Commit f188b8f4ad8e41bf715c5c8474629e9d62d00117
1 parent
8dae4cb3
线路档案整改内容
Showing
5 changed files
with
12067 additions
and
8 deletions
bsthLineProfiles/src/main/java/com/ruoyi/project/system/line/service/IBsthTSiteService.java
0 → 100644
bsthLineProfiles/src/main/java/com/ruoyi/project/system/line/service/impl/BsthTSiteImpl.java
0 → 100644
| 1 | +package com.ruoyi.project.system.line.service.impl; | ||
| 2 | + | ||
| 3 | + | ||
| 4 | +import com.ruoyi.project.system.line.domain.*; | ||
| 5 | +import com.ruoyi.project.system.line.mapper.BsthSiteMapper; | ||
| 6 | +import com.ruoyi.project.system.line.mapper.BsthTLineMapper; | ||
| 7 | +import com.ruoyi.project.system.line.service.IBsthTSiteService; | ||
| 8 | +import org.slf4j.Logger; | ||
| 9 | +import org.slf4j.LoggerFactory; | ||
| 10 | +import org.springframework.beans.factory.annotation.Autowired; | ||
| 11 | +import org.springframework.stereotype.Service; | ||
| 12 | +import java.util.*; | ||
| 13 | + | ||
| 14 | + | ||
| 15 | +@Service | ||
| 16 | +public class BsthTSiteImpl implements IBsthTSiteService | ||
| 17 | +{ | ||
| 18 | + @Autowired | ||
| 19 | + private BsthSiteMapper bsthSiteMapper; | ||
| 20 | + | ||
| 21 | + Logger logger = LoggerFactory.getLogger(BsthTSiteImpl.class); | ||
| 22 | + | ||
| 23 | + public List<BsthSite> selectBsthSite(){ | ||
| 24 | + return bsthSiteMapper.selectBsthSite(); | ||
| 25 | + } | ||
| 26 | + | ||
| 27 | +} |
bsthLineProfiles/src/main/resources/application-druid.yml
| @@ -5,15 +5,15 @@ spring: | @@ -5,15 +5,15 @@ spring: | ||
| 5 | driverClassName: com.mysql.cj.jdbc.Driver | 5 | driverClassName: com.mysql.cj.jdbc.Driver |
| 6 | druid: | 6 | druid: |
| 7 | # 主库数据源 | 7 | # 主库数据源 |
| 8 | - master: | ||
| 9 | - url: jdbc:mysql://192.168.101.111:3306/bsth_line_profiles?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 | ||
| 10 | - username: xldasys | ||
| 11 | - password: bsth@pj2021 | ||
| 12 | - # 主库数据源 | ||
| 13 | # master: | 8 | # master: |
| 14 | -# url: jdbc:mysql://localhost:3306/bsth_line_profiles?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 | ||
| 15 | -# username: root | ||
| 16 | -# password: 1995627a | 9 | +# url: jdbc:mysql://192.168.101.111:3306/bsth_line_profiles?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 |
| 10 | +# username: xldasys | ||
| 11 | +# password: bsth@pj2021 | ||
| 12 | + # 主库数据源 | ||
| 13 | + master: | ||
| 14 | + url: jdbc:mysql://localhost:3306/bsth_line_profiles?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 | ||
| 15 | + username: root | ||
| 16 | + password: 1995627a | ||
| 17 | # 从库数据源 | 17 | # 从库数据源 |
| 18 | slave: | 18 | slave: |
| 19 | # 从数据源开关/默认关闭 | 19 | # 从数据源开关/默认关闭 |
bsthLineProfiles/src/main/resources/static/ajax/libs/vue/vue.js
0 → 100644
| 1 | +/*! | ||
| 2 | + * Vue.js v2.6.14 | ||
| 3 | + * (c) 2014-2021 Evan You | ||
| 4 | + * Released under the MIT License. | ||
| 5 | + */ | ||
| 6 | +(function (global, factory) { | ||
| 7 | + typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : | ||
| 8 | + typeof define === 'function' && define.amd ? define(factory) : | ||
| 9 | + (global = global || self, global.Vue = factory()); | ||
| 10 | +}(this, function () { 'use strict'; | ||
| 11 | + | ||
| 12 | + /* */ | ||
| 13 | + | ||
| 14 | + var emptyObject = Object.freeze({}); | ||
| 15 | + | ||
| 16 | + // These helpers produce better VM code in JS engines due to their | ||
| 17 | + // explicitness and function inlining. | ||
| 18 | + function isUndef (v) { | ||
| 19 | + return v === undefined || v === null | ||
| 20 | + } | ||
| 21 | + | ||
| 22 | + function isDef (v) { | ||
| 23 | + return v !== undefined && v !== null | ||
| 24 | + } | ||
| 25 | + | ||
| 26 | + function isTrue (v) { | ||
| 27 | + return v === true | ||
| 28 | + } | ||
| 29 | + | ||
| 30 | + function isFalse (v) { | ||
| 31 | + return v === false | ||
| 32 | + } | ||
| 33 | + | ||
| 34 | + /** | ||
| 35 | + * Check if value is primitive. | ||
| 36 | + */ | ||
| 37 | + function isPrimitive (value) { | ||
| 38 | + return ( | ||
| 39 | + typeof value === 'string' || | ||
| 40 | + typeof value === 'number' || | ||
| 41 | + // $flow-disable-line | ||
| 42 | + typeof value === 'symbol' || | ||
| 43 | + typeof value === 'boolean' | ||
| 44 | + ) | ||
| 45 | + } | ||
| 46 | + | ||
| 47 | + /** | ||
| 48 | + * Quick object check - this is primarily used to tell | ||
| 49 | + * Objects from primitive values when we know the value | ||
| 50 | + * is a JSON-compliant type. | ||
| 51 | + */ | ||
| 52 | + function isObject (obj) { | ||
| 53 | + return obj !== null && typeof obj === 'object' | ||
| 54 | + } | ||
| 55 | + | ||
| 56 | + /** | ||
| 57 | + * Get the raw type string of a value, e.g., [object Object]. | ||
| 58 | + */ | ||
| 59 | + var _toString = Object.prototype.toString; | ||
| 60 | + | ||
| 61 | + function toRawType (value) { | ||
| 62 | + return _toString.call(value).slice(8, -1) | ||
| 63 | + } | ||
| 64 | + | ||
| 65 | + /** | ||
| 66 | + * Strict object type check. Only returns true | ||
| 67 | + * for plain JavaScript objects. | ||
| 68 | + */ | ||
| 69 | + function isPlainObject (obj) { | ||
| 70 | + return _toString.call(obj) === '[object Object]' | ||
| 71 | + } | ||
| 72 | + | ||
| 73 | + function isRegExp (v) { | ||
| 74 | + return _toString.call(v) === '[object RegExp]' | ||
| 75 | + } | ||
| 76 | + | ||
| 77 | + /** | ||
| 78 | + * Check if val is a valid array index. | ||
| 79 | + */ | ||
| 80 | + function isValidArrayIndex (val) { | ||
| 81 | + var n = parseFloat(String(val)); | ||
| 82 | + return n >= 0 && Math.floor(n) === n && isFinite(val) | ||
| 83 | + } | ||
| 84 | + | ||
| 85 | + function isPromise (val) { | ||
| 86 | + return ( | ||
| 87 | + isDef(val) && | ||
| 88 | + typeof val.then === 'function' && | ||
| 89 | + typeof val.catch === 'function' | ||
| 90 | + ) | ||
| 91 | + } | ||
| 92 | + | ||
| 93 | + /** | ||
| 94 | + * Convert a value to a string that is actually rendered. | ||
| 95 | + */ | ||
| 96 | + function toString (val) { | ||
| 97 | + return val == null | ||
| 98 | + ? '' | ||
| 99 | + : Array.isArray(val) || (isPlainObject(val) && val.toString === _toString) | ||
| 100 | + ? JSON.stringify(val, null, 2) | ||
| 101 | + : String(val) | ||
| 102 | + } | ||
| 103 | + | ||
| 104 | + /** | ||
| 105 | + * Convert an input value to a number for persistence. | ||
| 106 | + * If the conversion fails, return original string. | ||
| 107 | + */ | ||
| 108 | + function toNumber (val) { | ||
| 109 | + var n = parseFloat(val); | ||
| 110 | + return isNaN(n) ? val : n | ||
| 111 | + } | ||
| 112 | + | ||
| 113 | + /** | ||
| 114 | + * Make a map and return a function for checking if a key | ||
| 115 | + * is in that map. | ||
| 116 | + */ | ||
| 117 | + function makeMap ( | ||
| 118 | + str, | ||
| 119 | + expectsLowerCase | ||
| 120 | + ) { | ||
| 121 | + var map = Object.create(null); | ||
| 122 | + var list = str.split(','); | ||
| 123 | + for (var i = 0; i < list.length; i++) { | ||
| 124 | + map[list[i]] = true; | ||
| 125 | + } | ||
| 126 | + return expectsLowerCase | ||
| 127 | + ? function (val) { return map[val.toLowerCase()]; } | ||
| 128 | + : function (val) { return map[val]; } | ||
| 129 | + } | ||
| 130 | + | ||
| 131 | + /** | ||
| 132 | + * Check if a tag is a built-in tag. | ||
| 133 | + */ | ||
| 134 | + var isBuiltInTag = makeMap('slot,component', true); | ||
| 135 | + | ||
| 136 | + /** | ||
| 137 | + * Check if an attribute is a reserved attribute. | ||
| 138 | + */ | ||
| 139 | + var isReservedAttribute = makeMap('key,ref,slot,slot-scope,is'); | ||
| 140 | + | ||
| 141 | + /** | ||
| 142 | + * Remove an item from an array. | ||
| 143 | + */ | ||
| 144 | + function remove (arr, item) { | ||
| 145 | + if (arr.length) { | ||
| 146 | + var index = arr.indexOf(item); | ||
| 147 | + if (index > -1) { | ||
| 148 | + return arr.splice(index, 1) | ||
| 149 | + } | ||
| 150 | + } | ||
| 151 | + } | ||
| 152 | + | ||
| 153 | + /** | ||
| 154 | + * Check whether an object has the property. | ||
| 155 | + */ | ||
| 156 | + var hasOwnProperty = Object.prototype.hasOwnProperty; | ||
| 157 | + function hasOwn (obj, key) { | ||
| 158 | + return hasOwnProperty.call(obj, key) | ||
| 159 | + } | ||
| 160 | + | ||
| 161 | + /** | ||
| 162 | + * Create a cached version of a pure function. | ||
| 163 | + */ | ||
| 164 | + function cached (fn) { | ||
| 165 | + var cache = Object.create(null); | ||
| 166 | + return (function cachedFn (str) { | ||
| 167 | + var hit = cache[str]; | ||
| 168 | + return hit || (cache[str] = fn(str)) | ||
| 169 | + }) | ||
| 170 | + } | ||
| 171 | + | ||
| 172 | + /** | ||
| 173 | + * Camelize a hyphen-delimited string. | ||
| 174 | + */ | ||
| 175 | + var camelizeRE = /-(\w)/g; | ||
| 176 | + var camelize = cached(function (str) { | ||
| 177 | + return str.replace(camelizeRE, function (_, c) { return c ? c.toUpperCase() : ''; }) | ||
| 178 | + }); | ||
| 179 | + | ||
| 180 | + /** | ||
| 181 | + * Capitalize a string. | ||
| 182 | + */ | ||
| 183 | + var capitalize = cached(function (str) { | ||
| 184 | + return str.charAt(0).toUpperCase() + str.slice(1) | ||
| 185 | + }); | ||
| 186 | + | ||
| 187 | + /** | ||
| 188 | + * Hyphenate a camelCase string. | ||
| 189 | + */ | ||
| 190 | + var hyphenateRE = /\B([A-Z])/g; | ||
| 191 | + var hyphenate = cached(function (str) { | ||
| 192 | + return str.replace(hyphenateRE, '-$1').toLowerCase() | ||
| 193 | + }); | ||
| 194 | + | ||
| 195 | + /** | ||
| 196 | + * Simple bind polyfill for environments that do not support it, | ||
| 197 | + * e.g., PhantomJS 1.x. Technically, we don't need this anymore | ||
| 198 | + * since native bind is now performant enough in most browsers. | ||
| 199 | + * But removing it would mean breaking code that was able to run in | ||
| 200 | + * PhantomJS 1.x, so this must be kept for backward compatibility. | ||
| 201 | + */ | ||
| 202 | + | ||
| 203 | + /* istanbul ignore next */ | ||
| 204 | + function polyfillBind (fn, ctx) { | ||
| 205 | + function boundFn (a) { | ||
| 206 | + var l = arguments.length; | ||
| 207 | + return l | ||
| 208 | + ? l > 1 | ||
| 209 | + ? fn.apply(ctx, arguments) | ||
| 210 | + : fn.call(ctx, a) | ||
| 211 | + : fn.call(ctx) | ||
| 212 | + } | ||
| 213 | + | ||
| 214 | + boundFn._length = fn.length; | ||
| 215 | + return boundFn | ||
| 216 | + } | ||
| 217 | + | ||
| 218 | + function nativeBind (fn, ctx) { | ||
| 219 | + return fn.bind(ctx) | ||
| 220 | + } | ||
| 221 | + | ||
| 222 | + var bind = Function.prototype.bind | ||
| 223 | + ? nativeBind | ||
| 224 | + : polyfillBind; | ||
| 225 | + | ||
| 226 | + /** | ||
| 227 | + * Convert an Array-like object to a real Array. | ||
| 228 | + */ | ||
| 229 | + function toArray (list, start) { | ||
| 230 | + start = start || 0; | ||
| 231 | + var i = list.length - start; | ||
| 232 | + var ret = new Array(i); | ||
| 233 | + while (i--) { | ||
| 234 | + ret[i] = list[i + start]; | ||
| 235 | + } | ||
| 236 | + return ret | ||
| 237 | + } | ||
| 238 | + | ||
| 239 | + /** | ||
| 240 | + * Mix properties into target object. | ||
| 241 | + */ | ||
| 242 | + function extend (to, _from) { | ||
| 243 | + for (var key in _from) { | ||
| 244 | + to[key] = _from[key]; | ||
| 245 | + } | ||
| 246 | + return to | ||
| 247 | + } | ||
| 248 | + | ||
| 249 | + /** | ||
| 250 | + * Merge an Array of Objects into a single Object. | ||
| 251 | + */ | ||
| 252 | + function toObject (arr) { | ||
| 253 | + var res = {}; | ||
| 254 | + for (var i = 0; i < arr.length; i++) { | ||
| 255 | + if (arr[i]) { | ||
| 256 | + extend(res, arr[i]); | ||
| 257 | + } | ||
| 258 | + } | ||
| 259 | + return res | ||
| 260 | + } | ||
| 261 | + | ||
| 262 | + /* eslint-disable no-unused-vars */ | ||
| 263 | + | ||
| 264 | + /** | ||
| 265 | + * Perform no operation. | ||
| 266 | + * Stubbing args to make Flow happy without leaving useless transpiled code | ||
| 267 | + * with ...rest (https://flow.org/blog/2017/05/07/Strict-Function-Call-Arity/). | ||
| 268 | + */ | ||
| 269 | + function noop (a, b, c) {} | ||
| 270 | + | ||
| 271 | + /** | ||
| 272 | + * Always return false. | ||
| 273 | + */ | ||
| 274 | + var no = function (a, b, c) { return false; }; | ||
| 275 | + | ||
| 276 | + /* eslint-enable no-unused-vars */ | ||
| 277 | + | ||
| 278 | + /** | ||
| 279 | + * Return the same value. | ||
| 280 | + */ | ||
| 281 | + var identity = function (_) { return _; }; | ||
| 282 | + | ||
| 283 | + /** | ||
| 284 | + * Generate a string containing static keys from compiler modules. | ||
| 285 | + */ | ||
| 286 | + function genStaticKeys (modules) { | ||
| 287 | + return modules.reduce(function (keys, m) { | ||
| 288 | + return keys.concat(m.staticKeys || []) | ||
| 289 | + }, []).join(',') | ||
| 290 | + } | ||
| 291 | + | ||
| 292 | + /** | ||
| 293 | + * Check if two values are loosely equal - that is, | ||
| 294 | + * if they are plain objects, do they have the same shape? | ||
| 295 | + */ | ||
| 296 | + function looseEqual (a, b) { | ||
| 297 | + if (a === b) { return true } | ||
| 298 | + var isObjectA = isObject(a); | ||
| 299 | + var isObjectB = isObject(b); | ||
| 300 | + if (isObjectA && isObjectB) { | ||
| 301 | + try { | ||
| 302 | + var isArrayA = Array.isArray(a); | ||
| 303 | + var isArrayB = Array.isArray(b); | ||
| 304 | + if (isArrayA && isArrayB) { | ||
| 305 | + return a.length === b.length && a.every(function (e, i) { | ||
| 306 | + return looseEqual(e, b[i]) | ||
| 307 | + }) | ||
| 308 | + } else if (a instanceof Date && b instanceof Date) { | ||
| 309 | + return a.getTime() === b.getTime() | ||
| 310 | + } else if (!isArrayA && !isArrayB) { | ||
| 311 | + var keysA = Object.keys(a); | ||
| 312 | + var keysB = Object.keys(b); | ||
| 313 | + return keysA.length === keysB.length && keysA.every(function (key) { | ||
| 314 | + return looseEqual(a[key], b[key]) | ||
| 315 | + }) | ||
| 316 | + } else { | ||
| 317 | + /* istanbul ignore next */ | ||
| 318 | + return false | ||
| 319 | + } | ||
| 320 | + } catch (e) { | ||
| 321 | + /* istanbul ignore next */ | ||
| 322 | + return false | ||
| 323 | + } | ||
| 324 | + } else if (!isObjectA && !isObjectB) { | ||
| 325 | + return String(a) === String(b) | ||
| 326 | + } else { | ||
| 327 | + return false | ||
| 328 | + } | ||
| 329 | + } | ||
| 330 | + | ||
| 331 | + /** | ||
| 332 | + * Return the first index at which a loosely equal value can be | ||
| 333 | + * found in the array (if value is a plain object, the array must | ||
| 334 | + * contain an object of the same shape), or -1 if it is not present. | ||
| 335 | + */ | ||
| 336 | + function looseIndexOf (arr, val) { | ||
| 337 | + for (var i = 0; i < arr.length; i++) { | ||
| 338 | + if (looseEqual(arr[i], val)) { return i } | ||
| 339 | + } | ||
| 340 | + return -1 | ||
| 341 | + } | ||
| 342 | + | ||
| 343 | + /** | ||
| 344 | + * Ensure a function is called only once. | ||
| 345 | + */ | ||
| 346 | + function once (fn) { | ||
| 347 | + var called = false; | ||
| 348 | + return function () { | ||
| 349 | + if (!called) { | ||
| 350 | + called = true; | ||
| 351 | + fn.apply(this, arguments); | ||
| 352 | + } | ||
| 353 | + } | ||
| 354 | + } | ||
| 355 | + | ||
| 356 | + var SSR_ATTR = 'data-server-rendered'; | ||
| 357 | + | ||
| 358 | + var ASSET_TYPES = [ | ||
| 359 | + 'component', | ||
| 360 | + 'directive', | ||
| 361 | + 'filter' | ||
| 362 | + ]; | ||
| 363 | + | ||
| 364 | + var LIFECYCLE_HOOKS = [ | ||
| 365 | + 'beforeCreate', | ||
| 366 | + 'created', | ||
| 367 | + 'beforeMount', | ||
| 368 | + 'mounted', | ||
| 369 | + 'beforeUpdate', | ||
| 370 | + 'updated', | ||
| 371 | + 'beforeDestroy', | ||
| 372 | + 'destroyed', | ||
| 373 | + 'activated', | ||
| 374 | + 'deactivated', | ||
| 375 | + 'errorCaptured', | ||
| 376 | + 'serverPrefetch' | ||
| 377 | + ]; | ||
| 378 | + | ||
| 379 | + /* */ | ||
| 380 | + | ||
| 381 | + | ||
| 382 | + | ||
| 383 | + var config = ({ | ||
| 384 | + /** | ||
| 385 | + * Option merge strategies (used in core/util/options) | ||
| 386 | + */ | ||
| 387 | + // $flow-disable-line | ||
| 388 | + optionMergeStrategies: Object.create(null), | ||
| 389 | + | ||
| 390 | + /** | ||
| 391 | + * Whether to suppress warnings. | ||
| 392 | + */ | ||
| 393 | + silent: false, | ||
| 394 | + | ||
| 395 | + /** | ||
| 396 | + * Show production mode tip message on boot? | ||
| 397 | + */ | ||
| 398 | + productionTip: "development" !== 'production', | ||
| 399 | + | ||
| 400 | + /** | ||
| 401 | + * Whether to enable devtools | ||
| 402 | + */ | ||
| 403 | + devtools: "development" !== 'production', | ||
| 404 | + | ||
| 405 | + /** | ||
| 406 | + * Whether to record perf | ||
| 407 | + */ | ||
| 408 | + performance: false, | ||
| 409 | + | ||
| 410 | + /** | ||
| 411 | + * Error handler for watcher errors | ||
| 412 | + */ | ||
| 413 | + errorHandler: null, | ||
| 414 | + | ||
| 415 | + /** | ||
| 416 | + * Warn handler for watcher warns | ||
| 417 | + */ | ||
| 418 | + warnHandler: null, | ||
| 419 | + | ||
| 420 | + /** | ||
| 421 | + * Ignore certain custom elements | ||
| 422 | + */ | ||
| 423 | + ignoredElements: [], | ||
| 424 | + | ||
| 425 | + /** | ||
| 426 | + * Custom user key aliases for v-on | ||
| 427 | + */ | ||
| 428 | + // $flow-disable-line | ||
| 429 | + keyCodes: Object.create(null), | ||
| 430 | + | ||
| 431 | + /** | ||
| 432 | + * Check if a tag is reserved so that it cannot be registered as a | ||
| 433 | + * component. This is platform-dependent and may be overwritten. | ||
| 434 | + */ | ||
| 435 | + isReservedTag: no, | ||
| 436 | + | ||
| 437 | + /** | ||
| 438 | + * Check if an attribute is reserved so that it cannot be used as a component | ||
| 439 | + * prop. This is platform-dependent and may be overwritten. | ||
| 440 | + */ | ||
| 441 | + isReservedAttr: no, | ||
| 442 | + | ||
| 443 | + /** | ||
| 444 | + * Check if a tag is an unknown element. | ||
| 445 | + * Platform-dependent. | ||
| 446 | + */ | ||
| 447 | + isUnknownElement: no, | ||
| 448 | + | ||
| 449 | + /** | ||
| 450 | + * Get the namespace of an element | ||
| 451 | + */ | ||
| 452 | + getTagNamespace: noop, | ||
| 453 | + | ||
| 454 | + /** | ||
| 455 | + * Parse the real tag name for the specific platform. | ||
| 456 | + */ | ||
| 457 | + parsePlatformTagName: identity, | ||
| 458 | + | ||
| 459 | + /** | ||
| 460 | + * Check if an attribute must be bound using property, e.g. value | ||
| 461 | + * Platform-dependent. | ||
| 462 | + */ | ||
| 463 | + mustUseProp: no, | ||
| 464 | + | ||
| 465 | + /** | ||
| 466 | + * Perform updates asynchronously. Intended to be used by Vue Test Utils | ||
| 467 | + * This will significantly reduce performance if set to false. | ||
| 468 | + */ | ||
| 469 | + async: true, | ||
| 470 | + | ||
| 471 | + /** | ||
| 472 | + * Exposed for legacy reasons | ||
| 473 | + */ | ||
| 474 | + _lifecycleHooks: LIFECYCLE_HOOKS | ||
| 475 | + }); | ||
| 476 | + | ||
| 477 | + /* */ | ||
| 478 | + | ||
| 479 | + /** | ||
| 480 | + * unicode letters used for parsing html tags, component names and property paths. | ||
| 481 | + * using https://www.w3.org/TR/html53/semantics-scripting.html#potentialcustomelementname | ||
| 482 | + * skipping \u10000-\uEFFFF due to it freezing up PhantomJS | ||
| 483 | + */ | ||
| 484 | + var unicodeRegExp = /a-zA-Z\u00B7\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u037D\u037F-\u1FFF\u200C-\u200D\u203F-\u2040\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD/; | ||
| 485 | + | ||
| 486 | + /** | ||
| 487 | + * Check if a string starts with $ or _ | ||
| 488 | + */ | ||
| 489 | + function isReserved (str) { | ||
| 490 | + var c = (str + '').charCodeAt(0); | ||
| 491 | + return c === 0x24 || c === 0x5F | ||
| 492 | + } | ||
| 493 | + | ||
| 494 | + /** | ||
| 495 | + * Define a property. | ||
| 496 | + */ | ||
| 497 | + function def (obj, key, val, enumerable) { | ||
| 498 | + Object.defineProperty(obj, key, { | ||
| 499 | + value: val, | ||
| 500 | + enumerable: !!enumerable, | ||
| 501 | + writable: true, | ||
| 502 | + configurable: true | ||
| 503 | + }); | ||
| 504 | + } | ||
| 505 | + | ||
| 506 | + /** | ||
| 507 | + * Parse simple path. | ||
| 508 | + */ | ||
| 509 | + var bailRE = new RegExp(("[^" + (unicodeRegExp.source) + ".$_\\d]")); | ||
| 510 | + function parsePath (path) { | ||
| 511 | + if (bailRE.test(path)) { | ||
| 512 | + return | ||
| 513 | + } | ||
| 514 | + var segments = path.split('.'); | ||
| 515 | + return function (obj) { | ||
| 516 | + for (var i = 0; i < segments.length; i++) { | ||
| 517 | + if (!obj) { return } | ||
| 518 | + obj = obj[segments[i]]; | ||
| 519 | + } | ||
| 520 | + return obj | ||
| 521 | + } | ||
| 522 | + } | ||
| 523 | + | ||
| 524 | + /* */ | ||
| 525 | + | ||
| 526 | + // can we use __proto__? | ||
| 527 | + var hasProto = '__proto__' in {}; | ||
| 528 | + | ||
| 529 | + // Browser environment sniffing | ||
| 530 | + var inBrowser = typeof window !== 'undefined'; | ||
| 531 | + var inWeex = typeof WXEnvironment !== 'undefined' && !!WXEnvironment.platform; | ||
| 532 | + var weexPlatform = inWeex && WXEnvironment.platform.toLowerCase(); | ||
| 533 | + var UA = inBrowser && window.navigator.userAgent.toLowerCase(); | ||
| 534 | + var isIE = UA && /msie|trident/.test(UA); | ||
| 535 | + var isIE9 = UA && UA.indexOf('msie 9.0') > 0; | ||
| 536 | + var isEdge = UA && UA.indexOf('edge/') > 0; | ||
| 537 | + var isAndroid = (UA && UA.indexOf('android') > 0) || (weexPlatform === 'android'); | ||
| 538 | + var isIOS = (UA && /iphone|ipad|ipod|ios/.test(UA)) || (weexPlatform === 'ios'); | ||
| 539 | + var isChrome = UA && /chrome\/\d+/.test(UA) && !isEdge; | ||
| 540 | + var isPhantomJS = UA && /phantomjs/.test(UA); | ||
| 541 | + var isFF = UA && UA.match(/firefox\/(\d+)/); | ||
| 542 | + | ||
| 543 | + // Firefox has a "watch" function on Object.prototype... | ||
| 544 | + var nativeWatch = ({}).watch; | ||
| 545 | + | ||
| 546 | + var supportsPassive = false; | ||
| 547 | + if (inBrowser) { | ||
| 548 | + try { | ||
| 549 | + var opts = {}; | ||
| 550 | + Object.defineProperty(opts, 'passive', ({ | ||
| 551 | + get: function get () { | ||
| 552 | + /* istanbul ignore next */ | ||
| 553 | + supportsPassive = true; | ||
| 554 | + } | ||
| 555 | + })); // https://github.com/facebook/flow/issues/285 | ||
| 556 | + window.addEventListener('test-passive', null, opts); | ||
| 557 | + } catch (e) {} | ||
| 558 | + } | ||
| 559 | + | ||
| 560 | + // this needs to be lazy-evaled because vue may be required before | ||
| 561 | + // vue-server-renderer can set VUE_ENV | ||
| 562 | + var _isServer; | ||
| 563 | + var isServerRendering = function () { | ||
| 564 | + if (_isServer === undefined) { | ||
| 565 | + /* istanbul ignore if */ | ||
| 566 | + if (!inBrowser && !inWeex && typeof global !== 'undefined') { | ||
| 567 | + // detect presence of vue-server-renderer and avoid | ||
| 568 | + // Webpack shimming the process | ||
| 569 | + _isServer = global['process'] && global['process'].env.VUE_ENV === 'server'; | ||
| 570 | + } else { | ||
| 571 | + _isServer = false; | ||
| 572 | + } | ||
| 573 | + } | ||
| 574 | + return _isServer | ||
| 575 | + }; | ||
| 576 | + | ||
| 577 | + // detect devtools | ||
| 578 | + var devtools = inBrowser && window.__VUE_DEVTOOLS_GLOBAL_HOOK__; | ||
| 579 | + | ||
| 580 | + /* istanbul ignore next */ | ||
| 581 | + function isNative (Ctor) { | ||
| 582 | + return typeof Ctor === 'function' && /native code/.test(Ctor.toString()) | ||
| 583 | + } | ||
| 584 | + | ||
| 585 | + var hasSymbol = | ||
| 586 | + typeof Symbol !== 'undefined' && isNative(Symbol) && | ||
| 587 | + typeof Reflect !== 'undefined' && isNative(Reflect.ownKeys); | ||
| 588 | + | ||
| 589 | + var _Set; | ||
| 590 | + /* istanbul ignore if */ // $flow-disable-line | ||
| 591 | + if (typeof Set !== 'undefined' && isNative(Set)) { | ||
| 592 | + // use native Set when available. | ||
| 593 | + _Set = Set; | ||
| 594 | + } else { | ||
| 595 | + // a non-standard Set polyfill that only works with primitive keys. | ||
| 596 | + _Set = /*@__PURE__*/(function () { | ||
| 597 | + function Set () { | ||
| 598 | + this.set = Object.create(null); | ||
| 599 | + } | ||
| 600 | + Set.prototype.has = function has (key) { | ||
| 601 | + return this.set[key] === true | ||
| 602 | + }; | ||
| 603 | + Set.prototype.add = function add (key) { | ||
| 604 | + this.set[key] = true; | ||
| 605 | + }; | ||
| 606 | + Set.prototype.clear = function clear () { | ||
| 607 | + this.set = Object.create(null); | ||
| 608 | + }; | ||
| 609 | + | ||
| 610 | + return Set; | ||
| 611 | + }()); | ||
| 612 | + } | ||
| 613 | + | ||
| 614 | + /* */ | ||
| 615 | + | ||
| 616 | + var warn = noop; | ||
| 617 | + var tip = noop; | ||
| 618 | + var generateComponentTrace = (noop); // work around flow check | ||
| 619 | + var formatComponentName = (noop); | ||
| 620 | + | ||
| 621 | + { | ||
| 622 | + var hasConsole = typeof console !== 'undefined'; | ||
| 623 | + var classifyRE = /(?:^|[-_])(\w)/g; | ||
| 624 | + var classify = function (str) { return str | ||
| 625 | + .replace(classifyRE, function (c) { return c.toUpperCase(); }) | ||
| 626 | + .replace(/[-_]/g, ''); }; | ||
| 627 | + | ||
| 628 | + warn = function (msg, vm) { | ||
| 629 | + var trace = vm ? generateComponentTrace(vm) : ''; | ||
| 630 | + | ||
| 631 | + if (config.warnHandler) { | ||
| 632 | + config.warnHandler.call(null, msg, vm, trace); | ||
| 633 | + } else if (hasConsole && (!config.silent)) { | ||
| 634 | + console.error(("[Vue warn]: " + msg + trace)); | ||
| 635 | + } | ||
| 636 | + }; | ||
| 637 | + | ||
| 638 | + tip = function (msg, vm) { | ||
| 639 | + if (hasConsole && (!config.silent)) { | ||
| 640 | + console.warn("[Vue tip]: " + msg + ( | ||
| 641 | + vm ? generateComponentTrace(vm) : '' | ||
| 642 | + )); | ||
| 643 | + } | ||
| 644 | + }; | ||
| 645 | + | ||
| 646 | + formatComponentName = function (vm, includeFile) { | ||
| 647 | + if (vm.$root === vm) { | ||
| 648 | + return '<Root>' | ||
| 649 | + } | ||
| 650 | + var options = typeof vm === 'function' && vm.cid != null | ||
| 651 | + ? vm.options | ||
| 652 | + : vm._isVue | ||
| 653 | + ? vm.$options || vm.constructor.options | ||
| 654 | + : vm; | ||
| 655 | + var name = options.name || options._componentTag; | ||
| 656 | + var file = options.__file; | ||
| 657 | + if (!name && file) { | ||
| 658 | + var match = file.match(/([^/\\]+)\.vue$/); | ||
| 659 | + name = match && match[1]; | ||
| 660 | + } | ||
| 661 | + | ||
| 662 | + return ( | ||
| 663 | + (name ? ("<" + (classify(name)) + ">") : "<Anonymous>") + | ||
| 664 | + (file && includeFile !== false ? (" at " + file) : '') | ||
| 665 | + ) | ||
| 666 | + }; | ||
| 667 | + | ||
| 668 | + var repeat = function (str, n) { | ||
| 669 | + var res = ''; | ||
| 670 | + while (n) { | ||
| 671 | + if (n % 2 === 1) { res += str; } | ||
| 672 | + if (n > 1) { str += str; } | ||
| 673 | + n >>= 1; | ||
| 674 | + } | ||
| 675 | + return res | ||
| 676 | + }; | ||
| 677 | + | ||
| 678 | + generateComponentTrace = function (vm) { | ||
| 679 | + if (vm._isVue && vm.$parent) { | ||
| 680 | + var tree = []; | ||
| 681 | + var currentRecursiveSequence = 0; | ||
| 682 | + while (vm) { | ||
| 683 | + if (tree.length > 0) { | ||
| 684 | + var last = tree[tree.length - 1]; | ||
| 685 | + if (last.constructor === vm.constructor) { | ||
| 686 | + currentRecursiveSequence++; | ||
| 687 | + vm = vm.$parent; | ||
| 688 | + continue | ||
| 689 | + } else if (currentRecursiveSequence > 0) { | ||
| 690 | + tree[tree.length - 1] = [last, currentRecursiveSequence]; | ||
| 691 | + currentRecursiveSequence = 0; | ||
| 692 | + } | ||
| 693 | + } | ||
| 694 | + tree.push(vm); | ||
| 695 | + vm = vm.$parent; | ||
| 696 | + } | ||
| 697 | + return '\n\nfound in\n\n' + tree | ||
| 698 | + .map(function (vm, i) { return ("" + (i === 0 ? '---> ' : repeat(' ', 5 + i * 2)) + (Array.isArray(vm) | ||
| 699 | + ? ((formatComponentName(vm[0])) + "... (" + (vm[1]) + " recursive calls)") | ||
| 700 | + : formatComponentName(vm))); }) | ||
| 701 | + .join('\n') | ||
| 702 | + } else { | ||
| 703 | + return ("\n\n(found in " + (formatComponentName(vm)) + ")") | ||
| 704 | + } | ||
| 705 | + }; | ||
| 706 | + } | ||
| 707 | + | ||
| 708 | + /* */ | ||
| 709 | + | ||
| 710 | + var uid = 0; | ||
| 711 | + | ||
| 712 | + /** | ||
| 713 | + * A dep is an observable that can have multiple | ||
| 714 | + * directives subscribing to it. | ||
| 715 | + */ | ||
| 716 | + var Dep = function Dep () { | ||
| 717 | + this.id = uid++; | ||
| 718 | + this.subs = []; | ||
| 719 | + }; | ||
| 720 | + | ||
| 721 | + Dep.prototype.addSub = function addSub (sub) { | ||
| 722 | + this.subs.push(sub); | ||
| 723 | + }; | ||
| 724 | + | ||
| 725 | + Dep.prototype.removeSub = function removeSub (sub) { | ||
| 726 | + remove(this.subs, sub); | ||
| 727 | + }; | ||
| 728 | + | ||
| 729 | + Dep.prototype.depend = function depend () { | ||
| 730 | + if (Dep.target) { | ||
| 731 | + Dep.target.addDep(this); | ||
| 732 | + } | ||
| 733 | + }; | ||
| 734 | + | ||
| 735 | + Dep.prototype.notify = function notify () { | ||
| 736 | + // stabilize the subscriber list first | ||
| 737 | + var subs = this.subs.slice(); | ||
| 738 | + if (!config.async) { | ||
| 739 | + // subs aren't sorted in scheduler if not running async | ||
| 740 | + // we need to sort them now to make sure they fire in correct | ||
| 741 | + // order | ||
| 742 | + subs.sort(function (a, b) { return a.id - b.id; }); | ||
| 743 | + } | ||
| 744 | + for (var i = 0, l = subs.length; i < l; i++) { | ||
| 745 | + subs[i].update(); | ||
| 746 | + } | ||
| 747 | + }; | ||
| 748 | + | ||
| 749 | + // The current target watcher being evaluated. | ||
| 750 | + // This is globally unique because only one watcher | ||
| 751 | + // can be evaluated at a time. | ||
| 752 | + Dep.target = null; | ||
| 753 | + var targetStack = []; | ||
| 754 | + | ||
| 755 | + function pushTarget (target) { | ||
| 756 | + targetStack.push(target); | ||
| 757 | + Dep.target = target; | ||
| 758 | + } | ||
| 759 | + | ||
| 760 | + function popTarget () { | ||
| 761 | + targetStack.pop(); | ||
| 762 | + Dep.target = targetStack[targetStack.length - 1]; | ||
| 763 | + } | ||
| 764 | + | ||
| 765 | + /* */ | ||
| 766 | + | ||
| 767 | + var VNode = function VNode ( | ||
| 768 | + tag, | ||
| 769 | + data, | ||
| 770 | + children, | ||
| 771 | + text, | ||
| 772 | + elm, | ||
| 773 | + context, | ||
| 774 | + componentOptions, | ||
| 775 | + asyncFactory | ||
| 776 | + ) { | ||
| 777 | + this.tag = tag; | ||
| 778 | + this.data = data; | ||
| 779 | + this.children = children; | ||
| 780 | + this.text = text; | ||
| 781 | + this.elm = elm; | ||
| 782 | + this.ns = undefined; | ||
| 783 | + this.context = context; | ||
| 784 | + this.fnContext = undefined; | ||
| 785 | + this.fnOptions = undefined; | ||
| 786 | + this.fnScopeId = undefined; | ||
| 787 | + this.key = data && data.key; | ||
| 788 | + this.componentOptions = componentOptions; | ||
| 789 | + this.componentInstance = undefined; | ||
| 790 | + this.parent = undefined; | ||
| 791 | + this.raw = false; | ||
| 792 | + this.isStatic = false; | ||
| 793 | + this.isRootInsert = true; | ||
| 794 | + this.isComment = false; | ||
| 795 | + this.isCloned = false; | ||
| 796 | + this.isOnce = false; | ||
| 797 | + this.asyncFactory = asyncFactory; | ||
| 798 | + this.asyncMeta = undefined; | ||
| 799 | + this.isAsyncPlaceholder = false; | ||
| 800 | + }; | ||
| 801 | + | ||
| 802 | + var prototypeAccessors = { child: { configurable: true } }; | ||
| 803 | + | ||
| 804 | + // DEPRECATED: alias for componentInstance for backwards compat. | ||
| 805 | + /* istanbul ignore next */ | ||
| 806 | + prototypeAccessors.child.get = function () { | ||
| 807 | + return this.componentInstance | ||
| 808 | + }; | ||
| 809 | + | ||
| 810 | + Object.defineProperties( VNode.prototype, prototypeAccessors ); | ||
| 811 | + | ||
| 812 | + var createEmptyVNode = function (text) { | ||
| 813 | + if ( text === void 0 ) text = ''; | ||
| 814 | + | ||
| 815 | + var node = new VNode(); | ||
| 816 | + node.text = text; | ||
| 817 | + node.isComment = true; | ||
| 818 | + return node | ||
| 819 | + }; | ||
| 820 | + | ||
| 821 | + function createTextVNode (val) { | ||
| 822 | + return new VNode(undefined, undefined, undefined, String(val)) | ||
| 823 | + } | ||
| 824 | + | ||
| 825 | + // optimized shallow clone | ||
| 826 | + // used for static nodes and slot nodes because they may be reused across | ||
| 827 | + // multiple renders, cloning them avoids errors when DOM manipulations rely | ||
| 828 | + // on their elm reference. | ||
| 829 | + function cloneVNode (vnode) { | ||
| 830 | + var cloned = new VNode( | ||
| 831 | + vnode.tag, | ||
| 832 | + vnode.data, | ||
| 833 | + // #7975 | ||
| 834 | + // clone children array to avoid mutating original in case of cloning | ||
| 835 | + // a child. | ||
| 836 | + vnode.children && vnode.children.slice(), | ||
| 837 | + vnode.text, | ||
| 838 | + vnode.elm, | ||
| 839 | + vnode.context, | ||
| 840 | + vnode.componentOptions, | ||
| 841 | + vnode.asyncFactory | ||
| 842 | + ); | ||
| 843 | + cloned.ns = vnode.ns; | ||
| 844 | + cloned.isStatic = vnode.isStatic; | ||
| 845 | + cloned.key = vnode.key; | ||
| 846 | + cloned.isComment = vnode.isComment; | ||
| 847 | + cloned.fnContext = vnode.fnContext; | ||
| 848 | + cloned.fnOptions = vnode.fnOptions; | ||
| 849 | + cloned.fnScopeId = vnode.fnScopeId; | ||
| 850 | + cloned.asyncMeta = vnode.asyncMeta; | ||
| 851 | + cloned.isCloned = true; | ||
| 852 | + return cloned | ||
| 853 | + } | ||
| 854 | + | ||
| 855 | + /* | ||
| 856 | + * not type checking this file because flow doesn't play well with | ||
| 857 | + * dynamically accessing methods on Array prototype | ||
| 858 | + */ | ||
| 859 | + | ||
| 860 | + var arrayProto = Array.prototype; | ||
| 861 | + var arrayMethods = Object.create(arrayProto); | ||
| 862 | + | ||
| 863 | + var methodsToPatch = [ | ||
| 864 | + 'push', | ||
| 865 | + 'pop', | ||
| 866 | + 'shift', | ||
| 867 | + 'unshift', | ||
| 868 | + 'splice', | ||
| 869 | + 'sort', | ||
| 870 | + 'reverse' | ||
| 871 | + ]; | ||
| 872 | + | ||
| 873 | + /** | ||
| 874 | + * Intercept mutating methods and emit events | ||
| 875 | + */ | ||
| 876 | + methodsToPatch.forEach(function (method) { | ||
| 877 | + // cache original method | ||
| 878 | + var original = arrayProto[method]; | ||
| 879 | + def(arrayMethods, method, function mutator () { | ||
| 880 | + var args = [], len = arguments.length; | ||
| 881 | + while ( len-- ) args[ len ] = arguments[ len ]; | ||
| 882 | + | ||
| 883 | + var result = original.apply(this, args); | ||
| 884 | + var ob = this.__ob__; | ||
| 885 | + var inserted; | ||
| 886 | + switch (method) { | ||
| 887 | + case 'push': | ||
| 888 | + case 'unshift': | ||
| 889 | + inserted = args; | ||
| 890 | + break | ||
| 891 | + case 'splice': | ||
| 892 | + inserted = args.slice(2); | ||
| 893 | + break | ||
| 894 | + } | ||
| 895 | + if (inserted) { ob.observeArray(inserted); } | ||
| 896 | + // notify change | ||
| 897 | + ob.dep.notify(); | ||
| 898 | + return result | ||
| 899 | + }); | ||
| 900 | + }); | ||
| 901 | + | ||
| 902 | + /* */ | ||
| 903 | + | ||
| 904 | + var arrayKeys = Object.getOwnPropertyNames(arrayMethods); | ||
| 905 | + | ||
| 906 | + /** | ||
| 907 | + * In some cases we may want to disable observation inside a component's | ||
| 908 | + * update computation. | ||
| 909 | + */ | ||
| 910 | + var shouldObserve = true; | ||
| 911 | + | ||
| 912 | + function toggleObserving (value) { | ||
| 913 | + shouldObserve = value; | ||
| 914 | + } | ||
| 915 | + | ||
| 916 | + /** | ||
| 917 | + * Observer class that is attached to each observed | ||
| 918 | + * object. Once attached, the observer converts the target | ||
| 919 | + * object's property keys into getter/setters that | ||
| 920 | + * collect dependencies and dispatch updates. | ||
| 921 | + */ | ||
| 922 | + var Observer = function Observer (value) { | ||
| 923 | + this.value = value; | ||
| 924 | + this.dep = new Dep(); | ||
| 925 | + this.vmCount = 0; | ||
| 926 | + def(value, '__ob__', this); | ||
| 927 | + if (Array.isArray(value)) { | ||
| 928 | + if (hasProto) { | ||
| 929 | + protoAugment(value, arrayMethods); | ||
| 930 | + } else { | ||
| 931 | + copyAugment(value, arrayMethods, arrayKeys); | ||
| 932 | + } | ||
| 933 | + this.observeArray(value); | ||
| 934 | + } else { | ||
| 935 | + this.walk(value); | ||
| 936 | + } | ||
| 937 | + }; | ||
| 938 | + | ||
| 939 | + /** | ||
| 940 | + * Walk through all properties and convert them into | ||
| 941 | + * getter/setters. This method should only be called when | ||
| 942 | + * value type is Object. | ||
| 943 | + */ | ||
| 944 | + Observer.prototype.walk = function walk (obj) { | ||
| 945 | + var keys = Object.keys(obj); | ||
| 946 | + for (var i = 0; i < keys.length; i++) { | ||
| 947 | + defineReactive$$1(obj, keys[i]); | ||
| 948 | + } | ||
| 949 | + }; | ||
| 950 | + | ||
| 951 | + /** | ||
| 952 | + * Observe a list of Array items. | ||
| 953 | + */ | ||
| 954 | + Observer.prototype.observeArray = function observeArray (items) { | ||
| 955 | + for (var i = 0, l = items.length; i < l; i++) { | ||
| 956 | + observe(items[i]); | ||
| 957 | + } | ||
| 958 | + }; | ||
| 959 | + | ||
| 960 | + // helpers | ||
| 961 | + | ||
| 962 | + /** | ||
| 963 | + * Augment a target Object or Array by intercepting | ||
| 964 | + * the prototype chain using __proto__ | ||
| 965 | + */ | ||
| 966 | + function protoAugment (target, src) { | ||
| 967 | + /* eslint-disable no-proto */ | ||
| 968 | + target.__proto__ = src; | ||
| 969 | + /* eslint-enable no-proto */ | ||
| 970 | + } | ||
| 971 | + | ||
| 972 | + /** | ||
| 973 | + * Augment a target Object or Array by defining | ||
| 974 | + * hidden properties. | ||
| 975 | + */ | ||
| 976 | + /* istanbul ignore next */ | ||
| 977 | + function copyAugment (target, src, keys) { | ||
| 978 | + for (var i = 0, l = keys.length; i < l; i++) { | ||
| 979 | + var key = keys[i]; | ||
| 980 | + def(target, key, src[key]); | ||
| 981 | + } | ||
| 982 | + } | ||
| 983 | + | ||
| 984 | + /** | ||
| 985 | + * Attempt to create an observer instance for a value, | ||
| 986 | + * returns the new observer if successfully observed, | ||
| 987 | + * or the existing observer if the value already has one. | ||
| 988 | + */ | ||
| 989 | + function observe (value, asRootData) { | ||
| 990 | + if (!isObject(value) || value instanceof VNode) { | ||
| 991 | + return | ||
| 992 | + } | ||
| 993 | + var ob; | ||
| 994 | + if (hasOwn(value, '__ob__') && value.__ob__ instanceof Observer) { | ||
| 995 | + ob = value.__ob__; | ||
| 996 | + } else if ( | ||
| 997 | + shouldObserve && | ||
| 998 | + !isServerRendering() && | ||
| 999 | + (Array.isArray(value) || isPlainObject(value)) && | ||
| 1000 | + Object.isExtensible(value) && | ||
| 1001 | + !value._isVue | ||
| 1002 | + ) { | ||
| 1003 | + ob = new Observer(value); | ||
| 1004 | + } | ||
| 1005 | + if (asRootData && ob) { | ||
| 1006 | + ob.vmCount++; | ||
| 1007 | + } | ||
| 1008 | + return ob | ||
| 1009 | + } | ||
| 1010 | + | ||
| 1011 | + /** | ||
| 1012 | + * Define a reactive property on an Object. | ||
| 1013 | + */ | ||
| 1014 | + function defineReactive$$1 ( | ||
| 1015 | + obj, | ||
| 1016 | + key, | ||
| 1017 | + val, | ||
| 1018 | + customSetter, | ||
| 1019 | + shallow | ||
| 1020 | + ) { | ||
| 1021 | + var dep = new Dep(); | ||
| 1022 | + | ||
| 1023 | + var property = Object.getOwnPropertyDescriptor(obj, key); | ||
| 1024 | + if (property && property.configurable === false) { | ||
| 1025 | + return | ||
| 1026 | + } | ||
| 1027 | + | ||
| 1028 | + // cater for pre-defined getter/setters | ||
| 1029 | + var getter = property && property.get; | ||
| 1030 | + var setter = property && property.set; | ||
| 1031 | + if ((!getter || setter) && arguments.length === 2) { | ||
| 1032 | + val = obj[key]; | ||
| 1033 | + } | ||
| 1034 | + | ||
| 1035 | + var childOb = !shallow && observe(val); | ||
| 1036 | + Object.defineProperty(obj, key, { | ||
| 1037 | + enumerable: true, | ||
| 1038 | + configurable: true, | ||
| 1039 | + get: function reactiveGetter () { | ||
| 1040 | + var value = getter ? getter.call(obj) : val; | ||
| 1041 | + if (Dep.target) { | ||
| 1042 | + dep.depend(); | ||
| 1043 | + if (childOb) { | ||
| 1044 | + childOb.dep.depend(); | ||
| 1045 | + if (Array.isArray(value)) { | ||
| 1046 | + dependArray(value); | ||
| 1047 | + } | ||
| 1048 | + } | ||
| 1049 | + } | ||
| 1050 | + return value | ||
| 1051 | + }, | ||
| 1052 | + set: function reactiveSetter (newVal) { | ||
| 1053 | + var value = getter ? getter.call(obj) : val; | ||
| 1054 | + /* eslint-disable no-self-compare */ | ||
| 1055 | + if (newVal === value || (newVal !== newVal && value !== value)) { | ||
| 1056 | + return | ||
| 1057 | + } | ||
| 1058 | + /* eslint-enable no-self-compare */ | ||
| 1059 | + if (customSetter) { | ||
| 1060 | + customSetter(); | ||
| 1061 | + } | ||
| 1062 | + // #7981: for accessor properties without setter | ||
| 1063 | + if (getter && !setter) { return } | ||
| 1064 | + if (setter) { | ||
| 1065 | + setter.call(obj, newVal); | ||
| 1066 | + } else { | ||
| 1067 | + val = newVal; | ||
| 1068 | + } | ||
| 1069 | + childOb = !shallow && observe(newVal); | ||
| 1070 | + dep.notify(); | ||
| 1071 | + } | ||
| 1072 | + }); | ||
| 1073 | + } | ||
| 1074 | + | ||
| 1075 | + /** | ||
| 1076 | + * Set a property on an object. Adds the new property and | ||
| 1077 | + * triggers change notification if the property doesn't | ||
| 1078 | + * already exist. | ||
| 1079 | + */ | ||
| 1080 | + function set (target, key, val) { | ||
| 1081 | + if (isUndef(target) || isPrimitive(target) | ||
| 1082 | + ) { | ||
| 1083 | + warn(("Cannot set reactive property on undefined, null, or primitive value: " + ((target)))); | ||
| 1084 | + } | ||
| 1085 | + if (Array.isArray(target) && isValidArrayIndex(key)) { | ||
| 1086 | + target.length = Math.max(target.length, key); | ||
| 1087 | + target.splice(key, 1, val); | ||
| 1088 | + return val | ||
| 1089 | + } | ||
| 1090 | + if (key in target && !(key in Object.prototype)) { | ||
| 1091 | + target[key] = val; | ||
| 1092 | + return val | ||
| 1093 | + } | ||
| 1094 | + var ob = (target).__ob__; | ||
| 1095 | + if (target._isVue || (ob && ob.vmCount)) { | ||
| 1096 | + warn( | ||
| 1097 | + 'Avoid adding reactive properties to a Vue instance or its root $data ' + | ||
| 1098 | + 'at runtime - declare it upfront in the data option.' | ||
| 1099 | + ); | ||
| 1100 | + return val | ||
| 1101 | + } | ||
| 1102 | + if (!ob) { | ||
| 1103 | + target[key] = val; | ||
| 1104 | + return val | ||
| 1105 | + } | ||
| 1106 | + defineReactive$$1(ob.value, key, val); | ||
| 1107 | + ob.dep.notify(); | ||
| 1108 | + return val | ||
| 1109 | + } | ||
| 1110 | + | ||
| 1111 | + /** | ||
| 1112 | + * Delete a property and trigger change if necessary. | ||
| 1113 | + */ | ||
| 1114 | + function del (target, key) { | ||
| 1115 | + if (isUndef(target) || isPrimitive(target) | ||
| 1116 | + ) { | ||
| 1117 | + warn(("Cannot delete reactive property on undefined, null, or primitive value: " + ((target)))); | ||
| 1118 | + } | ||
| 1119 | + if (Array.isArray(target) && isValidArrayIndex(key)) { | ||
| 1120 | + target.splice(key, 1); | ||
| 1121 | + return | ||
| 1122 | + } | ||
| 1123 | + var ob = (target).__ob__; | ||
| 1124 | + if (target._isVue || (ob && ob.vmCount)) { | ||
| 1125 | + warn( | ||
| 1126 | + 'Avoid deleting properties on a Vue instance or its root $data ' + | ||
| 1127 | + '- just set it to null.' | ||
| 1128 | + ); | ||
| 1129 | + return | ||
| 1130 | + } | ||
| 1131 | + if (!hasOwn(target, key)) { | ||
| 1132 | + return | ||
| 1133 | + } | ||
| 1134 | + delete target[key]; | ||
| 1135 | + if (!ob) { | ||
| 1136 | + return | ||
| 1137 | + } | ||
| 1138 | + ob.dep.notify(); | ||
| 1139 | + } | ||
| 1140 | + | ||
| 1141 | + /** | ||
| 1142 | + * Collect dependencies on array elements when the array is touched, since | ||
| 1143 | + * we cannot intercept array element access like property getters. | ||
| 1144 | + */ | ||
| 1145 | + function dependArray (value) { | ||
| 1146 | + for (var e = (void 0), i = 0, l = value.length; i < l; i++) { | ||
| 1147 | + e = value[i]; | ||
| 1148 | + e && e.__ob__ && e.__ob__.dep.depend(); | ||
| 1149 | + if (Array.isArray(e)) { | ||
| 1150 | + dependArray(e); | ||
| 1151 | + } | ||
| 1152 | + } | ||
| 1153 | + } | ||
| 1154 | + | ||
| 1155 | + /* */ | ||
| 1156 | + | ||
| 1157 | + /** | ||
| 1158 | + * Option overwriting strategies are functions that handle | ||
| 1159 | + * how to merge a parent option value and a child option | ||
| 1160 | + * value into the final value. | ||
| 1161 | + */ | ||
| 1162 | + var strats = config.optionMergeStrategies; | ||
| 1163 | + | ||
| 1164 | + /** | ||
| 1165 | + * Options with restrictions | ||
| 1166 | + */ | ||
| 1167 | + { | ||
| 1168 | + strats.el = strats.propsData = function (parent, child, vm, key) { | ||
| 1169 | + if (!vm) { | ||
| 1170 | + warn( | ||
| 1171 | + "option \"" + key + "\" can only be used during instance " + | ||
| 1172 | + 'creation with the `new` keyword.' | ||
| 1173 | + ); | ||
| 1174 | + } | ||
| 1175 | + return defaultStrat(parent, child) | ||
| 1176 | + }; | ||
| 1177 | + } | ||
| 1178 | + | ||
| 1179 | + /** | ||
| 1180 | + * Helper that recursively merges two data objects together. | ||
| 1181 | + */ | ||
| 1182 | + function mergeData (to, from) { | ||
| 1183 | + if (!from) { return to } | ||
| 1184 | + var key, toVal, fromVal; | ||
| 1185 | + | ||
| 1186 | + var keys = hasSymbol | ||
| 1187 | + ? Reflect.ownKeys(from) | ||
| 1188 | + : Object.keys(from); | ||
| 1189 | + | ||
| 1190 | + for (var i = 0; i < keys.length; i++) { | ||
| 1191 | + key = keys[i]; | ||
| 1192 | + // in case the object is already observed... | ||
| 1193 | + if (key === '__ob__') { continue } | ||
| 1194 | + toVal = to[key]; | ||
| 1195 | + fromVal = from[key]; | ||
| 1196 | + if (!hasOwn(to, key)) { | ||
| 1197 | + set(to, key, fromVal); | ||
| 1198 | + } else if ( | ||
| 1199 | + toVal !== fromVal && | ||
| 1200 | + isPlainObject(toVal) && | ||
| 1201 | + isPlainObject(fromVal) | ||
| 1202 | + ) { | ||
| 1203 | + mergeData(toVal, fromVal); | ||
| 1204 | + } | ||
| 1205 | + } | ||
| 1206 | + return to | ||
| 1207 | + } | ||
| 1208 | + | ||
| 1209 | + /** | ||
| 1210 | + * Data | ||
| 1211 | + */ | ||
| 1212 | + function mergeDataOrFn ( | ||
| 1213 | + parentVal, | ||
| 1214 | + childVal, | ||
| 1215 | + vm | ||
| 1216 | + ) { | ||
| 1217 | + if (!vm) { | ||
| 1218 | + // in a Vue.extend merge, both should be functions | ||
| 1219 | + if (!childVal) { | ||
| 1220 | + return parentVal | ||
| 1221 | + } | ||
| 1222 | + if (!parentVal) { | ||
| 1223 | + return childVal | ||
| 1224 | + } | ||
| 1225 | + // when parentVal & childVal are both present, | ||
| 1226 | + // we need to return a function that returns the | ||
| 1227 | + // merged result of both functions... no need to | ||
| 1228 | + // check if parentVal is a function here because | ||
| 1229 | + // it has to be a function to pass previous merges. | ||
| 1230 | + return function mergedDataFn () { | ||
| 1231 | + return mergeData( | ||
| 1232 | + typeof childVal === 'function' ? childVal.call(this, this) : childVal, | ||
| 1233 | + typeof parentVal === 'function' ? parentVal.call(this, this) : parentVal | ||
| 1234 | + ) | ||
| 1235 | + } | ||
| 1236 | + } else { | ||
| 1237 | + return function mergedInstanceDataFn () { | ||
| 1238 | + // instance merge | ||
| 1239 | + var instanceData = typeof childVal === 'function' | ||
| 1240 | + ? childVal.call(vm, vm) | ||
| 1241 | + : childVal; | ||
| 1242 | + var defaultData = typeof parentVal === 'function' | ||
| 1243 | + ? parentVal.call(vm, vm) | ||
| 1244 | + : parentVal; | ||
| 1245 | + if (instanceData) { | ||
| 1246 | + return mergeData(instanceData, defaultData) | ||
| 1247 | + } else { | ||
| 1248 | + return defaultData | ||
| 1249 | + } | ||
| 1250 | + } | ||
| 1251 | + } | ||
| 1252 | + } | ||
| 1253 | + | ||
| 1254 | + strats.data = function ( | ||
| 1255 | + parentVal, | ||
| 1256 | + childVal, | ||
| 1257 | + vm | ||
| 1258 | + ) { | ||
| 1259 | + if (!vm) { | ||
| 1260 | + if (childVal && typeof childVal !== 'function') { | ||
| 1261 | + warn( | ||
| 1262 | + 'The "data" option should be a function ' + | ||
| 1263 | + 'that returns a per-instance value in component ' + | ||
| 1264 | + 'definitions.', | ||
| 1265 | + vm | ||
| 1266 | + ); | ||
| 1267 | + | ||
| 1268 | + return parentVal | ||
| 1269 | + } | ||
| 1270 | + return mergeDataOrFn(parentVal, childVal) | ||
| 1271 | + } | ||
| 1272 | + | ||
| 1273 | + return mergeDataOrFn(parentVal, childVal, vm) | ||
| 1274 | + }; | ||
| 1275 | + | ||
| 1276 | + /** | ||
| 1277 | + * Hooks and props are merged as arrays. | ||
| 1278 | + */ | ||
| 1279 | + function mergeHook ( | ||
| 1280 | + parentVal, | ||
| 1281 | + childVal | ||
| 1282 | + ) { | ||
| 1283 | + var res = childVal | ||
| 1284 | + ? parentVal | ||
| 1285 | + ? parentVal.concat(childVal) | ||
| 1286 | + : Array.isArray(childVal) | ||
| 1287 | + ? childVal | ||
| 1288 | + : [childVal] | ||
| 1289 | + : parentVal; | ||
| 1290 | + return res | ||
| 1291 | + ? dedupeHooks(res) | ||
| 1292 | + : res | ||
| 1293 | + } | ||
| 1294 | + | ||
| 1295 | + function dedupeHooks (hooks) { | ||
| 1296 | + var res = []; | ||
| 1297 | + for (var i = 0; i < hooks.length; i++) { | ||
| 1298 | + if (res.indexOf(hooks[i]) === -1) { | ||
| 1299 | + res.push(hooks[i]); | ||
| 1300 | + } | ||
| 1301 | + } | ||
| 1302 | + return res | ||
| 1303 | + } | ||
| 1304 | + | ||
| 1305 | + LIFECYCLE_HOOKS.forEach(function (hook) { | ||
| 1306 | + strats[hook] = mergeHook; | ||
| 1307 | + }); | ||
| 1308 | + | ||
| 1309 | + /** | ||
| 1310 | + * Assets | ||
| 1311 | + * | ||
| 1312 | + * When a vm is present (instance creation), we need to do | ||
| 1313 | + * a three-way merge between constructor options, instance | ||
| 1314 | + * options and parent options. | ||
| 1315 | + */ | ||
| 1316 | + function mergeAssets ( | ||
| 1317 | + parentVal, | ||
| 1318 | + childVal, | ||
| 1319 | + vm, | ||
| 1320 | + key | ||
| 1321 | + ) { | ||
| 1322 | + var res = Object.create(parentVal || null); | ||
| 1323 | + if (childVal) { | ||
| 1324 | + assertObjectType(key, childVal, vm); | ||
| 1325 | + return extend(res, childVal) | ||
| 1326 | + } else { | ||
| 1327 | + return res | ||
| 1328 | + } | ||
| 1329 | + } | ||
| 1330 | + | ||
| 1331 | + ASSET_TYPES.forEach(function (type) { | ||
| 1332 | + strats[type + 's'] = mergeAssets; | ||
| 1333 | + }); | ||
| 1334 | + | ||
| 1335 | + /** | ||
| 1336 | + * Watchers. | ||
| 1337 | + * | ||
| 1338 | + * Watchers hashes should not overwrite one | ||
| 1339 | + * another, so we merge them as arrays. | ||
| 1340 | + */ | ||
| 1341 | + strats.watch = function ( | ||
| 1342 | + parentVal, | ||
| 1343 | + childVal, | ||
| 1344 | + vm, | ||
| 1345 | + key | ||
| 1346 | + ) { | ||
| 1347 | + // work around Firefox's Object.prototype.watch... | ||
| 1348 | + if (parentVal === nativeWatch) { parentVal = undefined; } | ||
| 1349 | + if (childVal === nativeWatch) { childVal = undefined; } | ||
| 1350 | + /* istanbul ignore if */ | ||
| 1351 | + if (!childVal) { return Object.create(parentVal || null) } | ||
| 1352 | + { | ||
| 1353 | + assertObjectType(key, childVal, vm); | ||
| 1354 | + } | ||
| 1355 | + if (!parentVal) { return childVal } | ||
| 1356 | + var ret = {}; | ||
| 1357 | + extend(ret, parentVal); | ||
| 1358 | + for (var key$1 in childVal) { | ||
| 1359 | + var parent = ret[key$1]; | ||
| 1360 | + var child = childVal[key$1]; | ||
| 1361 | + if (parent && !Array.isArray(parent)) { | ||
| 1362 | + parent = [parent]; | ||
| 1363 | + } | ||
| 1364 | + ret[key$1] = parent | ||
| 1365 | + ? parent.concat(child) | ||
| 1366 | + : Array.isArray(child) ? child : [child]; | ||
| 1367 | + } | ||
| 1368 | + return ret | ||
| 1369 | + }; | ||
| 1370 | + | ||
| 1371 | + /** | ||
| 1372 | + * Other object hashes. | ||
| 1373 | + */ | ||
| 1374 | + strats.props = | ||
| 1375 | + strats.methods = | ||
| 1376 | + strats.inject = | ||
| 1377 | + strats.computed = function ( | ||
| 1378 | + parentVal, | ||
| 1379 | + childVal, | ||
| 1380 | + vm, | ||
| 1381 | + key | ||
| 1382 | + ) { | ||
| 1383 | + if (childVal && "development" !== 'production') { | ||
| 1384 | + assertObjectType(key, childVal, vm); | ||
| 1385 | + } | ||
| 1386 | + if (!parentVal) { return childVal } | ||
| 1387 | + var ret = Object.create(null); | ||
| 1388 | + extend(ret, parentVal); | ||
| 1389 | + if (childVal) { extend(ret, childVal); } | ||
| 1390 | + return ret | ||
| 1391 | + }; | ||
| 1392 | + strats.provide = mergeDataOrFn; | ||
| 1393 | + | ||
| 1394 | + /** | ||
| 1395 | + * Default strategy. | ||
| 1396 | + */ | ||
| 1397 | + var defaultStrat = function (parentVal, childVal) { | ||
| 1398 | + return childVal === undefined | ||
| 1399 | + ? parentVal | ||
| 1400 | + : childVal | ||
| 1401 | + }; | ||
| 1402 | + | ||
| 1403 | + /** | ||
| 1404 | + * Validate component names | ||
| 1405 | + */ | ||
| 1406 | + function checkComponents (options) { | ||
| 1407 | + for (var key in options.components) { | ||
| 1408 | + validateComponentName(key); | ||
| 1409 | + } | ||
| 1410 | + } | ||
| 1411 | + | ||
| 1412 | + function validateComponentName (name) { | ||
| 1413 | + if (!new RegExp(("^[a-zA-Z][\\-\\.0-9_" + (unicodeRegExp.source) + "]*$")).test(name)) { | ||
| 1414 | + warn( | ||
| 1415 | + 'Invalid component name: "' + name + '". Component names ' + | ||
| 1416 | + 'should conform to valid custom element name in html5 specification.' | ||
| 1417 | + ); | ||
| 1418 | + } | ||
| 1419 | + if (isBuiltInTag(name) || config.isReservedTag(name)) { | ||
| 1420 | + warn( | ||
| 1421 | + 'Do not use built-in or reserved HTML elements as component ' + | ||
| 1422 | + 'id: ' + name | ||
| 1423 | + ); | ||
| 1424 | + } | ||
| 1425 | + } | ||
| 1426 | + | ||
| 1427 | + /** | ||
| 1428 | + * Ensure all props option syntax are normalized into the | ||
| 1429 | + * Object-based format. | ||
| 1430 | + */ | ||
| 1431 | + function normalizeProps (options, vm) { | ||
| 1432 | + var props = options.props; | ||
| 1433 | + if (!props) { return } | ||
| 1434 | + var res = {}; | ||
| 1435 | + var i, val, name; | ||
| 1436 | + if (Array.isArray(props)) { | ||
| 1437 | + i = props.length; | ||
| 1438 | + while (i--) { | ||
| 1439 | + val = props[i]; | ||
| 1440 | + if (typeof val === 'string') { | ||
| 1441 | + name = camelize(val); | ||
| 1442 | + res[name] = { type: null }; | ||
| 1443 | + } else { | ||
| 1444 | + warn('props must be strings when using array syntax.'); | ||
| 1445 | + } | ||
| 1446 | + } | ||
| 1447 | + } else if (isPlainObject(props)) { | ||
| 1448 | + for (var key in props) { | ||
| 1449 | + val = props[key]; | ||
| 1450 | + name = camelize(key); | ||
| 1451 | + res[name] = isPlainObject(val) | ||
| 1452 | + ? val | ||
| 1453 | + : { type: val }; | ||
| 1454 | + } | ||
| 1455 | + } else { | ||
| 1456 | + warn( | ||
| 1457 | + "Invalid value for option \"props\": expected an Array or an Object, " + | ||
| 1458 | + "but got " + (toRawType(props)) + ".", | ||
| 1459 | + vm | ||
| 1460 | + ); | ||
| 1461 | + } | ||
| 1462 | + options.props = res; | ||
| 1463 | + } | ||
| 1464 | + | ||
| 1465 | + /** | ||
| 1466 | + * Normalize all injections into Object-based format | ||
| 1467 | + */ | ||
| 1468 | + function normalizeInject (options, vm) { | ||
| 1469 | + var inject = options.inject; | ||
| 1470 | + if (!inject) { return } | ||
| 1471 | + var normalized = options.inject = {}; | ||
| 1472 | + if (Array.isArray(inject)) { | ||
| 1473 | + for (var i = 0; i < inject.length; i++) { | ||
| 1474 | + normalized[inject[i]] = { from: inject[i] }; | ||
| 1475 | + } | ||
| 1476 | + } else if (isPlainObject(inject)) { | ||
| 1477 | + for (var key in inject) { | ||
| 1478 | + var val = inject[key]; | ||
| 1479 | + normalized[key] = isPlainObject(val) | ||
| 1480 | + ? extend({ from: key }, val) | ||
| 1481 | + : { from: val }; | ||
| 1482 | + } | ||
| 1483 | + } else { | ||
| 1484 | + warn( | ||
| 1485 | + "Invalid value for option \"inject\": expected an Array or an Object, " + | ||
| 1486 | + "but got " + (toRawType(inject)) + ".", | ||
| 1487 | + vm | ||
| 1488 | + ); | ||
| 1489 | + } | ||
| 1490 | + } | ||
| 1491 | + | ||
| 1492 | + /** | ||
| 1493 | + * Normalize raw function directives into object format. | ||
| 1494 | + */ | ||
| 1495 | + function normalizeDirectives (options) { | ||
| 1496 | + var dirs = options.directives; | ||
| 1497 | + if (dirs) { | ||
| 1498 | + for (var key in dirs) { | ||
| 1499 | + var def$$1 = dirs[key]; | ||
| 1500 | + if (typeof def$$1 === 'function') { | ||
| 1501 | + dirs[key] = { bind: def$$1, update: def$$1 }; | ||
| 1502 | + } | ||
| 1503 | + } | ||
| 1504 | + } | ||
| 1505 | + } | ||
| 1506 | + | ||
| 1507 | + function assertObjectType (name, value, vm) { | ||
| 1508 | + if (!isPlainObject(value)) { | ||
| 1509 | + warn( | ||
| 1510 | + "Invalid value for option \"" + name + "\": expected an Object, " + | ||
| 1511 | + "but got " + (toRawType(value)) + ".", | ||
| 1512 | + vm | ||
| 1513 | + ); | ||
| 1514 | + } | ||
| 1515 | + } | ||
| 1516 | + | ||
| 1517 | + /** | ||
| 1518 | + * Merge two option objects into a new one. | ||
| 1519 | + * Core utility used in both instantiation and inheritance. | ||
| 1520 | + */ | ||
| 1521 | + function mergeOptions ( | ||
| 1522 | + parent, | ||
| 1523 | + child, | ||
| 1524 | + vm | ||
| 1525 | + ) { | ||
| 1526 | + { | ||
| 1527 | + checkComponents(child); | ||
| 1528 | + } | ||
| 1529 | + | ||
| 1530 | + if (typeof child === 'function') { | ||
| 1531 | + child = child.options; | ||
| 1532 | + } | ||
| 1533 | + | ||
| 1534 | + normalizeProps(child, vm); | ||
| 1535 | + normalizeInject(child, vm); | ||
| 1536 | + normalizeDirectives(child); | ||
| 1537 | + | ||
| 1538 | + // Apply extends and mixins on the child options, | ||
| 1539 | + // but only if it is a raw options object that isn't | ||
| 1540 | + // the result of another mergeOptions call. | ||
| 1541 | + // Only merged options has the _base property. | ||
| 1542 | + if (!child._base) { | ||
| 1543 | + if (child.extends) { | ||
| 1544 | + parent = mergeOptions(parent, child.extends, vm); | ||
| 1545 | + } | ||
| 1546 | + if (child.mixins) { | ||
| 1547 | + for (var i = 0, l = child.mixins.length; i < l; i++) { | ||
| 1548 | + parent = mergeOptions(parent, child.mixins[i], vm); | ||
| 1549 | + } | ||
| 1550 | + } | ||
| 1551 | + } | ||
| 1552 | + | ||
| 1553 | + var options = {}; | ||
| 1554 | + var key; | ||
| 1555 | + for (key in parent) { | ||
| 1556 | + mergeField(key); | ||
| 1557 | + } | ||
| 1558 | + for (key in child) { | ||
| 1559 | + if (!hasOwn(parent, key)) { | ||
| 1560 | + mergeField(key); | ||
| 1561 | + } | ||
| 1562 | + } | ||
| 1563 | + function mergeField (key) { | ||
| 1564 | + var strat = strats[key] || defaultStrat; | ||
| 1565 | + options[key] = strat(parent[key], child[key], vm, key); | ||
| 1566 | + } | ||
| 1567 | + return options | ||
| 1568 | + } | ||
| 1569 | + | ||
| 1570 | + /** | ||
| 1571 | + * Resolve an asset. | ||
| 1572 | + * This function is used because child instances need access | ||
| 1573 | + * to assets defined in its ancestor chain. | ||
| 1574 | + */ | ||
| 1575 | + function resolveAsset ( | ||
| 1576 | + options, | ||
| 1577 | + type, | ||
| 1578 | + id, | ||
| 1579 | + warnMissing | ||
| 1580 | + ) { | ||
| 1581 | + /* istanbul ignore if */ | ||
| 1582 | + if (typeof id !== 'string') { | ||
| 1583 | + return | ||
| 1584 | + } | ||
| 1585 | + var assets = options[type]; | ||
| 1586 | + // check local registration variations first | ||
| 1587 | + if (hasOwn(assets, id)) { return assets[id] } | ||
| 1588 | + var camelizedId = camelize(id); | ||
| 1589 | + if (hasOwn(assets, camelizedId)) { return assets[camelizedId] } | ||
| 1590 | + var PascalCaseId = capitalize(camelizedId); | ||
| 1591 | + if (hasOwn(assets, PascalCaseId)) { return assets[PascalCaseId] } | ||
| 1592 | + // fallback to prototype chain | ||
| 1593 | + var res = assets[id] || assets[camelizedId] || assets[PascalCaseId]; | ||
| 1594 | + if (warnMissing && !res) { | ||
| 1595 | + warn( | ||
| 1596 | + 'Failed to resolve ' + type.slice(0, -1) + ': ' + id, | ||
| 1597 | + options | ||
| 1598 | + ); | ||
| 1599 | + } | ||
| 1600 | + return res | ||
| 1601 | + } | ||
| 1602 | + | ||
| 1603 | + /* */ | ||
| 1604 | + | ||
| 1605 | + | ||
| 1606 | + | ||
| 1607 | + function validateProp ( | ||
| 1608 | + key, | ||
| 1609 | + propOptions, | ||
| 1610 | + propsData, | ||
| 1611 | + vm | ||
| 1612 | + ) { | ||
| 1613 | + var prop = propOptions[key]; | ||
| 1614 | + var absent = !hasOwn(propsData, key); | ||
| 1615 | + var value = propsData[key]; | ||
| 1616 | + // boolean casting | ||
| 1617 | + var booleanIndex = getTypeIndex(Boolean, prop.type); | ||
| 1618 | + if (booleanIndex > -1) { | ||
| 1619 | + if (absent && !hasOwn(prop, 'default')) { | ||
| 1620 | + value = false; | ||
| 1621 | + } else if (value === '' || value === hyphenate(key)) { | ||
| 1622 | + // only cast empty string / same name to boolean if | ||
| 1623 | + // boolean has higher priority | ||
| 1624 | + var stringIndex = getTypeIndex(String, prop.type); | ||
| 1625 | + if (stringIndex < 0 || booleanIndex < stringIndex) { | ||
| 1626 | + value = true; | ||
| 1627 | + } | ||
| 1628 | + } | ||
| 1629 | + } | ||
| 1630 | + // check default value | ||
| 1631 | + if (value === undefined) { | ||
| 1632 | + value = getPropDefaultValue(vm, prop, key); | ||
| 1633 | + // since the default value is a fresh copy, | ||
| 1634 | + // make sure to observe it. | ||
| 1635 | + var prevShouldObserve = shouldObserve; | ||
| 1636 | + toggleObserving(true); | ||
| 1637 | + observe(value); | ||
| 1638 | + toggleObserving(prevShouldObserve); | ||
| 1639 | + } | ||
| 1640 | + { | ||
| 1641 | + assertProp(prop, key, value, vm, absent); | ||
| 1642 | + } | ||
| 1643 | + return value | ||
| 1644 | + } | ||
| 1645 | + | ||
| 1646 | + /** | ||
| 1647 | + * Get the default value of a prop. | ||
| 1648 | + */ | ||
| 1649 | + function getPropDefaultValue (vm, prop, key) { | ||
| 1650 | + // no default, return undefined | ||
| 1651 | + if (!hasOwn(prop, 'default')) { | ||
| 1652 | + return undefined | ||
| 1653 | + } | ||
| 1654 | + var def = prop.default; | ||
| 1655 | + // warn against non-factory defaults for Object & Array | ||
| 1656 | + if (isObject(def)) { | ||
| 1657 | + warn( | ||
| 1658 | + 'Invalid default value for prop "' + key + '": ' + | ||
| 1659 | + 'Props with type Object/Array must use a factory function ' + | ||
| 1660 | + 'to return the default value.', | ||
| 1661 | + vm | ||
| 1662 | + ); | ||
| 1663 | + } | ||
| 1664 | + // the raw prop value was also undefined from previous render, | ||
| 1665 | + // return previous default value to avoid unnecessary watcher trigger | ||
| 1666 | + if (vm && vm.$options.propsData && | ||
| 1667 | + vm.$options.propsData[key] === undefined && | ||
| 1668 | + vm._props[key] !== undefined | ||
| 1669 | + ) { | ||
| 1670 | + return vm._props[key] | ||
| 1671 | + } | ||
| 1672 | + // call factory function for non-Function types | ||
| 1673 | + // a value is Function if its prototype is function even across different execution context | ||
| 1674 | + return typeof def === 'function' && getType(prop.type) !== 'Function' | ||
| 1675 | + ? def.call(vm) | ||
| 1676 | + : def | ||
| 1677 | + } | ||
| 1678 | + | ||
| 1679 | + /** | ||
| 1680 | + * Assert whether a prop is valid. | ||
| 1681 | + */ | ||
| 1682 | + function assertProp ( | ||
| 1683 | + prop, | ||
| 1684 | + name, | ||
| 1685 | + value, | ||
| 1686 | + vm, | ||
| 1687 | + absent | ||
| 1688 | + ) { | ||
| 1689 | + if (prop.required && absent) { | ||
| 1690 | + warn( | ||
| 1691 | + 'Missing required prop: "' + name + '"', | ||
| 1692 | + vm | ||
| 1693 | + ); | ||
| 1694 | + return | ||
| 1695 | + } | ||
| 1696 | + if (value == null && !prop.required) { | ||
| 1697 | + return | ||
| 1698 | + } | ||
| 1699 | + var type = prop.type; | ||
| 1700 | + var valid = !type || type === true; | ||
| 1701 | + var expectedTypes = []; | ||
| 1702 | + if (type) { | ||
| 1703 | + if (!Array.isArray(type)) { | ||
| 1704 | + type = [type]; | ||
| 1705 | + } | ||
| 1706 | + for (var i = 0; i < type.length && !valid; i++) { | ||
| 1707 | + var assertedType = assertType(value, type[i], vm); | ||
| 1708 | + expectedTypes.push(assertedType.expectedType || ''); | ||
| 1709 | + valid = assertedType.valid; | ||
| 1710 | + } | ||
| 1711 | + } | ||
| 1712 | + | ||
| 1713 | + var haveExpectedTypes = expectedTypes.some(function (t) { return t; }); | ||
| 1714 | + if (!valid && haveExpectedTypes) { | ||
| 1715 | + warn( | ||
| 1716 | + getInvalidTypeMessage(name, value, expectedTypes), | ||
| 1717 | + vm | ||
| 1718 | + ); | ||
| 1719 | + return | ||
| 1720 | + } | ||
| 1721 | + var validator = prop.validator; | ||
| 1722 | + if (validator) { | ||
| 1723 | + if (!validator(value)) { | ||
| 1724 | + warn( | ||
| 1725 | + 'Invalid prop: custom validator check failed for prop "' + name + '".', | ||
| 1726 | + vm | ||
| 1727 | + ); | ||
| 1728 | + } | ||
| 1729 | + } | ||
| 1730 | + } | ||
| 1731 | + | ||
| 1732 | + var simpleCheckRE = /^(String|Number|Boolean|Function|Symbol|BigInt)$/; | ||
| 1733 | + | ||
| 1734 | + function assertType (value, type, vm) { | ||
| 1735 | + var valid; | ||
| 1736 | + var expectedType = getType(type); | ||
| 1737 | + if (simpleCheckRE.test(expectedType)) { | ||
| 1738 | + var t = typeof value; | ||
| 1739 | + valid = t === expectedType.toLowerCase(); | ||
| 1740 | + // for primitive wrapper objects | ||
| 1741 | + if (!valid && t === 'object') { | ||
| 1742 | + valid = value instanceof type; | ||
| 1743 | + } | ||
| 1744 | + } else if (expectedType === 'Object') { | ||
| 1745 | + valid = isPlainObject(value); | ||
| 1746 | + } else if (expectedType === 'Array') { | ||
| 1747 | + valid = Array.isArray(value); | ||
| 1748 | + } else { | ||
| 1749 | + try { | ||
| 1750 | + valid = value instanceof type; | ||
| 1751 | + } catch (e) { | ||
| 1752 | + warn('Invalid prop type: "' + String(type) + '" is not a constructor', vm); | ||
| 1753 | + valid = false; | ||
| 1754 | + } | ||
| 1755 | + } | ||
| 1756 | + return { | ||
| 1757 | + valid: valid, | ||
| 1758 | + expectedType: expectedType | ||
| 1759 | + } | ||
| 1760 | + } | ||
| 1761 | + | ||
| 1762 | + var functionTypeCheckRE = /^\s*function (\w+)/; | ||
| 1763 | + | ||
| 1764 | + /** | ||
| 1765 | + * Use function string name to check built-in types, | ||
| 1766 | + * because a simple equality check will fail when running | ||
| 1767 | + * across different vms / iframes. | ||
| 1768 | + */ | ||
| 1769 | + function getType (fn) { | ||
| 1770 | + var match = fn && fn.toString().match(functionTypeCheckRE); | ||
| 1771 | + return match ? match[1] : '' | ||
| 1772 | + } | ||
| 1773 | + | ||
| 1774 | + function isSameType (a, b) { | ||
| 1775 | + return getType(a) === getType(b) | ||
| 1776 | + } | ||
| 1777 | + | ||
| 1778 | + function getTypeIndex (type, expectedTypes) { | ||
| 1779 | + if (!Array.isArray(expectedTypes)) { | ||
| 1780 | + return isSameType(expectedTypes, type) ? 0 : -1 | ||
| 1781 | + } | ||
| 1782 | + for (var i = 0, len = expectedTypes.length; i < len; i++) { | ||
| 1783 | + if (isSameType(expectedTypes[i], type)) { | ||
| 1784 | + return i | ||
| 1785 | + } | ||
| 1786 | + } | ||
| 1787 | + return -1 | ||
| 1788 | + } | ||
| 1789 | + | ||
| 1790 | + function getInvalidTypeMessage (name, value, expectedTypes) { | ||
| 1791 | + var message = "Invalid prop: type check failed for prop \"" + name + "\"." + | ||
| 1792 | + " Expected " + (expectedTypes.map(capitalize).join(', ')); | ||
| 1793 | + var expectedType = expectedTypes[0]; | ||
| 1794 | + var receivedType = toRawType(value); | ||
| 1795 | + // check if we need to specify expected value | ||
| 1796 | + if ( | ||
| 1797 | + expectedTypes.length === 1 && | ||
| 1798 | + isExplicable(expectedType) && | ||
| 1799 | + isExplicable(typeof value) && | ||
| 1800 | + !isBoolean(expectedType, receivedType) | ||
| 1801 | + ) { | ||
| 1802 | + message += " with value " + (styleValue(value, expectedType)); | ||
| 1803 | + } | ||
| 1804 | + message += ", got " + receivedType + " "; | ||
| 1805 | + // check if we need to specify received value | ||
| 1806 | + if (isExplicable(receivedType)) { | ||
| 1807 | + message += "with value " + (styleValue(value, receivedType)) + "."; | ||
| 1808 | + } | ||
| 1809 | + return message | ||
| 1810 | + } | ||
| 1811 | + | ||
| 1812 | + function styleValue (value, type) { | ||
| 1813 | + if (type === 'String') { | ||
| 1814 | + return ("\"" + value + "\"") | ||
| 1815 | + } else if (type === 'Number') { | ||
| 1816 | + return ("" + (Number(value))) | ||
| 1817 | + } else { | ||
| 1818 | + return ("" + value) | ||
| 1819 | + } | ||
| 1820 | + } | ||
| 1821 | + | ||
| 1822 | + var EXPLICABLE_TYPES = ['string', 'number', 'boolean']; | ||
| 1823 | + function isExplicable (value) { | ||
| 1824 | + return EXPLICABLE_TYPES.some(function (elem) { return value.toLowerCase() === elem; }) | ||
| 1825 | + } | ||
| 1826 | + | ||
| 1827 | + function isBoolean () { | ||
| 1828 | + var args = [], len = arguments.length; | ||
| 1829 | + while ( len-- ) args[ len ] = arguments[ len ]; | ||
| 1830 | + | ||
| 1831 | + return args.some(function (elem) { return elem.toLowerCase() === 'boolean'; }) | ||
| 1832 | + } | ||
| 1833 | + | ||
| 1834 | + /* */ | ||
| 1835 | + | ||
| 1836 | + function handleError (err, vm, info) { | ||
| 1837 | + // Deactivate deps tracking while processing error handler to avoid possible infinite rendering. | ||
| 1838 | + // See: https://github.com/vuejs/vuex/issues/1505 | ||
| 1839 | + pushTarget(); | ||
| 1840 | + try { | ||
| 1841 | + if (vm) { | ||
| 1842 | + var cur = vm; | ||
| 1843 | + while ((cur = cur.$parent)) { | ||
| 1844 | + var hooks = cur.$options.errorCaptured; | ||
| 1845 | + if (hooks) { | ||
| 1846 | + for (var i = 0; i < hooks.length; i++) { | ||
| 1847 | + try { | ||
| 1848 | + var capture = hooks[i].call(cur, err, vm, info) === false; | ||
| 1849 | + if (capture) { return } | ||
| 1850 | + } catch (e) { | ||
| 1851 | + globalHandleError(e, cur, 'errorCaptured hook'); | ||
| 1852 | + } | ||
| 1853 | + } | ||
| 1854 | + } | ||
| 1855 | + } | ||
| 1856 | + } | ||
| 1857 | + globalHandleError(err, vm, info); | ||
| 1858 | + } finally { | ||
| 1859 | + popTarget(); | ||
| 1860 | + } | ||
| 1861 | + } | ||
| 1862 | + | ||
| 1863 | + function invokeWithErrorHandling ( | ||
| 1864 | + handler, | ||
| 1865 | + context, | ||
| 1866 | + args, | ||
| 1867 | + vm, | ||
| 1868 | + info | ||
| 1869 | + ) { | ||
| 1870 | + var res; | ||
| 1871 | + try { | ||
| 1872 | + res = args ? handler.apply(context, args) : handler.call(context); | ||
| 1873 | + if (res && !res._isVue && isPromise(res) && !res._handled) { | ||
| 1874 | + res.catch(function (e) { return handleError(e, vm, info + " (Promise/async)"); }); | ||
| 1875 | + // issue #9511 | ||
| 1876 | + // avoid catch triggering multiple times when nested calls | ||
| 1877 | + res._handled = true; | ||
| 1878 | + } | ||
| 1879 | + } catch (e) { | ||
| 1880 | + handleError(e, vm, info); | ||
| 1881 | + } | ||
| 1882 | + return res | ||
| 1883 | + } | ||
| 1884 | + | ||
| 1885 | + function globalHandleError (err, vm, info) { | ||
| 1886 | + if (config.errorHandler) { | ||
| 1887 | + try { | ||
| 1888 | + return config.errorHandler.call(null, err, vm, info) | ||
| 1889 | + } catch (e) { | ||
| 1890 | + // if the user intentionally throws the original error in the handler, | ||
| 1891 | + // do not log it twice | ||
| 1892 | + if (e !== err) { | ||
| 1893 | + logError(e, null, 'config.errorHandler'); | ||
| 1894 | + } | ||
| 1895 | + } | ||
| 1896 | + } | ||
| 1897 | + logError(err, vm, info); | ||
| 1898 | + } | ||
| 1899 | + | ||
| 1900 | + function logError (err, vm, info) { | ||
| 1901 | + { | ||
| 1902 | + warn(("Error in " + info + ": \"" + (err.toString()) + "\""), vm); | ||
| 1903 | + } | ||
| 1904 | + /* istanbul ignore else */ | ||
| 1905 | + if ((inBrowser || inWeex) && typeof console !== 'undefined') { | ||
| 1906 | + console.error(err); | ||
| 1907 | + } else { | ||
| 1908 | + throw err | ||
| 1909 | + } | ||
| 1910 | + } | ||
| 1911 | + | ||
| 1912 | + /* */ | ||
| 1913 | + | ||
| 1914 | + var isUsingMicroTask = false; | ||
| 1915 | + | ||
| 1916 | + var callbacks = []; | ||
| 1917 | + var pending = false; | ||
| 1918 | + | ||
| 1919 | + function flushCallbacks () { | ||
| 1920 | + pending = false; | ||
| 1921 | + var copies = callbacks.slice(0); | ||
| 1922 | + callbacks.length = 0; | ||
| 1923 | + for (var i = 0; i < copies.length; i++) { | ||
| 1924 | + copies[i](); | ||
| 1925 | + } | ||
| 1926 | + } | ||
| 1927 | + | ||
| 1928 | + // Here we have async deferring wrappers using microtasks. | ||
| 1929 | + // In 2.5 we used (macro) tasks (in combination with microtasks). | ||
| 1930 | + // However, it has subtle problems when state is changed right before repaint | ||
| 1931 | + // (e.g. #6813, out-in transitions). | ||
| 1932 | + // Also, using (macro) tasks in event handler would cause some weird behaviors | ||
| 1933 | + // that cannot be circumvented (e.g. #7109, #7153, #7546, #7834, #8109). | ||
| 1934 | + // So we now use microtasks everywhere, again. | ||
| 1935 | + // A major drawback of this tradeoff is that there are some scenarios | ||
| 1936 | + // where microtasks have too high a priority and fire in between supposedly | ||
| 1937 | + // sequential events (e.g. #4521, #6690, which have workarounds) | ||
| 1938 | + // or even between bubbling of the same event (#6566). | ||
| 1939 | + var timerFunc; | ||
| 1940 | + | ||
| 1941 | + // The nextTick behavior leverages the microtask queue, which can be accessed | ||
| 1942 | + // via either native Promise.then or MutationObserver. | ||
| 1943 | + // MutationObserver has wider support, however it is seriously bugged in | ||
| 1944 | + // UIWebView in iOS >= 9.3.3 when triggered in touch event handlers. It | ||
| 1945 | + // completely stops working after triggering a few times... so, if native | ||
| 1946 | + // Promise is available, we will use it: | ||
| 1947 | + /* istanbul ignore next, $flow-disable-line */ | ||
| 1948 | + if (typeof Promise !== 'undefined' && isNative(Promise)) { | ||
| 1949 | + var p = Promise.resolve(); | ||
| 1950 | + timerFunc = function () { | ||
| 1951 | + p.then(flushCallbacks); | ||
| 1952 | + // In problematic UIWebViews, Promise.then doesn't completely break, but | ||
| 1953 | + // it can get stuck in a weird state where callbacks are pushed into the | ||
| 1954 | + // microtask queue but the queue isn't being flushed, until the browser | ||
| 1955 | + // needs to do some other work, e.g. handle a timer. Therefore we can | ||
| 1956 | + // "force" the microtask queue to be flushed by adding an empty timer. | ||
| 1957 | + if (isIOS) { setTimeout(noop); } | ||
| 1958 | + }; | ||
| 1959 | + isUsingMicroTask = true; | ||
| 1960 | + } else if (!isIE && typeof MutationObserver !== 'undefined' && ( | ||
| 1961 | + isNative(MutationObserver) || | ||
| 1962 | + // PhantomJS and iOS 7.x | ||
| 1963 | + MutationObserver.toString() === '[object MutationObserverConstructor]' | ||
| 1964 | + )) { | ||
| 1965 | + // Use MutationObserver where native Promise is not available, | ||
| 1966 | + // e.g. PhantomJS, iOS7, Android 4.4 | ||
| 1967 | + // (#6466 MutationObserver is unreliable in IE11) | ||
| 1968 | + var counter = 1; | ||
| 1969 | + var observer = new MutationObserver(flushCallbacks); | ||
| 1970 | + var textNode = document.createTextNode(String(counter)); | ||
| 1971 | + observer.observe(textNode, { | ||
| 1972 | + characterData: true | ||
| 1973 | + }); | ||
| 1974 | + timerFunc = function () { | ||
| 1975 | + counter = (counter + 1) % 2; | ||
| 1976 | + textNode.data = String(counter); | ||
| 1977 | + }; | ||
| 1978 | + isUsingMicroTask = true; | ||
| 1979 | + } else if (typeof setImmediate !== 'undefined' && isNative(setImmediate)) { | ||
| 1980 | + // Fallback to setImmediate. | ||
| 1981 | + // Technically it leverages the (macro) task queue, | ||
| 1982 | + // but it is still a better choice than setTimeout. | ||
| 1983 | + timerFunc = function () { | ||
| 1984 | + setImmediate(flushCallbacks); | ||
| 1985 | + }; | ||
| 1986 | + } else { | ||
| 1987 | + // Fallback to setTimeout. | ||
| 1988 | + timerFunc = function () { | ||
| 1989 | + setTimeout(flushCallbacks, 0); | ||
| 1990 | + }; | ||
| 1991 | + } | ||
| 1992 | + | ||
| 1993 | + function nextTick (cb, ctx) { | ||
| 1994 | + var _resolve; | ||
| 1995 | + callbacks.push(function () { | ||
| 1996 | + if (cb) { | ||
| 1997 | + try { | ||
| 1998 | + cb.call(ctx); | ||
| 1999 | + } catch (e) { | ||
| 2000 | + handleError(e, ctx, 'nextTick'); | ||
| 2001 | + } | ||
| 2002 | + } else if (_resolve) { | ||
| 2003 | + _resolve(ctx); | ||
| 2004 | + } | ||
| 2005 | + }); | ||
| 2006 | + if (!pending) { | ||
| 2007 | + pending = true; | ||
| 2008 | + timerFunc(); | ||
| 2009 | + } | ||
| 2010 | + // $flow-disable-line | ||
| 2011 | + if (!cb && typeof Promise !== 'undefined') { | ||
| 2012 | + return new Promise(function (resolve) { | ||
| 2013 | + _resolve = resolve; | ||
| 2014 | + }) | ||
| 2015 | + } | ||
| 2016 | + } | ||
| 2017 | + | ||
| 2018 | + /* */ | ||
| 2019 | + | ||
| 2020 | + var mark; | ||
| 2021 | + var measure; | ||
| 2022 | + | ||
| 2023 | + { | ||
| 2024 | + var perf = inBrowser && window.performance; | ||
| 2025 | + /* istanbul ignore if */ | ||
| 2026 | + if ( | ||
| 2027 | + perf && | ||
| 2028 | + perf.mark && | ||
| 2029 | + perf.measure && | ||
| 2030 | + perf.clearMarks && | ||
| 2031 | + perf.clearMeasures | ||
| 2032 | + ) { | ||
| 2033 | + mark = function (tag) { return perf.mark(tag); }; | ||
| 2034 | + measure = function (name, startTag, endTag) { | ||
| 2035 | + perf.measure(name, startTag, endTag); | ||
| 2036 | + perf.clearMarks(startTag); | ||
| 2037 | + perf.clearMarks(endTag); | ||
| 2038 | + // perf.clearMeasures(name) | ||
| 2039 | + }; | ||
| 2040 | + } | ||
| 2041 | + } | ||
| 2042 | + | ||
| 2043 | + /* not type checking this file because flow doesn't play well with Proxy */ | ||
| 2044 | + | ||
| 2045 | + var initProxy; | ||
| 2046 | + | ||
| 2047 | + { | ||
| 2048 | + var allowedGlobals = makeMap( | ||
| 2049 | + 'Infinity,undefined,NaN,isFinite,isNaN,' + | ||
| 2050 | + 'parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,' + | ||
| 2051 | + 'Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,BigInt,' + | ||
| 2052 | + 'require' // for Webpack/Browserify | ||
| 2053 | + ); | ||
| 2054 | + | ||
| 2055 | + var warnNonPresent = function (target, key) { | ||
| 2056 | + warn( | ||
| 2057 | + "Property or method \"" + key + "\" is not defined on the instance but " + | ||
| 2058 | + 'referenced during render. Make sure that this property is reactive, ' + | ||
| 2059 | + 'either in the data option, or for class-based components, by ' + | ||
| 2060 | + 'initializing the property. ' + | ||
| 2061 | + 'See: https://vuejs.org/v2/guide/reactivity.html#Declaring-Reactive-Properties.', | ||
| 2062 | + target | ||
| 2063 | + ); | ||
| 2064 | + }; | ||
| 2065 | + | ||
| 2066 | + var warnReservedPrefix = function (target, key) { | ||
| 2067 | + warn( | ||
| 2068 | + "Property \"" + key + "\" must be accessed with \"$data." + key + "\" because " + | ||
| 2069 | + 'properties starting with "$" or "_" are not proxied in the Vue instance to ' + | ||
| 2070 | + 'prevent conflicts with Vue internals. ' + | ||
| 2071 | + 'See: https://vuejs.org/v2/api/#data', | ||
| 2072 | + target | ||
| 2073 | + ); | ||
| 2074 | + }; | ||
| 2075 | + | ||
| 2076 | + var hasProxy = | ||
| 2077 | + typeof Proxy !== 'undefined' && isNative(Proxy); | ||
| 2078 | + | ||
| 2079 | + if (hasProxy) { | ||
| 2080 | + var isBuiltInModifier = makeMap('stop,prevent,self,ctrl,shift,alt,meta,exact'); | ||
| 2081 | + config.keyCodes = new Proxy(config.keyCodes, { | ||
| 2082 | + set: function set (target, key, value) { | ||
| 2083 | + if (isBuiltInModifier(key)) { | ||
| 2084 | + warn(("Avoid overwriting built-in modifier in config.keyCodes: ." + key)); | ||
| 2085 | + return false | ||
| 2086 | + } else { | ||
| 2087 | + target[key] = value; | ||
| 2088 | + return true | ||
| 2089 | + } | ||
| 2090 | + } | ||
| 2091 | + }); | ||
| 2092 | + } | ||
| 2093 | + | ||
| 2094 | + var hasHandler = { | ||
| 2095 | + has: function has (target, key) { | ||
| 2096 | + var has = key in target; | ||
| 2097 | + var isAllowed = allowedGlobals(key) || | ||
| 2098 | + (typeof key === 'string' && key.charAt(0) === '_' && !(key in target.$data)); | ||
| 2099 | + if (!has && !isAllowed) { | ||
| 2100 | + if (key in target.$data) { warnReservedPrefix(target, key); } | ||
| 2101 | + else { warnNonPresent(target, key); } | ||
| 2102 | + } | ||
| 2103 | + return has || !isAllowed | ||
| 2104 | + } | ||
| 2105 | + }; | ||
| 2106 | + | ||
| 2107 | + var getHandler = { | ||
| 2108 | + get: function get (target, key) { | ||
| 2109 | + if (typeof key === 'string' && !(key in target)) { | ||
| 2110 | + if (key in target.$data) { warnReservedPrefix(target, key); } | ||
| 2111 | + else { warnNonPresent(target, key); } | ||
| 2112 | + } | ||
| 2113 | + return target[key] | ||
| 2114 | + } | ||
| 2115 | + }; | ||
| 2116 | + | ||
| 2117 | + initProxy = function initProxy (vm) { | ||
| 2118 | + if (hasProxy) { | ||
| 2119 | + // determine which proxy handler to use | ||
| 2120 | + var options = vm.$options; | ||
| 2121 | + var handlers = options.render && options.render._withStripped | ||
| 2122 | + ? getHandler | ||
| 2123 | + : hasHandler; | ||
| 2124 | + vm._renderProxy = new Proxy(vm, handlers); | ||
| 2125 | + } else { | ||
| 2126 | + vm._renderProxy = vm; | ||
| 2127 | + } | ||
| 2128 | + }; | ||
| 2129 | + } | ||
| 2130 | + | ||
| 2131 | + /* */ | ||
| 2132 | + | ||
| 2133 | + var seenObjects = new _Set(); | ||
| 2134 | + | ||
| 2135 | + /** | ||
| 2136 | + * Recursively traverse an object to evoke all converted | ||
| 2137 | + * getters, so that every nested property inside the object | ||
| 2138 | + * is collected as a "deep" dependency. | ||
| 2139 | + */ | ||
| 2140 | + function traverse (val) { | ||
| 2141 | + _traverse(val, seenObjects); | ||
| 2142 | + seenObjects.clear(); | ||
| 2143 | + } | ||
| 2144 | + | ||
| 2145 | + function _traverse (val, seen) { | ||
| 2146 | + var i, keys; | ||
| 2147 | + var isA = Array.isArray(val); | ||
| 2148 | + if ((!isA && !isObject(val)) || Object.isFrozen(val) || val instanceof VNode) { | ||
| 2149 | + return | ||
| 2150 | + } | ||
| 2151 | + if (val.__ob__) { | ||
| 2152 | + var depId = val.__ob__.dep.id; | ||
| 2153 | + if (seen.has(depId)) { | ||
| 2154 | + return | ||
| 2155 | + } | ||
| 2156 | + seen.add(depId); | ||
| 2157 | + } | ||
| 2158 | + if (isA) { | ||
| 2159 | + i = val.length; | ||
| 2160 | + while (i--) { _traverse(val[i], seen); } | ||
| 2161 | + } else { | ||
| 2162 | + keys = Object.keys(val); | ||
| 2163 | + i = keys.length; | ||
| 2164 | + while (i--) { _traverse(val[keys[i]], seen); } | ||
| 2165 | + } | ||
| 2166 | + } | ||
| 2167 | + | ||
| 2168 | + /* */ | ||
| 2169 | + | ||
| 2170 | + var normalizeEvent = cached(function (name) { | ||
| 2171 | + var passive = name.charAt(0) === '&'; | ||
| 2172 | + name = passive ? name.slice(1) : name; | ||
| 2173 | + var once$$1 = name.charAt(0) === '~'; // Prefixed last, checked first | ||
| 2174 | + name = once$$1 ? name.slice(1) : name; | ||
| 2175 | + var capture = name.charAt(0) === '!'; | ||
| 2176 | + name = capture ? name.slice(1) : name; | ||
| 2177 | + return { | ||
| 2178 | + name: name, | ||
| 2179 | + once: once$$1, | ||
| 2180 | + capture: capture, | ||
| 2181 | + passive: passive | ||
| 2182 | + } | ||
| 2183 | + }); | ||
| 2184 | + | ||
| 2185 | + function createFnInvoker (fns, vm) { | ||
| 2186 | + function invoker () { | ||
| 2187 | + var arguments$1 = arguments; | ||
| 2188 | + | ||
| 2189 | + var fns = invoker.fns; | ||
| 2190 | + if (Array.isArray(fns)) { | ||
| 2191 | + var cloned = fns.slice(); | ||
| 2192 | + for (var i = 0; i < cloned.length; i++) { | ||
| 2193 | + invokeWithErrorHandling(cloned[i], null, arguments$1, vm, "v-on handler"); | ||
| 2194 | + } | ||
| 2195 | + } else { | ||
| 2196 | + // return handler return value for single handlers | ||
| 2197 | + return invokeWithErrorHandling(fns, null, arguments, vm, "v-on handler") | ||
| 2198 | + } | ||
| 2199 | + } | ||
| 2200 | + invoker.fns = fns; | ||
| 2201 | + return invoker | ||
| 2202 | + } | ||
| 2203 | + | ||
| 2204 | + function updateListeners ( | ||
| 2205 | + on, | ||
| 2206 | + oldOn, | ||
| 2207 | + add, | ||
| 2208 | + remove$$1, | ||
| 2209 | + createOnceHandler, | ||
| 2210 | + vm | ||
| 2211 | + ) { | ||
| 2212 | + var name, def$$1, cur, old, event; | ||
| 2213 | + for (name in on) { | ||
| 2214 | + def$$1 = cur = on[name]; | ||
| 2215 | + old = oldOn[name]; | ||
| 2216 | + event = normalizeEvent(name); | ||
| 2217 | + if (isUndef(cur)) { | ||
| 2218 | + warn( | ||
| 2219 | + "Invalid handler for event \"" + (event.name) + "\": got " + String(cur), | ||
| 2220 | + vm | ||
| 2221 | + ); | ||
| 2222 | + } else if (isUndef(old)) { | ||
| 2223 | + if (isUndef(cur.fns)) { | ||
| 2224 | + cur = on[name] = createFnInvoker(cur, vm); | ||
| 2225 | + } | ||
| 2226 | + if (isTrue(event.once)) { | ||
| 2227 | + cur = on[name] = createOnceHandler(event.name, cur, event.capture); | ||
| 2228 | + } | ||
| 2229 | + add(event.name, cur, event.capture, event.passive, event.params); | ||
| 2230 | + } else if (cur !== old) { | ||
| 2231 | + old.fns = cur; | ||
| 2232 | + on[name] = old; | ||
| 2233 | + } | ||
| 2234 | + } | ||
| 2235 | + for (name in oldOn) { | ||
| 2236 | + if (isUndef(on[name])) { | ||
| 2237 | + event = normalizeEvent(name); | ||
| 2238 | + remove$$1(event.name, oldOn[name], event.capture); | ||
| 2239 | + } | ||
| 2240 | + } | ||
| 2241 | + } | ||
| 2242 | + | ||
| 2243 | + /* */ | ||
| 2244 | + | ||
| 2245 | + function mergeVNodeHook (def, hookKey, hook) { | ||
| 2246 | + if (def instanceof VNode) { | ||
| 2247 | + def = def.data.hook || (def.data.hook = {}); | ||
| 2248 | + } | ||
| 2249 | + var invoker; | ||
| 2250 | + var oldHook = def[hookKey]; | ||
| 2251 | + | ||
| 2252 | + function wrappedHook () { | ||
| 2253 | + hook.apply(this, arguments); | ||
| 2254 | + // important: remove merged hook to ensure it's called only once | ||
| 2255 | + // and prevent memory leak | ||
| 2256 | + remove(invoker.fns, wrappedHook); | ||
| 2257 | + } | ||
| 2258 | + | ||
| 2259 | + if (isUndef(oldHook)) { | ||
| 2260 | + // no existing hook | ||
| 2261 | + invoker = createFnInvoker([wrappedHook]); | ||
| 2262 | + } else { | ||
| 2263 | + /* istanbul ignore if */ | ||
| 2264 | + if (isDef(oldHook.fns) && isTrue(oldHook.merged)) { | ||
| 2265 | + // already a merged invoker | ||
| 2266 | + invoker = oldHook; | ||
| 2267 | + invoker.fns.push(wrappedHook); | ||
| 2268 | + } else { | ||
| 2269 | + // existing plain hook | ||
| 2270 | + invoker = createFnInvoker([oldHook, wrappedHook]); | ||
| 2271 | + } | ||
| 2272 | + } | ||
| 2273 | + | ||
| 2274 | + invoker.merged = true; | ||
| 2275 | + def[hookKey] = invoker; | ||
| 2276 | + } | ||
| 2277 | + | ||
| 2278 | + /* */ | ||
| 2279 | + | ||
| 2280 | + function extractPropsFromVNodeData ( | ||
| 2281 | + data, | ||
| 2282 | + Ctor, | ||
| 2283 | + tag | ||
| 2284 | + ) { | ||
| 2285 | + // we are only extracting raw values here. | ||
| 2286 | + // validation and default values are handled in the child | ||
| 2287 | + // component itself. | ||
| 2288 | + var propOptions = Ctor.options.props; | ||
| 2289 | + if (isUndef(propOptions)) { | ||
| 2290 | + return | ||
| 2291 | + } | ||
| 2292 | + var res = {}; | ||
| 2293 | + var attrs = data.attrs; | ||
| 2294 | + var props = data.props; | ||
| 2295 | + if (isDef(attrs) || isDef(props)) { | ||
| 2296 | + for (var key in propOptions) { | ||
| 2297 | + var altKey = hyphenate(key); | ||
| 2298 | + { | ||
| 2299 | + var keyInLowerCase = key.toLowerCase(); | ||
| 2300 | + if ( | ||
| 2301 | + key !== keyInLowerCase && | ||
| 2302 | + attrs && hasOwn(attrs, keyInLowerCase) | ||
| 2303 | + ) { | ||
| 2304 | + tip( | ||
| 2305 | + "Prop \"" + keyInLowerCase + "\" is passed to component " + | ||
| 2306 | + (formatComponentName(tag || Ctor)) + ", but the declared prop name is" + | ||
| 2307 | + " \"" + key + "\". " + | ||
| 2308 | + "Note that HTML attributes are case-insensitive and camelCased " + | ||
| 2309 | + "props need to use their kebab-case equivalents when using in-DOM " + | ||
| 2310 | + "templates. You should probably use \"" + altKey + "\" instead of \"" + key + "\"." | ||
| 2311 | + ); | ||
| 2312 | + } | ||
| 2313 | + } | ||
| 2314 | + checkProp(res, props, key, altKey, true) || | ||
| 2315 | + checkProp(res, attrs, key, altKey, false); | ||
| 2316 | + } | ||
| 2317 | + } | ||
| 2318 | + return res | ||
| 2319 | + } | ||
| 2320 | + | ||
| 2321 | + function checkProp ( | ||
| 2322 | + res, | ||
| 2323 | + hash, | ||
| 2324 | + key, | ||
| 2325 | + altKey, | ||
| 2326 | + preserve | ||
| 2327 | + ) { | ||
| 2328 | + if (isDef(hash)) { | ||
| 2329 | + if (hasOwn(hash, key)) { | ||
| 2330 | + res[key] = hash[key]; | ||
| 2331 | + if (!preserve) { | ||
| 2332 | + delete hash[key]; | ||
| 2333 | + } | ||
| 2334 | + return true | ||
| 2335 | + } else if (hasOwn(hash, altKey)) { | ||
| 2336 | + res[key] = hash[altKey]; | ||
| 2337 | + if (!preserve) { | ||
| 2338 | + delete hash[altKey]; | ||
| 2339 | + } | ||
| 2340 | + return true | ||
| 2341 | + } | ||
| 2342 | + } | ||
| 2343 | + return false | ||
| 2344 | + } | ||
| 2345 | + | ||
| 2346 | + /* */ | ||
| 2347 | + | ||
| 2348 | + // The template compiler attempts to minimize the need for normalization by | ||
| 2349 | + // statically analyzing the template at compile time. | ||
| 2350 | + // | ||
| 2351 | + // For plain HTML markup, normalization can be completely skipped because the | ||
| 2352 | + // generated render function is guaranteed to return Array<VNode>. There are | ||
| 2353 | + // two cases where extra normalization is needed: | ||
| 2354 | + | ||
| 2355 | + // 1. When the children contains components - because a functional component | ||
| 2356 | + // may return an Array instead of a single root. In this case, just a simple | ||
| 2357 | + // normalization is needed - if any child is an Array, we flatten the whole | ||
| 2358 | + // thing with Array.prototype.concat. It is guaranteed to be only 1-level deep | ||
| 2359 | + // because functional components already normalize their own children. | ||
| 2360 | + function simpleNormalizeChildren (children) { | ||
| 2361 | + for (var i = 0; i < children.length; i++) { | ||
| 2362 | + if (Array.isArray(children[i])) { | ||
| 2363 | + return Array.prototype.concat.apply([], children) | ||
| 2364 | + } | ||
| 2365 | + } | ||
| 2366 | + return children | ||
| 2367 | + } | ||
| 2368 | + | ||
| 2369 | + // 2. When the children contains constructs that always generated nested Arrays, | ||
| 2370 | + // e.g. <template>, <slot>, v-for, or when the children is provided by user | ||
| 2371 | + // with hand-written render functions / JSX. In such cases a full normalization | ||
| 2372 | + // is needed to cater to all possible types of children values. | ||
| 2373 | + function normalizeChildren (children) { | ||
| 2374 | + return isPrimitive(children) | ||
| 2375 | + ? [createTextVNode(children)] | ||
| 2376 | + : Array.isArray(children) | ||
| 2377 | + ? normalizeArrayChildren(children) | ||
| 2378 | + : undefined | ||
| 2379 | + } | ||
| 2380 | + | ||
| 2381 | + function isTextNode (node) { | ||
| 2382 | + return isDef(node) && isDef(node.text) && isFalse(node.isComment) | ||
| 2383 | + } | ||
| 2384 | + | ||
| 2385 | + function normalizeArrayChildren (children, nestedIndex) { | ||
| 2386 | + var res = []; | ||
| 2387 | + var i, c, lastIndex, last; | ||
| 2388 | + for (i = 0; i < children.length; i++) { | ||
| 2389 | + c = children[i]; | ||
| 2390 | + if (isUndef(c) || typeof c === 'boolean') { continue } | ||
| 2391 | + lastIndex = res.length - 1; | ||
| 2392 | + last = res[lastIndex]; | ||
| 2393 | + // nested | ||
| 2394 | + if (Array.isArray(c)) { | ||
| 2395 | + if (c.length > 0) { | ||
| 2396 | + c = normalizeArrayChildren(c, ((nestedIndex || '') + "_" + i)); | ||
| 2397 | + // merge adjacent text nodes | ||
| 2398 | + if (isTextNode(c[0]) && isTextNode(last)) { | ||
| 2399 | + res[lastIndex] = createTextVNode(last.text + (c[0]).text); | ||
| 2400 | + c.shift(); | ||
| 2401 | + } | ||
| 2402 | + res.push.apply(res, c); | ||
| 2403 | + } | ||
| 2404 | + } else if (isPrimitive(c)) { | ||
| 2405 | + if (isTextNode(last)) { | ||
| 2406 | + // merge adjacent text nodes | ||
| 2407 | + // this is necessary for SSR hydration because text nodes are | ||
| 2408 | + // essentially merged when rendered to HTML strings | ||
| 2409 | + res[lastIndex] = createTextVNode(last.text + c); | ||
| 2410 | + } else if (c !== '') { | ||
| 2411 | + // convert primitive to vnode | ||
| 2412 | + res.push(createTextVNode(c)); | ||
| 2413 | + } | ||
| 2414 | + } else { | ||
| 2415 | + if (isTextNode(c) && isTextNode(last)) { | ||
| 2416 | + // merge adjacent text nodes | ||
| 2417 | + res[lastIndex] = createTextVNode(last.text + c.text); | ||
| 2418 | + } else { | ||
| 2419 | + // default key for nested array children (likely generated by v-for) | ||
| 2420 | + if (isTrue(children._isVList) && | ||
| 2421 | + isDef(c.tag) && | ||
| 2422 | + isUndef(c.key) && | ||
| 2423 | + isDef(nestedIndex)) { | ||
| 2424 | + c.key = "__vlist" + nestedIndex + "_" + i + "__"; | ||
| 2425 | + } | ||
| 2426 | + res.push(c); | ||
| 2427 | + } | ||
| 2428 | + } | ||
| 2429 | + } | ||
| 2430 | + return res | ||
| 2431 | + } | ||
| 2432 | + | ||
| 2433 | + /* */ | ||
| 2434 | + | ||
| 2435 | + function initProvide (vm) { | ||
| 2436 | + var provide = vm.$options.provide; | ||
| 2437 | + if (provide) { | ||
| 2438 | + vm._provided = typeof provide === 'function' | ||
| 2439 | + ? provide.call(vm) | ||
| 2440 | + : provide; | ||
| 2441 | + } | ||
| 2442 | + } | ||
| 2443 | + | ||
| 2444 | + function initInjections (vm) { | ||
| 2445 | + var result = resolveInject(vm.$options.inject, vm); | ||
| 2446 | + if (result) { | ||
| 2447 | + toggleObserving(false); | ||
| 2448 | + Object.keys(result).forEach(function (key) { | ||
| 2449 | + /* istanbul ignore else */ | ||
| 2450 | + { | ||
| 2451 | + defineReactive$$1(vm, key, result[key], function () { | ||
| 2452 | + warn( | ||
| 2453 | + "Avoid mutating an injected value directly since the changes will be " + | ||
| 2454 | + "overwritten whenever the provided component re-renders. " + | ||
| 2455 | + "injection being mutated: \"" + key + "\"", | ||
| 2456 | + vm | ||
| 2457 | + ); | ||
| 2458 | + }); | ||
| 2459 | + } | ||
| 2460 | + }); | ||
| 2461 | + toggleObserving(true); | ||
| 2462 | + } | ||
| 2463 | + } | ||
| 2464 | + | ||
| 2465 | + function resolveInject (inject, vm) { | ||
| 2466 | + if (inject) { | ||
| 2467 | + // inject is :any because flow is not smart enough to figure out cached | ||
| 2468 | + var result = Object.create(null); | ||
| 2469 | + var keys = hasSymbol | ||
| 2470 | + ? Reflect.ownKeys(inject) | ||
| 2471 | + : Object.keys(inject); | ||
| 2472 | + | ||
| 2473 | + for (var i = 0; i < keys.length; i++) { | ||
| 2474 | + var key = keys[i]; | ||
| 2475 | + // #6574 in case the inject object is observed... | ||
| 2476 | + if (key === '__ob__') { continue } | ||
| 2477 | + var provideKey = inject[key].from; | ||
| 2478 | + var source = vm; | ||
| 2479 | + while (source) { | ||
| 2480 | + if (source._provided && hasOwn(source._provided, provideKey)) { | ||
| 2481 | + result[key] = source._provided[provideKey]; | ||
| 2482 | + break | ||
| 2483 | + } | ||
| 2484 | + source = source.$parent; | ||
| 2485 | + } | ||
| 2486 | + if (!source) { | ||
| 2487 | + if ('default' in inject[key]) { | ||
| 2488 | + var provideDefault = inject[key].default; | ||
| 2489 | + result[key] = typeof provideDefault === 'function' | ||
| 2490 | + ? provideDefault.call(vm) | ||
| 2491 | + : provideDefault; | ||
| 2492 | + } else { | ||
| 2493 | + warn(("Injection \"" + key + "\" not found"), vm); | ||
| 2494 | + } | ||
| 2495 | + } | ||
| 2496 | + } | ||
| 2497 | + return result | ||
| 2498 | + } | ||
| 2499 | + } | ||
| 2500 | + | ||
| 2501 | + /* */ | ||
| 2502 | + | ||
| 2503 | + | ||
| 2504 | + | ||
| 2505 | + /** | ||
| 2506 | + * Runtime helper for resolving raw children VNodes into a slot object. | ||
| 2507 | + */ | ||
| 2508 | + function resolveSlots ( | ||
| 2509 | + children, | ||
| 2510 | + context | ||
| 2511 | + ) { | ||
| 2512 | + if (!children || !children.length) { | ||
| 2513 | + return {} | ||
| 2514 | + } | ||
| 2515 | + var slots = {}; | ||
| 2516 | + for (var i = 0, l = children.length; i < l; i++) { | ||
| 2517 | + var child = children[i]; | ||
| 2518 | + var data = child.data; | ||
| 2519 | + // remove slot attribute if the node is resolved as a Vue slot node | ||
| 2520 | + if (data && data.attrs && data.attrs.slot) { | ||
| 2521 | + delete data.attrs.slot; | ||
| 2522 | + } | ||
| 2523 | + // named slots should only be respected if the vnode was rendered in the | ||
| 2524 | + // same context. | ||
| 2525 | + if ((child.context === context || child.fnContext === context) && | ||
| 2526 | + data && data.slot != null | ||
| 2527 | + ) { | ||
| 2528 | + var name = data.slot; | ||
| 2529 | + var slot = (slots[name] || (slots[name] = [])); | ||
| 2530 | + if (child.tag === 'template') { | ||
| 2531 | + slot.push.apply(slot, child.children || []); | ||
| 2532 | + } else { | ||
| 2533 | + slot.push(child); | ||
| 2534 | + } | ||
| 2535 | + } else { | ||
| 2536 | + (slots.default || (slots.default = [])).push(child); | ||
| 2537 | + } | ||
| 2538 | + } | ||
| 2539 | + // ignore slots that contains only whitespace | ||
| 2540 | + for (var name$1 in slots) { | ||
| 2541 | + if (slots[name$1].every(isWhitespace)) { | ||
| 2542 | + delete slots[name$1]; | ||
| 2543 | + } | ||
| 2544 | + } | ||
| 2545 | + return slots | ||
| 2546 | + } | ||
| 2547 | + | ||
| 2548 | + function isWhitespace (node) { | ||
| 2549 | + return (node.isComment && !node.asyncFactory) || node.text === ' ' | ||
| 2550 | + } | ||
| 2551 | + | ||
| 2552 | + /* */ | ||
| 2553 | + | ||
| 2554 | + function isAsyncPlaceholder (node) { | ||
| 2555 | + return node.isComment && node.asyncFactory | ||
| 2556 | + } | ||
| 2557 | + | ||
| 2558 | + /* */ | ||
| 2559 | + | ||
| 2560 | + function normalizeScopedSlots ( | ||
| 2561 | + slots, | ||
| 2562 | + normalSlots, | ||
| 2563 | + prevSlots | ||
| 2564 | + ) { | ||
| 2565 | + var res; | ||
| 2566 | + var hasNormalSlots = Object.keys(normalSlots).length > 0; | ||
| 2567 | + var isStable = slots ? !!slots.$stable : !hasNormalSlots; | ||
| 2568 | + var key = slots && slots.$key; | ||
| 2569 | + if (!slots) { | ||
| 2570 | + res = {}; | ||
| 2571 | + } else if (slots._normalized) { | ||
| 2572 | + // fast path 1: child component re-render only, parent did not change | ||
| 2573 | + return slots._normalized | ||
| 2574 | + } else if ( | ||
| 2575 | + isStable && | ||
| 2576 | + prevSlots && | ||
| 2577 | + prevSlots !== emptyObject && | ||
| 2578 | + key === prevSlots.$key && | ||
| 2579 | + !hasNormalSlots && | ||
| 2580 | + !prevSlots.$hasNormal | ||
| 2581 | + ) { | ||
| 2582 | + // fast path 2: stable scoped slots w/ no normal slots to proxy, | ||
| 2583 | + // only need to normalize once | ||
| 2584 | + return prevSlots | ||
| 2585 | + } else { | ||
| 2586 | + res = {}; | ||
| 2587 | + for (var key$1 in slots) { | ||
| 2588 | + if (slots[key$1] && key$1[0] !== '$') { | ||
| 2589 | + res[key$1] = normalizeScopedSlot(normalSlots, key$1, slots[key$1]); | ||
| 2590 | + } | ||
| 2591 | + } | ||
| 2592 | + } | ||
| 2593 | + // expose normal slots on scopedSlots | ||
| 2594 | + for (var key$2 in normalSlots) { | ||
| 2595 | + if (!(key$2 in res)) { | ||
| 2596 | + res[key$2] = proxyNormalSlot(normalSlots, key$2); | ||
| 2597 | + } | ||
| 2598 | + } | ||
| 2599 | + // avoriaz seems to mock a non-extensible $scopedSlots object | ||
| 2600 | + // and when that is passed down this would cause an error | ||
| 2601 | + if (slots && Object.isExtensible(slots)) { | ||
| 2602 | + (slots)._normalized = res; | ||
| 2603 | + } | ||
| 2604 | + def(res, '$stable', isStable); | ||
| 2605 | + def(res, '$key', key); | ||
| 2606 | + def(res, '$hasNormal', hasNormalSlots); | ||
| 2607 | + return res | ||
| 2608 | + } | ||
| 2609 | + | ||
| 2610 | + function normalizeScopedSlot(normalSlots, key, fn) { | ||
| 2611 | + var normalized = function () { | ||
| 2612 | + var res = arguments.length ? fn.apply(null, arguments) : fn({}); | ||
| 2613 | + res = res && typeof res === 'object' && !Array.isArray(res) | ||
| 2614 | + ? [res] // single vnode | ||
| 2615 | + : normalizeChildren(res); | ||
| 2616 | + var vnode = res && res[0]; | ||
| 2617 | + return res && ( | ||
| 2618 | + !vnode || | ||
| 2619 | + (res.length === 1 && vnode.isComment && !isAsyncPlaceholder(vnode)) // #9658, #10391 | ||
| 2620 | + ) ? undefined | ||
| 2621 | + : res | ||
| 2622 | + }; | ||
| 2623 | + // this is a slot using the new v-slot syntax without scope. although it is | ||
| 2624 | + // compiled as a scoped slot, render fn users would expect it to be present | ||
| 2625 | + // on this.$slots because the usage is semantically a normal slot. | ||
| 2626 | + if (fn.proxy) { | ||
| 2627 | + Object.defineProperty(normalSlots, key, { | ||
| 2628 | + get: normalized, | ||
| 2629 | + enumerable: true, | ||
| 2630 | + configurable: true | ||
| 2631 | + }); | ||
| 2632 | + } | ||
| 2633 | + return normalized | ||
| 2634 | + } | ||
| 2635 | + | ||
| 2636 | + function proxyNormalSlot(slots, key) { | ||
| 2637 | + return function () { return slots[key]; } | ||
| 2638 | + } | ||
| 2639 | + | ||
| 2640 | + /* */ | ||
| 2641 | + | ||
| 2642 | + /** | ||
| 2643 | + * Runtime helper for rendering v-for lists. | ||
| 2644 | + */ | ||
| 2645 | + function renderList ( | ||
| 2646 | + val, | ||
| 2647 | + render | ||
| 2648 | + ) { | ||
| 2649 | + var ret, i, l, keys, key; | ||
| 2650 | + if (Array.isArray(val) || typeof val === 'string') { | ||
| 2651 | + ret = new Array(val.length); | ||
| 2652 | + for (i = 0, l = val.length; i < l; i++) { | ||
| 2653 | + ret[i] = render(val[i], i); | ||
| 2654 | + } | ||
| 2655 | + } else if (typeof val === 'number') { | ||
| 2656 | + ret = new Array(val); | ||
| 2657 | + for (i = 0; i < val; i++) { | ||
| 2658 | + ret[i] = render(i + 1, i); | ||
| 2659 | + } | ||
| 2660 | + } else if (isObject(val)) { | ||
| 2661 | + if (hasSymbol && val[Symbol.iterator]) { | ||
| 2662 | + ret = []; | ||
| 2663 | + var iterator = val[Symbol.iterator](); | ||
| 2664 | + var result = iterator.next(); | ||
| 2665 | + while (!result.done) { | ||
| 2666 | + ret.push(render(result.value, ret.length)); | ||
| 2667 | + result = iterator.next(); | ||
| 2668 | + } | ||
| 2669 | + } else { | ||
| 2670 | + keys = Object.keys(val); | ||
| 2671 | + ret = new Array(keys.length); | ||
| 2672 | + for (i = 0, l = keys.length; i < l; i++) { | ||
| 2673 | + key = keys[i]; | ||
| 2674 | + ret[i] = render(val[key], key, i); | ||
| 2675 | + } | ||
| 2676 | + } | ||
| 2677 | + } | ||
| 2678 | + if (!isDef(ret)) { | ||
| 2679 | + ret = []; | ||
| 2680 | + } | ||
| 2681 | + (ret)._isVList = true; | ||
| 2682 | + return ret | ||
| 2683 | + } | ||
| 2684 | + | ||
| 2685 | + /* */ | ||
| 2686 | + | ||
| 2687 | + /** | ||
| 2688 | + * Runtime helper for rendering <slot> | ||
| 2689 | + */ | ||
| 2690 | + function renderSlot ( | ||
| 2691 | + name, | ||
| 2692 | + fallbackRender, | ||
| 2693 | + props, | ||
| 2694 | + bindObject | ||
| 2695 | + ) { | ||
| 2696 | + var scopedSlotFn = this.$scopedSlots[name]; | ||
| 2697 | + var nodes; | ||
| 2698 | + if (scopedSlotFn) { | ||
| 2699 | + // scoped slot | ||
| 2700 | + props = props || {}; | ||
| 2701 | + if (bindObject) { | ||
| 2702 | + if (!isObject(bindObject)) { | ||
| 2703 | + warn('slot v-bind without argument expects an Object', this); | ||
| 2704 | + } | ||
| 2705 | + props = extend(extend({}, bindObject), props); | ||
| 2706 | + } | ||
| 2707 | + nodes = | ||
| 2708 | + scopedSlotFn(props) || | ||
| 2709 | + (typeof fallbackRender === 'function' ? fallbackRender() : fallbackRender); | ||
| 2710 | + } else { | ||
| 2711 | + nodes = | ||
| 2712 | + this.$slots[name] || | ||
| 2713 | + (typeof fallbackRender === 'function' ? fallbackRender() : fallbackRender); | ||
| 2714 | + } | ||
| 2715 | + | ||
| 2716 | + var target = props && props.slot; | ||
| 2717 | + if (target) { | ||
| 2718 | + return this.$createElement('template', { slot: target }, nodes) | ||
| 2719 | + } else { | ||
| 2720 | + return nodes | ||
| 2721 | + } | ||
| 2722 | + } | ||
| 2723 | + | ||
| 2724 | + /* */ | ||
| 2725 | + | ||
| 2726 | + /** | ||
| 2727 | + * Runtime helper for resolving filters | ||
| 2728 | + */ | ||
| 2729 | + function resolveFilter (id) { | ||
| 2730 | + return resolveAsset(this.$options, 'filters', id, true) || identity | ||
| 2731 | + } | ||
| 2732 | + | ||
| 2733 | + /* */ | ||
| 2734 | + | ||
| 2735 | + function isKeyNotMatch (expect, actual) { | ||
| 2736 | + if (Array.isArray(expect)) { | ||
| 2737 | + return expect.indexOf(actual) === -1 | ||
| 2738 | + } else { | ||
| 2739 | + return expect !== actual | ||
| 2740 | + } | ||
| 2741 | + } | ||
| 2742 | + | ||
| 2743 | + /** | ||
| 2744 | + * Runtime helper for checking keyCodes from config. | ||
| 2745 | + * exposed as Vue.prototype._k | ||
| 2746 | + * passing in eventKeyName as last argument separately for backwards compat | ||
| 2747 | + */ | ||
| 2748 | + function checkKeyCodes ( | ||
| 2749 | + eventKeyCode, | ||
| 2750 | + key, | ||
| 2751 | + builtInKeyCode, | ||
| 2752 | + eventKeyName, | ||
| 2753 | + builtInKeyName | ||
| 2754 | + ) { | ||
| 2755 | + var mappedKeyCode = config.keyCodes[key] || builtInKeyCode; | ||
| 2756 | + if (builtInKeyName && eventKeyName && !config.keyCodes[key]) { | ||
| 2757 | + return isKeyNotMatch(builtInKeyName, eventKeyName) | ||
| 2758 | + } else if (mappedKeyCode) { | ||
| 2759 | + return isKeyNotMatch(mappedKeyCode, eventKeyCode) | ||
| 2760 | + } else if (eventKeyName) { | ||
| 2761 | + return hyphenate(eventKeyName) !== key | ||
| 2762 | + } | ||
| 2763 | + return eventKeyCode === undefined | ||
| 2764 | + } | ||
| 2765 | + | ||
| 2766 | + /* */ | ||
| 2767 | + | ||
| 2768 | + /** | ||
| 2769 | + * Runtime helper for merging v-bind="object" into a VNode's data. | ||
| 2770 | + */ | ||
| 2771 | + function bindObjectProps ( | ||
| 2772 | + data, | ||
| 2773 | + tag, | ||
| 2774 | + value, | ||
| 2775 | + asProp, | ||
| 2776 | + isSync | ||
| 2777 | + ) { | ||
| 2778 | + if (value) { | ||
| 2779 | + if (!isObject(value)) { | ||
| 2780 | + warn( | ||
| 2781 | + 'v-bind without argument expects an Object or Array value', | ||
| 2782 | + this | ||
| 2783 | + ); | ||
| 2784 | + } else { | ||
| 2785 | + if (Array.isArray(value)) { | ||
| 2786 | + value = toObject(value); | ||
| 2787 | + } | ||
| 2788 | + var hash; | ||
| 2789 | + var loop = function ( key ) { | ||
| 2790 | + if ( | ||
| 2791 | + key === 'class' || | ||
| 2792 | + key === 'style' || | ||
| 2793 | + isReservedAttribute(key) | ||
| 2794 | + ) { | ||
| 2795 | + hash = data; | ||
| 2796 | + } else { | ||
| 2797 | + var type = data.attrs && data.attrs.type; | ||
| 2798 | + hash = asProp || config.mustUseProp(tag, type, key) | ||
| 2799 | + ? data.domProps || (data.domProps = {}) | ||
| 2800 | + : data.attrs || (data.attrs = {}); | ||
| 2801 | + } | ||
| 2802 | + var camelizedKey = camelize(key); | ||
| 2803 | + var hyphenatedKey = hyphenate(key); | ||
| 2804 | + if (!(camelizedKey in hash) && !(hyphenatedKey in hash)) { | ||
| 2805 | + hash[key] = value[key]; | ||
| 2806 | + | ||
| 2807 | + if (isSync) { | ||
| 2808 | + var on = data.on || (data.on = {}); | ||
| 2809 | + on[("update:" + key)] = function ($event) { | ||
| 2810 | + value[key] = $event; | ||
| 2811 | + }; | ||
| 2812 | + } | ||
| 2813 | + } | ||
| 2814 | + }; | ||
| 2815 | + | ||
| 2816 | + for (var key in value) loop( key ); | ||
| 2817 | + } | ||
| 2818 | + } | ||
| 2819 | + return data | ||
| 2820 | + } | ||
| 2821 | + | ||
| 2822 | + /* */ | ||
| 2823 | + | ||
| 2824 | + /** | ||
| 2825 | + * Runtime helper for rendering static trees. | ||
| 2826 | + */ | ||
| 2827 | + function renderStatic ( | ||
| 2828 | + index, | ||
| 2829 | + isInFor | ||
| 2830 | + ) { | ||
| 2831 | + var cached = this._staticTrees || (this._staticTrees = []); | ||
| 2832 | + var tree = cached[index]; | ||
| 2833 | + // if has already-rendered static tree and not inside v-for, | ||
| 2834 | + // we can reuse the same tree. | ||
| 2835 | + if (tree && !isInFor) { | ||
| 2836 | + return tree | ||
| 2837 | + } | ||
| 2838 | + // otherwise, render a fresh tree. | ||
| 2839 | + tree = cached[index] = this.$options.staticRenderFns[index].call( | ||
| 2840 | + this._renderProxy, | ||
| 2841 | + null, | ||
| 2842 | + this // for render fns generated for functional component templates | ||
| 2843 | + ); | ||
| 2844 | + markStatic(tree, ("__static__" + index), false); | ||
| 2845 | + return tree | ||
| 2846 | + } | ||
| 2847 | + | ||
| 2848 | + /** | ||
| 2849 | + * Runtime helper for v-once. | ||
| 2850 | + * Effectively it means marking the node as static with a unique key. | ||
| 2851 | + */ | ||
| 2852 | + function markOnce ( | ||
| 2853 | + tree, | ||
| 2854 | + index, | ||
| 2855 | + key | ||
| 2856 | + ) { | ||
| 2857 | + markStatic(tree, ("__once__" + index + (key ? ("_" + key) : "")), true); | ||
| 2858 | + return tree | ||
| 2859 | + } | ||
| 2860 | + | ||
| 2861 | + function markStatic ( | ||
| 2862 | + tree, | ||
| 2863 | + key, | ||
| 2864 | + isOnce | ||
| 2865 | + ) { | ||
| 2866 | + if (Array.isArray(tree)) { | ||
| 2867 | + for (var i = 0; i < tree.length; i++) { | ||
| 2868 | + if (tree[i] && typeof tree[i] !== 'string') { | ||
| 2869 | + markStaticNode(tree[i], (key + "_" + i), isOnce); | ||
| 2870 | + } | ||
| 2871 | + } | ||
| 2872 | + } else { | ||
| 2873 | + markStaticNode(tree, key, isOnce); | ||
| 2874 | + } | ||
| 2875 | + } | ||
| 2876 | + | ||
| 2877 | + function markStaticNode (node, key, isOnce) { | ||
| 2878 | + node.isStatic = true; | ||
| 2879 | + node.key = key; | ||
| 2880 | + node.isOnce = isOnce; | ||
| 2881 | + } | ||
| 2882 | + | ||
| 2883 | + /* */ | ||
| 2884 | + | ||
| 2885 | + function bindObjectListeners (data, value) { | ||
| 2886 | + if (value) { | ||
| 2887 | + if (!isPlainObject(value)) { | ||
| 2888 | + warn( | ||
| 2889 | + 'v-on without argument expects an Object value', | ||
| 2890 | + this | ||
| 2891 | + ); | ||
| 2892 | + } else { | ||
| 2893 | + var on = data.on = data.on ? extend({}, data.on) : {}; | ||
| 2894 | + for (var key in value) { | ||
| 2895 | + var existing = on[key]; | ||
| 2896 | + var ours = value[key]; | ||
| 2897 | + on[key] = existing ? [].concat(existing, ours) : ours; | ||
| 2898 | + } | ||
| 2899 | + } | ||
| 2900 | + } | ||
| 2901 | + return data | ||
| 2902 | + } | ||
| 2903 | + | ||
| 2904 | + /* */ | ||
| 2905 | + | ||
| 2906 | + function resolveScopedSlots ( | ||
| 2907 | + fns, // see flow/vnode | ||
| 2908 | + res, | ||
| 2909 | + // the following are added in 2.6 | ||
| 2910 | + hasDynamicKeys, | ||
| 2911 | + contentHashKey | ||
| 2912 | + ) { | ||
| 2913 | + res = res || { $stable: !hasDynamicKeys }; | ||
| 2914 | + for (var i = 0; i < fns.length; i++) { | ||
| 2915 | + var slot = fns[i]; | ||
| 2916 | + if (Array.isArray(slot)) { | ||
| 2917 | + resolveScopedSlots(slot, res, hasDynamicKeys); | ||
| 2918 | + } else if (slot) { | ||
| 2919 | + // marker for reverse proxying v-slot without scope on this.$slots | ||
| 2920 | + if (slot.proxy) { | ||
| 2921 | + slot.fn.proxy = true; | ||
| 2922 | + } | ||
| 2923 | + res[slot.key] = slot.fn; | ||
| 2924 | + } | ||
| 2925 | + } | ||
| 2926 | + if (contentHashKey) { | ||
| 2927 | + (res).$key = contentHashKey; | ||
| 2928 | + } | ||
| 2929 | + return res | ||
| 2930 | + } | ||
| 2931 | + | ||
| 2932 | + /* */ | ||
| 2933 | + | ||
| 2934 | + function bindDynamicKeys (baseObj, values) { | ||
| 2935 | + for (var i = 0; i < values.length; i += 2) { | ||
| 2936 | + var key = values[i]; | ||
| 2937 | + if (typeof key === 'string' && key) { | ||
| 2938 | + baseObj[values[i]] = values[i + 1]; | ||
| 2939 | + } else if (key !== '' && key !== null) { | ||
| 2940 | + // null is a special value for explicitly removing a binding | ||
| 2941 | + warn( | ||
| 2942 | + ("Invalid value for dynamic directive argument (expected string or null): " + key), | ||
| 2943 | + this | ||
| 2944 | + ); | ||
| 2945 | + } | ||
| 2946 | + } | ||
| 2947 | + return baseObj | ||
| 2948 | + } | ||
| 2949 | + | ||
| 2950 | + // helper to dynamically append modifier runtime markers to event names. | ||
| 2951 | + // ensure only append when value is already string, otherwise it will be cast | ||
| 2952 | + // to string and cause the type check to miss. | ||
| 2953 | + function prependModifier (value, symbol) { | ||
| 2954 | + return typeof value === 'string' ? symbol + value : value | ||
| 2955 | + } | ||
| 2956 | + | ||
| 2957 | + /* */ | ||
| 2958 | + | ||
| 2959 | + function installRenderHelpers (target) { | ||
| 2960 | + target._o = markOnce; | ||
| 2961 | + target._n = toNumber; | ||
| 2962 | + target._s = toString; | ||
| 2963 | + target._l = renderList; | ||
| 2964 | + target._t = renderSlot; | ||
| 2965 | + target._q = looseEqual; | ||
| 2966 | + target._i = looseIndexOf; | ||
| 2967 | + target._m = renderStatic; | ||
| 2968 | + target._f = resolveFilter; | ||
| 2969 | + target._k = checkKeyCodes; | ||
| 2970 | + target._b = bindObjectProps; | ||
| 2971 | + target._v = createTextVNode; | ||
| 2972 | + target._e = createEmptyVNode; | ||
| 2973 | + target._u = resolveScopedSlots; | ||
| 2974 | + target._g = bindObjectListeners; | ||
| 2975 | + target._d = bindDynamicKeys; | ||
| 2976 | + target._p = prependModifier; | ||
| 2977 | + } | ||
| 2978 | + | ||
| 2979 | + /* */ | ||
| 2980 | + | ||
| 2981 | + function FunctionalRenderContext ( | ||
| 2982 | + data, | ||
| 2983 | + props, | ||
| 2984 | + children, | ||
| 2985 | + parent, | ||
| 2986 | + Ctor | ||
| 2987 | + ) { | ||
| 2988 | + var this$1 = this; | ||
| 2989 | + | ||
| 2990 | + var options = Ctor.options; | ||
| 2991 | + // ensure the createElement function in functional components | ||
| 2992 | + // gets a unique context - this is necessary for correct named slot check | ||
| 2993 | + var contextVm; | ||
| 2994 | + if (hasOwn(parent, '_uid')) { | ||
| 2995 | + contextVm = Object.create(parent); | ||
| 2996 | + // $flow-disable-line | ||
| 2997 | + contextVm._original = parent; | ||
| 2998 | + } else { | ||
| 2999 | + // the context vm passed in is a functional context as well. | ||
| 3000 | + // in this case we want to make sure we are able to get a hold to the | ||
| 3001 | + // real context instance. | ||
| 3002 | + contextVm = parent; | ||
| 3003 | + // $flow-disable-line | ||
| 3004 | + parent = parent._original; | ||
| 3005 | + } | ||
| 3006 | + var isCompiled = isTrue(options._compiled); | ||
| 3007 | + var needNormalization = !isCompiled; | ||
| 3008 | + | ||
| 3009 | + this.data = data; | ||
| 3010 | + this.props = props; | ||
| 3011 | + this.children = children; | ||
| 3012 | + this.parent = parent; | ||
| 3013 | + this.listeners = data.on || emptyObject; | ||
| 3014 | + this.injections = resolveInject(options.inject, parent); | ||
| 3015 | + this.slots = function () { | ||
| 3016 | + if (!this$1.$slots) { | ||
| 3017 | + normalizeScopedSlots( | ||
| 3018 | + data.scopedSlots, | ||
| 3019 | + this$1.$slots = resolveSlots(children, parent) | ||
| 3020 | + ); | ||
| 3021 | + } | ||
| 3022 | + return this$1.$slots | ||
| 3023 | + }; | ||
| 3024 | + | ||
| 3025 | + Object.defineProperty(this, 'scopedSlots', ({ | ||
| 3026 | + enumerable: true, | ||
| 3027 | + get: function get () { | ||
| 3028 | + return normalizeScopedSlots(data.scopedSlots, this.slots()) | ||
| 3029 | + } | ||
| 3030 | + })); | ||
| 3031 | + | ||
| 3032 | + // support for compiled functional template | ||
| 3033 | + if (isCompiled) { | ||
| 3034 | + // exposing $options for renderStatic() | ||
| 3035 | + this.$options = options; | ||
| 3036 | + // pre-resolve slots for renderSlot() | ||
| 3037 | + this.$slots = this.slots(); | ||
| 3038 | + this.$scopedSlots = normalizeScopedSlots(data.scopedSlots, this.$slots); | ||
| 3039 | + } | ||
| 3040 | + | ||
| 3041 | + if (options._scopeId) { | ||
| 3042 | + this._c = function (a, b, c, d) { | ||
| 3043 | + var vnode = createElement(contextVm, a, b, c, d, needNormalization); | ||
| 3044 | + if (vnode && !Array.isArray(vnode)) { | ||
| 3045 | + vnode.fnScopeId = options._scopeId; | ||
| 3046 | + vnode.fnContext = parent; | ||
| 3047 | + } | ||
| 3048 | + return vnode | ||
| 3049 | + }; | ||
| 3050 | + } else { | ||
| 3051 | + this._c = function (a, b, c, d) { return createElement(contextVm, a, b, c, d, needNormalization); }; | ||
| 3052 | + } | ||
| 3053 | + } | ||
| 3054 | + | ||
| 3055 | + installRenderHelpers(FunctionalRenderContext.prototype); | ||
| 3056 | + | ||
| 3057 | + function createFunctionalComponent ( | ||
| 3058 | + Ctor, | ||
| 3059 | + propsData, | ||
| 3060 | + data, | ||
| 3061 | + contextVm, | ||
| 3062 | + children | ||
| 3063 | + ) { | ||
| 3064 | + var options = Ctor.options; | ||
| 3065 | + var props = {}; | ||
| 3066 | + var propOptions = options.props; | ||
| 3067 | + if (isDef(propOptions)) { | ||
| 3068 | + for (var key in propOptions) { | ||
| 3069 | + props[key] = validateProp(key, propOptions, propsData || emptyObject); | ||
| 3070 | + } | ||
| 3071 | + } else { | ||
| 3072 | + if (isDef(data.attrs)) { mergeProps(props, data.attrs); } | ||
| 3073 | + if (isDef(data.props)) { mergeProps(props, data.props); } | ||
| 3074 | + } | ||
| 3075 | + | ||
| 3076 | + var renderContext = new FunctionalRenderContext( | ||
| 3077 | + data, | ||
| 3078 | + props, | ||
| 3079 | + children, | ||
| 3080 | + contextVm, | ||
| 3081 | + Ctor | ||
| 3082 | + ); | ||
| 3083 | + | ||
| 3084 | + var vnode = options.render.call(null, renderContext._c, renderContext); | ||
| 3085 | + | ||
| 3086 | + if (vnode instanceof VNode) { | ||
| 3087 | + return cloneAndMarkFunctionalResult(vnode, data, renderContext.parent, options, renderContext) | ||
| 3088 | + } else if (Array.isArray(vnode)) { | ||
| 3089 | + var vnodes = normalizeChildren(vnode) || []; | ||
| 3090 | + var res = new Array(vnodes.length); | ||
| 3091 | + for (var i = 0; i < vnodes.length; i++) { | ||
| 3092 | + res[i] = cloneAndMarkFunctionalResult(vnodes[i], data, renderContext.parent, options, renderContext); | ||
| 3093 | + } | ||
| 3094 | + return res | ||
| 3095 | + } | ||
| 3096 | + } | ||
| 3097 | + | ||
| 3098 | + function cloneAndMarkFunctionalResult (vnode, data, contextVm, options, renderContext) { | ||
| 3099 | + // #7817 clone node before setting fnContext, otherwise if the node is reused | ||
| 3100 | + // (e.g. it was from a cached normal slot) the fnContext causes named slots | ||
| 3101 | + // that should not be matched to match. | ||
| 3102 | + var clone = cloneVNode(vnode); | ||
| 3103 | + clone.fnContext = contextVm; | ||
| 3104 | + clone.fnOptions = options; | ||
| 3105 | + { | ||
| 3106 | + (clone.devtoolsMeta = clone.devtoolsMeta || {}).renderContext = renderContext; | ||
| 3107 | + } | ||
| 3108 | + if (data.slot) { | ||
| 3109 | + (clone.data || (clone.data = {})).slot = data.slot; | ||
| 3110 | + } | ||
| 3111 | + return clone | ||
| 3112 | + } | ||
| 3113 | + | ||
| 3114 | + function mergeProps (to, from) { | ||
| 3115 | + for (var key in from) { | ||
| 3116 | + to[camelize(key)] = from[key]; | ||
| 3117 | + } | ||
| 3118 | + } | ||
| 3119 | + | ||
| 3120 | + /* */ | ||
| 3121 | + | ||
| 3122 | + /* */ | ||
| 3123 | + | ||
| 3124 | + /* */ | ||
| 3125 | + | ||
| 3126 | + /* */ | ||
| 3127 | + | ||
| 3128 | + // inline hooks to be invoked on component VNodes during patch | ||
| 3129 | + var componentVNodeHooks = { | ||
| 3130 | + init: function init (vnode, hydrating) { | ||
| 3131 | + if ( | ||
| 3132 | + vnode.componentInstance && | ||
| 3133 | + !vnode.componentInstance._isDestroyed && | ||
| 3134 | + vnode.data.keepAlive | ||
| 3135 | + ) { | ||
| 3136 | + // kept-alive components, treat as a patch | ||
| 3137 | + var mountedNode = vnode; // work around flow | ||
| 3138 | + componentVNodeHooks.prepatch(mountedNode, mountedNode); | ||
| 3139 | + } else { | ||
| 3140 | + var child = vnode.componentInstance = createComponentInstanceForVnode( | ||
| 3141 | + vnode, | ||
| 3142 | + activeInstance | ||
| 3143 | + ); | ||
| 3144 | + child.$mount(hydrating ? vnode.elm : undefined, hydrating); | ||
| 3145 | + } | ||
| 3146 | + }, | ||
| 3147 | + | ||
| 3148 | + prepatch: function prepatch (oldVnode, vnode) { | ||
| 3149 | + var options = vnode.componentOptions; | ||
| 3150 | + var child = vnode.componentInstance = oldVnode.componentInstance; | ||
| 3151 | + updateChildComponent( | ||
| 3152 | + child, | ||
| 3153 | + options.propsData, // updated props | ||
| 3154 | + options.listeners, // updated listeners | ||
| 3155 | + vnode, // new parent vnode | ||
| 3156 | + options.children // new children | ||
| 3157 | + ); | ||
| 3158 | + }, | ||
| 3159 | + | ||
| 3160 | + insert: function insert (vnode) { | ||
| 3161 | + var context = vnode.context; | ||
| 3162 | + var componentInstance = vnode.componentInstance; | ||
| 3163 | + if (!componentInstance._isMounted) { | ||
| 3164 | + componentInstance._isMounted = true; | ||
| 3165 | + callHook(componentInstance, 'mounted'); | ||
| 3166 | + } | ||
| 3167 | + if (vnode.data.keepAlive) { | ||
| 3168 | + if (context._isMounted) { | ||
| 3169 | + // vue-router#1212 | ||
| 3170 | + // During updates, a kept-alive component's child components may | ||
| 3171 | + // change, so directly walking the tree here may call activated hooks | ||
| 3172 | + // on incorrect children. Instead we push them into a queue which will | ||
| 3173 | + // be processed after the whole patch process ended. | ||
| 3174 | + queueActivatedComponent(componentInstance); | ||
| 3175 | + } else { | ||
| 3176 | + activateChildComponent(componentInstance, true /* direct */); | ||
| 3177 | + } | ||
| 3178 | + } | ||
| 3179 | + }, | ||
| 3180 | + | ||
| 3181 | + destroy: function destroy (vnode) { | ||
| 3182 | + var componentInstance = vnode.componentInstance; | ||
| 3183 | + if (!componentInstance._isDestroyed) { | ||
| 3184 | + if (!vnode.data.keepAlive) { | ||
| 3185 | + componentInstance.$destroy(); | ||
| 3186 | + } else { | ||
| 3187 | + deactivateChildComponent(componentInstance, true /* direct */); | ||
| 3188 | + } | ||
| 3189 | + } | ||
| 3190 | + } | ||
| 3191 | + }; | ||
| 3192 | + | ||
| 3193 | + var hooksToMerge = Object.keys(componentVNodeHooks); | ||
| 3194 | + | ||
| 3195 | + function createComponent ( | ||
| 3196 | + Ctor, | ||
| 3197 | + data, | ||
| 3198 | + context, | ||
| 3199 | + children, | ||
| 3200 | + tag | ||
| 3201 | + ) { | ||
| 3202 | + if (isUndef(Ctor)) { | ||
| 3203 | + return | ||
| 3204 | + } | ||
| 3205 | + | ||
| 3206 | + var baseCtor = context.$options._base; | ||
| 3207 | + | ||
| 3208 | + // plain options object: turn it into a constructor | ||
| 3209 | + if (isObject(Ctor)) { | ||
| 3210 | + Ctor = baseCtor.extend(Ctor); | ||
| 3211 | + } | ||
| 3212 | + | ||
| 3213 | + // if at this stage it's not a constructor or an async component factory, | ||
| 3214 | + // reject. | ||
| 3215 | + if (typeof Ctor !== 'function') { | ||
| 3216 | + { | ||
| 3217 | + warn(("Invalid Component definition: " + (String(Ctor))), context); | ||
| 3218 | + } | ||
| 3219 | + return | ||
| 3220 | + } | ||
| 3221 | + | ||
| 3222 | + // async component | ||
| 3223 | + var asyncFactory; | ||
| 3224 | + if (isUndef(Ctor.cid)) { | ||
| 3225 | + asyncFactory = Ctor; | ||
| 3226 | + Ctor = resolveAsyncComponent(asyncFactory, baseCtor); | ||
| 3227 | + if (Ctor === undefined) { | ||
| 3228 | + // return a placeholder node for async component, which is rendered | ||
| 3229 | + // as a comment node but preserves all the raw information for the node. | ||
| 3230 | + // the information will be used for async server-rendering and hydration. | ||
| 3231 | + return createAsyncPlaceholder( | ||
| 3232 | + asyncFactory, | ||
| 3233 | + data, | ||
| 3234 | + context, | ||
| 3235 | + children, | ||
| 3236 | + tag | ||
| 3237 | + ) | ||
| 3238 | + } | ||
| 3239 | + } | ||
| 3240 | + | ||
| 3241 | + data = data || {}; | ||
| 3242 | + | ||
| 3243 | + // resolve constructor options in case global mixins are applied after | ||
| 3244 | + // component constructor creation | ||
| 3245 | + resolveConstructorOptions(Ctor); | ||
| 3246 | + | ||
| 3247 | + // transform component v-model data into props & events | ||
| 3248 | + if (isDef(data.model)) { | ||
| 3249 | + transformModel(Ctor.options, data); | ||
| 3250 | + } | ||
| 3251 | + | ||
| 3252 | + // extract props | ||
| 3253 | + var propsData = extractPropsFromVNodeData(data, Ctor, tag); | ||
| 3254 | + | ||
| 3255 | + // functional component | ||
| 3256 | + if (isTrue(Ctor.options.functional)) { | ||
| 3257 | + return createFunctionalComponent(Ctor, propsData, data, context, children) | ||
| 3258 | + } | ||
| 3259 | + | ||
| 3260 | + // extract listeners, since these needs to be treated as | ||
| 3261 | + // child component listeners instead of DOM listeners | ||
| 3262 | + var listeners = data.on; | ||
| 3263 | + // replace with listeners with .native modifier | ||
| 3264 | + // so it gets processed during parent component patch. | ||
| 3265 | + data.on = data.nativeOn; | ||
| 3266 | + | ||
| 3267 | + if (isTrue(Ctor.options.abstract)) { | ||
| 3268 | + // abstract components do not keep anything | ||
| 3269 | + // other than props & listeners & slot | ||
| 3270 | + | ||
| 3271 | + // work around flow | ||
| 3272 | + var slot = data.slot; | ||
| 3273 | + data = {}; | ||
| 3274 | + if (slot) { | ||
| 3275 | + data.slot = slot; | ||
| 3276 | + } | ||
| 3277 | + } | ||
| 3278 | + | ||
| 3279 | + // install component management hooks onto the placeholder node | ||
| 3280 | + installComponentHooks(data); | ||
| 3281 | + | ||
| 3282 | + // return a placeholder vnode | ||
| 3283 | + var name = Ctor.options.name || tag; | ||
| 3284 | + var vnode = new VNode( | ||
| 3285 | + ("vue-component-" + (Ctor.cid) + (name ? ("-" + name) : '')), | ||
| 3286 | + data, undefined, undefined, undefined, context, | ||
| 3287 | + { Ctor: Ctor, propsData: propsData, listeners: listeners, tag: tag, children: children }, | ||
| 3288 | + asyncFactory | ||
| 3289 | + ); | ||
| 3290 | + | ||
| 3291 | + return vnode | ||
| 3292 | + } | ||
| 3293 | + | ||
| 3294 | + function createComponentInstanceForVnode ( | ||
| 3295 | + // we know it's MountedComponentVNode but flow doesn't | ||
| 3296 | + vnode, | ||
| 3297 | + // activeInstance in lifecycle state | ||
| 3298 | + parent | ||
| 3299 | + ) { | ||
| 3300 | + var options = { | ||
| 3301 | + _isComponent: true, | ||
| 3302 | + _parentVnode: vnode, | ||
| 3303 | + parent: parent | ||
| 3304 | + }; | ||
| 3305 | + // check inline-template render functions | ||
| 3306 | + var inlineTemplate = vnode.data.inlineTemplate; | ||
| 3307 | + if (isDef(inlineTemplate)) { | ||
| 3308 | + options.render = inlineTemplate.render; | ||
| 3309 | + options.staticRenderFns = inlineTemplate.staticRenderFns; | ||
| 3310 | + } | ||
| 3311 | + return new vnode.componentOptions.Ctor(options) | ||
| 3312 | + } | ||
| 3313 | + | ||
| 3314 | + function installComponentHooks (data) { | ||
| 3315 | + var hooks = data.hook || (data.hook = {}); | ||
| 3316 | + for (var i = 0; i < hooksToMerge.length; i++) { | ||
| 3317 | + var key = hooksToMerge[i]; | ||
| 3318 | + var existing = hooks[key]; | ||
| 3319 | + var toMerge = componentVNodeHooks[key]; | ||
| 3320 | + if (existing !== toMerge && !(existing && existing._merged)) { | ||
| 3321 | + hooks[key] = existing ? mergeHook$1(toMerge, existing) : toMerge; | ||
| 3322 | + } | ||
| 3323 | + } | ||
| 3324 | + } | ||
| 3325 | + | ||
| 3326 | + function mergeHook$1 (f1, f2) { | ||
| 3327 | + var merged = function (a, b) { | ||
| 3328 | + // flow complains about extra args which is why we use any | ||
| 3329 | + f1(a, b); | ||
| 3330 | + f2(a, b); | ||
| 3331 | + }; | ||
| 3332 | + merged._merged = true; | ||
| 3333 | + return merged | ||
| 3334 | + } | ||
| 3335 | + | ||
| 3336 | + // transform component v-model info (value and callback) into | ||
| 3337 | + // prop and event handler respectively. | ||
| 3338 | + function transformModel (options, data) { | ||
| 3339 | + var prop = (options.model && options.model.prop) || 'value'; | ||
| 3340 | + var event = (options.model && options.model.event) || 'input' | ||
| 3341 | + ;(data.attrs || (data.attrs = {}))[prop] = data.model.value; | ||
| 3342 | + var on = data.on || (data.on = {}); | ||
| 3343 | + var existing = on[event]; | ||
| 3344 | + var callback = data.model.callback; | ||
| 3345 | + if (isDef(existing)) { | ||
| 3346 | + if ( | ||
| 3347 | + Array.isArray(existing) | ||
| 3348 | + ? existing.indexOf(callback) === -1 | ||
| 3349 | + : existing !== callback | ||
| 3350 | + ) { | ||
| 3351 | + on[event] = [callback].concat(existing); | ||
| 3352 | + } | ||
| 3353 | + } else { | ||
| 3354 | + on[event] = callback; | ||
| 3355 | + } | ||
| 3356 | + } | ||
| 3357 | + | ||
| 3358 | + /* */ | ||
| 3359 | + | ||
| 3360 | + var SIMPLE_NORMALIZE = 1; | ||
| 3361 | + var ALWAYS_NORMALIZE = 2; | ||
| 3362 | + | ||
| 3363 | + // wrapper function for providing a more flexible interface | ||
| 3364 | + // without getting yelled at by flow | ||
| 3365 | + function createElement ( | ||
| 3366 | + context, | ||
| 3367 | + tag, | ||
| 3368 | + data, | ||
| 3369 | + children, | ||
| 3370 | + normalizationType, | ||
| 3371 | + alwaysNormalize | ||
| 3372 | + ) { | ||
| 3373 | + if (Array.isArray(data) || isPrimitive(data)) { | ||
| 3374 | + normalizationType = children; | ||
| 3375 | + children = data; | ||
| 3376 | + data = undefined; | ||
| 3377 | + } | ||
| 3378 | + if (isTrue(alwaysNormalize)) { | ||
| 3379 | + normalizationType = ALWAYS_NORMALIZE; | ||
| 3380 | + } | ||
| 3381 | + return _createElement(context, tag, data, children, normalizationType) | ||
| 3382 | + } | ||
| 3383 | + | ||
| 3384 | + function _createElement ( | ||
| 3385 | + context, | ||
| 3386 | + tag, | ||
| 3387 | + data, | ||
| 3388 | + children, | ||
| 3389 | + normalizationType | ||
| 3390 | + ) { | ||
| 3391 | + if (isDef(data) && isDef((data).__ob__)) { | ||
| 3392 | + warn( | ||
| 3393 | + "Avoid using observed data object as vnode data: " + (JSON.stringify(data)) + "\n" + | ||
| 3394 | + 'Always create fresh vnode data objects in each render!', | ||
| 3395 | + context | ||
| 3396 | + ); | ||
| 3397 | + return createEmptyVNode() | ||
| 3398 | + } | ||
| 3399 | + // object syntax in v-bind | ||
| 3400 | + if (isDef(data) && isDef(data.is)) { | ||
| 3401 | + tag = data.is; | ||
| 3402 | + } | ||
| 3403 | + if (!tag) { | ||
| 3404 | + // in case of component :is set to falsy value | ||
| 3405 | + return createEmptyVNode() | ||
| 3406 | + } | ||
| 3407 | + // warn against non-primitive key | ||
| 3408 | + if (isDef(data) && isDef(data.key) && !isPrimitive(data.key) | ||
| 3409 | + ) { | ||
| 3410 | + { | ||
| 3411 | + warn( | ||
| 3412 | + 'Avoid using non-primitive value as key, ' + | ||
| 3413 | + 'use string/number value instead.', | ||
| 3414 | + context | ||
| 3415 | + ); | ||
| 3416 | + } | ||
| 3417 | + } | ||
| 3418 | + // support single function children as default scoped slot | ||
| 3419 | + if (Array.isArray(children) && | ||
| 3420 | + typeof children[0] === 'function' | ||
| 3421 | + ) { | ||
| 3422 | + data = data || {}; | ||
| 3423 | + data.scopedSlots = { default: children[0] }; | ||
| 3424 | + children.length = 0; | ||
| 3425 | + } | ||
| 3426 | + if (normalizationType === ALWAYS_NORMALIZE) { | ||
| 3427 | + children = normalizeChildren(children); | ||
| 3428 | + } else if (normalizationType === SIMPLE_NORMALIZE) { | ||
| 3429 | + children = simpleNormalizeChildren(children); | ||
| 3430 | + } | ||
| 3431 | + var vnode, ns; | ||
| 3432 | + if (typeof tag === 'string') { | ||
| 3433 | + var Ctor; | ||
| 3434 | + ns = (context.$vnode && context.$vnode.ns) || config.getTagNamespace(tag); | ||
| 3435 | + if (config.isReservedTag(tag)) { | ||
| 3436 | + // platform built-in elements | ||
| 3437 | + if (isDef(data) && isDef(data.nativeOn) && data.tag !== 'component') { | ||
| 3438 | + warn( | ||
| 3439 | + ("The .native modifier for v-on is only valid on components but it was used on <" + tag + ">."), | ||
| 3440 | + context | ||
| 3441 | + ); | ||
| 3442 | + } | ||
| 3443 | + vnode = new VNode( | ||
| 3444 | + config.parsePlatformTagName(tag), data, children, | ||
| 3445 | + undefined, undefined, context | ||
| 3446 | + ); | ||
| 3447 | + } else if ((!data || !data.pre) && isDef(Ctor = resolveAsset(context.$options, 'components', tag))) { | ||
| 3448 | + // component | ||
| 3449 | + vnode = createComponent(Ctor, data, context, children, tag); | ||
| 3450 | + } else { | ||
| 3451 | + // unknown or unlisted namespaced elements | ||
| 3452 | + // check at runtime because it may get assigned a namespace when its | ||
| 3453 | + // parent normalizes children | ||
| 3454 | + vnode = new VNode( | ||
| 3455 | + tag, data, children, | ||
| 3456 | + undefined, undefined, context | ||
| 3457 | + ); | ||
| 3458 | + } | ||
| 3459 | + } else { | ||
| 3460 | + // direct component options / constructor | ||
| 3461 | + vnode = createComponent(tag, data, context, children); | ||
| 3462 | + } | ||
| 3463 | + if (Array.isArray(vnode)) { | ||
| 3464 | + return vnode | ||
| 3465 | + } else if (isDef(vnode)) { | ||
| 3466 | + if (isDef(ns)) { applyNS(vnode, ns); } | ||
| 3467 | + if (isDef(data)) { registerDeepBindings(data); } | ||
| 3468 | + return vnode | ||
| 3469 | + } else { | ||
| 3470 | + return createEmptyVNode() | ||
| 3471 | + } | ||
| 3472 | + } | ||
| 3473 | + | ||
| 3474 | + function applyNS (vnode, ns, force) { | ||
| 3475 | + vnode.ns = ns; | ||
| 3476 | + if (vnode.tag === 'foreignObject') { | ||
| 3477 | + // use default namespace inside foreignObject | ||
| 3478 | + ns = undefined; | ||
| 3479 | + force = true; | ||
| 3480 | + } | ||
| 3481 | + if (isDef(vnode.children)) { | ||
| 3482 | + for (var i = 0, l = vnode.children.length; i < l; i++) { | ||
| 3483 | + var child = vnode.children[i]; | ||
| 3484 | + if (isDef(child.tag) && ( | ||
| 3485 | + isUndef(child.ns) || (isTrue(force) && child.tag !== 'svg'))) { | ||
| 3486 | + applyNS(child, ns, force); | ||
| 3487 | + } | ||
| 3488 | + } | ||
| 3489 | + } | ||
| 3490 | + } | ||
| 3491 | + | ||
| 3492 | + // ref #5318 | ||
| 3493 | + // necessary to ensure parent re-render when deep bindings like :style and | ||
| 3494 | + // :class are used on slot nodes | ||
| 3495 | + function registerDeepBindings (data) { | ||
| 3496 | + if (isObject(data.style)) { | ||
| 3497 | + traverse(data.style); | ||
| 3498 | + } | ||
| 3499 | + if (isObject(data.class)) { | ||
| 3500 | + traverse(data.class); | ||
| 3501 | + } | ||
| 3502 | + } | ||
| 3503 | + | ||
| 3504 | + /* */ | ||
| 3505 | + | ||
| 3506 | + function initRender (vm) { | ||
| 3507 | + vm._vnode = null; // the root of the child tree | ||
| 3508 | + vm._staticTrees = null; // v-once cached trees | ||
| 3509 | + var options = vm.$options; | ||
| 3510 | + var parentVnode = vm.$vnode = options._parentVnode; // the placeholder node in parent tree | ||
| 3511 | + var renderContext = parentVnode && parentVnode.context; | ||
| 3512 | + vm.$slots = resolveSlots(options._renderChildren, renderContext); | ||
| 3513 | + vm.$scopedSlots = emptyObject; | ||
| 3514 | + // bind the createElement fn to this instance | ||
| 3515 | + // so that we get proper render context inside it. | ||
| 3516 | + // args order: tag, data, children, normalizationType, alwaysNormalize | ||
| 3517 | + // internal version is used by render functions compiled from templates | ||
| 3518 | + vm._c = function (a, b, c, d) { return createElement(vm, a, b, c, d, false); }; | ||
| 3519 | + // normalization is always applied for the public version, used in | ||
| 3520 | + // user-written render functions. | ||
| 3521 | + vm.$createElement = function (a, b, c, d) { return createElement(vm, a, b, c, d, true); }; | ||
| 3522 | + | ||
| 3523 | + // $attrs & $listeners are exposed for easier HOC creation. | ||
| 3524 | + // they need to be reactive so that HOCs using them are always updated | ||
| 3525 | + var parentData = parentVnode && parentVnode.data; | ||
| 3526 | + | ||
| 3527 | + /* istanbul ignore else */ | ||
| 3528 | + { | ||
| 3529 | + defineReactive$$1(vm, '$attrs', parentData && parentData.attrs || emptyObject, function () { | ||
| 3530 | + !isUpdatingChildComponent && warn("$attrs is readonly.", vm); | ||
| 3531 | + }, true); | ||
| 3532 | + defineReactive$$1(vm, '$listeners', options._parentListeners || emptyObject, function () { | ||
| 3533 | + !isUpdatingChildComponent && warn("$listeners is readonly.", vm); | ||
| 3534 | + }, true); | ||
| 3535 | + } | ||
| 3536 | + } | ||
| 3537 | + | ||
| 3538 | + var currentRenderingInstance = null; | ||
| 3539 | + | ||
| 3540 | + function renderMixin (Vue) { | ||
| 3541 | + // install runtime convenience helpers | ||
| 3542 | + installRenderHelpers(Vue.prototype); | ||
| 3543 | + | ||
| 3544 | + Vue.prototype.$nextTick = function (fn) { | ||
| 3545 | + return nextTick(fn, this) | ||
| 3546 | + }; | ||
| 3547 | + | ||
| 3548 | + Vue.prototype._render = function () { | ||
| 3549 | + var vm = this; | ||
| 3550 | + var ref = vm.$options; | ||
| 3551 | + var render = ref.render; | ||
| 3552 | + var _parentVnode = ref._parentVnode; | ||
| 3553 | + | ||
| 3554 | + if (_parentVnode) { | ||
| 3555 | + vm.$scopedSlots = normalizeScopedSlots( | ||
| 3556 | + _parentVnode.data.scopedSlots, | ||
| 3557 | + vm.$slots, | ||
| 3558 | + vm.$scopedSlots | ||
| 3559 | + ); | ||
| 3560 | + } | ||
| 3561 | + | ||
| 3562 | + // set parent vnode. this allows render functions to have access | ||
| 3563 | + // to the data on the placeholder node. | ||
| 3564 | + vm.$vnode = _parentVnode; | ||
| 3565 | + // render self | ||
| 3566 | + var vnode; | ||
| 3567 | + try { | ||
| 3568 | + // There's no need to maintain a stack because all render fns are called | ||
| 3569 | + // separately from one another. Nested component's render fns are called | ||
| 3570 | + // when parent component is patched. | ||
| 3571 | + currentRenderingInstance = vm; | ||
| 3572 | + vnode = render.call(vm._renderProxy, vm.$createElement); | ||
| 3573 | + } catch (e) { | ||
| 3574 | + handleError(e, vm, "render"); | ||
| 3575 | + // return error render result, | ||
| 3576 | + // or previous vnode to prevent render error causing blank component | ||
| 3577 | + /* istanbul ignore else */ | ||
| 3578 | + if (vm.$options.renderError) { | ||
| 3579 | + try { | ||
| 3580 | + vnode = vm.$options.renderError.call(vm._renderProxy, vm.$createElement, e); | ||
| 3581 | + } catch (e) { | ||
| 3582 | + handleError(e, vm, "renderError"); | ||
| 3583 | + vnode = vm._vnode; | ||
| 3584 | + } | ||
| 3585 | + } else { | ||
| 3586 | + vnode = vm._vnode; | ||
| 3587 | + } | ||
| 3588 | + } finally { | ||
| 3589 | + currentRenderingInstance = null; | ||
| 3590 | + } | ||
| 3591 | + // if the returned array contains only a single node, allow it | ||
| 3592 | + if (Array.isArray(vnode) && vnode.length === 1) { | ||
| 3593 | + vnode = vnode[0]; | ||
| 3594 | + } | ||
| 3595 | + // return empty vnode in case the render function errored out | ||
| 3596 | + if (!(vnode instanceof VNode)) { | ||
| 3597 | + if (Array.isArray(vnode)) { | ||
| 3598 | + warn( | ||
| 3599 | + 'Multiple root nodes returned from render function. Render function ' + | ||
| 3600 | + 'should return a single root node.', | ||
| 3601 | + vm | ||
| 3602 | + ); | ||
| 3603 | + } | ||
| 3604 | + vnode = createEmptyVNode(); | ||
| 3605 | + } | ||
| 3606 | + // set parent | ||
| 3607 | + vnode.parent = _parentVnode; | ||
| 3608 | + return vnode | ||
| 3609 | + }; | ||
| 3610 | + } | ||
| 3611 | + | ||
| 3612 | + /* */ | ||
| 3613 | + | ||
| 3614 | + function ensureCtor (comp, base) { | ||
| 3615 | + if ( | ||
| 3616 | + comp.__esModule || | ||
| 3617 | + (hasSymbol && comp[Symbol.toStringTag] === 'Module') | ||
| 3618 | + ) { | ||
| 3619 | + comp = comp.default; | ||
| 3620 | + } | ||
| 3621 | + return isObject(comp) | ||
| 3622 | + ? base.extend(comp) | ||
| 3623 | + : comp | ||
| 3624 | + } | ||
| 3625 | + | ||
| 3626 | + function createAsyncPlaceholder ( | ||
| 3627 | + factory, | ||
| 3628 | + data, | ||
| 3629 | + context, | ||
| 3630 | + children, | ||
| 3631 | + tag | ||
| 3632 | + ) { | ||
| 3633 | + var node = createEmptyVNode(); | ||
| 3634 | + node.asyncFactory = factory; | ||
| 3635 | + node.asyncMeta = { data: data, context: context, children: children, tag: tag }; | ||
| 3636 | + return node | ||
| 3637 | + } | ||
| 3638 | + | ||
| 3639 | + function resolveAsyncComponent ( | ||
| 3640 | + factory, | ||
| 3641 | + baseCtor | ||
| 3642 | + ) { | ||
| 3643 | + if (isTrue(factory.error) && isDef(factory.errorComp)) { | ||
| 3644 | + return factory.errorComp | ||
| 3645 | + } | ||
| 3646 | + | ||
| 3647 | + if (isDef(factory.resolved)) { | ||
| 3648 | + return factory.resolved | ||
| 3649 | + } | ||
| 3650 | + | ||
| 3651 | + var owner = currentRenderingInstance; | ||
| 3652 | + if (owner && isDef(factory.owners) && factory.owners.indexOf(owner) === -1) { | ||
| 3653 | + // already pending | ||
| 3654 | + factory.owners.push(owner); | ||
| 3655 | + } | ||
| 3656 | + | ||
| 3657 | + if (isTrue(factory.loading) && isDef(factory.loadingComp)) { | ||
| 3658 | + return factory.loadingComp | ||
| 3659 | + } | ||
| 3660 | + | ||
| 3661 | + if (owner && !isDef(factory.owners)) { | ||
| 3662 | + var owners = factory.owners = [owner]; | ||
| 3663 | + var sync = true; | ||
| 3664 | + var timerLoading = null; | ||
| 3665 | + var timerTimeout = null | ||
| 3666 | + | ||
| 3667 | + ;(owner).$on('hook:destroyed', function () { return remove(owners, owner); }); | ||
| 3668 | + | ||
| 3669 | + var forceRender = function (renderCompleted) { | ||
| 3670 | + for (var i = 0, l = owners.length; i < l; i++) { | ||
| 3671 | + (owners[i]).$forceUpdate(); | ||
| 3672 | + } | ||
| 3673 | + | ||
| 3674 | + if (renderCompleted) { | ||
| 3675 | + owners.length = 0; | ||
| 3676 | + if (timerLoading !== null) { | ||
| 3677 | + clearTimeout(timerLoading); | ||
| 3678 | + timerLoading = null; | ||
| 3679 | + } | ||
| 3680 | + if (timerTimeout !== null) { | ||
| 3681 | + clearTimeout(timerTimeout); | ||
| 3682 | + timerTimeout = null; | ||
| 3683 | + } | ||
| 3684 | + } | ||
| 3685 | + }; | ||
| 3686 | + | ||
| 3687 | + var resolve = once(function (res) { | ||
| 3688 | + // cache resolved | ||
| 3689 | + factory.resolved = ensureCtor(res, baseCtor); | ||
| 3690 | + // invoke callbacks only if this is not a synchronous resolve | ||
| 3691 | + // (async resolves are shimmed as synchronous during SSR) | ||
| 3692 | + if (!sync) { | ||
| 3693 | + forceRender(true); | ||
| 3694 | + } else { | ||
| 3695 | + owners.length = 0; | ||
| 3696 | + } | ||
| 3697 | + }); | ||
| 3698 | + | ||
| 3699 | + var reject = once(function (reason) { | ||
| 3700 | + warn( | ||
| 3701 | + "Failed to resolve async component: " + (String(factory)) + | ||
| 3702 | + (reason ? ("\nReason: " + reason) : '') | ||
| 3703 | + ); | ||
| 3704 | + if (isDef(factory.errorComp)) { | ||
| 3705 | + factory.error = true; | ||
| 3706 | + forceRender(true); | ||
| 3707 | + } | ||
| 3708 | + }); | ||
| 3709 | + | ||
| 3710 | + var res = factory(resolve, reject); | ||
| 3711 | + | ||
| 3712 | + if (isObject(res)) { | ||
| 3713 | + if (isPromise(res)) { | ||
| 3714 | + // () => Promise | ||
| 3715 | + if (isUndef(factory.resolved)) { | ||
| 3716 | + res.then(resolve, reject); | ||
| 3717 | + } | ||
| 3718 | + } else if (isPromise(res.component)) { | ||
| 3719 | + res.component.then(resolve, reject); | ||
| 3720 | + | ||
| 3721 | + if (isDef(res.error)) { | ||
| 3722 | + factory.errorComp = ensureCtor(res.error, baseCtor); | ||
| 3723 | + } | ||
| 3724 | + | ||
| 3725 | + if (isDef(res.loading)) { | ||
| 3726 | + factory.loadingComp = ensureCtor(res.loading, baseCtor); | ||
| 3727 | + if (res.delay === 0) { | ||
| 3728 | + factory.loading = true; | ||
| 3729 | + } else { | ||
| 3730 | + timerLoading = setTimeout(function () { | ||
| 3731 | + timerLoading = null; | ||
| 3732 | + if (isUndef(factory.resolved) && isUndef(factory.error)) { | ||
| 3733 | + factory.loading = true; | ||
| 3734 | + forceRender(false); | ||
| 3735 | + } | ||
| 3736 | + }, res.delay || 200); | ||
| 3737 | + } | ||
| 3738 | + } | ||
| 3739 | + | ||
| 3740 | + if (isDef(res.timeout)) { | ||
| 3741 | + timerTimeout = setTimeout(function () { | ||
| 3742 | + timerTimeout = null; | ||
| 3743 | + if (isUndef(factory.resolved)) { | ||
| 3744 | + reject( | ||
| 3745 | + "timeout (" + (res.timeout) + "ms)" | ||
| 3746 | + ); | ||
| 3747 | + } | ||
| 3748 | + }, res.timeout); | ||
| 3749 | + } | ||
| 3750 | + } | ||
| 3751 | + } | ||
| 3752 | + | ||
| 3753 | + sync = false; | ||
| 3754 | + // return in case resolved synchronously | ||
| 3755 | + return factory.loading | ||
| 3756 | + ? factory.loadingComp | ||
| 3757 | + : factory.resolved | ||
| 3758 | + } | ||
| 3759 | + } | ||
| 3760 | + | ||
| 3761 | + /* */ | ||
| 3762 | + | ||
| 3763 | + function getFirstComponentChild (children) { | ||
| 3764 | + if (Array.isArray(children)) { | ||
| 3765 | + for (var i = 0; i < children.length; i++) { | ||
| 3766 | + var c = children[i]; | ||
| 3767 | + if (isDef(c) && (isDef(c.componentOptions) || isAsyncPlaceholder(c))) { | ||
| 3768 | + return c | ||
| 3769 | + } | ||
| 3770 | + } | ||
| 3771 | + } | ||
| 3772 | + } | ||
| 3773 | + | ||
| 3774 | + /* */ | ||
| 3775 | + | ||
| 3776 | + /* */ | ||
| 3777 | + | ||
| 3778 | + function initEvents (vm) { | ||
| 3779 | + vm._events = Object.create(null); | ||
| 3780 | + vm._hasHookEvent = false; | ||
| 3781 | + // init parent attached events | ||
| 3782 | + var listeners = vm.$options._parentListeners; | ||
| 3783 | + if (listeners) { | ||
| 3784 | + updateComponentListeners(vm, listeners); | ||
| 3785 | + } | ||
| 3786 | + } | ||
| 3787 | + | ||
| 3788 | + var target; | ||
| 3789 | + | ||
| 3790 | + function add (event, fn) { | ||
| 3791 | + target.$on(event, fn); | ||
| 3792 | + } | ||
| 3793 | + | ||
| 3794 | + function remove$1 (event, fn) { | ||
| 3795 | + target.$off(event, fn); | ||
| 3796 | + } | ||
| 3797 | + | ||
| 3798 | + function createOnceHandler (event, fn) { | ||
| 3799 | + var _target = target; | ||
| 3800 | + return function onceHandler () { | ||
| 3801 | + var res = fn.apply(null, arguments); | ||
| 3802 | + if (res !== null) { | ||
| 3803 | + _target.$off(event, onceHandler); | ||
| 3804 | + } | ||
| 3805 | + } | ||
| 3806 | + } | ||
| 3807 | + | ||
| 3808 | + function updateComponentListeners ( | ||
| 3809 | + vm, | ||
| 3810 | + listeners, | ||
| 3811 | + oldListeners | ||
| 3812 | + ) { | ||
| 3813 | + target = vm; | ||
| 3814 | + updateListeners(listeners, oldListeners || {}, add, remove$1, createOnceHandler, vm); | ||
| 3815 | + target = undefined; | ||
| 3816 | + } | ||
| 3817 | + | ||
| 3818 | + function eventsMixin (Vue) { | ||
| 3819 | + var hookRE = /^hook:/; | ||
| 3820 | + Vue.prototype.$on = function (event, fn) { | ||
| 3821 | + var vm = this; | ||
| 3822 | + if (Array.isArray(event)) { | ||
| 3823 | + for (var i = 0, l = event.length; i < l; i++) { | ||
| 3824 | + vm.$on(event[i], fn); | ||
| 3825 | + } | ||
| 3826 | + } else { | ||
| 3827 | + (vm._events[event] || (vm._events[event] = [])).push(fn); | ||
| 3828 | + // optimize hook:event cost by using a boolean flag marked at registration | ||
| 3829 | + // instead of a hash lookup | ||
| 3830 | + if (hookRE.test(event)) { | ||
| 3831 | + vm._hasHookEvent = true; | ||
| 3832 | + } | ||
| 3833 | + } | ||
| 3834 | + return vm | ||
| 3835 | + }; | ||
| 3836 | + | ||
| 3837 | + Vue.prototype.$once = function (event, fn) { | ||
| 3838 | + var vm = this; | ||
| 3839 | + function on () { | ||
| 3840 | + vm.$off(event, on); | ||
| 3841 | + fn.apply(vm, arguments); | ||
| 3842 | + } | ||
| 3843 | + on.fn = fn; | ||
| 3844 | + vm.$on(event, on); | ||
| 3845 | + return vm | ||
| 3846 | + }; | ||
| 3847 | + | ||
| 3848 | + Vue.prototype.$off = function (event, fn) { | ||
| 3849 | + var vm = this; | ||
| 3850 | + // all | ||
| 3851 | + if (!arguments.length) { | ||
| 3852 | + vm._events = Object.create(null); | ||
| 3853 | + return vm | ||
| 3854 | + } | ||
| 3855 | + // array of events | ||
| 3856 | + if (Array.isArray(event)) { | ||
| 3857 | + for (var i$1 = 0, l = event.length; i$1 < l; i$1++) { | ||
| 3858 | + vm.$off(event[i$1], fn); | ||
| 3859 | + } | ||
| 3860 | + return vm | ||
| 3861 | + } | ||
| 3862 | + // specific event | ||
| 3863 | + var cbs = vm._events[event]; | ||
| 3864 | + if (!cbs) { | ||
| 3865 | + return vm | ||
| 3866 | + } | ||
| 3867 | + if (!fn) { | ||
| 3868 | + vm._events[event] = null; | ||
| 3869 | + return vm | ||
| 3870 | + } | ||
| 3871 | + // specific handler | ||
| 3872 | + var cb; | ||
| 3873 | + var i = cbs.length; | ||
| 3874 | + while (i--) { | ||
| 3875 | + cb = cbs[i]; | ||
| 3876 | + if (cb === fn || cb.fn === fn) { | ||
| 3877 | + cbs.splice(i, 1); | ||
| 3878 | + break | ||
| 3879 | + } | ||
| 3880 | + } | ||
| 3881 | + return vm | ||
| 3882 | + }; | ||
| 3883 | + | ||
| 3884 | + Vue.prototype.$emit = function (event) { | ||
| 3885 | + var vm = this; | ||
| 3886 | + { | ||
| 3887 | + var lowerCaseEvent = event.toLowerCase(); | ||
| 3888 | + if (lowerCaseEvent !== event && vm._events[lowerCaseEvent]) { | ||
| 3889 | + tip( | ||
| 3890 | + "Event \"" + lowerCaseEvent + "\" is emitted in component " + | ||
| 3891 | + (formatComponentName(vm)) + " but the handler is registered for \"" + event + "\". " + | ||
| 3892 | + "Note that HTML attributes are case-insensitive and you cannot use " + | ||
| 3893 | + "v-on to listen to camelCase events when using in-DOM templates. " + | ||
| 3894 | + "You should probably use \"" + (hyphenate(event)) + "\" instead of \"" + event + "\"." | ||
| 3895 | + ); | ||
| 3896 | + } | ||
| 3897 | + } | ||
| 3898 | + var cbs = vm._events[event]; | ||
| 3899 | + if (cbs) { | ||
| 3900 | + cbs = cbs.length > 1 ? toArray(cbs) : cbs; | ||
| 3901 | + var args = toArray(arguments, 1); | ||
| 3902 | + var info = "event handler for \"" + event + "\""; | ||
| 3903 | + for (var i = 0, l = cbs.length; i < l; i++) { | ||
| 3904 | + invokeWithErrorHandling(cbs[i], vm, args, vm, info); | ||
| 3905 | + } | ||
| 3906 | + } | ||
| 3907 | + return vm | ||
| 3908 | + }; | ||
| 3909 | + } | ||
| 3910 | + | ||
| 3911 | + /* */ | ||
| 3912 | + | ||
| 3913 | + var activeInstance = null; | ||
| 3914 | + var isUpdatingChildComponent = false; | ||
| 3915 | + | ||
| 3916 | + function setActiveInstance(vm) { | ||
| 3917 | + var prevActiveInstance = activeInstance; | ||
| 3918 | + activeInstance = vm; | ||
| 3919 | + return function () { | ||
| 3920 | + activeInstance = prevActiveInstance; | ||
| 3921 | + } | ||
| 3922 | + } | ||
| 3923 | + | ||
| 3924 | + function initLifecycle (vm) { | ||
| 3925 | + var options = vm.$options; | ||
| 3926 | + | ||
| 3927 | + // locate first non-abstract parent | ||
| 3928 | + var parent = options.parent; | ||
| 3929 | + if (parent && !options.abstract) { | ||
| 3930 | + while (parent.$options.abstract && parent.$parent) { | ||
| 3931 | + parent = parent.$parent; | ||
| 3932 | + } | ||
| 3933 | + parent.$children.push(vm); | ||
| 3934 | + } | ||
| 3935 | + | ||
| 3936 | + vm.$parent = parent; | ||
| 3937 | + vm.$root = parent ? parent.$root : vm; | ||
| 3938 | + | ||
| 3939 | + vm.$children = []; | ||
| 3940 | + vm.$refs = {}; | ||
| 3941 | + | ||
| 3942 | + vm._watcher = null; | ||
| 3943 | + vm._inactive = null; | ||
| 3944 | + vm._directInactive = false; | ||
| 3945 | + vm._isMounted = false; | ||
| 3946 | + vm._isDestroyed = false; | ||
| 3947 | + vm._isBeingDestroyed = false; | ||
| 3948 | + } | ||
| 3949 | + | ||
| 3950 | + function lifecycleMixin (Vue) { | ||
| 3951 | + Vue.prototype._update = function (vnode, hydrating) { | ||
| 3952 | + var vm = this; | ||
| 3953 | + var prevEl = vm.$el; | ||
| 3954 | + var prevVnode = vm._vnode; | ||
| 3955 | + var restoreActiveInstance = setActiveInstance(vm); | ||
| 3956 | + vm._vnode = vnode; | ||
| 3957 | + // Vue.prototype.__patch__ is injected in entry points | ||
| 3958 | + // based on the rendering backend used. | ||
| 3959 | + if (!prevVnode) { | ||
| 3960 | + // initial render | ||
| 3961 | + vm.$el = vm.__patch__(vm.$el, vnode, hydrating, false /* removeOnly */); | ||
| 3962 | + } else { | ||
| 3963 | + // updates | ||
| 3964 | + vm.$el = vm.__patch__(prevVnode, vnode); | ||
| 3965 | + } | ||
| 3966 | + restoreActiveInstance(); | ||
| 3967 | + // update __vue__ reference | ||
| 3968 | + if (prevEl) { | ||
| 3969 | + prevEl.__vue__ = null; | ||
| 3970 | + } | ||
| 3971 | + if (vm.$el) { | ||
| 3972 | + vm.$el.__vue__ = vm; | ||
| 3973 | + } | ||
| 3974 | + // if parent is an HOC, update its $el as well | ||
| 3975 | + if (vm.$vnode && vm.$parent && vm.$vnode === vm.$parent._vnode) { | ||
| 3976 | + vm.$parent.$el = vm.$el; | ||
| 3977 | + } | ||
| 3978 | + // updated hook is called by the scheduler to ensure that children are | ||
| 3979 | + // updated in a parent's updated hook. | ||
| 3980 | + }; | ||
| 3981 | + | ||
| 3982 | + Vue.prototype.$forceUpdate = function () { | ||
| 3983 | + var vm = this; | ||
| 3984 | + if (vm._watcher) { | ||
| 3985 | + vm._watcher.update(); | ||
| 3986 | + } | ||
| 3987 | + }; | ||
| 3988 | + | ||
| 3989 | + Vue.prototype.$destroy = function () { | ||
| 3990 | + var vm = this; | ||
| 3991 | + if (vm._isBeingDestroyed) { | ||
| 3992 | + return | ||
| 3993 | + } | ||
| 3994 | + callHook(vm, 'beforeDestroy'); | ||
| 3995 | + vm._isBeingDestroyed = true; | ||
| 3996 | + // remove self from parent | ||
| 3997 | + var parent = vm.$parent; | ||
| 3998 | + if (parent && !parent._isBeingDestroyed && !vm.$options.abstract) { | ||
| 3999 | + remove(parent.$children, vm); | ||
| 4000 | + } | ||
| 4001 | + // teardown watchers | ||
| 4002 | + if (vm._watcher) { | ||
| 4003 | + vm._watcher.teardown(); | ||
| 4004 | + } | ||
| 4005 | + var i = vm._watchers.length; | ||
| 4006 | + while (i--) { | ||
| 4007 | + vm._watchers[i].teardown(); | ||
| 4008 | + } | ||
| 4009 | + // remove reference from data ob | ||
| 4010 | + // frozen object may not have observer. | ||
| 4011 | + if (vm._data.__ob__) { | ||
| 4012 | + vm._data.__ob__.vmCount--; | ||
| 4013 | + } | ||
| 4014 | + // call the last hook... | ||
| 4015 | + vm._isDestroyed = true; | ||
| 4016 | + // invoke destroy hooks on current rendered tree | ||
| 4017 | + vm.__patch__(vm._vnode, null); | ||
| 4018 | + // fire destroyed hook | ||
| 4019 | + callHook(vm, 'destroyed'); | ||
| 4020 | + // turn off all instance listeners. | ||
| 4021 | + vm.$off(); | ||
| 4022 | + // remove __vue__ reference | ||
| 4023 | + if (vm.$el) { | ||
| 4024 | + vm.$el.__vue__ = null; | ||
| 4025 | + } | ||
| 4026 | + // release circular reference (#6759) | ||
| 4027 | + if (vm.$vnode) { | ||
| 4028 | + vm.$vnode.parent = null; | ||
| 4029 | + } | ||
| 4030 | + }; | ||
| 4031 | + } | ||
| 4032 | + | ||
| 4033 | + function mountComponent ( | ||
| 4034 | + vm, | ||
| 4035 | + el, | ||
| 4036 | + hydrating | ||
| 4037 | + ) { | ||
| 4038 | + vm.$el = el; | ||
| 4039 | + if (!vm.$options.render) { | ||
| 4040 | + vm.$options.render = createEmptyVNode; | ||
| 4041 | + { | ||
| 4042 | + /* istanbul ignore if */ | ||
| 4043 | + if ((vm.$options.template && vm.$options.template.charAt(0) !== '#') || | ||
| 4044 | + vm.$options.el || el) { | ||
| 4045 | + warn( | ||
| 4046 | + 'You are using the runtime-only build of Vue where the template ' + | ||
| 4047 | + 'compiler is not available. Either pre-compile the templates into ' + | ||
| 4048 | + 'render functions, or use the compiler-included build.', | ||
| 4049 | + vm | ||
| 4050 | + ); | ||
| 4051 | + } else { | ||
| 4052 | + warn( | ||
| 4053 | + 'Failed to mount component: template or render function not defined.', | ||
| 4054 | + vm | ||
| 4055 | + ); | ||
| 4056 | + } | ||
| 4057 | + } | ||
| 4058 | + } | ||
| 4059 | + callHook(vm, 'beforeMount'); | ||
| 4060 | + | ||
| 4061 | + var updateComponent; | ||
| 4062 | + /* istanbul ignore if */ | ||
| 4063 | + if (config.performance && mark) { | ||
| 4064 | + updateComponent = function () { | ||
| 4065 | + var name = vm._name; | ||
| 4066 | + var id = vm._uid; | ||
| 4067 | + var startTag = "vue-perf-start:" + id; | ||
| 4068 | + var endTag = "vue-perf-end:" + id; | ||
| 4069 | + | ||
| 4070 | + mark(startTag); | ||
| 4071 | + var vnode = vm._render(); | ||
| 4072 | + mark(endTag); | ||
| 4073 | + measure(("vue " + name + " render"), startTag, endTag); | ||
| 4074 | + | ||
| 4075 | + mark(startTag); | ||
| 4076 | + vm._update(vnode, hydrating); | ||
| 4077 | + mark(endTag); | ||
| 4078 | + measure(("vue " + name + " patch"), startTag, endTag); | ||
| 4079 | + }; | ||
| 4080 | + } else { | ||
| 4081 | + updateComponent = function () { | ||
| 4082 | + vm._update(vm._render(), hydrating); | ||
| 4083 | + }; | ||
| 4084 | + } | ||
| 4085 | + | ||
| 4086 | + // we set this to vm._watcher inside the watcher's constructor | ||
| 4087 | + // since the watcher's initial patch may call $forceUpdate (e.g. inside child | ||
| 4088 | + // component's mounted hook), which relies on vm._watcher being already defined | ||
| 4089 | + new Watcher(vm, updateComponent, noop, { | ||
| 4090 | + before: function before () { | ||
| 4091 | + if (vm._isMounted && !vm._isDestroyed) { | ||
| 4092 | + callHook(vm, 'beforeUpdate'); | ||
| 4093 | + } | ||
| 4094 | + } | ||
| 4095 | + }, true /* isRenderWatcher */); | ||
| 4096 | + hydrating = false; | ||
| 4097 | + | ||
| 4098 | + // manually mounted instance, call mounted on self | ||
| 4099 | + // mounted is called for render-created child components in its inserted hook | ||
| 4100 | + if (vm.$vnode == null) { | ||
| 4101 | + vm._isMounted = true; | ||
| 4102 | + callHook(vm, 'mounted'); | ||
| 4103 | + } | ||
| 4104 | + return vm | ||
| 4105 | + } | ||
| 4106 | + | ||
| 4107 | + function updateChildComponent ( | ||
| 4108 | + vm, | ||
| 4109 | + propsData, | ||
| 4110 | + listeners, | ||
| 4111 | + parentVnode, | ||
| 4112 | + renderChildren | ||
| 4113 | + ) { | ||
| 4114 | + { | ||
| 4115 | + isUpdatingChildComponent = true; | ||
| 4116 | + } | ||
| 4117 | + | ||
| 4118 | + // determine whether component has slot children | ||
| 4119 | + // we need to do this before overwriting $options._renderChildren. | ||
| 4120 | + | ||
| 4121 | + // check if there are dynamic scopedSlots (hand-written or compiled but with | ||
| 4122 | + // dynamic slot names). Static scoped slots compiled from template has the | ||
| 4123 | + // "$stable" marker. | ||
| 4124 | + var newScopedSlots = parentVnode.data.scopedSlots; | ||
| 4125 | + var oldScopedSlots = vm.$scopedSlots; | ||
| 4126 | + var hasDynamicScopedSlot = !!( | ||
| 4127 | + (newScopedSlots && !newScopedSlots.$stable) || | ||
| 4128 | + (oldScopedSlots !== emptyObject && !oldScopedSlots.$stable) || | ||
| 4129 | + (newScopedSlots && vm.$scopedSlots.$key !== newScopedSlots.$key) || | ||
| 4130 | + (!newScopedSlots && vm.$scopedSlots.$key) | ||
| 4131 | + ); | ||
| 4132 | + | ||
| 4133 | + // Any static slot children from the parent may have changed during parent's | ||
| 4134 | + // update. Dynamic scoped slots may also have changed. In such cases, a forced | ||
| 4135 | + // update is necessary to ensure correctness. | ||
| 4136 | + var needsForceUpdate = !!( | ||
| 4137 | + renderChildren || // has new static slots | ||
| 4138 | + vm.$options._renderChildren || // has old static slots | ||
| 4139 | + hasDynamicScopedSlot | ||
| 4140 | + ); | ||
| 4141 | + | ||
| 4142 | + vm.$options._parentVnode = parentVnode; | ||
| 4143 | + vm.$vnode = parentVnode; // update vm's placeholder node without re-render | ||
| 4144 | + | ||
| 4145 | + if (vm._vnode) { // update child tree's parent | ||
| 4146 | + vm._vnode.parent = parentVnode; | ||
| 4147 | + } | ||
| 4148 | + vm.$options._renderChildren = renderChildren; | ||
| 4149 | + | ||
| 4150 | + // update $attrs and $listeners hash | ||
| 4151 | + // these are also reactive so they may trigger child update if the child | ||
| 4152 | + // used them during render | ||
| 4153 | + vm.$attrs = parentVnode.data.attrs || emptyObject; | ||
| 4154 | + vm.$listeners = listeners || emptyObject; | ||
| 4155 | + | ||
| 4156 | + // update props | ||
| 4157 | + if (propsData && vm.$options.props) { | ||
| 4158 | + toggleObserving(false); | ||
| 4159 | + var props = vm._props; | ||
| 4160 | + var propKeys = vm.$options._propKeys || []; | ||
| 4161 | + for (var i = 0; i < propKeys.length; i++) { | ||
| 4162 | + var key = propKeys[i]; | ||
| 4163 | + var propOptions = vm.$options.props; // wtf flow? | ||
| 4164 | + props[key] = validateProp(key, propOptions, propsData, vm); | ||
| 4165 | + } | ||
| 4166 | + toggleObserving(true); | ||
| 4167 | + // keep a copy of raw propsData | ||
| 4168 | + vm.$options.propsData = propsData; | ||
| 4169 | + } | ||
| 4170 | + | ||
| 4171 | + // update listeners | ||
| 4172 | + listeners = listeners || emptyObject; | ||
| 4173 | + var oldListeners = vm.$options._parentListeners; | ||
| 4174 | + vm.$options._parentListeners = listeners; | ||
| 4175 | + updateComponentListeners(vm, listeners, oldListeners); | ||
| 4176 | + | ||
| 4177 | + // resolve slots + force update if has children | ||
| 4178 | + if (needsForceUpdate) { | ||
| 4179 | + vm.$slots = resolveSlots(renderChildren, parentVnode.context); | ||
| 4180 | + vm.$forceUpdate(); | ||
| 4181 | + } | ||
| 4182 | + | ||
| 4183 | + { | ||
| 4184 | + isUpdatingChildComponent = false; | ||
| 4185 | + } | ||
| 4186 | + } | ||
| 4187 | + | ||
| 4188 | + function isInInactiveTree (vm) { | ||
| 4189 | + while (vm && (vm = vm.$parent)) { | ||
| 4190 | + if (vm._inactive) { return true } | ||
| 4191 | + } | ||
| 4192 | + return false | ||
| 4193 | + } | ||
| 4194 | + | ||
| 4195 | + function activateChildComponent (vm, direct) { | ||
| 4196 | + if (direct) { | ||
| 4197 | + vm._directInactive = false; | ||
| 4198 | + if (isInInactiveTree(vm)) { | ||
| 4199 | + return | ||
| 4200 | + } | ||
| 4201 | + } else if (vm._directInactive) { | ||
| 4202 | + return | ||
| 4203 | + } | ||
| 4204 | + if (vm._inactive || vm._inactive === null) { | ||
| 4205 | + vm._inactive = false; | ||
| 4206 | + for (var i = 0; i < vm.$children.length; i++) { | ||
| 4207 | + activateChildComponent(vm.$children[i]); | ||
| 4208 | + } | ||
| 4209 | + callHook(vm, 'activated'); | ||
| 4210 | + } | ||
| 4211 | + } | ||
| 4212 | + | ||
| 4213 | + function deactivateChildComponent (vm, direct) { | ||
| 4214 | + if (direct) { | ||
| 4215 | + vm._directInactive = true; | ||
| 4216 | + if (isInInactiveTree(vm)) { | ||
| 4217 | + return | ||
| 4218 | + } | ||
| 4219 | + } | ||
| 4220 | + if (!vm._inactive) { | ||
| 4221 | + vm._inactive = true; | ||
| 4222 | + for (var i = 0; i < vm.$children.length; i++) { | ||
| 4223 | + deactivateChildComponent(vm.$children[i]); | ||
| 4224 | + } | ||
| 4225 | + callHook(vm, 'deactivated'); | ||
| 4226 | + } | ||
| 4227 | + } | ||
| 4228 | + | ||
| 4229 | + function callHook (vm, hook) { | ||
| 4230 | + // #7573 disable dep collection when invoking lifecycle hooks | ||
| 4231 | + pushTarget(); | ||
| 4232 | + var handlers = vm.$options[hook]; | ||
| 4233 | + var info = hook + " hook"; | ||
| 4234 | + if (handlers) { | ||
| 4235 | + for (var i = 0, j = handlers.length; i < j; i++) { | ||
| 4236 | + invokeWithErrorHandling(handlers[i], vm, null, vm, info); | ||
| 4237 | + } | ||
| 4238 | + } | ||
| 4239 | + if (vm._hasHookEvent) { | ||
| 4240 | + vm.$emit('hook:' + hook); | ||
| 4241 | + } | ||
| 4242 | + popTarget(); | ||
| 4243 | + } | ||
| 4244 | + | ||
| 4245 | + /* */ | ||
| 4246 | + | ||
| 4247 | + var MAX_UPDATE_COUNT = 100; | ||
| 4248 | + | ||
| 4249 | + var queue = []; | ||
| 4250 | + var activatedChildren = []; | ||
| 4251 | + var has = {}; | ||
| 4252 | + var circular = {}; | ||
| 4253 | + var waiting = false; | ||
| 4254 | + var flushing = false; | ||
| 4255 | + var index = 0; | ||
| 4256 | + | ||
| 4257 | + /** | ||
| 4258 | + * Reset the scheduler's state. | ||
| 4259 | + */ | ||
| 4260 | + function resetSchedulerState () { | ||
| 4261 | + index = queue.length = activatedChildren.length = 0; | ||
| 4262 | + has = {}; | ||
| 4263 | + { | ||
| 4264 | + circular = {}; | ||
| 4265 | + } | ||
| 4266 | + waiting = flushing = false; | ||
| 4267 | + } | ||
| 4268 | + | ||
| 4269 | + // Async edge case #6566 requires saving the timestamp when event listeners are | ||
| 4270 | + // attached. However, calling performance.now() has a perf overhead especially | ||
| 4271 | + // if the page has thousands of event listeners. Instead, we take a timestamp | ||
| 4272 | + // every time the scheduler flushes and use that for all event listeners | ||
| 4273 | + // attached during that flush. | ||
| 4274 | + var currentFlushTimestamp = 0; | ||
| 4275 | + | ||
| 4276 | + // Async edge case fix requires storing an event listener's attach timestamp. | ||
| 4277 | + var getNow = Date.now; | ||
| 4278 | + | ||
| 4279 | + // Determine what event timestamp the browser is using. Annoyingly, the | ||
| 4280 | + // timestamp can either be hi-res (relative to page load) or low-res | ||
| 4281 | + // (relative to UNIX epoch), so in order to compare time we have to use the | ||
| 4282 | + // same timestamp type when saving the flush timestamp. | ||
| 4283 | + // All IE versions use low-res event timestamps, and have problematic clock | ||
| 4284 | + // implementations (#9632) | ||
| 4285 | + if (inBrowser && !isIE) { | ||
| 4286 | + var performance = window.performance; | ||
| 4287 | + if ( | ||
| 4288 | + performance && | ||
| 4289 | + typeof performance.now === 'function' && | ||
| 4290 | + getNow() > document.createEvent('Event').timeStamp | ||
| 4291 | + ) { | ||
| 4292 | + // if the event timestamp, although evaluated AFTER the Date.now(), is | ||
| 4293 | + // smaller than it, it means the event is using a hi-res timestamp, | ||
| 4294 | + // and we need to use the hi-res version for event listener timestamps as | ||
| 4295 | + // well. | ||
| 4296 | + getNow = function () { return performance.now(); }; | ||
| 4297 | + } | ||
| 4298 | + } | ||
| 4299 | + | ||
| 4300 | + /** | ||
| 4301 | + * Flush both queues and run the watchers. | ||
| 4302 | + */ | ||
| 4303 | + function flushSchedulerQueue () { | ||
| 4304 | + currentFlushTimestamp = getNow(); | ||
| 4305 | + flushing = true; | ||
| 4306 | + var watcher, id; | ||
| 4307 | + | ||
| 4308 | + // Sort queue before flush. | ||
| 4309 | + // This ensures that: | ||
| 4310 | + // 1. Components are updated from parent to child. (because parent is always | ||
| 4311 | + // created before the child) | ||
| 4312 | + // 2. A component's user watchers are run before its render watcher (because | ||
| 4313 | + // user watchers are created before the render watcher) | ||
| 4314 | + // 3. If a component is destroyed during a parent component's watcher run, | ||
| 4315 | + // its watchers can be skipped. | ||
| 4316 | + queue.sort(function (a, b) { return a.id - b.id; }); | ||
| 4317 | + | ||
| 4318 | + // do not cache length because more watchers might be pushed | ||
| 4319 | + // as we run existing watchers | ||
| 4320 | + for (index = 0; index < queue.length; index++) { | ||
| 4321 | + watcher = queue[index]; | ||
| 4322 | + if (watcher.before) { | ||
| 4323 | + watcher.before(); | ||
| 4324 | + } | ||
| 4325 | + id = watcher.id; | ||
| 4326 | + has[id] = null; | ||
| 4327 | + watcher.run(); | ||
| 4328 | + // in dev build, check and stop circular updates. | ||
| 4329 | + if (has[id] != null) { | ||
| 4330 | + circular[id] = (circular[id] || 0) + 1; | ||
| 4331 | + if (circular[id] > MAX_UPDATE_COUNT) { | ||
| 4332 | + warn( | ||
| 4333 | + 'You may have an infinite update loop ' + ( | ||
| 4334 | + watcher.user | ||
| 4335 | + ? ("in watcher with expression \"" + (watcher.expression) + "\"") | ||
| 4336 | + : "in a component render function." | ||
| 4337 | + ), | ||
| 4338 | + watcher.vm | ||
| 4339 | + ); | ||
| 4340 | + break | ||
| 4341 | + } | ||
| 4342 | + } | ||
| 4343 | + } | ||
| 4344 | + | ||
| 4345 | + // keep copies of post queues before resetting state | ||
| 4346 | + var activatedQueue = activatedChildren.slice(); | ||
| 4347 | + var updatedQueue = queue.slice(); | ||
| 4348 | + | ||
| 4349 | + resetSchedulerState(); | ||
| 4350 | + | ||
| 4351 | + // call component updated and activated hooks | ||
| 4352 | + callActivatedHooks(activatedQueue); | ||
| 4353 | + callUpdatedHooks(updatedQueue); | ||
| 4354 | + | ||
| 4355 | + // devtool hook | ||
| 4356 | + /* istanbul ignore if */ | ||
| 4357 | + if (devtools && config.devtools) { | ||
| 4358 | + devtools.emit('flush'); | ||
| 4359 | + } | ||
| 4360 | + } | ||
| 4361 | + | ||
| 4362 | + function callUpdatedHooks (queue) { | ||
| 4363 | + var i = queue.length; | ||
| 4364 | + while (i--) { | ||
| 4365 | + var watcher = queue[i]; | ||
| 4366 | + var vm = watcher.vm; | ||
| 4367 | + if (vm._watcher === watcher && vm._isMounted && !vm._isDestroyed) { | ||
| 4368 | + callHook(vm, 'updated'); | ||
| 4369 | + } | ||
| 4370 | + } | ||
| 4371 | + } | ||
| 4372 | + | ||
| 4373 | + /** | ||
| 4374 | + * Queue a kept-alive component that was activated during patch. | ||
| 4375 | + * The queue will be processed after the entire tree has been patched. | ||
| 4376 | + */ | ||
| 4377 | + function queueActivatedComponent (vm) { | ||
| 4378 | + // setting _inactive to false here so that a render function can | ||
| 4379 | + // rely on checking whether it's in an inactive tree (e.g. router-view) | ||
| 4380 | + vm._inactive = false; | ||
| 4381 | + activatedChildren.push(vm); | ||
| 4382 | + } | ||
| 4383 | + | ||
| 4384 | + function callActivatedHooks (queue) { | ||
| 4385 | + for (var i = 0; i < queue.length; i++) { | ||
| 4386 | + queue[i]._inactive = true; | ||
| 4387 | + activateChildComponent(queue[i], true /* true */); | ||
| 4388 | + } | ||
| 4389 | + } | ||
| 4390 | + | ||
| 4391 | + /** | ||
| 4392 | + * Push a watcher into the watcher queue. | ||
| 4393 | + * Jobs with duplicate IDs will be skipped unless it's | ||
| 4394 | + * pushed when the queue is being flushed. | ||
| 4395 | + */ | ||
| 4396 | + function queueWatcher (watcher) { | ||
| 4397 | + var id = watcher.id; | ||
| 4398 | + if (has[id] == null) { | ||
| 4399 | + has[id] = true; | ||
| 4400 | + if (!flushing) { | ||
| 4401 | + queue.push(watcher); | ||
| 4402 | + } else { | ||
| 4403 | + // if already flushing, splice the watcher based on its id | ||
| 4404 | + // if already past its id, it will be run next immediately. | ||
| 4405 | + var i = queue.length - 1; | ||
| 4406 | + while (i > index && queue[i].id > watcher.id) { | ||
| 4407 | + i--; | ||
| 4408 | + } | ||
| 4409 | + queue.splice(i + 1, 0, watcher); | ||
| 4410 | + } | ||
| 4411 | + // queue the flush | ||
| 4412 | + if (!waiting) { | ||
| 4413 | + waiting = true; | ||
| 4414 | + | ||
| 4415 | + if (!config.async) { | ||
| 4416 | + flushSchedulerQueue(); | ||
| 4417 | + return | ||
| 4418 | + } | ||
| 4419 | + nextTick(flushSchedulerQueue); | ||
| 4420 | + } | ||
| 4421 | + } | ||
| 4422 | + } | ||
| 4423 | + | ||
| 4424 | + /* */ | ||
| 4425 | + | ||
| 4426 | + | ||
| 4427 | + | ||
| 4428 | + var uid$2 = 0; | ||
| 4429 | + | ||
| 4430 | + /** | ||
| 4431 | + * A watcher parses an expression, collects dependencies, | ||
| 4432 | + * and fires callback when the expression value changes. | ||
| 4433 | + * This is used for both the $watch() api and directives. | ||
| 4434 | + */ | ||
| 4435 | + var Watcher = function Watcher ( | ||
| 4436 | + vm, | ||
| 4437 | + expOrFn, | ||
| 4438 | + cb, | ||
| 4439 | + options, | ||
| 4440 | + isRenderWatcher | ||
| 4441 | + ) { | ||
| 4442 | + this.vm = vm; | ||
| 4443 | + if (isRenderWatcher) { | ||
| 4444 | + vm._watcher = this; | ||
| 4445 | + } | ||
| 4446 | + vm._watchers.push(this); | ||
| 4447 | + // options | ||
| 4448 | + if (options) { | ||
| 4449 | + this.deep = !!options.deep; | ||
| 4450 | + this.user = !!options.user; | ||
| 4451 | + this.lazy = !!options.lazy; | ||
| 4452 | + this.sync = !!options.sync; | ||
| 4453 | + this.before = options.before; | ||
| 4454 | + } else { | ||
| 4455 | + this.deep = this.user = this.lazy = this.sync = false; | ||
| 4456 | + } | ||
| 4457 | + this.cb = cb; | ||
| 4458 | + this.id = ++uid$2; // uid for batching | ||
| 4459 | + this.active = true; | ||
| 4460 | + this.dirty = this.lazy; // for lazy watchers | ||
| 4461 | + this.deps = []; | ||
| 4462 | + this.newDeps = []; | ||
| 4463 | + this.depIds = new _Set(); | ||
| 4464 | + this.newDepIds = new _Set(); | ||
| 4465 | + this.expression = expOrFn.toString(); | ||
| 4466 | + // parse expression for getter | ||
| 4467 | + if (typeof expOrFn === 'function') { | ||
| 4468 | + this.getter = expOrFn; | ||
| 4469 | + } else { | ||
| 4470 | + this.getter = parsePath(expOrFn); | ||
| 4471 | + if (!this.getter) { | ||
| 4472 | + this.getter = noop; | ||
| 4473 | + warn( | ||
| 4474 | + "Failed watching path: \"" + expOrFn + "\" " + | ||
| 4475 | + 'Watcher only accepts simple dot-delimited paths. ' + | ||
| 4476 | + 'For full control, use a function instead.', | ||
| 4477 | + vm | ||
| 4478 | + ); | ||
| 4479 | + } | ||
| 4480 | + } | ||
| 4481 | + this.value = this.lazy | ||
| 4482 | + ? undefined | ||
| 4483 | + : this.get(); | ||
| 4484 | + }; | ||
| 4485 | + | ||
| 4486 | + /** | ||
| 4487 | + * Evaluate the getter, and re-collect dependencies. | ||
| 4488 | + */ | ||
| 4489 | + Watcher.prototype.get = function get () { | ||
| 4490 | + pushTarget(this); | ||
| 4491 | + var value; | ||
| 4492 | + var vm = this.vm; | ||
| 4493 | + try { | ||
| 4494 | + value = this.getter.call(vm, vm); | ||
| 4495 | + } catch (e) { | ||
| 4496 | + if (this.user) { | ||
| 4497 | + handleError(e, vm, ("getter for watcher \"" + (this.expression) + "\"")); | ||
| 4498 | + } else { | ||
| 4499 | + throw e | ||
| 4500 | + } | ||
| 4501 | + } finally { | ||
| 4502 | + // "touch" every property so they are all tracked as | ||
| 4503 | + // dependencies for deep watching | ||
| 4504 | + if (this.deep) { | ||
| 4505 | + traverse(value); | ||
| 4506 | + } | ||
| 4507 | + popTarget(); | ||
| 4508 | + this.cleanupDeps(); | ||
| 4509 | + } | ||
| 4510 | + return value | ||
| 4511 | + }; | ||
| 4512 | + | ||
| 4513 | + /** | ||
| 4514 | + * Add a dependency to this directive. | ||
| 4515 | + */ | ||
| 4516 | + Watcher.prototype.addDep = function addDep (dep) { | ||
| 4517 | + var id = dep.id; | ||
| 4518 | + if (!this.newDepIds.has(id)) { | ||
| 4519 | + this.newDepIds.add(id); | ||
| 4520 | + this.newDeps.push(dep); | ||
| 4521 | + if (!this.depIds.has(id)) { | ||
| 4522 | + dep.addSub(this); | ||
| 4523 | + } | ||
| 4524 | + } | ||
| 4525 | + }; | ||
| 4526 | + | ||
| 4527 | + /** | ||
| 4528 | + * Clean up for dependency collection. | ||
| 4529 | + */ | ||
| 4530 | + Watcher.prototype.cleanupDeps = function cleanupDeps () { | ||
| 4531 | + var i = this.deps.length; | ||
| 4532 | + while (i--) { | ||
| 4533 | + var dep = this.deps[i]; | ||
| 4534 | + if (!this.newDepIds.has(dep.id)) { | ||
| 4535 | + dep.removeSub(this); | ||
| 4536 | + } | ||
| 4537 | + } | ||
| 4538 | + var tmp = this.depIds; | ||
| 4539 | + this.depIds = this.newDepIds; | ||
| 4540 | + this.newDepIds = tmp; | ||
| 4541 | + this.newDepIds.clear(); | ||
| 4542 | + tmp = this.deps; | ||
| 4543 | + this.deps = this.newDeps; | ||
| 4544 | + this.newDeps = tmp; | ||
| 4545 | + this.newDeps.length = 0; | ||
| 4546 | + }; | ||
| 4547 | + | ||
| 4548 | + /** | ||
| 4549 | + * Subscriber interface. | ||
| 4550 | + * Will be called when a dependency changes. | ||
| 4551 | + */ | ||
| 4552 | + Watcher.prototype.update = function update () { | ||
| 4553 | + /* istanbul ignore else */ | ||
| 4554 | + if (this.lazy) { | ||
| 4555 | + this.dirty = true; | ||
| 4556 | + } else if (this.sync) { | ||
| 4557 | + this.run(); | ||
| 4558 | + } else { | ||
| 4559 | + queueWatcher(this); | ||
| 4560 | + } | ||
| 4561 | + }; | ||
| 4562 | + | ||
| 4563 | + /** | ||
| 4564 | + * Scheduler job interface. | ||
| 4565 | + * Will be called by the scheduler. | ||
| 4566 | + */ | ||
| 4567 | + Watcher.prototype.run = function run () { | ||
| 4568 | + if (this.active) { | ||
| 4569 | + var value = this.get(); | ||
| 4570 | + if ( | ||
| 4571 | + value !== this.value || | ||
| 4572 | + // Deep watchers and watchers on Object/Arrays should fire even | ||
| 4573 | + // when the value is the same, because the value may | ||
| 4574 | + // have mutated. | ||
| 4575 | + isObject(value) || | ||
| 4576 | + this.deep | ||
| 4577 | + ) { | ||
| 4578 | + // set new value | ||
| 4579 | + var oldValue = this.value; | ||
| 4580 | + this.value = value; | ||
| 4581 | + if (this.user) { | ||
| 4582 | + var info = "callback for watcher \"" + (this.expression) + "\""; | ||
| 4583 | + invokeWithErrorHandling(this.cb, this.vm, [value, oldValue], this.vm, info); | ||
| 4584 | + } else { | ||
| 4585 | + this.cb.call(this.vm, value, oldValue); | ||
| 4586 | + } | ||
| 4587 | + } | ||
| 4588 | + } | ||
| 4589 | + }; | ||
| 4590 | + | ||
| 4591 | + /** | ||
| 4592 | + * Evaluate the value of the watcher. | ||
| 4593 | + * This only gets called for lazy watchers. | ||
| 4594 | + */ | ||
| 4595 | + Watcher.prototype.evaluate = function evaluate () { | ||
| 4596 | + this.value = this.get(); | ||
| 4597 | + this.dirty = false; | ||
| 4598 | + }; | ||
| 4599 | + | ||
| 4600 | + /** | ||
| 4601 | + * Depend on all deps collected by this watcher. | ||
| 4602 | + */ | ||
| 4603 | + Watcher.prototype.depend = function depend () { | ||
| 4604 | + var i = this.deps.length; | ||
| 4605 | + while (i--) { | ||
| 4606 | + this.deps[i].depend(); | ||
| 4607 | + } | ||
| 4608 | + }; | ||
| 4609 | + | ||
| 4610 | + /** | ||
| 4611 | + * Remove self from all dependencies' subscriber list. | ||
| 4612 | + */ | ||
| 4613 | + Watcher.prototype.teardown = function teardown () { | ||
| 4614 | + if (this.active) { | ||
| 4615 | + // remove self from vm's watcher list | ||
| 4616 | + // this is a somewhat expensive operation so we skip it | ||
| 4617 | + // if the vm is being destroyed. | ||
| 4618 | + if (!this.vm._isBeingDestroyed) { | ||
| 4619 | + remove(this.vm._watchers, this); | ||
| 4620 | + } | ||
| 4621 | + var i = this.deps.length; | ||
| 4622 | + while (i--) { | ||
| 4623 | + this.deps[i].removeSub(this); | ||
| 4624 | + } | ||
| 4625 | + this.active = false; | ||
| 4626 | + } | ||
| 4627 | + }; | ||
| 4628 | + | ||
| 4629 | + /* */ | ||
| 4630 | + | ||
| 4631 | + var sharedPropertyDefinition = { | ||
| 4632 | + enumerable: true, | ||
| 4633 | + configurable: true, | ||
| 4634 | + get: noop, | ||
| 4635 | + set: noop | ||
| 4636 | + }; | ||
| 4637 | + | ||
| 4638 | + function proxy (target, sourceKey, key) { | ||
| 4639 | + sharedPropertyDefinition.get = function proxyGetter () { | ||
| 4640 | + return this[sourceKey][key] | ||
| 4641 | + }; | ||
| 4642 | + sharedPropertyDefinition.set = function proxySetter (val) { | ||
| 4643 | + this[sourceKey][key] = val; | ||
| 4644 | + }; | ||
| 4645 | + Object.defineProperty(target, key, sharedPropertyDefinition); | ||
| 4646 | + } | ||
| 4647 | + | ||
| 4648 | + function initState (vm) { | ||
| 4649 | + vm._watchers = []; | ||
| 4650 | + var opts = vm.$options; | ||
| 4651 | + if (opts.props) { initProps(vm, opts.props); } | ||
| 4652 | + if (opts.methods) { initMethods(vm, opts.methods); } | ||
| 4653 | + if (opts.data) { | ||
| 4654 | + initData(vm); | ||
| 4655 | + } else { | ||
| 4656 | + observe(vm._data = {}, true /* asRootData */); | ||
| 4657 | + } | ||
| 4658 | + if (opts.computed) { initComputed(vm, opts.computed); } | ||
| 4659 | + if (opts.watch && opts.watch !== nativeWatch) { | ||
| 4660 | + initWatch(vm, opts.watch); | ||
| 4661 | + } | ||
| 4662 | + } | ||
| 4663 | + | ||
| 4664 | + function initProps (vm, propsOptions) { | ||
| 4665 | + var propsData = vm.$options.propsData || {}; | ||
| 4666 | + var props = vm._props = {}; | ||
| 4667 | + // cache prop keys so that future props updates can iterate using Array | ||
| 4668 | + // instead of dynamic object key enumeration. | ||
| 4669 | + var keys = vm.$options._propKeys = []; | ||
| 4670 | + var isRoot = !vm.$parent; | ||
| 4671 | + // root instance props should be converted | ||
| 4672 | + if (!isRoot) { | ||
| 4673 | + toggleObserving(false); | ||
| 4674 | + } | ||
| 4675 | + var loop = function ( key ) { | ||
| 4676 | + keys.push(key); | ||
| 4677 | + var value = validateProp(key, propsOptions, propsData, vm); | ||
| 4678 | + /* istanbul ignore else */ | ||
| 4679 | + { | ||
| 4680 | + var hyphenatedKey = hyphenate(key); | ||
| 4681 | + if (isReservedAttribute(hyphenatedKey) || | ||
| 4682 | + config.isReservedAttr(hyphenatedKey)) { | ||
| 4683 | + warn( | ||
| 4684 | + ("\"" + hyphenatedKey + "\" is a reserved attribute and cannot be used as component prop."), | ||
| 4685 | + vm | ||
| 4686 | + ); | ||
| 4687 | + } | ||
| 4688 | + defineReactive$$1(props, key, value, function () { | ||
| 4689 | + if (!isRoot && !isUpdatingChildComponent) { | ||
| 4690 | + warn( | ||
| 4691 | + "Avoid mutating a prop directly since the value will be " + | ||
| 4692 | + "overwritten whenever the parent component re-renders. " + | ||
| 4693 | + "Instead, use a data or computed property based on the prop's " + | ||
| 4694 | + "value. Prop being mutated: \"" + key + "\"", | ||
| 4695 | + vm | ||
| 4696 | + ); | ||
| 4697 | + } | ||
| 4698 | + }); | ||
| 4699 | + } | ||
| 4700 | + // static props are already proxied on the component's prototype | ||
| 4701 | + // during Vue.extend(). We only need to proxy props defined at | ||
| 4702 | + // instantiation here. | ||
| 4703 | + if (!(key in vm)) { | ||
| 4704 | + proxy(vm, "_props", key); | ||
| 4705 | + } | ||
| 4706 | + }; | ||
| 4707 | + | ||
| 4708 | + for (var key in propsOptions) loop( key ); | ||
| 4709 | + toggleObserving(true); | ||
| 4710 | + } | ||
| 4711 | + | ||
| 4712 | + function initData (vm) { | ||
| 4713 | + var data = vm.$options.data; | ||
| 4714 | + data = vm._data = typeof data === 'function' | ||
| 4715 | + ? getData(data, vm) | ||
| 4716 | + : data || {}; | ||
| 4717 | + if (!isPlainObject(data)) { | ||
| 4718 | + data = {}; | ||
| 4719 | + warn( | ||
| 4720 | + 'data functions should return an object:\n' + | ||
| 4721 | + 'https://vuejs.org/v2/guide/components.html#data-Must-Be-a-Function', | ||
| 4722 | + vm | ||
| 4723 | + ); | ||
| 4724 | + } | ||
| 4725 | + // proxy data on instance | ||
| 4726 | + var keys = Object.keys(data); | ||
| 4727 | + var props = vm.$options.props; | ||
| 4728 | + var methods = vm.$options.methods; | ||
| 4729 | + var i = keys.length; | ||
| 4730 | + while (i--) { | ||
| 4731 | + var key = keys[i]; | ||
| 4732 | + { | ||
| 4733 | + if (methods && hasOwn(methods, key)) { | ||
| 4734 | + warn( | ||
| 4735 | + ("Method \"" + key + "\" has already been defined as a data property."), | ||
| 4736 | + vm | ||
| 4737 | + ); | ||
| 4738 | + } | ||
| 4739 | + } | ||
| 4740 | + if (props && hasOwn(props, key)) { | ||
| 4741 | + warn( | ||
| 4742 | + "The data property \"" + key + "\" is already declared as a prop. " + | ||
| 4743 | + "Use prop default value instead.", | ||
| 4744 | + vm | ||
| 4745 | + ); | ||
| 4746 | + } else if (!isReserved(key)) { | ||
| 4747 | + proxy(vm, "_data", key); | ||
| 4748 | + } | ||
| 4749 | + } | ||
| 4750 | + // observe data | ||
| 4751 | + observe(data, true /* asRootData */); | ||
| 4752 | + } | ||
| 4753 | + | ||
| 4754 | + function getData (data, vm) { | ||
| 4755 | + // #7573 disable dep collection when invoking data getters | ||
| 4756 | + pushTarget(); | ||
| 4757 | + try { | ||
| 4758 | + return data.call(vm, vm) | ||
| 4759 | + } catch (e) { | ||
| 4760 | + handleError(e, vm, "data()"); | ||
| 4761 | + return {} | ||
| 4762 | + } finally { | ||
| 4763 | + popTarget(); | ||
| 4764 | + } | ||
| 4765 | + } | ||
| 4766 | + | ||
| 4767 | + var computedWatcherOptions = { lazy: true }; | ||
| 4768 | + | ||
| 4769 | + function initComputed (vm, computed) { | ||
| 4770 | + // $flow-disable-line | ||
| 4771 | + var watchers = vm._computedWatchers = Object.create(null); | ||
| 4772 | + // computed properties are just getters during SSR | ||
| 4773 | + var isSSR = isServerRendering(); | ||
| 4774 | + | ||
| 4775 | + for (var key in computed) { | ||
| 4776 | + var userDef = computed[key]; | ||
| 4777 | + var getter = typeof userDef === 'function' ? userDef : userDef.get; | ||
| 4778 | + if (getter == null) { | ||
| 4779 | + warn( | ||
| 4780 | + ("Getter is missing for computed property \"" + key + "\"."), | ||
| 4781 | + vm | ||
| 4782 | + ); | ||
| 4783 | + } | ||
| 4784 | + | ||
| 4785 | + if (!isSSR) { | ||
| 4786 | + // create internal watcher for the computed property. | ||
| 4787 | + watchers[key] = new Watcher( | ||
| 4788 | + vm, | ||
| 4789 | + getter || noop, | ||
| 4790 | + noop, | ||
| 4791 | + computedWatcherOptions | ||
| 4792 | + ); | ||
| 4793 | + } | ||
| 4794 | + | ||
| 4795 | + // component-defined computed properties are already defined on the | ||
| 4796 | + // component prototype. We only need to define computed properties defined | ||
| 4797 | + // at instantiation here. | ||
| 4798 | + if (!(key in vm)) { | ||
| 4799 | + defineComputed(vm, key, userDef); | ||
| 4800 | + } else { | ||
| 4801 | + if (key in vm.$data) { | ||
| 4802 | + warn(("The computed property \"" + key + "\" is already defined in data."), vm); | ||
| 4803 | + } else if (vm.$options.props && key in vm.$options.props) { | ||
| 4804 | + warn(("The computed property \"" + key + "\" is already defined as a prop."), vm); | ||
| 4805 | + } else if (vm.$options.methods && key in vm.$options.methods) { | ||
| 4806 | + warn(("The computed property \"" + key + "\" is already defined as a method."), vm); | ||
| 4807 | + } | ||
| 4808 | + } | ||
| 4809 | + } | ||
| 4810 | + } | ||
| 4811 | + | ||
| 4812 | + function defineComputed ( | ||
| 4813 | + target, | ||
| 4814 | + key, | ||
| 4815 | + userDef | ||
| 4816 | + ) { | ||
| 4817 | + var shouldCache = !isServerRendering(); | ||
| 4818 | + if (typeof userDef === 'function') { | ||
| 4819 | + sharedPropertyDefinition.get = shouldCache | ||
| 4820 | + ? createComputedGetter(key) | ||
| 4821 | + : createGetterInvoker(userDef); | ||
| 4822 | + sharedPropertyDefinition.set = noop; | ||
| 4823 | + } else { | ||
| 4824 | + sharedPropertyDefinition.get = userDef.get | ||
| 4825 | + ? shouldCache && userDef.cache !== false | ||
| 4826 | + ? createComputedGetter(key) | ||
| 4827 | + : createGetterInvoker(userDef.get) | ||
| 4828 | + : noop; | ||
| 4829 | + sharedPropertyDefinition.set = userDef.set || noop; | ||
| 4830 | + } | ||
| 4831 | + if (sharedPropertyDefinition.set === noop) { | ||
| 4832 | + sharedPropertyDefinition.set = function () { | ||
| 4833 | + warn( | ||
| 4834 | + ("Computed property \"" + key + "\" was assigned to but it has no setter."), | ||
| 4835 | + this | ||
| 4836 | + ); | ||
| 4837 | + }; | ||
| 4838 | + } | ||
| 4839 | + Object.defineProperty(target, key, sharedPropertyDefinition); | ||
| 4840 | + } | ||
| 4841 | + | ||
| 4842 | + function createComputedGetter (key) { | ||
| 4843 | + return function computedGetter () { | ||
| 4844 | + var watcher = this._computedWatchers && this._computedWatchers[key]; | ||
| 4845 | + if (watcher) { | ||
| 4846 | + if (watcher.dirty) { | ||
| 4847 | + watcher.evaluate(); | ||
| 4848 | + } | ||
| 4849 | + if (Dep.target) { | ||
| 4850 | + watcher.depend(); | ||
| 4851 | + } | ||
| 4852 | + return watcher.value | ||
| 4853 | + } | ||
| 4854 | + } | ||
| 4855 | + } | ||
| 4856 | + | ||
| 4857 | + function createGetterInvoker(fn) { | ||
| 4858 | + return function computedGetter () { | ||
| 4859 | + return fn.call(this, this) | ||
| 4860 | + } | ||
| 4861 | + } | ||
| 4862 | + | ||
| 4863 | + function initMethods (vm, methods) { | ||
| 4864 | + var props = vm.$options.props; | ||
| 4865 | + for (var key in methods) { | ||
| 4866 | + { | ||
| 4867 | + if (typeof methods[key] !== 'function') { | ||
| 4868 | + warn( | ||
| 4869 | + "Method \"" + key + "\" has type \"" + (typeof methods[key]) + "\" in the component definition. " + | ||
| 4870 | + "Did you reference the function correctly?", | ||
| 4871 | + vm | ||
| 4872 | + ); | ||
| 4873 | + } | ||
| 4874 | + if (props && hasOwn(props, key)) { | ||
| 4875 | + warn( | ||
| 4876 | + ("Method \"" + key + "\" has already been defined as a prop."), | ||
| 4877 | + vm | ||
| 4878 | + ); | ||
| 4879 | + } | ||
| 4880 | + if ((key in vm) && isReserved(key)) { | ||
| 4881 | + warn( | ||
| 4882 | + "Method \"" + key + "\" conflicts with an existing Vue instance method. " + | ||
| 4883 | + "Avoid defining component methods that start with _ or $." | ||
| 4884 | + ); | ||
| 4885 | + } | ||
| 4886 | + } | ||
| 4887 | + vm[key] = typeof methods[key] !== 'function' ? noop : bind(methods[key], vm); | ||
| 4888 | + } | ||
| 4889 | + } | ||
| 4890 | + | ||
| 4891 | + function initWatch (vm, watch) { | ||
| 4892 | + for (var key in watch) { | ||
| 4893 | + var handler = watch[key]; | ||
| 4894 | + if (Array.isArray(handler)) { | ||
| 4895 | + for (var i = 0; i < handler.length; i++) { | ||
| 4896 | + createWatcher(vm, key, handler[i]); | ||
| 4897 | + } | ||
| 4898 | + } else { | ||
| 4899 | + createWatcher(vm, key, handler); | ||
| 4900 | + } | ||
| 4901 | + } | ||
| 4902 | + } | ||
| 4903 | + | ||
| 4904 | + function createWatcher ( | ||
| 4905 | + vm, | ||
| 4906 | + expOrFn, | ||
| 4907 | + handler, | ||
| 4908 | + options | ||
| 4909 | + ) { | ||
| 4910 | + if (isPlainObject(handler)) { | ||
| 4911 | + options = handler; | ||
| 4912 | + handler = handler.handler; | ||
| 4913 | + } | ||
| 4914 | + if (typeof handler === 'string') { | ||
| 4915 | + handler = vm[handler]; | ||
| 4916 | + } | ||
| 4917 | + return vm.$watch(expOrFn, handler, options) | ||
| 4918 | + } | ||
| 4919 | + | ||
| 4920 | + function stateMixin (Vue) { | ||
| 4921 | + // flow somehow has problems with directly declared definition object | ||
| 4922 | + // when using Object.defineProperty, so we have to procedurally build up | ||
| 4923 | + // the object here. | ||
| 4924 | + var dataDef = {}; | ||
| 4925 | + dataDef.get = function () { return this._data }; | ||
| 4926 | + var propsDef = {}; | ||
| 4927 | + propsDef.get = function () { return this._props }; | ||
| 4928 | + { | ||
| 4929 | + dataDef.set = function () { | ||
| 4930 | + warn( | ||
| 4931 | + 'Avoid replacing instance root $data. ' + | ||
| 4932 | + 'Use nested data properties instead.', | ||
| 4933 | + this | ||
| 4934 | + ); | ||
| 4935 | + }; | ||
| 4936 | + propsDef.set = function () { | ||
| 4937 | + warn("$props is readonly.", this); | ||
| 4938 | + }; | ||
| 4939 | + } | ||
| 4940 | + Object.defineProperty(Vue.prototype, '$data', dataDef); | ||
| 4941 | + Object.defineProperty(Vue.prototype, '$props', propsDef); | ||
| 4942 | + | ||
| 4943 | + Vue.prototype.$set = set; | ||
| 4944 | + Vue.prototype.$delete = del; | ||
| 4945 | + | ||
| 4946 | + Vue.prototype.$watch = function ( | ||
| 4947 | + expOrFn, | ||
| 4948 | + cb, | ||
| 4949 | + options | ||
| 4950 | + ) { | ||
| 4951 | + var vm = this; | ||
| 4952 | + if (isPlainObject(cb)) { | ||
| 4953 | + return createWatcher(vm, expOrFn, cb, options) | ||
| 4954 | + } | ||
| 4955 | + options = options || {}; | ||
| 4956 | + options.user = true; | ||
| 4957 | + var watcher = new Watcher(vm, expOrFn, cb, options); | ||
| 4958 | + if (options.immediate) { | ||
| 4959 | + var info = "callback for immediate watcher \"" + (watcher.expression) + "\""; | ||
| 4960 | + pushTarget(); | ||
| 4961 | + invokeWithErrorHandling(cb, vm, [watcher.value], vm, info); | ||
| 4962 | + popTarget(); | ||
| 4963 | + } | ||
| 4964 | + return function unwatchFn () { | ||
| 4965 | + watcher.teardown(); | ||
| 4966 | + } | ||
| 4967 | + }; | ||
| 4968 | + } | ||
| 4969 | + | ||
| 4970 | + /* */ | ||
| 4971 | + | ||
| 4972 | + var uid$3 = 0; | ||
| 4973 | + | ||
| 4974 | + function initMixin (Vue) { | ||
| 4975 | + Vue.prototype._init = function (options) { | ||
| 4976 | + var vm = this; | ||
| 4977 | + // a uid | ||
| 4978 | + vm._uid = uid$3++; | ||
| 4979 | + | ||
| 4980 | + var startTag, endTag; | ||
| 4981 | + /* istanbul ignore if */ | ||
| 4982 | + if (config.performance && mark) { | ||
| 4983 | + startTag = "vue-perf-start:" + (vm._uid); | ||
| 4984 | + endTag = "vue-perf-end:" + (vm._uid); | ||
| 4985 | + mark(startTag); | ||
| 4986 | + } | ||
| 4987 | + | ||
| 4988 | + // a flag to avoid this being observed | ||
| 4989 | + vm._isVue = true; | ||
| 4990 | + // merge options | ||
| 4991 | + if (options && options._isComponent) { | ||
| 4992 | + // optimize internal component instantiation | ||
| 4993 | + // since dynamic options merging is pretty slow, and none of the | ||
| 4994 | + // internal component options needs special treatment. | ||
| 4995 | + initInternalComponent(vm, options); | ||
| 4996 | + } else { | ||
| 4997 | + vm.$options = mergeOptions( | ||
| 4998 | + resolveConstructorOptions(vm.constructor), | ||
| 4999 | + options || {}, | ||
| 5000 | + vm | ||
| 5001 | + ); | ||
| 5002 | + } | ||
| 5003 | + /* istanbul ignore else */ | ||
| 5004 | + { | ||
| 5005 | + initProxy(vm); | ||
| 5006 | + } | ||
| 5007 | + // expose real self | ||
| 5008 | + vm._self = vm; | ||
| 5009 | + initLifecycle(vm); | ||
| 5010 | + initEvents(vm); | ||
| 5011 | + initRender(vm); | ||
| 5012 | + callHook(vm, 'beforeCreate'); | ||
| 5013 | + initInjections(vm); // resolve injections before data/props | ||
| 5014 | + initState(vm); | ||
| 5015 | + initProvide(vm); // resolve provide after data/props | ||
| 5016 | + callHook(vm, 'created'); | ||
| 5017 | + | ||
| 5018 | + /* istanbul ignore if */ | ||
| 5019 | + if (config.performance && mark) { | ||
| 5020 | + vm._name = formatComponentName(vm, false); | ||
| 5021 | + mark(endTag); | ||
| 5022 | + measure(("vue " + (vm._name) + " init"), startTag, endTag); | ||
| 5023 | + } | ||
| 5024 | + | ||
| 5025 | + if (vm.$options.el) { | ||
| 5026 | + vm.$mount(vm.$options.el); | ||
| 5027 | + } | ||
| 5028 | + }; | ||
| 5029 | + } | ||
| 5030 | + | ||
| 5031 | + function initInternalComponent (vm, options) { | ||
| 5032 | + var opts = vm.$options = Object.create(vm.constructor.options); | ||
| 5033 | + // doing this because it's faster than dynamic enumeration. | ||
| 5034 | + var parentVnode = options._parentVnode; | ||
| 5035 | + opts.parent = options.parent; | ||
| 5036 | + opts._parentVnode = parentVnode; | ||
| 5037 | + | ||
| 5038 | + var vnodeComponentOptions = parentVnode.componentOptions; | ||
| 5039 | + opts.propsData = vnodeComponentOptions.propsData; | ||
| 5040 | + opts._parentListeners = vnodeComponentOptions.listeners; | ||
| 5041 | + opts._renderChildren = vnodeComponentOptions.children; | ||
| 5042 | + opts._componentTag = vnodeComponentOptions.tag; | ||
| 5043 | + | ||
| 5044 | + if (options.render) { | ||
| 5045 | + opts.render = options.render; | ||
| 5046 | + opts.staticRenderFns = options.staticRenderFns; | ||
| 5047 | + } | ||
| 5048 | + } | ||
| 5049 | + | ||
| 5050 | + function resolveConstructorOptions (Ctor) { | ||
| 5051 | + var options = Ctor.options; | ||
| 5052 | + if (Ctor.super) { | ||
| 5053 | + var superOptions = resolveConstructorOptions(Ctor.super); | ||
| 5054 | + var cachedSuperOptions = Ctor.superOptions; | ||
| 5055 | + if (superOptions !== cachedSuperOptions) { | ||
| 5056 | + // super option changed, | ||
| 5057 | + // need to resolve new options. | ||
| 5058 | + Ctor.superOptions = superOptions; | ||
| 5059 | + // check if there are any late-modified/attached options (#4976) | ||
| 5060 | + var modifiedOptions = resolveModifiedOptions(Ctor); | ||
| 5061 | + // update base extend options | ||
| 5062 | + if (modifiedOptions) { | ||
| 5063 | + extend(Ctor.extendOptions, modifiedOptions); | ||
| 5064 | + } | ||
| 5065 | + options = Ctor.options = mergeOptions(superOptions, Ctor.extendOptions); | ||
| 5066 | + if (options.name) { | ||
| 5067 | + options.components[options.name] = Ctor; | ||
| 5068 | + } | ||
| 5069 | + } | ||
| 5070 | + } | ||
| 5071 | + return options | ||
| 5072 | + } | ||
| 5073 | + | ||
| 5074 | + function resolveModifiedOptions (Ctor) { | ||
| 5075 | + var modified; | ||
| 5076 | + var latest = Ctor.options; | ||
| 5077 | + var sealed = Ctor.sealedOptions; | ||
| 5078 | + for (var key in latest) { | ||
| 5079 | + if (latest[key] !== sealed[key]) { | ||
| 5080 | + if (!modified) { modified = {}; } | ||
| 5081 | + modified[key] = latest[key]; | ||
| 5082 | + } | ||
| 5083 | + } | ||
| 5084 | + return modified | ||
| 5085 | + } | ||
| 5086 | + | ||
| 5087 | + function Vue (options) { | ||
| 5088 | + if (!(this instanceof Vue) | ||
| 5089 | + ) { | ||
| 5090 | + warn('Vue is a constructor and should be called with the `new` keyword'); | ||
| 5091 | + } | ||
| 5092 | + this._init(options); | ||
| 5093 | + } | ||
| 5094 | + | ||
| 5095 | + initMixin(Vue); | ||
| 5096 | + stateMixin(Vue); | ||
| 5097 | + eventsMixin(Vue); | ||
| 5098 | + lifecycleMixin(Vue); | ||
| 5099 | + renderMixin(Vue); | ||
| 5100 | + | ||
| 5101 | + /* */ | ||
| 5102 | + | ||
| 5103 | + function initUse (Vue) { | ||
| 5104 | + Vue.use = function (plugin) { | ||
| 5105 | + var installedPlugins = (this._installedPlugins || (this._installedPlugins = [])); | ||
| 5106 | + if (installedPlugins.indexOf(plugin) > -1) { | ||
| 5107 | + return this | ||
| 5108 | + } | ||
| 5109 | + | ||
| 5110 | + // additional parameters | ||
| 5111 | + var args = toArray(arguments, 1); | ||
| 5112 | + args.unshift(this); | ||
| 5113 | + if (typeof plugin.install === 'function') { | ||
| 5114 | + plugin.install.apply(plugin, args); | ||
| 5115 | + } else if (typeof plugin === 'function') { | ||
| 5116 | + plugin.apply(null, args); | ||
| 5117 | + } | ||
| 5118 | + installedPlugins.push(plugin); | ||
| 5119 | + return this | ||
| 5120 | + }; | ||
| 5121 | + } | ||
| 5122 | + | ||
| 5123 | + /* */ | ||
| 5124 | + | ||
| 5125 | + function initMixin$1 (Vue) { | ||
| 5126 | + Vue.mixin = function (mixin) { | ||
| 5127 | + this.options = mergeOptions(this.options, mixin); | ||
| 5128 | + return this | ||
| 5129 | + }; | ||
| 5130 | + } | ||
| 5131 | + | ||
| 5132 | + /* */ | ||
| 5133 | + | ||
| 5134 | + function initExtend (Vue) { | ||
| 5135 | + /** | ||
| 5136 | + * Each instance constructor, including Vue, has a unique | ||
| 5137 | + * cid. This enables us to create wrapped "child | ||
| 5138 | + * constructors" for prototypal inheritance and cache them. | ||
| 5139 | + */ | ||
| 5140 | + Vue.cid = 0; | ||
| 5141 | + var cid = 1; | ||
| 5142 | + | ||
| 5143 | + /** | ||
| 5144 | + * Class inheritance | ||
| 5145 | + */ | ||
| 5146 | + Vue.extend = function (extendOptions) { | ||
| 5147 | + extendOptions = extendOptions || {}; | ||
| 5148 | + var Super = this; | ||
| 5149 | + var SuperId = Super.cid; | ||
| 5150 | + var cachedCtors = extendOptions._Ctor || (extendOptions._Ctor = {}); | ||
| 5151 | + if (cachedCtors[SuperId]) { | ||
| 5152 | + return cachedCtors[SuperId] | ||
| 5153 | + } | ||
| 5154 | + | ||
| 5155 | + var name = extendOptions.name || Super.options.name; | ||
| 5156 | + if (name) { | ||
| 5157 | + validateComponentName(name); | ||
| 5158 | + } | ||
| 5159 | + | ||
| 5160 | + var Sub = function VueComponent (options) { | ||
| 5161 | + this._init(options); | ||
| 5162 | + }; | ||
| 5163 | + Sub.prototype = Object.create(Super.prototype); | ||
| 5164 | + Sub.prototype.constructor = Sub; | ||
| 5165 | + Sub.cid = cid++; | ||
| 5166 | + Sub.options = mergeOptions( | ||
| 5167 | + Super.options, | ||
| 5168 | + extendOptions | ||
| 5169 | + ); | ||
| 5170 | + Sub['super'] = Super; | ||
| 5171 | + | ||
| 5172 | + // For props and computed properties, we define the proxy getters on | ||
| 5173 | + // the Vue instances at extension time, on the extended prototype. This | ||
| 5174 | + // avoids Object.defineProperty calls for each instance created. | ||
| 5175 | + if (Sub.options.props) { | ||
| 5176 | + initProps$1(Sub); | ||
| 5177 | + } | ||
| 5178 | + if (Sub.options.computed) { | ||
| 5179 | + initComputed$1(Sub); | ||
| 5180 | + } | ||
| 5181 | + | ||
| 5182 | + // allow further extension/mixin/plugin usage | ||
| 5183 | + Sub.extend = Super.extend; | ||
| 5184 | + Sub.mixin = Super.mixin; | ||
| 5185 | + Sub.use = Super.use; | ||
| 5186 | + | ||
| 5187 | + // create asset registers, so extended classes | ||
| 5188 | + // can have their private assets too. | ||
| 5189 | + ASSET_TYPES.forEach(function (type) { | ||
| 5190 | + Sub[type] = Super[type]; | ||
| 5191 | + }); | ||
| 5192 | + // enable recursive self-lookup | ||
| 5193 | + if (name) { | ||
| 5194 | + Sub.options.components[name] = Sub; | ||
| 5195 | + } | ||
| 5196 | + | ||
| 5197 | + // keep a reference to the super options at extension time. | ||
| 5198 | + // later at instantiation we can check if Super's options have | ||
| 5199 | + // been updated. | ||
| 5200 | + Sub.superOptions = Super.options; | ||
| 5201 | + Sub.extendOptions = extendOptions; | ||
| 5202 | + Sub.sealedOptions = extend({}, Sub.options); | ||
| 5203 | + | ||
| 5204 | + // cache constructor | ||
| 5205 | + cachedCtors[SuperId] = Sub; | ||
| 5206 | + return Sub | ||
| 5207 | + }; | ||
| 5208 | + } | ||
| 5209 | + | ||
| 5210 | + function initProps$1 (Comp) { | ||
| 5211 | + var props = Comp.options.props; | ||
| 5212 | + for (var key in props) { | ||
| 5213 | + proxy(Comp.prototype, "_props", key); | ||
| 5214 | + } | ||
| 5215 | + } | ||
| 5216 | + | ||
| 5217 | + function initComputed$1 (Comp) { | ||
| 5218 | + var computed = Comp.options.computed; | ||
| 5219 | + for (var key in computed) { | ||
| 5220 | + defineComputed(Comp.prototype, key, computed[key]); | ||
| 5221 | + } | ||
| 5222 | + } | ||
| 5223 | + | ||
| 5224 | + /* */ | ||
| 5225 | + | ||
| 5226 | + function initAssetRegisters (Vue) { | ||
| 5227 | + /** | ||
| 5228 | + * Create asset registration methods. | ||
| 5229 | + */ | ||
| 5230 | + ASSET_TYPES.forEach(function (type) { | ||
| 5231 | + Vue[type] = function ( | ||
| 5232 | + id, | ||
| 5233 | + definition | ||
| 5234 | + ) { | ||
| 5235 | + if (!definition) { | ||
| 5236 | + return this.options[type + 's'][id] | ||
| 5237 | + } else { | ||
| 5238 | + /* istanbul ignore if */ | ||
| 5239 | + if (type === 'component') { | ||
| 5240 | + validateComponentName(id); | ||
| 5241 | + } | ||
| 5242 | + if (type === 'component' && isPlainObject(definition)) { | ||
| 5243 | + definition.name = definition.name || id; | ||
| 5244 | + definition = this.options._base.extend(definition); | ||
| 5245 | + } | ||
| 5246 | + if (type === 'directive' && typeof definition === 'function') { | ||
| 5247 | + definition = { bind: definition, update: definition }; | ||
| 5248 | + } | ||
| 5249 | + this.options[type + 's'][id] = definition; | ||
| 5250 | + return definition | ||
| 5251 | + } | ||
| 5252 | + }; | ||
| 5253 | + }); | ||
| 5254 | + } | ||
| 5255 | + | ||
| 5256 | + /* */ | ||
| 5257 | + | ||
| 5258 | + | ||
| 5259 | + | ||
| 5260 | + | ||
| 5261 | + | ||
| 5262 | + function getComponentName (opts) { | ||
| 5263 | + return opts && (opts.Ctor.options.name || opts.tag) | ||
| 5264 | + } | ||
| 5265 | + | ||
| 5266 | + function matches (pattern, name) { | ||
| 5267 | + if (Array.isArray(pattern)) { | ||
| 5268 | + return pattern.indexOf(name) > -1 | ||
| 5269 | + } else if (typeof pattern === 'string') { | ||
| 5270 | + return pattern.split(',').indexOf(name) > -1 | ||
| 5271 | + } else if (isRegExp(pattern)) { | ||
| 5272 | + return pattern.test(name) | ||
| 5273 | + } | ||
| 5274 | + /* istanbul ignore next */ | ||
| 5275 | + return false | ||
| 5276 | + } | ||
| 5277 | + | ||
| 5278 | + function pruneCache (keepAliveInstance, filter) { | ||
| 5279 | + var cache = keepAliveInstance.cache; | ||
| 5280 | + var keys = keepAliveInstance.keys; | ||
| 5281 | + var _vnode = keepAliveInstance._vnode; | ||
| 5282 | + for (var key in cache) { | ||
| 5283 | + var entry = cache[key]; | ||
| 5284 | + if (entry) { | ||
| 5285 | + var name = entry.name; | ||
| 5286 | + if (name && !filter(name)) { | ||
| 5287 | + pruneCacheEntry(cache, key, keys, _vnode); | ||
| 5288 | + } | ||
| 5289 | + } | ||
| 5290 | + } | ||
| 5291 | + } | ||
| 5292 | + | ||
| 5293 | + function pruneCacheEntry ( | ||
| 5294 | + cache, | ||
| 5295 | + key, | ||
| 5296 | + keys, | ||
| 5297 | + current | ||
| 5298 | + ) { | ||
| 5299 | + var entry = cache[key]; | ||
| 5300 | + if (entry && (!current || entry.tag !== current.tag)) { | ||
| 5301 | + entry.componentInstance.$destroy(); | ||
| 5302 | + } | ||
| 5303 | + cache[key] = null; | ||
| 5304 | + remove(keys, key); | ||
| 5305 | + } | ||
| 5306 | + | ||
| 5307 | + var patternTypes = [String, RegExp, Array]; | ||
| 5308 | + | ||
| 5309 | + var KeepAlive = { | ||
| 5310 | + name: 'keep-alive', | ||
| 5311 | + abstract: true, | ||
| 5312 | + | ||
| 5313 | + props: { | ||
| 5314 | + include: patternTypes, | ||
| 5315 | + exclude: patternTypes, | ||
| 5316 | + max: [String, Number] | ||
| 5317 | + }, | ||
| 5318 | + | ||
| 5319 | + methods: { | ||
| 5320 | + cacheVNode: function cacheVNode() { | ||
| 5321 | + var ref = this; | ||
| 5322 | + var cache = ref.cache; | ||
| 5323 | + var keys = ref.keys; | ||
| 5324 | + var vnodeToCache = ref.vnodeToCache; | ||
| 5325 | + var keyToCache = ref.keyToCache; | ||
| 5326 | + if (vnodeToCache) { | ||
| 5327 | + var tag = vnodeToCache.tag; | ||
| 5328 | + var componentInstance = vnodeToCache.componentInstance; | ||
| 5329 | + var componentOptions = vnodeToCache.componentOptions; | ||
| 5330 | + cache[keyToCache] = { | ||
| 5331 | + name: getComponentName(componentOptions), | ||
| 5332 | + tag: tag, | ||
| 5333 | + componentInstance: componentInstance, | ||
| 5334 | + }; | ||
| 5335 | + keys.push(keyToCache); | ||
| 5336 | + // prune oldest entry | ||
| 5337 | + if (this.max && keys.length > parseInt(this.max)) { | ||
| 5338 | + pruneCacheEntry(cache, keys[0], keys, this._vnode); | ||
| 5339 | + } | ||
| 5340 | + this.vnodeToCache = null; | ||
| 5341 | + } | ||
| 5342 | + } | ||
| 5343 | + }, | ||
| 5344 | + | ||
| 5345 | + created: function created () { | ||
| 5346 | + this.cache = Object.create(null); | ||
| 5347 | + this.keys = []; | ||
| 5348 | + }, | ||
| 5349 | + | ||
| 5350 | + destroyed: function destroyed () { | ||
| 5351 | + for (var key in this.cache) { | ||
| 5352 | + pruneCacheEntry(this.cache, key, this.keys); | ||
| 5353 | + } | ||
| 5354 | + }, | ||
| 5355 | + | ||
| 5356 | + mounted: function mounted () { | ||
| 5357 | + var this$1 = this; | ||
| 5358 | + | ||
| 5359 | + this.cacheVNode(); | ||
| 5360 | + this.$watch('include', function (val) { | ||
| 5361 | + pruneCache(this$1, function (name) { return matches(val, name); }); | ||
| 5362 | + }); | ||
| 5363 | + this.$watch('exclude', function (val) { | ||
| 5364 | + pruneCache(this$1, function (name) { return !matches(val, name); }); | ||
| 5365 | + }); | ||
| 5366 | + }, | ||
| 5367 | + | ||
| 5368 | + updated: function updated () { | ||
| 5369 | + this.cacheVNode(); | ||
| 5370 | + }, | ||
| 5371 | + | ||
| 5372 | + render: function render () { | ||
| 5373 | + var slot = this.$slots.default; | ||
| 5374 | + var vnode = getFirstComponentChild(slot); | ||
| 5375 | + var componentOptions = vnode && vnode.componentOptions; | ||
| 5376 | + if (componentOptions) { | ||
| 5377 | + // check pattern | ||
| 5378 | + var name = getComponentName(componentOptions); | ||
| 5379 | + var ref = this; | ||
| 5380 | + var include = ref.include; | ||
| 5381 | + var exclude = ref.exclude; | ||
| 5382 | + if ( | ||
| 5383 | + // not included | ||
| 5384 | + (include && (!name || !matches(include, name))) || | ||
| 5385 | + // excluded | ||
| 5386 | + (exclude && name && matches(exclude, name)) | ||
| 5387 | + ) { | ||
| 5388 | + return vnode | ||
| 5389 | + } | ||
| 5390 | + | ||
| 5391 | + var ref$1 = this; | ||
| 5392 | + var cache = ref$1.cache; | ||
| 5393 | + var keys = ref$1.keys; | ||
| 5394 | + var key = vnode.key == null | ||
| 5395 | + // same constructor may get registered as different local components | ||
| 5396 | + // so cid alone is not enough (#3269) | ||
| 5397 | + ? componentOptions.Ctor.cid + (componentOptions.tag ? ("::" + (componentOptions.tag)) : '') | ||
| 5398 | + : vnode.key; | ||
| 5399 | + if (cache[key]) { | ||
| 5400 | + vnode.componentInstance = cache[key].componentInstance; | ||
| 5401 | + // make current key freshest | ||
| 5402 | + remove(keys, key); | ||
| 5403 | + keys.push(key); | ||
| 5404 | + } else { | ||
| 5405 | + // delay setting the cache until update | ||
| 5406 | + this.vnodeToCache = vnode; | ||
| 5407 | + this.keyToCache = key; | ||
| 5408 | + } | ||
| 5409 | + | ||
| 5410 | + vnode.data.keepAlive = true; | ||
| 5411 | + } | ||
| 5412 | + return vnode || (slot && slot[0]) | ||
| 5413 | + } | ||
| 5414 | + }; | ||
| 5415 | + | ||
| 5416 | + var builtInComponents = { | ||
| 5417 | + KeepAlive: KeepAlive | ||
| 5418 | + }; | ||
| 5419 | + | ||
| 5420 | + /* */ | ||
| 5421 | + | ||
| 5422 | + function initGlobalAPI (Vue) { | ||
| 5423 | + // config | ||
| 5424 | + var configDef = {}; | ||
| 5425 | + configDef.get = function () { return config; }; | ||
| 5426 | + { | ||
| 5427 | + configDef.set = function () { | ||
| 5428 | + warn( | ||
| 5429 | + 'Do not replace the Vue.config object, set individual fields instead.' | ||
| 5430 | + ); | ||
| 5431 | + }; | ||
| 5432 | + } | ||
| 5433 | + Object.defineProperty(Vue, 'config', configDef); | ||
| 5434 | + | ||
| 5435 | + // exposed util methods. | ||
| 5436 | + // NOTE: these are not considered part of the public API - avoid relying on | ||
| 5437 | + // them unless you are aware of the risk. | ||
| 5438 | + Vue.util = { | ||
| 5439 | + warn: warn, | ||
| 5440 | + extend: extend, | ||
| 5441 | + mergeOptions: mergeOptions, | ||
| 5442 | + defineReactive: defineReactive$$1 | ||
| 5443 | + }; | ||
| 5444 | + | ||
| 5445 | + Vue.set = set; | ||
| 5446 | + Vue.delete = del; | ||
| 5447 | + Vue.nextTick = nextTick; | ||
| 5448 | + | ||
| 5449 | + // 2.6 explicit observable API | ||
| 5450 | + Vue.observable = function (obj) { | ||
| 5451 | + observe(obj); | ||
| 5452 | + return obj | ||
| 5453 | + }; | ||
| 5454 | + | ||
| 5455 | + Vue.options = Object.create(null); | ||
| 5456 | + ASSET_TYPES.forEach(function (type) { | ||
| 5457 | + Vue.options[type + 's'] = Object.create(null); | ||
| 5458 | + }); | ||
| 5459 | + | ||
| 5460 | + // this is used to identify the "base" constructor to extend all plain-object | ||
| 5461 | + // components with in Weex's multi-instance scenarios. | ||
| 5462 | + Vue.options._base = Vue; | ||
| 5463 | + | ||
| 5464 | + extend(Vue.options.components, builtInComponents); | ||
| 5465 | + | ||
| 5466 | + initUse(Vue); | ||
| 5467 | + initMixin$1(Vue); | ||
| 5468 | + initExtend(Vue); | ||
| 5469 | + initAssetRegisters(Vue); | ||
| 5470 | + } | ||
| 5471 | + | ||
| 5472 | + initGlobalAPI(Vue); | ||
| 5473 | + | ||
| 5474 | + Object.defineProperty(Vue.prototype, '$isServer', { | ||
| 5475 | + get: isServerRendering | ||
| 5476 | + }); | ||
| 5477 | + | ||
| 5478 | + Object.defineProperty(Vue.prototype, '$ssrContext', { | ||
| 5479 | + get: function get () { | ||
| 5480 | + /* istanbul ignore next */ | ||
| 5481 | + return this.$vnode && this.$vnode.ssrContext | ||
| 5482 | + } | ||
| 5483 | + }); | ||
| 5484 | + | ||
| 5485 | + // expose FunctionalRenderContext for ssr runtime helper installation | ||
| 5486 | + Object.defineProperty(Vue, 'FunctionalRenderContext', { | ||
| 5487 | + value: FunctionalRenderContext | ||
| 5488 | + }); | ||
| 5489 | + | ||
| 5490 | + Vue.version = '2.6.14'; | ||
| 5491 | + | ||
| 5492 | + /* */ | ||
| 5493 | + | ||
| 5494 | + // these are reserved for web because they are directly compiled away | ||
| 5495 | + // during template compilation | ||
| 5496 | + var isReservedAttr = makeMap('style,class'); | ||
| 5497 | + | ||
| 5498 | + // attributes that should be using props for binding | ||
| 5499 | + var acceptValue = makeMap('input,textarea,option,select,progress'); | ||
| 5500 | + var mustUseProp = function (tag, type, attr) { | ||
| 5501 | + return ( | ||
| 5502 | + (attr === 'value' && acceptValue(tag)) && type !== 'button' || | ||
| 5503 | + (attr === 'selected' && tag === 'option') || | ||
| 5504 | + (attr === 'checked' && tag === 'input') || | ||
| 5505 | + (attr === 'muted' && tag === 'video') | ||
| 5506 | + ) | ||
| 5507 | + }; | ||
| 5508 | + | ||
| 5509 | + var isEnumeratedAttr = makeMap('contenteditable,draggable,spellcheck'); | ||
| 5510 | + | ||
| 5511 | + var isValidContentEditableValue = makeMap('events,caret,typing,plaintext-only'); | ||
| 5512 | + | ||
| 5513 | + var convertEnumeratedValue = function (key, value) { | ||
| 5514 | + return isFalsyAttrValue(value) || value === 'false' | ||
| 5515 | + ? 'false' | ||
| 5516 | + // allow arbitrary string value for contenteditable | ||
| 5517 | + : key === 'contenteditable' && isValidContentEditableValue(value) | ||
| 5518 | + ? value | ||
| 5519 | + : 'true' | ||
| 5520 | + }; | ||
| 5521 | + | ||
| 5522 | + var isBooleanAttr = makeMap( | ||
| 5523 | + 'allowfullscreen,async,autofocus,autoplay,checked,compact,controls,declare,' + | ||
| 5524 | + 'default,defaultchecked,defaultmuted,defaultselected,defer,disabled,' + | ||
| 5525 | + 'enabled,formnovalidate,hidden,indeterminate,inert,ismap,itemscope,loop,multiple,' + | ||
| 5526 | + 'muted,nohref,noresize,noshade,novalidate,nowrap,open,pauseonexit,readonly,' + | ||
| 5527 | + 'required,reversed,scoped,seamless,selected,sortable,' + | ||
| 5528 | + 'truespeed,typemustmatch,visible' | ||
| 5529 | + ); | ||
| 5530 | + | ||
| 5531 | + var xlinkNS = 'http://www.w3.org/1999/xlink'; | ||
| 5532 | + | ||
| 5533 | + var isXlink = function (name) { | ||
| 5534 | + return name.charAt(5) === ':' && name.slice(0, 5) === 'xlink' | ||
| 5535 | + }; | ||
| 5536 | + | ||
| 5537 | + var getXlinkProp = function (name) { | ||
| 5538 | + return isXlink(name) ? name.slice(6, name.length) : '' | ||
| 5539 | + }; | ||
| 5540 | + | ||
| 5541 | + var isFalsyAttrValue = function (val) { | ||
| 5542 | + return val == null || val === false | ||
| 5543 | + }; | ||
| 5544 | + | ||
| 5545 | + /* */ | ||
| 5546 | + | ||
| 5547 | + function genClassForVnode (vnode) { | ||
| 5548 | + var data = vnode.data; | ||
| 5549 | + var parentNode = vnode; | ||
| 5550 | + var childNode = vnode; | ||
| 5551 | + while (isDef(childNode.componentInstance)) { | ||
| 5552 | + childNode = childNode.componentInstance._vnode; | ||
| 5553 | + if (childNode && childNode.data) { | ||
| 5554 | + data = mergeClassData(childNode.data, data); | ||
| 5555 | + } | ||
| 5556 | + } | ||
| 5557 | + while (isDef(parentNode = parentNode.parent)) { | ||
| 5558 | + if (parentNode && parentNode.data) { | ||
| 5559 | + data = mergeClassData(data, parentNode.data); | ||
| 5560 | + } | ||
| 5561 | + } | ||
| 5562 | + return renderClass(data.staticClass, data.class) | ||
| 5563 | + } | ||
| 5564 | + | ||
| 5565 | + function mergeClassData (child, parent) { | ||
| 5566 | + return { | ||
| 5567 | + staticClass: concat(child.staticClass, parent.staticClass), | ||
| 5568 | + class: isDef(child.class) | ||
| 5569 | + ? [child.class, parent.class] | ||
| 5570 | + : parent.class | ||
| 5571 | + } | ||
| 5572 | + } | ||
| 5573 | + | ||
| 5574 | + function renderClass ( | ||
| 5575 | + staticClass, | ||
| 5576 | + dynamicClass | ||
| 5577 | + ) { | ||
| 5578 | + if (isDef(staticClass) || isDef(dynamicClass)) { | ||
| 5579 | + return concat(staticClass, stringifyClass(dynamicClass)) | ||
| 5580 | + } | ||
| 5581 | + /* istanbul ignore next */ | ||
| 5582 | + return '' | ||
| 5583 | + } | ||
| 5584 | + | ||
| 5585 | + function concat (a, b) { | ||
| 5586 | + return a ? b ? (a + ' ' + b) : a : (b || '') | ||
| 5587 | + } | ||
| 5588 | + | ||
| 5589 | + function stringifyClass (value) { | ||
| 5590 | + if (Array.isArray(value)) { | ||
| 5591 | + return stringifyArray(value) | ||
| 5592 | + } | ||
| 5593 | + if (isObject(value)) { | ||
| 5594 | + return stringifyObject(value) | ||
| 5595 | + } | ||
| 5596 | + if (typeof value === 'string') { | ||
| 5597 | + return value | ||
| 5598 | + } | ||
| 5599 | + /* istanbul ignore next */ | ||
| 5600 | + return '' | ||
| 5601 | + } | ||
| 5602 | + | ||
| 5603 | + function stringifyArray (value) { | ||
| 5604 | + var res = ''; | ||
| 5605 | + var stringified; | ||
| 5606 | + for (var i = 0, l = value.length; i < l; i++) { | ||
| 5607 | + if (isDef(stringified = stringifyClass(value[i])) && stringified !== '') { | ||
| 5608 | + if (res) { res += ' '; } | ||
| 5609 | + res += stringified; | ||
| 5610 | + } | ||
| 5611 | + } | ||
| 5612 | + return res | ||
| 5613 | + } | ||
| 5614 | + | ||
| 5615 | + function stringifyObject (value) { | ||
| 5616 | + var res = ''; | ||
| 5617 | + for (var key in value) { | ||
| 5618 | + if (value[key]) { | ||
| 5619 | + if (res) { res += ' '; } | ||
| 5620 | + res += key; | ||
| 5621 | + } | ||
| 5622 | + } | ||
| 5623 | + return res | ||
| 5624 | + } | ||
| 5625 | + | ||
| 5626 | + /* */ | ||
| 5627 | + | ||
| 5628 | + var namespaceMap = { | ||
| 5629 | + svg: 'http://www.w3.org/2000/svg', | ||
| 5630 | + math: 'http://www.w3.org/1998/Math/MathML' | ||
| 5631 | + }; | ||
| 5632 | + | ||
| 5633 | + var isHTMLTag = makeMap( | ||
| 5634 | + 'html,body,base,head,link,meta,style,title,' + | ||
| 5635 | + 'address,article,aside,footer,header,h1,h2,h3,h4,h5,h6,hgroup,nav,section,' + | ||
| 5636 | + 'div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,' + | ||
| 5637 | + 'a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,rtc,ruby,' + | ||
| 5638 | + 's,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,' + | ||
| 5639 | + 'embed,object,param,source,canvas,script,noscript,del,ins,' + | ||
| 5640 | + 'caption,col,colgroup,table,thead,tbody,td,th,tr,' + | ||
| 5641 | + 'button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,' + | ||
| 5642 | + 'output,progress,select,textarea,' + | ||
| 5643 | + 'details,dialog,menu,menuitem,summary,' + | ||
| 5644 | + 'content,element,shadow,template,blockquote,iframe,tfoot' | ||
| 5645 | + ); | ||
| 5646 | + | ||
| 5647 | + // this map is intentionally selective, only covering SVG elements that may | ||
| 5648 | + // contain child elements. | ||
| 5649 | + var isSVG = makeMap( | ||
| 5650 | + 'svg,animate,circle,clippath,cursor,defs,desc,ellipse,filter,font-face,' + | ||
| 5651 | + 'foreignobject,g,glyph,image,line,marker,mask,missing-glyph,path,pattern,' + | ||
| 5652 | + 'polygon,polyline,rect,switch,symbol,text,textpath,tspan,use,view', | ||
| 5653 | + true | ||
| 5654 | + ); | ||
| 5655 | + | ||
| 5656 | + var isPreTag = function (tag) { return tag === 'pre'; }; | ||
| 5657 | + | ||
| 5658 | + var isReservedTag = function (tag) { | ||
| 5659 | + return isHTMLTag(tag) || isSVG(tag) | ||
| 5660 | + }; | ||
| 5661 | + | ||
| 5662 | + function getTagNamespace (tag) { | ||
| 5663 | + if (isSVG(tag)) { | ||
| 5664 | + return 'svg' | ||
| 5665 | + } | ||
| 5666 | + // basic support for MathML | ||
| 5667 | + // note it doesn't support other MathML elements being component roots | ||
| 5668 | + if (tag === 'math') { | ||
| 5669 | + return 'math' | ||
| 5670 | + } | ||
| 5671 | + } | ||
| 5672 | + | ||
| 5673 | + var unknownElementCache = Object.create(null); | ||
| 5674 | + function isUnknownElement (tag) { | ||
| 5675 | + /* istanbul ignore if */ | ||
| 5676 | + if (!inBrowser) { | ||
| 5677 | + return true | ||
| 5678 | + } | ||
| 5679 | + if (isReservedTag(tag)) { | ||
| 5680 | + return false | ||
| 5681 | + } | ||
| 5682 | + tag = tag.toLowerCase(); | ||
| 5683 | + /* istanbul ignore if */ | ||
| 5684 | + if (unknownElementCache[tag] != null) { | ||
| 5685 | + return unknownElementCache[tag] | ||
| 5686 | + } | ||
| 5687 | + var el = document.createElement(tag); | ||
| 5688 | + if (tag.indexOf('-') > -1) { | ||
| 5689 | + // http://stackoverflow.com/a/28210364/1070244 | ||
| 5690 | + return (unknownElementCache[tag] = ( | ||
| 5691 | + el.constructor === window.HTMLUnknownElement || | ||
| 5692 | + el.constructor === window.HTMLElement | ||
| 5693 | + )) | ||
| 5694 | + } else { | ||
| 5695 | + return (unknownElementCache[tag] = /HTMLUnknownElement/.test(el.toString())) | ||
| 5696 | + } | ||
| 5697 | + } | ||
| 5698 | + | ||
| 5699 | + var isTextInputType = makeMap('text,number,password,search,email,tel,url'); | ||
| 5700 | + | ||
| 5701 | + /* */ | ||
| 5702 | + | ||
| 5703 | + /** | ||
| 5704 | + * Query an element selector if it's not an element already. | ||
| 5705 | + */ | ||
| 5706 | + function query (el) { | ||
| 5707 | + if (typeof el === 'string') { | ||
| 5708 | + var selected = document.querySelector(el); | ||
| 5709 | + if (!selected) { | ||
| 5710 | + warn( | ||
| 5711 | + 'Cannot find element: ' + el | ||
| 5712 | + ); | ||
| 5713 | + return document.createElement('div') | ||
| 5714 | + } | ||
| 5715 | + return selected | ||
| 5716 | + } else { | ||
| 5717 | + return el | ||
| 5718 | + } | ||
| 5719 | + } | ||
| 5720 | + | ||
| 5721 | + /* */ | ||
| 5722 | + | ||
| 5723 | + function createElement$1 (tagName, vnode) { | ||
| 5724 | + var elm = document.createElement(tagName); | ||
| 5725 | + if (tagName !== 'select') { | ||
| 5726 | + return elm | ||
| 5727 | + } | ||
| 5728 | + // false or null will remove the attribute but undefined will not | ||
| 5729 | + if (vnode.data && vnode.data.attrs && vnode.data.attrs.multiple !== undefined) { | ||
| 5730 | + elm.setAttribute('multiple', 'multiple'); | ||
| 5731 | + } | ||
| 5732 | + return elm | ||
| 5733 | + } | ||
| 5734 | + | ||
| 5735 | + function createElementNS (namespace, tagName) { | ||
| 5736 | + return document.createElementNS(namespaceMap[namespace], tagName) | ||
| 5737 | + } | ||
| 5738 | + | ||
| 5739 | + function createTextNode (text) { | ||
| 5740 | + return document.createTextNode(text) | ||
| 5741 | + } | ||
| 5742 | + | ||
| 5743 | + function createComment (text) { | ||
| 5744 | + return document.createComment(text) | ||
| 5745 | + } | ||
| 5746 | + | ||
| 5747 | + function insertBefore (parentNode, newNode, referenceNode) { | ||
| 5748 | + parentNode.insertBefore(newNode, referenceNode); | ||
| 5749 | + } | ||
| 5750 | + | ||
| 5751 | + function removeChild (node, child) { | ||
| 5752 | + node.removeChild(child); | ||
| 5753 | + } | ||
| 5754 | + | ||
| 5755 | + function appendChild (node, child) { | ||
| 5756 | + node.appendChild(child); | ||
| 5757 | + } | ||
| 5758 | + | ||
| 5759 | + function parentNode (node) { | ||
| 5760 | + return node.parentNode | ||
| 5761 | + } | ||
| 5762 | + | ||
| 5763 | + function nextSibling (node) { | ||
| 5764 | + return node.nextSibling | ||
| 5765 | + } | ||
| 5766 | + | ||
| 5767 | + function tagName (node) { | ||
| 5768 | + return node.tagName | ||
| 5769 | + } | ||
| 5770 | + | ||
| 5771 | + function setTextContent (node, text) { | ||
| 5772 | + node.textContent = text; | ||
| 5773 | + } | ||
| 5774 | + | ||
| 5775 | + function setStyleScope (node, scopeId) { | ||
| 5776 | + node.setAttribute(scopeId, ''); | ||
| 5777 | + } | ||
| 5778 | + | ||
| 5779 | + var nodeOps = /*#__PURE__*/Object.freeze({ | ||
| 5780 | + createElement: createElement$1, | ||
| 5781 | + createElementNS: createElementNS, | ||
| 5782 | + createTextNode: createTextNode, | ||
| 5783 | + createComment: createComment, | ||
| 5784 | + insertBefore: insertBefore, | ||
| 5785 | + removeChild: removeChild, | ||
| 5786 | + appendChild: appendChild, | ||
| 5787 | + parentNode: parentNode, | ||
| 5788 | + nextSibling: nextSibling, | ||
| 5789 | + tagName: tagName, | ||
| 5790 | + setTextContent: setTextContent, | ||
| 5791 | + setStyleScope: setStyleScope | ||
| 5792 | + }); | ||
| 5793 | + | ||
| 5794 | + /* */ | ||
| 5795 | + | ||
| 5796 | + var ref = { | ||
| 5797 | + create: function create (_, vnode) { | ||
| 5798 | + registerRef(vnode); | ||
| 5799 | + }, | ||
| 5800 | + update: function update (oldVnode, vnode) { | ||
| 5801 | + if (oldVnode.data.ref !== vnode.data.ref) { | ||
| 5802 | + registerRef(oldVnode, true); | ||
| 5803 | + registerRef(vnode); | ||
| 5804 | + } | ||
| 5805 | + }, | ||
| 5806 | + destroy: function destroy (vnode) { | ||
| 5807 | + registerRef(vnode, true); | ||
| 5808 | + } | ||
| 5809 | + }; | ||
| 5810 | + | ||
| 5811 | + function registerRef (vnode, isRemoval) { | ||
| 5812 | + var key = vnode.data.ref; | ||
| 5813 | + if (!isDef(key)) { return } | ||
| 5814 | + | ||
| 5815 | + var vm = vnode.context; | ||
| 5816 | + var ref = vnode.componentInstance || vnode.elm; | ||
| 5817 | + var refs = vm.$refs; | ||
| 5818 | + if (isRemoval) { | ||
| 5819 | + if (Array.isArray(refs[key])) { | ||
| 5820 | + remove(refs[key], ref); | ||
| 5821 | + } else if (refs[key] === ref) { | ||
| 5822 | + refs[key] = undefined; | ||
| 5823 | + } | ||
| 5824 | + } else { | ||
| 5825 | + if (vnode.data.refInFor) { | ||
| 5826 | + if (!Array.isArray(refs[key])) { | ||
| 5827 | + refs[key] = [ref]; | ||
| 5828 | + } else if (refs[key].indexOf(ref) < 0) { | ||
| 5829 | + // $flow-disable-line | ||
| 5830 | + refs[key].push(ref); | ||
| 5831 | + } | ||
| 5832 | + } else { | ||
| 5833 | + refs[key] = ref; | ||
| 5834 | + } | ||
| 5835 | + } | ||
| 5836 | + } | ||
| 5837 | + | ||
| 5838 | + /** | ||
| 5839 | + * Virtual DOM patching algorithm based on Snabbdom by | ||
| 5840 | + * Simon Friis Vindum (@paldepind) | ||
| 5841 | + * Licensed under the MIT License | ||
| 5842 | + * https://github.com/paldepind/snabbdom/blob/master/LICENSE | ||
| 5843 | + * | ||
| 5844 | + * modified by Evan You (@yyx990803) | ||
| 5845 | + * | ||
| 5846 | + * Not type-checking this because this file is perf-critical and the cost | ||
| 5847 | + * of making flow understand it is not worth it. | ||
| 5848 | + */ | ||
| 5849 | + | ||
| 5850 | + var emptyNode = new VNode('', {}, []); | ||
| 5851 | + | ||
| 5852 | + var hooks = ['create', 'activate', 'update', 'remove', 'destroy']; | ||
| 5853 | + | ||
| 5854 | + function sameVnode (a, b) { | ||
| 5855 | + return ( | ||
| 5856 | + a.key === b.key && | ||
| 5857 | + a.asyncFactory === b.asyncFactory && ( | ||
| 5858 | + ( | ||
| 5859 | + a.tag === b.tag && | ||
| 5860 | + a.isComment === b.isComment && | ||
| 5861 | + isDef(a.data) === isDef(b.data) && | ||
| 5862 | + sameInputType(a, b) | ||
| 5863 | + ) || ( | ||
| 5864 | + isTrue(a.isAsyncPlaceholder) && | ||
| 5865 | + isUndef(b.asyncFactory.error) | ||
| 5866 | + ) | ||
| 5867 | + ) | ||
| 5868 | + ) | ||
| 5869 | + } | ||
| 5870 | + | ||
| 5871 | + function sameInputType (a, b) { | ||
| 5872 | + if (a.tag !== 'input') { return true } | ||
| 5873 | + var i; | ||
| 5874 | + var typeA = isDef(i = a.data) && isDef(i = i.attrs) && i.type; | ||
| 5875 | + var typeB = isDef(i = b.data) && isDef(i = i.attrs) && i.type; | ||
| 5876 | + return typeA === typeB || isTextInputType(typeA) && isTextInputType(typeB) | ||
| 5877 | + } | ||
| 5878 | + | ||
| 5879 | + function createKeyToOldIdx (children, beginIdx, endIdx) { | ||
| 5880 | + var i, key; | ||
| 5881 | + var map = {}; | ||
| 5882 | + for (i = beginIdx; i <= endIdx; ++i) { | ||
| 5883 | + key = children[i].key; | ||
| 5884 | + if (isDef(key)) { map[key] = i; } | ||
| 5885 | + } | ||
| 5886 | + return map | ||
| 5887 | + } | ||
| 5888 | + | ||
| 5889 | + function createPatchFunction (backend) { | ||
| 5890 | + var i, j; | ||
| 5891 | + var cbs = {}; | ||
| 5892 | + | ||
| 5893 | + var modules = backend.modules; | ||
| 5894 | + var nodeOps = backend.nodeOps; | ||
| 5895 | + | ||
| 5896 | + for (i = 0; i < hooks.length; ++i) { | ||
| 5897 | + cbs[hooks[i]] = []; | ||
| 5898 | + for (j = 0; j < modules.length; ++j) { | ||
| 5899 | + if (isDef(modules[j][hooks[i]])) { | ||
| 5900 | + cbs[hooks[i]].push(modules[j][hooks[i]]); | ||
| 5901 | + } | ||
| 5902 | + } | ||
| 5903 | + } | ||
| 5904 | + | ||
| 5905 | + function emptyNodeAt (elm) { | ||
| 5906 | + return new VNode(nodeOps.tagName(elm).toLowerCase(), {}, [], undefined, elm) | ||
| 5907 | + } | ||
| 5908 | + | ||
| 5909 | + function createRmCb (childElm, listeners) { | ||
| 5910 | + function remove$$1 () { | ||
| 5911 | + if (--remove$$1.listeners === 0) { | ||
| 5912 | + removeNode(childElm); | ||
| 5913 | + } | ||
| 5914 | + } | ||
| 5915 | + remove$$1.listeners = listeners; | ||
| 5916 | + return remove$$1 | ||
| 5917 | + } | ||
| 5918 | + | ||
| 5919 | + function removeNode (el) { | ||
| 5920 | + var parent = nodeOps.parentNode(el); | ||
| 5921 | + // element may have already been removed due to v-html / v-text | ||
| 5922 | + if (isDef(parent)) { | ||
| 5923 | + nodeOps.removeChild(parent, el); | ||
| 5924 | + } | ||
| 5925 | + } | ||
| 5926 | + | ||
| 5927 | + function isUnknownElement$$1 (vnode, inVPre) { | ||
| 5928 | + return ( | ||
| 5929 | + !inVPre && | ||
| 5930 | + !vnode.ns && | ||
| 5931 | + !( | ||
| 5932 | + config.ignoredElements.length && | ||
| 5933 | + config.ignoredElements.some(function (ignore) { | ||
| 5934 | + return isRegExp(ignore) | ||
| 5935 | + ? ignore.test(vnode.tag) | ||
| 5936 | + : ignore === vnode.tag | ||
| 5937 | + }) | ||
| 5938 | + ) && | ||
| 5939 | + config.isUnknownElement(vnode.tag) | ||
| 5940 | + ) | ||
| 5941 | + } | ||
| 5942 | + | ||
| 5943 | + var creatingElmInVPre = 0; | ||
| 5944 | + | ||
| 5945 | + function createElm ( | ||
| 5946 | + vnode, | ||
| 5947 | + insertedVnodeQueue, | ||
| 5948 | + parentElm, | ||
| 5949 | + refElm, | ||
| 5950 | + nested, | ||
| 5951 | + ownerArray, | ||
| 5952 | + index | ||
| 5953 | + ) { | ||
| 5954 | + if (isDef(vnode.elm) && isDef(ownerArray)) { | ||
| 5955 | + // This vnode was used in a previous render! | ||
| 5956 | + // now it's used as a new node, overwriting its elm would cause | ||
| 5957 | + // potential patch errors down the road when it's used as an insertion | ||
| 5958 | + // reference node. Instead, we clone the node on-demand before creating | ||
| 5959 | + // associated DOM element for it. | ||
| 5960 | + vnode = ownerArray[index] = cloneVNode(vnode); | ||
| 5961 | + } | ||
| 5962 | + | ||
| 5963 | + vnode.isRootInsert = !nested; // for transition enter check | ||
| 5964 | + if (createComponent(vnode, insertedVnodeQueue, parentElm, refElm)) { | ||
| 5965 | + return | ||
| 5966 | + } | ||
| 5967 | + | ||
| 5968 | + var data = vnode.data; | ||
| 5969 | + var children = vnode.children; | ||
| 5970 | + var tag = vnode.tag; | ||
| 5971 | + if (isDef(tag)) { | ||
| 5972 | + { | ||
| 5973 | + if (data && data.pre) { | ||
| 5974 | + creatingElmInVPre++; | ||
| 5975 | + } | ||
| 5976 | + if (isUnknownElement$$1(vnode, creatingElmInVPre)) { | ||
| 5977 | + warn( | ||
| 5978 | + 'Unknown custom element: <' + tag + '> - did you ' + | ||
| 5979 | + 'register the component correctly? For recursive components, ' + | ||
| 5980 | + 'make sure to provide the "name" option.', | ||
| 5981 | + vnode.context | ||
| 5982 | + ); | ||
| 5983 | + } | ||
| 5984 | + } | ||
| 5985 | + | ||
| 5986 | + vnode.elm = vnode.ns | ||
| 5987 | + ? nodeOps.createElementNS(vnode.ns, tag) | ||
| 5988 | + : nodeOps.createElement(tag, vnode); | ||
| 5989 | + setScope(vnode); | ||
| 5990 | + | ||
| 5991 | + /* istanbul ignore if */ | ||
| 5992 | + { | ||
| 5993 | + createChildren(vnode, children, insertedVnodeQueue); | ||
| 5994 | + if (isDef(data)) { | ||
| 5995 | + invokeCreateHooks(vnode, insertedVnodeQueue); | ||
| 5996 | + } | ||
| 5997 | + insert(parentElm, vnode.elm, refElm); | ||
| 5998 | + } | ||
| 5999 | + | ||
| 6000 | + if (data && data.pre) { | ||
| 6001 | + creatingElmInVPre--; | ||
| 6002 | + } | ||
| 6003 | + } else if (isTrue(vnode.isComment)) { | ||
| 6004 | + vnode.elm = nodeOps.createComment(vnode.text); | ||
| 6005 | + insert(parentElm, vnode.elm, refElm); | ||
| 6006 | + } else { | ||
| 6007 | + vnode.elm = nodeOps.createTextNode(vnode.text); | ||
| 6008 | + insert(parentElm, vnode.elm, refElm); | ||
| 6009 | + } | ||
| 6010 | + } | ||
| 6011 | + | ||
| 6012 | + function createComponent (vnode, insertedVnodeQueue, parentElm, refElm) { | ||
| 6013 | + var i = vnode.data; | ||
| 6014 | + if (isDef(i)) { | ||
| 6015 | + var isReactivated = isDef(vnode.componentInstance) && i.keepAlive; | ||
| 6016 | + if (isDef(i = i.hook) && isDef(i = i.init)) { | ||
| 6017 | + i(vnode, false /* hydrating */); | ||
| 6018 | + } | ||
| 6019 | + // after calling the init hook, if the vnode is a child component | ||
| 6020 | + // it should've created a child instance and mounted it. the child | ||
| 6021 | + // component also has set the placeholder vnode's elm. | ||
| 6022 | + // in that case we can just return the element and be done. | ||
| 6023 | + if (isDef(vnode.componentInstance)) { | ||
| 6024 | + initComponent(vnode, insertedVnodeQueue); | ||
| 6025 | + insert(parentElm, vnode.elm, refElm); | ||
| 6026 | + if (isTrue(isReactivated)) { | ||
| 6027 | + reactivateComponent(vnode, insertedVnodeQueue, parentElm, refElm); | ||
| 6028 | + } | ||
| 6029 | + return true | ||
| 6030 | + } | ||
| 6031 | + } | ||
| 6032 | + } | ||
| 6033 | + | ||
| 6034 | + function initComponent (vnode, insertedVnodeQueue) { | ||
| 6035 | + if (isDef(vnode.data.pendingInsert)) { | ||
| 6036 | + insertedVnodeQueue.push.apply(insertedVnodeQueue, vnode.data.pendingInsert); | ||
| 6037 | + vnode.data.pendingInsert = null; | ||
| 6038 | + } | ||
| 6039 | + vnode.elm = vnode.componentInstance.$el; | ||
| 6040 | + if (isPatchable(vnode)) { | ||
| 6041 | + invokeCreateHooks(vnode, insertedVnodeQueue); | ||
| 6042 | + setScope(vnode); | ||
| 6043 | + } else { | ||
| 6044 | + // empty component root. | ||
| 6045 | + // skip all element-related modules except for ref (#3455) | ||
| 6046 | + registerRef(vnode); | ||
| 6047 | + // make sure to invoke the insert hook | ||
| 6048 | + insertedVnodeQueue.push(vnode); | ||
| 6049 | + } | ||
| 6050 | + } | ||
| 6051 | + | ||
| 6052 | + function reactivateComponent (vnode, insertedVnodeQueue, parentElm, refElm) { | ||
| 6053 | + var i; | ||
| 6054 | + // hack for #4339: a reactivated component with inner transition | ||
| 6055 | + // does not trigger because the inner node's created hooks are not called | ||
| 6056 | + // again. It's not ideal to involve module-specific logic in here but | ||
| 6057 | + // there doesn't seem to be a better way to do it. | ||
| 6058 | + var innerNode = vnode; | ||
| 6059 | + while (innerNode.componentInstance) { | ||
| 6060 | + innerNode = innerNode.componentInstance._vnode; | ||
| 6061 | + if (isDef(i = innerNode.data) && isDef(i = i.transition)) { | ||
| 6062 | + for (i = 0; i < cbs.activate.length; ++i) { | ||
| 6063 | + cbs.activate[i](emptyNode, innerNode); | ||
| 6064 | + } | ||
| 6065 | + insertedVnodeQueue.push(innerNode); | ||
| 6066 | + break | ||
| 6067 | + } | ||
| 6068 | + } | ||
| 6069 | + // unlike a newly created component, | ||
| 6070 | + // a reactivated keep-alive component doesn't insert itself | ||
| 6071 | + insert(parentElm, vnode.elm, refElm); | ||
| 6072 | + } | ||
| 6073 | + | ||
| 6074 | + function insert (parent, elm, ref$$1) { | ||
| 6075 | + if (isDef(parent)) { | ||
| 6076 | + if (isDef(ref$$1)) { | ||
| 6077 | + if (nodeOps.parentNode(ref$$1) === parent) { | ||
| 6078 | + nodeOps.insertBefore(parent, elm, ref$$1); | ||
| 6079 | + } | ||
| 6080 | + } else { | ||
| 6081 | + nodeOps.appendChild(parent, elm); | ||
| 6082 | + } | ||
| 6083 | + } | ||
| 6084 | + } | ||
| 6085 | + | ||
| 6086 | + function createChildren (vnode, children, insertedVnodeQueue) { | ||
| 6087 | + if (Array.isArray(children)) { | ||
| 6088 | + { | ||
| 6089 | + checkDuplicateKeys(children); | ||
| 6090 | + } | ||
| 6091 | + for (var i = 0; i < children.length; ++i) { | ||
| 6092 | + createElm(children[i], insertedVnodeQueue, vnode.elm, null, true, children, i); | ||
| 6093 | + } | ||
| 6094 | + } else if (isPrimitive(vnode.text)) { | ||
| 6095 | + nodeOps.appendChild(vnode.elm, nodeOps.createTextNode(String(vnode.text))); | ||
| 6096 | + } | ||
| 6097 | + } | ||
| 6098 | + | ||
| 6099 | + function isPatchable (vnode) { | ||
| 6100 | + while (vnode.componentInstance) { | ||
| 6101 | + vnode = vnode.componentInstance._vnode; | ||
| 6102 | + } | ||
| 6103 | + return isDef(vnode.tag) | ||
| 6104 | + } | ||
| 6105 | + | ||
| 6106 | + function invokeCreateHooks (vnode, insertedVnodeQueue) { | ||
| 6107 | + for (var i$1 = 0; i$1 < cbs.create.length; ++i$1) { | ||
| 6108 | + cbs.create[i$1](emptyNode, vnode); | ||
| 6109 | + } | ||
| 6110 | + i = vnode.data.hook; // Reuse variable | ||
| 6111 | + if (isDef(i)) { | ||
| 6112 | + if (isDef(i.create)) { i.create(emptyNode, vnode); } | ||
| 6113 | + if (isDef(i.insert)) { insertedVnodeQueue.push(vnode); } | ||
| 6114 | + } | ||
| 6115 | + } | ||
| 6116 | + | ||
| 6117 | + // set scope id attribute for scoped CSS. | ||
| 6118 | + // this is implemented as a special case to avoid the overhead | ||
| 6119 | + // of going through the normal attribute patching process. | ||
| 6120 | + function setScope (vnode) { | ||
| 6121 | + var i; | ||
| 6122 | + if (isDef(i = vnode.fnScopeId)) { | ||
| 6123 | + nodeOps.setStyleScope(vnode.elm, i); | ||
| 6124 | + } else { | ||
| 6125 | + var ancestor = vnode; | ||
| 6126 | + while (ancestor) { | ||
| 6127 | + if (isDef(i = ancestor.context) && isDef(i = i.$options._scopeId)) { | ||
| 6128 | + nodeOps.setStyleScope(vnode.elm, i); | ||
| 6129 | + } | ||
| 6130 | + ancestor = ancestor.parent; | ||
| 6131 | + } | ||
| 6132 | + } | ||
| 6133 | + // for slot content they should also get the scopeId from the host instance. | ||
| 6134 | + if (isDef(i = activeInstance) && | ||
| 6135 | + i !== vnode.context && | ||
| 6136 | + i !== vnode.fnContext && | ||
| 6137 | + isDef(i = i.$options._scopeId) | ||
| 6138 | + ) { | ||
| 6139 | + nodeOps.setStyleScope(vnode.elm, i); | ||
| 6140 | + } | ||
| 6141 | + } | ||
| 6142 | + | ||
| 6143 | + function addVnodes (parentElm, refElm, vnodes, startIdx, endIdx, insertedVnodeQueue) { | ||
| 6144 | + for (; startIdx <= endIdx; ++startIdx) { | ||
| 6145 | + createElm(vnodes[startIdx], insertedVnodeQueue, parentElm, refElm, false, vnodes, startIdx); | ||
| 6146 | + } | ||
| 6147 | + } | ||
| 6148 | + | ||
| 6149 | + function invokeDestroyHook (vnode) { | ||
| 6150 | + var i, j; | ||
| 6151 | + var data = vnode.data; | ||
| 6152 | + if (isDef(data)) { | ||
| 6153 | + if (isDef(i = data.hook) && isDef(i = i.destroy)) { i(vnode); } | ||
| 6154 | + for (i = 0; i < cbs.destroy.length; ++i) { cbs.destroy[i](vnode); } | ||
| 6155 | + } | ||
| 6156 | + if (isDef(i = vnode.children)) { | ||
| 6157 | + for (j = 0; j < vnode.children.length; ++j) { | ||
| 6158 | + invokeDestroyHook(vnode.children[j]); | ||
| 6159 | + } | ||
| 6160 | + } | ||
| 6161 | + } | ||
| 6162 | + | ||
| 6163 | + function removeVnodes (vnodes, startIdx, endIdx) { | ||
| 6164 | + for (; startIdx <= endIdx; ++startIdx) { | ||
| 6165 | + var ch = vnodes[startIdx]; | ||
| 6166 | + if (isDef(ch)) { | ||
| 6167 | + if (isDef(ch.tag)) { | ||
| 6168 | + removeAndInvokeRemoveHook(ch); | ||
| 6169 | + invokeDestroyHook(ch); | ||
| 6170 | + } else { // Text node | ||
| 6171 | + removeNode(ch.elm); | ||
| 6172 | + } | ||
| 6173 | + } | ||
| 6174 | + } | ||
| 6175 | + } | ||
| 6176 | + | ||
| 6177 | + function removeAndInvokeRemoveHook (vnode, rm) { | ||
| 6178 | + if (isDef(rm) || isDef(vnode.data)) { | ||
| 6179 | + var i; | ||
| 6180 | + var listeners = cbs.remove.length + 1; | ||
| 6181 | + if (isDef(rm)) { | ||
| 6182 | + // we have a recursively passed down rm callback | ||
| 6183 | + // increase the listeners count | ||
| 6184 | + rm.listeners += listeners; | ||
| 6185 | + } else { | ||
| 6186 | + // directly removing | ||
| 6187 | + rm = createRmCb(vnode.elm, listeners); | ||
| 6188 | + } | ||
| 6189 | + // recursively invoke hooks on child component root node | ||
| 6190 | + if (isDef(i = vnode.componentInstance) && isDef(i = i._vnode) && isDef(i.data)) { | ||
| 6191 | + removeAndInvokeRemoveHook(i, rm); | ||
| 6192 | + } | ||
| 6193 | + for (i = 0; i < cbs.remove.length; ++i) { | ||
| 6194 | + cbs.remove[i](vnode, rm); | ||
| 6195 | + } | ||
| 6196 | + if (isDef(i = vnode.data.hook) && isDef(i = i.remove)) { | ||
| 6197 | + i(vnode, rm); | ||
| 6198 | + } else { | ||
| 6199 | + rm(); | ||
| 6200 | + } | ||
| 6201 | + } else { | ||
| 6202 | + removeNode(vnode.elm); | ||
| 6203 | + } | ||
| 6204 | + } | ||
| 6205 | + | ||
| 6206 | + function updateChildren (parentElm, oldCh, newCh, insertedVnodeQueue, removeOnly) { | ||
| 6207 | + var oldStartIdx = 0; | ||
| 6208 | + var newStartIdx = 0; | ||
| 6209 | + var oldEndIdx = oldCh.length - 1; | ||
| 6210 | + var oldStartVnode = oldCh[0]; | ||
| 6211 | + var oldEndVnode = oldCh[oldEndIdx]; | ||
| 6212 | + var newEndIdx = newCh.length - 1; | ||
| 6213 | + var newStartVnode = newCh[0]; | ||
| 6214 | + var newEndVnode = newCh[newEndIdx]; | ||
| 6215 | + var oldKeyToIdx, idxInOld, vnodeToMove, refElm; | ||
| 6216 | + | ||
| 6217 | + // removeOnly is a special flag used only by <transition-group> | ||
| 6218 | + // to ensure removed elements stay in correct relative positions | ||
| 6219 | + // during leaving transitions | ||
| 6220 | + var canMove = !removeOnly; | ||
| 6221 | + | ||
| 6222 | + { | ||
| 6223 | + checkDuplicateKeys(newCh); | ||
| 6224 | + } | ||
| 6225 | + | ||
| 6226 | + while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) { | ||
| 6227 | + if (isUndef(oldStartVnode)) { | ||
| 6228 | + oldStartVnode = oldCh[++oldStartIdx]; // Vnode has been moved left | ||
| 6229 | + } else if (isUndef(oldEndVnode)) { | ||
| 6230 | + oldEndVnode = oldCh[--oldEndIdx]; | ||
| 6231 | + } else if (sameVnode(oldStartVnode, newStartVnode)) { | ||
| 6232 | + patchVnode(oldStartVnode, newStartVnode, insertedVnodeQueue, newCh, newStartIdx); | ||
| 6233 | + oldStartVnode = oldCh[++oldStartIdx]; | ||
| 6234 | + newStartVnode = newCh[++newStartIdx]; | ||
| 6235 | + } else if (sameVnode(oldEndVnode, newEndVnode)) { | ||
| 6236 | + patchVnode(oldEndVnode, newEndVnode, insertedVnodeQueue, newCh, newEndIdx); | ||
| 6237 | + oldEndVnode = oldCh[--oldEndIdx]; | ||
| 6238 | + newEndVnode = newCh[--newEndIdx]; | ||
| 6239 | + } else if (sameVnode(oldStartVnode, newEndVnode)) { // Vnode moved right | ||
| 6240 | + patchVnode(oldStartVnode, newEndVnode, insertedVnodeQueue, newCh, newEndIdx); | ||
| 6241 | + canMove && nodeOps.insertBefore(parentElm, oldStartVnode.elm, nodeOps.nextSibling(oldEndVnode.elm)); | ||
| 6242 | + oldStartVnode = oldCh[++oldStartIdx]; | ||
| 6243 | + newEndVnode = newCh[--newEndIdx]; | ||
| 6244 | + } else if (sameVnode(oldEndVnode, newStartVnode)) { // Vnode moved left | ||
| 6245 | + patchVnode(oldEndVnode, newStartVnode, insertedVnodeQueue, newCh, newStartIdx); | ||
| 6246 | + canMove && nodeOps.insertBefore(parentElm, oldEndVnode.elm, oldStartVnode.elm); | ||
| 6247 | + oldEndVnode = oldCh[--oldEndIdx]; | ||
| 6248 | + newStartVnode = newCh[++newStartIdx]; | ||
| 6249 | + } else { | ||
| 6250 | + if (isUndef(oldKeyToIdx)) { oldKeyToIdx = createKeyToOldIdx(oldCh, oldStartIdx, oldEndIdx); } | ||
| 6251 | + idxInOld = isDef(newStartVnode.key) | ||
| 6252 | + ? oldKeyToIdx[newStartVnode.key] | ||
| 6253 | + : findIdxInOld(newStartVnode, oldCh, oldStartIdx, oldEndIdx); | ||
| 6254 | + if (isUndef(idxInOld)) { // New element | ||
| 6255 | + createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm, false, newCh, newStartIdx); | ||
| 6256 | + } else { | ||
| 6257 | + vnodeToMove = oldCh[idxInOld]; | ||
| 6258 | + if (sameVnode(vnodeToMove, newStartVnode)) { | ||
| 6259 | + patchVnode(vnodeToMove, newStartVnode, insertedVnodeQueue, newCh, newStartIdx); | ||
| 6260 | + oldCh[idxInOld] = undefined; | ||
| 6261 | + canMove && nodeOps.insertBefore(parentElm, vnodeToMove.elm, oldStartVnode.elm); | ||
| 6262 | + } else { | ||
| 6263 | + // same key but different element. treat as new element | ||
| 6264 | + createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm, false, newCh, newStartIdx); | ||
| 6265 | + } | ||
| 6266 | + } | ||
| 6267 | + newStartVnode = newCh[++newStartIdx]; | ||
| 6268 | + } | ||
| 6269 | + } | ||
| 6270 | + if (oldStartIdx > oldEndIdx) { | ||
| 6271 | + refElm = isUndef(newCh[newEndIdx + 1]) ? null : newCh[newEndIdx + 1].elm; | ||
| 6272 | + addVnodes(parentElm, refElm, newCh, newStartIdx, newEndIdx, insertedVnodeQueue); | ||
| 6273 | + } else if (newStartIdx > newEndIdx) { | ||
| 6274 | + removeVnodes(oldCh, oldStartIdx, oldEndIdx); | ||
| 6275 | + } | ||
| 6276 | + } | ||
| 6277 | + | ||
| 6278 | + function checkDuplicateKeys (children) { | ||
| 6279 | + var seenKeys = {}; | ||
| 6280 | + for (var i = 0; i < children.length; i++) { | ||
| 6281 | + var vnode = children[i]; | ||
| 6282 | + var key = vnode.key; | ||
| 6283 | + if (isDef(key)) { | ||
| 6284 | + if (seenKeys[key]) { | ||
| 6285 | + warn( | ||
| 6286 | + ("Duplicate keys detected: '" + key + "'. This may cause an update error."), | ||
| 6287 | + vnode.context | ||
| 6288 | + ); | ||
| 6289 | + } else { | ||
| 6290 | + seenKeys[key] = true; | ||
| 6291 | + } | ||
| 6292 | + } | ||
| 6293 | + } | ||
| 6294 | + } | ||
| 6295 | + | ||
| 6296 | + function findIdxInOld (node, oldCh, start, end) { | ||
| 6297 | + for (var i = start; i < end; i++) { | ||
| 6298 | + var c = oldCh[i]; | ||
| 6299 | + if (isDef(c) && sameVnode(node, c)) { return i } | ||
| 6300 | + } | ||
| 6301 | + } | ||
| 6302 | + | ||
| 6303 | + function patchVnode ( | ||
| 6304 | + oldVnode, | ||
| 6305 | + vnode, | ||
| 6306 | + insertedVnodeQueue, | ||
| 6307 | + ownerArray, | ||
| 6308 | + index, | ||
| 6309 | + removeOnly | ||
| 6310 | + ) { | ||
| 6311 | + if (oldVnode === vnode) { | ||
| 6312 | + return | ||
| 6313 | + } | ||
| 6314 | + | ||
| 6315 | + if (isDef(vnode.elm) && isDef(ownerArray)) { | ||
| 6316 | + // clone reused vnode | ||
| 6317 | + vnode = ownerArray[index] = cloneVNode(vnode); | ||
| 6318 | + } | ||
| 6319 | + | ||
| 6320 | + var elm = vnode.elm = oldVnode.elm; | ||
| 6321 | + | ||
| 6322 | + if (isTrue(oldVnode.isAsyncPlaceholder)) { | ||
| 6323 | + if (isDef(vnode.asyncFactory.resolved)) { | ||
| 6324 | + hydrate(oldVnode.elm, vnode, insertedVnodeQueue); | ||
| 6325 | + } else { | ||
| 6326 | + vnode.isAsyncPlaceholder = true; | ||
| 6327 | + } | ||
| 6328 | + return | ||
| 6329 | + } | ||
| 6330 | + | ||
| 6331 | + // reuse element for static trees. | ||
| 6332 | + // note we only do this if the vnode is cloned - | ||
| 6333 | + // if the new node is not cloned it means the render functions have been | ||
| 6334 | + // reset by the hot-reload-api and we need to do a proper re-render. | ||
| 6335 | + if (isTrue(vnode.isStatic) && | ||
| 6336 | + isTrue(oldVnode.isStatic) && | ||
| 6337 | + vnode.key === oldVnode.key && | ||
| 6338 | + (isTrue(vnode.isCloned) || isTrue(vnode.isOnce)) | ||
| 6339 | + ) { | ||
| 6340 | + vnode.componentInstance = oldVnode.componentInstance; | ||
| 6341 | + return | ||
| 6342 | + } | ||
| 6343 | + | ||
| 6344 | + var i; | ||
| 6345 | + var data = vnode.data; | ||
| 6346 | + if (isDef(data) && isDef(i = data.hook) && isDef(i = i.prepatch)) { | ||
| 6347 | + i(oldVnode, vnode); | ||
| 6348 | + } | ||
| 6349 | + | ||
| 6350 | + var oldCh = oldVnode.children; | ||
| 6351 | + var ch = vnode.children; | ||
| 6352 | + if (isDef(data) && isPatchable(vnode)) { | ||
| 6353 | + for (i = 0; i < cbs.update.length; ++i) { cbs.update[i](oldVnode, vnode); } | ||
| 6354 | + if (isDef(i = data.hook) && isDef(i = i.update)) { i(oldVnode, vnode); } | ||
| 6355 | + } | ||
| 6356 | + if (isUndef(vnode.text)) { | ||
| 6357 | + if (isDef(oldCh) && isDef(ch)) { | ||
| 6358 | + if (oldCh !== ch) { updateChildren(elm, oldCh, ch, insertedVnodeQueue, removeOnly); } | ||
| 6359 | + } else if (isDef(ch)) { | ||
| 6360 | + { | ||
| 6361 | + checkDuplicateKeys(ch); | ||
| 6362 | + } | ||
| 6363 | + if (isDef(oldVnode.text)) { nodeOps.setTextContent(elm, ''); } | ||
| 6364 | + addVnodes(elm, null, ch, 0, ch.length - 1, insertedVnodeQueue); | ||
| 6365 | + } else if (isDef(oldCh)) { | ||
| 6366 | + removeVnodes(oldCh, 0, oldCh.length - 1); | ||
| 6367 | + } else if (isDef(oldVnode.text)) { | ||
| 6368 | + nodeOps.setTextContent(elm, ''); | ||
| 6369 | + } | ||
| 6370 | + } else if (oldVnode.text !== vnode.text) { | ||
| 6371 | + nodeOps.setTextContent(elm, vnode.text); | ||
| 6372 | + } | ||
| 6373 | + if (isDef(data)) { | ||
| 6374 | + if (isDef(i = data.hook) && isDef(i = i.postpatch)) { i(oldVnode, vnode); } | ||
| 6375 | + } | ||
| 6376 | + } | ||
| 6377 | + | ||
| 6378 | + function invokeInsertHook (vnode, queue, initial) { | ||
| 6379 | + // delay insert hooks for component root nodes, invoke them after the | ||
| 6380 | + // element is really inserted | ||
| 6381 | + if (isTrue(initial) && isDef(vnode.parent)) { | ||
| 6382 | + vnode.parent.data.pendingInsert = queue; | ||
| 6383 | + } else { | ||
| 6384 | + for (var i = 0; i < queue.length; ++i) { | ||
| 6385 | + queue[i].data.hook.insert(queue[i]); | ||
| 6386 | + } | ||
| 6387 | + } | ||
| 6388 | + } | ||
| 6389 | + | ||
| 6390 | + var hydrationBailed = false; | ||
| 6391 | + // list of modules that can skip create hook during hydration because they | ||
| 6392 | + // are already rendered on the client or has no need for initialization | ||
| 6393 | + // Note: style is excluded because it relies on initial clone for future | ||
| 6394 | + // deep updates (#7063). | ||
| 6395 | + var isRenderedModule = makeMap('attrs,class,staticClass,staticStyle,key'); | ||
| 6396 | + | ||
| 6397 | + // Note: this is a browser-only function so we can assume elms are DOM nodes. | ||
| 6398 | + function hydrate (elm, vnode, insertedVnodeQueue, inVPre) { | ||
| 6399 | + var i; | ||
| 6400 | + var tag = vnode.tag; | ||
| 6401 | + var data = vnode.data; | ||
| 6402 | + var children = vnode.children; | ||
| 6403 | + inVPre = inVPre || (data && data.pre); | ||
| 6404 | + vnode.elm = elm; | ||
| 6405 | + | ||
| 6406 | + if (isTrue(vnode.isComment) && isDef(vnode.asyncFactory)) { | ||
| 6407 | + vnode.isAsyncPlaceholder = true; | ||
| 6408 | + return true | ||
| 6409 | + } | ||
| 6410 | + // assert node match | ||
| 6411 | + { | ||
| 6412 | + if (!assertNodeMatch(elm, vnode, inVPre)) { | ||
| 6413 | + return false | ||
| 6414 | + } | ||
| 6415 | + } | ||
| 6416 | + if (isDef(data)) { | ||
| 6417 | + if (isDef(i = data.hook) && isDef(i = i.init)) { i(vnode, true /* hydrating */); } | ||
| 6418 | + if (isDef(i = vnode.componentInstance)) { | ||
| 6419 | + // child component. it should have hydrated its own tree. | ||
| 6420 | + initComponent(vnode, insertedVnodeQueue); | ||
| 6421 | + return true | ||
| 6422 | + } | ||
| 6423 | + } | ||
| 6424 | + if (isDef(tag)) { | ||
| 6425 | + if (isDef(children)) { | ||
| 6426 | + // empty element, allow client to pick up and populate children | ||
| 6427 | + if (!elm.hasChildNodes()) { | ||
| 6428 | + createChildren(vnode, children, insertedVnodeQueue); | ||
| 6429 | + } else { | ||
| 6430 | + // v-html and domProps: innerHTML | ||
| 6431 | + if (isDef(i = data) && isDef(i = i.domProps) && isDef(i = i.innerHTML)) { | ||
| 6432 | + if (i !== elm.innerHTML) { | ||
| 6433 | + /* istanbul ignore if */ | ||
| 6434 | + if (typeof console !== 'undefined' && | ||
| 6435 | + !hydrationBailed | ||
| 6436 | + ) { | ||
| 6437 | + hydrationBailed = true; | ||
| 6438 | + console.warn('Parent: ', elm); | ||
| 6439 | + console.warn('server innerHTML: ', i); | ||
| 6440 | + console.warn('client innerHTML: ', elm.innerHTML); | ||
| 6441 | + } | ||
| 6442 | + return false | ||
| 6443 | + } | ||
| 6444 | + } else { | ||
| 6445 | + // iterate and compare children lists | ||
| 6446 | + var childrenMatch = true; | ||
| 6447 | + var childNode = elm.firstChild; | ||
| 6448 | + for (var i$1 = 0; i$1 < children.length; i$1++) { | ||
| 6449 | + if (!childNode || !hydrate(childNode, children[i$1], insertedVnodeQueue, inVPre)) { | ||
| 6450 | + childrenMatch = false; | ||
| 6451 | + break | ||
| 6452 | + } | ||
| 6453 | + childNode = childNode.nextSibling; | ||
| 6454 | + } | ||
| 6455 | + // if childNode is not null, it means the actual childNodes list is | ||
| 6456 | + // longer than the virtual children list. | ||
| 6457 | + if (!childrenMatch || childNode) { | ||
| 6458 | + /* istanbul ignore if */ | ||
| 6459 | + if (typeof console !== 'undefined' && | ||
| 6460 | + !hydrationBailed | ||
| 6461 | + ) { | ||
| 6462 | + hydrationBailed = true; | ||
| 6463 | + console.warn('Parent: ', elm); | ||
| 6464 | + console.warn('Mismatching childNodes vs. VNodes: ', elm.childNodes, children); | ||
| 6465 | + } | ||
| 6466 | + return false | ||
| 6467 | + } | ||
| 6468 | + } | ||
| 6469 | + } | ||
| 6470 | + } | ||
| 6471 | + if (isDef(data)) { | ||
| 6472 | + var fullInvoke = false; | ||
| 6473 | + for (var key in data) { | ||
| 6474 | + if (!isRenderedModule(key)) { | ||
| 6475 | + fullInvoke = true; | ||
| 6476 | + invokeCreateHooks(vnode, insertedVnodeQueue); | ||
| 6477 | + break | ||
| 6478 | + } | ||
| 6479 | + } | ||
| 6480 | + if (!fullInvoke && data['class']) { | ||
| 6481 | + // ensure collecting deps for deep class bindings for future updates | ||
| 6482 | + traverse(data['class']); | ||
| 6483 | + } | ||
| 6484 | + } | ||
| 6485 | + } else if (elm.data !== vnode.text) { | ||
| 6486 | + elm.data = vnode.text; | ||
| 6487 | + } | ||
| 6488 | + return true | ||
| 6489 | + } | ||
| 6490 | + | ||
| 6491 | + function assertNodeMatch (node, vnode, inVPre) { | ||
| 6492 | + if (isDef(vnode.tag)) { | ||
| 6493 | + return vnode.tag.indexOf('vue-component') === 0 || ( | ||
| 6494 | + !isUnknownElement$$1(vnode, inVPre) && | ||
| 6495 | + vnode.tag.toLowerCase() === (node.tagName && node.tagName.toLowerCase()) | ||
| 6496 | + ) | ||
| 6497 | + } else { | ||
| 6498 | + return node.nodeType === (vnode.isComment ? 8 : 3) | ||
| 6499 | + } | ||
| 6500 | + } | ||
| 6501 | + | ||
| 6502 | + return function patch (oldVnode, vnode, hydrating, removeOnly) { | ||
| 6503 | + if (isUndef(vnode)) { | ||
| 6504 | + if (isDef(oldVnode)) { invokeDestroyHook(oldVnode); } | ||
| 6505 | + return | ||
| 6506 | + } | ||
| 6507 | + | ||
| 6508 | + var isInitialPatch = false; | ||
| 6509 | + var insertedVnodeQueue = []; | ||
| 6510 | + | ||
| 6511 | + if (isUndef(oldVnode)) { | ||
| 6512 | + // empty mount (likely as component), create new root element | ||
| 6513 | + isInitialPatch = true; | ||
| 6514 | + createElm(vnode, insertedVnodeQueue); | ||
| 6515 | + } else { | ||
| 6516 | + var isRealElement = isDef(oldVnode.nodeType); | ||
| 6517 | + if (!isRealElement && sameVnode(oldVnode, vnode)) { | ||
| 6518 | + // patch existing root node | ||
| 6519 | + patchVnode(oldVnode, vnode, insertedVnodeQueue, null, null, removeOnly); | ||
| 6520 | + } else { | ||
| 6521 | + if (isRealElement) { | ||
| 6522 | + // mounting to a real element | ||
| 6523 | + // check if this is server-rendered content and if we can perform | ||
| 6524 | + // a successful hydration. | ||
| 6525 | + if (oldVnode.nodeType === 1 && oldVnode.hasAttribute(SSR_ATTR)) { | ||
| 6526 | + oldVnode.removeAttribute(SSR_ATTR); | ||
| 6527 | + hydrating = true; | ||
| 6528 | + } | ||
| 6529 | + if (isTrue(hydrating)) { | ||
| 6530 | + if (hydrate(oldVnode, vnode, insertedVnodeQueue)) { | ||
| 6531 | + invokeInsertHook(vnode, insertedVnodeQueue, true); | ||
| 6532 | + return oldVnode | ||
| 6533 | + } else { | ||
| 6534 | + warn( | ||
| 6535 | + 'The client-side rendered virtual DOM tree is not matching ' + | ||
| 6536 | + 'server-rendered content. This is likely caused by incorrect ' + | ||
| 6537 | + 'HTML markup, for example nesting block-level elements inside ' + | ||
| 6538 | + '<p>, or missing <tbody>. Bailing hydration and performing ' + | ||
| 6539 | + 'full client-side render.' | ||
| 6540 | + ); | ||
| 6541 | + } | ||
| 6542 | + } | ||
| 6543 | + // either not server-rendered, or hydration failed. | ||
| 6544 | + // create an empty node and replace it | ||
| 6545 | + oldVnode = emptyNodeAt(oldVnode); | ||
| 6546 | + } | ||
| 6547 | + | ||
| 6548 | + // replacing existing element | ||
| 6549 | + var oldElm = oldVnode.elm; | ||
| 6550 | + var parentElm = nodeOps.parentNode(oldElm); | ||
| 6551 | + | ||
| 6552 | + // create new node | ||
| 6553 | + createElm( | ||
| 6554 | + vnode, | ||
| 6555 | + insertedVnodeQueue, | ||
| 6556 | + // extremely rare edge case: do not insert if old element is in a | ||
| 6557 | + // leaving transition. Only happens when combining transition + | ||
| 6558 | + // keep-alive + HOCs. (#4590) | ||
| 6559 | + oldElm._leaveCb ? null : parentElm, | ||
| 6560 | + nodeOps.nextSibling(oldElm) | ||
| 6561 | + ); | ||
| 6562 | + | ||
| 6563 | + // update parent placeholder node element, recursively | ||
| 6564 | + if (isDef(vnode.parent)) { | ||
| 6565 | + var ancestor = vnode.parent; | ||
| 6566 | + var patchable = isPatchable(vnode); | ||
| 6567 | + while (ancestor) { | ||
| 6568 | + for (var i = 0; i < cbs.destroy.length; ++i) { | ||
| 6569 | + cbs.destroy[i](ancestor); | ||
| 6570 | + } | ||
| 6571 | + ancestor.elm = vnode.elm; | ||
| 6572 | + if (patchable) { | ||
| 6573 | + for (var i$1 = 0; i$1 < cbs.create.length; ++i$1) { | ||
| 6574 | + cbs.create[i$1](emptyNode, ancestor); | ||
| 6575 | + } | ||
| 6576 | + // #6513 | ||
| 6577 | + // invoke insert hooks that may have been merged by create hooks. | ||
| 6578 | + // e.g. for directives that uses the "inserted" hook. | ||
| 6579 | + var insert = ancestor.data.hook.insert; | ||
| 6580 | + if (insert.merged) { | ||
| 6581 | + // start at index 1 to avoid re-invoking component mounted hook | ||
| 6582 | + for (var i$2 = 1; i$2 < insert.fns.length; i$2++) { | ||
| 6583 | + insert.fns[i$2](); | ||
| 6584 | + } | ||
| 6585 | + } | ||
| 6586 | + } else { | ||
| 6587 | + registerRef(ancestor); | ||
| 6588 | + } | ||
| 6589 | + ancestor = ancestor.parent; | ||
| 6590 | + } | ||
| 6591 | + } | ||
| 6592 | + | ||
| 6593 | + // destroy old node | ||
| 6594 | + if (isDef(parentElm)) { | ||
| 6595 | + removeVnodes([oldVnode], 0, 0); | ||
| 6596 | + } else if (isDef(oldVnode.tag)) { | ||
| 6597 | + invokeDestroyHook(oldVnode); | ||
| 6598 | + } | ||
| 6599 | + } | ||
| 6600 | + } | ||
| 6601 | + | ||
| 6602 | + invokeInsertHook(vnode, insertedVnodeQueue, isInitialPatch); | ||
| 6603 | + return vnode.elm | ||
| 6604 | + } | ||
| 6605 | + } | ||
| 6606 | + | ||
| 6607 | + /* */ | ||
| 6608 | + | ||
| 6609 | + var directives = { | ||
| 6610 | + create: updateDirectives, | ||
| 6611 | + update: updateDirectives, | ||
| 6612 | + destroy: function unbindDirectives (vnode) { | ||
| 6613 | + updateDirectives(vnode, emptyNode); | ||
| 6614 | + } | ||
| 6615 | + }; | ||
| 6616 | + | ||
| 6617 | + function updateDirectives (oldVnode, vnode) { | ||
| 6618 | + if (oldVnode.data.directives || vnode.data.directives) { | ||
| 6619 | + _update(oldVnode, vnode); | ||
| 6620 | + } | ||
| 6621 | + } | ||
| 6622 | + | ||
| 6623 | + function _update (oldVnode, vnode) { | ||
| 6624 | + var isCreate = oldVnode === emptyNode; | ||
| 6625 | + var isDestroy = vnode === emptyNode; | ||
| 6626 | + var oldDirs = normalizeDirectives$1(oldVnode.data.directives, oldVnode.context); | ||
| 6627 | + var newDirs = normalizeDirectives$1(vnode.data.directives, vnode.context); | ||
| 6628 | + | ||
| 6629 | + var dirsWithInsert = []; | ||
| 6630 | + var dirsWithPostpatch = []; | ||
| 6631 | + | ||
| 6632 | + var key, oldDir, dir; | ||
| 6633 | + for (key in newDirs) { | ||
| 6634 | + oldDir = oldDirs[key]; | ||
| 6635 | + dir = newDirs[key]; | ||
| 6636 | + if (!oldDir) { | ||
| 6637 | + // new directive, bind | ||
| 6638 | + callHook$1(dir, 'bind', vnode, oldVnode); | ||
| 6639 | + if (dir.def && dir.def.inserted) { | ||
| 6640 | + dirsWithInsert.push(dir); | ||
| 6641 | + } | ||
| 6642 | + } else { | ||
| 6643 | + // existing directive, update | ||
| 6644 | + dir.oldValue = oldDir.value; | ||
| 6645 | + dir.oldArg = oldDir.arg; | ||
| 6646 | + callHook$1(dir, 'update', vnode, oldVnode); | ||
| 6647 | + if (dir.def && dir.def.componentUpdated) { | ||
| 6648 | + dirsWithPostpatch.push(dir); | ||
| 6649 | + } | ||
| 6650 | + } | ||
| 6651 | + } | ||
| 6652 | + | ||
| 6653 | + if (dirsWithInsert.length) { | ||
| 6654 | + var callInsert = function () { | ||
| 6655 | + for (var i = 0; i < dirsWithInsert.length; i++) { | ||
| 6656 | + callHook$1(dirsWithInsert[i], 'inserted', vnode, oldVnode); | ||
| 6657 | + } | ||
| 6658 | + }; | ||
| 6659 | + if (isCreate) { | ||
| 6660 | + mergeVNodeHook(vnode, 'insert', callInsert); | ||
| 6661 | + } else { | ||
| 6662 | + callInsert(); | ||
| 6663 | + } | ||
| 6664 | + } | ||
| 6665 | + | ||
| 6666 | + if (dirsWithPostpatch.length) { | ||
| 6667 | + mergeVNodeHook(vnode, 'postpatch', function () { | ||
| 6668 | + for (var i = 0; i < dirsWithPostpatch.length; i++) { | ||
| 6669 | + callHook$1(dirsWithPostpatch[i], 'componentUpdated', vnode, oldVnode); | ||
| 6670 | + } | ||
| 6671 | + }); | ||
| 6672 | + } | ||
| 6673 | + | ||
| 6674 | + if (!isCreate) { | ||
| 6675 | + for (key in oldDirs) { | ||
| 6676 | + if (!newDirs[key]) { | ||
| 6677 | + // no longer present, unbind | ||
| 6678 | + callHook$1(oldDirs[key], 'unbind', oldVnode, oldVnode, isDestroy); | ||
| 6679 | + } | ||
| 6680 | + } | ||
| 6681 | + } | ||
| 6682 | + } | ||
| 6683 | + | ||
| 6684 | + var emptyModifiers = Object.create(null); | ||
| 6685 | + | ||
| 6686 | + function normalizeDirectives$1 ( | ||
| 6687 | + dirs, | ||
| 6688 | + vm | ||
| 6689 | + ) { | ||
| 6690 | + var res = Object.create(null); | ||
| 6691 | + if (!dirs) { | ||
| 6692 | + // $flow-disable-line | ||
| 6693 | + return res | ||
| 6694 | + } | ||
| 6695 | + var i, dir; | ||
| 6696 | + for (i = 0; i < dirs.length; i++) { | ||
| 6697 | + dir = dirs[i]; | ||
| 6698 | + if (!dir.modifiers) { | ||
| 6699 | + // $flow-disable-line | ||
| 6700 | + dir.modifiers = emptyModifiers; | ||
| 6701 | + } | ||
| 6702 | + res[getRawDirName(dir)] = dir; | ||
| 6703 | + dir.def = resolveAsset(vm.$options, 'directives', dir.name, true); | ||
| 6704 | + } | ||
| 6705 | + // $flow-disable-line | ||
| 6706 | + return res | ||
| 6707 | + } | ||
| 6708 | + | ||
| 6709 | + function getRawDirName (dir) { | ||
| 6710 | + return dir.rawName || ((dir.name) + "." + (Object.keys(dir.modifiers || {}).join('.'))) | ||
| 6711 | + } | ||
| 6712 | + | ||
| 6713 | + function callHook$1 (dir, hook, vnode, oldVnode, isDestroy) { | ||
| 6714 | + var fn = dir.def && dir.def[hook]; | ||
| 6715 | + if (fn) { | ||
| 6716 | + try { | ||
| 6717 | + fn(vnode.elm, dir, vnode, oldVnode, isDestroy); | ||
| 6718 | + } catch (e) { | ||
| 6719 | + handleError(e, vnode.context, ("directive " + (dir.name) + " " + hook + " hook")); | ||
| 6720 | + } | ||
| 6721 | + } | ||
| 6722 | + } | ||
| 6723 | + | ||
| 6724 | + var baseModules = [ | ||
| 6725 | + ref, | ||
| 6726 | + directives | ||
| 6727 | + ]; | ||
| 6728 | + | ||
| 6729 | + /* */ | ||
| 6730 | + | ||
| 6731 | + function updateAttrs (oldVnode, vnode) { | ||
| 6732 | + var opts = vnode.componentOptions; | ||
| 6733 | + if (isDef(opts) && opts.Ctor.options.inheritAttrs === false) { | ||
| 6734 | + return | ||
| 6735 | + } | ||
| 6736 | + if (isUndef(oldVnode.data.attrs) && isUndef(vnode.data.attrs)) { | ||
| 6737 | + return | ||
| 6738 | + } | ||
| 6739 | + var key, cur, old; | ||
| 6740 | + var elm = vnode.elm; | ||
| 6741 | + var oldAttrs = oldVnode.data.attrs || {}; | ||
| 6742 | + var attrs = vnode.data.attrs || {}; | ||
| 6743 | + // clone observed objects, as the user probably wants to mutate it | ||
| 6744 | + if (isDef(attrs.__ob__)) { | ||
| 6745 | + attrs = vnode.data.attrs = extend({}, attrs); | ||
| 6746 | + } | ||
| 6747 | + | ||
| 6748 | + for (key in attrs) { | ||
| 6749 | + cur = attrs[key]; | ||
| 6750 | + old = oldAttrs[key]; | ||
| 6751 | + if (old !== cur) { | ||
| 6752 | + setAttr(elm, key, cur, vnode.data.pre); | ||
| 6753 | + } | ||
| 6754 | + } | ||
| 6755 | + // #4391: in IE9, setting type can reset value for input[type=radio] | ||
| 6756 | + // #6666: IE/Edge forces progress value down to 1 before setting a max | ||
| 6757 | + /* istanbul ignore if */ | ||
| 6758 | + if ((isIE || isEdge) && attrs.value !== oldAttrs.value) { | ||
| 6759 | + setAttr(elm, 'value', attrs.value); | ||
| 6760 | + } | ||
| 6761 | + for (key in oldAttrs) { | ||
| 6762 | + if (isUndef(attrs[key])) { | ||
| 6763 | + if (isXlink(key)) { | ||
| 6764 | + elm.removeAttributeNS(xlinkNS, getXlinkProp(key)); | ||
| 6765 | + } else if (!isEnumeratedAttr(key)) { | ||
| 6766 | + elm.removeAttribute(key); | ||
| 6767 | + } | ||
| 6768 | + } | ||
| 6769 | + } | ||
| 6770 | + } | ||
| 6771 | + | ||
| 6772 | + function setAttr (el, key, value, isInPre) { | ||
| 6773 | + if (isInPre || el.tagName.indexOf('-') > -1) { | ||
| 6774 | + baseSetAttr(el, key, value); | ||
| 6775 | + } else if (isBooleanAttr(key)) { | ||
| 6776 | + // set attribute for blank value | ||
| 6777 | + // e.g. <option disabled>Select one</option> | ||
| 6778 | + if (isFalsyAttrValue(value)) { | ||
| 6779 | + el.removeAttribute(key); | ||
| 6780 | + } else { | ||
| 6781 | + // technically allowfullscreen is a boolean attribute for <iframe>, | ||
| 6782 | + // but Flash expects a value of "true" when used on <embed> tag | ||
| 6783 | + value = key === 'allowfullscreen' && el.tagName === 'EMBED' | ||
| 6784 | + ? 'true' | ||
| 6785 | + : key; | ||
| 6786 | + el.setAttribute(key, value); | ||
| 6787 | + } | ||
| 6788 | + } else if (isEnumeratedAttr(key)) { | ||
| 6789 | + el.setAttribute(key, convertEnumeratedValue(key, value)); | ||
| 6790 | + } else if (isXlink(key)) { | ||
| 6791 | + if (isFalsyAttrValue(value)) { | ||
| 6792 | + el.removeAttributeNS(xlinkNS, getXlinkProp(key)); | ||
| 6793 | + } else { | ||
| 6794 | + el.setAttributeNS(xlinkNS, key, value); | ||
| 6795 | + } | ||
| 6796 | + } else { | ||
| 6797 | + baseSetAttr(el, key, value); | ||
| 6798 | + } | ||
| 6799 | + } | ||
| 6800 | + | ||
| 6801 | + function baseSetAttr (el, key, value) { | ||
| 6802 | + if (isFalsyAttrValue(value)) { | ||
| 6803 | + el.removeAttribute(key); | ||
| 6804 | + } else { | ||
| 6805 | + // #7138: IE10 & 11 fires input event when setting placeholder on | ||
| 6806 | + // <textarea>... block the first input event and remove the blocker | ||
| 6807 | + // immediately. | ||
| 6808 | + /* istanbul ignore if */ | ||
| 6809 | + if ( | ||
| 6810 | + isIE && !isIE9 && | ||
| 6811 | + el.tagName === 'TEXTAREA' && | ||
| 6812 | + key === 'placeholder' && value !== '' && !el.__ieph | ||
| 6813 | + ) { | ||
| 6814 | + var blocker = function (e) { | ||
| 6815 | + e.stopImmediatePropagation(); | ||
| 6816 | + el.removeEventListener('input', blocker); | ||
| 6817 | + }; | ||
| 6818 | + el.addEventListener('input', blocker); | ||
| 6819 | + // $flow-disable-line | ||
| 6820 | + el.__ieph = true; /* IE placeholder patched */ | ||
| 6821 | + } | ||
| 6822 | + el.setAttribute(key, value); | ||
| 6823 | + } | ||
| 6824 | + } | ||
| 6825 | + | ||
| 6826 | + var attrs = { | ||
| 6827 | + create: updateAttrs, | ||
| 6828 | + update: updateAttrs | ||
| 6829 | + }; | ||
| 6830 | + | ||
| 6831 | + /* */ | ||
| 6832 | + | ||
| 6833 | + function updateClass (oldVnode, vnode) { | ||
| 6834 | + var el = vnode.elm; | ||
| 6835 | + var data = vnode.data; | ||
| 6836 | + var oldData = oldVnode.data; | ||
| 6837 | + if ( | ||
| 6838 | + isUndef(data.staticClass) && | ||
| 6839 | + isUndef(data.class) && ( | ||
| 6840 | + isUndef(oldData) || ( | ||
| 6841 | + isUndef(oldData.staticClass) && | ||
| 6842 | + isUndef(oldData.class) | ||
| 6843 | + ) | ||
| 6844 | + ) | ||
| 6845 | + ) { | ||
| 6846 | + return | ||
| 6847 | + } | ||
| 6848 | + | ||
| 6849 | + var cls = genClassForVnode(vnode); | ||
| 6850 | + | ||
| 6851 | + // handle transition classes | ||
| 6852 | + var transitionClass = el._transitionClasses; | ||
| 6853 | + if (isDef(transitionClass)) { | ||
| 6854 | + cls = concat(cls, stringifyClass(transitionClass)); | ||
| 6855 | + } | ||
| 6856 | + | ||
| 6857 | + // set the class | ||
| 6858 | + if (cls !== el._prevClass) { | ||
| 6859 | + el.setAttribute('class', cls); | ||
| 6860 | + el._prevClass = cls; | ||
| 6861 | + } | ||
| 6862 | + } | ||
| 6863 | + | ||
| 6864 | + var klass = { | ||
| 6865 | + create: updateClass, | ||
| 6866 | + update: updateClass | ||
| 6867 | + }; | ||
| 6868 | + | ||
| 6869 | + /* */ | ||
| 6870 | + | ||
| 6871 | + var validDivisionCharRE = /[\w).+\-_$\]]/; | ||
| 6872 | + | ||
| 6873 | + function parseFilters (exp) { | ||
| 6874 | + var inSingle = false; | ||
| 6875 | + var inDouble = false; | ||
| 6876 | + var inTemplateString = false; | ||
| 6877 | + var inRegex = false; | ||
| 6878 | + var curly = 0; | ||
| 6879 | + var square = 0; | ||
| 6880 | + var paren = 0; | ||
| 6881 | + var lastFilterIndex = 0; | ||
| 6882 | + var c, prev, i, expression, filters; | ||
| 6883 | + | ||
| 6884 | + for (i = 0; i < exp.length; i++) { | ||
| 6885 | + prev = c; | ||
| 6886 | + c = exp.charCodeAt(i); | ||
| 6887 | + if (inSingle) { | ||
| 6888 | + if (c === 0x27 && prev !== 0x5C) { inSingle = false; } | ||
| 6889 | + } else if (inDouble) { | ||
| 6890 | + if (c === 0x22 && prev !== 0x5C) { inDouble = false; } | ||
| 6891 | + } else if (inTemplateString) { | ||
| 6892 | + if (c === 0x60 && prev !== 0x5C) { inTemplateString = false; } | ||
| 6893 | + } else if (inRegex) { | ||
| 6894 | + if (c === 0x2f && prev !== 0x5C) { inRegex = false; } | ||
| 6895 | + } else if ( | ||
| 6896 | + c === 0x7C && // pipe | ||
| 6897 | + exp.charCodeAt(i + 1) !== 0x7C && | ||
| 6898 | + exp.charCodeAt(i - 1) !== 0x7C && | ||
| 6899 | + !curly && !square && !paren | ||
| 6900 | + ) { | ||
| 6901 | + if (expression === undefined) { | ||
| 6902 | + // first filter, end of expression | ||
| 6903 | + lastFilterIndex = i + 1; | ||
| 6904 | + expression = exp.slice(0, i).trim(); | ||
| 6905 | + } else { | ||
| 6906 | + pushFilter(); | ||
| 6907 | + } | ||
| 6908 | + } else { | ||
| 6909 | + switch (c) { | ||
| 6910 | + case 0x22: inDouble = true; break // " | ||
| 6911 | + case 0x27: inSingle = true; break // ' | ||
| 6912 | + case 0x60: inTemplateString = true; break // ` | ||
| 6913 | + case 0x28: paren++; break // ( | ||
| 6914 | + case 0x29: paren--; break // ) | ||
| 6915 | + case 0x5B: square++; break // [ | ||
| 6916 | + case 0x5D: square--; break // ] | ||
| 6917 | + case 0x7B: curly++; break // { | ||
| 6918 | + case 0x7D: curly--; break // } | ||
| 6919 | + } | ||
| 6920 | + if (c === 0x2f) { // / | ||
| 6921 | + var j = i - 1; | ||
| 6922 | + var p = (void 0); | ||
| 6923 | + // find first non-whitespace prev char | ||
| 6924 | + for (; j >= 0; j--) { | ||
| 6925 | + p = exp.charAt(j); | ||
| 6926 | + if (p !== ' ') { break } | ||
| 6927 | + } | ||
| 6928 | + if (!p || !validDivisionCharRE.test(p)) { | ||
| 6929 | + inRegex = true; | ||
| 6930 | + } | ||
| 6931 | + } | ||
| 6932 | + } | ||
| 6933 | + } | ||
| 6934 | + | ||
| 6935 | + if (expression === undefined) { | ||
| 6936 | + expression = exp.slice(0, i).trim(); | ||
| 6937 | + } else if (lastFilterIndex !== 0) { | ||
| 6938 | + pushFilter(); | ||
| 6939 | + } | ||
| 6940 | + | ||
| 6941 | + function pushFilter () { | ||
| 6942 | + (filters || (filters = [])).push(exp.slice(lastFilterIndex, i).trim()); | ||
| 6943 | + lastFilterIndex = i + 1; | ||
| 6944 | + } | ||
| 6945 | + | ||
| 6946 | + if (filters) { | ||
| 6947 | + for (i = 0; i < filters.length; i++) { | ||
| 6948 | + expression = wrapFilter(expression, filters[i]); | ||
| 6949 | + } | ||
| 6950 | + } | ||
| 6951 | + | ||
| 6952 | + return expression | ||
| 6953 | + } | ||
| 6954 | + | ||
| 6955 | + function wrapFilter (exp, filter) { | ||
| 6956 | + var i = filter.indexOf('('); | ||
| 6957 | + if (i < 0) { | ||
| 6958 | + // _f: resolveFilter | ||
| 6959 | + return ("_f(\"" + filter + "\")(" + exp + ")") | ||
| 6960 | + } else { | ||
| 6961 | + var name = filter.slice(0, i); | ||
| 6962 | + var args = filter.slice(i + 1); | ||
| 6963 | + return ("_f(\"" + name + "\")(" + exp + (args !== ')' ? ',' + args : args)) | ||
| 6964 | + } | ||
| 6965 | + } | ||
| 6966 | + | ||
| 6967 | + /* */ | ||
| 6968 | + | ||
| 6969 | + | ||
| 6970 | + | ||
| 6971 | + /* eslint-disable no-unused-vars */ | ||
| 6972 | + function baseWarn (msg, range) { | ||
| 6973 | + console.error(("[Vue compiler]: " + msg)); | ||
| 6974 | + } | ||
| 6975 | + /* eslint-enable no-unused-vars */ | ||
| 6976 | + | ||
| 6977 | + function pluckModuleFunction ( | ||
| 6978 | + modules, | ||
| 6979 | + key | ||
| 6980 | + ) { | ||
| 6981 | + return modules | ||
| 6982 | + ? modules.map(function (m) { return m[key]; }).filter(function (_) { return _; }) | ||
| 6983 | + : [] | ||
| 6984 | + } | ||
| 6985 | + | ||
| 6986 | + function addProp (el, name, value, range, dynamic) { | ||
| 6987 | + (el.props || (el.props = [])).push(rangeSetItem({ name: name, value: value, dynamic: dynamic }, range)); | ||
| 6988 | + el.plain = false; | ||
| 6989 | + } | ||
| 6990 | + | ||
| 6991 | + function addAttr (el, name, value, range, dynamic) { | ||
| 6992 | + var attrs = dynamic | ||
| 6993 | + ? (el.dynamicAttrs || (el.dynamicAttrs = [])) | ||
| 6994 | + : (el.attrs || (el.attrs = [])); | ||
| 6995 | + attrs.push(rangeSetItem({ name: name, value: value, dynamic: dynamic }, range)); | ||
| 6996 | + el.plain = false; | ||
| 6997 | + } | ||
| 6998 | + | ||
| 6999 | + // add a raw attr (use this in preTransforms) | ||
| 7000 | + function addRawAttr (el, name, value, range) { | ||
| 7001 | + el.attrsMap[name] = value; | ||
| 7002 | + el.attrsList.push(rangeSetItem({ name: name, value: value }, range)); | ||
| 7003 | + } | ||
| 7004 | + | ||
| 7005 | + function addDirective ( | ||
| 7006 | + el, | ||
| 7007 | + name, | ||
| 7008 | + rawName, | ||
| 7009 | + value, | ||
| 7010 | + arg, | ||
| 7011 | + isDynamicArg, | ||
| 7012 | + modifiers, | ||
| 7013 | + range | ||
| 7014 | + ) { | ||
| 7015 | + (el.directives || (el.directives = [])).push(rangeSetItem({ | ||
| 7016 | + name: name, | ||
| 7017 | + rawName: rawName, | ||
| 7018 | + value: value, | ||
| 7019 | + arg: arg, | ||
| 7020 | + isDynamicArg: isDynamicArg, | ||
| 7021 | + modifiers: modifiers | ||
| 7022 | + }, range)); | ||
| 7023 | + el.plain = false; | ||
| 7024 | + } | ||
| 7025 | + | ||
| 7026 | + function prependModifierMarker (symbol, name, dynamic) { | ||
| 7027 | + return dynamic | ||
| 7028 | + ? ("_p(" + name + ",\"" + symbol + "\")") | ||
| 7029 | + : symbol + name // mark the event as captured | ||
| 7030 | + } | ||
| 7031 | + | ||
| 7032 | + function addHandler ( | ||
| 7033 | + el, | ||
| 7034 | + name, | ||
| 7035 | + value, | ||
| 7036 | + modifiers, | ||
| 7037 | + important, | ||
| 7038 | + warn, | ||
| 7039 | + range, | ||
| 7040 | + dynamic | ||
| 7041 | + ) { | ||
| 7042 | + modifiers = modifiers || emptyObject; | ||
| 7043 | + // warn prevent and passive modifier | ||
| 7044 | + /* istanbul ignore if */ | ||
| 7045 | + if ( | ||
| 7046 | + warn && | ||
| 7047 | + modifiers.prevent && modifiers.passive | ||
| 7048 | + ) { | ||
| 7049 | + warn( | ||
| 7050 | + 'passive and prevent can\'t be used together. ' + | ||
| 7051 | + 'Passive handler can\'t prevent default event.', | ||
| 7052 | + range | ||
| 7053 | + ); | ||
| 7054 | + } | ||
| 7055 | + | ||
| 7056 | + // normalize click.right and click.middle since they don't actually fire | ||
| 7057 | + // this is technically browser-specific, but at least for now browsers are | ||
| 7058 | + // the only target envs that have right/middle clicks. | ||
| 7059 | + if (modifiers.right) { | ||
| 7060 | + if (dynamic) { | ||
| 7061 | + name = "(" + name + ")==='click'?'contextmenu':(" + name + ")"; | ||
| 7062 | + } else if (name === 'click') { | ||
| 7063 | + name = 'contextmenu'; | ||
| 7064 | + delete modifiers.right; | ||
| 7065 | + } | ||
| 7066 | + } else if (modifiers.middle) { | ||
| 7067 | + if (dynamic) { | ||
| 7068 | + name = "(" + name + ")==='click'?'mouseup':(" + name + ")"; | ||
| 7069 | + } else if (name === 'click') { | ||
| 7070 | + name = 'mouseup'; | ||
| 7071 | + } | ||
| 7072 | + } | ||
| 7073 | + | ||
| 7074 | + // check capture modifier | ||
| 7075 | + if (modifiers.capture) { | ||
| 7076 | + delete modifiers.capture; | ||
| 7077 | + name = prependModifierMarker('!', name, dynamic); | ||
| 7078 | + } | ||
| 7079 | + if (modifiers.once) { | ||
| 7080 | + delete modifiers.once; | ||
| 7081 | + name = prependModifierMarker('~', name, dynamic); | ||
| 7082 | + } | ||
| 7083 | + /* istanbul ignore if */ | ||
| 7084 | + if (modifiers.passive) { | ||
| 7085 | + delete modifiers.passive; | ||
| 7086 | + name = prependModifierMarker('&', name, dynamic); | ||
| 7087 | + } | ||
| 7088 | + | ||
| 7089 | + var events; | ||
| 7090 | + if (modifiers.native) { | ||
| 7091 | + delete modifiers.native; | ||
| 7092 | + events = el.nativeEvents || (el.nativeEvents = {}); | ||
| 7093 | + } else { | ||
| 7094 | + events = el.events || (el.events = {}); | ||
| 7095 | + } | ||
| 7096 | + | ||
| 7097 | + var newHandler = rangeSetItem({ value: value.trim(), dynamic: dynamic }, range); | ||
| 7098 | + if (modifiers !== emptyObject) { | ||
| 7099 | + newHandler.modifiers = modifiers; | ||
| 7100 | + } | ||
| 7101 | + | ||
| 7102 | + var handlers = events[name]; | ||
| 7103 | + /* istanbul ignore if */ | ||
| 7104 | + if (Array.isArray(handlers)) { | ||
| 7105 | + important ? handlers.unshift(newHandler) : handlers.push(newHandler); | ||
| 7106 | + } else if (handlers) { | ||
| 7107 | + events[name] = important ? [newHandler, handlers] : [handlers, newHandler]; | ||
| 7108 | + } else { | ||
| 7109 | + events[name] = newHandler; | ||
| 7110 | + } | ||
| 7111 | + | ||
| 7112 | + el.plain = false; | ||
| 7113 | + } | ||
| 7114 | + | ||
| 7115 | + function getRawBindingAttr ( | ||
| 7116 | + el, | ||
| 7117 | + name | ||
| 7118 | + ) { | ||
| 7119 | + return el.rawAttrsMap[':' + name] || | ||
| 7120 | + el.rawAttrsMap['v-bind:' + name] || | ||
| 7121 | + el.rawAttrsMap[name] | ||
| 7122 | + } | ||
| 7123 | + | ||
| 7124 | + function getBindingAttr ( | ||
| 7125 | + el, | ||
| 7126 | + name, | ||
| 7127 | + getStatic | ||
| 7128 | + ) { | ||
| 7129 | + var dynamicValue = | ||
| 7130 | + getAndRemoveAttr(el, ':' + name) || | ||
| 7131 | + getAndRemoveAttr(el, 'v-bind:' + name); | ||
| 7132 | + if (dynamicValue != null) { | ||
| 7133 | + return parseFilters(dynamicValue) | ||
| 7134 | + } else if (getStatic !== false) { | ||
| 7135 | + var staticValue = getAndRemoveAttr(el, name); | ||
| 7136 | + if (staticValue != null) { | ||
| 7137 | + return JSON.stringify(staticValue) | ||
| 7138 | + } | ||
| 7139 | + } | ||
| 7140 | + } | ||
| 7141 | + | ||
| 7142 | + // note: this only removes the attr from the Array (attrsList) so that it | ||
| 7143 | + // doesn't get processed by processAttrs. | ||
| 7144 | + // By default it does NOT remove it from the map (attrsMap) because the map is | ||
| 7145 | + // needed during codegen. | ||
| 7146 | + function getAndRemoveAttr ( | ||
| 7147 | + el, | ||
| 7148 | + name, | ||
| 7149 | + removeFromMap | ||
| 7150 | + ) { | ||
| 7151 | + var val; | ||
| 7152 | + if ((val = el.attrsMap[name]) != null) { | ||
| 7153 | + var list = el.attrsList; | ||
| 7154 | + for (var i = 0, l = list.length; i < l; i++) { | ||
| 7155 | + if (list[i].name === name) { | ||
| 7156 | + list.splice(i, 1); | ||
| 7157 | + break | ||
| 7158 | + } | ||
| 7159 | + } | ||
| 7160 | + } | ||
| 7161 | + if (removeFromMap) { | ||
| 7162 | + delete el.attrsMap[name]; | ||
| 7163 | + } | ||
| 7164 | + return val | ||
| 7165 | + } | ||
| 7166 | + | ||
| 7167 | + function getAndRemoveAttrByRegex ( | ||
| 7168 | + el, | ||
| 7169 | + name | ||
| 7170 | + ) { | ||
| 7171 | + var list = el.attrsList; | ||
| 7172 | + for (var i = 0, l = list.length; i < l; i++) { | ||
| 7173 | + var attr = list[i]; | ||
| 7174 | + if (name.test(attr.name)) { | ||
| 7175 | + list.splice(i, 1); | ||
| 7176 | + return attr | ||
| 7177 | + } | ||
| 7178 | + } | ||
| 7179 | + } | ||
| 7180 | + | ||
| 7181 | + function rangeSetItem ( | ||
| 7182 | + item, | ||
| 7183 | + range | ||
| 7184 | + ) { | ||
| 7185 | + if (range) { | ||
| 7186 | + if (range.start != null) { | ||
| 7187 | + item.start = range.start; | ||
| 7188 | + } | ||
| 7189 | + if (range.end != null) { | ||
| 7190 | + item.end = range.end; | ||
| 7191 | + } | ||
| 7192 | + } | ||
| 7193 | + return item | ||
| 7194 | + } | ||
| 7195 | + | ||
| 7196 | + /* */ | ||
| 7197 | + | ||
| 7198 | + /** | ||
| 7199 | + * Cross-platform code generation for component v-model | ||
| 7200 | + */ | ||
| 7201 | + function genComponentModel ( | ||
| 7202 | + el, | ||
| 7203 | + value, | ||
| 7204 | + modifiers | ||
| 7205 | + ) { | ||
| 7206 | + var ref = modifiers || {}; | ||
| 7207 | + var number = ref.number; | ||
| 7208 | + var trim = ref.trim; | ||
| 7209 | + | ||
| 7210 | + var baseValueExpression = '$$v'; | ||
| 7211 | + var valueExpression = baseValueExpression; | ||
| 7212 | + if (trim) { | ||
| 7213 | + valueExpression = | ||
| 7214 | + "(typeof " + baseValueExpression + " === 'string'" + | ||
| 7215 | + "? " + baseValueExpression + ".trim()" + | ||
| 7216 | + ": " + baseValueExpression + ")"; | ||
| 7217 | + } | ||
| 7218 | + if (number) { | ||
| 7219 | + valueExpression = "_n(" + valueExpression + ")"; | ||
| 7220 | + } | ||
| 7221 | + var assignment = genAssignmentCode(value, valueExpression); | ||
| 7222 | + | ||
| 7223 | + el.model = { | ||
| 7224 | + value: ("(" + value + ")"), | ||
| 7225 | + expression: JSON.stringify(value), | ||
| 7226 | + callback: ("function (" + baseValueExpression + ") {" + assignment + "}") | ||
| 7227 | + }; | ||
| 7228 | + } | ||
| 7229 | + | ||
| 7230 | + /** | ||
| 7231 | + * Cross-platform codegen helper for generating v-model value assignment code. | ||
| 7232 | + */ | ||
| 7233 | + function genAssignmentCode ( | ||
| 7234 | + value, | ||
| 7235 | + assignment | ||
| 7236 | + ) { | ||
| 7237 | + var res = parseModel(value); | ||
| 7238 | + if (res.key === null) { | ||
| 7239 | + return (value + "=" + assignment) | ||
| 7240 | + } else { | ||
| 7241 | + return ("$set(" + (res.exp) + ", " + (res.key) + ", " + assignment + ")") | ||
| 7242 | + } | ||
| 7243 | + } | ||
| 7244 | + | ||
| 7245 | + /** | ||
| 7246 | + * Parse a v-model expression into a base path and a final key segment. | ||
| 7247 | + * Handles both dot-path and possible square brackets. | ||
| 7248 | + * | ||
| 7249 | + * Possible cases: | ||
| 7250 | + * | ||
| 7251 | + * - test | ||
| 7252 | + * - test[key] | ||
| 7253 | + * - test[test1[key]] | ||
| 7254 | + * - test["a"][key] | ||
| 7255 | + * - xxx.test[a[a].test1[key]] | ||
| 7256 | + * - test.xxx.a["asa"][test1[key]] | ||
| 7257 | + * | ||
| 7258 | + */ | ||
| 7259 | + | ||
| 7260 | + var len, str, chr, index$1, expressionPos, expressionEndPos; | ||
| 7261 | + | ||
| 7262 | + | ||
| 7263 | + | ||
| 7264 | + function parseModel (val) { | ||
| 7265 | + // Fix https://github.com/vuejs/vue/pull/7730 | ||
| 7266 | + // allow v-model="obj.val " (trailing whitespace) | ||
| 7267 | + val = val.trim(); | ||
| 7268 | + len = val.length; | ||
| 7269 | + | ||
| 7270 | + if (val.indexOf('[') < 0 || val.lastIndexOf(']') < len - 1) { | ||
| 7271 | + index$1 = val.lastIndexOf('.'); | ||
| 7272 | + if (index$1 > -1) { | ||
| 7273 | + return { | ||
| 7274 | + exp: val.slice(0, index$1), | ||
| 7275 | + key: '"' + val.slice(index$1 + 1) + '"' | ||
| 7276 | + } | ||
| 7277 | + } else { | ||
| 7278 | + return { | ||
| 7279 | + exp: val, | ||
| 7280 | + key: null | ||
| 7281 | + } | ||
| 7282 | + } | ||
| 7283 | + } | ||
| 7284 | + | ||
| 7285 | + str = val; | ||
| 7286 | + index$1 = expressionPos = expressionEndPos = 0; | ||
| 7287 | + | ||
| 7288 | + while (!eof()) { | ||
| 7289 | + chr = next(); | ||
| 7290 | + /* istanbul ignore if */ | ||
| 7291 | + if (isStringStart(chr)) { | ||
| 7292 | + parseString(chr); | ||
| 7293 | + } else if (chr === 0x5B) { | ||
| 7294 | + parseBracket(chr); | ||
| 7295 | + } | ||
| 7296 | + } | ||
| 7297 | + | ||
| 7298 | + return { | ||
| 7299 | + exp: val.slice(0, expressionPos), | ||
| 7300 | + key: val.slice(expressionPos + 1, expressionEndPos) | ||
| 7301 | + } | ||
| 7302 | + } | ||
| 7303 | + | ||
| 7304 | + function next () { | ||
| 7305 | + return str.charCodeAt(++index$1) | ||
| 7306 | + } | ||
| 7307 | + | ||
| 7308 | + function eof () { | ||
| 7309 | + return index$1 >= len | ||
| 7310 | + } | ||
| 7311 | + | ||
| 7312 | + function isStringStart (chr) { | ||
| 7313 | + return chr === 0x22 || chr === 0x27 | ||
| 7314 | + } | ||
| 7315 | + | ||
| 7316 | + function parseBracket (chr) { | ||
| 7317 | + var inBracket = 1; | ||
| 7318 | + expressionPos = index$1; | ||
| 7319 | + while (!eof()) { | ||
| 7320 | + chr = next(); | ||
| 7321 | + if (isStringStart(chr)) { | ||
| 7322 | + parseString(chr); | ||
| 7323 | + continue | ||
| 7324 | + } | ||
| 7325 | + if (chr === 0x5B) { inBracket++; } | ||
| 7326 | + if (chr === 0x5D) { inBracket--; } | ||
| 7327 | + if (inBracket === 0) { | ||
| 7328 | + expressionEndPos = index$1; | ||
| 7329 | + break | ||
| 7330 | + } | ||
| 7331 | + } | ||
| 7332 | + } | ||
| 7333 | + | ||
| 7334 | + function parseString (chr) { | ||
| 7335 | + var stringQuote = chr; | ||
| 7336 | + while (!eof()) { | ||
| 7337 | + chr = next(); | ||
| 7338 | + if (chr === stringQuote) { | ||
| 7339 | + break | ||
| 7340 | + } | ||
| 7341 | + } | ||
| 7342 | + } | ||
| 7343 | + | ||
| 7344 | + /* */ | ||
| 7345 | + | ||
| 7346 | + var warn$1; | ||
| 7347 | + | ||
| 7348 | + // in some cases, the event used has to be determined at runtime | ||
| 7349 | + // so we used some reserved tokens during compile. | ||
| 7350 | + var RANGE_TOKEN = '__r'; | ||
| 7351 | + var CHECKBOX_RADIO_TOKEN = '__c'; | ||
| 7352 | + | ||
| 7353 | + function model ( | ||
| 7354 | + el, | ||
| 7355 | + dir, | ||
| 7356 | + _warn | ||
| 7357 | + ) { | ||
| 7358 | + warn$1 = _warn; | ||
| 7359 | + var value = dir.value; | ||
| 7360 | + var modifiers = dir.modifiers; | ||
| 7361 | + var tag = el.tag; | ||
| 7362 | + var type = el.attrsMap.type; | ||
| 7363 | + | ||
| 7364 | + { | ||
| 7365 | + // inputs with type="file" are read only and setting the input's | ||
| 7366 | + // value will throw an error. | ||
| 7367 | + if (tag === 'input' && type === 'file') { | ||
| 7368 | + warn$1( | ||
| 7369 | + "<" + (el.tag) + " v-model=\"" + value + "\" type=\"file\">:\n" + | ||
| 7370 | + "File inputs are read only. Use a v-on:change listener instead.", | ||
| 7371 | + el.rawAttrsMap['v-model'] | ||
| 7372 | + ); | ||
| 7373 | + } | ||
| 7374 | + } | ||
| 7375 | + | ||
| 7376 | + if (el.component) { | ||
| 7377 | + genComponentModel(el, value, modifiers); | ||
| 7378 | + // component v-model doesn't need extra runtime | ||
| 7379 | + return false | ||
| 7380 | + } else if (tag === 'select') { | ||
| 7381 | + genSelect(el, value, modifiers); | ||
| 7382 | + } else if (tag === 'input' && type === 'checkbox') { | ||
| 7383 | + genCheckboxModel(el, value, modifiers); | ||
| 7384 | + } else if (tag === 'input' && type === 'radio') { | ||
| 7385 | + genRadioModel(el, value, modifiers); | ||
| 7386 | + } else if (tag === 'input' || tag === 'textarea') { | ||
| 7387 | + genDefaultModel(el, value, modifiers); | ||
| 7388 | + } else if (!config.isReservedTag(tag)) { | ||
| 7389 | + genComponentModel(el, value, modifiers); | ||
| 7390 | + // component v-model doesn't need extra runtime | ||
| 7391 | + return false | ||
| 7392 | + } else { | ||
| 7393 | + warn$1( | ||
| 7394 | + "<" + (el.tag) + " v-model=\"" + value + "\">: " + | ||
| 7395 | + "v-model is not supported on this element type. " + | ||
| 7396 | + 'If you are working with contenteditable, it\'s recommended to ' + | ||
| 7397 | + 'wrap a library dedicated for that purpose inside a custom component.', | ||
| 7398 | + el.rawAttrsMap['v-model'] | ||
| 7399 | + ); | ||
| 7400 | + } | ||
| 7401 | + | ||
| 7402 | + // ensure runtime directive metadata | ||
| 7403 | + return true | ||
| 7404 | + } | ||
| 7405 | + | ||
| 7406 | + function genCheckboxModel ( | ||
| 7407 | + el, | ||
| 7408 | + value, | ||
| 7409 | + modifiers | ||
| 7410 | + ) { | ||
| 7411 | + var number = modifiers && modifiers.number; | ||
| 7412 | + var valueBinding = getBindingAttr(el, 'value') || 'null'; | ||
| 7413 | + var trueValueBinding = getBindingAttr(el, 'true-value') || 'true'; | ||
| 7414 | + var falseValueBinding = getBindingAttr(el, 'false-value') || 'false'; | ||
| 7415 | + addProp(el, 'checked', | ||
| 7416 | + "Array.isArray(" + value + ")" + | ||
| 7417 | + "?_i(" + value + "," + valueBinding + ")>-1" + ( | ||
| 7418 | + trueValueBinding === 'true' | ||
| 7419 | + ? (":(" + value + ")") | ||
| 7420 | + : (":_q(" + value + "," + trueValueBinding + ")") | ||
| 7421 | + ) | ||
| 7422 | + ); | ||
| 7423 | + addHandler(el, 'change', | ||
| 7424 | + "var $$a=" + value + "," + | ||
| 7425 | + '$$el=$event.target,' + | ||
| 7426 | + "$$c=$$el.checked?(" + trueValueBinding + "):(" + falseValueBinding + ");" + | ||
| 7427 | + 'if(Array.isArray($$a)){' + | ||
| 7428 | + "var $$v=" + (number ? '_n(' + valueBinding + ')' : valueBinding) + "," + | ||
| 7429 | + '$$i=_i($$a,$$v);' + | ||
| 7430 | + "if($$el.checked){$$i<0&&(" + (genAssignmentCode(value, '$$a.concat([$$v])')) + ")}" + | ||
| 7431 | + "else{$$i>-1&&(" + (genAssignmentCode(value, '$$a.slice(0,$$i).concat($$a.slice($$i+1))')) + ")}" + | ||
| 7432 | + "}else{" + (genAssignmentCode(value, '$$c')) + "}", | ||
| 7433 | + null, true | ||
| 7434 | + ); | ||
| 7435 | + } | ||
| 7436 | + | ||
| 7437 | + function genRadioModel ( | ||
| 7438 | + el, | ||
| 7439 | + value, | ||
| 7440 | + modifiers | ||
| 7441 | + ) { | ||
| 7442 | + var number = modifiers && modifiers.number; | ||
| 7443 | + var valueBinding = getBindingAttr(el, 'value') || 'null'; | ||
| 7444 | + valueBinding = number ? ("_n(" + valueBinding + ")") : valueBinding; | ||
| 7445 | + addProp(el, 'checked', ("_q(" + value + "," + valueBinding + ")")); | ||
| 7446 | + addHandler(el, 'change', genAssignmentCode(value, valueBinding), null, true); | ||
| 7447 | + } | ||
| 7448 | + | ||
| 7449 | + function genSelect ( | ||
| 7450 | + el, | ||
| 7451 | + value, | ||
| 7452 | + modifiers | ||
| 7453 | + ) { | ||
| 7454 | + var number = modifiers && modifiers.number; | ||
| 7455 | + var selectedVal = "Array.prototype.filter" + | ||
| 7456 | + ".call($event.target.options,function(o){return o.selected})" + | ||
| 7457 | + ".map(function(o){var val = \"_value\" in o ? o._value : o.value;" + | ||
| 7458 | + "return " + (number ? '_n(val)' : 'val') + "})"; | ||
| 7459 | + | ||
| 7460 | + var assignment = '$event.target.multiple ? $$selectedVal : $$selectedVal[0]'; | ||
| 7461 | + var code = "var $$selectedVal = " + selectedVal + ";"; | ||
| 7462 | + code = code + " " + (genAssignmentCode(value, assignment)); | ||
| 7463 | + addHandler(el, 'change', code, null, true); | ||
| 7464 | + } | ||
| 7465 | + | ||
| 7466 | + function genDefaultModel ( | ||
| 7467 | + el, | ||
| 7468 | + value, | ||
| 7469 | + modifiers | ||
| 7470 | + ) { | ||
| 7471 | + var type = el.attrsMap.type; | ||
| 7472 | + | ||
| 7473 | + // warn if v-bind:value conflicts with v-model | ||
| 7474 | + // except for inputs with v-bind:type | ||
| 7475 | + { | ||
| 7476 | + var value$1 = el.attrsMap['v-bind:value'] || el.attrsMap[':value']; | ||
| 7477 | + var typeBinding = el.attrsMap['v-bind:type'] || el.attrsMap[':type']; | ||
| 7478 | + if (value$1 && !typeBinding) { | ||
| 7479 | + var binding = el.attrsMap['v-bind:value'] ? 'v-bind:value' : ':value'; | ||
| 7480 | + warn$1( | ||
| 7481 | + binding + "=\"" + value$1 + "\" conflicts with v-model on the same element " + | ||
| 7482 | + 'because the latter already expands to a value binding internally', | ||
| 7483 | + el.rawAttrsMap[binding] | ||
| 7484 | + ); | ||
| 7485 | + } | ||
| 7486 | + } | ||
| 7487 | + | ||
| 7488 | + var ref = modifiers || {}; | ||
| 7489 | + var lazy = ref.lazy; | ||
| 7490 | + var number = ref.number; | ||
| 7491 | + var trim = ref.trim; | ||
| 7492 | + var needCompositionGuard = !lazy && type !== 'range'; | ||
| 7493 | + var event = lazy | ||
| 7494 | + ? 'change' | ||
| 7495 | + : type === 'range' | ||
| 7496 | + ? RANGE_TOKEN | ||
| 7497 | + : 'input'; | ||
| 7498 | + | ||
| 7499 | + var valueExpression = '$event.target.value'; | ||
| 7500 | + if (trim) { | ||
| 7501 | + valueExpression = "$event.target.value.trim()"; | ||
| 7502 | + } | ||
| 7503 | + if (number) { | ||
| 7504 | + valueExpression = "_n(" + valueExpression + ")"; | ||
| 7505 | + } | ||
| 7506 | + | ||
| 7507 | + var code = genAssignmentCode(value, valueExpression); | ||
| 7508 | + if (needCompositionGuard) { | ||
| 7509 | + code = "if($event.target.composing)return;" + code; | ||
| 7510 | + } | ||
| 7511 | + | ||
| 7512 | + addProp(el, 'value', ("(" + value + ")")); | ||
| 7513 | + addHandler(el, event, code, null, true); | ||
| 7514 | + if (trim || number) { | ||
| 7515 | + addHandler(el, 'blur', '$forceUpdate()'); | ||
| 7516 | + } | ||
| 7517 | + } | ||
| 7518 | + | ||
| 7519 | + /* */ | ||
| 7520 | + | ||
| 7521 | + // normalize v-model event tokens that can only be determined at runtime. | ||
| 7522 | + // it's important to place the event as the first in the array because | ||
| 7523 | + // the whole point is ensuring the v-model callback gets called before | ||
| 7524 | + // user-attached handlers. | ||
| 7525 | + function normalizeEvents (on) { | ||
| 7526 | + /* istanbul ignore if */ | ||
| 7527 | + if (isDef(on[RANGE_TOKEN])) { | ||
| 7528 | + // IE input[type=range] only supports `change` event | ||
| 7529 | + var event = isIE ? 'change' : 'input'; | ||
| 7530 | + on[event] = [].concat(on[RANGE_TOKEN], on[event] || []); | ||
| 7531 | + delete on[RANGE_TOKEN]; | ||
| 7532 | + } | ||
| 7533 | + // This was originally intended to fix #4521 but no longer necessary | ||
| 7534 | + // after 2.5. Keeping it for backwards compat with generated code from < 2.4 | ||
| 7535 | + /* istanbul ignore if */ | ||
| 7536 | + if (isDef(on[CHECKBOX_RADIO_TOKEN])) { | ||
| 7537 | + on.change = [].concat(on[CHECKBOX_RADIO_TOKEN], on.change || []); | ||
| 7538 | + delete on[CHECKBOX_RADIO_TOKEN]; | ||
| 7539 | + } | ||
| 7540 | + } | ||
| 7541 | + | ||
| 7542 | + var target$1; | ||
| 7543 | + | ||
| 7544 | + function createOnceHandler$1 (event, handler, capture) { | ||
| 7545 | + var _target = target$1; // save current target element in closure | ||
| 7546 | + return function onceHandler () { | ||
| 7547 | + var res = handler.apply(null, arguments); | ||
| 7548 | + if (res !== null) { | ||
| 7549 | + remove$2(event, onceHandler, capture, _target); | ||
| 7550 | + } | ||
| 7551 | + } | ||
| 7552 | + } | ||
| 7553 | + | ||
| 7554 | + // #9446: Firefox <= 53 (in particular, ESR 52) has incorrect Event.timeStamp | ||
| 7555 | + // implementation and does not fire microtasks in between event propagation, so | ||
| 7556 | + // safe to exclude. | ||
| 7557 | + var useMicrotaskFix = isUsingMicroTask && !(isFF && Number(isFF[1]) <= 53); | ||
| 7558 | + | ||
| 7559 | + function add$1 ( | ||
| 7560 | + name, | ||
| 7561 | + handler, | ||
| 7562 | + capture, | ||
| 7563 | + passive | ||
| 7564 | + ) { | ||
| 7565 | + // async edge case #6566: inner click event triggers patch, event handler | ||
| 7566 | + // attached to outer element during patch, and triggered again. This | ||
| 7567 | + // happens because browsers fire microtask ticks between event propagation. | ||
| 7568 | + // the solution is simple: we save the timestamp when a handler is attached, | ||
| 7569 | + // and the handler would only fire if the event passed to it was fired | ||
| 7570 | + // AFTER it was attached. | ||
| 7571 | + if (useMicrotaskFix) { | ||
| 7572 | + var attachedTimestamp = currentFlushTimestamp; | ||
| 7573 | + var original = handler; | ||
| 7574 | + handler = original._wrapper = function (e) { | ||
| 7575 | + if ( | ||
| 7576 | + // no bubbling, should always fire. | ||
| 7577 | + // this is just a safety net in case event.timeStamp is unreliable in | ||
| 7578 | + // certain weird environments... | ||
| 7579 | + e.target === e.currentTarget || | ||
| 7580 | + // event is fired after handler attachment | ||
| 7581 | + e.timeStamp >= attachedTimestamp || | ||
| 7582 | + // bail for environments that have buggy event.timeStamp implementations | ||
| 7583 | + // #9462 iOS 9 bug: event.timeStamp is 0 after history.pushState | ||
| 7584 | + // #9681 QtWebEngine event.timeStamp is negative value | ||
| 7585 | + e.timeStamp <= 0 || | ||
| 7586 | + // #9448 bail if event is fired in another document in a multi-page | ||
| 7587 | + // electron/nw.js app, since event.timeStamp will be using a different | ||
| 7588 | + // starting reference | ||
| 7589 | + e.target.ownerDocument !== document | ||
| 7590 | + ) { | ||
| 7591 | + return original.apply(this, arguments) | ||
| 7592 | + } | ||
| 7593 | + }; | ||
| 7594 | + } | ||
| 7595 | + target$1.addEventListener( | ||
| 7596 | + name, | ||
| 7597 | + handler, | ||
| 7598 | + supportsPassive | ||
| 7599 | + ? { capture: capture, passive: passive } | ||
| 7600 | + : capture | ||
| 7601 | + ); | ||
| 7602 | + } | ||
| 7603 | + | ||
| 7604 | + function remove$2 ( | ||
| 7605 | + name, | ||
| 7606 | + handler, | ||
| 7607 | + capture, | ||
| 7608 | + _target | ||
| 7609 | + ) { | ||
| 7610 | + (_target || target$1).removeEventListener( | ||
| 7611 | + name, | ||
| 7612 | + handler._wrapper || handler, | ||
| 7613 | + capture | ||
| 7614 | + ); | ||
| 7615 | + } | ||
| 7616 | + | ||
| 7617 | + function updateDOMListeners (oldVnode, vnode) { | ||
| 7618 | + if (isUndef(oldVnode.data.on) && isUndef(vnode.data.on)) { | ||
| 7619 | + return | ||
| 7620 | + } | ||
| 7621 | + var on = vnode.data.on || {}; | ||
| 7622 | + var oldOn = oldVnode.data.on || {}; | ||
| 7623 | + target$1 = vnode.elm; | ||
| 7624 | + normalizeEvents(on); | ||
| 7625 | + updateListeners(on, oldOn, add$1, remove$2, createOnceHandler$1, vnode.context); | ||
| 7626 | + target$1 = undefined; | ||
| 7627 | + } | ||
| 7628 | + | ||
| 7629 | + var events = { | ||
| 7630 | + create: updateDOMListeners, | ||
| 7631 | + update: updateDOMListeners | ||
| 7632 | + }; | ||
| 7633 | + | ||
| 7634 | + /* */ | ||
| 7635 | + | ||
| 7636 | + var svgContainer; | ||
| 7637 | + | ||
| 7638 | + function updateDOMProps (oldVnode, vnode) { | ||
| 7639 | + if (isUndef(oldVnode.data.domProps) && isUndef(vnode.data.domProps)) { | ||
| 7640 | + return | ||
| 7641 | + } | ||
| 7642 | + var key, cur; | ||
| 7643 | + var elm = vnode.elm; | ||
| 7644 | + var oldProps = oldVnode.data.domProps || {}; | ||
| 7645 | + var props = vnode.data.domProps || {}; | ||
| 7646 | + // clone observed objects, as the user probably wants to mutate it | ||
| 7647 | + if (isDef(props.__ob__)) { | ||
| 7648 | + props = vnode.data.domProps = extend({}, props); | ||
| 7649 | + } | ||
| 7650 | + | ||
| 7651 | + for (key in oldProps) { | ||
| 7652 | + if (!(key in props)) { | ||
| 7653 | + elm[key] = ''; | ||
| 7654 | + } | ||
| 7655 | + } | ||
| 7656 | + | ||
| 7657 | + for (key in props) { | ||
| 7658 | + cur = props[key]; | ||
| 7659 | + // ignore children if the node has textContent or innerHTML, | ||
| 7660 | + // as these will throw away existing DOM nodes and cause removal errors | ||
| 7661 | + // on subsequent patches (#3360) | ||
| 7662 | + if (key === 'textContent' || key === 'innerHTML') { | ||
| 7663 | + if (vnode.children) { vnode.children.length = 0; } | ||
| 7664 | + if (cur === oldProps[key]) { continue } | ||
| 7665 | + // #6601 work around Chrome version <= 55 bug where single textNode | ||
| 7666 | + // replaced by innerHTML/textContent retains its parentNode property | ||
| 7667 | + if (elm.childNodes.length === 1) { | ||
| 7668 | + elm.removeChild(elm.childNodes[0]); | ||
| 7669 | + } | ||
| 7670 | + } | ||
| 7671 | + | ||
| 7672 | + if (key === 'value' && elm.tagName !== 'PROGRESS') { | ||
| 7673 | + // store value as _value as well since | ||
| 7674 | + // non-string values will be stringified | ||
| 7675 | + elm._value = cur; | ||
| 7676 | + // avoid resetting cursor position when value is the same | ||
| 7677 | + var strCur = isUndef(cur) ? '' : String(cur); | ||
| 7678 | + if (shouldUpdateValue(elm, strCur)) { | ||
| 7679 | + elm.value = strCur; | ||
| 7680 | + } | ||
| 7681 | + } else if (key === 'innerHTML' && isSVG(elm.tagName) && isUndef(elm.innerHTML)) { | ||
| 7682 | + // IE doesn't support innerHTML for SVG elements | ||
| 7683 | + svgContainer = svgContainer || document.createElement('div'); | ||
| 7684 | + svgContainer.innerHTML = "<svg>" + cur + "</svg>"; | ||
| 7685 | + var svg = svgContainer.firstChild; | ||
| 7686 | + while (elm.firstChild) { | ||
| 7687 | + elm.removeChild(elm.firstChild); | ||
| 7688 | + } | ||
| 7689 | + while (svg.firstChild) { | ||
| 7690 | + elm.appendChild(svg.firstChild); | ||
| 7691 | + } | ||
| 7692 | + } else if ( | ||
| 7693 | + // skip the update if old and new VDOM state is the same. | ||
| 7694 | + // `value` is handled separately because the DOM value may be temporarily | ||
| 7695 | + // out of sync with VDOM state due to focus, composition and modifiers. | ||
| 7696 | + // This #4521 by skipping the unnecessary `checked` update. | ||
| 7697 | + cur !== oldProps[key] | ||
| 7698 | + ) { | ||
| 7699 | + // some property updates can throw | ||
| 7700 | + // e.g. `value` on <progress> w/ non-finite value | ||
| 7701 | + try { | ||
| 7702 | + elm[key] = cur; | ||
| 7703 | + } catch (e) {} | ||
| 7704 | + } | ||
| 7705 | + } | ||
| 7706 | + } | ||
| 7707 | + | ||
| 7708 | + // check platforms/web/util/attrs.js acceptValue | ||
| 7709 | + | ||
| 7710 | + | ||
| 7711 | + function shouldUpdateValue (elm, checkVal) { | ||
| 7712 | + return (!elm.composing && ( | ||
| 7713 | + elm.tagName === 'OPTION' || | ||
| 7714 | + isNotInFocusAndDirty(elm, checkVal) || | ||
| 7715 | + isDirtyWithModifiers(elm, checkVal) | ||
| 7716 | + )) | ||
| 7717 | + } | ||
| 7718 | + | ||
| 7719 | + function isNotInFocusAndDirty (elm, checkVal) { | ||
| 7720 | + // return true when textbox (.number and .trim) loses focus and its value is | ||
| 7721 | + // not equal to the updated value | ||
| 7722 | + var notInFocus = true; | ||
| 7723 | + // #6157 | ||
| 7724 | + // work around IE bug when accessing document.activeElement in an iframe | ||
| 7725 | + try { notInFocus = document.activeElement !== elm; } catch (e) {} | ||
| 7726 | + return notInFocus && elm.value !== checkVal | ||
| 7727 | + } | ||
| 7728 | + | ||
| 7729 | + function isDirtyWithModifiers (elm, newVal) { | ||
| 7730 | + var value = elm.value; | ||
| 7731 | + var modifiers = elm._vModifiers; // injected by v-model runtime | ||
| 7732 | + if (isDef(modifiers)) { | ||
| 7733 | + if (modifiers.number) { | ||
| 7734 | + return toNumber(value) !== toNumber(newVal) | ||
| 7735 | + } | ||
| 7736 | + if (modifiers.trim) { | ||
| 7737 | + return value.trim() !== newVal.trim() | ||
| 7738 | + } | ||
| 7739 | + } | ||
| 7740 | + return value !== newVal | ||
| 7741 | + } | ||
| 7742 | + | ||
| 7743 | + var domProps = { | ||
| 7744 | + create: updateDOMProps, | ||
| 7745 | + update: updateDOMProps | ||
| 7746 | + }; | ||
| 7747 | + | ||
| 7748 | + /* */ | ||
| 7749 | + | ||
| 7750 | + var parseStyleText = cached(function (cssText) { | ||
| 7751 | + var res = {}; | ||
| 7752 | + var listDelimiter = /;(?![^(]*\))/g; | ||
| 7753 | + var propertyDelimiter = /:(.+)/; | ||
| 7754 | + cssText.split(listDelimiter).forEach(function (item) { | ||
| 7755 | + if (item) { | ||
| 7756 | + var tmp = item.split(propertyDelimiter); | ||
| 7757 | + tmp.length > 1 && (res[tmp[0].trim()] = tmp[1].trim()); | ||
| 7758 | + } | ||
| 7759 | + }); | ||
| 7760 | + return res | ||
| 7761 | + }); | ||
| 7762 | + | ||
| 7763 | + // merge static and dynamic style data on the same vnode | ||
| 7764 | + function normalizeStyleData (data) { | ||
| 7765 | + var style = normalizeStyleBinding(data.style); | ||
| 7766 | + // static style is pre-processed into an object during compilation | ||
| 7767 | + // and is always a fresh object, so it's safe to merge into it | ||
| 7768 | + return data.staticStyle | ||
| 7769 | + ? extend(data.staticStyle, style) | ||
| 7770 | + : style | ||
| 7771 | + } | ||
| 7772 | + | ||
| 7773 | + // normalize possible array / string values into Object | ||
| 7774 | + function normalizeStyleBinding (bindingStyle) { | ||
| 7775 | + if (Array.isArray(bindingStyle)) { | ||
| 7776 | + return toObject(bindingStyle) | ||
| 7777 | + } | ||
| 7778 | + if (typeof bindingStyle === 'string') { | ||
| 7779 | + return parseStyleText(bindingStyle) | ||
| 7780 | + } | ||
| 7781 | + return bindingStyle | ||
| 7782 | + } | ||
| 7783 | + | ||
| 7784 | + /** | ||
| 7785 | + * parent component style should be after child's | ||
| 7786 | + * so that parent component's style could override it | ||
| 7787 | + */ | ||
| 7788 | + function getStyle (vnode, checkChild) { | ||
| 7789 | + var res = {}; | ||
| 7790 | + var styleData; | ||
| 7791 | + | ||
| 7792 | + if (checkChild) { | ||
| 7793 | + var childNode = vnode; | ||
| 7794 | + while (childNode.componentInstance) { | ||
| 7795 | + childNode = childNode.componentInstance._vnode; | ||
| 7796 | + if ( | ||
| 7797 | + childNode && childNode.data && | ||
| 7798 | + (styleData = normalizeStyleData(childNode.data)) | ||
| 7799 | + ) { | ||
| 7800 | + extend(res, styleData); | ||
| 7801 | + } | ||
| 7802 | + } | ||
| 7803 | + } | ||
| 7804 | + | ||
| 7805 | + if ((styleData = normalizeStyleData(vnode.data))) { | ||
| 7806 | + extend(res, styleData); | ||
| 7807 | + } | ||
| 7808 | + | ||
| 7809 | + var parentNode = vnode; | ||
| 7810 | + while ((parentNode = parentNode.parent)) { | ||
| 7811 | + if (parentNode.data && (styleData = normalizeStyleData(parentNode.data))) { | ||
| 7812 | + extend(res, styleData); | ||
| 7813 | + } | ||
| 7814 | + } | ||
| 7815 | + return res | ||
| 7816 | + } | ||
| 7817 | + | ||
| 7818 | + /* */ | ||
| 7819 | + | ||
| 7820 | + var cssVarRE = /^--/; | ||
| 7821 | + var importantRE = /\s*!important$/; | ||
| 7822 | + var setProp = function (el, name, val) { | ||
| 7823 | + /* istanbul ignore if */ | ||
| 7824 | + if (cssVarRE.test(name)) { | ||
| 7825 | + el.style.setProperty(name, val); | ||
| 7826 | + } else if (importantRE.test(val)) { | ||
| 7827 | + el.style.setProperty(hyphenate(name), val.replace(importantRE, ''), 'important'); | ||
| 7828 | + } else { | ||
| 7829 | + var normalizedName = normalize(name); | ||
| 7830 | + if (Array.isArray(val)) { | ||
| 7831 | + // Support values array created by autoprefixer, e.g. | ||
| 7832 | + // {display: ["-webkit-box", "-ms-flexbox", "flex"]} | ||
| 7833 | + // Set them one by one, and the browser will only set those it can recognize | ||
| 7834 | + for (var i = 0, len = val.length; i < len; i++) { | ||
| 7835 | + el.style[normalizedName] = val[i]; | ||
| 7836 | + } | ||
| 7837 | + } else { | ||
| 7838 | + el.style[normalizedName] = val; | ||
| 7839 | + } | ||
| 7840 | + } | ||
| 7841 | + }; | ||
| 7842 | + | ||
| 7843 | + var vendorNames = ['Webkit', 'Moz', 'ms']; | ||
| 7844 | + | ||
| 7845 | + var emptyStyle; | ||
| 7846 | + var normalize = cached(function (prop) { | ||
| 7847 | + emptyStyle = emptyStyle || document.createElement('div').style; | ||
| 7848 | + prop = camelize(prop); | ||
| 7849 | + if (prop !== 'filter' && (prop in emptyStyle)) { | ||
| 7850 | + return prop | ||
| 7851 | + } | ||
| 7852 | + var capName = prop.charAt(0).toUpperCase() + prop.slice(1); | ||
| 7853 | + for (var i = 0; i < vendorNames.length; i++) { | ||
| 7854 | + var name = vendorNames[i] + capName; | ||
| 7855 | + if (name in emptyStyle) { | ||
| 7856 | + return name | ||
| 7857 | + } | ||
| 7858 | + } | ||
| 7859 | + }); | ||
| 7860 | + | ||
| 7861 | + function updateStyle (oldVnode, vnode) { | ||
| 7862 | + var data = vnode.data; | ||
| 7863 | + var oldData = oldVnode.data; | ||
| 7864 | + | ||
| 7865 | + if (isUndef(data.staticStyle) && isUndef(data.style) && | ||
| 7866 | + isUndef(oldData.staticStyle) && isUndef(oldData.style) | ||
| 7867 | + ) { | ||
| 7868 | + return | ||
| 7869 | + } | ||
| 7870 | + | ||
| 7871 | + var cur, name; | ||
| 7872 | + var el = vnode.elm; | ||
| 7873 | + var oldStaticStyle = oldData.staticStyle; | ||
| 7874 | + var oldStyleBinding = oldData.normalizedStyle || oldData.style || {}; | ||
| 7875 | + | ||
| 7876 | + // if static style exists, stylebinding already merged into it when doing normalizeStyleData | ||
| 7877 | + var oldStyle = oldStaticStyle || oldStyleBinding; | ||
| 7878 | + | ||
| 7879 | + var style = normalizeStyleBinding(vnode.data.style) || {}; | ||
| 7880 | + | ||
| 7881 | + // store normalized style under a different key for next diff | ||
| 7882 | + // make sure to clone it if it's reactive, since the user likely wants | ||
| 7883 | + // to mutate it. | ||
| 7884 | + vnode.data.normalizedStyle = isDef(style.__ob__) | ||
| 7885 | + ? extend({}, style) | ||
| 7886 | + : style; | ||
| 7887 | + | ||
| 7888 | + var newStyle = getStyle(vnode, true); | ||
| 7889 | + | ||
| 7890 | + for (name in oldStyle) { | ||
| 7891 | + if (isUndef(newStyle[name])) { | ||
| 7892 | + setProp(el, name, ''); | ||
| 7893 | + } | ||
| 7894 | + } | ||
| 7895 | + for (name in newStyle) { | ||
| 7896 | + cur = newStyle[name]; | ||
| 7897 | + if (cur !== oldStyle[name]) { | ||
| 7898 | + // ie9 setting to null has no effect, must use empty string | ||
| 7899 | + setProp(el, name, cur == null ? '' : cur); | ||
| 7900 | + } | ||
| 7901 | + } | ||
| 7902 | + } | ||
| 7903 | + | ||
| 7904 | + var style = { | ||
| 7905 | + create: updateStyle, | ||
| 7906 | + update: updateStyle | ||
| 7907 | + }; | ||
| 7908 | + | ||
| 7909 | + /* */ | ||
| 7910 | + | ||
| 7911 | + var whitespaceRE = /\s+/; | ||
| 7912 | + | ||
| 7913 | + /** | ||
| 7914 | + * Add class with compatibility for SVG since classList is not supported on | ||
| 7915 | + * SVG elements in IE | ||
| 7916 | + */ | ||
| 7917 | + function addClass (el, cls) { | ||
| 7918 | + /* istanbul ignore if */ | ||
| 7919 | + if (!cls || !(cls = cls.trim())) { | ||
| 7920 | + return | ||
| 7921 | + } | ||
| 7922 | + | ||
| 7923 | + /* istanbul ignore else */ | ||
| 7924 | + if (el.classList) { | ||
| 7925 | + if (cls.indexOf(' ') > -1) { | ||
| 7926 | + cls.split(whitespaceRE).forEach(function (c) { return el.classList.add(c); }); | ||
| 7927 | + } else { | ||
| 7928 | + el.classList.add(cls); | ||
| 7929 | + } | ||
| 7930 | + } else { | ||
| 7931 | + var cur = " " + (el.getAttribute('class') || '') + " "; | ||
| 7932 | + if (cur.indexOf(' ' + cls + ' ') < 0) { | ||
| 7933 | + el.setAttribute('class', (cur + cls).trim()); | ||
| 7934 | + } | ||
| 7935 | + } | ||
| 7936 | + } | ||
| 7937 | + | ||
| 7938 | + /** | ||
| 7939 | + * Remove class with compatibility for SVG since classList is not supported on | ||
| 7940 | + * SVG elements in IE | ||
| 7941 | + */ | ||
| 7942 | + function removeClass (el, cls) { | ||
| 7943 | + /* istanbul ignore if */ | ||
| 7944 | + if (!cls || !(cls = cls.trim())) { | ||
| 7945 | + return | ||
| 7946 | + } | ||
| 7947 | + | ||
| 7948 | + /* istanbul ignore else */ | ||
| 7949 | + if (el.classList) { | ||
| 7950 | + if (cls.indexOf(' ') > -1) { | ||
| 7951 | + cls.split(whitespaceRE).forEach(function (c) { return el.classList.remove(c); }); | ||
| 7952 | + } else { | ||
| 7953 | + el.classList.remove(cls); | ||
| 7954 | + } | ||
| 7955 | + if (!el.classList.length) { | ||
| 7956 | + el.removeAttribute('class'); | ||
| 7957 | + } | ||
| 7958 | + } else { | ||
| 7959 | + var cur = " " + (el.getAttribute('class') || '') + " "; | ||
| 7960 | + var tar = ' ' + cls + ' '; | ||
| 7961 | + while (cur.indexOf(tar) >= 0) { | ||
| 7962 | + cur = cur.replace(tar, ' '); | ||
| 7963 | + } | ||
| 7964 | + cur = cur.trim(); | ||
| 7965 | + if (cur) { | ||
| 7966 | + el.setAttribute('class', cur); | ||
| 7967 | + } else { | ||
| 7968 | + el.removeAttribute('class'); | ||
| 7969 | + } | ||
| 7970 | + } | ||
| 7971 | + } | ||
| 7972 | + | ||
| 7973 | + /* */ | ||
| 7974 | + | ||
| 7975 | + function resolveTransition (def$$1) { | ||
| 7976 | + if (!def$$1) { | ||
| 7977 | + return | ||
| 7978 | + } | ||
| 7979 | + /* istanbul ignore else */ | ||
| 7980 | + if (typeof def$$1 === 'object') { | ||
| 7981 | + var res = {}; | ||
| 7982 | + if (def$$1.css !== false) { | ||
| 7983 | + extend(res, autoCssTransition(def$$1.name || 'v')); | ||
| 7984 | + } | ||
| 7985 | + extend(res, def$$1); | ||
| 7986 | + return res | ||
| 7987 | + } else if (typeof def$$1 === 'string') { | ||
| 7988 | + return autoCssTransition(def$$1) | ||
| 7989 | + } | ||
| 7990 | + } | ||
| 7991 | + | ||
| 7992 | + var autoCssTransition = cached(function (name) { | ||
| 7993 | + return { | ||
| 7994 | + enterClass: (name + "-enter"), | ||
| 7995 | + enterToClass: (name + "-enter-to"), | ||
| 7996 | + enterActiveClass: (name + "-enter-active"), | ||
| 7997 | + leaveClass: (name + "-leave"), | ||
| 7998 | + leaveToClass: (name + "-leave-to"), | ||
| 7999 | + leaveActiveClass: (name + "-leave-active") | ||
| 8000 | + } | ||
| 8001 | + }); | ||
| 8002 | + | ||
| 8003 | + var hasTransition = inBrowser && !isIE9; | ||
| 8004 | + var TRANSITION = 'transition'; | ||
| 8005 | + var ANIMATION = 'animation'; | ||
| 8006 | + | ||
| 8007 | + // Transition property/event sniffing | ||
| 8008 | + var transitionProp = 'transition'; | ||
| 8009 | + var transitionEndEvent = 'transitionend'; | ||
| 8010 | + var animationProp = 'animation'; | ||
| 8011 | + var animationEndEvent = 'animationend'; | ||
| 8012 | + if (hasTransition) { | ||
| 8013 | + /* istanbul ignore if */ | ||
| 8014 | + if (window.ontransitionend === undefined && | ||
| 8015 | + window.onwebkittransitionend !== undefined | ||
| 8016 | + ) { | ||
| 8017 | + transitionProp = 'WebkitTransition'; | ||
| 8018 | + transitionEndEvent = 'webkitTransitionEnd'; | ||
| 8019 | + } | ||
| 8020 | + if (window.onanimationend === undefined && | ||
| 8021 | + window.onwebkitanimationend !== undefined | ||
| 8022 | + ) { | ||
| 8023 | + animationProp = 'WebkitAnimation'; | ||
| 8024 | + animationEndEvent = 'webkitAnimationEnd'; | ||
| 8025 | + } | ||
| 8026 | + } | ||
| 8027 | + | ||
| 8028 | + // binding to window is necessary to make hot reload work in IE in strict mode | ||
| 8029 | + var raf = inBrowser | ||
| 8030 | + ? window.requestAnimationFrame | ||
| 8031 | + ? window.requestAnimationFrame.bind(window) | ||
| 8032 | + : setTimeout | ||
| 8033 | + : /* istanbul ignore next */ function (fn) { return fn(); }; | ||
| 8034 | + | ||
| 8035 | + function nextFrame (fn) { | ||
| 8036 | + raf(function () { | ||
| 8037 | + raf(fn); | ||
| 8038 | + }); | ||
| 8039 | + } | ||
| 8040 | + | ||
| 8041 | + function addTransitionClass (el, cls) { | ||
| 8042 | + var transitionClasses = el._transitionClasses || (el._transitionClasses = []); | ||
| 8043 | + if (transitionClasses.indexOf(cls) < 0) { | ||
| 8044 | + transitionClasses.push(cls); | ||
| 8045 | + addClass(el, cls); | ||
| 8046 | + } | ||
| 8047 | + } | ||
| 8048 | + | ||
| 8049 | + function removeTransitionClass (el, cls) { | ||
| 8050 | + if (el._transitionClasses) { | ||
| 8051 | + remove(el._transitionClasses, cls); | ||
| 8052 | + } | ||
| 8053 | + removeClass(el, cls); | ||
| 8054 | + } | ||
| 8055 | + | ||
| 8056 | + function whenTransitionEnds ( | ||
| 8057 | + el, | ||
| 8058 | + expectedType, | ||
| 8059 | + cb | ||
| 8060 | + ) { | ||
| 8061 | + var ref = getTransitionInfo(el, expectedType); | ||
| 8062 | + var type = ref.type; | ||
| 8063 | + var timeout = ref.timeout; | ||
| 8064 | + var propCount = ref.propCount; | ||
| 8065 | + if (!type) { return cb() } | ||
| 8066 | + var event = type === TRANSITION ? transitionEndEvent : animationEndEvent; | ||
| 8067 | + var ended = 0; | ||
| 8068 | + var end = function () { | ||
| 8069 | + el.removeEventListener(event, onEnd); | ||
| 8070 | + cb(); | ||
| 8071 | + }; | ||
| 8072 | + var onEnd = function (e) { | ||
| 8073 | + if (e.target === el) { | ||
| 8074 | + if (++ended >= propCount) { | ||
| 8075 | + end(); | ||
| 8076 | + } | ||
| 8077 | + } | ||
| 8078 | + }; | ||
| 8079 | + setTimeout(function () { | ||
| 8080 | + if (ended < propCount) { | ||
| 8081 | + end(); | ||
| 8082 | + } | ||
| 8083 | + }, timeout + 1); | ||
| 8084 | + el.addEventListener(event, onEnd); | ||
| 8085 | + } | ||
| 8086 | + | ||
| 8087 | + var transformRE = /\b(transform|all)(,|$)/; | ||
| 8088 | + | ||
| 8089 | + function getTransitionInfo (el, expectedType) { | ||
| 8090 | + var styles = window.getComputedStyle(el); | ||
| 8091 | + // JSDOM may return undefined for transition properties | ||
| 8092 | + var transitionDelays = (styles[transitionProp + 'Delay'] || '').split(', '); | ||
| 8093 | + var transitionDurations = (styles[transitionProp + 'Duration'] || '').split(', '); | ||
| 8094 | + var transitionTimeout = getTimeout(transitionDelays, transitionDurations); | ||
| 8095 | + var animationDelays = (styles[animationProp + 'Delay'] || '').split(', '); | ||
| 8096 | + var animationDurations = (styles[animationProp + 'Duration'] || '').split(', '); | ||
| 8097 | + var animationTimeout = getTimeout(animationDelays, animationDurations); | ||
| 8098 | + | ||
| 8099 | + var type; | ||
| 8100 | + var timeout = 0; | ||
| 8101 | + var propCount = 0; | ||
| 8102 | + /* istanbul ignore if */ | ||
| 8103 | + if (expectedType === TRANSITION) { | ||
| 8104 | + if (transitionTimeout > 0) { | ||
| 8105 | + type = TRANSITION; | ||
| 8106 | + timeout = transitionTimeout; | ||
| 8107 | + propCount = transitionDurations.length; | ||
| 8108 | + } | ||
| 8109 | + } else if (expectedType === ANIMATION) { | ||
| 8110 | + if (animationTimeout > 0) { | ||
| 8111 | + type = ANIMATION; | ||
| 8112 | + timeout = animationTimeout; | ||
| 8113 | + propCount = animationDurations.length; | ||
| 8114 | + } | ||
| 8115 | + } else { | ||
| 8116 | + timeout = Math.max(transitionTimeout, animationTimeout); | ||
| 8117 | + type = timeout > 0 | ||
| 8118 | + ? transitionTimeout > animationTimeout | ||
| 8119 | + ? TRANSITION | ||
| 8120 | + : ANIMATION | ||
| 8121 | + : null; | ||
| 8122 | + propCount = type | ||
| 8123 | + ? type === TRANSITION | ||
| 8124 | + ? transitionDurations.length | ||
| 8125 | + : animationDurations.length | ||
| 8126 | + : 0; | ||
| 8127 | + } | ||
| 8128 | + var hasTransform = | ||
| 8129 | + type === TRANSITION && | ||
| 8130 | + transformRE.test(styles[transitionProp + 'Property']); | ||
| 8131 | + return { | ||
| 8132 | + type: type, | ||
| 8133 | + timeout: timeout, | ||
| 8134 | + propCount: propCount, | ||
| 8135 | + hasTransform: hasTransform | ||
| 8136 | + } | ||
| 8137 | + } | ||
| 8138 | + | ||
| 8139 | + function getTimeout (delays, durations) { | ||
| 8140 | + /* istanbul ignore next */ | ||
| 8141 | + while (delays.length < durations.length) { | ||
| 8142 | + delays = delays.concat(delays); | ||
| 8143 | + } | ||
| 8144 | + | ||
| 8145 | + return Math.max.apply(null, durations.map(function (d, i) { | ||
| 8146 | + return toMs(d) + toMs(delays[i]) | ||
| 8147 | + })) | ||
| 8148 | + } | ||
| 8149 | + | ||
| 8150 | + // Old versions of Chromium (below 61.0.3163.100) formats floating pointer numbers | ||
| 8151 | + // in a locale-dependent way, using a comma instead of a dot. | ||
| 8152 | + // If comma is not replaced with a dot, the input will be rounded down (i.e. acting | ||
| 8153 | + // as a floor function) causing unexpected behaviors | ||
| 8154 | + function toMs (s) { | ||
| 8155 | + return Number(s.slice(0, -1).replace(',', '.')) * 1000 | ||
| 8156 | + } | ||
| 8157 | + | ||
| 8158 | + /* */ | ||
| 8159 | + | ||
| 8160 | + function enter (vnode, toggleDisplay) { | ||
| 8161 | + var el = vnode.elm; | ||
| 8162 | + | ||
| 8163 | + // call leave callback now | ||
| 8164 | + if (isDef(el._leaveCb)) { | ||
| 8165 | + el._leaveCb.cancelled = true; | ||
| 8166 | + el._leaveCb(); | ||
| 8167 | + } | ||
| 8168 | + | ||
| 8169 | + var data = resolveTransition(vnode.data.transition); | ||
| 8170 | + if (isUndef(data)) { | ||
| 8171 | + return | ||
| 8172 | + } | ||
| 8173 | + | ||
| 8174 | + /* istanbul ignore if */ | ||
| 8175 | + if (isDef(el._enterCb) || el.nodeType !== 1) { | ||
| 8176 | + return | ||
| 8177 | + } | ||
| 8178 | + | ||
| 8179 | + var css = data.css; | ||
| 8180 | + var type = data.type; | ||
| 8181 | + var enterClass = data.enterClass; | ||
| 8182 | + var enterToClass = data.enterToClass; | ||
| 8183 | + var enterActiveClass = data.enterActiveClass; | ||
| 8184 | + var appearClass = data.appearClass; | ||
| 8185 | + var appearToClass = data.appearToClass; | ||
| 8186 | + var appearActiveClass = data.appearActiveClass; | ||
| 8187 | + var beforeEnter = data.beforeEnter; | ||
| 8188 | + var enter = data.enter; | ||
| 8189 | + var afterEnter = data.afterEnter; | ||
| 8190 | + var enterCancelled = data.enterCancelled; | ||
| 8191 | + var beforeAppear = data.beforeAppear; | ||
| 8192 | + var appear = data.appear; | ||
| 8193 | + var afterAppear = data.afterAppear; | ||
| 8194 | + var appearCancelled = data.appearCancelled; | ||
| 8195 | + var duration = data.duration; | ||
| 8196 | + | ||
| 8197 | + // activeInstance will always be the <transition> component managing this | ||
| 8198 | + // transition. One edge case to check is when the <transition> is placed | ||
| 8199 | + // as the root node of a child component. In that case we need to check | ||
| 8200 | + // <transition>'s parent for appear check. | ||
| 8201 | + var context = activeInstance; | ||
| 8202 | + var transitionNode = activeInstance.$vnode; | ||
| 8203 | + while (transitionNode && transitionNode.parent) { | ||
| 8204 | + context = transitionNode.context; | ||
| 8205 | + transitionNode = transitionNode.parent; | ||
| 8206 | + } | ||
| 8207 | + | ||
| 8208 | + var isAppear = !context._isMounted || !vnode.isRootInsert; | ||
| 8209 | + | ||
| 8210 | + if (isAppear && !appear && appear !== '') { | ||
| 8211 | + return | ||
| 8212 | + } | ||
| 8213 | + | ||
| 8214 | + var startClass = isAppear && appearClass | ||
| 8215 | + ? appearClass | ||
| 8216 | + : enterClass; | ||
| 8217 | + var activeClass = isAppear && appearActiveClass | ||
| 8218 | + ? appearActiveClass | ||
| 8219 | + : enterActiveClass; | ||
| 8220 | + var toClass = isAppear && appearToClass | ||
| 8221 | + ? appearToClass | ||
| 8222 | + : enterToClass; | ||
| 8223 | + | ||
| 8224 | + var beforeEnterHook = isAppear | ||
| 8225 | + ? (beforeAppear || beforeEnter) | ||
| 8226 | + : beforeEnter; | ||
| 8227 | + var enterHook = isAppear | ||
| 8228 | + ? (typeof appear === 'function' ? appear : enter) | ||
| 8229 | + : enter; | ||
| 8230 | + var afterEnterHook = isAppear | ||
| 8231 | + ? (afterAppear || afterEnter) | ||
| 8232 | + : afterEnter; | ||
| 8233 | + var enterCancelledHook = isAppear | ||
| 8234 | + ? (appearCancelled || enterCancelled) | ||
| 8235 | + : enterCancelled; | ||
| 8236 | + | ||
| 8237 | + var explicitEnterDuration = toNumber( | ||
| 8238 | + isObject(duration) | ||
| 8239 | + ? duration.enter | ||
| 8240 | + : duration | ||
| 8241 | + ); | ||
| 8242 | + | ||
| 8243 | + if (explicitEnterDuration != null) { | ||
| 8244 | + checkDuration(explicitEnterDuration, 'enter', vnode); | ||
| 8245 | + } | ||
| 8246 | + | ||
| 8247 | + var expectsCSS = css !== false && !isIE9; | ||
| 8248 | + var userWantsControl = getHookArgumentsLength(enterHook); | ||
| 8249 | + | ||
| 8250 | + var cb = el._enterCb = once(function () { | ||
| 8251 | + if (expectsCSS) { | ||
| 8252 | + removeTransitionClass(el, toClass); | ||
| 8253 | + removeTransitionClass(el, activeClass); | ||
| 8254 | + } | ||
| 8255 | + if (cb.cancelled) { | ||
| 8256 | + if (expectsCSS) { | ||
| 8257 | + removeTransitionClass(el, startClass); | ||
| 8258 | + } | ||
| 8259 | + enterCancelledHook && enterCancelledHook(el); | ||
| 8260 | + } else { | ||
| 8261 | + afterEnterHook && afterEnterHook(el); | ||
| 8262 | + } | ||
| 8263 | + el._enterCb = null; | ||
| 8264 | + }); | ||
| 8265 | + | ||
| 8266 | + if (!vnode.data.show) { | ||
| 8267 | + // remove pending leave element on enter by injecting an insert hook | ||
| 8268 | + mergeVNodeHook(vnode, 'insert', function () { | ||
| 8269 | + var parent = el.parentNode; | ||
| 8270 | + var pendingNode = parent && parent._pending && parent._pending[vnode.key]; | ||
| 8271 | + if (pendingNode && | ||
| 8272 | + pendingNode.tag === vnode.tag && | ||
| 8273 | + pendingNode.elm._leaveCb | ||
| 8274 | + ) { | ||
| 8275 | + pendingNode.elm._leaveCb(); | ||
| 8276 | + } | ||
| 8277 | + enterHook && enterHook(el, cb); | ||
| 8278 | + }); | ||
| 8279 | + } | ||
| 8280 | + | ||
| 8281 | + // start enter transition | ||
| 8282 | + beforeEnterHook && beforeEnterHook(el); | ||
| 8283 | + if (expectsCSS) { | ||
| 8284 | + addTransitionClass(el, startClass); | ||
| 8285 | + addTransitionClass(el, activeClass); | ||
| 8286 | + nextFrame(function () { | ||
| 8287 | + removeTransitionClass(el, startClass); | ||
| 8288 | + if (!cb.cancelled) { | ||
| 8289 | + addTransitionClass(el, toClass); | ||
| 8290 | + if (!userWantsControl) { | ||
| 8291 | + if (isValidDuration(explicitEnterDuration)) { | ||
| 8292 | + setTimeout(cb, explicitEnterDuration); | ||
| 8293 | + } else { | ||
| 8294 | + whenTransitionEnds(el, type, cb); | ||
| 8295 | + } | ||
| 8296 | + } | ||
| 8297 | + } | ||
| 8298 | + }); | ||
| 8299 | + } | ||
| 8300 | + | ||
| 8301 | + if (vnode.data.show) { | ||
| 8302 | + toggleDisplay && toggleDisplay(); | ||
| 8303 | + enterHook && enterHook(el, cb); | ||
| 8304 | + } | ||
| 8305 | + | ||
| 8306 | + if (!expectsCSS && !userWantsControl) { | ||
| 8307 | + cb(); | ||
| 8308 | + } | ||
| 8309 | + } | ||
| 8310 | + | ||
| 8311 | + function leave (vnode, rm) { | ||
| 8312 | + var el = vnode.elm; | ||
| 8313 | + | ||
| 8314 | + // call enter callback now | ||
| 8315 | + if (isDef(el._enterCb)) { | ||
| 8316 | + el._enterCb.cancelled = true; | ||
| 8317 | + el._enterCb(); | ||
| 8318 | + } | ||
| 8319 | + | ||
| 8320 | + var data = resolveTransition(vnode.data.transition); | ||
| 8321 | + if (isUndef(data) || el.nodeType !== 1) { | ||
| 8322 | + return rm() | ||
| 8323 | + } | ||
| 8324 | + | ||
| 8325 | + /* istanbul ignore if */ | ||
| 8326 | + if (isDef(el._leaveCb)) { | ||
| 8327 | + return | ||
| 8328 | + } | ||
| 8329 | + | ||
| 8330 | + var css = data.css; | ||
| 8331 | + var type = data.type; | ||
| 8332 | + var leaveClass = data.leaveClass; | ||
| 8333 | + var leaveToClass = data.leaveToClass; | ||
| 8334 | + var leaveActiveClass = data.leaveActiveClass; | ||
| 8335 | + var beforeLeave = data.beforeLeave; | ||
| 8336 | + var leave = data.leave; | ||
| 8337 | + var afterLeave = data.afterLeave; | ||
| 8338 | + var leaveCancelled = data.leaveCancelled; | ||
| 8339 | + var delayLeave = data.delayLeave; | ||
| 8340 | + var duration = data.duration; | ||
| 8341 | + | ||
| 8342 | + var expectsCSS = css !== false && !isIE9; | ||
| 8343 | + var userWantsControl = getHookArgumentsLength(leave); | ||
| 8344 | + | ||
| 8345 | + var explicitLeaveDuration = toNumber( | ||
| 8346 | + isObject(duration) | ||
| 8347 | + ? duration.leave | ||
| 8348 | + : duration | ||
| 8349 | + ); | ||
| 8350 | + | ||
| 8351 | + if (isDef(explicitLeaveDuration)) { | ||
| 8352 | + checkDuration(explicitLeaveDuration, 'leave', vnode); | ||
| 8353 | + } | ||
| 8354 | + | ||
| 8355 | + var cb = el._leaveCb = once(function () { | ||
| 8356 | + if (el.parentNode && el.parentNode._pending) { | ||
| 8357 | + el.parentNode._pending[vnode.key] = null; | ||
| 8358 | + } | ||
| 8359 | + if (expectsCSS) { | ||
| 8360 | + removeTransitionClass(el, leaveToClass); | ||
| 8361 | + removeTransitionClass(el, leaveActiveClass); | ||
| 8362 | + } | ||
| 8363 | + if (cb.cancelled) { | ||
| 8364 | + if (expectsCSS) { | ||
| 8365 | + removeTransitionClass(el, leaveClass); | ||
| 8366 | + } | ||
| 8367 | + leaveCancelled && leaveCancelled(el); | ||
| 8368 | + } else { | ||
| 8369 | + rm(); | ||
| 8370 | + afterLeave && afterLeave(el); | ||
| 8371 | + } | ||
| 8372 | + el._leaveCb = null; | ||
| 8373 | + }); | ||
| 8374 | + | ||
| 8375 | + if (delayLeave) { | ||
| 8376 | + delayLeave(performLeave); | ||
| 8377 | + } else { | ||
| 8378 | + performLeave(); | ||
| 8379 | + } | ||
| 8380 | + | ||
| 8381 | + function performLeave () { | ||
| 8382 | + // the delayed leave may have already been cancelled | ||
| 8383 | + if (cb.cancelled) { | ||
| 8384 | + return | ||
| 8385 | + } | ||
| 8386 | + // record leaving element | ||
| 8387 | + if (!vnode.data.show && el.parentNode) { | ||
| 8388 | + (el.parentNode._pending || (el.parentNode._pending = {}))[(vnode.key)] = vnode; | ||
| 8389 | + } | ||
| 8390 | + beforeLeave && beforeLeave(el); | ||
| 8391 | + if (expectsCSS) { | ||
| 8392 | + addTransitionClass(el, leaveClass); | ||
| 8393 | + addTransitionClass(el, leaveActiveClass); | ||
| 8394 | + nextFrame(function () { | ||
| 8395 | + removeTransitionClass(el, leaveClass); | ||
| 8396 | + if (!cb.cancelled) { | ||
| 8397 | + addTransitionClass(el, leaveToClass); | ||
| 8398 | + if (!userWantsControl) { | ||
| 8399 | + if (isValidDuration(explicitLeaveDuration)) { | ||
| 8400 | + setTimeout(cb, explicitLeaveDuration); | ||
| 8401 | + } else { | ||
| 8402 | + whenTransitionEnds(el, type, cb); | ||
| 8403 | + } | ||
| 8404 | + } | ||
| 8405 | + } | ||
| 8406 | + }); | ||
| 8407 | + } | ||
| 8408 | + leave && leave(el, cb); | ||
| 8409 | + if (!expectsCSS && !userWantsControl) { | ||
| 8410 | + cb(); | ||
| 8411 | + } | ||
| 8412 | + } | ||
| 8413 | + } | ||
| 8414 | + | ||
| 8415 | + // only used in dev mode | ||
| 8416 | + function checkDuration (val, name, vnode) { | ||
| 8417 | + if (typeof val !== 'number') { | ||
| 8418 | + warn( | ||
| 8419 | + "<transition> explicit " + name + " duration is not a valid number - " + | ||
| 8420 | + "got " + (JSON.stringify(val)) + ".", | ||
| 8421 | + vnode.context | ||
| 8422 | + ); | ||
| 8423 | + } else if (isNaN(val)) { | ||
| 8424 | + warn( | ||
| 8425 | + "<transition> explicit " + name + " duration is NaN - " + | ||
| 8426 | + 'the duration expression might be incorrect.', | ||
| 8427 | + vnode.context | ||
| 8428 | + ); | ||
| 8429 | + } | ||
| 8430 | + } | ||
| 8431 | + | ||
| 8432 | + function isValidDuration (val) { | ||
| 8433 | + return typeof val === 'number' && !isNaN(val) | ||
| 8434 | + } | ||
| 8435 | + | ||
| 8436 | + /** | ||
| 8437 | + * Normalize a transition hook's argument length. The hook may be: | ||
| 8438 | + * - a merged hook (invoker) with the original in .fns | ||
| 8439 | + * - a wrapped component method (check ._length) | ||
| 8440 | + * - a plain function (.length) | ||
| 8441 | + */ | ||
| 8442 | + function getHookArgumentsLength (fn) { | ||
| 8443 | + if (isUndef(fn)) { | ||
| 8444 | + return false | ||
| 8445 | + } | ||
| 8446 | + var invokerFns = fn.fns; | ||
| 8447 | + if (isDef(invokerFns)) { | ||
| 8448 | + // invoker | ||
| 8449 | + return getHookArgumentsLength( | ||
| 8450 | + Array.isArray(invokerFns) | ||
| 8451 | + ? invokerFns[0] | ||
| 8452 | + : invokerFns | ||
| 8453 | + ) | ||
| 8454 | + } else { | ||
| 8455 | + return (fn._length || fn.length) > 1 | ||
| 8456 | + } | ||
| 8457 | + } | ||
| 8458 | + | ||
| 8459 | + function _enter (_, vnode) { | ||
| 8460 | + if (vnode.data.show !== true) { | ||
| 8461 | + enter(vnode); | ||
| 8462 | + } | ||
| 8463 | + } | ||
| 8464 | + | ||
| 8465 | + var transition = inBrowser ? { | ||
| 8466 | + create: _enter, | ||
| 8467 | + activate: _enter, | ||
| 8468 | + remove: function remove$$1 (vnode, rm) { | ||
| 8469 | + /* istanbul ignore else */ | ||
| 8470 | + if (vnode.data.show !== true) { | ||
| 8471 | + leave(vnode, rm); | ||
| 8472 | + } else { | ||
| 8473 | + rm(); | ||
| 8474 | + } | ||
| 8475 | + } | ||
| 8476 | + } : {}; | ||
| 8477 | + | ||
| 8478 | + var platformModules = [ | ||
| 8479 | + attrs, | ||
| 8480 | + klass, | ||
| 8481 | + events, | ||
| 8482 | + domProps, | ||
| 8483 | + style, | ||
| 8484 | + transition | ||
| 8485 | + ]; | ||
| 8486 | + | ||
| 8487 | + /* */ | ||
| 8488 | + | ||
| 8489 | + // the directive module should be applied last, after all | ||
| 8490 | + // built-in modules have been applied. | ||
| 8491 | + var modules = platformModules.concat(baseModules); | ||
| 8492 | + | ||
| 8493 | + var patch = createPatchFunction({ nodeOps: nodeOps, modules: modules }); | ||
| 8494 | + | ||
| 8495 | + /** | ||
| 8496 | + * Not type checking this file because flow doesn't like attaching | ||
| 8497 | + * properties to Elements. | ||
| 8498 | + */ | ||
| 8499 | + | ||
| 8500 | + /* istanbul ignore if */ | ||
| 8501 | + if (isIE9) { | ||
| 8502 | + // http://www.matts411.com/post/internet-explorer-9-oninput/ | ||
| 8503 | + document.addEventListener('selectionchange', function () { | ||
| 8504 | + var el = document.activeElement; | ||
| 8505 | + if (el && el.vmodel) { | ||
| 8506 | + trigger(el, 'input'); | ||
| 8507 | + } | ||
| 8508 | + }); | ||
| 8509 | + } | ||
| 8510 | + | ||
| 8511 | + var directive = { | ||
| 8512 | + inserted: function inserted (el, binding, vnode, oldVnode) { | ||
| 8513 | + if (vnode.tag === 'select') { | ||
| 8514 | + // #6903 | ||
| 8515 | + if (oldVnode.elm && !oldVnode.elm._vOptions) { | ||
| 8516 | + mergeVNodeHook(vnode, 'postpatch', function () { | ||
| 8517 | + directive.componentUpdated(el, binding, vnode); | ||
| 8518 | + }); | ||
| 8519 | + } else { | ||
| 8520 | + setSelected(el, binding, vnode.context); | ||
| 8521 | + } | ||
| 8522 | + el._vOptions = [].map.call(el.options, getValue); | ||
| 8523 | + } else if (vnode.tag === 'textarea' || isTextInputType(el.type)) { | ||
| 8524 | + el._vModifiers = binding.modifiers; | ||
| 8525 | + if (!binding.modifiers.lazy) { | ||
| 8526 | + el.addEventListener('compositionstart', onCompositionStart); | ||
| 8527 | + el.addEventListener('compositionend', onCompositionEnd); | ||
| 8528 | + // Safari < 10.2 & UIWebView doesn't fire compositionend when | ||
| 8529 | + // switching focus before confirming composition choice | ||
| 8530 | + // this also fixes the issue where some browsers e.g. iOS Chrome | ||
| 8531 | + // fires "change" instead of "input" on autocomplete. | ||
| 8532 | + el.addEventListener('change', onCompositionEnd); | ||
| 8533 | + /* istanbul ignore if */ | ||
| 8534 | + if (isIE9) { | ||
| 8535 | + el.vmodel = true; | ||
| 8536 | + } | ||
| 8537 | + } | ||
| 8538 | + } | ||
| 8539 | + }, | ||
| 8540 | + | ||
| 8541 | + componentUpdated: function componentUpdated (el, binding, vnode) { | ||
| 8542 | + if (vnode.tag === 'select') { | ||
| 8543 | + setSelected(el, binding, vnode.context); | ||
| 8544 | + // in case the options rendered by v-for have changed, | ||
| 8545 | + // it's possible that the value is out-of-sync with the rendered options. | ||
| 8546 | + // detect such cases and filter out values that no longer has a matching | ||
| 8547 | + // option in the DOM. | ||
| 8548 | + var prevOptions = el._vOptions; | ||
| 8549 | + var curOptions = el._vOptions = [].map.call(el.options, getValue); | ||
| 8550 | + if (curOptions.some(function (o, i) { return !looseEqual(o, prevOptions[i]); })) { | ||
| 8551 | + // trigger change event if | ||
| 8552 | + // no matching option found for at least one value | ||
| 8553 | + var needReset = el.multiple | ||
| 8554 | + ? binding.value.some(function (v) { return hasNoMatchingOption(v, curOptions); }) | ||
| 8555 | + : binding.value !== binding.oldValue && hasNoMatchingOption(binding.value, curOptions); | ||
| 8556 | + if (needReset) { | ||
| 8557 | + trigger(el, 'change'); | ||
| 8558 | + } | ||
| 8559 | + } | ||
| 8560 | + } | ||
| 8561 | + } | ||
| 8562 | + }; | ||
| 8563 | + | ||
| 8564 | + function setSelected (el, binding, vm) { | ||
| 8565 | + actuallySetSelected(el, binding, vm); | ||
| 8566 | + /* istanbul ignore if */ | ||
| 8567 | + if (isIE || isEdge) { | ||
| 8568 | + setTimeout(function () { | ||
| 8569 | + actuallySetSelected(el, binding, vm); | ||
| 8570 | + }, 0); | ||
| 8571 | + } | ||
| 8572 | + } | ||
| 8573 | + | ||
| 8574 | + function actuallySetSelected (el, binding, vm) { | ||
| 8575 | + var value = binding.value; | ||
| 8576 | + var isMultiple = el.multiple; | ||
| 8577 | + if (isMultiple && !Array.isArray(value)) { | ||
| 8578 | + warn( | ||
| 8579 | + "<select multiple v-model=\"" + (binding.expression) + "\"> " + | ||
| 8580 | + "expects an Array value for its binding, but got " + (Object.prototype.toString.call(value).slice(8, -1)), | ||
| 8581 | + vm | ||
| 8582 | + ); | ||
| 8583 | + return | ||
| 8584 | + } | ||
| 8585 | + var selected, option; | ||
| 8586 | + for (var i = 0, l = el.options.length; i < l; i++) { | ||
| 8587 | + option = el.options[i]; | ||
| 8588 | + if (isMultiple) { | ||
| 8589 | + selected = looseIndexOf(value, getValue(option)) > -1; | ||
| 8590 | + if (option.selected !== selected) { | ||
| 8591 | + option.selected = selected; | ||
| 8592 | + } | ||
| 8593 | + } else { | ||
| 8594 | + if (looseEqual(getValue(option), value)) { | ||
| 8595 | + if (el.selectedIndex !== i) { | ||
| 8596 | + el.selectedIndex = i; | ||
| 8597 | + } | ||
| 8598 | + return | ||
| 8599 | + } | ||
| 8600 | + } | ||
| 8601 | + } | ||
| 8602 | + if (!isMultiple) { | ||
| 8603 | + el.selectedIndex = -1; | ||
| 8604 | + } | ||
| 8605 | + } | ||
| 8606 | + | ||
| 8607 | + function hasNoMatchingOption (value, options) { | ||
| 8608 | + return options.every(function (o) { return !looseEqual(o, value); }) | ||
| 8609 | + } | ||
| 8610 | + | ||
| 8611 | + function getValue (option) { | ||
| 8612 | + return '_value' in option | ||
| 8613 | + ? option._value | ||
| 8614 | + : option.value | ||
| 8615 | + } | ||
| 8616 | + | ||
| 8617 | + function onCompositionStart (e) { | ||
| 8618 | + e.target.composing = true; | ||
| 8619 | + } | ||
| 8620 | + | ||
| 8621 | + function onCompositionEnd (e) { | ||
| 8622 | + // prevent triggering an input event for no reason | ||
| 8623 | + if (!e.target.composing) { return } | ||
| 8624 | + e.target.composing = false; | ||
| 8625 | + trigger(e.target, 'input'); | ||
| 8626 | + } | ||
| 8627 | + | ||
| 8628 | + function trigger (el, type) { | ||
| 8629 | + var e = document.createEvent('HTMLEvents'); | ||
| 8630 | + e.initEvent(type, true, true); | ||
| 8631 | + el.dispatchEvent(e); | ||
| 8632 | + } | ||
| 8633 | + | ||
| 8634 | + /* */ | ||
| 8635 | + | ||
| 8636 | + // recursively search for possible transition defined inside the component root | ||
| 8637 | + function locateNode (vnode) { | ||
| 8638 | + return vnode.componentInstance && (!vnode.data || !vnode.data.transition) | ||
| 8639 | + ? locateNode(vnode.componentInstance._vnode) | ||
| 8640 | + : vnode | ||
| 8641 | + } | ||
| 8642 | + | ||
| 8643 | + var show = { | ||
| 8644 | + bind: function bind (el, ref, vnode) { | ||
| 8645 | + var value = ref.value; | ||
| 8646 | + | ||
| 8647 | + vnode = locateNode(vnode); | ||
| 8648 | + var transition$$1 = vnode.data && vnode.data.transition; | ||
| 8649 | + var originalDisplay = el.__vOriginalDisplay = | ||
| 8650 | + el.style.display === 'none' ? '' : el.style.display; | ||
| 8651 | + if (value && transition$$1) { | ||
| 8652 | + vnode.data.show = true; | ||
| 8653 | + enter(vnode, function () { | ||
| 8654 | + el.style.display = originalDisplay; | ||
| 8655 | + }); | ||
| 8656 | + } else { | ||
| 8657 | + el.style.display = value ? originalDisplay : 'none'; | ||
| 8658 | + } | ||
| 8659 | + }, | ||
| 8660 | + | ||
| 8661 | + update: function update (el, ref, vnode) { | ||
| 8662 | + var value = ref.value; | ||
| 8663 | + var oldValue = ref.oldValue; | ||
| 8664 | + | ||
| 8665 | + /* istanbul ignore if */ | ||
| 8666 | + if (!value === !oldValue) { return } | ||
| 8667 | + vnode = locateNode(vnode); | ||
| 8668 | + var transition$$1 = vnode.data && vnode.data.transition; | ||
| 8669 | + if (transition$$1) { | ||
| 8670 | + vnode.data.show = true; | ||
| 8671 | + if (value) { | ||
| 8672 | + enter(vnode, function () { | ||
| 8673 | + el.style.display = el.__vOriginalDisplay; | ||
| 8674 | + }); | ||
| 8675 | + } else { | ||
| 8676 | + leave(vnode, function () { | ||
| 8677 | + el.style.display = 'none'; | ||
| 8678 | + }); | ||
| 8679 | + } | ||
| 8680 | + } else { | ||
| 8681 | + el.style.display = value ? el.__vOriginalDisplay : 'none'; | ||
| 8682 | + } | ||
| 8683 | + }, | ||
| 8684 | + | ||
| 8685 | + unbind: function unbind ( | ||
| 8686 | + el, | ||
| 8687 | + binding, | ||
| 8688 | + vnode, | ||
| 8689 | + oldVnode, | ||
| 8690 | + isDestroy | ||
| 8691 | + ) { | ||
| 8692 | + if (!isDestroy) { | ||
| 8693 | + el.style.display = el.__vOriginalDisplay; | ||
| 8694 | + } | ||
| 8695 | + } | ||
| 8696 | + }; | ||
| 8697 | + | ||
| 8698 | + var platformDirectives = { | ||
| 8699 | + model: directive, | ||
| 8700 | + show: show | ||
| 8701 | + }; | ||
| 8702 | + | ||
| 8703 | + /* */ | ||
| 8704 | + | ||
| 8705 | + var transitionProps = { | ||
| 8706 | + name: String, | ||
| 8707 | + appear: Boolean, | ||
| 8708 | + css: Boolean, | ||
| 8709 | + mode: String, | ||
| 8710 | + type: String, | ||
| 8711 | + enterClass: String, | ||
| 8712 | + leaveClass: String, | ||
| 8713 | + enterToClass: String, | ||
| 8714 | + leaveToClass: String, | ||
| 8715 | + enterActiveClass: String, | ||
| 8716 | + leaveActiveClass: String, | ||
| 8717 | + appearClass: String, | ||
| 8718 | + appearActiveClass: String, | ||
| 8719 | + appearToClass: String, | ||
| 8720 | + duration: [Number, String, Object] | ||
| 8721 | + }; | ||
| 8722 | + | ||
| 8723 | + // in case the child is also an abstract component, e.g. <keep-alive> | ||
| 8724 | + // we want to recursively retrieve the real component to be rendered | ||
| 8725 | + function getRealChild (vnode) { | ||
| 8726 | + var compOptions = vnode && vnode.componentOptions; | ||
| 8727 | + if (compOptions && compOptions.Ctor.options.abstract) { | ||
| 8728 | + return getRealChild(getFirstComponentChild(compOptions.children)) | ||
| 8729 | + } else { | ||
| 8730 | + return vnode | ||
| 8731 | + } | ||
| 8732 | + } | ||
| 8733 | + | ||
| 8734 | + function extractTransitionData (comp) { | ||
| 8735 | + var data = {}; | ||
| 8736 | + var options = comp.$options; | ||
| 8737 | + // props | ||
| 8738 | + for (var key in options.propsData) { | ||
| 8739 | + data[key] = comp[key]; | ||
| 8740 | + } | ||
| 8741 | + // events. | ||
| 8742 | + // extract listeners and pass them directly to the transition methods | ||
| 8743 | + var listeners = options._parentListeners; | ||
| 8744 | + for (var key$1 in listeners) { | ||
| 8745 | + data[camelize(key$1)] = listeners[key$1]; | ||
| 8746 | + } | ||
| 8747 | + return data | ||
| 8748 | + } | ||
| 8749 | + | ||
| 8750 | + function placeholder (h, rawChild) { | ||
| 8751 | + if (/\d-keep-alive$/.test(rawChild.tag)) { | ||
| 8752 | + return h('keep-alive', { | ||
| 8753 | + props: rawChild.componentOptions.propsData | ||
| 8754 | + }) | ||
| 8755 | + } | ||
| 8756 | + } | ||
| 8757 | + | ||
| 8758 | + function hasParentTransition (vnode) { | ||
| 8759 | + while ((vnode = vnode.parent)) { | ||
| 8760 | + if (vnode.data.transition) { | ||
| 8761 | + return true | ||
| 8762 | + } | ||
| 8763 | + } | ||
| 8764 | + } | ||
| 8765 | + | ||
| 8766 | + function isSameChild (child, oldChild) { | ||
| 8767 | + return oldChild.key === child.key && oldChild.tag === child.tag | ||
| 8768 | + } | ||
| 8769 | + | ||
| 8770 | + var isNotTextNode = function (c) { return c.tag || isAsyncPlaceholder(c); }; | ||
| 8771 | + | ||
| 8772 | + var isVShowDirective = function (d) { return d.name === 'show'; }; | ||
| 8773 | + | ||
| 8774 | + var Transition = { | ||
| 8775 | + name: 'transition', | ||
| 8776 | + props: transitionProps, | ||
| 8777 | + abstract: true, | ||
| 8778 | + | ||
| 8779 | + render: function render (h) { | ||
| 8780 | + var this$1 = this; | ||
| 8781 | + | ||
| 8782 | + var children = this.$slots.default; | ||
| 8783 | + if (!children) { | ||
| 8784 | + return | ||
| 8785 | + } | ||
| 8786 | + | ||
| 8787 | + // filter out text nodes (possible whitespaces) | ||
| 8788 | + children = children.filter(isNotTextNode); | ||
| 8789 | + /* istanbul ignore if */ | ||
| 8790 | + if (!children.length) { | ||
| 8791 | + return | ||
| 8792 | + } | ||
| 8793 | + | ||
| 8794 | + // warn multiple elements | ||
| 8795 | + if (children.length > 1) { | ||
| 8796 | + warn( | ||
| 8797 | + '<transition> can only be used on a single element. Use ' + | ||
| 8798 | + '<transition-group> for lists.', | ||
| 8799 | + this.$parent | ||
| 8800 | + ); | ||
| 8801 | + } | ||
| 8802 | + | ||
| 8803 | + var mode = this.mode; | ||
| 8804 | + | ||
| 8805 | + // warn invalid mode | ||
| 8806 | + if (mode && mode !== 'in-out' && mode !== 'out-in' | ||
| 8807 | + ) { | ||
| 8808 | + warn( | ||
| 8809 | + 'invalid <transition> mode: ' + mode, | ||
| 8810 | + this.$parent | ||
| 8811 | + ); | ||
| 8812 | + } | ||
| 8813 | + | ||
| 8814 | + var rawChild = children[0]; | ||
| 8815 | + | ||
| 8816 | + // if this is a component root node and the component's | ||
| 8817 | + // parent container node also has transition, skip. | ||
| 8818 | + if (hasParentTransition(this.$vnode)) { | ||
| 8819 | + return rawChild | ||
| 8820 | + } | ||
| 8821 | + | ||
| 8822 | + // apply transition data to child | ||
| 8823 | + // use getRealChild() to ignore abstract components e.g. keep-alive | ||
| 8824 | + var child = getRealChild(rawChild); | ||
| 8825 | + /* istanbul ignore if */ | ||
| 8826 | + if (!child) { | ||
| 8827 | + return rawChild | ||
| 8828 | + } | ||
| 8829 | + | ||
| 8830 | + if (this._leaving) { | ||
| 8831 | + return placeholder(h, rawChild) | ||
| 8832 | + } | ||
| 8833 | + | ||
| 8834 | + // ensure a key that is unique to the vnode type and to this transition | ||
| 8835 | + // component instance. This key will be used to remove pending leaving nodes | ||
| 8836 | + // during entering. | ||
| 8837 | + var id = "__transition-" + (this._uid) + "-"; | ||
| 8838 | + child.key = child.key == null | ||
| 8839 | + ? child.isComment | ||
| 8840 | + ? id + 'comment' | ||
| 8841 | + : id + child.tag | ||
| 8842 | + : isPrimitive(child.key) | ||
| 8843 | + ? (String(child.key).indexOf(id) === 0 ? child.key : id + child.key) | ||
| 8844 | + : child.key; | ||
| 8845 | + | ||
| 8846 | + var data = (child.data || (child.data = {})).transition = extractTransitionData(this); | ||
| 8847 | + var oldRawChild = this._vnode; | ||
| 8848 | + var oldChild = getRealChild(oldRawChild); | ||
| 8849 | + | ||
| 8850 | + // mark v-show | ||
| 8851 | + // so that the transition module can hand over the control to the directive | ||
| 8852 | + if (child.data.directives && child.data.directives.some(isVShowDirective)) { | ||
| 8853 | + child.data.show = true; | ||
| 8854 | + } | ||
| 8855 | + | ||
| 8856 | + if ( | ||
| 8857 | + oldChild && | ||
| 8858 | + oldChild.data && | ||
| 8859 | + !isSameChild(child, oldChild) && | ||
| 8860 | + !isAsyncPlaceholder(oldChild) && | ||
| 8861 | + // #6687 component root is a comment node | ||
| 8862 | + !(oldChild.componentInstance && oldChild.componentInstance._vnode.isComment) | ||
| 8863 | + ) { | ||
| 8864 | + // replace old child transition data with fresh one | ||
| 8865 | + // important for dynamic transitions! | ||
| 8866 | + var oldData = oldChild.data.transition = extend({}, data); | ||
| 8867 | + // handle transition mode | ||
| 8868 | + if (mode === 'out-in') { | ||
| 8869 | + // return placeholder node and queue update when leave finishes | ||
| 8870 | + this._leaving = true; | ||
| 8871 | + mergeVNodeHook(oldData, 'afterLeave', function () { | ||
| 8872 | + this$1._leaving = false; | ||
| 8873 | + this$1.$forceUpdate(); | ||
| 8874 | + }); | ||
| 8875 | + return placeholder(h, rawChild) | ||
| 8876 | + } else if (mode === 'in-out') { | ||
| 8877 | + if (isAsyncPlaceholder(child)) { | ||
| 8878 | + return oldRawChild | ||
| 8879 | + } | ||
| 8880 | + var delayedLeave; | ||
| 8881 | + var performLeave = function () { delayedLeave(); }; | ||
| 8882 | + mergeVNodeHook(data, 'afterEnter', performLeave); | ||
| 8883 | + mergeVNodeHook(data, 'enterCancelled', performLeave); | ||
| 8884 | + mergeVNodeHook(oldData, 'delayLeave', function (leave) { delayedLeave = leave; }); | ||
| 8885 | + } | ||
| 8886 | + } | ||
| 8887 | + | ||
| 8888 | + return rawChild | ||
| 8889 | + } | ||
| 8890 | + }; | ||
| 8891 | + | ||
| 8892 | + /* */ | ||
| 8893 | + | ||
| 8894 | + var props = extend({ | ||
| 8895 | + tag: String, | ||
| 8896 | + moveClass: String | ||
| 8897 | + }, transitionProps); | ||
| 8898 | + | ||
| 8899 | + delete props.mode; | ||
| 8900 | + | ||
| 8901 | + var TransitionGroup = { | ||
| 8902 | + props: props, | ||
| 8903 | + | ||
| 8904 | + beforeMount: function beforeMount () { | ||
| 8905 | + var this$1 = this; | ||
| 8906 | + | ||
| 8907 | + var update = this._update; | ||
| 8908 | + this._update = function (vnode, hydrating) { | ||
| 8909 | + var restoreActiveInstance = setActiveInstance(this$1); | ||
| 8910 | + // force removing pass | ||
| 8911 | + this$1.__patch__( | ||
| 8912 | + this$1._vnode, | ||
| 8913 | + this$1.kept, | ||
| 8914 | + false, // hydrating | ||
| 8915 | + true // removeOnly (!important, avoids unnecessary moves) | ||
| 8916 | + ); | ||
| 8917 | + this$1._vnode = this$1.kept; | ||
| 8918 | + restoreActiveInstance(); | ||
| 8919 | + update.call(this$1, vnode, hydrating); | ||
| 8920 | + }; | ||
| 8921 | + }, | ||
| 8922 | + | ||
| 8923 | + render: function render (h) { | ||
| 8924 | + var tag = this.tag || this.$vnode.data.tag || 'span'; | ||
| 8925 | + var map = Object.create(null); | ||
| 8926 | + var prevChildren = this.prevChildren = this.children; | ||
| 8927 | + var rawChildren = this.$slots.default || []; | ||
| 8928 | + var children = this.children = []; | ||
| 8929 | + var transitionData = extractTransitionData(this); | ||
| 8930 | + | ||
| 8931 | + for (var i = 0; i < rawChildren.length; i++) { | ||
| 8932 | + var c = rawChildren[i]; | ||
| 8933 | + if (c.tag) { | ||
| 8934 | + if (c.key != null && String(c.key).indexOf('__vlist') !== 0) { | ||
| 8935 | + children.push(c); | ||
| 8936 | + map[c.key] = c | ||
| 8937 | + ;(c.data || (c.data = {})).transition = transitionData; | ||
| 8938 | + } else { | ||
| 8939 | + var opts = c.componentOptions; | ||
| 8940 | + var name = opts ? (opts.Ctor.options.name || opts.tag || '') : c.tag; | ||
| 8941 | + warn(("<transition-group> children must be keyed: <" + name + ">")); | ||
| 8942 | + } | ||
| 8943 | + } | ||
| 8944 | + } | ||
| 8945 | + | ||
| 8946 | + if (prevChildren) { | ||
| 8947 | + var kept = []; | ||
| 8948 | + var removed = []; | ||
| 8949 | + for (var i$1 = 0; i$1 < prevChildren.length; i$1++) { | ||
| 8950 | + var c$1 = prevChildren[i$1]; | ||
| 8951 | + c$1.data.transition = transitionData; | ||
| 8952 | + c$1.data.pos = c$1.elm.getBoundingClientRect(); | ||
| 8953 | + if (map[c$1.key]) { | ||
| 8954 | + kept.push(c$1); | ||
| 8955 | + } else { | ||
| 8956 | + removed.push(c$1); | ||
| 8957 | + } | ||
| 8958 | + } | ||
| 8959 | + this.kept = h(tag, null, kept); | ||
| 8960 | + this.removed = removed; | ||
| 8961 | + } | ||
| 8962 | + | ||
| 8963 | + return h(tag, null, children) | ||
| 8964 | + }, | ||
| 8965 | + | ||
| 8966 | + updated: function updated () { | ||
| 8967 | + var children = this.prevChildren; | ||
| 8968 | + var moveClass = this.moveClass || ((this.name || 'v') + '-move'); | ||
| 8969 | + if (!children.length || !this.hasMove(children[0].elm, moveClass)) { | ||
| 8970 | + return | ||
| 8971 | + } | ||
| 8972 | + | ||
| 8973 | + // we divide the work into three loops to avoid mixing DOM reads and writes | ||
| 8974 | + // in each iteration - which helps prevent layout thrashing. | ||
| 8975 | + children.forEach(callPendingCbs); | ||
| 8976 | + children.forEach(recordPosition); | ||
| 8977 | + children.forEach(applyTranslation); | ||
| 8978 | + | ||
| 8979 | + // force reflow to put everything in position | ||
| 8980 | + // assign to this to avoid being removed in tree-shaking | ||
| 8981 | + // $flow-disable-line | ||
| 8982 | + this._reflow = document.body.offsetHeight; | ||
| 8983 | + | ||
| 8984 | + children.forEach(function (c) { | ||
| 8985 | + if (c.data.moved) { | ||
| 8986 | + var el = c.elm; | ||
| 8987 | + var s = el.style; | ||
| 8988 | + addTransitionClass(el, moveClass); | ||
| 8989 | + s.transform = s.WebkitTransform = s.transitionDuration = ''; | ||
| 8990 | + el.addEventListener(transitionEndEvent, el._moveCb = function cb (e) { | ||
| 8991 | + if (e && e.target !== el) { | ||
| 8992 | + return | ||
| 8993 | + } | ||
| 8994 | + if (!e || /transform$/.test(e.propertyName)) { | ||
| 8995 | + el.removeEventListener(transitionEndEvent, cb); | ||
| 8996 | + el._moveCb = null; | ||
| 8997 | + removeTransitionClass(el, moveClass); | ||
| 8998 | + } | ||
| 8999 | + }); | ||
| 9000 | + } | ||
| 9001 | + }); | ||
| 9002 | + }, | ||
| 9003 | + | ||
| 9004 | + methods: { | ||
| 9005 | + hasMove: function hasMove (el, moveClass) { | ||
| 9006 | + /* istanbul ignore if */ | ||
| 9007 | + if (!hasTransition) { | ||
| 9008 | + return false | ||
| 9009 | + } | ||
| 9010 | + /* istanbul ignore if */ | ||
| 9011 | + if (this._hasMove) { | ||
| 9012 | + return this._hasMove | ||
| 9013 | + } | ||
| 9014 | + // Detect whether an element with the move class applied has | ||
| 9015 | + // CSS transitions. Since the element may be inside an entering | ||
| 9016 | + // transition at this very moment, we make a clone of it and remove | ||
| 9017 | + // all other transition classes applied to ensure only the move class | ||
| 9018 | + // is applied. | ||
| 9019 | + var clone = el.cloneNode(); | ||
| 9020 | + if (el._transitionClasses) { | ||
| 9021 | + el._transitionClasses.forEach(function (cls) { removeClass(clone, cls); }); | ||
| 9022 | + } | ||
| 9023 | + addClass(clone, moveClass); | ||
| 9024 | + clone.style.display = 'none'; | ||
| 9025 | + this.$el.appendChild(clone); | ||
| 9026 | + var info = getTransitionInfo(clone); | ||
| 9027 | + this.$el.removeChild(clone); | ||
| 9028 | + return (this._hasMove = info.hasTransform) | ||
| 9029 | + } | ||
| 9030 | + } | ||
| 9031 | + }; | ||
| 9032 | + | ||
| 9033 | + function callPendingCbs (c) { | ||
| 9034 | + /* istanbul ignore if */ | ||
| 9035 | + if (c.elm._moveCb) { | ||
| 9036 | + c.elm._moveCb(); | ||
| 9037 | + } | ||
| 9038 | + /* istanbul ignore if */ | ||
| 9039 | + if (c.elm._enterCb) { | ||
| 9040 | + c.elm._enterCb(); | ||
| 9041 | + } | ||
| 9042 | + } | ||
| 9043 | + | ||
| 9044 | + function recordPosition (c) { | ||
| 9045 | + c.data.newPos = c.elm.getBoundingClientRect(); | ||
| 9046 | + } | ||
| 9047 | + | ||
| 9048 | + function applyTranslation (c) { | ||
| 9049 | + var oldPos = c.data.pos; | ||
| 9050 | + var newPos = c.data.newPos; | ||
| 9051 | + var dx = oldPos.left - newPos.left; | ||
| 9052 | + var dy = oldPos.top - newPos.top; | ||
| 9053 | + if (dx || dy) { | ||
| 9054 | + c.data.moved = true; | ||
| 9055 | + var s = c.elm.style; | ||
| 9056 | + s.transform = s.WebkitTransform = "translate(" + dx + "px," + dy + "px)"; | ||
| 9057 | + s.transitionDuration = '0s'; | ||
| 9058 | + } | ||
| 9059 | + } | ||
| 9060 | + | ||
| 9061 | + var platformComponents = { | ||
| 9062 | + Transition: Transition, | ||
| 9063 | + TransitionGroup: TransitionGroup | ||
| 9064 | + }; | ||
| 9065 | + | ||
| 9066 | + /* */ | ||
| 9067 | + | ||
| 9068 | + // install platform specific utils | ||
| 9069 | + Vue.config.mustUseProp = mustUseProp; | ||
| 9070 | + Vue.config.isReservedTag = isReservedTag; | ||
| 9071 | + Vue.config.isReservedAttr = isReservedAttr; | ||
| 9072 | + Vue.config.getTagNamespace = getTagNamespace; | ||
| 9073 | + Vue.config.isUnknownElement = isUnknownElement; | ||
| 9074 | + | ||
| 9075 | + // install platform runtime directives & components | ||
| 9076 | + extend(Vue.options.directives, platformDirectives); | ||
| 9077 | + extend(Vue.options.components, platformComponents); | ||
| 9078 | + | ||
| 9079 | + // install platform patch function | ||
| 9080 | + Vue.prototype.__patch__ = inBrowser ? patch : noop; | ||
| 9081 | + | ||
| 9082 | + // public mount method | ||
| 9083 | + Vue.prototype.$mount = function ( | ||
| 9084 | + el, | ||
| 9085 | + hydrating | ||
| 9086 | + ) { | ||
| 9087 | + el = el && inBrowser ? query(el) : undefined; | ||
| 9088 | + return mountComponent(this, el, hydrating) | ||
| 9089 | + }; | ||
| 9090 | + | ||
| 9091 | + // devtools global hook | ||
| 9092 | + /* istanbul ignore next */ | ||
| 9093 | + if (inBrowser) { | ||
| 9094 | + setTimeout(function () { | ||
| 9095 | + if (config.devtools) { | ||
| 9096 | + if (devtools) { | ||
| 9097 | + devtools.emit('init', Vue); | ||
| 9098 | + } else { | ||
| 9099 | + console[console.info ? 'info' : 'log']( | ||
| 9100 | + 'Download the Vue Devtools extension for a better development experience:\n' + | ||
| 9101 | + 'https://github.com/vuejs/vue-devtools' | ||
| 9102 | + ); | ||
| 9103 | + } | ||
| 9104 | + } | ||
| 9105 | + if (config.productionTip !== false && | ||
| 9106 | + typeof console !== 'undefined' | ||
| 9107 | + ) { | ||
| 9108 | + console[console.info ? 'info' : 'log']( | ||
| 9109 | + "You are running Vue in development mode.\n" + | ||
| 9110 | + "Make sure to turn on production mode when deploying for production.\n" + | ||
| 9111 | + "See more tips at https://vuejs.org/guide/deployment.html" | ||
| 9112 | + ); | ||
| 9113 | + } | ||
| 9114 | + }, 0); | ||
| 9115 | + } | ||
| 9116 | + | ||
| 9117 | + /* */ | ||
| 9118 | + | ||
| 9119 | + var defaultTagRE = /\{\{((?:.|\r?\n)+?)\}\}/g; | ||
| 9120 | + var regexEscapeRE = /[-.*+?^${}()|[\]\/\\]/g; | ||
| 9121 | + | ||
| 9122 | + var buildRegex = cached(function (delimiters) { | ||
| 9123 | + var open = delimiters[0].replace(regexEscapeRE, '\\$&'); | ||
| 9124 | + var close = delimiters[1].replace(regexEscapeRE, '\\$&'); | ||
| 9125 | + return new RegExp(open + '((?:.|\\n)+?)' + close, 'g') | ||
| 9126 | + }); | ||
| 9127 | + | ||
| 9128 | + | ||
| 9129 | + | ||
| 9130 | + function parseText ( | ||
| 9131 | + text, | ||
| 9132 | + delimiters | ||
| 9133 | + ) { | ||
| 9134 | + var tagRE = delimiters ? buildRegex(delimiters) : defaultTagRE; | ||
| 9135 | + if (!tagRE.test(text)) { | ||
| 9136 | + return | ||
| 9137 | + } | ||
| 9138 | + var tokens = []; | ||
| 9139 | + var rawTokens = []; | ||
| 9140 | + var lastIndex = tagRE.lastIndex = 0; | ||
| 9141 | + var match, index, tokenValue; | ||
| 9142 | + while ((match = tagRE.exec(text))) { | ||
| 9143 | + index = match.index; | ||
| 9144 | + // push text token | ||
| 9145 | + if (index > lastIndex) { | ||
| 9146 | + rawTokens.push(tokenValue = text.slice(lastIndex, index)); | ||
| 9147 | + tokens.push(JSON.stringify(tokenValue)); | ||
| 9148 | + } | ||
| 9149 | + // tag token | ||
| 9150 | + var exp = parseFilters(match[1].trim()); | ||
| 9151 | + tokens.push(("_s(" + exp + ")")); | ||
| 9152 | + rawTokens.push({ '@binding': exp }); | ||
| 9153 | + lastIndex = index + match[0].length; | ||
| 9154 | + } | ||
| 9155 | + if (lastIndex < text.length) { | ||
| 9156 | + rawTokens.push(tokenValue = text.slice(lastIndex)); | ||
| 9157 | + tokens.push(JSON.stringify(tokenValue)); | ||
| 9158 | + } | ||
| 9159 | + return { | ||
| 9160 | + expression: tokens.join('+'), | ||
| 9161 | + tokens: rawTokens | ||
| 9162 | + } | ||
| 9163 | + } | ||
| 9164 | + | ||
| 9165 | + /* */ | ||
| 9166 | + | ||
| 9167 | + function transformNode (el, options) { | ||
| 9168 | + var warn = options.warn || baseWarn; | ||
| 9169 | + var staticClass = getAndRemoveAttr(el, 'class'); | ||
| 9170 | + if (staticClass) { | ||
| 9171 | + var res = parseText(staticClass, options.delimiters); | ||
| 9172 | + if (res) { | ||
| 9173 | + warn( | ||
| 9174 | + "class=\"" + staticClass + "\": " + | ||
| 9175 | + 'Interpolation inside attributes has been removed. ' + | ||
| 9176 | + 'Use v-bind or the colon shorthand instead. For example, ' + | ||
| 9177 | + 'instead of <div class="{{ val }}">, use <div :class="val">.', | ||
| 9178 | + el.rawAttrsMap['class'] | ||
| 9179 | + ); | ||
| 9180 | + } | ||
| 9181 | + } | ||
| 9182 | + if (staticClass) { | ||
| 9183 | + el.staticClass = JSON.stringify(staticClass); | ||
| 9184 | + } | ||
| 9185 | + var classBinding = getBindingAttr(el, 'class', false /* getStatic */); | ||
| 9186 | + if (classBinding) { | ||
| 9187 | + el.classBinding = classBinding; | ||
| 9188 | + } | ||
| 9189 | + } | ||
| 9190 | + | ||
| 9191 | + function genData (el) { | ||
| 9192 | + var data = ''; | ||
| 9193 | + if (el.staticClass) { | ||
| 9194 | + data += "staticClass:" + (el.staticClass) + ","; | ||
| 9195 | + } | ||
| 9196 | + if (el.classBinding) { | ||
| 9197 | + data += "class:" + (el.classBinding) + ","; | ||
| 9198 | + } | ||
| 9199 | + return data | ||
| 9200 | + } | ||
| 9201 | + | ||
| 9202 | + var klass$1 = { | ||
| 9203 | + staticKeys: ['staticClass'], | ||
| 9204 | + transformNode: transformNode, | ||
| 9205 | + genData: genData | ||
| 9206 | + }; | ||
| 9207 | + | ||
| 9208 | + /* */ | ||
| 9209 | + | ||
| 9210 | + function transformNode$1 (el, options) { | ||
| 9211 | + var warn = options.warn || baseWarn; | ||
| 9212 | + var staticStyle = getAndRemoveAttr(el, 'style'); | ||
| 9213 | + if (staticStyle) { | ||
| 9214 | + /* istanbul ignore if */ | ||
| 9215 | + { | ||
| 9216 | + var res = parseText(staticStyle, options.delimiters); | ||
| 9217 | + if (res) { | ||
| 9218 | + warn( | ||
| 9219 | + "style=\"" + staticStyle + "\": " + | ||
| 9220 | + 'Interpolation inside attributes has been removed. ' + | ||
| 9221 | + 'Use v-bind or the colon shorthand instead. For example, ' + | ||
| 9222 | + 'instead of <div style="{{ val }}">, use <div :style="val">.', | ||
| 9223 | + el.rawAttrsMap['style'] | ||
| 9224 | + ); | ||
| 9225 | + } | ||
| 9226 | + } | ||
| 9227 | + el.staticStyle = JSON.stringify(parseStyleText(staticStyle)); | ||
| 9228 | + } | ||
| 9229 | + | ||
| 9230 | + var styleBinding = getBindingAttr(el, 'style', false /* getStatic */); | ||
| 9231 | + if (styleBinding) { | ||
| 9232 | + el.styleBinding = styleBinding; | ||
| 9233 | + } | ||
| 9234 | + } | ||
| 9235 | + | ||
| 9236 | + function genData$1 (el) { | ||
| 9237 | + var data = ''; | ||
| 9238 | + if (el.staticStyle) { | ||
| 9239 | + data += "staticStyle:" + (el.staticStyle) + ","; | ||
| 9240 | + } | ||
| 9241 | + if (el.styleBinding) { | ||
| 9242 | + data += "style:(" + (el.styleBinding) + "),"; | ||
| 9243 | + } | ||
| 9244 | + return data | ||
| 9245 | + } | ||
| 9246 | + | ||
| 9247 | + var style$1 = { | ||
| 9248 | + staticKeys: ['staticStyle'], | ||
| 9249 | + transformNode: transformNode$1, | ||
| 9250 | + genData: genData$1 | ||
| 9251 | + }; | ||
| 9252 | + | ||
| 9253 | + /* */ | ||
| 9254 | + | ||
| 9255 | + var decoder; | ||
| 9256 | + | ||
| 9257 | + var he = { | ||
| 9258 | + decode: function decode (html) { | ||
| 9259 | + decoder = decoder || document.createElement('div'); | ||
| 9260 | + decoder.innerHTML = html; | ||
| 9261 | + return decoder.textContent | ||
| 9262 | + } | ||
| 9263 | + }; | ||
| 9264 | + | ||
| 9265 | + /* */ | ||
| 9266 | + | ||
| 9267 | + var isUnaryTag = makeMap( | ||
| 9268 | + 'area,base,br,col,embed,frame,hr,img,input,isindex,keygen,' + | ||
| 9269 | + 'link,meta,param,source,track,wbr' | ||
| 9270 | + ); | ||
| 9271 | + | ||
| 9272 | + // Elements that you can, intentionally, leave open | ||
| 9273 | + // (and which close themselves) | ||
| 9274 | + var canBeLeftOpenTag = makeMap( | ||
| 9275 | + 'colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr,source' | ||
| 9276 | + ); | ||
| 9277 | + | ||
| 9278 | + // HTML5 tags https://html.spec.whatwg.org/multipage/indices.html#elements-3 | ||
| 9279 | + // Phrasing Content https://html.spec.whatwg.org/multipage/dom.html#phrasing-content | ||
| 9280 | + var isNonPhrasingTag = makeMap( | ||
| 9281 | + 'address,article,aside,base,blockquote,body,caption,col,colgroup,dd,' + | ||
| 9282 | + 'details,dialog,div,dl,dt,fieldset,figcaption,figure,footer,form,' + | ||
| 9283 | + 'h1,h2,h3,h4,h5,h6,head,header,hgroup,hr,html,legend,li,menuitem,meta,' + | ||
| 9284 | + 'optgroup,option,param,rp,rt,source,style,summary,tbody,td,tfoot,th,thead,' + | ||
| 9285 | + 'title,tr,track' | ||
| 9286 | + ); | ||
| 9287 | + | ||
| 9288 | + /** | ||
| 9289 | + * Not type-checking this file because it's mostly vendor code. | ||
| 9290 | + */ | ||
| 9291 | + | ||
| 9292 | + // Regular Expressions for parsing tags and attributes | ||
| 9293 | + var attribute = /^\s*([^\s"'<>\/=]+)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/; | ||
| 9294 | + var dynamicArgAttribute = /^\s*((?:v-[\w-]+:|@|:|#)\[[^=]+?\][^\s"'<>\/=]*)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/; | ||
| 9295 | + var ncname = "[a-zA-Z_][\\-\\.0-9_a-zA-Z" + (unicodeRegExp.source) + "]*"; | ||
| 9296 | + var qnameCapture = "((?:" + ncname + "\\:)?" + ncname + ")"; | ||
| 9297 | + var startTagOpen = new RegExp(("^<" + qnameCapture)); | ||
| 9298 | + var startTagClose = /^\s*(\/?)>/; | ||
| 9299 | + var endTag = new RegExp(("^<\\/" + qnameCapture + "[^>]*>")); | ||
| 9300 | + var doctype = /^<!DOCTYPE [^>]+>/i; | ||
| 9301 | + // #7298: escape - to avoid being passed as HTML comment when inlined in page | ||
| 9302 | + var comment = /^<!\--/; | ||
| 9303 | + var conditionalComment = /^<!\[/; | ||
| 9304 | + | ||
| 9305 | + // Special Elements (can contain anything) | ||
| 9306 | + var isPlainTextElement = makeMap('script,style,textarea', true); | ||
| 9307 | + var reCache = {}; | ||
| 9308 | + | ||
| 9309 | + var decodingMap = { | ||
| 9310 | + '<': '<', | ||
| 9311 | + '>': '>', | ||
| 9312 | + '"': '"', | ||
| 9313 | + '&': '&', | ||
| 9314 | + ' ': '\n', | ||
| 9315 | + '	': '\t', | ||
| 9316 | + ''': "'" | ||
| 9317 | + }; | ||
| 9318 | + var encodedAttr = /&(?:lt|gt|quot|amp|#39);/g; | ||
| 9319 | + var encodedAttrWithNewLines = /&(?:lt|gt|quot|amp|#39|#10|#9);/g; | ||
| 9320 | + | ||
| 9321 | + // #5992 | ||
| 9322 | + var isIgnoreNewlineTag = makeMap('pre,textarea', true); | ||
| 9323 | + var shouldIgnoreFirstNewline = function (tag, html) { return tag && isIgnoreNewlineTag(tag) && html[0] === '\n'; }; | ||
| 9324 | + | ||
| 9325 | + function decodeAttr (value, shouldDecodeNewlines) { | ||
| 9326 | + var re = shouldDecodeNewlines ? encodedAttrWithNewLines : encodedAttr; | ||
| 9327 | + return value.replace(re, function (match) { return decodingMap[match]; }) | ||
| 9328 | + } | ||
| 9329 | + | ||
| 9330 | + function parseHTML (html, options) { | ||
| 9331 | + var stack = []; | ||
| 9332 | + var expectHTML = options.expectHTML; | ||
| 9333 | + var isUnaryTag$$1 = options.isUnaryTag || no; | ||
| 9334 | + var canBeLeftOpenTag$$1 = options.canBeLeftOpenTag || no; | ||
| 9335 | + var index = 0; | ||
| 9336 | + var last, lastTag; | ||
| 9337 | + while (html) { | ||
| 9338 | + last = html; | ||
| 9339 | + // Make sure we're not in a plaintext content element like script/style | ||
| 9340 | + if (!lastTag || !isPlainTextElement(lastTag)) { | ||
| 9341 | + var textEnd = html.indexOf('<'); | ||
| 9342 | + if (textEnd === 0) { | ||
| 9343 | + // Comment: | ||
| 9344 | + if (comment.test(html)) { | ||
| 9345 | + var commentEnd = html.indexOf('-->'); | ||
| 9346 | + | ||
| 9347 | + if (commentEnd >= 0) { | ||
| 9348 | + if (options.shouldKeepComment) { | ||
| 9349 | + options.comment(html.substring(4, commentEnd), index, index + commentEnd + 3); | ||
| 9350 | + } | ||
| 9351 | + advance(commentEnd + 3); | ||
| 9352 | + continue | ||
| 9353 | + } | ||
| 9354 | + } | ||
| 9355 | + | ||
| 9356 | + // http://en.wikipedia.org/wiki/Conditional_comment#Downlevel-revealed_conditional_comment | ||
| 9357 | + if (conditionalComment.test(html)) { | ||
| 9358 | + var conditionalEnd = html.indexOf(']>'); | ||
| 9359 | + | ||
| 9360 | + if (conditionalEnd >= 0) { | ||
| 9361 | + advance(conditionalEnd + 2); | ||
| 9362 | + continue | ||
| 9363 | + } | ||
| 9364 | + } | ||
| 9365 | + | ||
| 9366 | + // Doctype: | ||
| 9367 | + var doctypeMatch = html.match(doctype); | ||
| 9368 | + if (doctypeMatch) { | ||
| 9369 | + advance(doctypeMatch[0].length); | ||
| 9370 | + continue | ||
| 9371 | + } | ||
| 9372 | + | ||
| 9373 | + // End tag: | ||
| 9374 | + var endTagMatch = html.match(endTag); | ||
| 9375 | + if (endTagMatch) { | ||
| 9376 | + var curIndex = index; | ||
| 9377 | + advance(endTagMatch[0].length); | ||
| 9378 | + parseEndTag(endTagMatch[1], curIndex, index); | ||
| 9379 | + continue | ||
| 9380 | + } | ||
| 9381 | + | ||
| 9382 | + // Start tag: | ||
| 9383 | + var startTagMatch = parseStartTag(); | ||
| 9384 | + if (startTagMatch) { | ||
| 9385 | + handleStartTag(startTagMatch); | ||
| 9386 | + if (shouldIgnoreFirstNewline(startTagMatch.tagName, html)) { | ||
| 9387 | + advance(1); | ||
| 9388 | + } | ||
| 9389 | + continue | ||
| 9390 | + } | ||
| 9391 | + } | ||
| 9392 | + | ||
| 9393 | + var text = (void 0), rest = (void 0), next = (void 0); | ||
| 9394 | + if (textEnd >= 0) { | ||
| 9395 | + rest = html.slice(textEnd); | ||
| 9396 | + while ( | ||
| 9397 | + !endTag.test(rest) && | ||
| 9398 | + !startTagOpen.test(rest) && | ||
| 9399 | + !comment.test(rest) && | ||
| 9400 | + !conditionalComment.test(rest) | ||
| 9401 | + ) { | ||
| 9402 | + // < in plain text, be forgiving and treat it as text | ||
| 9403 | + next = rest.indexOf('<', 1); | ||
| 9404 | + if (next < 0) { break } | ||
| 9405 | + textEnd += next; | ||
| 9406 | + rest = html.slice(textEnd); | ||
| 9407 | + } | ||
| 9408 | + text = html.substring(0, textEnd); | ||
| 9409 | + } | ||
| 9410 | + | ||
| 9411 | + if (textEnd < 0) { | ||
| 9412 | + text = html; | ||
| 9413 | + } | ||
| 9414 | + | ||
| 9415 | + if (text) { | ||
| 9416 | + advance(text.length); | ||
| 9417 | + } | ||
| 9418 | + | ||
| 9419 | + if (options.chars && text) { | ||
| 9420 | + options.chars(text, index - text.length, index); | ||
| 9421 | + } | ||
| 9422 | + } else { | ||
| 9423 | + var endTagLength = 0; | ||
| 9424 | + var stackedTag = lastTag.toLowerCase(); | ||
| 9425 | + var reStackedTag = reCache[stackedTag] || (reCache[stackedTag] = new RegExp('([\\s\\S]*?)(</' + stackedTag + '[^>]*>)', 'i')); | ||
| 9426 | + var rest$1 = html.replace(reStackedTag, function (all, text, endTag) { | ||
| 9427 | + endTagLength = endTag.length; | ||
| 9428 | + if (!isPlainTextElement(stackedTag) && stackedTag !== 'noscript') { | ||
| 9429 | + text = text | ||
| 9430 | + .replace(/<!\--([\s\S]*?)-->/g, '$1') // #7298 | ||
| 9431 | + .replace(/<!\[CDATA\[([\s\S]*?)]]>/g, '$1'); | ||
| 9432 | + } | ||
| 9433 | + if (shouldIgnoreFirstNewline(stackedTag, text)) { | ||
| 9434 | + text = text.slice(1); | ||
| 9435 | + } | ||
| 9436 | + if (options.chars) { | ||
| 9437 | + options.chars(text); | ||
| 9438 | + } | ||
| 9439 | + return '' | ||
| 9440 | + }); | ||
| 9441 | + index += html.length - rest$1.length; | ||
| 9442 | + html = rest$1; | ||
| 9443 | + parseEndTag(stackedTag, index - endTagLength, index); | ||
| 9444 | + } | ||
| 9445 | + | ||
| 9446 | + if (html === last) { | ||
| 9447 | + options.chars && options.chars(html); | ||
| 9448 | + if (!stack.length && options.warn) { | ||
| 9449 | + options.warn(("Mal-formatted tag at end of template: \"" + html + "\""), { start: index + html.length }); | ||
| 9450 | + } | ||
| 9451 | + break | ||
| 9452 | + } | ||
| 9453 | + } | ||
| 9454 | + | ||
| 9455 | + // Clean up any remaining tags | ||
| 9456 | + parseEndTag(); | ||
| 9457 | + | ||
| 9458 | + function advance (n) { | ||
| 9459 | + index += n; | ||
| 9460 | + html = html.substring(n); | ||
| 9461 | + } | ||
| 9462 | + | ||
| 9463 | + function parseStartTag () { | ||
| 9464 | + var start = html.match(startTagOpen); | ||
| 9465 | + if (start) { | ||
| 9466 | + var match = { | ||
| 9467 | + tagName: start[1], | ||
| 9468 | + attrs: [], | ||
| 9469 | + start: index | ||
| 9470 | + }; | ||
| 9471 | + advance(start[0].length); | ||
| 9472 | + var end, attr; | ||
| 9473 | + while (!(end = html.match(startTagClose)) && (attr = html.match(dynamicArgAttribute) || html.match(attribute))) { | ||
| 9474 | + attr.start = index; | ||
| 9475 | + advance(attr[0].length); | ||
| 9476 | + attr.end = index; | ||
| 9477 | + match.attrs.push(attr); | ||
| 9478 | + } | ||
| 9479 | + if (end) { | ||
| 9480 | + match.unarySlash = end[1]; | ||
| 9481 | + advance(end[0].length); | ||
| 9482 | + match.end = index; | ||
| 9483 | + return match | ||
| 9484 | + } | ||
| 9485 | + } | ||
| 9486 | + } | ||
| 9487 | + | ||
| 9488 | + function handleStartTag (match) { | ||
| 9489 | + var tagName = match.tagName; | ||
| 9490 | + var unarySlash = match.unarySlash; | ||
| 9491 | + | ||
| 9492 | + if (expectHTML) { | ||
| 9493 | + if (lastTag === 'p' && isNonPhrasingTag(tagName)) { | ||
| 9494 | + parseEndTag(lastTag); | ||
| 9495 | + } | ||
| 9496 | + if (canBeLeftOpenTag$$1(tagName) && lastTag === tagName) { | ||
| 9497 | + parseEndTag(tagName); | ||
| 9498 | + } | ||
| 9499 | + } | ||
| 9500 | + | ||
| 9501 | + var unary = isUnaryTag$$1(tagName) || !!unarySlash; | ||
| 9502 | + | ||
| 9503 | + var l = match.attrs.length; | ||
| 9504 | + var attrs = new Array(l); | ||
| 9505 | + for (var i = 0; i < l; i++) { | ||
| 9506 | + var args = match.attrs[i]; | ||
| 9507 | + var value = args[3] || args[4] || args[5] || ''; | ||
| 9508 | + var shouldDecodeNewlines = tagName === 'a' && args[1] === 'href' | ||
| 9509 | + ? options.shouldDecodeNewlinesForHref | ||
| 9510 | + : options.shouldDecodeNewlines; | ||
| 9511 | + attrs[i] = { | ||
| 9512 | + name: args[1], | ||
| 9513 | + value: decodeAttr(value, shouldDecodeNewlines) | ||
| 9514 | + }; | ||
| 9515 | + if (options.outputSourceRange) { | ||
| 9516 | + attrs[i].start = args.start + args[0].match(/^\s*/).length; | ||
| 9517 | + attrs[i].end = args.end; | ||
| 9518 | + } | ||
| 9519 | + } | ||
| 9520 | + | ||
| 9521 | + if (!unary) { | ||
| 9522 | + stack.push({ tag: tagName, lowerCasedTag: tagName.toLowerCase(), attrs: attrs, start: match.start, end: match.end }); | ||
| 9523 | + lastTag = tagName; | ||
| 9524 | + } | ||
| 9525 | + | ||
| 9526 | + if (options.start) { | ||
| 9527 | + options.start(tagName, attrs, unary, match.start, match.end); | ||
| 9528 | + } | ||
| 9529 | + } | ||
| 9530 | + | ||
| 9531 | + function parseEndTag (tagName, start, end) { | ||
| 9532 | + var pos, lowerCasedTagName; | ||
| 9533 | + if (start == null) { start = index; } | ||
| 9534 | + if (end == null) { end = index; } | ||
| 9535 | + | ||
| 9536 | + // Find the closest opened tag of the same type | ||
| 9537 | + if (tagName) { | ||
| 9538 | + lowerCasedTagName = tagName.toLowerCase(); | ||
| 9539 | + for (pos = stack.length - 1; pos >= 0; pos--) { | ||
| 9540 | + if (stack[pos].lowerCasedTag === lowerCasedTagName) { | ||
| 9541 | + break | ||
| 9542 | + } | ||
| 9543 | + } | ||
| 9544 | + } else { | ||
| 9545 | + // If no tag name is provided, clean shop | ||
| 9546 | + pos = 0; | ||
| 9547 | + } | ||
| 9548 | + | ||
| 9549 | + if (pos >= 0) { | ||
| 9550 | + // Close all the open elements, up the stack | ||
| 9551 | + for (var i = stack.length - 1; i >= pos; i--) { | ||
| 9552 | + if (i > pos || !tagName && | ||
| 9553 | + options.warn | ||
| 9554 | + ) { | ||
| 9555 | + options.warn( | ||
| 9556 | + ("tag <" + (stack[i].tag) + "> has no matching end tag."), | ||
| 9557 | + { start: stack[i].start, end: stack[i].end } | ||
| 9558 | + ); | ||
| 9559 | + } | ||
| 9560 | + if (options.end) { | ||
| 9561 | + options.end(stack[i].tag, start, end); | ||
| 9562 | + } | ||
| 9563 | + } | ||
| 9564 | + | ||
| 9565 | + // Remove the open elements from the stack | ||
| 9566 | + stack.length = pos; | ||
| 9567 | + lastTag = pos && stack[pos - 1].tag; | ||
| 9568 | + } else if (lowerCasedTagName === 'br') { | ||
| 9569 | + if (options.start) { | ||
| 9570 | + options.start(tagName, [], true, start, end); | ||
| 9571 | + } | ||
| 9572 | + } else if (lowerCasedTagName === 'p') { | ||
| 9573 | + if (options.start) { | ||
| 9574 | + options.start(tagName, [], false, start, end); | ||
| 9575 | + } | ||
| 9576 | + if (options.end) { | ||
| 9577 | + options.end(tagName, start, end); | ||
| 9578 | + } | ||
| 9579 | + } | ||
| 9580 | + } | ||
| 9581 | + } | ||
| 9582 | + | ||
| 9583 | + /* */ | ||
| 9584 | + | ||
| 9585 | + var onRE = /^@|^v-on:/; | ||
| 9586 | + var dirRE = /^v-|^@|^:|^#/; | ||
| 9587 | + var forAliasRE = /([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/; | ||
| 9588 | + var forIteratorRE = /,([^,\}\]]*)(?:,([^,\}\]]*))?$/; | ||
| 9589 | + var stripParensRE = /^\(|\)$/g; | ||
| 9590 | + var dynamicArgRE = /^\[.*\]$/; | ||
| 9591 | + | ||
| 9592 | + var argRE = /:(.*)$/; | ||
| 9593 | + var bindRE = /^:|^\.|^v-bind:/; | ||
| 9594 | + var modifierRE = /\.[^.\]]+(?=[^\]]*$)/g; | ||
| 9595 | + | ||
| 9596 | + var slotRE = /^v-slot(:|$)|^#/; | ||
| 9597 | + | ||
| 9598 | + var lineBreakRE = /[\r\n]/; | ||
| 9599 | + var whitespaceRE$1 = /[ \f\t\r\n]+/g; | ||
| 9600 | + | ||
| 9601 | + var invalidAttributeRE = /[\s"'<>\/=]/; | ||
| 9602 | + | ||
| 9603 | + var decodeHTMLCached = cached(he.decode); | ||
| 9604 | + | ||
| 9605 | + var emptySlotScopeToken = "_empty_"; | ||
| 9606 | + | ||
| 9607 | + // configurable state | ||
| 9608 | + var warn$2; | ||
| 9609 | + var delimiters; | ||
| 9610 | + var transforms; | ||
| 9611 | + var preTransforms; | ||
| 9612 | + var postTransforms; | ||
| 9613 | + var platformIsPreTag; | ||
| 9614 | + var platformMustUseProp; | ||
| 9615 | + var platformGetTagNamespace; | ||
| 9616 | + var maybeComponent; | ||
| 9617 | + | ||
| 9618 | + function createASTElement ( | ||
| 9619 | + tag, | ||
| 9620 | + attrs, | ||
| 9621 | + parent | ||
| 9622 | + ) { | ||
| 9623 | + return { | ||
| 9624 | + type: 1, | ||
| 9625 | + tag: tag, | ||
| 9626 | + attrsList: attrs, | ||
| 9627 | + attrsMap: makeAttrsMap(attrs), | ||
| 9628 | + rawAttrsMap: {}, | ||
| 9629 | + parent: parent, | ||
| 9630 | + children: [] | ||
| 9631 | + } | ||
| 9632 | + } | ||
| 9633 | + | ||
| 9634 | + /** | ||
| 9635 | + * Convert HTML string to AST. | ||
| 9636 | + */ | ||
| 9637 | + function parse ( | ||
| 9638 | + template, | ||
| 9639 | + options | ||
| 9640 | + ) { | ||
| 9641 | + warn$2 = options.warn || baseWarn; | ||
| 9642 | + | ||
| 9643 | + platformIsPreTag = options.isPreTag || no; | ||
| 9644 | + platformMustUseProp = options.mustUseProp || no; | ||
| 9645 | + platformGetTagNamespace = options.getTagNamespace || no; | ||
| 9646 | + var isReservedTag = options.isReservedTag || no; | ||
| 9647 | + maybeComponent = function (el) { return !!( | ||
| 9648 | + el.component || | ||
| 9649 | + el.attrsMap[':is'] || | ||
| 9650 | + el.attrsMap['v-bind:is'] || | ||
| 9651 | + !(el.attrsMap.is ? isReservedTag(el.attrsMap.is) : isReservedTag(el.tag)) | ||
| 9652 | + ); }; | ||
| 9653 | + transforms = pluckModuleFunction(options.modules, 'transformNode'); | ||
| 9654 | + preTransforms = pluckModuleFunction(options.modules, 'preTransformNode'); | ||
| 9655 | + postTransforms = pluckModuleFunction(options.modules, 'postTransformNode'); | ||
| 9656 | + | ||
| 9657 | + delimiters = options.delimiters; | ||
| 9658 | + | ||
| 9659 | + var stack = []; | ||
| 9660 | + var preserveWhitespace = options.preserveWhitespace !== false; | ||
| 9661 | + var whitespaceOption = options.whitespace; | ||
| 9662 | + var root; | ||
| 9663 | + var currentParent; | ||
| 9664 | + var inVPre = false; | ||
| 9665 | + var inPre = false; | ||
| 9666 | + var warned = false; | ||
| 9667 | + | ||
| 9668 | + function warnOnce (msg, range) { | ||
| 9669 | + if (!warned) { | ||
| 9670 | + warned = true; | ||
| 9671 | + warn$2(msg, range); | ||
| 9672 | + } | ||
| 9673 | + } | ||
| 9674 | + | ||
| 9675 | + function closeElement (element) { | ||
| 9676 | + trimEndingWhitespace(element); | ||
| 9677 | + if (!inVPre && !element.processed) { | ||
| 9678 | + element = processElement(element, options); | ||
| 9679 | + } | ||
| 9680 | + // tree management | ||
| 9681 | + if (!stack.length && element !== root) { | ||
| 9682 | + // allow root elements with v-if, v-else-if and v-else | ||
| 9683 | + if (root.if && (element.elseif || element.else)) { | ||
| 9684 | + { | ||
| 9685 | + checkRootConstraints(element); | ||
| 9686 | + } | ||
| 9687 | + addIfCondition(root, { | ||
| 9688 | + exp: element.elseif, | ||
| 9689 | + block: element | ||
| 9690 | + }); | ||
| 9691 | + } else { | ||
| 9692 | + warnOnce( | ||
| 9693 | + "Component template should contain exactly one root element. " + | ||
| 9694 | + "If you are using v-if on multiple elements, " + | ||
| 9695 | + "use v-else-if to chain them instead.", | ||
| 9696 | + { start: element.start } | ||
| 9697 | + ); | ||
| 9698 | + } | ||
| 9699 | + } | ||
| 9700 | + if (currentParent && !element.forbidden) { | ||
| 9701 | + if (element.elseif || element.else) { | ||
| 9702 | + processIfConditions(element, currentParent); | ||
| 9703 | + } else { | ||
| 9704 | + if (element.slotScope) { | ||
| 9705 | + // scoped slot | ||
| 9706 | + // keep it in the children list so that v-else(-if) conditions can | ||
| 9707 | + // find it as the prev node. | ||
| 9708 | + var name = element.slotTarget || '"default"' | ||
| 9709 | + ;(currentParent.scopedSlots || (currentParent.scopedSlots = {}))[name] = element; | ||
| 9710 | + } | ||
| 9711 | + currentParent.children.push(element); | ||
| 9712 | + element.parent = currentParent; | ||
| 9713 | + } | ||
| 9714 | + } | ||
| 9715 | + | ||
| 9716 | + // final children cleanup | ||
| 9717 | + // filter out scoped slots | ||
| 9718 | + element.children = element.children.filter(function (c) { return !(c).slotScope; }); | ||
| 9719 | + // remove trailing whitespace node again | ||
| 9720 | + trimEndingWhitespace(element); | ||
| 9721 | + | ||
| 9722 | + // check pre state | ||
| 9723 | + if (element.pre) { | ||
| 9724 | + inVPre = false; | ||
| 9725 | + } | ||
| 9726 | + if (platformIsPreTag(element.tag)) { | ||
| 9727 | + inPre = false; | ||
| 9728 | + } | ||
| 9729 | + // apply post-transforms | ||
| 9730 | + for (var i = 0; i < postTransforms.length; i++) { | ||
| 9731 | + postTransforms[i](element, options); | ||
| 9732 | + } | ||
| 9733 | + } | ||
| 9734 | + | ||
| 9735 | + function trimEndingWhitespace (el) { | ||
| 9736 | + // remove trailing whitespace node | ||
| 9737 | + if (!inPre) { | ||
| 9738 | + var lastNode; | ||
| 9739 | + while ( | ||
| 9740 | + (lastNode = el.children[el.children.length - 1]) && | ||
| 9741 | + lastNode.type === 3 && | ||
| 9742 | + lastNode.text === ' ' | ||
| 9743 | + ) { | ||
| 9744 | + el.children.pop(); | ||
| 9745 | + } | ||
| 9746 | + } | ||
| 9747 | + } | ||
| 9748 | + | ||
| 9749 | + function checkRootConstraints (el) { | ||
| 9750 | + if (el.tag === 'slot' || el.tag === 'template') { | ||
| 9751 | + warnOnce( | ||
| 9752 | + "Cannot use <" + (el.tag) + "> as component root element because it may " + | ||
| 9753 | + 'contain multiple nodes.', | ||
| 9754 | + { start: el.start } | ||
| 9755 | + ); | ||
| 9756 | + } | ||
| 9757 | + if (el.attrsMap.hasOwnProperty('v-for')) { | ||
| 9758 | + warnOnce( | ||
| 9759 | + 'Cannot use v-for on stateful component root element because ' + | ||
| 9760 | + 'it renders multiple elements.', | ||
| 9761 | + el.rawAttrsMap['v-for'] | ||
| 9762 | + ); | ||
| 9763 | + } | ||
| 9764 | + } | ||
| 9765 | + | ||
| 9766 | + parseHTML(template, { | ||
| 9767 | + warn: warn$2, | ||
| 9768 | + expectHTML: options.expectHTML, | ||
| 9769 | + isUnaryTag: options.isUnaryTag, | ||
| 9770 | + canBeLeftOpenTag: options.canBeLeftOpenTag, | ||
| 9771 | + shouldDecodeNewlines: options.shouldDecodeNewlines, | ||
| 9772 | + shouldDecodeNewlinesForHref: options.shouldDecodeNewlinesForHref, | ||
| 9773 | + shouldKeepComment: options.comments, | ||
| 9774 | + outputSourceRange: options.outputSourceRange, | ||
| 9775 | + start: function start (tag, attrs, unary, start$1, end) { | ||
| 9776 | + // check namespace. | ||
| 9777 | + // inherit parent ns if there is one | ||
| 9778 | + var ns = (currentParent && currentParent.ns) || platformGetTagNamespace(tag); | ||
| 9779 | + | ||
| 9780 | + // handle IE svg bug | ||
| 9781 | + /* istanbul ignore if */ | ||
| 9782 | + if (isIE && ns === 'svg') { | ||
| 9783 | + attrs = guardIESVGBug(attrs); | ||
| 9784 | + } | ||
| 9785 | + | ||
| 9786 | + var element = createASTElement(tag, attrs, currentParent); | ||
| 9787 | + if (ns) { | ||
| 9788 | + element.ns = ns; | ||
| 9789 | + } | ||
| 9790 | + | ||
| 9791 | + { | ||
| 9792 | + if (options.outputSourceRange) { | ||
| 9793 | + element.start = start$1; | ||
| 9794 | + element.end = end; | ||
| 9795 | + element.rawAttrsMap = element.attrsList.reduce(function (cumulated, attr) { | ||
| 9796 | + cumulated[attr.name] = attr; | ||
| 9797 | + return cumulated | ||
| 9798 | + }, {}); | ||
| 9799 | + } | ||
| 9800 | + attrs.forEach(function (attr) { | ||
| 9801 | + if (invalidAttributeRE.test(attr.name)) { | ||
| 9802 | + warn$2( | ||
| 9803 | + "Invalid dynamic argument expression: attribute names cannot contain " + | ||
| 9804 | + "spaces, quotes, <, >, / or =.", | ||
| 9805 | + { | ||
| 9806 | + start: attr.start + attr.name.indexOf("["), | ||
| 9807 | + end: attr.start + attr.name.length | ||
| 9808 | + } | ||
| 9809 | + ); | ||
| 9810 | + } | ||
| 9811 | + }); | ||
| 9812 | + } | ||
| 9813 | + | ||
| 9814 | + if (isForbiddenTag(element) && !isServerRendering()) { | ||
| 9815 | + element.forbidden = true; | ||
| 9816 | + warn$2( | ||
| 9817 | + 'Templates should only be responsible for mapping the state to the ' + | ||
| 9818 | + 'UI. Avoid placing tags with side-effects in your templates, such as ' + | ||
| 9819 | + "<" + tag + ">" + ', as they will not be parsed.', | ||
| 9820 | + { start: element.start } | ||
| 9821 | + ); | ||
| 9822 | + } | ||
| 9823 | + | ||
| 9824 | + // apply pre-transforms | ||
| 9825 | + for (var i = 0; i < preTransforms.length; i++) { | ||
| 9826 | + element = preTransforms[i](element, options) || element; | ||
| 9827 | + } | ||
| 9828 | + | ||
| 9829 | + if (!inVPre) { | ||
| 9830 | + processPre(element); | ||
| 9831 | + if (element.pre) { | ||
| 9832 | + inVPre = true; | ||
| 9833 | + } | ||
| 9834 | + } | ||
| 9835 | + if (platformIsPreTag(element.tag)) { | ||
| 9836 | + inPre = true; | ||
| 9837 | + } | ||
| 9838 | + if (inVPre) { | ||
| 9839 | + processRawAttrs(element); | ||
| 9840 | + } else if (!element.processed) { | ||
| 9841 | + // structural directives | ||
| 9842 | + processFor(element); | ||
| 9843 | + processIf(element); | ||
| 9844 | + processOnce(element); | ||
| 9845 | + } | ||
| 9846 | + | ||
| 9847 | + if (!root) { | ||
| 9848 | + root = element; | ||
| 9849 | + { | ||
| 9850 | + checkRootConstraints(root); | ||
| 9851 | + } | ||
| 9852 | + } | ||
| 9853 | + | ||
| 9854 | + if (!unary) { | ||
| 9855 | + currentParent = element; | ||
| 9856 | + stack.push(element); | ||
| 9857 | + } else { | ||
| 9858 | + closeElement(element); | ||
| 9859 | + } | ||
| 9860 | + }, | ||
| 9861 | + | ||
| 9862 | + end: function end (tag, start, end$1) { | ||
| 9863 | + var element = stack[stack.length - 1]; | ||
| 9864 | + // pop stack | ||
| 9865 | + stack.length -= 1; | ||
| 9866 | + currentParent = stack[stack.length - 1]; | ||
| 9867 | + if (options.outputSourceRange) { | ||
| 9868 | + element.end = end$1; | ||
| 9869 | + } | ||
| 9870 | + closeElement(element); | ||
| 9871 | + }, | ||
| 9872 | + | ||
| 9873 | + chars: function chars (text, start, end) { | ||
| 9874 | + if (!currentParent) { | ||
| 9875 | + { | ||
| 9876 | + if (text === template) { | ||
| 9877 | + warnOnce( | ||
| 9878 | + 'Component template requires a root element, rather than just text.', | ||
| 9879 | + { start: start } | ||
| 9880 | + ); | ||
| 9881 | + } else if ((text = text.trim())) { | ||
| 9882 | + warnOnce( | ||
| 9883 | + ("text \"" + text + "\" outside root element will be ignored."), | ||
| 9884 | + { start: start } | ||
| 9885 | + ); | ||
| 9886 | + } | ||
| 9887 | + } | ||
| 9888 | + return | ||
| 9889 | + } | ||
| 9890 | + // IE textarea placeholder bug | ||
| 9891 | + /* istanbul ignore if */ | ||
| 9892 | + if (isIE && | ||
| 9893 | + currentParent.tag === 'textarea' && | ||
| 9894 | + currentParent.attrsMap.placeholder === text | ||
| 9895 | + ) { | ||
| 9896 | + return | ||
| 9897 | + } | ||
| 9898 | + var children = currentParent.children; | ||
| 9899 | + if (inPre || text.trim()) { | ||
| 9900 | + text = isTextTag(currentParent) ? text : decodeHTMLCached(text); | ||
| 9901 | + } else if (!children.length) { | ||
| 9902 | + // remove the whitespace-only node right after an opening tag | ||
| 9903 | + text = ''; | ||
| 9904 | + } else if (whitespaceOption) { | ||
| 9905 | + if (whitespaceOption === 'condense') { | ||
| 9906 | + // in condense mode, remove the whitespace node if it contains | ||
| 9907 | + // line break, otherwise condense to a single space | ||
| 9908 | + text = lineBreakRE.test(text) ? '' : ' '; | ||
| 9909 | + } else { | ||
| 9910 | + text = ' '; | ||
| 9911 | + } | ||
| 9912 | + } else { | ||
| 9913 | + text = preserveWhitespace ? ' ' : ''; | ||
| 9914 | + } | ||
| 9915 | + if (text) { | ||
| 9916 | + if (!inPre && whitespaceOption === 'condense') { | ||
| 9917 | + // condense consecutive whitespaces into single space | ||
| 9918 | + text = text.replace(whitespaceRE$1, ' '); | ||
| 9919 | + } | ||
| 9920 | + var res; | ||
| 9921 | + var child; | ||
| 9922 | + if (!inVPre && text !== ' ' && (res = parseText(text, delimiters))) { | ||
| 9923 | + child = { | ||
| 9924 | + type: 2, | ||
| 9925 | + expression: res.expression, | ||
| 9926 | + tokens: res.tokens, | ||
| 9927 | + text: text | ||
| 9928 | + }; | ||
| 9929 | + } else if (text !== ' ' || !children.length || children[children.length - 1].text !== ' ') { | ||
| 9930 | + child = { | ||
| 9931 | + type: 3, | ||
| 9932 | + text: text | ||
| 9933 | + }; | ||
| 9934 | + } | ||
| 9935 | + if (child) { | ||
| 9936 | + if (options.outputSourceRange) { | ||
| 9937 | + child.start = start; | ||
| 9938 | + child.end = end; | ||
| 9939 | + } | ||
| 9940 | + children.push(child); | ||
| 9941 | + } | ||
| 9942 | + } | ||
| 9943 | + }, | ||
| 9944 | + comment: function comment (text, start, end) { | ||
| 9945 | + // adding anything as a sibling to the root node is forbidden | ||
| 9946 | + // comments should still be allowed, but ignored | ||
| 9947 | + if (currentParent) { | ||
| 9948 | + var child = { | ||
| 9949 | + type: 3, | ||
| 9950 | + text: text, | ||
| 9951 | + isComment: true | ||
| 9952 | + }; | ||
| 9953 | + if (options.outputSourceRange) { | ||
| 9954 | + child.start = start; | ||
| 9955 | + child.end = end; | ||
| 9956 | + } | ||
| 9957 | + currentParent.children.push(child); | ||
| 9958 | + } | ||
| 9959 | + } | ||
| 9960 | + }); | ||
| 9961 | + return root | ||
| 9962 | + } | ||
| 9963 | + | ||
| 9964 | + function processPre (el) { | ||
| 9965 | + if (getAndRemoveAttr(el, 'v-pre') != null) { | ||
| 9966 | + el.pre = true; | ||
| 9967 | + } | ||
| 9968 | + } | ||
| 9969 | + | ||
| 9970 | + function processRawAttrs (el) { | ||
| 9971 | + var list = el.attrsList; | ||
| 9972 | + var len = list.length; | ||
| 9973 | + if (len) { | ||
| 9974 | + var attrs = el.attrs = new Array(len); | ||
| 9975 | + for (var i = 0; i < len; i++) { | ||
| 9976 | + attrs[i] = { | ||
| 9977 | + name: list[i].name, | ||
| 9978 | + value: JSON.stringify(list[i].value) | ||
| 9979 | + }; | ||
| 9980 | + if (list[i].start != null) { | ||
| 9981 | + attrs[i].start = list[i].start; | ||
| 9982 | + attrs[i].end = list[i].end; | ||
| 9983 | + } | ||
| 9984 | + } | ||
| 9985 | + } else if (!el.pre) { | ||
| 9986 | + // non root node in pre blocks with no attributes | ||
| 9987 | + el.plain = true; | ||
| 9988 | + } | ||
| 9989 | + } | ||
| 9990 | + | ||
| 9991 | + function processElement ( | ||
| 9992 | + element, | ||
| 9993 | + options | ||
| 9994 | + ) { | ||
| 9995 | + processKey(element); | ||
| 9996 | + | ||
| 9997 | + // determine whether this is a plain element after | ||
| 9998 | + // removing structural attributes | ||
| 9999 | + element.plain = ( | ||
| 10000 | + !element.key && | ||
| 10001 | + !element.scopedSlots && | ||
| 10002 | + !element.attrsList.length | ||
| 10003 | + ); | ||
| 10004 | + | ||
| 10005 | + processRef(element); | ||
| 10006 | + processSlotContent(element); | ||
| 10007 | + processSlotOutlet(element); | ||
| 10008 | + processComponent(element); | ||
| 10009 | + for (var i = 0; i < transforms.length; i++) { | ||
| 10010 | + element = transforms[i](element, options) || element; | ||
| 10011 | + } | ||
| 10012 | + processAttrs(element); | ||
| 10013 | + return element | ||
| 10014 | + } | ||
| 10015 | + | ||
| 10016 | + function processKey (el) { | ||
| 10017 | + var exp = getBindingAttr(el, 'key'); | ||
| 10018 | + if (exp) { | ||
| 10019 | + { | ||
| 10020 | + if (el.tag === 'template') { | ||
| 10021 | + warn$2( | ||
| 10022 | + "<template> cannot be keyed. Place the key on real elements instead.", | ||
| 10023 | + getRawBindingAttr(el, 'key') | ||
| 10024 | + ); | ||
| 10025 | + } | ||
| 10026 | + if (el.for) { | ||
| 10027 | + var iterator = el.iterator2 || el.iterator1; | ||
| 10028 | + var parent = el.parent; | ||
| 10029 | + if (iterator && iterator === exp && parent && parent.tag === 'transition-group') { | ||
| 10030 | + warn$2( | ||
| 10031 | + "Do not use v-for index as key on <transition-group> children, " + | ||
| 10032 | + "this is the same as not using keys.", | ||
| 10033 | + getRawBindingAttr(el, 'key'), | ||
| 10034 | + true /* tip */ | ||
| 10035 | + ); | ||
| 10036 | + } | ||
| 10037 | + } | ||
| 10038 | + } | ||
| 10039 | + el.key = exp; | ||
| 10040 | + } | ||
| 10041 | + } | ||
| 10042 | + | ||
| 10043 | + function processRef (el) { | ||
| 10044 | + var ref = getBindingAttr(el, 'ref'); | ||
| 10045 | + if (ref) { | ||
| 10046 | + el.ref = ref; | ||
| 10047 | + el.refInFor = checkInFor(el); | ||
| 10048 | + } | ||
| 10049 | + } | ||
| 10050 | + | ||
| 10051 | + function processFor (el) { | ||
| 10052 | + var exp; | ||
| 10053 | + if ((exp = getAndRemoveAttr(el, 'v-for'))) { | ||
| 10054 | + var res = parseFor(exp); | ||
| 10055 | + if (res) { | ||
| 10056 | + extend(el, res); | ||
| 10057 | + } else { | ||
| 10058 | + warn$2( | ||
| 10059 | + ("Invalid v-for expression: " + exp), | ||
| 10060 | + el.rawAttrsMap['v-for'] | ||
| 10061 | + ); | ||
| 10062 | + } | ||
| 10063 | + } | ||
| 10064 | + } | ||
| 10065 | + | ||
| 10066 | + | ||
| 10067 | + | ||
| 10068 | + function parseFor (exp) { | ||
| 10069 | + var inMatch = exp.match(forAliasRE); | ||
| 10070 | + if (!inMatch) { return } | ||
| 10071 | + var res = {}; | ||
| 10072 | + res.for = inMatch[2].trim(); | ||
| 10073 | + var alias = inMatch[1].trim().replace(stripParensRE, ''); | ||
| 10074 | + var iteratorMatch = alias.match(forIteratorRE); | ||
| 10075 | + if (iteratorMatch) { | ||
| 10076 | + res.alias = alias.replace(forIteratorRE, '').trim(); | ||
| 10077 | + res.iterator1 = iteratorMatch[1].trim(); | ||
| 10078 | + if (iteratorMatch[2]) { | ||
| 10079 | + res.iterator2 = iteratorMatch[2].trim(); | ||
| 10080 | + } | ||
| 10081 | + } else { | ||
| 10082 | + res.alias = alias; | ||
| 10083 | + } | ||
| 10084 | + return res | ||
| 10085 | + } | ||
| 10086 | + | ||
| 10087 | + function processIf (el) { | ||
| 10088 | + var exp = getAndRemoveAttr(el, 'v-if'); | ||
| 10089 | + if (exp) { | ||
| 10090 | + el.if = exp; | ||
| 10091 | + addIfCondition(el, { | ||
| 10092 | + exp: exp, | ||
| 10093 | + block: el | ||
| 10094 | + }); | ||
| 10095 | + } else { | ||
| 10096 | + if (getAndRemoveAttr(el, 'v-else') != null) { | ||
| 10097 | + el.else = true; | ||
| 10098 | + } | ||
| 10099 | + var elseif = getAndRemoveAttr(el, 'v-else-if'); | ||
| 10100 | + if (elseif) { | ||
| 10101 | + el.elseif = elseif; | ||
| 10102 | + } | ||
| 10103 | + } | ||
| 10104 | + } | ||
| 10105 | + | ||
| 10106 | + function processIfConditions (el, parent) { | ||
| 10107 | + var prev = findPrevElement(parent.children); | ||
| 10108 | + if (prev && prev.if) { | ||
| 10109 | + addIfCondition(prev, { | ||
| 10110 | + exp: el.elseif, | ||
| 10111 | + block: el | ||
| 10112 | + }); | ||
| 10113 | + } else { | ||
| 10114 | + warn$2( | ||
| 10115 | + "v-" + (el.elseif ? ('else-if="' + el.elseif + '"') : 'else') + " " + | ||
| 10116 | + "used on element <" + (el.tag) + "> without corresponding v-if.", | ||
| 10117 | + el.rawAttrsMap[el.elseif ? 'v-else-if' : 'v-else'] | ||
| 10118 | + ); | ||
| 10119 | + } | ||
| 10120 | + } | ||
| 10121 | + | ||
| 10122 | + function findPrevElement (children) { | ||
| 10123 | + var i = children.length; | ||
| 10124 | + while (i--) { | ||
| 10125 | + if (children[i].type === 1) { | ||
| 10126 | + return children[i] | ||
| 10127 | + } else { | ||
| 10128 | + if (children[i].text !== ' ') { | ||
| 10129 | + warn$2( | ||
| 10130 | + "text \"" + (children[i].text.trim()) + "\" between v-if and v-else(-if) " + | ||
| 10131 | + "will be ignored.", | ||
| 10132 | + children[i] | ||
| 10133 | + ); | ||
| 10134 | + } | ||
| 10135 | + children.pop(); | ||
| 10136 | + } | ||
| 10137 | + } | ||
| 10138 | + } | ||
| 10139 | + | ||
| 10140 | + function addIfCondition (el, condition) { | ||
| 10141 | + if (!el.ifConditions) { | ||
| 10142 | + el.ifConditions = []; | ||
| 10143 | + } | ||
| 10144 | + el.ifConditions.push(condition); | ||
| 10145 | + } | ||
| 10146 | + | ||
| 10147 | + function processOnce (el) { | ||
| 10148 | + var once$$1 = getAndRemoveAttr(el, 'v-once'); | ||
| 10149 | + if (once$$1 != null) { | ||
| 10150 | + el.once = true; | ||
| 10151 | + } | ||
| 10152 | + } | ||
| 10153 | + | ||
| 10154 | + // handle content being passed to a component as slot, | ||
| 10155 | + // e.g. <template slot="xxx">, <div slot-scope="xxx"> | ||
| 10156 | + function processSlotContent (el) { | ||
| 10157 | + var slotScope; | ||
| 10158 | + if (el.tag === 'template') { | ||
| 10159 | + slotScope = getAndRemoveAttr(el, 'scope'); | ||
| 10160 | + /* istanbul ignore if */ | ||
| 10161 | + if (slotScope) { | ||
| 10162 | + warn$2( | ||
| 10163 | + "the \"scope\" attribute for scoped slots have been deprecated and " + | ||
| 10164 | + "replaced by \"slot-scope\" since 2.5. The new \"slot-scope\" attribute " + | ||
| 10165 | + "can also be used on plain elements in addition to <template> to " + | ||
| 10166 | + "denote scoped slots.", | ||
| 10167 | + el.rawAttrsMap['scope'], | ||
| 10168 | + true | ||
| 10169 | + ); | ||
| 10170 | + } | ||
| 10171 | + el.slotScope = slotScope || getAndRemoveAttr(el, 'slot-scope'); | ||
| 10172 | + } else if ((slotScope = getAndRemoveAttr(el, 'slot-scope'))) { | ||
| 10173 | + /* istanbul ignore if */ | ||
| 10174 | + if (el.attrsMap['v-for']) { | ||
| 10175 | + warn$2( | ||
| 10176 | + "Ambiguous combined usage of slot-scope and v-for on <" + (el.tag) + "> " + | ||
| 10177 | + "(v-for takes higher priority). Use a wrapper <template> for the " + | ||
| 10178 | + "scoped slot to make it clearer.", | ||
| 10179 | + el.rawAttrsMap['slot-scope'], | ||
| 10180 | + true | ||
| 10181 | + ); | ||
| 10182 | + } | ||
| 10183 | + el.slotScope = slotScope; | ||
| 10184 | + } | ||
| 10185 | + | ||
| 10186 | + // slot="xxx" | ||
| 10187 | + var slotTarget = getBindingAttr(el, 'slot'); | ||
| 10188 | + if (slotTarget) { | ||
| 10189 | + el.slotTarget = slotTarget === '""' ? '"default"' : slotTarget; | ||
| 10190 | + el.slotTargetDynamic = !!(el.attrsMap[':slot'] || el.attrsMap['v-bind:slot']); | ||
| 10191 | + // preserve slot as an attribute for native shadow DOM compat | ||
| 10192 | + // only for non-scoped slots. | ||
| 10193 | + if (el.tag !== 'template' && !el.slotScope) { | ||
| 10194 | + addAttr(el, 'slot', slotTarget, getRawBindingAttr(el, 'slot')); | ||
| 10195 | + } | ||
| 10196 | + } | ||
| 10197 | + | ||
| 10198 | + // 2.6 v-slot syntax | ||
| 10199 | + { | ||
| 10200 | + if (el.tag === 'template') { | ||
| 10201 | + // v-slot on <template> | ||
| 10202 | + var slotBinding = getAndRemoveAttrByRegex(el, slotRE); | ||
| 10203 | + if (slotBinding) { | ||
| 10204 | + { | ||
| 10205 | + if (el.slotTarget || el.slotScope) { | ||
| 10206 | + warn$2( | ||
| 10207 | + "Unexpected mixed usage of different slot syntaxes.", | ||
| 10208 | + el | ||
| 10209 | + ); | ||
| 10210 | + } | ||
| 10211 | + if (el.parent && !maybeComponent(el.parent)) { | ||
| 10212 | + warn$2( | ||
| 10213 | + "<template v-slot> can only appear at the root level inside " + | ||
| 10214 | + "the receiving component", | ||
| 10215 | + el | ||
| 10216 | + ); | ||
| 10217 | + } | ||
| 10218 | + } | ||
| 10219 | + var ref = getSlotName(slotBinding); | ||
| 10220 | + var name = ref.name; | ||
| 10221 | + var dynamic = ref.dynamic; | ||
| 10222 | + el.slotTarget = name; | ||
| 10223 | + el.slotTargetDynamic = dynamic; | ||
| 10224 | + el.slotScope = slotBinding.value || emptySlotScopeToken; // force it into a scoped slot for perf | ||
| 10225 | + } | ||
| 10226 | + } else { | ||
| 10227 | + // v-slot on component, denotes default slot | ||
| 10228 | + var slotBinding$1 = getAndRemoveAttrByRegex(el, slotRE); | ||
| 10229 | + if (slotBinding$1) { | ||
| 10230 | + { | ||
| 10231 | + if (!maybeComponent(el)) { | ||
| 10232 | + warn$2( | ||
| 10233 | + "v-slot can only be used on components or <template>.", | ||
| 10234 | + slotBinding$1 | ||
| 10235 | + ); | ||
| 10236 | + } | ||
| 10237 | + if (el.slotScope || el.slotTarget) { | ||
| 10238 | + warn$2( | ||
| 10239 | + "Unexpected mixed usage of different slot syntaxes.", | ||
| 10240 | + el | ||
| 10241 | + ); | ||
| 10242 | + } | ||
| 10243 | + if (el.scopedSlots) { | ||
| 10244 | + warn$2( | ||
| 10245 | + "To avoid scope ambiguity, the default slot should also use " + | ||
| 10246 | + "<template> syntax when there are other named slots.", | ||
| 10247 | + slotBinding$1 | ||
| 10248 | + ); | ||
| 10249 | + } | ||
| 10250 | + } | ||
| 10251 | + // add the component's children to its default slot | ||
| 10252 | + var slots = el.scopedSlots || (el.scopedSlots = {}); | ||
| 10253 | + var ref$1 = getSlotName(slotBinding$1); | ||
| 10254 | + var name$1 = ref$1.name; | ||
| 10255 | + var dynamic$1 = ref$1.dynamic; | ||
| 10256 | + var slotContainer = slots[name$1] = createASTElement('template', [], el); | ||
| 10257 | + slotContainer.slotTarget = name$1; | ||
| 10258 | + slotContainer.slotTargetDynamic = dynamic$1; | ||
| 10259 | + slotContainer.children = el.children.filter(function (c) { | ||
| 10260 | + if (!c.slotScope) { | ||
| 10261 | + c.parent = slotContainer; | ||
| 10262 | + return true | ||
| 10263 | + } | ||
| 10264 | + }); | ||
| 10265 | + slotContainer.slotScope = slotBinding$1.value || emptySlotScopeToken; | ||
| 10266 | + // remove children as they are returned from scopedSlots now | ||
| 10267 | + el.children = []; | ||
| 10268 | + // mark el non-plain so data gets generated | ||
| 10269 | + el.plain = false; | ||
| 10270 | + } | ||
| 10271 | + } | ||
| 10272 | + } | ||
| 10273 | + } | ||
| 10274 | + | ||
| 10275 | + function getSlotName (binding) { | ||
| 10276 | + var name = binding.name.replace(slotRE, ''); | ||
| 10277 | + if (!name) { | ||
| 10278 | + if (binding.name[0] !== '#') { | ||
| 10279 | + name = 'default'; | ||
| 10280 | + } else { | ||
| 10281 | + warn$2( | ||
| 10282 | + "v-slot shorthand syntax requires a slot name.", | ||
| 10283 | + binding | ||
| 10284 | + ); | ||
| 10285 | + } | ||
| 10286 | + } | ||
| 10287 | + return dynamicArgRE.test(name) | ||
| 10288 | + // dynamic [name] | ||
| 10289 | + ? { name: name.slice(1, -1), dynamic: true } | ||
| 10290 | + // static name | ||
| 10291 | + : { name: ("\"" + name + "\""), dynamic: false } | ||
| 10292 | + } | ||
| 10293 | + | ||
| 10294 | + // handle <slot/> outlets | ||
| 10295 | + function processSlotOutlet (el) { | ||
| 10296 | + if (el.tag === 'slot') { | ||
| 10297 | + el.slotName = getBindingAttr(el, 'name'); | ||
| 10298 | + if (el.key) { | ||
| 10299 | + warn$2( | ||
| 10300 | + "`key` does not work on <slot> because slots are abstract outlets " + | ||
| 10301 | + "and can possibly expand into multiple elements. " + | ||
| 10302 | + "Use the key on a wrapping element instead.", | ||
| 10303 | + getRawBindingAttr(el, 'key') | ||
| 10304 | + ); | ||
| 10305 | + } | ||
| 10306 | + } | ||
| 10307 | + } | ||
| 10308 | + | ||
| 10309 | + function processComponent (el) { | ||
| 10310 | + var binding; | ||
| 10311 | + if ((binding = getBindingAttr(el, 'is'))) { | ||
| 10312 | + el.component = binding; | ||
| 10313 | + } | ||
| 10314 | + if (getAndRemoveAttr(el, 'inline-template') != null) { | ||
| 10315 | + el.inlineTemplate = true; | ||
| 10316 | + } | ||
| 10317 | + } | ||
| 10318 | + | ||
| 10319 | + function processAttrs (el) { | ||
| 10320 | + var list = el.attrsList; | ||
| 10321 | + var i, l, name, rawName, value, modifiers, syncGen, isDynamic; | ||
| 10322 | + for (i = 0, l = list.length; i < l; i++) { | ||
| 10323 | + name = rawName = list[i].name; | ||
| 10324 | + value = list[i].value; | ||
| 10325 | + if (dirRE.test(name)) { | ||
| 10326 | + // mark element as dynamic | ||
| 10327 | + el.hasBindings = true; | ||
| 10328 | + // modifiers | ||
| 10329 | + modifiers = parseModifiers(name.replace(dirRE, '')); | ||
| 10330 | + // support .foo shorthand syntax for the .prop modifier | ||
| 10331 | + if (modifiers) { | ||
| 10332 | + name = name.replace(modifierRE, ''); | ||
| 10333 | + } | ||
| 10334 | + if (bindRE.test(name)) { // v-bind | ||
| 10335 | + name = name.replace(bindRE, ''); | ||
| 10336 | + value = parseFilters(value); | ||
| 10337 | + isDynamic = dynamicArgRE.test(name); | ||
| 10338 | + if (isDynamic) { | ||
| 10339 | + name = name.slice(1, -1); | ||
| 10340 | + } | ||
| 10341 | + if ( | ||
| 10342 | + value.trim().length === 0 | ||
| 10343 | + ) { | ||
| 10344 | + warn$2( | ||
| 10345 | + ("The value for a v-bind expression cannot be empty. Found in \"v-bind:" + name + "\"") | ||
| 10346 | + ); | ||
| 10347 | + } | ||
| 10348 | + if (modifiers) { | ||
| 10349 | + if (modifiers.prop && !isDynamic) { | ||
| 10350 | + name = camelize(name); | ||
| 10351 | + if (name === 'innerHtml') { name = 'innerHTML'; } | ||
| 10352 | + } | ||
| 10353 | + if (modifiers.camel && !isDynamic) { | ||
| 10354 | + name = camelize(name); | ||
| 10355 | + } | ||
| 10356 | + if (modifiers.sync) { | ||
| 10357 | + syncGen = genAssignmentCode(value, "$event"); | ||
| 10358 | + if (!isDynamic) { | ||
| 10359 | + addHandler( | ||
| 10360 | + el, | ||
| 10361 | + ("update:" + (camelize(name))), | ||
| 10362 | + syncGen, | ||
| 10363 | + null, | ||
| 10364 | + false, | ||
| 10365 | + warn$2, | ||
| 10366 | + list[i] | ||
| 10367 | + ); | ||
| 10368 | + if (hyphenate(name) !== camelize(name)) { | ||
| 10369 | + addHandler( | ||
| 10370 | + el, | ||
| 10371 | + ("update:" + (hyphenate(name))), | ||
| 10372 | + syncGen, | ||
| 10373 | + null, | ||
| 10374 | + false, | ||
| 10375 | + warn$2, | ||
| 10376 | + list[i] | ||
| 10377 | + ); | ||
| 10378 | + } | ||
| 10379 | + } else { | ||
| 10380 | + // handler w/ dynamic event name | ||
| 10381 | + addHandler( | ||
| 10382 | + el, | ||
| 10383 | + ("\"update:\"+(" + name + ")"), | ||
| 10384 | + syncGen, | ||
| 10385 | + null, | ||
| 10386 | + false, | ||
| 10387 | + warn$2, | ||
| 10388 | + list[i], | ||
| 10389 | + true // dynamic | ||
| 10390 | + ); | ||
| 10391 | + } | ||
| 10392 | + } | ||
| 10393 | + } | ||
| 10394 | + if ((modifiers && modifiers.prop) || ( | ||
| 10395 | + !el.component && platformMustUseProp(el.tag, el.attrsMap.type, name) | ||
| 10396 | + )) { | ||
| 10397 | + addProp(el, name, value, list[i], isDynamic); | ||
| 10398 | + } else { | ||
| 10399 | + addAttr(el, name, value, list[i], isDynamic); | ||
| 10400 | + } | ||
| 10401 | + } else if (onRE.test(name)) { // v-on | ||
| 10402 | + name = name.replace(onRE, ''); | ||
| 10403 | + isDynamic = dynamicArgRE.test(name); | ||
| 10404 | + if (isDynamic) { | ||
| 10405 | + name = name.slice(1, -1); | ||
| 10406 | + } | ||
| 10407 | + addHandler(el, name, value, modifiers, false, warn$2, list[i], isDynamic); | ||
| 10408 | + } else { // normal directives | ||
| 10409 | + name = name.replace(dirRE, ''); | ||
| 10410 | + // parse arg | ||
| 10411 | + var argMatch = name.match(argRE); | ||
| 10412 | + var arg = argMatch && argMatch[1]; | ||
| 10413 | + isDynamic = false; | ||
| 10414 | + if (arg) { | ||
| 10415 | + name = name.slice(0, -(arg.length + 1)); | ||
| 10416 | + if (dynamicArgRE.test(arg)) { | ||
| 10417 | + arg = arg.slice(1, -1); | ||
| 10418 | + isDynamic = true; | ||
| 10419 | + } | ||
| 10420 | + } | ||
| 10421 | + addDirective(el, name, rawName, value, arg, isDynamic, modifiers, list[i]); | ||
| 10422 | + if (name === 'model') { | ||
| 10423 | + checkForAliasModel(el, value); | ||
| 10424 | + } | ||
| 10425 | + } | ||
| 10426 | + } else { | ||
| 10427 | + // literal attribute | ||
| 10428 | + { | ||
| 10429 | + var res = parseText(value, delimiters); | ||
| 10430 | + if (res) { | ||
| 10431 | + warn$2( | ||
| 10432 | + name + "=\"" + value + "\": " + | ||
| 10433 | + 'Interpolation inside attributes has been removed. ' + | ||
| 10434 | + 'Use v-bind or the colon shorthand instead. For example, ' + | ||
| 10435 | + 'instead of <div id="{{ val }}">, use <div :id="val">.', | ||
| 10436 | + list[i] | ||
| 10437 | + ); | ||
| 10438 | + } | ||
| 10439 | + } | ||
| 10440 | + addAttr(el, name, JSON.stringify(value), list[i]); | ||
| 10441 | + // #6887 firefox doesn't update muted state if set via attribute | ||
| 10442 | + // even immediately after element creation | ||
| 10443 | + if (!el.component && | ||
| 10444 | + name === 'muted' && | ||
| 10445 | + platformMustUseProp(el.tag, el.attrsMap.type, name)) { | ||
| 10446 | + addProp(el, name, 'true', list[i]); | ||
| 10447 | + } | ||
| 10448 | + } | ||
| 10449 | + } | ||
| 10450 | + } | ||
| 10451 | + | ||
| 10452 | + function checkInFor (el) { | ||
| 10453 | + var parent = el; | ||
| 10454 | + while (parent) { | ||
| 10455 | + if (parent.for !== undefined) { | ||
| 10456 | + return true | ||
| 10457 | + } | ||
| 10458 | + parent = parent.parent; | ||
| 10459 | + } | ||
| 10460 | + return false | ||
| 10461 | + } | ||
| 10462 | + | ||
| 10463 | + function parseModifiers (name) { | ||
| 10464 | + var match = name.match(modifierRE); | ||
| 10465 | + if (match) { | ||
| 10466 | + var ret = {}; | ||
| 10467 | + match.forEach(function (m) { ret[m.slice(1)] = true; }); | ||
| 10468 | + return ret | ||
| 10469 | + } | ||
| 10470 | + } | ||
| 10471 | + | ||
| 10472 | + function makeAttrsMap (attrs) { | ||
| 10473 | + var map = {}; | ||
| 10474 | + for (var i = 0, l = attrs.length; i < l; i++) { | ||
| 10475 | + if ( | ||
| 10476 | + map[attrs[i].name] && !isIE && !isEdge | ||
| 10477 | + ) { | ||
| 10478 | + warn$2('duplicate attribute: ' + attrs[i].name, attrs[i]); | ||
| 10479 | + } | ||
| 10480 | + map[attrs[i].name] = attrs[i].value; | ||
| 10481 | + } | ||
| 10482 | + return map | ||
| 10483 | + } | ||
| 10484 | + | ||
| 10485 | + // for script (e.g. type="x/template") or style, do not decode content | ||
| 10486 | + function isTextTag (el) { | ||
| 10487 | + return el.tag === 'script' || el.tag === 'style' | ||
| 10488 | + } | ||
| 10489 | + | ||
| 10490 | + function isForbiddenTag (el) { | ||
| 10491 | + return ( | ||
| 10492 | + el.tag === 'style' || | ||
| 10493 | + (el.tag === 'script' && ( | ||
| 10494 | + !el.attrsMap.type || | ||
| 10495 | + el.attrsMap.type === 'text/javascript' | ||
| 10496 | + )) | ||
| 10497 | + ) | ||
| 10498 | + } | ||
| 10499 | + | ||
| 10500 | + var ieNSBug = /^xmlns:NS\d+/; | ||
| 10501 | + var ieNSPrefix = /^NS\d+:/; | ||
| 10502 | + | ||
| 10503 | + /* istanbul ignore next */ | ||
| 10504 | + function guardIESVGBug (attrs) { | ||
| 10505 | + var res = []; | ||
| 10506 | + for (var i = 0; i < attrs.length; i++) { | ||
| 10507 | + var attr = attrs[i]; | ||
| 10508 | + if (!ieNSBug.test(attr.name)) { | ||
| 10509 | + attr.name = attr.name.replace(ieNSPrefix, ''); | ||
| 10510 | + res.push(attr); | ||
| 10511 | + } | ||
| 10512 | + } | ||
| 10513 | + return res | ||
| 10514 | + } | ||
| 10515 | + | ||
| 10516 | + function checkForAliasModel (el, value) { | ||
| 10517 | + var _el = el; | ||
| 10518 | + while (_el) { | ||
| 10519 | + if (_el.for && _el.alias === value) { | ||
| 10520 | + warn$2( | ||
| 10521 | + "<" + (el.tag) + " v-model=\"" + value + "\">: " + | ||
| 10522 | + "You are binding v-model directly to a v-for iteration alias. " + | ||
| 10523 | + "This will not be able to modify the v-for source array because " + | ||
| 10524 | + "writing to the alias is like modifying a function local variable. " + | ||
| 10525 | + "Consider using an array of objects and use v-model on an object property instead.", | ||
| 10526 | + el.rawAttrsMap['v-model'] | ||
| 10527 | + ); | ||
| 10528 | + } | ||
| 10529 | + _el = _el.parent; | ||
| 10530 | + } | ||
| 10531 | + } | ||
| 10532 | + | ||
| 10533 | + /* */ | ||
| 10534 | + | ||
| 10535 | + function preTransformNode (el, options) { | ||
| 10536 | + if (el.tag === 'input') { | ||
| 10537 | + var map = el.attrsMap; | ||
| 10538 | + if (!map['v-model']) { | ||
| 10539 | + return | ||
| 10540 | + } | ||
| 10541 | + | ||
| 10542 | + var typeBinding; | ||
| 10543 | + if (map[':type'] || map['v-bind:type']) { | ||
| 10544 | + typeBinding = getBindingAttr(el, 'type'); | ||
| 10545 | + } | ||
| 10546 | + if (!map.type && !typeBinding && map['v-bind']) { | ||
| 10547 | + typeBinding = "(" + (map['v-bind']) + ").type"; | ||
| 10548 | + } | ||
| 10549 | + | ||
| 10550 | + if (typeBinding) { | ||
| 10551 | + var ifCondition = getAndRemoveAttr(el, 'v-if', true); | ||
| 10552 | + var ifConditionExtra = ifCondition ? ("&&(" + ifCondition + ")") : ""; | ||
| 10553 | + var hasElse = getAndRemoveAttr(el, 'v-else', true) != null; | ||
| 10554 | + var elseIfCondition = getAndRemoveAttr(el, 'v-else-if', true); | ||
| 10555 | + // 1. checkbox | ||
| 10556 | + var branch0 = cloneASTElement(el); | ||
| 10557 | + // process for on the main node | ||
| 10558 | + processFor(branch0); | ||
| 10559 | + addRawAttr(branch0, 'type', 'checkbox'); | ||
| 10560 | + processElement(branch0, options); | ||
| 10561 | + branch0.processed = true; // prevent it from double-processed | ||
| 10562 | + branch0.if = "(" + typeBinding + ")==='checkbox'" + ifConditionExtra; | ||
| 10563 | + addIfCondition(branch0, { | ||
| 10564 | + exp: branch0.if, | ||
| 10565 | + block: branch0 | ||
| 10566 | + }); | ||
| 10567 | + // 2. add radio else-if condition | ||
| 10568 | + var branch1 = cloneASTElement(el); | ||
| 10569 | + getAndRemoveAttr(branch1, 'v-for', true); | ||
| 10570 | + addRawAttr(branch1, 'type', 'radio'); | ||
| 10571 | + processElement(branch1, options); | ||
| 10572 | + addIfCondition(branch0, { | ||
| 10573 | + exp: "(" + typeBinding + ")==='radio'" + ifConditionExtra, | ||
| 10574 | + block: branch1 | ||
| 10575 | + }); | ||
| 10576 | + // 3. other | ||
| 10577 | + var branch2 = cloneASTElement(el); | ||
| 10578 | + getAndRemoveAttr(branch2, 'v-for', true); | ||
| 10579 | + addRawAttr(branch2, ':type', typeBinding); | ||
| 10580 | + processElement(branch2, options); | ||
| 10581 | + addIfCondition(branch0, { | ||
| 10582 | + exp: ifCondition, | ||
| 10583 | + block: branch2 | ||
| 10584 | + }); | ||
| 10585 | + | ||
| 10586 | + if (hasElse) { | ||
| 10587 | + branch0.else = true; | ||
| 10588 | + } else if (elseIfCondition) { | ||
| 10589 | + branch0.elseif = elseIfCondition; | ||
| 10590 | + } | ||
| 10591 | + | ||
| 10592 | + return branch0 | ||
| 10593 | + } | ||
| 10594 | + } | ||
| 10595 | + } | ||
| 10596 | + | ||
| 10597 | + function cloneASTElement (el) { | ||
| 10598 | + return createASTElement(el.tag, el.attrsList.slice(), el.parent) | ||
| 10599 | + } | ||
| 10600 | + | ||
| 10601 | + var model$1 = { | ||
| 10602 | + preTransformNode: preTransformNode | ||
| 10603 | + }; | ||
| 10604 | + | ||
| 10605 | + var modules$1 = [ | ||
| 10606 | + klass$1, | ||
| 10607 | + style$1, | ||
| 10608 | + model$1 | ||
| 10609 | + ]; | ||
| 10610 | + | ||
| 10611 | + /* */ | ||
| 10612 | + | ||
| 10613 | + function text (el, dir) { | ||
| 10614 | + if (dir.value) { | ||
| 10615 | + addProp(el, 'textContent', ("_s(" + (dir.value) + ")"), dir); | ||
| 10616 | + } | ||
| 10617 | + } | ||
| 10618 | + | ||
| 10619 | + /* */ | ||
| 10620 | + | ||
| 10621 | + function html (el, dir) { | ||
| 10622 | + if (dir.value) { | ||
| 10623 | + addProp(el, 'innerHTML', ("_s(" + (dir.value) + ")"), dir); | ||
| 10624 | + } | ||
| 10625 | + } | ||
| 10626 | + | ||
| 10627 | + var directives$1 = { | ||
| 10628 | + model: model, | ||
| 10629 | + text: text, | ||
| 10630 | + html: html | ||
| 10631 | + }; | ||
| 10632 | + | ||
| 10633 | + /* */ | ||
| 10634 | + | ||
| 10635 | + var baseOptions = { | ||
| 10636 | + expectHTML: true, | ||
| 10637 | + modules: modules$1, | ||
| 10638 | + directives: directives$1, | ||
| 10639 | + isPreTag: isPreTag, | ||
| 10640 | + isUnaryTag: isUnaryTag, | ||
| 10641 | + mustUseProp: mustUseProp, | ||
| 10642 | + canBeLeftOpenTag: canBeLeftOpenTag, | ||
| 10643 | + isReservedTag: isReservedTag, | ||
| 10644 | + getTagNamespace: getTagNamespace, | ||
| 10645 | + staticKeys: genStaticKeys(modules$1) | ||
| 10646 | + }; | ||
| 10647 | + | ||
| 10648 | + /* */ | ||
| 10649 | + | ||
| 10650 | + var isStaticKey; | ||
| 10651 | + var isPlatformReservedTag; | ||
| 10652 | + | ||
| 10653 | + var genStaticKeysCached = cached(genStaticKeys$1); | ||
| 10654 | + | ||
| 10655 | + /** | ||
| 10656 | + * Goal of the optimizer: walk the generated template AST tree | ||
| 10657 | + * and detect sub-trees that are purely static, i.e. parts of | ||
| 10658 | + * the DOM that never needs to change. | ||
| 10659 | + * | ||
| 10660 | + * Once we detect these sub-trees, we can: | ||
| 10661 | + * | ||
| 10662 | + * 1. Hoist them into constants, so that we no longer need to | ||
| 10663 | + * create fresh nodes for them on each re-render; | ||
| 10664 | + * 2. Completely skip them in the patching process. | ||
| 10665 | + */ | ||
| 10666 | + function optimize (root, options) { | ||
| 10667 | + if (!root) { return } | ||
| 10668 | + isStaticKey = genStaticKeysCached(options.staticKeys || ''); | ||
| 10669 | + isPlatformReservedTag = options.isReservedTag || no; | ||
| 10670 | + // first pass: mark all non-static nodes. | ||
| 10671 | + markStatic$1(root); | ||
| 10672 | + // second pass: mark static roots. | ||
| 10673 | + markStaticRoots(root, false); | ||
| 10674 | + } | ||
| 10675 | + | ||
| 10676 | + function genStaticKeys$1 (keys) { | ||
| 10677 | + return makeMap( | ||
| 10678 | + 'type,tag,attrsList,attrsMap,plain,parent,children,attrs,start,end,rawAttrsMap' + | ||
| 10679 | + (keys ? ',' + keys : '') | ||
| 10680 | + ) | ||
| 10681 | + } | ||
| 10682 | + | ||
| 10683 | + function markStatic$1 (node) { | ||
| 10684 | + node.static = isStatic(node); | ||
| 10685 | + if (node.type === 1) { | ||
| 10686 | + // do not make component slot content static. this avoids | ||
| 10687 | + // 1. components not able to mutate slot nodes | ||
| 10688 | + // 2. static slot content fails for hot-reloading | ||
| 10689 | + if ( | ||
| 10690 | + !isPlatformReservedTag(node.tag) && | ||
| 10691 | + node.tag !== 'slot' && | ||
| 10692 | + node.attrsMap['inline-template'] == null | ||
| 10693 | + ) { | ||
| 10694 | + return | ||
| 10695 | + } | ||
| 10696 | + for (var i = 0, l = node.children.length; i < l; i++) { | ||
| 10697 | + var child = node.children[i]; | ||
| 10698 | + markStatic$1(child); | ||
| 10699 | + if (!child.static) { | ||
| 10700 | + node.static = false; | ||
| 10701 | + } | ||
| 10702 | + } | ||
| 10703 | + if (node.ifConditions) { | ||
| 10704 | + for (var i$1 = 1, l$1 = node.ifConditions.length; i$1 < l$1; i$1++) { | ||
| 10705 | + var block = node.ifConditions[i$1].block; | ||
| 10706 | + markStatic$1(block); | ||
| 10707 | + if (!block.static) { | ||
| 10708 | + node.static = false; | ||
| 10709 | + } | ||
| 10710 | + } | ||
| 10711 | + } | ||
| 10712 | + } | ||
| 10713 | + } | ||
| 10714 | + | ||
| 10715 | + function markStaticRoots (node, isInFor) { | ||
| 10716 | + if (node.type === 1) { | ||
| 10717 | + if (node.static || node.once) { | ||
| 10718 | + node.staticInFor = isInFor; | ||
| 10719 | + } | ||
| 10720 | + // For a node to qualify as a static root, it should have children that | ||
| 10721 | + // are not just static text. Otherwise the cost of hoisting out will | ||
| 10722 | + // outweigh the benefits and it's better off to just always render it fresh. | ||
| 10723 | + if (node.static && node.children.length && !( | ||
| 10724 | + node.children.length === 1 && | ||
| 10725 | + node.children[0].type === 3 | ||
| 10726 | + )) { | ||
| 10727 | + node.staticRoot = true; | ||
| 10728 | + return | ||
| 10729 | + } else { | ||
| 10730 | + node.staticRoot = false; | ||
| 10731 | + } | ||
| 10732 | + if (node.children) { | ||
| 10733 | + for (var i = 0, l = node.children.length; i < l; i++) { | ||
| 10734 | + markStaticRoots(node.children[i], isInFor || !!node.for); | ||
| 10735 | + } | ||
| 10736 | + } | ||
| 10737 | + if (node.ifConditions) { | ||
| 10738 | + for (var i$1 = 1, l$1 = node.ifConditions.length; i$1 < l$1; i$1++) { | ||
| 10739 | + markStaticRoots(node.ifConditions[i$1].block, isInFor); | ||
| 10740 | + } | ||
| 10741 | + } | ||
| 10742 | + } | ||
| 10743 | + } | ||
| 10744 | + | ||
| 10745 | + function isStatic (node) { | ||
| 10746 | + if (node.type === 2) { // expression | ||
| 10747 | + return false | ||
| 10748 | + } | ||
| 10749 | + if (node.type === 3) { // text | ||
| 10750 | + return true | ||
| 10751 | + } | ||
| 10752 | + return !!(node.pre || ( | ||
| 10753 | + !node.hasBindings && // no dynamic bindings | ||
| 10754 | + !node.if && !node.for && // not v-if or v-for or v-else | ||
| 10755 | + !isBuiltInTag(node.tag) && // not a built-in | ||
| 10756 | + isPlatformReservedTag(node.tag) && // not a component | ||
| 10757 | + !isDirectChildOfTemplateFor(node) && | ||
| 10758 | + Object.keys(node).every(isStaticKey) | ||
| 10759 | + )) | ||
| 10760 | + } | ||
| 10761 | + | ||
| 10762 | + function isDirectChildOfTemplateFor (node) { | ||
| 10763 | + while (node.parent) { | ||
| 10764 | + node = node.parent; | ||
| 10765 | + if (node.tag !== 'template') { | ||
| 10766 | + return false | ||
| 10767 | + } | ||
| 10768 | + if (node.for) { | ||
| 10769 | + return true | ||
| 10770 | + } | ||
| 10771 | + } | ||
| 10772 | + return false | ||
| 10773 | + } | ||
| 10774 | + | ||
| 10775 | + /* */ | ||
| 10776 | + | ||
| 10777 | + var fnExpRE = /^([\w$_]+|\([^)]*?\))\s*=>|^function(?:\s+[\w$]+)?\s*\(/; | ||
| 10778 | + var fnInvokeRE = /\([^)]*?\);*$/; | ||
| 10779 | + var simplePathRE = /^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*|\['[^']*?']|\["[^"]*?"]|\[\d+]|\[[A-Za-z_$][\w$]*])*$/; | ||
| 10780 | + | ||
| 10781 | + // KeyboardEvent.keyCode aliases | ||
| 10782 | + var keyCodes = { | ||
| 10783 | + esc: 27, | ||
| 10784 | + tab: 9, | ||
| 10785 | + enter: 13, | ||
| 10786 | + space: 32, | ||
| 10787 | + up: 38, | ||
| 10788 | + left: 37, | ||
| 10789 | + right: 39, | ||
| 10790 | + down: 40, | ||
| 10791 | + 'delete': [8, 46] | ||
| 10792 | + }; | ||
| 10793 | + | ||
| 10794 | + // KeyboardEvent.key aliases | ||
| 10795 | + var keyNames = { | ||
| 10796 | + // #7880: IE11 and Edge use `Esc` for Escape key name. | ||
| 10797 | + esc: ['Esc', 'Escape'], | ||
| 10798 | + tab: 'Tab', | ||
| 10799 | + enter: 'Enter', | ||
| 10800 | + // #9112: IE11 uses `Spacebar` for Space key name. | ||
| 10801 | + space: [' ', 'Spacebar'], | ||
| 10802 | + // #7806: IE11 uses key names without `Arrow` prefix for arrow keys. | ||
| 10803 | + up: ['Up', 'ArrowUp'], | ||
| 10804 | + left: ['Left', 'ArrowLeft'], | ||
| 10805 | + right: ['Right', 'ArrowRight'], | ||
| 10806 | + down: ['Down', 'ArrowDown'], | ||
| 10807 | + // #9112: IE11 uses `Del` for Delete key name. | ||
| 10808 | + 'delete': ['Backspace', 'Delete', 'Del'] | ||
| 10809 | + }; | ||
| 10810 | + | ||
| 10811 | + // #4868: modifiers that prevent the execution of the listener | ||
| 10812 | + // need to explicitly return null so that we can determine whether to remove | ||
| 10813 | + // the listener for .once | ||
| 10814 | + var genGuard = function (condition) { return ("if(" + condition + ")return null;"); }; | ||
| 10815 | + | ||
| 10816 | + var modifierCode = { | ||
| 10817 | + stop: '$event.stopPropagation();', | ||
| 10818 | + prevent: '$event.preventDefault();', | ||
| 10819 | + self: genGuard("$event.target !== $event.currentTarget"), | ||
| 10820 | + ctrl: genGuard("!$event.ctrlKey"), | ||
| 10821 | + shift: genGuard("!$event.shiftKey"), | ||
| 10822 | + alt: genGuard("!$event.altKey"), | ||
| 10823 | + meta: genGuard("!$event.metaKey"), | ||
| 10824 | + left: genGuard("'button' in $event && $event.button !== 0"), | ||
| 10825 | + middle: genGuard("'button' in $event && $event.button !== 1"), | ||
| 10826 | + right: genGuard("'button' in $event && $event.button !== 2") | ||
| 10827 | + }; | ||
| 10828 | + | ||
| 10829 | + function genHandlers ( | ||
| 10830 | + events, | ||
| 10831 | + isNative | ||
| 10832 | + ) { | ||
| 10833 | + var prefix = isNative ? 'nativeOn:' : 'on:'; | ||
| 10834 | + var staticHandlers = ""; | ||
| 10835 | + var dynamicHandlers = ""; | ||
| 10836 | + for (var name in events) { | ||
| 10837 | + var handlerCode = genHandler(events[name]); | ||
| 10838 | + if (events[name] && events[name].dynamic) { | ||
| 10839 | + dynamicHandlers += name + "," + handlerCode + ","; | ||
| 10840 | + } else { | ||
| 10841 | + staticHandlers += "\"" + name + "\":" + handlerCode + ","; | ||
| 10842 | + } | ||
| 10843 | + } | ||
| 10844 | + staticHandlers = "{" + (staticHandlers.slice(0, -1)) + "}"; | ||
| 10845 | + if (dynamicHandlers) { | ||
| 10846 | + return prefix + "_d(" + staticHandlers + ",[" + (dynamicHandlers.slice(0, -1)) + "])" | ||
| 10847 | + } else { | ||
| 10848 | + return prefix + staticHandlers | ||
| 10849 | + } | ||
| 10850 | + } | ||
| 10851 | + | ||
| 10852 | + function genHandler (handler) { | ||
| 10853 | + if (!handler) { | ||
| 10854 | + return 'function(){}' | ||
| 10855 | + } | ||
| 10856 | + | ||
| 10857 | + if (Array.isArray(handler)) { | ||
| 10858 | + return ("[" + (handler.map(function (handler) { return genHandler(handler); }).join(',')) + "]") | ||
| 10859 | + } | ||
| 10860 | + | ||
| 10861 | + var isMethodPath = simplePathRE.test(handler.value); | ||
| 10862 | + var isFunctionExpression = fnExpRE.test(handler.value); | ||
| 10863 | + var isFunctionInvocation = simplePathRE.test(handler.value.replace(fnInvokeRE, '')); | ||
| 10864 | + | ||
| 10865 | + if (!handler.modifiers) { | ||
| 10866 | + if (isMethodPath || isFunctionExpression) { | ||
| 10867 | + return handler.value | ||
| 10868 | + } | ||
| 10869 | + return ("function($event){" + (isFunctionInvocation ? ("return " + (handler.value)) : handler.value) + "}") // inline statement | ||
| 10870 | + } else { | ||
| 10871 | + var code = ''; | ||
| 10872 | + var genModifierCode = ''; | ||
| 10873 | + var keys = []; | ||
| 10874 | + for (var key in handler.modifiers) { | ||
| 10875 | + if (modifierCode[key]) { | ||
| 10876 | + genModifierCode += modifierCode[key]; | ||
| 10877 | + // left/right | ||
| 10878 | + if (keyCodes[key]) { | ||
| 10879 | + keys.push(key); | ||
| 10880 | + } | ||
| 10881 | + } else if (key === 'exact') { | ||
| 10882 | + var modifiers = (handler.modifiers); | ||
| 10883 | + genModifierCode += genGuard( | ||
| 10884 | + ['ctrl', 'shift', 'alt', 'meta'] | ||
| 10885 | + .filter(function (keyModifier) { return !modifiers[keyModifier]; }) | ||
| 10886 | + .map(function (keyModifier) { return ("$event." + keyModifier + "Key"); }) | ||
| 10887 | + .join('||') | ||
| 10888 | + ); | ||
| 10889 | + } else { | ||
| 10890 | + keys.push(key); | ||
| 10891 | + } | ||
| 10892 | + } | ||
| 10893 | + if (keys.length) { | ||
| 10894 | + code += genKeyFilter(keys); | ||
| 10895 | + } | ||
| 10896 | + // Make sure modifiers like prevent and stop get executed after key filtering | ||
| 10897 | + if (genModifierCode) { | ||
| 10898 | + code += genModifierCode; | ||
| 10899 | + } | ||
| 10900 | + var handlerCode = isMethodPath | ||
| 10901 | + ? ("return " + (handler.value) + ".apply(null, arguments)") | ||
| 10902 | + : isFunctionExpression | ||
| 10903 | + ? ("return (" + (handler.value) + ").apply(null, arguments)") | ||
| 10904 | + : isFunctionInvocation | ||
| 10905 | + ? ("return " + (handler.value)) | ||
| 10906 | + : handler.value; | ||
| 10907 | + return ("function($event){" + code + handlerCode + "}") | ||
| 10908 | + } | ||
| 10909 | + } | ||
| 10910 | + | ||
| 10911 | + function genKeyFilter (keys) { | ||
| 10912 | + return ( | ||
| 10913 | + // make sure the key filters only apply to KeyboardEvents | ||
| 10914 | + // #9441: can't use 'keyCode' in $event because Chrome autofill fires fake | ||
| 10915 | + // key events that do not have keyCode property... | ||
| 10916 | + "if(!$event.type.indexOf('key')&&" + | ||
| 10917 | + (keys.map(genFilterCode).join('&&')) + ")return null;" | ||
| 10918 | + ) | ||
| 10919 | + } | ||
| 10920 | + | ||
| 10921 | + function genFilterCode (key) { | ||
| 10922 | + var keyVal = parseInt(key, 10); | ||
| 10923 | + if (keyVal) { | ||
| 10924 | + return ("$event.keyCode!==" + keyVal) | ||
| 10925 | + } | ||
| 10926 | + var keyCode = keyCodes[key]; | ||
| 10927 | + var keyName = keyNames[key]; | ||
| 10928 | + return ( | ||
| 10929 | + "_k($event.keyCode," + | ||
| 10930 | + (JSON.stringify(key)) + "," + | ||
| 10931 | + (JSON.stringify(keyCode)) + "," + | ||
| 10932 | + "$event.key," + | ||
| 10933 | + "" + (JSON.stringify(keyName)) + | ||
| 10934 | + ")" | ||
| 10935 | + ) | ||
| 10936 | + } | ||
| 10937 | + | ||
| 10938 | + /* */ | ||
| 10939 | + | ||
| 10940 | + function on (el, dir) { | ||
| 10941 | + if (dir.modifiers) { | ||
| 10942 | + warn("v-on without argument does not support modifiers."); | ||
| 10943 | + } | ||
| 10944 | + el.wrapListeners = function (code) { return ("_g(" + code + "," + (dir.value) + ")"); }; | ||
| 10945 | + } | ||
| 10946 | + | ||
| 10947 | + /* */ | ||
| 10948 | + | ||
| 10949 | + function bind$1 (el, dir) { | ||
| 10950 | + el.wrapData = function (code) { | ||
| 10951 | + return ("_b(" + code + ",'" + (el.tag) + "'," + (dir.value) + "," + (dir.modifiers && dir.modifiers.prop ? 'true' : 'false') + (dir.modifiers && dir.modifiers.sync ? ',true' : '') + ")") | ||
| 10952 | + }; | ||
| 10953 | + } | ||
| 10954 | + | ||
| 10955 | + /* */ | ||
| 10956 | + | ||
| 10957 | + var baseDirectives = { | ||
| 10958 | + on: on, | ||
| 10959 | + bind: bind$1, | ||
| 10960 | + cloak: noop | ||
| 10961 | + }; | ||
| 10962 | + | ||
| 10963 | + /* */ | ||
| 10964 | + | ||
| 10965 | + | ||
| 10966 | + | ||
| 10967 | + | ||
| 10968 | + | ||
| 10969 | + var CodegenState = function CodegenState (options) { | ||
| 10970 | + this.options = options; | ||
| 10971 | + this.warn = options.warn || baseWarn; | ||
| 10972 | + this.transforms = pluckModuleFunction(options.modules, 'transformCode'); | ||
| 10973 | + this.dataGenFns = pluckModuleFunction(options.modules, 'genData'); | ||
| 10974 | + this.directives = extend(extend({}, baseDirectives), options.directives); | ||
| 10975 | + var isReservedTag = options.isReservedTag || no; | ||
| 10976 | + this.maybeComponent = function (el) { return !!el.component || !isReservedTag(el.tag); }; | ||
| 10977 | + this.onceId = 0; | ||
| 10978 | + this.staticRenderFns = []; | ||
| 10979 | + this.pre = false; | ||
| 10980 | + }; | ||
| 10981 | + | ||
| 10982 | + | ||
| 10983 | + | ||
| 10984 | + function generate ( | ||
| 10985 | + ast, | ||
| 10986 | + options | ||
| 10987 | + ) { | ||
| 10988 | + var state = new CodegenState(options); | ||
| 10989 | + // fix #11483, Root level <script> tags should not be rendered. | ||
| 10990 | + var code = ast ? (ast.tag === 'script' ? 'null' : genElement(ast, state)) : '_c("div")'; | ||
| 10991 | + return { | ||
| 10992 | + render: ("with(this){return " + code + "}"), | ||
| 10993 | + staticRenderFns: state.staticRenderFns | ||
| 10994 | + } | ||
| 10995 | + } | ||
| 10996 | + | ||
| 10997 | + function genElement (el, state) { | ||
| 10998 | + if (el.parent) { | ||
| 10999 | + el.pre = el.pre || el.parent.pre; | ||
| 11000 | + } | ||
| 11001 | + | ||
| 11002 | + if (el.staticRoot && !el.staticProcessed) { | ||
| 11003 | + return genStatic(el, state) | ||
| 11004 | + } else if (el.once && !el.onceProcessed) { | ||
| 11005 | + return genOnce(el, state) | ||
| 11006 | + } else if (el.for && !el.forProcessed) { | ||
| 11007 | + return genFor(el, state) | ||
| 11008 | + } else if (el.if && !el.ifProcessed) { | ||
| 11009 | + return genIf(el, state) | ||
| 11010 | + } else if (el.tag === 'template' && !el.slotTarget && !state.pre) { | ||
| 11011 | + return genChildren(el, state) || 'void 0' | ||
| 11012 | + } else if (el.tag === 'slot') { | ||
| 11013 | + return genSlot(el, state) | ||
| 11014 | + } else { | ||
| 11015 | + // component or element | ||
| 11016 | + var code; | ||
| 11017 | + if (el.component) { | ||
| 11018 | + code = genComponent(el.component, el, state); | ||
| 11019 | + } else { | ||
| 11020 | + var data; | ||
| 11021 | + if (!el.plain || (el.pre && state.maybeComponent(el))) { | ||
| 11022 | + data = genData$2(el, state); | ||
| 11023 | + } | ||
| 11024 | + | ||
| 11025 | + var children = el.inlineTemplate ? null : genChildren(el, state, true); | ||
| 11026 | + code = "_c('" + (el.tag) + "'" + (data ? ("," + data) : '') + (children ? ("," + children) : '') + ")"; | ||
| 11027 | + } | ||
| 11028 | + // module transforms | ||
| 11029 | + for (var i = 0; i < state.transforms.length; i++) { | ||
| 11030 | + code = state.transforms[i](el, code); | ||
| 11031 | + } | ||
| 11032 | + return code | ||
| 11033 | + } | ||
| 11034 | + } | ||
| 11035 | + | ||
| 11036 | + // hoist static sub-trees out | ||
| 11037 | + function genStatic (el, state) { | ||
| 11038 | + el.staticProcessed = true; | ||
| 11039 | + // Some elements (templates) need to behave differently inside of a v-pre | ||
| 11040 | + // node. All pre nodes are static roots, so we can use this as a location to | ||
| 11041 | + // wrap a state change and reset it upon exiting the pre node. | ||
| 11042 | + var originalPreState = state.pre; | ||
| 11043 | + if (el.pre) { | ||
| 11044 | + state.pre = el.pre; | ||
| 11045 | + } | ||
| 11046 | + state.staticRenderFns.push(("with(this){return " + (genElement(el, state)) + "}")); | ||
| 11047 | + state.pre = originalPreState; | ||
| 11048 | + return ("_m(" + (state.staticRenderFns.length - 1) + (el.staticInFor ? ',true' : '') + ")") | ||
| 11049 | + } | ||
| 11050 | + | ||
| 11051 | + // v-once | ||
| 11052 | + function genOnce (el, state) { | ||
| 11053 | + el.onceProcessed = true; | ||
| 11054 | + if (el.if && !el.ifProcessed) { | ||
| 11055 | + return genIf(el, state) | ||
| 11056 | + } else if (el.staticInFor) { | ||
| 11057 | + var key = ''; | ||
| 11058 | + var parent = el.parent; | ||
| 11059 | + while (parent) { | ||
| 11060 | + if (parent.for) { | ||
| 11061 | + key = parent.key; | ||
| 11062 | + break | ||
| 11063 | + } | ||
| 11064 | + parent = parent.parent; | ||
| 11065 | + } | ||
| 11066 | + if (!key) { | ||
| 11067 | + state.warn( | ||
| 11068 | + "v-once can only be used inside v-for that is keyed. ", | ||
| 11069 | + el.rawAttrsMap['v-once'] | ||
| 11070 | + ); | ||
| 11071 | + return genElement(el, state) | ||
| 11072 | + } | ||
| 11073 | + return ("_o(" + (genElement(el, state)) + "," + (state.onceId++) + "," + key + ")") | ||
| 11074 | + } else { | ||
| 11075 | + return genStatic(el, state) | ||
| 11076 | + } | ||
| 11077 | + } | ||
| 11078 | + | ||
| 11079 | + function genIf ( | ||
| 11080 | + el, | ||
| 11081 | + state, | ||
| 11082 | + altGen, | ||
| 11083 | + altEmpty | ||
| 11084 | + ) { | ||
| 11085 | + el.ifProcessed = true; // avoid recursion | ||
| 11086 | + return genIfConditions(el.ifConditions.slice(), state, altGen, altEmpty) | ||
| 11087 | + } | ||
| 11088 | + | ||
| 11089 | + function genIfConditions ( | ||
| 11090 | + conditions, | ||
| 11091 | + state, | ||
| 11092 | + altGen, | ||
| 11093 | + altEmpty | ||
| 11094 | + ) { | ||
| 11095 | + if (!conditions.length) { | ||
| 11096 | + return altEmpty || '_e()' | ||
| 11097 | + } | ||
| 11098 | + | ||
| 11099 | + var condition = conditions.shift(); | ||
| 11100 | + if (condition.exp) { | ||
| 11101 | + return ("(" + (condition.exp) + ")?" + (genTernaryExp(condition.block)) + ":" + (genIfConditions(conditions, state, altGen, altEmpty))) | ||
| 11102 | + } else { | ||
| 11103 | + return ("" + (genTernaryExp(condition.block))) | ||
| 11104 | + } | ||
| 11105 | + | ||
| 11106 | + // v-if with v-once should generate code like (a)?_m(0):_m(1) | ||
| 11107 | + function genTernaryExp (el) { | ||
| 11108 | + return altGen | ||
| 11109 | + ? altGen(el, state) | ||
| 11110 | + : el.once | ||
| 11111 | + ? genOnce(el, state) | ||
| 11112 | + : genElement(el, state) | ||
| 11113 | + } | ||
| 11114 | + } | ||
| 11115 | + | ||
| 11116 | + function genFor ( | ||
| 11117 | + el, | ||
| 11118 | + state, | ||
| 11119 | + altGen, | ||
| 11120 | + altHelper | ||
| 11121 | + ) { | ||
| 11122 | + var exp = el.for; | ||
| 11123 | + var alias = el.alias; | ||
| 11124 | + var iterator1 = el.iterator1 ? ("," + (el.iterator1)) : ''; | ||
| 11125 | + var iterator2 = el.iterator2 ? ("," + (el.iterator2)) : ''; | ||
| 11126 | + | ||
| 11127 | + if (state.maybeComponent(el) && | ||
| 11128 | + el.tag !== 'slot' && | ||
| 11129 | + el.tag !== 'template' && | ||
| 11130 | + !el.key | ||
| 11131 | + ) { | ||
| 11132 | + state.warn( | ||
| 11133 | + "<" + (el.tag) + " v-for=\"" + alias + " in " + exp + "\">: component lists rendered with " + | ||
| 11134 | + "v-for should have explicit keys. " + | ||
| 11135 | + "See https://vuejs.org/guide/list.html#key for more info.", | ||
| 11136 | + el.rawAttrsMap['v-for'], | ||
| 11137 | + true /* tip */ | ||
| 11138 | + ); | ||
| 11139 | + } | ||
| 11140 | + | ||
| 11141 | + el.forProcessed = true; // avoid recursion | ||
| 11142 | + return (altHelper || '_l') + "((" + exp + ")," + | ||
| 11143 | + "function(" + alias + iterator1 + iterator2 + "){" + | ||
| 11144 | + "return " + ((altGen || genElement)(el, state)) + | ||
| 11145 | + '})' | ||
| 11146 | + } | ||
| 11147 | + | ||
| 11148 | + function genData$2 (el, state) { | ||
| 11149 | + var data = '{'; | ||
| 11150 | + | ||
| 11151 | + // directives first. | ||
| 11152 | + // directives may mutate the el's other properties before they are generated. | ||
| 11153 | + var dirs = genDirectives(el, state); | ||
| 11154 | + if (dirs) { data += dirs + ','; } | ||
| 11155 | + | ||
| 11156 | + // key | ||
| 11157 | + if (el.key) { | ||
| 11158 | + data += "key:" + (el.key) + ","; | ||
| 11159 | + } | ||
| 11160 | + // ref | ||
| 11161 | + if (el.ref) { | ||
| 11162 | + data += "ref:" + (el.ref) + ","; | ||
| 11163 | + } | ||
| 11164 | + if (el.refInFor) { | ||
| 11165 | + data += "refInFor:true,"; | ||
| 11166 | + } | ||
| 11167 | + // pre | ||
| 11168 | + if (el.pre) { | ||
| 11169 | + data += "pre:true,"; | ||
| 11170 | + } | ||
| 11171 | + // record original tag name for components using "is" attribute | ||
| 11172 | + if (el.component) { | ||
| 11173 | + data += "tag:\"" + (el.tag) + "\","; | ||
| 11174 | + } | ||
| 11175 | + // module data generation functions | ||
| 11176 | + for (var i = 0; i < state.dataGenFns.length; i++) { | ||
| 11177 | + data += state.dataGenFns[i](el); | ||
| 11178 | + } | ||
| 11179 | + // attributes | ||
| 11180 | + if (el.attrs) { | ||
| 11181 | + data += "attrs:" + (genProps(el.attrs)) + ","; | ||
| 11182 | + } | ||
| 11183 | + // DOM props | ||
| 11184 | + if (el.props) { | ||
| 11185 | + data += "domProps:" + (genProps(el.props)) + ","; | ||
| 11186 | + } | ||
| 11187 | + // event handlers | ||
| 11188 | + if (el.events) { | ||
| 11189 | + data += (genHandlers(el.events, false)) + ","; | ||
| 11190 | + } | ||
| 11191 | + if (el.nativeEvents) { | ||
| 11192 | + data += (genHandlers(el.nativeEvents, true)) + ","; | ||
| 11193 | + } | ||
| 11194 | + // slot target | ||
| 11195 | + // only for non-scoped slots | ||
| 11196 | + if (el.slotTarget && !el.slotScope) { | ||
| 11197 | + data += "slot:" + (el.slotTarget) + ","; | ||
| 11198 | + } | ||
| 11199 | + // scoped slots | ||
| 11200 | + if (el.scopedSlots) { | ||
| 11201 | + data += (genScopedSlots(el, el.scopedSlots, state)) + ","; | ||
| 11202 | + } | ||
| 11203 | + // component v-model | ||
| 11204 | + if (el.model) { | ||
| 11205 | + data += "model:{value:" + (el.model.value) + ",callback:" + (el.model.callback) + ",expression:" + (el.model.expression) + "},"; | ||
| 11206 | + } | ||
| 11207 | + // inline-template | ||
| 11208 | + if (el.inlineTemplate) { | ||
| 11209 | + var inlineTemplate = genInlineTemplate(el, state); | ||
| 11210 | + if (inlineTemplate) { | ||
| 11211 | + data += inlineTemplate + ","; | ||
| 11212 | + } | ||
| 11213 | + } | ||
| 11214 | + data = data.replace(/,$/, '') + '}'; | ||
| 11215 | + // v-bind dynamic argument wrap | ||
| 11216 | + // v-bind with dynamic arguments must be applied using the same v-bind object | ||
| 11217 | + // merge helper so that class/style/mustUseProp attrs are handled correctly. | ||
| 11218 | + if (el.dynamicAttrs) { | ||
| 11219 | + data = "_b(" + data + ",\"" + (el.tag) + "\"," + (genProps(el.dynamicAttrs)) + ")"; | ||
| 11220 | + } | ||
| 11221 | + // v-bind data wrap | ||
| 11222 | + if (el.wrapData) { | ||
| 11223 | + data = el.wrapData(data); | ||
| 11224 | + } | ||
| 11225 | + // v-on data wrap | ||
| 11226 | + if (el.wrapListeners) { | ||
| 11227 | + data = el.wrapListeners(data); | ||
| 11228 | + } | ||
| 11229 | + return data | ||
| 11230 | + } | ||
| 11231 | + | ||
| 11232 | + function genDirectives (el, state) { | ||
| 11233 | + var dirs = el.directives; | ||
| 11234 | + if (!dirs) { return } | ||
| 11235 | + var res = 'directives:['; | ||
| 11236 | + var hasRuntime = false; | ||
| 11237 | + var i, l, dir, needRuntime; | ||
| 11238 | + for (i = 0, l = dirs.length; i < l; i++) { | ||
| 11239 | + dir = dirs[i]; | ||
| 11240 | + needRuntime = true; | ||
| 11241 | + var gen = state.directives[dir.name]; | ||
| 11242 | + if (gen) { | ||
| 11243 | + // compile-time directive that manipulates AST. | ||
| 11244 | + // returns true if it also needs a runtime counterpart. | ||
| 11245 | + needRuntime = !!gen(el, dir, state.warn); | ||
| 11246 | + } | ||
| 11247 | + if (needRuntime) { | ||
| 11248 | + hasRuntime = true; | ||
| 11249 | + res += "{name:\"" + (dir.name) + "\",rawName:\"" + (dir.rawName) + "\"" + (dir.value ? (",value:(" + (dir.value) + "),expression:" + (JSON.stringify(dir.value))) : '') + (dir.arg ? (",arg:" + (dir.isDynamicArg ? dir.arg : ("\"" + (dir.arg) + "\""))) : '') + (dir.modifiers ? (",modifiers:" + (JSON.stringify(dir.modifiers))) : '') + "},"; | ||
| 11250 | + } | ||
| 11251 | + } | ||
| 11252 | + if (hasRuntime) { | ||
| 11253 | + return res.slice(0, -1) + ']' | ||
| 11254 | + } | ||
| 11255 | + } | ||
| 11256 | + | ||
| 11257 | + function genInlineTemplate (el, state) { | ||
| 11258 | + var ast = el.children[0]; | ||
| 11259 | + if (el.children.length !== 1 || ast.type !== 1) { | ||
| 11260 | + state.warn( | ||
| 11261 | + 'Inline-template components must have exactly one child element.', | ||
| 11262 | + { start: el.start } | ||
| 11263 | + ); | ||
| 11264 | + } | ||
| 11265 | + if (ast && ast.type === 1) { | ||
| 11266 | + var inlineRenderFns = generate(ast, state.options); | ||
| 11267 | + return ("inlineTemplate:{render:function(){" + (inlineRenderFns.render) + "},staticRenderFns:[" + (inlineRenderFns.staticRenderFns.map(function (code) { return ("function(){" + code + "}"); }).join(',')) + "]}") | ||
| 11268 | + } | ||
| 11269 | + } | ||
| 11270 | + | ||
| 11271 | + function genScopedSlots ( | ||
| 11272 | + el, | ||
| 11273 | + slots, | ||
| 11274 | + state | ||
| 11275 | + ) { | ||
| 11276 | + // by default scoped slots are considered "stable", this allows child | ||
| 11277 | + // components with only scoped slots to skip forced updates from parent. | ||
| 11278 | + // but in some cases we have to bail-out of this optimization | ||
| 11279 | + // for example if the slot contains dynamic names, has v-if or v-for on them... | ||
| 11280 | + var needsForceUpdate = el.for || Object.keys(slots).some(function (key) { | ||
| 11281 | + var slot = slots[key]; | ||
| 11282 | + return ( | ||
| 11283 | + slot.slotTargetDynamic || | ||
| 11284 | + slot.if || | ||
| 11285 | + slot.for || | ||
| 11286 | + containsSlotChild(slot) // is passing down slot from parent which may be dynamic | ||
| 11287 | + ) | ||
| 11288 | + }); | ||
| 11289 | + | ||
| 11290 | + // #9534: if a component with scoped slots is inside a conditional branch, | ||
| 11291 | + // it's possible for the same component to be reused but with different | ||
| 11292 | + // compiled slot content. To avoid that, we generate a unique key based on | ||
| 11293 | + // the generated code of all the slot contents. | ||
| 11294 | + var needsKey = !!el.if; | ||
| 11295 | + | ||
| 11296 | + // OR when it is inside another scoped slot or v-for (the reactivity may be | ||
| 11297 | + // disconnected due to the intermediate scope variable) | ||
| 11298 | + // #9438, #9506 | ||
| 11299 | + // TODO: this can be further optimized by properly analyzing in-scope bindings | ||
| 11300 | + // and skip force updating ones that do not actually use scope variables. | ||
| 11301 | + if (!needsForceUpdate) { | ||
| 11302 | + var parent = el.parent; | ||
| 11303 | + while (parent) { | ||
| 11304 | + if ( | ||
| 11305 | + (parent.slotScope && parent.slotScope !== emptySlotScopeToken) || | ||
| 11306 | + parent.for | ||
| 11307 | + ) { | ||
| 11308 | + needsForceUpdate = true; | ||
| 11309 | + break | ||
| 11310 | + } | ||
| 11311 | + if (parent.if) { | ||
| 11312 | + needsKey = true; | ||
| 11313 | + } | ||
| 11314 | + parent = parent.parent; | ||
| 11315 | + } | ||
| 11316 | + } | ||
| 11317 | + | ||
| 11318 | + var generatedSlots = Object.keys(slots) | ||
| 11319 | + .map(function (key) { return genScopedSlot(slots[key], state); }) | ||
| 11320 | + .join(','); | ||
| 11321 | + | ||
| 11322 | + return ("scopedSlots:_u([" + generatedSlots + "]" + (needsForceUpdate ? ",null,true" : "") + (!needsForceUpdate && needsKey ? (",null,false," + (hash(generatedSlots))) : "") + ")") | ||
| 11323 | + } | ||
| 11324 | + | ||
| 11325 | + function hash(str) { | ||
| 11326 | + var hash = 5381; | ||
| 11327 | + var i = str.length; | ||
| 11328 | + while(i) { | ||
| 11329 | + hash = (hash * 33) ^ str.charCodeAt(--i); | ||
| 11330 | + } | ||
| 11331 | + return hash >>> 0 | ||
| 11332 | + } | ||
| 11333 | + | ||
| 11334 | + function containsSlotChild (el) { | ||
| 11335 | + if (el.type === 1) { | ||
| 11336 | + if (el.tag === 'slot') { | ||
| 11337 | + return true | ||
| 11338 | + } | ||
| 11339 | + return el.children.some(containsSlotChild) | ||
| 11340 | + } | ||
| 11341 | + return false | ||
| 11342 | + } | ||
| 11343 | + | ||
| 11344 | + function genScopedSlot ( | ||
| 11345 | + el, | ||
| 11346 | + state | ||
| 11347 | + ) { | ||
| 11348 | + var isLegacySyntax = el.attrsMap['slot-scope']; | ||
| 11349 | + if (el.if && !el.ifProcessed && !isLegacySyntax) { | ||
| 11350 | + return genIf(el, state, genScopedSlot, "null") | ||
| 11351 | + } | ||
| 11352 | + if (el.for && !el.forProcessed) { | ||
| 11353 | + return genFor(el, state, genScopedSlot) | ||
| 11354 | + } | ||
| 11355 | + var slotScope = el.slotScope === emptySlotScopeToken | ||
| 11356 | + ? "" | ||
| 11357 | + : String(el.slotScope); | ||
| 11358 | + var fn = "function(" + slotScope + "){" + | ||
| 11359 | + "return " + (el.tag === 'template' | ||
| 11360 | + ? el.if && isLegacySyntax | ||
| 11361 | + ? ("(" + (el.if) + ")?" + (genChildren(el, state) || 'undefined') + ":undefined") | ||
| 11362 | + : genChildren(el, state) || 'undefined' | ||
| 11363 | + : genElement(el, state)) + "}"; | ||
| 11364 | + // reverse proxy v-slot without scope on this.$slots | ||
| 11365 | + var reverseProxy = slotScope ? "" : ",proxy:true"; | ||
| 11366 | + return ("{key:" + (el.slotTarget || "\"default\"") + ",fn:" + fn + reverseProxy + "}") | ||
| 11367 | + } | ||
| 11368 | + | ||
| 11369 | + function genChildren ( | ||
| 11370 | + el, | ||
| 11371 | + state, | ||
| 11372 | + checkSkip, | ||
| 11373 | + altGenElement, | ||
| 11374 | + altGenNode | ||
| 11375 | + ) { | ||
| 11376 | + var children = el.children; | ||
| 11377 | + if (children.length) { | ||
| 11378 | + var el$1 = children[0]; | ||
| 11379 | + // optimize single v-for | ||
| 11380 | + if (children.length === 1 && | ||
| 11381 | + el$1.for && | ||
| 11382 | + el$1.tag !== 'template' && | ||
| 11383 | + el$1.tag !== 'slot' | ||
| 11384 | + ) { | ||
| 11385 | + var normalizationType = checkSkip | ||
| 11386 | + ? state.maybeComponent(el$1) ? ",1" : ",0" | ||
| 11387 | + : ""; | ||
| 11388 | + return ("" + ((altGenElement || genElement)(el$1, state)) + normalizationType) | ||
| 11389 | + } | ||
| 11390 | + var normalizationType$1 = checkSkip | ||
| 11391 | + ? getNormalizationType(children, state.maybeComponent) | ||
| 11392 | + : 0; | ||
| 11393 | + var gen = altGenNode || genNode; | ||
| 11394 | + return ("[" + (children.map(function (c) { return gen(c, state); }).join(',')) + "]" + (normalizationType$1 ? ("," + normalizationType$1) : '')) | ||
| 11395 | + } | ||
| 11396 | + } | ||
| 11397 | + | ||
| 11398 | + // determine the normalization needed for the children array. | ||
| 11399 | + // 0: no normalization needed | ||
| 11400 | + // 1: simple normalization needed (possible 1-level deep nested array) | ||
| 11401 | + // 2: full normalization needed | ||
| 11402 | + function getNormalizationType ( | ||
| 11403 | + children, | ||
| 11404 | + maybeComponent | ||
| 11405 | + ) { | ||
| 11406 | + var res = 0; | ||
| 11407 | + for (var i = 0; i < children.length; i++) { | ||
| 11408 | + var el = children[i]; | ||
| 11409 | + if (el.type !== 1) { | ||
| 11410 | + continue | ||
| 11411 | + } | ||
| 11412 | + if (needsNormalization(el) || | ||
| 11413 | + (el.ifConditions && el.ifConditions.some(function (c) { return needsNormalization(c.block); }))) { | ||
| 11414 | + res = 2; | ||
| 11415 | + break | ||
| 11416 | + } | ||
| 11417 | + if (maybeComponent(el) || | ||
| 11418 | + (el.ifConditions && el.ifConditions.some(function (c) { return maybeComponent(c.block); }))) { | ||
| 11419 | + res = 1; | ||
| 11420 | + } | ||
| 11421 | + } | ||
| 11422 | + return res | ||
| 11423 | + } | ||
| 11424 | + | ||
| 11425 | + function needsNormalization (el) { | ||
| 11426 | + return el.for !== undefined || el.tag === 'template' || el.tag === 'slot' | ||
| 11427 | + } | ||
| 11428 | + | ||
| 11429 | + function genNode (node, state) { | ||
| 11430 | + if (node.type === 1) { | ||
| 11431 | + return genElement(node, state) | ||
| 11432 | + } else if (node.type === 3 && node.isComment) { | ||
| 11433 | + return genComment(node) | ||
| 11434 | + } else { | ||
| 11435 | + return genText(node) | ||
| 11436 | + } | ||
| 11437 | + } | ||
| 11438 | + | ||
| 11439 | + function genText (text) { | ||
| 11440 | + return ("_v(" + (text.type === 2 | ||
| 11441 | + ? text.expression // no need for () because already wrapped in _s() | ||
| 11442 | + : transformSpecialNewlines(JSON.stringify(text.text))) + ")") | ||
| 11443 | + } | ||
| 11444 | + | ||
| 11445 | + function genComment (comment) { | ||
| 11446 | + return ("_e(" + (JSON.stringify(comment.text)) + ")") | ||
| 11447 | + } | ||
| 11448 | + | ||
| 11449 | + function genSlot (el, state) { | ||
| 11450 | + var slotName = el.slotName || '"default"'; | ||
| 11451 | + var children = genChildren(el, state); | ||
| 11452 | + var res = "_t(" + slotName + (children ? (",function(){return " + children + "}") : ''); | ||
| 11453 | + var attrs = el.attrs || el.dynamicAttrs | ||
| 11454 | + ? genProps((el.attrs || []).concat(el.dynamicAttrs || []).map(function (attr) { return ({ | ||
| 11455 | + // slot props are camelized | ||
| 11456 | + name: camelize(attr.name), | ||
| 11457 | + value: attr.value, | ||
| 11458 | + dynamic: attr.dynamic | ||
| 11459 | + }); })) | ||
| 11460 | + : null; | ||
| 11461 | + var bind$$1 = el.attrsMap['v-bind']; | ||
| 11462 | + if ((attrs || bind$$1) && !children) { | ||
| 11463 | + res += ",null"; | ||
| 11464 | + } | ||
| 11465 | + if (attrs) { | ||
| 11466 | + res += "," + attrs; | ||
| 11467 | + } | ||
| 11468 | + if (bind$$1) { | ||
| 11469 | + res += (attrs ? '' : ',null') + "," + bind$$1; | ||
| 11470 | + } | ||
| 11471 | + return res + ')' | ||
| 11472 | + } | ||
| 11473 | + | ||
| 11474 | + // componentName is el.component, take it as argument to shun flow's pessimistic refinement | ||
| 11475 | + function genComponent ( | ||
| 11476 | + componentName, | ||
| 11477 | + el, | ||
| 11478 | + state | ||
| 11479 | + ) { | ||
| 11480 | + var children = el.inlineTemplate ? null : genChildren(el, state, true); | ||
| 11481 | + return ("_c(" + componentName + "," + (genData$2(el, state)) + (children ? ("," + children) : '') + ")") | ||
| 11482 | + } | ||
| 11483 | + | ||
| 11484 | + function genProps (props) { | ||
| 11485 | + var staticProps = ""; | ||
| 11486 | + var dynamicProps = ""; | ||
| 11487 | + for (var i = 0; i < props.length; i++) { | ||
| 11488 | + var prop = props[i]; | ||
| 11489 | + var value = transformSpecialNewlines(prop.value); | ||
| 11490 | + if (prop.dynamic) { | ||
| 11491 | + dynamicProps += (prop.name) + "," + value + ","; | ||
| 11492 | + } else { | ||
| 11493 | + staticProps += "\"" + (prop.name) + "\":" + value + ","; | ||
| 11494 | + } | ||
| 11495 | + } | ||
| 11496 | + staticProps = "{" + (staticProps.slice(0, -1)) + "}"; | ||
| 11497 | + if (dynamicProps) { | ||
| 11498 | + return ("_d(" + staticProps + ",[" + (dynamicProps.slice(0, -1)) + "])") | ||
| 11499 | + } else { | ||
| 11500 | + return staticProps | ||
| 11501 | + } | ||
| 11502 | + } | ||
| 11503 | + | ||
| 11504 | + // #3895, #4268 | ||
| 11505 | + function transformSpecialNewlines (text) { | ||
| 11506 | + return text | ||
| 11507 | + .replace(/\u2028/g, '\\u2028') | ||
| 11508 | + .replace(/\u2029/g, '\\u2029') | ||
| 11509 | + } | ||
| 11510 | + | ||
| 11511 | + /* */ | ||
| 11512 | + | ||
| 11513 | + | ||
| 11514 | + | ||
| 11515 | + // these keywords should not appear inside expressions, but operators like | ||
| 11516 | + // typeof, instanceof and in are allowed | ||
| 11517 | + var prohibitedKeywordRE = new RegExp('\\b' + ( | ||
| 11518 | + 'do,if,for,let,new,try,var,case,else,with,await,break,catch,class,const,' + | ||
| 11519 | + 'super,throw,while,yield,delete,export,import,return,switch,default,' + | ||
| 11520 | + 'extends,finally,continue,debugger,function,arguments' | ||
| 11521 | + ).split(',').join('\\b|\\b') + '\\b'); | ||
| 11522 | + | ||
| 11523 | + // these unary operators should not be used as property/method names | ||
| 11524 | + var unaryOperatorsRE = new RegExp('\\b' + ( | ||
| 11525 | + 'delete,typeof,void' | ||
| 11526 | + ).split(',').join('\\s*\\([^\\)]*\\)|\\b') + '\\s*\\([^\\)]*\\)'); | ||
| 11527 | + | ||
| 11528 | + // strip strings in expressions | ||
| 11529 | + var stripStringRE = /'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"|`(?:[^`\\]|\\.)*\$\{|\}(?:[^`\\]|\\.)*`|`(?:[^`\\]|\\.)*`/g; | ||
| 11530 | + | ||
| 11531 | + // detect problematic expressions in a template | ||
| 11532 | + function detectErrors (ast, warn) { | ||
| 11533 | + if (ast) { | ||
| 11534 | + checkNode(ast, warn); | ||
| 11535 | + } | ||
| 11536 | + } | ||
| 11537 | + | ||
| 11538 | + function checkNode (node, warn) { | ||
| 11539 | + if (node.type === 1) { | ||
| 11540 | + for (var name in node.attrsMap) { | ||
| 11541 | + if (dirRE.test(name)) { | ||
| 11542 | + var value = node.attrsMap[name]; | ||
| 11543 | + if (value) { | ||
| 11544 | + var range = node.rawAttrsMap[name]; | ||
| 11545 | + if (name === 'v-for') { | ||
| 11546 | + checkFor(node, ("v-for=\"" + value + "\""), warn, range); | ||
| 11547 | + } else if (name === 'v-slot' || name[0] === '#') { | ||
| 11548 | + checkFunctionParameterExpression(value, (name + "=\"" + value + "\""), warn, range); | ||
| 11549 | + } else if (onRE.test(name)) { | ||
| 11550 | + checkEvent(value, (name + "=\"" + value + "\""), warn, range); | ||
| 11551 | + } else { | ||
| 11552 | + checkExpression(value, (name + "=\"" + value + "\""), warn, range); | ||
| 11553 | + } | ||
| 11554 | + } | ||
| 11555 | + } | ||
| 11556 | + } | ||
| 11557 | + if (node.children) { | ||
| 11558 | + for (var i = 0; i < node.children.length; i++) { | ||
| 11559 | + checkNode(node.children[i], warn); | ||
| 11560 | + } | ||
| 11561 | + } | ||
| 11562 | + } else if (node.type === 2) { | ||
| 11563 | + checkExpression(node.expression, node.text, warn, node); | ||
| 11564 | + } | ||
| 11565 | + } | ||
| 11566 | + | ||
| 11567 | + function checkEvent (exp, text, warn, range) { | ||
| 11568 | + var stripped = exp.replace(stripStringRE, ''); | ||
| 11569 | + var keywordMatch = stripped.match(unaryOperatorsRE); | ||
| 11570 | + if (keywordMatch && stripped.charAt(keywordMatch.index - 1) !== '$') { | ||
| 11571 | + warn( | ||
| 11572 | + "avoid using JavaScript unary operator as property name: " + | ||
| 11573 | + "\"" + (keywordMatch[0]) + "\" in expression " + (text.trim()), | ||
| 11574 | + range | ||
| 11575 | + ); | ||
| 11576 | + } | ||
| 11577 | + checkExpression(exp, text, warn, range); | ||
| 11578 | + } | ||
| 11579 | + | ||
| 11580 | + function checkFor (node, text, warn, range) { | ||
| 11581 | + checkExpression(node.for || '', text, warn, range); | ||
| 11582 | + checkIdentifier(node.alias, 'v-for alias', text, warn, range); | ||
| 11583 | + checkIdentifier(node.iterator1, 'v-for iterator', text, warn, range); | ||
| 11584 | + checkIdentifier(node.iterator2, 'v-for iterator', text, warn, range); | ||
| 11585 | + } | ||
| 11586 | + | ||
| 11587 | + function checkIdentifier ( | ||
| 11588 | + ident, | ||
| 11589 | + type, | ||
| 11590 | + text, | ||
| 11591 | + warn, | ||
| 11592 | + range | ||
| 11593 | + ) { | ||
| 11594 | + if (typeof ident === 'string') { | ||
| 11595 | + try { | ||
| 11596 | + new Function(("var " + ident + "=_")); | ||
| 11597 | + } catch (e) { | ||
| 11598 | + warn(("invalid " + type + " \"" + ident + "\" in expression: " + (text.trim())), range); | ||
| 11599 | + } | ||
| 11600 | + } | ||
| 11601 | + } | ||
| 11602 | + | ||
| 11603 | + function checkExpression (exp, text, warn, range) { | ||
| 11604 | + try { | ||
| 11605 | + new Function(("return " + exp)); | ||
| 11606 | + } catch (e) { | ||
| 11607 | + var keywordMatch = exp.replace(stripStringRE, '').match(prohibitedKeywordRE); | ||
| 11608 | + if (keywordMatch) { | ||
| 11609 | + warn( | ||
| 11610 | + "avoid using JavaScript keyword as property name: " + | ||
| 11611 | + "\"" + (keywordMatch[0]) + "\"\n Raw expression: " + (text.trim()), | ||
| 11612 | + range | ||
| 11613 | + ); | ||
| 11614 | + } else { | ||
| 11615 | + warn( | ||
| 11616 | + "invalid expression: " + (e.message) + " in\n\n" + | ||
| 11617 | + " " + exp + "\n\n" + | ||
| 11618 | + " Raw expression: " + (text.trim()) + "\n", | ||
| 11619 | + range | ||
| 11620 | + ); | ||
| 11621 | + } | ||
| 11622 | + } | ||
| 11623 | + } | ||
| 11624 | + | ||
| 11625 | + function checkFunctionParameterExpression (exp, text, warn, range) { | ||
| 11626 | + try { | ||
| 11627 | + new Function(exp, ''); | ||
| 11628 | + } catch (e) { | ||
| 11629 | + warn( | ||
| 11630 | + "invalid function parameter expression: " + (e.message) + " in\n\n" + | ||
| 11631 | + " " + exp + "\n\n" + | ||
| 11632 | + " Raw expression: " + (text.trim()) + "\n", | ||
| 11633 | + range | ||
| 11634 | + ); | ||
| 11635 | + } | ||
| 11636 | + } | ||
| 11637 | + | ||
| 11638 | + /* */ | ||
| 11639 | + | ||
| 11640 | + var range = 2; | ||
| 11641 | + | ||
| 11642 | + function generateCodeFrame ( | ||
| 11643 | + source, | ||
| 11644 | + start, | ||
| 11645 | + end | ||
| 11646 | + ) { | ||
| 11647 | + if ( start === void 0 ) start = 0; | ||
| 11648 | + if ( end === void 0 ) end = source.length; | ||
| 11649 | + | ||
| 11650 | + var lines = source.split(/\r?\n/); | ||
| 11651 | + var count = 0; | ||
| 11652 | + var res = []; | ||
| 11653 | + for (var i = 0; i < lines.length; i++) { | ||
| 11654 | + count += lines[i].length + 1; | ||
| 11655 | + if (count >= start) { | ||
| 11656 | + for (var j = i - range; j <= i + range || end > count; j++) { | ||
| 11657 | + if (j < 0 || j >= lines.length) { continue } | ||
| 11658 | + res.push(("" + (j + 1) + (repeat$1(" ", 3 - String(j + 1).length)) + "| " + (lines[j]))); | ||
| 11659 | + var lineLength = lines[j].length; | ||
| 11660 | + if (j === i) { | ||
| 11661 | + // push underline | ||
| 11662 | + var pad = start - (count - lineLength) + 1; | ||
| 11663 | + var length = end > count ? lineLength - pad : end - start; | ||
| 11664 | + res.push(" | " + repeat$1(" ", pad) + repeat$1("^", length)); | ||
| 11665 | + } else if (j > i) { | ||
| 11666 | + if (end > count) { | ||
| 11667 | + var length$1 = Math.min(end - count, lineLength); | ||
| 11668 | + res.push(" | " + repeat$1("^", length$1)); | ||
| 11669 | + } | ||
| 11670 | + count += lineLength + 1; | ||
| 11671 | + } | ||
| 11672 | + } | ||
| 11673 | + break | ||
| 11674 | + } | ||
| 11675 | + } | ||
| 11676 | + return res.join('\n') | ||
| 11677 | + } | ||
| 11678 | + | ||
| 11679 | + function repeat$1 (str, n) { | ||
| 11680 | + var result = ''; | ||
| 11681 | + if (n > 0) { | ||
| 11682 | + while (true) { // eslint-disable-line | ||
| 11683 | + if (n & 1) { result += str; } | ||
| 11684 | + n >>>= 1; | ||
| 11685 | + if (n <= 0) { break } | ||
| 11686 | + str += str; | ||
| 11687 | + } | ||
| 11688 | + } | ||
| 11689 | + return result | ||
| 11690 | + } | ||
| 11691 | + | ||
| 11692 | + /* */ | ||
| 11693 | + | ||
| 11694 | + | ||
| 11695 | + | ||
| 11696 | + function createFunction (code, errors) { | ||
| 11697 | + try { | ||
| 11698 | + return new Function(code) | ||
| 11699 | + } catch (err) { | ||
| 11700 | + errors.push({ err: err, code: code }); | ||
| 11701 | + return noop | ||
| 11702 | + } | ||
| 11703 | + } | ||
| 11704 | + | ||
| 11705 | + function createCompileToFunctionFn (compile) { | ||
| 11706 | + var cache = Object.create(null); | ||
| 11707 | + | ||
| 11708 | + return function compileToFunctions ( | ||
| 11709 | + template, | ||
| 11710 | + options, | ||
| 11711 | + vm | ||
| 11712 | + ) { | ||
| 11713 | + options = extend({}, options); | ||
| 11714 | + var warn$$1 = options.warn || warn; | ||
| 11715 | + delete options.warn; | ||
| 11716 | + | ||
| 11717 | + /* istanbul ignore if */ | ||
| 11718 | + { | ||
| 11719 | + // detect possible CSP restriction | ||
| 11720 | + try { | ||
| 11721 | + new Function('return 1'); | ||
| 11722 | + } catch (e) { | ||
| 11723 | + if (e.toString().match(/unsafe-eval|CSP/)) { | ||
| 11724 | + warn$$1( | ||
| 11725 | + 'It seems you are using the standalone build of Vue.js in an ' + | ||
| 11726 | + 'environment with Content Security Policy that prohibits unsafe-eval. ' + | ||
| 11727 | + 'The template compiler cannot work in this environment. Consider ' + | ||
| 11728 | + 'relaxing the policy to allow unsafe-eval or pre-compiling your ' + | ||
| 11729 | + 'templates into render functions.' | ||
| 11730 | + ); | ||
| 11731 | + } | ||
| 11732 | + } | ||
| 11733 | + } | ||
| 11734 | + | ||
| 11735 | + // check cache | ||
| 11736 | + var key = options.delimiters | ||
| 11737 | + ? String(options.delimiters) + template | ||
| 11738 | + : template; | ||
| 11739 | + if (cache[key]) { | ||
| 11740 | + return cache[key] | ||
| 11741 | + } | ||
| 11742 | + | ||
| 11743 | + // compile | ||
| 11744 | + var compiled = compile(template, options); | ||
| 11745 | + | ||
| 11746 | + // check compilation errors/tips | ||
| 11747 | + { | ||
| 11748 | + if (compiled.errors && compiled.errors.length) { | ||
| 11749 | + if (options.outputSourceRange) { | ||
| 11750 | + compiled.errors.forEach(function (e) { | ||
| 11751 | + warn$$1( | ||
| 11752 | + "Error compiling template:\n\n" + (e.msg) + "\n\n" + | ||
| 11753 | + generateCodeFrame(template, e.start, e.end), | ||
| 11754 | + vm | ||
| 11755 | + ); | ||
| 11756 | + }); | ||
| 11757 | + } else { | ||
| 11758 | + warn$$1( | ||
| 11759 | + "Error compiling template:\n\n" + template + "\n\n" + | ||
| 11760 | + compiled.errors.map(function (e) { return ("- " + e); }).join('\n') + '\n', | ||
| 11761 | + vm | ||
| 11762 | + ); | ||
| 11763 | + } | ||
| 11764 | + } | ||
| 11765 | + if (compiled.tips && compiled.tips.length) { | ||
| 11766 | + if (options.outputSourceRange) { | ||
| 11767 | + compiled.tips.forEach(function (e) { return tip(e.msg, vm); }); | ||
| 11768 | + } else { | ||
| 11769 | + compiled.tips.forEach(function (msg) { return tip(msg, vm); }); | ||
| 11770 | + } | ||
| 11771 | + } | ||
| 11772 | + } | ||
| 11773 | + | ||
| 11774 | + // turn code into functions | ||
| 11775 | + var res = {}; | ||
| 11776 | + var fnGenErrors = []; | ||
| 11777 | + res.render = createFunction(compiled.render, fnGenErrors); | ||
| 11778 | + res.staticRenderFns = compiled.staticRenderFns.map(function (code) { | ||
| 11779 | + return createFunction(code, fnGenErrors) | ||
| 11780 | + }); | ||
| 11781 | + | ||
| 11782 | + // check function generation errors. | ||
| 11783 | + // this should only happen if there is a bug in the compiler itself. | ||
| 11784 | + // mostly for codegen development use | ||
| 11785 | + /* istanbul ignore if */ | ||
| 11786 | + { | ||
| 11787 | + if ((!compiled.errors || !compiled.errors.length) && fnGenErrors.length) { | ||
| 11788 | + warn$$1( | ||
| 11789 | + "Failed to generate render function:\n\n" + | ||
| 11790 | + fnGenErrors.map(function (ref) { | ||
| 11791 | + var err = ref.err; | ||
| 11792 | + var code = ref.code; | ||
| 11793 | + | ||
| 11794 | + return ((err.toString()) + " in\n\n" + code + "\n"); | ||
| 11795 | + }).join('\n'), | ||
| 11796 | + vm | ||
| 11797 | + ); | ||
| 11798 | + } | ||
| 11799 | + } | ||
| 11800 | + | ||
| 11801 | + return (cache[key] = res) | ||
| 11802 | + } | ||
| 11803 | + } | ||
| 11804 | + | ||
| 11805 | + /* */ | ||
| 11806 | + | ||
| 11807 | + function createCompilerCreator (baseCompile) { | ||
| 11808 | + return function createCompiler (baseOptions) { | ||
| 11809 | + function compile ( | ||
| 11810 | + template, | ||
| 11811 | + options | ||
| 11812 | + ) { | ||
| 11813 | + var finalOptions = Object.create(baseOptions); | ||
| 11814 | + var errors = []; | ||
| 11815 | + var tips = []; | ||
| 11816 | + | ||
| 11817 | + var warn = function (msg, range, tip) { | ||
| 11818 | + (tip ? tips : errors).push(msg); | ||
| 11819 | + }; | ||
| 11820 | + | ||
| 11821 | + if (options) { | ||
| 11822 | + if (options.outputSourceRange) { | ||
| 11823 | + // $flow-disable-line | ||
| 11824 | + var leadingSpaceLength = template.match(/^\s*/)[0].length; | ||
| 11825 | + | ||
| 11826 | + warn = function (msg, range, tip) { | ||
| 11827 | + var data = { msg: msg }; | ||
| 11828 | + if (range) { | ||
| 11829 | + if (range.start != null) { | ||
| 11830 | + data.start = range.start + leadingSpaceLength; | ||
| 11831 | + } | ||
| 11832 | + if (range.end != null) { | ||
| 11833 | + data.end = range.end + leadingSpaceLength; | ||
| 11834 | + } | ||
| 11835 | + } | ||
| 11836 | + (tip ? tips : errors).push(data); | ||
| 11837 | + }; | ||
| 11838 | + } | ||
| 11839 | + // merge custom modules | ||
| 11840 | + if (options.modules) { | ||
| 11841 | + finalOptions.modules = | ||
| 11842 | + (baseOptions.modules || []).concat(options.modules); | ||
| 11843 | + } | ||
| 11844 | + // merge custom directives | ||
| 11845 | + if (options.directives) { | ||
| 11846 | + finalOptions.directives = extend( | ||
| 11847 | + Object.create(baseOptions.directives || null), | ||
| 11848 | + options.directives | ||
| 11849 | + ); | ||
| 11850 | + } | ||
| 11851 | + // copy other options | ||
| 11852 | + for (var key in options) { | ||
| 11853 | + if (key !== 'modules' && key !== 'directives') { | ||
| 11854 | + finalOptions[key] = options[key]; | ||
| 11855 | + } | ||
| 11856 | + } | ||
| 11857 | + } | ||
| 11858 | + | ||
| 11859 | + finalOptions.warn = warn; | ||
| 11860 | + | ||
| 11861 | + var compiled = baseCompile(template.trim(), finalOptions); | ||
| 11862 | + { | ||
| 11863 | + detectErrors(compiled.ast, warn); | ||
| 11864 | + } | ||
| 11865 | + compiled.errors = errors; | ||
| 11866 | + compiled.tips = tips; | ||
| 11867 | + return compiled | ||
| 11868 | + } | ||
| 11869 | + | ||
| 11870 | + return { | ||
| 11871 | + compile: compile, | ||
| 11872 | + compileToFunctions: createCompileToFunctionFn(compile) | ||
| 11873 | + } | ||
| 11874 | + } | ||
| 11875 | + } | ||
| 11876 | + | ||
| 11877 | + /* */ | ||
| 11878 | + | ||
| 11879 | + // `createCompilerCreator` allows creating compilers that use alternative | ||
| 11880 | + // parser/optimizer/codegen, e.g the SSR optimizing compiler. | ||
| 11881 | + // Here we just export a default compiler using the default parts. | ||
| 11882 | + var createCompiler = createCompilerCreator(function baseCompile ( | ||
| 11883 | + template, | ||
| 11884 | + options | ||
| 11885 | + ) { | ||
| 11886 | + var ast = parse(template.trim(), options); | ||
| 11887 | + if (options.optimize !== false) { | ||
| 11888 | + optimize(ast, options); | ||
| 11889 | + } | ||
| 11890 | + var code = generate(ast, options); | ||
| 11891 | + return { | ||
| 11892 | + ast: ast, | ||
| 11893 | + render: code.render, | ||
| 11894 | + staticRenderFns: code.staticRenderFns | ||
| 11895 | + } | ||
| 11896 | + }); | ||
| 11897 | + | ||
| 11898 | + /* */ | ||
| 11899 | + | ||
| 11900 | + var ref$1 = createCompiler(baseOptions); | ||
| 11901 | + var compile = ref$1.compile; | ||
| 11902 | + var compileToFunctions = ref$1.compileToFunctions; | ||
| 11903 | + | ||
| 11904 | + /* */ | ||
| 11905 | + | ||
| 11906 | + // check whether current browser encodes a char inside attribute values | ||
| 11907 | + var div; | ||
| 11908 | + function getShouldDecode (href) { | ||
| 11909 | + div = div || document.createElement('div'); | ||
| 11910 | + div.innerHTML = href ? "<a href=\"\n\"/>" : "<div a=\"\n\"/>"; | ||
| 11911 | + return div.innerHTML.indexOf(' ') > 0 | ||
| 11912 | + } | ||
| 11913 | + | ||
| 11914 | + // #3663: IE encodes newlines inside attribute values while other browsers don't | ||
| 11915 | + var shouldDecodeNewlines = inBrowser ? getShouldDecode(false) : false; | ||
| 11916 | + // #6828: chrome encodes content in a[href] | ||
| 11917 | + var shouldDecodeNewlinesForHref = inBrowser ? getShouldDecode(true) : false; | ||
| 11918 | + | ||
| 11919 | + /* */ | ||
| 11920 | + | ||
| 11921 | + var idToTemplate = cached(function (id) { | ||
| 11922 | + var el = query(id); | ||
| 11923 | + return el && el.innerHTML | ||
| 11924 | + }); | ||
| 11925 | + | ||
| 11926 | + var mount = Vue.prototype.$mount; | ||
| 11927 | + Vue.prototype.$mount = function ( | ||
| 11928 | + el, | ||
| 11929 | + hydrating | ||
| 11930 | + ) { | ||
| 11931 | + el = el && query(el); | ||
| 11932 | + | ||
| 11933 | + /* istanbul ignore if */ | ||
| 11934 | + if (el === document.body || el === document.documentElement) { | ||
| 11935 | + warn( | ||
| 11936 | + "Do not mount Vue to <html> or <body> - mount to normal elements instead." | ||
| 11937 | + ); | ||
| 11938 | + return this | ||
| 11939 | + } | ||
| 11940 | + | ||
| 11941 | + var options = this.$options; | ||
| 11942 | + // resolve template/el and convert to render function | ||
| 11943 | + if (!options.render) { | ||
| 11944 | + var template = options.template; | ||
| 11945 | + if (template) { | ||
| 11946 | + if (typeof template === 'string') { | ||
| 11947 | + if (template.charAt(0) === '#') { | ||
| 11948 | + template = idToTemplate(template); | ||
| 11949 | + /* istanbul ignore if */ | ||
| 11950 | + if (!template) { | ||
| 11951 | + warn( | ||
| 11952 | + ("Template element not found or is empty: " + (options.template)), | ||
| 11953 | + this | ||
| 11954 | + ); | ||
| 11955 | + } | ||
| 11956 | + } | ||
| 11957 | + } else if (template.nodeType) { | ||
| 11958 | + template = template.innerHTML; | ||
| 11959 | + } else { | ||
| 11960 | + { | ||
| 11961 | + warn('invalid template option:' + template, this); | ||
| 11962 | + } | ||
| 11963 | + return this | ||
| 11964 | + } | ||
| 11965 | + } else if (el) { | ||
| 11966 | + template = getOuterHTML(el); | ||
| 11967 | + } | ||
| 11968 | + if (template) { | ||
| 11969 | + /* istanbul ignore if */ | ||
| 11970 | + if (config.performance && mark) { | ||
| 11971 | + mark('compile'); | ||
| 11972 | + } | ||
| 11973 | + | ||
| 11974 | + var ref = compileToFunctions(template, { | ||
| 11975 | + outputSourceRange: "development" !== 'production', | ||
| 11976 | + shouldDecodeNewlines: shouldDecodeNewlines, | ||
| 11977 | + shouldDecodeNewlinesForHref: shouldDecodeNewlinesForHref, | ||
| 11978 | + delimiters: options.delimiters, | ||
| 11979 | + comments: options.comments | ||
| 11980 | + }, this); | ||
| 11981 | + var render = ref.render; | ||
| 11982 | + var staticRenderFns = ref.staticRenderFns; | ||
| 11983 | + options.render = render; | ||
| 11984 | + options.staticRenderFns = staticRenderFns; | ||
| 11985 | + | ||
| 11986 | + /* istanbul ignore if */ | ||
| 11987 | + if (config.performance && mark) { | ||
| 11988 | + mark('compile end'); | ||
| 11989 | + measure(("vue " + (this._name) + " compile"), 'compile', 'compile end'); | ||
| 11990 | + } | ||
| 11991 | + } | ||
| 11992 | + } | ||
| 11993 | + return mount.call(this, el, hydrating) | ||
| 11994 | + }; | ||
| 11995 | + | ||
| 11996 | + /** | ||
| 11997 | + * Get outerHTML of elements, taking care | ||
| 11998 | + * of SVG elements in IE as well. | ||
| 11999 | + */ | ||
| 12000 | + function getOuterHTML (el) { | ||
| 12001 | + if (el.outerHTML) { | ||
| 12002 | + return el.outerHTML | ||
| 12003 | + } else { | ||
| 12004 | + var container = document.createElement('div'); | ||
| 12005 | + container.appendChild(el.cloneNode(true)); | ||
| 12006 | + return container.innerHTML | ||
| 12007 | + } | ||
| 12008 | + } | ||
| 12009 | + | ||
| 12010 | + Vue.compile = compileToFunctions; | ||
| 12011 | + | ||
| 12012 | + return Vue; | ||
| 12013 | + | ||
| 12014 | +})); |
bsthLineProfiles/src/main/resources/static/ajax/libs/vue/vue.min.js
0 → 100644
| 1 | +/*! | ||
| 2 | + * Vue.js v2.6.14 | ||
| 3 | + * (c) 2014-2021 Evan You | ||
| 4 | + * Released under the MIT License. | ||
| 5 | + */ | ||
| 6 | +!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e=e||self).Vue=t()}(this,function(){"use strict";var e=Object.freeze({});function t(e){return null==e}function n(e){return null!=e}function r(e){return!0===e}function i(e){return"string"==typeof e||"number"==typeof e||"symbol"==typeof e||"boolean"==typeof e}function o(e){return null!==e&&"object"==typeof e}var a=Object.prototype.toString;function s(e){return"[object Object]"===a.call(e)}function c(e){var t=parseFloat(String(e));return t>=0&&Math.floor(t)===t&&isFinite(e)}function u(e){return n(e)&&"function"==typeof e.then&&"function"==typeof e.catch}function l(e){return null==e?"":Array.isArray(e)||s(e)&&e.toString===a?JSON.stringify(e,null,2):String(e)}function f(e){var t=parseFloat(e);return isNaN(t)?e:t}function p(e,t){for(var n=Object.create(null),r=e.split(","),i=0;i<r.length;i++)n[r[i]]=!0;return t?function(e){return n[e.toLowerCase()]}:function(e){return n[e]}}var d=p("slot,component",!0),v=p("key,ref,slot,slot-scope,is");function h(e,t){if(e.length){var n=e.indexOf(t);if(n>-1)return e.splice(n,1)}}var m=Object.prototype.hasOwnProperty;function y(e,t){return m.call(e,t)}function g(e){var t=Object.create(null);return function(n){return t[n]||(t[n]=e(n))}}var _=/-(\w)/g,b=g(function(e){return e.replace(_,function(e,t){return t?t.toUpperCase():""})}),$=g(function(e){return e.charAt(0).toUpperCase()+e.slice(1)}),w=/\B([A-Z])/g,C=g(function(e){return e.replace(w,"-$1").toLowerCase()});var x=Function.prototype.bind?function(e,t){return e.bind(t)}:function(e,t){function n(n){var r=arguments.length;return r?r>1?e.apply(t,arguments):e.call(t,n):e.call(t)}return n._length=e.length,n};function k(e,t){t=t||0;for(var n=e.length-t,r=new Array(n);n--;)r[n]=e[n+t];return r}function A(e,t){for(var n in t)e[n]=t[n];return e}function O(e){for(var t={},n=0;n<e.length;n++)e[n]&&A(t,e[n]);return t}function S(e,t,n){}var T=function(e,t,n){return!1},N=function(e){return e};function E(e,t){if(e===t)return!0;var n=o(e),r=o(t);if(!n||!r)return!n&&!r&&String(e)===String(t);try{var i=Array.isArray(e),a=Array.isArray(t);if(i&&a)return e.length===t.length&&e.every(function(e,n){return E(e,t[n])});if(e instanceof Date&&t instanceof Date)return e.getTime()===t.getTime();if(i||a)return!1;var s=Object.keys(e),c=Object.keys(t);return s.length===c.length&&s.every(function(n){return E(e[n],t[n])})}catch(e){return!1}}function j(e,t){for(var n=0;n<e.length;n++)if(E(e[n],t))return n;return-1}function D(e){var t=!1;return function(){t||(t=!0,e.apply(this,arguments))}}var L="data-server-rendered",I=["component","directive","filter"],M=["beforeCreate","created","beforeMount","mounted","beforeUpdate","updated","beforeDestroy","destroyed","activated","deactivated","errorCaptured","serverPrefetch"],F={optionMergeStrategies:Object.create(null),silent:!1,productionTip:!1,devtools:!1,performance:!1,errorHandler:null,warnHandler:null,ignoredElements:[],keyCodes:Object.create(null),isReservedTag:T,isReservedAttr:T,isUnknownElement:T,getTagNamespace:S,parsePlatformTagName:N,mustUseProp:T,async:!0,_lifecycleHooks:M},P=/a-zA-Z\u00B7\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u037D\u037F-\u1FFF\u200C-\u200D\u203F-\u2040\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD/;function R(e,t,n,r){Object.defineProperty(e,t,{value:n,enumerable:!!r,writable:!0,configurable:!0})}var H=new RegExp("[^"+P.source+".$_\\d]");var B,U="__proto__"in{},V="undefined"!=typeof window,z="undefined"!=typeof WXEnvironment&&!!WXEnvironment.platform,K=z&&WXEnvironment.platform.toLowerCase(),J=V&&window.navigator.userAgent.toLowerCase(),q=J&&/msie|trident/.test(J),W=J&&J.indexOf("msie 9.0")>0,Z=J&&J.indexOf("edge/")>0,G=(J&&J.indexOf("android"),J&&/iphone|ipad|ipod|ios/.test(J)||"ios"===K),X=(J&&/chrome\/\d+/.test(J),J&&/phantomjs/.test(J),J&&J.match(/firefox\/(\d+)/)),Y={}.watch,Q=!1;if(V)try{var ee={};Object.defineProperty(ee,"passive",{get:function(){Q=!0}}),window.addEventListener("test-passive",null,ee)}catch(e){}var te=function(){return void 0===B&&(B=!V&&!z&&"undefined"!=typeof global&&(global.process&&"server"===global.process.env.VUE_ENV)),B},ne=V&&window.__VUE_DEVTOOLS_GLOBAL_HOOK__;function re(e){return"function"==typeof e&&/native code/.test(e.toString())}var ie,oe="undefined"!=typeof Symbol&&re(Symbol)&&"undefined"!=typeof Reflect&&re(Reflect.ownKeys);ie="undefined"!=typeof Set&&re(Set)?Set:function(){function e(){this.set=Object.create(null)}return e.prototype.has=function(e){return!0===this.set[e]},e.prototype.add=function(e){this.set[e]=!0},e.prototype.clear=function(){this.set=Object.create(null)},e}();var ae=S,se=0,ce=function(){this.id=se++,this.subs=[]};ce.prototype.addSub=function(e){this.subs.push(e)},ce.prototype.removeSub=function(e){h(this.subs,e)},ce.prototype.depend=function(){ce.target&&ce.target.addDep(this)},ce.prototype.notify=function(){for(var e=this.subs.slice(),t=0,n=e.length;t<n;t++)e[t].update()},ce.target=null;var ue=[];function le(e){ue.push(e),ce.target=e}function fe(){ue.pop(),ce.target=ue[ue.length-1]}var pe=function(e,t,n,r,i,o,a,s){this.tag=e,this.data=t,this.children=n,this.text=r,this.elm=i,this.ns=void 0,this.context=o,this.fnContext=void 0,this.fnOptions=void 0,this.fnScopeId=void 0,this.key=t&&t.key,this.componentOptions=a,this.componentInstance=void 0,this.parent=void 0,this.raw=!1,this.isStatic=!1,this.isRootInsert=!0,this.isComment=!1,this.isCloned=!1,this.isOnce=!1,this.asyncFactory=s,this.asyncMeta=void 0,this.isAsyncPlaceholder=!1},de={child:{configurable:!0}};de.child.get=function(){return this.componentInstance},Object.defineProperties(pe.prototype,de);var ve=function(e){void 0===e&&(e="");var t=new pe;return t.text=e,t.isComment=!0,t};function he(e){return new pe(void 0,void 0,void 0,String(e))}function me(e){var t=new pe(e.tag,e.data,e.children&&e.children.slice(),e.text,e.elm,e.context,e.componentOptions,e.asyncFactory);return t.ns=e.ns,t.isStatic=e.isStatic,t.key=e.key,t.isComment=e.isComment,t.fnContext=e.fnContext,t.fnOptions=e.fnOptions,t.fnScopeId=e.fnScopeId,t.asyncMeta=e.asyncMeta,t.isCloned=!0,t}var ye=Array.prototype,ge=Object.create(ye);["push","pop","shift","unshift","splice","sort","reverse"].forEach(function(e){var t=ye[e];R(ge,e,function(){for(var n=[],r=arguments.length;r--;)n[r]=arguments[r];var i,o=t.apply(this,n),a=this.__ob__;switch(e){case"push":case"unshift":i=n;break;case"splice":i=n.slice(2)}return i&&a.observeArray(i),a.dep.notify(),o})});var _e=Object.getOwnPropertyNames(ge),be=!0;function $e(e){be=e}var we=function(e){var t;this.value=e,this.dep=new ce,this.vmCount=0,R(e,"__ob__",this),Array.isArray(e)?(U?(t=ge,e.__proto__=t):function(e,t,n){for(var r=0,i=n.length;r<i;r++){var o=n[r];R(e,o,t[o])}}(e,ge,_e),this.observeArray(e)):this.walk(e)};function Ce(e,t){var n;if(o(e)&&!(e instanceof pe))return y(e,"__ob__")&&e.__ob__ instanceof we?n=e.__ob__:be&&!te()&&(Array.isArray(e)||s(e))&&Object.isExtensible(e)&&!e._isVue&&(n=new we(e)),t&&n&&n.vmCount++,n}function xe(e,t,n,r,i){var o=new ce,a=Object.getOwnPropertyDescriptor(e,t);if(!a||!1!==a.configurable){var s=a&&a.get,c=a&&a.set;s&&!c||2!==arguments.length||(n=e[t]);var u=!i&&Ce(n);Object.defineProperty(e,t,{enumerable:!0,configurable:!0,get:function(){var t=s?s.call(e):n;return ce.target&&(o.depend(),u&&(u.dep.depend(),Array.isArray(t)&&function e(t){for(var n=void 0,r=0,i=t.length;r<i;r++)(n=t[r])&&n.__ob__&&n.__ob__.dep.depend(),Array.isArray(n)&&e(n)}(t))),t},set:function(t){var r=s?s.call(e):n;t===r||t!=t&&r!=r||s&&!c||(c?c.call(e,t):n=t,u=!i&&Ce(t),o.notify())}})}}function ke(e,t,n){if(Array.isArray(e)&&c(t))return e.length=Math.max(e.length,t),e.splice(t,1,n),n;if(t in e&&!(t in Object.prototype))return e[t]=n,n;var r=e.__ob__;return e._isVue||r&&r.vmCount?n:r?(xe(r.value,t,n),r.dep.notify(),n):(e[t]=n,n)}function Ae(e,t){if(Array.isArray(e)&&c(t))e.splice(t,1);else{var n=e.__ob__;e._isVue||n&&n.vmCount||y(e,t)&&(delete e[t],n&&n.dep.notify())}}we.prototype.walk=function(e){for(var t=Object.keys(e),n=0;n<t.length;n++)xe(e,t[n])},we.prototype.observeArray=function(e){for(var t=0,n=e.length;t<n;t++)Ce(e[t])};var Oe=F.optionMergeStrategies;function Se(e,t){if(!t)return e;for(var n,r,i,o=oe?Reflect.ownKeys(t):Object.keys(t),a=0;a<o.length;a++)"__ob__"!==(n=o[a])&&(r=e[n],i=t[n],y(e,n)?r!==i&&s(r)&&s(i)&&Se(r,i):ke(e,n,i));return e}function Te(e,t,n){return n?function(){var r="function"==typeof t?t.call(n,n):t,i="function"==typeof e?e.call(n,n):e;return r?Se(r,i):i}:t?e?function(){return Se("function"==typeof t?t.call(this,this):t,"function"==typeof e?e.call(this,this):e)}:t:e}function Ne(e,t){var n=t?e?e.concat(t):Array.isArray(t)?t:[t]:e;return n?function(e){for(var t=[],n=0;n<e.length;n++)-1===t.indexOf(e[n])&&t.push(e[n]);return t}(n):n}function Ee(e,t,n,r){var i=Object.create(e||null);return t?A(i,t):i}Oe.data=function(e,t,n){return n?Te(e,t,n):t&&"function"!=typeof t?e:Te(e,t)},M.forEach(function(e){Oe[e]=Ne}),I.forEach(function(e){Oe[e+"s"]=Ee}),Oe.watch=function(e,t,n,r){if(e===Y&&(e=void 0),t===Y&&(t=void 0),!t)return Object.create(e||null);if(!e)return t;var i={};for(var o in A(i,e),t){var a=i[o],s=t[o];a&&!Array.isArray(a)&&(a=[a]),i[o]=a?a.concat(s):Array.isArray(s)?s:[s]}return i},Oe.props=Oe.methods=Oe.inject=Oe.computed=function(e,t,n,r){if(!e)return t;var i=Object.create(null);return A(i,e),t&&A(i,t),i},Oe.provide=Te;var je=function(e,t){return void 0===t?e:t};function De(e,t,n){if("function"==typeof t&&(t=t.options),function(e,t){var n=e.props;if(n){var r,i,o={};if(Array.isArray(n))for(r=n.length;r--;)"string"==typeof(i=n[r])&&(o[b(i)]={type:null});else if(s(n))for(var a in n)i=n[a],o[b(a)]=s(i)?i:{type:i};e.props=o}}(t),function(e,t){var n=e.inject;if(n){var r=e.inject={};if(Array.isArray(n))for(var i=0;i<n.length;i++)r[n[i]]={from:n[i]};else if(s(n))for(var o in n){var a=n[o];r[o]=s(a)?A({from:o},a):{from:a}}}}(t),function(e){var t=e.directives;if(t)for(var n in t){var r=t[n];"function"==typeof r&&(t[n]={bind:r,update:r})}}(t),!t._base&&(t.extends&&(e=De(e,t.extends,n)),t.mixins))for(var r=0,i=t.mixins.length;r<i;r++)e=De(e,t.mixins[r],n);var o,a={};for(o in e)c(o);for(o in t)y(e,o)||c(o);function c(r){var i=Oe[r]||je;a[r]=i(e[r],t[r],n,r)}return a}function Le(e,t,n,r){if("string"==typeof n){var i=e[t];if(y(i,n))return i[n];var o=b(n);if(y(i,o))return i[o];var a=$(o);return y(i,a)?i[a]:i[n]||i[o]||i[a]}}function Ie(e,t,n,r){var i=t[e],o=!y(n,e),a=n[e],s=Re(Boolean,i.type);if(s>-1)if(o&&!y(i,"default"))a=!1;else if(""===a||a===C(e)){var c=Re(String,i.type);(c<0||s<c)&&(a=!0)}if(void 0===a){a=function(e,t,n){if(!y(t,"default"))return;var r=t.default;if(e&&e.$options.propsData&&void 0===e.$options.propsData[n]&&void 0!==e._props[n])return e._props[n];return"function"==typeof r&&"Function"!==Fe(t.type)?r.call(e):r}(r,i,e);var u=be;$e(!0),Ce(a),$e(u)}return a}var Me=/^\s*function (\w+)/;function Fe(e){var t=e&&e.toString().match(Me);return t?t[1]:""}function Pe(e,t){return Fe(e)===Fe(t)}function Re(e,t){if(!Array.isArray(t))return Pe(t,e)?0:-1;for(var n=0,r=t.length;n<r;n++)if(Pe(t[n],e))return n;return-1}function He(e,t,n){le();try{if(t)for(var r=t;r=r.$parent;){var i=r.$options.errorCaptured;if(i)for(var o=0;o<i.length;o++)try{if(!1===i[o].call(r,e,t,n))return}catch(e){Ue(e,r,"errorCaptured hook")}}Ue(e,t,n)}finally{fe()}}function Be(e,t,n,r,i){var o;try{(o=n?e.apply(t,n):e.call(t))&&!o._isVue&&u(o)&&!o._handled&&(o.catch(function(e){return He(e,r,i+" (Promise/async)")}),o._handled=!0)}catch(e){He(e,r,i)}return o}function Ue(e,t,n){if(F.errorHandler)try{return F.errorHandler.call(null,e,t,n)}catch(t){t!==e&&Ve(t,null,"config.errorHandler")}Ve(e,t,n)}function Ve(e,t,n){if(!V&&!z||"undefined"==typeof console)throw e;console.error(e)}var ze,Ke=!1,Je=[],qe=!1;function We(){qe=!1;var e=Je.slice(0);Je.length=0;for(var t=0;t<e.length;t++)e[t]()}if("undefined"!=typeof Promise&&re(Promise)){var Ze=Promise.resolve();ze=function(){Ze.then(We),G&&setTimeout(S)},Ke=!0}else if(q||"undefined"==typeof MutationObserver||!re(MutationObserver)&&"[object MutationObserverConstructor]"!==MutationObserver.toString())ze="undefined"!=typeof setImmediate&&re(setImmediate)?function(){setImmediate(We)}:function(){setTimeout(We,0)};else{var Ge=1,Xe=new MutationObserver(We),Ye=document.createTextNode(String(Ge));Xe.observe(Ye,{characterData:!0}),ze=function(){Ge=(Ge+1)%2,Ye.data=String(Ge)},Ke=!0}function Qe(e,t){var n;if(Je.push(function(){if(e)try{e.call(t)}catch(e){He(e,t,"nextTick")}else n&&n(t)}),qe||(qe=!0,ze()),!e&&"undefined"!=typeof Promise)return new Promise(function(e){n=e})}var et=new ie;function tt(e){!function e(t,n){var r,i;var a=Array.isArray(t);if(!a&&!o(t)||Object.isFrozen(t)||t instanceof pe)return;if(t.__ob__){var s=t.__ob__.dep.id;if(n.has(s))return;n.add(s)}if(a)for(r=t.length;r--;)e(t[r],n);else for(i=Object.keys(t),r=i.length;r--;)e(t[i[r]],n)}(e,et),et.clear()}var nt=g(function(e){var t="&"===e.charAt(0),n="~"===(e=t?e.slice(1):e).charAt(0),r="!"===(e=n?e.slice(1):e).charAt(0);return{name:e=r?e.slice(1):e,once:n,capture:r,passive:t}});function rt(e,t){function n(){var e=arguments,r=n.fns;if(!Array.isArray(r))return Be(r,null,arguments,t,"v-on handler");for(var i=r.slice(),o=0;o<i.length;o++)Be(i[o],null,e,t,"v-on handler")}return n.fns=e,n}function it(e,n,i,o,a,s){var c,u,l,f;for(c in e)u=e[c],l=n[c],f=nt(c),t(u)||(t(l)?(t(u.fns)&&(u=e[c]=rt(u,s)),r(f.once)&&(u=e[c]=a(f.name,u,f.capture)),i(f.name,u,f.capture,f.passive,f.params)):u!==l&&(l.fns=u,e[c]=l));for(c in n)t(e[c])&&o((f=nt(c)).name,n[c],f.capture)}function ot(e,i,o){var a;e instanceof pe&&(e=e.data.hook||(e.data.hook={}));var s=e[i];function c(){o.apply(this,arguments),h(a.fns,c)}t(s)?a=rt([c]):n(s.fns)&&r(s.merged)?(a=s).fns.push(c):a=rt([s,c]),a.merged=!0,e[i]=a}function at(e,t,r,i,o){if(n(t)){if(y(t,r))return e[r]=t[r],o||delete t[r],!0;if(y(t,i))return e[r]=t[i],o||delete t[i],!0}return!1}function st(e){return i(e)?[he(e)]:Array.isArray(e)?function e(o,a){var s=[];var c,u,l,f;for(c=0;c<o.length;c++)t(u=o[c])||"boolean"==typeof u||(l=s.length-1,f=s[l],Array.isArray(u)?u.length>0&&(ct((u=e(u,(a||"")+"_"+c))[0])&&ct(f)&&(s[l]=he(f.text+u[0].text),u.shift()),s.push.apply(s,u)):i(u)?ct(f)?s[l]=he(f.text+u):""!==u&&s.push(he(u)):ct(u)&&ct(f)?s[l]=he(f.text+u.text):(r(o._isVList)&&n(u.tag)&&t(u.key)&&n(a)&&(u.key="__vlist"+a+"_"+c+"__"),s.push(u)));return s}(e):void 0}function ct(e){return n(e)&&n(e.text)&&!1===e.isComment}function ut(e,t){if(e){for(var n=Object.create(null),r=oe?Reflect.ownKeys(e):Object.keys(e),i=0;i<r.length;i++){var o=r[i];if("__ob__"!==o){for(var a=e[o].from,s=t;s;){if(s._provided&&y(s._provided,a)){n[o]=s._provided[a];break}s=s.$parent}if(!s&&"default"in e[o]){var c=e[o].default;n[o]="function"==typeof c?c.call(t):c}}}return n}}function lt(e,t){if(!e||!e.length)return{};for(var n={},r=0,i=e.length;r<i;r++){var o=e[r],a=o.data;if(a&&a.attrs&&a.attrs.slot&&delete a.attrs.slot,o.context!==t&&o.fnContext!==t||!a||null==a.slot)(n.default||(n.default=[])).push(o);else{var s=a.slot,c=n[s]||(n[s]=[]);"template"===o.tag?c.push.apply(c,o.children||[]):c.push(o)}}for(var u in n)n[u].every(ft)&&delete n[u];return n}function ft(e){return e.isComment&&!e.asyncFactory||" "===e.text}function pt(e){return e.isComment&&e.asyncFactory}function dt(t,n,r){var i,o=Object.keys(n).length>0,a=t?!!t.$stable:!o,s=t&&t.$key;if(t){if(t._normalized)return t._normalized;if(a&&r&&r!==e&&s===r.$key&&!o&&!r.$hasNormal)return r;for(var c in i={},t)t[c]&&"$"!==c[0]&&(i[c]=vt(n,c,t[c]))}else i={};for(var u in n)u in i||(i[u]=ht(n,u));return t&&Object.isExtensible(t)&&(t._normalized=i),R(i,"$stable",a),R(i,"$key",s),R(i,"$hasNormal",o),i}function vt(e,t,n){var r=function(){var e=arguments.length?n.apply(null,arguments):n({}),t=(e=e&&"object"==typeof e&&!Array.isArray(e)?[e]:st(e))&&e[0];return e&&(!t||1===e.length&&t.isComment&&!pt(t))?void 0:e};return n.proxy&&Object.defineProperty(e,t,{get:r,enumerable:!0,configurable:!0}),r}function ht(e,t){return function(){return e[t]}}function mt(e,t){var r,i,a,s,c;if(Array.isArray(e)||"string"==typeof e)for(r=new Array(e.length),i=0,a=e.length;i<a;i++)r[i]=t(e[i],i);else if("number"==typeof e)for(r=new Array(e),i=0;i<e;i++)r[i]=t(i+1,i);else if(o(e))if(oe&&e[Symbol.iterator]){r=[];for(var u=e[Symbol.iterator](),l=u.next();!l.done;)r.push(t(l.value,r.length)),l=u.next()}else for(s=Object.keys(e),r=new Array(s.length),i=0,a=s.length;i<a;i++)c=s[i],r[i]=t(e[c],c,i);return n(r)||(r=[]),r._isVList=!0,r}function yt(e,t,n,r){var i,o=this.$scopedSlots[e];o?(n=n||{},r&&(n=A(A({},r),n)),i=o(n)||("function"==typeof t?t():t)):i=this.$slots[e]||("function"==typeof t?t():t);var a=n&&n.slot;return a?this.$createElement("template",{slot:a},i):i}function gt(e){return Le(this.$options,"filters",e)||N}function _t(e,t){return Array.isArray(e)?-1===e.indexOf(t):e!==t}function bt(e,t,n,r,i){var o=F.keyCodes[t]||n;return i&&r&&!F.keyCodes[t]?_t(i,r):o?_t(o,e):r?C(r)!==t:void 0===e}function $t(e,t,n,r,i){if(n)if(o(n)){var a;Array.isArray(n)&&(n=O(n));var s=function(o){if("class"===o||"style"===o||v(o))a=e;else{var s=e.attrs&&e.attrs.type;a=r||F.mustUseProp(t,s,o)?e.domProps||(e.domProps={}):e.attrs||(e.attrs={})}var c=b(o),u=C(o);c in a||u in a||(a[o]=n[o],i&&((e.on||(e.on={}))["update:"+o]=function(e){n[o]=e}))};for(var c in n)s(c)}else;return e}function wt(e,t){var n=this._staticTrees||(this._staticTrees=[]),r=n[e];return r&&!t?r:(xt(r=n[e]=this.$options.staticRenderFns[e].call(this._renderProxy,null,this),"__static__"+e,!1),r)}function Ct(e,t,n){return xt(e,"__once__"+t+(n?"_"+n:""),!0),e}function xt(e,t,n){if(Array.isArray(e))for(var r=0;r<e.length;r++)e[r]&&"string"!=typeof e[r]&&kt(e[r],t+"_"+r,n);else kt(e,t,n)}function kt(e,t,n){e.isStatic=!0,e.key=t,e.isOnce=n}function At(e,t){if(t)if(s(t)){var n=e.on=e.on?A({},e.on):{};for(var r in t){var i=n[r],o=t[r];n[r]=i?[].concat(i,o):o}}else;return e}function Ot(e,t,n,r){t=t||{$stable:!n};for(var i=0;i<e.length;i++){var o=e[i];Array.isArray(o)?Ot(o,t,n):o&&(o.proxy&&(o.fn.proxy=!0),t[o.key]=o.fn)}return r&&(t.$key=r),t}function St(e,t){for(var n=0;n<t.length;n+=2){var r=t[n];"string"==typeof r&&r&&(e[t[n]]=t[n+1])}return e}function Tt(e,t){return"string"==typeof e?t+e:e}function Nt(e){e._o=Ct,e._n=f,e._s=l,e._l=mt,e._t=yt,e._q=E,e._i=j,e._m=wt,e._f=gt,e._k=bt,e._b=$t,e._v=he,e._e=ve,e._u=Ot,e._g=At,e._d=St,e._p=Tt}function Et(t,n,i,o,a){var s,c=this,u=a.options;y(o,"_uid")?(s=Object.create(o))._original=o:(s=o,o=o._original);var l=r(u._compiled),f=!l;this.data=t,this.props=n,this.children=i,this.parent=o,this.listeners=t.on||e,this.injections=ut(u.inject,o),this.slots=function(){return c.$slots||dt(t.scopedSlots,c.$slots=lt(i,o)),c.$slots},Object.defineProperty(this,"scopedSlots",{enumerable:!0,get:function(){return dt(t.scopedSlots,this.slots())}}),l&&(this.$options=u,this.$slots=this.slots(),this.$scopedSlots=dt(t.scopedSlots,this.$slots)),u._scopeId?this._c=function(e,t,n,r){var i=Ht(s,e,t,n,r,f);return i&&!Array.isArray(i)&&(i.fnScopeId=u._scopeId,i.fnContext=o),i}:this._c=function(e,t,n,r){return Ht(s,e,t,n,r,f)}}function jt(e,t,n,r,i){var o=me(e);return o.fnContext=n,o.fnOptions=r,t.slot&&((o.data||(o.data={})).slot=t.slot),o}function Dt(e,t){for(var n in t)e[b(n)]=t[n]}Nt(Et.prototype);var Lt={init:function(e,t){if(e.componentInstance&&!e.componentInstance._isDestroyed&&e.data.keepAlive){var r=e;Lt.prepatch(r,r)}else{(e.componentInstance=function(e,t){var r={_isComponent:!0,_parentVnode:e,parent:t},i=e.data.inlineTemplate;n(i)&&(r.render=i.render,r.staticRenderFns=i.staticRenderFns);return new e.componentOptions.Ctor(r)}(e,Zt)).$mount(t?e.elm:void 0,t)}},prepatch:function(t,n){var r=n.componentOptions;!function(t,n,r,i,o){var a=i.data.scopedSlots,s=t.$scopedSlots,c=!!(a&&!a.$stable||s!==e&&!s.$stable||a&&t.$scopedSlots.$key!==a.$key||!a&&t.$scopedSlots.$key),u=!!(o||t.$options._renderChildren||c);t.$options._parentVnode=i,t.$vnode=i,t._vnode&&(t._vnode.parent=i);if(t.$options._renderChildren=o,t.$attrs=i.data.attrs||e,t.$listeners=r||e,n&&t.$options.props){$e(!1);for(var l=t._props,f=t.$options._propKeys||[],p=0;p<f.length;p++){var d=f[p],v=t.$options.props;l[d]=Ie(d,v,n,t)}$e(!0),t.$options.propsData=n}r=r||e;var h=t.$options._parentListeners;t.$options._parentListeners=r,Wt(t,r,h),u&&(t.$slots=lt(o,i.context),t.$forceUpdate())}(n.componentInstance=t.componentInstance,r.propsData,r.listeners,n,r.children)},insert:function(e){var t,n=e.context,r=e.componentInstance;r._isMounted||(r._isMounted=!0,Qt(r,"mounted")),e.data.keepAlive&&(n._isMounted?((t=r)._inactive=!1,tn.push(t)):Yt(r,!0))},destroy:function(e){var t=e.componentInstance;t._isDestroyed||(e.data.keepAlive?function e(t,n){if(n&&(t._directInactive=!0,Xt(t)))return;if(!t._inactive){t._inactive=!0;for(var r=0;r<t.$children.length;r++)e(t.$children[r]);Qt(t,"deactivated")}}(t,!0):t.$destroy())}},It=Object.keys(Lt);function Mt(i,a,s,c,l){if(!t(i)){var f=s.$options._base;if(o(i)&&(i=f.extend(i)),"function"==typeof i){var p;if(t(i.cid)&&void 0===(i=function(e,i){if(r(e.error)&&n(e.errorComp))return e.errorComp;if(n(e.resolved))return e.resolved;var a=Ut;a&&n(e.owners)&&-1===e.owners.indexOf(a)&&e.owners.push(a);if(r(e.loading)&&n(e.loadingComp))return e.loadingComp;if(a&&!n(e.owners)){var s=e.owners=[a],c=!0,l=null,f=null;a.$on("hook:destroyed",function(){return h(s,a)});var p=function(e){for(var t=0,n=s.length;t<n;t++)s[t].$forceUpdate();e&&(s.length=0,null!==l&&(clearTimeout(l),l=null),null!==f&&(clearTimeout(f),f=null))},d=D(function(t){e.resolved=Vt(t,i),c?s.length=0:p(!0)}),v=D(function(t){n(e.errorComp)&&(e.error=!0,p(!0))}),m=e(d,v);return o(m)&&(u(m)?t(e.resolved)&&m.then(d,v):u(m.component)&&(m.component.then(d,v),n(m.error)&&(e.errorComp=Vt(m.error,i)),n(m.loading)&&(e.loadingComp=Vt(m.loading,i),0===m.delay?e.loading=!0:l=setTimeout(function(){l=null,t(e.resolved)&&t(e.error)&&(e.loading=!0,p(!1))},m.delay||200)),n(m.timeout)&&(f=setTimeout(function(){f=null,t(e.resolved)&&v(null)},m.timeout)))),c=!1,e.loading?e.loadingComp:e.resolved}}(p=i,f)))return function(e,t,n,r,i){var o=ve();return o.asyncFactory=e,o.asyncMeta={data:t,context:n,children:r,tag:i},o}(p,a,s,c,l);a=a||{},wn(i),n(a.model)&&function(e,t){var r=e.model&&e.model.prop||"value",i=e.model&&e.model.event||"input";(t.attrs||(t.attrs={}))[r]=t.model.value;var o=t.on||(t.on={}),a=o[i],s=t.model.callback;n(a)?(Array.isArray(a)?-1===a.indexOf(s):a!==s)&&(o[i]=[s].concat(a)):o[i]=s}(i.options,a);var d=function(e,r,i){var o=r.options.props;if(!t(o)){var a={},s=e.attrs,c=e.props;if(n(s)||n(c))for(var u in o){var l=C(u);at(a,c,u,l,!0)||at(a,s,u,l,!1)}return a}}(a,i);if(r(i.options.functional))return function(t,r,i,o,a){var s=t.options,c={},u=s.props;if(n(u))for(var l in u)c[l]=Ie(l,u,r||e);else n(i.attrs)&&Dt(c,i.attrs),n(i.props)&&Dt(c,i.props);var f=new Et(i,c,a,o,t),p=s.render.call(null,f._c,f);if(p instanceof pe)return jt(p,i,f.parent,s);if(Array.isArray(p)){for(var d=st(p)||[],v=new Array(d.length),h=0;h<d.length;h++)v[h]=jt(d[h],i,f.parent,s);return v}}(i,d,a,s,c);var v=a.on;if(a.on=a.nativeOn,r(i.options.abstract)){var m=a.slot;a={},m&&(a.slot=m)}!function(e){for(var t=e.hook||(e.hook={}),n=0;n<It.length;n++){var r=It[n],i=t[r],o=Lt[r];i===o||i&&i._merged||(t[r]=i?Ft(o,i):o)}}(a);var y=i.options.name||l;return new pe("vue-component-"+i.cid+(y?"-"+y:""),a,void 0,void 0,void 0,s,{Ctor:i,propsData:d,listeners:v,tag:l,children:c},p)}}}function Ft(e,t){var n=function(n,r){e(n,r),t(n,r)};return n._merged=!0,n}var Pt=1,Rt=2;function Ht(e,a,s,c,u,l){return(Array.isArray(s)||i(s))&&(u=c,c=s,s=void 0),r(l)&&(u=Rt),function(e,i,a,s,c){if(n(a)&&n(a.__ob__))return ve();n(a)&&n(a.is)&&(i=a.is);if(!i)return ve();Array.isArray(s)&&"function"==typeof s[0]&&((a=a||{}).scopedSlots={default:s[0]},s.length=0);c===Rt?s=st(s):c===Pt&&(s=function(e){for(var t=0;t<e.length;t++)if(Array.isArray(e[t]))return Array.prototype.concat.apply([],e);return e}(s));var u,l;if("string"==typeof i){var f;l=e.$vnode&&e.$vnode.ns||F.getTagNamespace(i),u=F.isReservedTag(i)?new pe(F.parsePlatformTagName(i),a,s,void 0,void 0,e):a&&a.pre||!n(f=Le(e.$options,"components",i))?new pe(i,a,s,void 0,void 0,e):Mt(f,a,e,s,i)}else u=Mt(i,a,e,s);return Array.isArray(u)?u:n(u)?(n(l)&&function e(i,o,a){i.ns=o;"foreignObject"===i.tag&&(o=void 0,a=!0);if(n(i.children))for(var s=0,c=i.children.length;s<c;s++){var u=i.children[s];n(u.tag)&&(t(u.ns)||r(a)&&"svg"!==u.tag)&&e(u,o,a)}}(u,l),n(a)&&function(e){o(e.style)&&tt(e.style);o(e.class)&&tt(e.class)}(a),u):ve()}(e,a,s,c,u)}var Bt,Ut=null;function Vt(e,t){return(e.__esModule||oe&&"Module"===e[Symbol.toStringTag])&&(e=e.default),o(e)?t.extend(e):e}function zt(e){if(Array.isArray(e))for(var t=0;t<e.length;t++){var r=e[t];if(n(r)&&(n(r.componentOptions)||pt(r)))return r}}function Kt(e,t){Bt.$on(e,t)}function Jt(e,t){Bt.$off(e,t)}function qt(e,t){var n=Bt;return function r(){null!==t.apply(null,arguments)&&n.$off(e,r)}}function Wt(e,t,n){Bt=e,it(t,n||{},Kt,Jt,qt,e),Bt=void 0}var Zt=null;function Gt(e){var t=Zt;return Zt=e,function(){Zt=t}}function Xt(e){for(;e&&(e=e.$parent);)if(e._inactive)return!0;return!1}function Yt(e,t){if(t){if(e._directInactive=!1,Xt(e))return}else if(e._directInactive)return;if(e._inactive||null===e._inactive){e._inactive=!1;for(var n=0;n<e.$children.length;n++)Yt(e.$children[n]);Qt(e,"activated")}}function Qt(e,t){le();var n=e.$options[t],r=t+" hook";if(n)for(var i=0,o=n.length;i<o;i++)Be(n[i],e,null,e,r);e._hasHookEvent&&e.$emit("hook:"+t),fe()}var en=[],tn=[],nn={},rn=!1,on=!1,an=0;var sn=0,cn=Date.now;if(V&&!q){var un=window.performance;un&&"function"==typeof un.now&&cn()>document.createEvent("Event").timeStamp&&(cn=function(){return un.now()})}function ln(){var e,t;for(sn=cn(),on=!0,en.sort(function(e,t){return e.id-t.id}),an=0;an<en.length;an++)(e=en[an]).before&&e.before(),t=e.id,nn[t]=null,e.run();var n=tn.slice(),r=en.slice();an=en.length=tn.length=0,nn={},rn=on=!1,function(e){for(var t=0;t<e.length;t++)e[t]._inactive=!0,Yt(e[t],!0)}(n),function(e){var t=e.length;for(;t--;){var n=e[t],r=n.vm;r._watcher===n&&r._isMounted&&!r._isDestroyed&&Qt(r,"updated")}}(r),ne&&F.devtools&&ne.emit("flush")}var fn=0,pn=function(e,t,n,r,i){this.vm=e,i&&(e._watcher=this),e._watchers.push(this),r?(this.deep=!!r.deep,this.user=!!r.user,this.lazy=!!r.lazy,this.sync=!!r.sync,this.before=r.before):this.deep=this.user=this.lazy=this.sync=!1,this.cb=n,this.id=++fn,this.active=!0,this.dirty=this.lazy,this.deps=[],this.newDeps=[],this.depIds=new ie,this.newDepIds=new ie,this.expression="","function"==typeof t?this.getter=t:(this.getter=function(e){if(!H.test(e)){var t=e.split(".");return function(e){for(var n=0;n<t.length;n++){if(!e)return;e=e[t[n]]}return e}}}(t),this.getter||(this.getter=S)),this.value=this.lazy?void 0:this.get()};pn.prototype.get=function(){var e;le(this);var t=this.vm;try{e=this.getter.call(t,t)}catch(e){if(!this.user)throw e;He(e,t,'getter for watcher "'+this.expression+'"')}finally{this.deep&&tt(e),fe(),this.cleanupDeps()}return e},pn.prototype.addDep=function(e){var t=e.id;this.newDepIds.has(t)||(this.newDepIds.add(t),this.newDeps.push(e),this.depIds.has(t)||e.addSub(this))},pn.prototype.cleanupDeps=function(){for(var e=this.deps.length;e--;){var t=this.deps[e];this.newDepIds.has(t.id)||t.removeSub(this)}var n=this.depIds;this.depIds=this.newDepIds,this.newDepIds=n,this.newDepIds.clear(),n=this.deps,this.deps=this.newDeps,this.newDeps=n,this.newDeps.length=0},pn.prototype.update=function(){this.lazy?this.dirty=!0:this.sync?this.run():function(e){var t=e.id;if(null==nn[t]){if(nn[t]=!0,on){for(var n=en.length-1;n>an&&en[n].id>e.id;)n--;en.splice(n+1,0,e)}else en.push(e);rn||(rn=!0,Qe(ln))}}(this)},pn.prototype.run=function(){if(this.active){var e=this.get();if(e!==this.value||o(e)||this.deep){var t=this.value;if(this.value=e,this.user){var n='callback for watcher "'+this.expression+'"';Be(this.cb,this.vm,[e,t],this.vm,n)}else this.cb.call(this.vm,e,t)}}},pn.prototype.evaluate=function(){this.value=this.get(),this.dirty=!1},pn.prototype.depend=function(){for(var e=this.deps.length;e--;)this.deps[e].depend()},pn.prototype.teardown=function(){if(this.active){this.vm._isBeingDestroyed||h(this.vm._watchers,this);for(var e=this.deps.length;e--;)this.deps[e].removeSub(this);this.active=!1}};var dn={enumerable:!0,configurable:!0,get:S,set:S};function vn(e,t,n){dn.get=function(){return this[t][n]},dn.set=function(e){this[t][n]=e},Object.defineProperty(e,n,dn)}function hn(e){e._watchers=[];var t=e.$options;t.props&&function(e,t){var n=e.$options.propsData||{},r=e._props={},i=e.$options._propKeys=[];e.$parent&&$e(!1);var o=function(o){i.push(o);var a=Ie(o,t,n,e);xe(r,o,a),o in e||vn(e,"_props",o)};for(var a in t)o(a);$e(!0)}(e,t.props),t.methods&&function(e,t){e.$options.props;for(var n in t)e[n]="function"!=typeof t[n]?S:x(t[n],e)}(e,t.methods),t.data?function(e){var t=e.$options.data;s(t=e._data="function"==typeof t?function(e,t){le();try{return e.call(t,t)}catch(e){return He(e,t,"data()"),{}}finally{fe()}}(t,e):t||{})||(t={});var n=Object.keys(t),r=e.$options.props,i=(e.$options.methods,n.length);for(;i--;){var o=n[i];r&&y(r,o)||(a=void 0,36!==(a=(o+"").charCodeAt(0))&&95!==a&&vn(e,"_data",o))}var a;Ce(t,!0)}(e):Ce(e._data={},!0),t.computed&&function(e,t){var n=e._computedWatchers=Object.create(null),r=te();for(var i in t){var o=t[i],a="function"==typeof o?o:o.get;r||(n[i]=new pn(e,a||S,S,mn)),i in e||yn(e,i,o)}}(e,t.computed),t.watch&&t.watch!==Y&&function(e,t){for(var n in t){var r=t[n];if(Array.isArray(r))for(var i=0;i<r.length;i++)bn(e,n,r[i]);else bn(e,n,r)}}(e,t.watch)}var mn={lazy:!0};function yn(e,t,n){var r=!te();"function"==typeof n?(dn.get=r?gn(t):_n(n),dn.set=S):(dn.get=n.get?r&&!1!==n.cache?gn(t):_n(n.get):S,dn.set=n.set||S),Object.defineProperty(e,t,dn)}function gn(e){return function(){var t=this._computedWatchers&&this._computedWatchers[e];if(t)return t.dirty&&t.evaluate(),ce.target&&t.depend(),t.value}}function _n(e){return function(){return e.call(this,this)}}function bn(e,t,n,r){return s(n)&&(r=n,n=n.handler),"string"==typeof n&&(n=e[n]),e.$watch(t,n,r)}var $n=0;function wn(e){var t=e.options;if(e.super){var n=wn(e.super);if(n!==e.superOptions){e.superOptions=n;var r=function(e){var t,n=e.options,r=e.sealedOptions;for(var i in n)n[i]!==r[i]&&(t||(t={}),t[i]=n[i]);return t}(e);r&&A(e.extendOptions,r),(t=e.options=De(n,e.extendOptions)).name&&(t.components[t.name]=e)}}return t}function Cn(e){this._init(e)}function xn(e){e.cid=0;var t=1;e.extend=function(e){e=e||{};var n=this,r=n.cid,i=e._Ctor||(e._Ctor={});if(i[r])return i[r];var o=e.name||n.options.name,a=function(e){this._init(e)};return(a.prototype=Object.create(n.prototype)).constructor=a,a.cid=t++,a.options=De(n.options,e),a.super=n,a.options.props&&function(e){var t=e.options.props;for(var n in t)vn(e.prototype,"_props",n)}(a),a.options.computed&&function(e){var t=e.options.computed;for(var n in t)yn(e.prototype,n,t[n])}(a),a.extend=n.extend,a.mixin=n.mixin,a.use=n.use,I.forEach(function(e){a[e]=n[e]}),o&&(a.options.components[o]=a),a.superOptions=n.options,a.extendOptions=e,a.sealedOptions=A({},a.options),i[r]=a,a}}function kn(e){return e&&(e.Ctor.options.name||e.tag)}function An(e,t){return Array.isArray(e)?e.indexOf(t)>-1:"string"==typeof e?e.split(",").indexOf(t)>-1:(n=e,"[object RegExp]"===a.call(n)&&e.test(t));var n}function On(e,t){var n=e.cache,r=e.keys,i=e._vnode;for(var o in n){var a=n[o];if(a){var s=a.name;s&&!t(s)&&Sn(n,o,r,i)}}}function Sn(e,t,n,r){var i=e[t];!i||r&&i.tag===r.tag||i.componentInstance.$destroy(),e[t]=null,h(n,t)}!function(t){t.prototype._init=function(t){var n=this;n._uid=$n++,n._isVue=!0,t&&t._isComponent?function(e,t){var n=e.$options=Object.create(e.constructor.options),r=t._parentVnode;n.parent=t.parent,n._parentVnode=r;var i=r.componentOptions;n.propsData=i.propsData,n._parentListeners=i.listeners,n._renderChildren=i.children,n._componentTag=i.tag,t.render&&(n.render=t.render,n.staticRenderFns=t.staticRenderFns)}(n,t):n.$options=De(wn(n.constructor),t||{},n),n._renderProxy=n,n._self=n,function(e){var t=e.$options,n=t.parent;if(n&&!t.abstract){for(;n.$options.abstract&&n.$parent;)n=n.$parent;n.$children.push(e)}e.$parent=n,e.$root=n?n.$root:e,e.$children=[],e.$refs={},e._watcher=null,e._inactive=null,e._directInactive=!1,e._isMounted=!1,e._isDestroyed=!1,e._isBeingDestroyed=!1}(n),function(e){e._events=Object.create(null),e._hasHookEvent=!1;var t=e.$options._parentListeners;t&&Wt(e,t)}(n),function(t){t._vnode=null,t._staticTrees=null;var n=t.$options,r=t.$vnode=n._parentVnode,i=r&&r.context;t.$slots=lt(n._renderChildren,i),t.$scopedSlots=e,t._c=function(e,n,r,i){return Ht(t,e,n,r,i,!1)},t.$createElement=function(e,n,r,i){return Ht(t,e,n,r,i,!0)};var o=r&&r.data;xe(t,"$attrs",o&&o.attrs||e,null,!0),xe(t,"$listeners",n._parentListeners||e,null,!0)}(n),Qt(n,"beforeCreate"),function(e){var t=ut(e.$options.inject,e);t&&($e(!1),Object.keys(t).forEach(function(n){xe(e,n,t[n])}),$e(!0))}(n),hn(n),function(e){var t=e.$options.provide;t&&(e._provided="function"==typeof t?t.call(e):t)}(n),Qt(n,"created"),n.$options.el&&n.$mount(n.$options.el)}}(Cn),function(e){var t={get:function(){return this._data}},n={get:function(){return this._props}};Object.defineProperty(e.prototype,"$data",t),Object.defineProperty(e.prototype,"$props",n),e.prototype.$set=ke,e.prototype.$delete=Ae,e.prototype.$watch=function(e,t,n){if(s(t))return bn(this,e,t,n);(n=n||{}).user=!0;var r=new pn(this,e,t,n);if(n.immediate){var i='callback for immediate watcher "'+r.expression+'"';le(),Be(t,this,[r.value],this,i),fe()}return function(){r.teardown()}}}(Cn),function(e){var t=/^hook:/;e.prototype.$on=function(e,n){var r=this;if(Array.isArray(e))for(var i=0,o=e.length;i<o;i++)r.$on(e[i],n);else(r._events[e]||(r._events[e]=[])).push(n),t.test(e)&&(r._hasHookEvent=!0);return r},e.prototype.$once=function(e,t){var n=this;function r(){n.$off(e,r),t.apply(n,arguments)}return r.fn=t,n.$on(e,r),n},e.prototype.$off=function(e,t){var n=this;if(!arguments.length)return n._events=Object.create(null),n;if(Array.isArray(e)){for(var r=0,i=e.length;r<i;r++)n.$off(e[r],t);return n}var o,a=n._events[e];if(!a)return n;if(!t)return n._events[e]=null,n;for(var s=a.length;s--;)if((o=a[s])===t||o.fn===t){a.splice(s,1);break}return n},e.prototype.$emit=function(e){var t=this._events[e];if(t){t=t.length>1?k(t):t;for(var n=k(arguments,1),r='event handler for "'+e+'"',i=0,o=t.length;i<o;i++)Be(t[i],this,n,this,r)}return this}}(Cn),function(e){e.prototype._update=function(e,t){var n=this,r=n.$el,i=n._vnode,o=Gt(n);n._vnode=e,n.$el=i?n.__patch__(i,e):n.__patch__(n.$el,e,t,!1),o(),r&&(r.__vue__=null),n.$el&&(n.$el.__vue__=n),n.$vnode&&n.$parent&&n.$vnode===n.$parent._vnode&&(n.$parent.$el=n.$el)},e.prototype.$forceUpdate=function(){this._watcher&&this._watcher.update()},e.prototype.$destroy=function(){var e=this;if(!e._isBeingDestroyed){Qt(e,"beforeDestroy"),e._isBeingDestroyed=!0;var t=e.$parent;!t||t._isBeingDestroyed||e.$options.abstract||h(t.$children,e),e._watcher&&e._watcher.teardown();for(var n=e._watchers.length;n--;)e._watchers[n].teardown();e._data.__ob__&&e._data.__ob__.vmCount--,e._isDestroyed=!0,e.__patch__(e._vnode,null),Qt(e,"destroyed"),e.$off(),e.$el&&(e.$el.__vue__=null),e.$vnode&&(e.$vnode.parent=null)}}}(Cn),function(e){Nt(e.prototype),e.prototype.$nextTick=function(e){return Qe(e,this)},e.prototype._render=function(){var e,t=this,n=t.$options,r=n.render,i=n._parentVnode;i&&(t.$scopedSlots=dt(i.data.scopedSlots,t.$slots,t.$scopedSlots)),t.$vnode=i;try{Ut=t,e=r.call(t._renderProxy,t.$createElement)}catch(n){He(n,t,"render"),e=t._vnode}finally{Ut=null}return Array.isArray(e)&&1===e.length&&(e=e[0]),e instanceof pe||(e=ve()),e.parent=i,e}}(Cn);var Tn=[String,RegExp,Array],Nn={KeepAlive:{name:"keep-alive",abstract:!0,props:{include:Tn,exclude:Tn,max:[String,Number]},methods:{cacheVNode:function(){var e=this.cache,t=this.keys,n=this.vnodeToCache,r=this.keyToCache;if(n){var i=n.tag,o=n.componentInstance,a=n.componentOptions;e[r]={name:kn(a),tag:i,componentInstance:o},t.push(r),this.max&&t.length>parseInt(this.max)&&Sn(e,t[0],t,this._vnode),this.vnodeToCache=null}}},created:function(){this.cache=Object.create(null),this.keys=[]},destroyed:function(){for(var e in this.cache)Sn(this.cache,e,this.keys)},mounted:function(){var e=this;this.cacheVNode(),this.$watch("include",function(t){On(e,function(e){return An(t,e)})}),this.$watch("exclude",function(t){On(e,function(e){return!An(t,e)})})},updated:function(){this.cacheVNode()},render:function(){var e=this.$slots.default,t=zt(e),n=t&&t.componentOptions;if(n){var r=kn(n),i=this.include,o=this.exclude;if(i&&(!r||!An(i,r))||o&&r&&An(o,r))return t;var a=this.cache,s=this.keys,c=null==t.key?n.Ctor.cid+(n.tag?"::"+n.tag:""):t.key;a[c]?(t.componentInstance=a[c].componentInstance,h(s,c),s.push(c)):(this.vnodeToCache=t,this.keyToCache=c),t.data.keepAlive=!0}return t||e&&e[0]}}};!function(e){var t={get:function(){return F}};Object.defineProperty(e,"config",t),e.util={warn:ae,extend:A,mergeOptions:De,defineReactive:xe},e.set=ke,e.delete=Ae,e.nextTick=Qe,e.observable=function(e){return Ce(e),e},e.options=Object.create(null),I.forEach(function(t){e.options[t+"s"]=Object.create(null)}),e.options._base=e,A(e.options.components,Nn),function(e){e.use=function(e){var t=this._installedPlugins||(this._installedPlugins=[]);if(t.indexOf(e)>-1)return this;var n=k(arguments,1);return n.unshift(this),"function"==typeof e.install?e.install.apply(e,n):"function"==typeof e&&e.apply(null,n),t.push(e),this}}(e),function(e){e.mixin=function(e){return this.options=De(this.options,e),this}}(e),xn(e),function(e){I.forEach(function(t){e[t]=function(e,n){return n?("component"===t&&s(n)&&(n.name=n.name||e,n=this.options._base.extend(n)),"directive"===t&&"function"==typeof n&&(n={bind:n,update:n}),this.options[t+"s"][e]=n,n):this.options[t+"s"][e]}})}(e)}(Cn),Object.defineProperty(Cn.prototype,"$isServer",{get:te}),Object.defineProperty(Cn.prototype,"$ssrContext",{get:function(){return this.$vnode&&this.$vnode.ssrContext}}),Object.defineProperty(Cn,"FunctionalRenderContext",{value:Et}),Cn.version="2.6.14";var En=p("style,class"),jn=p("input,textarea,option,select,progress"),Dn=function(e,t,n){return"value"===n&&jn(e)&&"button"!==t||"selected"===n&&"option"===e||"checked"===n&&"input"===e||"muted"===n&&"video"===e},Ln=p("contenteditable,draggable,spellcheck"),In=p("events,caret,typing,plaintext-only"),Mn=function(e,t){return Bn(t)||"false"===t?"false":"contenteditable"===e&&In(t)?t:"true"},Fn=p("allowfullscreen,async,autofocus,autoplay,checked,compact,controls,declare,default,defaultchecked,defaultmuted,defaultselected,defer,disabled,enabled,formnovalidate,hidden,indeterminate,inert,ismap,itemscope,loop,multiple,muted,nohref,noresize,noshade,novalidate,nowrap,open,pauseonexit,readonly,required,reversed,scoped,seamless,selected,sortable,truespeed,typemustmatch,visible"),Pn="http://www.w3.org/1999/xlink",Rn=function(e){return":"===e.charAt(5)&&"xlink"===e.slice(0,5)},Hn=function(e){return Rn(e)?e.slice(6,e.length):""},Bn=function(e){return null==e||!1===e};function Un(e){for(var t=e.data,r=e,i=e;n(i.componentInstance);)(i=i.componentInstance._vnode)&&i.data&&(t=Vn(i.data,t));for(;n(r=r.parent);)r&&r.data&&(t=Vn(t,r.data));return function(e,t){if(n(e)||n(t))return zn(e,Kn(t));return""}(t.staticClass,t.class)}function Vn(e,t){return{staticClass:zn(e.staticClass,t.staticClass),class:n(e.class)?[e.class,t.class]:t.class}}function zn(e,t){return e?t?e+" "+t:e:t||""}function Kn(e){return Array.isArray(e)?function(e){for(var t,r="",i=0,o=e.length;i<o;i++)n(t=Kn(e[i]))&&""!==t&&(r&&(r+=" "),r+=t);return r}(e):o(e)?function(e){var t="";for(var n in e)e[n]&&(t&&(t+=" "),t+=n);return t}(e):"string"==typeof e?e:""}var Jn={svg:"http://www.w3.org/2000/svg",math:"http://www.w3.org/1998/Math/MathML"},qn=p("html,body,base,head,link,meta,style,title,address,article,aside,footer,header,h1,h2,h3,h4,h5,h6,hgroup,nav,section,div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,rtc,ruby,s,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,embed,object,param,source,canvas,script,noscript,del,ins,caption,col,colgroup,table,thead,tbody,td,th,tr,button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,output,progress,select,textarea,details,dialog,menu,menuitem,summary,content,element,shadow,template,blockquote,iframe,tfoot"),Wn=p("svg,animate,circle,clippath,cursor,defs,desc,ellipse,filter,font-face,foreignobject,g,glyph,image,line,marker,mask,missing-glyph,path,pattern,polygon,polyline,rect,switch,symbol,text,textpath,tspan,use,view",!0),Zn=function(e){return qn(e)||Wn(e)};function Gn(e){return Wn(e)?"svg":"math"===e?"math":void 0}var Xn=Object.create(null);var Yn=p("text,number,password,search,email,tel,url");function Qn(e){if("string"==typeof e){var t=document.querySelector(e);return t||document.createElement("div")}return e}var er=Object.freeze({createElement:function(e,t){var n=document.createElement(e);return"select"!==e?n:(t.data&&t.data.attrs&&void 0!==t.data.attrs.multiple&&n.setAttribute("multiple","multiple"),n)},createElementNS:function(e,t){return document.createElementNS(Jn[e],t)},createTextNode:function(e){return document.createTextNode(e)},createComment:function(e){return document.createComment(e)},insertBefore:function(e,t,n){e.insertBefore(t,n)},removeChild:function(e,t){e.removeChild(t)},appendChild:function(e,t){e.appendChild(t)},parentNode:function(e){return e.parentNode},nextSibling:function(e){return e.nextSibling},tagName:function(e){return e.tagName},setTextContent:function(e,t){e.textContent=t},setStyleScope:function(e,t){e.setAttribute(t,"")}}),tr={create:function(e,t){nr(t)},update:function(e,t){e.data.ref!==t.data.ref&&(nr(e,!0),nr(t))},destroy:function(e){nr(e,!0)}};function nr(e,t){var r=e.data.ref;if(n(r)){var i=e.context,o=e.componentInstance||e.elm,a=i.$refs;t?Array.isArray(a[r])?h(a[r],o):a[r]===o&&(a[r]=void 0):e.data.refInFor?Array.isArray(a[r])?a[r].indexOf(o)<0&&a[r].push(o):a[r]=[o]:a[r]=o}}var rr=new pe("",{},[]),ir=["create","activate","update","remove","destroy"];function or(e,i){return e.key===i.key&&e.asyncFactory===i.asyncFactory&&(e.tag===i.tag&&e.isComment===i.isComment&&n(e.data)===n(i.data)&&function(e,t){if("input"!==e.tag)return!0;var r,i=n(r=e.data)&&n(r=r.attrs)&&r.type,o=n(r=t.data)&&n(r=r.attrs)&&r.type;return i===o||Yn(i)&&Yn(o)}(e,i)||r(e.isAsyncPlaceholder)&&t(i.asyncFactory.error))}function ar(e,t,r){var i,o,a={};for(i=t;i<=r;++i)n(o=e[i].key)&&(a[o]=i);return a}var sr={create:cr,update:cr,destroy:function(e){cr(e,rr)}};function cr(e,t){(e.data.directives||t.data.directives)&&function(e,t){var n,r,i,o=e===rr,a=t===rr,s=lr(e.data.directives,e.context),c=lr(t.data.directives,t.context),u=[],l=[];for(n in c)r=s[n],i=c[n],r?(i.oldValue=r.value,i.oldArg=r.arg,pr(i,"update",t,e),i.def&&i.def.componentUpdated&&l.push(i)):(pr(i,"bind",t,e),i.def&&i.def.inserted&&u.push(i));if(u.length){var f=function(){for(var n=0;n<u.length;n++)pr(u[n],"inserted",t,e)};o?ot(t,"insert",f):f()}l.length&&ot(t,"postpatch",function(){for(var n=0;n<l.length;n++)pr(l[n],"componentUpdated",t,e)});if(!o)for(n in s)c[n]||pr(s[n],"unbind",e,e,a)}(e,t)}var ur=Object.create(null);function lr(e,t){var n,r,i=Object.create(null);if(!e)return i;for(n=0;n<e.length;n++)(r=e[n]).modifiers||(r.modifiers=ur),i[fr(r)]=r,r.def=Le(t.$options,"directives",r.name);return i}function fr(e){return e.rawName||e.name+"."+Object.keys(e.modifiers||{}).join(".")}function pr(e,t,n,r,i){var o=e.def&&e.def[t];if(o)try{o(n.elm,e,n,r,i)}catch(r){He(r,n.context,"directive "+e.name+" "+t+" hook")}}var dr=[tr,sr];function vr(e,r){var i=r.componentOptions;if(!(n(i)&&!1===i.Ctor.options.inheritAttrs||t(e.data.attrs)&&t(r.data.attrs))){var o,a,s=r.elm,c=e.data.attrs||{},u=r.data.attrs||{};for(o in n(u.__ob__)&&(u=r.data.attrs=A({},u)),u)a=u[o],c[o]!==a&&hr(s,o,a,r.data.pre);for(o in(q||Z)&&u.value!==c.value&&hr(s,"value",u.value),c)t(u[o])&&(Rn(o)?s.removeAttributeNS(Pn,Hn(o)):Ln(o)||s.removeAttribute(o))}}function hr(e,t,n,r){r||e.tagName.indexOf("-")>-1?mr(e,t,n):Fn(t)?Bn(n)?e.removeAttribute(t):(n="allowfullscreen"===t&&"EMBED"===e.tagName?"true":t,e.setAttribute(t,n)):Ln(t)?e.setAttribute(t,Mn(t,n)):Rn(t)?Bn(n)?e.removeAttributeNS(Pn,Hn(t)):e.setAttributeNS(Pn,t,n):mr(e,t,n)}function mr(e,t,n){if(Bn(n))e.removeAttribute(t);else{if(q&&!W&&"TEXTAREA"===e.tagName&&"placeholder"===t&&""!==n&&!e.__ieph){var r=function(t){t.stopImmediatePropagation(),e.removeEventListener("input",r)};e.addEventListener("input",r),e.__ieph=!0}e.setAttribute(t,n)}}var yr={create:vr,update:vr};function gr(e,r){var i=r.elm,o=r.data,a=e.data;if(!(t(o.staticClass)&&t(o.class)&&(t(a)||t(a.staticClass)&&t(a.class)))){var s=Un(r),c=i._transitionClasses;n(c)&&(s=zn(s,Kn(c))),s!==i._prevClass&&(i.setAttribute("class",s),i._prevClass=s)}}var _r,br,$r,wr,Cr,xr,kr={create:gr,update:gr},Ar=/[\w).+\-_$\]]/;function Or(e){var t,n,r,i,o,a=!1,s=!1,c=!1,u=!1,l=0,f=0,p=0,d=0;for(r=0;r<e.length;r++)if(n=t,t=e.charCodeAt(r),a)39===t&&92!==n&&(a=!1);else if(s)34===t&&92!==n&&(s=!1);else if(c)96===t&&92!==n&&(c=!1);else if(u)47===t&&92!==n&&(u=!1);else if(124!==t||124===e.charCodeAt(r+1)||124===e.charCodeAt(r-1)||l||f||p){switch(t){case 34:s=!0;break;case 39:a=!0;break;case 96:c=!0;break;case 40:p++;break;case 41:p--;break;case 91:f++;break;case 93:f--;break;case 123:l++;break;case 125:l--}if(47===t){for(var v=r-1,h=void 0;v>=0&&" "===(h=e.charAt(v));v--);h&&Ar.test(h)||(u=!0)}}else void 0===i?(d=r+1,i=e.slice(0,r).trim()):m();function m(){(o||(o=[])).push(e.slice(d,r).trim()),d=r+1}if(void 0===i?i=e.slice(0,r).trim():0!==d&&m(),o)for(r=0;r<o.length;r++)i=Sr(i,o[r]);return i}function Sr(e,t){var n=t.indexOf("(");if(n<0)return'_f("'+t+'")('+e+")";var r=t.slice(0,n),i=t.slice(n+1);return'_f("'+r+'")('+e+(")"!==i?","+i:i)}function Tr(e,t){console.error("[Vue compiler]: "+e)}function Nr(e,t){return e?e.map(function(e){return e[t]}).filter(function(e){return e}):[]}function Er(e,t,n,r,i){(e.props||(e.props=[])).push(Hr({name:t,value:n,dynamic:i},r)),e.plain=!1}function jr(e,t,n,r,i){(i?e.dynamicAttrs||(e.dynamicAttrs=[]):e.attrs||(e.attrs=[])).push(Hr({name:t,value:n,dynamic:i},r)),e.plain=!1}function Dr(e,t,n,r){e.attrsMap[t]=n,e.attrsList.push(Hr({name:t,value:n},r))}function Lr(e,t,n,r,i,o,a,s){(e.directives||(e.directives=[])).push(Hr({name:t,rawName:n,value:r,arg:i,isDynamicArg:o,modifiers:a},s)),e.plain=!1}function Ir(e,t,n){return n?"_p("+t+',"'+e+'")':e+t}function Mr(t,n,r,i,o,a,s,c){var u;(i=i||e).right?c?n="("+n+")==='click'?'contextmenu':("+n+")":"click"===n&&(n="contextmenu",delete i.right):i.middle&&(c?n="("+n+")==='click'?'mouseup':("+n+")":"click"===n&&(n="mouseup")),i.capture&&(delete i.capture,n=Ir("!",n,c)),i.once&&(delete i.once,n=Ir("~",n,c)),i.passive&&(delete i.passive,n=Ir("&",n,c)),i.native?(delete i.native,u=t.nativeEvents||(t.nativeEvents={})):u=t.events||(t.events={});var l=Hr({value:r.trim(),dynamic:c},s);i!==e&&(l.modifiers=i);var f=u[n];Array.isArray(f)?o?f.unshift(l):f.push(l):u[n]=f?o?[l,f]:[f,l]:l,t.plain=!1}function Fr(e,t,n){var r=Pr(e,":"+t)||Pr(e,"v-bind:"+t);if(null!=r)return Or(r);if(!1!==n){var i=Pr(e,t);if(null!=i)return JSON.stringify(i)}}function Pr(e,t,n){var r;if(null!=(r=e.attrsMap[t]))for(var i=e.attrsList,o=0,a=i.length;o<a;o++)if(i[o].name===t){i.splice(o,1);break}return n&&delete e.attrsMap[t],r}function Rr(e,t){for(var n=e.attrsList,r=0,i=n.length;r<i;r++){var o=n[r];if(t.test(o.name))return n.splice(r,1),o}}function Hr(e,t){return t&&(null!=t.start&&(e.start=t.start),null!=t.end&&(e.end=t.end)),e}function Br(e,t,n){var r=n||{},i=r.number,o="$$v";r.trim&&(o="(typeof $$v === 'string'? $$v.trim(): $$v)"),i&&(o="_n("+o+")");var a=Ur(t,o);e.model={value:"("+t+")",expression:JSON.stringify(t),callback:"function ($$v) {"+a+"}"}}function Ur(e,t){var n=function(e){if(e=e.trim(),_r=e.length,e.indexOf("[")<0||e.lastIndexOf("]")<_r-1)return(wr=e.lastIndexOf("."))>-1?{exp:e.slice(0,wr),key:'"'+e.slice(wr+1)+'"'}:{exp:e,key:null};br=e,wr=Cr=xr=0;for(;!zr();)Kr($r=Vr())?qr($r):91===$r&&Jr($r);return{exp:e.slice(0,Cr),key:e.slice(Cr+1,xr)}}(e);return null===n.key?e+"="+t:"$set("+n.exp+", "+n.key+", "+t+")"}function Vr(){return br.charCodeAt(++wr)}function zr(){return wr>=_r}function Kr(e){return 34===e||39===e}function Jr(e){var t=1;for(Cr=wr;!zr();)if(Kr(e=Vr()))qr(e);else if(91===e&&t++,93===e&&t--,0===t){xr=wr;break}}function qr(e){for(var t=e;!zr()&&(e=Vr())!==t;);}var Wr,Zr="__r",Gr="__c";function Xr(e,t,n){var r=Wr;return function i(){null!==t.apply(null,arguments)&&ei(e,i,n,r)}}var Yr=Ke&&!(X&&Number(X[1])<=53);function Qr(e,t,n,r){if(Yr){var i=sn,o=t;t=o._wrapper=function(e){if(e.target===e.currentTarget||e.timeStamp>=i||e.timeStamp<=0||e.target.ownerDocument!==document)return o.apply(this,arguments)}}Wr.addEventListener(e,t,Q?{capture:n,passive:r}:n)}function ei(e,t,n,r){(r||Wr).removeEventListener(e,t._wrapper||t,n)}function ti(e,r){if(!t(e.data.on)||!t(r.data.on)){var i=r.data.on||{},o=e.data.on||{};Wr=r.elm,function(e){if(n(e[Zr])){var t=q?"change":"input";e[t]=[].concat(e[Zr],e[t]||[]),delete e[Zr]}n(e[Gr])&&(e.change=[].concat(e[Gr],e.change||[]),delete e[Gr])}(i),it(i,o,Qr,ei,Xr,r.context),Wr=void 0}}var ni,ri={create:ti,update:ti};function ii(e,r){if(!t(e.data.domProps)||!t(r.data.domProps)){var i,o,a=r.elm,s=e.data.domProps||{},c=r.data.domProps||{};for(i in n(c.__ob__)&&(c=r.data.domProps=A({},c)),s)i in c||(a[i]="");for(i in c){if(o=c[i],"textContent"===i||"innerHTML"===i){if(r.children&&(r.children.length=0),o===s[i])continue;1===a.childNodes.length&&a.removeChild(a.childNodes[0])}if("value"===i&&"PROGRESS"!==a.tagName){a._value=o;var u=t(o)?"":String(o);oi(a,u)&&(a.value=u)}else if("innerHTML"===i&&Wn(a.tagName)&&t(a.innerHTML)){(ni=ni||document.createElement("div")).innerHTML="<svg>"+o+"</svg>";for(var l=ni.firstChild;a.firstChild;)a.removeChild(a.firstChild);for(;l.firstChild;)a.appendChild(l.firstChild)}else if(o!==s[i])try{a[i]=o}catch(e){}}}}function oi(e,t){return!e.composing&&("OPTION"===e.tagName||function(e,t){var n=!0;try{n=document.activeElement!==e}catch(e){}return n&&e.value!==t}(e,t)||function(e,t){var r=e.value,i=e._vModifiers;if(n(i)){if(i.number)return f(r)!==f(t);if(i.trim)return r.trim()!==t.trim()}return r!==t}(e,t))}var ai={create:ii,update:ii},si=g(function(e){var t={},n=/:(.+)/;return e.split(/;(?![^(]*\))/g).forEach(function(e){if(e){var r=e.split(n);r.length>1&&(t[r[0].trim()]=r[1].trim())}}),t});function ci(e){var t=ui(e.style);return e.staticStyle?A(e.staticStyle,t):t}function ui(e){return Array.isArray(e)?O(e):"string"==typeof e?si(e):e}var li,fi=/^--/,pi=/\s*!important$/,di=function(e,t,n){if(fi.test(t))e.style.setProperty(t,n);else if(pi.test(n))e.style.setProperty(C(t),n.replace(pi,""),"important");else{var r=hi(t);if(Array.isArray(n))for(var i=0,o=n.length;i<o;i++)e.style[r]=n[i];else e.style[r]=n}},vi=["Webkit","Moz","ms"],hi=g(function(e){if(li=li||document.createElement("div").style,"filter"!==(e=b(e))&&e in li)return e;for(var t=e.charAt(0).toUpperCase()+e.slice(1),n=0;n<vi.length;n++){var r=vi[n]+t;if(r in li)return r}});function mi(e,r){var i=r.data,o=e.data;if(!(t(i.staticStyle)&&t(i.style)&&t(o.staticStyle)&&t(o.style))){var a,s,c=r.elm,u=o.staticStyle,l=o.normalizedStyle||o.style||{},f=u||l,p=ui(r.data.style)||{};r.data.normalizedStyle=n(p.__ob__)?A({},p):p;var d=function(e,t){var n,r={};if(t)for(var i=e;i.componentInstance;)(i=i.componentInstance._vnode)&&i.data&&(n=ci(i.data))&&A(r,n);(n=ci(e.data))&&A(r,n);for(var o=e;o=o.parent;)o.data&&(n=ci(o.data))&&A(r,n);return r}(r,!0);for(s in f)t(d[s])&&di(c,s,"");for(s in d)(a=d[s])!==f[s]&&di(c,s,null==a?"":a)}}var yi={create:mi,update:mi},gi=/\s+/;function _i(e,t){if(t&&(t=t.trim()))if(e.classList)t.indexOf(" ")>-1?t.split(gi).forEach(function(t){return e.classList.add(t)}):e.classList.add(t);else{var n=" "+(e.getAttribute("class")||"")+" ";n.indexOf(" "+t+" ")<0&&e.setAttribute("class",(n+t).trim())}}function bi(e,t){if(t&&(t=t.trim()))if(e.classList)t.indexOf(" ")>-1?t.split(gi).forEach(function(t){return e.classList.remove(t)}):e.classList.remove(t),e.classList.length||e.removeAttribute("class");else{for(var n=" "+(e.getAttribute("class")||"")+" ",r=" "+t+" ";n.indexOf(r)>=0;)n=n.replace(r," ");(n=n.trim())?e.setAttribute("class",n):e.removeAttribute("class")}}function $i(e){if(e){if("object"==typeof e){var t={};return!1!==e.css&&A(t,wi(e.name||"v")),A(t,e),t}return"string"==typeof e?wi(e):void 0}}var wi=g(function(e){return{enterClass:e+"-enter",enterToClass:e+"-enter-to",enterActiveClass:e+"-enter-active",leaveClass:e+"-leave",leaveToClass:e+"-leave-to",leaveActiveClass:e+"-leave-active"}}),Ci=V&&!W,xi="transition",ki="animation",Ai="transition",Oi="transitionend",Si="animation",Ti="animationend";Ci&&(void 0===window.ontransitionend&&void 0!==window.onwebkittransitionend&&(Ai="WebkitTransition",Oi="webkitTransitionEnd"),void 0===window.onanimationend&&void 0!==window.onwebkitanimationend&&(Si="WebkitAnimation",Ti="webkitAnimationEnd"));var Ni=V?window.requestAnimationFrame?window.requestAnimationFrame.bind(window):setTimeout:function(e){return e()};function Ei(e){Ni(function(){Ni(e)})}function ji(e,t){var n=e._transitionClasses||(e._transitionClasses=[]);n.indexOf(t)<0&&(n.push(t),_i(e,t))}function Di(e,t){e._transitionClasses&&h(e._transitionClasses,t),bi(e,t)}function Li(e,t,n){var r=Mi(e,t),i=r.type,o=r.timeout,a=r.propCount;if(!i)return n();var s=i===xi?Oi:Ti,c=0,u=function(){e.removeEventListener(s,l),n()},l=function(t){t.target===e&&++c>=a&&u()};setTimeout(function(){c<a&&u()},o+1),e.addEventListener(s,l)}var Ii=/\b(transform|all)(,|$)/;function Mi(e,t){var n,r=window.getComputedStyle(e),i=(r[Ai+"Delay"]||"").split(", "),o=(r[Ai+"Duration"]||"").split(", "),a=Fi(i,o),s=(r[Si+"Delay"]||"").split(", "),c=(r[Si+"Duration"]||"").split(", "),u=Fi(s,c),l=0,f=0;return t===xi?a>0&&(n=xi,l=a,f=o.length):t===ki?u>0&&(n=ki,l=u,f=c.length):f=(n=(l=Math.max(a,u))>0?a>u?xi:ki:null)?n===xi?o.length:c.length:0,{type:n,timeout:l,propCount:f,hasTransform:n===xi&&Ii.test(r[Ai+"Property"])}}function Fi(e,t){for(;e.length<t.length;)e=e.concat(e);return Math.max.apply(null,t.map(function(t,n){return Pi(t)+Pi(e[n])}))}function Pi(e){return 1e3*Number(e.slice(0,-1).replace(",","."))}function Ri(e,r){var i=e.elm;n(i._leaveCb)&&(i._leaveCb.cancelled=!0,i._leaveCb());var a=$i(e.data.transition);if(!t(a)&&!n(i._enterCb)&&1===i.nodeType){for(var s=a.css,c=a.type,u=a.enterClass,l=a.enterToClass,p=a.enterActiveClass,d=a.appearClass,v=a.appearToClass,h=a.appearActiveClass,m=a.beforeEnter,y=a.enter,g=a.afterEnter,_=a.enterCancelled,b=a.beforeAppear,$=a.appear,w=a.afterAppear,C=a.appearCancelled,x=a.duration,k=Zt,A=Zt.$vnode;A&&A.parent;)k=A.context,A=A.parent;var O=!k._isMounted||!e.isRootInsert;if(!O||$||""===$){var S=O&&d?d:u,T=O&&h?h:p,N=O&&v?v:l,E=O&&b||m,j=O&&"function"==typeof $?$:y,L=O&&w||g,I=O&&C||_,M=f(o(x)?x.enter:x),F=!1!==s&&!W,P=Ui(j),R=i._enterCb=D(function(){F&&(Di(i,N),Di(i,T)),R.cancelled?(F&&Di(i,S),I&&I(i)):L&&L(i),i._enterCb=null});e.data.show||ot(e,"insert",function(){var t=i.parentNode,n=t&&t._pending&&t._pending[e.key];n&&n.tag===e.tag&&n.elm._leaveCb&&n.elm._leaveCb(),j&&j(i,R)}),E&&E(i),F&&(ji(i,S),ji(i,T),Ei(function(){Di(i,S),R.cancelled||(ji(i,N),P||(Bi(M)?setTimeout(R,M):Li(i,c,R)))})),e.data.show&&(r&&r(),j&&j(i,R)),F||P||R()}}}function Hi(e,r){var i=e.elm;n(i._enterCb)&&(i._enterCb.cancelled=!0,i._enterCb());var a=$i(e.data.transition);if(t(a)||1!==i.nodeType)return r();if(!n(i._leaveCb)){var s=a.css,c=a.type,u=a.leaveClass,l=a.leaveToClass,p=a.leaveActiveClass,d=a.beforeLeave,v=a.leave,h=a.afterLeave,m=a.leaveCancelled,y=a.delayLeave,g=a.duration,_=!1!==s&&!W,b=Ui(v),$=f(o(g)?g.leave:g),w=i._leaveCb=D(function(){i.parentNode&&i.parentNode._pending&&(i.parentNode._pending[e.key]=null),_&&(Di(i,l),Di(i,p)),w.cancelled?(_&&Di(i,u),m&&m(i)):(r(),h&&h(i)),i._leaveCb=null});y?y(C):C()}function C(){w.cancelled||(!e.data.show&&i.parentNode&&((i.parentNode._pending||(i.parentNode._pending={}))[e.key]=e),d&&d(i),_&&(ji(i,u),ji(i,p),Ei(function(){Di(i,u),w.cancelled||(ji(i,l),b||(Bi($)?setTimeout(w,$):Li(i,c,w)))})),v&&v(i,w),_||b||w())}}function Bi(e){return"number"==typeof e&&!isNaN(e)}function Ui(e){if(t(e))return!1;var r=e.fns;return n(r)?Ui(Array.isArray(r)?r[0]:r):(e._length||e.length)>1}function Vi(e,t){!0!==t.data.show&&Ri(t)}var zi=function(e){var o,a,s={},c=e.modules,u=e.nodeOps;for(o=0;o<ir.length;++o)for(s[ir[o]]=[],a=0;a<c.length;++a)n(c[a][ir[o]])&&s[ir[o]].push(c[a][ir[o]]);function l(e){var t=u.parentNode(e);n(t)&&u.removeChild(t,e)}function f(e,t,i,o,a,c,l){if(n(e.elm)&&n(c)&&(e=c[l]=me(e)),e.isRootInsert=!a,!function(e,t,i,o){var a=e.data;if(n(a)){var c=n(e.componentInstance)&&a.keepAlive;if(n(a=a.hook)&&n(a=a.init)&&a(e,!1),n(e.componentInstance))return d(e,t),v(i,e.elm,o),r(c)&&function(e,t,r,i){for(var o,a=e;a.componentInstance;)if(a=a.componentInstance._vnode,n(o=a.data)&&n(o=o.transition)){for(o=0;o<s.activate.length;++o)s.activate[o](rr,a);t.push(a);break}v(r,e.elm,i)}(e,t,i,o),!0}}(e,t,i,o)){var f=e.data,p=e.children,m=e.tag;n(m)?(e.elm=e.ns?u.createElementNS(e.ns,m):u.createElement(m,e),g(e),h(e,p,t),n(f)&&y(e,t),v(i,e.elm,o)):r(e.isComment)?(e.elm=u.createComment(e.text),v(i,e.elm,o)):(e.elm=u.createTextNode(e.text),v(i,e.elm,o))}}function d(e,t){n(e.data.pendingInsert)&&(t.push.apply(t,e.data.pendingInsert),e.data.pendingInsert=null),e.elm=e.componentInstance.$el,m(e)?(y(e,t),g(e)):(nr(e),t.push(e))}function v(e,t,r){n(e)&&(n(r)?u.parentNode(r)===e&&u.insertBefore(e,t,r):u.appendChild(e,t))}function h(e,t,n){if(Array.isArray(t))for(var r=0;r<t.length;++r)f(t[r],n,e.elm,null,!0,t,r);else i(e.text)&&u.appendChild(e.elm,u.createTextNode(String(e.text)))}function m(e){for(;e.componentInstance;)e=e.componentInstance._vnode;return n(e.tag)}function y(e,t){for(var r=0;r<s.create.length;++r)s.create[r](rr,e);n(o=e.data.hook)&&(n(o.create)&&o.create(rr,e),n(o.insert)&&t.push(e))}function g(e){var t;if(n(t=e.fnScopeId))u.setStyleScope(e.elm,t);else for(var r=e;r;)n(t=r.context)&&n(t=t.$options._scopeId)&&u.setStyleScope(e.elm,t),r=r.parent;n(t=Zt)&&t!==e.context&&t!==e.fnContext&&n(t=t.$options._scopeId)&&u.setStyleScope(e.elm,t)}function _(e,t,n,r,i,o){for(;r<=i;++r)f(n[r],o,e,t,!1,n,r)}function b(e){var t,r,i=e.data;if(n(i))for(n(t=i.hook)&&n(t=t.destroy)&&t(e),t=0;t<s.destroy.length;++t)s.destroy[t](e);if(n(t=e.children))for(r=0;r<e.children.length;++r)b(e.children[r])}function $(e,t,r){for(;t<=r;++t){var i=e[t];n(i)&&(n(i.tag)?(w(i),b(i)):l(i.elm))}}function w(e,t){if(n(t)||n(e.data)){var r,i=s.remove.length+1;for(n(t)?t.listeners+=i:t=function(e,t){function n(){0==--n.listeners&&l(e)}return n.listeners=t,n}(e.elm,i),n(r=e.componentInstance)&&n(r=r._vnode)&&n(r.data)&&w(r,t),r=0;r<s.remove.length;++r)s.remove[r](e,t);n(r=e.data.hook)&&n(r=r.remove)?r(e,t):t()}else l(e.elm)}function C(e,t,r,i){for(var o=r;o<i;o++){var a=t[o];if(n(a)&&or(e,a))return o}}function x(e,i,o,a,c,l){if(e!==i){n(i.elm)&&n(a)&&(i=a[c]=me(i));var p=i.elm=e.elm;if(r(e.isAsyncPlaceholder))n(i.asyncFactory.resolved)?O(e.elm,i,o):i.isAsyncPlaceholder=!0;else if(r(i.isStatic)&&r(e.isStatic)&&i.key===e.key&&(r(i.isCloned)||r(i.isOnce)))i.componentInstance=e.componentInstance;else{var d,v=i.data;n(v)&&n(d=v.hook)&&n(d=d.prepatch)&&d(e,i);var h=e.children,y=i.children;if(n(v)&&m(i)){for(d=0;d<s.update.length;++d)s.update[d](e,i);n(d=v.hook)&&n(d=d.update)&&d(e,i)}t(i.text)?n(h)&&n(y)?h!==y&&function(e,r,i,o,a){for(var s,c,l,p=0,d=0,v=r.length-1,h=r[0],m=r[v],y=i.length-1,g=i[0],b=i[y],w=!a;p<=v&&d<=y;)t(h)?h=r[++p]:t(m)?m=r[--v]:or(h,g)?(x(h,g,o,i,d),h=r[++p],g=i[++d]):or(m,b)?(x(m,b,o,i,y),m=r[--v],b=i[--y]):or(h,b)?(x(h,b,o,i,y),w&&u.insertBefore(e,h.elm,u.nextSibling(m.elm)),h=r[++p],b=i[--y]):or(m,g)?(x(m,g,o,i,d),w&&u.insertBefore(e,m.elm,h.elm),m=r[--v],g=i[++d]):(t(s)&&(s=ar(r,p,v)),t(c=n(g.key)?s[g.key]:C(g,r,p,v))?f(g,o,e,h.elm,!1,i,d):or(l=r[c],g)?(x(l,g,o,i,d),r[c]=void 0,w&&u.insertBefore(e,l.elm,h.elm)):f(g,o,e,h.elm,!1,i,d),g=i[++d]);p>v?_(e,t(i[y+1])?null:i[y+1].elm,i,d,y,o):d>y&&$(r,p,v)}(p,h,y,o,l):n(y)?(n(e.text)&&u.setTextContent(p,""),_(p,null,y,0,y.length-1,o)):n(h)?$(h,0,h.length-1):n(e.text)&&u.setTextContent(p,""):e.text!==i.text&&u.setTextContent(p,i.text),n(v)&&n(d=v.hook)&&n(d=d.postpatch)&&d(e,i)}}}function k(e,t,i){if(r(i)&&n(e.parent))e.parent.data.pendingInsert=t;else for(var o=0;o<t.length;++o)t[o].data.hook.insert(t[o])}var A=p("attrs,class,staticClass,staticStyle,key");function O(e,t,i,o){var a,s=t.tag,c=t.data,u=t.children;if(o=o||c&&c.pre,t.elm=e,r(t.isComment)&&n(t.asyncFactory))return t.isAsyncPlaceholder=!0,!0;if(n(c)&&(n(a=c.hook)&&n(a=a.init)&&a(t,!0),n(a=t.componentInstance)))return d(t,i),!0;if(n(s)){if(n(u))if(e.hasChildNodes())if(n(a=c)&&n(a=a.domProps)&&n(a=a.innerHTML)){if(a!==e.innerHTML)return!1}else{for(var l=!0,f=e.firstChild,p=0;p<u.length;p++){if(!f||!O(f,u[p],i,o)){l=!1;break}f=f.nextSibling}if(!l||f)return!1}else h(t,u,i);if(n(c)){var v=!1;for(var m in c)if(!A(m)){v=!0,y(t,i);break}!v&&c.class&&tt(c.class)}}else e.data!==t.text&&(e.data=t.text);return!0}return function(e,i,o,a){if(!t(i)){var c,l=!1,p=[];if(t(e))l=!0,f(i,p);else{var d=n(e.nodeType);if(!d&&or(e,i))x(e,i,p,null,null,a);else{if(d){if(1===e.nodeType&&e.hasAttribute(L)&&(e.removeAttribute(L),o=!0),r(o)&&O(e,i,p))return k(i,p,!0),e;c=e,e=new pe(u.tagName(c).toLowerCase(),{},[],void 0,c)}var v=e.elm,h=u.parentNode(v);if(f(i,p,v._leaveCb?null:h,u.nextSibling(v)),n(i.parent))for(var y=i.parent,g=m(i);y;){for(var _=0;_<s.destroy.length;++_)s.destroy[_](y);if(y.elm=i.elm,g){for(var w=0;w<s.create.length;++w)s.create[w](rr,y);var C=y.data.hook.insert;if(C.merged)for(var A=1;A<C.fns.length;A++)C.fns[A]()}else nr(y);y=y.parent}n(h)?$([e],0,0):n(e.tag)&&b(e)}}return k(i,p,l),i.elm}n(e)&&b(e)}}({nodeOps:er,modules:[yr,kr,ri,ai,yi,V?{create:Vi,activate:Vi,remove:function(e,t){!0!==e.data.show?Hi(e,t):t()}}:{}].concat(dr)});W&&document.addEventListener("selectionchange",function(){var e=document.activeElement;e&&e.vmodel&&Yi(e,"input")});var Ki={inserted:function(e,t,n,r){"select"===n.tag?(r.elm&&!r.elm._vOptions?ot(n,"postpatch",function(){Ki.componentUpdated(e,t,n)}):Ji(e,t,n.context),e._vOptions=[].map.call(e.options,Zi)):("textarea"===n.tag||Yn(e.type))&&(e._vModifiers=t.modifiers,t.modifiers.lazy||(e.addEventListener("compositionstart",Gi),e.addEventListener("compositionend",Xi),e.addEventListener("change",Xi),W&&(e.vmodel=!0)))},componentUpdated:function(e,t,n){if("select"===n.tag){Ji(e,t,n.context);var r=e._vOptions,i=e._vOptions=[].map.call(e.options,Zi);if(i.some(function(e,t){return!E(e,r[t])}))(e.multiple?t.value.some(function(e){return Wi(e,i)}):t.value!==t.oldValue&&Wi(t.value,i))&&Yi(e,"change")}}};function Ji(e,t,n){qi(e,t,n),(q||Z)&&setTimeout(function(){qi(e,t,n)},0)}function qi(e,t,n){var r=t.value,i=e.multiple;if(!i||Array.isArray(r)){for(var o,a,s=0,c=e.options.length;s<c;s++)if(a=e.options[s],i)o=j(r,Zi(a))>-1,a.selected!==o&&(a.selected=o);else if(E(Zi(a),r))return void(e.selectedIndex!==s&&(e.selectedIndex=s));i||(e.selectedIndex=-1)}}function Wi(e,t){return t.every(function(t){return!E(t,e)})}function Zi(e){return"_value"in e?e._value:e.value}function Gi(e){e.target.composing=!0}function Xi(e){e.target.composing&&(e.target.composing=!1,Yi(e.target,"input"))}function Yi(e,t){var n=document.createEvent("HTMLEvents");n.initEvent(t,!0,!0),e.dispatchEvent(n)}function Qi(e){return!e.componentInstance||e.data&&e.data.transition?e:Qi(e.componentInstance._vnode)}var eo={model:Ki,show:{bind:function(e,t,n){var r=t.value,i=(n=Qi(n)).data&&n.data.transition,o=e.__vOriginalDisplay="none"===e.style.display?"":e.style.display;r&&i?(n.data.show=!0,Ri(n,function(){e.style.display=o})):e.style.display=r?o:"none"},update:function(e,t,n){var r=t.value;!r!=!t.oldValue&&((n=Qi(n)).data&&n.data.transition?(n.data.show=!0,r?Ri(n,function(){e.style.display=e.__vOriginalDisplay}):Hi(n,function(){e.style.display="none"})):e.style.display=r?e.__vOriginalDisplay:"none")},unbind:function(e,t,n,r,i){i||(e.style.display=e.__vOriginalDisplay)}}},to={name:String,appear:Boolean,css:Boolean,mode:String,type:String,enterClass:String,leaveClass:String,enterToClass:String,leaveToClass:String,enterActiveClass:String,leaveActiveClass:String,appearClass:String,appearActiveClass:String,appearToClass:String,duration:[Number,String,Object]};function no(e){var t=e&&e.componentOptions;return t&&t.Ctor.options.abstract?no(zt(t.children)):e}function ro(e){var t={},n=e.$options;for(var r in n.propsData)t[r]=e[r];var i=n._parentListeners;for(var o in i)t[b(o)]=i[o];return t}function io(e,t){if(/\d-keep-alive$/.test(t.tag))return e("keep-alive",{props:t.componentOptions.propsData})}var oo=function(e){return e.tag||pt(e)},ao=function(e){return"show"===e.name},so={name:"transition",props:to,abstract:!0,render:function(e){var t=this,n=this.$slots.default;if(n&&(n=n.filter(oo)).length){var r=this.mode,o=n[0];if(function(e){for(;e=e.parent;)if(e.data.transition)return!0}(this.$vnode))return o;var a=no(o);if(!a)return o;if(this._leaving)return io(e,o);var s="__transition-"+this._uid+"-";a.key=null==a.key?a.isComment?s+"comment":s+a.tag:i(a.key)?0===String(a.key).indexOf(s)?a.key:s+a.key:a.key;var c=(a.data||(a.data={})).transition=ro(this),u=this._vnode,l=no(u);if(a.data.directives&&a.data.directives.some(ao)&&(a.data.show=!0),l&&l.data&&!function(e,t){return t.key===e.key&&t.tag===e.tag}(a,l)&&!pt(l)&&(!l.componentInstance||!l.componentInstance._vnode.isComment)){var f=l.data.transition=A({},c);if("out-in"===r)return this._leaving=!0,ot(f,"afterLeave",function(){t._leaving=!1,t.$forceUpdate()}),io(e,o);if("in-out"===r){if(pt(a))return u;var p,d=function(){p()};ot(c,"afterEnter",d),ot(c,"enterCancelled",d),ot(f,"delayLeave",function(e){p=e})}}return o}}},co=A({tag:String,moveClass:String},to);function uo(e){e.elm._moveCb&&e.elm._moveCb(),e.elm._enterCb&&e.elm._enterCb()}function lo(e){e.data.newPos=e.elm.getBoundingClientRect()}function fo(e){var t=e.data.pos,n=e.data.newPos,r=t.left-n.left,i=t.top-n.top;if(r||i){e.data.moved=!0;var o=e.elm.style;o.transform=o.WebkitTransform="translate("+r+"px,"+i+"px)",o.transitionDuration="0s"}}delete co.mode;var po={Transition:so,TransitionGroup:{props:co,beforeMount:function(){var e=this,t=this._update;this._update=function(n,r){var i=Gt(e);e.__patch__(e._vnode,e.kept,!1,!0),e._vnode=e.kept,i(),t.call(e,n,r)}},render:function(e){for(var t=this.tag||this.$vnode.data.tag||"span",n=Object.create(null),r=this.prevChildren=this.children,i=this.$slots.default||[],o=this.children=[],a=ro(this),s=0;s<i.length;s++){var c=i[s];c.tag&&null!=c.key&&0!==String(c.key).indexOf("__vlist")&&(o.push(c),n[c.key]=c,(c.data||(c.data={})).transition=a)}if(r){for(var u=[],l=[],f=0;f<r.length;f++){var p=r[f];p.data.transition=a,p.data.pos=p.elm.getBoundingClientRect(),n[p.key]?u.push(p):l.push(p)}this.kept=e(t,null,u),this.removed=l}return e(t,null,o)},updated:function(){var e=this.prevChildren,t=this.moveClass||(this.name||"v")+"-move";e.length&&this.hasMove(e[0].elm,t)&&(e.forEach(uo),e.forEach(lo),e.forEach(fo),this._reflow=document.body.offsetHeight,e.forEach(function(e){if(e.data.moved){var n=e.elm,r=n.style;ji(n,t),r.transform=r.WebkitTransform=r.transitionDuration="",n.addEventListener(Oi,n._moveCb=function e(r){r&&r.target!==n||r&&!/transform$/.test(r.propertyName)||(n.removeEventListener(Oi,e),n._moveCb=null,Di(n,t))})}}))},methods:{hasMove:function(e,t){if(!Ci)return!1;if(this._hasMove)return this._hasMove;var n=e.cloneNode();e._transitionClasses&&e._transitionClasses.forEach(function(e){bi(n,e)}),_i(n,t),n.style.display="none",this.$el.appendChild(n);var r=Mi(n);return this.$el.removeChild(n),this._hasMove=r.hasTransform}}}};Cn.config.mustUseProp=Dn,Cn.config.isReservedTag=Zn,Cn.config.isReservedAttr=En,Cn.config.getTagNamespace=Gn,Cn.config.isUnknownElement=function(e){if(!V)return!0;if(Zn(e))return!1;if(e=e.toLowerCase(),null!=Xn[e])return Xn[e];var t=document.createElement(e);return e.indexOf("-")>-1?Xn[e]=t.constructor===window.HTMLUnknownElement||t.constructor===window.HTMLElement:Xn[e]=/HTMLUnknownElement/.test(t.toString())},A(Cn.options.directives,eo),A(Cn.options.components,po),Cn.prototype.__patch__=V?zi:S,Cn.prototype.$mount=function(e,t){return function(e,t,n){var r;return e.$el=t,e.$options.render||(e.$options.render=ve),Qt(e,"beforeMount"),r=function(){e._update(e._render(),n)},new pn(e,r,S,{before:function(){e._isMounted&&!e._isDestroyed&&Qt(e,"beforeUpdate")}},!0),n=!1,null==e.$vnode&&(e._isMounted=!0,Qt(e,"mounted")),e}(this,e=e&&V?Qn(e):void 0,t)},V&&setTimeout(function(){F.devtools&&ne&&ne.emit("init",Cn)},0);var vo=/\{\{((?:.|\r?\n)+?)\}\}/g,ho=/[-.*+?^${}()|[\]\/\\]/g,mo=g(function(e){var t=e[0].replace(ho,"\\$&"),n=e[1].replace(ho,"\\$&");return new RegExp(t+"((?:.|\\n)+?)"+n,"g")});var yo={staticKeys:["staticClass"],transformNode:function(e,t){t.warn;var n=Pr(e,"class");n&&(e.staticClass=JSON.stringify(n));var r=Fr(e,"class",!1);r&&(e.classBinding=r)},genData:function(e){var t="";return e.staticClass&&(t+="staticClass:"+e.staticClass+","),e.classBinding&&(t+="class:"+e.classBinding+","),t}};var go,_o={staticKeys:["staticStyle"],transformNode:function(e,t){t.warn;var n=Pr(e,"style");n&&(e.staticStyle=JSON.stringify(si(n)));var r=Fr(e,"style",!1);r&&(e.styleBinding=r)},genData:function(e){var t="";return e.staticStyle&&(t+="staticStyle:"+e.staticStyle+","),e.styleBinding&&(t+="style:("+e.styleBinding+"),"),t}},bo=function(e){return(go=go||document.createElement("div")).innerHTML=e,go.textContent},$o=p("area,base,br,col,embed,frame,hr,img,input,isindex,keygen,link,meta,param,source,track,wbr"),wo=p("colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr,source"),Co=p("address,article,aside,base,blockquote,body,caption,col,colgroup,dd,details,dialog,div,dl,dt,fieldset,figcaption,figure,footer,form,h1,h2,h3,h4,h5,h6,head,header,hgroup,hr,html,legend,li,menuitem,meta,optgroup,option,param,rp,rt,source,style,summary,tbody,td,tfoot,th,thead,title,tr,track"),xo=/^\s*([^\s"'<>\/=]+)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/,ko=/^\s*((?:v-[\w-]+:|@|:|#)\[[^=]+?\][^\s"'<>\/=]*)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/,Ao="[a-zA-Z_][\\-\\.0-9_a-zA-Z"+P.source+"]*",Oo="((?:"+Ao+"\\:)?"+Ao+")",So=new RegExp("^<"+Oo),To=/^\s*(\/?)>/,No=new RegExp("^<\\/"+Oo+"[^>]*>"),Eo=/^<!DOCTYPE [^>]+>/i,jo=/^<!\--/,Do=/^<!\[/,Lo=p("script,style,textarea",!0),Io={},Mo={"<":"<",">":">",""":'"',"&":"&"," ":"\n","	":"\t","'":"'"},Fo=/&(?:lt|gt|quot|amp|#39);/g,Po=/&(?:lt|gt|quot|amp|#39|#10|#9);/g,Ro=p("pre,textarea",!0),Ho=function(e,t){return e&&Ro(e)&&"\n"===t[0]};function Bo(e,t){var n=t?Po:Fo;return e.replace(n,function(e){return Mo[e]})}var Uo,Vo,zo,Ko,Jo,qo,Wo,Zo,Go=/^@|^v-on:/,Xo=/^v-|^@|^:|^#/,Yo=/([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/,Qo=/,([^,\}\]]*)(?:,([^,\}\]]*))?$/,ea=/^\(|\)$/g,ta=/^\[.*\]$/,na=/:(.*)$/,ra=/^:|^\.|^v-bind:/,ia=/\.[^.\]]+(?=[^\]]*$)/g,oa=/^v-slot(:|$)|^#/,aa=/[\r\n]/,sa=/[ \f\t\r\n]+/g,ca=g(bo),ua="_empty_";function la(e,t,n){return{type:1,tag:e,attrsList:t,attrsMap:ya(t),rawAttrsMap:{},parent:n,children:[]}}function fa(e,t){Uo=t.warn||Tr,qo=t.isPreTag||T,Wo=t.mustUseProp||T,Zo=t.getTagNamespace||T;t.isReservedTag;zo=Nr(t.modules,"transformNode"),Ko=Nr(t.modules,"preTransformNode"),Jo=Nr(t.modules,"postTransformNode"),Vo=t.delimiters;var n,r,i=[],o=!1!==t.preserveWhitespace,a=t.whitespace,s=!1,c=!1;function u(e){if(l(e),s||e.processed||(e=pa(e,t)),i.length||e===n||n.if&&(e.elseif||e.else)&&va(n,{exp:e.elseif,block:e}),r&&!e.forbidden)if(e.elseif||e.else)a=e,(u=function(e){var t=e.length;for(;t--;){if(1===e[t].type)return e[t];e.pop()}}(r.children))&&u.if&&va(u,{exp:a.elseif,block:a});else{if(e.slotScope){var o=e.slotTarget||'"default"';(r.scopedSlots||(r.scopedSlots={}))[o]=e}r.children.push(e),e.parent=r}var a,u;e.children=e.children.filter(function(e){return!e.slotScope}),l(e),e.pre&&(s=!1),qo(e.tag)&&(c=!1);for(var f=0;f<Jo.length;f++)Jo[f](e,t)}function l(e){if(!c)for(var t;(t=e.children[e.children.length-1])&&3===t.type&&" "===t.text;)e.children.pop()}return function(e,t){for(var n,r,i=[],o=t.expectHTML,a=t.isUnaryTag||T,s=t.canBeLeftOpenTag||T,c=0;e;){if(n=e,r&&Lo(r)){var u=0,l=r.toLowerCase(),f=Io[l]||(Io[l]=new RegExp("([\\s\\S]*?)(</"+l+"[^>]*>)","i")),p=e.replace(f,function(e,n,r){return u=r.length,Lo(l)||"noscript"===l||(n=n.replace(/<!\--([\s\S]*?)-->/g,"$1").replace(/<!\[CDATA\[([\s\S]*?)]]>/g,"$1")),Ho(l,n)&&(n=n.slice(1)),t.chars&&t.chars(n),""});c+=e.length-p.length,e=p,A(l,c-u,c)}else{var d=e.indexOf("<");if(0===d){if(jo.test(e)){var v=e.indexOf("--\x3e");if(v>=0){t.shouldKeepComment&&t.comment(e.substring(4,v),c,c+v+3),C(v+3);continue}}if(Do.test(e)){var h=e.indexOf("]>");if(h>=0){C(h+2);continue}}var m=e.match(Eo);if(m){C(m[0].length);continue}var y=e.match(No);if(y){var g=c;C(y[0].length),A(y[1],g,c);continue}var _=x();if(_){k(_),Ho(_.tagName,e)&&C(1);continue}}var b=void 0,$=void 0,w=void 0;if(d>=0){for($=e.slice(d);!(No.test($)||So.test($)||jo.test($)||Do.test($)||(w=$.indexOf("<",1))<0);)d+=w,$=e.slice(d);b=e.substring(0,d)}d<0&&(b=e),b&&C(b.length),t.chars&&b&&t.chars(b,c-b.length,c)}if(e===n){t.chars&&t.chars(e);break}}function C(t){c+=t,e=e.substring(t)}function x(){var t=e.match(So);if(t){var n,r,i={tagName:t[1],attrs:[],start:c};for(C(t[0].length);!(n=e.match(To))&&(r=e.match(ko)||e.match(xo));)r.start=c,C(r[0].length),r.end=c,i.attrs.push(r);if(n)return i.unarySlash=n[1],C(n[0].length),i.end=c,i}}function k(e){var n=e.tagName,c=e.unarySlash;o&&("p"===r&&Co(n)&&A(r),s(n)&&r===n&&A(n));for(var u=a(n)||!!c,l=e.attrs.length,f=new Array(l),p=0;p<l;p++){var d=e.attrs[p],v=d[3]||d[4]||d[5]||"",h="a"===n&&"href"===d[1]?t.shouldDecodeNewlinesForHref:t.shouldDecodeNewlines;f[p]={name:d[1],value:Bo(v,h)}}u||(i.push({tag:n,lowerCasedTag:n.toLowerCase(),attrs:f,start:e.start,end:e.end}),r=n),t.start&&t.start(n,f,u,e.start,e.end)}function A(e,n,o){var a,s;if(null==n&&(n=c),null==o&&(o=c),e)for(s=e.toLowerCase(),a=i.length-1;a>=0&&i[a].lowerCasedTag!==s;a--);else a=0;if(a>=0){for(var u=i.length-1;u>=a;u--)t.end&&t.end(i[u].tag,n,o);i.length=a,r=a&&i[a-1].tag}else"br"===s?t.start&&t.start(e,[],!0,n,o):"p"===s&&(t.start&&t.start(e,[],!1,n,o),t.end&&t.end(e,n,o))}A()}(e,{warn:Uo,expectHTML:t.expectHTML,isUnaryTag:t.isUnaryTag,canBeLeftOpenTag:t.canBeLeftOpenTag,shouldDecodeNewlines:t.shouldDecodeNewlines,shouldDecodeNewlinesForHref:t.shouldDecodeNewlinesForHref,shouldKeepComment:t.comments,outputSourceRange:t.outputSourceRange,start:function(e,o,a,l,f){var p=r&&r.ns||Zo(e);q&&"svg"===p&&(o=function(e){for(var t=[],n=0;n<e.length;n++){var r=e[n];ga.test(r.name)||(r.name=r.name.replace(_a,""),t.push(r))}return t}(o));var d,v=la(e,o,r);p&&(v.ns=p),"style"!==(d=v).tag&&("script"!==d.tag||d.attrsMap.type&&"text/javascript"!==d.attrsMap.type)||te()||(v.forbidden=!0);for(var h=0;h<Ko.length;h++)v=Ko[h](v,t)||v;s||(!function(e){null!=Pr(e,"v-pre")&&(e.pre=!0)}(v),v.pre&&(s=!0)),qo(v.tag)&&(c=!0),s?function(e){var t=e.attrsList,n=t.length;if(n)for(var r=e.attrs=new Array(n),i=0;i<n;i++)r[i]={name:t[i].name,value:JSON.stringify(t[i].value)},null!=t[i].start&&(r[i].start=t[i].start,r[i].end=t[i].end);else e.pre||(e.plain=!0)}(v):v.processed||(da(v),function(e){var t=Pr(e,"v-if");if(t)e.if=t,va(e,{exp:t,block:e});else{null!=Pr(e,"v-else")&&(e.else=!0);var n=Pr(e,"v-else-if");n&&(e.elseif=n)}}(v),function(e){null!=Pr(e,"v-once")&&(e.once=!0)}(v)),n||(n=v),a?u(v):(r=v,i.push(v))},end:function(e,t,n){var o=i[i.length-1];i.length-=1,r=i[i.length-1],u(o)},chars:function(e,t,n){if(r&&(!q||"textarea"!==r.tag||r.attrsMap.placeholder!==e)){var i,u,l,f=r.children;if(e=c||e.trim()?"script"===(i=r).tag||"style"===i.tag?e:ca(e):f.length?a?"condense"===a&&aa.test(e)?"":" ":o?" ":"":"")c||"condense"!==a||(e=e.replace(sa," ")),!s&&" "!==e&&(u=function(e,t){var n=t?mo(t):vo;if(n.test(e)){for(var r,i,o,a=[],s=[],c=n.lastIndex=0;r=n.exec(e);){(i=r.index)>c&&(s.push(o=e.slice(c,i)),a.push(JSON.stringify(o)));var u=Or(r[1].trim());a.push("_s("+u+")"),s.push({"@binding":u}),c=i+r[0].length}return c<e.length&&(s.push(o=e.slice(c)),a.push(JSON.stringify(o))),{expression:a.join("+"),tokens:s}}}(e,Vo))?l={type:2,expression:u.expression,tokens:u.tokens,text:e}:" "===e&&f.length&&" "===f[f.length-1].text||(l={type:3,text:e}),l&&f.push(l)}},comment:function(e,t,n){if(r){var i={type:3,text:e,isComment:!0};r.children.push(i)}}}),n}function pa(e,t){var n,r;(r=Fr(n=e,"key"))&&(n.key=r),e.plain=!e.key&&!e.scopedSlots&&!e.attrsList.length,function(e){var t=Fr(e,"ref");t&&(e.ref=t,e.refInFor=function(e){var t=e;for(;t;){if(void 0!==t.for)return!0;t=t.parent}return!1}(e))}(e),function(e){var t;"template"===e.tag?(t=Pr(e,"scope"),e.slotScope=t||Pr(e,"slot-scope")):(t=Pr(e,"slot-scope"))&&(e.slotScope=t);var n=Fr(e,"slot");n&&(e.slotTarget='""'===n?'"default"':n,e.slotTargetDynamic=!(!e.attrsMap[":slot"]&&!e.attrsMap["v-bind:slot"]),"template"===e.tag||e.slotScope||jr(e,"slot",n,function(e,t){return e.rawAttrsMap[":"+t]||e.rawAttrsMap["v-bind:"+t]||e.rawAttrsMap[t]}(e,"slot")));if("template"===e.tag){var r=Rr(e,oa);if(r){var i=ha(r),o=i.name,a=i.dynamic;e.slotTarget=o,e.slotTargetDynamic=a,e.slotScope=r.value||ua}}else{var s=Rr(e,oa);if(s){var c=e.scopedSlots||(e.scopedSlots={}),u=ha(s),l=u.name,f=u.dynamic,p=c[l]=la("template",[],e);p.slotTarget=l,p.slotTargetDynamic=f,p.children=e.children.filter(function(e){if(!e.slotScope)return e.parent=p,!0}),p.slotScope=s.value||ua,e.children=[],e.plain=!1}}}(e),function(e){"slot"===e.tag&&(e.slotName=Fr(e,"name"))}(e),function(e){var t;(t=Fr(e,"is"))&&(e.component=t);null!=Pr(e,"inline-template")&&(e.inlineTemplate=!0)}(e);for(var i=0;i<zo.length;i++)e=zo[i](e,t)||e;return function(e){var t,n,r,i,o,a,s,c,u=e.attrsList;for(t=0,n=u.length;t<n;t++)if(r=i=u[t].name,o=u[t].value,Xo.test(r))if(e.hasBindings=!0,(a=ma(r.replace(Xo,"")))&&(r=r.replace(ia,"")),ra.test(r))r=r.replace(ra,""),o=Or(o),(c=ta.test(r))&&(r=r.slice(1,-1)),a&&(a.prop&&!c&&"innerHtml"===(r=b(r))&&(r="innerHTML"),a.camel&&!c&&(r=b(r)),a.sync&&(s=Ur(o,"$event"),c?Mr(e,'"update:"+('+r+")",s,null,!1,0,u[t],!0):(Mr(e,"update:"+b(r),s,null,!1,0,u[t]),C(r)!==b(r)&&Mr(e,"update:"+C(r),s,null,!1,0,u[t])))),a&&a.prop||!e.component&&Wo(e.tag,e.attrsMap.type,r)?Er(e,r,o,u[t],c):jr(e,r,o,u[t],c);else if(Go.test(r))r=r.replace(Go,""),(c=ta.test(r))&&(r=r.slice(1,-1)),Mr(e,r,o,a,!1,0,u[t],c);else{var l=(r=r.replace(Xo,"")).match(na),f=l&&l[1];c=!1,f&&(r=r.slice(0,-(f.length+1)),ta.test(f)&&(f=f.slice(1,-1),c=!0)),Lr(e,r,i,o,f,c,a,u[t])}else jr(e,r,JSON.stringify(o),u[t]),!e.component&&"muted"===r&&Wo(e.tag,e.attrsMap.type,r)&&Er(e,r,"true",u[t])}(e),e}function da(e){var t;if(t=Pr(e,"v-for")){var n=function(e){var t=e.match(Yo);if(!t)return;var n={};n.for=t[2].trim();var r=t[1].trim().replace(ea,""),i=r.match(Qo);i?(n.alias=r.replace(Qo,"").trim(),n.iterator1=i[1].trim(),i[2]&&(n.iterator2=i[2].trim())):n.alias=r;return n}(t);n&&A(e,n)}}function va(e,t){e.ifConditions||(e.ifConditions=[]),e.ifConditions.push(t)}function ha(e){var t=e.name.replace(oa,"");return t||"#"!==e.name[0]&&(t="default"),ta.test(t)?{name:t.slice(1,-1),dynamic:!0}:{name:'"'+t+'"',dynamic:!1}}function ma(e){var t=e.match(ia);if(t){var n={};return t.forEach(function(e){n[e.slice(1)]=!0}),n}}function ya(e){for(var t={},n=0,r=e.length;n<r;n++)t[e[n].name]=e[n].value;return t}var ga=/^xmlns:NS\d+/,_a=/^NS\d+:/;function ba(e){return la(e.tag,e.attrsList.slice(),e.parent)}var $a=[yo,_o,{preTransformNode:function(e,t){if("input"===e.tag){var n,r=e.attrsMap;if(!r["v-model"])return;if((r[":type"]||r["v-bind:type"])&&(n=Fr(e,"type")),r.type||n||!r["v-bind"]||(n="("+r["v-bind"]+").type"),n){var i=Pr(e,"v-if",!0),o=i?"&&("+i+")":"",a=null!=Pr(e,"v-else",!0),s=Pr(e,"v-else-if",!0),c=ba(e);da(c),Dr(c,"type","checkbox"),pa(c,t),c.processed=!0,c.if="("+n+")==='checkbox'"+o,va(c,{exp:c.if,block:c});var u=ba(e);Pr(u,"v-for",!0),Dr(u,"type","radio"),pa(u,t),va(c,{exp:"("+n+")==='radio'"+o,block:u});var l=ba(e);return Pr(l,"v-for",!0),Dr(l,":type",n),pa(l,t),va(c,{exp:i,block:l}),a?c.else=!0:s&&(c.elseif=s),c}}}}];var wa,Ca,xa={expectHTML:!0,modules:$a,directives:{model:function(e,t,n){var r=t.value,i=t.modifiers,o=e.tag,a=e.attrsMap.type;if(e.component)return Br(e,r,i),!1;if("select"===o)!function(e,t,n){var r='var $$selectedVal = Array.prototype.filter.call($event.target.options,function(o){return o.selected}).map(function(o){var val = "_value" in o ? o._value : o.value;return '+(n&&n.number?"_n(val)":"val")+"});";r=r+" "+Ur(t,"$event.target.multiple ? $$selectedVal : $$selectedVal[0]"),Mr(e,"change",r,null,!0)}(e,r,i);else if("input"===o&&"checkbox"===a)!function(e,t,n){var r=n&&n.number,i=Fr(e,"value")||"null",o=Fr(e,"true-value")||"true",a=Fr(e,"false-value")||"false";Er(e,"checked","Array.isArray("+t+")?_i("+t+","+i+")>-1"+("true"===o?":("+t+")":":_q("+t+","+o+")")),Mr(e,"change","var $$a="+t+",$$el=$event.target,$$c=$$el.checked?("+o+"):("+a+");if(Array.isArray($$a)){var $$v="+(r?"_n("+i+")":i)+",$$i=_i($$a,$$v);if($$el.checked){$$i<0&&("+Ur(t,"$$a.concat([$$v])")+")}else{$$i>-1&&("+Ur(t,"$$a.slice(0,$$i).concat($$a.slice($$i+1))")+")}}else{"+Ur(t,"$$c")+"}",null,!0)}(e,r,i);else if("input"===o&&"radio"===a)!function(e,t,n){var r=n&&n.number,i=Fr(e,"value")||"null";Er(e,"checked","_q("+t+","+(i=r?"_n("+i+")":i)+")"),Mr(e,"change",Ur(t,i),null,!0)}(e,r,i);else if("input"===o||"textarea"===o)!function(e,t,n){var r=e.attrsMap.type,i=n||{},o=i.lazy,a=i.number,s=i.trim,c=!o&&"range"!==r,u=o?"change":"range"===r?Zr:"input",l="$event.target.value";s&&(l="$event.target.value.trim()"),a&&(l="_n("+l+")");var f=Ur(t,l);c&&(f="if($event.target.composing)return;"+f),Er(e,"value","("+t+")"),Mr(e,u,f,null,!0),(s||a)&&Mr(e,"blur","$forceUpdate()")}(e,r,i);else if(!F.isReservedTag(o))return Br(e,r,i),!1;return!0},text:function(e,t){t.value&&Er(e,"textContent","_s("+t.value+")",t)},html:function(e,t){t.value&&Er(e,"innerHTML","_s("+t.value+")",t)}},isPreTag:function(e){return"pre"===e},isUnaryTag:$o,mustUseProp:Dn,canBeLeftOpenTag:wo,isReservedTag:Zn,getTagNamespace:Gn,staticKeys:function(e){return e.reduce(function(e,t){return e.concat(t.staticKeys||[])},[]).join(",")}($a)},ka=g(function(e){return p("type,tag,attrsList,attrsMap,plain,parent,children,attrs,start,end,rawAttrsMap"+(e?","+e:""))});function Aa(e,t){e&&(wa=ka(t.staticKeys||""),Ca=t.isReservedTag||T,function e(t){t.static=function(e){if(2===e.type)return!1;if(3===e.type)return!0;return!(!e.pre&&(e.hasBindings||e.if||e.for||d(e.tag)||!Ca(e.tag)||function(e){for(;e.parent;){if("template"!==(e=e.parent).tag)return!1;if(e.for)return!0}return!1}(e)||!Object.keys(e).every(wa)))}(t);if(1===t.type){if(!Ca(t.tag)&&"slot"!==t.tag&&null==t.attrsMap["inline-template"])return;for(var n=0,r=t.children.length;n<r;n++){var i=t.children[n];e(i),i.static||(t.static=!1)}if(t.ifConditions)for(var o=1,a=t.ifConditions.length;o<a;o++){var s=t.ifConditions[o].block;e(s),s.static||(t.static=!1)}}}(e),function e(t,n){if(1===t.type){if((t.static||t.once)&&(t.staticInFor=n),t.static&&t.children.length&&(1!==t.children.length||3!==t.children[0].type))return void(t.staticRoot=!0);if(t.staticRoot=!1,t.children)for(var r=0,i=t.children.length;r<i;r++)e(t.children[r],n||!!t.for);if(t.ifConditions)for(var o=1,a=t.ifConditions.length;o<a;o++)e(t.ifConditions[o].block,n)}}(e,!1))}var Oa=/^([\w$_]+|\([^)]*?\))\s*=>|^function(?:\s+[\w$]+)?\s*\(/,Sa=/\([^)]*?\);*$/,Ta=/^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*|\['[^']*?']|\["[^"]*?"]|\[\d+]|\[[A-Za-z_$][\w$]*])*$/,Na={esc:27,tab:9,enter:13,space:32,up:38,left:37,right:39,down:40,delete:[8,46]},Ea={esc:["Esc","Escape"],tab:"Tab",enter:"Enter",space:[" ","Spacebar"],up:["Up","ArrowUp"],left:["Left","ArrowLeft"],right:["Right","ArrowRight"],down:["Down","ArrowDown"],delete:["Backspace","Delete","Del"]},ja=function(e){return"if("+e+")return null;"},Da={stop:"$event.stopPropagation();",prevent:"$event.preventDefault();",self:ja("$event.target !== $event.currentTarget"),ctrl:ja("!$event.ctrlKey"),shift:ja("!$event.shiftKey"),alt:ja("!$event.altKey"),meta:ja("!$event.metaKey"),left:ja("'button' in $event && $event.button !== 0"),middle:ja("'button' in $event && $event.button !== 1"),right:ja("'button' in $event && $event.button !== 2")};function La(e,t){var n=t?"nativeOn:":"on:",r="",i="";for(var o in e){var a=Ia(e[o]);e[o]&&e[o].dynamic?i+=o+","+a+",":r+='"'+o+'":'+a+","}return r="{"+r.slice(0,-1)+"}",i?n+"_d("+r+",["+i.slice(0,-1)+"])":n+r}function Ia(e){if(!e)return"function(){}";if(Array.isArray(e))return"["+e.map(function(e){return Ia(e)}).join(",")+"]";var t=Ta.test(e.value),n=Oa.test(e.value),r=Ta.test(e.value.replace(Sa,""));if(e.modifiers){var i="",o="",a=[];for(var s in e.modifiers)if(Da[s])o+=Da[s],Na[s]&&a.push(s);else if("exact"===s){var c=e.modifiers;o+=ja(["ctrl","shift","alt","meta"].filter(function(e){return!c[e]}).map(function(e){return"$event."+e+"Key"}).join("||"))}else a.push(s);return a.length&&(i+=function(e){return"if(!$event.type.indexOf('key')&&"+e.map(Ma).join("&&")+")return null;"}(a)),o&&(i+=o),"function($event){"+i+(t?"return "+e.value+".apply(null, arguments)":n?"return ("+e.value+").apply(null, arguments)":r?"return "+e.value:e.value)+"}"}return t||n?e.value:"function($event){"+(r?"return "+e.value:e.value)+"}"}function Ma(e){var t=parseInt(e,10);if(t)return"$event.keyCode!=="+t;var n=Na[e],r=Ea[e];return"_k($event.keyCode,"+JSON.stringify(e)+","+JSON.stringify(n)+",$event.key,"+JSON.stringify(r)+")"}var Fa={on:function(e,t){e.wrapListeners=function(e){return"_g("+e+","+t.value+")"}},bind:function(e,t){e.wrapData=function(n){return"_b("+n+",'"+e.tag+"',"+t.value+","+(t.modifiers&&t.modifiers.prop?"true":"false")+(t.modifiers&&t.modifiers.sync?",true":"")+")"}},cloak:S},Pa=function(e){this.options=e,this.warn=e.warn||Tr,this.transforms=Nr(e.modules,"transformCode"),this.dataGenFns=Nr(e.modules,"genData"),this.directives=A(A({},Fa),e.directives);var t=e.isReservedTag||T;this.maybeComponent=function(e){return!!e.component||!t(e.tag)},this.onceId=0,this.staticRenderFns=[],this.pre=!1};function Ra(e,t){var n=new Pa(t);return{render:"with(this){return "+(e?"script"===e.tag?"null":Ha(e,n):'_c("div")')+"}",staticRenderFns:n.staticRenderFns}}function Ha(e,t){if(e.parent&&(e.pre=e.pre||e.parent.pre),e.staticRoot&&!e.staticProcessed)return Ba(e,t);if(e.once&&!e.onceProcessed)return Ua(e,t);if(e.for&&!e.forProcessed)return za(e,t);if(e.if&&!e.ifProcessed)return Va(e,t);if("template"!==e.tag||e.slotTarget||t.pre){if("slot"===e.tag)return function(e,t){var n=e.slotName||'"default"',r=Wa(e,t),i="_t("+n+(r?",function(){return "+r+"}":""),o=e.attrs||e.dynamicAttrs?Xa((e.attrs||[]).concat(e.dynamicAttrs||[]).map(function(e){return{name:b(e.name),value:e.value,dynamic:e.dynamic}})):null,a=e.attrsMap["v-bind"];!o&&!a||r||(i+=",null");o&&(i+=","+o);a&&(i+=(o?"":",null")+","+a);return i+")"}(e,t);var n;if(e.component)n=function(e,t,n){var r=t.inlineTemplate?null:Wa(t,n,!0);return"_c("+e+","+Ka(t,n)+(r?","+r:"")+")"}(e.component,e,t);else{var r;(!e.plain||e.pre&&t.maybeComponent(e))&&(r=Ka(e,t));var i=e.inlineTemplate?null:Wa(e,t,!0);n="_c('"+e.tag+"'"+(r?","+r:"")+(i?","+i:"")+")"}for(var o=0;o<t.transforms.length;o++)n=t.transforms[o](e,n);return n}return Wa(e,t)||"void 0"}function Ba(e,t){e.staticProcessed=!0;var n=t.pre;return e.pre&&(t.pre=e.pre),t.staticRenderFns.push("with(this){return "+Ha(e,t)+"}"),t.pre=n,"_m("+(t.staticRenderFns.length-1)+(e.staticInFor?",true":"")+")"}function Ua(e,t){if(e.onceProcessed=!0,e.if&&!e.ifProcessed)return Va(e,t);if(e.staticInFor){for(var n="",r=e.parent;r;){if(r.for){n=r.key;break}r=r.parent}return n?"_o("+Ha(e,t)+","+t.onceId+++","+n+")":Ha(e,t)}return Ba(e,t)}function Va(e,t,n,r){return e.ifProcessed=!0,function e(t,n,r,i){if(!t.length)return i||"_e()";var o=t.shift();return o.exp?"("+o.exp+")?"+a(o.block)+":"+e(t,n,r,i):""+a(o.block);function a(e){return r?r(e,n):e.once?Ua(e,n):Ha(e,n)}}(e.ifConditions.slice(),t,n,r)}function za(e,t,n,r){var i=e.for,o=e.alias,a=e.iterator1?","+e.iterator1:"",s=e.iterator2?","+e.iterator2:"";return e.forProcessed=!0,(r||"_l")+"(("+i+"),function("+o+a+s+"){return "+(n||Ha)(e,t)+"})"}function Ka(e,t){var n="{",r=function(e,t){var n=e.directives;if(!n)return;var r,i,o,a,s="directives:[",c=!1;for(r=0,i=n.length;r<i;r++){o=n[r],a=!0;var u=t.directives[o.name];u&&(a=!!u(e,o,t.warn)),a&&(c=!0,s+='{name:"'+o.name+'",rawName:"'+o.rawName+'"'+(o.value?",value:("+o.value+"),expression:"+JSON.stringify(o.value):"")+(o.arg?",arg:"+(o.isDynamicArg?o.arg:'"'+o.arg+'"'):"")+(o.modifiers?",modifiers:"+JSON.stringify(o.modifiers):"")+"},")}if(c)return s.slice(0,-1)+"]"}(e,t);r&&(n+=r+","),e.key&&(n+="key:"+e.key+","),e.ref&&(n+="ref:"+e.ref+","),e.refInFor&&(n+="refInFor:true,"),e.pre&&(n+="pre:true,"),e.component&&(n+='tag:"'+e.tag+'",');for(var i=0;i<t.dataGenFns.length;i++)n+=t.dataGenFns[i](e);if(e.attrs&&(n+="attrs:"+Xa(e.attrs)+","),e.props&&(n+="domProps:"+Xa(e.props)+","),e.events&&(n+=La(e.events,!1)+","),e.nativeEvents&&(n+=La(e.nativeEvents,!0)+","),e.slotTarget&&!e.slotScope&&(n+="slot:"+e.slotTarget+","),e.scopedSlots&&(n+=function(e,t,n){var r=e.for||Object.keys(t).some(function(e){var n=t[e];return n.slotTargetDynamic||n.if||n.for||Ja(n)}),i=!!e.if;if(!r)for(var o=e.parent;o;){if(o.slotScope&&o.slotScope!==ua||o.for){r=!0;break}o.if&&(i=!0),o=o.parent}var a=Object.keys(t).map(function(e){return qa(t[e],n)}).join(",");return"scopedSlots:_u(["+a+"]"+(r?",null,true":"")+(!r&&i?",null,false,"+function(e){var t=5381,n=e.length;for(;n;)t=33*t^e.charCodeAt(--n);return t>>>0}(a):"")+")"}(e,e.scopedSlots,t)+","),e.model&&(n+="model:{value:"+e.model.value+",callback:"+e.model.callback+",expression:"+e.model.expression+"},"),e.inlineTemplate){var o=function(e,t){var n=e.children[0];if(n&&1===n.type){var r=Ra(n,t.options);return"inlineTemplate:{render:function(){"+r.render+"},staticRenderFns:["+r.staticRenderFns.map(function(e){return"function(){"+e+"}"}).join(",")+"]}"}}(e,t);o&&(n+=o+",")}return n=n.replace(/,$/,"")+"}",e.dynamicAttrs&&(n="_b("+n+',"'+e.tag+'",'+Xa(e.dynamicAttrs)+")"),e.wrapData&&(n=e.wrapData(n)),e.wrapListeners&&(n=e.wrapListeners(n)),n}function Ja(e){return 1===e.type&&("slot"===e.tag||e.children.some(Ja))}function qa(e,t){var n=e.attrsMap["slot-scope"];if(e.if&&!e.ifProcessed&&!n)return Va(e,t,qa,"null");if(e.for&&!e.forProcessed)return za(e,t,qa);var r=e.slotScope===ua?"":String(e.slotScope),i="function("+r+"){return "+("template"===e.tag?e.if&&n?"("+e.if+")?"+(Wa(e,t)||"undefined")+":undefined":Wa(e,t)||"undefined":Ha(e,t))+"}",o=r?"":",proxy:true";return"{key:"+(e.slotTarget||'"default"')+",fn:"+i+o+"}"}function Wa(e,t,n,r,i){var o=e.children;if(o.length){var a=o[0];if(1===o.length&&a.for&&"template"!==a.tag&&"slot"!==a.tag){var s=n?t.maybeComponent(a)?",1":",0":"";return""+(r||Ha)(a,t)+s}var c=n?function(e,t){for(var n=0,r=0;r<e.length;r++){var i=e[r];if(1===i.type){if(Za(i)||i.ifConditions&&i.ifConditions.some(function(e){return Za(e.block)})){n=2;break}(t(i)||i.ifConditions&&i.ifConditions.some(function(e){return t(e.block)}))&&(n=1)}}return n}(o,t.maybeComponent):0,u=i||Ga;return"["+o.map(function(e){return u(e,t)}).join(",")+"]"+(c?","+c:"")}}function Za(e){return void 0!==e.for||"template"===e.tag||"slot"===e.tag}function Ga(e,t){return 1===e.type?Ha(e,t):3===e.type&&e.isComment?(r=e,"_e("+JSON.stringify(r.text)+")"):"_v("+(2===(n=e).type?n.expression:Ya(JSON.stringify(n.text)))+")";var n,r}function Xa(e){for(var t="",n="",r=0;r<e.length;r++){var i=e[r],o=Ya(i.value);i.dynamic?n+=i.name+","+o+",":t+='"'+i.name+'":'+o+","}return t="{"+t.slice(0,-1)+"}",n?"_d("+t+",["+n.slice(0,-1)+"])":t}function Ya(e){return e.replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}new RegExp("\\b"+"do,if,for,let,new,try,var,case,else,with,await,break,catch,class,const,super,throw,while,yield,delete,export,import,return,switch,default,extends,finally,continue,debugger,function,arguments".split(",").join("\\b|\\b")+"\\b");function Qa(e,t){try{return new Function(e)}catch(n){return t.push({err:n,code:e}),S}}function es(e){var t=Object.create(null);return function(n,r,i){(r=A({},r)).warn;delete r.warn;var o=r.delimiters?String(r.delimiters)+n:n;if(t[o])return t[o];var a=e(n,r),s={},c=[];return s.render=Qa(a.render,c),s.staticRenderFns=a.staticRenderFns.map(function(e){return Qa(e,c)}),t[o]=s}}var ts,ns,rs=(ts=function(e,t){var n=fa(e.trim(),t);!1!==t.optimize&&Aa(n,t);var r=Ra(n,t);return{ast:n,render:r.render,staticRenderFns:r.staticRenderFns}},function(e){function t(t,n){var r=Object.create(e),i=[],o=[];if(n)for(var a in n.modules&&(r.modules=(e.modules||[]).concat(n.modules)),n.directives&&(r.directives=A(Object.create(e.directives||null),n.directives)),n)"modules"!==a&&"directives"!==a&&(r[a]=n[a]);r.warn=function(e,t,n){(n?o:i).push(e)};var s=ts(t.trim(),r);return s.errors=i,s.tips=o,s}return{compile:t,compileToFunctions:es(t)}})(xa),is=(rs.compile,rs.compileToFunctions);function os(e){return(ns=ns||document.createElement("div")).innerHTML=e?'<a href="\n"/>':'<div a="\n"/>',ns.innerHTML.indexOf(" ")>0}var as=!!V&&os(!1),ss=!!V&&os(!0),cs=g(function(e){var t=Qn(e);return t&&t.innerHTML}),us=Cn.prototype.$mount;return Cn.prototype.$mount=function(e,t){if((e=e&&Qn(e))===document.body||e===document.documentElement)return this;var n=this.$options;if(!n.render){var r=n.template;if(r)if("string"==typeof r)"#"===r.charAt(0)&&(r=cs(r));else{if(!r.nodeType)return this;r=r.innerHTML}else e&&(r=function(e){if(e.outerHTML)return e.outerHTML;var t=document.createElement("div");return t.appendChild(e.cloneNode(!0)),t.innerHTML}(e));if(r){var i=is(r,{outputSourceRange:!1,shouldDecodeNewlines:as,shouldDecodeNewlinesForHref:ss,delimiters:n.delimiters,comments:n.comments},this),o=i.render,a=i.staticRenderFns;n.render=o,n.staticRenderFns=a}}return us.call(this,e,t)},Cn.compile=is,Cn}); | ||
| 0 | \ No newline at end of file | 7 | \ No newline at end of file |