| 1 |
(self["webpackChunkadminify"] = self["webpackChunkadminify"] || []).push([["/assets/admin/js/vendor"],{ |
| 2 |
|
| 3 |
/***/ "./node_modules/css-loader/dist/cjs.js??clonedRuleSet-102[0].rules[0].use[1]!./node_modules/postcss-loader/dist/cjs.js??clonedRuleSet-102[0].rules[0].use[2]!./node_modules/vue-range-slider/dist/vue-range-slider.css": |
| 4 |
/*!*****************************************************************************************************************************************************************************************************************************!*\ |
| 5 |
!*** ./node_modules/css-loader/dist/cjs.js??clonedRuleSet-102[0].rules[0].use[1]!./node_modules/postcss-loader/dist/cjs.js??clonedRuleSet-102[0].rules[0].use[2]!./node_modules/vue-range-slider/dist/vue-range-slider.css ***! |
| 6 |
\*****************************************************************************************************************************************************************************************************************************/ |
| 7 |
/***/ ((module, __webpack_exports__, __webpack_require__) => { |
| 8 |
|
| 9 |
"use strict"; |
| 10 |
__webpack_require__.r(__webpack_exports__); |
| 11 |
/* harmony export */ __webpack_require__.d(__webpack_exports__, { |
| 12 |
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) |
| 13 |
/* harmony export */ }); |
| 14 |
/* harmony import */ var _css_loader_dist_runtime_cssWithMappingToString_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../css-loader/dist/runtime/cssWithMappingToString.js */ "./node_modules/css-loader/dist/runtime/cssWithMappingToString.js"); |
| 15 |
/* harmony import */ var _css_loader_dist_runtime_cssWithMappingToString_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_css_loader_dist_runtime_cssWithMappingToString_js__WEBPACK_IMPORTED_MODULE_0__); |
| 16 |
/* harmony import */ var _css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../css-loader/dist/runtime/api.js */ "./node_modules/css-loader/dist/runtime/api.js"); |
| 17 |
/* harmony import */ var _css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1__); |
| 18 |
// Imports |
| 19 |
|
| 20 |
|
| 21 |
var ___CSS_LOADER_EXPORT___ = _css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1___default()((_css_loader_dist_runtime_cssWithMappingToString_js__WEBPACK_IMPORTED_MODULE_0___default())); |
| 22 |
// Module |
| 23 |
___CSS_LOADER_EXPORT___.push([module.id, ".range-slider {\n display: inline-block;\n padding: 0 10px;\n height: 20px;\n width: 130px;\n}\n\n.range-slider.disabled {\n opacity: 0.5;\n}\n\n.range-slider-inner {\n display: inline-block;\n position: relative;\n height: 100%;\n width: 100%;\n}\n\n.range-slider-rail,\n.range-slider-fill {\n display: block;\n position: absolute;\n top: 50%;\n left: 0;\n height: 4px;\n -webkit-border-radius: 2px;\n border-radius: 2px;\n -webkit-transform: translateY(-50%);\n -ms-transform: translateY(-50%);\n transform: translateY(-50%);\n}\n\n.range-slider-rail {\n width: 100%;\n background-color: #e2e2e2;\n}\n\n.range-slider-fill {\n background-color: #21fb92;\n}\n\n.range-slider-knob {\n display: block;\n position: absolute;\n top: 50%;\n left: 0;\n -webkit-box-sizing: border-box;\n box-sizing: border-box;\n height: 20px;\n width: 20px;\n border: 1px solid #f5f5f5;\n -webkit-border-radius: 50%;\n border-radius: 50%;\n background-color: #fff;\n -webkit-box-shadow: 1px 1px rgba(0, 0, 0, 0.2);\n box-shadow: 1px 1px rgba(0, 0, 0, 0.2);\n -webkit-transform: translate(-50%, -50%);\n -ms-transform: translate(-50%, -50%);\n transform: translate(-50%, -50%);\n cursor: pointer;\n}\n\n.range-slider-hidden {\n display: none;\n}\n", "",{"version":3,"sources":["webpack://./node_modules/vue-range-slider/dist/vue-range-slider.css"],"names":[],"mappings":"AAAA;EACE,qBAAqB;EACrB,eAAe;EACf,YAAY;EACZ,YAAY;AACd;;AAEA;EACE,YAAY;AACd;;AAEA;EACE,qBAAqB;EACrB,kBAAkB;EAClB,YAAY;EACZ,WAAW;AACb;;AAEA;;EAEE,cAAc;EACd,kBAAkB;EAClB,QAAQ;EACR,OAAO;EACP,WAAW;EACX,0BAAkB;UAAlB,kBAAkB;EAClB,mCAAmC;MAC/B,+BAA+B;UAC3B,2BAA2B;AACrC;;AAEA;EACE,WAAW;EACX,yBAAyB;AAC3B;;AAEA;EACE,yBAAyB;AAC3B;;AAEA;EACE,cAAc;EACd,kBAAkB;EAClB,QAAQ;EACR,OAAO;EACP,8BAA8B;UACtB,sBAAsB;EAC9B,YAAY;EACZ,WAAW;EACX,yBAAyB;EACzB,0BAAkB;UAAlB,kBAAkB;EAClB,sBAAsB;EACtB,8CAA8C;UACtC,sCAAsC;EAC9C,wCAAwC;MACpC,oCAAoC;UAChC,gCAAgC;EACxC,eAAe;AACjB;;AAEA;EACE,aAAa;AACf","sourcesContent":[".range-slider {\n display: inline-block;\n padding: 0 10px;\n height: 20px;\n width: 130px;\n}\n\n.range-slider.disabled {\n opacity: 0.5;\n}\n\n.range-slider-inner {\n display: inline-block;\n position: relative;\n height: 100%;\n width: 100%;\n}\n\n.range-slider-rail,\n.range-slider-fill {\n display: block;\n position: absolute;\n top: 50%;\n left: 0;\n height: 4px;\n border-radius: 2px;\n -webkit-transform: translateY(-50%);\n -ms-transform: translateY(-50%);\n transform: translateY(-50%);\n}\n\n.range-slider-rail {\n width: 100%;\n background-color: #e2e2e2;\n}\n\n.range-slider-fill {\n background-color: #21fb92;\n}\n\n.range-slider-knob {\n display: block;\n position: absolute;\n top: 50%;\n left: 0;\n -webkit-box-sizing: border-box;\n box-sizing: border-box;\n height: 20px;\n width: 20px;\n border: 1px solid #f5f5f5;\n border-radius: 50%;\n background-color: #fff;\n -webkit-box-shadow: 1px 1px rgba(0, 0, 0, 0.2);\n box-shadow: 1px 1px rgba(0, 0, 0, 0.2);\n -webkit-transform: translate(-50%, -50%);\n -ms-transform: translate(-50%, -50%);\n transform: translate(-50%, -50%);\n cursor: pointer;\n}\n\n.range-slider-hidden {\n display: none;\n}\n"],"sourceRoot":""}]); |
| 24 |
// Exports |
| 25 |
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (___CSS_LOADER_EXPORT___); |
| 26 |
|
| 27 |
|
| 28 |
/***/ }), |
| 29 |
|
| 30 |
/***/ "./node_modules/css-loader/dist/runtime/api.js": |
| 31 |
/*!*****************************************************!*\ |
| 32 |
!*** ./node_modules/css-loader/dist/runtime/api.js ***! |
| 33 |
\*****************************************************/ |
| 34 |
/***/ ((module) => { |
| 35 |
|
| 36 |
"use strict"; |
| 37 |
|
| 38 |
|
| 39 |
/* |
| 40 |
MIT License http://www.opensource.org/licenses/mit-license.php |
| 41 |
Author Tobias Koppers @sokra |
| 42 |
*/ |
| 43 |
// css base code, injected by the css-loader |
| 44 |
// eslint-disable-next-line func-names |
| 45 |
module.exports = function (cssWithMappingToString) { |
| 46 |
var list = []; // return the list of modules as css string |
| 47 |
|
| 48 |
list.toString = function toString() { |
| 49 |
return this.map(function (item) { |
| 50 |
var content = cssWithMappingToString(item); |
| 51 |
|
| 52 |
if (item[2]) { |
| 53 |
return "@media ".concat(item[2], " {").concat(content, "}"); |
| 54 |
} |
| 55 |
|
| 56 |
return content; |
| 57 |
}).join(""); |
| 58 |
}; // import a list of modules into the list |
| 59 |
// eslint-disable-next-line func-names |
| 60 |
|
| 61 |
|
| 62 |
list.i = function (modules, mediaQuery, dedupe) { |
| 63 |
if (typeof modules === "string") { |
| 64 |
// eslint-disable-next-line no-param-reassign |
| 65 |
modules = [[null, modules, ""]]; |
| 66 |
} |
| 67 |
|
| 68 |
var alreadyImportedModules = {}; |
| 69 |
|
| 70 |
if (dedupe) { |
| 71 |
for (var i = 0; i < this.length; i++) { |
| 72 |
// eslint-disable-next-line prefer-destructuring |
| 73 |
var id = this[i][0]; |
| 74 |
|
| 75 |
if (id != null) { |
| 76 |
alreadyImportedModules[id] = true; |
| 77 |
} |
| 78 |
} |
| 79 |
} |
| 80 |
|
| 81 |
for (var _i = 0; _i < modules.length; _i++) { |
| 82 |
var item = [].concat(modules[_i]); |
| 83 |
|
| 84 |
if (dedupe && alreadyImportedModules[item[0]]) { |
| 85 |
// eslint-disable-next-line no-continue |
| 86 |
continue; |
| 87 |
} |
| 88 |
|
| 89 |
if (mediaQuery) { |
| 90 |
if (!item[2]) { |
| 91 |
item[2] = mediaQuery; |
| 92 |
} else { |
| 93 |
item[2] = "".concat(mediaQuery, " and ").concat(item[2]); |
| 94 |
} |
| 95 |
} |
| 96 |
|
| 97 |
list.push(item); |
| 98 |
} |
| 99 |
}; |
| 100 |
|
| 101 |
return list; |
| 102 |
}; |
| 103 |
|
| 104 |
/***/ }), |
| 105 |
|
| 106 |
/***/ "./node_modules/css-loader/dist/runtime/cssWithMappingToString.js": |
| 107 |
/*!************************************************************************!*\ |
| 108 |
!*** ./node_modules/css-loader/dist/runtime/cssWithMappingToString.js ***! |
| 109 |
\************************************************************************/ |
| 110 |
/***/ ((module) => { |
| 111 |
|
| 112 |
"use strict"; |
| 113 |
|
| 114 |
|
| 115 |
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); } |
| 116 |
|
| 117 |
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } |
| 118 |
|
| 119 |
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } |
| 120 |
|
| 121 |
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } |
| 122 |
|
| 123 |
function _iterableToArrayLimit(arr, i) { var _i = arr && (typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]); if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } |
| 124 |
|
| 125 |
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } |
| 126 |
|
| 127 |
module.exports = function cssWithMappingToString(item) { |
| 128 |
var _item = _slicedToArray(item, 4), |
| 129 |
content = _item[1], |
| 130 |
cssMapping = _item[3]; |
| 131 |
|
| 132 |
if (!cssMapping) { |
| 133 |
return content; |
| 134 |
} |
| 135 |
|
| 136 |
if (typeof btoa === "function") { |
| 137 |
// eslint-disable-next-line no-undef |
| 138 |
var base64 = btoa(unescape(encodeURIComponent(JSON.stringify(cssMapping)))); |
| 139 |
var data = "sourceMappingURL=data:application/json;charset=utf-8;base64,".concat(base64); |
| 140 |
var sourceMapping = "/*# ".concat(data, " */"); |
| 141 |
var sourceURLs = cssMapping.sources.map(function (source) { |
| 142 |
return "/*# sourceURL=".concat(cssMapping.sourceRoot || "").concat(source, " */"); |
| 143 |
}); |
| 144 |
return [content].concat(sourceURLs).concat([sourceMapping]).join("\n"); |
| 145 |
} |
| 146 |
|
| 147 |
return [content].join("\n"); |
| 148 |
}; |
| 149 |
|
| 150 |
/***/ }), |
| 151 |
|
| 152 |
/***/ "./node_modules/sortablejs/modular/sortable.esm.js": |
| 153 |
/*!*********************************************************!*\ |
| 154 |
!*** ./node_modules/sortablejs/modular/sortable.esm.js ***! |
| 155 |
\*********************************************************/ |
| 156 |
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { |
| 157 |
|
| 158 |
"use strict"; |
| 159 |
__webpack_require__.r(__webpack_exports__); |
| 160 |
/* harmony export */ __webpack_require__.d(__webpack_exports__, { |
| 161 |
/* harmony export */ "MultiDrag": () => (/* binding */ MultiDragPlugin), |
| 162 |
/* harmony export */ "Sortable": () => (/* binding */ Sortable), |
| 163 |
/* harmony export */ "Swap": () => (/* binding */ SwapPlugin), |
| 164 |
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) |
| 165 |
/* harmony export */ }); |
| 166 |
/**! |
| 167 |
* Sortable 1.10.2 |
| 168 |
* @author RubaXa <trash@rubaxa.org> |
| 169 |
* @author owenm <owen23355@gmail.com> |
| 170 |
* @license MIT |
| 171 |
*/ |
| 172 |
function _typeof(obj) { |
| 173 |
if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { |
| 174 |
_typeof = function (obj) { |
| 175 |
return typeof obj; |
| 176 |
}; |
| 177 |
} else { |
| 178 |
_typeof = function (obj) { |
| 179 |
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; |
| 180 |
}; |
| 181 |
} |
| 182 |
|
| 183 |
return _typeof(obj); |
| 184 |
} |
| 185 |
|
| 186 |
function _defineProperty(obj, key, value) { |
| 187 |
if (key in obj) { |
| 188 |
Object.defineProperty(obj, key, { |
| 189 |
value: value, |
| 190 |
enumerable: true, |
| 191 |
configurable: true, |
| 192 |
writable: true |
| 193 |
}); |
| 194 |
} else { |
| 195 |
obj[key] = value; |
| 196 |
} |
| 197 |
|
| 198 |
return obj; |
| 199 |
} |
| 200 |
|
| 201 |
function _extends() { |
| 202 |
_extends = Object.assign || function (target) { |
| 203 |
for (var i = 1; i < arguments.length; i++) { |
| 204 |
var source = arguments[i]; |
| 205 |
|
| 206 |
for (var key in source) { |
| 207 |
if (Object.prototype.hasOwnProperty.call(source, key)) { |
| 208 |
target[key] = source[key]; |
| 209 |
} |
| 210 |
} |
| 211 |
} |
| 212 |
|
| 213 |
return target; |
| 214 |
}; |
| 215 |
|
| 216 |
return _extends.apply(this, arguments); |
| 217 |
} |
| 218 |
|
| 219 |
function _objectSpread(target) { |
| 220 |
for (var i = 1; i < arguments.length; i++) { |
| 221 |
var source = arguments[i] != null ? arguments[i] : {}; |
| 222 |
var ownKeys = Object.keys(source); |
| 223 |
|
| 224 |
if (typeof Object.getOwnPropertySymbols === 'function') { |
| 225 |
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { |
| 226 |
return Object.getOwnPropertyDescriptor(source, sym).enumerable; |
| 227 |
})); |
| 228 |
} |
| 229 |
|
| 230 |
ownKeys.forEach(function (key) { |
| 231 |
_defineProperty(target, key, source[key]); |
| 232 |
}); |
| 233 |
} |
| 234 |
|
| 235 |
return target; |
| 236 |
} |
| 237 |
|
| 238 |
function _objectWithoutPropertiesLoose(source, excluded) { |
| 239 |
if (source == null) return {}; |
| 240 |
var target = {}; |
| 241 |
var sourceKeys = Object.keys(source); |
| 242 |
var key, i; |
| 243 |
|
| 244 |
for (i = 0; i < sourceKeys.length; i++) { |
| 245 |
key = sourceKeys[i]; |
| 246 |
if (excluded.indexOf(key) >= 0) continue; |
| 247 |
target[key] = source[key]; |
| 248 |
} |
| 249 |
|
| 250 |
return target; |
| 251 |
} |
| 252 |
|
| 253 |
function _objectWithoutProperties(source, excluded) { |
| 254 |
if (source == null) return {}; |
| 255 |
|
| 256 |
var target = _objectWithoutPropertiesLoose(source, excluded); |
| 257 |
|
| 258 |
var key, i; |
| 259 |
|
| 260 |
if (Object.getOwnPropertySymbols) { |
| 261 |
var sourceSymbolKeys = Object.getOwnPropertySymbols(source); |
| 262 |
|
| 263 |
for (i = 0; i < sourceSymbolKeys.length; i++) { |
| 264 |
key = sourceSymbolKeys[i]; |
| 265 |
if (excluded.indexOf(key) >= 0) continue; |
| 266 |
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; |
| 267 |
target[key] = source[key]; |
| 268 |
} |
| 269 |
} |
| 270 |
|
| 271 |
return target; |
| 272 |
} |
| 273 |
|
| 274 |
function _toConsumableArray(arr) { |
| 275 |
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread(); |
| 276 |
} |
| 277 |
|
| 278 |
function _arrayWithoutHoles(arr) { |
| 279 |
if (Array.isArray(arr)) { |
| 280 |
for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) arr2[i] = arr[i]; |
| 281 |
|
| 282 |
return arr2; |
| 283 |
} |
| 284 |
} |
| 285 |
|
| 286 |
function _iterableToArray(iter) { |
| 287 |
if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter); |
| 288 |
} |
| 289 |
|
| 290 |
function _nonIterableSpread() { |
| 291 |
throw new TypeError("Invalid attempt to spread non-iterable instance"); |
| 292 |
} |
| 293 |
|
| 294 |
var version = "1.10.2"; |
| 295 |
|
| 296 |
function userAgent(pattern) { |
| 297 |
if (typeof window !== 'undefined' && window.navigator) { |
| 298 |
return !! |
| 299 |
/*@__PURE__*/ |
| 300 |
navigator.userAgent.match(pattern); |
| 301 |
} |
| 302 |
} |
| 303 |
|
| 304 |
var IE11OrLess = userAgent(/(?:Trident.*rv[ :]?11\.|msie|iemobile|Windows Phone)/i); |
| 305 |
var Edge = userAgent(/Edge/i); |
| 306 |
var FireFox = userAgent(/firefox/i); |
| 307 |
var Safari = userAgent(/safari/i) && !userAgent(/chrome/i) && !userAgent(/android/i); |
| 308 |
var IOS = userAgent(/iP(ad|od|hone)/i); |
| 309 |
var ChromeForAndroid = userAgent(/chrome/i) && userAgent(/android/i); |
| 310 |
|
| 311 |
var captureMode = { |
| 312 |
capture: false, |
| 313 |
passive: false |
| 314 |
}; |
| 315 |
|
| 316 |
function on(el, event, fn) { |
| 317 |
el.addEventListener(event, fn, !IE11OrLess && captureMode); |
| 318 |
} |
| 319 |
|
| 320 |
function off(el, event, fn) { |
| 321 |
el.removeEventListener(event, fn, !IE11OrLess && captureMode); |
| 322 |
} |
| 323 |
|
| 324 |
function matches( |
| 325 |
/**HTMLElement*/ |
| 326 |
el, |
| 327 |
/**String*/ |
| 328 |
selector) { |
| 329 |
if (!selector) return; |
| 330 |
selector[0] === '>' && (selector = selector.substring(1)); |
| 331 |
|
| 332 |
if (el) { |
| 333 |
try { |
| 334 |
if (el.matches) { |
| 335 |
return el.matches(selector); |
| 336 |
} else if (el.msMatchesSelector) { |
| 337 |
return el.msMatchesSelector(selector); |
| 338 |
} else if (el.webkitMatchesSelector) { |
| 339 |
return el.webkitMatchesSelector(selector); |
| 340 |
} |
| 341 |
} catch (_) { |
| 342 |
return false; |
| 343 |
} |
| 344 |
} |
| 345 |
|
| 346 |
return false; |
| 347 |
} |
| 348 |
|
| 349 |
function getParentOrHost(el) { |
| 350 |
return el.host && el !== document && el.host.nodeType ? el.host : el.parentNode; |
| 351 |
} |
| 352 |
|
| 353 |
function closest( |
| 354 |
/**HTMLElement*/ |
| 355 |
el, |
| 356 |
/**String*/ |
| 357 |
selector, |
| 358 |
/**HTMLElement*/ |
| 359 |
ctx, includeCTX) { |
| 360 |
if (el) { |
| 361 |
ctx = ctx || document; |
| 362 |
|
| 363 |
do { |
| 364 |
if (selector != null && (selector[0] === '>' ? el.parentNode === ctx && matches(el, selector) : matches(el, selector)) || includeCTX && el === ctx) { |
| 365 |
return el; |
| 366 |
} |
| 367 |
|
| 368 |
if (el === ctx) break; |
| 369 |
/* jshint boss:true */ |
| 370 |
} while (el = getParentOrHost(el)); |
| 371 |
} |
| 372 |
|
| 373 |
return null; |
| 374 |
} |
| 375 |
|
| 376 |
var R_SPACE = /\s+/g; |
| 377 |
|
| 378 |
function toggleClass(el, name, state) { |
| 379 |
if (el && name) { |
| 380 |
if (el.classList) { |
| 381 |
el.classList[state ? 'add' : 'remove'](name); |
| 382 |
} else { |
| 383 |
var className = (' ' + el.className + ' ').replace(R_SPACE, ' ').replace(' ' + name + ' ', ' '); |
| 384 |
el.className = (className + (state ? ' ' + name : '')).replace(R_SPACE, ' '); |
| 385 |
} |
| 386 |
} |
| 387 |
} |
| 388 |
|
| 389 |
function css(el, prop, val) { |
| 390 |
var style = el && el.style; |
| 391 |
|
| 392 |
if (style) { |
| 393 |
if (val === void 0) { |
| 394 |
if (document.defaultView && document.defaultView.getComputedStyle) { |
| 395 |
val = document.defaultView.getComputedStyle(el, ''); |
| 396 |
} else if (el.currentStyle) { |
| 397 |
val = el.currentStyle; |
| 398 |
} |
| 399 |
|
| 400 |
return prop === void 0 ? val : val[prop]; |
| 401 |
} else { |
| 402 |
if (!(prop in style) && prop.indexOf('webkit') === -1) { |
| 403 |
prop = '-webkit-' + prop; |
| 404 |
} |
| 405 |
|
| 406 |
style[prop] = val + (typeof val === 'string' ? '' : 'px'); |
| 407 |
} |
| 408 |
} |
| 409 |
} |
| 410 |
|
| 411 |
function matrix(el, selfOnly) { |
| 412 |
var appliedTransforms = ''; |
| 413 |
|
| 414 |
if (typeof el === 'string') { |
| 415 |
appliedTransforms = el; |
| 416 |
} else { |
| 417 |
do { |
| 418 |
var transform = css(el, 'transform'); |
| 419 |
|
| 420 |
if (transform && transform !== 'none') { |
| 421 |
appliedTransforms = transform + ' ' + appliedTransforms; |
| 422 |
} |
| 423 |
/* jshint boss:true */ |
| 424 |
|
| 425 |
} while (!selfOnly && (el = el.parentNode)); |
| 426 |
} |
| 427 |
|
| 428 |
var matrixFn = window.DOMMatrix || window.WebKitCSSMatrix || window.CSSMatrix || window.MSCSSMatrix; |
| 429 |
/*jshint -W056 */ |
| 430 |
|
| 431 |
return matrixFn && new matrixFn(appliedTransforms); |
| 432 |
} |
| 433 |
|
| 434 |
function find(ctx, tagName, iterator) { |
| 435 |
if (ctx) { |
| 436 |
var list = ctx.getElementsByTagName(tagName), |
| 437 |
i = 0, |
| 438 |
n = list.length; |
| 439 |
|
| 440 |
if (iterator) { |
| 441 |
for (; i < n; i++) { |
| 442 |
iterator(list[i], i); |
| 443 |
} |
| 444 |
} |
| 445 |
|
| 446 |
return list; |
| 447 |
} |
| 448 |
|
| 449 |
return []; |
| 450 |
} |
| 451 |
|
| 452 |
function getWindowScrollingElement() { |
| 453 |
var scrollingElement = document.scrollingElement; |
| 454 |
|
| 455 |
if (scrollingElement) { |
| 456 |
return scrollingElement; |
| 457 |
} else { |
| 458 |
return document.documentElement; |
| 459 |
} |
| 460 |
} |
| 461 |
/**
|
| 462 |
* Returns the "bounding client rect" of given element
|
| 463 |
* @param {HTMLElement} el The element whose boundingClientRect is wanted
|
| 464 |
* @param {[Boolean]} relativeToContainingBlock Whether the rect should be relative to the containing block of (including) the container
|
| 465 |
* @param {[Boolean]} relativeToNonStaticParent Whether the rect should be relative to the relative parent of (including) the contaienr
|
| 466 |
* @param {[Boolean]} undoScale Whether the container's scale() should be undone
|
| 467 |
* @param {[HTMLElement]} container The parent the element will be placed in
|
| 468 |
* @return {Object} The boundingClientRect of el, with specified adjustments
|
| 469 |
*/ |
| 470 |
|
| 471 |
|
| 472 |
function getRect(el, relativeToContainingBlock, relativeToNonStaticParent, undoScale, container) { |
| 473 |
if (!el.getBoundingClientRect && el !== window) return; |
| 474 |
var elRect, top, left, bottom, right, height, width; |
| 475 |
|
| 476 |
if (el !== window && el !== getWindowScrollingElement()) { |
| 477 |
elRect = el.getBoundingClientRect(); |
| 478 |
top = elRect.top; |
| 479 |
left = elRect.left; |
| 480 |
bottom = elRect.bottom; |
| 481 |
right = elRect.right; |
| 482 |
height = elRect.height; |
| 483 |
width = elRect.width; |
| 484 |
} else { |
| 485 |
top = 0; |
| 486 |
left = 0; |
| 487 |
bottom = window.innerHeight; |
| 488 |
right = window.innerWidth; |
| 489 |
height = window.innerHeight; |
| 490 |
width = window.innerWidth; |
| 491 |
} |
| 492 |
|
| 493 |
if ((relativeToContainingBlock || relativeToNonStaticParent) && el !== window) { |
| 494 |
// Adjust for translate() |
| 495 |
container = container || el.parentNode; // solves #1123 (see: https://stackoverflow.com/a/37953806/6088312) |
| 496 |
// Not needed on <= IE11 |
| 497 |
|
| 498 |
if (!IE11OrLess) { |
| 499 |
do { |
| 500 |
if (container && container.getBoundingClientRect && (css(container, 'transform') !== 'none' || relativeToNonStaticParent && css(container, 'position') !== 'static')) { |
| 501 |
var containerRect = container.getBoundingClientRect(); // Set relative to edges of padding box of container |
| 502 |
|
| 503 |
top -= containerRect.top + parseInt(css(container, 'border-top-width')); |
| 504 |
left -= containerRect.left + parseInt(css(container, 'border-left-width')); |
| 505 |
bottom = top + elRect.height; |
| 506 |
right = left + elRect.width; |
| 507 |
break; |
| 508 |
} |
| 509 |
/* jshint boss:true */ |
| 510 |
|
| 511 |
} while (container = container.parentNode); |
| 512 |
} |
| 513 |
} |
| 514 |
|
| 515 |
if (undoScale && el !== window) { |
| 516 |
// Adjust for scale() |
| 517 |
var elMatrix = matrix(container || el), |
| 518 |
scaleX = elMatrix && elMatrix.a, |
| 519 |
scaleY = elMatrix && elMatrix.d; |
| 520 |
|
| 521 |
if (elMatrix) { |
| 522 |
top /= scaleY; |
| 523 |
left /= scaleX; |
| 524 |
width /= scaleX; |
| 525 |
height /= scaleY; |
| 526 |
bottom = top + height; |
| 527 |
right = left + width; |
| 528 |
} |
| 529 |
} |
| 530 |
|
| 531 |
return { |
| 532 |
top: top, |
| 533 |
left: left, |
| 534 |
bottom: bottom, |
| 535 |
right: right, |
| 536 |
width: width, |
| 537 |
height: height |
| 538 |
}; |
| 539 |
} |
| 540 |
/**
|
| 541 |
* Checks if a side of an element is scrolled past a side of its parents
|
| 542 |
* @param {HTMLElement} el The element who's side being scrolled out of view is in question
|
| 543 |
* @param {String} elSide Side of the element in question ('top', 'left', 'right', 'bottom')
|
| 544 |
* @param {String} parentSide Side of the parent in question ('top', 'left', 'right', 'bottom')
|
| 545 |
* @return {HTMLElement} The parent scroll element that the el's side is scrolled past, or null if there is no such element
|
| 546 |
*/ |
| 547 |
|
| 548 |
|
| 549 |
function isScrolledPast(el, elSide, parentSide) { |
| 550 |
var parent = getParentAutoScrollElement(el, true), |
| 551 |
elSideVal = getRect(el)[elSide]; |
| 552 |
/* jshint boss:true */ |
| 553 |
|
| 554 |
while (parent) { |
| 555 |
var parentSideVal = getRect(parent)[parentSide], |
| 556 |
visible = void 0; |
| 557 |
|
| 558 |
if (parentSide === 'top' || parentSide === 'left') { |
| 559 |
visible = elSideVal >= parentSideVal; |
| 560 |
} else { |
| 561 |
visible = elSideVal <= parentSideVal; |
| 562 |
} |
| 563 |
|
| 564 |
if (!visible) return parent; |
| 565 |
if (parent === getWindowScrollingElement()) break; |
| 566 |
parent = getParentAutoScrollElement(parent, false); |
| 567 |
} |
| 568 |
|
| 569 |
return false; |
| 570 |
} |
| 571 |
/**
|
| 572 |
* Gets nth child of el, ignoring hidden children, sortable's elements (does not ignore clone if it's visible)
|
| 573 |
* and non-draggable elements
|
| 574 |
* @param {HTMLElement} el The parent element
|
| 575 |
* @param {Number} childNum The index of the child
|
| 576 |
* @param {Object} options Parent Sortable's options
|
| 577 |
* @return {HTMLElement} The child at index childNum, or null if not found
|
| 578 |
*/ |
| 579 |
|
| 580 |
|
| 581 |
function getChild(el, childNum, options) { |
| 582 |
var currentChild = 0, |
| 583 |
i = 0, |
| 584 |
children = el.children; |
| 585 |
|
| 586 |
while (i < children.length) { |
| 587 |
if (children[i].style.display !== 'none' && children[i] !== Sortable.ghost && children[i] !== Sortable.dragged && closest(children[i], options.draggable, el, false)) { |
| 588 |
if (currentChild === childNum) { |
| 589 |
return children[i]; |
| 590 |
} |
| 591 |
|
| 592 |
currentChild++; |
| 593 |
} |
| 594 |
|
| 595 |
i++; |
| 596 |
} |
| 597 |
|
| 598 |
return null; |
| 599 |
} |
| 600 |
/**
|
| 601 |
* Gets the last child in the el, ignoring ghostEl or invisible elements (clones)
|
| 602 |
* @param {HTMLElement} el Parent element
|
| 603 |
* @param {selector} selector Any other elements that should be ignored
|
| 604 |
* @return {HTMLElement} The last child, ignoring ghostEl
|
| 605 |
*/ |
| 606 |
|
| 607 |
|
| 608 |
function lastChild(el, selector) { |
| 609 |
var last = el.lastElementChild; |
| 610 |
|
| 611 |
while (last && (last === Sortable.ghost || css(last, 'display') === 'none' || selector && !matches(last, selector))) { |
| 612 |
last = last.previousElementSibling; |
| 613 |
} |
| 614 |
|
| 615 |
return last || null; |
| 616 |
} |
| 617 |
/**
|
| 618 |
* Returns the index of an element within its parent for a selected set of
|
| 619 |
* elements
|
| 620 |
* @param {HTMLElement} el
|
| 621 |
* @param {selector} selector
|
| 622 |
* @return {number}
|
| 623 |
*/ |
| 624 |
|
| 625 |
|
| 626 |
function index(el, selector) { |
| 627 |
var index = 0; |
| 628 |
|
| 629 |
if (!el || !el.parentNode) { |
| 630 |
return -1; |
| 631 |
} |
| 632 |
/* jshint boss:true */ |
| 633 |
|
| 634 |
|
| 635 |
while (el = el.previousElementSibling) { |
| 636 |
if (el.nodeName.toUpperCase() !== 'TEMPLATE' && el !== Sortable.clone && (!selector || matches(el, selector))) { |
| 637 |
index++; |
| 638 |
} |
| 639 |
} |
| 640 |
|
| 641 |
return index; |
| 642 |
} |
| 643 |
/**
|
| 644 |
* Returns the scroll offset of the given element, added with all the scroll offsets of parent elements.
|
| 645 |
* The value is returned in real pixels.
|
| 646 |
* @param {HTMLElement} el
|
| 647 |
* @return {Array} Offsets in the format of [left, top]
|
| 648 |
*/ |
| 649 |
|
| 650 |
|
| 651 |
function getRelativeScrollOffset(el) { |
| 652 |
var offsetLeft = 0, |
| 653 |
offsetTop = 0, |
| 654 |
winScroller = getWindowScrollingElement(); |
| 655 |
|
| 656 |
if (el) { |
| 657 |
do { |
| 658 |
var elMatrix = matrix(el), |
| 659 |
scaleX = elMatrix.a, |
| 660 |
scaleY = elMatrix.d; |
| 661 |
offsetLeft += el.scrollLeft * scaleX; |
| 662 |
offsetTop += el.scrollTop * scaleY; |
| 663 |
} while (el !== winScroller && (el = el.parentNode)); |
| 664 |
} |
| 665 |
|
| 666 |
return [offsetLeft, offsetTop]; |
| 667 |
} |
| 668 |
/**
|
| 669 |
* Returns the index of the object within the given array
|
| 670 |
* @param {Array} arr Array that may or may not hold the object
|
| 671 |
* @param {Object} obj An object that has a key-value pair unique to and identical to a key-value pair in the object you want to find
|
| 672 |
* @return {Number} The index of the object in the array, or -1
|
| 673 |
*/ |
| 674 |
|
| 675 |
|
| 676 |
function indexOfObject(arr, obj) { |
| 677 |
for (var i in arr) { |
| 678 |
if (!arr.hasOwnProperty(i)) continue; |
| 679 |
|
| 680 |
for (var key in obj) { |
| 681 |
if (obj.hasOwnProperty(key) && obj[key] === arr[i][key]) return Number(i); |
| 682 |
} |
| 683 |
} |
| 684 |
|
| 685 |
return -1; |
| 686 |
} |
| 687 |
|
| 688 |
function getParentAutoScrollElement(el, includeSelf) { |
| 689 |
// skip to window |
| 690 |
if (!el || !el.getBoundingClientRect) return getWindowScrollingElement(); |
| 691 |
var elem = el; |
| 692 |
var gotSelf = false; |
| 693 |
|
| 694 |
do { |
| 695 |
// we don't need to get elem css if it isn't even overflowing in the first place (performance) |
| 696 |
if (elem.clientWidth < elem.scrollWidth || elem.clientHeight < elem.scrollHeight) { |
| 697 |
var elemCSS = css(elem); |
| 698 |
|
| 699 |
if (elem.clientWidth < elem.scrollWidth && (elemCSS.overflowX == 'auto' || elemCSS.overflowX == 'scroll') || elem.clientHeight < elem.scrollHeight && (elemCSS.overflowY == 'auto' || elemCSS.overflowY == 'scroll')) { |
| 700 |
if (!elem.getBoundingClientRect || elem === document.body) return getWindowScrollingElement(); |
| 701 |
if (gotSelf || includeSelf) return elem; |
| 702 |
gotSelf = true; |
| 703 |
} |
| 704 |
} |
| 705 |
/* jshint boss:true */ |
| 706 |
|
| 707 |
} while (elem = elem.parentNode); |
| 708 |
|
| 709 |
return getWindowScrollingElement(); |
| 710 |
} |
| 711 |
|
| 712 |
function extend(dst, src) { |
| 713 |
if (dst && src) { |
| 714 |
for (var key in src) { |
| 715 |
if (src.hasOwnProperty(key)) { |
| 716 |
dst[key] = src[key]; |
| 717 |
} |
| 718 |
} |
| 719 |
} |
| 720 |
|
| 721 |
return dst; |
| 722 |
} |
| 723 |
|
| 724 |
function isRectEqual(rect1, rect2) { |
| 725 |
return Math.round(rect1.top) === Math.round(rect2.top) && Math.round(rect1.left) === Math.round(rect2.left) && Math.round(rect1.height) === Math.round(rect2.height) && Math.round(rect1.width) === Math.round(rect2.width); |
| 726 |
} |
| 727 |
|
| 728 |
var _throttleTimeout; |
| 729 |
|
| 730 |
function throttle(callback, ms) { |
| 731 |
return function () { |
| 732 |
if (!_throttleTimeout) { |
| 733 |
var args = arguments, |
| 734 |
_this = this; |
| 735 |
|
| 736 |
if (args.length === 1) { |
| 737 |
callback.call(_this, args[0]); |
| 738 |
} else { |
| 739 |
callback.apply(_this, args); |
| 740 |
} |
| 741 |
|
| 742 |
_throttleTimeout = setTimeout(function () { |
| 743 |
_throttleTimeout = void 0; |
| 744 |
}, ms); |
| 745 |
} |
| 746 |
}; |
| 747 |
} |
| 748 |
|
| 749 |
function cancelThrottle() { |
| 750 |
clearTimeout(_throttleTimeout); |
| 751 |
_throttleTimeout = void 0; |
| 752 |
} |
| 753 |
|
| 754 |
function scrollBy(el, x, y) { |
| 755 |
el.scrollLeft += x; |
| 756 |
el.scrollTop += y; |
| 757 |
} |
| 758 |
|
| 759 |
function clone(el) { |
| 760 |
var Polymer = window.Polymer; |
| 761 |
var $ = window.jQuery || window.Zepto; |
| 762 |
|
| 763 |
if (Polymer && Polymer.dom) { |
| 764 |
return Polymer.dom(el).cloneNode(true); |
| 765 |
} else if ($) { |
| 766 |
return $(el).clone(true)[0]; |
| 767 |
} else { |
| 768 |
return el.cloneNode(true); |
| 769 |
} |
| 770 |
} |
| 771 |
|
| 772 |
function setRect(el, rect) { |
| 773 |
css(el, 'position', 'absolute'); |
| 774 |
css(el, 'top', rect.top); |
| 775 |
css(el, 'left', rect.left); |
| 776 |
css(el, 'width', rect.width); |
| 777 |
css(el, 'height', rect.height); |
| 778 |
} |
| 779 |
|
| 780 |
function unsetRect(el) { |
| 781 |
css(el, 'position', ''); |
| 782 |
css(el, 'top', ''); |
| 783 |
css(el, 'left', ''); |
| 784 |
css(el, 'width', ''); |
| 785 |
css(el, 'height', ''); |
| 786 |
} |
| 787 |
|
| 788 |
var expando = 'Sortable' + new Date().getTime(); |
| 789 |
|
| 790 |
function AnimationStateManager() { |
| 791 |
var animationStates = [], |
| 792 |
animationCallbackId; |
| 793 |
return { |
| 794 |
captureAnimationState: function captureAnimationState() { |
| 795 |
animationStates = []; |
| 796 |
if (!this.options.animation) return; |
| 797 |
var children = [].slice.call(this.el.children); |
| 798 |
children.forEach(function (child) { |
| 799 |
if (css(child, 'display') === 'none' || child === Sortable.ghost) return; |
| 800 |
animationStates.push({ |
| 801 |
target: child, |
| 802 |
rect: getRect(child) |
| 803 |
}); |
| 804 |
|
| 805 |
var fromRect = _objectSpread({}, animationStates[animationStates.length - 1].rect); // If animating: compensate for current animation |
| 806 |
|
| 807 |
|
| 808 |
if (child.thisAnimationDuration) { |
| 809 |
var childMatrix = matrix(child, true); |
| 810 |
|
| 811 |
if (childMatrix) { |
| 812 |
fromRect.top -= childMatrix.f; |
| 813 |
fromRect.left -= childMatrix.e; |
| 814 |
} |
| 815 |
} |
| 816 |
|
| 817 |
child.fromRect = fromRect; |
| 818 |
}); |
| 819 |
}, |
| 820 |
addAnimationState: function addAnimationState(state) { |
| 821 |
animationStates.push(state); |
| 822 |
}, |
| 823 |
removeAnimationState: function removeAnimationState(target) { |
| 824 |
animationStates.splice(indexOfObject(animationStates, { |
| 825 |
target: target |
| 826 |
}), 1); |
| 827 |
}, |
| 828 |
animateAll: function animateAll(callback) { |
| 829 |
var _this = this; |
| 830 |
|
| 831 |
if (!this.options.animation) { |
| 832 |
clearTimeout(animationCallbackId); |
| 833 |
if (typeof callback === 'function') callback(); |
| 834 |
return; |
| 835 |
} |
| 836 |
|
| 837 |
var animating = false, |
| 838 |
animationTime = 0; |
| 839 |
animationStates.forEach(function (state) { |
| 840 |
var time = 0, |
| 841 |
target = state.target, |
| 842 |
fromRect = target.fromRect, |
| 843 |
toRect = getRect(target), |
| 844 |
prevFromRect = target.prevFromRect, |
| 845 |
prevToRect = target.prevToRect, |
| 846 |
animatingRect = state.rect, |
| 847 |
targetMatrix = matrix(target, true); |
| 848 |
|
| 849 |
if (targetMatrix) { |
| 850 |
// Compensate for current animation |
| 851 |
toRect.top -= targetMatrix.f; |
| 852 |
toRect.left -= targetMatrix.e; |
| 853 |
} |
| 854 |
|
| 855 |
target.toRect = toRect; |
| 856 |
|
| 857 |
if (target.thisAnimationDuration) { |
| 858 |
// Could also check if animatingRect is between fromRect and toRect |
| 859 |
if (isRectEqual(prevFromRect, toRect) && !isRectEqual(fromRect, toRect) && // Make sure animatingRect is on line between toRect & fromRect |
| 860 |
(animatingRect.top - toRect.top) / (animatingRect.left - toRect.left) === (fromRect.top - toRect.top) / (fromRect.left - toRect.left)) { |
| 861 |
// If returning to same place as started from animation and on same axis |
| 862 |
time = calculateRealTime(animatingRect, prevFromRect, prevToRect, _this.options); |
| 863 |
} |
| 864 |
} // if fromRect != toRect: animate |
| 865 |
|
| 866 |
|
| 867 |
if (!isRectEqual(toRect, fromRect)) { |
| 868 |
target.prevFromRect = fromRect; |
| 869 |
target.prevToRect = toRect; |
| 870 |
|
| 871 |
if (!time) { |
| 872 |
time = _this.options.animation; |
| 873 |
} |
| 874 |
|
| 875 |
_this.animate(target, animatingRect, toRect, time); |
| 876 |
} |
| 877 |
|
| 878 |
if (time) { |
| 879 |
animating = true; |
| 880 |
animationTime = Math.max(animationTime, time); |
| 881 |
clearTimeout(target.animationResetTimer); |
| 882 |
target.animationResetTimer = setTimeout(function () { |
| 883 |
target.animationTime = 0; |
| 884 |
target.prevFromRect = null; |
| 885 |
target.fromRect = null; |
| 886 |
target.prevToRect = null; |
| 887 |
target.thisAnimationDuration = null; |
| 888 |
}, time); |
| 889 |
target.thisAnimationDuration = time; |
| 890 |
} |
| 891 |
}); |
| 892 |
clearTimeout(animationCallbackId); |
| 893 |
|
| 894 |
if (!animating) { |
| 895 |
if (typeof callback === 'function') callback(); |
| 896 |
} else { |
| 897 |
animationCallbackId = setTimeout(function () { |
| 898 |
if (typeof callback === 'function') callback(); |
| 899 |
}, animationTime); |
| 900 |
} |
| 901 |
|
| 902 |
animationStates = []; |
| 903 |
}, |
| 904 |
animate: function animate(target, currentRect, toRect, duration) { |
| 905 |
if (duration) { |
| 906 |
css(target, 'transition', ''); |
| 907 |
css(target, 'transform', ''); |
| 908 |
var elMatrix = matrix(this.el), |
| 909 |
scaleX = elMatrix && elMatrix.a, |
| 910 |
scaleY = elMatrix && elMatrix.d, |
| 911 |
translateX = (currentRect.left - toRect.left) / (scaleX || 1), |
| 912 |
translateY = (currentRect.top - toRect.top) / (scaleY || 1); |
| 913 |
target.animatingX = !!translateX; |
| 914 |
target.animatingY = !!translateY; |
| 915 |
css(target, 'transform', 'translate3d(' + translateX + 'px,' + translateY + 'px,0)'); |
| 916 |
repaint(target); // repaint |
| 917 |
|
| 918 |
css(target, 'transition', 'transform ' + duration + 'ms' + (this.options.easing ? ' ' + this.options.easing : '')); |
| 919 |
css(target, 'transform', 'translate3d(0,0,0)'); |
| 920 |
typeof target.animated === 'number' && clearTimeout(target.animated); |
| 921 |
target.animated = setTimeout(function () { |
| 922 |
css(target, 'transition', ''); |
| 923 |
css(target, 'transform', ''); |
| 924 |
target.animated = false; |
| 925 |
target.animatingX = false; |
| 926 |
target.animatingY = false; |
| 927 |
}, duration); |
| 928 |
} |
| 929 |
} |
| 930 |
}; |
| 931 |
} |
| 932 |
|
| 933 |
function repaint(target) { |
| 934 |
return target.offsetWidth; |
| 935 |
} |
| 936 |
|
| 937 |
function calculateRealTime(animatingRect, fromRect, toRect, options) { |
| 938 |
return Math.sqrt(Math.pow(fromRect.top - animatingRect.top, 2) + Math.pow(fromRect.left - animatingRect.left, 2)) / Math.sqrt(Math.pow(fromRect.top - toRect.top, 2) + Math.pow(fromRect.left - toRect.left, 2)) * options.animation; |
| 939 |
} |
| 940 |
|
| 941 |
var plugins = []; |
| 942 |
var defaults = { |
| 943 |
initializeByDefault: true |
| 944 |
}; |
| 945 |
var PluginManager = { |
| 946 |
mount: function mount(plugin) { |
| 947 |
// Set default static properties |
| 948 |
for (var option in defaults) { |
| 949 |
if (defaults.hasOwnProperty(option) && !(option in plugin)) { |
| 950 |
plugin[option] = defaults[option]; |
| 951 |
} |
| 952 |
} |
| 953 |
|
| 954 |
plugins.push(plugin); |
| 955 |
}, |
| 956 |
pluginEvent: function pluginEvent(eventName, sortable, evt) { |
| 957 |
var _this = this; |
| 958 |
|
| 959 |
this.eventCanceled = false; |
| 960 |
|
| 961 |
evt.cancel = function () { |
| 962 |
_this.eventCanceled = true; |
| 963 |
}; |
| 964 |
|
| 965 |
var eventNameGlobal = eventName + 'Global'; |
| 966 |
plugins.forEach(function (plugin) { |
| 967 |
if (!sortable[plugin.pluginName]) return; // Fire global events if it exists in this sortable |
| 968 |
|
| 969 |
if (sortable[plugin.pluginName][eventNameGlobal]) { |
| 970 |
sortable[plugin.pluginName][eventNameGlobal](_objectSpread({ |
| 971 |
sortable: sortable |
| 972 |
}, evt)); |
| 973 |
} // Only fire plugin event if plugin is enabled in this sortable, |
| 974 |
// and plugin has event defined |
| 975 |
|
| 976 |
|
| 977 |
if (sortable.options[plugin.pluginName] && sortable[plugin.pluginName][eventName]) { |
| 978 |
sortable[plugin.pluginName][eventName](_objectSpread({ |
| 979 |
sortable: sortable |
| 980 |
}, evt)); |
| 981 |
} |
| 982 |
}); |
| 983 |
}, |
| 984 |
initializePlugins: function initializePlugins(sortable, el, defaults, options) { |
| 985 |
plugins.forEach(function (plugin) { |
| 986 |
var pluginName = plugin.pluginName; |
| 987 |
if (!sortable.options[pluginName] && !plugin.initializeByDefault) return; |
| 988 |
var initialized = new plugin(sortable, el, sortable.options); |
| 989 |
initialized.sortable = sortable; |
| 990 |
initialized.options = sortable.options; |
| 991 |
sortable[pluginName] = initialized; // Add default options from plugin |
| 992 |
|
| 993 |
_extends(defaults, initialized.defaults); |
| 994 |
}); |
| 995 |
|
| 996 |
for (var option in sortable.options) { |
| 997 |
if (!sortable.options.hasOwnProperty(option)) continue; |
| 998 |
var modified = this.modifyOption(sortable, option, sortable.options[option]); |
| 999 |
|
| 1000 |
if (typeof modified !== 'undefined') { |
| 1001 |
sortable.options[option] = modified; |
| 1002 |
} |
| 1003 |
} |
| 1004 |
}, |
| 1005 |
getEventProperties: function getEventProperties(name, sortable) { |
| 1006 |
var eventProperties = {}; |
| 1007 |
plugins.forEach(function (plugin) { |
| 1008 |
if (typeof plugin.eventProperties !== 'function') return; |
| 1009 |
|
| 1010 |
_extends(eventProperties, plugin.eventProperties.call(sortable[plugin.pluginName], name)); |
| 1011 |
}); |
| 1012 |
return eventProperties; |
| 1013 |
}, |
| 1014 |
modifyOption: function modifyOption(sortable, name, value) { |
| 1015 |
var modifiedValue; |
| 1016 |
plugins.forEach(function (plugin) { |
| 1017 |
// Plugin must exist on the Sortable |
| 1018 |
if (!sortable[plugin.pluginName]) return; // If static option listener exists for this option, call in the context of the Sortable's instance of this plugin |
| 1019 |
|
| 1020 |
if (plugin.optionListeners && typeof plugin.optionListeners[name] === 'function') { |
| 1021 |
modifiedValue = plugin.optionListeners[name].call(sortable[plugin.pluginName], value); |
| 1022 |
} |
| 1023 |
}); |
| 1024 |
return modifiedValue; |
| 1025 |
} |
| 1026 |
}; |
| 1027 |
|
| 1028 |
function dispatchEvent(_ref) { |
| 1029 |
var sortable = _ref.sortable, |
| 1030 |
rootEl = _ref.rootEl, |
| 1031 |
name = _ref.name, |
| 1032 |
targetEl = _ref.targetEl, |
| 1033 |
cloneEl = _ref.cloneEl, |
| 1034 |
toEl = _ref.toEl, |
| 1035 |
fromEl = _ref.fromEl, |
| 1036 |
oldIndex = _ref.oldIndex, |
| 1037 |
newIndex = _ref.newIndex, |
| 1038 |
oldDraggableIndex = _ref.oldDraggableIndex, |
| 1039 |
newDraggableIndex = _ref.newDraggableIndex, |
| 1040 |
originalEvent = _ref.originalEvent, |
| 1041 |
putSortable = _ref.putSortable, |
| 1042 |
extraEventProperties = _ref.extraEventProperties; |
| 1043 |
sortable = sortable || rootEl && rootEl[expando]; |
| 1044 |
if (!sortable) return; |
| 1045 |
var evt, |
| 1046 |
options = sortable.options, |
| 1047 |
onName = 'on' + name.charAt(0).toUpperCase() + name.substr(1); // Support for new CustomEvent feature |
| 1048 |
|
| 1049 |
if (window.CustomEvent && !IE11OrLess && !Edge) { |
| 1050 |
evt = new CustomEvent(name, { |
| 1051 |
bubbles: true, |
| 1052 |
cancelable: true |
| 1053 |
}); |
| 1054 |
} else { |
| 1055 |
evt = document.createEvent('Event'); |
| 1056 |
evt.initEvent(name, true, true); |
| 1057 |
} |
| 1058 |
|
| 1059 |
evt.to = toEl || rootEl; |
| 1060 |
evt.from = fromEl || rootEl; |
| 1061 |
evt.item = targetEl || rootEl; |
| 1062 |
evt.clone = cloneEl; |
| 1063 |
evt.oldIndex = oldIndex; |
| 1064 |
evt.newIndex = newIndex; |
| 1065 |
evt.oldDraggableIndex = oldDraggableIndex; |
| 1066 |
evt.newDraggableIndex = newDraggableIndex; |
| 1067 |
evt.originalEvent = originalEvent; |
| 1068 |
evt.pullMode = putSortable ? putSortable.lastPutMode : undefined; |
| 1069 |
|
| 1070 |
var allEventProperties = _objectSpread({}, extraEventProperties, PluginManager.getEventProperties(name, sortable)); |
| 1071 |
|
| 1072 |
for (var option in allEventProperties) { |
| 1073 |
evt[option] = allEventProperties[option]; |
| 1074 |
} |
| 1075 |
|
| 1076 |
if (rootEl) { |
| 1077 |
rootEl.dispatchEvent(evt); |
| 1078 |
} |
| 1079 |
|
| 1080 |
if (options[onName]) { |
| 1081 |
options[onName].call(sortable, evt); |
| 1082 |
} |
| 1083 |
} |
| 1084 |
|
| 1085 |
var pluginEvent = function pluginEvent(eventName, sortable) { |
| 1086 |
var _ref = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}, |
| 1087 |
originalEvent = _ref.evt, |
| 1088 |
data = _objectWithoutProperties(_ref, ["evt"]); |
| 1089 |
|
| 1090 |
PluginManager.pluginEvent.bind(Sortable)(eventName, sortable, _objectSpread({ |
| 1091 |
dragEl: dragEl, |
| 1092 |
parentEl: parentEl, |
| 1093 |
ghostEl: ghostEl, |
| 1094 |
rootEl: rootEl, |
| 1095 |
nextEl: nextEl, |
| 1096 |
lastDownEl: lastDownEl, |
| 1097 |
cloneEl: cloneEl, |
| 1098 |
cloneHidden: cloneHidden, |
| 1099 |
dragStarted: moved, |
| 1100 |
putSortable: putSortable, |
| 1101 |
activeSortable: Sortable.active, |
| 1102 |
originalEvent: originalEvent, |
| 1103 |
oldIndex: oldIndex, |
| 1104 |
oldDraggableIndex: oldDraggableIndex, |
| 1105 |
newIndex: newIndex, |
| 1106 |
newDraggableIndex: newDraggableIndex, |
| 1107 |
hideGhostForTarget: _hideGhostForTarget, |
| 1108 |
unhideGhostForTarget: _unhideGhostForTarget, |
| 1109 |
cloneNowHidden: function cloneNowHidden() { |
| 1110 |
cloneHidden = true; |
| 1111 |
}, |
| 1112 |
cloneNowShown: function cloneNowShown() { |
| 1113 |
cloneHidden = false; |
| 1114 |
}, |
| 1115 |
dispatchSortableEvent: function dispatchSortableEvent(name) { |
| 1116 |
_dispatchEvent({ |
| 1117 |
sortable: sortable, |
| 1118 |
name: name, |
| 1119 |
originalEvent: originalEvent |
| 1120 |
}); |
| 1121 |
} |
| 1122 |
}, data)); |
| 1123 |
}; |
| 1124 |
|
| 1125 |
function _dispatchEvent(info) { |
| 1126 |
dispatchEvent(_objectSpread({ |
| 1127 |
putSortable: putSortable, |
| 1128 |
cloneEl: cloneEl, |
| 1129 |
targetEl: dragEl, |
| 1130 |
rootEl: rootEl, |
| 1131 |
oldIndex: oldIndex, |
| 1132 |
oldDraggableIndex: oldDraggableIndex, |
| 1133 |
newIndex: newIndex, |
| 1134 |
newDraggableIndex: newDraggableIndex |
| 1135 |
}, info)); |
| 1136 |
} |
| 1137 |
|
| 1138 |
var dragEl, |
| 1139 |
parentEl, |
| 1140 |
ghostEl, |
| 1141 |
rootEl, |
| 1142 |
nextEl, |
| 1143 |
lastDownEl, |
| 1144 |
cloneEl, |
| 1145 |
cloneHidden, |
| 1146 |
oldIndex, |
| 1147 |
newIndex, |
| 1148 |
oldDraggableIndex, |
| 1149 |
newDraggableIndex, |
| 1150 |
activeGroup, |
| 1151 |
putSortable, |
| 1152 |
awaitingDragStarted = false, |
| 1153 |
ignoreNextClick = false, |
| 1154 |
sortables = [], |
| 1155 |
tapEvt, |
| 1156 |
touchEvt, |
| 1157 |
lastDx, |
| 1158 |
lastDy, |
| 1159 |
tapDistanceLeft, |
| 1160 |
tapDistanceTop, |
| 1161 |
moved, |
| 1162 |
lastTarget, |
| 1163 |
lastDirection, |
| 1164 |
pastFirstInvertThresh = false, |
| 1165 |
isCircumstantialInvert = false, |
| 1166 |
targetMoveDistance, |
| 1167 |
// For positioning ghost absolutely |
| 1168 |
ghostRelativeParent, |
| 1169 |
ghostRelativeParentInitialScroll = [], |
| 1170 |
// (left, top) |
| 1171 |
_silent = false, |
| 1172 |
savedInputChecked = []; |
| 1173 |
/** @const */ |
| 1174 |
|
| 1175 |
var documentExists = typeof document !== 'undefined', |
| 1176 |
PositionGhostAbsolutely = IOS, |
| 1177 |
CSSFloatProperty = Edge || IE11OrLess ? 'cssFloat' : 'float', |
| 1178 |
// This will not pass for IE9, because IE9 DnD only works on anchors |
| 1179 |
supportDraggable = documentExists && !ChromeForAndroid && !IOS && 'draggable' in document.createElement('div'), |
| 1180 |
supportCssPointerEvents = function () { |
| 1181 |
if (!documentExists) return; // false when <= IE11 |
| 1182 |
|
| 1183 |
if (IE11OrLess) { |
| 1184 |
return false; |
| 1185 |
} |
| 1186 |
|
| 1187 |
var el = document.createElement('x'); |
| 1188 |
el.style.cssText = 'pointer-events:auto'; |
| 1189 |
return el.style.pointerEvents === 'auto'; |
| 1190 |
}(), |
| 1191 |
_detectDirection = function _detectDirection(el, options) { |
| 1192 |
var elCSS = css(el), |
| 1193 |
elWidth = parseInt(elCSS.width) - parseInt(elCSS.paddingLeft) - parseInt(elCSS.paddingRight) - parseInt(elCSS.borderLeftWidth) - parseInt(elCSS.borderRightWidth), |
| 1194 |
child1 = getChild(el, 0, options), |
| 1195 |
child2 = getChild(el, 1, options), |
| 1196 |
firstChildCSS = child1 && css(child1), |
| 1197 |
secondChildCSS = child2 && css(child2), |
| 1198 |
firstChildWidth = firstChildCSS && parseInt(firstChildCSS.marginLeft) + parseInt(firstChildCSS.marginRight) + getRect(child1).width, |
| 1199 |
secondChildWidth = secondChildCSS && parseInt(secondChildCSS.marginLeft) + parseInt(secondChildCSS.marginRight) + getRect(child2).width; |
| 1200 |
|
| 1201 |
if (elCSS.display === 'flex') { |
| 1202 |
return elCSS.flexDirection === 'column' || elCSS.flexDirection === 'column-reverse' ? 'vertical' : 'horizontal'; |
| 1203 |
} |
| 1204 |
|
| 1205 |
if (elCSS.display === 'grid') { |
| 1206 |
return elCSS.gridTemplateColumns.split(' ').length <= 1 ? 'vertical' : 'horizontal'; |
| 1207 |
} |
| 1208 |
|
| 1209 |
if (child1 && firstChildCSS["float"] && firstChildCSS["float"] !== 'none') { |
| 1210 |
var touchingSideChild2 = firstChildCSS["float"] === 'left' ? 'left' : 'right'; |
| 1211 |
return child2 && (secondChildCSS.clear === 'both' || secondChildCSS.clear === touchingSideChild2) ? 'vertical' : 'horizontal'; |
| 1212 |
} |
| 1213 |
|
| 1214 |
return child1 && (firstChildCSS.display === 'block' || firstChildCSS.display === 'flex' || firstChildCSS.display === 'table' || firstChildCSS.display === 'grid' || firstChildWidth >= elWidth && elCSS[CSSFloatProperty] === 'none' || child2 && elCSS[CSSFloatProperty] === 'none' && firstChildWidth + secondChildWidth > elWidth) ? 'vertical' : 'horizontal'; |
| 1215 |
}, |
| 1216 |
_dragElInRowColumn = function _dragElInRowColumn(dragRect, targetRect, vertical) { |
| 1217 |
var dragElS1Opp = vertical ? dragRect.left : dragRect.top, |
| 1218 |
dragElS2Opp = vertical ? dragRect.right : dragRect.bottom, |
| 1219 |
dragElOppLength = vertical ? dragRect.width : dragRect.height, |
| 1220 |
targetS1Opp = vertical ? targetRect.left : targetRect.top, |
| 1221 |
targetS2Opp = vertical ? targetRect.right : targetRect.bottom, |
| 1222 |
targetOppLength = vertical ? targetRect.width : targetRect.height; |
| 1223 |
return dragElS1Opp === targetS1Opp || dragElS2Opp === targetS2Opp || dragElS1Opp + dragElOppLength / 2 === targetS1Opp + targetOppLength / 2; |
| 1224 |
}, |
| 1225 |
|
| 1226 |
/** |
| 1227 |
* Detects first nearest empty sortable to X and Y position using emptyInsertThreshold. |
| 1228 |
* @param {Number} x X position |
| 1229 |
* @param {Number} y Y position |
| 1230 |
* @return {HTMLElement} Element of the first found nearest Sortable |
| 1231 |
*/ |
| 1232 |
_detectNearestEmptySortable = function _detectNearestEmptySortable(x, y) { |
| 1233 |
var ret; |
| 1234 |
sortables.some(function (sortable) { |
| 1235 |
if (lastChild(sortable)) return; |
| 1236 |
var rect = getRect(sortable), |
| 1237 |
threshold = sortable[expando].options.emptyInsertThreshold, |
| 1238 |
insideHorizontally = x >= rect.left - threshold && x <= rect.right + threshold, |
| 1239 |
insideVertically = y >= rect.top - threshold && y <= rect.bottom + threshold; |
| 1240 |
|
| 1241 |
if (threshold && insideHorizontally && insideVertically) { |
| 1242 |
return ret = sortable; |
| 1243 |
} |
| 1244 |
}); |
| 1245 |
return ret; |
| 1246 |
}, |
| 1247 |
_prepareGroup = function _prepareGroup(options) { |
| 1248 |
function toFn(value, pull) { |
| 1249 |
return function (to, from, dragEl, evt) { |
| 1250 |
var sameGroup = to.options.group.name && from.options.group.name && to.options.group.name === from.options.group.name; |
| 1251 |
|
| 1252 |
if (value == null && (pull || sameGroup)) { |
| 1253 |
// Default pull value |
| 1254 |
// Default pull and put value if same group |
| 1255 |
return true; |
| 1256 |
} else if (value == null || value === false) { |
| 1257 |
return false; |
| 1258 |
} else if (pull && value === 'clone') { |
| 1259 |
return value; |
| 1260 |
} else if (typeof value === 'function') { |
| 1261 |
return toFn(value(to, from, dragEl, evt), pull)(to, from, dragEl, evt); |
| 1262 |
} else { |
| 1263 |
var otherGroup = (pull ? to : from).options.group.name; |
| 1264 |
return value === true || typeof value === 'string' && value === otherGroup || value.join && value.indexOf(otherGroup) > -1; |
| 1265 |
} |
| 1266 |
}; |
| 1267 |
} |
| 1268 |
|
| 1269 |
var group = {}; |
| 1270 |
var originalGroup = options.group; |
| 1271 |
|
| 1272 |
if (!originalGroup || _typeof(originalGroup) != 'object') { |
| 1273 |
originalGroup = { |
| 1274 |
name: originalGroup |
| 1275 |
}; |
| 1276 |
} |
| 1277 |
|
| 1278 |
group.name = originalGroup.name; |
| 1279 |
group.checkPull = toFn(originalGroup.pull, true); |
| 1280 |
group.checkPut = toFn(originalGroup.put); |
| 1281 |
group.revertClone = originalGroup.revertClone; |
| 1282 |
options.group = group; |
| 1283 |
}, |
| 1284 |
_hideGhostForTarget = function _hideGhostForTarget() { |
| 1285 |
if (!supportCssPointerEvents && ghostEl) { |
| 1286 |
css(ghostEl, 'display', 'none'); |
| 1287 |
} |
| 1288 |
}, |
| 1289 |
_unhideGhostForTarget = function _unhideGhostForTarget() { |
| 1290 |
if (!supportCssPointerEvents && ghostEl) { |
| 1291 |
css(ghostEl, 'display', ''); |
| 1292 |
} |
| 1293 |
}; // #1184 fix - Prevent click event on fallback if dragged but item not changed position |
| 1294 |
|
| 1295 |
|
| 1296 |
if (documentExists) { |
| 1297 |
document.addEventListener('click', function (evt) { |
| 1298 |
if (ignoreNextClick) { |
| 1299 |
evt.preventDefault(); |
| 1300 |
evt.stopPropagation && evt.stopPropagation(); |
| 1301 |
evt.stopImmediatePropagation && evt.stopImmediatePropagation(); |
| 1302 |
ignoreNextClick = false; |
| 1303 |
return false; |
| 1304 |
} |
| 1305 |
}, true); |
| 1306 |
} |
| 1307 |
|
| 1308 |
var nearestEmptyInsertDetectEvent = function nearestEmptyInsertDetectEvent(evt) { |
| 1309 |
if (dragEl) { |
| 1310 |
evt = evt.touches ? evt.touches[0] : evt; |
| 1311 |
|
| 1312 |
var nearest = _detectNearestEmptySortable(evt.clientX, evt.clientY); |
| 1313 |
|
| 1314 |
if (nearest) { |
| 1315 |
// Create imitation event |
| 1316 |
var event = {}; |
| 1317 |
|
| 1318 |
for (var i in evt) { |
| 1319 |
if (evt.hasOwnProperty(i)) { |
| 1320 |
event[i] = evt[i]; |
| 1321 |
} |
| 1322 |
} |
| 1323 |
|
| 1324 |
event.target = event.rootEl = nearest; |
| 1325 |
event.preventDefault = void 0; |
| 1326 |
event.stopPropagation = void 0; |
| 1327 |
|
| 1328 |
nearest[expando]._onDragOver(event); |
| 1329 |
} |
| 1330 |
} |
| 1331 |
}; |
| 1332 |
|
| 1333 |
var _checkOutsideTargetEl = function _checkOutsideTargetEl(evt) { |
| 1334 |
if (dragEl) { |
| 1335 |
dragEl.parentNode[expando]._isOutsideThisEl(evt.target); |
| 1336 |
} |
| 1337 |
}; |
| 1338 |
/** |
| 1339 |
* @class Sortable |
| 1340 |
* @param {HTMLElement} el |
| 1341 |
* @param {Object} [options] |
| 1342 |
*/ |
| 1343 |
|
| 1344 |
|
| 1345 |
function Sortable(el, options) { |
| 1346 |
if (!(el && el.nodeType && el.nodeType === 1)) { |
| 1347 |
throw "Sortable: `el` must be an HTMLElement, not ".concat({}.toString.call(el)); |
| 1348 |
} |
| 1349 |
|
| 1350 |
this.el = el; // root element |
| 1351 |
|
| 1352 |
this.options = options = _extends({}, options); // Export instance |
| 1353 |
|
| 1354 |
el[expando] = this; |
| 1355 |
var defaults = { |
| 1356 |
group: null, |
| 1357 |
sort: true, |
| 1358 |
disabled: false, |
| 1359 |
store: null, |
| 1360 |
handle: null, |
| 1361 |
draggable: /^[uo]l$/i.test(el.nodeName) ? '>li' : '>*', |
| 1362 |
swapThreshold: 1, |
| 1363 |
// percentage; 0 <= x <= 1 |
| 1364 |
invertSwap: false, |
| 1365 |
// invert always |
| 1366 |
invertedSwapThreshold: null, |
| 1367 |
// will be set to same as swapThreshold if default |
| 1368 |
removeCloneOnHide: true, |
| 1369 |
direction: function direction() { |
| 1370 |
return _detectDirection(el, this.options); |
| 1371 |
}, |
| 1372 |
ghostClass: 'sortable-ghost', |
| 1373 |
chosenClass: 'sortable-chosen', |
| 1374 |
dragClass: 'sortable-drag', |
| 1375 |
ignore: 'a, img', |
| 1376 |
filter: null, |
| 1377 |
preventOnFilter: true, |
| 1378 |
animation: 0, |
| 1379 |
easing: null, |
| 1380 |
setData: function setData(dataTransfer, dragEl) { |
| 1381 |
dataTransfer.setData('Text', dragEl.textContent); |
| 1382 |
}, |
| 1383 |
dropBubble: false, |
| 1384 |
dragoverBubble: false, |
| 1385 |
dataIdAttr: 'data-id', |
| 1386 |
delay: 0, |
| 1387 |
delayOnTouchOnly: false, |
| 1388 |
touchStartThreshold: (Number.parseInt ? Number : window).parseInt(window.devicePixelRatio, 10) || 1, |
| 1389 |
forceFallback: false, |
| 1390 |
fallbackClass: 'sortable-fallback', |
| 1391 |
fallbackOnBody: false, |
| 1392 |
fallbackTolerance: 0, |
| 1393 |
fallbackOffset: { |
| 1394 |
x: 0, |
| 1395 |
y: 0 |
| 1396 |
}, |
| 1397 |
supportPointer: Sortable.supportPointer !== false && 'PointerEvent' in window, |
| 1398 |
emptyInsertThreshold: 5 |
| 1399 |
}; |
| 1400 |
PluginManager.initializePlugins(this, el, defaults); // Set default options |
| 1401 |
|
| 1402 |
for (var name in defaults) { |
| 1403 |
!(name in options) && (options[name] = defaults[name]); |
| 1404 |
} |
| 1405 |
|
| 1406 |
_prepareGroup(options); // Bind all private methods |
| 1407 |
|
| 1408 |
|
| 1409 |
for (var fn in this) { |
| 1410 |
if (fn.charAt(0) === '_' && typeof this[fn] === 'function') { |
| 1411 |
this[fn] = this[fn].bind(this); |
| 1412 |
} |
| 1413 |
} // Setup drag mode |
| 1414 |
|
| 1415 |
|
| 1416 |
this.nativeDraggable = options.forceFallback ? false : supportDraggable; |
| 1417 |
|
| 1418 |
if (this.nativeDraggable) { |
| 1419 |
// Touch start threshold cannot be greater than the native dragstart threshold |
| 1420 |
this.options.touchStartThreshold = 1; |
| 1421 |
} // Bind events |
| 1422 |
|
| 1423 |
|
| 1424 |
if (options.supportPointer) { |
| 1425 |
on(el, 'pointerdown', this._onTapStart); |
| 1426 |
} else { |
| 1427 |
on(el, 'mousedown', this._onTapStart); |
| 1428 |
on(el, 'touchstart', this._onTapStart); |
| 1429 |
} |
| 1430 |
|
| 1431 |
if (this.nativeDraggable) { |
| 1432 |
on(el, 'dragover', this); |
| 1433 |
on(el, 'dragenter', this); |
| 1434 |
} |
| 1435 |
|
| 1436 |
sortables.push(this.el); // Restore sorting |
| 1437 |
|
| 1438 |
options.store && options.store.get && this.sort(options.store.get(this) || []); // Add animation state manager |
| 1439 |
|
| 1440 |
_extends(this, AnimationStateManager()); |
| 1441 |
} |
| 1442 |
|
| 1443 |
Sortable.prototype = |
| 1444 |
/** @lends Sortable.prototype */ |
| 1445 |
{ |
| 1446 |
constructor: Sortable, |
| 1447 |
_isOutsideThisEl: function _isOutsideThisEl(target) { |
| 1448 |
if (!this.el.contains(target) && target !== this.el) { |
| 1449 |
lastTarget = null; |
| 1450 |
} |
| 1451 |
}, |
| 1452 |
_getDirection: function _getDirection(evt, target) { |
| 1453 |
return typeof this.options.direction === 'function' ? this.options.direction.call(this, evt, target, dragEl) : this.options.direction; |
| 1454 |
}, |
| 1455 |
_onTapStart: function _onTapStart( |
| 1456 |
/** Event|TouchEvent */ |
| 1457 |
evt) { |
| 1458 |
if (!evt.cancelable) return; |
| 1459 |
|
| 1460 |
var _this = this, |
| 1461 |
el = this.el, |
| 1462 |
options = this.options, |
| 1463 |
preventOnFilter = options.preventOnFilter, |
| 1464 |
type = evt.type, |
| 1465 |
touch = evt.touches && evt.touches[0] || evt.pointerType && evt.pointerType === 'touch' && evt, |
| 1466 |
target = (touch || evt).target, |
| 1467 |
originalTarget = evt.target.shadowRoot && (evt.path && evt.path[0] || evt.composedPath && evt.composedPath()[0]) || target, |
| 1468 |
filter = options.filter; |
| 1469 |
|
| 1470 |
_saveInputCheckedState(el); // Don't trigger start event when an element is been dragged, otherwise the evt.oldindex always wrong when set option.group. |
| 1471 |
|
| 1472 |
|
| 1473 |
if (dragEl) { |
| 1474 |
return; |
| 1475 |
} |
| 1476 |
|
| 1477 |
if (/mousedown|pointerdown/.test(type) && evt.button !== 0 || options.disabled) { |
| 1478 |
return; // only left button and enabled |
| 1479 |
} // cancel dnd if original target is content editable |
| 1480 |
|
| 1481 |
|
| 1482 |
if (originalTarget.isContentEditable) { |
| 1483 |
return; |
| 1484 |
} |
| 1485 |
|
| 1486 |
target = closest(target, options.draggable, el, false); |
| 1487 |
|
| 1488 |
if (target && target.animated) { |
| 1489 |
return; |
| 1490 |
} |
| 1491 |
|
| 1492 |
if (lastDownEl === target) { |
| 1493 |
// Ignoring duplicate `down` |
| 1494 |
return; |
| 1495 |
} // Get the index of the dragged element within its parent |
| 1496 |
|
| 1497 |
|
| 1498 |
oldIndex = index(target); |
| 1499 |
oldDraggableIndex = index(target, options.draggable); // Check filter |
| 1500 |
|
| 1501 |
if (typeof filter === 'function') { |
| 1502 |
if (filter.call(this, evt, target, this)) { |
| 1503 |
_dispatchEvent({ |
| 1504 |
sortable: _this, |
| 1505 |
rootEl: originalTarget, |
| 1506 |
name: 'filter', |
| 1507 |
targetEl: target, |
| 1508 |
toEl: el, |
| 1509 |
fromEl: el |
| 1510 |
}); |
| 1511 |
|
| 1512 |
pluginEvent('filter', _this, { |
| 1513 |
evt: evt |
| 1514 |
}); |
| 1515 |
preventOnFilter && evt.cancelable && evt.preventDefault(); |
| 1516 |
return; // cancel dnd |
| 1517 |
} |
| 1518 |
} else if (filter) { |
| 1519 |
filter = filter.split(',').some(function (criteria) { |
| 1520 |
criteria = closest(originalTarget, criteria.trim(), el, false); |
| 1521 |
|
| 1522 |
if (criteria) { |
| 1523 |
_dispatchEvent({ |
| 1524 |
sortable: _this, |
| 1525 |
rootEl: criteria, |
| 1526 |
name: 'filter', |
| 1527 |
targetEl: target, |
| 1528 |
fromEl: el, |
| 1529 |
toEl: el |
| 1530 |
}); |
| 1531 |
|
| 1532 |
pluginEvent('filter', _this, { |
| 1533 |
evt: evt |
| 1534 |
}); |
| 1535 |
return true; |
| 1536 |
} |
| 1537 |
}); |
| 1538 |
|
| 1539 |
if (filter) { |
| 1540 |
preventOnFilter && evt.cancelable && evt.preventDefault(); |
| 1541 |
return; // cancel dnd |
| 1542 |
} |
| 1543 |
} |
| 1544 |
|
| 1545 |
if (options.handle && !closest(originalTarget, options.handle, el, false)) { |
| 1546 |
return; |
| 1547 |
} // Prepare `dragstart` |
| 1548 |
|
| 1549 |
|
| 1550 |
this._prepareDragStart(evt, touch, target); |
| 1551 |
}, |
| 1552 |
_prepareDragStart: function _prepareDragStart( |
| 1553 |
/** Event */ |
| 1554 |
evt, |
| 1555 |
/** Touch */ |
| 1556 |
touch, |
| 1557 |
/** HTMLElement */ |
| 1558 |
target) { |
| 1559 |
var _this = this, |
| 1560 |
el = _this.el, |
| 1561 |
options = _this.options, |
| 1562 |
ownerDocument = el.ownerDocument, |
| 1563 |
dragStartFn; |
| 1564 |
|
| 1565 |
if (target && !dragEl && target.parentNode === el) { |
| 1566 |
var dragRect = getRect(target); |
| 1567 |
rootEl = el; |
| 1568 |
dragEl = target; |
| 1569 |
parentEl = dragEl.parentNode; |
| 1570 |
nextEl = dragEl.nextSibling; |
| 1571 |
lastDownEl = target; |
| 1572 |
activeGroup = options.group; |
| 1573 |
Sortable.dragged = dragEl; |
| 1574 |
tapEvt = { |
| 1575 |
target: dragEl, |
| 1576 |
clientX: (touch || evt).clientX, |
| 1577 |
clientY: (touch || evt).clientY |
| 1578 |
}; |
| 1579 |
tapDistanceLeft = tapEvt.clientX - dragRect.left; |
| 1580 |
tapDistanceTop = tapEvt.clientY - dragRect.top; |
| 1581 |
this._lastX = (touch || evt).clientX; |
| 1582 |
this._lastY = (touch || evt).clientY; |
| 1583 |
dragEl.style['will-change'] = 'all'; |
| 1584 |
|
| 1585 |
dragStartFn = function dragStartFn() { |
| 1586 |
pluginEvent('delayEnded', _this, { |
| 1587 |
evt: evt |
| 1588 |
}); |
| 1589 |
|
| 1590 |
if (Sortable.eventCanceled) { |
| 1591 |
_this._onDrop(); |
| 1592 |
|
| 1593 |
return; |
| 1594 |
} // Delayed drag has been triggered |
| 1595 |
// we can re-enable the events: touchmove/mousemove |
| 1596 |
|
| 1597 |
|
| 1598 |
_this._disableDelayedDragEvents(); |
| 1599 |
|
| 1600 |
if (!FireFox && _this.nativeDraggable) { |
| 1601 |
dragEl.draggable = true; |
| 1602 |
} // Bind the events: dragstart/dragend |
| 1603 |
|
| 1604 |
|
| 1605 |
_this._triggerDragStart(evt, touch); // Drag start event |
| 1606 |
|
| 1607 |
|
| 1608 |
_dispatchEvent({ |
| 1609 |
sortable: _this, |
| 1610 |
name: 'choose', |
| 1611 |
originalEvent: evt |
| 1612 |
}); // Chosen item |
| 1613 |
|
| 1614 |
|
| 1615 |
toggleClass(dragEl, options.chosenClass, true); |
| 1616 |
}; // Disable "draggable" |
| 1617 |
|
| 1618 |
|
| 1619 |
options.ignore.split(',').forEach(function (criteria) { |
| 1620 |
find(dragEl, criteria.trim(), _disableDraggable); |
| 1621 |
}); |
| 1622 |
on(ownerDocument, 'dragover', nearestEmptyInsertDetectEvent); |
| 1623 |
on(ownerDocument, 'mousemove', nearestEmptyInsertDetectEvent); |
| 1624 |
on(ownerDocument, 'touchmove', nearestEmptyInsertDetectEvent); |
| 1625 |
on(ownerDocument, 'mouseup', _this._onDrop); |
| 1626 |
on(ownerDocument, 'touchend', _this._onDrop); |
| 1627 |
on(ownerDocument, 'touchcancel', _this._onDrop); // Make dragEl draggable (must be before delay for FireFox) |
| 1628 |
|
| 1629 |
if (FireFox && this.nativeDraggable) { |
| 1630 |
this.options.touchStartThreshold = 4; |
| 1631 |
dragEl.draggable = true; |
| 1632 |
} |
| 1633 |
|
| 1634 |
pluginEvent('delayStart', this, { |
| 1635 |
evt: evt |
| 1636 |
}); // Delay is impossible for native DnD in Edge or IE |
| 1637 |
|
| 1638 |
if (options.delay && (!options.delayOnTouchOnly || touch) && (!this.nativeDraggable || !(Edge || IE11OrLess))) { |
| 1639 |
if (Sortable.eventCanceled) { |
| 1640 |
this._onDrop(); |
| 1641 |
|
| 1642 |
return; |
| 1643 |
} // If the user moves the pointer or let go the click or touch |
| 1644 |
// before the delay has been reached: |
| 1645 |
// disable the delayed drag |
| 1646 |
|
| 1647 |
|
| 1648 |
on(ownerDocument, 'mouseup', _this._disableDelayedDrag); |
| 1649 |
on(ownerDocument, 'touchend', _this._disableDelayedDrag); |
| 1650 |
on(ownerDocument, 'touchcancel', _this._disableDelayedDrag); |
| 1651 |
on(ownerDocument, 'mousemove', _this._delayedDragTouchMoveHandler); |
| 1652 |
on(ownerDocument, 'touchmove', _this._delayedDragTouchMoveHandler); |
| 1653 |
options.supportPointer && on(ownerDocument, 'pointermove', _this._delayedDragTouchMoveHandler); |
| 1654 |
_this._dragStartTimer = setTimeout(dragStartFn, options.delay); |
| 1655 |
} else { |
| 1656 |
dragStartFn(); |
| 1657 |
} |
| 1658 |
} |
| 1659 |
}, |
| 1660 |
_delayedDragTouchMoveHandler: function _delayedDragTouchMoveHandler( |
| 1661 |
/** TouchEvent|PointerEvent **/ |
| 1662 |
e) { |
| 1663 |
var touch = e.touches ? e.touches[0] : e; |
| 1664 |
|
| 1665 |
if (Math.max(Math.abs(touch.clientX - this._lastX), Math.abs(touch.clientY - this._lastY)) >= Math.floor(this.options.touchStartThreshold / (this.nativeDraggable && window.devicePixelRatio || 1))) { |
| 1666 |
this._disableDelayedDrag(); |
| 1667 |
} |
| 1668 |
}, |
| 1669 |
_disableDelayedDrag: function _disableDelayedDrag() { |
| 1670 |
dragEl && _disableDraggable(dragEl); |
| 1671 |
clearTimeout(this._dragStartTimer); |
| 1672 |
|
| 1673 |
this._disableDelayedDragEvents(); |
| 1674 |
}, |
| 1675 |
_disableDelayedDragEvents: function _disableDelayedDragEvents() { |
| 1676 |
var ownerDocument = this.el.ownerDocument; |
| 1677 |
off(ownerDocument, 'mouseup', this._disableDelayedDrag); |
| 1678 |
off(ownerDocument, 'touchend', this._disableDelayedDrag); |
| 1679 |
off(ownerDocument, 'touchcancel', this._disableDelayedDrag); |
| 1680 |
off(ownerDocument, 'mousemove', this._delayedDragTouchMoveHandler); |
| 1681 |
off(ownerDocument, 'touchmove', this._delayedDragTouchMoveHandler); |
| 1682 |
off(ownerDocument, 'pointermove', this._delayedDragTouchMoveHandler); |
| 1683 |
}, |
| 1684 |
_triggerDragStart: function _triggerDragStart( |
| 1685 |
/** Event */ |
| 1686 |
evt, |
| 1687 |
/** Touch */ |
| 1688 |
touch) { |
| 1689 |
touch = touch || evt.pointerType == 'touch' && evt; |
| 1690 |
|
| 1691 |
if (!this.nativeDraggable || touch) { |
| 1692 |
if (this.options.supportPointer) { |
| 1693 |
on(document, 'pointermove', this._onTouchMove); |
| 1694 |
} else if (touch) { |
| 1695 |
on(document, 'touchmove', this._onTouchMove); |
| 1696 |
} else { |
| 1697 |
on(document, 'mousemove', this._onTouchMove); |
| 1698 |
} |
| 1699 |
} else { |
| 1700 |
on(dragEl, 'dragend', this); |
| 1701 |
on(rootEl, 'dragstart', this._onDragStart); |
| 1702 |
} |
| 1703 |
|
| 1704 |
try { |
| 1705 |
if (document.selection) { |
| 1706 |
// Timeout neccessary for IE9 |
| 1707 |
_nextTick(function () { |
| 1708 |
document.selection.empty(); |
| 1709 |
}); |
| 1710 |
} else { |
| 1711 |
window.getSelection().removeAllRanges(); |
| 1712 |
} |
| 1713 |
} catch (err) {} |
| 1714 |
}, |
| 1715 |
_dragStarted: function _dragStarted(fallback, evt) { |
| 1716 |
|
| 1717 |
awaitingDragStarted = false; |
| 1718 |
|
| 1719 |
if (rootEl && dragEl) { |
| 1720 |
pluginEvent('dragStarted', this, { |
| 1721 |
evt: evt |
| 1722 |
}); |
| 1723 |
|
| 1724 |
if (this.nativeDraggable) { |
| 1725 |
on(document, 'dragover', _checkOutsideTargetEl); |
| 1726 |
} |
| 1727 |
|
| 1728 |
var options = this.options; // Apply effect |
| 1729 |
|
| 1730 |
!fallback && toggleClass(dragEl, options.dragClass, false); |
| 1731 |
toggleClass(dragEl, options.ghostClass, true); |
| 1732 |
Sortable.active = this; |
| 1733 |
fallback && this._appendGhost(); // Drag start event |
| 1734 |
|
| 1735 |
_dispatchEvent({ |
| 1736 |
sortable: this, |
| 1737 |
name: 'start', |
| 1738 |
originalEvent: evt |
| 1739 |
}); |
| 1740 |
} else { |
| 1741 |
this._nulling(); |
| 1742 |
} |
| 1743 |
}, |
| 1744 |
_emulateDragOver: function _emulateDragOver() { |
| 1745 |
if (touchEvt) { |
| 1746 |
this._lastX = touchEvt.clientX; |
| 1747 |
this._lastY = touchEvt.clientY; |
| 1748 |
|
| 1749 |
_hideGhostForTarget(); |
| 1750 |
|
| 1751 |
var target = document.elementFromPoint(touchEvt.clientX, touchEvt.clientY); |
| 1752 |
var parent = target; |
| 1753 |
|
| 1754 |
while (target && target.shadowRoot) { |
| 1755 |
target = target.shadowRoot.elementFromPoint(touchEvt.clientX, touchEvt.clientY); |
| 1756 |
if (target === parent) break; |
| 1757 |
parent = target; |
| 1758 |
} |
| 1759 |
|
| 1760 |
dragEl.parentNode[expando]._isOutsideThisEl(target); |
| 1761 |
|
| 1762 |
if (parent) { |
| 1763 |
do { |
| 1764 |
if (parent[expando]) { |
| 1765 |
var inserted = void 0; |
| 1766 |
inserted = parent[expando]._onDragOver({ |
| 1767 |
clientX: touchEvt.clientX, |
| 1768 |
clientY: touchEvt.clientY, |
| 1769 |
target: target, |
| 1770 |
rootEl: parent |
| 1771 |
}); |
| 1772 |
|
| 1773 |
if (inserted && !this.options.dragoverBubble) { |
| 1774 |
break; |
| 1775 |
} |
| 1776 |
} |
| 1777 |
|
| 1778 |
target = parent; // store last element |
| 1779 |
} |
| 1780 |
/* jshint boss:true */ |
| 1781 |
while (parent = parent.parentNode); |
| 1782 |
} |
| 1783 |
|
| 1784 |
_unhideGhostForTarget(); |
| 1785 |
} |
| 1786 |
}, |
| 1787 |
_onTouchMove: function _onTouchMove( |
| 1788 |
/**TouchEvent*/ |
| 1789 |
evt) { |
| 1790 |
if (tapEvt) { |
| 1791 |
var options = this.options, |
| 1792 |
fallbackTolerance = options.fallbackTolerance, |
| 1793 |
fallbackOffset = options.fallbackOffset, |
| 1794 |
touch = evt.touches ? evt.touches[0] : evt, |
| 1795 |
ghostMatrix = ghostEl && matrix(ghostEl, true), |
| 1796 |
scaleX = ghostEl && ghostMatrix && ghostMatrix.a, |
| 1797 |
scaleY = ghostEl && ghostMatrix && ghostMatrix.d, |
| 1798 |
relativeScrollOffset = PositionGhostAbsolutely && ghostRelativeParent && getRelativeScrollOffset(ghostRelativeParent), |
| 1799 |
dx = (touch.clientX - tapEvt.clientX + fallbackOffset.x) / (scaleX || 1) + (relativeScrollOffset ? relativeScrollOffset[0] - ghostRelativeParentInitialScroll[0] : 0) / (scaleX || 1), |
| 1800 |
dy = (touch.clientY - tapEvt.clientY + fallbackOffset.y) / (scaleY || 1) + (relativeScrollOffset ? relativeScrollOffset[1] - ghostRelativeParentInitialScroll[1] : 0) / (scaleY || 1); // only set the status to dragging, when we are actually dragging |
| 1801 |
|
| 1802 |
if (!Sortable.active && !awaitingDragStarted) { |
| 1803 |
if (fallbackTolerance && Math.max(Math.abs(touch.clientX - this._lastX), Math.abs(touch.clientY - this._lastY)) < fallbackTolerance) { |
| 1804 |
return; |
| 1805 |
} |
| 1806 |
|
| 1807 |
this._onDragStart(evt, true); |
| 1808 |
} |
| 1809 |
|
| 1810 |
if (ghostEl) { |
| 1811 |
if (ghostMatrix) { |
| 1812 |
ghostMatrix.e += dx - (lastDx || 0); |
| 1813 |
ghostMatrix.f += dy - (lastDy || 0); |
| 1814 |
} else { |
| 1815 |
ghostMatrix = { |
| 1816 |
a: 1, |
| 1817 |
b: 0, |
| 1818 |
c: 0, |
| 1819 |
d: 1, |
| 1820 |
e: dx, |
| 1821 |
f: dy |
| 1822 |
}; |
| 1823 |
} |
| 1824 |
|
| 1825 |
var cssMatrix = "matrix(".concat(ghostMatrix.a, ",").concat(ghostMatrix.b, ",").concat(ghostMatrix.c, ",").concat(ghostMatrix.d, ",").concat(ghostMatrix.e, ",").concat(ghostMatrix.f, ")"); |
| 1826 |
css(ghostEl, 'webkitTransform', cssMatrix); |
| 1827 |
css(ghostEl, 'mozTransform', cssMatrix); |
| 1828 |
css(ghostEl, 'msTransform', cssMatrix); |
| 1829 |
css(ghostEl, 'transform', cssMatrix); |
| 1830 |
lastDx = dx; |
| 1831 |
lastDy = dy; |
| 1832 |
touchEvt = touch; |
| 1833 |
} |
| 1834 |
|
| 1835 |
evt.cancelable && evt.preventDefault(); |
| 1836 |
} |
| 1837 |
}, |
| 1838 |
_appendGhost: function _appendGhost() { |
| 1839 |
// Bug if using scale(): https://stackoverflow.com/questions/2637058 |
| 1840 |
// Not being adjusted for |
| 1841 |
if (!ghostEl) { |
| 1842 |
var container = this.options.fallbackOnBody ? document.body : rootEl, |
| 1843 |
rect = getRect(dragEl, true, PositionGhostAbsolutely, true, container), |
| 1844 |
options = this.options; // Position absolutely |
| 1845 |
|
| 1846 |
if (PositionGhostAbsolutely) { |
| 1847 |
// Get relatively positioned parent |
| 1848 |
ghostRelativeParent = container; |
| 1849 |
|
| 1850 |
while (css(ghostRelativeParent, 'position') === 'static' && css(ghostRelativeParent, 'transform') === 'none' && ghostRelativeParent !== document) { |
| 1851 |
ghostRelativeParent = ghostRelativeParent.parentNode; |
| 1852 |
} |
| 1853 |
|
| 1854 |
if (ghostRelativeParent !== document.body && ghostRelativeParent !== document.documentElement) { |
| 1855 |
if (ghostRelativeParent === document) ghostRelativeParent = getWindowScrollingElement(); |
| 1856 |
rect.top += ghostRelativeParent.scrollTop; |
| 1857 |
rect.left += ghostRelativeParent.scrollLeft; |
| 1858 |
} else { |
| 1859 |
ghostRelativeParent = getWindowScrollingElement(); |
| 1860 |
} |
| 1861 |
|
| 1862 |
ghostRelativeParentInitialScroll = getRelativeScrollOffset(ghostRelativeParent); |
| 1863 |
} |
| 1864 |
|
| 1865 |
ghostEl = dragEl.cloneNode(true); |
| 1866 |
toggleClass(ghostEl, options.ghostClass, false); |
| 1867 |
toggleClass(ghostEl, options.fallbackClass, true); |
| 1868 |
toggleClass(ghostEl, options.dragClass, true); |
| 1869 |
css(ghostEl, 'transition', ''); |
| 1870 |
css(ghostEl, 'transform', ''); |
| 1871 |
css(ghostEl, 'box-sizing', 'border-box'); |
| 1872 |
css(ghostEl, 'margin', 0); |
| 1873 |
css(ghostEl, 'top', rect.top); |
| 1874 |
css(ghostEl, 'left', rect.left); |
| 1875 |
css(ghostEl, 'width', rect.width); |
| 1876 |
css(ghostEl, 'height', rect.height); |
| 1877 |
css(ghostEl, 'opacity', '0.8'); |
| 1878 |
css(ghostEl, 'position', PositionGhostAbsolutely ? 'absolute' : 'fixed'); |
| 1879 |
css(ghostEl, 'zIndex', '100000'); |
| 1880 |
css(ghostEl, 'pointerEvents', 'none'); |
| 1881 |
Sortable.ghost = ghostEl; |
| 1882 |
container.appendChild(ghostEl); // Set transform-origin |
| 1883 |
|
| 1884 |
css(ghostEl, 'transform-origin', tapDistanceLeft / parseInt(ghostEl.style.width) * 100 + '% ' + tapDistanceTop / parseInt(ghostEl.style.height) * 100 + '%'); |
| 1885 |
} |
| 1886 |
}, |
| 1887 |
_onDragStart: function _onDragStart( |
| 1888 |
/**Event*/ |
| 1889 |
evt, |
| 1890 |
/**boolean*/ |
| 1891 |
fallback) { |
| 1892 |
var _this = this; |
| 1893 |
|
| 1894 |
var dataTransfer = evt.dataTransfer; |
| 1895 |
var options = _this.options; |
| 1896 |
pluginEvent('dragStart', this, { |
| 1897 |
evt: evt |
| 1898 |
}); |
| 1899 |
|
| 1900 |
if (Sortable.eventCanceled) { |
| 1901 |
this._onDrop(); |
| 1902 |
|
| 1903 |
return; |
| 1904 |
} |
| 1905 |
|
| 1906 |
pluginEvent('setupClone', this); |
| 1907 |
|
| 1908 |
if (!Sortable.eventCanceled) { |
| 1909 |
cloneEl = clone(dragEl); |
| 1910 |
cloneEl.draggable = false; |
| 1911 |
cloneEl.style['will-change'] = ''; |
| 1912 |
|
| 1913 |
this._hideClone(); |
| 1914 |
|
| 1915 |
toggleClass(cloneEl, this.options.chosenClass, false); |
| 1916 |
Sortable.clone = cloneEl; |
| 1917 |
} // #1143: IFrame support workaround |
| 1918 |
|
| 1919 |
|
| 1920 |
_this.cloneId = _nextTick(function () { |
| 1921 |
pluginEvent('clone', _this); |
| 1922 |
if (Sortable.eventCanceled) return; |
| 1923 |
|
| 1924 |
if (!_this.options.removeCloneOnHide) { |
| 1925 |
rootEl.insertBefore(cloneEl, dragEl); |
| 1926 |
} |
| 1927 |
|
| 1928 |
_this._hideClone(); |
| 1929 |
|
| 1930 |
_dispatchEvent({ |
| 1931 |
sortable: _this, |
| 1932 |
name: 'clone' |
| 1933 |
}); |
| 1934 |
}); |
| 1935 |
!fallback && toggleClass(dragEl, options.dragClass, true); // Set proper drop events |
| 1936 |
|
| 1937 |
if (fallback) { |
| 1938 |
ignoreNextClick = true; |
| 1939 |
_this._loopId = setInterval(_this._emulateDragOver, 50); |
| 1940 |
} else { |
| 1941 |
// Undo what was set in _prepareDragStart before drag started |
| 1942 |
off(document, 'mouseup', _this._onDrop); |
| 1943 |
off(document, 'touchend', _this._onDrop); |
| 1944 |
off(document, 'touchcancel', _this._onDrop); |
| 1945 |
|
| 1946 |
if (dataTransfer) { |
| 1947 |
dataTransfer.effectAllowed = 'move'; |
| 1948 |
options.setData && options.setData.call(_this, dataTransfer, dragEl); |
| 1949 |
} |
| 1950 |
|
| 1951 |
on(document, 'drop', _this); // #1276 fix: |
| 1952 |
|
| 1953 |
css(dragEl, 'transform', 'translateZ(0)'); |
| 1954 |
} |
| 1955 |
|
| 1956 |
awaitingDragStarted = true; |
| 1957 |
_this._dragStartId = _nextTick(_this._dragStarted.bind(_this, fallback, evt)); |
| 1958 |
on(document, 'selectstart', _this); |
| 1959 |
moved = true; |
| 1960 |
|
| 1961 |
if (Safari) { |
| 1962 |
css(document.body, 'user-select', 'none'); |
| 1963 |
} |
| 1964 |
}, |
| 1965 |
// Returns true - if no further action is needed (either inserted or another condition) |
| 1966 |
_onDragOver: function _onDragOver( |
| 1967 |
/**Event*/ |
| 1968 |
evt) { |
| 1969 |
var el = this.el, |
| 1970 |
target = evt.target, |
| 1971 |
dragRect, |
| 1972 |
targetRect, |
| 1973 |
revert, |
| 1974 |
options = this.options, |
| 1975 |
group = options.group, |
| 1976 |
activeSortable = Sortable.active, |
| 1977 |
isOwner = activeGroup === group, |
| 1978 |
canSort = options.sort, |
| 1979 |
fromSortable = putSortable || activeSortable, |
| 1980 |
vertical, |
| 1981 |
_this = this, |
| 1982 |
completedFired = false; |
| 1983 |
|
| 1984 |
if (_silent) return; |
| 1985 |
|
| 1986 |
function dragOverEvent(name, extra) { |
| 1987 |
pluginEvent(name, _this, _objectSpread({ |
| 1988 |
evt: evt, |
| 1989 |
isOwner: isOwner, |
| 1990 |
axis: vertical ? 'vertical' : 'horizontal', |
| 1991 |
revert: revert, |
| 1992 |
dragRect: dragRect, |
| 1993 |
targetRect: targetRect, |
| 1994 |
canSort: canSort, |
| 1995 |
fromSortable: fromSortable, |
| 1996 |
target: target, |
| 1997 |
completed: completed, |
| 1998 |
onMove: function onMove(target, after) { |
| 1999 |
return _onMove(rootEl, el, dragEl, dragRect, target, getRect(target), evt, after); |
| 2000 |
}, |
| 2001 |
changed: changed |
| 2002 |
}, extra)); |
| 2003 |
} // Capture animation state |
| 2004 |
|
| 2005 |
|
| 2006 |
function capture() { |
| 2007 |
dragOverEvent('dragOverAnimationCapture'); |
| 2008 |
|
| 2009 |
_this.captureAnimationState(); |
| 2010 |
|
| 2011 |
if (_this !== fromSortable) { |
| 2012 |
fromSortable.captureAnimationState(); |
| 2013 |
} |
| 2014 |
} // Return invocation when dragEl is inserted (or completed) |
| 2015 |
|
| 2016 |
|
| 2017 |
function completed(insertion) { |
| 2018 |
dragOverEvent('dragOverCompleted', { |
| 2019 |
insertion: insertion |
| 2020 |
}); |
| 2021 |
|
| 2022 |
if (insertion) { |
| 2023 |
// Clones must be hidden before folding animation to capture dragRectAbsolute properly |
| 2024 |
if (isOwner) { |
| 2025 |
activeSortable._hideClone(); |
| 2026 |
} else { |
| 2027 |
activeSortable._showClone(_this); |
| 2028 |
} |
| 2029 |
|
| 2030 |
if (_this !== fromSortable) { |
| 2031 |
// Set ghost class to new sortable's ghost class |
| 2032 |
toggleClass(dragEl, putSortable ? putSortable.options.ghostClass : activeSortable.options.ghostClass, false); |
| 2033 |
toggleClass(dragEl, options.ghostClass, true); |
| 2034 |
} |
| 2035 |
|
| 2036 |
if (putSortable !== _this && _this !== Sortable.active) { |
| 2037 |
putSortable = _this; |
| 2038 |
} else if (_this === Sortable.active && putSortable) { |
| 2039 |
putSortable = null; |
| 2040 |
} // Animation |
| 2041 |
|
| 2042 |
|
| 2043 |
if (fromSortable === _this) { |
| 2044 |
_this._ignoreWhileAnimating = target; |
| 2045 |
} |
| 2046 |
|
| 2047 |
_this.animateAll(function () { |
| 2048 |
dragOverEvent('dragOverAnimationComplete'); |
| 2049 |
_this._ignoreWhileAnimating = null; |
| 2050 |
}); |
| 2051 |
|
| 2052 |
if (_this !== fromSortable) { |
| 2053 |
fromSortable.animateAll(); |
| 2054 |
fromSortable._ignoreWhileAnimating = null; |
| 2055 |
} |
| 2056 |
} // Null lastTarget if it is not inside a previously swapped element |
| 2057 |
|
| 2058 |
|
| 2059 |
if (target === dragEl && !dragEl.animated || target === el && !target.animated) { |
| 2060 |
lastTarget = null; |
| 2061 |
} // no bubbling and not fallback |
| 2062 |
|
| 2063 |
|
| 2064 |
if (!options.dragoverBubble && !evt.rootEl && target !== document) { |
| 2065 |
dragEl.parentNode[expando]._isOutsideThisEl(evt.target); // Do not detect for empty insert if already inserted |
| 2066 |
|
| 2067 |
|
| 2068 |
!insertion && nearestEmptyInsertDetectEvent(evt); |
| 2069 |
} |
| 2070 |
|
| 2071 |
!options.dragoverBubble && evt.stopPropagation && evt.stopPropagation(); |
| 2072 |
return completedFired = true; |
| 2073 |
} // Call when dragEl has been inserted |
| 2074 |
|
| 2075 |
|
| 2076 |
function changed() { |
| 2077 |
newIndex = index(dragEl); |
| 2078 |
newDraggableIndex = index(dragEl, options.draggable); |
| 2079 |
|
| 2080 |
_dispatchEvent({ |
| 2081 |
sortable: _this, |
| 2082 |
name: 'change', |
| 2083 |
toEl: el, |
| 2084 |
newIndex: newIndex, |
| 2085 |
newDraggableIndex: newDraggableIndex, |
| 2086 |
originalEvent: evt |
| 2087 |
}); |
| 2088 |
} |
| 2089 |
|
| 2090 |
if (evt.preventDefault !== void 0) { |
| 2091 |
evt.cancelable && evt.preventDefault(); |
| 2092 |
} |
| 2093 |
|
| 2094 |
target = closest(target, options.draggable, el, true); |
| 2095 |
dragOverEvent('dragOver'); |
| 2096 |
if (Sortable.eventCanceled) return completedFired; |
| 2097 |
|
| 2098 |
if (dragEl.contains(evt.target) || target.animated && target.animatingX && target.animatingY || _this._ignoreWhileAnimating === target) { |
| 2099 |
return completed(false); |
| 2100 |
} |
| 2101 |
|
| 2102 |
ignoreNextClick = false; |
| 2103 |
|
| 2104 |
if (activeSortable && !options.disabled && (isOwner ? canSort || (revert = !rootEl.contains(dragEl)) // Reverting item into the original list |
| 2105 |
: putSortable === this || (this.lastPutMode = activeGroup.checkPull(this, activeSortable, dragEl, evt)) && group.checkPut(this, activeSortable, dragEl, evt))) { |
| 2106 |
vertical = this._getDirection(evt, target) === 'vertical'; |
| 2107 |
dragRect = getRect(dragEl); |
| 2108 |
dragOverEvent('dragOverValid'); |
| 2109 |
if (Sortable.eventCanceled) return completedFired; |
| 2110 |
|
| 2111 |
if (revert) { |
| 2112 |
parentEl = rootEl; // actualization |
| 2113 |
|
| 2114 |
capture(); |
| 2115 |
|
| 2116 |
this._hideClone(); |
| 2117 |
|
| 2118 |
dragOverEvent('revert'); |
| 2119 |
|
| 2120 |
if (!Sortable.eventCanceled) { |
| 2121 |
if (nextEl) { |
| 2122 |
rootEl.insertBefore(dragEl, nextEl); |
| 2123 |
} else { |
| 2124 |
rootEl.appendChild(dragEl); |
| 2125 |
} |
| 2126 |
} |
| 2127 |
|
| 2128 |
return completed(true); |
| 2129 |
} |
| 2130 |
|
| 2131 |
var elLastChild = lastChild(el, options.draggable); |
| 2132 |
|
| 2133 |
if (!elLastChild || _ghostIsLast(evt, vertical, this) && !elLastChild.animated) { |
| 2134 |
// If already at end of list: Do not insert |
| 2135 |
if (elLastChild === dragEl) { |
| 2136 |
return completed(false); |
| 2137 |
} // assign target only if condition is true |
| 2138 |
|
| 2139 |
|
| 2140 |
if (elLastChild && el === evt.target) { |
| 2141 |
target = elLastChild; |
| 2142 |
} |
| 2143 |
|
| 2144 |
if (target) { |
| 2145 |
targetRect = getRect(target); |
| 2146 |
} |
| 2147 |
|
| 2148 |
if (_onMove(rootEl, el, dragEl, dragRect, target, targetRect, evt, !!target) !== false) { |
| 2149 |
capture(); |
| 2150 |
el.appendChild(dragEl); |
| 2151 |
parentEl = el; // actualization |
| 2152 |
|
| 2153 |
changed(); |
| 2154 |
return completed(true); |
| 2155 |
} |
| 2156 |
} else if (target.parentNode === el) { |
| 2157 |
targetRect = getRect(target); |
| 2158 |
var direction = 0, |
| 2159 |
targetBeforeFirstSwap, |
| 2160 |
differentLevel = dragEl.parentNode !== el, |
| 2161 |
differentRowCol = !_dragElInRowColumn(dragEl.animated && dragEl.toRect || dragRect, target.animated && target.toRect || targetRect, vertical), |
| 2162 |
side1 = vertical ? 'top' : 'left', |
| 2163 |
scrolledPastTop = isScrolledPast(target, 'top', 'top') || isScrolledPast(dragEl, 'top', 'top'), |
| 2164 |
scrollBefore = scrolledPastTop ? scrolledPastTop.scrollTop : void 0; |
| 2165 |
|
| 2166 |
if (lastTarget !== target) { |
| 2167 |
targetBeforeFirstSwap = targetRect[side1]; |
| 2168 |
pastFirstInvertThresh = false; |
| 2169 |
isCircumstantialInvert = !differentRowCol && options.invertSwap || differentLevel; |
| 2170 |
} |
| 2171 |
|
| 2172 |
direction = _getSwapDirection(evt, target, targetRect, vertical, differentRowCol ? 1 : options.swapThreshold, options.invertedSwapThreshold == null ? options.swapThreshold : options.invertedSwapThreshold, isCircumstantialInvert, lastTarget === target); |
| 2173 |
var sibling; |
| 2174 |
|
| 2175 |
if (direction !== 0) { |
| 2176 |
// Check if target is beside dragEl in respective direction (ignoring hidden elements) |
| 2177 |
var dragIndex = index(dragEl); |
| 2178 |
|
| 2179 |
do { |
| 2180 |
dragIndex -= direction; |
| 2181 |
sibling = parentEl.children[dragIndex]; |
| 2182 |
} while (sibling && (css(sibling, 'display') === 'none' || sibling === ghostEl)); |
| 2183 |
} // If dragEl is already beside target: Do not insert |
| 2184 |
|
| 2185 |
|
| 2186 |
if (direction === 0 || sibling === target) { |
| 2187 |
return completed(false); |
| 2188 |
} |
| 2189 |
|
| 2190 |
lastTarget = target; |
| 2191 |
lastDirection = direction; |
| 2192 |
var nextSibling = target.nextElementSibling, |
| 2193 |
after = false; |
| 2194 |
after = direction === 1; |
| 2195 |
|
| 2196 |
var moveVector = _onMove(rootEl, el, dragEl, dragRect, target, targetRect, evt, after); |
| 2197 |
|
| 2198 |
if (moveVector !== false) { |
| 2199 |
if (moveVector === 1 || moveVector === -1) { |
| 2200 |
after = moveVector === 1; |
| 2201 |
} |
| 2202 |
|
| 2203 |
_silent = true; |
| 2204 |
setTimeout(_unsilent, 30); |
| 2205 |
capture(); |
| 2206 |
|
| 2207 |
if (after && !nextSibling) { |
| 2208 |
el.appendChild(dragEl); |
| 2209 |
} else { |
| 2210 |
target.parentNode.insertBefore(dragEl, after ? nextSibling : target); |
| 2211 |
} // Undo chrome's scroll adjustment (has no effect on other browsers) |
| 2212 |
|
| 2213 |
|
| 2214 |
if (scrolledPastTop) { |
| 2215 |
scrollBy(scrolledPastTop, 0, scrollBefore - scrolledPastTop.scrollTop); |
| 2216 |
} |
| 2217 |
|
| 2218 |
parentEl = dragEl.parentNode; // actualization |
| 2219 |
// must be done before animation |
| 2220 |
|
| 2221 |
if (targetBeforeFirstSwap !== undefined && !isCircumstantialInvert) { |
| 2222 |
targetMoveDistance = Math.abs(targetBeforeFirstSwap - getRect(target)[side1]); |
| 2223 |
} |
| 2224 |
|
| 2225 |
changed(); |
| 2226 |
return completed(true); |
| 2227 |
} |
| 2228 |
} |
| 2229 |
|
| 2230 |
if (el.contains(dragEl)) { |
| 2231 |
return completed(false); |
| 2232 |
} |
| 2233 |
} |
| 2234 |
|
| 2235 |
return false; |
| 2236 |
}, |
| 2237 |
_ignoreWhileAnimating: null, |
| 2238 |
_offMoveEvents: function _offMoveEvents() { |
| 2239 |
off(document, 'mousemove', this._onTouchMove); |
| 2240 |
off(document, 'touchmove', this._onTouchMove); |
| 2241 |
off(document, 'pointermove', this._onTouchMove); |
| 2242 |
off(document, 'dragover', nearestEmptyInsertDetectEvent); |
| 2243 |
off(document, 'mousemove', nearestEmptyInsertDetectEvent); |
| 2244 |
off(document, 'touchmove', nearestEmptyInsertDetectEvent); |
| 2245 |
}, |
| 2246 |
_offUpEvents: function _offUpEvents() { |
| 2247 |
var ownerDocument = this.el.ownerDocument; |
| 2248 |
off(ownerDocument, 'mouseup', this._onDrop); |
| 2249 |
off(ownerDocument, 'touchend', this._onDrop); |
| 2250 |
off(ownerDocument, 'pointerup', this._onDrop); |
| 2251 |
off(ownerDocument, 'touchcancel', this._onDrop); |
| 2252 |
off(document, 'selectstart', this); |
| 2253 |
}, |
| 2254 |
_onDrop: function _onDrop( |
| 2255 |
/**Event*/ |
| 2256 |
evt) { |
| 2257 |
var el = this.el, |
| 2258 |
options = this.options; // Get the index of the dragged element within its parent |
| 2259 |
|
| 2260 |
newIndex = index(dragEl); |
| 2261 |
newDraggableIndex = index(dragEl, options.draggable); |
| 2262 |
pluginEvent('drop', this, { |
| 2263 |
evt: evt |
| 2264 |
}); |
| 2265 |
parentEl = dragEl && dragEl.parentNode; // Get again after plugin event |
| 2266 |
|
| 2267 |
newIndex = index(dragEl); |
| 2268 |
newDraggableIndex = index(dragEl, options.draggable); |
| 2269 |
|
| 2270 |
if (Sortable.eventCanceled) { |
| 2271 |
this._nulling(); |
| 2272 |
|
| 2273 |
return; |
| 2274 |
} |
| 2275 |
|
| 2276 |
awaitingDragStarted = false; |
| 2277 |
isCircumstantialInvert = false; |
| 2278 |
pastFirstInvertThresh = false; |
| 2279 |
clearInterval(this._loopId); |
| 2280 |
clearTimeout(this._dragStartTimer); |
| 2281 |
|
| 2282 |
_cancelNextTick(this.cloneId); |
| 2283 |
|
| 2284 |
_cancelNextTick(this._dragStartId); // Unbind events |
| 2285 |
|
| 2286 |
|
| 2287 |
if (this.nativeDraggable) { |
| 2288 |
off(document, 'drop', this); |
| 2289 |
off(el, 'dragstart', this._onDragStart); |
| 2290 |
} |
| 2291 |
|
| 2292 |
this._offMoveEvents(); |
| 2293 |
|
| 2294 |
this._offUpEvents(); |
| 2295 |
|
| 2296 |
if (Safari) { |
| 2297 |
css(document.body, 'user-select', ''); |
| 2298 |
} |
| 2299 |
|
| 2300 |
css(dragEl, 'transform', ''); |
| 2301 |
|
| 2302 |
if (evt) { |
| 2303 |
if (moved) { |
| 2304 |
evt.cancelable && evt.preventDefault(); |
| 2305 |
!options.dropBubble && evt.stopPropagation(); |
| 2306 |
} |
| 2307 |
|
| 2308 |
ghostEl && ghostEl.parentNode && ghostEl.parentNode.removeChild(ghostEl); |
| 2309 |
|
| 2310 |
if (rootEl === parentEl || putSortable && putSortable.lastPutMode !== 'clone') { |
| 2311 |
// Remove clone(s) |
| 2312 |
cloneEl && cloneEl.parentNode && cloneEl.parentNode.removeChild(cloneEl); |
| 2313 |
} |
| 2314 |
|
| 2315 |
if (dragEl) { |
| 2316 |
if (this.nativeDraggable) { |
| 2317 |
off(dragEl, 'dragend', this); |
| 2318 |
} |
| 2319 |
|
| 2320 |
_disableDraggable(dragEl); |
| 2321 |
|
| 2322 |
dragEl.style['will-change'] = ''; // Remove classes |
| 2323 |
// ghostClass is added in dragStarted |
| 2324 |
|
| 2325 |
if (moved && !awaitingDragStarted) { |
| 2326 |
toggleClass(dragEl, putSortable ? putSortable.options.ghostClass : this.options.ghostClass, false); |
| 2327 |
} |
| 2328 |
|
| 2329 |
toggleClass(dragEl, this.options.chosenClass, false); // Drag stop event |
| 2330 |
|
| 2331 |
_dispatchEvent({ |
| 2332 |
sortable: this, |
| 2333 |
name: 'unchoose', |
| 2334 |
toEl: parentEl, |
| 2335 |
newIndex: null, |
| 2336 |
newDraggableIndex: null, |
| 2337 |
originalEvent: evt |
| 2338 |
}); |
| 2339 |
|
| 2340 |
if (rootEl !== parentEl) { |
| 2341 |
if (newIndex >= 0) { |
| 2342 |
// Add event |
| 2343 |
_dispatchEvent({ |
| 2344 |
rootEl: parentEl, |
| 2345 |
name: 'add', |
| 2346 |
toEl: parentEl, |
| 2347 |
fromEl: rootEl, |
| 2348 |
originalEvent: evt |
| 2349 |
}); // Remove event |
| 2350 |
|
| 2351 |
|
| 2352 |
_dispatchEvent({ |
| 2353 |
sortable: this, |
| 2354 |
name: 'remove', |
| 2355 |
toEl: parentEl, |
| 2356 |
originalEvent: evt |
| 2357 |
}); // drag from one list and drop into another |
| 2358 |
|
| 2359 |
|
| 2360 |
_dispatchEvent({ |
| 2361 |
rootEl: parentEl, |
| 2362 |
name: 'sort', |
| 2363 |
toEl: parentEl, |
| 2364 |
fromEl: rootEl, |
| 2365 |
originalEvent: evt |
| 2366 |
}); |
| 2367 |
|
| 2368 |
_dispatchEvent({ |
| 2369 |
sortable: this, |
| 2370 |
name: 'sort', |
| 2371 |
toEl: parentEl, |
| 2372 |
originalEvent: evt |
| 2373 |
}); |
| 2374 |
} |
| 2375 |
|
| 2376 |
putSortable && putSortable.save(); |
| 2377 |
} else { |
| 2378 |
if (newIndex !== oldIndex) { |
| 2379 |
if (newIndex >= 0) { |
| 2380 |
// drag & drop within the same list |
| 2381 |
_dispatchEvent({ |
| 2382 |
sortable: this, |
| 2383 |
name: 'update', |
| 2384 |
toEl: parentEl, |
| 2385 |
originalEvent: evt |
| 2386 |
}); |
| 2387 |
|
| 2388 |
_dispatchEvent({ |
| 2389 |
sortable: this, |
| 2390 |
name: 'sort', |
| 2391 |
toEl: parentEl, |
| 2392 |
originalEvent: evt |
| 2393 |
}); |
| 2394 |
} |
| 2395 |
} |
| 2396 |
} |
| 2397 |
|
| 2398 |
if (Sortable.active) { |
| 2399 |
/* jshint eqnull:true */ |
| 2400 |
if (newIndex == null || newIndex === -1) { |
| 2401 |
newIndex = oldIndex; |
| 2402 |
newDraggableIndex = oldDraggableIndex; |
| 2403 |
} |
| 2404 |
|
| 2405 |
_dispatchEvent({ |
| 2406 |
sortable: this, |
| 2407 |
name: 'end', |
| 2408 |
toEl: parentEl, |
| 2409 |
originalEvent: evt |
| 2410 |
}); // Save sorting |
| 2411 |
|
| 2412 |
|
| 2413 |
this.save(); |
| 2414 |
} |
| 2415 |
} |
| 2416 |
} |
| 2417 |
|
| 2418 |
this._nulling(); |
| 2419 |
}, |
| 2420 |
_nulling: function _nulling() { |
| 2421 |
pluginEvent('nulling', this); |
| 2422 |
rootEl = dragEl = parentEl = ghostEl = nextEl = cloneEl = lastDownEl = cloneHidden = tapEvt = touchEvt = moved = newIndex = newDraggableIndex = oldIndex = oldDraggableIndex = lastTarget = lastDirection = putSortable = activeGroup = Sortable.dragged = Sortable.ghost = Sortable.clone = Sortable.active = null; |
| 2423 |
savedInputChecked.forEach(function (el) { |
| 2424 |
el.checked = true; |
| 2425 |
}); |
| 2426 |
savedInputChecked.length = lastDx = lastDy = 0; |
| 2427 |
}, |
| 2428 |
handleEvent: function handleEvent( |
| 2429 |
/**Event*/ |
| 2430 |
evt) { |
| 2431 |
switch (evt.type) { |
| 2432 |
case 'drop': |
| 2433 |
case 'dragend': |
| 2434 |
this._onDrop(evt); |
| 2435 |
|
| 2436 |
break; |
| 2437 |
|
| 2438 |
case 'dragenter': |
| 2439 |
case 'dragover': |
| 2440 |
if (dragEl) { |
| 2441 |
this._onDragOver(evt); |
| 2442 |
|
| 2443 |
_globalDragOver(evt); |
| 2444 |
} |
| 2445 |
|
| 2446 |
break; |
| 2447 |
|
| 2448 |
case 'selectstart': |
| 2449 |
evt.preventDefault(); |
| 2450 |
break; |
| 2451 |
} |
| 2452 |
}, |
| 2453 |
|
| 2454 |
/** |
| 2455 |
* Serializes the item into an array of string. |
| 2456 |
* @returns {String[]} |
| 2457 |
*/ |
| 2458 |
toArray: function toArray() { |
| 2459 |
var order = [], |
| 2460 |
el, |
| 2461 |
children = this.el.children, |
| 2462 |
i = 0, |
| 2463 |
n = children.length, |
| 2464 |
options = this.options; |
| 2465 |
|
| 2466 |
for (; i < n; i++) { |
| 2467 |
el = children[i]; |
| 2468 |
|
| 2469 |
if (closest(el, options.draggable, this.el, false)) { |
| 2470 |
order.push(el.getAttribute(options.dataIdAttr) || _generateId(el)); |
| 2471 |
} |
| 2472 |
} |
| 2473 |
|
| 2474 |
return order; |
| 2475 |
}, |
| 2476 |
|
| 2477 |
/** |
| 2478 |
* Sorts the elements according to the array. |
| 2479 |
* @param {String[]} order order of the items |
| 2480 |
*/ |
| 2481 |
sort: function sort(order) { |
| 2482 |
var items = {}, |
| 2483 |
rootEl = this.el; |
| 2484 |
this.toArray().forEach(function (id, i) { |
| 2485 |
var el = rootEl.children[i]; |
| 2486 |
|
| 2487 |
if (closest(el, this.options.draggable, rootEl, false)) { |
| 2488 |
items[id] = el; |
| 2489 |
} |
| 2490 |
}, this); |
| 2491 |
order.forEach(function (id) { |
| 2492 |
if (items[id]) { |
| 2493 |
rootEl.removeChild(items[id]); |
| 2494 |
rootEl.appendChild(items[id]); |
| 2495 |
} |
| 2496 |
}); |
| 2497 |
}, |
| 2498 |
|
| 2499 |
/** |
| 2500 |
* Save the current sorting |
| 2501 |
*/ |
| 2502 |
save: function save() { |
| 2503 |
var store = this.options.store; |
| 2504 |
store && store.set && store.set(this); |
| 2505 |
}, |
| 2506 |
|
| 2507 |
/** |
| 2508 |
* For each element in the set, get the first element that matches the selector by testing the element itself and traversing up through its ancestors in the DOM tree. |
| 2509 |
* @param {HTMLElement} el |
| 2510 |
* @param {String} [selector] default: `options.draggable` |
| 2511 |
* @returns {HTMLElement|null} |
| 2512 |
*/ |
| 2513 |
closest: function closest$1(el, selector) { |
| 2514 |
return closest(el, selector || this.options.draggable, this.el, false); |
| 2515 |
}, |
| 2516 |
|
| 2517 |
/** |
| 2518 |
* Set/get option |
| 2519 |
* @param {string} name |
| 2520 |
* @param {*} [value] |
| 2521 |
* @returns {*} |
| 2522 |
*/ |
| 2523 |
option: function option(name, value) { |
| 2524 |
var options = this.options; |
| 2525 |
|
| 2526 |
if (value === void 0) { |
| 2527 |
return options[name]; |
| 2528 |
} else { |
| 2529 |
var modifiedValue = PluginManager.modifyOption(this, name, value); |
| 2530 |
|
| 2531 |
if (typeof modifiedValue !== 'undefined') { |
| 2532 |
options[name] = modifiedValue; |
| 2533 |
} else { |
| 2534 |
options[name] = value; |
| 2535 |
} |
| 2536 |
|
| 2537 |
if (name === 'group') { |
| 2538 |
_prepareGroup(options); |
| 2539 |
} |
| 2540 |
} |
| 2541 |
}, |
| 2542 |
|
| 2543 |
/** |
| 2544 |
* Destroy |
| 2545 |
*/ |
| 2546 |
destroy: function destroy() { |
| 2547 |
pluginEvent('destroy', this); |
| 2548 |
var el = this.el; |
| 2549 |
el[expando] = null; |
| 2550 |
off(el, 'mousedown', this._onTapStart); |
| 2551 |
off(el, 'touchstart', this._onTapStart); |
| 2552 |
off(el, 'pointerdown', this._onTapStart); |
| 2553 |
|
| 2554 |
if (this.nativeDraggable) { |
| 2555 |
off(el, 'dragover', this); |
| 2556 |
off(el, 'dragenter', this); |
| 2557 |
} // Remove draggable attributes |
| 2558 |
|
| 2559 |
|
| 2560 |
Array.prototype.forEach.call(el.querySelectorAll('[draggable]'), function (el) { |
| 2561 |
el.removeAttribute('draggable'); |
| 2562 |
}); |
| 2563 |
|
| 2564 |
this._onDrop(); |
| 2565 |
|
| 2566 |
this._disableDelayedDragEvents(); |
| 2567 |
|
| 2568 |
sortables.splice(sortables.indexOf(this.el), 1); |
| 2569 |
this.el = el = null; |
| 2570 |
}, |
| 2571 |
_hideClone: function _hideClone() { |
| 2572 |
if (!cloneHidden) { |
| 2573 |
pluginEvent('hideClone', this); |
| 2574 |
if (Sortable.eventCanceled) return; |
| 2575 |
css(cloneEl, 'display', 'none'); |
| 2576 |
|
| 2577 |
if (this.options.removeCloneOnHide && cloneEl.parentNode) { |
| 2578 |
cloneEl.parentNode.removeChild(cloneEl); |
| 2579 |
} |
| 2580 |
|
| 2581 |
cloneHidden = true; |
| 2582 |
} |
| 2583 |
}, |
| 2584 |
_showClone: function _showClone(putSortable) { |
| 2585 |
if (putSortable.lastPutMode !== 'clone') { |
| 2586 |
this._hideClone(); |
| 2587 |
|
| 2588 |
return; |
| 2589 |
} |
| 2590 |
|
| 2591 |
if (cloneHidden) { |
| 2592 |
pluginEvent('showClone', this); |
| 2593 |
if (Sortable.eventCanceled) return; // show clone at dragEl or original position |
| 2594 |
|
| 2595 |
if (rootEl.contains(dragEl) && !this.options.group.revertClone) { |
| 2596 |
rootEl.insertBefore(cloneEl, dragEl); |
| 2597 |
} else if (nextEl) { |
| 2598 |
rootEl.insertBefore(cloneEl, nextEl); |
| 2599 |
} else { |
| 2600 |
rootEl.appendChild(cloneEl); |
| 2601 |
} |
| 2602 |
|
| 2603 |
if (this.options.group.revertClone) { |
| 2604 |
this.animate(dragEl, cloneEl); |
| 2605 |
} |
| 2606 |
|
| 2607 |
css(cloneEl, 'display', ''); |
| 2608 |
cloneHidden = false; |
| 2609 |
} |
| 2610 |
} |
| 2611 |
}; |
| 2612 |
|
| 2613 |
function _globalDragOver( |
| 2614 |
/**Event*/ |
| 2615 |
evt) { |
| 2616 |
if (evt.dataTransfer) { |
| 2617 |
evt.dataTransfer.dropEffect = 'move'; |
| 2618 |
} |
| 2619 |
|
| 2620 |
evt.cancelable && evt.preventDefault(); |
| 2621 |
} |
| 2622 |
|
| 2623 |
function _onMove(fromEl, toEl, dragEl, dragRect, targetEl, targetRect, originalEvent, willInsertAfter) { |
| 2624 |
var evt, |
| 2625 |
sortable = fromEl[expando], |
| 2626 |
onMoveFn = sortable.options.onMove, |
| 2627 |
retVal; // Support for new CustomEvent feature |
| 2628 |
|
| 2629 |
if (window.CustomEvent && !IE11OrLess && !Edge) { |
| 2630 |
evt = new CustomEvent('move', { |
| 2631 |
bubbles: true, |
| 2632 |
cancelable: true |
| 2633 |
}); |
| 2634 |
} else { |
| 2635 |
evt = document.createEvent('Event'); |
| 2636 |
evt.initEvent('move', true, true); |
| 2637 |
} |
| 2638 |
|
| 2639 |
evt.to = toEl; |
| 2640 |
evt.from = fromEl; |
| 2641 |
evt.dragged = dragEl; |
| 2642 |
evt.draggedRect = dragRect; |
| 2643 |
evt.related = targetEl || toEl; |
| 2644 |
evt.relatedRect = targetRect || getRect(toEl); |
| 2645 |
evt.willInsertAfter = willInsertAfter; |
| 2646 |
evt.originalEvent = originalEvent; |
| 2647 |
fromEl.dispatchEvent(evt); |
| 2648 |
|
| 2649 |
if (onMoveFn) { |
| 2650 |
retVal = onMoveFn.call(sortable, evt, originalEvent); |
| 2651 |
} |
| 2652 |
|
| 2653 |
return retVal; |
| 2654 |
} |
| 2655 |
|
| 2656 |
function _disableDraggable(el) { |
| 2657 |
el.draggable = false; |
| 2658 |
} |
| 2659 |
|
| 2660 |
function _unsilent() { |
| 2661 |
_silent = false; |
| 2662 |
} |
| 2663 |
|
| 2664 |
function _ghostIsLast(evt, vertical, sortable) { |
| 2665 |
var rect = getRect(lastChild(sortable.el, sortable.options.draggable)); |
| 2666 |
var spacer = 10; |
| 2667 |
return vertical ? evt.clientX > rect.right + spacer || evt.clientX <= rect.right && evt.clientY > rect.bottom && evt.clientX >= rect.left : evt.clientX > rect.right && evt.clientY > rect.top || evt.clientX <= rect.right && evt.clientY > rect.bottom + spacer; |
| 2668 |
} |
| 2669 |
|
| 2670 |
function _getSwapDirection(evt, target, targetRect, vertical, swapThreshold, invertedSwapThreshold, invertSwap, isLastTarget) { |
| 2671 |
var mouseOnAxis = vertical ? evt.clientY : evt.clientX, |
| 2672 |
targetLength = vertical ? targetRect.height : targetRect.width, |
| 2673 |
targetS1 = vertical ? targetRect.top : targetRect.left, |
| 2674 |
targetS2 = vertical ? targetRect.bottom : targetRect.right, |
| 2675 |
invert = false; |
| 2676 |
|
| 2677 |
if (!invertSwap) { |
| 2678 |
// Never invert or create dragEl shadow when target movemenet causes mouse to move past the end of regular swapThreshold |
| 2679 |
if (isLastTarget && targetMoveDistance < targetLength * swapThreshold) { |
| 2680 |
// multiplied only by swapThreshold because mouse will already be inside target by (1 - threshold) * targetLength / 2 |
| 2681 |
// check if past first invert threshold on side opposite of lastDirection |
| 2682 |
if (!pastFirstInvertThresh && (lastDirection === 1 ? mouseOnAxis > targetS1 + targetLength * invertedSwapThreshold / 2 : mouseOnAxis < targetS2 - targetLength * invertedSwapThreshold / 2)) { |
| 2683 |
// past first invert threshold, do not restrict inverted threshold to dragEl shadow |
| 2684 |
pastFirstInvertThresh = true; |
| 2685 |
} |
| 2686 |
|
| 2687 |
if (!pastFirstInvertThresh) { |
| 2688 |
// dragEl shadow (target move distance shadow) |
| 2689 |
if (lastDirection === 1 ? mouseOnAxis < targetS1 + targetMoveDistance // over dragEl shadow |
| 2690 |
: mouseOnAxis > targetS2 - targetMoveDistance) { |
| 2691 |
return -lastDirection; |
| 2692 |
} |
| 2693 |
} else { |
| 2694 |
invert = true; |
| 2695 |
} |
| 2696 |
} else { |
| 2697 |
// Regular |
| 2698 |
if (mouseOnAxis > targetS1 + targetLength * (1 - swapThreshold) / 2 && mouseOnAxis < targetS2 - targetLength * (1 - swapThreshold) / 2) { |
| 2699 |
return _getInsertDirection(target); |
| 2700 |
} |
| 2701 |
} |
| 2702 |
} |
| 2703 |
|
| 2704 |
invert = invert || invertSwap; |
| 2705 |
|
| 2706 |
if (invert) { |
| 2707 |
// Invert of regular |
| 2708 |
if (mouseOnAxis < targetS1 + targetLength * invertedSwapThreshold / 2 || mouseOnAxis > targetS2 - targetLength * invertedSwapThreshold / 2) { |
| 2709 |
return mouseOnAxis > targetS1 + targetLength / 2 ? 1 : -1; |
| 2710 |
} |
| 2711 |
} |
| 2712 |
|
| 2713 |
return 0; |
| 2714 |
} |
| 2715 |
/** |
| 2716 |
* Gets the direction dragEl must be swapped relative to target in order to make it |
| 2717 |
* seem that dragEl has been "inserted" into that element's position |
| 2718 |
* @param {HTMLElement} target The target whose position dragEl is being inserted at |
| 2719 |
* @return {Number} Direction dragEl must be swapped |
| 2720 |
*/ |
| 2721 |
|
| 2722 |
|
| 2723 |
function _getInsertDirection(target) { |
| 2724 |
if (index(dragEl) < index(target)) { |
| 2725 |
return 1; |
| 2726 |
} else { |
| 2727 |
return -1; |
| 2728 |
} |
| 2729 |
} |
| 2730 |
/** |
| 2731 |
* Generate id |
| 2732 |
* @param {HTMLElement} el |
| 2733 |
* @returns {String} |
| 2734 |
* @private |
| 2735 |
*/ |
| 2736 |
|
| 2737 |
|
| 2738 |
function _generateId(el) { |
| 2739 |
var str = el.tagName + el.className + el.src + el.href + el.textContent, |
| 2740 |
i = str.length, |
| 2741 |
sum = 0; |
| 2742 |
|
| 2743 |
while (i--) { |
| 2744 |
sum += str.charCodeAt(i); |
| 2745 |
} |
| 2746 |
|
| 2747 |
return sum.toString(36); |
| 2748 |
} |
| 2749 |
|
| 2750 |
function _saveInputCheckedState(root) { |
| 2751 |
savedInputChecked.length = 0; |
| 2752 |
var inputs = root.getElementsByTagName('input'); |
| 2753 |
var idx = inputs.length; |
| 2754 |
|
| 2755 |
while (idx--) { |
| 2756 |
var el = inputs[idx]; |
| 2757 |
el.checked && savedInputChecked.push(el); |
| 2758 |
} |
| 2759 |
} |
| 2760 |
|
| 2761 |
function _nextTick(fn) { |
| 2762 |
return setTimeout(fn, 0); |
| 2763 |
} |
| 2764 |
|
| 2765 |
function _cancelNextTick(id) { |
| 2766 |
return clearTimeout(id); |
| 2767 |
} // Fixed #973: |
| 2768 |
|
| 2769 |
|
| 2770 |
if (documentExists) { |
| 2771 |
on(document, 'touchmove', function (evt) { |
| 2772 |
if ((Sortable.active || awaitingDragStarted) && evt.cancelable) { |
| 2773 |
evt.preventDefault(); |
| 2774 |
} |
| 2775 |
}); |
| 2776 |
} // Export utils |
| 2777 |
|
| 2778 |
|
| 2779 |
Sortable.utils = { |
| 2780 |
on: on, |
| 2781 |
off: off, |
| 2782 |
css: css, |
| 2783 |
find: find, |
| 2784 |
is: function is(el, selector) { |
| 2785 |
return !!closest(el, selector, el, false); |
| 2786 |
}, |
| 2787 |
extend: extend, |
| 2788 |
throttle: throttle, |
| 2789 |
closest: closest, |
| 2790 |
toggleClass: toggleClass, |
| 2791 |
clone: clone, |
| 2792 |
index: index, |
| 2793 |
nextTick: _nextTick, |
| 2794 |
cancelNextTick: _cancelNextTick, |
| 2795 |
detectDirection: _detectDirection, |
| 2796 |
getChild: getChild |
| 2797 |
}; |
| 2798 |
/** |
| 2799 |
* Get the Sortable instance of an element |
| 2800 |
* @param {HTMLElement} element The element |
| 2801 |
* @return {Sortable|undefined} The instance of Sortable |
| 2802 |
*/ |
| 2803 |
|
| 2804 |
Sortable.get = function (element) { |
| 2805 |
return element[expando]; |
| 2806 |
}; |
| 2807 |
/** |
| 2808 |
* Mount a plugin to Sortable |
| 2809 |
* @param {...SortablePlugin|SortablePlugin[]} plugins Plugins being mounted |
| 2810 |
*/ |
| 2811 |
|
| 2812 |
|
| 2813 |
Sortable.mount = function () { |
| 2814 |
for (var _len = arguments.length, plugins = new Array(_len), _key = 0; _key < _len; _key++) { |
| 2815 |
plugins[_key] = arguments[_key]; |
| 2816 |
} |
| 2817 |
|
| 2818 |
if (plugins[0].constructor === Array) plugins = plugins[0]; |
| 2819 |
plugins.forEach(function (plugin) { |
| 2820 |
if (!plugin.prototype || !plugin.prototype.constructor) { |
| 2821 |
throw "Sortable: Mounted plugin must be a constructor function, not ".concat({}.toString.call(plugin)); |
| 2822 |
} |
| 2823 |
|
| 2824 |
if (plugin.utils) Sortable.utils = _objectSpread({}, Sortable.utils, plugin.utils); |
| 2825 |
PluginManager.mount(plugin); |
| 2826 |
}); |
| 2827 |
}; |
| 2828 |
/** |
| 2829 |
* Create sortable instance |
| 2830 |
* @param {HTMLElement} el |
| 2831 |
* @param {Object} [options] |
| 2832 |
*/ |
| 2833 |
|
| 2834 |
|
| 2835 |
Sortable.create = function (el, options) { |
| 2836 |
return new Sortable(el, options); |
| 2837 |
}; // Export |
| 2838 |
|
| 2839 |
|
| 2840 |
Sortable.version = version; |
| 2841 |
|
| 2842 |
var autoScrolls = [], |
| 2843 |
scrollEl, |
| 2844 |
scrollRootEl, |
| 2845 |
scrolling = false, |
| 2846 |
lastAutoScrollX, |
| 2847 |
lastAutoScrollY, |
| 2848 |
touchEvt$1, |
| 2849 |
pointerElemChangedInterval; |
| 2850 |
|
| 2851 |
function AutoScrollPlugin() { |
| 2852 |
function AutoScroll() { |
| 2853 |
this.defaults = { |
| 2854 |
scroll: true, |
| 2855 |
scrollSensitivity: 30, |
| 2856 |
scrollSpeed: 10, |
| 2857 |
bubbleScroll: true |
| 2858 |
}; // Bind all private methods |
| 2859 |
|
| 2860 |
for (var fn in this) { |
| 2861 |
if (fn.charAt(0) === '_' && typeof this[fn] === 'function') { |
| 2862 |
this[fn] = this[fn].bind(this); |
| 2863 |
} |
| 2864 |
} |
| 2865 |
} |
| 2866 |
|
| 2867 |
AutoScroll.prototype = { |
| 2868 |
dragStarted: function dragStarted(_ref) { |
| 2869 |
var originalEvent = _ref.originalEvent; |
| 2870 |
|
| 2871 |
if (this.sortable.nativeDraggable) { |
| 2872 |
on(document, 'dragover', this._handleAutoScroll); |
| 2873 |
} else { |
| 2874 |
if (this.options.supportPointer) { |
| 2875 |
on(document, 'pointermove', this._handleFallbackAutoScroll); |
| 2876 |
} else if (originalEvent.touches) { |
| 2877 |
on(document, 'touchmove', this._handleFallbackAutoScroll); |
| 2878 |
} else { |
| 2879 |
on(document, 'mousemove', this._handleFallbackAutoScroll); |
| 2880 |
} |
| 2881 |
} |
| 2882 |
}, |
| 2883 |
dragOverCompleted: function dragOverCompleted(_ref2) { |
| 2884 |
var originalEvent = _ref2.originalEvent; |
| 2885 |
|
| 2886 |
// For when bubbling is canceled and using fallback (fallback 'touchmove' always reached) |
| 2887 |
if (!this.options.dragOverBubble && !originalEvent.rootEl) { |
| 2888 |
this._handleAutoScroll(originalEvent); |
| 2889 |
} |
| 2890 |
}, |
| 2891 |
drop: function drop() { |
| 2892 |
if (this.sortable.nativeDraggable) { |
| 2893 |
off(document, 'dragover', this._handleAutoScroll); |
| 2894 |
} else { |
| 2895 |
off(document, 'pointermove', this._handleFallbackAutoScroll); |
| 2896 |
off(document, 'touchmove', this._handleFallbackAutoScroll); |
| 2897 |
off(document, 'mousemove', this._handleFallbackAutoScroll); |
| 2898 |
} |
| 2899 |
|
| 2900 |
clearPointerElemChangedInterval(); |
| 2901 |
clearAutoScrolls(); |
| 2902 |
cancelThrottle(); |
| 2903 |
}, |
| 2904 |
nulling: function nulling() { |
| 2905 |
touchEvt$1 = scrollRootEl = scrollEl = scrolling = pointerElemChangedInterval = lastAutoScrollX = lastAutoScrollY = null; |
| 2906 |
autoScrolls.length = 0; |
| 2907 |
}, |
| 2908 |
_handleFallbackAutoScroll: function _handleFallbackAutoScroll(evt) { |
| 2909 |
this._handleAutoScroll(evt, true); |
| 2910 |
}, |
| 2911 |
_handleAutoScroll: function _handleAutoScroll(evt, fallback) { |
| 2912 |
var _this = this; |
| 2913 |
|
| 2914 |
var x = (evt.touches ? evt.touches[0] : evt).clientX, |
| 2915 |
y = (evt.touches ? evt.touches[0] : evt).clientY, |
| 2916 |
elem = document.elementFromPoint(x, y); |
| 2917 |
touchEvt$1 = evt; // IE does not seem to have native autoscroll, |
| 2918 |
// Edge's autoscroll seems too conditional, |
| 2919 |
// MACOS Safari does not have autoscroll, |
| 2920 |
// Firefox and Chrome are good |
| 2921 |
|
| 2922 |
if (fallback || Edge || IE11OrLess || Safari) { |
| 2923 |
autoScroll(evt, this.options, elem, fallback); // Listener for pointer element change |
| 2924 |
|
| 2925 |
var ogElemScroller = getParentAutoScrollElement(elem, true); |
| 2926 |
|
| 2927 |
if (scrolling && (!pointerElemChangedInterval || x !== lastAutoScrollX || y !== lastAutoScrollY)) { |
| 2928 |
pointerElemChangedInterval && clearPointerElemChangedInterval(); // Detect for pointer elem change, emulating native DnD behaviour |
| 2929 |
|
| 2930 |
pointerElemChangedInterval = setInterval(function () { |
| 2931 |
var newElem = getParentAutoScrollElement(document.elementFromPoint(x, y), true); |
| 2932 |
|
| 2933 |
if (newElem !== ogElemScroller) { |
| 2934 |
ogElemScroller = newElem; |
| 2935 |
clearAutoScrolls(); |
| 2936 |
} |
| 2937 |
|
| 2938 |
autoScroll(evt, _this.options, newElem, fallback); |
| 2939 |
}, 10); |
| 2940 |
lastAutoScrollX = x; |
| 2941 |
lastAutoScrollY = y; |
| 2942 |
} |
| 2943 |
} else { |
| 2944 |
// if DnD is enabled (and browser has good autoscrolling), first autoscroll will already scroll, so get parent autoscroll of first autoscroll |
| 2945 |
if (!this.options.bubbleScroll || getParentAutoScrollElement(elem, true) === getWindowScrollingElement()) { |
| 2946 |
clearAutoScrolls(); |
| 2947 |
return; |
| 2948 |
} |
| 2949 |
|
| 2950 |
autoScroll(evt, this.options, getParentAutoScrollElement(elem, false), false); |
| 2951 |
} |
| 2952 |
} |
| 2953 |
}; |
| 2954 |
return _extends(AutoScroll, { |
| 2955 |
pluginName: 'scroll', |
| 2956 |
initializeByDefault: true |
| 2957 |
}); |
| 2958 |
} |
| 2959 |
|
| 2960 |
function clearAutoScrolls() { |
| 2961 |
autoScrolls.forEach(function (autoScroll) { |
| 2962 |
clearInterval(autoScroll.pid); |
| 2963 |
}); |
| 2964 |
autoScrolls = []; |
| 2965 |
} |
| 2966 |
|
| 2967 |
function clearPointerElemChangedInterval() { |
| 2968 |
clearInterval(pointerElemChangedInterval); |
| 2969 |
} |
| 2970 |
|
| 2971 |
var autoScroll = throttle(function (evt, options, rootEl, isFallback) { |
| 2972 |
// Bug: https://bugzilla.mozilla.org/show_bug.cgi?id=505521 |
| 2973 |
if (!options.scroll) return; |
| 2974 |
var x = (evt.touches ? evt.touches[0] : evt).clientX, |
| 2975 |
y = (evt.touches ? evt.touches[0] : evt).clientY, |
| 2976 |
sens = options.scrollSensitivity, |
| 2977 |
speed = options.scrollSpeed, |
| 2978 |
winScroller = getWindowScrollingElement(); |
| 2979 |
var scrollThisInstance = false, |
| 2980 |
scrollCustomFn; // New scroll root, set scrollEl |
| 2981 |
|
| 2982 |
if (scrollRootEl !== rootEl) { |
| 2983 |
scrollRootEl = rootEl; |
| 2984 |
clearAutoScrolls(); |
| 2985 |
scrollEl = options.scroll; |
| 2986 |
scrollCustomFn = options.scrollFn; |
| 2987 |
|
| 2988 |
if (scrollEl === true) { |
| 2989 |
scrollEl = getParentAutoScrollElement(rootEl, true); |
| 2990 |
} |
| 2991 |
} |
| 2992 |
|
| 2993 |
var layersOut = 0; |
| 2994 |
var currentParent = scrollEl; |
| 2995 |
|
| 2996 |
do { |
| 2997 |
var el = currentParent, |
| 2998 |
rect = getRect(el), |
| 2999 |
top = rect.top, |
| 3000 |
bottom = rect.bottom, |
| 3001 |
left = rect.left, |
| 3002 |
right = rect.right, |
| 3003 |
width = rect.width, |
| 3004 |
height = rect.height, |
| 3005 |
canScrollX = void 0, |
| 3006 |
canScrollY = void 0, |
| 3007 |
scrollWidth = el.scrollWidth, |
| 3008 |
scrollHeight = el.scrollHeight, |
| 3009 |
elCSS = css(el), |
| 3010 |
scrollPosX = el.scrollLeft, |
| 3011 |
scrollPosY = el.scrollTop; |
| 3012 |
|
| 3013 |
if (el === winScroller) { |
| 3014 |
canScrollX = width < scrollWidth && (elCSS.overflowX === 'auto' || elCSS.overflowX === 'scroll' || elCSS.overflowX === 'visible'); |
| 3015 |
canScrollY = height < scrollHeight && (elCSS.overflowY === 'auto' || elCSS.overflowY === 'scroll' || elCSS.overflowY === 'visible'); |
| 3016 |
} else { |
| 3017 |
canScrollX = width < scrollWidth && (elCSS.overflowX === 'auto' || elCSS.overflowX === 'scroll'); |
| 3018 |
canScrollY = height < scrollHeight && (elCSS.overflowY === 'auto' || elCSS.overflowY === 'scroll'); |
| 3019 |
} |
| 3020 |
|
| 3021 |
var vx = canScrollX && (Math.abs(right - x) <= sens && scrollPosX + width < scrollWidth) - (Math.abs(left - x) <= sens && !!scrollPosX); |
| 3022 |
var vy = canScrollY && (Math.abs(bottom - y) <= sens && scrollPosY + height < scrollHeight) - (Math.abs(top - y) <= sens && !!scrollPosY); |
| 3023 |
|
| 3024 |
if (!autoScrolls[layersOut]) { |
| 3025 |
for (var i = 0; i <= layersOut; i++) { |
| 3026 |
if (!autoScrolls[i]) { |
| 3027 |
autoScrolls[i] = {}; |
| 3028 |
} |
| 3029 |
} |
| 3030 |
} |
| 3031 |
|
| 3032 |
if (autoScrolls[layersOut].vx != vx || autoScrolls[layersOut].vy != vy || autoScrolls[layersOut].el !== el) { |
| 3033 |
autoScrolls[layersOut].el = el; |
| 3034 |
autoScrolls[layersOut].vx = vx; |
| 3035 |
autoScrolls[layersOut].vy = vy; |
| 3036 |
clearInterval(autoScrolls[layersOut].pid); |
| 3037 |
|
| 3038 |
if (vx != 0 || vy != 0) { |
| 3039 |
scrollThisInstance = true; |
| 3040 |
/* jshint loopfunc:true */ |
| 3041 |
|
| 3042 |
autoScrolls[layersOut].pid = setInterval(function () { |
| 3043 |
// emulate drag over during autoscroll (fallback), emulating native DnD behaviour |
| 3044 |
if (isFallback && this.layer === 0) { |
| 3045 |
Sortable.active._onTouchMove(touchEvt$1); // To move ghost if it is positioned absolutely |
| 3046 |
|
| 3047 |
} |
| 3048 |
|
| 3049 |
var scrollOffsetY = autoScrolls[this.layer].vy ? autoScrolls[this.layer].vy * speed : 0; |
| 3050 |
var scrollOffsetX = autoScrolls[this.layer].vx ? autoScrolls[this.layer].vx * speed : 0; |
| 3051 |
|
| 3052 |
if (typeof scrollCustomFn === 'function') { |
| 3053 |
if (scrollCustomFn.call(Sortable.dragged.parentNode[expando], scrollOffsetX, scrollOffsetY, evt, touchEvt$1, autoScrolls[this.layer].el) !== 'continue') { |
| 3054 |
return; |
| 3055 |
} |
| 3056 |
} |
| 3057 |
|
| 3058 |
scrollBy(autoScrolls[this.layer].el, scrollOffsetX, scrollOffsetY); |
| 3059 |
}.bind({ |
| 3060 |
layer: layersOut |
| 3061 |
}), 24); |
| 3062 |
} |
| 3063 |
} |
| 3064 |
|
| 3065 |
layersOut++; |
| 3066 |
} while (options.bubbleScroll && currentParent !== winScroller && (currentParent = getParentAutoScrollElement(currentParent, false))); |
| 3067 |
|
| 3068 |
scrolling = scrollThisInstance; // in case another function catches scrolling as false in between when it is not |
| 3069 |
}, 30); |
| 3070 |
|
| 3071 |
var drop = function drop(_ref) { |
| 3072 |
var originalEvent = _ref.originalEvent, |
| 3073 |
putSortable = _ref.putSortable, |
| 3074 |
dragEl = _ref.dragEl, |
| 3075 |
activeSortable = _ref.activeSortable, |
| 3076 |
dispatchSortableEvent = _ref.dispatchSortableEvent, |
| 3077 |
hideGhostForTarget = _ref.hideGhostForTarget, |
| 3078 |
unhideGhostForTarget = _ref.unhideGhostForTarget; |
| 3079 |
if (!originalEvent) return; |
| 3080 |
var toSortable = putSortable || activeSortable; |
| 3081 |
hideGhostForTarget(); |
| 3082 |
var touch = originalEvent.changedTouches && originalEvent.changedTouches.length ? originalEvent.changedTouches[0] : originalEvent; |
| 3083 |
var target = document.elementFromPoint(touch.clientX, touch.clientY); |
| 3084 |
unhideGhostForTarget(); |
| 3085 |
|
| 3086 |
if (toSortable && !toSortable.el.contains(target)) { |
| 3087 |
dispatchSortableEvent('spill'); |
| 3088 |
this.onSpill({ |
| 3089 |
dragEl: dragEl, |
| 3090 |
putSortable: putSortable |
| 3091 |
}); |
| 3092 |
} |
| 3093 |
}; |
| 3094 |
|
| 3095 |
function Revert() {} |
| 3096 |
|
| 3097 |
Revert.prototype = { |
| 3098 |
startIndex: null, |
| 3099 |
dragStart: function dragStart(_ref2) { |
| 3100 |
var oldDraggableIndex = _ref2.oldDraggableIndex; |
| 3101 |
this.startIndex = oldDraggableIndex; |
| 3102 |
}, |
| 3103 |
onSpill: function onSpill(_ref3) { |
| 3104 |
var dragEl = _ref3.dragEl, |
| 3105 |
putSortable = _ref3.putSortable; |
| 3106 |
this.sortable.captureAnimationState(); |
| 3107 |
|
| 3108 |
if (putSortable) { |
| 3109 |
putSortable.captureAnimationState(); |
| 3110 |
} |
| 3111 |
|
| 3112 |
var nextSibling = getChild(this.sortable.el, this.startIndex, this.options); |
| 3113 |
|
| 3114 |
if (nextSibling) { |
| 3115 |
this.sortable.el.insertBefore(dragEl, nextSibling); |
| 3116 |
} else { |
| 3117 |
this.sortable.el.appendChild(dragEl); |
| 3118 |
} |
| 3119 |
|
| 3120 |
this.sortable.animateAll(); |
| 3121 |
|
| 3122 |
if (putSortable) { |
| 3123 |
putSortable.animateAll(); |
| 3124 |
} |
| 3125 |
}, |
| 3126 |
drop: drop |
| 3127 |
}; |
| 3128 |
|
| 3129 |
_extends(Revert, { |
| 3130 |
pluginName: 'revertOnSpill' |
| 3131 |
}); |
| 3132 |
|
| 3133 |
function Remove() {} |
| 3134 |
|
| 3135 |
Remove.prototype = { |
| 3136 |
onSpill: function onSpill(_ref4) { |
| 3137 |
var dragEl = _ref4.dragEl, |
| 3138 |
putSortable = _ref4.putSortable; |
| 3139 |
var parentSortable = putSortable || this.sortable; |
| 3140 |
parentSortable.captureAnimationState(); |
| 3141 |
dragEl.parentNode && dragEl.parentNode.removeChild(dragEl); |
| 3142 |
parentSortable.animateAll(); |
| 3143 |
}, |
| 3144 |
drop: drop |
| 3145 |
}; |
| 3146 |
|
| 3147 |
_extends(Remove, { |
| 3148 |
pluginName: 'removeOnSpill' |
| 3149 |
}); |
| 3150 |
|
| 3151 |
var lastSwapEl; |
| 3152 |
|
| 3153 |
function SwapPlugin() { |
| 3154 |
function Swap() { |
| 3155 |
this.defaults = { |
| 3156 |
swapClass: 'sortable-swap-highlight' |
| 3157 |
}; |
| 3158 |
} |
| 3159 |
|
| 3160 |
Swap.prototype = { |
| 3161 |
dragStart: function dragStart(_ref) { |
| 3162 |
var dragEl = _ref.dragEl; |
| 3163 |
lastSwapEl = dragEl; |
| 3164 |
}, |
| 3165 |
dragOverValid: function dragOverValid(_ref2) { |
| 3166 |
var completed = _ref2.completed, |
| 3167 |
target = _ref2.target, |
| 3168 |
onMove = _ref2.onMove, |
| 3169 |
activeSortable = _ref2.activeSortable, |
| 3170 |
changed = _ref2.changed, |
| 3171 |
cancel = _ref2.cancel; |
| 3172 |
if (!activeSortable.options.swap) return; |
| 3173 |
var el = this.sortable.el, |
| 3174 |
options = this.options; |
| 3175 |
|
| 3176 |
if (target && target !== el) { |
| 3177 |
var prevSwapEl = lastSwapEl; |
| 3178 |
|
| 3179 |
if (onMove(target) !== false) { |
| 3180 |
toggleClass(target, options.swapClass, true); |
| 3181 |
lastSwapEl = target; |
| 3182 |
} else { |
| 3183 |
lastSwapEl = null; |
| 3184 |
} |
| 3185 |
|
| 3186 |
if (prevSwapEl && prevSwapEl !== lastSwapEl) { |
| 3187 |
toggleClass(prevSwapEl, options.swapClass, false); |
| 3188 |
} |
| 3189 |
} |
| 3190 |
|
| 3191 |
changed(); |
| 3192 |
completed(true); |
| 3193 |
cancel(); |
| 3194 |
}, |
| 3195 |
drop: function drop(_ref3) { |
| 3196 |
var activeSortable = _ref3.activeSortable, |
| 3197 |
putSortable = _ref3.putSortable, |
| 3198 |
dragEl = _ref3.dragEl; |
| 3199 |
var toSortable = putSortable || this.sortable; |
| 3200 |
var options = this.options; |
| 3201 |
lastSwapEl && toggleClass(lastSwapEl, options.swapClass, false); |
| 3202 |
|
| 3203 |
if (lastSwapEl && (options.swap || putSortable && putSortable.options.swap)) { |
| 3204 |
if (dragEl !== lastSwapEl) { |
| 3205 |
toSortable.captureAnimationState(); |
| 3206 |
if (toSortable !== activeSortable) activeSortable.captureAnimationState(); |
| 3207 |
swapNodes(dragEl, lastSwapEl); |
| 3208 |
toSortable.animateAll(); |
| 3209 |
if (toSortable !== activeSortable) activeSortable.animateAll(); |
| 3210 |
} |
| 3211 |
} |
| 3212 |
}, |
| 3213 |
nulling: function nulling() { |
| 3214 |
lastSwapEl = null; |
| 3215 |
} |
| 3216 |
}; |
| 3217 |
return _extends(Swap, { |
| 3218 |
pluginName: 'swap', |
| 3219 |
eventProperties: function eventProperties() { |
| 3220 |
return { |
| 3221 |
swapItem: lastSwapEl |
| 3222 |
}; |
| 3223 |
} |
| 3224 |
}); |
| 3225 |
} |
| 3226 |
|
| 3227 |
function swapNodes(n1, n2) { |
| 3228 |
var p1 = n1.parentNode, |
| 3229 |
p2 = n2.parentNode, |
| 3230 |
i1, |
| 3231 |
i2; |
| 3232 |
if (!p1 || !p2 || p1.isEqualNode(n2) || p2.isEqualNode(n1)) return; |
| 3233 |
i1 = index(n1); |
| 3234 |
i2 = index(n2); |
| 3235 |
|
| 3236 |
if (p1.isEqualNode(p2) && i1 < i2) { |
| 3237 |
i2++; |
| 3238 |
} |
| 3239 |
|
| 3240 |
p1.insertBefore(n2, p1.children[i1]); |
| 3241 |
p2.insertBefore(n1, p2.children[i2]); |
| 3242 |
} |
| 3243 |
|
| 3244 |
var multiDragElements = [], |
| 3245 |
multiDragClones = [], |
| 3246 |
lastMultiDragSelect, |
| 3247 |
// for selection with modifier key down (SHIFT) |
| 3248 |
multiDragSortable, |
| 3249 |
initialFolding = false, |
| 3250 |
// Initial multi-drag fold when drag started |
| 3251 |
folding = false, |
| 3252 |
// Folding any other time |
| 3253 |
dragStarted = false, |
| 3254 |
dragEl$1, |
| 3255 |
clonesFromRect, |
| 3256 |
clonesHidden; |
| 3257 |
|
| 3258 |
function MultiDragPlugin() { |
| 3259 |
function MultiDrag(sortable) { |
| 3260 |
// Bind all private methods |
| 3261 |
for (var fn in this) { |
| 3262 |
if (fn.charAt(0) === '_' && typeof this[fn] === 'function') { |
| 3263 |
this[fn] = this[fn].bind(this); |
| 3264 |
} |
| 3265 |
} |
| 3266 |
|
| 3267 |
if (sortable.options.supportPointer) { |
| 3268 |
on(document, 'pointerup', this._deselectMultiDrag); |
| 3269 |
} else { |
| 3270 |
on(document, 'mouseup', this._deselectMultiDrag); |
| 3271 |
on(document, 'touchend', this._deselectMultiDrag); |
| 3272 |
} |
| 3273 |
|
| 3274 |
on(document, 'keydown', this._checkKeyDown); |
| 3275 |
on(document, 'keyup', this._checkKeyUp); |
| 3276 |
this.defaults = { |
| 3277 |
selectedClass: 'sortable-selected', |
| 3278 |
multiDragKey: null, |
| 3279 |
setData: function setData(dataTransfer, dragEl) { |
| 3280 |
var data = ''; |
| 3281 |
|
| 3282 |
if (multiDragElements.length && multiDragSortable === sortable) { |
| 3283 |
multiDragElements.forEach(function (multiDragElement, i) { |
| 3284 |
data += (!i ? '' : ', ') + multiDragElement.textContent; |
| 3285 |
}); |
| 3286 |
} else { |
| 3287 |
data = dragEl.textContent; |
| 3288 |
} |
| 3289 |
|
| 3290 |
dataTransfer.setData('Text', data); |
| 3291 |
} |
| 3292 |
}; |
| 3293 |
} |
| 3294 |
|
| 3295 |
MultiDrag.prototype = { |
| 3296 |
multiDragKeyDown: false, |
| 3297 |
isMultiDrag: false, |
| 3298 |
delayStartGlobal: function delayStartGlobal(_ref) { |
| 3299 |
var dragged = _ref.dragEl; |
| 3300 |
dragEl$1 = dragged; |
| 3301 |
}, |
| 3302 |
delayEnded: function delayEnded() { |
| 3303 |
this.isMultiDrag = ~multiDragElements.indexOf(dragEl$1); |
| 3304 |
}, |
| 3305 |
setupClone: function setupClone(_ref2) { |
| 3306 |
var sortable = _ref2.sortable, |
| 3307 |
cancel = _ref2.cancel; |
| 3308 |
if (!this.isMultiDrag) return; |
| 3309 |
|
| 3310 |
for (var i = 0; i < multiDragElements.length; i++) { |
| 3311 |
multiDragClones.push(clone(multiDragElements[i])); |
| 3312 |
multiDragClones[i].sortableIndex = multiDragElements[i].sortableIndex; |
| 3313 |
multiDragClones[i].draggable = false; |
| 3314 |
multiDragClones[i].style['will-change'] = ''; |
| 3315 |
toggleClass(multiDragClones[i], this.options.selectedClass, false); |
| 3316 |
multiDragElements[i] === dragEl$1 && toggleClass(multiDragClones[i], this.options.chosenClass, false); |
| 3317 |
} |
| 3318 |
|
| 3319 |
sortable._hideClone(); |
| 3320 |
|
| 3321 |
cancel(); |
| 3322 |
}, |
| 3323 |
clone: function clone(_ref3) { |
| 3324 |
var sortable = _ref3.sortable, |
| 3325 |
rootEl = _ref3.rootEl, |
| 3326 |
dispatchSortableEvent = _ref3.dispatchSortableEvent, |
| 3327 |
cancel = _ref3.cancel; |
| 3328 |
if (!this.isMultiDrag) return; |
| 3329 |
|
| 3330 |
if (!this.options.removeCloneOnHide) { |
| 3331 |
if (multiDragElements.length && multiDragSortable === sortable) { |
| 3332 |
insertMultiDragClones(true, rootEl); |
| 3333 |
dispatchSortableEvent('clone'); |
| 3334 |
cancel(); |
| 3335 |
} |
| 3336 |
} |
| 3337 |
}, |
| 3338 |
showClone: function showClone(_ref4) { |
| 3339 |
var cloneNowShown = _ref4.cloneNowShown, |
| 3340 |
rootEl = _ref4.rootEl, |
| 3341 |
cancel = _ref4.cancel; |
| 3342 |
if (!this.isMultiDrag) return; |
| 3343 |
insertMultiDragClones(false, rootEl); |
| 3344 |
multiDragClones.forEach(function (clone) { |
| 3345 |
css(clone, 'display', ''); |
| 3346 |
}); |
| 3347 |
cloneNowShown(); |
| 3348 |
clonesHidden = false; |
| 3349 |
cancel(); |
| 3350 |
}, |
| 3351 |
hideClone: function hideClone(_ref5) { |
| 3352 |
var _this = this; |
| 3353 |
|
| 3354 |
var sortable = _ref5.sortable, |
| 3355 |
cloneNowHidden = _ref5.cloneNowHidden, |
| 3356 |
cancel = _ref5.cancel; |
| 3357 |
if (!this.isMultiDrag) return; |
| 3358 |
multiDragClones.forEach(function (clone) { |
| 3359 |
css(clone, 'display', 'none'); |
| 3360 |
|
| 3361 |
if (_this.options.removeCloneOnHide && clone.parentNode) { |
| 3362 |
clone.parentNode.removeChild(clone); |
| 3363 |
} |
| 3364 |
}); |
| 3365 |
cloneNowHidden(); |
| 3366 |
clonesHidden = true; |
| 3367 |
cancel(); |
| 3368 |
}, |
| 3369 |
dragStartGlobal: function dragStartGlobal(_ref6) { |
| 3370 |
var sortable = _ref6.sortable; |
| 3371 |
|
| 3372 |
if (!this.isMultiDrag && multiDragSortable) { |
| 3373 |
multiDragSortable.multiDrag._deselectMultiDrag(); |
| 3374 |
} |
| 3375 |
|
| 3376 |
multiDragElements.forEach(function (multiDragElement) { |
| 3377 |
multiDragElement.sortableIndex = index(multiDragElement); |
| 3378 |
}); // Sort multi-drag elements |
| 3379 |
|
| 3380 |
multiDragElements = multiDragElements.sort(function (a, b) { |
| 3381 |
return a.sortableIndex - b.sortableIndex; |
| 3382 |
}); |
| 3383 |
dragStarted = true; |
| 3384 |
}, |
| 3385 |
dragStarted: function dragStarted(_ref7) { |
| 3386 |
var _this2 = this; |
| 3387 |
|
| 3388 |
var sortable = _ref7.sortable; |
| 3389 |
if (!this.isMultiDrag) return; |
| 3390 |
|
| 3391 |
if (this.options.sort) { |
| 3392 |
// Capture rects, |
| 3393 |
// hide multi drag elements (by positioning them absolute), |
| 3394 |
// set multi drag elements rects to dragRect, |
| 3395 |
// show multi drag elements, |
| 3396 |
// animate to rects, |
| 3397 |
// unset rects & remove from DOM |
| 3398 |
sortable.captureAnimationState(); |
| 3399 |
|
| 3400 |
if (this.options.animation) { |
| 3401 |
multiDragElements.forEach(function (multiDragElement) { |
| 3402 |
if (multiDragElement === dragEl$1) return; |
| 3403 |
css(multiDragElement, 'position', 'absolute'); |
| 3404 |
}); |
| 3405 |
var dragRect = getRect(dragEl$1, false, true, true); |
| 3406 |
multiDragElements.forEach(function (multiDragElement) { |
| 3407 |
if (multiDragElement === dragEl$1) return; |
| 3408 |
setRect(multiDragElement, dragRect); |
| 3409 |
}); |
| 3410 |
folding = true; |
| 3411 |
initialFolding = true; |
| 3412 |
} |
| 3413 |
} |
| 3414 |
|
| 3415 |
sortable.animateAll(function () { |
| 3416 |
folding = false; |
| 3417 |
initialFolding = false; |
| 3418 |
|
| 3419 |
if (_this2.options.animation) { |
| 3420 |
multiDragElements.forEach(function (multiDragElement) { |
| 3421 |
unsetRect(multiDragElement); |
| 3422 |
}); |
| 3423 |
} // Remove all auxiliary multidrag items from el, if sorting enabled |
| 3424 |
|
| 3425 |
|
| 3426 |
if (_this2.options.sort) { |
| 3427 |
removeMultiDragElements(); |
| 3428 |
} |
| 3429 |
}); |
| 3430 |
}, |
| 3431 |
dragOver: function dragOver(_ref8) { |
| 3432 |
var target = _ref8.target, |
| 3433 |
completed = _ref8.completed, |
| 3434 |
cancel = _ref8.cancel; |
| 3435 |
|
| 3436 |
if (folding && ~multiDragElements.indexOf(target)) { |
| 3437 |
completed(false); |
| 3438 |
cancel(); |
| 3439 |
} |
| 3440 |
}, |
| 3441 |
revert: function revert(_ref9) { |
| 3442 |
var fromSortable = _ref9.fromSortable, |
| 3443 |
rootEl = _ref9.rootEl, |
| 3444 |
sortable = _ref9.sortable, |
| 3445 |
dragRect = _ref9.dragRect; |
| 3446 |
|
| 3447 |
if (multiDragElements.length > 1) { |
| 3448 |
// Setup unfold animation |
| 3449 |
multiDragElements.forEach(function (multiDragElement) { |
| 3450 |
sortable.addAnimationState({ |
| 3451 |
target: multiDragElement, |
| 3452 |
rect: folding ? getRect(multiDragElement) : dragRect |
| 3453 |
}); |
| 3454 |
unsetRect(multiDragElement); |
| 3455 |
multiDragElement.fromRect = dragRect; |
| 3456 |
fromSortable.removeAnimationState(multiDragElement); |
| 3457 |
}); |
| 3458 |
folding = false; |
| 3459 |
insertMultiDragElements(!this.options.removeCloneOnHide, rootEl); |
| 3460 |
} |
| 3461 |
}, |
| 3462 |
dragOverCompleted: function dragOverCompleted(_ref10) { |
| 3463 |
var sortable = _ref10.sortable, |
| 3464 |
isOwner = _ref10.isOwner, |
| 3465 |
insertion = _ref10.insertion, |
| 3466 |
activeSortable = _ref10.activeSortable, |
| 3467 |
parentEl = _ref10.parentEl, |
| 3468 |
putSortable = _ref10.putSortable; |
| 3469 |
var options = this.options; |
| 3470 |
|
| 3471 |
if (insertion) { |
| 3472 |
// Clones must be hidden before folding animation to capture dragRectAbsolute properly |
| 3473 |
if (isOwner) { |
| 3474 |
activeSortable._hideClone(); |
| 3475 |
} |
| 3476 |
|
| 3477 |
initialFolding = false; // If leaving sort:false root, or already folding - Fold to new location |
| 3478 |
|
| 3479 |
if (options.animation && multiDragElements.length > 1 && (folding || !isOwner && !activeSortable.options.sort && !putSortable)) { |
| 3480 |
// Fold: Set all multi drag elements's rects to dragEl's rect when multi-drag elements are invisible |
| 3481 |
var dragRectAbsolute = getRect(dragEl$1, false, true, true); |
| 3482 |
multiDragElements.forEach(function (multiDragElement) { |
| 3483 |
if (multiDragElement === dragEl$1) return; |
| 3484 |
setRect(multiDragElement, dragRectAbsolute); // Move element(s) to end of parentEl so that it does not interfere with multi-drag clones insertion if they are inserted |
| 3485 |
// while folding, and so that we can capture them again because old sortable will no longer be fromSortable |
| 3486 |
|
| 3487 |
parentEl.appendChild(multiDragElement); |
| 3488 |
}); |
| 3489 |
folding = true; |
| 3490 |
} // Clones must be shown (and check to remove multi drags) after folding when interfering multiDragElements are moved out |
| 3491 |
|
| 3492 |
|
| 3493 |
if (!isOwner) { |
| 3494 |
// Only remove if not folding (folding will remove them anyways) |
| 3495 |
if (!folding) { |
| 3496 |
removeMultiDragElements(); |
| 3497 |
} |
| 3498 |
|
| 3499 |
if (multiDragElements.length > 1) { |
| 3500 |
var clonesHiddenBefore = clonesHidden; |
| 3501 |
|
| 3502 |
activeSortable._showClone(sortable); // Unfold animation for clones if showing from hidden |
| 3503 |
|
| 3504 |
|
| 3505 |
if (activeSortable.options.animation && !clonesHidden && clonesHiddenBefore) { |
| 3506 |
multiDragClones.forEach(function (clone) { |
| 3507 |
activeSortable.addAnimationState({ |
| 3508 |
target: clone, |
| 3509 |
rect: clonesFromRect |
| 3510 |
}); |
| 3511 |
clone.fromRect = clonesFromRect; |
| 3512 |
clone.thisAnimationDuration = null; |
| 3513 |
}); |
| 3514 |
} |
| 3515 |
} else { |
| 3516 |
activeSortable._showClone(sortable); |
| 3517 |
} |
| 3518 |
} |
| 3519 |
} |
| 3520 |
}, |
| 3521 |
dragOverAnimationCapture: function dragOverAnimationCapture(_ref11) { |
| 3522 |
var dragRect = _ref11.dragRect, |
| 3523 |
isOwner = _ref11.isOwner, |
| 3524 |
activeSortable = _ref11.activeSortable; |
| 3525 |
multiDragElements.forEach(function (multiDragElement) { |
| 3526 |
multiDragElement.thisAnimationDuration = null; |
| 3527 |
}); |
| 3528 |
|
| 3529 |
if (activeSortable.options.animation && !isOwner && activeSortable.multiDrag.isMultiDrag) { |
| 3530 |
clonesFromRect = _extends({}, dragRect); |
| 3531 |
var dragMatrix = matrix(dragEl$1, true); |
| 3532 |
clonesFromRect.top -= dragMatrix.f; |
| 3533 |
clonesFromRect.left -= dragMatrix.e; |
| 3534 |
} |
| 3535 |
}, |
| 3536 |
dragOverAnimationComplete: function dragOverAnimationComplete() { |
| 3537 |
if (folding) { |
| 3538 |
folding = false; |
| 3539 |
removeMultiDragElements(); |
| 3540 |
} |
| 3541 |
}, |
| 3542 |
drop: function drop(_ref12) { |
| 3543 |
var evt = _ref12.originalEvent, |
| 3544 |
rootEl = _ref12.rootEl, |
| 3545 |
parentEl = _ref12.parentEl, |
| 3546 |
sortable = _ref12.sortable, |
| 3547 |
dispatchSortableEvent = _ref12.dispatchSortableEvent, |
| 3548 |
oldIndex = _ref12.oldIndex, |
| 3549 |
putSortable = _ref12.putSortable; |
| 3550 |
var toSortable = putSortable || this.sortable; |
| 3551 |
if (!evt) return; |
| 3552 |
var options = this.options, |
| 3553 |
children = parentEl.children; // Multi-drag selection |
| 3554 |
|
| 3555 |
if (!dragStarted) { |
| 3556 |
if (options.multiDragKey && !this.multiDragKeyDown) { |
| 3557 |
this._deselectMultiDrag(); |
| 3558 |
} |
| 3559 |
|
| 3560 |
toggleClass(dragEl$1, options.selectedClass, !~multiDragElements.indexOf(dragEl$1)); |
| 3561 |
|
| 3562 |
if (!~multiDragElements.indexOf(dragEl$1)) { |
| 3563 |
multiDragElements.push(dragEl$1); |
| 3564 |
dispatchEvent({ |
| 3565 |
sortable: sortable, |
| 3566 |
rootEl: rootEl, |
| 3567 |
name: 'select', |
| 3568 |
targetEl: dragEl$1, |
| 3569 |
originalEvt: evt |
| 3570 |
}); // Modifier activated, select from last to dragEl |
| 3571 |
|
| 3572 |
if (evt.shiftKey && lastMultiDragSelect && sortable.el.contains(lastMultiDragSelect)) { |
| 3573 |
var lastIndex = index(lastMultiDragSelect), |
| 3574 |
currentIndex = index(dragEl$1); |
| 3575 |
|
| 3576 |
if (~lastIndex && ~currentIndex && lastIndex !== currentIndex) { |
| 3577 |
// Must include lastMultiDragSelect (select it), in case modified selection from no selection |
| 3578 |
// (but previous selection existed) |
| 3579 |
var n, i; |
| 3580 |
|
| 3581 |
if (currentIndex > lastIndex) { |
| 3582 |
i = lastIndex; |
| 3583 |
n = currentIndex; |
| 3584 |
} else { |
| 3585 |
i = currentIndex; |
| 3586 |
n = lastIndex + 1; |
| 3587 |
} |
| 3588 |
|
| 3589 |
for (; i < n; i++) { |
| 3590 |
if (~multiDragElements.indexOf(children[i])) continue; |
| 3591 |
toggleClass(children[i], options.selectedClass, true); |
| 3592 |
multiDragElements.push(children[i]); |
| 3593 |
dispatchEvent({ |
| 3594 |
sortable: sortable, |
| 3595 |
rootEl: rootEl, |
| 3596 |
name: 'select', |
| 3597 |
targetEl: children[i], |
| 3598 |
originalEvt: evt |
| 3599 |
}); |
| 3600 |
} |
| 3601 |
} |
| 3602 |
} else { |
| 3603 |
lastMultiDragSelect = dragEl$1; |
| 3604 |
} |
| 3605 |
|
| 3606 |
multiDragSortable = toSortable; |
| 3607 |
} else { |
| 3608 |
multiDragElements.splice(multiDragElements.indexOf(dragEl$1), 1); |
| 3609 |
lastMultiDragSelect = null; |
| 3610 |
dispatchEvent({ |
| 3611 |
sortable: sortable, |
| 3612 |
rootEl: rootEl, |
| 3613 |
name: 'deselect', |
| 3614 |
targetEl: dragEl$1, |
| 3615 |
originalEvt: evt |
| 3616 |
}); |
| 3617 |
} |
| 3618 |
} // Multi-drag drop |
| 3619 |
|
| 3620 |
|
| 3621 |
if (dragStarted && this.isMultiDrag) { |
| 3622 |
// Do not "unfold" after around dragEl if reverted |
| 3623 |
if ((parentEl[expando].options.sort || parentEl !== rootEl) && multiDragElements.length > 1) { |
| 3624 |
var dragRect = getRect(dragEl$1), |
| 3625 |
multiDragIndex = index(dragEl$1, ':not(.' + this.options.selectedClass + ')'); |
| 3626 |
if (!initialFolding && options.animation) dragEl$1.thisAnimationDuration = null; |
| 3627 |
toSortable.captureAnimationState(); |
| 3628 |
|
| 3629 |
if (!initialFolding) { |
| 3630 |
if (options.animation) { |
| 3631 |
dragEl$1.fromRect = dragRect; |
| 3632 |
multiDragElements.forEach(function (multiDragElement) { |
| 3633 |
multiDragElement.thisAnimationDuration = null; |
| 3634 |
|
| 3635 |
if (multiDragElement !== dragEl$1) { |
| 3636 |
var rect = folding ? getRect(multiDragElement) : dragRect; |
| 3637 |
multiDragElement.fromRect = rect; // Prepare unfold animation |
| 3638 |
|
| 3639 |
toSortable.addAnimationState({ |
| 3640 |
target: multiDragElement, |
| 3641 |
rect: rect |
| 3642 |
}); |
| 3643 |
} |
| 3644 |
}); |
| 3645 |
} // Multi drag elements are not necessarily removed from the DOM on drop, so to reinsert |
| 3646 |
// properly they must all be removed |
| 3647 |
|
| 3648 |
|
| 3649 |
removeMultiDragElements(); |
| 3650 |
multiDragElements.forEach(function (multiDragElement) { |
| 3651 |
if (children[multiDragIndex]) { |
| 3652 |
parentEl.insertBefore(multiDragElement, children[multiDragIndex]); |
| 3653 |
} else { |
| 3654 |
parentEl.appendChild(multiDragElement); |
| 3655 |
} |
| 3656 |
|
| 3657 |
multiDragIndex++; |
| 3658 |
}); // If initial folding is done, the elements may have changed position because they are now |
| 3659 |
// unfolding around dragEl, even though dragEl may not have his index changed, so update event |
| 3660 |
// must be fired here as Sortable will not. |
| 3661 |
|
| 3662 |
if (oldIndex === index(dragEl$1)) { |
| 3663 |
var update = false; |
| 3664 |
multiDragElements.forEach(function (multiDragElement) { |
| 3665 |
if (multiDragElement.sortableIndex !== index(multiDragElement)) { |
| 3666 |
update = true; |
| 3667 |
return; |
| 3668 |
} |
| 3669 |
}); |
| 3670 |
|
| 3671 |
if (update) { |
| 3672 |
dispatchSortableEvent('update'); |
| 3673 |
} |
| 3674 |
} |
| 3675 |
} // Must be done after capturing individual rects (scroll bar) |
| 3676 |
|
| 3677 |
|
| 3678 |
multiDragElements.forEach(function (multiDragElement) { |
| 3679 |
unsetRect(multiDragElement); |
| 3680 |
}); |
| 3681 |
toSortable.animateAll(); |
| 3682 |
} |
| 3683 |
|
| 3684 |
multiDragSortable = toSortable; |
| 3685 |
} // Remove clones if necessary |
| 3686 |
|
| 3687 |
|
| 3688 |
if (rootEl === parentEl || putSortable && putSortable.lastPutMode !== 'clone') { |
| 3689 |
multiDragClones.forEach(function (clone) { |
| 3690 |
clone.parentNode && clone.parentNode.removeChild(clone); |
| 3691 |
}); |
| 3692 |
} |
| 3693 |
}, |
| 3694 |
nullingGlobal: function nullingGlobal() { |
| 3695 |
this.isMultiDrag = dragStarted = false; |
| 3696 |
multiDragClones.length = 0; |
| 3697 |
}, |
| 3698 |
destroyGlobal: function destroyGlobal() { |
| 3699 |
this._deselectMultiDrag(); |
| 3700 |
|
| 3701 |
off(document, 'pointerup', this._deselectMultiDrag); |
| 3702 |
off(document, 'mouseup', this._deselectMultiDrag); |
| 3703 |
off(document, 'touchend', this._deselectMultiDrag); |
| 3704 |
off(document, 'keydown', this._checkKeyDown); |
| 3705 |
off(document, 'keyup', this._checkKeyUp); |
| 3706 |
}, |
| 3707 |
_deselectMultiDrag: function _deselectMultiDrag(evt) { |
| 3708 |
if (typeof dragStarted !== "undefined" && dragStarted) return; // Only deselect if selection is in this sortable |
| 3709 |
|
| 3710 |
if (multiDragSortable !== this.sortable) return; // Only deselect if target is not item in this sortable |
| 3711 |
|
| 3712 |
if (evt && closest(evt.target, this.options.draggable, this.sortable.el, false)) return; // Only deselect if left click |
| 3713 |
|
| 3714 |
if (evt && evt.button !== 0) return; |
| 3715 |
|
| 3716 |
while (multiDragElements.length) { |
| 3717 |
var el = multiDragElements[0]; |
| 3718 |
toggleClass(el, this.options.selectedClass, false); |
| 3719 |
multiDragElements.shift(); |
| 3720 |
dispatchEvent({ |
| 3721 |
sortable: this.sortable, |
| 3722 |
rootEl: this.sortable.el, |
| 3723 |
name: 'deselect', |
| 3724 |
targetEl: el, |
| 3725 |
originalEvt: evt |
| 3726 |
}); |
| 3727 |
} |
| 3728 |
}, |
| 3729 |
_checkKeyDown: function _checkKeyDown(evt) { |
| 3730 |
if (evt.key === this.options.multiDragKey) { |
| 3731 |
this.multiDragKeyDown = true; |
| 3732 |
} |
| 3733 |
}, |
| 3734 |
_checkKeyUp: function _checkKeyUp(evt) { |
| 3735 |
if (evt.key === this.options.multiDragKey) { |
| 3736 |
this.multiDragKeyDown = false; |
| 3737 |
} |
| 3738 |
} |
| 3739 |
}; |
| 3740 |
return _extends(MultiDrag, { |
| 3741 |
// Static methods & properties |
| 3742 |
pluginName: 'multiDrag', |
| 3743 |
utils: { |
| 3744 |
/**
|
| 3745 |
* Selects the provided multi-drag item
|
| 3746 |
* @param {HTMLElement} el The element to be selected
|
| 3747 |
*/ |
| 3748 |
select: function select(el) { |
| 3749 |
var sortable = el.parentNode[expando]; |
| 3750 |
if (!sortable || !sortable.options.multiDrag || ~multiDragElements.indexOf(el)) return; |
| 3751 |
|
| 3752 |
if (multiDragSortable && multiDragSortable !== sortable) { |
| 3753 |
multiDragSortable.multiDrag._deselectMultiDrag(); |
| 3754 |
|
| 3755 |
multiDragSortable = sortable; |
| 3756 |
} |
| 3757 |
|
| 3758 |
toggleClass(el, sortable.options.selectedClass, true); |
| 3759 |
multiDragElements.push(el); |
| 3760 |
}, |
| 3761 |
|
| 3762 |
/**
|
| 3763 |
* Deselects the provided multi-drag item
|
| 3764 |
* @param {HTMLElement} el The element to be deselected
|
| 3765 |
*/ |
| 3766 |
deselect: function deselect(el) { |
| 3767 |
var sortable = el.parentNode[expando], |
| 3768 |
index = multiDragElements.indexOf(el); |
| 3769 |
if (!sortable || !sortable.options.multiDrag || !~index) return; |
| 3770 |
toggleClass(el, sortable.options.selectedClass, false); |
| 3771 |
multiDragElements.splice(index, 1); |
| 3772 |
} |
| 3773 |
}, |
| 3774 |
eventProperties: function eventProperties() { |
| 3775 |
var _this3 = this; |
| 3776 |
|
| 3777 |
var oldIndicies = [], |
| 3778 |
newIndicies = []; |
| 3779 |
multiDragElements.forEach(function (multiDragElement) { |
| 3780 |
oldIndicies.push({ |
| 3781 |
multiDragElement: multiDragElement, |
| 3782 |
index: multiDragElement.sortableIndex |
| 3783 |
}); // multiDragElements will already be sorted if folding |
| 3784 |
|
| 3785 |
var newIndex; |
| 3786 |
|
| 3787 |
if (folding && multiDragElement !== dragEl$1) { |
| 3788 |
newIndex = -1; |
| 3789 |
} else if (folding) { |
| 3790 |
newIndex = index(multiDragElement, ':not(.' + _this3.options.selectedClass + ')'); |
| 3791 |
} else { |
| 3792 |
newIndex = index(multiDragElement); |
| 3793 |
} |
| 3794 |
|
| 3795 |
newIndicies.push({ |
| 3796 |
multiDragElement: multiDragElement, |
| 3797 |
index: newIndex |
| 3798 |
}); |
| 3799 |
}); |
| 3800 |
return { |
| 3801 |
items: _toConsumableArray(multiDragElements), |
| 3802 |
clones: [].concat(multiDragClones), |
| 3803 |
oldIndicies: oldIndicies, |
| 3804 |
newIndicies: newIndicies |
| 3805 |
}; |
| 3806 |
}, |
| 3807 |
optionListeners: { |
| 3808 |
multiDragKey: function multiDragKey(key) { |
| 3809 |
key = key.toLowerCase(); |
| 3810 |
|
| 3811 |
if (key === 'ctrl') { |
| 3812 |
key = 'Control'; |
| 3813 |
} else if (key.length > 1) { |
| 3814 |
key = key.charAt(0).toUpperCase() + key.substr(1); |
| 3815 |
} |
| 3816 |
|
| 3817 |
return key; |
| 3818 |
} |
| 3819 |
} |
| 3820 |
}); |
| 3821 |
} |
| 3822 |
|
| 3823 |
function insertMultiDragElements(clonesInserted, rootEl) { |
| 3824 |
multiDragElements.forEach(function (multiDragElement, i) { |
| 3825 |
var target = rootEl.children[multiDragElement.sortableIndex + (clonesInserted ? Number(i) : 0)]; |
| 3826 |
|
| 3827 |
if (target) { |
| 3828 |
rootEl.insertBefore(multiDragElement, target); |
| 3829 |
} else { |
| 3830 |
rootEl.appendChild(multiDragElement); |
| 3831 |
} |
| 3832 |
}); |
| 3833 |
} |
| 3834 |
/**
|
| 3835 |
* Insert multi-drag clones
|
| 3836 |
* @param {[Boolean]} elementsInserted Whether the multi-drag elements are inserted
|
| 3837 |
* @param {HTMLElement} rootEl
|
| 3838 |
*/ |
| 3839 |
|
| 3840 |
|
| 3841 |
function insertMultiDragClones(elementsInserted, rootEl) { |
| 3842 |
multiDragClones.forEach(function (clone, i) { |
| 3843 |
var target = rootEl.children[clone.sortableIndex + (elementsInserted ? Number(i) : 0)]; |
| 3844 |
|
| 3845 |
if (target) { |
| 3846 |
rootEl.insertBefore(clone, target); |
| 3847 |
} else { |
| 3848 |
rootEl.appendChild(clone); |
| 3849 |
} |
| 3850 |
}); |
| 3851 |
} |
| 3852 |
|
| 3853 |
function removeMultiDragElements() { |
| 3854 |
multiDragElements.forEach(function (multiDragElement) { |
| 3855 |
if (multiDragElement === dragEl$1) return; |
| 3856 |
multiDragElement.parentNode && multiDragElement.parentNode.removeChild(multiDragElement); |
| 3857 |
}); |
| 3858 |
} |
| 3859 |
|
| 3860 |
Sortable.mount(new AutoScrollPlugin()); |
| 3861 |
Sortable.mount(Remove, Revert); |
| 3862 |
|
| 3863 |
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (Sortable); |
| 3864 |
|
| 3865 |
|
| 3866 |
|
| 3867 |
/***/ }), |
| 3868 |
|
| 3869 |
/***/ "./node_modules/vue-range-slider/dist/vue-range-slider.css": |
| 3870 |
/*!*****************************************************************!*\ |
| 3871 |
!*** ./node_modules/vue-range-slider/dist/vue-range-slider.css ***! |
| 3872 |
\*****************************************************************/ |
| 3873 |
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { |
| 3874 |
|
| 3875 |
"use strict"; |
| 3876 |
__webpack_require__.r(__webpack_exports__); |
| 3877 |
/* harmony export */ __webpack_require__.d(__webpack_exports__, { |
| 3878 |
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) |
| 3879 |
/* harmony export */ }); |
| 3880 |
/* harmony import */ var _style_loader_dist_runtime_injectStylesIntoStyleTag_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! !../../style-loader/dist/runtime/injectStylesIntoStyleTag.js */ "./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js"); |
| 3881 |
/* harmony import */ var _style_loader_dist_runtime_injectStylesIntoStyleTag_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_style_loader_dist_runtime_injectStylesIntoStyleTag_js__WEBPACK_IMPORTED_MODULE_0__); |
| 3882 |
/* harmony import */ var _css_loader_dist_cjs_js_clonedRuleSet_102_0_rules_0_use_1_postcss_loader_dist_cjs_js_clonedRuleSet_102_0_rules_0_use_2_vue_range_slider_css__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! !!../../css-loader/dist/cjs.js??clonedRuleSet-102[0].rules[0].use[1]!../../postcss-loader/dist/cjs.js??clonedRuleSet-102[0].rules[0].use[2]!./vue-range-slider.css */ "./node_modules/css-loader/dist/cjs.js??clonedRuleSet-102[0].rules[0].use[1]!./node_modules/postcss-loader/dist/cjs.js??clonedRuleSet-102[0].rules[0].use[2]!./node_modules/vue-range-slider/dist/vue-range-slider.css"); |
| 3883 |
|
| 3884 |
|
| 3885 |
|
| 3886 |
var options = {}; |
| 3887 |
|
| 3888 |
options.insert = "head"; |
| 3889 |
options.singleton = false; |
| 3890 |
|
| 3891 |
var update = _style_loader_dist_runtime_injectStylesIntoStyleTag_js__WEBPACK_IMPORTED_MODULE_0___default()(_css_loader_dist_cjs_js_clonedRuleSet_102_0_rules_0_use_1_postcss_loader_dist_cjs_js_clonedRuleSet_102_0_rules_0_use_2_vue_range_slider_css__WEBPACK_IMPORTED_MODULE_1__["default"], options); |
| 3892 |
|
| 3893 |
|
| 3894 |
|
| 3895 |
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (_css_loader_dist_cjs_js_clonedRuleSet_102_0_rules_0_use_1_postcss_loader_dist_cjs_js_clonedRuleSet_102_0_rules_0_use_2_vue_range_slider_css__WEBPACK_IMPORTED_MODULE_1__["default"].locals || {}); |
| 3896 |
|
| 3897 |
/***/ }), |
| 3898 |
|
| 3899 |
/***/ "./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js": |
| 3900 |
/*!****************************************************************************!*\ |
| 3901 |
!*** ./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js ***! |
| 3902 |
\****************************************************************************/ |
| 3903 |
/***/ ((module, __unused_webpack_exports, __webpack_require__) => { |
| 3904 |
|
| 3905 |
"use strict"; |
| 3906 |
|
| 3907 |
|
| 3908 |
var isOldIE = function isOldIE() { |
| 3909 |
var memo; |
| 3910 |
return function memorize() { |
| 3911 |
if (typeof memo === 'undefined') { |
| 3912 |
// Test for IE <= 9 as proposed by Browserhacks |
| 3913 |
// @see http://browserhacks.com/#hack-e71d8692f65334173fee715c222cb805 |
| 3914 |
// Tests for existence of standard globals is to allow style-loader |
| 3915 |
// to operate correctly into non-standard environments |
| 3916 |
// @see https://github.com/webpack-contrib/style-loader/issues/177 |
| 3917 |
memo = Boolean(window && document && document.all && !window.atob); |
| 3918 |
} |
| 3919 |
|
| 3920 |
return memo; |
| 3921 |
}; |
| 3922 |
}(); |
| 3923 |
|
| 3924 |
var getTarget = function getTarget() { |
| 3925 |
var memo = {}; |
| 3926 |
return function memorize(target) { |
| 3927 |
if (typeof memo[target] === 'undefined') { |
| 3928 |
var styleTarget = document.querySelector(target); // Special case to return head of iframe instead of iframe itself |
| 3929 |
|
| 3930 |
if (window.HTMLIFrameElement && styleTarget instanceof window.HTMLIFrameElement) { |
| 3931 |
try { |
| 3932 |
// This will throw an exception if access to iframe is blocked |
| 3933 |
// due to cross-origin restrictions |
| 3934 |
styleTarget = styleTarget.contentDocument.head; |
| 3935 |
} catch (e) { |
| 3936 |
// istanbul ignore next |
| 3937 |
styleTarget = null; |
| 3938 |
} |
| 3939 |
} |
| 3940 |
|
| 3941 |
memo[target] = styleTarget; |
| 3942 |
} |
| 3943 |
|
| 3944 |
return memo[target]; |
| 3945 |
}; |
| 3946 |
}(); |
| 3947 |
|
| 3948 |
var stylesInDom = []; |
| 3949 |
|
| 3950 |
function getIndexByIdentifier(identifier) { |
| 3951 |
var result = -1; |
| 3952 |
|
| 3953 |
for (var i = 0; i < stylesInDom.length; i++) { |
| 3954 |
if (stylesInDom[i].identifier === identifier) { |
| 3955 |
result = i; |
| 3956 |
break; |
| 3957 |
} |
| 3958 |
} |
| 3959 |
|
| 3960 |
return result; |
| 3961 |
} |
| 3962 |
|
| 3963 |
function modulesToDom(list, options) { |
| 3964 |
var idCountMap = {}; |
| 3965 |
var identifiers = []; |
| 3966 |
|
| 3967 |
for (var i = 0; i < list.length; i++) { |
| 3968 |
var item = list[i]; |
| 3969 |
var id = options.base ? item[0] + options.base : item[0]; |
| 3970 |
var count = idCountMap[id] || 0; |
| 3971 |
var identifier = "".concat(id, " ").concat(count); |
| 3972 |
idCountMap[id] = count + 1; |
| 3973 |
var index = getIndexByIdentifier(identifier); |
| 3974 |
var obj = { |
| 3975 |
css: item[1], |
| 3976 |
media: item[2], |
| 3977 |
sourceMap: item[3] |
| 3978 |
}; |
| 3979 |
|
| 3980 |
if (index !== -1) { |
| 3981 |
stylesInDom[index].references++; |
| 3982 |
stylesInDom[index].updater(obj); |
| 3983 |
} else { |
| 3984 |
stylesInDom.push({ |
| 3985 |
identifier: identifier, |
| 3986 |
updater: addStyle(obj, options), |
| 3987 |
references: 1 |
| 3988 |
}); |
| 3989 |
} |
| 3990 |
|
| 3991 |
identifiers.push(identifier); |
| 3992 |
} |
| 3993 |
|
| 3994 |
return identifiers; |
| 3995 |
} |
| 3996 |
|
| 3997 |
function insertStyleElement(options) { |
| 3998 |
var style = document.createElement('style'); |
| 3999 |
var attributes = options.attributes || {}; |
| 4000 |
|
| 4001 |
if (typeof attributes.nonce === 'undefined') { |
| 4002 |
var nonce = true ? __webpack_require__.nc : 0; |
| 4003 |
|
| 4004 |
if (nonce) { |
| 4005 |
attributes.nonce = nonce; |
| 4006 |
} |
| 4007 |
} |
| 4008 |
|
| 4009 |
Object.keys(attributes).forEach(function (key) { |
| 4010 |
style.setAttribute(key, attributes[key]); |
| 4011 |
}); |
| 4012 |
|
| 4013 |
if (typeof options.insert === 'function') { |
| 4014 |
options.insert(style); |
| 4015 |
} else { |
| 4016 |
var target = getTarget(options.insert || 'head'); |
| 4017 |
|
| 4018 |
if (!target) { |
| 4019 |
throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid."); |
| 4020 |
} |
| 4021 |
|
| 4022 |
target.appendChild(style); |
| 4023 |
} |
| 4024 |
|
| 4025 |
return style; |
| 4026 |
} |
| 4027 |
|
| 4028 |
function removeStyleElement(style) { |
| 4029 |
// istanbul ignore if |
| 4030 |
if (style.parentNode === null) { |
| 4031 |
return false; |
| 4032 |
} |
| 4033 |
|
| 4034 |
style.parentNode.removeChild(style); |
| 4035 |
} |
| 4036 |
/* istanbul ignore next */ |
| 4037 |
|
| 4038 |
|
| 4039 |
var replaceText = function replaceText() { |
| 4040 |
var textStore = []; |
| 4041 |
return function replace(index, replacement) { |
| 4042 |
textStore[index] = replacement; |
| 4043 |
return textStore.filter(Boolean).join('\n'); |
| 4044 |
}; |
| 4045 |
}(); |
| 4046 |
|
| 4047 |
function applyToSingletonTag(style, index, remove, obj) { |
| 4048 |
var css = remove ? '' : obj.media ? "@media ".concat(obj.media, " {").concat(obj.css, "}") : obj.css; // For old IE |
| 4049 |
|
| 4050 |
/* istanbul ignore if */ |
| 4051 |
|
| 4052 |
if (style.styleSheet) { |
| 4053 |
style.styleSheet.cssText = replaceText(index, css); |
| 4054 |
} else { |
| 4055 |
var cssNode = document.createTextNode(css); |
| 4056 |
var childNodes = style.childNodes; |
| 4057 |
|
| 4058 |
if (childNodes[index]) { |
| 4059 |
style.removeChild(childNodes[index]); |
| 4060 |
} |
| 4061 |
|
| 4062 |
if (childNodes.length) { |
| 4063 |
style.insertBefore(cssNode, childNodes[index]); |
| 4064 |
} else { |
| 4065 |
style.appendChild(cssNode); |
| 4066 |
} |
| 4067 |
} |
| 4068 |
} |
| 4069 |
|
| 4070 |
function applyToTag(style, options, obj) { |
| 4071 |
var css = obj.css; |
| 4072 |
var media = obj.media; |
| 4073 |
var sourceMap = obj.sourceMap; |
| 4074 |
|
| 4075 |
if (media) { |
| 4076 |
style.setAttribute('media', media); |
| 4077 |
} else { |
| 4078 |
style.removeAttribute('media'); |
| 4079 |
} |
| 4080 |
|
| 4081 |
if (sourceMap && typeof btoa !== 'undefined') { |
| 4082 |
css += "\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap)))), " */"); |
| 4083 |
} // For old IE |
| 4084 |
|
| 4085 |
/* istanbul ignore if */ |
| 4086 |
|
| 4087 |
|
| 4088 |
if (style.styleSheet) { |
| 4089 |
style.styleSheet.cssText = css; |
| 4090 |
} else { |
| 4091 |
while (style.firstChild) { |
| 4092 |
style.removeChild(style.firstChild); |
| 4093 |
} |
| 4094 |
|
| 4095 |
style.appendChild(document.createTextNode(css)); |
| 4096 |
} |
| 4097 |
} |
| 4098 |
|
| 4099 |
var singleton = null; |
| 4100 |
var singletonCounter = 0; |
| 4101 |
|
| 4102 |
function addStyle(obj, options) { |
| 4103 |
var style; |
| 4104 |
var update; |
| 4105 |
var remove; |
| 4106 |
|
| 4107 |
if (options.singleton) { |
| 4108 |
var styleIndex = singletonCounter++; |
| 4109 |
style = singleton || (singleton = insertStyleElement(options)); |
| 4110 |
update = applyToSingletonTag.bind(null, style, styleIndex, false); |
| 4111 |
remove = applyToSingletonTag.bind(null, style, styleIndex, true); |
| 4112 |
} else { |
| 4113 |
style = insertStyleElement(options); |
| 4114 |
update = applyToTag.bind(null, style, options); |
| 4115 |
|
| 4116 |
remove = function remove() { |
| 4117 |
removeStyleElement(style); |
| 4118 |
}; |
| 4119 |
} |
| 4120 |
|
| 4121 |
update(obj); |
| 4122 |
return function updateStyle(newObj) { |
| 4123 |
if (newObj) { |
| 4124 |
if (newObj.css === obj.css && newObj.media === obj.media && newObj.sourceMap === obj.sourceMap) { |
| 4125 |
return; |
| 4126 |
} |
| 4127 |
|
| 4128 |
update(obj = newObj); |
| 4129 |
} else { |
| 4130 |
remove(); |
| 4131 |
} |
| 4132 |
}; |
| 4133 |
} |
| 4134 |
|
| 4135 |
module.exports = function (list, options) { |
| 4136 |
options = options || {}; // Force single-tag solution on IE6-9, which has a hard limit on the # of <style> |
| 4137 |
// tags it will allow on a page |
| 4138 |
|
| 4139 |
if (!options.singleton && typeof options.singleton !== 'boolean') { |
| 4140 |
options.singleton = isOldIE(); |
| 4141 |
} |
| 4142 |
|
| 4143 |
list = list || []; |
| 4144 |
var lastIdentifiers = modulesToDom(list, options); |
| 4145 |
return function update(newList) { |
| 4146 |
newList = newList || []; |
| 4147 |
|
| 4148 |
if (Object.prototype.toString.call(newList) !== '[object Array]') { |
| 4149 |
return; |
| 4150 |
} |
| 4151 |
|
| 4152 |
for (var i = 0; i < lastIdentifiers.length; i++) { |
| 4153 |
var identifier = lastIdentifiers[i]; |
| 4154 |
var index = getIndexByIdentifier(identifier); |
| 4155 |
stylesInDom[index].references--; |
| 4156 |
} |
| 4157 |
|
| 4158 |
var newLastIdentifiers = modulesToDom(newList, options); |
| 4159 |
|
| 4160 |
for (var _i = 0; _i < lastIdentifiers.length; _i++) { |
| 4161 |
var _identifier = lastIdentifiers[_i]; |
| 4162 |
|
| 4163 |
var _index = getIndexByIdentifier(_identifier); |
| 4164 |
|
| 4165 |
if (stylesInDom[_index].references === 0) { |
| 4166 |
stylesInDom[_index].updater(); |
| 4167 |
|
| 4168 |
stylesInDom.splice(_index, 1); |
| 4169 |
} |
| 4170 |
} |
| 4171 |
|
| 4172 |
lastIdentifiers = newLastIdentifiers; |
| 4173 |
}; |
| 4174 |
}; |
| 4175 |
|
| 4176 |
/***/ }), |
| 4177 |
|
| 4178 |
/***/ "./node_modules/vue-loader/lib/runtime/componentNormalizer.js": |
| 4179 |
/*!********************************************************************!*\ |
| 4180 |
!*** ./node_modules/vue-loader/lib/runtime/componentNormalizer.js ***! |
| 4181 |
\********************************************************************/ |
| 4182 |
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { |
| 4183 |
|
| 4184 |
"use strict"; |
| 4185 |
__webpack_require__.r(__webpack_exports__); |
| 4186 |
/* harmony export */ __webpack_require__.d(__webpack_exports__, { |
| 4187 |
/* harmony export */ "default": () => (/* binding */ normalizeComponent) |
| 4188 |
/* harmony export */ }); |
| 4189 |
/* globals __VUE_SSR_CONTEXT__ */ |
| 4190 |
|
| 4191 |
// IMPORTANT: Do NOT use ES2015 features in this file (except for modules). |
| 4192 |
// This module is a runtime utility for cleaner component module output and will |
| 4193 |
// be included in the final webpack user bundle. |
| 4194 |
|
| 4195 |
function normalizeComponent ( |
| 4196 |
scriptExports, |
| 4197 |
render, |
| 4198 |
staticRenderFns, |
| 4199 |
functionalTemplate, |
| 4200 |
injectStyles, |
| 4201 |
scopeId, |
| 4202 |
moduleIdentifier, /* server only */ |
| 4203 |
shadowMode /* vue-cli only */ |
| 4204 |
) { |
| 4205 |
// Vue.extend constructor export interop |
| 4206 |
var options = typeof scriptExports === 'function' |
| 4207 |
? scriptExports.options |
| 4208 |
: scriptExports |
| 4209 |
|
| 4210 |
// render functions |
| 4211 |
if (render) { |
| 4212 |
options.render = render |
| 4213 |
options.staticRenderFns = staticRenderFns |
| 4214 |
options._compiled = true |
| 4215 |
} |
| 4216 |
|
| 4217 |
// functional template |
| 4218 |
if (functionalTemplate) { |
| 4219 |
options.functional = true |
| 4220 |
} |
| 4221 |
|
| 4222 |
// scopedId |
| 4223 |
if (scopeId) { |
| 4224 |
options._scopeId = 'data-v-' + scopeId |
| 4225 |
} |
| 4226 |
|
| 4227 |
var hook |
| 4228 |
if (moduleIdentifier) { // server build |
| 4229 |
hook = function (context) { |
| 4230 |
// 2.3 injection |
| 4231 |
context = |
| 4232 |
context || // cached call |
| 4233 |
(this.$vnode && this.$vnode.ssrContext) || // stateful |
| 4234 |
(this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional |
| 4235 |
// 2.2 with runInNewContext: true |
| 4236 |
if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') { |
| 4237 |
context = __VUE_SSR_CONTEXT__ |
| 4238 |
} |
| 4239 |
// inject component styles |
| 4240 |
if (injectStyles) { |
| 4241 |
injectStyles.call(this, context) |
| 4242 |
} |
| 4243 |
// register component module identifier for async chunk inferrence |
| 4244 |
if (context && context._registeredComponents) { |
| 4245 |
context._registeredComponents.add(moduleIdentifier) |
| 4246 |
} |
| 4247 |
} |
| 4248 |
// used by ssr in case component is cached and beforeCreate |
| 4249 |
// never gets called |
| 4250 |
options._ssrRegister = hook |
| 4251 |
} else if (injectStyles) { |
| 4252 |
hook = shadowMode |
| 4253 |
? function () { |
| 4254 |
injectStyles.call( |
| 4255 |
this, |
| 4256 |
(options.functional ? this.parent : this).$root.$options.shadowRoot |
| 4257 |
) |
| 4258 |
} |
| 4259 |
: injectStyles |
| 4260 |
} |
| 4261 |
|
| 4262 |
if (hook) { |
| 4263 |
if (options.functional) { |
| 4264 |
// for template-only hot-reload because in that case the render fn doesn't |
| 4265 |
// go through the normalizer |
| 4266 |
options._injectStyles = hook |
| 4267 |
// register for functional component in vue file |
| 4268 |
var originalRender = options.render |
| 4269 |
options.render = function renderWithStyleInjection (h, context) { |
| 4270 |
hook.call(context) |
| 4271 |
return originalRender(h, context) |
| 4272 |
} |
| 4273 |
} else { |
| 4274 |
// inject component registration as beforeCreate hook |
| 4275 |
var existing = options.beforeCreate |
| 4276 |
options.beforeCreate = existing |
| 4277 |
? [].concat(existing, hook) |
| 4278 |
: [hook] |
| 4279 |
} |
| 4280 |
} |
| 4281 |
|
| 4282 |
return { |
| 4283 |
exports: scriptExports, |
| 4284 |
options: options |
| 4285 |
} |
| 4286 |
} |
| 4287 |
|
| 4288 |
|
| 4289 |
/***/ }), |
| 4290 |
|
| 4291 |
/***/ "./node_modules/vue-range-slider/dist/vue-range-slider.cjs.js": |
| 4292 |
/*!********************************************************************!*\ |
| 4293 |
!*** ./node_modules/vue-range-slider/dist/vue-range-slider.cjs.js ***! |
| 4294 |
\********************************************************************/ |
| 4295 |
/***/ ((module) => { |
| 4296 |
|
| 4297 |
"use strict"; |
| 4298 |
/*! |
| 4299 |
* vue-range-slider v0.6.0 |
| 4300 |
* https://github.com/ktsn/vue-range-slider |
| 4301 |
* |
| 4302 |
* @license |
| 4303 |
* Copyright (c) 2016-2018 katashin |
| 4304 |
* Released under the MIT license |
| 4305 |
* https://github.com/ktsn/vue-range-slider/blob/master/LICENSE |
| 4306 |
*/ |
| 4307 |
|
| 4308 |
|
| 4309 |
/* global window, document */ |
| 4310 |
|
| 4311 |
var DocumentEventHelper = { |
| 4312 |
created: function created() { |
| 4313 |
if (typeof document === 'undefined') return; |
| 4314 |
forEachListener(this, function (key, listener) { |
| 4315 |
on(document, key, listener); |
| 4316 |
}); |
| 4317 |
}, |
| 4318 |
beforeDestroy: function beforeDestroy() { |
| 4319 |
if (typeof document === 'undefined') return; |
| 4320 |
forEachListener(this, function (key, listener) { |
| 4321 |
off(document, key, listener); |
| 4322 |
}); |
| 4323 |
} |
| 4324 |
}; |
| 4325 |
|
| 4326 |
var isBrowser = typeof window !== 'undefined'; |
| 4327 |
|
| 4328 |
var hasPassive = isBrowser && function () { |
| 4329 |
var supported = false; |
| 4330 |
|
| 4331 |
try { |
| 4332 |
var desc = { |
| 4333 |
get: function get() { |
| 4334 |
supported = true; |
| 4335 |
} |
| 4336 |
}; |
| 4337 |
var opts = Object.defineProperty({}, 'passive', desc); |
| 4338 |
|
| 4339 |
window.addEventListener('test', null, opts); |
| 4340 |
window.removeEventListener('test', null, opts); |
| 4341 |
} catch (e) { |
| 4342 |
supported = false; |
| 4343 |
} |
| 4344 |
|
| 4345 |
return supported; |
| 4346 |
}(); |
| 4347 |
|
| 4348 |
function forEachListener(vm, f) { |
| 4349 |
var events = vm.$options.events; |
| 4350 |
Object.keys(events).forEach(function (key) { |
| 4351 |
f(key, function (event) { |
| 4352 |
return events[key].call(vm, event); |
| 4353 |
}); |
| 4354 |
}); |
| 4355 |
} |
| 4356 |
|
| 4357 |
function on(el, name, fn) { |
| 4358 |
var options = hasPassive ? { passive: false } : undefined; |
| 4359 |
el.addEventListener(name, fn, options); |
| 4360 |
} |
| 4361 |
|
| 4362 |
function off(el, name, fn) { |
| 4363 |
var options = hasPassive ? { passive: false } : undefined; |
| 4364 |
el.removeEventListener(name, fn, options); |
| 4365 |
} |
| 4366 |
|
| 4367 |
function relativeMouseOffset(offset, base) { |
| 4368 |
var bounds = base.getBoundingClientRect(); |
| 4369 |
return { |
| 4370 |
left: offset.clientX - bounds.left, |
| 4371 |
top: offset.clientY - bounds.top |
| 4372 |
}; |
| 4373 |
} |
| 4374 |
|
| 4375 |
function round(value, min, max, step) { |
| 4376 |
if (value <= min) { |
| 4377 |
return min; |
| 4378 |
} |
| 4379 |
|
| 4380 |
var roundedMax = Math.floor((max - min) / step) * step + min; |
| 4381 |
if (value >= roundedMax) { |
| 4382 |
return roundedMax; |
| 4383 |
} |
| 4384 |
|
| 4385 |
var normalize = (value - min) / step; |
| 4386 |
var decimal = Math.floor(normalize); |
| 4387 |
var fraction = normalize - decimal; |
| 4388 |
|
| 4389 |
if (fraction === 0) return value; |
| 4390 |
|
| 4391 |
if (fraction < 0.5) { |
| 4392 |
return step * decimal + min; |
| 4393 |
} else { |
| 4394 |
return step * (decimal + 1) + min; |
| 4395 |
} |
| 4396 |
} |
| 4397 |
|
| 4398 |
var DragHelper = { |
| 4399 |
mixins: [DocumentEventHelper], |
| 4400 |
|
| 4401 |
props: { |
| 4402 |
disabled: Boolean |
| 4403 |
}, |
| 4404 |
|
| 4405 |
data: function data() { |
| 4406 |
return { |
| 4407 |
isDrag: false |
| 4408 |
}; |
| 4409 |
}, |
| 4410 |
|
| 4411 |
|
| 4412 |
events: { |
| 4413 |
mousedown: function mousedown(event) { |
| 4414 |
return this.dragStart(event, this.offsetByMouse); |
| 4415 |
}, |
| 4416 |
mousemove: function mousemove(event) { |
| 4417 |
return this.dragMove(event, this.offsetByMouse); |
| 4418 |
}, |
| 4419 |
mouseup: function mouseup(event) { |
| 4420 |
return this.dragEnd(event, this.offsetByMouse); |
| 4421 |
}, |
| 4422 |
touchstart: function touchstart(event) { |
| 4423 |
return this.dragStart(event, this.offsetByTouch); |
| 4424 |
}, |
| 4425 |
touchmove: function touchmove(event) { |
| 4426 |
return this.dragMove(event, this.offsetByTouch); |
| 4427 |
}, |
| 4428 |
touchend: function touchend(event) { |
| 4429 |
return this.dragEnd(event, this.offsetByTouch); |
| 4430 |
}, |
| 4431 |
touchcancel: function touchcancel(event) { |
| 4432 |
return this.dragEnd(event, this.offsetByTouch); |
| 4433 |
} |
| 4434 |
}, |
| 4435 |
|
| 4436 |
methods: { |
| 4437 |
isInTarget: function isInTarget(el) { |
| 4438 |
if (!el) return false; |
| 4439 |
|
| 4440 |
if (el === this.$el) { |
| 4441 |
return true; |
| 4442 |
} else { |
| 4443 |
return this.isInTarget(el.parentElement); |
| 4444 |
} |
| 4445 |
}, |
| 4446 |
offsetByMouse: function offsetByMouse(event) { |
| 4447 |
return relativeMouseOffset(event, this.$el); |
| 4448 |
}, |
| 4449 |
offsetByTouch: function offsetByTouch(event) { |
| 4450 |
var touch = event.touches.length === 0 ? event.changedTouches[0] : event.touches[0]; |
| 4451 |
return relativeMouseOffset(touch, this.$el); |
| 4452 |
}, |
| 4453 |
dragStart: function dragStart(event, f) { |
| 4454 |
if (this.disabled || event.button !== undefined && event.button !== 0 || !this.isInTarget(event.target)) { |
| 4455 |
return; |
| 4456 |
} |
| 4457 |
|
| 4458 |
event.preventDefault(); |
| 4459 |
this.isDrag = true; |
| 4460 |
this.$emit('dragstart', event, f(event), this.$el); |
| 4461 |
}, |
| 4462 |
dragMove: function dragMove(event, f) { |
| 4463 |
if (!this.isDrag) return; |
| 4464 |
event.preventDefault(); |
| 4465 |
this.$emit('drag', event, f(event), this.$el); |
| 4466 |
}, |
| 4467 |
dragEnd: function dragEnd(event, f) { |
| 4468 |
if (!this.isDrag) return; |
| 4469 |
event.preventDefault(); |
| 4470 |
this.isDrag = false; |
| 4471 |
this.$emit('dragend', event, f(event), this.$el); |
| 4472 |
} |
| 4473 |
}, |
| 4474 |
|
| 4475 |
render: function render() { |
| 4476 |
return this.$slots.default && this.$slots.default[0]; |
| 4477 |
} |
| 4478 |
}; |
| 4479 |
|
| 4480 |
var RangeSlider = { render: function render() { |
| 4481 |
var _vm = this;var _h = _vm.$createElement;var _c = _vm._self._c || _h;return _c('span', { staticClass: "range-slider", class: { disabled: _vm.disabled } }, [_c('drag-helper', { attrs: { "disabled": _vm.disabled }, on: { "dragstart": _vm.dragStart, "drag": _vm.drag, "dragend": _vm.dragEnd } }, [_c('span', { ref: "inner", staticClass: "range-slider-inner" }, [_c('input', { staticClass: "range-slider-hidden", attrs: { "type": "text", "name": _vm.name, "disabled": _vm.disabled }, domProps: { "value": _vm.actualValue } }), _vm._v(" "), _c('span', { staticClass: "range-slider-rail" }), _vm._v(" "), _c('span', { staticClass: "range-slider-fill", style: { width: _vm.valuePercent + '%' } }), _vm._v(" "), _c('span', { ref: "knob", staticClass: "range-slider-knob", style: { left: _vm.valuePercent + '%' } }, [_vm._t("knob")], 2)])])], 1); |
| 4482 |
}, staticRenderFns: [], |
| 4483 |
props: { |
| 4484 |
name: String, |
| 4485 |
value: [String, Number], |
| 4486 |
disabled: { |
| 4487 |
type: Boolean, |
| 4488 |
default: false |
| 4489 |
}, |
| 4490 |
min: { |
| 4491 |
type: [String, Number], |
| 4492 |
default: 0 |
| 4493 |
}, |
| 4494 |
max: { |
| 4495 |
type: [String, Number], |
| 4496 |
default: 100 |
| 4497 |
}, |
| 4498 |
step: { |
| 4499 |
type: [String, Number], |
| 4500 |
default: 1 |
| 4501 |
} |
| 4502 |
}, |
| 4503 |
|
| 4504 |
data: function data() { |
| 4505 |
return { |
| 4506 |
actualValue: null, |
| 4507 |
dragStartValue: null |
| 4508 |
}; |
| 4509 |
}, |
| 4510 |
created: function created() { |
| 4511 |
var min = this._min, |
| 4512 |
max = this._max; |
| 4513 |
|
| 4514 |
var defaultValue = Number(this.value); |
| 4515 |
|
| 4516 |
if (this.value == null || isNaN(defaultValue)) { |
| 4517 |
if (min > max) { |
| 4518 |
defaultValue = min; |
| 4519 |
} else { |
| 4520 |
defaultValue = (min + max) / 2; |
| 4521 |
} |
| 4522 |
} |
| 4523 |
|
| 4524 |
this.actualValue = this.round(defaultValue); |
| 4525 |
}, |
| 4526 |
|
| 4527 |
|
| 4528 |
computed: { |
| 4529 |
_min: function _min() { |
| 4530 |
return Number(this.min); |
| 4531 |
}, |
| 4532 |
_max: function _max() { |
| 4533 |
return Number(this.max); |
| 4534 |
}, |
| 4535 |
_step: function _step() { |
| 4536 |
return Number(this.step); |
| 4537 |
}, |
| 4538 |
valuePercent: function valuePercent() { |
| 4539 |
return (this.actualValue - this._min) / (this._max - this._min) * 100; |
| 4540 |
} |
| 4541 |
}, |
| 4542 |
|
| 4543 |
watch: { |
| 4544 |
value: function value(newValue) { |
| 4545 |
var value = Number(newValue); |
| 4546 |
if (newValue != null && !isNaN(value)) { |
| 4547 |
this.actualValue = this.round(value); |
| 4548 |
} |
| 4549 |
}, |
| 4550 |
min: function min() { |
| 4551 |
this.actualValue = this.round(this.actualValue); |
| 4552 |
}, |
| 4553 |
max: function max() { |
| 4554 |
this.actualValue = this.round(this.actualValue); |
| 4555 |
} |
| 4556 |
}, |
| 4557 |
|
| 4558 |
methods: { |
| 4559 |
dragStart: function dragStart(event, offset) { |
| 4560 |
this.dragStartValue = this.actualValue; |
| 4561 |
if (event.target === this.$refs.knob) { |
| 4562 |
return; |
| 4563 |
} |
| 4564 |
// If the click is out of knob, move it to mouse position |
| 4565 |
this.drag(event, offset); |
| 4566 |
}, |
| 4567 |
drag: function drag(event, offset) { |
| 4568 |
var offsetWidth = this.$refs.inner.offsetWidth; |
| 4569 |
|
| 4570 |
this.actualValue = this.round(this.valueFromBounds(offset.left, offsetWidth)); |
| 4571 |
this.emitInput(this.actualValue); |
| 4572 |
}, |
| 4573 |
dragEnd: function dragEnd(event, offset) { |
| 4574 |
var offsetWidth = this.$refs.inner.offsetWidth; |
| 4575 |
|
| 4576 |
this.actualValue = this.round(this.valueFromBounds(offset.left, offsetWidth)); |
| 4577 |
|
| 4578 |
if (this.dragStartValue !== this.actualValue) { |
| 4579 |
this.emitChange(this.actualValue); |
| 4580 |
} |
| 4581 |
}, |
| 4582 |
emitInput: function emitInput(value) { |
| 4583 |
this.$emit('input', value); |
| 4584 |
}, |
| 4585 |
emitChange: function emitChange(value) { |
| 4586 |
this.$emit('change', value); |
| 4587 |
}, |
| 4588 |
valueFromBounds: function valueFromBounds(point, width) { |
| 4589 |
return point / width * (this._max - this._min) + this._min; |
| 4590 |
}, |
| 4591 |
round: function round$$1(value) { |
| 4592 |
return round(value, this._min, this._max, this._step); |
| 4593 |
} |
| 4594 |
}, |
| 4595 |
|
| 4596 |
components: { |
| 4597 |
DragHelper: DragHelper |
| 4598 |
} |
| 4599 |
}; |
| 4600 |
|
| 4601 |
module.exports = RangeSlider; |
| 4602 |
|
| 4603 |
|
| 4604 |
/***/ }), |
| 4605 |
|
| 4606 |
/***/ "./node_modules/vue-router/dist/vue-router.esm.js": |
| 4607 |
/*!********************************************************!*\ |
| 4608 |
!*** ./node_modules/vue-router/dist/vue-router.esm.js ***! |
| 4609 |
\********************************************************/ |
| 4610 |
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { |
| 4611 |
|
| 4612 |
"use strict"; |
| 4613 |
__webpack_require__.r(__webpack_exports__); |
| 4614 |
/* harmony export */ __webpack_require__.d(__webpack_exports__, { |
| 4615 |
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) |
| 4616 |
/* harmony export */ }); |
| 4617 |
/*! |
| 4618 |
* vue-router v3.5.2 |
| 4619 |
* (c) 2021 Evan You |
| 4620 |
* @license MIT |
| 4621 |
*/ |
| 4622 |
/* */ |
| 4623 |
|
| 4624 |
function assert (condition, message) { |
| 4625 |
if (!condition) { |
| 4626 |
throw new Error(("[vue-router] " + message)) |
| 4627 |
} |
| 4628 |
} |
| 4629 |
|
| 4630 |
function warn (condition, message) { |
| 4631 |
if ( true && !condition) { |
| 4632 |
typeof console !== 'undefined' && console.warn(("[vue-router] " + message)); |
| 4633 |
} |
| 4634 |
} |
| 4635 |
|
| 4636 |
function extend (a, b) { |
| 4637 |
for (var key in b) { |
| 4638 |
a[key] = b[key]; |
| 4639 |
} |
| 4640 |
return a |
| 4641 |
} |
| 4642 |
|
| 4643 |
/* */ |
| 4644 |
|
| 4645 |
var encodeReserveRE = /[!'()*]/g; |
| 4646 |
var encodeReserveReplacer = function (c) { return '%' + c.charCodeAt(0).toString(16); }; |
| 4647 |
var commaRE = /%2C/g; |
| 4648 |
|
| 4649 |
// fixed encodeURIComponent which is more conformant to RFC3986: |
| 4650 |
// - escapes [!'()*] |
| 4651 |
// - preserve commas |
| 4652 |
var encode = function (str) { return encodeURIComponent(str) |
| 4653 |
.replace(encodeReserveRE, encodeReserveReplacer) |
| 4654 |
.replace(commaRE, ','); }; |
| 4655 |
|
| 4656 |
function decode (str) { |
| 4657 |
try { |
| 4658 |
return decodeURIComponent(str) |
| 4659 |
} catch (err) { |
| 4660 |
if (true) { |
| 4661 |
warn(false, ("Error decoding \"" + str + "\". Leaving it intact.")); |
| 4662 |
} |
| 4663 |
} |
| 4664 |
return str |
| 4665 |
} |
| 4666 |
|
| 4667 |
function resolveQuery ( |
| 4668 |
query, |
| 4669 |
extraQuery, |
| 4670 |
_parseQuery |
| 4671 |
) { |
| 4672 |
if ( extraQuery === void 0 ) extraQuery = {}; |
| 4673 |
|
| 4674 |
var parse = _parseQuery || parseQuery; |
| 4675 |
var parsedQuery; |
| 4676 |
try { |
| 4677 |
parsedQuery = parse(query || ''); |
| 4678 |
} catch (e) { |
| 4679 |
true && warn(false, e.message); |
| 4680 |
parsedQuery = {}; |
| 4681 |
} |
| 4682 |
for (var key in extraQuery) { |
| 4683 |
var value = extraQuery[key]; |
| 4684 |
parsedQuery[key] = Array.isArray(value) |
| 4685 |
? value.map(castQueryParamValue) |
| 4686 |
: castQueryParamValue(value); |
| 4687 |
} |
| 4688 |
return parsedQuery |
| 4689 |
} |
| 4690 |
|
| 4691 |
var castQueryParamValue = function (value) { return (value == null || typeof value === 'object' ? value : String(value)); }; |
| 4692 |
|
| 4693 |
function parseQuery (query) { |
| 4694 |
var res = {}; |
| 4695 |
|
| 4696 |
query = query.trim().replace(/^(\?|#|&)/, ''); |
| 4697 |
|
| 4698 |
if (!query) { |
| 4699 |
return res |
| 4700 |
} |
| 4701 |
|
| 4702 |
query.split('&').forEach(function (param) { |
| 4703 |
var parts = param.replace(/\+/g, ' ').split('='); |
| 4704 |
var key = decode(parts.shift()); |
| 4705 |
var val = parts.length > 0 ? decode(parts.join('=')) : null; |
| 4706 |
|
| 4707 |
if (res[key] === undefined) { |
| 4708 |
res[key] = val; |
| 4709 |
} else if (Array.isArray(res[key])) { |
| 4710 |
res[key].push(val); |
| 4711 |
} else { |
| 4712 |
res[key] = [res[key], val]; |
| 4713 |
} |
| 4714 |
}); |
| 4715 |
|
| 4716 |
return res |
| 4717 |
} |
| 4718 |
|
| 4719 |
function stringifyQuery (obj) { |
| 4720 |
var res = obj |
| 4721 |
? Object.keys(obj) |
| 4722 |
.map(function (key) { |
| 4723 |
var val = obj[key]; |
| 4724 |
|
| 4725 |
if (val === undefined) { |
| 4726 |
return '' |
| 4727 |
} |
| 4728 |
|
| 4729 |
if (val === null) { |
| 4730 |
return encode(key) |
| 4731 |
} |
| 4732 |
|
| 4733 |
if (Array.isArray(val)) { |
| 4734 |
var result = []; |
| 4735 |
val.forEach(function (val2) { |
| 4736 |
if (val2 === undefined) { |
| 4737 |
return |
| 4738 |
} |
| 4739 |
if (val2 === null) { |
| 4740 |
result.push(encode(key)); |
| 4741 |
} else { |
| 4742 |
result.push(encode(key) + '=' + encode(val2)); |
| 4743 |
} |
| 4744 |
}); |
| 4745 |
return result.join('&') |
| 4746 |
} |
| 4747 |
|
| 4748 |
return encode(key) + '=' + encode(val) |
| 4749 |
}) |
| 4750 |
.filter(function (x) { return x.length > 0; }) |
| 4751 |
.join('&') |
| 4752 |
: null; |
| 4753 |
return res ? ("?" + res) : '' |
| 4754 |
} |
| 4755 |
|
| 4756 |
/* */ |
| 4757 |
|
| 4758 |
var trailingSlashRE = /\/?$/; |
| 4759 |
|
| 4760 |
function createRoute ( |
| 4761 |
record, |
| 4762 |
location, |
| 4763 |
redirectedFrom, |
| 4764 |
router |
| 4765 |
) { |
| 4766 |
var stringifyQuery = router && router.options.stringifyQuery; |
| 4767 |
|
| 4768 |
var query = location.query || {}; |
| 4769 |
try { |
| 4770 |
query = clone(query); |
| 4771 |
} catch (e) {} |
| 4772 |
|
| 4773 |
var route = { |
| 4774 |
name: location.name || (record && record.name), |
| 4775 |
meta: (record && record.meta) || {}, |
| 4776 |
path: location.path || '/', |
| 4777 |
hash: location.hash || '', |
| 4778 |
query: query, |
| 4779 |
params: location.params || {}, |
| 4780 |
fullPath: getFullPath(location, stringifyQuery), |
| 4781 |
matched: record ? formatMatch(record) : [] |
| 4782 |
}; |
| 4783 |
if (redirectedFrom) { |
| 4784 |
route.redirectedFrom = getFullPath(redirectedFrom, stringifyQuery); |
| 4785 |
} |
| 4786 |
return Object.freeze(route) |
| 4787 |
} |
| 4788 |
|
| 4789 |
function clone (value) { |
| 4790 |
if (Array.isArray(value)) { |
| 4791 |
return value.map(clone) |
| 4792 |
} else if (value && typeof value === 'object') { |
| 4793 |
var res = {}; |
| 4794 |
for (var key in value) { |
| 4795 |
res[key] = clone(value[key]); |
| 4796 |
} |
| 4797 |
return res |
| 4798 |
} else { |
| 4799 |
return value |
| 4800 |
} |
| 4801 |
} |
| 4802 |
|
| 4803 |
// the starting route that represents the initial state |
| 4804 |
var START = createRoute(null, { |
| 4805 |
path: '/' |
| 4806 |
}); |
| 4807 |
|
| 4808 |
function formatMatch (record) { |
| 4809 |
var res = []; |
| 4810 |
while (record) { |
| 4811 |
res.unshift(record); |
| 4812 |
record = record.parent; |
| 4813 |
} |
| 4814 |
return res |
| 4815 |
} |
| 4816 |
|
| 4817 |
function getFullPath ( |
| 4818 |
ref, |
| 4819 |
_stringifyQuery |
| 4820 |
) { |
| 4821 |
var path = ref.path; |
| 4822 |
var query = ref.query; if ( query === void 0 ) query = {}; |
| 4823 |
var hash = ref.hash; if ( hash === void 0 ) hash = ''; |
| 4824 |
|
| 4825 |
var stringify = _stringifyQuery || stringifyQuery; |
| 4826 |
return (path || '/') + stringify(query) + hash |
| 4827 |
} |
| 4828 |
|
| 4829 |
function isSameRoute (a, b, onlyPath) { |
| 4830 |
if (b === START) { |
| 4831 |
return a === b |
| 4832 |
} else if (!b) { |
| 4833 |
return false |
| 4834 |
} else if (a.path && b.path) { |
| 4835 |
return a.path.replace(trailingSlashRE, '') === b.path.replace(trailingSlashRE, '') && (onlyPath || |
| 4836 |
a.hash === b.hash && |
| 4837 |
isObjectEqual(a.query, b.query)) |
| 4838 |
} else if (a.name && b.name) { |
| 4839 |
return ( |
| 4840 |
a.name === b.name && |
| 4841 |
(onlyPath || ( |
| 4842 |
a.hash === b.hash && |
| 4843 |
isObjectEqual(a.query, b.query) && |
| 4844 |
isObjectEqual(a.params, b.params)) |
| 4845 |
) |
| 4846 |
) |
| 4847 |
} else { |
| 4848 |
return false |
| 4849 |
} |
| 4850 |
} |
| 4851 |
|
| 4852 |
function isObjectEqual (a, b) { |
| 4853 |
if ( a === void 0 ) a = {}; |
| 4854 |
if ( b === void 0 ) b = {}; |
| 4855 |
|
| 4856 |
// handle null value #1566 |
| 4857 |
if (!a || !b) { return a === b } |
| 4858 |
var aKeys = Object.keys(a).sort(); |
| 4859 |
var bKeys = Object.keys(b).sort(); |
| 4860 |
if (aKeys.length !== bKeys.length) { |
| 4861 |
return false |
| 4862 |
} |
| 4863 |
return aKeys.every(function (key, i) { |
| 4864 |
var aVal = a[key]; |
| 4865 |
var bKey = bKeys[i]; |
| 4866 |
if (bKey !== key) { return false } |
| 4867 |
var bVal = b[key]; |
| 4868 |
// query values can be null and undefined |
| 4869 |
if (aVal == null || bVal == null) { return aVal === bVal } |
| 4870 |
// check nested equality |
| 4871 |
if (typeof aVal === 'object' && typeof bVal === 'object') { |
| 4872 |
return isObjectEqual(aVal, bVal) |
| 4873 |
} |
| 4874 |
return String(aVal) === String(bVal) |
| 4875 |
}) |
| 4876 |
} |
| 4877 |
|
| 4878 |
function isIncludedRoute (current, target) { |
| 4879 |
return ( |
| 4880 |
current.path.replace(trailingSlashRE, '/').indexOf( |
| 4881 |
target.path.replace(trailingSlashRE, '/') |
| 4882 |
) === 0 && |
| 4883 |
(!target.hash || current.hash === target.hash) && |
| 4884 |
queryIncludes(current.query, target.query) |
| 4885 |
) |
| 4886 |
} |
| 4887 |
|
| 4888 |
function queryIncludes (current, target) { |
| 4889 |
for (var key in target) { |
| 4890 |
if (!(key in current)) { |
| 4891 |
return false |
| 4892 |
} |
| 4893 |
} |
| 4894 |
return true |
| 4895 |
} |
| 4896 |
|
| 4897 |
function handleRouteEntered (route) { |
| 4898 |
for (var i = 0; i < route.matched.length; i++) { |
| 4899 |
var record = route.matched[i]; |
| 4900 |
for (var name in record.instances) { |
| 4901 |
var instance = record.instances[name]; |
| 4902 |
var cbs = record.enteredCbs[name]; |
| 4903 |
if (!instance || !cbs) { continue } |
| 4904 |
delete record.enteredCbs[name]; |
| 4905 |
for (var i$1 = 0; i$1 < cbs.length; i$1++) { |
| 4906 |
if (!instance._isBeingDestroyed) { cbs[i$1](instance); } |
| 4907 |
} |
| 4908 |
} |
| 4909 |
} |
| 4910 |
} |
| 4911 |
|
| 4912 |
var View = { |
| 4913 |
name: 'RouterView', |
| 4914 |
functional: true, |
| 4915 |
props: { |
| 4916 |
name: { |
| 4917 |
type: String, |
| 4918 |
default: 'default' |
| 4919 |
} |
| 4920 |
}, |
| 4921 |
render: function render (_, ref) { |
| 4922 |
var props = ref.props; |
| 4923 |
var children = ref.children; |
| 4924 |
var parent = ref.parent; |
| 4925 |
var data = ref.data; |
| 4926 |
|
| 4927 |
// used by devtools to display a router-view badge |
| 4928 |
data.routerView = true; |
| 4929 |
|
| 4930 |
// directly use parent context's createElement() function |
| 4931 |
// so that components rendered by router-view can resolve named slots |
| 4932 |
var h = parent.$createElement; |
| 4933 |
var name = props.name; |
| 4934 |
var route = parent.$route; |
| 4935 |
var cache = parent._routerViewCache || (parent._routerViewCache = {}); |
| 4936 |
|
| 4937 |
// determine current view depth, also check to see if the tree |
| 4938 |
// has been toggled inactive but kept-alive. |
| 4939 |
var depth = 0; |
| 4940 |
var inactive = false; |
| 4941 |
while (parent && parent._routerRoot !== parent) { |
| 4942 |
var vnodeData = parent.$vnode ? parent.$vnode.data : {}; |
| 4943 |
if (vnodeData.routerView) { |
| 4944 |
depth++; |
| 4945 |
} |
| 4946 |
if (vnodeData.keepAlive && parent._directInactive && parent._inactive) { |
| 4947 |
inactive = true; |
| 4948 |
} |
| 4949 |
parent = parent.$parent; |
| 4950 |
} |
| 4951 |
data.routerViewDepth = depth; |
| 4952 |
|
| 4953 |
// render previous view if the tree is inactive and kept-alive |
| 4954 |
if (inactive) { |
| 4955 |
var cachedData = cache[name]; |
| 4956 |
var cachedComponent = cachedData && cachedData.component; |
| 4957 |
if (cachedComponent) { |
| 4958 |
// #2301 |
| 4959 |
// pass props |
| 4960 |
if (cachedData.configProps) { |
| 4961 |
fillPropsinData(cachedComponent, data, cachedData.route, cachedData.configProps); |
| 4962 |
} |
| 4963 |
return h(cachedComponent, data, children) |
| 4964 |
} else { |
| 4965 |
// render previous empty view |
| 4966 |
return h() |
| 4967 |
} |
| 4968 |
} |
| 4969 |
|
| 4970 |
var matched = route.matched[depth]; |
| 4971 |
var component = matched && matched.components[name]; |
| 4972 |
|
| 4973 |
// render empty node if no matched route or no config component |
| 4974 |
if (!matched || !component) { |
| 4975 |
cache[name] = null; |
| 4976 |
return h() |
| 4977 |
} |
| 4978 |
|
| 4979 |
// cache component |
| 4980 |
cache[name] = { component: component }; |
| 4981 |
|
| 4982 |
// attach instance registration hook |
| 4983 |
// this will be called in the instance's injected lifecycle hooks |
| 4984 |
data.registerRouteInstance = function (vm, val) { |
| 4985 |
// val could be undefined for unregistration |
| 4986 |
var current = matched.instances[name]; |
| 4987 |
if ( |
| 4988 |
(val && current !== vm) || |
| 4989 |
(!val && current === vm) |
| 4990 |
) { |
| 4991 |
matched.instances[name] = val; |
| 4992 |
} |
| 4993 |
} |
| 4994 |
|
| 4995 |
// also register instance in prepatch hook |
| 4996 |
// in case the same component instance is reused across different routes |
| 4997 |
;(data.hook || (data.hook = {})).prepatch = function (_, vnode) { |
| 4998 |
matched.instances[name] = vnode.componentInstance; |
| 4999 |
}; |
| 5000 |
|
| 5001 |
// register instance in init hook |
| 5002 |
// in case kept-alive component be actived when routes changed |
| 5003 |
data.hook.init = function (vnode) { |
| 5004 |
if (vnode.data.keepAlive && |
| 5005 |
vnode.componentInstance && |
| 5006 |
vnode.componentInstance !== matched.instances[name] |
| 5007 |
) { |
| 5008 |
matched.instances[name] = vnode.componentInstance; |
| 5009 |
} |
| 5010 |
|
| 5011 |
// if the route transition has already been confirmed then we weren't |
| 5012 |
// able to call the cbs during confirmation as the component was not |
| 5013 |
// registered yet, so we call it here. |
| 5014 |
handleRouteEntered(route); |
| 5015 |
}; |
| 5016 |
|
| 5017 |
var configProps = matched.props && matched.props[name]; |
| 5018 |
// save route and configProps in cache |
| 5019 |
if (configProps) { |
| 5020 |
extend(cache[name], { |
| 5021 |
route: route, |
| 5022 |
configProps: configProps |
| 5023 |
}); |
| 5024 |
fillPropsinData(component, data, route, configProps); |
| 5025 |
} |
| 5026 |
|
| 5027 |
return h(component, data, children) |
| 5028 |
} |
| 5029 |
}; |
| 5030 |
|
| 5031 |
function fillPropsinData (component, data, route, configProps) { |
| 5032 |
// resolve props |
| 5033 |
var propsToPass = data.props = resolveProps(route, configProps); |
| 5034 |
if (propsToPass) { |
| 5035 |
// clone to prevent mutation |
| 5036 |
propsToPass = data.props = extend({}, propsToPass); |
| 5037 |
// pass non-declared props as attrs |
| 5038 |
var attrs = data.attrs = data.attrs || {}; |
| 5039 |
for (var key in propsToPass) { |
| 5040 |
if (!component.props || !(key in component.props)) { |
| 5041 |
attrs[key] = propsToPass[key]; |
| 5042 |
delete propsToPass[key]; |
| 5043 |
} |
| 5044 |
} |
| 5045 |
} |
| 5046 |
} |
| 5047 |
|
| 5048 |
function resolveProps (route, config) { |
| 5049 |
switch (typeof config) { |
| 5050 |
case 'undefined': |
| 5051 |
return |
| 5052 |
case 'object': |
| 5053 |
return config |
| 5054 |
case 'function': |
| 5055 |
return config(route) |
| 5056 |
case 'boolean': |
| 5057 |
return config ? route.params : undefined |
| 5058 |
default: |
| 5059 |
if (true) { |
| 5060 |
warn( |
| 5061 |
false, |
| 5062 |
"props in \"" + (route.path) + "\" is a " + (typeof config) + ", " + |
| 5063 |
"expecting an object, function or boolean." |
| 5064 |
); |
| 5065 |
} |
| 5066 |
} |
| 5067 |
} |
| 5068 |
|
| 5069 |
/* */ |
| 5070 |
|
| 5071 |
function resolvePath ( |
| 5072 |
relative, |
| 5073 |
base, |
| 5074 |
append |
| 5075 |
) { |
| 5076 |
var firstChar = relative.charAt(0); |
| 5077 |
if (firstChar === '/') { |
| 5078 |
return relative |
| 5079 |
} |
| 5080 |
|
| 5081 |
if (firstChar === '?' || firstChar === '#') { |
| 5082 |
return base + relative |
| 5083 |
} |
| 5084 |
|
| 5085 |
var stack = base.split('/'); |
| 5086 |
|
| 5087 |
// remove trailing segment if: |
| 5088 |
// - not appending |
| 5089 |
// - appending to trailing slash (last segment is empty) |
| 5090 |
if (!append || !stack[stack.length - 1]) { |
| 5091 |
stack.pop(); |
| 5092 |
} |
| 5093 |
|
| 5094 |
// resolve relative path |
| 5095 |
var segments = relative.replace(/^\//, '').split('/'); |
| 5096 |
for (var i = 0; i < segments.length; i++) { |
| 5097 |
var segment = segments[i]; |
| 5098 |
if (segment === '..') { |
| 5099 |
stack.pop(); |
| 5100 |
} else if (segment !== '.') { |
| 5101 |
stack.push(segment); |
| 5102 |
} |
| 5103 |
} |
| 5104 |
|
| 5105 |
// ensure leading slash |
| 5106 |
if (stack[0] !== '') { |
| 5107 |
stack.unshift(''); |
| 5108 |
} |
| 5109 |
|
| 5110 |
return stack.join('/') |
| 5111 |
} |
| 5112 |
|
| 5113 |
function parsePath (path) { |
| 5114 |
var hash = ''; |
| 5115 |
var query = ''; |
| 5116 |
|
| 5117 |
var hashIndex = path.indexOf('#'); |
| 5118 |
if (hashIndex >= 0) { |
| 5119 |
hash = path.slice(hashIndex); |
| 5120 |
path = path.slice(0, hashIndex); |
| 5121 |
} |
| 5122 |
|
| 5123 |
var queryIndex = path.indexOf('?'); |
| 5124 |
if (queryIndex >= 0) { |
| 5125 |
query = path.slice(queryIndex + 1); |
| 5126 |
path = path.slice(0, queryIndex); |
| 5127 |
} |
| 5128 |
|
| 5129 |
return { |
| 5130 |
path: path, |
| 5131 |
query: query, |
| 5132 |
hash: hash |
| 5133 |
} |
| 5134 |
} |
| 5135 |
|
| 5136 |
function cleanPath (path) { |
| 5137 |
return path.replace(/\/\//g, '/') |
| 5138 |
} |
| 5139 |
|
| 5140 |
var isarray = Array.isArray || function (arr) { |
| 5141 |
return Object.prototype.toString.call(arr) == '[object Array]'; |
| 5142 |
}; |
| 5143 |
|
| 5144 |
/** |
| 5145 |
* Expose `pathToRegexp`. |
| 5146 |
*/ |
| 5147 |
var pathToRegexp_1 = pathToRegexp; |
| 5148 |
var parse_1 = parse; |
| 5149 |
var compile_1 = compile; |
| 5150 |
var tokensToFunction_1 = tokensToFunction; |
| 5151 |
var tokensToRegExp_1 = tokensToRegExp; |
| 5152 |
|
| 5153 |
/** |
| 5154 |
* The main path matching regexp utility. |
| 5155 |
* |
| 5156 |
* @type {RegExp} |
| 5157 |
*/ |
| 5158 |
var PATH_REGEXP = new RegExp([ |
| 5159 |
// Match escaped characters that would otherwise appear in future matches. |
| 5160 |
// This allows the user to escape special characters that won't transform. |
| 5161 |
'(\\\\.)', |
| 5162 |
// Match Express-style parameters and un-named parameters with a prefix |
| 5163 |
// and optional suffixes. Matches appear as: |
| 5164 |
// |
| 5165 |
// "/:test(\\d+)?" => ["/", "test", "\d+", undefined, "?", undefined] |
| 5166 |
// "/route(\\d+)" => [undefined, undefined, undefined, "\d+", undefined, undefined] |
| 5167 |
// "/*" => ["/", undefined, undefined, undefined, undefined, "*"] |
| 5168 |
'([\\/.])?(?:(?:\\:(\\w+)(?:\\(((?:\\\\.|[^\\\\()])+)\\))?|\\(((?:\\\\.|[^\\\\()])+)\\))([+*?])?|(\\*))' |
| 5169 |
].join('|'), 'g'); |
| 5170 |
|
| 5171 |
/** |
| 5172 |
* Parse a string for the raw tokens. |
| 5173 |
* |
| 5174 |
* @param {string} str |
| 5175 |
* @param {Object=} options |
| 5176 |
* @return {!Array} |
| 5177 |
*/ |
| 5178 |
function parse (str, options) { |
| 5179 |
var tokens = []; |
| 5180 |
var key = 0; |
| 5181 |
var index = 0; |
| 5182 |
var path = ''; |
| 5183 |
var defaultDelimiter = options && options.delimiter || '/'; |
| 5184 |
var res; |
| 5185 |
|
| 5186 |
while ((res = PATH_REGEXP.exec(str)) != null) { |
| 5187 |
var m = res[0]; |
| 5188 |
var escaped = res[1]; |
| 5189 |
var offset = res.index; |
| 5190 |
path += str.slice(index, offset); |
| 5191 |
index = offset + m.length; |
| 5192 |
|
| 5193 |
// Ignore already escaped sequences. |
| 5194 |
if (escaped) { |
| 5195 |
path += escaped[1]; |
| 5196 |
continue |
| 5197 |
} |
| 5198 |
|
| 5199 |
var next = str[index]; |
| 5200 |
var prefix = res[2]; |
| 5201 |
var name = res[3]; |
| 5202 |
var capture = res[4]; |
| 5203 |
var group = res[5]; |
| 5204 |
var modifier = res[6]; |
| 5205 |
var asterisk = res[7]; |
| 5206 |
|
| 5207 |
// Push the current path onto the tokens. |
| 5208 |
if (path) { |
| 5209 |
tokens.push(path); |
| 5210 |
path = ''; |
| 5211 |
} |
| 5212 |
|
| 5213 |
var partial = prefix != null && next != null && next !== prefix; |
| 5214 |
var repeat = modifier === '+' || modifier === '*'; |
| 5215 |
var optional = modifier === '?' || modifier === '*'; |
| 5216 |
var delimiter = res[2] || defaultDelimiter; |
| 5217 |
var pattern = capture || group; |
| 5218 |
|
| 5219 |
tokens.push({ |
| 5220 |
name: name || key++, |
| 5221 |
prefix: prefix || '', |
| 5222 |
delimiter: delimiter, |
| 5223 |
optional: optional, |
| 5224 |
repeat: repeat, |
| 5225 |
partial: partial, |
| 5226 |
asterisk: !!asterisk, |
| 5227 |
pattern: pattern ? escapeGroup(pattern) : (asterisk ? '.*' : '[^' + escapeString(delimiter) + ']+?') |
| 5228 |
}); |
| 5229 |
} |
| 5230 |
|
| 5231 |
// Match any characters still remaining. |
| 5232 |
if (index < str.length) { |
| 5233 |
path += str.substr(index); |
| 5234 |
} |
| 5235 |
|
| 5236 |
// If the path exists, push it onto the end. |
| 5237 |
if (path) { |
| 5238 |
tokens.push(path); |
| 5239 |
} |
| 5240 |
|
| 5241 |
return tokens |
| 5242 |
} |
| 5243 |
|
| 5244 |
/** |
| 5245 |
* Compile a string to a template function for the path. |
| 5246 |
* |
| 5247 |
* @param {string} str |
| 5248 |
* @param {Object=} options |
| 5249 |
* @return {!function(Object=, Object=)} |
| 5250 |
*/ |
| 5251 |
function compile (str, options) { |
| 5252 |
return tokensToFunction(parse(str, options), options) |
| 5253 |
} |
| 5254 |
|
| 5255 |
/** |
| 5256 |
* Prettier encoding of URI path segments. |
| 5257 |
* |
| 5258 |
* @param {string} |
| 5259 |
* @return {string} |
| 5260 |
*/ |
| 5261 |
function encodeURIComponentPretty (str) { |
| 5262 |
return encodeURI(str).replace(/[\/?#]/g, function (c) { |
| 5263 |
return '%' + c.charCodeAt(0).toString(16).toUpperCase() |
| 5264 |
}) |
| 5265 |
} |
| 5266 |
|
| 5267 |
/** |
| 5268 |
* Encode the asterisk parameter. Similar to `pretty`, but allows slashes. |
| 5269 |
* |
| 5270 |
* @param {string} |
| 5271 |
* @return {string} |
| 5272 |
*/ |
| 5273 |
function encodeAsterisk (str) { |
| 5274 |
return encodeURI(str).replace(/[?#]/g, function (c) { |
| 5275 |
return '%' + c.charCodeAt(0).toString(16).toUpperCase() |
| 5276 |
}) |
| 5277 |
} |
| 5278 |
|
| 5279 |
/** |
| 5280 |
* Expose a method for transforming tokens into the path function. |
| 5281 |
*/ |
| 5282 |
function tokensToFunction (tokens, options) { |
| 5283 |
// Compile all the tokens into regexps. |
| 5284 |
var matches = new Array(tokens.length); |
| 5285 |
|
| 5286 |
// Compile all the patterns before compilation. |
| 5287 |
for (var i = 0; i < tokens.length; i++) { |
| 5288 |
if (typeof tokens[i] === 'object') { |
| 5289 |
matches[i] = new RegExp('^(?:' + tokens[i].pattern + ')$', flags(options)); |
| 5290 |
} |
| 5291 |
} |
| 5292 |
|
| 5293 |
return function (obj, opts) { |
| 5294 |
var path = ''; |
| 5295 |
var data = obj || {}; |
| 5296 |
var options = opts || {}; |
| 5297 |
var encode = options.pretty ? encodeURIComponentPretty : encodeURIComponent; |
| 5298 |
|
| 5299 |
for (var i = 0; i < tokens.length; i++) { |
| 5300 |
var token = tokens[i]; |
| 5301 |
|
| 5302 |
if (typeof token === 'string') { |
| 5303 |
path += token; |
| 5304 |
|
| 5305 |
continue |
| 5306 |
} |
| 5307 |
|
| 5308 |
var value = data[token.name]; |
| 5309 |
var segment; |
| 5310 |
|
| 5311 |
if (value == null) { |
| 5312 |
if (token.optional) { |
| 5313 |
// Prepend partial segment prefixes. |
| 5314 |
if (token.partial) { |
| 5315 |
path += token.prefix; |
| 5316 |
} |
| 5317 |
|
| 5318 |
continue |
| 5319 |
} else { |
| 5320 |
throw new TypeError('Expected "' + token.name + '" to be defined') |
| 5321 |
} |
| 5322 |
} |
| 5323 |
|
| 5324 |
if (isarray(value)) { |
| 5325 |
if (!token.repeat) { |
| 5326 |
throw new TypeError('Expected "' + token.name + '" to not repeat, but received `' + JSON.stringify(value) + '`') |
| 5327 |
} |
| 5328 |
|
| 5329 |
if (value.length === 0) { |
| 5330 |
if (token.optional) { |
| 5331 |
continue |
| 5332 |
} else { |
| 5333 |
throw new TypeError('Expected "' + token.name + '" to not be empty') |
| 5334 |
} |
| 5335 |
} |
| 5336 |
|
| 5337 |
for (var j = 0; j < value.length; j++) { |
| 5338 |
segment = encode(value[j]); |
| 5339 |
|
| 5340 |
if (!matches[i].test(segment)) { |
| 5341 |
throw new TypeError('Expected all "' + token.name + '" to match "' + token.pattern + '", but received `' + JSON.stringify(segment) + '`') |
| 5342 |
} |
| 5343 |
|
| 5344 |
path += (j === 0 ? token.prefix : token.delimiter) + segment; |
| 5345 |
} |
| 5346 |
|
| 5347 |
continue |
| 5348 |
} |
| 5349 |
|
| 5350 |
segment = token.asterisk ? encodeAsterisk(value) : encode(value); |
| 5351 |
|
| 5352 |
if (!matches[i].test(segment)) { |
| 5353 |
throw new TypeError('Expected "' + token.name + '" to match "' + token.pattern + '", but received "' + segment + '"') |
| 5354 |
} |
| 5355 |
|
| 5356 |
path += token.prefix + segment; |
| 5357 |
} |
| 5358 |
|
| 5359 |
return path |
| 5360 |
} |
| 5361 |
} |
| 5362 |
|
| 5363 |
/** |
| 5364 |
* Escape a regular expression string. |
| 5365 |
* |
| 5366 |
* @param {string} str |
| 5367 |
* @return {string} |
| 5368 |
*/ |
| 5369 |
function escapeString (str) { |
| 5370 |
return str.replace(/([.+*?=^!:${}()[\]|\/\\])/g, '\\$1') |
| 5371 |
} |
| 5372 |
|
| 5373 |
/** |
| 5374 |
* Escape the capturing group by escaping special characters and meaning. |
| 5375 |
* |
| 5376 |
* @param {string} group |
| 5377 |
* @return {string} |
| 5378 |
*/ |
| 5379 |
function escapeGroup (group) { |
| 5380 |
return group.replace(/([=!:$\/()])/g, '\\$1') |
| 5381 |
} |
| 5382 |
|
| 5383 |
/** |
| 5384 |
* Attach the keys as a property of the regexp. |
| 5385 |
* |
| 5386 |
* @param {!RegExp} re |
| 5387 |
* @param {Array} keys |
| 5388 |
* @return {!RegExp} |
| 5389 |
*/ |
| 5390 |
function attachKeys (re, keys) { |
| 5391 |
re.keys = keys; |
| 5392 |
return re |
| 5393 |
} |
| 5394 |
|
| 5395 |
/** |
| 5396 |
* Get the flags for a regexp from the options. |
| 5397 |
* |
| 5398 |
* @param {Object} options |
| 5399 |
* @return {string} |
| 5400 |
*/ |
| 5401 |
function flags (options) { |
| 5402 |
return options && options.sensitive ? '' : 'i' |
| 5403 |
} |
| 5404 |
|
| 5405 |
/** |
| 5406 |
* Pull out keys from a regexp. |
| 5407 |
* |
| 5408 |
* @param {!RegExp} path |
| 5409 |
* @param {!Array} keys |
| 5410 |
* @return {!RegExp} |
| 5411 |
*/ |
| 5412 |
function regexpToRegexp (path, keys) { |
| 5413 |
// Use a negative lookahead to match only capturing groups. |
| 5414 |
var groups = path.source.match(/\((?!\?)/g); |
| 5415 |
|
| 5416 |
if (groups) { |
| 5417 |
for (var i = 0; i < groups.length; i++) { |
| 5418 |
keys.push({ |
| 5419 |
name: i, |
| 5420 |
prefix: null, |
| 5421 |
delimiter: null, |
| 5422 |
optional: false, |
| 5423 |
repeat: false, |
| 5424 |
partial: false, |
| 5425 |
asterisk: false, |
| 5426 |
pattern: null |
| 5427 |
}); |
| 5428 |
} |
| 5429 |
} |
| 5430 |
|
| 5431 |
return attachKeys(path, keys) |
| 5432 |
} |
| 5433 |
|
| 5434 |
/** |
| 5435 |
* Transform an array into a regexp. |
| 5436 |
* |
| 5437 |
* @param {!Array} path |
| 5438 |
* @param {Array} keys |
| 5439 |
* @param {!Object} options |
| 5440 |
* @return {!RegExp} |
| 5441 |
*/ |
| 5442 |
function arrayToRegexp (path, keys, options) { |
| 5443 |
var parts = []; |
| 5444 |
|
| 5445 |
for (var i = 0; i < path.length; i++) { |
| 5446 |
parts.push(pathToRegexp(path[i], keys, options).source); |
| 5447 |
} |
| 5448 |
|
| 5449 |
var regexp = new RegExp('(?:' + parts.join('|') + ')', flags(options)); |
| 5450 |
|
| 5451 |
return attachKeys(regexp, keys) |
| 5452 |
} |
| 5453 |
|
| 5454 |
/** |
| 5455 |
* Create a path regexp from string input. |
| 5456 |
* |
| 5457 |
* @param {string} path |
| 5458 |
* @param {!Array} keys |
| 5459 |
* @param {!Object} options |
| 5460 |
* @return {!RegExp} |
| 5461 |
*/ |
| 5462 |
function stringToRegexp (path, keys, options) { |
| 5463 |
return tokensToRegExp(parse(path, options), keys, options) |
| 5464 |
} |
| 5465 |
|
| 5466 |
/** |
| 5467 |
* Expose a function for taking tokens and returning a RegExp. |
| 5468 |
* |
| 5469 |
* @param {!Array} tokens |
| 5470 |
* @param {(Array|Object)=} keys |
| 5471 |
* @param {Object=} options |
| 5472 |
* @return {!RegExp} |
| 5473 |
*/ |
| 5474 |
function tokensToRegExp (tokens, keys, options) { |
| 5475 |
if (!isarray(keys)) { |
| 5476 |
options = /** @type {!Object} */ (keys || options); |
| 5477 |
keys = []; |
| 5478 |
} |
| 5479 |
|
| 5480 |
options = options || {}; |
| 5481 |
|
| 5482 |
var strict = options.strict; |
| 5483 |
var end = options.end !== false; |
| 5484 |
var route = ''; |
| 5485 |
|
| 5486 |
// Iterate over the tokens and create our regexp string. |
| 5487 |
for (var i = 0; i < tokens.length; i++) { |
| 5488 |
var token = tokens[i]; |
| 5489 |
|
| 5490 |
if (typeof token === 'string') { |
| 5491 |
route += escapeString(token); |
| 5492 |
} else { |
| 5493 |
var prefix = escapeString(token.prefix); |
| 5494 |
var capture = '(?:' + token.pattern + ')'; |
| 5495 |
|
| 5496 |
keys.push(token); |
| 5497 |
|
| 5498 |
if (token.repeat) { |
| 5499 |
capture += '(?:' + prefix + capture + ')*'; |
| 5500 |
} |
| 5501 |
|
| 5502 |
if (token.optional) { |
| 5503 |
if (!token.partial) { |
| 5504 |
capture = '(?:' + prefix + '(' + capture + '))?'; |
| 5505 |
} else { |
| 5506 |
capture = prefix + '(' + capture + ')?'; |
| 5507 |
} |
| 5508 |
} else { |
| 5509 |
capture = prefix + '(' + capture + ')'; |
| 5510 |
} |
| 5511 |
|
| 5512 |
route += capture; |
| 5513 |
} |
| 5514 |
} |
| 5515 |
|
| 5516 |
var delimiter = escapeString(options.delimiter || '/'); |
| 5517 |
var endsWithDelimiter = route.slice(-delimiter.length) === delimiter; |
| 5518 |
|
| 5519 |
// In non-strict mode we allow a slash at the end of match. If the path to |
| 5520 |
// match already ends with a slash, we remove it for consistency. The slash |
| 5521 |
// is valid at the end of a path match, not in the middle. This is important |
| 5522 |
// in non-ending mode, where "/test/" shouldn't match "/test//route". |
| 5523 |
if (!strict) { |
| 5524 |
route = (endsWithDelimiter ? route.slice(0, -delimiter.length) : route) + '(?:' + delimiter + '(?=$))?'; |
| 5525 |
} |
| 5526 |
|
| 5527 |
if (end) { |
| 5528 |
route += '$'; |
| 5529 |
} else { |
| 5530 |
// In non-ending mode, we need the capturing groups to match as much as |
| 5531 |
// possible by using a positive lookahead to the end or next path segment. |
| 5532 |
route += strict && endsWithDelimiter ? '' : '(?=' + delimiter + '|$)'; |
| 5533 |
} |
| 5534 |
|
| 5535 |
return attachKeys(new RegExp('^' + route, flags(options)), keys) |
| 5536 |
} |
| 5537 |
|
| 5538 |
/** |
| 5539 |
* Normalize the given path string, returning a regular expression. |
| 5540 |
* |
| 5541 |
* An empty array can be passed in for the keys, which will hold the |
| 5542 |
* placeholder key descriptions. For example, using `/user/:id`, `keys` will |
| 5543 |
* contain `[{ name: 'id', delimiter: '/', optional: false, repeat: false }]`. |
| 5544 |
* |
| 5545 |
* @param {(string|RegExp|Array)} path |
| 5546 |
* @param {(Array|Object)=} keys |
| 5547 |
* @param {Object=} options |
| 5548 |
* @return {!RegExp} |
| 5549 |
*/ |
| 5550 |
function pathToRegexp (path, keys, options) { |
| 5551 |
if (!isarray(keys)) { |
| 5552 |
options = /** @type {!Object} */ (keys || options); |
| 5553 |
keys = []; |
| 5554 |
} |
| 5555 |
|
| 5556 |
options = options || {}; |
| 5557 |
|
| 5558 |
if (path instanceof RegExp) { |
| 5559 |
return regexpToRegexp(path, /** @type {!Array} */ (keys)) |
| 5560 |
} |
| 5561 |
|
| 5562 |
if (isarray(path)) { |
| 5563 |
return arrayToRegexp(/** @type {!Array} */ (path), /** @type {!Array} */ (keys), options) |
| 5564 |
} |
| 5565 |
|
| 5566 |
return stringToRegexp(/** @type {string} */ (path), /** @type {!Array} */ (keys), options) |
| 5567 |
} |
| 5568 |
pathToRegexp_1.parse = parse_1; |
| 5569 |
pathToRegexp_1.compile = compile_1; |
| 5570 |
pathToRegexp_1.tokensToFunction = tokensToFunction_1; |
| 5571 |
pathToRegexp_1.tokensToRegExp = tokensToRegExp_1; |
| 5572 |
|
| 5573 |
/* */ |
| 5574 |
|
| 5575 |
// $flow-disable-line |
| 5576 |
var regexpCompileCache = Object.create(null); |
| 5577 |
|
| 5578 |
function fillParams ( |
| 5579 |
path, |
| 5580 |
params, |
| 5581 |
routeMsg |
| 5582 |
) { |
| 5583 |
params = params || {}; |
| 5584 |
try { |
| 5585 |
var filler = |
| 5586 |
regexpCompileCache[path] || |
| 5587 |
(regexpCompileCache[path] = pathToRegexp_1.compile(path)); |
| 5588 |
|
| 5589 |
// Fix #2505 resolving asterisk routes { name: 'not-found', params: { pathMatch: '/not-found' }} |
| 5590 |
// and fix #3106 so that you can work with location descriptor object having params.pathMatch equal to empty string |
| 5591 |
if (typeof params.pathMatch === 'string') { params[0] = params.pathMatch; } |
| 5592 |
|
| 5593 |
return filler(params, { pretty: true }) |
| 5594 |
} catch (e) { |
| 5595 |
if (true) { |
| 5596 |
// Fix #3072 no warn if `pathMatch` is string |
| 5597 |
warn(typeof params.pathMatch === 'string', ("missing param for " + routeMsg + ": " + (e.message))); |
| 5598 |
} |
| 5599 |
return '' |
| 5600 |
} finally { |
| 5601 |
// delete the 0 if it was added |
| 5602 |
delete params[0]; |
| 5603 |
} |
| 5604 |
} |
| 5605 |
|
| 5606 |
/* */ |
| 5607 |
|
| 5608 |
function normalizeLocation ( |
| 5609 |
raw, |
| 5610 |
current, |
| 5611 |
append, |
| 5612 |
router |
| 5613 |
) { |
| 5614 |
var next = typeof raw === 'string' ? { path: raw } : raw; |
| 5615 |
// named target |
| 5616 |
if (next._normalized) { |
| 5617 |
return next |
| 5618 |
} else if (next.name) { |
| 5619 |
next = extend({}, raw); |
| 5620 |
var params = next.params; |
| 5621 |
if (params && typeof params === 'object') { |
| 5622 |
next.params = extend({}, params); |
| 5623 |
} |
| 5624 |
return next |
| 5625 |
} |
| 5626 |
|
| 5627 |
// relative params |
| 5628 |
if (!next.path && next.params && current) { |
| 5629 |
next = extend({}, next); |
| 5630 |
next._normalized = true; |
| 5631 |
var params$1 = extend(extend({}, current.params), next.params); |
| 5632 |
if (current.name) { |
| 5633 |
next.name = current.name; |
| 5634 |
next.params = params$1; |
| 5635 |
} else if (current.matched.length) { |
| 5636 |
var rawPath = current.matched[current.matched.length - 1].path; |
| 5637 |
next.path = fillParams(rawPath, params$1, ("path " + (current.path))); |
| 5638 |
} else if (true) { |
| 5639 |
warn(false, "relative params navigation requires a current route."); |
| 5640 |
} |
| 5641 |
return next |
| 5642 |
} |
| 5643 |
|
| 5644 |
var parsedPath = parsePath(next.path || ''); |
| 5645 |
var basePath = (current && current.path) || '/'; |
| 5646 |
var path = parsedPath.path |
| 5647 |
? resolvePath(parsedPath.path, basePath, append || next.append) |
| 5648 |
: basePath; |
| 5649 |
|
| 5650 |
var query = resolveQuery( |
| 5651 |
parsedPath.query, |
| 5652 |
next.query, |
| 5653 |
router && router.options.parseQuery |
| 5654 |
); |
| 5655 |
|
| 5656 |
var hash = next.hash || parsedPath.hash; |
| 5657 |
if (hash && hash.charAt(0) !== '#') { |
| 5658 |
hash = "#" + hash; |
| 5659 |
} |
| 5660 |
|
| 5661 |
return { |
| 5662 |
_normalized: true, |
| 5663 |
path: path, |
| 5664 |
query: query, |
| 5665 |
hash: hash |
| 5666 |
} |
| 5667 |
} |
| 5668 |
|
| 5669 |
/* */ |
| 5670 |
|
| 5671 |
// work around weird flow bug |
| 5672 |
var toTypes = [String, Object]; |
| 5673 |
var eventTypes = [String, Array]; |
| 5674 |
|
| 5675 |
var noop = function () {}; |
| 5676 |
|
| 5677 |
var warnedCustomSlot; |
| 5678 |
var warnedTagProp; |
| 5679 |
var warnedEventProp; |
| 5680 |
|
| 5681 |
var Link = { |
| 5682 |
name: 'RouterLink', |
| 5683 |
props: { |
| 5684 |
to: { |
| 5685 |
type: toTypes, |
| 5686 |
required: true |
| 5687 |
}, |
| 5688 |
tag: { |
| 5689 |
type: String, |
| 5690 |
default: 'a' |
| 5691 |
}, |
| 5692 |
custom: Boolean, |
| 5693 |
exact: Boolean, |
| 5694 |
exactPath: Boolean, |
| 5695 |
append: Boolean, |
| 5696 |
replace: Boolean, |
| 5697 |
activeClass: String, |
| 5698 |
exactActiveClass: String, |
| 5699 |
ariaCurrentValue: { |
| 5700 |
type: String, |
| 5701 |
default: 'page' |
| 5702 |
}, |
| 5703 |
event: { |
| 5704 |
type: eventTypes, |
| 5705 |
default: 'click' |
| 5706 |
} |
| 5707 |
}, |
| 5708 |
render: function render (h) { |
| 5709 |
var this$1 = this; |
| 5710 |
|
| 5711 |
var router = this.$router; |
| 5712 |
var current = this.$route; |
| 5713 |
var ref = router.resolve( |
| 5714 |
this.to, |
| 5715 |
current, |
| 5716 |
this.append |
| 5717 |
); |
| 5718 |
var location = ref.location; |
| 5719 |
var route = ref.route; |
| 5720 |
var href = ref.href; |
| 5721 |
|
| 5722 |
var classes = {}; |
| 5723 |
var globalActiveClass = router.options.linkActiveClass; |
| 5724 |
var globalExactActiveClass = router.options.linkExactActiveClass; |
| 5725 |
// Support global empty active class |
| 5726 |
var activeClassFallback = |
| 5727 |
globalActiveClass == null ? 'router-link-active' : globalActiveClass; |
| 5728 |
var exactActiveClassFallback = |
| 5729 |
globalExactActiveClass == null |
| 5730 |
? 'router-link-exact-active' |
| 5731 |
: globalExactActiveClass; |
| 5732 |
var activeClass = |
| 5733 |
this.activeClass == null ? activeClassFallback : this.activeClass; |
| 5734 |
var exactActiveClass = |
| 5735 |
this.exactActiveClass == null |
| 5736 |
? exactActiveClassFallback |
| 5737 |
: this.exactActiveClass; |
| 5738 |
|
| 5739 |
var compareTarget = route.redirectedFrom |
| 5740 |
? createRoute(null, normalizeLocation(route.redirectedFrom), null, router) |
| 5741 |
: route; |
| 5742 |
|
| 5743 |
classes[exactActiveClass] = isSameRoute(current, compareTarget, this.exactPath); |
| 5744 |
classes[activeClass] = this.exact || this.exactPath |
| 5745 |
? classes[exactActiveClass] |
| 5746 |
: isIncludedRoute(current, compareTarget); |
| 5747 |
|
| 5748 |
var ariaCurrentValue = classes[exactActiveClass] ? this.ariaCurrentValue : null; |
| 5749 |
|
| 5750 |
var handler = function (e) { |
| 5751 |
if (guardEvent(e)) { |
| 5752 |
if (this$1.replace) { |
| 5753 |
router.replace(location, noop); |
| 5754 |
} else { |
| 5755 |
router.push(location, noop); |
| 5756 |
} |
| 5757 |
} |
| 5758 |
}; |
| 5759 |
|
| 5760 |
var on = { click: guardEvent }; |
| 5761 |
if (Array.isArray(this.event)) { |
| 5762 |
this.event.forEach(function (e) { |
| 5763 |
on[e] = handler; |
| 5764 |
}); |
| 5765 |
} else { |
| 5766 |
on[this.event] = handler; |
| 5767 |
} |
| 5768 |
|
| 5769 |
var data = { class: classes }; |
| 5770 |
|
| 5771 |
var scopedSlot = |
| 5772 |
!this.$scopedSlots.$hasNormal && |
| 5773 |
this.$scopedSlots.default && |
| 5774 |
this.$scopedSlots.default({ |
| 5775 |
href: href, |
| 5776 |
route: route, |
| 5777 |
navigate: handler, |
| 5778 |
isActive: classes[activeClass], |
| 5779 |
isExactActive: classes[exactActiveClass] |
| 5780 |
}); |
| 5781 |
|
| 5782 |
if (scopedSlot) { |
| 5783 |
if ( true && !this.custom) { |
| 5784 |
!warnedCustomSlot && warn(false, 'In Vue Router 4, the v-slot API will by default wrap its content with an <a> element. Use the custom prop to remove this warning:\n<router-link v-slot="{ navigate, href }" custom></router-link>\n'); |
| 5785 |
warnedCustomSlot = true; |
| 5786 |
} |
| 5787 |
if (scopedSlot.length === 1) { |
| 5788 |
return scopedSlot[0] |
| 5789 |
} else if (scopedSlot.length > 1 || !scopedSlot.length) { |
| 5790 |
if (true) { |
| 5791 |
warn( |
| 5792 |
false, |
| 5793 |
("<router-link> with to=\"" + (this.to) + "\" is trying to use a scoped slot but it didn't provide exactly one child. Wrapping the content with a span element.") |
| 5794 |
); |
| 5795 |
} |
| 5796 |
return scopedSlot.length === 0 ? h() : h('span', {}, scopedSlot) |
| 5797 |
} |
| 5798 |
} |
| 5799 |
|
| 5800 |
if (true) { |
| 5801 |
if ('tag' in this.$options.propsData && !warnedTagProp) { |
| 5802 |
warn( |
| 5803 |
false, |
| 5804 |
"<router-link>'s tag prop is deprecated and has been removed in Vue Router 4. Use the v-slot API to remove this warning: https://next.router.vuejs.org/guide/migration/#removal-of-event-and-tag-props-in-router-link." |
| 5805 |
); |
| 5806 |
warnedTagProp = true; |
| 5807 |
} |
| 5808 |
if ('event' in this.$options.propsData && !warnedEventProp) { |
| 5809 |
warn( |
| 5810 |
false, |
| 5811 |
"<router-link>'s event prop is deprecated and has been removed in Vue Router 4. Use the v-slot API to remove this warning: https://next.router.vuejs.org/guide/migration/#removal-of-event-and-tag-props-in-router-link." |
| 5812 |
); |
| 5813 |
warnedEventProp = true; |
| 5814 |
} |
| 5815 |
} |
| 5816 |
|
| 5817 |
if (this.tag === 'a') { |
| 5818 |
data.on = on; |
| 5819 |
data.attrs = { href: href, 'aria-current': ariaCurrentValue }; |
| 5820 |
} else { |
| 5821 |
// find the first <a> child and apply listener and href |
| 5822 |
var a = findAnchor(this.$slots.default); |
| 5823 |
if (a) { |
| 5824 |
// in case the <a> is a static node |
| 5825 |
a.isStatic = false; |
| 5826 |
var aData = (a.data = extend({}, a.data)); |
| 5827 |
aData.on = aData.on || {}; |
| 5828 |
// transform existing events in both objects into arrays so we can push later |
| 5829 |
for (var event in aData.on) { |
| 5830 |
var handler$1 = aData.on[event]; |
| 5831 |
if (event in on) { |
| 5832 |
aData.on[event] = Array.isArray(handler$1) ? handler$1 : [handler$1]; |
| 5833 |
} |
| 5834 |
} |
| 5835 |
// append new listeners for router-link |
| 5836 |
for (var event$1 in on) { |
| 5837 |
if (event$1 in aData.on) { |
| 5838 |
// on[event] is always a function |
| 5839 |
aData.on[event$1].push(on[event$1]); |
| 5840 |
} else { |
| 5841 |
aData.on[event$1] = handler; |
| 5842 |
} |
| 5843 |
} |
| 5844 |
|
| 5845 |
var aAttrs = (a.data.attrs = extend({}, a.data.attrs)); |
| 5846 |
aAttrs.href = href; |
| 5847 |
aAttrs['aria-current'] = ariaCurrentValue; |
| 5848 |
} else { |
| 5849 |
// doesn't have <a> child, apply listener to self |
| 5850 |
data.on = on; |
| 5851 |
} |
| 5852 |
} |
| 5853 |
|
| 5854 |
return h(this.tag, data, this.$slots.default) |
| 5855 |
} |
| 5856 |
}; |
| 5857 |
|
| 5858 |
function guardEvent (e) { |
| 5859 |
// don't redirect with control keys |
| 5860 |
if (e.metaKey || e.altKey || e.ctrlKey || e.shiftKey) { return } |
| 5861 |
// don't redirect when preventDefault called |
| 5862 |
if (e.defaultPrevented) { return } |
| 5863 |
// don't redirect on right click |
| 5864 |
if (e.button !== undefined && e.button !== 0) { return } |
| 5865 |
// don't redirect if `target="_blank"` |
| 5866 |
if (e.currentTarget && e.currentTarget.getAttribute) { |
| 5867 |
var target = e.currentTarget.getAttribute('target'); |
| 5868 |
if (/\b_blank\b/i.test(target)) { return } |
| 5869 |
} |
| 5870 |
// this may be a Weex event which doesn't have this method |
| 5871 |
if (e.preventDefault) { |
| 5872 |
e.preventDefault(); |
| 5873 |
} |
| 5874 |
return true |
| 5875 |
} |
| 5876 |
|
| 5877 |
function findAnchor (children) { |
| 5878 |
if (children) { |
| 5879 |
var child; |
| 5880 |
for (var i = 0; i < children.length; i++) { |
| 5881 |
child = children[i]; |
| 5882 |
if (child.tag === 'a') { |
| 5883 |
return child |
| 5884 |
} |
| 5885 |
if (child.children && (child = findAnchor(child.children))) { |
| 5886 |
return child |
| 5887 |
} |
| 5888 |
} |
| 5889 |
} |
| 5890 |
} |
| 5891 |
|
| 5892 |
var _Vue; |
| 5893 |
|
| 5894 |
function install (Vue) { |
| 5895 |
if (install.installed && _Vue === Vue) { return } |
| 5896 |
install.installed = true; |
| 5897 |
|
| 5898 |
_Vue = Vue; |
| 5899 |
|
| 5900 |
var isDef = function (v) { return v !== undefined; }; |
| 5901 |
|
| 5902 |
var registerInstance = function (vm, callVal) { |
| 5903 |
var i = vm.$options._parentVnode; |
| 5904 |
if (isDef(i) && isDef(i = i.data) && isDef(i = i.registerRouteInstance)) { |
| 5905 |
i(vm, callVal); |
| 5906 |
} |
| 5907 |
}; |
| 5908 |
|
| 5909 |
Vue.mixin({ |
| 5910 |
beforeCreate: function beforeCreate () { |
| 5911 |
if (isDef(this.$options.router)) { |
| 5912 |
this._routerRoot = this; |
| 5913 |
this._router = this.$options.router; |
| 5914 |
this._router.init(this); |
| 5915 |
Vue.util.defineReactive(this, '_route', this._router.history.current); |
| 5916 |
} else { |
| 5917 |
this._routerRoot = (this.$parent && this.$parent._routerRoot) || this; |
| 5918 |
} |
| 5919 |
registerInstance(this, this); |
| 5920 |
}, |
| 5921 |
destroyed: function destroyed () { |
| 5922 |
registerInstance(this); |
| 5923 |
} |
| 5924 |
}); |
| 5925 |
|
| 5926 |
Object.defineProperty(Vue.prototype, '$router', { |
| 5927 |
get: function get () { return this._routerRoot._router } |
| 5928 |
}); |
| 5929 |
|
| 5930 |
Object.defineProperty(Vue.prototype, '$route', { |
| 5931 |
get: function get () { return this._routerRoot._route } |
| 5932 |
}); |
| 5933 |
|
| 5934 |
Vue.component('RouterView', View); |
| 5935 |
Vue.component('RouterLink', Link); |
| 5936 |
|
| 5937 |
var strats = Vue.config.optionMergeStrategies; |
| 5938 |
// use the same hook merging strategy for route hooks |
| 5939 |
strats.beforeRouteEnter = strats.beforeRouteLeave = strats.beforeRouteUpdate = strats.created; |
| 5940 |
} |
| 5941 |
|
| 5942 |
/* */ |
| 5943 |
|
| 5944 |
var inBrowser = typeof window !== 'undefined'; |
| 5945 |
|
| 5946 |
/* */ |
| 5947 |
|
| 5948 |
function createRouteMap ( |
| 5949 |
routes, |
| 5950 |
oldPathList, |
| 5951 |
oldPathMap, |
| 5952 |
oldNameMap, |
| 5953 |
parentRoute |
| 5954 |
) { |
| 5955 |
// the path list is used to control path matching priority |
| 5956 |
var pathList = oldPathList || []; |
| 5957 |
// $flow-disable-line |
| 5958 |
var pathMap = oldPathMap || Object.create(null); |
| 5959 |
// $flow-disable-line |
| 5960 |
var nameMap = oldNameMap || Object.create(null); |
| 5961 |
|
| 5962 |
routes.forEach(function (route) { |
| 5963 |
addRouteRecord(pathList, pathMap, nameMap, route, parentRoute); |
| 5964 |
}); |
| 5965 |
|
| 5966 |
// ensure wildcard routes are always at the end |
| 5967 |
for (var i = 0, l = pathList.length; i < l; i++) { |
| 5968 |
if (pathList[i] === '*') { |
| 5969 |
pathList.push(pathList.splice(i, 1)[0]); |
| 5970 |
l--; |
| 5971 |
i--; |
| 5972 |
} |
| 5973 |
} |
| 5974 |
|
| 5975 |
if (true) { |
| 5976 |
// warn if routes do not include leading slashes |
| 5977 |
var found = pathList |
| 5978 |
// check for missing leading slash |
| 5979 |
.filter(function (path) { return path && path.charAt(0) !== '*' && path.charAt(0) !== '/'; }); |
| 5980 |
|
| 5981 |
if (found.length > 0) { |
| 5982 |
var pathNames = found.map(function (path) { return ("- " + path); }).join('\n'); |
| 5983 |
warn(false, ("Non-nested routes must include a leading slash character. Fix the following routes: \n" + pathNames)); |
| 5984 |
} |
| 5985 |
} |
| 5986 |
|
| 5987 |
return { |
| 5988 |
pathList: pathList, |
| 5989 |
pathMap: pathMap, |
| 5990 |
nameMap: nameMap |
| 5991 |
} |
| 5992 |
} |
| 5993 |
|
| 5994 |
function addRouteRecord ( |
| 5995 |
pathList, |
| 5996 |
pathMap, |
| 5997 |
nameMap, |
| 5998 |
route, |
| 5999 |
parent, |
| 6000 |
matchAs |
| 6001 |
) { |
| 6002 |
var path = route.path; |
| 6003 |
var name = route.name; |
| 6004 |
if (true) { |
| 6005 |
assert(path != null, "\"path\" is required in a route configuration."); |
| 6006 |
assert( |
| 6007 |
typeof route.component !== 'string', |
| 6008 |
"route config \"component\" for path: " + (String( |
| 6009 |
path || name |
| 6010 |
)) + " cannot be a " + "string id. Use an actual component instead." |
| 6011 |
); |
| 6012 |
|
| 6013 |
warn( |
| 6014 |
// eslint-disable-next-line no-control-regex |
| 6015 |
!/[^\u0000-\u007F]+/.test(path), |
| 6016 |
"Route with path \"" + path + "\" contains unencoded characters, make sure " + |
| 6017 |
"your path is correctly encoded before passing it to the router. Use " + |
| 6018 |
"encodeURI to encode static segments of your path." |
| 6019 |
); |
| 6020 |
} |
| 6021 |
|
| 6022 |
var pathToRegexpOptions = |
| 6023 |
route.pathToRegexpOptions || {}; |
| 6024 |
var normalizedPath = normalizePath(path, parent, pathToRegexpOptions.strict); |
| 6025 |
|
| 6026 |
if (typeof route.caseSensitive === 'boolean') { |
| 6027 |
pathToRegexpOptions.sensitive = route.caseSensitive; |
| 6028 |
} |
| 6029 |
|
| 6030 |
var record = { |
| 6031 |
path: normalizedPath, |
| 6032 |
regex: compileRouteRegex(normalizedPath, pathToRegexpOptions), |
| 6033 |
components: route.components || { default: route.component }, |
| 6034 |
alias: route.alias |
| 6035 |
? typeof route.alias === 'string' |
| 6036 |
? [route.alias] |
| 6037 |
: route.alias |
| 6038 |
: [], |
| 6039 |
instances: {}, |
| 6040 |
enteredCbs: {}, |
| 6041 |
name: name, |
| 6042 |
parent: parent, |
| 6043 |
matchAs: matchAs, |
| 6044 |
redirect: route.redirect, |
| 6045 |
beforeEnter: route.beforeEnter, |
| 6046 |
meta: route.meta || {}, |
| 6047 |
props: |
| 6048 |
route.props == null |
| 6049 |
? {} |
| 6050 |
: route.components |
| 6051 |
? route.props |
| 6052 |
: { default: route.props } |
| 6053 |
}; |
| 6054 |
|
| 6055 |
if (route.children) { |
| 6056 |
// Warn if route is named, does not redirect and has a default child route. |
| 6057 |
// If users navigate to this route by name, the default child will |
| 6058 |
// not be rendered (GH Issue #629) |
| 6059 |
if (true) { |
| 6060 |
if ( |
| 6061 |
route.name && |
| 6062 |
!route.redirect && |
| 6063 |
route.children.some(function (child) { return /^\/?$/.test(child.path); }) |
| 6064 |
) { |
| 6065 |
warn( |
| 6066 |
false, |
| 6067 |
"Named Route '" + (route.name) + "' has a default child route. " + |
| 6068 |
"When navigating to this named route (:to=\"{name: '" + (route.name) + "'\"), " + |
| 6069 |
"the default child route will not be rendered. Remove the name from " + |
| 6070 |
"this route and use the name of the default child route for named " + |
| 6071 |
"links instead." |
| 6072 |
); |
| 6073 |
} |
| 6074 |
} |
| 6075 |
route.children.forEach(function (child) { |
| 6076 |
var childMatchAs = matchAs |
| 6077 |
? cleanPath((matchAs + "/" + (child.path))) |
| 6078 |
: undefined; |
| 6079 |
addRouteRecord(pathList, pathMap, nameMap, child, record, childMatchAs); |
| 6080 |
}); |
| 6081 |
} |
| 6082 |
|
| 6083 |
if (!pathMap[record.path]) { |
| 6084 |
pathList.push(record.path); |
| 6085 |
pathMap[record.path] = record; |
| 6086 |
} |
| 6087 |
|
| 6088 |
if (route.alias !== undefined) { |
| 6089 |
var aliases = Array.isArray(route.alias) ? route.alias : [route.alias]; |
| 6090 |
for (var i = 0; i < aliases.length; ++i) { |
| 6091 |
var alias = aliases[i]; |
| 6092 |
if ( true && alias === path) { |
| 6093 |
warn( |
| 6094 |
false, |
| 6095 |
("Found an alias with the same value as the path: \"" + path + "\". You have to remove that alias. It will be ignored in development.") |
| 6096 |
); |
| 6097 |
// skip in dev to make it work |
| 6098 |
continue |
| 6099 |
} |
| 6100 |
|
| 6101 |
var aliasRoute = { |
| 6102 |
path: alias, |
| 6103 |
children: route.children |
| 6104 |
}; |
| 6105 |
addRouteRecord( |
| 6106 |
pathList, |
| 6107 |
pathMap, |
| 6108 |
nameMap, |
| 6109 |
aliasRoute, |
| 6110 |
parent, |
| 6111 |
record.path || '/' // matchAs |
| 6112 |
); |
| 6113 |
} |
| 6114 |
} |
| 6115 |
|
| 6116 |
if (name) { |
| 6117 |
if (!nameMap[name]) { |
| 6118 |
nameMap[name] = record; |
| 6119 |
} else if ( true && !matchAs) { |
| 6120 |
warn( |
| 6121 |
false, |
| 6122 |
"Duplicate named routes definition: " + |
| 6123 |
"{ name: \"" + name + "\", path: \"" + (record.path) + "\" }" |
| 6124 |
); |
| 6125 |
} |
| 6126 |
} |
| 6127 |
} |
| 6128 |
|
| 6129 |
function compileRouteRegex ( |
| 6130 |
path, |
| 6131 |
pathToRegexpOptions |
| 6132 |
) { |
| 6133 |
var regex = pathToRegexp_1(path, [], pathToRegexpOptions); |
| 6134 |
if (true) { |
| 6135 |
var keys = Object.create(null); |
| 6136 |
regex.keys.forEach(function (key) { |
| 6137 |
warn( |
| 6138 |
!keys[key.name], |
| 6139 |
("Duplicate param keys in route with path: \"" + path + "\"") |
| 6140 |
); |
| 6141 |
keys[key.name] = true; |
| 6142 |
}); |
| 6143 |
} |
| 6144 |
return regex |
| 6145 |
} |
| 6146 |
|
| 6147 |
function normalizePath ( |
| 6148 |
path, |
| 6149 |
parent, |
| 6150 |
strict |
| 6151 |
) { |
| 6152 |
if (!strict) { path = path.replace(/\/$/, ''); } |
| 6153 |
if (path[0] === '/') { return path } |
| 6154 |
if (parent == null) { return path } |
| 6155 |
return cleanPath(((parent.path) + "/" + path)) |
| 6156 |
} |
| 6157 |
|
| 6158 |
/* */ |
| 6159 |
|
| 6160 |
|
| 6161 |
|
| 6162 |
function createMatcher ( |
| 6163 |
routes, |
| 6164 |
router |
| 6165 |
) { |
| 6166 |
var ref = createRouteMap(routes); |
| 6167 |
var pathList = ref.pathList; |
| 6168 |
var pathMap = ref.pathMap; |
| 6169 |
var nameMap = ref.nameMap; |
| 6170 |
|
| 6171 |
function addRoutes (routes) { |
| 6172 |
createRouteMap(routes, pathList, pathMap, nameMap); |
| 6173 |
} |
| 6174 |
|
| 6175 |
function addRoute (parentOrRoute, route) { |
| 6176 |
var parent = (typeof parentOrRoute !== 'object') ? nameMap[parentOrRoute] : undefined; |
| 6177 |
// $flow-disable-line |
| 6178 |
createRouteMap([route || parentOrRoute], pathList, pathMap, nameMap, parent); |
| 6179 |
|
| 6180 |
// add aliases of parent |
| 6181 |
if (parent && parent.alias.length) { |
| 6182 |
createRouteMap( |
| 6183 |
// $flow-disable-line route is defined if parent is |
| 6184 |
parent.alias.map(function (alias) { return ({ path: alias, children: [route] }); }), |
| 6185 |
pathList, |
| 6186 |
pathMap, |
| 6187 |
nameMap, |
| 6188 |
parent |
| 6189 |
); |
| 6190 |
} |
| 6191 |
} |
| 6192 |
|
| 6193 |
function getRoutes () { |
| 6194 |
return pathList.map(function (path) { return pathMap[path]; }) |
| 6195 |
} |
| 6196 |
|
| 6197 |
function match ( |
| 6198 |
raw, |
| 6199 |
currentRoute, |
| 6200 |
redirectedFrom |
| 6201 |
) { |
| 6202 |
var location = normalizeLocation(raw, currentRoute, false, router); |
| 6203 |
var name = location.name; |
| 6204 |
|
| 6205 |
if (name) { |
| 6206 |
var record = nameMap[name]; |
| 6207 |
if (true) { |
| 6208 |
warn(record, ("Route with name '" + name + "' does not exist")); |
| 6209 |
} |
| 6210 |
if (!record) { return _createRoute(null, location) } |
| 6211 |
var paramNames = record.regex.keys |
| 6212 |
.filter(function (key) { return !key.optional; }) |
| 6213 |
.map(function (key) { return key.name; }); |
| 6214 |
|
| 6215 |
if (typeof location.params !== 'object') { |
| 6216 |
location.params = {}; |
| 6217 |
} |
| 6218 |
|
| 6219 |
if (currentRoute && typeof currentRoute.params === 'object') { |
| 6220 |
for (var key in currentRoute.params) { |
| 6221 |
if (!(key in location.params) && paramNames.indexOf(key) > -1) { |
| 6222 |
location.params[key] = currentRoute.params[key]; |
| 6223 |
} |
| 6224 |
} |
| 6225 |
} |
| 6226 |
|
| 6227 |
location.path = fillParams(record.path, location.params, ("named route \"" + name + "\"")); |
| 6228 |
return _createRoute(record, location, redirectedFrom) |
| 6229 |
} else if (location.path) { |
| 6230 |
location.params = {}; |
| 6231 |
for (var i = 0; i < pathList.length; i++) { |
| 6232 |
var path = pathList[i]; |
| 6233 |
var record$1 = pathMap[path]; |
| 6234 |
if (matchRoute(record$1.regex, location.path, location.params)) { |
| 6235 |
return _createRoute(record$1, location, redirectedFrom) |
| 6236 |
} |
| 6237 |
} |
| 6238 |
} |
| 6239 |
// no match |
| 6240 |
return _createRoute(null, location) |
| 6241 |
} |
| 6242 |
|
| 6243 |
function redirect ( |
| 6244 |
record, |
| 6245 |
location |
| 6246 |
) { |
| 6247 |
var originalRedirect = record.redirect; |
| 6248 |
var redirect = typeof originalRedirect === 'function' |
| 6249 |
? originalRedirect(createRoute(record, location, null, router)) |
| 6250 |
: originalRedirect; |
| 6251 |
|
| 6252 |
if (typeof redirect === 'string') { |
| 6253 |
redirect = { path: redirect }; |
| 6254 |
} |
| 6255 |
|
| 6256 |
if (!redirect || typeof redirect !== 'object') { |
| 6257 |
if (true) { |
| 6258 |
warn( |
| 6259 |
false, ("invalid redirect option: " + (JSON.stringify(redirect))) |
| 6260 |
); |
| 6261 |
} |
| 6262 |
return _createRoute(null, location) |
| 6263 |
} |
| 6264 |
|
| 6265 |
var re = redirect; |
| 6266 |
var name = re.name; |
| 6267 |
var path = re.path; |
| 6268 |
var query = location.query; |
| 6269 |
var hash = location.hash; |
| 6270 |
var params = location.params; |
| 6271 |
query = re.hasOwnProperty('query') ? re.query : query; |
| 6272 |
hash = re.hasOwnProperty('hash') ? re.hash : hash; |
| 6273 |
params = re.hasOwnProperty('params') ? re.params : params; |
| 6274 |
|
| 6275 |
if (name) { |
| 6276 |
// resolved named direct |
| 6277 |
var targetRecord = nameMap[name]; |
| 6278 |
if (true) { |
| 6279 |
assert(targetRecord, ("redirect failed: named route \"" + name + "\" not found.")); |
| 6280 |
} |
| 6281 |
return match({ |
| 6282 |
_normalized: true, |
| 6283 |
name: name, |
| 6284 |
query: query, |
| 6285 |
hash: hash, |
| 6286 |
params: params |
| 6287 |
}, undefined, location) |
| 6288 |
} else if (path) { |
| 6289 |
// 1. resolve relative redirect |
| 6290 |
var rawPath = resolveRecordPath(path, record); |
| 6291 |
// 2. resolve params |
| 6292 |
var resolvedPath = fillParams(rawPath, params, ("redirect route with path \"" + rawPath + "\"")); |
| 6293 |
// 3. rematch with existing query and hash |
| 6294 |
return match({ |
| 6295 |
_normalized: true, |
| 6296 |
path: resolvedPath, |
| 6297 |
query: query, |
| 6298 |
hash: hash |
| 6299 |
}, undefined, location) |
| 6300 |
} else { |
| 6301 |
if (true) { |
| 6302 |
warn(false, ("invalid redirect option: " + (JSON.stringify(redirect)))); |
| 6303 |
} |
| 6304 |
return _createRoute(null, location) |
| 6305 |
} |
| 6306 |
} |
| 6307 |
|
| 6308 |
function alias ( |
| 6309 |
record, |
| 6310 |
location, |
| 6311 |
matchAs |
| 6312 |
) { |
| 6313 |
var aliasedPath = fillParams(matchAs, location.params, ("aliased route with path \"" + matchAs + "\"")); |
| 6314 |
var aliasedMatch = match({ |
| 6315 |
_normalized: true, |
| 6316 |
path: aliasedPath |
| 6317 |
}); |
| 6318 |
if (aliasedMatch) { |
| 6319 |
var matched = aliasedMatch.matched; |
| 6320 |
var aliasedRecord = matched[matched.length - 1]; |
| 6321 |
location.params = aliasedMatch.params; |
| 6322 |
return _createRoute(aliasedRecord, location) |
| 6323 |
} |
| 6324 |
return _createRoute(null, location) |
| 6325 |
} |
| 6326 |
|
| 6327 |
function _createRoute ( |
| 6328 |
record, |
| 6329 |
location, |
| 6330 |
redirectedFrom |
| 6331 |
) { |
| 6332 |
if (record && record.redirect) { |
| 6333 |
return redirect(record, redirectedFrom || location) |
| 6334 |
} |
| 6335 |
if (record && record.matchAs) { |
| 6336 |
return alias(record, location, record.matchAs) |
| 6337 |
} |
| 6338 |
return createRoute(record, location, redirectedFrom, router) |
| 6339 |
} |
| 6340 |
|
| 6341 |
return { |
| 6342 |
match: match, |
| 6343 |
addRoute: addRoute, |
| 6344 |
getRoutes: getRoutes, |
| 6345 |
addRoutes: addRoutes |
| 6346 |
} |
| 6347 |
} |
| 6348 |
|
| 6349 |
function matchRoute ( |
| 6350 |
regex, |
| 6351 |
path, |
| 6352 |
params |
| 6353 |
) { |
| 6354 |
var m = path.match(regex); |
| 6355 |
|
| 6356 |
if (!m) { |
| 6357 |
return false |
| 6358 |
} else if (!params) { |
| 6359 |
return true |
| 6360 |
} |
| 6361 |
|
| 6362 |
for (var i = 1, len = m.length; i < len; ++i) { |
| 6363 |
var key = regex.keys[i - 1]; |
| 6364 |
if (key) { |
| 6365 |
// Fix #1994: using * with props: true generates a param named 0 |
| 6366 |
params[key.name || 'pathMatch'] = typeof m[i] === 'string' ? decode(m[i]) : m[i]; |
| 6367 |
} |
| 6368 |
} |
| 6369 |
|
| 6370 |
return true |
| 6371 |
} |
| 6372 |
|
| 6373 |
function resolveRecordPath (path, record) { |
| 6374 |
return resolvePath(path, record.parent ? record.parent.path : '/', true) |
| 6375 |
} |
| 6376 |
|
| 6377 |
/* */ |
| 6378 |
|
| 6379 |
// use User Timing api (if present) for more accurate key precision |
| 6380 |
var Time = |
| 6381 |
inBrowser && window.performance && window.performance.now |
| 6382 |
? window.performance |
| 6383 |
: Date; |
| 6384 |
|
| 6385 |
function genStateKey () { |
| 6386 |
return Time.now().toFixed(3) |
| 6387 |
} |
| 6388 |
|
| 6389 |
var _key = genStateKey(); |
| 6390 |
|
| 6391 |
function getStateKey () { |
| 6392 |
return _key |
| 6393 |
} |
| 6394 |
|
| 6395 |
function setStateKey (key) { |
| 6396 |
return (_key = key) |
| 6397 |
} |
| 6398 |
|
| 6399 |
/* */ |
| 6400 |
|
| 6401 |
var positionStore = Object.create(null); |
| 6402 |
|
| 6403 |
function setupScroll () { |
| 6404 |
// Prevent browser scroll behavior on History popstate |
| 6405 |
if ('scrollRestoration' in window.history) { |
| 6406 |
window.history.scrollRestoration = 'manual'; |
| 6407 |
} |
| 6408 |
// Fix for #1585 for Firefox |
| 6409 |
// Fix for #2195 Add optional third attribute to workaround a bug in safari https://bugs.webkit.org/show_bug.cgi?id=182678 |
| 6410 |
// Fix for #2774 Support for apps loaded from Windows file shares not mapped to network drives: replaced location.origin with |
| 6411 |
// window.location.protocol + '//' + window.location.host |
| 6412 |
// location.host contains the port and location.hostname doesn't |
| 6413 |
var protocolAndPath = window.location.protocol + '//' + window.location.host; |
| 6414 |
var absolutePath = window.location.href.replace(protocolAndPath, ''); |
| 6415 |
// preserve existing history state as it could be overriden by the user |
| 6416 |
var stateCopy = extend({}, window.history.state); |
| 6417 |
stateCopy.key = getStateKey(); |
| 6418 |
window.history.replaceState(stateCopy, '', absolutePath); |
| 6419 |
window.addEventListener('popstate', handlePopState); |
| 6420 |
return function () { |
| 6421 |
window.removeEventListener('popstate', handlePopState); |
| 6422 |
} |
| 6423 |
} |
| 6424 |
|
| 6425 |
function handleScroll ( |
| 6426 |
router, |
| 6427 |
to, |
| 6428 |
from, |
| 6429 |
isPop |
| 6430 |
) { |
| 6431 |
if (!router.app) { |
| 6432 |
return |
| 6433 |
} |
| 6434 |
|
| 6435 |
var behavior = router.options.scrollBehavior; |
| 6436 |
if (!behavior) { |
| 6437 |
return |
| 6438 |
} |
| 6439 |
|
| 6440 |
if (true) { |
| 6441 |
assert(typeof behavior === 'function', "scrollBehavior must be a function"); |
| 6442 |
} |
| 6443 |
|
| 6444 |
// wait until re-render finishes before scrolling |
| 6445 |
router.app.$nextTick(function () { |
| 6446 |
var position = getScrollPosition(); |
| 6447 |
var shouldScroll = behavior.call( |
| 6448 |
router, |
| 6449 |
to, |
| 6450 |
from, |
| 6451 |
isPop ? position : null |
| 6452 |
); |
| 6453 |
|
| 6454 |
if (!shouldScroll) { |
| 6455 |
return |
| 6456 |
} |
| 6457 |
|
| 6458 |
if (typeof shouldScroll.then === 'function') { |
| 6459 |
shouldScroll |
| 6460 |
.then(function (shouldScroll) { |
| 6461 |
scrollToPosition((shouldScroll), position); |
| 6462 |
}) |
| 6463 |
.catch(function (err) { |
| 6464 |
if (true) { |
| 6465 |
assert(false, err.toString()); |
| 6466 |
} |
| 6467 |
}); |
| 6468 |
} else { |
| 6469 |
scrollToPosition(shouldScroll, position); |
| 6470 |
} |
| 6471 |
}); |
| 6472 |
} |
| 6473 |
|
| 6474 |
function saveScrollPosition () { |
| 6475 |
var key = getStateKey(); |
| 6476 |
if (key) { |
| 6477 |
positionStore[key] = { |
| 6478 |
x: window.pageXOffset, |
| 6479 |
y: window.pageYOffset |
| 6480 |
}; |
| 6481 |
} |
| 6482 |
} |
| 6483 |
|
| 6484 |
function handlePopState (e) { |
| 6485 |
saveScrollPosition(); |
| 6486 |
if (e.state && e.state.key) { |
| 6487 |
setStateKey(e.state.key); |
| 6488 |
} |
| 6489 |
} |
| 6490 |
|
| 6491 |
function getScrollPosition () { |
| 6492 |
var key = getStateKey(); |
| 6493 |
if (key) { |
| 6494 |
return positionStore[key] |
| 6495 |
} |
| 6496 |
} |
| 6497 |
|
| 6498 |
function getElementPosition (el, offset) { |
| 6499 |
var docEl = document.documentElement; |
| 6500 |
var docRect = docEl.getBoundingClientRect(); |
| 6501 |
var elRect = el.getBoundingClientRect(); |
| 6502 |
return { |
| 6503 |
x: elRect.left - docRect.left - offset.x, |
| 6504 |
y: elRect.top - docRect.top - offset.y |
| 6505 |
} |
| 6506 |
} |
| 6507 |
|
| 6508 |
function isValidPosition (obj) { |
| 6509 |
return isNumber(obj.x) || isNumber(obj.y) |
| 6510 |
} |
| 6511 |
|
| 6512 |
function normalizePosition (obj) { |
| 6513 |
return { |
| 6514 |
x: isNumber(obj.x) ? obj.x : window.pageXOffset, |
| 6515 |
y: isNumber(obj.y) ? obj.y : window.pageYOffset |
| 6516 |
} |
| 6517 |
} |
| 6518 |
|
| 6519 |
function normalizeOffset (obj) { |
| 6520 |
return { |
| 6521 |
x: isNumber(obj.x) ? obj.x : 0, |
| 6522 |
y: isNumber(obj.y) ? obj.y : 0 |
| 6523 |
} |
| 6524 |
} |
| 6525 |
|
| 6526 |
function isNumber (v) { |
| 6527 |
return typeof v === 'number' |
| 6528 |
} |
| 6529 |
|
| 6530 |
var hashStartsWithNumberRE = /^#\d/; |
| 6531 |
|
| 6532 |
function scrollToPosition (shouldScroll, position) { |
| 6533 |
var isObject = typeof shouldScroll === 'object'; |
| 6534 |
if (isObject && typeof shouldScroll.selector === 'string') { |
| 6535 |
// getElementById would still fail if the selector contains a more complicated query like #main[data-attr] |
| 6536 |
// but at the same time, it doesn't make much sense to select an element with an id and an extra selector |
| 6537 |
var el = hashStartsWithNumberRE.test(shouldScroll.selector) // $flow-disable-line |
| 6538 |
? document.getElementById(shouldScroll.selector.slice(1)) // $flow-disable-line |
| 6539 |
: document.querySelector(shouldScroll.selector); |
| 6540 |
|
| 6541 |
if (el) { |
| 6542 |
var offset = |
| 6543 |
shouldScroll.offset && typeof shouldScroll.offset === 'object' |
| 6544 |
? shouldScroll.offset |
| 6545 |
: {}; |
| 6546 |
offset = normalizeOffset(offset); |
| 6547 |
position = getElementPosition(el, offset); |
| 6548 |
} else if (isValidPosition(shouldScroll)) { |
| 6549 |
position = normalizePosition(shouldScroll); |
| 6550 |
} |
| 6551 |
} else if (isObject && isValidPosition(shouldScroll)) { |
| 6552 |
position = normalizePosition(shouldScroll); |
| 6553 |
} |
| 6554 |
|
| 6555 |
if (position) { |
| 6556 |
// $flow-disable-line |
| 6557 |
if ('scrollBehavior' in document.documentElement.style) { |
| 6558 |
window.scrollTo({ |
| 6559 |
left: position.x, |
| 6560 |
top: position.y, |
| 6561 |
// $flow-disable-line |
| 6562 |
behavior: shouldScroll.behavior |
| 6563 |
}); |
| 6564 |
} else { |
| 6565 |
window.scrollTo(position.x, position.y); |
| 6566 |
} |
| 6567 |
} |
| 6568 |
} |
| 6569 |
|
| 6570 |
/* */ |
| 6571 |
|
| 6572 |
var supportsPushState = |
| 6573 |
inBrowser && |
| 6574 |
(function () { |
| 6575 |
var ua = window.navigator.userAgent; |
| 6576 |
|
| 6577 |
if ( |
| 6578 |
(ua.indexOf('Android 2.') !== -1 || ua.indexOf('Android 4.0') !== -1) && |
| 6579 |
ua.indexOf('Mobile Safari') !== -1 && |
| 6580 |
ua.indexOf('Chrome') === -1 && |
| 6581 |
ua.indexOf('Windows Phone') === -1 |
| 6582 |
) { |
| 6583 |
return false |
| 6584 |
} |
| 6585 |
|
| 6586 |
return window.history && typeof window.history.pushState === 'function' |
| 6587 |
})(); |
| 6588 |
|
| 6589 |
function pushState (url, replace) { |
| 6590 |
saveScrollPosition(); |
| 6591 |
// try...catch the pushState call to get around Safari |
| 6592 |
// DOM Exception 18 where it limits to 100 pushState calls |
| 6593 |
var history = window.history; |
| 6594 |
try { |
| 6595 |
if (replace) { |
| 6596 |
// preserve existing history state as it could be overriden by the user |
| 6597 |
var stateCopy = extend({}, history.state); |
| 6598 |
stateCopy.key = getStateKey(); |
| 6599 |
history.replaceState(stateCopy, '', url); |
| 6600 |
} else { |
| 6601 |
history.pushState({ key: setStateKey(genStateKey()) }, '', url); |
| 6602 |
} |
| 6603 |
} catch (e) { |
| 6604 |
window.location[replace ? 'replace' : 'assign'](url); |
| 6605 |
} |
| 6606 |
} |
| 6607 |
|
| 6608 |
function replaceState (url) { |
| 6609 |
pushState(url, true); |
| 6610 |
} |
| 6611 |
|
| 6612 |
/* */ |
| 6613 |
|
| 6614 |
function runQueue (queue, fn, cb) { |
| 6615 |
var step = function (index) { |
| 6616 |
if (index >= queue.length) { |
| 6617 |
cb(); |
| 6618 |
} else { |
| 6619 |
if (queue[index]) { |
| 6620 |
fn(queue[index], function () { |
| 6621 |
step(index + 1); |
| 6622 |
}); |
| 6623 |
} else { |
| 6624 |
step(index + 1); |
| 6625 |
} |
| 6626 |
} |
| 6627 |
}; |
| 6628 |
step(0); |
| 6629 |
} |
| 6630 |
|
| 6631 |
// When changing thing, also edit router.d.ts |
| 6632 |
var NavigationFailureType = { |
| 6633 |
redirected: 2, |
| 6634 |
aborted: 4, |
| 6635 |
cancelled: 8, |
| 6636 |
duplicated: 16 |
| 6637 |
}; |
| 6638 |
|
| 6639 |
function createNavigationRedirectedError (from, to) { |
| 6640 |
return createRouterError( |
| 6641 |
from, |
| 6642 |
to, |
| 6643 |
NavigationFailureType.redirected, |
| 6644 |
("Redirected when going from \"" + (from.fullPath) + "\" to \"" + (stringifyRoute( |
| 6645 |
to |
| 6646 |
)) + "\" via a navigation guard.") |
| 6647 |
) |
| 6648 |
} |
| 6649 |
|
| 6650 |
function createNavigationDuplicatedError (from, to) { |
| 6651 |
var error = createRouterError( |
| 6652 |
from, |
| 6653 |
to, |
| 6654 |
NavigationFailureType.duplicated, |
| 6655 |
("Avoided redundant navigation to current location: \"" + (from.fullPath) + "\".") |
| 6656 |
); |
| 6657 |
// backwards compatible with the first introduction of Errors |
| 6658 |
error.name = 'NavigationDuplicated'; |
| 6659 |
return error |
| 6660 |
} |
| 6661 |
|
| 6662 |
function createNavigationCancelledError (from, to) { |
| 6663 |
return createRouterError( |
| 6664 |
from, |
| 6665 |
to, |
| 6666 |
NavigationFailureType.cancelled, |
| 6667 |
("Navigation cancelled from \"" + (from.fullPath) + "\" to \"" + (to.fullPath) + "\" with a new navigation.") |
| 6668 |
) |
| 6669 |
} |
| 6670 |
|
| 6671 |
function createNavigationAbortedError (from, to) { |
| 6672 |
return createRouterError( |
| 6673 |
from, |
| 6674 |
to, |
| 6675 |
NavigationFailureType.aborted, |
| 6676 |
("Navigation aborted from \"" + (from.fullPath) + "\" to \"" + (to.fullPath) + "\" via a navigation guard.") |
| 6677 |
) |
| 6678 |
} |
| 6679 |
|
| 6680 |
function createRouterError (from, to, type, message) { |
| 6681 |
var error = new Error(message); |
| 6682 |
error._isRouter = true; |
| 6683 |
error.from = from; |
| 6684 |
error.to = to; |
| 6685 |
error.type = type; |
| 6686 |
|
| 6687 |
return error |
| 6688 |
} |
| 6689 |
|
| 6690 |
var propertiesToLog = ['params', 'query', 'hash']; |
| 6691 |
|
| 6692 |
function stringifyRoute (to) { |
| 6693 |
if (typeof to === 'string') { return to } |
| 6694 |
if ('path' in to) { return to.path } |
| 6695 |
var location = {}; |
| 6696 |
propertiesToLog.forEach(function (key) { |
| 6697 |
if (key in to) { location[key] = to[key]; } |
| 6698 |
}); |
| 6699 |
return JSON.stringify(location, null, 2) |
| 6700 |
} |
| 6701 |
|
| 6702 |
function isError (err) { |
| 6703 |
return Object.prototype.toString.call(err).indexOf('Error') > -1 |
| 6704 |
} |
| 6705 |
|
| 6706 |
function isNavigationFailure (err, errorType) { |
| 6707 |
return ( |
| 6708 |
isError(err) && |
| 6709 |
err._isRouter && |
| 6710 |
(errorType == null || err.type === errorType) |
| 6711 |
) |
| 6712 |
} |
| 6713 |
|
| 6714 |
/* */ |
| 6715 |
|
| 6716 |
function resolveAsyncComponents (matched) { |
| 6717 |
return function (to, from, next) { |
| 6718 |
var hasAsync = false; |
| 6719 |
var pending = 0; |
| 6720 |
var error = null; |
| 6721 |
|
| 6722 |
flatMapComponents(matched, function (def, _, match, key) { |
| 6723 |
// if it's a function and doesn't have cid attached, |
| 6724 |
// assume it's an async component resolve function. |
| 6725 |
// we are not using Vue's default async resolving mechanism because |
| 6726 |
// we want to halt the navigation until the incoming component has been |
| 6727 |
// resolved. |
| 6728 |
if (typeof def === 'function' && def.cid === undefined) { |
| 6729 |
hasAsync = true; |
| 6730 |
pending++; |
| 6731 |
|
| 6732 |
var resolve = once(function (resolvedDef) { |
| 6733 |
if (isESModule(resolvedDef)) { |
| 6734 |
resolvedDef = resolvedDef.default; |
| 6735 |
} |
| 6736 |
// save resolved on async factory in case it's used elsewhere |
| 6737 |
def.resolved = typeof resolvedDef === 'function' |
| 6738 |
? resolvedDef |
| 6739 |
: _Vue.extend(resolvedDef); |
| 6740 |
match.components[key] = resolvedDef; |
| 6741 |
pending--; |
| 6742 |
if (pending <= 0) { |
| 6743 |
next(); |
| 6744 |
} |
| 6745 |
}); |
| 6746 |
|
| 6747 |
var reject = once(function (reason) { |
| 6748 |
var msg = "Failed to resolve async component " + key + ": " + reason; |
| 6749 |
true && warn(false, msg); |
| 6750 |
if (!error) { |
| 6751 |
error = isError(reason) |
| 6752 |
? reason |
| 6753 |
: new Error(msg); |
| 6754 |
next(error); |
| 6755 |
} |
| 6756 |
}); |
| 6757 |
|
| 6758 |
var res; |
| 6759 |
try { |
| 6760 |
res = def(resolve, reject); |
| 6761 |
} catch (e) { |
| 6762 |
reject(e); |
| 6763 |
} |
| 6764 |
if (res) { |
| 6765 |
if (typeof res.then === 'function') { |
| 6766 |
res.then(resolve, reject); |
| 6767 |
} else { |
| 6768 |
// new syntax in Vue 2.3 |
| 6769 |
var comp = res.component; |
| 6770 |
if (comp && typeof comp.then === 'function') { |
| 6771 |
comp.then(resolve, reject); |
| 6772 |
} |
| 6773 |
} |
| 6774 |
} |
| 6775 |
} |
| 6776 |
}); |
| 6777 |
|
| 6778 |
if (!hasAsync) { next(); } |
| 6779 |
} |
| 6780 |
} |
| 6781 |
|
| 6782 |
function flatMapComponents ( |
| 6783 |
matched, |
| 6784 |
fn |
| 6785 |
) { |
| 6786 |
return flatten(matched.map(function (m) { |
| 6787 |
return Object.keys(m.components).map(function (key) { return fn( |
| 6788 |
m.components[key], |
| 6789 |
m.instances[key], |
| 6790 |
m, key |
| 6791 |
); }) |
| 6792 |
})) |
| 6793 |
} |
| 6794 |
|
| 6795 |
function flatten (arr) { |
| 6796 |
return Array.prototype.concat.apply([], arr) |
| 6797 |
} |
| 6798 |
|
| 6799 |
var hasSymbol = |
| 6800 |
typeof Symbol === 'function' && |
| 6801 |
typeof Symbol.toStringTag === 'symbol'; |
| 6802 |
|
| 6803 |
function isESModule (obj) { |
| 6804 |
return obj.__esModule || (hasSymbol && obj[Symbol.toStringTag] === 'Module') |
| 6805 |
} |
| 6806 |
|
| 6807 |
// in Webpack 2, require.ensure now also returns a Promise |
| 6808 |
// so the resolve/reject functions may get called an extra time |
| 6809 |
// if the user uses an arrow function shorthand that happens to |
| 6810 |
// return that Promise. |
| 6811 |
function once (fn) { |
| 6812 |
var called = false; |
| 6813 |
return function () { |
| 6814 |
var args = [], len = arguments.length; |
| 6815 |
while ( len-- ) args[ len ] = arguments[ len ]; |
| 6816 |
|
| 6817 |
if (called) { return } |
| 6818 |
called = true; |
| 6819 |
return fn.apply(this, args) |
| 6820 |
} |
| 6821 |
} |
| 6822 |
|
| 6823 |
/* */ |
| 6824 |
|
| 6825 |
var History = function History (router, base) { |
| 6826 |
this.router = router; |
| 6827 |
this.base = normalizeBase(base); |
| 6828 |
// start with a route object that stands for "nowhere" |
| 6829 |
this.current = START; |
| 6830 |
this.pending = null; |
| 6831 |
this.ready = false; |
| 6832 |
this.readyCbs = []; |
| 6833 |
this.readyErrorCbs = []; |
| 6834 |
this.errorCbs = []; |
| 6835 |
this.listeners = []; |
| 6836 |
}; |
| 6837 |
|
| 6838 |
History.prototype.listen = function listen (cb) { |
| 6839 |
this.cb = cb; |
| 6840 |
}; |
| 6841 |
|
| 6842 |
History.prototype.onReady = function onReady (cb, errorCb) { |
| 6843 |
if (this.ready) { |
| 6844 |
cb(); |
| 6845 |
} else { |
| 6846 |
this.readyCbs.push(cb); |
| 6847 |
if (errorCb) { |
| 6848 |
this.readyErrorCbs.push(errorCb); |
| 6849 |
} |
| 6850 |
} |
| 6851 |
}; |
| 6852 |
|
| 6853 |
History.prototype.onError = function onError (errorCb) { |
| 6854 |
this.errorCbs.push(errorCb); |
| 6855 |
}; |
| 6856 |
|
| 6857 |
History.prototype.transitionTo = function transitionTo ( |
| 6858 |
location, |
| 6859 |
onComplete, |
| 6860 |
onAbort |
| 6861 |
) { |
| 6862 |
var this$1 = this; |
| 6863 |
|
| 6864 |
var route; |
| 6865 |
// catch redirect option https://github.com/vuejs/vue-router/issues/3201 |
| 6866 |
try { |
| 6867 |
route = this.router.match(location, this.current); |
| 6868 |
} catch (e) { |
| 6869 |
this.errorCbs.forEach(function (cb) { |
| 6870 |
cb(e); |
| 6871 |
}); |
| 6872 |
// Exception should still be thrown |
| 6873 |
throw e |
| 6874 |
} |
| 6875 |
var prev = this.current; |
| 6876 |
this.confirmTransition( |
| 6877 |
route, |
| 6878 |
function () { |
| 6879 |
this$1.updateRoute(route); |
| 6880 |
onComplete && onComplete(route); |
| 6881 |
this$1.ensureURL(); |
| 6882 |
this$1.router.afterHooks.forEach(function (hook) { |
| 6883 |
hook && hook(route, prev); |
| 6884 |
}); |
| 6885 |
|
| 6886 |
// fire ready cbs once |
| 6887 |
if (!this$1.ready) { |
| 6888 |
this$1.ready = true; |
| 6889 |
this$1.readyCbs.forEach(function (cb) { |
| 6890 |
cb(route); |
| 6891 |
}); |
| 6892 |
} |
| 6893 |
}, |
| 6894 |
function (err) { |
| 6895 |
if (onAbort) { |
| 6896 |
onAbort(err); |
| 6897 |
} |
| 6898 |
if (err && !this$1.ready) { |
| 6899 |
// Initial redirection should not mark the history as ready yet |
| 6900 |
// because it's triggered by the redirection instead |
| 6901 |
// https://github.com/vuejs/vue-router/issues/3225 |
| 6902 |
// https://github.com/vuejs/vue-router/issues/3331 |
| 6903 |
if (!isNavigationFailure(err, NavigationFailureType.redirected) || prev !== START) { |
| 6904 |
this$1.ready = true; |
| 6905 |
this$1.readyErrorCbs.forEach(function (cb) { |
| 6906 |
cb(err); |
| 6907 |
}); |
| 6908 |
} |
| 6909 |
} |
| 6910 |
} |
| 6911 |
); |
| 6912 |
}; |
| 6913 |
|
| 6914 |
History.prototype.confirmTransition = function confirmTransition (route, onComplete, onAbort) { |
| 6915 |
var this$1 = this; |
| 6916 |
|
| 6917 |
var current = this.current; |
| 6918 |
this.pending = route; |
| 6919 |
var abort = function (err) { |
| 6920 |
// changed after adding errors with |
| 6921 |
// https://github.com/vuejs/vue-router/pull/3047 before that change, |
| 6922 |
// redirect and aborted navigation would produce an err == null |
| 6923 |
if (!isNavigationFailure(err) && isError(err)) { |
| 6924 |
if (this$1.errorCbs.length) { |
| 6925 |
this$1.errorCbs.forEach(function (cb) { |
| 6926 |
cb(err); |
| 6927 |
}); |
| 6928 |
} else { |
| 6929 |
warn(false, 'uncaught error during route navigation:'); |
| 6930 |
console.error(err); |
| 6931 |
} |
| 6932 |
} |
| 6933 |
onAbort && onAbort(err); |
| 6934 |
}; |
| 6935 |
var lastRouteIndex = route.matched.length - 1; |
| 6936 |
var lastCurrentIndex = current.matched.length - 1; |
| 6937 |
if ( |
| 6938 |
isSameRoute(route, current) && |
| 6939 |
// in the case the route map has been dynamically appended to |
| 6940 |
lastRouteIndex === lastCurrentIndex && |
| 6941 |
route.matched[lastRouteIndex] === current.matched[lastCurrentIndex] |
| 6942 |
) { |
| 6943 |
this.ensureURL(); |
| 6944 |
return abort(createNavigationDuplicatedError(current, route)) |
| 6945 |
} |
| 6946 |
|
| 6947 |
var ref = resolveQueue( |
| 6948 |
this.current.matched, |
| 6949 |
route.matched |
| 6950 |
); |
| 6951 |
var updated = ref.updated; |
| 6952 |
var deactivated = ref.deactivated; |
| 6953 |
var activated = ref.activated; |
| 6954 |
|
| 6955 |
var queue = [].concat( |
| 6956 |
// in-component leave guards |
| 6957 |
extractLeaveGuards(deactivated), |
| 6958 |
// global before hooks |
| 6959 |
this.router.beforeHooks, |
| 6960 |
// in-component update hooks |
| 6961 |
extractUpdateHooks(updated), |
| 6962 |
// in-config enter guards |
| 6963 |
activated.map(function (m) { return m.beforeEnter; }), |
| 6964 |
// async components |
| 6965 |
resolveAsyncComponents(activated) |
| 6966 |
); |
| 6967 |
|
| 6968 |
var iterator = function (hook, next) { |
| 6969 |
if (this$1.pending !== route) { |
| 6970 |
return abort(createNavigationCancelledError(current, route)) |
| 6971 |
} |
| 6972 |
try { |
| 6973 |
hook(route, current, function (to) { |
| 6974 |
if (to === false) { |
| 6975 |
// next(false) -> abort navigation, ensure current URL |
| 6976 |
this$1.ensureURL(true); |
| 6977 |
abort(createNavigationAbortedError(current, route)); |
| 6978 |
} else if (isError(to)) { |
| 6979 |
this$1.ensureURL(true); |
| 6980 |
abort(to); |
| 6981 |
} else if ( |
| 6982 |
typeof to === 'string' || |
| 6983 |
(typeof to === 'object' && |
| 6984 |
(typeof to.path === 'string' || typeof to.name === 'string')) |
| 6985 |
) { |
| 6986 |
// next('/') or next({ path: '/' }) -> redirect |
| 6987 |
abort(createNavigationRedirectedError(current, route)); |
| 6988 |
if (typeof to === 'object' && to.replace) { |
| 6989 |
this$1.replace(to); |
| 6990 |
} else { |
| 6991 |
this$1.push(to); |
| 6992 |
} |
| 6993 |
} else { |
| 6994 |
// confirm transition and pass on the value |
| 6995 |
next(to); |
| 6996 |
} |
| 6997 |
}); |
| 6998 |
} catch (e) { |
| 6999 |
abort(e); |
| 7000 |
} |
| 7001 |
}; |
| 7002 |
|
| 7003 |
runQueue(queue, iterator, function () { |
| 7004 |
// wait until async components are resolved before |
| 7005 |
// extracting in-component enter guards |
| 7006 |
var enterGuards = extractEnterGuards(activated); |
| 7007 |
var queue = enterGuards.concat(this$1.router.resolveHooks); |
| 7008 |
runQueue(queue, iterator, function () { |
| 7009 |
if (this$1.pending !== route) { |
| 7010 |
return abort(createNavigationCancelledError(current, route)) |
| 7011 |
} |
| 7012 |
this$1.pending = null; |
| 7013 |
onComplete(route); |
| 7014 |
if (this$1.router.app) { |
| 7015 |
this$1.router.app.$nextTick(function () { |
| 7016 |
handleRouteEntered(route); |
| 7017 |
}); |
| 7018 |
} |
| 7019 |
}); |
| 7020 |
}); |
| 7021 |
}; |
| 7022 |
|
| 7023 |
History.prototype.updateRoute = function updateRoute (route) { |
| 7024 |
this.current = route; |
| 7025 |
this.cb && this.cb(route); |
| 7026 |
}; |
| 7027 |
|
| 7028 |
History.prototype.setupListeners = function setupListeners () { |
| 7029 |
// Default implementation is empty |
| 7030 |
}; |
| 7031 |
|
| 7032 |
History.prototype.teardown = function teardown () { |
| 7033 |
// clean up event listeners |
| 7034 |
// https://github.com/vuejs/vue-router/issues/2341 |
| 7035 |
this.listeners.forEach(function (cleanupListener) { |
| 7036 |
cleanupListener(); |
| 7037 |
}); |
| 7038 |
this.listeners = []; |
| 7039 |
|
| 7040 |
// reset current history route |
| 7041 |
// https://github.com/vuejs/vue-router/issues/3294 |
| 7042 |
this.current = START; |
| 7043 |
this.pending = null; |
| 7044 |
}; |
| 7045 |
|
| 7046 |
function normalizeBase (base) { |
| 7047 |
if (!base) { |
| 7048 |
if (inBrowser) { |
| 7049 |
// respect <base> tag |
| 7050 |
var baseEl = document.querySelector('base'); |
| 7051 |
base = (baseEl && baseEl.getAttribute('href')) || '/'; |
| 7052 |
// strip full URL origin |
| 7053 |
base = base.replace(/^https?:\/\/[^\/]+/, ''); |
| 7054 |
} else { |
| 7055 |
base = '/'; |
| 7056 |
} |
| 7057 |
} |
| 7058 |
// make sure there's the starting slash |
| 7059 |
if (base.charAt(0) !== '/') { |
| 7060 |
base = '/' + base; |
| 7061 |
} |
| 7062 |
// remove trailing slash |
| 7063 |
return base.replace(/\/$/, '') |
| 7064 |
} |
| 7065 |
|
| 7066 |
function resolveQueue ( |
| 7067 |
current, |
| 7068 |
next |
| 7069 |
) { |
| 7070 |
var i; |
| 7071 |
var max = Math.max(current.length, next.length); |
| 7072 |
for (i = 0; i < max; i++) { |
| 7073 |
if (current[i] !== next[i]) { |
| 7074 |
break |
| 7075 |
} |
| 7076 |
} |
| 7077 |
return { |
| 7078 |
updated: next.slice(0, i), |
| 7079 |
activated: next.slice(i), |
| 7080 |
deactivated: current.slice(i) |
| 7081 |
} |
| 7082 |
} |
| 7083 |
|
| 7084 |
function extractGuards ( |
| 7085 |
records, |
| 7086 |
name, |
| 7087 |
bind, |
| 7088 |
reverse |
| 7089 |
) { |
| 7090 |
var guards = flatMapComponents(records, function (def, instance, match, key) { |
| 7091 |
var guard = extractGuard(def, name); |
| 7092 |
if (guard) { |
| 7093 |
return Array.isArray(guard) |
| 7094 |
? guard.map(function (guard) { return bind(guard, instance, match, key); }) |
| 7095 |
: bind(guard, instance, match, key) |
| 7096 |
} |
| 7097 |
}); |
| 7098 |
return flatten(reverse ? guards.reverse() : guards) |
| 7099 |
} |
| 7100 |
|
| 7101 |
function extractGuard ( |
| 7102 |
def, |
| 7103 |
key |
| 7104 |
) { |
| 7105 |
if (typeof def !== 'function') { |
| 7106 |
// extend now so that global mixins are applied. |
| 7107 |
def = _Vue.extend(def); |
| 7108 |
} |
| 7109 |
return def.options[key] |
| 7110 |
} |
| 7111 |
|
| 7112 |
function extractLeaveGuards (deactivated) { |
| 7113 |
return extractGuards(deactivated, 'beforeRouteLeave', bindGuard, true) |
| 7114 |
} |
| 7115 |
|
| 7116 |
function extractUpdateHooks (updated) { |
| 7117 |
return extractGuards(updated, 'beforeRouteUpdate', bindGuard) |
| 7118 |
} |
| 7119 |
|
| 7120 |
function bindGuard (guard, instance) { |
| 7121 |
if (instance) { |
| 7122 |
return function boundRouteGuard () { |
| 7123 |
return guard.apply(instance, arguments) |
| 7124 |
} |
| 7125 |
} |
| 7126 |
} |
| 7127 |
|
| 7128 |
function extractEnterGuards ( |
| 7129 |
activated |
| 7130 |
) { |
| 7131 |
return extractGuards( |
| 7132 |
activated, |
| 7133 |
'beforeRouteEnter', |
| 7134 |
function (guard, _, match, key) { |
| 7135 |
return bindEnterGuard(guard, match, key) |
| 7136 |
} |
| 7137 |
) |
| 7138 |
} |
| 7139 |
|
| 7140 |
function bindEnterGuard ( |
| 7141 |
guard, |
| 7142 |
match, |
| 7143 |
key |
| 7144 |
) { |
| 7145 |
return function routeEnterGuard (to, from, next) { |
| 7146 |
return guard(to, from, function (cb) { |
| 7147 |
if (typeof cb === 'function') { |
| 7148 |
if (!match.enteredCbs[key]) { |
| 7149 |
match.enteredCbs[key] = []; |
| 7150 |
} |
| 7151 |
match.enteredCbs[key].push(cb); |
| 7152 |
} |
| 7153 |
next(cb); |
| 7154 |
}) |
| 7155 |
} |
| 7156 |
} |
| 7157 |
|
| 7158 |
/* */ |
| 7159 |
|
| 7160 |
var HTML5History = /*@__PURE__*/(function (History) { |
| 7161 |
function HTML5History (router, base) { |
| 7162 |
History.call(this, router, base); |
| 7163 |
|
| 7164 |
this._startLocation = getLocation(this.base); |
| 7165 |
} |
| 7166 |
|
| 7167 |
if ( History ) HTML5History.__proto__ = History; |
| 7168 |
HTML5History.prototype = Object.create( History && History.prototype ); |
| 7169 |
HTML5History.prototype.constructor = HTML5History; |
| 7170 |
|
| 7171 |
HTML5History.prototype.setupListeners = function setupListeners () { |
| 7172 |
var this$1 = this; |
| 7173 |
|
| 7174 |
if (this.listeners.length > 0) { |
| 7175 |
return |
| 7176 |
} |
| 7177 |
|
| 7178 |
var router = this.router; |
| 7179 |
var expectScroll = router.options.scrollBehavior; |
| 7180 |
var supportsScroll = supportsPushState && expectScroll; |
| 7181 |
|
| 7182 |
if (supportsScroll) { |
| 7183 |
this.listeners.push(setupScroll()); |
| 7184 |
} |
| 7185 |
|
| 7186 |
var handleRoutingEvent = function () { |
| 7187 |
var current = this$1.current; |
| 7188 |
|
| 7189 |
// Avoiding first `popstate` event dispatched in some browsers but first |
| 7190 |
// history route not updated since async guard at the same time. |
| 7191 |
var location = getLocation(this$1.base); |
| 7192 |
if (this$1.current === START && location === this$1._startLocation) { |
| 7193 |
return |
| 7194 |
} |
| 7195 |
|
| 7196 |
this$1.transitionTo(location, function (route) { |
| 7197 |
if (supportsScroll) { |
| 7198 |
handleScroll(router, route, current, true); |
| 7199 |
} |
| 7200 |
}); |
| 7201 |
}; |
| 7202 |
window.addEventListener('popstate', handleRoutingEvent); |
| 7203 |
this.listeners.push(function () { |
| 7204 |
window.removeEventListener('popstate', handleRoutingEvent); |
| 7205 |
}); |
| 7206 |
}; |
| 7207 |
|
| 7208 |
HTML5History.prototype.go = function go (n) { |
| 7209 |
window.history.go(n); |
| 7210 |
}; |
| 7211 |
|
| 7212 |
HTML5History.prototype.push = function push (location, onComplete, onAbort) { |
| 7213 |
var this$1 = this; |
| 7214 |
|
| 7215 |
var ref = this; |
| 7216 |
var fromRoute = ref.current; |
| 7217 |
this.transitionTo(location, function (route) { |
| 7218 |
pushState(cleanPath(this$1.base + route.fullPath)); |
| 7219 |
handleScroll(this$1.router, route, fromRoute, false); |
| 7220 |
onComplete && onComplete(route); |
| 7221 |
}, onAbort); |
| 7222 |
}; |
| 7223 |
|
| 7224 |
HTML5History.prototype.replace = function replace (location, onComplete, onAbort) { |
| 7225 |
var this$1 = this; |
| 7226 |
|
| 7227 |
var ref = this; |
| 7228 |
var fromRoute = ref.current; |
| 7229 |
this.transitionTo(location, function (route) { |
| 7230 |
replaceState(cleanPath(this$1.base + route.fullPath)); |
| 7231 |
handleScroll(this$1.router, route, fromRoute, false); |
| 7232 |
onComplete && onComplete(route); |
| 7233 |
}, onAbort); |
| 7234 |
}; |
| 7235 |
|
| 7236 |
HTML5History.prototype.ensureURL = function ensureURL (push) { |
| 7237 |
if (getLocation(this.base) !== this.current.fullPath) { |
| 7238 |
var current = cleanPath(this.base + this.current.fullPath); |
| 7239 |
push ? pushState(current) : replaceState(current); |
| 7240 |
} |
| 7241 |
}; |
| 7242 |
|
| 7243 |
HTML5History.prototype.getCurrentLocation = function getCurrentLocation () { |
| 7244 |
return getLocation(this.base) |
| 7245 |
}; |
| 7246 |
|
| 7247 |
return HTML5History; |
| 7248 |
}(History)); |
| 7249 |
|
| 7250 |
function getLocation (base) { |
| 7251 |
var path = window.location.pathname; |
| 7252 |
var pathLowerCase = path.toLowerCase(); |
| 7253 |
var baseLowerCase = base.toLowerCase(); |
| 7254 |
// base="/a" shouldn't turn path="/app" into "/a/pp" |
| 7255 |
// https://github.com/vuejs/vue-router/issues/3555 |
| 7256 |
// so we ensure the trailing slash in the base |
| 7257 |
if (base && ((pathLowerCase === baseLowerCase) || |
| 7258 |
(pathLowerCase.indexOf(cleanPath(baseLowerCase + '/')) === 0))) { |
| 7259 |
path = path.slice(base.length); |
| 7260 |
} |
| 7261 |
return (path || '/') + window.location.search + window.location.hash |
| 7262 |
} |
| 7263 |
|
| 7264 |
/* */ |
| 7265 |
|
| 7266 |
var HashHistory = /*@__PURE__*/(function (History) { |
| 7267 |
function HashHistory (router, base, fallback) { |
| 7268 |
History.call(this, router, base); |
| 7269 |
// check history fallback deeplinking |
| 7270 |
if (fallback && checkFallback(this.base)) { |
| 7271 |
return |
| 7272 |
} |
| 7273 |
ensureSlash(); |
| 7274 |
} |
| 7275 |
|
| 7276 |
if ( History ) HashHistory.__proto__ = History; |
| 7277 |
HashHistory.prototype = Object.create( History && History.prototype ); |
| 7278 |
HashHistory.prototype.constructor = HashHistory; |
| 7279 |
|
| 7280 |
// this is delayed until the app mounts |
| 7281 |
// to avoid the hashchange listener being fired too early |
| 7282 |
HashHistory.prototype.setupListeners = function setupListeners () { |
| 7283 |
var this$1 = this; |
| 7284 |
|
| 7285 |
if (this.listeners.length > 0) { |
| 7286 |
return |
| 7287 |
} |
| 7288 |
|
| 7289 |
var router = this.router; |
| 7290 |
var expectScroll = router.options.scrollBehavior; |
| 7291 |
var supportsScroll = supportsPushState && expectScroll; |
| 7292 |
|
| 7293 |
if (supportsScroll) { |
| 7294 |
this.listeners.push(setupScroll()); |
| 7295 |
} |
| 7296 |
|
| 7297 |
var handleRoutingEvent = function () { |
| 7298 |
var current = this$1.current; |
| 7299 |
if (!ensureSlash()) { |
| 7300 |
return |
| 7301 |
} |
| 7302 |
this$1.transitionTo(getHash(), function (route) { |
| 7303 |
if (supportsScroll) { |
| 7304 |
handleScroll(this$1.router, route, current, true); |
| 7305 |
} |
| 7306 |
if (!supportsPushState) { |
| 7307 |
replaceHash(route.fullPath); |
| 7308 |
} |
| 7309 |
}); |
| 7310 |
}; |
| 7311 |
var eventType = supportsPushState ? 'popstate' : 'hashchange'; |
| 7312 |
window.addEventListener( |
| 7313 |
eventType, |
| 7314 |
handleRoutingEvent |
| 7315 |
); |
| 7316 |
this.listeners.push(function () { |
| 7317 |
window.removeEventListener(eventType, handleRoutingEvent); |
| 7318 |
}); |
| 7319 |
}; |
| 7320 |
|
| 7321 |
HashHistory.prototype.push = function push (location, onComplete, onAbort) { |
| 7322 |
var this$1 = this; |
| 7323 |
|
| 7324 |
var ref = this; |
| 7325 |
var fromRoute = ref.current; |
| 7326 |
this.transitionTo( |
| 7327 |
location, |
| 7328 |
function (route) { |
| 7329 |
pushHash(route.fullPath); |
| 7330 |
handleScroll(this$1.router, route, fromRoute, false); |
| 7331 |
onComplete && onComplete(route); |
| 7332 |
}, |
| 7333 |
onAbort |
| 7334 |
); |
| 7335 |
}; |
| 7336 |
|
| 7337 |
HashHistory.prototype.replace = function replace (location, onComplete, onAbort) { |
| 7338 |
var this$1 = this; |
| 7339 |
|
| 7340 |
var ref = this; |
| 7341 |
var fromRoute = ref.current; |
| 7342 |
this.transitionTo( |
| 7343 |
location, |
| 7344 |
function (route) { |
| 7345 |
replaceHash(route.fullPath); |
| 7346 |
handleScroll(this$1.router, route, fromRoute, false); |
| 7347 |
onComplete && onComplete(route); |
| 7348 |
}, |
| 7349 |
onAbort |
| 7350 |
); |
| 7351 |
}; |
| 7352 |
|
| 7353 |
HashHistory.prototype.go = function go (n) { |
| 7354 |
window.history.go(n); |
| 7355 |
}; |
| 7356 |
|
| 7357 |
HashHistory.prototype.ensureURL = function ensureURL (push) { |
| 7358 |
var current = this.current.fullPath; |
| 7359 |
if (getHash() !== current) { |
| 7360 |
push ? pushHash(current) : replaceHash(current); |
| 7361 |
} |
| 7362 |
}; |
| 7363 |
|
| 7364 |
HashHistory.prototype.getCurrentLocation = function getCurrentLocation () { |
| 7365 |
return getHash() |
| 7366 |
}; |
| 7367 |
|
| 7368 |
return HashHistory; |
| 7369 |
}(History)); |
| 7370 |
|
| 7371 |
function checkFallback (base) { |
| 7372 |
var location = getLocation(base); |
| 7373 |
if (!/^\/#/.test(location)) { |
| 7374 |
window.location.replace(cleanPath(base + '/#' + location)); |
| 7375 |
return true |
| 7376 |
} |
| 7377 |
} |
| 7378 |
|
| 7379 |
function ensureSlash () { |
| 7380 |
var path = getHash(); |
| 7381 |
if (path.charAt(0) === '/') { |
| 7382 |
return true |
| 7383 |
} |
| 7384 |
replaceHash('/' + path); |
| 7385 |
return false |
| 7386 |
} |
| 7387 |
|
| 7388 |
function getHash () { |
| 7389 |
// We can't use window.location.hash here because it's not |
| 7390 |
// consistent across browsers - Firefox will pre-decode it! |
| 7391 |
var href = window.location.href; |
| 7392 |
var index = href.indexOf('#'); |
| 7393 |
// empty path |
| 7394 |
if (index < 0) { return '' } |
| 7395 |
|
| 7396 |
href = href.slice(index + 1); |
| 7397 |
|
| 7398 |
return href |
| 7399 |
} |
| 7400 |
|
| 7401 |
function getUrl (path) { |
| 7402 |
var href = window.location.href; |
| 7403 |
var i = href.indexOf('#'); |
| 7404 |
var base = i >= 0 ? href.slice(0, i) : href; |
| 7405 |
return (base + "#" + path) |
| 7406 |
} |
| 7407 |
|
| 7408 |
function pushHash (path) { |
| 7409 |
if (supportsPushState) { |
| 7410 |
pushState(getUrl(path)); |
| 7411 |
} else { |
| 7412 |
window.location.hash = path; |
| 7413 |
} |
| 7414 |
} |
| 7415 |
|
| 7416 |
function replaceHash (path) { |
| 7417 |
if (supportsPushState) { |
| 7418 |
replaceState(getUrl(path)); |
| 7419 |
} else { |
| 7420 |
window.location.replace(getUrl(path)); |
| 7421 |
} |
| 7422 |
} |
| 7423 |
|
| 7424 |
/* */ |
| 7425 |
|
| 7426 |
var AbstractHistory = /*@__PURE__*/(function (History) { |
| 7427 |
function AbstractHistory (router, base) { |
| 7428 |
History.call(this, router, base); |
| 7429 |
this.stack = []; |
| 7430 |
this.index = -1; |
| 7431 |
} |
| 7432 |
|
| 7433 |
if ( History ) AbstractHistory.__proto__ = History; |
| 7434 |
AbstractHistory.prototype = Object.create( History && History.prototype ); |
| 7435 |
AbstractHistory.prototype.constructor = AbstractHistory; |
| 7436 |
|
| 7437 |
AbstractHistory.prototype.push = function push (location, onComplete, onAbort) { |
| 7438 |
var this$1 = this; |
| 7439 |
|
| 7440 |
this.transitionTo( |
| 7441 |
location, |
| 7442 |
function (route) { |
| 7443 |
this$1.stack = this$1.stack.slice(0, this$1.index + 1).concat(route); |
| 7444 |
this$1.index++; |
| 7445 |
onComplete && onComplete(route); |
| 7446 |
}, |
| 7447 |
onAbort |
| 7448 |
); |
| 7449 |
}; |
| 7450 |
|
| 7451 |
AbstractHistory.prototype.replace = function replace (location, onComplete, onAbort) { |
| 7452 |
var this$1 = this; |
| 7453 |
|
| 7454 |
this.transitionTo( |
| 7455 |
location, |
| 7456 |
function (route) { |
| 7457 |
this$1.stack = this$1.stack.slice(0, this$1.index).concat(route); |
| 7458 |
onComplete && onComplete(route); |
| 7459 |
}, |
| 7460 |
onAbort |
| 7461 |
); |
| 7462 |
}; |
| 7463 |
|
| 7464 |
AbstractHistory.prototype.go = function go (n) { |
| 7465 |
var this$1 = this; |
| 7466 |
|
| 7467 |
var targetIndex = this.index + n; |
| 7468 |
if (targetIndex < 0 || targetIndex >= this.stack.length) { |
| 7469 |
return |
| 7470 |
} |
| 7471 |
var route = this.stack[targetIndex]; |
| 7472 |
this.confirmTransition( |
| 7473 |
route, |
| 7474 |
function () { |
| 7475 |
var prev = this$1.current; |
| 7476 |
this$1.index = targetIndex; |
| 7477 |
this$1.updateRoute(route); |
| 7478 |
this$1.router.afterHooks.forEach(function (hook) { |
| 7479 |
hook && hook(route, prev); |
| 7480 |
}); |
| 7481 |
}, |
| 7482 |
function (err) { |
| 7483 |
if (isNavigationFailure(err, NavigationFailureType.duplicated)) { |
| 7484 |
this$1.index = targetIndex; |
| 7485 |
} |
| 7486 |
} |
| 7487 |
); |
| 7488 |
}; |
| 7489 |
|
| 7490 |
AbstractHistory.prototype.getCurrentLocation = function getCurrentLocation () { |
| 7491 |
var current = this.stack[this.stack.length - 1]; |
| 7492 |
return current ? current.fullPath : '/' |
| 7493 |
}; |
| 7494 |
|
| 7495 |
AbstractHistory.prototype.ensureURL = function ensureURL () { |
| 7496 |
// noop |
| 7497 |
}; |
| 7498 |
|
| 7499 |
return AbstractHistory; |
| 7500 |
}(History)); |
| 7501 |
|
| 7502 |
/* */ |
| 7503 |
|
| 7504 |
var VueRouter = function VueRouter (options) { |
| 7505 |
if ( options === void 0 ) options = {}; |
| 7506 |
|
| 7507 |
this.app = null; |
| 7508 |
this.apps = []; |
| 7509 |
this.options = options; |
| 7510 |
this.beforeHooks = []; |
| 7511 |
this.resolveHooks = []; |
| 7512 |
this.afterHooks = []; |
| 7513 |
this.matcher = createMatcher(options.routes || [], this); |
| 7514 |
|
| 7515 |
var mode = options.mode || 'hash'; |
| 7516 |
this.fallback = |
| 7517 |
mode === 'history' && !supportsPushState && options.fallback !== false; |
| 7518 |
if (this.fallback) { |
| 7519 |
mode = 'hash'; |
| 7520 |
} |
| 7521 |
if (!inBrowser) { |
| 7522 |
mode = 'abstract'; |
| 7523 |
} |
| 7524 |
this.mode = mode; |
| 7525 |
|
| 7526 |
switch (mode) { |
| 7527 |
case 'history': |
| 7528 |
this.history = new HTML5History(this, options.base); |
| 7529 |
break |
| 7530 |
case 'hash': |
| 7531 |
this.history = new HashHistory(this, options.base, this.fallback); |
| 7532 |
break |
| 7533 |
case 'abstract': |
| 7534 |
this.history = new AbstractHistory(this, options.base); |
| 7535 |
break |
| 7536 |
default: |
| 7537 |
if (true) { |
| 7538 |
assert(false, ("invalid mode: " + mode)); |
| 7539 |
} |
| 7540 |
} |
| 7541 |
}; |
| 7542 |
|
| 7543 |
var prototypeAccessors = { currentRoute: { configurable: true } }; |
| 7544 |
|
| 7545 |
VueRouter.prototype.match = function match (raw, current, redirectedFrom) { |
| 7546 |
return this.matcher.match(raw, current, redirectedFrom) |
| 7547 |
}; |
| 7548 |
|
| 7549 |
prototypeAccessors.currentRoute.get = function () { |
| 7550 |
return this.history && this.history.current |
| 7551 |
}; |
| 7552 |
|
| 7553 |
VueRouter.prototype.init = function init (app /* Vue component instance */) { |
| 7554 |
var this$1 = this; |
| 7555 |
|
| 7556 |
true && |
| 7557 |
assert( |
| 7558 |
install.installed, |
| 7559 |
"not installed. Make sure to call `Vue.use(VueRouter)` " + |
| 7560 |
"before creating root instance." |
| 7561 |
); |
| 7562 |
|
| 7563 |
this.apps.push(app); |
| 7564 |
|
| 7565 |
// set up app destroyed handler |
| 7566 |
// https://github.com/vuejs/vue-router/issues/2639 |
| 7567 |
app.$once('hook:destroyed', function () { |
| 7568 |
// clean out app from this.apps array once destroyed |
| 7569 |
var index = this$1.apps.indexOf(app); |
| 7570 |
if (index > -1) { this$1.apps.splice(index, 1); } |
| 7571 |
// ensure we still have a main app or null if no apps |
| 7572 |
// we do not release the router so it can be reused |
| 7573 |
if (this$1.app === app) { this$1.app = this$1.apps[0] || null; } |
| 7574 |
|
| 7575 |
if (!this$1.app) { this$1.history.teardown(); } |
| 7576 |
}); |
| 7577 |
|
| 7578 |
// main app previously initialized |
| 7579 |
// return as we don't need to set up new history listener |
| 7580 |
if (this.app) { |
| 7581 |
return |
| 7582 |
} |
| 7583 |
|
| 7584 |
this.app = app; |
| 7585 |
|
| 7586 |
var history = this.history; |
| 7587 |
|
| 7588 |
if (history instanceof HTML5History || history instanceof HashHistory) { |
| 7589 |
var handleInitialScroll = function (routeOrError) { |
| 7590 |
var from = history.current; |
| 7591 |
var expectScroll = this$1.options.scrollBehavior; |
| 7592 |
var supportsScroll = supportsPushState && expectScroll; |
| 7593 |
|
| 7594 |
if (supportsScroll && 'fullPath' in routeOrError) { |
| 7595 |
handleScroll(this$1, routeOrError, from, false); |
| 7596 |
} |
| 7597 |
}; |
| 7598 |
var setupListeners = function (routeOrError) { |
| 7599 |
history.setupListeners(); |
| 7600 |
handleInitialScroll(routeOrError); |
| 7601 |
}; |
| 7602 |
history.transitionTo( |
| 7603 |
history.getCurrentLocation(), |
| 7604 |
setupListeners, |
| 7605 |
setupListeners |
| 7606 |
); |
| 7607 |
} |
| 7608 |
|
| 7609 |
history.listen(function (route) { |
| 7610 |
this$1.apps.forEach(function (app) { |
| 7611 |
app._route = route; |
| 7612 |
}); |
| 7613 |
}); |
| 7614 |
}; |
| 7615 |
|
| 7616 |
VueRouter.prototype.beforeEach = function beforeEach (fn) { |
| 7617 |
return registerHook(this.beforeHooks, fn) |
| 7618 |
}; |
| 7619 |
|
| 7620 |
VueRouter.prototype.beforeResolve = function beforeResolve (fn) { |
| 7621 |
return registerHook(this.resolveHooks, fn) |
| 7622 |
}; |
| 7623 |
|
| 7624 |
VueRouter.prototype.afterEach = function afterEach (fn) { |
| 7625 |
return registerHook(this.afterHooks, fn) |
| 7626 |
}; |
| 7627 |
|
| 7628 |
VueRouter.prototype.onReady = function onReady (cb, errorCb) { |
| 7629 |
this.history.onReady(cb, errorCb); |
| 7630 |
}; |
| 7631 |
|
| 7632 |
VueRouter.prototype.onError = function onError (errorCb) { |
| 7633 |
this.history.onError(errorCb); |
| 7634 |
}; |
| 7635 |
|
| 7636 |
VueRouter.prototype.push = function push (location, onComplete, onAbort) { |
| 7637 |
var this$1 = this; |
| 7638 |
|
| 7639 |
// $flow-disable-line |
| 7640 |
if (!onComplete && !onAbort && typeof Promise !== 'undefined') { |
| 7641 |
return new Promise(function (resolve, reject) { |
| 7642 |
this$1.history.push(location, resolve, reject); |
| 7643 |
}) |
| 7644 |
} else { |
| 7645 |
this.history.push(location, onComplete, onAbort); |
| 7646 |
} |
| 7647 |
}; |
| 7648 |
|
| 7649 |
VueRouter.prototype.replace = function replace (location, onComplete, onAbort) { |
| 7650 |
var this$1 = this; |
| 7651 |
|
| 7652 |
// $flow-disable-line |
| 7653 |
if (!onComplete && !onAbort && typeof Promise !== 'undefined') { |
| 7654 |
return new Promise(function (resolve, reject) { |
| 7655 |
this$1.history.replace(location, resolve, reject); |
| 7656 |
}) |
| 7657 |
} else { |
| 7658 |
this.history.replace(location, onComplete, onAbort); |
| 7659 |
} |
| 7660 |
}; |
| 7661 |
|
| 7662 |
VueRouter.prototype.go = function go (n) { |
| 7663 |
this.history.go(n); |
| 7664 |
}; |
| 7665 |
|
| 7666 |
VueRouter.prototype.back = function back () { |
| 7667 |
this.go(-1); |
| 7668 |
}; |
| 7669 |
|
| 7670 |
VueRouter.prototype.forward = function forward () { |
| 7671 |
this.go(1); |
| 7672 |
}; |
| 7673 |
|
| 7674 |
VueRouter.prototype.getMatchedComponents = function getMatchedComponents (to) { |
| 7675 |
var route = to |
| 7676 |
? to.matched |
| 7677 |
? to |
| 7678 |
: this.resolve(to).route |
| 7679 |
: this.currentRoute; |
| 7680 |
if (!route) { |
| 7681 |
return [] |
| 7682 |
} |
| 7683 |
return [].concat.apply( |
| 7684 |
[], |
| 7685 |
route.matched.map(function (m) { |
| 7686 |
return Object.keys(m.components).map(function (key) { |
| 7687 |
return m.components[key] |
| 7688 |
}) |
| 7689 |
}) |
| 7690 |
) |
| 7691 |
}; |
| 7692 |
|
| 7693 |
VueRouter.prototype.resolve = function resolve ( |
| 7694 |
to, |
| 7695 |
current, |
| 7696 |
append |
| 7697 |
) { |
| 7698 |
current = current || this.history.current; |
| 7699 |
var location = normalizeLocation(to, current, append, this); |
| 7700 |
var route = this.match(location, current); |
| 7701 |
var fullPath = route.redirectedFrom || route.fullPath; |
| 7702 |
var base = this.history.base; |
| 7703 |
var href = createHref(base, fullPath, this.mode); |
| 7704 |
return { |
| 7705 |
location: location, |
| 7706 |
route: route, |
| 7707 |
href: href, |
| 7708 |
// for backwards compat |
| 7709 |
normalizedTo: location, |
| 7710 |
resolved: route |
| 7711 |
} |
| 7712 |
}; |
| 7713 |
|
| 7714 |
VueRouter.prototype.getRoutes = function getRoutes () { |
| 7715 |
return this.matcher.getRoutes() |
| 7716 |
}; |
| 7717 |
|
| 7718 |
VueRouter.prototype.addRoute = function addRoute (parentOrRoute, route) { |
| 7719 |
this.matcher.addRoute(parentOrRoute, route); |
| 7720 |
if (this.history.current !== START) { |
| 7721 |
this.history.transitionTo(this.history.getCurrentLocation()); |
| 7722 |
} |
| 7723 |
}; |
| 7724 |
|
| 7725 |
VueRouter.prototype.addRoutes = function addRoutes (routes) { |
| 7726 |
if (true) { |
| 7727 |
warn(false, 'router.addRoutes() is deprecated and has been removed in Vue Router 4. Use router.addRoute() instead.'); |
| 7728 |
} |
| 7729 |
this.matcher.addRoutes(routes); |
| 7730 |
if (this.history.current !== START) { |
| 7731 |
this.history.transitionTo(this.history.getCurrentLocation()); |
| 7732 |
} |
| 7733 |
}; |
| 7734 |
|
| 7735 |
Object.defineProperties( VueRouter.prototype, prototypeAccessors ); |
| 7736 |
|
| 7737 |
function registerHook (list, fn) { |
| 7738 |
list.push(fn); |
| 7739 |
return function () { |
| 7740 |
var i = list.indexOf(fn); |
| 7741 |
if (i > -1) { list.splice(i, 1); } |
| 7742 |
} |
| 7743 |
} |
| 7744 |
|
| 7745 |
function createHref (base, fullPath, mode) { |
| 7746 |
var path = mode === 'hash' ? '#' + fullPath : fullPath; |
| 7747 |
return base ? cleanPath(base + '/' + path) : path |
| 7748 |
} |
| 7749 |
|
| 7750 |
VueRouter.install = install; |
| 7751 |
VueRouter.version = '3.5.2'; |
| 7752 |
VueRouter.isNavigationFailure = isNavigationFailure; |
| 7753 |
VueRouter.NavigationFailureType = NavigationFailureType; |
| 7754 |
VueRouter.START_LOCATION = START; |
| 7755 |
|
| 7756 |
if (inBrowser && window.Vue) { |
| 7757 |
window.Vue.use(VueRouter); |
| 7758 |
} |
| 7759 |
|
| 7760 |
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (VueRouter); |
| 7761 |
|
| 7762 |
|
| 7763 |
/***/ }), |
| 7764 |
|
| 7765 |
/***/ "./node_modules/vue/dist/vue.esm.js": |
| 7766 |
/*!******************************************!*\ |
| 7767 |
!*** ./node_modules/vue/dist/vue.esm.js ***! |
| 7768 |
\******************************************/ |
| 7769 |
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { |
| 7770 |
|
| 7771 |
"use strict"; |
| 7772 |
__webpack_require__.r(__webpack_exports__); |
| 7773 |
/* harmony export */ __webpack_require__.d(__webpack_exports__, { |
| 7774 |
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) |
| 7775 |
/* harmony export */ }); |
| 7776 |
/*! |
| 7777 |
* Vue.js v2.6.14 |
| 7778 |
* (c) 2014-2021 Evan You |
| 7779 |
* Released under the MIT License. |
| 7780 |
*/ |
| 7781 |
/* */ |
| 7782 |
|
| 7783 |
var emptyObject = Object.freeze({}); |
| 7784 |
|
| 7785 |
// These helpers produce better VM code in JS engines due to their |
| 7786 |
// explicitness and function inlining. |
| 7787 |
function isUndef (v) { |
| 7788 |
return v === undefined || v === null |
| 7789 |
} |
| 7790 |
|
| 7791 |
function isDef (v) { |
| 7792 |
return v !== undefined && v !== null |
| 7793 |
} |
| 7794 |
|
| 7795 |
function isTrue (v) { |
| 7796 |
return v === true |
| 7797 |
} |
| 7798 |
|
| 7799 |
function isFalse (v) { |
| 7800 |
return v === false |
| 7801 |
} |
| 7802 |
|
| 7803 |
/** |
| 7804 |
* Check if value is primitive. |
| 7805 |
*/ |
| 7806 |
function isPrimitive (value) { |
| 7807 |
return ( |
| 7808 |
typeof value === 'string' || |
| 7809 |
typeof value === 'number' || |
| 7810 |
// $flow-disable-line |
| 7811 |
typeof value === 'symbol' || |
| 7812 |
typeof value === 'boolean' |
| 7813 |
) |
| 7814 |
} |
| 7815 |
|
| 7816 |
/** |
| 7817 |
* Quick object check - this is primarily used to tell |
| 7818 |
* Objects from primitive values when we know the value |
| 7819 |
* is a JSON-compliant type. |
| 7820 |
*/ |
| 7821 |
function isObject (obj) { |
| 7822 |
return obj !== null && typeof obj === 'object' |
| 7823 |
} |
| 7824 |
|
| 7825 |
/** |
| 7826 |
* Get the raw type string of a value, e.g., [object Object]. |
| 7827 |
*/ |
| 7828 |
var _toString = Object.prototype.toString; |
| 7829 |
|
| 7830 |
function toRawType (value) { |
| 7831 |
return _toString.call(value).slice(8, -1) |
| 7832 |
} |
| 7833 |
|
| 7834 |
/** |
| 7835 |
* Strict object type check. Only returns true |
| 7836 |
* for plain JavaScript objects. |
| 7837 |
*/ |
| 7838 |
function isPlainObject (obj) { |
| 7839 |
return _toString.call(obj) === '[object Object]' |
| 7840 |
} |
| 7841 |
|
| 7842 |
function isRegExp (v) { |
| 7843 |
return _toString.call(v) === '[object RegExp]' |
| 7844 |
} |
| 7845 |
|
| 7846 |
/** |
| 7847 |
* Check if val is a valid array index. |
| 7848 |
*/ |
| 7849 |
function isValidArrayIndex (val) { |
| 7850 |
var n = parseFloat(String(val)); |
| 7851 |
return n >= 0 && Math.floor(n) === n && isFinite(val) |
| 7852 |
} |
| 7853 |
|
| 7854 |
function isPromise (val) { |
| 7855 |
return ( |
| 7856 |
isDef(val) && |
| 7857 |
typeof val.then === 'function' && |
| 7858 |
typeof val.catch === 'function' |
| 7859 |
) |
| 7860 |
} |
| 7861 |
|
| 7862 |
/** |
| 7863 |
* Convert a value to a string that is actually rendered. |
| 7864 |
*/ |
| 7865 |
function toString (val) { |
| 7866 |
return val == null |
| 7867 |
? '' |
| 7868 |
: Array.isArray(val) || (isPlainObject(val) && val.toString === _toString) |
| 7869 |
? JSON.stringify(val, null, 2) |
| 7870 |
: String(val) |
| 7871 |
} |
| 7872 |
|
| 7873 |
/** |
| 7874 |
* Convert an input value to a number for persistence. |
| 7875 |
* If the conversion fails, return original string. |
| 7876 |
*/ |
| 7877 |
function toNumber (val) { |
| 7878 |
var n = parseFloat(val); |
| 7879 |
return isNaN(n) ? val : n |
| 7880 |
} |
| 7881 |
|
| 7882 |
/** |
| 7883 |
* Make a map and return a function for checking if a key |
| 7884 |
* is in that map. |
| 7885 |
*/ |
| 7886 |
function makeMap ( |
| 7887 |
str, |
| 7888 |
expectsLowerCase |
| 7889 |
) { |
| 7890 |
var map = Object.create(null); |
| 7891 |
var list = str.split(','); |
| 7892 |
for (var i = 0; i < list.length; i++) { |
| 7893 |
map[list[i]] = true; |
| 7894 |
} |
| 7895 |
return expectsLowerCase |
| 7896 |
? function (val) { return map[val.toLowerCase()]; } |
| 7897 |
: function (val) { return map[val]; } |
| 7898 |
} |
| 7899 |
|
| 7900 |
/** |
| 7901 |
* Check if a tag is a built-in tag. |
| 7902 |
*/ |
| 7903 |
var isBuiltInTag = makeMap('slot,component', true); |
| 7904 |
|
| 7905 |
/** |
| 7906 |
* Check if an attribute is a reserved attribute. |
| 7907 |
*/ |
| 7908 |
var isReservedAttribute = makeMap('key,ref,slot,slot-scope,is'); |
| 7909 |
|
| 7910 |
/** |
| 7911 |
* Remove an item from an array. |
| 7912 |
*/ |
| 7913 |
function remove (arr, item) { |
| 7914 |
if (arr.length) { |
| 7915 |
var index = arr.indexOf(item); |
| 7916 |
if (index > -1) { |
| 7917 |
return arr.splice(index, 1) |
| 7918 |
} |
| 7919 |
} |
| 7920 |
} |
| 7921 |
|
| 7922 |
/** |
| 7923 |
* Check whether an object has the property. |
| 7924 |
*/ |
| 7925 |
var hasOwnProperty = Object.prototype.hasOwnProperty; |
| 7926 |
function hasOwn (obj, key) { |
| 7927 |
return hasOwnProperty.call(obj, key) |
| 7928 |
} |
| 7929 |
|
| 7930 |
/** |
| 7931 |
* Create a cached version of a pure function. |
| 7932 |
*/ |
| 7933 |
function cached (fn) { |
| 7934 |
var cache = Object.create(null); |
| 7935 |
return (function cachedFn (str) { |
| 7936 |
var hit = cache[str]; |
| 7937 |
return hit || (cache[str] = fn(str)) |
| 7938 |
}) |
| 7939 |
} |
| 7940 |
|
| 7941 |
/** |
| 7942 |
* Camelize a hyphen-delimited string. |
| 7943 |
*/ |
| 7944 |
var camelizeRE = /-(\w)/g; |
| 7945 |
var camelize = cached(function (str) { |
| 7946 |
return str.replace(camelizeRE, function (_, c) { return c ? c.toUpperCase() : ''; }) |
| 7947 |
}); |
| 7948 |
|
| 7949 |
/** |
| 7950 |
* Capitalize a string. |
| 7951 |
*/ |
| 7952 |
var capitalize = cached(function (str) { |
| 7953 |
return str.charAt(0).toUpperCase() + str.slice(1) |
| 7954 |
}); |
| 7955 |
|
| 7956 |
/** |
| 7957 |
* Hyphenate a camelCase string. |
| 7958 |
*/ |
| 7959 |
var hyphenateRE = /\B([A-Z])/g; |
| 7960 |
var hyphenate = cached(function (str) { |
| 7961 |
return str.replace(hyphenateRE, '-$1').toLowerCase() |
| 7962 |
}); |
| 7963 |
|
| 7964 |
/** |
| 7965 |
* Simple bind polyfill for environments that do not support it, |
| 7966 |
* e.g., PhantomJS 1.x. Technically, we don't need this anymore |
| 7967 |
* since native bind is now performant enough in most browsers. |
| 7968 |
* But removing it would mean breaking code that was able to run in |
| 7969 |
* PhantomJS 1.x, so this must be kept for backward compatibility. |
| 7970 |
*/ |
| 7971 |
|
| 7972 |
/* istanbul ignore next */ |
| 7973 |
function polyfillBind (fn, ctx) { |
| 7974 |
function boundFn (a) { |
| 7975 |
var l = arguments.length; |
| 7976 |
return l |
| 7977 |
? l > 1 |
| 7978 |
? fn.apply(ctx, arguments) |
| 7979 |
: fn.call(ctx, a) |
| 7980 |
: fn.call(ctx) |
| 7981 |
} |
| 7982 |
|
| 7983 |
boundFn._length = fn.length; |
| 7984 |
return boundFn |
| 7985 |
} |
| 7986 |
|
| 7987 |
function nativeBind (fn, ctx) { |
| 7988 |
return fn.bind(ctx) |
| 7989 |
} |
| 7990 |
|
| 7991 |
var bind = Function.prototype.bind |
| 7992 |
? nativeBind |
| 7993 |
: polyfillBind; |
| 7994 |
|
| 7995 |
/** |
| 7996 |
* Convert an Array-like object to a real Array. |
| 7997 |
*/ |
| 7998 |
function toArray (list, start) { |
| 7999 |
start = start || 0; |
| 8000 |
var i = list.length - start; |
| 8001 |
var ret = new Array(i); |
| 8002 |
while (i--) { |
| 8003 |
ret[i] = list[i + start]; |
| 8004 |
} |
| 8005 |
return ret |
| 8006 |
} |
| 8007 |
|
| 8008 |
/** |
| 8009 |
* Mix properties into target object. |
| 8010 |
*/ |
| 8011 |
function extend (to, _from) { |
| 8012 |
for (var key in _from) { |
| 8013 |
to[key] = _from[key]; |
| 8014 |
} |
| 8015 |
return to |
| 8016 |
} |
| 8017 |
|
| 8018 |
/** |
| 8019 |
* Merge an Array of Objects into a single Object. |
| 8020 |
*/ |
| 8021 |
function toObject (arr) { |
| 8022 |
var res = {}; |
| 8023 |
for (var i = 0; i < arr.length; i++) { |
| 8024 |
if (arr[i]) { |
| 8025 |
extend(res, arr[i]); |
| 8026 |
} |
| 8027 |
} |
| 8028 |
return res |
| 8029 |
} |
| 8030 |
|
| 8031 |
/* eslint-disable no-unused-vars */ |
| 8032 |
|
| 8033 |
/** |
| 8034 |
* Perform no operation. |
| 8035 |
* Stubbing args to make Flow happy without leaving useless transpiled code |
| 8036 |
* with ...rest (https://flow.org/blog/2017/05/07/Strict-Function-Call-Arity/). |
| 8037 |
*/ |
| 8038 |
function noop (a, b, c) {} |
| 8039 |
|
| 8040 |
/** |
| 8041 |
* Always return false. |
| 8042 |
*/ |
| 8043 |
var no = function (a, b, c) { return false; }; |
| 8044 |
|
| 8045 |
/* eslint-enable no-unused-vars */ |
| 8046 |
|
| 8047 |
/** |
| 8048 |
* Return the same value. |
| 8049 |
*/ |
| 8050 |
var identity = function (_) { return _; }; |
| 8051 |
|
| 8052 |
/** |
| 8053 |
* Generate a string containing static keys from compiler modules. |
| 8054 |
*/ |
| 8055 |
function genStaticKeys (modules) { |
| 8056 |
return modules.reduce(function (keys, m) { |
| 8057 |
return keys.concat(m.staticKeys || []) |
| 8058 |
}, []).join(',') |
| 8059 |
} |
| 8060 |
|
| 8061 |
/** |
| 8062 |
* Check if two values are loosely equal - that is, |
| 8063 |
* if they are plain objects, do they have the same shape? |
| 8064 |
*/ |
| 8065 |
function looseEqual (a, b) { |
| 8066 |
if (a === b) { return true } |
| 8067 |
var isObjectA = isObject(a); |
| 8068 |
var isObjectB = isObject(b); |
| 8069 |
if (isObjectA && isObjectB) { |
| 8070 |
try { |
| 8071 |
var isArrayA = Array.isArray(a); |
| 8072 |
var isArrayB = Array.isArray(b); |
| 8073 |
if (isArrayA && isArrayB) { |
| 8074 |
return a.length === b.length && a.every(function (e, i) { |
| 8075 |
return looseEqual(e, b[i]) |
| 8076 |
}) |
| 8077 |
} else if (a instanceof Date && b instanceof Date) { |
| 8078 |
return a.getTime() === b.getTime() |
| 8079 |
} else if (!isArrayA && !isArrayB) { |
| 8080 |
var keysA = Object.keys(a); |
| 8081 |
var keysB = Object.keys(b); |
| 8082 |
return keysA.length === keysB.length && keysA.every(function (key) { |
| 8083 |
return looseEqual(a[key], b[key]) |
| 8084 |
}) |
| 8085 |
} else { |
| 8086 |
/* istanbul ignore next */ |
| 8087 |
return false |
| 8088 |
} |
| 8089 |
} catch (e) { |
| 8090 |
/* istanbul ignore next */ |
| 8091 |
return false |
| 8092 |
} |
| 8093 |
} else if (!isObjectA && !isObjectB) { |
| 8094 |
return String(a) === String(b) |
| 8095 |
} else { |
| 8096 |
return false |
| 8097 |
} |
| 8098 |
} |
| 8099 |
|
| 8100 |
/** |
| 8101 |
* Return the first index at which a loosely equal value can be |
| 8102 |
* found in the array (if value is a plain object, the array must |
| 8103 |
* contain an object of the same shape), or -1 if it is not present. |
| 8104 |
*/ |
| 8105 |
function looseIndexOf (arr, val) { |
| 8106 |
for (var i = 0; i < arr.length; i++) { |
| 8107 |
if (looseEqual(arr[i], val)) { return i } |
| 8108 |
} |
| 8109 |
return -1 |
| 8110 |
} |
| 8111 |
|
| 8112 |
/** |
| 8113 |
* Ensure a function is called only once. |
| 8114 |
*/ |
| 8115 |
function once (fn) { |
| 8116 |
var called = false; |
| 8117 |
return function () { |
| 8118 |
if (!called) { |
| 8119 |
called = true; |
| 8120 |
fn.apply(this, arguments); |
| 8121 |
} |
| 8122 |
} |
| 8123 |
} |
| 8124 |
|
| 8125 |
var SSR_ATTR = 'data-server-rendered'; |
| 8126 |
|
| 8127 |
var ASSET_TYPES = [ |
| 8128 |
'component', |
| 8129 |
'directive', |
| 8130 |
'filter' |
| 8131 |
]; |
| 8132 |
|
| 8133 |
var LIFECYCLE_HOOKS = [ |
| 8134 |
'beforeCreate', |
| 8135 |
'created', |
| 8136 |
'beforeMount', |
| 8137 |
'mounted', |
| 8138 |
'beforeUpdate', |
| 8139 |
'updated', |
| 8140 |
'beforeDestroy', |
| 8141 |
'destroyed', |
| 8142 |
'activated', |
| 8143 |
'deactivated', |
| 8144 |
'errorCaptured', |
| 8145 |
'serverPrefetch' |
| 8146 |
]; |
| 8147 |
|
| 8148 |
/* */ |
| 8149 |
|
| 8150 |
|
| 8151 |
|
| 8152 |
var config = ({ |
| 8153 |
/** |
| 8154 |
* Option merge strategies (used in core/util/options) |
| 8155 |
*/ |
| 8156 |
// $flow-disable-line |
| 8157 |
optionMergeStrategies: Object.create(null), |
| 8158 |
|
| 8159 |
/** |
| 8160 |
* Whether to suppress warnings. |
| 8161 |
*/ |
| 8162 |
silent: false, |
| 8163 |
|
| 8164 |
/** |
| 8165 |
* Show production mode tip message on boot? |
| 8166 |
*/ |
| 8167 |
productionTip: "development" !== 'production', |
| 8168 |
|
| 8169 |
/** |
| 8170 |
* Whether to enable devtools |
| 8171 |
*/ |
| 8172 |
devtools: "development" !== 'production', |
| 8173 |
|
| 8174 |
/** |
| 8175 |
* Whether to record perf |
| 8176 |
*/ |
| 8177 |
performance: false, |
| 8178 |
|
| 8179 |
/** |
| 8180 |
* Error handler for watcher errors |
| 8181 |
*/ |
| 8182 |
errorHandler: null, |
| 8183 |
|
| 8184 |
/** |
| 8185 |
* Warn handler for watcher warns |
| 8186 |
*/ |
| 8187 |
warnHandler: null, |
| 8188 |
|
| 8189 |
/** |
| 8190 |
* Ignore certain custom elements |
| 8191 |
*/ |
| 8192 |
ignoredElements: [], |
| 8193 |
|
| 8194 |
/** |
| 8195 |
* Custom user key aliases for v-on |
| 8196 |
*/ |
| 8197 |
// $flow-disable-line |
| 8198 |
keyCodes: Object.create(null), |
| 8199 |
|
| 8200 |
/** |
| 8201 |
* Check if a tag is reserved so that it cannot be registered as a |
| 8202 |
* component. This is platform-dependent and may be overwritten. |
| 8203 |
*/ |
| 8204 |
isReservedTag: no, |
| 8205 |
|
| 8206 |
/** |
| 8207 |
* Check if an attribute is reserved so that it cannot be used as a component |
| 8208 |
* prop. This is platform-dependent and may be overwritten. |
| 8209 |
*/ |
| 8210 |
isReservedAttr: no, |
| 8211 |
|
| 8212 |
/** |
| 8213 |
* Check if a tag is an unknown element. |
| 8214 |
* Platform-dependent. |
| 8215 |
*/ |
| 8216 |
isUnknownElement: no, |
| 8217 |
|
| 8218 |
/** |
| 8219 |
* Get the namespace of an element |
| 8220 |
*/ |
| 8221 |
getTagNamespace: noop, |
| 8222 |
|
| 8223 |
/** |
| 8224 |
* Parse the real tag name for the specific platform. |
| 8225 |
*/ |
| 8226 |
parsePlatformTagName: identity, |
| 8227 |
|
| 8228 |
/** |
| 8229 |
* Check if an attribute must be bound using property, e.g. value |
| 8230 |
* Platform-dependent. |
| 8231 |
*/ |
| 8232 |
mustUseProp: no, |
| 8233 |
|
| 8234 |
/** |
| 8235 |
* Perform updates asynchronously. Intended to be used by Vue Test Utils |
| 8236 |
* This will significantly reduce performance if set to false. |
| 8237 |
*/ |
| 8238 |
async: true, |
| 8239 |
|
| 8240 |
/** |
| 8241 |
* Exposed for legacy reasons |
| 8242 |
*/ |
| 8243 |
_lifecycleHooks: LIFECYCLE_HOOKS |
| 8244 |
}); |
| 8245 |
|
| 8246 |
/* */ |
| 8247 |
|
| 8248 |
/** |
| 8249 |
* unicode letters used for parsing html tags, component names and property paths. |
| 8250 |
* using https://www.w3.org/TR/html53/semantics-scripting.html#potentialcustomelementname |
| 8251 |
* skipping \u10000-\uEFFFF due to it freezing up PhantomJS |
| 8252 |
*/ |
| 8253 |
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/; |
| 8254 |
|
| 8255 |
/** |
| 8256 |
* Check if a string starts with $ or _ |
| 8257 |
*/ |
| 8258 |
function isReserved (str) { |
| 8259 |
var c = (str + '').charCodeAt(0); |
| 8260 |
return c === 0x24 || c === 0x5F |
| 8261 |
} |
| 8262 |
|
| 8263 |
/** |
| 8264 |
* Define a property. |
| 8265 |
*/ |
| 8266 |
function def (obj, key, val, enumerable) { |
| 8267 |
Object.defineProperty(obj, key, { |
| 8268 |
value: val, |
| 8269 |
enumerable: !!enumerable, |
| 8270 |
writable: true, |
| 8271 |
configurable: true |
| 8272 |
}); |
| 8273 |
} |
| 8274 |
|
| 8275 |
/** |
| 8276 |
* Parse simple path. |
| 8277 |
*/ |
| 8278 |
var bailRE = new RegExp(("[^" + (unicodeRegExp.source) + ".$_\\d]")); |
| 8279 |
function parsePath (path) { |
| 8280 |
if (bailRE.test(path)) { |
| 8281 |
return |
| 8282 |
} |
| 8283 |
var segments = path.split('.'); |
| 8284 |
return function (obj) { |
| 8285 |
for (var i = 0; i < segments.length; i++) { |
| 8286 |
if (!obj) { return } |
| 8287 |
obj = obj[segments[i]]; |
| 8288 |
} |
| 8289 |
return obj |
| 8290 |
} |
| 8291 |
} |
| 8292 |
|
| 8293 |
/* */ |
| 8294 |
|
| 8295 |
// can we use __proto__? |
| 8296 |
var hasProto = '__proto__' in {}; |
| 8297 |
|
| 8298 |
// Browser environment sniffing |
| 8299 |
var inBrowser = typeof window !== 'undefined'; |
| 8300 |
var inWeex = typeof WXEnvironment !== 'undefined' && !!WXEnvironment.platform; |
| 8301 |
var weexPlatform = inWeex && WXEnvironment.platform.toLowerCase(); |
| 8302 |
var UA = inBrowser && window.navigator.userAgent.toLowerCase(); |
| 8303 |
var isIE = UA && /msie|trident/.test(UA); |
| 8304 |
var isIE9 = UA && UA.indexOf('msie 9.0') > 0; |
| 8305 |
var isEdge = UA && UA.indexOf('edge/') > 0; |
| 8306 |
var isAndroid = (UA && UA.indexOf('android') > 0) || (weexPlatform === 'android'); |
| 8307 |
var isIOS = (UA && /iphone|ipad|ipod|ios/.test(UA)) || (weexPlatform === 'ios'); |
| 8308 |
var isChrome = UA && /chrome\/\d+/.test(UA) && !isEdge; |
| 8309 |
var isPhantomJS = UA && /phantomjs/.test(UA); |
| 8310 |
var isFF = UA && UA.match(/firefox\/(\d+)/); |
| 8311 |
|
| 8312 |
// Firefox has a "watch" function on Object.prototype... |
| 8313 |
var nativeWatch = ({}).watch; |
| 8314 |
|
| 8315 |
var supportsPassive = false; |
| 8316 |
if (inBrowser) { |
| 8317 |
try { |
| 8318 |
var opts = {}; |
| 8319 |
Object.defineProperty(opts, 'passive', ({ |
| 8320 |
get: function get () { |
| 8321 |
/* istanbul ignore next */ |
| 8322 |
supportsPassive = true; |
| 8323 |
} |
| 8324 |
})); // https://github.com/facebook/flow/issues/285 |
| 8325 |
window.addEventListener('test-passive', null, opts); |
| 8326 |
} catch (e) {} |
| 8327 |
} |
| 8328 |
|
| 8329 |
// this needs to be lazy-evaled because vue may be required before |
| 8330 |
// vue-server-renderer can set VUE_ENV |
| 8331 |
var _isServer; |
| 8332 |
var isServerRendering = function () { |
| 8333 |
if (_isServer === undefined) { |
| 8334 |
/* istanbul ignore if */ |
| 8335 |
if (!inBrowser && !inWeex && typeof __webpack_require__.g !== 'undefined') { |
| 8336 |
// detect presence of vue-server-renderer and avoid |
| 8337 |
// Webpack shimming the process |
| 8338 |
_isServer = __webpack_require__.g['process'] && __webpack_require__.g['process'].env.VUE_ENV === 'server'; |
| 8339 |
} else { |
| 8340 |
_isServer = false; |
| 8341 |
} |
| 8342 |
} |
| 8343 |
return _isServer |
| 8344 |
}; |
| 8345 |
|
| 8346 |
// detect devtools |
| 8347 |
var devtools = inBrowser && window.__VUE_DEVTOOLS_GLOBAL_HOOK__; |
| 8348 |
|
| 8349 |
/* istanbul ignore next */ |
| 8350 |
function isNative (Ctor) { |
| 8351 |
return typeof Ctor === 'function' && /native code/.test(Ctor.toString()) |
| 8352 |
} |
| 8353 |
|
| 8354 |
var hasSymbol = |
| 8355 |
typeof Symbol !== 'undefined' && isNative(Symbol) && |
| 8356 |
typeof Reflect !== 'undefined' && isNative(Reflect.ownKeys); |
| 8357 |
|
| 8358 |
var _Set; |
| 8359 |
/* istanbul ignore if */ // $flow-disable-line |
| 8360 |
if (typeof Set !== 'undefined' && isNative(Set)) { |
| 8361 |
// use native Set when available. |
| 8362 |
_Set = Set; |
| 8363 |
} else { |
| 8364 |
// a non-standard Set polyfill that only works with primitive keys. |
| 8365 |
_Set = /*@__PURE__*/(function () { |
| 8366 |
function Set () { |
| 8367 |
this.set = Object.create(null); |
| 8368 |
} |
| 8369 |
Set.prototype.has = function has (key) { |
| 8370 |
return this.set[key] === true |
| 8371 |
}; |
| 8372 |
Set.prototype.add = function add (key) { |
| 8373 |
this.set[key] = true; |
| 8374 |
}; |
| 8375 |
Set.prototype.clear = function clear () { |
| 8376 |
this.set = Object.create(null); |
| 8377 |
}; |
| 8378 |
|
| 8379 |
return Set; |
| 8380 |
}()); |
| 8381 |
} |
| 8382 |
|
| 8383 |
/* */ |
| 8384 |
|
| 8385 |
var warn = noop; |
| 8386 |
var tip = noop; |
| 8387 |
var generateComponentTrace = (noop); // work around flow check |
| 8388 |
var formatComponentName = (noop); |
| 8389 |
|
| 8390 |
if (true) { |
| 8391 |
var hasConsole = typeof console !== 'undefined'; |
| 8392 |
var classifyRE = /(?:^|[-_])(\w)/g; |
| 8393 |
var classify = function (str) { return str |
| 8394 |
.replace(classifyRE, function (c) { return c.toUpperCase(); }) |
| 8395 |
.replace(/[-_]/g, ''); }; |
| 8396 |
|
| 8397 |
warn = function (msg, vm) { |
| 8398 |
var trace = vm ? generateComponentTrace(vm) : ''; |
| 8399 |
|
| 8400 |
if (config.warnHandler) { |
| 8401 |
config.warnHandler.call(null, msg, vm, trace); |
| 8402 |
} else if (hasConsole && (!config.silent)) { |
| 8403 |
console.error(("[Vue warn]: " + msg + trace)); |
| 8404 |
} |
| 8405 |
}; |
| 8406 |
|
| 8407 |
tip = function (msg, vm) { |
| 8408 |
if (hasConsole && (!config.silent)) { |
| 8409 |
console.warn("[Vue tip]: " + msg + ( |
| 8410 |
vm ? generateComponentTrace(vm) : '' |
| 8411 |
)); |
| 8412 |
} |
| 8413 |
}; |
| 8414 |
|
| 8415 |
formatComponentName = function (vm, includeFile) { |
| 8416 |
if (vm.$root === vm) { |
| 8417 |
return '<Root>' |
| 8418 |
} |
| 8419 |
var options = typeof vm === 'function' && vm.cid != null |
| 8420 |
? vm.options |
| 8421 |
: vm._isVue |
| 8422 |
? vm.$options || vm.constructor.options |
| 8423 |
: vm; |
| 8424 |
var name = options.name || options._componentTag; |
| 8425 |
var file = options.__file; |
| 8426 |
if (!name && file) { |
| 8427 |
var match = file.match(/([^/\\]+)\.vue$/); |
| 8428 |
name = match && match[1]; |
| 8429 |
} |
| 8430 |
|
| 8431 |
return ( |
| 8432 |
(name ? ("<" + (classify(name)) + ">") : "<Anonymous>") + |
| 8433 |
(file && includeFile !== false ? (" at " + file) : '') |
| 8434 |
) |
| 8435 |
}; |
| 8436 |
|
| 8437 |
var repeat = function (str, n) { |
| 8438 |
var res = ''; |
| 8439 |
while (n) { |
| 8440 |
if (n % 2 === 1) { res += str; } |
| 8441 |
if (n > 1) { str += str; } |
| 8442 |
n >>= 1; |
| 8443 |
} |
| 8444 |
return res |
| 8445 |
}; |
| 8446 |
|
| 8447 |
generateComponentTrace = function (vm) { |
| 8448 |
if (vm._isVue && vm.$parent) { |
| 8449 |
var tree = []; |
| 8450 |
var currentRecursiveSequence = 0; |
| 8451 |
while (vm) { |
| 8452 |
if (tree.length > 0) { |
| 8453 |
var last = tree[tree.length - 1]; |
| 8454 |
if (last.constructor === vm.constructor) { |
| 8455 |
currentRecursiveSequence++; |
| 8456 |
vm = vm.$parent; |
| 8457 |
continue |
| 8458 |
} else if (currentRecursiveSequence > 0) { |
| 8459 |
tree[tree.length - 1] = [last, currentRecursiveSequence]; |
| 8460 |
currentRecursiveSequence = 0; |
| 8461 |
} |
| 8462 |
} |
| 8463 |
tree.push(vm); |
| 8464 |
vm = vm.$parent; |
| 8465 |
} |
| 8466 |
return '\n\nfound in\n\n' + tree |
| 8467 |
.map(function (vm, i) { return ("" + (i === 0 ? '---> ' : repeat(' ', 5 + i * 2)) + (Array.isArray(vm) |
| 8468 |
? ((formatComponentName(vm[0])) + "... (" + (vm[1]) + " recursive calls)") |
| 8469 |
: formatComponentName(vm))); }) |
| 8470 |
.join('\n') |
| 8471 |
} else { |
| 8472 |
return ("\n\n(found in " + (formatComponentName(vm)) + ")") |
| 8473 |
} |
| 8474 |
}; |
| 8475 |
} |
| 8476 |
|
| 8477 |
/* */ |
| 8478 |
|
| 8479 |
var uid = 0; |
| 8480 |
|
| 8481 |
/** |
| 8482 |
* A dep is an observable that can have multiple |
| 8483 |
* directives subscribing to it. |
| 8484 |
*/ |
| 8485 |
var Dep = function Dep () { |
| 8486 |
this.id = uid++; |
| 8487 |
this.subs = []; |
| 8488 |
}; |
| 8489 |
|
| 8490 |
Dep.prototype.addSub = function addSub (sub) { |
| 8491 |
this.subs.push(sub); |
| 8492 |
}; |
| 8493 |
|
| 8494 |
Dep.prototype.removeSub = function removeSub (sub) { |
| 8495 |
remove(this.subs, sub); |
| 8496 |
}; |
| 8497 |
|
| 8498 |
Dep.prototype.depend = function depend () { |
| 8499 |
if (Dep.target) { |
| 8500 |
Dep.target.addDep(this); |
| 8501 |
} |
| 8502 |
}; |
| 8503 |
|
| 8504 |
Dep.prototype.notify = function notify () { |
| 8505 |
// stabilize the subscriber list first |
| 8506 |
var subs = this.subs.slice(); |
| 8507 |
if ( true && !config.async) { |
| 8508 |
// subs aren't sorted in scheduler if not running async |
| 8509 |
// we need to sort them now to make sure they fire in correct |
| 8510 |
// order |
| 8511 |
subs.sort(function (a, b) { return a.id - b.id; }); |
| 8512 |
} |
| 8513 |
for (var i = 0, l = subs.length; i < l; i++) { |
| 8514 |
subs[i].update(); |
| 8515 |
} |
| 8516 |
}; |
| 8517 |
|
| 8518 |
// The current target watcher being evaluated. |
| 8519 |
// This is globally unique because only one watcher |
| 8520 |
// can be evaluated at a time. |
| 8521 |
Dep.target = null; |
| 8522 |
var targetStack = []; |
| 8523 |
|
| 8524 |
function pushTarget (target) { |
| 8525 |
targetStack.push(target); |
| 8526 |
Dep.target = target; |
| 8527 |
} |
| 8528 |
|
| 8529 |
function popTarget () { |
| 8530 |
targetStack.pop(); |
| 8531 |
Dep.target = targetStack[targetStack.length - 1]; |
| 8532 |
} |
| 8533 |
|
| 8534 |
/* */ |
| 8535 |
|
| 8536 |
var VNode = function VNode ( |
| 8537 |
tag, |
| 8538 |
data, |
| 8539 |
children, |
| 8540 |
text, |
| 8541 |
elm, |
| 8542 |
context, |
| 8543 |
componentOptions, |
| 8544 |
asyncFactory |
| 8545 |
) { |
| 8546 |
this.tag = tag; |
| 8547 |
this.data = data; |
| 8548 |
this.children = children; |
| 8549 |
this.text = text; |
| 8550 |
this.elm = elm; |
| 8551 |
this.ns = undefined; |
| 8552 |
this.context = context; |
| 8553 |
this.fnContext = undefined; |
| 8554 |
this.fnOptions = undefined; |
| 8555 |
this.fnScopeId = undefined; |
| 8556 |
this.key = data && data.key; |
| 8557 |
this.componentOptions = componentOptions; |
| 8558 |
this.componentInstance = undefined; |
| 8559 |
this.parent = undefined; |
| 8560 |
this.raw = false; |
| 8561 |
this.isStatic = false; |
| 8562 |
this.isRootInsert = true; |
| 8563 |
this.isComment = false; |
| 8564 |
this.isCloned = false; |
| 8565 |
this.isOnce = false; |
| 8566 |
this.asyncFactory = asyncFactory; |
| 8567 |
this.asyncMeta = undefined; |
| 8568 |
this.isAsyncPlaceholder = false; |
| 8569 |
}; |
| 8570 |
|
| 8571 |
var prototypeAccessors = { child: { configurable: true } }; |
| 8572 |
|
| 8573 |
// DEPRECATED: alias for componentInstance for backwards compat. |
| 8574 |
/* istanbul ignore next */ |
| 8575 |
prototypeAccessors.child.get = function () { |
| 8576 |
return this.componentInstance |
| 8577 |
}; |
| 8578 |
|
| 8579 |
Object.defineProperties( VNode.prototype, prototypeAccessors ); |
| 8580 |
|
| 8581 |
var createEmptyVNode = function (text) { |
| 8582 |
if ( text === void 0 ) text = ''; |
| 8583 |
|
| 8584 |
var node = new VNode(); |
| 8585 |
node.text = text; |
| 8586 |
node.isComment = true; |
| 8587 |
return node |
| 8588 |
}; |
| 8589 |
|
| 8590 |
function createTextVNode (val) { |
| 8591 |
return new VNode(undefined, undefined, undefined, String(val)) |
| 8592 |
} |
| 8593 |
|
| 8594 |
// optimized shallow clone |
| 8595 |
// used for static nodes and slot nodes because they may be reused across |
| 8596 |
// multiple renders, cloning them avoids errors when DOM manipulations rely |
| 8597 |
// on their elm reference. |
| 8598 |
function cloneVNode (vnode) { |
| 8599 |
var cloned = new VNode( |
| 8600 |
vnode.tag, |
| 8601 |
vnode.data, |
| 8602 |
// #7975 |
| 8603 |
// clone children array to avoid mutating original in case of cloning |
| 8604 |
// a child. |
| 8605 |
vnode.children && vnode.children.slice(), |
| 8606 |
vnode.text, |
| 8607 |
vnode.elm, |
| 8608 |
vnode.context, |
| 8609 |
vnode.componentOptions, |
| 8610 |
vnode.asyncFactory |
| 8611 |
); |
| 8612 |
cloned.ns = vnode.ns; |
| 8613 |
cloned.isStatic = vnode.isStatic; |
| 8614 |
cloned.key = vnode.key; |
| 8615 |
cloned.isComment = vnode.isComment; |
| 8616 |
cloned.fnContext = vnode.fnContext; |
| 8617 |
cloned.fnOptions = vnode.fnOptions; |
| 8618 |
cloned.fnScopeId = vnode.fnScopeId; |
| 8619 |
cloned.asyncMeta = vnode.asyncMeta; |
| 8620 |
cloned.isCloned = true; |
| 8621 |
return cloned |
| 8622 |
} |
| 8623 |
|
| 8624 |
/* |
| 8625 |
* not type checking this file because flow doesn't play well with |
| 8626 |
* dynamically accessing methods on Array prototype |
| 8627 |
*/ |
| 8628 |
|
| 8629 |
var arrayProto = Array.prototype; |
| 8630 |
var arrayMethods = Object.create(arrayProto); |
| 8631 |
|
| 8632 |
var methodsToPatch = [ |
| 8633 |
'push', |
| 8634 |
'pop', |
| 8635 |
'shift', |
| 8636 |
'unshift', |
| 8637 |
'splice', |
| 8638 |
'sort', |
| 8639 |
'reverse' |
| 8640 |
]; |
| 8641 |
|
| 8642 |
/** |
| 8643 |
* Intercept mutating methods and emit events |
| 8644 |
*/ |
| 8645 |
methodsToPatch.forEach(function (method) { |
| 8646 |
// cache original method |
| 8647 |
var original = arrayProto[method]; |
| 8648 |
def(arrayMethods, method, function mutator () { |
| 8649 |
var args = [], len = arguments.length; |
| 8650 |
while ( len-- ) args[ len ] = arguments[ len ]; |
| 8651 |
|
| 8652 |
var result = original.apply(this, args); |
| 8653 |
var ob = this.__ob__; |
| 8654 |
var inserted; |
| 8655 |
switch (method) { |
| 8656 |
case 'push': |
| 8657 |
case 'unshift': |
| 8658 |
inserted = args; |
| 8659 |
break |
| 8660 |
case 'splice': |
| 8661 |
inserted = args.slice(2); |
| 8662 |
break |
| 8663 |
} |
| 8664 |
if (inserted) { ob.observeArray(inserted); } |
| 8665 |
// notify change |
| 8666 |
ob.dep.notify(); |
| 8667 |
return result |
| 8668 |
}); |
| 8669 |
}); |
| 8670 |
|
| 8671 |
/* */ |
| 8672 |
|
| 8673 |
var arrayKeys = Object.getOwnPropertyNames(arrayMethods); |
| 8674 |
|
| 8675 |
/** |
| 8676 |
* In some cases we may want to disable observation inside a component's |
| 8677 |
* update computation. |
| 8678 |
*/ |
| 8679 |
var shouldObserve = true; |
| 8680 |
|
| 8681 |
function toggleObserving (value) { |
| 8682 |
shouldObserve = value; |
| 8683 |
} |
| 8684 |
|
| 8685 |
/** |
| 8686 |
* Observer class that is attached to each observed |
| 8687 |
* object. Once attached, the observer converts the target |
| 8688 |
* object's property keys into getter/setters that |
| 8689 |
* collect dependencies and dispatch updates. |
| 8690 |
*/ |
| 8691 |
var Observer = function Observer (value) { |
| 8692 |
this.value = value; |
| 8693 |
this.dep = new Dep(); |
| 8694 |
this.vmCount = 0; |
| 8695 |
def(value, '__ob__', this); |
| 8696 |
if (Array.isArray(value)) { |
| 8697 |
if (hasProto) { |
| 8698 |
protoAugment(value, arrayMethods); |
| 8699 |
} else { |
| 8700 |
copyAugment(value, arrayMethods, arrayKeys); |
| 8701 |
} |
| 8702 |
this.observeArray(value); |
| 8703 |
} else { |
| 8704 |
this.walk(value); |
| 8705 |
} |
| 8706 |
}; |
| 8707 |
|
| 8708 |
/** |
| 8709 |
* Walk through all properties and convert them into |
| 8710 |
* getter/setters. This method should only be called when |
| 8711 |
* value type is Object. |
| 8712 |
*/ |
| 8713 |
Observer.prototype.walk = function walk (obj) { |
| 8714 |
var keys = Object.keys(obj); |
| 8715 |
for (var i = 0; i < keys.length; i++) { |
| 8716 |
defineReactive$$1(obj, keys[i]); |
| 8717 |
} |
| 8718 |
}; |
| 8719 |
|
| 8720 |
/** |
| 8721 |
* Observe a list of Array items. |
| 8722 |
*/ |
| 8723 |
Observer.prototype.observeArray = function observeArray (items) { |
| 8724 |
for (var i = 0, l = items.length; i < l; i++) { |
| 8725 |
observe(items[i]); |
| 8726 |
} |
| 8727 |
}; |
| 8728 |
|
| 8729 |
// helpers |
| 8730 |
|
| 8731 |
/** |
| 8732 |
* Augment a target Object or Array by intercepting |
| 8733 |
* the prototype chain using __proto__ |
| 8734 |
*/ |
| 8735 |
function protoAugment (target, src) { |
| 8736 |
/* eslint-disable no-proto */ |
| 8737 |
target.__proto__ = src; |
| 8738 |
/* eslint-enable no-proto */ |
| 8739 |
} |
| 8740 |
|
| 8741 |
/** |
| 8742 |
* Augment a target Object or Array by defining |
| 8743 |
* hidden properties. |
| 8744 |
*/ |
| 8745 |
/* istanbul ignore next */ |
| 8746 |
function copyAugment (target, src, keys) { |
| 8747 |
for (var i = 0, l = keys.length; i < l; i++) { |
| 8748 |
var key = keys[i]; |
| 8749 |
def(target, key, src[key]); |
| 8750 |
} |
| 8751 |
} |
| 8752 |
|
| 8753 |
/** |
| 8754 |
* Attempt to create an observer instance for a value, |
| 8755 |
* returns the new observer if successfully observed, |
| 8756 |
* or the existing observer if the value already has one. |
| 8757 |
*/ |
| 8758 |
function observe (value, asRootData) { |
| 8759 |
if (!isObject(value) || value instanceof VNode) { |
| 8760 |
return |
| 8761 |
} |
| 8762 |
var ob; |
| 8763 |
if (hasOwn(value, '__ob__') && value.__ob__ instanceof Observer) { |
| 8764 |
ob = value.__ob__; |
| 8765 |
} else if ( |
| 8766 |
shouldObserve && |
| 8767 |
!isServerRendering() && |
| 8768 |
(Array.isArray(value) || isPlainObject(value)) && |
| 8769 |
Object.isExtensible(value) && |
| 8770 |
!value._isVue |
| 8771 |
) { |
| 8772 |
ob = new Observer(value); |
| 8773 |
} |
| 8774 |
if (asRootData && ob) { |
| 8775 |
ob.vmCount++; |
| 8776 |
} |
| 8777 |
return ob |
| 8778 |
} |
| 8779 |
|
| 8780 |
/** |
| 8781 |
* Define a reactive property on an Object. |
| 8782 |
*/ |
| 8783 |
function defineReactive$$1 ( |
| 8784 |
obj, |
| 8785 |
key, |
| 8786 |
val, |
| 8787 |
customSetter, |
| 8788 |
shallow |
| 8789 |
) { |
| 8790 |
var dep = new Dep(); |
| 8791 |
|
| 8792 |
var property = Object.getOwnPropertyDescriptor(obj, key); |
| 8793 |
if (property && property.configurable === false) { |
| 8794 |
return |
| 8795 |
} |
| 8796 |
|
| 8797 |
// cater for pre-defined getter/setters |
| 8798 |
var getter = property && property.get; |
| 8799 |
var setter = property && property.set; |
| 8800 |
if ((!getter || setter) && arguments.length === 2) { |
| 8801 |
val = obj[key]; |
| 8802 |
} |
| 8803 |
|
| 8804 |
var childOb = !shallow && observe(val); |
| 8805 |
Object.defineProperty(obj, key, { |
| 8806 |
enumerable: true, |
| 8807 |
configurable: true, |
| 8808 |
get: function reactiveGetter () { |
| 8809 |
var value = getter ? getter.call(obj) : val; |
| 8810 |
if (Dep.target) { |
| 8811 |
dep.depend(); |
| 8812 |
if (childOb) { |
| 8813 |
childOb.dep.depend(); |
| 8814 |
if (Array.isArray(value)) { |
| 8815 |
dependArray(value); |
| 8816 |
} |
| 8817 |
} |
| 8818 |
} |
| 8819 |
return value |
| 8820 |
}, |
| 8821 |
set: function reactiveSetter (newVal) { |
| 8822 |
var value = getter ? getter.call(obj) : val; |
| 8823 |
/* eslint-disable no-self-compare */ |
| 8824 |
if (newVal === value || (newVal !== newVal && value !== value)) { |
| 8825 |
return |
| 8826 |
} |
| 8827 |
/* eslint-enable no-self-compare */ |
| 8828 |
if ( true && customSetter) { |
| 8829 |
customSetter(); |
| 8830 |
} |
| 8831 |
// #7981: for accessor properties without setter |
| 8832 |
if (getter && !setter) { return } |
| 8833 |
if (setter) { |
| 8834 |
setter.call(obj, newVal); |
| 8835 |
} else { |
| 8836 |
val = newVal; |
| 8837 |
} |
| 8838 |
childOb = !shallow && observe(newVal); |
| 8839 |
dep.notify(); |
| 8840 |
} |
| 8841 |
}); |
| 8842 |
} |
| 8843 |
|
| 8844 |
/** |
| 8845 |
* Set a property on an object. Adds the new property and |
| 8846 |
* triggers change notification if the property doesn't |
| 8847 |
* already exist. |
| 8848 |
*/ |
| 8849 |
function set (target, key, val) { |
| 8850 |
if ( true && |
| 8851 |
(isUndef(target) || isPrimitive(target)) |
| 8852 |
) { |
| 8853 |
warn(("Cannot set reactive property on undefined, null, or primitive value: " + ((target)))); |
| 8854 |
} |
| 8855 |
if (Array.isArray(target) && isValidArrayIndex(key)) { |
| 8856 |
target.length = Math.max(target.length, key); |
| 8857 |
target.splice(key, 1, val); |
| 8858 |
return val |
| 8859 |
} |
| 8860 |
if (key in target && !(key in Object.prototype)) { |
| 8861 |
target[key] = val; |
| 8862 |
return val |
| 8863 |
} |
| 8864 |
var ob = (target).__ob__; |
| 8865 |
if (target._isVue || (ob && ob.vmCount)) { |
| 8866 |
true && warn( |
| 8867 |
'Avoid adding reactive properties to a Vue instance or its root $data ' + |
| 8868 |
'at runtime - declare it upfront in the data option.' |
| 8869 |
); |
| 8870 |
return val |
| 8871 |
} |
| 8872 |
if (!ob) { |
| 8873 |
target[key] = val; |
| 8874 |
return val |
| 8875 |
} |
| 8876 |
defineReactive$$1(ob.value, key, val); |
| 8877 |
ob.dep.notify(); |
| 8878 |
return val |
| 8879 |
} |
| 8880 |
|
| 8881 |
/** |
| 8882 |
* Delete a property and trigger change if necessary. |
| 8883 |
*/ |
| 8884 |
function del (target, key) { |
| 8885 |
if ( true && |
| 8886 |
(isUndef(target) || isPrimitive(target)) |
| 8887 |
) { |
| 8888 |
warn(("Cannot delete reactive property on undefined, null, or primitive value: " + ((target)))); |
| 8889 |
} |
| 8890 |
if (Array.isArray(target) && isValidArrayIndex(key)) { |
| 8891 |
target.splice(key, 1); |
| 8892 |
return |
| 8893 |
} |
| 8894 |
var ob = (target).__ob__; |
| 8895 |
if (target._isVue || (ob && ob.vmCount)) { |
| 8896 |
true && warn( |
| 8897 |
'Avoid deleting properties on a Vue instance or its root $data ' + |
| 8898 |
'- just set it to null.' |
| 8899 |
); |
| 8900 |
return |
| 8901 |
} |
| 8902 |
if (!hasOwn(target, key)) { |
| 8903 |
return |
| 8904 |
} |
| 8905 |
delete target[key]; |
| 8906 |
if (!ob) { |
| 8907 |
return |
| 8908 |
} |
| 8909 |
ob.dep.notify(); |
| 8910 |
} |
| 8911 |
|
| 8912 |
/** |
| 8913 |
* Collect dependencies on array elements when the array is touched, since |
| 8914 |
* we cannot intercept array element access like property getters. |
| 8915 |
*/ |
| 8916 |
function dependArray (value) { |
| 8917 |
for (var e = (void 0), i = 0, l = value.length; i < l; i++) { |
| 8918 |
e = value[i]; |
| 8919 |
e && e.__ob__ && e.__ob__.dep.depend(); |
| 8920 |
if (Array.isArray(e)) { |
| 8921 |
dependArray(e); |
| 8922 |
} |
| 8923 |
} |
| 8924 |
} |
| 8925 |
|
| 8926 |
/* */ |
| 8927 |
|
| 8928 |
/** |
| 8929 |
* Option overwriting strategies are functions that handle |
| 8930 |
* how to merge a parent option value and a child option |
| 8931 |
* value into the final value. |
| 8932 |
*/ |
| 8933 |
var strats = config.optionMergeStrategies; |
| 8934 |
|
| 8935 |
/** |
| 8936 |
* Options with restrictions |
| 8937 |
*/ |
| 8938 |
if (true) { |
| 8939 |
strats.el = strats.propsData = function (parent, child, vm, key) { |
| 8940 |
if (!vm) { |
| 8941 |
warn( |
| 8942 |
"option \"" + key + "\" can only be used during instance " + |
| 8943 |
'creation with the `new` keyword.' |
| 8944 |
); |
| 8945 |
} |
| 8946 |
return defaultStrat(parent, child) |
| 8947 |
}; |
| 8948 |
} |
| 8949 |
|
| 8950 |
/** |
| 8951 |
* Helper that recursively merges two data objects together. |
| 8952 |
*/ |
| 8953 |
function mergeData (to, from) { |
| 8954 |
if (!from) { return to } |
| 8955 |
var key, toVal, fromVal; |
| 8956 |
|
| 8957 |
var keys = hasSymbol |
| 8958 |
? Reflect.ownKeys(from) |
| 8959 |
: Object.keys(from); |
| 8960 |
|
| 8961 |
for (var i = 0; i < keys.length; i++) { |
| 8962 |
key = keys[i]; |
| 8963 |
// in case the object is already observed... |
| 8964 |
if (key === '__ob__') { continue } |
| 8965 |
toVal = to[key]; |
| 8966 |
fromVal = from[key]; |
| 8967 |
if (!hasOwn(to, key)) { |
| 8968 |
set(to, key, fromVal); |
| 8969 |
} else if ( |
| 8970 |
toVal !== fromVal && |
| 8971 |
isPlainObject(toVal) && |
| 8972 |
isPlainObject(fromVal) |
| 8973 |
) { |
| 8974 |
mergeData(toVal, fromVal); |
| 8975 |
} |
| 8976 |
} |
| 8977 |
return to |
| 8978 |
} |
| 8979 |
|
| 8980 |
/** |
| 8981 |
* Data |
| 8982 |
*/ |
| 8983 |
function mergeDataOrFn ( |
| 8984 |
parentVal, |
| 8985 |
childVal, |
| 8986 |
vm |
| 8987 |
) { |
| 8988 |
if (!vm) { |
| 8989 |
// in a Vue.extend merge, both should be functions |
| 8990 |
if (!childVal) { |
| 8991 |
return parentVal |
| 8992 |
} |
| 8993 |
if (!parentVal) { |
| 8994 |
return childVal |
| 8995 |
} |
| 8996 |
// when parentVal & childVal are both present, |
| 8997 |
// we need to return a function that returns the |
| 8998 |
// merged result of both functions... no need to |
| 8999 |
// check if parentVal is a function here because |
| 9000 |
// it has to be a function to pass previous merges. |
| 9001 |
return function mergedDataFn () { |
| 9002 |
return mergeData( |
| 9003 |
typeof childVal === 'function' ? childVal.call(this, this) : childVal, |
| 9004 |
typeof parentVal === 'function' ? parentVal.call(this, this) : parentVal |
| 9005 |
) |
| 9006 |
} |
| 9007 |
} else { |
| 9008 |
return function mergedInstanceDataFn () { |
| 9009 |
// instance merge |
| 9010 |
var instanceData = typeof childVal === 'function' |
| 9011 |
? childVal.call(vm, vm) |
| 9012 |
: childVal; |
| 9013 |
var defaultData = typeof parentVal === 'function' |
| 9014 |
? parentVal.call(vm, vm) |
| 9015 |
: parentVal; |
| 9016 |
if (instanceData) { |
| 9017 |
return mergeData(instanceData, defaultData) |
| 9018 |
} else { |
| 9019 |
return defaultData |
| 9020 |
} |
| 9021 |
} |
| 9022 |
} |
| 9023 |
} |
| 9024 |
|
| 9025 |
strats.data = function ( |
| 9026 |
parentVal, |
| 9027 |
childVal, |
| 9028 |
vm |
| 9029 |
) { |
| 9030 |
if (!vm) { |
| 9031 |
if (childVal && typeof childVal !== 'function') { |
| 9032 |
true && warn( |
| 9033 |
'The "data" option should be a function ' + |
| 9034 |
'that returns a per-instance value in component ' + |
| 9035 |
'definitions.', |
| 9036 |
vm |
| 9037 |
); |
| 9038 |
|
| 9039 |
return parentVal |
| 9040 |
} |
| 9041 |
return mergeDataOrFn(parentVal, childVal) |
| 9042 |
} |
| 9043 |
|
| 9044 |
return mergeDataOrFn(parentVal, childVal, vm) |
| 9045 |
}; |
| 9046 |
|
| 9047 |
/** |
| 9048 |
* Hooks and props are merged as arrays. |
| 9049 |
*/ |
| 9050 |
function mergeHook ( |
| 9051 |
parentVal, |
| 9052 |
childVal |
| 9053 |
) { |
| 9054 |
var res = childVal |
| 9055 |
? parentVal |
| 9056 |
? parentVal.concat(childVal) |
| 9057 |
: Array.isArray(childVal) |
| 9058 |
? childVal |
| 9059 |
: [childVal] |
| 9060 |
: parentVal; |
| 9061 |
return res |
| 9062 |
? dedupeHooks(res) |
| 9063 |
: res |
| 9064 |
} |
| 9065 |
|
| 9066 |
function dedupeHooks (hooks) { |
| 9067 |
var res = []; |
| 9068 |
for (var i = 0; i < hooks.length; i++) { |
| 9069 |
if (res.indexOf(hooks[i]) === -1) { |
| 9070 |
res.push(hooks[i]); |
| 9071 |
} |
| 9072 |
} |
| 9073 |
return res |
| 9074 |
} |
| 9075 |
|
| 9076 |
LIFECYCLE_HOOKS.forEach(function (hook) { |
| 9077 |
strats[hook] = mergeHook; |
| 9078 |
}); |
| 9079 |
|
| 9080 |
/** |
| 9081 |
* Assets |
| 9082 |
* |
| 9083 |
* When a vm is present (instance creation), we need to do |
| 9084 |
* a three-way merge between constructor options, instance |
| 9085 |
* options and parent options. |
| 9086 |
*/ |
| 9087 |
function mergeAssets ( |
| 9088 |
parentVal, |
| 9089 |
childVal, |
| 9090 |
vm, |
| 9091 |
key |
| 9092 |
) { |
| 9093 |
var res = Object.create(parentVal || null); |
| 9094 |
if (childVal) { |
| 9095 |
true && assertObjectType(key, childVal, vm); |
| 9096 |
return extend(res, childVal) |
| 9097 |
} else { |
| 9098 |
return res |
| 9099 |
} |
| 9100 |
} |
| 9101 |
|
| 9102 |
ASSET_TYPES.forEach(function (type) { |
| 9103 |
strats[type + 's'] = mergeAssets; |
| 9104 |
}); |
| 9105 |
|
| 9106 |
/** |
| 9107 |
* Watchers. |
| 9108 |
* |
| 9109 |
* Watchers hashes should not overwrite one |
| 9110 |
* another, so we merge them as arrays. |
| 9111 |
*/ |
| 9112 |
strats.watch = function ( |
| 9113 |
parentVal, |
| 9114 |
childVal, |
| 9115 |
vm, |
| 9116 |
key |
| 9117 |
) { |
| 9118 |
// work around Firefox's Object.prototype.watch... |
| 9119 |
if (parentVal === nativeWatch) { parentVal = undefined; } |
| 9120 |
if (childVal === nativeWatch) { childVal = undefined; } |
| 9121 |
/* istanbul ignore if */ |
| 9122 |
if (!childVal) { return Object.create(parentVal || null) } |
| 9123 |
if (true) { |
| 9124 |
assertObjectType(key, childVal, vm); |
| 9125 |
} |
| 9126 |
if (!parentVal) { return childVal } |
| 9127 |
var ret = {}; |
| 9128 |
extend(ret, parentVal); |
| 9129 |
for (var key$1 in childVal) { |
| 9130 |
var parent = ret[key$1]; |
| 9131 |
var child = childVal[key$1]; |
| 9132 |
if (parent && !Array.isArray(parent)) { |
| 9133 |
parent = [parent]; |
| 9134 |
} |
| 9135 |
ret[key$1] = parent |
| 9136 |
? parent.concat(child) |
| 9137 |
: Array.isArray(child) ? child : [child]; |
| 9138 |
} |
| 9139 |
return ret |
| 9140 |
}; |
| 9141 |
|
| 9142 |
/** |
| 9143 |
* Other object hashes. |
| 9144 |
*/ |
| 9145 |
strats.props = |
| 9146 |
strats.methods = |
| 9147 |
strats.inject = |
| 9148 |
strats.computed = function ( |
| 9149 |
parentVal, |
| 9150 |
childVal, |
| 9151 |
vm, |
| 9152 |
key |
| 9153 |
) { |
| 9154 |
if (childVal && "development" !== 'production') { |
| 9155 |
assertObjectType(key, childVal, vm); |
| 9156 |
} |
| 9157 |
if (!parentVal) { return childVal } |
| 9158 |
var ret = Object.create(null); |
| 9159 |
extend(ret, parentVal); |
| 9160 |
if (childVal) { extend(ret, childVal); } |
| 9161 |
return ret |
| 9162 |
}; |
| 9163 |
strats.provide = mergeDataOrFn; |
| 9164 |
|
| 9165 |
/** |
| 9166 |
* Default strategy. |
| 9167 |
*/ |
| 9168 |
var defaultStrat = function (parentVal, childVal) { |
| 9169 |
return childVal === undefined |
| 9170 |
? parentVal |
| 9171 |
: childVal |
| 9172 |
}; |
| 9173 |
|
| 9174 |
/** |
| 9175 |
* Validate component names |
| 9176 |
*/ |
| 9177 |
function checkComponents (options) { |
| 9178 |
for (var key in options.components) { |
| 9179 |
validateComponentName(key); |
| 9180 |
} |
| 9181 |
} |
| 9182 |
|
| 9183 |
function validateComponentName (name) { |
| 9184 |
if (!new RegExp(("^[a-zA-Z][\\-\\.0-9_" + (unicodeRegExp.source) + "]*$")).test(name)) { |
| 9185 |
warn( |
| 9186 |
'Invalid component name: "' + name + '". Component names ' + |
| 9187 |
'should conform to valid custom element name in html5 specification.' |
| 9188 |
); |
| 9189 |
} |
| 9190 |
if (isBuiltInTag(name) || config.isReservedTag(name)) { |
| 9191 |
warn( |
| 9192 |
'Do not use built-in or reserved HTML elements as component ' + |
| 9193 |
'id: ' + name |
| 9194 |
); |
| 9195 |
} |
| 9196 |
} |
| 9197 |
|
| 9198 |
/** |
| 9199 |
* Ensure all props option syntax are normalized into the |
| 9200 |
* Object-based format. |
| 9201 |
*/ |
| 9202 |
function normalizeProps (options, vm) { |
| 9203 |
var props = options.props; |
| 9204 |
if (!props) { return } |
| 9205 |
var res = {}; |
| 9206 |
var i, val, name; |
| 9207 |
if (Array.isArray(props)) { |
| 9208 |
i = props.length; |
| 9209 |
while (i--) { |
| 9210 |
val = props[i]; |
| 9211 |
if (typeof val === 'string') { |
| 9212 |
name = camelize(val); |
| 9213 |
res[name] = { type: null }; |
| 9214 |
} else if (true) { |
| 9215 |
warn('props must be strings when using array syntax.'); |
| 9216 |
} |
| 9217 |
} |
| 9218 |
} else if (isPlainObject(props)) { |
| 9219 |
for (var key in props) { |
| 9220 |
val = props[key]; |
| 9221 |
name = camelize(key); |
| 9222 |
res[name] = isPlainObject(val) |
| 9223 |
? val |
| 9224 |
: { type: val }; |
| 9225 |
} |
| 9226 |
} else if (true) { |
| 9227 |
warn( |
| 9228 |
"Invalid value for option \"props\": expected an Array or an Object, " + |
| 9229 |
"but got " + (toRawType(props)) + ".", |
| 9230 |
vm |
| 9231 |
); |
| 9232 |
} |
| 9233 |
options.props = res; |
| 9234 |
} |
| 9235 |
|
| 9236 |
/** |
| 9237 |
* Normalize all injections into Object-based format |
| 9238 |
*/ |
| 9239 |
function normalizeInject (options, vm) { |
| 9240 |
var inject = options.inject; |
| 9241 |
if (!inject) { return } |
| 9242 |
var normalized = options.inject = {}; |
| 9243 |
if (Array.isArray(inject)) { |
| 9244 |
for (var i = 0; i < inject.length; i++) { |
| 9245 |
normalized[inject[i]] = { from: inject[i] }; |
| 9246 |
} |
| 9247 |
} else if (isPlainObject(inject)) { |
| 9248 |
for (var key in inject) { |
| 9249 |
var val = inject[key]; |
| 9250 |
normalized[key] = isPlainObject(val) |
| 9251 |
? extend({ from: key }, val) |
| 9252 |
: { from: val }; |
| 9253 |
} |
| 9254 |
} else if (true) { |
| 9255 |
warn( |
| 9256 |
"Invalid value for option \"inject\": expected an Array or an Object, " + |
| 9257 |
"but got " + (toRawType(inject)) + ".", |
| 9258 |
vm |
| 9259 |
); |
| 9260 |
} |
| 9261 |
} |
| 9262 |
|
| 9263 |
/** |
| 9264 |
* Normalize raw function directives into object format. |
| 9265 |
*/ |
| 9266 |
function normalizeDirectives (options) { |
| 9267 |
var dirs = options.directives; |
| 9268 |
if (dirs) { |
| 9269 |
for (var key in dirs) { |
| 9270 |
var def$$1 = dirs[key]; |
| 9271 |
if (typeof def$$1 === 'function') { |
| 9272 |
dirs[key] = { bind: def$$1, update: def$$1 }; |
| 9273 |
} |
| 9274 |
} |
| 9275 |
} |
| 9276 |
} |
| 9277 |
|
| 9278 |
function assertObjectType (name, value, vm) { |
| 9279 |
if (!isPlainObject(value)) { |
| 9280 |
warn( |
| 9281 |
"Invalid value for option \"" + name + "\": expected an Object, " + |
| 9282 |
"but got " + (toRawType(value)) + ".", |
| 9283 |
vm |
| 9284 |
); |
| 9285 |
} |
| 9286 |
} |
| 9287 |
|
| 9288 |
/** |
| 9289 |
* Merge two option objects into a new one. |
| 9290 |
* Core utility used in both instantiation and inheritance. |
| 9291 |
*/ |
| 9292 |
function mergeOptions ( |
| 9293 |
parent, |
| 9294 |
child, |
| 9295 |
vm |
| 9296 |
) { |
| 9297 |
if (true) { |
| 9298 |
checkComponents(child); |
| 9299 |
} |
| 9300 |
|
| 9301 |
if (typeof child === 'function') { |
| 9302 |
child = child.options; |
| 9303 |
} |
| 9304 |
|
| 9305 |
normalizeProps(child, vm); |
| 9306 |
normalizeInject(child, vm); |
| 9307 |
normalizeDirectives(child); |
| 9308 |
|
| 9309 |
// Apply extends and mixins on the child options, |
| 9310 |
// but only if it is a raw options object that isn't |
| 9311 |
// the result of another mergeOptions call. |
| 9312 |
// Only merged options has the _base property. |
| 9313 |
if (!child._base) { |
| 9314 |
if (child.extends) { |
| 9315 |
parent = mergeOptions(parent, child.extends, vm); |
| 9316 |
} |
| 9317 |
if (child.mixins) { |
| 9318 |
for (var i = 0, l = child.mixins.length; i < l; i++) { |
| 9319 |
parent = mergeOptions(parent, child.mixins[i], vm); |
| 9320 |
} |
| 9321 |
} |
| 9322 |
} |
| 9323 |
|
| 9324 |
var options = {}; |
| 9325 |
var key; |
| 9326 |
for (key in parent) { |
| 9327 |
mergeField(key); |
| 9328 |
} |
| 9329 |
for (key in child) { |
| 9330 |
if (!hasOwn(parent, key)) { |
| 9331 |
mergeField(key); |
| 9332 |
} |
| 9333 |
} |
| 9334 |
function mergeField (key) { |
| 9335 |
var strat = strats[key] || defaultStrat; |
| 9336 |
options[key] = strat(parent[key], child[key], vm, key); |
| 9337 |
} |
| 9338 |
return options |
| 9339 |
} |
| 9340 |
|
| 9341 |
/** |
| 9342 |
* Resolve an asset. |
| 9343 |
* This function is used because child instances need access |
| 9344 |
* to assets defined in its ancestor chain. |
| 9345 |
*/ |
| 9346 |
function resolveAsset ( |
| 9347 |
options, |
| 9348 |
type, |
| 9349 |
id, |
| 9350 |
warnMissing |
| 9351 |
) { |
| 9352 |
/* istanbul ignore if */ |
| 9353 |
if (typeof id !== 'string') { |
| 9354 |
return |
| 9355 |
} |
| 9356 |
var assets = options[type]; |
| 9357 |
// check local registration variations first |
| 9358 |
if (hasOwn(assets, id)) { return assets[id] } |
| 9359 |
var camelizedId = camelize(id); |
| 9360 |
if (hasOwn(assets, camelizedId)) { return assets[camelizedId] } |
| 9361 |
var PascalCaseId = capitalize(camelizedId); |
| 9362 |
if (hasOwn(assets, PascalCaseId)) { return assets[PascalCaseId] } |
| 9363 |
// fallback to prototype chain |
| 9364 |
var res = assets[id] || assets[camelizedId] || assets[PascalCaseId]; |
| 9365 |
if ( true && warnMissing && !res) { |
| 9366 |
warn( |
| 9367 |
'Failed to resolve ' + type.slice(0, -1) + ': ' + id, |
| 9368 |
options |
| 9369 |
); |
| 9370 |
} |
| 9371 |
return res |
| 9372 |
} |
| 9373 |
|
| 9374 |
/* */ |
| 9375 |
|
| 9376 |
|
| 9377 |
|
| 9378 |
function validateProp ( |
| 9379 |
key, |
| 9380 |
propOptions, |
| 9381 |
propsData, |
| 9382 |
vm |
| 9383 |
) { |
| 9384 |
var prop = propOptions[key]; |
| 9385 |
var absent = !hasOwn(propsData, key); |
| 9386 |
var value = propsData[key]; |
| 9387 |
// boolean casting |
| 9388 |
var booleanIndex = getTypeIndex(Boolean, prop.type); |
| 9389 |
if (booleanIndex > -1) { |
| 9390 |
if (absent && !hasOwn(prop, 'default')) { |
| 9391 |
value = false; |
| 9392 |
} else if (value === '' || value === hyphenate(key)) { |
| 9393 |
// only cast empty string / same name to boolean if |
| 9394 |
// boolean has higher priority |
| 9395 |
var stringIndex = getTypeIndex(String, prop.type); |
| 9396 |
if (stringIndex < 0 || booleanIndex < stringIndex) { |
| 9397 |
value = true; |
| 9398 |
} |
| 9399 |
} |
| 9400 |
} |
| 9401 |
// check default value |
| 9402 |
if (value === undefined) { |
| 9403 |
value = getPropDefaultValue(vm, prop, key); |
| 9404 |
// since the default value is a fresh copy, |
| 9405 |
// make sure to observe it. |
| 9406 |
var prevShouldObserve = shouldObserve; |
| 9407 |
toggleObserving(true); |
| 9408 |
observe(value); |
| 9409 |
toggleObserving(prevShouldObserve); |
| 9410 |
} |
| 9411 |
if ( |
| 9412 |
true |
| 9413 |
) { |
| 9414 |
assertProp(prop, key, value, vm, absent); |
| 9415 |
} |
| 9416 |
return value |
| 9417 |
} |
| 9418 |
|
| 9419 |
/** |
| 9420 |
* Get the default value of a prop. |
| 9421 |
*/ |
| 9422 |
function getPropDefaultValue (vm, prop, key) { |
| 9423 |
// no default, return undefined |
| 9424 |
if (!hasOwn(prop, 'default')) { |
| 9425 |
return undefined |
| 9426 |
} |
| 9427 |
var def = prop.default; |
| 9428 |
// warn against non-factory defaults for Object & Array |
| 9429 |
if ( true && isObject(def)) { |
| 9430 |
warn( |
| 9431 |
'Invalid default value for prop "' + key + '": ' + |
| 9432 |
'Props with type Object/Array must use a factory function ' + |
| 9433 |
'to return the default value.', |
| 9434 |
vm |
| 9435 |
); |
| 9436 |
} |
| 9437 |
// the raw prop value was also undefined from previous render, |
| 9438 |
// return previous default value to avoid unnecessary watcher trigger |
| 9439 |
if (vm && vm.$options.propsData && |
| 9440 |
vm.$options.propsData[key] === undefined && |
| 9441 |
vm._props[key] !== undefined |
| 9442 |
) { |
| 9443 |
return vm._props[key] |
| 9444 |
} |
| 9445 |
// call factory function for non-Function types |
| 9446 |
// a value is Function if its prototype is function even across different execution context |
| 9447 |
return typeof def === 'function' && getType(prop.type) !== 'Function' |
| 9448 |
? def.call(vm) |
| 9449 |
: def |
| 9450 |
} |
| 9451 |
|
| 9452 |
/** |
| 9453 |
* Assert whether a prop is valid. |
| 9454 |
*/ |
| 9455 |
function assertProp ( |
| 9456 |
prop, |
| 9457 |
name, |
| 9458 |
value, |
| 9459 |
vm, |
| 9460 |
absent |
| 9461 |
) { |
| 9462 |
if (prop.required && absent) { |
| 9463 |
warn( |
| 9464 |
'Missing required prop: "' + name + '"', |
| 9465 |
vm |
| 9466 |
); |
| 9467 |
return |
| 9468 |
} |
| 9469 |
if (value == null && !prop.required) { |
| 9470 |
return |
| 9471 |
} |
| 9472 |
var type = prop.type; |
| 9473 |
var valid = !type || type === true; |
| 9474 |
var expectedTypes = []; |
| 9475 |
if (type) { |
| 9476 |
if (!Array.isArray(type)) { |
| 9477 |
type = [type]; |
| 9478 |
} |
| 9479 |
for (var i = 0; i < type.length && !valid; i++) { |
| 9480 |
var assertedType = assertType(value, type[i], vm); |
| 9481 |
expectedTypes.push(assertedType.expectedType || ''); |
| 9482 |
valid = assertedType.valid; |
| 9483 |
} |
| 9484 |
} |
| 9485 |
|
| 9486 |
var haveExpectedTypes = expectedTypes.some(function (t) { return t; }); |
| 9487 |
if (!valid && haveExpectedTypes) { |
| 9488 |
warn( |
| 9489 |
getInvalidTypeMessage(name, value, expectedTypes), |
| 9490 |
vm |
| 9491 |
); |
| 9492 |
return |
| 9493 |
} |
| 9494 |
var validator = prop.validator; |
| 9495 |
if (validator) { |
| 9496 |
if (!validator(value)) { |
| 9497 |
warn( |
| 9498 |
'Invalid prop: custom validator check failed for prop "' + name + '".', |
| 9499 |
vm |
| 9500 |
); |
| 9501 |
} |
| 9502 |
} |
| 9503 |
} |
| 9504 |
|
| 9505 |
var simpleCheckRE = /^(String|Number|Boolean|Function|Symbol|BigInt)$/; |
| 9506 |
|
| 9507 |
function assertType (value, type, vm) { |
| 9508 |
var valid; |
| 9509 |
var expectedType = getType(type); |
| 9510 |
if (simpleCheckRE.test(expectedType)) { |
| 9511 |
var t = typeof value; |
| 9512 |
valid = t === expectedType.toLowerCase(); |
| 9513 |
// for primitive wrapper objects |
| 9514 |
if (!valid && t === 'object') { |
| 9515 |
valid = value instanceof type; |
| 9516 |
} |
| 9517 |
} else if (expectedType === 'Object') { |
| 9518 |
valid = isPlainObject(value); |
| 9519 |
} else if (expectedType === 'Array') { |
| 9520 |
valid = Array.isArray(value); |
| 9521 |
} else { |
| 9522 |
try { |
| 9523 |
valid = value instanceof type; |
| 9524 |
} catch (e) { |
| 9525 |
warn('Invalid prop type: "' + String(type) + '" is not a constructor', vm); |
| 9526 |
valid = false; |
| 9527 |
} |
| 9528 |
} |
| 9529 |
return { |
| 9530 |
valid: valid, |
| 9531 |
expectedType: expectedType |
| 9532 |
} |
| 9533 |
} |
| 9534 |
|
| 9535 |
var functionTypeCheckRE = /^\s*function (\w+)/; |
| 9536 |
|
| 9537 |
/** |
| 9538 |
* Use function string name to check built-in types, |
| 9539 |
* because a simple equality check will fail when running |
| 9540 |
* across different vms / iframes. |
| 9541 |
*/ |
| 9542 |
function getType (fn) { |
| 9543 |
var match = fn && fn.toString().match(functionTypeCheckRE); |
| 9544 |
return match ? match[1] : '' |
| 9545 |
} |
| 9546 |
|
| 9547 |
function isSameType (a, b) { |
| 9548 |
return getType(a) === getType(b) |
| 9549 |
} |
| 9550 |
|
| 9551 |
function getTypeIndex (type, expectedTypes) { |
| 9552 |
if (!Array.isArray(expectedTypes)) { |
| 9553 |
return isSameType(expectedTypes, type) ? 0 : -1 |
| 9554 |
} |
| 9555 |
for (var i = 0, len = expectedTypes.length; i < len; i++) { |
| 9556 |
if (isSameType(expectedTypes[i], type)) { |
| 9557 |
return i |
| 9558 |
} |
| 9559 |
} |
| 9560 |
return -1 |
| 9561 |
} |
| 9562 |
|
| 9563 |
function getInvalidTypeMessage (name, value, expectedTypes) { |
| 9564 |
var message = "Invalid prop: type check failed for prop \"" + name + "\"." + |
| 9565 |
" Expected " + (expectedTypes.map(capitalize).join(', ')); |
| 9566 |
var expectedType = expectedTypes[0]; |
| 9567 |
var receivedType = toRawType(value); |
| 9568 |
// check if we need to specify expected value |
| 9569 |
if ( |
| 9570 |
expectedTypes.length === 1 && |
| 9571 |
isExplicable(expectedType) && |
| 9572 |
isExplicable(typeof value) && |
| 9573 |
!isBoolean(expectedType, receivedType) |
| 9574 |
) { |
| 9575 |
message += " with value " + (styleValue(value, expectedType)); |
| 9576 |
} |
| 9577 |
message += ", got " + receivedType + " "; |
| 9578 |
// check if we need to specify received value |
| 9579 |
if (isExplicable(receivedType)) { |
| 9580 |
message += "with value " + (styleValue(value, receivedType)) + "."; |
| 9581 |
} |
| 9582 |
return message |
| 9583 |
} |
| 9584 |
|
| 9585 |
function styleValue (value, type) { |
| 9586 |
if (type === 'String') { |
| 9587 |
return ("\"" + value + "\"") |
| 9588 |
} else if (type === 'Number') { |
| 9589 |
return ("" + (Number(value))) |
| 9590 |
} else { |
| 9591 |
return ("" + value) |
| 9592 |
} |
| 9593 |
} |
| 9594 |
|
| 9595 |
var EXPLICABLE_TYPES = ['string', 'number', 'boolean']; |
| 9596 |
function isExplicable (value) { |
| 9597 |
return EXPLICABLE_TYPES.some(function (elem) { return value.toLowerCase() === elem; }) |
| 9598 |
} |
| 9599 |
|
| 9600 |
function isBoolean () { |
| 9601 |
var args = [], len = arguments.length; |
| 9602 |
while ( len-- ) args[ len ] = arguments[ len ]; |
| 9603 |
|
| 9604 |
return args.some(function (elem) { return elem.toLowerCase() === 'boolean'; }) |
| 9605 |
} |
| 9606 |
|
| 9607 |
/* */ |
| 9608 |
|
| 9609 |
function handleError (err, vm, info) { |
| 9610 |
// Deactivate deps tracking while processing error handler to avoid possible infinite rendering. |
| 9611 |
// See: https://github.com/vuejs/vuex/issues/1505 |
| 9612 |
pushTarget(); |
| 9613 |
try { |
| 9614 |
if (vm) { |
| 9615 |
var cur = vm; |
| 9616 |
while ((cur = cur.$parent)) { |
| 9617 |
var hooks = cur.$options.errorCaptured; |
| 9618 |
if (hooks) { |
| 9619 |
for (var i = 0; i < hooks.length; i++) { |
| 9620 |
try { |
| 9621 |
var capture = hooks[i].call(cur, err, vm, info) === false; |
| 9622 |
if (capture) { return } |
| 9623 |
} catch (e) { |
| 9624 |
globalHandleError(e, cur, 'errorCaptured hook'); |
| 9625 |
} |
| 9626 |
} |
| 9627 |
} |
| 9628 |
} |
| 9629 |
} |
| 9630 |
globalHandleError(err, vm, info); |
| 9631 |
} finally { |
| 9632 |
popTarget(); |
| 9633 |
} |
| 9634 |
} |
| 9635 |
|
| 9636 |
function invokeWithErrorHandling ( |
| 9637 |
handler, |
| 9638 |
context, |
| 9639 |
args, |
| 9640 |
vm, |
| 9641 |
info |
| 9642 |
) { |
| 9643 |
var res; |
| 9644 |
try { |
| 9645 |
res = args ? handler.apply(context, args) : handler.call(context); |
| 9646 |
if (res && !res._isVue && isPromise(res) && !res._handled) { |
| 9647 |
res.catch(function (e) { return handleError(e, vm, info + " (Promise/async)"); }); |
| 9648 |
// issue #9511 |
| 9649 |
// avoid catch triggering multiple times when nested calls |
| 9650 |
res._handled = true; |
| 9651 |
} |
| 9652 |
} catch (e) { |
| 9653 |
handleError(e, vm, info); |
| 9654 |
} |
| 9655 |
return res |
| 9656 |
} |
| 9657 |
|
| 9658 |
function globalHandleError (err, vm, info) { |
| 9659 |
if (config.errorHandler) { |
| 9660 |
try { |
| 9661 |
return config.errorHandler.call(null, err, vm, info) |
| 9662 |
} catch (e) { |
| 9663 |
// if the user intentionally throws the original error in the handler, |
| 9664 |
// do not log it twice |
| 9665 |
if (e !== err) { |
| 9666 |
logError(e, null, 'config.errorHandler'); |
| 9667 |
} |
| 9668 |
} |
| 9669 |
} |
| 9670 |
logError(err, vm, info); |
| 9671 |
} |
| 9672 |
|
| 9673 |
function logError (err, vm, info) { |
| 9674 |
if (true) { |
| 9675 |
warn(("Error in " + info + ": \"" + (err.toString()) + "\""), vm); |
| 9676 |
} |
| 9677 |
/* istanbul ignore else */ |
| 9678 |
if ((inBrowser || inWeex) && typeof console !== 'undefined') { |
| 9679 |
console.error(err); |
| 9680 |
} else { |
| 9681 |
throw err |
| 9682 |
} |
| 9683 |
} |
| 9684 |
|
| 9685 |
/* */ |
| 9686 |
|
| 9687 |
var isUsingMicroTask = false; |
| 9688 |
|
| 9689 |
var callbacks = []; |
| 9690 |
var pending = false; |
| 9691 |
|
| 9692 |
function flushCallbacks () { |
| 9693 |
pending = false; |
| 9694 |
var copies = callbacks.slice(0); |
| 9695 |
callbacks.length = 0; |
| 9696 |
for (var i = 0; i < copies.length; i++) { |
| 9697 |
copies[i](); |
| 9698 |
} |
| 9699 |
} |
| 9700 |
|
| 9701 |
// Here we have async deferring wrappers using microtasks. |
| 9702 |
// In 2.5 we used (macro) tasks (in combination with microtasks). |
| 9703 |
// However, it has subtle problems when state is changed right before repaint |
| 9704 |
// (e.g. #6813, out-in transitions). |
| 9705 |
// Also, using (macro) tasks in event handler would cause some weird behaviors |
| 9706 |
// that cannot be circumvented (e.g. #7109, #7153, #7546, #7834, #8109). |
| 9707 |
// So we now use microtasks everywhere, again. |
| 9708 |
// A major drawback of this tradeoff is that there are some scenarios |
| 9709 |
// where microtasks have too high a priority and fire in between supposedly |
| 9710 |
// sequential events (e.g. #4521, #6690, which have workarounds) |
| 9711 |
// or even between bubbling of the same event (#6566). |
| 9712 |
var timerFunc; |
| 9713 |
|
| 9714 |
// The nextTick behavior leverages the microtask queue, which can be accessed |
| 9715 |
// via either native Promise.then or MutationObserver. |
| 9716 |
// MutationObserver has wider support, however it is seriously bugged in |
| 9717 |
// UIWebView in iOS >= 9.3.3 when triggered in touch event handlers. It |
| 9718 |
// completely stops working after triggering a few times... so, if native |
| 9719 |
// Promise is available, we will use it: |
| 9720 |
/* istanbul ignore next, $flow-disable-line */ |
| 9721 |
if (typeof Promise !== 'undefined' && isNative(Promise)) { |
| 9722 |
var p = Promise.resolve(); |
| 9723 |
timerFunc = function () { |
| 9724 |
p.then(flushCallbacks); |
| 9725 |
// In problematic UIWebViews, Promise.then doesn't completely break, but |
| 9726 |
// it can get stuck in a weird state where callbacks are pushed into the |
| 9727 |
// microtask queue but the queue isn't being flushed, until the browser |
| 9728 |
// needs to do some other work, e.g. handle a timer. Therefore we can |
| 9729 |
// "force" the microtask queue to be flushed by adding an empty timer. |
| 9730 |
if (isIOS) { setTimeout(noop); } |
| 9731 |
}; |
| 9732 |
isUsingMicroTask = true; |
| 9733 |
} else if (!isIE && typeof MutationObserver !== 'undefined' && ( |
| 9734 |
isNative(MutationObserver) || |
| 9735 |
// PhantomJS and iOS 7.x |
| 9736 |
MutationObserver.toString() === '[object MutationObserverConstructor]' |
| 9737 |
)) { |
| 9738 |
// Use MutationObserver where native Promise is not available, |
| 9739 |
// e.g. PhantomJS, iOS7, Android 4.4 |
| 9740 |
// (#6466 MutationObserver is unreliable in IE11) |
| 9741 |
var counter = 1; |
| 9742 |
var observer = new MutationObserver(flushCallbacks); |
| 9743 |
var textNode = document.createTextNode(String(counter)); |
| 9744 |
observer.observe(textNode, { |
| 9745 |
characterData: true |
| 9746 |
}); |
| 9747 |
timerFunc = function () { |
| 9748 |
counter = (counter + 1) % 2; |
| 9749 |
textNode.data = String(counter); |
| 9750 |
}; |
| 9751 |
isUsingMicroTask = true; |
| 9752 |
} else if (typeof setImmediate !== 'undefined' && isNative(setImmediate)) { |
| 9753 |
// Fallback to setImmediate. |
| 9754 |
// Technically it leverages the (macro) task queue, |
| 9755 |
// but it is still a better choice than setTimeout. |
| 9756 |
timerFunc = function () { |
| 9757 |
setImmediate(flushCallbacks); |
| 9758 |
}; |
| 9759 |
} else { |
| 9760 |
// Fallback to setTimeout. |
| 9761 |
timerFunc = function () { |
| 9762 |
setTimeout(flushCallbacks, 0); |
| 9763 |
}; |
| 9764 |
} |
| 9765 |
|
| 9766 |
function nextTick (cb, ctx) { |
| 9767 |
var _resolve; |
| 9768 |
callbacks.push(function () { |
| 9769 |
if (cb) { |
| 9770 |
try { |
| 9771 |
cb.call(ctx); |
| 9772 |
} catch (e) { |
| 9773 |
handleError(e, ctx, 'nextTick'); |
| 9774 |
} |
| 9775 |
} else if (_resolve) { |
| 9776 |
_resolve(ctx); |
| 9777 |
} |
| 9778 |
}); |
| 9779 |
if (!pending) { |
| 9780 |
pending = true; |
| 9781 |
timerFunc(); |
| 9782 |
} |
| 9783 |
// $flow-disable-line |
| 9784 |
if (!cb && typeof Promise !== 'undefined') { |
| 9785 |
return new Promise(function (resolve) { |
| 9786 |
_resolve = resolve; |
| 9787 |
}) |
| 9788 |
} |
| 9789 |
} |
| 9790 |
|
| 9791 |
/* */ |
| 9792 |
|
| 9793 |
var mark; |
| 9794 |
var measure; |
| 9795 |
|
| 9796 |
if (true) { |
| 9797 |
var perf = inBrowser && window.performance; |
| 9798 |
/* istanbul ignore if */ |
| 9799 |
if ( |
| 9800 |
perf && |
| 9801 |
perf.mark && |
| 9802 |
perf.measure && |
| 9803 |
perf.clearMarks && |
| 9804 |
perf.clearMeasures |
| 9805 |
) { |
| 9806 |
mark = function (tag) { return perf.mark(tag); }; |
| 9807 |
measure = function (name, startTag, endTag) { |
| 9808 |
perf.measure(name, startTag, endTag); |
| 9809 |
perf.clearMarks(startTag); |
| 9810 |
perf.clearMarks(endTag); |
| 9811 |
// perf.clearMeasures(name) |
| 9812 |
}; |
| 9813 |
} |
| 9814 |
} |
| 9815 |
|
| 9816 |
/* not type checking this file because flow doesn't play well with Proxy */ |
| 9817 |
|
| 9818 |
var initProxy; |
| 9819 |
|
| 9820 |
if (true) { |
| 9821 |
var allowedGlobals = makeMap( |
| 9822 |
'Infinity,undefined,NaN,isFinite,isNaN,' + |
| 9823 |
'parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,' + |
| 9824 |
'Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,BigInt,' + |
| 9825 |
'require' // for Webpack/Browserify |
| 9826 |
); |
| 9827 |
|
| 9828 |
var warnNonPresent = function (target, key) { |
| 9829 |
warn( |
| 9830 |
"Property or method \"" + key + "\" is not defined on the instance but " + |
| 9831 |
'referenced during render. Make sure that this property is reactive, ' + |
| 9832 |
'either in the data option, or for class-based components, by ' + |
| 9833 |
'initializing the property. ' + |
| 9834 |
'See: https://vuejs.org/v2/guide/reactivity.html#Declaring-Reactive-Properties.', |
| 9835 |
target |
| 9836 |
); |
| 9837 |
}; |
| 9838 |
|
| 9839 |
var warnReservedPrefix = function (target, key) { |
| 9840 |
warn( |
| 9841 |
"Property \"" + key + "\" must be accessed with \"$data." + key + "\" because " + |
| 9842 |
'properties starting with "$" or "_" are not proxied in the Vue instance to ' + |
| 9843 |
'prevent conflicts with Vue internals. ' + |
| 9844 |
'See: https://vuejs.org/v2/api/#data', |
| 9845 |
target |
| 9846 |
); |
| 9847 |
}; |
| 9848 |
|
| 9849 |
var hasProxy = |
| 9850 |
typeof Proxy !== 'undefined' && isNative(Proxy); |
| 9851 |
|
| 9852 |
if (hasProxy) { |
| 9853 |
var isBuiltInModifier = makeMap('stop,prevent,self,ctrl,shift,alt,meta,exact'); |
| 9854 |
config.keyCodes = new Proxy(config.keyCodes, { |
| 9855 |
set: function set (target, key, value) { |
| 9856 |
if (isBuiltInModifier(key)) { |
| 9857 |
warn(("Avoid overwriting built-in modifier in config.keyCodes: ." + key)); |
| 9858 |
return false |
| 9859 |
} else { |
| 9860 |
target[key] = value; |
| 9861 |
return true |
| 9862 |
} |
| 9863 |
} |
| 9864 |
}); |
| 9865 |
} |
| 9866 |
|
| 9867 |
var hasHandler = { |
| 9868 |
has: function has (target, key) { |
| 9869 |
var has = key in target; |
| 9870 |
var isAllowed = allowedGlobals(key) || |
| 9871 |
(typeof key === 'string' && key.charAt(0) === '_' && !(key in target.$data)); |
| 9872 |
if (!has && !isAllowed) { |
| 9873 |
if (key in target.$data) { warnReservedPrefix(target, key); } |
| 9874 |
else { warnNonPresent(target, key); } |
| 9875 |
} |
| 9876 |
return has || !isAllowed |
| 9877 |
} |
| 9878 |
}; |
| 9879 |
|
| 9880 |
var getHandler = { |
| 9881 |
get: function get (target, key) { |
| 9882 |
if (typeof key === 'string' && !(key in target)) { |
| 9883 |
if (key in target.$data) { warnReservedPrefix(target, key); } |
| 9884 |
else { warnNonPresent(target, key); } |
| 9885 |
} |
| 9886 |
return target[key] |
| 9887 |
} |
| 9888 |
}; |
| 9889 |
|
| 9890 |
initProxy = function initProxy (vm) { |
| 9891 |
if (hasProxy) { |
| 9892 |
// determine which proxy handler to use |
| 9893 |
var options = vm.$options; |
| 9894 |
var handlers = options.render && options.render._withStripped |
| 9895 |
? getHandler |
| 9896 |
: hasHandler; |
| 9897 |
vm._renderProxy = new Proxy(vm, handlers); |
| 9898 |
} else { |
| 9899 |
vm._renderProxy = vm; |
| 9900 |
} |
| 9901 |
}; |
| 9902 |
} |
| 9903 |
|
| 9904 |
/* */ |
| 9905 |
|
| 9906 |
var seenObjects = new _Set(); |
| 9907 |
|
| 9908 |
/** |
| 9909 |
* Recursively traverse an object to evoke all converted |
| 9910 |
* getters, so that every nested property inside the object |
| 9911 |
* is collected as a "deep" dependency. |
| 9912 |
*/ |
| 9913 |
function traverse (val) { |
| 9914 |
_traverse(val, seenObjects); |
| 9915 |
seenObjects.clear(); |
| 9916 |
} |
| 9917 |
|
| 9918 |
function _traverse (val, seen) { |
| 9919 |
var i, keys; |
| 9920 |
var isA = Array.isArray(val); |
| 9921 |
if ((!isA && !isObject(val)) || Object.isFrozen(val) || val instanceof VNode) { |
| 9922 |
return |
| 9923 |
} |
| 9924 |
if (val.__ob__) { |
| 9925 |
var depId = val.__ob__.dep.id; |
| 9926 |
if (seen.has(depId)) { |
| 9927 |
return |
| 9928 |
} |
| 9929 |
seen.add(depId); |
| 9930 |
} |
| 9931 |
if (isA) { |
| 9932 |
i = val.length; |
| 9933 |
while (i--) { _traverse(val[i], seen); } |
| 9934 |
} else { |
| 9935 |
keys = Object.keys(val); |
| 9936 |
i = keys.length; |
| 9937 |
while (i--) { _traverse(val[keys[i]], seen); } |
| 9938 |
} |
| 9939 |
} |
| 9940 |
|
| 9941 |
/* */ |
| 9942 |
|
| 9943 |
var normalizeEvent = cached(function (name) { |
| 9944 |
var passive = name.charAt(0) === '&'; |
| 9945 |
name = passive ? name.slice(1) : name; |
| 9946 |
var once$$1 = name.charAt(0) === '~'; // Prefixed last, checked first |
| 9947 |
name = once$$1 ? name.slice(1) : name; |
| 9948 |
var capture = name.charAt(0) === '!'; |
| 9949 |
name = capture ? name.slice(1) : name; |
| 9950 |
return { |
| 9951 |
name: name, |
| 9952 |
once: once$$1, |
| 9953 |
capture: capture, |
| 9954 |
passive: passive |
| 9955 |
} |
| 9956 |
}); |
| 9957 |
|
| 9958 |
function createFnInvoker (fns, vm) { |
| 9959 |
function invoker () { |
| 9960 |
var arguments$1 = arguments; |
| 9961 |
|
| 9962 |
var fns = invoker.fns; |
| 9963 |
if (Array.isArray(fns)) { |
| 9964 |
var cloned = fns.slice(); |
| 9965 |
for (var i = 0; i < cloned.length; i++) { |
| 9966 |
invokeWithErrorHandling(cloned[i], null, arguments$1, vm, "v-on handler"); |
| 9967 |
} |
| 9968 |
} else { |
| 9969 |
// return handler return value for single handlers |
| 9970 |
return invokeWithErrorHandling(fns, null, arguments, vm, "v-on handler") |
| 9971 |
} |
| 9972 |
} |
| 9973 |
invoker.fns = fns; |
| 9974 |
return invoker |
| 9975 |
} |
| 9976 |
|
| 9977 |
function updateListeners ( |
| 9978 |
on, |
| 9979 |
oldOn, |
| 9980 |
add, |
| 9981 |
remove$$1, |
| 9982 |
createOnceHandler, |
| 9983 |
vm |
| 9984 |
) { |
| 9985 |
var name, def$$1, cur, old, event; |
| 9986 |
for (name in on) { |
| 9987 |
def$$1 = cur = on[name]; |
| 9988 |
old = oldOn[name]; |
| 9989 |
event = normalizeEvent(name); |
| 9990 |
if (isUndef(cur)) { |
| 9991 |
true && warn( |
| 9992 |
"Invalid handler for event \"" + (event.name) + "\": got " + String(cur), |
| 9993 |
vm |
| 9994 |
); |
| 9995 |
} else if (isUndef(old)) { |
| 9996 |
if (isUndef(cur.fns)) { |
| 9997 |
cur = on[name] = createFnInvoker(cur, vm); |
| 9998 |
} |
| 9999 |
if (isTrue(event.once)) { |
| 10000 |
cur = on[name] = createOnceHandler(event.name, cur, event.capture); |
| 10001 |
} |
| 10002 |
add(event.name, cur, event.capture, event.passive, event.params); |
| 10003 |
} else if (cur !== old) { |
| 10004 |
old.fns = cur; |
| 10005 |
on[name] = old; |
| 10006 |
} |
| 10007 |
} |
| 10008 |
for (name in oldOn) { |
| 10009 |
if (isUndef(on[name])) { |
| 10010 |
event = normalizeEvent(name); |
| 10011 |
remove$$1(event.name, oldOn[name], event.capture); |
| 10012 |
} |
| 10013 |
} |
| 10014 |
} |
| 10015 |
|
| 10016 |
/* */ |
| 10017 |
|
| 10018 |
function mergeVNodeHook (def, hookKey, hook) { |
| 10019 |
if (def instanceof VNode) { |
| 10020 |
def = def.data.hook || (def.data.hook = {}); |
| 10021 |
} |
| 10022 |
var invoker; |
| 10023 |
var oldHook = def[hookKey]; |
| 10024 |
|
| 10025 |
function wrappedHook () { |
| 10026 |
hook.apply(this, arguments); |
| 10027 |
// important: remove merged hook to ensure it's called only once |
| 10028 |
// and prevent memory leak |
| 10029 |
remove(invoker.fns, wrappedHook); |
| 10030 |
} |
| 10031 |
|
| 10032 |
if (isUndef(oldHook)) { |
| 10033 |
// no existing hook |
| 10034 |
invoker = createFnInvoker([wrappedHook]); |
| 10035 |
} else { |
| 10036 |
/* istanbul ignore if */ |
| 10037 |
if (isDef(oldHook.fns) && isTrue(oldHook.merged)) { |
| 10038 |
// already a merged invoker |
| 10039 |
invoker = oldHook; |
| 10040 |
invoker.fns.push(wrappedHook); |
| 10041 |
} else { |
| 10042 |
// existing plain hook |
| 10043 |
invoker = createFnInvoker([oldHook, wrappedHook]); |
| 10044 |
} |
| 10045 |
} |
| 10046 |
|
| 10047 |
invoker.merged = true; |
| 10048 |
def[hookKey] = invoker; |
| 10049 |
} |
| 10050 |
|
| 10051 |
/* */ |
| 10052 |
|
| 10053 |
function extractPropsFromVNodeData ( |
| 10054 |
data, |
| 10055 |
Ctor, |
| 10056 |
tag |
| 10057 |
) { |
| 10058 |
// we are only extracting raw values here. |
| 10059 |
// validation and default values are handled in the child |
| 10060 |
// component itself. |
| 10061 |
var propOptions = Ctor.options.props; |
| 10062 |
if (isUndef(propOptions)) { |
| 10063 |
return |
| 10064 |
} |
| 10065 |
var res = {}; |
| 10066 |
var attrs = data.attrs; |
| 10067 |
var props = data.props; |
| 10068 |
if (isDef(attrs) || isDef(props)) { |
| 10069 |
for (var key in propOptions) { |
| 10070 |
var altKey = hyphenate(key); |
| 10071 |
if (true) { |
| 10072 |
var keyInLowerCase = key.toLowerCase(); |
| 10073 |
if ( |
| 10074 |
key !== keyInLowerCase && |
| 10075 |
attrs && hasOwn(attrs, keyInLowerCase) |
| 10076 |
) { |
| 10077 |
tip( |
| 10078 |
"Prop \"" + keyInLowerCase + "\" is passed to component " + |
| 10079 |
(formatComponentName(tag || Ctor)) + ", but the declared prop name is" + |
| 10080 |
" \"" + key + "\". " + |
| 10081 |
"Note that HTML attributes are case-insensitive and camelCased " + |
| 10082 |
"props need to use their kebab-case equivalents when using in-DOM " + |
| 10083 |
"templates. You should probably use \"" + altKey + "\" instead of \"" + key + "\"." |
| 10084 |
); |
| 10085 |
} |
| 10086 |
} |
| 10087 |
checkProp(res, props, key, altKey, true) || |
| 10088 |
checkProp(res, attrs, key, altKey, false); |
| 10089 |
} |
| 10090 |
} |
| 10091 |
return res |
| 10092 |
} |
| 10093 |
|
| 10094 |
function checkProp ( |
| 10095 |
res, |
| 10096 |
hash, |
| 10097 |
key, |
| 10098 |
altKey, |
| 10099 |
preserve |
| 10100 |
) { |
| 10101 |
if (isDef(hash)) { |
| 10102 |
if (hasOwn(hash, key)) { |
| 10103 |
res[key] = hash[key]; |
| 10104 |
if (!preserve) { |
| 10105 |
delete hash[key]; |
| 10106 |
} |
| 10107 |
return true |
| 10108 |
} else if (hasOwn(hash, altKey)) { |
| 10109 |
res[key] = hash[altKey]; |
| 10110 |
if (!preserve) { |
| 10111 |
delete hash[altKey]; |
| 10112 |
} |
| 10113 |
return true |
| 10114 |
} |
| 10115 |
} |
| 10116 |
return false |
| 10117 |
} |
| 10118 |
|
| 10119 |
/* */ |
| 10120 |
|
| 10121 |
// The template compiler attempts to minimize the need for normalization by |
| 10122 |
// statically analyzing the template at compile time. |
| 10123 |
// |
| 10124 |
// For plain HTML markup, normalization can be completely skipped because the |
| 10125 |
// generated render function is guaranteed to return Array<VNode>. There are |
| 10126 |
// two cases where extra normalization is needed: |
| 10127 |
|
| 10128 |
// 1. When the children contains components - because a functional component |
| 10129 |
// may return an Array instead of a single root. In this case, just a simple |
| 10130 |
// normalization is needed - if any child is an Array, we flatten the whole |
| 10131 |
// thing with Array.prototype.concat. It is guaranteed to be only 1-level deep |
| 10132 |
// because functional components already normalize their own children. |
| 10133 |
function simpleNormalizeChildren (children) { |
| 10134 |
for (var i = 0; i < children.length; i++) { |
| 10135 |
if (Array.isArray(children[i])) { |
| 10136 |
return Array.prototype.concat.apply([], children) |
| 10137 |
} |
| 10138 |
} |
| 10139 |
return children |
| 10140 |
} |
| 10141 |
|
| 10142 |
// 2. When the children contains constructs that always generated nested Arrays, |
| 10143 |
// e.g. <template>, <slot>, v-for, or when the children is provided by user |
| 10144 |
// with hand-written render functions / JSX. In such cases a full normalization |
| 10145 |
// is needed to cater to all possible types of children values. |
| 10146 |
function normalizeChildren (children) { |
| 10147 |
return isPrimitive(children) |
| 10148 |
? [createTextVNode(children)] |
| 10149 |
: Array.isArray(children) |
| 10150 |
? normalizeArrayChildren(children) |
| 10151 |
: undefined |
| 10152 |
} |
| 10153 |
|
| 10154 |
function isTextNode (node) { |
| 10155 |
return isDef(node) && isDef(node.text) && isFalse(node.isComment) |
| 10156 |
} |
| 10157 |
|
| 10158 |
function normalizeArrayChildren (children, nestedIndex) { |
| 10159 |
var res = []; |
| 10160 |
var i, c, lastIndex, last; |
| 10161 |
for (i = 0; i < children.length; i++) { |
| 10162 |
c = children[i]; |
| 10163 |
if (isUndef(c) || typeof c === 'boolean') { continue } |
| 10164 |
lastIndex = res.length - 1; |
| 10165 |
last = res[lastIndex]; |
| 10166 |
// nested |
| 10167 |
if (Array.isArray(c)) { |
| 10168 |
if (c.length > 0) { |
| 10169 |
c = normalizeArrayChildren(c, ((nestedIndex || '') + "_" + i)); |
| 10170 |
// merge adjacent text nodes |
| 10171 |
if (isTextNode(c[0]) && isTextNode(last)) { |
| 10172 |
res[lastIndex] = createTextVNode(last.text + (c[0]).text); |
| 10173 |
c.shift(); |
| 10174 |
} |
| 10175 |
res.push.apply(res, c); |
| 10176 |
} |
| 10177 |
} else if (isPrimitive(c)) { |
| 10178 |
if (isTextNode(last)) { |
| 10179 |
// merge adjacent text nodes |
| 10180 |
// this is necessary for SSR hydration because text nodes are |
| 10181 |
// essentially merged when rendered to HTML strings |
| 10182 |
res[lastIndex] = createTextVNode(last.text + c); |
| 10183 |
} else if (c !== '') { |
| 10184 |
// convert primitive to vnode |
| 10185 |
res.push(createTextVNode(c)); |
| 10186 |
} |
| 10187 |
} else { |
| 10188 |
if (isTextNode(c) && isTextNode(last)) { |
| 10189 |
// merge adjacent text nodes |
| 10190 |
res[lastIndex] = createTextVNode(last.text + c.text); |
| 10191 |
} else { |
| 10192 |
// default key for nested array children (likely generated by v-for) |
| 10193 |
if (isTrue(children._isVList) && |
| 10194 |
isDef(c.tag) && |
| 10195 |
isUndef(c.key) && |
| 10196 |
isDef(nestedIndex)) { |
| 10197 |
c.key = "__vlist" + nestedIndex + "_" + i + "__"; |
| 10198 |
} |
| 10199 |
res.push(c); |
| 10200 |
} |
| 10201 |
} |
| 10202 |
} |
| 10203 |
return res |
| 10204 |
} |
| 10205 |
|
| 10206 |
/* */ |
| 10207 |
|
| 10208 |
function initProvide (vm) { |
| 10209 |
var provide = vm.$options.provide; |
| 10210 |
if (provide) { |
| 10211 |
vm._provided = typeof provide === 'function' |
| 10212 |
? provide.call(vm) |
| 10213 |
: provide; |
| 10214 |
} |
| 10215 |
} |
| 10216 |
|
| 10217 |
function initInjections (vm) { |
| 10218 |
var result = resolveInject(vm.$options.inject, vm); |
| 10219 |
if (result) { |
| 10220 |
toggleObserving(false); |
| 10221 |
Object.keys(result).forEach(function (key) { |
| 10222 |
/* istanbul ignore else */ |
| 10223 |
if (true) { |
| 10224 |
defineReactive$$1(vm, key, result[key], function () { |
| 10225 |
warn( |
| 10226 |
"Avoid mutating an injected value directly since the changes will be " + |
| 10227 |
"overwritten whenever the provided component re-renders. " + |
| 10228 |
"injection being mutated: \"" + key + "\"", |
| 10229 |
vm |
| 10230 |
); |
| 10231 |
}); |
| 10232 |
} else {} |
| 10233 |
}); |
| 10234 |
toggleObserving(true); |
| 10235 |
} |
| 10236 |
} |
| 10237 |
|
| 10238 |
function resolveInject (inject, vm) { |
| 10239 |
if (inject) { |
| 10240 |
// inject is :any because flow is not smart enough to figure out cached |
| 10241 |
var result = Object.create(null); |
| 10242 |
var keys = hasSymbol |
| 10243 |
? Reflect.ownKeys(inject) |
| 10244 |
: Object.keys(inject); |
| 10245 |
|
| 10246 |
for (var i = 0; i < keys.length; i++) { |
| 10247 |
var key = keys[i]; |
| 10248 |
// #6574 in case the inject object is observed... |
| 10249 |
if (key === '__ob__') { continue } |
| 10250 |
var provideKey = inject[key].from; |
| 10251 |
var source = vm; |
| 10252 |
while (source) { |
| 10253 |
if (source._provided && hasOwn(source._provided, provideKey)) { |
| 10254 |
result[key] = source._provided[provideKey]; |
| 10255 |
break |
| 10256 |
} |
| 10257 |
source = source.$parent; |
| 10258 |
} |
| 10259 |
if (!source) { |
| 10260 |
if ('default' in inject[key]) { |
| 10261 |
var provideDefault = inject[key].default; |
| 10262 |
result[key] = typeof provideDefault === 'function' |
| 10263 |
? provideDefault.call(vm) |
| 10264 |
: provideDefault; |
| 10265 |
} else if (true) { |
| 10266 |
warn(("Injection \"" + key + "\" not found"), vm); |
| 10267 |
} |
| 10268 |
} |
| 10269 |
} |
| 10270 |
return result |
| 10271 |
} |
| 10272 |
} |
| 10273 |
|
| 10274 |
/* */ |
| 10275 |
|
| 10276 |
|
| 10277 |
|
| 10278 |
/** |
| 10279 |
* Runtime helper for resolving raw children VNodes into a slot object. |
| 10280 |
*/ |
| 10281 |
function resolveSlots ( |
| 10282 |
children, |
| 10283 |
context |
| 10284 |
) { |
| 10285 |
if (!children || !children.length) { |
| 10286 |
return {} |
| 10287 |
} |
| 10288 |
var slots = {}; |
| 10289 |
for (var i = 0, l = children.length; i < l; i++) { |
| 10290 |
var child = children[i]; |
| 10291 |
var data = child.data; |
| 10292 |
// remove slot attribute if the node is resolved as a Vue slot node |
| 10293 |
if (data && data.attrs && data.attrs.slot) { |
| 10294 |
delete data.attrs.slot; |
| 10295 |
} |
| 10296 |
// named slots should only be respected if the vnode was rendered in the |
| 10297 |
// same context. |
| 10298 |
if ((child.context === context || child.fnContext === context) && |
| 10299 |
data && data.slot != null |
| 10300 |
) { |
| 10301 |
var name = data.slot; |
| 10302 |
var slot = (slots[name] || (slots[name] = [])); |
| 10303 |
if (child.tag === 'template') { |
| 10304 |
slot.push.apply(slot, child.children || []); |
| 10305 |
} else { |
| 10306 |
slot.push(child); |
| 10307 |
} |
| 10308 |
} else { |
| 10309 |
(slots.default || (slots.default = [])).push(child); |
| 10310 |
} |
| 10311 |
} |
| 10312 |
// ignore slots that contains only whitespace |
| 10313 |
for (var name$1 in slots) { |
| 10314 |
if (slots[name$1].every(isWhitespace)) { |
| 10315 |
delete slots[name$1]; |
| 10316 |
} |
| 10317 |
} |
| 10318 |
return slots |
| 10319 |
} |
| 10320 |
|
| 10321 |
function isWhitespace (node) { |
| 10322 |
return (node.isComment && !node.asyncFactory) || node.text === ' ' |
| 10323 |
} |
| 10324 |
|
| 10325 |
/* */ |
| 10326 |
|
| 10327 |
function isAsyncPlaceholder (node) { |
| 10328 |
return node.isComment && node.asyncFactory |
| 10329 |
} |
| 10330 |
|
| 10331 |
/* */ |
| 10332 |
|
| 10333 |
function normalizeScopedSlots ( |
| 10334 |
slots, |
| 10335 |
normalSlots, |
| 10336 |
prevSlots |
| 10337 |
) { |
| 10338 |
var res; |
| 10339 |
var hasNormalSlots = Object.keys(normalSlots).length > 0; |
| 10340 |
var isStable = slots ? !!slots.$stable : !hasNormalSlots; |
| 10341 |
var key = slots && slots.$key; |
| 10342 |
if (!slots) { |
| 10343 |
res = {}; |
| 10344 |
} else if (slots._normalized) { |
| 10345 |
// fast path 1: child component re-render only, parent did not change |
| 10346 |
return slots._normalized |
| 10347 |
} else if ( |
| 10348 |
isStable && |
| 10349 |
prevSlots && |
| 10350 |
prevSlots !== emptyObject && |
| 10351 |
key === prevSlots.$key && |
| 10352 |
!hasNormalSlots && |
| 10353 |
!prevSlots.$hasNormal |
| 10354 |
) { |
| 10355 |
// fast path 2: stable scoped slots w/ no normal slots to proxy, |
| 10356 |
// only need to normalize once |
| 10357 |
return prevSlots |
| 10358 |
} else { |
| 10359 |
res = {}; |
| 10360 |
for (var key$1 in slots) { |
| 10361 |
if (slots[key$1] && key$1[0] !== '$') { |
| 10362 |
res[key$1] = normalizeScopedSlot(normalSlots, key$1, slots[key$1]); |
| 10363 |
} |
| 10364 |
} |
| 10365 |
} |
| 10366 |
// expose normal slots on scopedSlots |
| 10367 |
for (var key$2 in normalSlots) { |
| 10368 |
if (!(key$2 in res)) { |
| 10369 |
res[key$2] = proxyNormalSlot(normalSlots, key$2); |
| 10370 |
} |
| 10371 |
} |
| 10372 |
// avoriaz seems to mock a non-extensible $scopedSlots object |
| 10373 |
// and when that is passed down this would cause an error |
| 10374 |
if (slots && Object.isExtensible(slots)) { |
| 10375 |
(slots)._normalized = res; |
| 10376 |
} |
| 10377 |
def(res, '$stable', isStable); |
| 10378 |
def(res, '$key', key); |
| 10379 |
def(res, '$hasNormal', hasNormalSlots); |
| 10380 |
return res |
| 10381 |
} |
| 10382 |
|
| 10383 |
function normalizeScopedSlot(normalSlots, key, fn) { |
| 10384 |
var normalized = function () { |
| 10385 |
var res = arguments.length ? fn.apply(null, arguments) : fn({}); |
| 10386 |
res = res && typeof res === 'object' && !Array.isArray(res) |
| 10387 |
? [res] // single vnode |
| 10388 |
: normalizeChildren(res); |
| 10389 |
var vnode = res && res[0]; |
| 10390 |
return res && ( |
| 10391 |
!vnode || |
| 10392 |
(res.length === 1 && vnode.isComment && !isAsyncPlaceholder(vnode)) // #9658, #10391 |
| 10393 |
) ? undefined |
| 10394 |
: res |
| 10395 |
}; |
| 10396 |
// this is a slot using the new v-slot syntax without scope. although it is |
| 10397 |
// compiled as a scoped slot, render fn users would expect it to be present |
| 10398 |
// on this.$slots because the usage is semantically a normal slot. |
| 10399 |
if (fn.proxy) { |
| 10400 |
Object.defineProperty(normalSlots, key, { |
| 10401 |
get: normalized, |
| 10402 |
enumerable: true, |
| 10403 |
configurable: true |
| 10404 |
}); |
| 10405 |
} |
| 10406 |
return normalized |
| 10407 |
} |
| 10408 |
|
| 10409 |
function proxyNormalSlot(slots, key) { |
| 10410 |
return function () { return slots[key]; } |
| 10411 |
} |
| 10412 |
|
| 10413 |
/* */ |
| 10414 |
|
| 10415 |
/** |
| 10416 |
* Runtime helper for rendering v-for lists. |
| 10417 |
*/ |
| 10418 |
function renderList ( |
| 10419 |
val, |
| 10420 |
render |
| 10421 |
) { |
| 10422 |
var ret, i, l, keys, key; |
| 10423 |
if (Array.isArray(val) || typeof val === 'string') { |
| 10424 |
ret = new Array(val.length); |
| 10425 |
for (i = 0, l = val.length; i < l; i++) { |
| 10426 |
ret[i] = render(val[i], i); |
| 10427 |
} |
| 10428 |
} else if (typeof val === 'number') { |
| 10429 |
ret = new Array(val); |
| 10430 |
for (i = 0; i < val; i++) { |
| 10431 |
ret[i] = render(i + 1, i); |
| 10432 |
} |
| 10433 |
} else if (isObject(val)) { |
| 10434 |
if (hasSymbol && val[Symbol.iterator]) { |
| 10435 |
ret = []; |
| 10436 |
var iterator = val[Symbol.iterator](); |
| 10437 |
var result = iterator.next(); |
| 10438 |
while (!result.done) { |
| 10439 |
ret.push(render(result.value, ret.length)); |
| 10440 |
result = iterator.next(); |
| 10441 |
} |
| 10442 |
} else { |
| 10443 |
keys = Object.keys(val); |
| 10444 |
ret = new Array(keys.length); |
| 10445 |
for (i = 0, l = keys.length; i < l; i++) { |
| 10446 |
key = keys[i]; |
| 10447 |
ret[i] = render(val[key], key, i); |
| 10448 |
} |
| 10449 |
} |
| 10450 |
} |
| 10451 |
if (!isDef(ret)) { |
| 10452 |
ret = []; |
| 10453 |
} |
| 10454 |
(ret)._isVList = true; |
| 10455 |
return ret |
| 10456 |
} |
| 10457 |
|
| 10458 |
/* */ |
| 10459 |
|
| 10460 |
/** |
| 10461 |
* Runtime helper for rendering <slot> |
| 10462 |
*/ |
| 10463 |
function renderSlot ( |
| 10464 |
name, |
| 10465 |
fallbackRender, |
| 10466 |
props, |
| 10467 |
bindObject |
| 10468 |
) { |
| 10469 |
var scopedSlotFn = this.$scopedSlots[name]; |
| 10470 |
var nodes; |
| 10471 |
if (scopedSlotFn) { |
| 10472 |
// scoped slot |
| 10473 |
props = props || {}; |
| 10474 |
if (bindObject) { |
| 10475 |
if ( true && !isObject(bindObject)) { |
| 10476 |
warn('slot v-bind without argument expects an Object', this); |
| 10477 |
} |
| 10478 |
props = extend(extend({}, bindObject), props); |
| 10479 |
} |
| 10480 |
nodes = |
| 10481 |
scopedSlotFn(props) || |
| 10482 |
(typeof fallbackRender === 'function' ? fallbackRender() : fallbackRender); |
| 10483 |
} else { |
| 10484 |
nodes = |
| 10485 |
this.$slots[name] || |
| 10486 |
(typeof fallbackRender === 'function' ? fallbackRender() : fallbackRender); |
| 10487 |
} |
| 10488 |
|
| 10489 |
var target = props && props.slot; |
| 10490 |
if (target) { |
| 10491 |
return this.$createElement('template', { slot: target }, nodes) |
| 10492 |
} else { |
| 10493 |
return nodes |
| 10494 |
} |
| 10495 |
} |
| 10496 |
|
| 10497 |
/* */ |
| 10498 |
|
| 10499 |
/** |
| 10500 |
* Runtime helper for resolving filters |
| 10501 |
*/ |
| 10502 |
function resolveFilter (id) { |
| 10503 |
return resolveAsset(this.$options, 'filters', id, true) || identity |
| 10504 |
} |
| 10505 |
|
| 10506 |
/* */ |
| 10507 |
|
| 10508 |
function isKeyNotMatch (expect, actual) { |
| 10509 |
if (Array.isArray(expect)) { |
| 10510 |
return expect.indexOf(actual) === -1 |
| 10511 |
} else { |
| 10512 |
return expect !== actual |
| 10513 |
} |
| 10514 |
} |
| 10515 |
|
| 10516 |
/** |
| 10517 |
* Runtime helper for checking keyCodes from config. |
| 10518 |
* exposed as Vue.prototype._k |
| 10519 |
* passing in eventKeyName as last argument separately for backwards compat |
| 10520 |
*/ |
| 10521 |
function checkKeyCodes ( |
| 10522 |
eventKeyCode, |
| 10523 |
key, |
| 10524 |
builtInKeyCode, |
| 10525 |
eventKeyName, |
| 10526 |
builtInKeyName |
| 10527 |
) { |
| 10528 |
var mappedKeyCode = config.keyCodes[key] || builtInKeyCode; |
| 10529 |
if (builtInKeyName && eventKeyName && !config.keyCodes[key]) { |
| 10530 |
return isKeyNotMatch(builtInKeyName, eventKeyName) |
| 10531 |
} else if (mappedKeyCode) { |
| 10532 |
return isKeyNotMatch(mappedKeyCode, eventKeyCode) |
| 10533 |
} else if (eventKeyName) { |
| 10534 |
return hyphenate(eventKeyName) !== key |
| 10535 |
} |
| 10536 |
return eventKeyCode === undefined |
| 10537 |
} |
| 10538 |
|
| 10539 |
/* */ |
| 10540 |
|
| 10541 |
/** |
| 10542 |
* Runtime helper for merging v-bind="object" into a VNode's data. |
| 10543 |
*/ |
| 10544 |
function bindObjectProps ( |
| 10545 |
data, |
| 10546 |
tag, |
| 10547 |
value, |
| 10548 |
asProp, |
| 10549 |
isSync |
| 10550 |
) { |
| 10551 |
if (value) { |
| 10552 |
if (!isObject(value)) { |
| 10553 |
true && warn( |
| 10554 |
'v-bind without argument expects an Object or Array value', |
| 10555 |
this |
| 10556 |
); |
| 10557 |
} else { |
| 10558 |
if (Array.isArray(value)) { |
| 10559 |
value = toObject(value); |
| 10560 |
} |
| 10561 |
var hash; |
| 10562 |
var loop = function ( key ) { |
| 10563 |
if ( |
| 10564 |
key === 'class' || |
| 10565 |
key === 'style' || |
| 10566 |
isReservedAttribute(key) |
| 10567 |
) { |
| 10568 |
hash = data; |
| 10569 |
} else { |
| 10570 |
var type = data.attrs && data.attrs.type; |
| 10571 |
hash = asProp || config.mustUseProp(tag, type, key) |
| 10572 |
? data.domProps || (data.domProps = {}) |
| 10573 |
: data.attrs || (data.attrs = {}); |
| 10574 |
} |
| 10575 |
var camelizedKey = camelize(key); |
| 10576 |
var hyphenatedKey = hyphenate(key); |
| 10577 |
if (!(camelizedKey in hash) && !(hyphenatedKey in hash)) { |
| 10578 |
hash[key] = value[key]; |
| 10579 |
|
| 10580 |
if (isSync) { |
| 10581 |
var on = data.on || (data.on = {}); |
| 10582 |
on[("update:" + key)] = function ($event) { |
| 10583 |
value[key] = $event; |
| 10584 |
}; |
| 10585 |
} |
| 10586 |
} |
| 10587 |
}; |
| 10588 |
|
| 10589 |
for (var key in value) loop( key ); |
| 10590 |
} |
| 10591 |
} |
| 10592 |
return data |
| 10593 |
} |
| 10594 |
|
| 10595 |
/* */ |
| 10596 |
|
| 10597 |
/** |
| 10598 |
* Runtime helper for rendering static trees. |
| 10599 |
*/ |
| 10600 |
function renderStatic ( |
| 10601 |
index, |
| 10602 |
isInFor |
| 10603 |
) { |
| 10604 |
var cached = this._staticTrees || (this._staticTrees = []); |
| 10605 |
var tree = cached[index]; |
| 10606 |
// if has already-rendered static tree and not inside v-for, |
| 10607 |
// we can reuse the same tree. |
| 10608 |
if (tree && !isInFor) { |
| 10609 |
return tree |
| 10610 |
} |
| 10611 |
// otherwise, render a fresh tree. |
| 10612 |
tree = cached[index] = this.$options.staticRenderFns[index].call( |
| 10613 |
this._renderProxy, |
| 10614 |
null, |
| 10615 |
this // for render fns generated for functional component templates |
| 10616 |
); |
| 10617 |
markStatic(tree, ("__static__" + index), false); |
| 10618 |
return tree |
| 10619 |
} |
| 10620 |
|
| 10621 |
/** |
| 10622 |
* Runtime helper for v-once. |
| 10623 |
* Effectively it means marking the node as static with a unique key. |
| 10624 |
*/ |
| 10625 |
function markOnce ( |
| 10626 |
tree, |
| 10627 |
index, |
| 10628 |
key |
| 10629 |
) { |
| 10630 |
markStatic(tree, ("__once__" + index + (key ? ("_" + key) : "")), true); |
| 10631 |
return tree |
| 10632 |
} |
| 10633 |
|
| 10634 |
function markStatic ( |
| 10635 |
tree, |
| 10636 |
key, |
| 10637 |
isOnce |
| 10638 |
) { |
| 10639 |
if (Array.isArray(tree)) { |
| 10640 |
for (var i = 0; i < tree.length; i++) { |
| 10641 |
if (tree[i] && typeof tree[i] !== 'string') { |
| 10642 |
markStaticNode(tree[i], (key + "_" + i), isOnce); |
| 10643 |
} |
| 10644 |
} |
| 10645 |
} else { |
| 10646 |
markStaticNode(tree, key, isOnce); |
| 10647 |
} |
| 10648 |
} |
| 10649 |
|
| 10650 |
function markStaticNode (node, key, isOnce) { |
| 10651 |
node.isStatic = true; |
| 10652 |
node.key = key; |
| 10653 |
node.isOnce = isOnce; |
| 10654 |
} |
| 10655 |
|
| 10656 |
/* */ |
| 10657 |
|
| 10658 |
function bindObjectListeners (data, value) { |
| 10659 |
if (value) { |
| 10660 |
if (!isPlainObject(value)) { |
| 10661 |
true && warn( |
| 10662 |
'v-on without argument expects an Object value', |
| 10663 |
this |
| 10664 |
); |
| 10665 |
} else { |
| 10666 |
var on = data.on = data.on ? extend({}, data.on) : {}; |
| 10667 |
for (var key in value) { |
| 10668 |
var existing = on[key]; |
| 10669 |
var ours = value[key]; |
| 10670 |
on[key] = existing ? [].concat(existing, ours) : ours; |
| 10671 |
} |
| 10672 |
} |
| 10673 |
} |
| 10674 |
return data |
| 10675 |
} |
| 10676 |
|
| 10677 |
/* */ |
| 10678 |
|
| 10679 |
function resolveScopedSlots ( |
| 10680 |
fns, // see flow/vnode |
| 10681 |
res, |
| 10682 |
// the following are added in 2.6 |
| 10683 |
hasDynamicKeys, |
| 10684 |
contentHashKey |
| 10685 |
) { |
| 10686 |
res = res || { $stable: !hasDynamicKeys }; |
| 10687 |
for (var i = 0; i < fns.length; i++) { |
| 10688 |
var slot = fns[i]; |
| 10689 |
if (Array.isArray(slot)) { |
| 10690 |
resolveScopedSlots(slot, res, hasDynamicKeys); |
| 10691 |
} else if (slot) { |
| 10692 |
// marker for reverse proxying v-slot without scope on this.$slots |
| 10693 |
if (slot.proxy) { |
| 10694 |
slot.fn.proxy = true; |
| 10695 |
} |
| 10696 |
res[slot.key] = slot.fn; |
| 10697 |
} |
| 10698 |
} |
| 10699 |
if (contentHashKey) { |
| 10700 |
(res).$key = contentHashKey; |
| 10701 |
} |
| 10702 |
return res |
| 10703 |
} |
| 10704 |
|
| 10705 |
/* */ |
| 10706 |
|
| 10707 |
function bindDynamicKeys (baseObj, values) { |
| 10708 |
for (var i = 0; i < values.length; i += 2) { |
| 10709 |
var key = values[i]; |
| 10710 |
if (typeof key === 'string' && key) { |
| 10711 |
baseObj[values[i]] = values[i + 1]; |
| 10712 |
} else if ( true && key !== '' && key !== null) { |
| 10713 |
// null is a special value for explicitly removing a binding |
| 10714 |
warn( |
| 10715 |
("Invalid value for dynamic directive argument (expected string or null): " + key), |
| 10716 |
this |
| 10717 |
); |
| 10718 |
} |
| 10719 |
} |
| 10720 |
return baseObj |
| 10721 |
} |
| 10722 |
|
| 10723 |
// helper to dynamically append modifier runtime markers to event names. |
| 10724 |
// ensure only append when value is already string, otherwise it will be cast |
| 10725 |
// to string and cause the type check to miss. |
| 10726 |
function prependModifier (value, symbol) { |
| 10727 |
return typeof value === 'string' ? symbol + value : value |
| 10728 |
} |
| 10729 |
|
| 10730 |
/* */ |
| 10731 |
|
| 10732 |
function installRenderHelpers (target) { |
| 10733 |
target._o = markOnce; |
| 10734 |
target._n = toNumber; |
| 10735 |
target._s = toString; |
| 10736 |
target._l = renderList; |
| 10737 |
target._t = renderSlot; |
| 10738 |
target._q = looseEqual; |
| 10739 |
target._i = looseIndexOf; |
| 10740 |
target._m = renderStatic; |
| 10741 |
target._f = resolveFilter; |
| 10742 |
target._k = checkKeyCodes; |
| 10743 |
target._b = bindObjectProps; |
| 10744 |
target._v = createTextVNode; |
| 10745 |
target._e = createEmptyVNode; |
| 10746 |
target._u = resolveScopedSlots; |
| 10747 |
target._g = bindObjectListeners; |
| 10748 |
target._d = bindDynamicKeys; |
| 10749 |
target._p = prependModifier; |
| 10750 |
} |
| 10751 |
|
| 10752 |
/* */ |
| 10753 |
|
| 10754 |
function FunctionalRenderContext ( |
| 10755 |
data, |
| 10756 |
props, |
| 10757 |
children, |
| 10758 |
parent, |
| 10759 |
Ctor |
| 10760 |
) { |
| 10761 |
var this$1 = this; |
| 10762 |
|
| 10763 |
var options = Ctor.options; |
| 10764 |
// ensure the createElement function in functional components |
| 10765 |
// gets a unique context - this is necessary for correct named slot check |
| 10766 |
var contextVm; |
| 10767 |
if (hasOwn(parent, '_uid')) { |
| 10768 |
contextVm = Object.create(parent); |
| 10769 |
// $flow-disable-line |
| 10770 |
contextVm._original = parent; |
| 10771 |
} else { |
| 10772 |
// the context vm passed in is a functional context as well. |
| 10773 |
// in this case we want to make sure we are able to get a hold to the |
| 10774 |
// real context instance. |
| 10775 |
contextVm = parent; |
| 10776 |
// $flow-disable-line |
| 10777 |
parent = parent._original; |
| 10778 |
} |
| 10779 |
var isCompiled = isTrue(options._compiled); |
| 10780 |
var needNormalization = !isCompiled; |
| 10781 |
|
| 10782 |
this.data = data; |
| 10783 |
this.props = props; |
| 10784 |
this.children = children; |
| 10785 |
this.parent = parent; |
| 10786 |
this.listeners = data.on || emptyObject; |
| 10787 |
this.injections = resolveInject(options.inject, parent); |
| 10788 |
this.slots = function () { |
| 10789 |
if (!this$1.$slots) { |
| 10790 |
normalizeScopedSlots( |
| 10791 |
data.scopedSlots, |
| 10792 |
this$1.$slots = resolveSlots(children, parent) |
| 10793 |
); |
| 10794 |
} |
| 10795 |
return this$1.$slots |
| 10796 |
}; |
| 10797 |
|
| 10798 |
Object.defineProperty(this, 'scopedSlots', ({ |
| 10799 |
enumerable: true, |
| 10800 |
get: function get () { |
| 10801 |
return normalizeScopedSlots(data.scopedSlots, this.slots()) |
| 10802 |
} |
| 10803 |
})); |
| 10804 |
|
| 10805 |
// support for compiled functional template |
| 10806 |
if (isCompiled) { |
| 10807 |
// exposing $options for renderStatic() |
| 10808 |
this.$options = options; |
| 10809 |
// pre-resolve slots for renderSlot() |
| 10810 |
this.$slots = this.slots(); |
| 10811 |
this.$scopedSlots = normalizeScopedSlots(data.scopedSlots, this.$slots); |
| 10812 |
} |
| 10813 |
|
| 10814 |
if (options._scopeId) { |
| 10815 |
this._c = function (a, b, c, d) { |
| 10816 |
var vnode = createElement(contextVm, a, b, c, d, needNormalization); |
| 10817 |
if (vnode && !Array.isArray(vnode)) { |
| 10818 |
vnode.fnScopeId = options._scopeId; |
| 10819 |
vnode.fnContext = parent; |
| 10820 |
} |
| 10821 |
return vnode |
| 10822 |
}; |
| 10823 |
} else { |
| 10824 |
this._c = function (a, b, c, d) { return createElement(contextVm, a, b, c, d, needNormalization); }; |
| 10825 |
} |
| 10826 |
} |
| 10827 |
|
| 10828 |
installRenderHelpers(FunctionalRenderContext.prototype); |
| 10829 |
|
| 10830 |
function createFunctionalComponent ( |
| 10831 |
Ctor, |
| 10832 |
propsData, |
| 10833 |
data, |
| 10834 |
contextVm, |
| 10835 |
children |
| 10836 |
) { |
| 10837 |
var options = Ctor.options; |
| 10838 |
var props = {}; |
| 10839 |
var propOptions = options.props; |
| 10840 |
if (isDef(propOptions)) { |
| 10841 |
for (var key in propOptions) { |
| 10842 |
props[key] = validateProp(key, propOptions, propsData || emptyObject); |
| 10843 |
} |
| 10844 |
} else { |
| 10845 |
if (isDef(data.attrs)) { mergeProps(props, data.attrs); } |
| 10846 |
if (isDef(data.props)) { mergeProps(props, data.props); } |
| 10847 |
} |
| 10848 |
|
| 10849 |
var renderContext = new FunctionalRenderContext( |
| 10850 |
data, |
| 10851 |
props, |
| 10852 |
children, |
| 10853 |
contextVm, |
| 10854 |
Ctor |
| 10855 |
); |
| 10856 |
|
| 10857 |
var vnode = options.render.call(null, renderContext._c, renderContext); |
| 10858 |
|
| 10859 |
if (vnode instanceof VNode) { |
| 10860 |
return cloneAndMarkFunctionalResult(vnode, data, renderContext.parent, options, renderContext) |
| 10861 |
} else if (Array.isArray(vnode)) { |
| 10862 |
var vnodes = normalizeChildren(vnode) || []; |
| 10863 |
var res = new Array(vnodes.length); |
| 10864 |
for (var i = 0; i < vnodes.length; i++) { |
| 10865 |
res[i] = cloneAndMarkFunctionalResult(vnodes[i], data, renderContext.parent, options, renderContext); |
| 10866 |
} |
| 10867 |
return res |
| 10868 |
} |
| 10869 |
} |
| 10870 |
|
| 10871 |
function cloneAndMarkFunctionalResult (vnode, data, contextVm, options, renderContext) { |
| 10872 |
// #7817 clone node before setting fnContext, otherwise if the node is reused |
| 10873 |
// (e.g. it was from a cached normal slot) the fnContext causes named slots |
| 10874 |
// that should not be matched to match. |
| 10875 |
var clone = cloneVNode(vnode); |
| 10876 |
clone.fnContext = contextVm; |
| 10877 |
clone.fnOptions = options; |
| 10878 |
if (true) { |
| 10879 |
(clone.devtoolsMeta = clone.devtoolsMeta || {}).renderContext = renderContext; |
| 10880 |
} |
| 10881 |
if (data.slot) { |
| 10882 |
(clone.data || (clone.data = {})).slot = data.slot; |
| 10883 |
} |
| 10884 |
return clone |
| 10885 |
} |
| 10886 |
|
| 10887 |
function mergeProps (to, from) { |
| 10888 |
for (var key in from) { |
| 10889 |
to[camelize(key)] = from[key]; |
| 10890 |
} |
| 10891 |
} |
| 10892 |
|
| 10893 |
/* */ |
| 10894 |
|
| 10895 |
/* */ |
| 10896 |
|
| 10897 |
/* */ |
| 10898 |
|
| 10899 |
/* */ |
| 10900 |
|
| 10901 |
// inline hooks to be invoked on component VNodes during patch |
| 10902 |
var componentVNodeHooks = { |
| 10903 |
init: function init (vnode, hydrating) { |
| 10904 |
if ( |
| 10905 |
vnode.componentInstance && |
| 10906 |
!vnode.componentInstance._isDestroyed && |
| 10907 |
vnode.data.keepAlive |
| 10908 |
) { |
| 10909 |
// kept-alive components, treat as a patch |
| 10910 |
var mountedNode = vnode; // work around flow |
| 10911 |
componentVNodeHooks.prepatch(mountedNode, mountedNode); |
| 10912 |
} else { |
| 10913 |
var child = vnode.componentInstance = createComponentInstanceForVnode( |
| 10914 |
vnode, |
| 10915 |
activeInstance |
| 10916 |
); |
| 10917 |
child.$mount(hydrating ? vnode.elm : undefined, hydrating); |
| 10918 |
} |
| 10919 |
}, |
| 10920 |
|
| 10921 |
prepatch: function prepatch (oldVnode, vnode) { |
| 10922 |
var options = vnode.componentOptions; |
| 10923 |
var child = vnode.componentInstance = oldVnode.componentInstance; |
| 10924 |
updateChildComponent( |
| 10925 |
child, |
| 10926 |
options.propsData, // updated props |
| 10927 |
options.listeners, // updated listeners |
| 10928 |
vnode, // new parent vnode |
| 10929 |
options.children // new children |
| 10930 |
); |
| 10931 |
}, |
| 10932 |
|
| 10933 |
insert: function insert (vnode) { |
| 10934 |
var context = vnode.context; |
| 10935 |
var componentInstance = vnode.componentInstance; |
| 10936 |
if (!componentInstance._isMounted) { |
| 10937 |
componentInstance._isMounted = true; |
| 10938 |
callHook(componentInstance, 'mounted'); |
| 10939 |
} |
| 10940 |
if (vnode.data.keepAlive) { |
| 10941 |
if (context._isMounted) { |
| 10942 |
// vue-router#1212 |
| 10943 |
// During updates, a kept-alive component's child components may |
| 10944 |
// change, so directly walking the tree here may call activated hooks |
| 10945 |
// on incorrect children. Instead we push them into a queue which will |
| 10946 |
// be processed after the whole patch process ended. |
| 10947 |
queueActivatedComponent(componentInstance); |
| 10948 |
} else { |
| 10949 |
activateChildComponent(componentInstance, true /* direct */); |
| 10950 |
} |
| 10951 |
} |
| 10952 |
}, |
| 10953 |
|
| 10954 |
destroy: function destroy (vnode) { |
| 10955 |
var componentInstance = vnode.componentInstance; |
| 10956 |
if (!componentInstance._isDestroyed) { |
| 10957 |
if (!vnode.data.keepAlive) { |
| 10958 |
componentInstance.$destroy(); |
| 10959 |
} else { |
| 10960 |
deactivateChildComponent(componentInstance, true /* direct */); |
| 10961 |
} |
| 10962 |
} |
| 10963 |
} |
| 10964 |
}; |
| 10965 |
|
| 10966 |
var hooksToMerge = Object.keys(componentVNodeHooks); |
| 10967 |
|
| 10968 |
function createComponent ( |
| 10969 |
Ctor, |
| 10970 |
data, |
| 10971 |
context, |
| 10972 |
children, |
| 10973 |
tag |
| 10974 |
) { |
| 10975 |
if (isUndef(Ctor)) { |
| 10976 |
return |
| 10977 |
} |
| 10978 |
|
| 10979 |
var baseCtor = context.$options._base; |
| 10980 |
|
| 10981 |
// plain options object: turn it into a constructor |
| 10982 |
if (isObject(Ctor)) { |
| 10983 |
Ctor = baseCtor.extend(Ctor); |
| 10984 |
} |
| 10985 |
|
| 10986 |
// if at this stage it's not a constructor or an async component factory, |
| 10987 |
// reject. |
| 10988 |
if (typeof Ctor !== 'function') { |
| 10989 |
if (true) { |
| 10990 |
warn(("Invalid Component definition: " + (String(Ctor))), context); |
| 10991 |
} |
| 10992 |
return |
| 10993 |
} |
| 10994 |
|
| 10995 |
// async component |
| 10996 |
var asyncFactory; |
| 10997 |
if (isUndef(Ctor.cid)) { |
| 10998 |
asyncFactory = Ctor; |
| 10999 |
Ctor = resolveAsyncComponent(asyncFactory, baseCtor); |
| 11000 |
if (Ctor === undefined) { |
| 11001 |
// return a placeholder node for async component, which is rendered |
| 11002 |
// as a comment node but preserves all the raw information for the node. |
| 11003 |
// the information will be used for async server-rendering and hydration. |
| 11004 |
return createAsyncPlaceholder( |
| 11005 |
asyncFactory, |
| 11006 |
data, |
| 11007 |
context, |
| 11008 |
children, |
| 11009 |
tag |
| 11010 |
) |
| 11011 |
} |
| 11012 |
} |
| 11013 |
|
| 11014 |
data = data || {}; |
| 11015 |
|
| 11016 |
// resolve constructor options in case global mixins are applied after |
| 11017 |
// component constructor creation |
| 11018 |
resolveConstructorOptions(Ctor); |
| 11019 |
|
| 11020 |
// transform component v-model data into props & events |
| 11021 |
if (isDef(data.model)) { |
| 11022 |
transformModel(Ctor.options, data); |
| 11023 |
} |
| 11024 |
|
| 11025 |
// extract props |
| 11026 |
var propsData = extractPropsFromVNodeData(data, Ctor, tag); |
| 11027 |
|
| 11028 |
// functional component |
| 11029 |
if (isTrue(Ctor.options.functional)) { |
| 11030 |
return createFunctionalComponent(Ctor, propsData, data, context, children) |
| 11031 |
} |
| 11032 |
|
| 11033 |
// extract listeners, since these needs to be treated as |
| 11034 |
// child component listeners instead of DOM listeners |
| 11035 |
var listeners = data.on; |
| 11036 |
// replace with listeners with .native modifier |
| 11037 |
// so it gets processed during parent component patch. |
| 11038 |
data.on = data.nativeOn; |
| 11039 |
|
| 11040 |
if (isTrue(Ctor.options.abstract)) { |
| 11041 |
// abstract components do not keep anything |
| 11042 |
// other than props & listeners & slot |
| 11043 |
|
| 11044 |
// work around flow |
| 11045 |
var slot = data.slot; |
| 11046 |
data = {}; |
| 11047 |
if (slot) { |
| 11048 |
data.slot = slot; |
| 11049 |
} |
| 11050 |
} |
| 11051 |
|
| 11052 |
// install component management hooks onto the placeholder node |
| 11053 |
installComponentHooks(data); |
| 11054 |
|
| 11055 |
// return a placeholder vnode |
| 11056 |
var name = Ctor.options.name || tag; |
| 11057 |
var vnode = new VNode( |
| 11058 |
("vue-component-" + (Ctor.cid) + (name ? ("-" + name) : '')), |
| 11059 |
data, undefined, undefined, undefined, context, |
| 11060 |
{ Ctor: Ctor, propsData: propsData, listeners: listeners, tag: tag, children: children }, |
| 11061 |
asyncFactory |
| 11062 |
); |
| 11063 |
|
| 11064 |
return vnode |
| 11065 |
} |
| 11066 |
|
| 11067 |
function createComponentInstanceForVnode ( |
| 11068 |
// we know it's MountedComponentVNode but flow doesn't |
| 11069 |
vnode, |
| 11070 |
// activeInstance in lifecycle state |
| 11071 |
parent |
| 11072 |
) { |
| 11073 |
var options = { |
| 11074 |
_isComponent: true, |
| 11075 |
_parentVnode: vnode, |
| 11076 |
parent: parent |
| 11077 |
}; |
| 11078 |
// check inline-template render functions |
| 11079 |
var inlineTemplate = vnode.data.inlineTemplate; |
| 11080 |
if (isDef(inlineTemplate)) { |
| 11081 |
options.render = inlineTemplate.render; |
| 11082 |
options.staticRenderFns = inlineTemplate.staticRenderFns; |
| 11083 |
} |
| 11084 |
return new vnode.componentOptions.Ctor(options) |
| 11085 |
} |
| 11086 |
|
| 11087 |
function installComponentHooks (data) { |
| 11088 |
var hooks = data.hook || (data.hook = {}); |
| 11089 |
for (var i = 0; i < hooksToMerge.length; i++) { |
| 11090 |
var key = hooksToMerge[i]; |
| 11091 |
var existing = hooks[key]; |
| 11092 |
var toMerge = componentVNodeHooks[key]; |
| 11093 |
if (existing !== toMerge && !(existing && existing._merged)) { |
| 11094 |
hooks[key] = existing ? mergeHook$1(toMerge, existing) : toMerge; |
| 11095 |
} |
| 11096 |
} |
| 11097 |
} |
| 11098 |
|
| 11099 |
function mergeHook$1 (f1, f2) { |
| 11100 |
var merged = function (a, b) { |
| 11101 |
// flow complains about extra args which is why we use any |
| 11102 |
f1(a, b); |
| 11103 |
f2(a, b); |
| 11104 |
}; |
| 11105 |
merged._merged = true; |
| 11106 |
return merged |
| 11107 |
} |
| 11108 |
|
| 11109 |
// transform component v-model info (value and callback) into |
| 11110 |
// prop and event handler respectively. |
| 11111 |
function transformModel (options, data) { |
| 11112 |
var prop = (options.model && options.model.prop) || 'value'; |
| 11113 |
var event = (options.model && options.model.event) || 'input' |
| 11114 |
;(data.attrs || (data.attrs = {}))[prop] = data.model.value; |
| 11115 |
var on = data.on || (data.on = {}); |
| 11116 |
var existing = on[event]; |
| 11117 |
var callback = data.model.callback; |
| 11118 |
if (isDef(existing)) { |
| 11119 |
if ( |
| 11120 |
Array.isArray(existing) |
| 11121 |
? existing.indexOf(callback) === -1 |
| 11122 |
: existing !== callback |
| 11123 |
) { |
| 11124 |
on[event] = [callback].concat(existing); |
| 11125 |
} |
| 11126 |
} else { |
| 11127 |
on[event] = callback; |
| 11128 |
} |
| 11129 |
} |
| 11130 |
|
| 11131 |
/* */ |
| 11132 |
|
| 11133 |
var SIMPLE_NORMALIZE = 1; |
| 11134 |
var ALWAYS_NORMALIZE = 2; |
| 11135 |
|
| 11136 |
// wrapper function for providing a more flexible interface |
| 11137 |
// without getting yelled at by flow |
| 11138 |
function createElement ( |
| 11139 |
context, |
| 11140 |
tag, |
| 11141 |
data, |
| 11142 |
children, |
| 11143 |
normalizationType, |
| 11144 |
alwaysNormalize |
| 11145 |
) { |
| 11146 |
if (Array.isArray(data) || isPrimitive(data)) { |
| 11147 |
normalizationType = children; |
| 11148 |
children = data; |
| 11149 |
data = undefined; |
| 11150 |
} |
| 11151 |
if (isTrue(alwaysNormalize)) { |
| 11152 |
normalizationType = ALWAYS_NORMALIZE; |
| 11153 |
} |
| 11154 |
return _createElement(context, tag, data, children, normalizationType) |
| 11155 |
} |
| 11156 |
|
| 11157 |
function _createElement ( |
| 11158 |
context, |
| 11159 |
tag, |
| 11160 |
data, |
| 11161 |
children, |
| 11162 |
normalizationType |
| 11163 |
) { |
| 11164 |
if (isDef(data) && isDef((data).__ob__)) { |
| 11165 |
true && warn( |
| 11166 |
"Avoid using observed data object as vnode data: " + (JSON.stringify(data)) + "\n" + |
| 11167 |
'Always create fresh vnode data objects in each render!', |
| 11168 |
context |
| 11169 |
); |
| 11170 |
return createEmptyVNode() |
| 11171 |
} |
| 11172 |
// object syntax in v-bind |
| 11173 |
if (isDef(data) && isDef(data.is)) { |
| 11174 |
tag = data.is; |
| 11175 |
} |
| 11176 |
if (!tag) { |
| 11177 |
// in case of component :is set to falsy value |
| 11178 |
return createEmptyVNode() |
| 11179 |
} |
| 11180 |
// warn against non-primitive key |
| 11181 |
if ( true && |
| 11182 |
isDef(data) && isDef(data.key) && !isPrimitive(data.key) |
| 11183 |
) { |
| 11184 |
{ |
| 11185 |
warn( |
| 11186 |
'Avoid using non-primitive value as key, ' + |
| 11187 |
'use string/number value instead.', |
| 11188 |
context |
| 11189 |
); |
| 11190 |
} |
| 11191 |
} |
| 11192 |
// support single function children as default scoped slot |
| 11193 |
if (Array.isArray(children) && |
| 11194 |
typeof children[0] === 'function' |
| 11195 |
) { |
| 11196 |
data = data || {}; |
| 11197 |
data.scopedSlots = { default: children[0] }; |
| 11198 |
children.length = 0; |
| 11199 |
} |
| 11200 |
if (normalizationType === ALWAYS_NORMALIZE) { |
| 11201 |
children = normalizeChildren(children); |
| 11202 |
} else if (normalizationType === SIMPLE_NORMALIZE) { |
| 11203 |
children = simpleNormalizeChildren(children); |
| 11204 |
} |
| 11205 |
var vnode, ns; |
| 11206 |
if (typeof tag === 'string') { |
| 11207 |
var Ctor; |
| 11208 |
ns = (context.$vnode && context.$vnode.ns) || config.getTagNamespace(tag); |
| 11209 |
if (config.isReservedTag(tag)) { |
| 11210 |
// platform built-in elements |
| 11211 |
if ( true && isDef(data) && isDef(data.nativeOn) && data.tag !== 'component') { |
| 11212 |
warn( |
| 11213 |
("The .native modifier for v-on is only valid on components but it was used on <" + tag + ">."), |
| 11214 |
context |
| 11215 |
); |
| 11216 |
} |
| 11217 |
vnode = new VNode( |
| 11218 |
config.parsePlatformTagName(tag), data, children, |
| 11219 |
undefined, undefined, context |
| 11220 |
); |
| 11221 |
} else if ((!data || !data.pre) && isDef(Ctor = resolveAsset(context.$options, 'components', tag))) { |
| 11222 |
// component |
| 11223 |
vnode = createComponent(Ctor, data, context, children, tag); |
| 11224 |
} else { |
| 11225 |
// unknown or unlisted namespaced elements |
| 11226 |
// check at runtime because it may get assigned a namespace when its |
| 11227 |
// parent normalizes children |
| 11228 |
vnode = new VNode( |
| 11229 |
tag, data, children, |
| 11230 |
undefined, undefined, context |
| 11231 |
); |
| 11232 |
} |
| 11233 |
} else { |
| 11234 |
// direct component options / constructor |
| 11235 |
vnode = createComponent(tag, data, context, children); |
| 11236 |
} |
| 11237 |
if (Array.isArray(vnode)) { |
| 11238 |
return vnode |
| 11239 |
} else if (isDef(vnode)) { |
| 11240 |
if (isDef(ns)) { applyNS(vnode, ns); } |
| 11241 |
if (isDef(data)) { registerDeepBindings(data); } |
| 11242 |
return vnode |
| 11243 |
} else { |
| 11244 |
return createEmptyVNode() |
| 11245 |
} |
| 11246 |
} |
| 11247 |
|
| 11248 |
function applyNS (vnode, ns, force) { |
| 11249 |
vnode.ns = ns; |
| 11250 |
if (vnode.tag === 'foreignObject') { |
| 11251 |
// use default namespace inside foreignObject |
| 11252 |
ns = undefined; |
| 11253 |
force = true; |
| 11254 |
} |
| 11255 |
if (isDef(vnode.children)) { |
| 11256 |
for (var i = 0, l = vnode.children.length; i < l; i++) { |
| 11257 |
var child = vnode.children[i]; |
| 11258 |
if (isDef(child.tag) && ( |
| 11259 |
isUndef(child.ns) || (isTrue(force) && child.tag !== 'svg'))) { |
| 11260 |
applyNS(child, ns, force); |
| 11261 |
} |
| 11262 |
} |
| 11263 |
} |
| 11264 |
} |
| 11265 |
|
| 11266 |
// ref #5318 |
| 11267 |
// necessary to ensure parent re-render when deep bindings like :style and |
| 11268 |
// :class are used on slot nodes |
| 11269 |
function registerDeepBindings (data) { |
| 11270 |
if (isObject(data.style)) { |
| 11271 |
traverse(data.style); |
| 11272 |
} |
| 11273 |
if (isObject(data.class)) { |
| 11274 |
traverse(data.class); |
| 11275 |
} |
| 11276 |
} |
| 11277 |
|
| 11278 |
/* */ |
| 11279 |
|
| 11280 |
function initRender (vm) { |
| 11281 |
vm._vnode = null; // the root of the child tree |
| 11282 |
vm._staticTrees = null; // v-once cached trees |
| 11283 |
var options = vm.$options; |
| 11284 |
var parentVnode = vm.$vnode = options._parentVnode; // the placeholder node in parent tree |
| 11285 |
var renderContext = parentVnode && parentVnode.context; |
| 11286 |
vm.$slots = resolveSlots(options._renderChildren, renderContext); |
| 11287 |
vm.$scopedSlots = emptyObject; |
| 11288 |
// bind the createElement fn to this instance |
| 11289 |
// so that we get proper render context inside it. |
| 11290 |
// args order: tag, data, children, normalizationType, alwaysNormalize |
| 11291 |
// internal version is used by render functions compiled from templates |
| 11292 |
vm._c = function (a, b, c, d) { return createElement(vm, a, b, c, d, false); }; |
| 11293 |
// normalization is always applied for the public version, used in |
| 11294 |
// user-written render functions. |
| 11295 |
vm.$createElement = function (a, b, c, d) { return createElement(vm, a, b, c, d, true); }; |
| 11296 |
|
| 11297 |
// $attrs & $listeners are exposed for easier HOC creation. |
| 11298 |
// they need to be reactive so that HOCs using them are always updated |
| 11299 |
var parentData = parentVnode && parentVnode.data; |
| 11300 |
|
| 11301 |
/* istanbul ignore else */ |
| 11302 |
if (true) { |
| 11303 |
defineReactive$$1(vm, '$attrs', parentData && parentData.attrs || emptyObject, function () { |
| 11304 |
!isUpdatingChildComponent && warn("$attrs is readonly.", vm); |
| 11305 |
}, true); |
| 11306 |
defineReactive$$1(vm, '$listeners', options._parentListeners || emptyObject, function () { |
| 11307 |
!isUpdatingChildComponent && warn("$listeners is readonly.", vm); |
| 11308 |
}, true); |
| 11309 |
} else {} |
| 11310 |
} |
| 11311 |
|
| 11312 |
var currentRenderingInstance = null; |
| 11313 |
|
| 11314 |
function renderMixin (Vue) { |
| 11315 |
// install runtime convenience helpers |
| 11316 |
installRenderHelpers(Vue.prototype); |
| 11317 |
|
| 11318 |
Vue.prototype.$nextTick = function (fn) { |
| 11319 |
return nextTick(fn, this) |
| 11320 |
}; |
| 11321 |
|
| 11322 |
Vue.prototype._render = function () { |
| 11323 |
var vm = this; |
| 11324 |
var ref = vm.$options; |
| 11325 |
var render = ref.render; |
| 11326 |
var _parentVnode = ref._parentVnode; |
| 11327 |
|
| 11328 |
if (_parentVnode) { |
| 11329 |
vm.$scopedSlots = normalizeScopedSlots( |
| 11330 |
_parentVnode.data.scopedSlots, |
| 11331 |
vm.$slots, |
| 11332 |
vm.$scopedSlots |
| 11333 |
); |
| 11334 |
} |
| 11335 |
|
| 11336 |
// set parent vnode. this allows render functions to have access |
| 11337 |
// to the data on the placeholder node. |
| 11338 |
vm.$vnode = _parentVnode; |
| 11339 |
// render self |
| 11340 |
var vnode; |
| 11341 |
try { |
| 11342 |
// There's no need to maintain a stack because all render fns are called |
| 11343 |
// separately from one another. Nested component's render fns are called |
| 11344 |
// when parent component is patched. |
| 11345 |
currentRenderingInstance = vm; |
| 11346 |
vnode = render.call(vm._renderProxy, vm.$createElement); |
| 11347 |
} catch (e) { |
| 11348 |
handleError(e, vm, "render"); |
| 11349 |
// return error render result, |
| 11350 |
// or previous vnode to prevent render error causing blank component |
| 11351 |
/* istanbul ignore else */ |
| 11352 |
if ( true && vm.$options.renderError) { |
| 11353 |
try { |
| 11354 |
vnode = vm.$options.renderError.call(vm._renderProxy, vm.$createElement, e); |
| 11355 |
} catch (e) { |
| 11356 |
handleError(e, vm, "renderError"); |
| 11357 |
vnode = vm._vnode; |
| 11358 |
} |
| 11359 |
} else { |
| 11360 |
vnode = vm._vnode; |
| 11361 |
} |
| 11362 |
} finally { |
| 11363 |
currentRenderingInstance = null; |
| 11364 |
} |
| 11365 |
// if the returned array contains only a single node, allow it |
| 11366 |
if (Array.isArray(vnode) && vnode.length === 1) { |
| 11367 |
vnode = vnode[0]; |
| 11368 |
} |
| 11369 |
// return empty vnode in case the render function errored out |
| 11370 |
if (!(vnode instanceof VNode)) { |
| 11371 |
if ( true && Array.isArray(vnode)) { |
| 11372 |
warn( |
| 11373 |
'Multiple root nodes returned from render function. Render function ' + |
| 11374 |
'should return a single root node.', |
| 11375 |
vm |
| 11376 |
); |
| 11377 |
} |
| 11378 |
vnode = createEmptyVNode(); |
| 11379 |
} |
| 11380 |
// set parent |
| 11381 |
vnode.parent = _parentVnode; |
| 11382 |
return vnode |
| 11383 |
}; |
| 11384 |
} |
| 11385 |
|
| 11386 |
/* */ |
| 11387 |
|
| 11388 |
function ensureCtor (comp, base) { |
| 11389 |
if ( |
| 11390 |
comp.__esModule || |
| 11391 |
(hasSymbol && comp[Symbol.toStringTag] === 'Module') |
| 11392 |
) { |
| 11393 |
comp = comp.default; |
| 11394 |
} |
| 11395 |
return isObject(comp) |
| 11396 |
? base.extend(comp) |
| 11397 |
: comp |
| 11398 |
} |
| 11399 |
|
| 11400 |
function createAsyncPlaceholder ( |
| 11401 |
factory, |
| 11402 |
data, |
| 11403 |
context, |
| 11404 |
children, |
| 11405 |
tag |
| 11406 |
) { |
| 11407 |
var node = createEmptyVNode(); |
| 11408 |
node.asyncFactory = factory; |
| 11409 |
node.asyncMeta = { data: data, context: context, children: children, tag: tag }; |
| 11410 |
return node |
| 11411 |
} |
| 11412 |
|
| 11413 |
function resolveAsyncComponent ( |
| 11414 |
factory, |
| 11415 |
baseCtor |
| 11416 |
) { |
| 11417 |
if (isTrue(factory.error) && isDef(factory.errorComp)) { |
| 11418 |
return factory.errorComp |
| 11419 |
} |
| 11420 |
|
| 11421 |
if (isDef(factory.resolved)) { |
| 11422 |
return factory.resolved |
| 11423 |
} |
| 11424 |
|
| 11425 |
var owner = currentRenderingInstance; |
| 11426 |
if (owner && isDef(factory.owners) && factory.owners.indexOf(owner) === -1) { |
| 11427 |
// already pending |
| 11428 |
factory.owners.push(owner); |
| 11429 |
} |
| 11430 |
|
| 11431 |
if (isTrue(factory.loading) && isDef(factory.loadingComp)) { |
| 11432 |
return factory.loadingComp |
| 11433 |
} |
| 11434 |
|
| 11435 |
if (owner && !isDef(factory.owners)) { |
| 11436 |
var owners = factory.owners = [owner]; |
| 11437 |
var sync = true; |
| 11438 |
var timerLoading = null; |
| 11439 |
var timerTimeout = null |
| 11440 |
|
| 11441 |
;(owner).$on('hook:destroyed', function () { return remove(owners, owner); }); |
| 11442 |
|
| 11443 |
var forceRender = function (renderCompleted) { |
| 11444 |
for (var i = 0, l = owners.length; i < l; i++) { |
| 11445 |
(owners[i]).$forceUpdate(); |
| 11446 |
} |
| 11447 |
|
| 11448 |
if (renderCompleted) { |
| 11449 |
owners.length = 0; |
| 11450 |
if (timerLoading !== null) { |
| 11451 |
clearTimeout(timerLoading); |
| 11452 |
timerLoading = null; |
| 11453 |
} |
| 11454 |
if (timerTimeout !== null) { |
| 11455 |
clearTimeout(timerTimeout); |
| 11456 |
timerTimeout = null; |
| 11457 |
} |
| 11458 |
} |
| 11459 |
}; |
| 11460 |
|
| 11461 |
var resolve = once(function (res) { |
| 11462 |
// cache resolved |
| 11463 |
factory.resolved = ensureCtor(res, baseCtor); |
| 11464 |
// invoke callbacks only if this is not a synchronous resolve |
| 11465 |
// (async resolves are shimmed as synchronous during SSR) |
| 11466 |
if (!sync) { |
| 11467 |
forceRender(true); |
| 11468 |
} else { |
| 11469 |
owners.length = 0; |
| 11470 |
} |
| 11471 |
}); |
| 11472 |
|
| 11473 |
var reject = once(function (reason) { |
| 11474 |
true && warn( |
| 11475 |
"Failed to resolve async component: " + (String(factory)) + |
| 11476 |
(reason ? ("\nReason: " + reason) : '') |
| 11477 |
); |
| 11478 |
if (isDef(factory.errorComp)) { |
| 11479 |
factory.error = true; |
| 11480 |
forceRender(true); |
| 11481 |
} |
| 11482 |
}); |
| 11483 |
|
| 11484 |
var res = factory(resolve, reject); |
| 11485 |
|
| 11486 |
if (isObject(res)) { |
| 11487 |
if (isPromise(res)) { |
| 11488 |
// () => Promise |
| 11489 |
if (isUndef(factory.resolved)) { |
| 11490 |
res.then(resolve, reject); |
| 11491 |
} |
| 11492 |
} else if (isPromise(res.component)) { |
| 11493 |
res.component.then(resolve, reject); |
| 11494 |
|
| 11495 |
if (isDef(res.error)) { |
| 11496 |
factory.errorComp = ensureCtor(res.error, baseCtor); |
| 11497 |
} |
| 11498 |
|
| 11499 |
if (isDef(res.loading)) { |
| 11500 |
factory.loadingComp = ensureCtor(res.loading, baseCtor); |
| 11501 |
if (res.delay === 0) { |
| 11502 |
factory.loading = true; |
| 11503 |
} else { |
| 11504 |
timerLoading = setTimeout(function () { |
| 11505 |
timerLoading = null; |
| 11506 |
if (isUndef(factory.resolved) && isUndef(factory.error)) { |
| 11507 |
factory.loading = true; |
| 11508 |
forceRender(false); |
| 11509 |
} |
| 11510 |
}, res.delay || 200); |
| 11511 |
} |
| 11512 |
} |
| 11513 |
|
| 11514 |
if (isDef(res.timeout)) { |
| 11515 |
timerTimeout = setTimeout(function () { |
| 11516 |
timerTimeout = null; |
| 11517 |
if (isUndef(factory.resolved)) { |
| 11518 |
reject( |
| 11519 |
true |
| 11520 |
? ("timeout (" + (res.timeout) + "ms)") |
| 11521 |
: 0 |
| 11522 |
); |
| 11523 |
} |
| 11524 |
}, res.timeout); |
| 11525 |
} |
| 11526 |
} |
| 11527 |
} |
| 11528 |
|
| 11529 |
sync = false; |
| 11530 |
// return in case resolved synchronously |
| 11531 |
return factory.loading |
| 11532 |
? factory.loadingComp |
| 11533 |
: factory.resolved |
| 11534 |
} |
| 11535 |
} |
| 11536 |
|
| 11537 |
/* */ |
| 11538 |
|
| 11539 |
function getFirstComponentChild (children) { |
| 11540 |
if (Array.isArray(children)) { |
| 11541 |
for (var i = 0; i < children.length; i++) { |
| 11542 |
var c = children[i]; |
| 11543 |
if (isDef(c) && (isDef(c.componentOptions) || isAsyncPlaceholder(c))) { |
| 11544 |
return c |
| 11545 |
} |
| 11546 |
} |
| 11547 |
} |
| 11548 |
} |
| 11549 |
|
| 11550 |
/* */ |
| 11551 |
|
| 11552 |
/* */ |
| 11553 |
|
| 11554 |
function initEvents (vm) { |
| 11555 |
vm._events = Object.create(null); |
| 11556 |
vm._hasHookEvent = false; |
| 11557 |
// init parent attached events |
| 11558 |
var listeners = vm.$options._parentListeners; |
| 11559 |
if (listeners) { |
| 11560 |
updateComponentListeners(vm, listeners); |
| 11561 |
} |
| 11562 |
} |
| 11563 |
|
| 11564 |
var target; |
| 11565 |
|
| 11566 |
function add (event, fn) { |
| 11567 |
target.$on(event, fn); |
| 11568 |
} |
| 11569 |
|
| 11570 |
function remove$1 (event, fn) { |
| 11571 |
target.$off(event, fn); |
| 11572 |
} |
| 11573 |
|
| 11574 |
function createOnceHandler (event, fn) { |
| 11575 |
var _target = target; |
| 11576 |
return function onceHandler () { |
| 11577 |
var res = fn.apply(null, arguments); |
| 11578 |
if (res !== null) { |
| 11579 |
_target.$off(event, onceHandler); |
| 11580 |
} |
| 11581 |
} |
| 11582 |
} |
| 11583 |
|
| 11584 |
function updateComponentListeners ( |
| 11585 |
vm, |
| 11586 |
listeners, |
| 11587 |
oldListeners |
| 11588 |
) { |
| 11589 |
target = vm; |
| 11590 |
updateListeners(listeners, oldListeners || {}, add, remove$1, createOnceHandler, vm); |
| 11591 |
target = undefined; |
| 11592 |
} |
| 11593 |
|
| 11594 |
function eventsMixin (Vue) { |
| 11595 |
var hookRE = /^hook:/; |
| 11596 |
Vue.prototype.$on = function (event, fn) { |
| 11597 |
var vm = this; |
| 11598 |
if (Array.isArray(event)) { |
| 11599 |
for (var i = 0, l = event.length; i < l; i++) { |
| 11600 |
vm.$on(event[i], fn); |
| 11601 |
} |
| 11602 |
} else { |
| 11603 |
(vm._events[event] || (vm._events[event] = [])).push(fn); |
| 11604 |
// optimize hook:event cost by using a boolean flag marked at registration |
| 11605 |
// instead of a hash lookup |
| 11606 |
if (hookRE.test(event)) { |
| 11607 |
vm._hasHookEvent = true; |
| 11608 |
} |
| 11609 |
} |
| 11610 |
return vm |
| 11611 |
}; |
| 11612 |
|
| 11613 |
Vue.prototype.$once = function (event, fn) { |
| 11614 |
var vm = this; |
| 11615 |
function on () { |
| 11616 |
vm.$off(event, on); |
| 11617 |
fn.apply(vm, arguments); |
| 11618 |
} |
| 11619 |
on.fn = fn; |
| 11620 |
vm.$on(event, on); |
| 11621 |
return vm |
| 11622 |
}; |
| 11623 |
|
| 11624 |
Vue.prototype.$off = function (event, fn) { |
| 11625 |
var vm = this; |
| 11626 |
// all |
| 11627 |
if (!arguments.length) { |
| 11628 |
vm._events = Object.create(null); |
| 11629 |
return vm |
| 11630 |
} |
| 11631 |
// array of events |
| 11632 |
if (Array.isArray(event)) { |
| 11633 |
for (var i$1 = 0, l = event.length; i$1 < l; i$1++) { |
| 11634 |
vm.$off(event[i$1], fn); |
| 11635 |
} |
| 11636 |
return vm |
| 11637 |
} |
| 11638 |
// specific event |
| 11639 |
var cbs = vm._events[event]; |
| 11640 |
if (!cbs) { |
| 11641 |
return vm |
| 11642 |
} |
| 11643 |
if (!fn) { |
| 11644 |
vm._events[event] = null; |
| 11645 |
return vm |
| 11646 |
} |
| 11647 |
// specific handler |
| 11648 |
var cb; |
| 11649 |
var i = cbs.length; |
| 11650 |
while (i--) { |
| 11651 |
cb = cbs[i]; |
| 11652 |
if (cb === fn || cb.fn === fn) { |
| 11653 |
cbs.splice(i, 1); |
| 11654 |
break |
| 11655 |
} |
| 11656 |
} |
| 11657 |
return vm |
| 11658 |
}; |
| 11659 |
|
| 11660 |
Vue.prototype.$emit = function (event) { |
| 11661 |
var vm = this; |
| 11662 |
if (true) { |
| 11663 |
var lowerCaseEvent = event.toLowerCase(); |
| 11664 |
if (lowerCaseEvent !== event && vm._events[lowerCaseEvent]) { |
| 11665 |
tip( |
| 11666 |
"Event \"" + lowerCaseEvent + "\" is emitted in component " + |
| 11667 |
(formatComponentName(vm)) + " but the handler is registered for \"" + event + "\". " + |
| 11668 |
"Note that HTML attributes are case-insensitive and you cannot use " + |
| 11669 |
"v-on to listen to camelCase events when using in-DOM templates. " + |
| 11670 |
"You should probably use \"" + (hyphenate(event)) + "\" instead of \"" + event + "\"." |
| 11671 |
); |
| 11672 |
} |
| 11673 |
} |
| 11674 |
var cbs = vm._events[event]; |
| 11675 |
if (cbs) { |
| 11676 |
cbs = cbs.length > 1 ? toArray(cbs) : cbs; |
| 11677 |
var args = toArray(arguments, 1); |
| 11678 |
var info = "event handler for \"" + event + "\""; |
| 11679 |
for (var i = 0, l = cbs.length; i < l; i++) { |
| 11680 |
invokeWithErrorHandling(cbs[i], vm, args, vm, info); |
| 11681 |
} |
| 11682 |
} |
| 11683 |
return vm |
| 11684 |
}; |
| 11685 |
} |
| 11686 |
|
| 11687 |
/* */ |
| 11688 |
|
| 11689 |
var activeInstance = null; |
| 11690 |
var isUpdatingChildComponent = false; |
| 11691 |
|
| 11692 |
function setActiveInstance(vm) { |
| 11693 |
var prevActiveInstance = activeInstance; |
| 11694 |
activeInstance = vm; |
| 11695 |
return function () { |
| 11696 |
activeInstance = prevActiveInstance; |
| 11697 |
} |
| 11698 |
} |
| 11699 |
|
| 11700 |
function initLifecycle (vm) { |
| 11701 |
var options = vm.$options; |
| 11702 |
|
| 11703 |
// locate first non-abstract parent |
| 11704 |
var parent = options.parent; |
| 11705 |
if (parent && !options.abstract) { |
| 11706 |
while (parent.$options.abstract && parent.$parent) { |
| 11707 |
parent = parent.$parent; |
| 11708 |
} |
| 11709 |
parent.$children.push(vm); |
| 11710 |
} |
| 11711 |
|
| 11712 |
vm.$parent = parent; |
| 11713 |
vm.$root = parent ? parent.$root : vm; |
| 11714 |
|
| 11715 |
vm.$children = []; |
| 11716 |
vm.$refs = {}; |
| 11717 |
|
| 11718 |
vm._watcher = null; |
| 11719 |
vm._inactive = null; |
| 11720 |
vm._directInactive = false; |
| 11721 |
vm._isMounted = false; |
| 11722 |
vm._isDestroyed = false; |
| 11723 |
vm._isBeingDestroyed = false; |
| 11724 |
} |
| 11725 |
|
| 11726 |
function lifecycleMixin (Vue) { |
| 11727 |
Vue.prototype._update = function (vnode, hydrating) { |
| 11728 |
var vm = this; |
| 11729 |
var prevEl = vm.$el; |
| 11730 |
var prevVnode = vm._vnode; |
| 11731 |
var restoreActiveInstance = setActiveInstance(vm); |
| 11732 |
vm._vnode = vnode; |
| 11733 |
// Vue.prototype.__patch__ is injected in entry points |
| 11734 |
// based on the rendering backend used. |
| 11735 |
if (!prevVnode) { |
| 11736 |
// initial render |
| 11737 |
vm.$el = vm.__patch__(vm.$el, vnode, hydrating, false /* removeOnly */); |
| 11738 |
} else { |
| 11739 |
// updates |
| 11740 |
vm.$el = vm.__patch__(prevVnode, vnode); |
| 11741 |
} |
| 11742 |
restoreActiveInstance(); |
| 11743 |
// update __vue__ reference |
| 11744 |
if (prevEl) { |
| 11745 |
prevEl.__vue__ = null; |
| 11746 |
} |
| 11747 |
if (vm.$el) { |
| 11748 |
vm.$el.__vue__ = vm; |
| 11749 |
} |
| 11750 |
// if parent is an HOC, update its $el as well |
| 11751 |
if (vm.$vnode && vm.$parent && vm.$vnode === vm.$parent._vnode) { |
| 11752 |
vm.$parent.$el = vm.$el; |
| 11753 |
} |
| 11754 |
// updated hook is called by the scheduler to ensure that children are |
| 11755 |
// updated in a parent's updated hook. |
| 11756 |
}; |
| 11757 |
|
| 11758 |
Vue.prototype.$forceUpdate = function () { |
| 11759 |
var vm = this; |
| 11760 |
if (vm._watcher) { |
| 11761 |
vm._watcher.update(); |
| 11762 |
} |
| 11763 |
}; |
| 11764 |
|
| 11765 |
Vue.prototype.$destroy = function () { |
| 11766 |
var vm = this; |
| 11767 |
if (vm._isBeingDestroyed) { |
| 11768 |
return |
| 11769 |
} |
| 11770 |
callHook(vm, 'beforeDestroy'); |
| 11771 |
vm._isBeingDestroyed = true; |
| 11772 |
// remove self from parent |
| 11773 |
var parent = vm.$parent; |
| 11774 |
if (parent && !parent._isBeingDestroyed && !vm.$options.abstract) { |
| 11775 |
remove(parent.$children, vm); |
| 11776 |
} |
| 11777 |
// teardown watchers |
| 11778 |
if (vm._watcher) { |
| 11779 |
vm._watcher.teardown(); |
| 11780 |
} |
| 11781 |
var i = vm._watchers.length; |
| 11782 |
while (i--) { |
| 11783 |
vm._watchers[i].teardown(); |
| 11784 |
} |
| 11785 |
// remove reference from data ob |
| 11786 |
// frozen object may not have observer. |
| 11787 |
if (vm._data.__ob__) { |
| 11788 |
vm._data.__ob__.vmCount--; |
| 11789 |
} |
| 11790 |
// call the last hook... |
| 11791 |
vm._isDestroyed = true; |
| 11792 |
// invoke destroy hooks on current rendered tree |
| 11793 |
vm.__patch__(vm._vnode, null); |
| 11794 |
// fire destroyed hook |
| 11795 |
callHook(vm, 'destroyed'); |
| 11796 |
// turn off all instance listeners. |
| 11797 |
vm.$off(); |
| 11798 |
// remove __vue__ reference |
| 11799 |
if (vm.$el) { |
| 11800 |
vm.$el.__vue__ = null; |
| 11801 |
} |
| 11802 |
// release circular reference (#6759) |
| 11803 |
if (vm.$vnode) { |
| 11804 |
vm.$vnode.parent = null; |
| 11805 |
} |
| 11806 |
}; |
| 11807 |
} |
| 11808 |
|
| 11809 |
function mountComponent ( |
| 11810 |
vm, |
| 11811 |
el, |
| 11812 |
hydrating |
| 11813 |
) { |
| 11814 |
vm.$el = el; |
| 11815 |
if (!vm.$options.render) { |
| 11816 |
vm.$options.render = createEmptyVNode; |
| 11817 |
if (true) { |
| 11818 |
/* istanbul ignore if */ |
| 11819 |
if ((vm.$options.template && vm.$options.template.charAt(0) !== '#') || |
| 11820 |
vm.$options.el || el) { |
| 11821 |
warn( |
| 11822 |
'You are using the runtime-only build of Vue where the template ' + |
| 11823 |
'compiler is not available. Either pre-compile the templates into ' + |
| 11824 |
'render functions, or use the compiler-included build.', |
| 11825 |
vm |
| 11826 |
); |
| 11827 |
} else { |
| 11828 |
warn( |
| 11829 |
'Failed to mount component: template or render function not defined.', |
| 11830 |
vm |
| 11831 |
); |
| 11832 |
} |
| 11833 |
} |
| 11834 |
} |
| 11835 |
callHook(vm, 'beforeMount'); |
| 11836 |
|
| 11837 |
var updateComponent; |
| 11838 |
/* istanbul ignore if */ |
| 11839 |
if ( true && config.performance && mark) { |
| 11840 |
updateComponent = function () { |
| 11841 |
var name = vm._name; |
| 11842 |
var id = vm._uid; |
| 11843 |
var startTag = "vue-perf-start:" + id; |
| 11844 |
var endTag = "vue-perf-end:" + id; |
| 11845 |
|
| 11846 |
mark(startTag); |
| 11847 |
var vnode = vm._render(); |
| 11848 |
mark(endTag); |
| 11849 |
measure(("vue " + name + " render"), startTag, endTag); |
| 11850 |
|
| 11851 |
mark(startTag); |
| 11852 |
vm._update(vnode, hydrating); |
| 11853 |
mark(endTag); |
| 11854 |
measure(("vue " + name + " patch"), startTag, endTag); |
| 11855 |
}; |
| 11856 |
} else { |
| 11857 |
updateComponent = function () { |
| 11858 |
vm._update(vm._render(), hydrating); |
| 11859 |
}; |
| 11860 |
} |
| 11861 |
|
| 11862 |
// we set this to vm._watcher inside the watcher's constructor |
| 11863 |
// since the watcher's initial patch may call $forceUpdate (e.g. inside child |
| 11864 |
// component's mounted hook), which relies on vm._watcher being already defined |
| 11865 |
new Watcher(vm, updateComponent, noop, { |
| 11866 |
before: function before () { |
| 11867 |
if (vm._isMounted && !vm._isDestroyed) { |
| 11868 |
callHook(vm, 'beforeUpdate'); |
| 11869 |
} |
| 11870 |
} |
| 11871 |
}, true /* isRenderWatcher */); |
| 11872 |
hydrating = false; |
| 11873 |
|
| 11874 |
// manually mounted instance, call mounted on self |
| 11875 |
// mounted is called for render-created child components in its inserted hook |
| 11876 |
if (vm.$vnode == null) { |
| 11877 |
vm._isMounted = true; |
| 11878 |
callHook(vm, 'mounted'); |
| 11879 |
} |
| 11880 |
return vm |
| 11881 |
} |
| 11882 |
|
| 11883 |
function updateChildComponent ( |
| 11884 |
vm, |
| 11885 |
propsData, |
| 11886 |
listeners, |
| 11887 |
parentVnode, |
| 11888 |
renderChildren |
| 11889 |
) { |
| 11890 |
if (true) { |
| 11891 |
isUpdatingChildComponent = true; |
| 11892 |
} |
| 11893 |
|
| 11894 |
// determine whether component has slot children |
| 11895 |
// we need to do this before overwriting $options._renderChildren. |
| 11896 |
|
| 11897 |
// check if there are dynamic scopedSlots (hand-written or compiled but with |
| 11898 |
// dynamic slot names). Static scoped slots compiled from template has the |
| 11899 |
// "$stable" marker. |
| 11900 |
var newScopedSlots = parentVnode.data.scopedSlots; |
| 11901 |
var oldScopedSlots = vm.$scopedSlots; |
| 11902 |
var hasDynamicScopedSlot = !!( |
| 11903 |
(newScopedSlots && !newScopedSlots.$stable) || |
| 11904 |
(oldScopedSlots !== emptyObject && !oldScopedSlots.$stable) || |
| 11905 |
(newScopedSlots && vm.$scopedSlots.$key !== newScopedSlots.$key) || |
| 11906 |
(!newScopedSlots && vm.$scopedSlots.$key) |
| 11907 |
); |
| 11908 |
|
| 11909 |
// Any static slot children from the parent may have changed during parent's |
| 11910 |
// update. Dynamic scoped slots may also have changed. In such cases, a forced |
| 11911 |
// update is necessary to ensure correctness. |
| 11912 |
var needsForceUpdate = !!( |
| 11913 |
renderChildren || // has new static slots |
| 11914 |
vm.$options._renderChildren || // has old static slots |
| 11915 |
hasDynamicScopedSlot |
| 11916 |
); |
| 11917 |
|
| 11918 |
vm.$options._parentVnode = parentVnode; |
| 11919 |
vm.$vnode = parentVnode; // update vm's placeholder node without re-render |
| 11920 |
|
| 11921 |
if (vm._vnode) { // update child tree's parent |
| 11922 |
vm._vnode.parent = parentVnode; |
| 11923 |
} |
| 11924 |
vm.$options._renderChildren = renderChildren; |
| 11925 |
|
| 11926 |
// update $attrs and $listeners hash |
| 11927 |
// these are also reactive so they may trigger child update if the child |
| 11928 |
// used them during render |
| 11929 |
vm.$attrs = parentVnode.data.attrs || emptyObject; |
| 11930 |
vm.$listeners = listeners || emptyObject; |
| 11931 |
|
| 11932 |
// update props |
| 11933 |
if (propsData && vm.$options.props) { |
| 11934 |
toggleObserving(false); |
| 11935 |
var props = vm._props; |
| 11936 |
var propKeys = vm.$options._propKeys || []; |
| 11937 |
for (var i = 0; i < propKeys.length; i++) { |
| 11938 |
var key = propKeys[i]; |
| 11939 |
var propOptions = vm.$options.props; // wtf flow? |
| 11940 |
props[key] = validateProp(key, propOptions, propsData, vm); |
| 11941 |
} |
| 11942 |
toggleObserving(true); |
| 11943 |
// keep a copy of raw propsData |
| 11944 |
vm.$options.propsData = propsData; |
| 11945 |
} |
| 11946 |
|
| 11947 |
// update listeners |
| 11948 |
listeners = listeners || emptyObject; |
| 11949 |
var oldListeners = vm.$options._parentListeners; |
| 11950 |
vm.$options._parentListeners = listeners; |
| 11951 |
updateComponentListeners(vm, listeners, oldListeners); |
| 11952 |
|
| 11953 |
// resolve slots + force update if has children |
| 11954 |
if (needsForceUpdate) { |
| 11955 |
vm.$slots = resolveSlots(renderChildren, parentVnode.context); |
| 11956 |
vm.$forceUpdate(); |
| 11957 |
} |
| 11958 |
|
| 11959 |
if (true) { |
| 11960 |
isUpdatingChildComponent = false; |
| 11961 |
} |
| 11962 |
} |
| 11963 |
|
| 11964 |
function isInInactiveTree (vm) { |
| 11965 |
while (vm && (vm = vm.$parent)) { |
| 11966 |
if (vm._inactive) { return true } |
| 11967 |
} |
| 11968 |
return false |
| 11969 |
} |
| 11970 |
|
| 11971 |
function activateChildComponent (vm, direct) { |
| 11972 |
if (direct) { |
| 11973 |
vm._directInactive = false; |
| 11974 |
if (isInInactiveTree(vm)) { |
| 11975 |
return |
| 11976 |
} |
| 11977 |
} else if (vm._directInactive) { |
| 11978 |
return |
| 11979 |
} |
| 11980 |
if (vm._inactive || vm._inactive === null) { |
| 11981 |
vm._inactive = false; |
| 11982 |
for (var i = 0; i < vm.$children.length; i++) { |
| 11983 |
activateChildComponent(vm.$children[i]); |
| 11984 |
} |
| 11985 |
callHook(vm, 'activated'); |
| 11986 |
} |
| 11987 |
} |
| 11988 |
|
| 11989 |
function deactivateChildComponent (vm, direct) { |
| 11990 |
if (direct) { |
| 11991 |
vm._directInactive = true; |
| 11992 |
if (isInInactiveTree(vm)) { |
| 11993 |
return |
| 11994 |
} |
| 11995 |
} |
| 11996 |
if (!vm._inactive) { |
| 11997 |
vm._inactive = true; |
| 11998 |
for (var i = 0; i < vm.$children.length; i++) { |
| 11999 |
deactivateChildComponent(vm.$children[i]); |
| 12000 |
} |
| 12001 |
callHook(vm, 'deactivated'); |
| 12002 |
} |
| 12003 |
} |
| 12004 |
|
| 12005 |
function callHook (vm, hook) { |
| 12006 |
// #7573 disable dep collection when invoking lifecycle hooks |
| 12007 |
pushTarget(); |
| 12008 |
var handlers = vm.$options[hook]; |
| 12009 |
var info = hook + " hook"; |
| 12010 |
if (handlers) { |
| 12011 |
for (var i = 0, j = handlers.length; i < j; i++) { |
| 12012 |
invokeWithErrorHandling(handlers[i], vm, null, vm, info); |
| 12013 |
} |
| 12014 |
} |
| 12015 |
if (vm._hasHookEvent) { |
| 12016 |
vm.$emit('hook:' + hook); |
| 12017 |
} |
| 12018 |
popTarget(); |
| 12019 |
} |
| 12020 |
|
| 12021 |
/* */ |
| 12022 |
|
| 12023 |
var MAX_UPDATE_COUNT = 100; |
| 12024 |
|
| 12025 |
var queue = []; |
| 12026 |
var activatedChildren = []; |
| 12027 |
var has = {}; |
| 12028 |
var circular = {}; |
| 12029 |
var waiting = false; |
| 12030 |
var flushing = false; |
| 12031 |
var index = 0; |
| 12032 |
|
| 12033 |
/** |
| 12034 |
* Reset the scheduler's state. |
| 12035 |
*/ |
| 12036 |
function resetSchedulerState () { |
| 12037 |
index = queue.length = activatedChildren.length = 0; |
| 12038 |
has = {}; |
| 12039 |
if (true) { |
| 12040 |
circular = {}; |
| 12041 |
} |
| 12042 |
waiting = flushing = false; |
| 12043 |
} |
| 12044 |
|
| 12045 |
// Async edge case #6566 requires saving the timestamp when event listeners are |
| 12046 |
// attached. However, calling performance.now() has a perf overhead especially |
| 12047 |
// if the page has thousands of event listeners. Instead, we take a timestamp |
| 12048 |
// every time the scheduler flushes and use that for all event listeners |
| 12049 |
// attached during that flush. |
| 12050 |
var currentFlushTimestamp = 0; |
| 12051 |
|
| 12052 |
// Async edge case fix requires storing an event listener's attach timestamp. |
| 12053 |
var getNow = Date.now; |
| 12054 |
|
| 12055 |
// Determine what event timestamp the browser is using. Annoyingly, the |
| 12056 |
// timestamp can either be hi-res (relative to page load) or low-res |
| 12057 |
// (relative to UNIX epoch), so in order to compare time we have to use the |
| 12058 |
// same timestamp type when saving the flush timestamp. |
| 12059 |
// All IE versions use low-res event timestamps, and have problematic clock |
| 12060 |
// implementations (#9632) |
| 12061 |
if (inBrowser && !isIE) { |
| 12062 |
var performance = window.performance; |
| 12063 |
if ( |
| 12064 |
performance && |
| 12065 |
typeof performance.now === 'function' && |
| 12066 |
getNow() > document.createEvent('Event').timeStamp |
| 12067 |
) { |
| 12068 |
// if the event timestamp, although evaluated AFTER the Date.now(), is |
| 12069 |
// smaller than it, it means the event is using a hi-res timestamp, |
| 12070 |
// and we need to use the hi-res version for event listener timestamps as |
| 12071 |
// well. |
| 12072 |
getNow = function () { return performance.now(); }; |
| 12073 |
} |
| 12074 |
} |
| 12075 |
|
| 12076 |
/** |
| 12077 |
* Flush both queues and run the watchers. |
| 12078 |
*/ |
| 12079 |
function flushSchedulerQueue () { |
| 12080 |
currentFlushTimestamp = getNow(); |
| 12081 |
flushing = true; |
| 12082 |
var watcher, id; |
| 12083 |
|
| 12084 |
// Sort queue before flush. |
| 12085 |
// This ensures that: |
| 12086 |
// 1. Components are updated from parent to child. (because parent is always |
| 12087 |
// created before the child) |
| 12088 |
// 2. A component's user watchers are run before its render watcher (because |
| 12089 |
// user watchers are created before the render watcher) |
| 12090 |
// 3. If a component is destroyed during a parent component's watcher run, |
| 12091 |
// its watchers can be skipped. |
| 12092 |
queue.sort(function (a, b) { return a.id - b.id; }); |
| 12093 |
|
| 12094 |
// do not cache length because more watchers might be pushed |
| 12095 |
// as we run existing watchers |
| 12096 |
for (index = 0; index < queue.length; index++) { |
| 12097 |
watcher = queue[index]; |
| 12098 |
if (watcher.before) { |
| 12099 |
watcher.before(); |
| 12100 |
} |
| 12101 |
id = watcher.id; |
| 12102 |
has[id] = null; |
| 12103 |
watcher.run(); |
| 12104 |
// in dev build, check and stop circular updates. |
| 12105 |
if ( true && has[id] != null) { |
| 12106 |
circular[id] = (circular[id] || 0) + 1; |
| 12107 |
if (circular[id] > MAX_UPDATE_COUNT) { |
| 12108 |
warn( |
| 12109 |
'You may have an infinite update loop ' + ( |
| 12110 |
watcher.user |
| 12111 |
? ("in watcher with expression \"" + (watcher.expression) + "\"") |
| 12112 |
: "in a component render function." |
| 12113 |
), |
| 12114 |
watcher.vm |
| 12115 |
); |
| 12116 |
break |
| 12117 |
} |
| 12118 |
} |
| 12119 |
} |
| 12120 |
|
| 12121 |
// keep copies of post queues before resetting state |
| 12122 |
var activatedQueue = activatedChildren.slice(); |
| 12123 |
var updatedQueue = queue.slice(); |
| 12124 |
|
| 12125 |
resetSchedulerState(); |
| 12126 |
|
| 12127 |
// call component updated and activated hooks |
| 12128 |
callActivatedHooks(activatedQueue); |
| 12129 |
callUpdatedHooks(updatedQueue); |
| 12130 |
|
| 12131 |
// devtool hook |
| 12132 |
/* istanbul ignore if */ |
| 12133 |
if (devtools && config.devtools) { |
| 12134 |
devtools.emit('flush'); |
| 12135 |
} |
| 12136 |
} |
| 12137 |
|
| 12138 |
function callUpdatedHooks (queue) { |
| 12139 |
var i = queue.length; |
| 12140 |
while (i--) { |
| 12141 |
var watcher = queue[i]; |
| 12142 |
var vm = watcher.vm; |
| 12143 |
if (vm._watcher === watcher && vm._isMounted && !vm._isDestroyed) { |
| 12144 |
callHook(vm, 'updated'); |
| 12145 |
} |
| 12146 |
} |
| 12147 |
} |
| 12148 |
|
| 12149 |
/** |
| 12150 |
* Queue a kept-alive component that was activated during patch. |
| 12151 |
* The queue will be processed after the entire tree has been patched. |
| 12152 |
*/ |
| 12153 |
function queueActivatedComponent (vm) { |
| 12154 |
// setting _inactive to false here so that a render function can |
| 12155 |
// rely on checking whether it's in an inactive tree (e.g. router-view) |
| 12156 |
vm._inactive = false; |
| 12157 |
activatedChildren.push(vm); |
| 12158 |
} |
| 12159 |
|
| 12160 |
function callActivatedHooks (queue) { |
| 12161 |
for (var i = 0; i < queue.length; i++) { |
| 12162 |
queue[i]._inactive = true; |
| 12163 |
activateChildComponent(queue[i], true /* true */); |
| 12164 |
} |
| 12165 |
} |
| 12166 |
|
| 12167 |
/** |
| 12168 |
* Push a watcher into the watcher queue. |
| 12169 |
* Jobs with duplicate IDs will be skipped unless it's |
| 12170 |
* pushed when the queue is being flushed. |
| 12171 |
*/ |
| 12172 |
function queueWatcher (watcher) { |
| 12173 |
var id = watcher.id; |
| 12174 |
if (has[id] == null) { |
| 12175 |
has[id] = true; |
| 12176 |
if (!flushing) { |
| 12177 |
queue.push(watcher); |
| 12178 |
} else { |
| 12179 |
// if already flushing, splice the watcher based on its id |
| 12180 |
// if already past its id, it will be run next immediately. |
| 12181 |
var i = queue.length - 1; |
| 12182 |
while (i > index && queue[i].id > watcher.id) { |
| 12183 |
i--; |
| 12184 |
} |
| 12185 |
queue.splice(i + 1, 0, watcher); |
| 12186 |
} |
| 12187 |
// queue the flush |
| 12188 |
if (!waiting) { |
| 12189 |
waiting = true; |
| 12190 |
|
| 12191 |
if ( true && !config.async) { |
| 12192 |
flushSchedulerQueue(); |
| 12193 |
return |
| 12194 |
} |
| 12195 |
nextTick(flushSchedulerQueue); |
| 12196 |
} |
| 12197 |
} |
| 12198 |
} |
| 12199 |
|
| 12200 |
/* */ |
| 12201 |
|
| 12202 |
|
| 12203 |
|
| 12204 |
var uid$2 = 0; |
| 12205 |
|
| 12206 |
/** |
| 12207 |
* A watcher parses an expression, collects dependencies, |
| 12208 |
* and fires callback when the expression value changes. |
| 12209 |
* This is used for both the $watch() api and directives. |
| 12210 |
*/ |
| 12211 |
var Watcher = function Watcher ( |
| 12212 |
vm, |
| 12213 |
expOrFn, |
| 12214 |
cb, |
| 12215 |
options, |
| 12216 |
isRenderWatcher |
| 12217 |
) { |
| 12218 |
this.vm = vm; |
| 12219 |
if (isRenderWatcher) { |
| 12220 |
vm._watcher = this; |
| 12221 |
} |
| 12222 |
vm._watchers.push(this); |
| 12223 |
// options |
| 12224 |
if (options) { |
| 12225 |
this.deep = !!options.deep; |
| 12226 |
this.user = !!options.user; |
| 12227 |
this.lazy = !!options.lazy; |
| 12228 |
this.sync = !!options.sync; |
| 12229 |
this.before = options.before; |
| 12230 |
} else { |
| 12231 |
this.deep = this.user = this.lazy = this.sync = false; |
| 12232 |
} |
| 12233 |
this.cb = cb; |
| 12234 |
this.id = ++uid$2; // uid for batching |
| 12235 |
this.active = true; |
| 12236 |
this.dirty = this.lazy; // for lazy watchers |
| 12237 |
this.deps = []; |
| 12238 |
this.newDeps = []; |
| 12239 |
this.depIds = new _Set(); |
| 12240 |
this.newDepIds = new _Set(); |
| 12241 |
this.expression = true |
| 12242 |
? expOrFn.toString() |
| 12243 |
: 0; |
| 12244 |
// parse expression for getter |
| 12245 |
if (typeof expOrFn === 'function') { |
| 12246 |
this.getter = expOrFn; |
| 12247 |
} else { |
| 12248 |
this.getter = parsePath(expOrFn); |
| 12249 |
if (!this.getter) { |
| 12250 |
this.getter = noop; |
| 12251 |
true && warn( |
| 12252 |
"Failed watching path: \"" + expOrFn + "\" " + |
| 12253 |
'Watcher only accepts simple dot-delimited paths. ' + |
| 12254 |
'For full control, use a function instead.', |
| 12255 |
vm |
| 12256 |
); |
| 12257 |
} |
| 12258 |
} |
| 12259 |
this.value = this.lazy |
| 12260 |
? undefined |
| 12261 |
: this.get(); |
| 12262 |
}; |
| 12263 |
|
| 12264 |
/** |
| 12265 |
* Evaluate the getter, and re-collect dependencies. |
| 12266 |
*/ |
| 12267 |
Watcher.prototype.get = function get () { |
| 12268 |
pushTarget(this); |
| 12269 |
var value; |
| 12270 |
var vm = this.vm; |
| 12271 |
try { |
| 12272 |
value = this.getter.call(vm, vm); |
| 12273 |
} catch (e) { |
| 12274 |
if (this.user) { |
| 12275 |
handleError(e, vm, ("getter for watcher \"" + (this.expression) + "\"")); |
| 12276 |
} else { |
| 12277 |
throw e |
| 12278 |
} |
| 12279 |
} finally { |
| 12280 |
// "touch" every property so they are all tracked as |
| 12281 |
// dependencies for deep watching |
| 12282 |
if (this.deep) { |
| 12283 |
traverse(value); |
| 12284 |
} |
| 12285 |
popTarget(); |
| 12286 |
this.cleanupDeps(); |
| 12287 |
} |
| 12288 |
return value |
| 12289 |
}; |
| 12290 |
|
| 12291 |
/** |
| 12292 |
* Add a dependency to this directive. |
| 12293 |
*/ |
| 12294 |
Watcher.prototype.addDep = function addDep (dep) { |
| 12295 |
var id = dep.id; |
| 12296 |
if (!this.newDepIds.has(id)) { |
| 12297 |
this.newDepIds.add(id); |
| 12298 |
this.newDeps.push(dep); |
| 12299 |
if (!this.depIds.has(id)) { |
| 12300 |
dep.addSub(this); |
| 12301 |
} |
| 12302 |
} |
| 12303 |
}; |
| 12304 |
|
| 12305 |
/** |
| 12306 |
* Clean up for dependency collection. |
| 12307 |
*/ |
| 12308 |
Watcher.prototype.cleanupDeps = function cleanupDeps () { |
| 12309 |
var i = this.deps.length; |
| 12310 |
while (i--) { |
| 12311 |
var dep = this.deps[i]; |
| 12312 |
if (!this.newDepIds.has(dep.id)) { |
| 12313 |
dep.removeSub(this); |
| 12314 |
} |
| 12315 |
} |
| 12316 |
var tmp = this.depIds; |
| 12317 |
this.depIds = this.newDepIds; |
| 12318 |
this.newDepIds = tmp; |
| 12319 |
this.newDepIds.clear(); |
| 12320 |
tmp = this.deps; |
| 12321 |
this.deps = this.newDeps; |
| 12322 |
this.newDeps = tmp; |
| 12323 |
this.newDeps.length = 0; |
| 12324 |
}; |
| 12325 |
|
| 12326 |
/** |
| 12327 |
* Subscriber interface. |
| 12328 |
* Will be called when a dependency changes. |
| 12329 |
*/ |
| 12330 |
Watcher.prototype.update = function update () { |
| 12331 |
/* istanbul ignore else */ |
| 12332 |
if (this.lazy) { |
| 12333 |
this.dirty = true; |
| 12334 |
} else if (this.sync) { |
| 12335 |
this.run(); |
| 12336 |
} else { |
| 12337 |
queueWatcher(this); |
| 12338 |
} |
| 12339 |
}; |
| 12340 |
|
| 12341 |
/** |
| 12342 |
* Scheduler job interface. |
| 12343 |
* Will be called by the scheduler. |
| 12344 |
*/ |
| 12345 |
Watcher.prototype.run = function run () { |
| 12346 |
if (this.active) { |
| 12347 |
var value = this.get(); |
| 12348 |
if ( |
| 12349 |
value !== this.value || |
| 12350 |
// Deep watchers and watchers on Object/Arrays should fire even |
| 12351 |
// when the value is the same, because the value may |
| 12352 |
// have mutated. |
| 12353 |
isObject(value) || |
| 12354 |
this.deep |
| 12355 |
) { |
| 12356 |
// set new value |
| 12357 |
var oldValue = this.value; |
| 12358 |
this.value = value; |
| 12359 |
if (this.user) { |
| 12360 |
var info = "callback for watcher \"" + (this.expression) + "\""; |
| 12361 |
invokeWithErrorHandling(this.cb, this.vm, [value, oldValue], this.vm, info); |
| 12362 |
} else { |
| 12363 |
this.cb.call(this.vm, value, oldValue); |
| 12364 |
} |
| 12365 |
} |
| 12366 |
} |
| 12367 |
}; |
| 12368 |
|
| 12369 |
/** |
| 12370 |
* Evaluate the value of the watcher. |
| 12371 |
* This only gets called for lazy watchers. |
| 12372 |
*/ |
| 12373 |
Watcher.prototype.evaluate = function evaluate () { |
| 12374 |
this.value = this.get(); |
| 12375 |
this.dirty = false; |
| 12376 |
}; |
| 12377 |
|
| 12378 |
/** |
| 12379 |
* Depend on all deps collected by this watcher. |
| 12380 |
*/ |
| 12381 |
Watcher.prototype.depend = function depend () { |
| 12382 |
var i = this.deps.length; |
| 12383 |
while (i--) { |
| 12384 |
this.deps[i].depend(); |
| 12385 |
} |
| 12386 |
}; |
| 12387 |
|
| 12388 |
/** |
| 12389 |
* Remove self from all dependencies' subscriber list. |
| 12390 |
*/ |
| 12391 |
Watcher.prototype.teardown = function teardown () { |
| 12392 |
if (this.active) { |
| 12393 |
// remove self from vm's watcher list |
| 12394 |
// this is a somewhat expensive operation so we skip it |
| 12395 |
// if the vm is being destroyed. |
| 12396 |
if (!this.vm._isBeingDestroyed) { |
| 12397 |
remove(this.vm._watchers, this); |
| 12398 |
} |
| 12399 |
var i = this.deps.length; |
| 12400 |
while (i--) { |
| 12401 |
this.deps[i].removeSub(this); |
| 12402 |
} |
| 12403 |
this.active = false; |
| 12404 |
} |
| 12405 |
}; |
| 12406 |
|
| 12407 |
/* */ |
| 12408 |
|
| 12409 |
var sharedPropertyDefinition = { |
| 12410 |
enumerable: true, |
| 12411 |
configurable: true, |
| 12412 |
get: noop, |
| 12413 |
set: noop |
| 12414 |
}; |
| 12415 |
|
| 12416 |
function proxy (target, sourceKey, key) { |
| 12417 |
sharedPropertyDefinition.get = function proxyGetter () { |
| 12418 |
return this[sourceKey][key] |
| 12419 |
}; |
| 12420 |
sharedPropertyDefinition.set = function proxySetter (val) { |
| 12421 |
this[sourceKey][key] = val; |
| 12422 |
}; |
| 12423 |
Object.defineProperty(target, key, sharedPropertyDefinition); |
| 12424 |
} |
| 12425 |
|
| 12426 |
function initState (vm) { |
| 12427 |
vm._watchers = []; |
| 12428 |
var opts = vm.$options; |
| 12429 |
if (opts.props) { initProps(vm, opts.props); } |
| 12430 |
if (opts.methods) { initMethods(vm, opts.methods); } |
| 12431 |
if (opts.data) { |
| 12432 |
initData(vm); |
| 12433 |
} else { |
| 12434 |
observe(vm._data = {}, true /* asRootData */); |
| 12435 |
} |
| 12436 |
if (opts.computed) { initComputed(vm, opts.computed); } |
| 12437 |
if (opts.watch && opts.watch !== nativeWatch) { |
| 12438 |
initWatch(vm, opts.watch); |
| 12439 |
} |
| 12440 |
} |
| 12441 |
|
| 12442 |
function initProps (vm, propsOptions) { |
| 12443 |
var propsData = vm.$options.propsData || {}; |
| 12444 |
var props = vm._props = {}; |
| 12445 |
// cache prop keys so that future props updates can iterate using Array |
| 12446 |
// instead of dynamic object key enumeration. |
| 12447 |
var keys = vm.$options._propKeys = []; |
| 12448 |
var isRoot = !vm.$parent; |
| 12449 |
// root instance props should be converted |
| 12450 |
if (!isRoot) { |
| 12451 |
toggleObserving(false); |
| 12452 |
} |
| 12453 |
var loop = function ( key ) { |
| 12454 |
keys.push(key); |
| 12455 |
var value = validateProp(key, propsOptions, propsData, vm); |
| 12456 |
/* istanbul ignore else */ |
| 12457 |
if (true) { |
| 12458 |
var hyphenatedKey = hyphenate(key); |
| 12459 |
if (isReservedAttribute(hyphenatedKey) || |
| 12460 |
config.isReservedAttr(hyphenatedKey)) { |
| 12461 |
warn( |
| 12462 |
("\"" + hyphenatedKey + "\" is a reserved attribute and cannot be used as component prop."), |
| 12463 |
vm |
| 12464 |
); |
| 12465 |
} |
| 12466 |
defineReactive$$1(props, key, value, function () { |
| 12467 |
if (!isRoot && !isUpdatingChildComponent) { |
| 12468 |
warn( |
| 12469 |
"Avoid mutating a prop directly since the value will be " + |
| 12470 |
"overwritten whenever the parent component re-renders. " + |
| 12471 |
"Instead, use a data or computed property based on the prop's " + |
| 12472 |
"value. Prop being mutated: \"" + key + "\"", |
| 12473 |
vm |
| 12474 |
); |
| 12475 |
} |
| 12476 |
}); |
| 12477 |
} else {} |
| 12478 |
// static props are already proxied on the component's prototype |
| 12479 |
// during Vue.extend(). We only need to proxy props defined at |
| 12480 |
// instantiation here. |
| 12481 |
if (!(key in vm)) { |
| 12482 |
proxy(vm, "_props", key); |
| 12483 |
} |
| 12484 |
}; |
| 12485 |
|
| 12486 |
for (var key in propsOptions) loop( key ); |
| 12487 |
toggleObserving(true); |
| 12488 |
} |
| 12489 |
|
| 12490 |
function initData (vm) { |
| 12491 |
var data = vm.$options.data; |
| 12492 |
data = vm._data = typeof data === 'function' |
| 12493 |
? getData(data, vm) |
| 12494 |
: data || {}; |
| 12495 |
if (!isPlainObject(data)) { |
| 12496 |
data = {}; |
| 12497 |
true && warn( |
| 12498 |
'data functions should return an object:\n' + |
| 12499 |
'https://vuejs.org/v2/guide/components.html#data-Must-Be-a-Function', |
| 12500 |
vm |
| 12501 |
); |
| 12502 |
} |
| 12503 |
// proxy data on instance |
| 12504 |
var keys = Object.keys(data); |
| 12505 |
var props = vm.$options.props; |
| 12506 |
var methods = vm.$options.methods; |
| 12507 |
var i = keys.length; |
| 12508 |
while (i--) { |
| 12509 |
var key = keys[i]; |
| 12510 |
if (true) { |
| 12511 |
if (methods && hasOwn(methods, key)) { |
| 12512 |
warn( |
| 12513 |
("Method \"" + key + "\" has already been defined as a data property."), |
| 12514 |
vm |
| 12515 |
); |
| 12516 |
} |
| 12517 |
} |
| 12518 |
if (props && hasOwn(props, key)) { |
| 12519 |
true && warn( |
| 12520 |
"The data property \"" + key + "\" is already declared as a prop. " + |
| 12521 |
"Use prop default value instead.", |
| 12522 |
vm |
| 12523 |
); |
| 12524 |
} else if (!isReserved(key)) { |
| 12525 |
proxy(vm, "_data", key); |
| 12526 |
} |
| 12527 |
} |
| 12528 |
// observe data |
| 12529 |
observe(data, true /* asRootData */); |
| 12530 |
} |
| 12531 |
|
| 12532 |
function getData (data, vm) { |
| 12533 |
// #7573 disable dep collection when invoking data getters |
| 12534 |
pushTarget(); |
| 12535 |
try { |
| 12536 |
return data.call(vm, vm) |
| 12537 |
} catch (e) { |
| 12538 |
handleError(e, vm, "data()"); |
| 12539 |
return {} |
| 12540 |
} finally { |
| 12541 |
popTarget(); |
| 12542 |
} |
| 12543 |
} |
| 12544 |
|
| 12545 |
var computedWatcherOptions = { lazy: true }; |
| 12546 |
|
| 12547 |
function initComputed (vm, computed) { |
| 12548 |
// $flow-disable-line |
| 12549 |
var watchers = vm._computedWatchers = Object.create(null); |
| 12550 |
// computed properties are just getters during SSR |
| 12551 |
var isSSR = isServerRendering(); |
| 12552 |
|
| 12553 |
for (var key in computed) { |
| 12554 |
var userDef = computed[key]; |
| 12555 |
var getter = typeof userDef === 'function' ? userDef : userDef.get; |
| 12556 |
if ( true && getter == null) { |
| 12557 |
warn( |
| 12558 |
("Getter is missing for computed property \"" + key + "\"."), |
| 12559 |
vm |
| 12560 |
); |
| 12561 |
} |
| 12562 |
|
| 12563 |
if (!isSSR) { |
| 12564 |
// create internal watcher for the computed property. |
| 12565 |
watchers[key] = new Watcher( |
| 12566 |
vm, |
| 12567 |
getter || noop, |
| 12568 |
noop, |
| 12569 |
computedWatcherOptions |
| 12570 |
); |
| 12571 |
} |
| 12572 |
|
| 12573 |
// component-defined computed properties are already defined on the |
| 12574 |
// component prototype. We only need to define computed properties defined |
| 12575 |
// at instantiation here. |
| 12576 |
if (!(key in vm)) { |
| 12577 |
defineComputed(vm, key, userDef); |
| 12578 |
} else if (true) { |
| 12579 |
if (key in vm.$data) { |
| 12580 |
warn(("The computed property \"" + key + "\" is already defined in data."), vm); |
| 12581 |
} else if (vm.$options.props && key in vm.$options.props) { |
| 12582 |
warn(("The computed property \"" + key + "\" is already defined as a prop."), vm); |
| 12583 |
} else if (vm.$options.methods && key in vm.$options.methods) { |
| 12584 |
warn(("The computed property \"" + key + "\" is already defined as a method."), vm); |
| 12585 |
} |
| 12586 |
} |
| 12587 |
} |
| 12588 |
} |
| 12589 |
|
| 12590 |
function defineComputed ( |
| 12591 |
target, |
| 12592 |
key, |
| 12593 |
userDef |
| 12594 |
) { |
| 12595 |
var shouldCache = !isServerRendering(); |
| 12596 |
if (typeof userDef === 'function') { |
| 12597 |
sharedPropertyDefinition.get = shouldCache |
| 12598 |
? createComputedGetter(key) |
| 12599 |
: createGetterInvoker(userDef); |
| 12600 |
sharedPropertyDefinition.set = noop; |
| 12601 |
} else { |
| 12602 |
sharedPropertyDefinition.get = userDef.get |
| 12603 |
? shouldCache && userDef.cache !== false |
| 12604 |
? createComputedGetter(key) |
| 12605 |
: createGetterInvoker(userDef.get) |
| 12606 |
: noop; |
| 12607 |
sharedPropertyDefinition.set = userDef.set || noop; |
| 12608 |
} |
| 12609 |
if ( true && |
| 12610 |
sharedPropertyDefinition.set === noop) { |
| 12611 |
sharedPropertyDefinition.set = function () { |
| 12612 |
warn( |
| 12613 |
("Computed property \"" + key + "\" was assigned to but it has no setter."), |
| 12614 |
this |
| 12615 |
); |
| 12616 |
}; |
| 12617 |
} |
| 12618 |
Object.defineProperty(target, key, sharedPropertyDefinition); |
| 12619 |
} |
| 12620 |
|
| 12621 |
function createComputedGetter (key) { |
| 12622 |
return function computedGetter () { |
| 12623 |
var watcher = this._computedWatchers && this._computedWatchers[key]; |
| 12624 |
if (watcher) { |
| 12625 |
if (watcher.dirty) { |
| 12626 |
watcher.evaluate(); |
| 12627 |
} |
| 12628 |
if (Dep.target) { |
| 12629 |
watcher.depend(); |
| 12630 |
} |
| 12631 |
return watcher.value |
| 12632 |
} |
| 12633 |
} |
| 12634 |
} |
| 12635 |
|
| 12636 |
function createGetterInvoker(fn) { |
| 12637 |
return function computedGetter () { |
| 12638 |
return fn.call(this, this) |
| 12639 |
} |
| 12640 |
} |
| 12641 |
|
| 12642 |
function initMethods (vm, methods) { |
| 12643 |
var props = vm.$options.props; |
| 12644 |
for (var key in methods) { |
| 12645 |
if (true) { |
| 12646 |
if (typeof methods[key] !== 'function') { |
| 12647 |
warn( |
| 12648 |
"Method \"" + key + "\" has type \"" + (typeof methods[key]) + "\" in the component definition. " + |
| 12649 |
"Did you reference the function correctly?", |
| 12650 |
vm |
| 12651 |
); |
| 12652 |
} |
| 12653 |
if (props && hasOwn(props, key)) { |
| 12654 |
warn( |
| 12655 |
("Method \"" + key + "\" has already been defined as a prop."), |
| 12656 |
vm |
| 12657 |
); |
| 12658 |
} |
| 12659 |
if ((key in vm) && isReserved(key)) { |
| 12660 |
warn( |
| 12661 |
"Method \"" + key + "\" conflicts with an existing Vue instance method. " + |
| 12662 |
"Avoid defining component methods that start with _ or $." |
| 12663 |
); |
| 12664 |
} |
| 12665 |
} |
| 12666 |
vm[key] = typeof methods[key] !== 'function' ? noop : bind(methods[key], vm); |
| 12667 |
} |
| 12668 |
} |
| 12669 |
|
| 12670 |
function initWatch (vm, watch) { |
| 12671 |
for (var key in watch) { |
| 12672 |
var handler = watch[key]; |
| 12673 |
if (Array.isArray(handler)) { |
| 12674 |
for (var i = 0; i < handler.length; i++) { |
| 12675 |
createWatcher(vm, key, handler[i]); |
| 12676 |
} |
| 12677 |
} else { |
| 12678 |
createWatcher(vm, key, handler); |
| 12679 |
} |
| 12680 |
} |
| 12681 |
} |
| 12682 |
|
| 12683 |
function createWatcher ( |
| 12684 |
vm, |
| 12685 |
expOrFn, |
| 12686 |
handler, |
| 12687 |
options |
| 12688 |
) { |
| 12689 |
if (isPlainObject(handler)) { |
| 12690 |
options = handler; |
| 12691 |
handler = handler.handler; |
| 12692 |
} |
| 12693 |
if (typeof handler === 'string') { |
| 12694 |
handler = vm[handler]; |
| 12695 |
} |
| 12696 |
return vm.$watch(expOrFn, handler, options) |
| 12697 |
} |
| 12698 |
|
| 12699 |
function stateMixin (Vue) { |
| 12700 |
// flow somehow has problems with directly declared definition object |
| 12701 |
// when using Object.defineProperty, so we have to procedurally build up |
| 12702 |
// the object here. |
| 12703 |
var dataDef = {}; |
| 12704 |
dataDef.get = function () { return this._data }; |
| 12705 |
var propsDef = {}; |
| 12706 |
propsDef.get = function () { return this._props }; |
| 12707 |
if (true) { |
| 12708 |
dataDef.set = function () { |
| 12709 |
warn( |
| 12710 |
'Avoid replacing instance root $data. ' + |
| 12711 |
'Use nested data properties instead.', |
| 12712 |
this |
| 12713 |
); |
| 12714 |
}; |
| 12715 |
propsDef.set = function () { |
| 12716 |
warn("$props is readonly.", this); |
| 12717 |
}; |
| 12718 |
} |
| 12719 |
Object.defineProperty(Vue.prototype, '$data', dataDef); |
| 12720 |
Object.defineProperty(Vue.prototype, '$props', propsDef); |
| 12721 |
|
| 12722 |
Vue.prototype.$set = set; |
| 12723 |
Vue.prototype.$delete = del; |
| 12724 |
|
| 12725 |
Vue.prototype.$watch = function ( |
| 12726 |
expOrFn, |
| 12727 |
cb, |
| 12728 |
options |
| 12729 |
) { |
| 12730 |
var vm = this; |
| 12731 |
if (isPlainObject(cb)) { |
| 12732 |
return createWatcher(vm, expOrFn, cb, options) |
| 12733 |
} |
| 12734 |
options = options || {}; |
| 12735 |
options.user = true; |
| 12736 |
var watcher = new Watcher(vm, expOrFn, cb, options); |
| 12737 |
if (options.immediate) { |
| 12738 |
var info = "callback for immediate watcher \"" + (watcher.expression) + "\""; |
| 12739 |
pushTarget(); |
| 12740 |
invokeWithErrorHandling(cb, vm, [watcher.value], vm, info); |
| 12741 |
popTarget(); |
| 12742 |
} |
| 12743 |
return function unwatchFn () { |
| 12744 |
watcher.teardown(); |
| 12745 |
} |
| 12746 |
}; |
| 12747 |
} |
| 12748 |
|
| 12749 |
/* */ |
| 12750 |
|
| 12751 |
var uid$3 = 0; |
| 12752 |
|
| 12753 |
function initMixin (Vue) { |
| 12754 |
Vue.prototype._init = function (options) { |
| 12755 |
var vm = this; |
| 12756 |
// a uid |
| 12757 |
vm._uid = uid$3++; |
| 12758 |
|
| 12759 |
var startTag, endTag; |
| 12760 |
/* istanbul ignore if */ |
| 12761 |
if ( true && config.performance && mark) { |
| 12762 |
startTag = "vue-perf-start:" + (vm._uid); |
| 12763 |
endTag = "vue-perf-end:" + (vm._uid); |
| 12764 |
mark(startTag); |
| 12765 |
} |
| 12766 |
|
| 12767 |
// a flag to avoid this being observed |
| 12768 |
vm._isVue = true; |
| 12769 |
// merge options |
| 12770 |
if (options && options._isComponent) { |
| 12771 |
// optimize internal component instantiation |
| 12772 |
// since dynamic options merging is pretty slow, and none of the |
| 12773 |
// internal component options needs special treatment. |
| 12774 |
initInternalComponent(vm, options); |
| 12775 |
} else { |
| 12776 |
vm.$options = mergeOptions( |
| 12777 |
resolveConstructorOptions(vm.constructor), |
| 12778 |
options || {}, |
| 12779 |
vm |
| 12780 |
); |
| 12781 |
} |
| 12782 |
/* istanbul ignore else */ |
| 12783 |
if (true) { |
| 12784 |
initProxy(vm); |
| 12785 |
} else {} |
| 12786 |
// expose real self |
| 12787 |
vm._self = vm; |
| 12788 |
initLifecycle(vm); |
| 12789 |
initEvents(vm); |
| 12790 |
initRender(vm); |
| 12791 |
callHook(vm, 'beforeCreate'); |
| 12792 |
initInjections(vm); // resolve injections before data/props |
| 12793 |
initState(vm); |
| 12794 |
initProvide(vm); // resolve provide after data/props |
| 12795 |
callHook(vm, 'created'); |
| 12796 |
|
| 12797 |
/* istanbul ignore if */ |
| 12798 |
if ( true && config.performance && mark) { |
| 12799 |
vm._name = formatComponentName(vm, false); |
| 12800 |
mark(endTag); |
| 12801 |
measure(("vue " + (vm._name) + " init"), startTag, endTag); |
| 12802 |
} |
| 12803 |
|
| 12804 |
if (vm.$options.el) { |
| 12805 |
vm.$mount(vm.$options.el); |
| 12806 |
} |
| 12807 |
}; |
| 12808 |
} |
| 12809 |
|
| 12810 |
function initInternalComponent (vm, options) { |
| 12811 |
var opts = vm.$options = Object.create(vm.constructor.options); |
| 12812 |
// doing this because it's faster than dynamic enumeration. |
| 12813 |
var parentVnode = options._parentVnode; |
| 12814 |
opts.parent = options.parent; |
| 12815 |
opts._parentVnode = parentVnode; |
| 12816 |
|
| 12817 |
var vnodeComponentOptions = parentVnode.componentOptions; |
| 12818 |
opts.propsData = vnodeComponentOptions.propsData; |
| 12819 |
opts._parentListeners = vnodeComponentOptions.listeners; |
| 12820 |
opts._renderChildren = vnodeComponentOptions.children; |
| 12821 |
opts._componentTag = vnodeComponentOptions.tag; |
| 12822 |
|
| 12823 |
if (options.render) { |
| 12824 |
opts.render = options.render; |
| 12825 |
opts.staticRenderFns = options.staticRenderFns; |
| 12826 |
} |
| 12827 |
} |
| 12828 |
|
| 12829 |
function resolveConstructorOptions (Ctor) { |
| 12830 |
var options = Ctor.options; |
| 12831 |
if (Ctor.super) { |
| 12832 |
var superOptions = resolveConstructorOptions(Ctor.super); |
| 12833 |
var cachedSuperOptions = Ctor.superOptions; |
| 12834 |
if (superOptions !== cachedSuperOptions) { |
| 12835 |
// super option changed, |
| 12836 |
// need to resolve new options. |
| 12837 |
Ctor.superOptions = superOptions; |
| 12838 |
// check if there are any late-modified/attached options (#4976) |
| 12839 |
var modifiedOptions = resolveModifiedOptions(Ctor); |
| 12840 |
// update base extend options |
| 12841 |
if (modifiedOptions) { |
| 12842 |
extend(Ctor.extendOptions, modifiedOptions); |
| 12843 |
} |
| 12844 |
options = Ctor.options = mergeOptions(superOptions, Ctor.extendOptions); |
| 12845 |
if (options.name) { |
| 12846 |
options.components[options.name] = Ctor; |
| 12847 |
} |
| 12848 |
} |
| 12849 |
} |
| 12850 |
return options |
| 12851 |
} |
| 12852 |
|
| 12853 |
function resolveModifiedOptions (Ctor) { |
| 12854 |
var modified; |
| 12855 |
var latest = Ctor.options; |
| 12856 |
var sealed = Ctor.sealedOptions; |
| 12857 |
for (var key in latest) { |
| 12858 |
if (latest[key] !== sealed[key]) { |
| 12859 |
if (!modified) { modified = {}; } |
| 12860 |
modified[key] = latest[key]; |
| 12861 |
} |
| 12862 |
} |
| 12863 |
return modified |
| 12864 |
} |
| 12865 |
|
| 12866 |
function Vue (options) { |
| 12867 |
if ( true && |
| 12868 |
!(this instanceof Vue) |
| 12869 |
) { |
| 12870 |
warn('Vue is a constructor and should be called with the `new` keyword'); |
| 12871 |
} |
| 12872 |
this._init(options); |
| 12873 |
} |
| 12874 |
|
| 12875 |
initMixin(Vue); |
| 12876 |
stateMixin(Vue); |
| 12877 |
eventsMixin(Vue); |
| 12878 |
lifecycleMixin(Vue); |
| 12879 |
renderMixin(Vue); |
| 12880 |
|
| 12881 |
/* */ |
| 12882 |
|
| 12883 |
function initUse (Vue) { |
| 12884 |
Vue.use = function (plugin) { |
| 12885 |
var installedPlugins = (this._installedPlugins || (this._installedPlugins = [])); |
| 12886 |
if (installedPlugins.indexOf(plugin) > -1) { |
| 12887 |
return this |
| 12888 |
} |
| 12889 |
|
| 12890 |
// additional parameters |
| 12891 |
var args = toArray(arguments, 1); |
| 12892 |
args.unshift(this); |
| 12893 |
if (typeof plugin.install === 'function') { |
| 12894 |
plugin.install.apply(plugin, args); |
| 12895 |
} else if (typeof plugin === 'function') { |
| 12896 |
plugin.apply(null, args); |
| 12897 |
} |
| 12898 |
installedPlugins.push(plugin); |
| 12899 |
return this |
| 12900 |
}; |
| 12901 |
} |
| 12902 |
|
| 12903 |
/* */ |
| 12904 |
|
| 12905 |
function initMixin$1 (Vue) { |
| 12906 |
Vue.mixin = function (mixin) { |
| 12907 |
this.options = mergeOptions(this.options, mixin); |
| 12908 |
return this |
| 12909 |
}; |
| 12910 |
} |
| 12911 |
|
| 12912 |
/* */ |
| 12913 |
|
| 12914 |
function initExtend (Vue) { |
| 12915 |
/** |
| 12916 |
* Each instance constructor, including Vue, has a unique |
| 12917 |
* cid. This enables us to create wrapped "child |
| 12918 |
* constructors" for prototypal inheritance and cache them. |
| 12919 |
*/ |
| 12920 |
Vue.cid = 0; |
| 12921 |
var cid = 1; |
| 12922 |
|
| 12923 |
/** |
| 12924 |
* Class inheritance |
| 12925 |
*/ |
| 12926 |
Vue.extend = function (extendOptions) { |
| 12927 |
extendOptions = extendOptions || {}; |
| 12928 |
var Super = this; |
| 12929 |
var SuperId = Super.cid; |
| 12930 |
var cachedCtors = extendOptions._Ctor || (extendOptions._Ctor = {}); |
| 12931 |
if (cachedCtors[SuperId]) { |
| 12932 |
return cachedCtors[SuperId] |
| 12933 |
} |
| 12934 |
|
| 12935 |
var name = extendOptions.name || Super.options.name; |
| 12936 |
if ( true && name) { |
| 12937 |
validateComponentName(name); |
| 12938 |
} |
| 12939 |
|
| 12940 |
var Sub = function VueComponent (options) { |
| 12941 |
this._init(options); |
| 12942 |
}; |
| 12943 |
Sub.prototype = Object.create(Super.prototype); |
| 12944 |
Sub.prototype.constructor = Sub; |
| 12945 |
Sub.cid = cid++; |
| 12946 |
Sub.options = mergeOptions( |
| 12947 |
Super.options, |
| 12948 |
extendOptions |
| 12949 |
); |
| 12950 |
Sub['super'] = Super; |
| 12951 |
|
| 12952 |
// For props and computed properties, we define the proxy getters on |
| 12953 |
// the Vue instances at extension time, on the extended prototype. This |
| 12954 |
// avoids Object.defineProperty calls for each instance created. |
| 12955 |
if (Sub.options.props) { |
| 12956 |
initProps$1(Sub); |
| 12957 |
} |
| 12958 |
if (Sub.options.computed) { |
| 12959 |
initComputed$1(Sub); |
| 12960 |
} |
| 12961 |
|
| 12962 |
// allow further extension/mixin/plugin usage |
| 12963 |
Sub.extend = Super.extend; |
| 12964 |
Sub.mixin = Super.mixin; |
| 12965 |
Sub.use = Super.use; |
| 12966 |
|
| 12967 |
// create asset registers, so extended classes |
| 12968 |
// can have their private assets too. |
| 12969 |
ASSET_TYPES.forEach(function (type) { |
| 12970 |
Sub[type] = Super[type]; |
| 12971 |
}); |
| 12972 |
// enable recursive self-lookup |
| 12973 |
if (name) { |
| 12974 |
Sub.options.components[name] = Sub; |
| 12975 |
} |
| 12976 |
|
| 12977 |
// keep a reference to the super options at extension time. |
| 12978 |
// later at instantiation we can check if Super's options have |
| 12979 |
// been updated. |
| 12980 |
Sub.superOptions = Super.options; |
| 12981 |
Sub.extendOptions = extendOptions; |
| 12982 |
Sub.sealedOptions = extend({}, Sub.options); |
| 12983 |
|
| 12984 |
// cache constructor |
| 12985 |
cachedCtors[SuperId] = Sub; |
| 12986 |
return Sub |
| 12987 |
}; |
| 12988 |
} |
| 12989 |
|
| 12990 |
function initProps$1 (Comp) { |
| 12991 |
var props = Comp.options.props; |
| 12992 |
for (var key in props) { |
| 12993 |
proxy(Comp.prototype, "_props", key); |
| 12994 |
} |
| 12995 |
} |
| 12996 |
|
| 12997 |
function initComputed$1 (Comp) { |
| 12998 |
var computed = Comp.options.computed; |
| 12999 |
for (var key in computed) { |
| 13000 |
defineComputed(Comp.prototype, key, computed[key]); |
| 13001 |
} |
| 13002 |
} |
| 13003 |
|
| 13004 |
/* */ |
| 13005 |
|
| 13006 |
function initAssetRegisters (Vue) { |
| 13007 |
/** |
| 13008 |
* Create asset registration methods. |
| 13009 |
*/ |
| 13010 |
ASSET_TYPES.forEach(function (type) { |
| 13011 |
Vue[type] = function ( |
| 13012 |
id, |
| 13013 |
definition |
| 13014 |
) { |
| 13015 |
if (!definition) { |
| 13016 |
return this.options[type + 's'][id] |
| 13017 |
} else { |
| 13018 |
/* istanbul ignore if */ |
| 13019 |
if ( true && type === 'component') { |
| 13020 |
validateComponentName(id); |
| 13021 |
} |
| 13022 |
if (type === 'component' && isPlainObject(definition)) { |
| 13023 |
definition.name = definition.name || id; |
| 13024 |
definition = this.options._base.extend(definition); |
| 13025 |
} |
| 13026 |
if (type === 'directive' && typeof definition === 'function') { |
| 13027 |
definition = { bind: definition, update: definition }; |
| 13028 |
} |
| 13029 |
this.options[type + 's'][id] = definition; |
| 13030 |
return definition |
| 13031 |
} |
| 13032 |
}; |
| 13033 |
}); |
| 13034 |
} |
| 13035 |
|
| 13036 |
/* */ |
| 13037 |
|
| 13038 |
|
| 13039 |
|
| 13040 |
|
| 13041 |
|
| 13042 |
function getComponentName (opts) { |
| 13043 |
return opts && (opts.Ctor.options.name || opts.tag) |
| 13044 |
} |
| 13045 |
|
| 13046 |
function matches (pattern, name) { |
| 13047 |
if (Array.isArray(pattern)) { |
| 13048 |
return pattern.indexOf(name) > -1 |
| 13049 |
} else if (typeof pattern === 'string') { |
| 13050 |
return pattern.split(',').indexOf(name) > -1 |
| 13051 |
} else if (isRegExp(pattern)) { |
| 13052 |
return pattern.test(name) |
| 13053 |
} |
| 13054 |
/* istanbul ignore next */ |
| 13055 |
return false |
| 13056 |
} |
| 13057 |
|
| 13058 |
function pruneCache (keepAliveInstance, filter) { |
| 13059 |
var cache = keepAliveInstance.cache; |
| 13060 |
var keys = keepAliveInstance.keys; |
| 13061 |
var _vnode = keepAliveInstance._vnode; |
| 13062 |
for (var key in cache) { |
| 13063 |
var entry = cache[key]; |
| 13064 |
if (entry) { |
| 13065 |
var name = entry.name; |
| 13066 |
if (name && !filter(name)) { |
| 13067 |
pruneCacheEntry(cache, key, keys, _vnode); |
| 13068 |
} |
| 13069 |
} |
| 13070 |
} |
| 13071 |
} |
| 13072 |
|
| 13073 |
function pruneCacheEntry ( |
| 13074 |
cache, |
| 13075 |
key, |
| 13076 |
keys, |
| 13077 |
current |
| 13078 |
) { |
| 13079 |
var entry = cache[key]; |
| 13080 |
if (entry && (!current || entry.tag !== current.tag)) { |
| 13081 |
entry.componentInstance.$destroy(); |
| 13082 |
} |
| 13083 |
cache[key] = null; |
| 13084 |
remove(keys, key); |
| 13085 |
} |
| 13086 |
|
| 13087 |
var patternTypes = [String, RegExp, Array]; |
| 13088 |
|
| 13089 |
var KeepAlive = { |
| 13090 |
name: 'keep-alive', |
| 13091 |
abstract: true, |
| 13092 |
|
| 13093 |
props: { |
| 13094 |
include: patternTypes, |
| 13095 |
exclude: patternTypes, |
| 13096 |
max: [String, Number] |
| 13097 |
}, |
| 13098 |
|
| 13099 |
methods: { |
| 13100 |
cacheVNode: function cacheVNode() { |
| 13101 |
var ref = this; |
| 13102 |
var cache = ref.cache; |
| 13103 |
var keys = ref.keys; |
| 13104 |
var vnodeToCache = ref.vnodeToCache; |
| 13105 |
var keyToCache = ref.keyToCache; |
| 13106 |
if (vnodeToCache) { |
| 13107 |
var tag = vnodeToCache.tag; |
| 13108 |
var componentInstance = vnodeToCache.componentInstance; |
| 13109 |
var componentOptions = vnodeToCache.componentOptions; |
| 13110 |
cache[keyToCache] = { |
| 13111 |
name: getComponentName(componentOptions), |
| 13112 |
tag: tag, |
| 13113 |
componentInstance: componentInstance, |
| 13114 |
}; |
| 13115 |
keys.push(keyToCache); |
| 13116 |
// prune oldest entry |
| 13117 |
if (this.max && keys.length > parseInt(this.max)) { |
| 13118 |
pruneCacheEntry(cache, keys[0], keys, this._vnode); |
| 13119 |
} |
| 13120 |
this.vnodeToCache = null; |
| 13121 |
} |
| 13122 |
} |
| 13123 |
}, |
| 13124 |
|
| 13125 |
created: function created () { |
| 13126 |
this.cache = Object.create(null); |
| 13127 |
this.keys = []; |
| 13128 |
}, |
| 13129 |
|
| 13130 |
destroyed: function destroyed () { |
| 13131 |
for (var key in this.cache) { |
| 13132 |
pruneCacheEntry(this.cache, key, this.keys); |
| 13133 |
} |
| 13134 |
}, |
| 13135 |
|
| 13136 |
mounted: function mounted () { |
| 13137 |
var this$1 = this; |
| 13138 |
|
| 13139 |
this.cacheVNode(); |
| 13140 |
this.$watch('include', function (val) { |
| 13141 |
pruneCache(this$1, function (name) { return matches(val, name); }); |
| 13142 |
}); |
| 13143 |
this.$watch('exclude', function (val) { |
| 13144 |
pruneCache(this$1, function (name) { return !matches(val, name); }); |
| 13145 |
}); |
| 13146 |
}, |
| 13147 |
|
| 13148 |
updated: function updated () { |
| 13149 |
this.cacheVNode(); |
| 13150 |
}, |
| 13151 |
|
| 13152 |
render: function render () { |
| 13153 |
var slot = this.$slots.default; |
| 13154 |
var vnode = getFirstComponentChild(slot); |
| 13155 |
var componentOptions = vnode && vnode.componentOptions; |
| 13156 |
if (componentOptions) { |
| 13157 |
// check pattern |
| 13158 |
var name = getComponentName(componentOptions); |
| 13159 |
var ref = this; |
| 13160 |
var include = ref.include; |
| 13161 |
var exclude = ref.exclude; |
| 13162 |
if ( |
| 13163 |
// not included |
| 13164 |
(include && (!name || !matches(include, name))) || |
| 13165 |
// excluded |
| 13166 |
(exclude && name && matches(exclude, name)) |
| 13167 |
) { |
| 13168 |
return vnode |
| 13169 |
} |
| 13170 |
|
| 13171 |
var ref$1 = this; |
| 13172 |
var cache = ref$1.cache; |
| 13173 |
var keys = ref$1.keys; |
| 13174 |
var key = vnode.key == null |
| 13175 |
// same constructor may get registered as different local components |
| 13176 |
// so cid alone is not enough (#3269) |
| 13177 |
? componentOptions.Ctor.cid + (componentOptions.tag ? ("::" + (componentOptions.tag)) : '') |
| 13178 |
: vnode.key; |
| 13179 |
if (cache[key]) { |
| 13180 |
vnode.componentInstance = cache[key].componentInstance; |
| 13181 |
// make current key freshest |
| 13182 |
remove(keys, key); |
| 13183 |
keys.push(key); |
| 13184 |
} else { |
| 13185 |
// delay setting the cache until update |
| 13186 |
this.vnodeToCache = vnode; |
| 13187 |
this.keyToCache = key; |
| 13188 |
} |
| 13189 |
|
| 13190 |
vnode.data.keepAlive = true; |
| 13191 |
} |
| 13192 |
return vnode || (slot && slot[0]) |
| 13193 |
} |
| 13194 |
}; |
| 13195 |
|
| 13196 |
var builtInComponents = { |
| 13197 |
KeepAlive: KeepAlive |
| 13198 |
}; |
| 13199 |
|
| 13200 |
/* */ |
| 13201 |
|
| 13202 |
function initGlobalAPI (Vue) { |
| 13203 |
// config |
| 13204 |
var configDef = {}; |
| 13205 |
configDef.get = function () { return config; }; |
| 13206 |
if (true) { |
| 13207 |
configDef.set = function () { |
| 13208 |
warn( |
| 13209 |
'Do not replace the Vue.config object, set individual fields instead.' |
| 13210 |
); |
| 13211 |
}; |
| 13212 |
} |
| 13213 |
Object.defineProperty(Vue, 'config', configDef); |
| 13214 |
|
| 13215 |
// exposed util methods. |
| 13216 |
// NOTE: these are not considered part of the public API - avoid relying on |
| 13217 |
// them unless you are aware of the risk. |
| 13218 |
Vue.util = { |
| 13219 |
warn: warn, |
| 13220 |
extend: extend, |
| 13221 |
mergeOptions: mergeOptions, |
| 13222 |
defineReactive: defineReactive$$1 |
| 13223 |
}; |
| 13224 |
|
| 13225 |
Vue.set = set; |
| 13226 |
Vue.delete = del; |
| 13227 |
Vue.nextTick = nextTick; |
| 13228 |
|
| 13229 |
// 2.6 explicit observable API |
| 13230 |
Vue.observable = function (obj) { |
| 13231 |
observe(obj); |
| 13232 |
return obj |
| 13233 |
}; |
| 13234 |
|
| 13235 |
Vue.options = Object.create(null); |
| 13236 |
ASSET_TYPES.forEach(function (type) { |
| 13237 |
Vue.options[type + 's'] = Object.create(null); |
| 13238 |
}); |
| 13239 |
|
| 13240 |
// this is used to identify the "base" constructor to extend all plain-object |
| 13241 |
// components with in Weex's multi-instance scenarios. |
| 13242 |
Vue.options._base = Vue; |
| 13243 |
|
| 13244 |
extend(Vue.options.components, builtInComponents); |
| 13245 |
|
| 13246 |
initUse(Vue); |
| 13247 |
initMixin$1(Vue); |
| 13248 |
initExtend(Vue); |
| 13249 |
initAssetRegisters(Vue); |
| 13250 |
} |
| 13251 |
|
| 13252 |
initGlobalAPI(Vue); |
| 13253 |
|
| 13254 |
Object.defineProperty(Vue.prototype, '$isServer', { |
| 13255 |
get: isServerRendering |
| 13256 |
}); |
| 13257 |
|
| 13258 |
Object.defineProperty(Vue.prototype, '$ssrContext', { |
| 13259 |
get: function get () { |
| 13260 |
/* istanbul ignore next */ |
| 13261 |
return this.$vnode && this.$vnode.ssrContext |
| 13262 |
} |
| 13263 |
}); |
| 13264 |
|
| 13265 |
// expose FunctionalRenderContext for ssr runtime helper installation |
| 13266 |
Object.defineProperty(Vue, 'FunctionalRenderContext', { |
| 13267 |
value: FunctionalRenderContext |
| 13268 |
}); |
| 13269 |
|
| 13270 |
Vue.version = '2.6.14'; |
| 13271 |
|
| 13272 |
/* */ |
| 13273 |
|
| 13274 |
// these are reserved for web because they are directly compiled away |
| 13275 |
// during template compilation |
| 13276 |
var isReservedAttr = makeMap('style,class'); |
| 13277 |
|
| 13278 |
// attributes that should be using props for binding |
| 13279 |
var acceptValue = makeMap('input,textarea,option,select,progress'); |
| 13280 |
var mustUseProp = function (tag, type, attr) { |
| 13281 |
return ( |
| 13282 |
(attr === 'value' && acceptValue(tag)) && type !== 'button' || |
| 13283 |
(attr === 'selected' && tag === 'option') || |
| 13284 |
(attr === 'checked' && tag === 'input') || |
| 13285 |
(attr === 'muted' && tag === 'video') |
| 13286 |
) |
| 13287 |
}; |
| 13288 |
|
| 13289 |
var isEnumeratedAttr = makeMap('contenteditable,draggable,spellcheck'); |
| 13290 |
|
| 13291 |
var isValidContentEditableValue = makeMap('events,caret,typing,plaintext-only'); |
| 13292 |
|
| 13293 |
var convertEnumeratedValue = function (key, value) { |
| 13294 |
return isFalsyAttrValue(value) || value === 'false' |
| 13295 |
? 'false' |
| 13296 |
// allow arbitrary string value for contenteditable |
| 13297 |
: key === 'contenteditable' && isValidContentEditableValue(value) |
| 13298 |
? value |
| 13299 |
: 'true' |
| 13300 |
}; |
| 13301 |
|
| 13302 |
var isBooleanAttr = makeMap( |
| 13303 |
'allowfullscreen,async,autofocus,autoplay,checked,compact,controls,declare,' + |
| 13304 |
'default,defaultchecked,defaultmuted,defaultselected,defer,disabled,' + |
| 13305 |
'enabled,formnovalidate,hidden,indeterminate,inert,ismap,itemscope,loop,multiple,' + |
| 13306 |
'muted,nohref,noresize,noshade,novalidate,nowrap,open,pauseonexit,readonly,' + |
| 13307 |
'required,reversed,scoped,seamless,selected,sortable,' + |
| 13308 |
'truespeed,typemustmatch,visible' |
| 13309 |
); |
| 13310 |
|
| 13311 |
var xlinkNS = 'http://www.w3.org/1999/xlink'; |
| 13312 |
|
| 13313 |
var isXlink = function (name) { |
| 13314 |
return name.charAt(5) === ':' && name.slice(0, 5) === 'xlink' |
| 13315 |
}; |
| 13316 |
|
| 13317 |
var getXlinkProp = function (name) { |
| 13318 |
return isXlink(name) ? name.slice(6, name.length) : '' |
| 13319 |
}; |
| 13320 |
|
| 13321 |
var isFalsyAttrValue = function (val) { |
| 13322 |
return val == null || val === false |
| 13323 |
}; |
| 13324 |
|
| 13325 |
/* */ |
| 13326 |
|
| 13327 |
function genClassForVnode (vnode) { |
| 13328 |
var data = vnode.data; |
| 13329 |
var parentNode = vnode; |
| 13330 |
var childNode = vnode; |
| 13331 |
while (isDef(childNode.componentInstance)) { |
| 13332 |
childNode = childNode.componentInstance._vnode; |
| 13333 |
if (childNode && childNode.data) { |
| 13334 |
data = mergeClassData(childNode.data, data); |
| 13335 |
} |
| 13336 |
} |
| 13337 |
while (isDef(parentNode = parentNode.parent)) { |
| 13338 |
if (parentNode && parentNode.data) { |
| 13339 |
data = mergeClassData(data, parentNode.data); |
| 13340 |
} |
| 13341 |
} |
| 13342 |
return renderClass(data.staticClass, data.class) |
| 13343 |
} |
| 13344 |
|
| 13345 |
function mergeClassData (child, parent) { |
| 13346 |
return { |
| 13347 |
staticClass: concat(child.staticClass, parent.staticClass), |
| 13348 |
class: isDef(child.class) |
| 13349 |
? [child.class, parent.class] |
| 13350 |
: parent.class |
| 13351 |
} |
| 13352 |
} |
| 13353 |
|
| 13354 |
function renderClass ( |
| 13355 |
staticClass, |
| 13356 |
dynamicClass |
| 13357 |
) { |
| 13358 |
if (isDef(staticClass) || isDef(dynamicClass)) { |
| 13359 |
return concat(staticClass, stringifyClass(dynamicClass)) |
| 13360 |
} |
| 13361 |
/* istanbul ignore next */ |
| 13362 |
return '' |
| 13363 |
} |
| 13364 |
|
| 13365 |
function concat (a, b) { |
| 13366 |
return a ? b ? (a + ' ' + b) : a : (b || '') |
| 13367 |
} |
| 13368 |
|
| 13369 |
function stringifyClass (value) { |
| 13370 |
if (Array.isArray(value)) { |
| 13371 |
return stringifyArray(value) |
| 13372 |
} |
| 13373 |
if (isObject(value)) { |
| 13374 |
return stringifyObject(value) |
| 13375 |
} |
| 13376 |
if (typeof value === 'string') { |
| 13377 |
return value |
| 13378 |
} |
| 13379 |
/* istanbul ignore next */ |
| 13380 |
return '' |
| 13381 |
} |
| 13382 |
|
| 13383 |
function stringifyArray (value) { |
| 13384 |
var res = ''; |
| 13385 |
var stringified; |
| 13386 |
for (var i = 0, l = value.length; i < l; i++) { |
| 13387 |
if (isDef(stringified = stringifyClass(value[i])) && stringified !== '') { |
| 13388 |
if (res) { res += ' '; } |
| 13389 |
res += stringified; |
| 13390 |
} |
| 13391 |
} |
| 13392 |
return res |
| 13393 |
} |
| 13394 |
|
| 13395 |
function stringifyObject (value) { |
| 13396 |
var res = ''; |
| 13397 |
for (var key in value) { |
| 13398 |
if (value[key]) { |
| 13399 |
if (res) { res += ' '; } |
| 13400 |
res += key; |
| 13401 |
} |
| 13402 |
} |
| 13403 |
return res |
| 13404 |
} |
| 13405 |
|
| 13406 |
/* */ |
| 13407 |
|
| 13408 |
var namespaceMap = { |
| 13409 |
svg: 'http://www.w3.org/2000/svg', |
| 13410 |
math: 'http://www.w3.org/1998/Math/MathML' |
| 13411 |
}; |
| 13412 |
|
| 13413 |
var isHTMLTag = makeMap( |
| 13414 |
'html,body,base,head,link,meta,style,title,' + |
| 13415 |
'address,article,aside,footer,header,h1,h2,h3,h4,h5,h6,hgroup,nav,section,' + |
| 13416 |
'div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,' + |
| 13417 |
'a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,rtc,ruby,' + |
| 13418 |
's,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,' + |
| 13419 |
'embed,object,param,source,canvas,script,noscript,del,ins,' + |
| 13420 |
'caption,col,colgroup,table,thead,tbody,td,th,tr,' + |
| 13421 |
'button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,' + |
| 13422 |
'output,progress,select,textarea,' + |
| 13423 |
'details,dialog,menu,menuitem,summary,' + |
| 13424 |
'content,element,shadow,template,blockquote,iframe,tfoot' |
| 13425 |
); |
| 13426 |
|
| 13427 |
// this map is intentionally selective, only covering SVG elements that may |
| 13428 |
// contain child elements. |
| 13429 |
var isSVG = makeMap( |
| 13430 |
'svg,animate,circle,clippath,cursor,defs,desc,ellipse,filter,font-face,' + |
| 13431 |
'foreignobject,g,glyph,image,line,marker,mask,missing-glyph,path,pattern,' + |
| 13432 |
'polygon,polyline,rect,switch,symbol,text,textpath,tspan,use,view', |
| 13433 |
true |
| 13434 |
); |
| 13435 |
|
| 13436 |
var isPreTag = function (tag) { return tag === 'pre'; }; |
| 13437 |
|
| 13438 |
var isReservedTag = function (tag) { |
| 13439 |
return isHTMLTag(tag) || isSVG(tag) |
| 13440 |
}; |
| 13441 |
|
| 13442 |
function getTagNamespace (tag) { |
| 13443 |
if (isSVG(tag)) { |
| 13444 |
return 'svg' |
| 13445 |
} |
| 13446 |
// basic support for MathML |
| 13447 |
// note it doesn't support other MathML elements being component roots |
| 13448 |
if (tag === 'math') { |
| 13449 |
return 'math' |
| 13450 |
} |
| 13451 |
} |
| 13452 |
|
| 13453 |
var unknownElementCache = Object.create(null); |
| 13454 |
function isUnknownElement (tag) { |
| 13455 |
/* istanbul ignore if */ |
| 13456 |
if (!inBrowser) { |
| 13457 |
return true |
| 13458 |
} |
| 13459 |
if (isReservedTag(tag)) { |
| 13460 |
return false |
| 13461 |
} |
| 13462 |
tag = tag.toLowerCase(); |
| 13463 |
/* istanbul ignore if */ |
| 13464 |
if (unknownElementCache[tag] != null) { |
| 13465 |
return unknownElementCache[tag] |
| 13466 |
} |
| 13467 |
var el = document.createElement(tag); |
| 13468 |
if (tag.indexOf('-') > -1) { |
| 13469 |
// http://stackoverflow.com/a/28210364/1070244 |
| 13470 |
return (unknownElementCache[tag] = ( |
| 13471 |
el.constructor === window.HTMLUnknownElement || |
| 13472 |
el.constructor === window.HTMLElement |
| 13473 |
)) |
| 13474 |
} else { |
| 13475 |
return (unknownElementCache[tag] = /HTMLUnknownElement/.test(el.toString())) |
| 13476 |
} |
| 13477 |
} |
| 13478 |
|
| 13479 |
var isTextInputType = makeMap('text,number,password,search,email,tel,url'); |
| 13480 |
|
| 13481 |
/* */ |
| 13482 |
|
| 13483 |
/** |
| 13484 |
* Query an element selector if it's not an element already. |
| 13485 |
*/ |
| 13486 |
function query (el) { |
| 13487 |
if (typeof el === 'string') { |
| 13488 |
var selected = document.querySelector(el); |
| 13489 |
if (!selected) { |
| 13490 |
true && warn( |
| 13491 |
'Cannot find element: ' + el |
| 13492 |
); |
| 13493 |
return document.createElement('div') |
| 13494 |
} |
| 13495 |
return selected |
| 13496 |
} else { |
| 13497 |
return el |
| 13498 |
} |
| 13499 |
} |
| 13500 |
|
| 13501 |
/* */ |
| 13502 |
|
| 13503 |
function createElement$1 (tagName, vnode) { |
| 13504 |
var elm = document.createElement(tagName); |
| 13505 |
if (tagName !== 'select') { |
| 13506 |
return elm |
| 13507 |
} |
| 13508 |
// false or null will remove the attribute but undefined will not |
| 13509 |
if (vnode.data && vnode.data.attrs && vnode.data.attrs.multiple !== undefined) { |
| 13510 |
elm.setAttribute('multiple', 'multiple'); |
| 13511 |
} |
| 13512 |
return elm |
| 13513 |
} |
| 13514 |
|
| 13515 |
function createElementNS (namespace, tagName) { |
| 13516 |
return document.createElementNS(namespaceMap[namespace], tagName) |
| 13517 |
} |
| 13518 |
|
| 13519 |
function createTextNode (text) { |
| 13520 |
return document.createTextNode(text) |
| 13521 |
} |
| 13522 |
|
| 13523 |
function createComment (text) { |
| 13524 |
return document.createComment(text) |
| 13525 |
} |
| 13526 |
|
| 13527 |
function insertBefore (parentNode, newNode, referenceNode) { |
| 13528 |
parentNode.insertBefore(newNode, referenceNode); |
| 13529 |
} |
| 13530 |
|
| 13531 |
function removeChild (node, child) { |
| 13532 |
node.removeChild(child); |
| 13533 |
} |
| 13534 |
|
| 13535 |
function appendChild (node, child) { |
| 13536 |
node.appendChild(child); |
| 13537 |
} |
| 13538 |
|
| 13539 |
function parentNode (node) { |
| 13540 |
return node.parentNode |
| 13541 |
} |
| 13542 |
|
| 13543 |
function nextSibling (node) { |
| 13544 |
return node.nextSibling |
| 13545 |
} |
| 13546 |
|
| 13547 |
function tagName (node) { |
| 13548 |
return node.tagName |
| 13549 |
} |
| 13550 |
|
| 13551 |
function setTextContent (node, text) { |
| 13552 |
node.textContent = text; |
| 13553 |
} |
| 13554 |
|
| 13555 |
function setStyleScope (node, scopeId) { |
| 13556 |
node.setAttribute(scopeId, ''); |
| 13557 |
} |
| 13558 |
|
| 13559 |
var nodeOps = /*#__PURE__*/Object.freeze({ |
| 13560 |
createElement: createElement$1, |
| 13561 |
createElementNS: createElementNS, |
| 13562 |
createTextNode: createTextNode, |
| 13563 |
createComment: createComment, |
| 13564 |
insertBefore: insertBefore, |
| 13565 |
removeChild: removeChild, |
| 13566 |
appendChild: appendChild, |
| 13567 |
parentNode: parentNode, |
| 13568 |
nextSibling: nextSibling, |
| 13569 |
tagName: tagName, |
| 13570 |
setTextContent: setTextContent, |
| 13571 |
setStyleScope: setStyleScope |
| 13572 |
}); |
| 13573 |
|
| 13574 |
/* */ |
| 13575 |
|
| 13576 |
var ref = { |
| 13577 |
create: function create (_, vnode) { |
| 13578 |
registerRef(vnode); |
| 13579 |
}, |
| 13580 |
update: function update (oldVnode, vnode) { |
| 13581 |
if (oldVnode.data.ref !== vnode.data.ref) { |
| 13582 |
registerRef(oldVnode, true); |
| 13583 |
registerRef(vnode); |
| 13584 |
} |
| 13585 |
}, |
| 13586 |
destroy: function destroy (vnode) { |
| 13587 |
registerRef(vnode, true); |
| 13588 |
} |
| 13589 |
}; |
| 13590 |
|
| 13591 |
function registerRef (vnode, isRemoval) { |
| 13592 |
var key = vnode.data.ref; |
| 13593 |
if (!isDef(key)) { return } |
| 13594 |
|
| 13595 |
var vm = vnode.context; |
| 13596 |
var ref = vnode.componentInstance || vnode.elm; |
| 13597 |
var refs = vm.$refs; |
| 13598 |
if (isRemoval) { |
| 13599 |
if (Array.isArray(refs[key])) { |
| 13600 |
remove(refs[key], ref); |
| 13601 |
} else if (refs[key] === ref) { |
| 13602 |
refs[key] = undefined; |
| 13603 |
} |
| 13604 |
} else { |
| 13605 |
if (vnode.data.refInFor) { |
| 13606 |
if (!Array.isArray(refs[key])) { |
| 13607 |
refs[key] = [ref]; |
| 13608 |
} else if (refs[key].indexOf(ref) < 0) { |
| 13609 |
// $flow-disable-line |
| 13610 |
refs[key].push(ref); |
| 13611 |
} |
| 13612 |
} else { |
| 13613 |
refs[key] = ref; |
| 13614 |
} |
| 13615 |
} |
| 13616 |
} |
| 13617 |
|
| 13618 |
/** |
| 13619 |
* Virtual DOM patching algorithm based on Snabbdom by |
| 13620 |
* Simon Friis Vindum (@paldepind) |
| 13621 |
* Licensed under the MIT License |
| 13622 |
* https://github.com/paldepind/snabbdom/blob/master/LICENSE |
| 13623 |
* |
| 13624 |
* modified by Evan You (@yyx990803) |
| 13625 |
* |
| 13626 |
* Not type-checking this because this file is perf-critical and the cost |
| 13627 |
* of making flow understand it is not worth it. |
| 13628 |
*/ |
| 13629 |
|
| 13630 |
var emptyNode = new VNode('', {}, []); |
| 13631 |
|
| 13632 |
var hooks = ['create', 'activate', 'update', 'remove', 'destroy']; |
| 13633 |
|
| 13634 |
function sameVnode (a, b) { |
| 13635 |
return ( |
| 13636 |
a.key === b.key && |
| 13637 |
a.asyncFactory === b.asyncFactory && ( |
| 13638 |
( |
| 13639 |
a.tag === b.tag && |
| 13640 |
a.isComment === b.isComment && |
| 13641 |
isDef(a.data) === isDef(b.data) && |
| 13642 |
sameInputType(a, b) |
| 13643 |
) || ( |
| 13644 |
isTrue(a.isAsyncPlaceholder) && |
| 13645 |
isUndef(b.asyncFactory.error) |
| 13646 |
) |
| 13647 |
) |
| 13648 |
) |
| 13649 |
} |
| 13650 |
|
| 13651 |
function sameInputType (a, b) { |
| 13652 |
if (a.tag !== 'input') { return true } |
| 13653 |
var i; |
| 13654 |
var typeA = isDef(i = a.data) && isDef(i = i.attrs) && i.type; |
| 13655 |
var typeB = isDef(i = b.data) && isDef(i = i.attrs) && i.type; |
| 13656 |
return typeA === typeB || isTextInputType(typeA) && isTextInputType(typeB) |
| 13657 |
} |
| 13658 |
|
| 13659 |
function createKeyToOldIdx (children, beginIdx, endIdx) { |
| 13660 |
var i, key; |
| 13661 |
var map = {}; |
| 13662 |
for (i = beginIdx; i <= endIdx; ++i) { |
| 13663 |
key = children[i].key; |
| 13664 |
if (isDef(key)) { map[key] = i; } |
| 13665 |
} |
| 13666 |
return map |
| 13667 |
} |
| 13668 |
|
| 13669 |
function createPatchFunction (backend) { |
| 13670 |
var i, j; |
| 13671 |
var cbs = {}; |
| 13672 |
|
| 13673 |
var modules = backend.modules; |
| 13674 |
var nodeOps = backend.nodeOps; |
| 13675 |
|
| 13676 |
for (i = 0; i < hooks.length; ++i) { |
| 13677 |
cbs[hooks[i]] = []; |
| 13678 |
for (j = 0; j < modules.length; ++j) { |
| 13679 |
if (isDef(modules[j][hooks[i]])) { |
| 13680 |
cbs[hooks[i]].push(modules[j][hooks[i]]); |
| 13681 |
} |
| 13682 |
} |
| 13683 |
} |
| 13684 |
|
| 13685 |
function emptyNodeAt (elm) { |
| 13686 |
return new VNode(nodeOps.tagName(elm).toLowerCase(), {}, [], undefined, elm) |
| 13687 |
} |
| 13688 |
|
| 13689 |
function createRmCb (childElm, listeners) { |
| 13690 |
function remove$$1 () { |
| 13691 |
if (--remove$$1.listeners === 0) { |
| 13692 |
removeNode(childElm); |
| 13693 |
} |
| 13694 |
} |
| 13695 |
remove$$1.listeners = listeners; |
| 13696 |
return remove$$1 |
| 13697 |
} |
| 13698 |
|
| 13699 |
function removeNode (el) { |
| 13700 |
var parent = nodeOps.parentNode(el); |
| 13701 |
// element may have already been removed due to v-html / v-text |
| 13702 |
if (isDef(parent)) { |
| 13703 |
nodeOps.removeChild(parent, el); |
| 13704 |
} |
| 13705 |
} |
| 13706 |
|
| 13707 |
function isUnknownElement$$1 (vnode, inVPre) { |
| 13708 |
return ( |
| 13709 |
!inVPre && |
| 13710 |
!vnode.ns && |
| 13711 |
!( |
| 13712 |
config.ignoredElements.length && |
| 13713 |
config.ignoredElements.some(function (ignore) { |
| 13714 |
return isRegExp(ignore) |
| 13715 |
? ignore.test(vnode.tag) |
| 13716 |
: ignore === vnode.tag |
| 13717 |
}) |
| 13718 |
) && |
| 13719 |
config.isUnknownElement(vnode.tag) |
| 13720 |
) |
| 13721 |
} |
| 13722 |
|
| 13723 |
var creatingElmInVPre = 0; |
| 13724 |
|
| 13725 |
function createElm ( |
| 13726 |
vnode, |
| 13727 |
insertedVnodeQueue, |
| 13728 |
parentElm, |
| 13729 |
refElm, |
| 13730 |
nested, |
| 13731 |
ownerArray, |
| 13732 |
index |
| 13733 |
) { |
| 13734 |
if (isDef(vnode.elm) && isDef(ownerArray)) { |
| 13735 |
// This vnode was used in a previous render! |
| 13736 |
// now it's used as a new node, overwriting its elm would cause |
| 13737 |
// potential patch errors down the road when it's used as an insertion |
| 13738 |
// reference node. Instead, we clone the node on-demand before creating |
| 13739 |
// associated DOM element for it. |
| 13740 |
vnode = ownerArray[index] = cloneVNode(vnode); |
| 13741 |
} |
| 13742 |
|
| 13743 |
vnode.isRootInsert = !nested; // for transition enter check |
| 13744 |
if (createComponent(vnode, insertedVnodeQueue, parentElm, refElm)) { |
| 13745 |
return |
| 13746 |
} |
| 13747 |
|
| 13748 |
var data = vnode.data; |
| 13749 |
var children = vnode.children; |
| 13750 |
var tag = vnode.tag; |
| 13751 |
if (isDef(tag)) { |
| 13752 |
if (true) { |
| 13753 |
if (data && data.pre) { |
| 13754 |
creatingElmInVPre++; |
| 13755 |
} |
| 13756 |
if (isUnknownElement$$1(vnode, creatingElmInVPre)) { |
| 13757 |
warn( |
| 13758 |
'Unknown custom element: <' + tag + '> - did you ' + |
| 13759 |
'register the component correctly? For recursive components, ' + |
| 13760 |
'make sure to provide the "name" option.', |
| 13761 |
vnode.context |
| 13762 |
); |
| 13763 |
} |
| 13764 |
} |
| 13765 |
|
| 13766 |
vnode.elm = vnode.ns |
| 13767 |
? nodeOps.createElementNS(vnode.ns, tag) |
| 13768 |
: nodeOps.createElement(tag, vnode); |
| 13769 |
setScope(vnode); |
| 13770 |
|
| 13771 |
/* istanbul ignore if */ |
| 13772 |
{ |
| 13773 |
createChildren(vnode, children, insertedVnodeQueue); |
| 13774 |
if (isDef(data)) { |
| 13775 |
invokeCreateHooks(vnode, insertedVnodeQueue); |
| 13776 |
} |
| 13777 |
insert(parentElm, vnode.elm, refElm); |
| 13778 |
} |
| 13779 |
|
| 13780 |
if ( true && data && data.pre) { |
| 13781 |
creatingElmInVPre--; |
| 13782 |
} |
| 13783 |
} else if (isTrue(vnode.isComment)) { |
| 13784 |
vnode.elm = nodeOps.createComment(vnode.text); |
| 13785 |
insert(parentElm, vnode.elm, refElm); |
| 13786 |
} else { |
| 13787 |
vnode.elm = nodeOps.createTextNode(vnode.text); |
| 13788 |
insert(parentElm, vnode.elm, refElm); |
| 13789 |
} |
| 13790 |
} |
| 13791 |
|
| 13792 |
function createComponent (vnode, insertedVnodeQueue, parentElm, refElm) { |
| 13793 |
var i = vnode.data; |
| 13794 |
if (isDef(i)) { |
| 13795 |
var isReactivated = isDef(vnode.componentInstance) && i.keepAlive; |
| 13796 |
if (isDef(i = i.hook) && isDef(i = i.init)) { |
| 13797 |
i(vnode, false /* hydrating */); |
| 13798 |
} |
| 13799 |
// after calling the init hook, if the vnode is a child component |
| 13800 |
// it should've created a child instance and mounted it. the child |
| 13801 |
// component also has set the placeholder vnode's elm. |
| 13802 |
// in that case we can just return the element and be done. |
| 13803 |
if (isDef(vnode.componentInstance)) { |
| 13804 |
initComponent(vnode, insertedVnodeQueue); |
| 13805 |
insert(parentElm, vnode.elm, refElm); |
| 13806 |
if (isTrue(isReactivated)) { |
| 13807 |
reactivateComponent(vnode, insertedVnodeQueue, parentElm, refElm); |
| 13808 |
} |
| 13809 |
return true |
| 13810 |
} |
| 13811 |
} |
| 13812 |
} |
| 13813 |
|
| 13814 |
function initComponent (vnode, insertedVnodeQueue) { |
| 13815 |
if (isDef(vnode.data.pendingInsert)) { |
| 13816 |
insertedVnodeQueue.push.apply(insertedVnodeQueue, vnode.data.pendingInsert); |
| 13817 |
vnode.data.pendingInsert = null; |
| 13818 |
} |
| 13819 |
vnode.elm = vnode.componentInstance.$el; |
| 13820 |
if (isPatchable(vnode)) { |
| 13821 |
invokeCreateHooks(vnode, insertedVnodeQueue); |
| 13822 |
setScope(vnode); |
| 13823 |
} else { |
| 13824 |
// empty component root. |
| 13825 |
// skip all element-related modules except for ref (#3455) |
| 13826 |
registerRef(vnode); |
| 13827 |
// make sure to invoke the insert hook |
| 13828 |
insertedVnodeQueue.push(vnode); |
| 13829 |
} |
| 13830 |
} |
| 13831 |
|
| 13832 |
function reactivateComponent (vnode, insertedVnodeQueue, parentElm, refElm) { |
| 13833 |
var i; |
| 13834 |
// hack for #4339: a reactivated component with inner transition |
| 13835 |
// does not trigger because the inner node's created hooks are not called |
| 13836 |
// again. It's not ideal to involve module-specific logic in here but |
| 13837 |
// there doesn't seem to be a better way to do it. |
| 13838 |
var innerNode = vnode; |
| 13839 |
while (innerNode.componentInstance) { |
| 13840 |
innerNode = innerNode.componentInstance._vnode; |
| 13841 |
if (isDef(i = innerNode.data) && isDef(i = i.transition)) { |
| 13842 |
for (i = 0; i < cbs.activate.length; ++i) { |
| 13843 |
cbs.activate[i](emptyNode, innerNode); |
| 13844 |
} |
| 13845 |
insertedVnodeQueue.push(innerNode); |
| 13846 |
break |
| 13847 |
} |
| 13848 |
} |
| 13849 |
// unlike a newly created component, |
| 13850 |
// a reactivated keep-alive component doesn't insert itself |
| 13851 |
insert(parentElm, vnode.elm, refElm); |
| 13852 |
} |
| 13853 |
|
| 13854 |
function insert (parent, elm, ref$$1) { |
| 13855 |
if (isDef(parent)) { |
| 13856 |
if (isDef(ref$$1)) { |
| 13857 |
if (nodeOps.parentNode(ref$$1) === parent) { |
| 13858 |
nodeOps.insertBefore(parent, elm, ref$$1); |
| 13859 |
} |
| 13860 |
} else { |
| 13861 |
nodeOps.appendChild(parent, elm); |
| 13862 |
} |
| 13863 |
} |
| 13864 |
} |
| 13865 |
|
| 13866 |
function createChildren (vnode, children, insertedVnodeQueue) { |
| 13867 |
if (Array.isArray(children)) { |
| 13868 |
if (true) { |
| 13869 |
checkDuplicateKeys(children); |
| 13870 |
} |
| 13871 |
for (var i = 0; i < children.length; ++i) { |
| 13872 |
createElm(children[i], insertedVnodeQueue, vnode.elm, null, true, children, i); |
| 13873 |
} |
| 13874 |
} else if (isPrimitive(vnode.text)) { |
| 13875 |
nodeOps.appendChild(vnode.elm, nodeOps.createTextNode(String(vnode.text))); |
| 13876 |
} |
| 13877 |
} |
| 13878 |
|
| 13879 |
function isPatchable (vnode) { |
| 13880 |
while (vnode.componentInstance) { |
| 13881 |
vnode = vnode.componentInstance._vnode; |
| 13882 |
} |
| 13883 |
return isDef(vnode.tag) |
| 13884 |
} |
| 13885 |
|
| 13886 |
function invokeCreateHooks (vnode, insertedVnodeQueue) { |
| 13887 |
for (var i$1 = 0; i$1 < cbs.create.length; ++i$1) { |
| 13888 |
cbs.create[i$1](emptyNode, vnode); |
| 13889 |
} |
| 13890 |
i = vnode.data.hook; // Reuse variable |
| 13891 |
if (isDef(i)) { |
| 13892 |
if (isDef(i.create)) { i.create(emptyNode, vnode); } |
| 13893 |
if (isDef(i.insert)) { insertedVnodeQueue.push(vnode); } |
| 13894 |
} |
| 13895 |
} |
| 13896 |
|
| 13897 |
// set scope id attribute for scoped CSS. |
| 13898 |
// this is implemented as a special case to avoid the overhead |
| 13899 |
// of going through the normal attribute patching process. |
| 13900 |
function setScope (vnode) { |
| 13901 |
var i; |
| 13902 |
if (isDef(i = vnode.fnScopeId)) { |
| 13903 |
nodeOps.setStyleScope(vnode.elm, i); |
| 13904 |
} else { |
| 13905 |
var ancestor = vnode; |
| 13906 |
while (ancestor) { |
| 13907 |
if (isDef(i = ancestor.context) && isDef(i = i.$options._scopeId)) { |
| 13908 |
nodeOps.setStyleScope(vnode.elm, i); |
| 13909 |
} |
| 13910 |
ancestor = ancestor.parent; |
| 13911 |
} |
| 13912 |
} |
| 13913 |
// for slot content they should also get the scopeId from the host instance. |
| 13914 |
if (isDef(i = activeInstance) && |
| 13915 |
i !== vnode.context && |
| 13916 |
i !== vnode.fnContext && |
| 13917 |
isDef(i = i.$options._scopeId) |
| 13918 |
) { |
| 13919 |
nodeOps.setStyleScope(vnode.elm, i); |
| 13920 |
} |
| 13921 |
} |
| 13922 |
|
| 13923 |
function addVnodes (parentElm, refElm, vnodes, startIdx, endIdx, insertedVnodeQueue) { |
| 13924 |
for (; startIdx <= endIdx; ++startIdx) { |
| 13925 |
createElm(vnodes[startIdx], insertedVnodeQueue, parentElm, refElm, false, vnodes, startIdx); |
| 13926 |
} |
| 13927 |
} |
| 13928 |
|
| 13929 |
function invokeDestroyHook (vnode) { |
| 13930 |
var i, j; |
| 13931 |
var data = vnode.data; |
| 13932 |
if (isDef(data)) { |
| 13933 |
if (isDef(i = data.hook) && isDef(i = i.destroy)) { i(vnode); } |
| 13934 |
for (i = 0; i < cbs.destroy.length; ++i) { cbs.destroy[i](vnode); } |
| 13935 |
} |
| 13936 |
if (isDef(i = vnode.children)) { |
| 13937 |
for (j = 0; j < vnode.children.length; ++j) { |
| 13938 |
invokeDestroyHook(vnode.children[j]); |
| 13939 |
} |
| 13940 |
} |
| 13941 |
} |
| 13942 |
|
| 13943 |
function removeVnodes (vnodes, startIdx, endIdx) { |
| 13944 |
for (; startIdx <= endIdx; ++startIdx) { |
| 13945 |
var ch = vnodes[startIdx]; |
| 13946 |
if (isDef(ch)) { |
| 13947 |
if (isDef(ch.tag)) { |
| 13948 |
removeAndInvokeRemoveHook(ch); |
| 13949 |
invokeDestroyHook(ch); |
| 13950 |
} else { // Text node |
| 13951 |
removeNode(ch.elm); |
| 13952 |
} |
| 13953 |
} |
| 13954 |
} |
| 13955 |
} |
| 13956 |
|
| 13957 |
function removeAndInvokeRemoveHook (vnode, rm) { |
| 13958 |
if (isDef(rm) || isDef(vnode.data)) { |
| 13959 |
var i; |
| 13960 |
var listeners = cbs.remove.length + 1; |
| 13961 |
if (isDef(rm)) { |
| 13962 |
// we have a recursively passed down rm callback |
| 13963 |
// increase the listeners count |
| 13964 |
rm.listeners += listeners; |
| 13965 |
} else { |
| 13966 |
// directly removing |
| 13967 |
rm = createRmCb(vnode.elm, listeners); |
| 13968 |
} |
| 13969 |
// recursively invoke hooks on child component root node |
| 13970 |
if (isDef(i = vnode.componentInstance) && isDef(i = i._vnode) && isDef(i.data)) { |
| 13971 |
removeAndInvokeRemoveHook(i, rm); |
| 13972 |
} |
| 13973 |
for (i = 0; i < cbs.remove.length; ++i) { |
| 13974 |
cbs.remove[i](vnode, rm); |
| 13975 |
} |
| 13976 |
if (isDef(i = vnode.data.hook) && isDef(i = i.remove)) { |
| 13977 |
i(vnode, rm); |
| 13978 |
} else { |
| 13979 |
rm(); |
| 13980 |
} |
| 13981 |
} else { |
| 13982 |
removeNode(vnode.elm); |
| 13983 |
} |
| 13984 |
} |
| 13985 |
|
| 13986 |
function updateChildren (parentElm, oldCh, newCh, insertedVnodeQueue, removeOnly) { |
| 13987 |
var oldStartIdx = 0; |
| 13988 |
var newStartIdx = 0; |
| 13989 |
var oldEndIdx = oldCh.length - 1; |
| 13990 |
var oldStartVnode = oldCh[0]; |
| 13991 |
var oldEndVnode = oldCh[oldEndIdx]; |
| 13992 |
var newEndIdx = newCh.length - 1; |
| 13993 |
var newStartVnode = newCh[0]; |
| 13994 |
var newEndVnode = newCh[newEndIdx]; |
| 13995 |
var oldKeyToIdx, idxInOld, vnodeToMove, refElm; |
| 13996 |
|
| 13997 |
// removeOnly is a special flag used only by <transition-group> |
| 13998 |
// to ensure removed elements stay in correct relative positions |
| 13999 |
// during leaving transitions |
| 14000 |
var canMove = !removeOnly; |
| 14001 |
|
| 14002 |
if (true) { |
| 14003 |
checkDuplicateKeys(newCh); |
| 14004 |
} |
| 14005 |
|
| 14006 |
while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) { |
| 14007 |
if (isUndef(oldStartVnode)) { |
| 14008 |
oldStartVnode = oldCh[++oldStartIdx]; // Vnode has been moved left |
| 14009 |
} else if (isUndef(oldEndVnode)) { |
| 14010 |
oldEndVnode = oldCh[--oldEndIdx]; |
| 14011 |
} else if (sameVnode(oldStartVnode, newStartVnode)) { |
| 14012 |
patchVnode(oldStartVnode, newStartVnode, insertedVnodeQueue, newCh, newStartIdx); |
| 14013 |
oldStartVnode = oldCh[++oldStartIdx]; |
| 14014 |
newStartVnode = newCh[++newStartIdx]; |
| 14015 |
} else if (sameVnode(oldEndVnode, newEndVnode)) { |
| 14016 |
patchVnode(oldEndVnode, newEndVnode, insertedVnodeQueue, newCh, newEndIdx); |
| 14017 |
oldEndVnode = oldCh[--oldEndIdx]; |
| 14018 |
newEndVnode = newCh[--newEndIdx]; |
| 14019 |
} else if (sameVnode(oldStartVnode, newEndVnode)) { // Vnode moved right |
| 14020 |
patchVnode(oldStartVnode, newEndVnode, insertedVnodeQueue, newCh, newEndIdx); |
| 14021 |
canMove && nodeOps.insertBefore(parentElm, oldStartVnode.elm, nodeOps.nextSibling(oldEndVnode.elm)); |
| 14022 |
oldStartVnode = oldCh[++oldStartIdx]; |
| 14023 |
newEndVnode = newCh[--newEndIdx]; |
| 14024 |
} else if (sameVnode(oldEndVnode, newStartVnode)) { // Vnode moved left |
| 14025 |
patchVnode(oldEndVnode, newStartVnode, insertedVnodeQueue, newCh, newStartIdx); |
| 14026 |
canMove && nodeOps.insertBefore(parentElm, oldEndVnode.elm, oldStartVnode.elm); |
| 14027 |
oldEndVnode = oldCh[--oldEndIdx]; |
| 14028 |
newStartVnode = newCh[++newStartIdx]; |
| 14029 |
} else { |
| 14030 |
if (isUndef(oldKeyToIdx)) { oldKeyToIdx = createKeyToOldIdx(oldCh, oldStartIdx, oldEndIdx); } |
| 14031 |
idxInOld = isDef(newStartVnode.key) |
| 14032 |
? oldKeyToIdx[newStartVnode.key] |
| 14033 |
: findIdxInOld(newStartVnode, oldCh, oldStartIdx, oldEndIdx); |
| 14034 |
if (isUndef(idxInOld)) { // New element |
| 14035 |
createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm, false, newCh, newStartIdx); |
| 14036 |
} else { |
| 14037 |
vnodeToMove = oldCh[idxInOld]; |
| 14038 |
if (sameVnode(vnodeToMove, newStartVnode)) { |
| 14039 |
patchVnode(vnodeToMove, newStartVnode, insertedVnodeQueue, newCh, newStartIdx); |
| 14040 |
oldCh[idxInOld] = undefined; |
| 14041 |
canMove && nodeOps.insertBefore(parentElm, vnodeToMove.elm, oldStartVnode.elm); |
| 14042 |
} else { |
| 14043 |
// same key but different element. treat as new element |
| 14044 |
createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm, false, newCh, newStartIdx); |
| 14045 |
} |
| 14046 |
} |
| 14047 |
newStartVnode = newCh[++newStartIdx]; |
| 14048 |
} |
| 14049 |
} |
| 14050 |
if (oldStartIdx > oldEndIdx) { |
| 14051 |
refElm = isUndef(newCh[newEndIdx + 1]) ? null : newCh[newEndIdx + 1].elm; |
| 14052 |
addVnodes(parentElm, refElm, newCh, newStartIdx, newEndIdx, insertedVnodeQueue); |
| 14053 |
} else if (newStartIdx > newEndIdx) { |
| 14054 |
removeVnodes(oldCh, oldStartIdx, oldEndIdx); |
| 14055 |
} |
| 14056 |
} |
| 14057 |
|
| 14058 |
function checkDuplicateKeys (children) { |
| 14059 |
var seenKeys = {}; |
| 14060 |
for (var i = 0; i < children.length; i++) { |
| 14061 |
var vnode = children[i]; |
| 14062 |
var key = vnode.key; |
| 14063 |
if (isDef(key)) { |
| 14064 |
if (seenKeys[key]) { |
| 14065 |
warn( |
| 14066 |
("Duplicate keys detected: '" + key + "'. This may cause an update error."), |
| 14067 |
vnode.context |
| 14068 |
); |
| 14069 |
} else { |
| 14070 |
seenKeys[key] = true; |
| 14071 |
} |
| 14072 |
} |
| 14073 |
} |
| 14074 |
} |
| 14075 |
|
| 14076 |
function findIdxInOld (node, oldCh, start, end) { |
| 14077 |
for (var i = start; i < end; i++) { |
| 14078 |
var c = oldCh[i]; |
| 14079 |
if (isDef(c) && sameVnode(node, c)) { return i } |
| 14080 |
} |
| 14081 |
} |
| 14082 |
|
| 14083 |
function patchVnode ( |
| 14084 |
oldVnode, |
| 14085 |
vnode, |
| 14086 |
insertedVnodeQueue, |
| 14087 |
ownerArray, |
| 14088 |
index, |
| 14089 |
removeOnly |
| 14090 |
) { |
| 14091 |
if (oldVnode === vnode) { |
| 14092 |
return |
| 14093 |
} |
| 14094 |
|
| 14095 |
if (isDef(vnode.elm) && isDef(ownerArray)) { |
| 14096 |
// clone reused vnode |
| 14097 |
vnode = ownerArray[index] = cloneVNode(vnode); |
| 14098 |
} |
| 14099 |
|
| 14100 |
var elm = vnode.elm = oldVnode.elm; |
| 14101 |
|
| 14102 |
if (isTrue(oldVnode.isAsyncPlaceholder)) { |
| 14103 |
if (isDef(vnode.asyncFactory.resolved)) { |
| 14104 |
hydrate(oldVnode.elm, vnode, insertedVnodeQueue); |
| 14105 |
} else { |
| 14106 |
vnode.isAsyncPlaceholder = true; |
| 14107 |
} |
| 14108 |
return |
| 14109 |
} |
| 14110 |
|
| 14111 |
// reuse element for static trees. |
| 14112 |
// note we only do this if the vnode is cloned - |
| 14113 |
// if the new node is not cloned it means the render functions have been |
| 14114 |
// reset by the hot-reload-api and we need to do a proper re-render. |
| 14115 |
if (isTrue(vnode.isStatic) && |
| 14116 |
isTrue(oldVnode.isStatic) && |
| 14117 |
vnode.key === oldVnode.key && |
| 14118 |
(isTrue(vnode.isCloned) || isTrue(vnode.isOnce)) |
| 14119 |
) { |
| 14120 |
vnode.componentInstance = oldVnode.componentInstance; |
| 14121 |
return |
| 14122 |
} |
| 14123 |
|
| 14124 |
var i; |
| 14125 |
var data = vnode.data; |
| 14126 |
if (isDef(data) && isDef(i = data.hook) && isDef(i = i.prepatch)) { |
| 14127 |
i(oldVnode, vnode); |
| 14128 |
} |
| 14129 |
|
| 14130 |
var oldCh = oldVnode.children; |
| 14131 |
var ch = vnode.children; |
| 14132 |
if (isDef(data) && isPatchable(vnode)) { |
| 14133 |
for (i = 0; i < cbs.update.length; ++i) { cbs.update[i](oldVnode, vnode); } |
| 14134 |
if (isDef(i = data.hook) && isDef(i = i.update)) { i(oldVnode, vnode); } |
| 14135 |
} |
| 14136 |
if (isUndef(vnode.text)) { |
| 14137 |
if (isDef(oldCh) && isDef(ch)) { |
| 14138 |
if (oldCh !== ch) { updateChildren(elm, oldCh, ch, insertedVnodeQueue, removeOnly); } |
| 14139 |
} else if (isDef(ch)) { |
| 14140 |
if (true) { |
| 14141 |
checkDuplicateKeys(ch); |
| 14142 |
} |
| 14143 |
if (isDef(oldVnode.text)) { nodeOps.setTextContent(elm, ''); } |
| 14144 |
addVnodes(elm, null, ch, 0, ch.length - 1, insertedVnodeQueue); |
| 14145 |
} else if (isDef(oldCh)) { |
| 14146 |
removeVnodes(oldCh, 0, oldCh.length - 1); |
| 14147 |
} else if (isDef(oldVnode.text)) { |
| 14148 |
nodeOps.setTextContent(elm, ''); |
| 14149 |
} |
| 14150 |
} else if (oldVnode.text !== vnode.text) { |
| 14151 |
nodeOps.setTextContent(elm, vnode.text); |
| 14152 |
} |
| 14153 |
if (isDef(data)) { |
| 14154 |
if (isDef(i = data.hook) && isDef(i = i.postpatch)) { i(oldVnode, vnode); } |
| 14155 |
} |
| 14156 |
} |
| 14157 |
|
| 14158 |
function invokeInsertHook (vnode, queue, initial) { |
| 14159 |
// delay insert hooks for component root nodes, invoke them after the |
| 14160 |
// element is really inserted |
| 14161 |
if (isTrue(initial) && isDef(vnode.parent)) { |
| 14162 |
vnode.parent.data.pendingInsert = queue; |
| 14163 |
} else { |
| 14164 |
for (var i = 0; i < queue.length; ++i) { |
| 14165 |
queue[i].data.hook.insert(queue[i]); |
| 14166 |
} |
| 14167 |
} |
| 14168 |
} |
| 14169 |
|
| 14170 |
var hydrationBailed = false; |
| 14171 |
// list of modules that can skip create hook during hydration because they |
| 14172 |
// are already rendered on the client or has no need for initialization |
| 14173 |
// Note: style is excluded because it relies on initial clone for future |
| 14174 |
// deep updates (#7063). |
| 14175 |
var isRenderedModule = makeMap('attrs,class,staticClass,staticStyle,key'); |
| 14176 |
|
| 14177 |
// Note: this is a browser-only function so we can assume elms are DOM nodes. |
| 14178 |
function hydrate (elm, vnode, insertedVnodeQueue, inVPre) { |
| 14179 |
var i; |
| 14180 |
var tag = vnode.tag; |
| 14181 |
var data = vnode.data; |
| 14182 |
var children = vnode.children; |
| 14183 |
inVPre = inVPre || (data && data.pre); |
| 14184 |
vnode.elm = elm; |
| 14185 |
|
| 14186 |
if (isTrue(vnode.isComment) && isDef(vnode.asyncFactory)) { |
| 14187 |
vnode.isAsyncPlaceholder = true; |
| 14188 |
return true |
| 14189 |
} |
| 14190 |
// assert node match |
| 14191 |
if (true) { |
| 14192 |
if (!assertNodeMatch(elm, vnode, inVPre)) { |
| 14193 |
return false |
| 14194 |
} |
| 14195 |
} |
| 14196 |
if (isDef(data)) { |
| 14197 |
if (isDef(i = data.hook) && isDef(i = i.init)) { i(vnode, true /* hydrating */); } |
| 14198 |
if (isDef(i = vnode.componentInstance)) { |
| 14199 |
// child component. it should have hydrated its own tree. |
| 14200 |
initComponent(vnode, insertedVnodeQueue); |
| 14201 |
return true |
| 14202 |
} |
| 14203 |
} |
| 14204 |
if (isDef(tag)) { |
| 14205 |
if (isDef(children)) { |
| 14206 |
// empty element, allow client to pick up and populate children |
| 14207 |
if (!elm.hasChildNodes()) { |
| 14208 |
createChildren(vnode, children, insertedVnodeQueue); |
| 14209 |
} else { |
| 14210 |
// v-html and domProps: innerHTML |
| 14211 |
if (isDef(i = data) && isDef(i = i.domProps) && isDef(i = i.innerHTML)) { |
| 14212 |
if (i !== elm.innerHTML) { |
| 14213 |
/* istanbul ignore if */ |
| 14214 |
if ( true && |
| 14215 |
typeof console !== 'undefined' && |
| 14216 |
!hydrationBailed |
| 14217 |
) { |
| 14218 |
hydrationBailed = true; |
| 14219 |
console.warn('Parent: ', elm); |
| 14220 |
console.warn('server innerHTML: ', i); |
| 14221 |
console.warn('client innerHTML: ', elm.innerHTML); |
| 14222 |
} |
| 14223 |
return false |
| 14224 |
} |
| 14225 |
} else { |
| 14226 |
// iterate and compare children lists |
| 14227 |
var childrenMatch = true; |
| 14228 |
var childNode = elm.firstChild; |
| 14229 |
for (var i$1 = 0; i$1 < children.length; i$1++) { |
| 14230 |
if (!childNode || !hydrate(childNode, children[i$1], insertedVnodeQueue, inVPre)) { |
| 14231 |
childrenMatch = false; |
| 14232 |
break |
| 14233 |
} |
| 14234 |
childNode = childNode.nextSibling; |
| 14235 |
} |
| 14236 |
// if childNode is not null, it means the actual childNodes list is |
| 14237 |
// longer than the virtual children list. |
| 14238 |
if (!childrenMatch || childNode) { |
| 14239 |
/* istanbul ignore if */ |
| 14240 |
if ( true && |
| 14241 |
typeof console !== 'undefined' && |
| 14242 |
!hydrationBailed |
| 14243 |
) { |
| 14244 |
hydrationBailed = true; |
| 14245 |
console.warn('Parent: ', elm); |
| 14246 |
console.warn('Mismatching childNodes vs. VNodes: ', elm.childNodes, children); |
| 14247 |
} |
| 14248 |
return false |
| 14249 |
} |
| 14250 |
} |
| 14251 |
} |
| 14252 |
} |
| 14253 |
if (isDef(data)) { |
| 14254 |
var fullInvoke = false; |
| 14255 |
for (var key in data) { |
| 14256 |
if (!isRenderedModule(key)) { |
| 14257 |
fullInvoke = true; |
| 14258 |
invokeCreateHooks(vnode, insertedVnodeQueue); |
| 14259 |
break |
| 14260 |
} |
| 14261 |
} |
| 14262 |
if (!fullInvoke && data['class']) { |
| 14263 |
// ensure collecting deps for deep class bindings for future updates |
| 14264 |
traverse(data['class']); |
| 14265 |
} |
| 14266 |
} |
| 14267 |
} else if (elm.data !== vnode.text) { |
| 14268 |
elm.data = vnode.text; |
| 14269 |
} |
| 14270 |
return true |
| 14271 |
} |
| 14272 |
|
| 14273 |
function assertNodeMatch (node, vnode, inVPre) { |
| 14274 |
if (isDef(vnode.tag)) { |
| 14275 |
return vnode.tag.indexOf('vue-component') === 0 || ( |
| 14276 |
!isUnknownElement$$1(vnode, inVPre) && |
| 14277 |
vnode.tag.toLowerCase() === (node.tagName && node.tagName.toLowerCase()) |
| 14278 |
) |
| 14279 |
} else { |
| 14280 |
return node.nodeType === (vnode.isComment ? 8 : 3) |
| 14281 |
} |
| 14282 |
} |
| 14283 |
|
| 14284 |
return function patch (oldVnode, vnode, hydrating, removeOnly) { |
| 14285 |
if (isUndef(vnode)) { |
| 14286 |
if (isDef(oldVnode)) { invokeDestroyHook(oldVnode); } |
| 14287 |
return |
| 14288 |
} |
| 14289 |
|
| 14290 |
var isInitialPatch = false; |
| 14291 |
var insertedVnodeQueue = []; |
| 14292 |
|
| 14293 |
if (isUndef(oldVnode)) { |
| 14294 |
// empty mount (likely as component), create new root element |
| 14295 |
isInitialPatch = true; |
| 14296 |
createElm(vnode, insertedVnodeQueue); |
| 14297 |
} else { |
| 14298 |
var isRealElement = isDef(oldVnode.nodeType); |
| 14299 |
if (!isRealElement && sameVnode(oldVnode, vnode)) { |
| 14300 |
// patch existing root node |
| 14301 |
patchVnode(oldVnode, vnode, insertedVnodeQueue, null, null, removeOnly); |
| 14302 |
} else { |
| 14303 |
if (isRealElement) { |
| 14304 |
// mounting to a real element |
| 14305 |
// check if this is server-rendered content and if we can perform |
| 14306 |
// a successful hydration. |
| 14307 |
if (oldVnode.nodeType === 1 && oldVnode.hasAttribute(SSR_ATTR)) { |
| 14308 |
oldVnode.removeAttribute(SSR_ATTR); |
| 14309 |
hydrating = true; |
| 14310 |
} |
| 14311 |
if (isTrue(hydrating)) { |
| 14312 |
if (hydrate(oldVnode, vnode, insertedVnodeQueue)) { |
| 14313 |
invokeInsertHook(vnode, insertedVnodeQueue, true); |
| 14314 |
return oldVnode |
| 14315 |
} else if (true) { |
| 14316 |
warn( |
| 14317 |
'The client-side rendered virtual DOM tree is not matching ' + |
| 14318 |
'server-rendered content. This is likely caused by incorrect ' + |
| 14319 |
'HTML markup, for example nesting block-level elements inside ' + |
| 14320 |
'<p>, or missing <tbody>. Bailing hydration and performing ' + |
| 14321 |
'full client-side render.' |
| 14322 |
); |
| 14323 |
} |
| 14324 |
} |
| 14325 |
// either not server-rendered, or hydration failed. |
| 14326 |
// create an empty node and replace it |
| 14327 |
oldVnode = emptyNodeAt(oldVnode); |
| 14328 |
} |
| 14329 |
|
| 14330 |
// replacing existing element |
| 14331 |
var oldElm = oldVnode.elm; |
| 14332 |
var parentElm = nodeOps.parentNode(oldElm); |
| 14333 |
|
| 14334 |
// create new node |
| 14335 |
createElm( |
| 14336 |
vnode, |
| 14337 |
insertedVnodeQueue, |
| 14338 |
// extremely rare edge case: do not insert if old element is in a |
| 14339 |
// leaving transition. Only happens when combining transition + |
| 14340 |
// keep-alive + HOCs. (#4590) |
| 14341 |
oldElm._leaveCb ? null : parentElm, |
| 14342 |
nodeOps.nextSibling(oldElm) |
| 14343 |
); |
| 14344 |
|
| 14345 |
// update parent placeholder node element, recursively |
| 14346 |
if (isDef(vnode.parent)) { |
| 14347 |
var ancestor = vnode.parent; |
| 14348 |
var patchable = isPatchable(vnode); |
| 14349 |
while (ancestor) { |
| 14350 |
for (var i = 0; i < cbs.destroy.length; ++i) { |
| 14351 |
cbs.destroy[i](ancestor); |
| 14352 |
} |
| 14353 |
ancestor.elm = vnode.elm; |
| 14354 |
if (patchable) { |
| 14355 |
for (var i$1 = 0; i$1 < cbs.create.length; ++i$1) { |
| 14356 |
cbs.create[i$1](emptyNode, ancestor); |
| 14357 |
} |
| 14358 |
// #6513 |
| 14359 |
// invoke insert hooks that may have been merged by create hooks. |
| 14360 |
// e.g. for directives that uses the "inserted" hook. |
| 14361 |
var insert = ancestor.data.hook.insert; |
| 14362 |
if (insert.merged) { |
| 14363 |
// start at index 1 to avoid re-invoking component mounted hook |
| 14364 |
for (var i$2 = 1; i$2 < insert.fns.length; i$2++) { |
| 14365 |
insert.fns[i$2](); |
| 14366 |
} |
| 14367 |
} |
| 14368 |
} else { |
| 14369 |
registerRef(ancestor); |
| 14370 |
} |
| 14371 |
ancestor = ancestor.parent; |
| 14372 |
} |
| 14373 |
} |
| 14374 |
|
| 14375 |
// destroy old node |
| 14376 |
if (isDef(parentElm)) { |
| 14377 |
removeVnodes([oldVnode], 0, 0); |
| 14378 |
} else if (isDef(oldVnode.tag)) { |
| 14379 |
invokeDestroyHook(oldVnode); |
| 14380 |
} |
| 14381 |
} |
| 14382 |
} |
| 14383 |
|
| 14384 |
invokeInsertHook(vnode, insertedVnodeQueue, isInitialPatch); |
| 14385 |
return vnode.elm |
| 14386 |
} |
| 14387 |
} |
| 14388 |
|
| 14389 |
/* */ |
| 14390 |
|
| 14391 |
var directives = { |
| 14392 |
create: updateDirectives, |
| 14393 |
update: updateDirectives, |
| 14394 |
destroy: function unbindDirectives (vnode) { |
| 14395 |
updateDirectives(vnode, emptyNode); |
| 14396 |
} |
| 14397 |
}; |
| 14398 |
|
| 14399 |
function updateDirectives (oldVnode, vnode) { |
| 14400 |
if (oldVnode.data.directives || vnode.data.directives) { |
| 14401 |
_update(oldVnode, vnode); |
| 14402 |
} |
| 14403 |
} |
| 14404 |
|
| 14405 |
function _update (oldVnode, vnode) { |
| 14406 |
var isCreate = oldVnode === emptyNode; |
| 14407 |
var isDestroy = vnode === emptyNode; |
| 14408 |
var oldDirs = normalizeDirectives$1(oldVnode.data.directives, oldVnode.context); |
| 14409 |
var newDirs = normalizeDirectives$1(vnode.data.directives, vnode.context); |
| 14410 |
|
| 14411 |
var dirsWithInsert = []; |
| 14412 |
var dirsWithPostpatch = []; |
| 14413 |
|
| 14414 |
var key, oldDir, dir; |
| 14415 |
for (key in newDirs) { |
| 14416 |
oldDir = oldDirs[key]; |
| 14417 |
dir = newDirs[key]; |
| 14418 |
if (!oldDir) { |
| 14419 |
// new directive, bind |
| 14420 |
callHook$1(dir, 'bind', vnode, oldVnode); |
| 14421 |
if (dir.def && dir.def.inserted) { |
| 14422 |
dirsWithInsert.push(dir); |
| 14423 |
} |
| 14424 |
} else { |
| 14425 |
// existing directive, update |
| 14426 |
dir.oldValue = oldDir.value; |
| 14427 |
dir.oldArg = oldDir.arg; |
| 14428 |
callHook$1(dir, 'update', vnode, oldVnode); |
| 14429 |
if (dir.def && dir.def.componentUpdated) { |
| 14430 |
dirsWithPostpatch.push(dir); |
| 14431 |
} |
| 14432 |
} |
| 14433 |
} |
| 14434 |
|
| 14435 |
if (dirsWithInsert.length) { |
| 14436 |
var callInsert = function () { |
| 14437 |
for (var i = 0; i < dirsWithInsert.length; i++) { |
| 14438 |
callHook$1(dirsWithInsert[i], 'inserted', vnode, oldVnode); |
| 14439 |
} |
| 14440 |
}; |
| 14441 |
if (isCreate) { |
| 14442 |
mergeVNodeHook(vnode, 'insert', callInsert); |
| 14443 |
} else { |
| 14444 |
callInsert(); |
| 14445 |
} |
| 14446 |
} |
| 14447 |
|
| 14448 |
if (dirsWithPostpatch.length) { |
| 14449 |
mergeVNodeHook(vnode, 'postpatch', function () { |
| 14450 |
for (var i = 0; i < dirsWithPostpatch.length; i++) { |
| 14451 |
callHook$1(dirsWithPostpatch[i], 'componentUpdated', vnode, oldVnode); |
| 14452 |
} |
| 14453 |
}); |
| 14454 |
} |
| 14455 |
|
| 14456 |
if (!isCreate) { |
| 14457 |
for (key in oldDirs) { |
| 14458 |
if (!newDirs[key]) { |
| 14459 |
// no longer present, unbind |
| 14460 |
callHook$1(oldDirs[key], 'unbind', oldVnode, oldVnode, isDestroy); |
| 14461 |
} |
| 14462 |
} |
| 14463 |
} |
| 14464 |
} |
| 14465 |
|
| 14466 |
var emptyModifiers = Object.create(null); |
| 14467 |
|
| 14468 |
function normalizeDirectives$1 ( |
| 14469 |
dirs, |
| 14470 |
vm |
| 14471 |
) { |
| 14472 |
var res = Object.create(null); |
| 14473 |
if (!dirs) { |
| 14474 |
// $flow-disable-line |
| 14475 |
return res |
| 14476 |
} |
| 14477 |
var i, dir; |
| 14478 |
for (i = 0; i < dirs.length; i++) { |
| 14479 |
dir = dirs[i]; |
| 14480 |
if (!dir.modifiers) { |
| 14481 |
// $flow-disable-line |
| 14482 |
dir.modifiers = emptyModifiers; |
| 14483 |
} |
| 14484 |
res[getRawDirName(dir)] = dir; |
| 14485 |
dir.def = resolveAsset(vm.$options, 'directives', dir.name, true); |
| 14486 |
} |
| 14487 |
// $flow-disable-line |
| 14488 |
return res |
| 14489 |
} |
| 14490 |
|
| 14491 |
function getRawDirName (dir) { |
| 14492 |
return dir.rawName || ((dir.name) + "." + (Object.keys(dir.modifiers || {}).join('.'))) |
| 14493 |
} |
| 14494 |
|
| 14495 |
function callHook$1 (dir, hook, vnode, oldVnode, isDestroy) { |
| 14496 |
var fn = dir.def && dir.def[hook]; |
| 14497 |
if (fn) { |
| 14498 |
try { |
| 14499 |
fn(vnode.elm, dir, vnode, oldVnode, isDestroy); |
| 14500 |
} catch (e) { |
| 14501 |
handleError(e, vnode.context, ("directive " + (dir.name) + " " + hook + " hook")); |
| 14502 |
} |
| 14503 |
} |
| 14504 |
} |
| 14505 |
|
| 14506 |
var baseModules = [ |
| 14507 |
ref, |
| 14508 |
directives |
| 14509 |
]; |
| 14510 |
|
| 14511 |
/* */ |
| 14512 |
|
| 14513 |
function updateAttrs (oldVnode, vnode) { |
| 14514 |
var opts = vnode.componentOptions; |
| 14515 |
if (isDef(opts) && opts.Ctor.options.inheritAttrs === false) { |
| 14516 |
return |
| 14517 |
} |
| 14518 |
if (isUndef(oldVnode.data.attrs) && isUndef(vnode.data.attrs)) { |
| 14519 |
return |
| 14520 |
} |
| 14521 |
var key, cur, old; |
| 14522 |
var elm = vnode.elm; |
| 14523 |
var oldAttrs = oldVnode.data.attrs || {}; |
| 14524 |
var attrs = vnode.data.attrs || {}; |
| 14525 |
// clone observed objects, as the user probably wants to mutate it |
| 14526 |
if (isDef(attrs.__ob__)) { |
| 14527 |
attrs = vnode.data.attrs = extend({}, attrs); |
| 14528 |
} |
| 14529 |
|
| 14530 |
for (key in attrs) { |
| 14531 |
cur = attrs[key]; |
| 14532 |
old = oldAttrs[key]; |
| 14533 |
if (old !== cur) { |
| 14534 |
setAttr(elm, key, cur, vnode.data.pre); |
| 14535 |
} |
| 14536 |
} |
| 14537 |
// #4391: in IE9, setting type can reset value for input[type=radio] |
| 14538 |
// #6666: IE/Edge forces progress value down to 1 before setting a max |
| 14539 |
/* istanbul ignore if */ |
| 14540 |
if ((isIE || isEdge) && attrs.value !== oldAttrs.value) { |
| 14541 |
setAttr(elm, 'value', attrs.value); |
| 14542 |
} |
| 14543 |
for (key in oldAttrs) { |
| 14544 |
if (isUndef(attrs[key])) { |
| 14545 |
if (isXlink(key)) { |
| 14546 |
elm.removeAttributeNS(xlinkNS, getXlinkProp(key)); |
| 14547 |
} else if (!isEnumeratedAttr(key)) { |
| 14548 |
elm.removeAttribute(key); |
| 14549 |
} |
| 14550 |
} |
| 14551 |
} |
| 14552 |
} |
| 14553 |
|
| 14554 |
function setAttr (el, key, value, isInPre) { |
| 14555 |
if (isInPre || el.tagName.indexOf('-') > -1) { |
| 14556 |
baseSetAttr(el, key, value); |
| 14557 |
} else if (isBooleanAttr(key)) { |
| 14558 |
// set attribute for blank value |
| 14559 |
// e.g. <option disabled>Select one</option> |
| 14560 |
if (isFalsyAttrValue(value)) { |
| 14561 |
el.removeAttribute(key); |
| 14562 |
} else { |
| 14563 |
// technically allowfullscreen is a boolean attribute for <iframe>, |
| 14564 |
// but Flash expects a value of "true" when used on <embed> tag |
| 14565 |
value = key === 'allowfullscreen' && el.tagName === 'EMBED' |
| 14566 |
? 'true' |
| 14567 |
: key; |
| 14568 |
el.setAttribute(key, value); |
| 14569 |
} |
| 14570 |
} else if (isEnumeratedAttr(key)) { |
| 14571 |
el.setAttribute(key, convertEnumeratedValue(key, value)); |
| 14572 |
} else if (isXlink(key)) { |
| 14573 |
if (isFalsyAttrValue(value)) { |
| 14574 |
el.removeAttributeNS(xlinkNS, getXlinkProp(key)); |
| 14575 |
} else { |
| 14576 |
el.setAttributeNS(xlinkNS, key, value); |
| 14577 |
} |
| 14578 |
} else { |
| 14579 |
baseSetAttr(el, key, value); |
| 14580 |
} |
| 14581 |
} |
| 14582 |
|
| 14583 |
function baseSetAttr (el, key, value) { |
| 14584 |
if (isFalsyAttrValue(value)) { |
| 14585 |
el.removeAttribute(key); |
| 14586 |
} else { |
| 14587 |
// #7138: IE10 & 11 fires input event when setting placeholder on |
| 14588 |
// <textarea>... block the first input event and remove the blocker |
| 14589 |
// immediately. |
| 14590 |
/* istanbul ignore if */ |
| 14591 |
if ( |
| 14592 |
isIE && !isIE9 && |
| 14593 |
el.tagName === 'TEXTAREA' && |
| 14594 |
key === 'placeholder' && value !== '' && !el.__ieph |
| 14595 |
) { |
| 14596 |
var blocker = function (e) { |
| 14597 |
e.stopImmediatePropagation(); |
| 14598 |
el.removeEventListener('input', blocker); |
| 14599 |
}; |
| 14600 |
el.addEventListener('input', blocker); |
| 14601 |
// $flow-disable-line |
| 14602 |
el.__ieph = true; /* IE placeholder patched */ |
| 14603 |
} |
| 14604 |
el.setAttribute(key, value); |
| 14605 |
} |
| 14606 |
} |
| 14607 |
|
| 14608 |
var attrs = { |
| 14609 |
create: updateAttrs, |
| 14610 |
update: updateAttrs |
| 14611 |
}; |
| 14612 |
|
| 14613 |
/* */ |
| 14614 |
|
| 14615 |
function updateClass (oldVnode, vnode) { |
| 14616 |
var el = vnode.elm; |
| 14617 |
var data = vnode.data; |
| 14618 |
var oldData = oldVnode.data; |
| 14619 |
if ( |
| 14620 |
isUndef(data.staticClass) && |
| 14621 |
isUndef(data.class) && ( |
| 14622 |
isUndef(oldData) || ( |
| 14623 |
isUndef(oldData.staticClass) && |
| 14624 |
isUndef(oldData.class) |
| 14625 |
) |
| 14626 |
) |
| 14627 |
) { |
| 14628 |
return |
| 14629 |
} |
| 14630 |
|
| 14631 |
var cls = genClassForVnode(vnode); |
| 14632 |
|
| 14633 |
// handle transition classes |
| 14634 |
var transitionClass = el._transitionClasses; |
| 14635 |
if (isDef(transitionClass)) { |
| 14636 |
cls = concat(cls, stringifyClass(transitionClass)); |
| 14637 |
} |
| 14638 |
|
| 14639 |
// set the class |
| 14640 |
if (cls !== el._prevClass) { |
| 14641 |
el.setAttribute('class', cls); |
| 14642 |
el._prevClass = cls; |
| 14643 |
} |
| 14644 |
} |
| 14645 |
|
| 14646 |
var klass = { |
| 14647 |
create: updateClass, |
| 14648 |
update: updateClass |
| 14649 |
}; |
| 14650 |
|
| 14651 |
/* */ |
| 14652 |
|
| 14653 |
var validDivisionCharRE = /[\w).+\-_$\]]/; |
| 14654 |
|
| 14655 |
function parseFilters (exp) { |
| 14656 |
var inSingle = false; |
| 14657 |
var inDouble = false; |
| 14658 |
var inTemplateString = false; |
| 14659 |
var inRegex = false; |
| 14660 |
var curly = 0; |
| 14661 |
var square = 0; |
| 14662 |
var paren = 0; |
| 14663 |
var lastFilterIndex = 0; |
| 14664 |
var c, prev, i, expression, filters; |
| 14665 |
|
| 14666 |
for (i = 0; i < exp.length; i++) { |
| 14667 |
prev = c; |
| 14668 |
c = exp.charCodeAt(i); |
| 14669 |
if (inSingle) { |
| 14670 |
if (c === 0x27 && prev !== 0x5C) { inSingle = false; } |
| 14671 |
} else if (inDouble) { |
| 14672 |
if (c === 0x22 && prev !== 0x5C) { inDouble = false; } |
| 14673 |
} else if (inTemplateString) { |
| 14674 |
if (c === 0x60 && prev !== 0x5C) { inTemplateString = false; } |
| 14675 |
} else if (inRegex) { |
| 14676 |
if (c === 0x2f && prev !== 0x5C) { inRegex = false; } |
| 14677 |
} else if ( |
| 14678 |
c === 0x7C && // pipe |
| 14679 |
exp.charCodeAt(i + 1) !== 0x7C && |
| 14680 |
exp.charCodeAt(i - 1) !== 0x7C && |
| 14681 |
!curly && !square && !paren |
| 14682 |
) { |
| 14683 |
if (expression === undefined) { |
| 14684 |
// first filter, end of expression |
| 14685 |
lastFilterIndex = i + 1; |
| 14686 |
expression = exp.slice(0, i).trim(); |
| 14687 |
} else { |
| 14688 |
pushFilter(); |
| 14689 |
} |
| 14690 |
} else { |
| 14691 |
switch (c) { |
| 14692 |
case 0x22: inDouble = true; break // " |
| 14693 |
case 0x27: inSingle = true; break // ' |
| 14694 |
case 0x60: inTemplateString = true; break // ` |
| 14695 |
case 0x28: paren++; break // ( |
| 14696 |
case 0x29: paren--; break // ) |
| 14697 |
case 0x5B: square++; break // [ |
| 14698 |
case 0x5D: square--; break // ] |
| 14699 |
case 0x7B: curly++; break // { |
| 14700 |
case 0x7D: curly--; break // } |
| 14701 |
} |
| 14702 |
if (c === 0x2f) { // / |
| 14703 |
var j = i - 1; |
| 14704 |
var p = (void 0); |
| 14705 |
// find first non-whitespace prev char |
| 14706 |
for (; j >= 0; j--) { |
| 14707 |
p = exp.charAt(j); |
| 14708 |
if (p !== ' ') { break } |
| 14709 |
} |
| 14710 |
if (!p || !validDivisionCharRE.test(p)) { |
| 14711 |
inRegex = true; |
| 14712 |
} |
| 14713 |
} |
| 14714 |
} |
| 14715 |
} |
| 14716 |
|
| 14717 |
if (expression === undefined) { |
| 14718 |
expression = exp.slice(0, i).trim(); |
| 14719 |
} else if (lastFilterIndex !== 0) { |
| 14720 |
pushFilter(); |
| 14721 |
} |
| 14722 |
|
| 14723 |
function pushFilter () { |
| 14724 |
(filters || (filters = [])).push(exp.slice(lastFilterIndex, i).trim()); |
| 14725 |
lastFilterIndex = i + 1; |
| 14726 |
} |
| 14727 |
|
| 14728 |
if (filters) { |
| 14729 |
for (i = 0; i < filters.length; i++) { |
| 14730 |
expression = wrapFilter(expression, filters[i]); |
| 14731 |
} |
| 14732 |
} |
| 14733 |
|
| 14734 |
return expression |
| 14735 |
} |
| 14736 |
|
| 14737 |
function wrapFilter (exp, filter) { |
| 14738 |
var i = filter.indexOf('('); |
| 14739 |
if (i < 0) { |
| 14740 |
// _f: resolveFilter |
| 14741 |
return ("_f(\"" + filter + "\")(" + exp + ")") |
| 14742 |
} else { |
| 14743 |
var name = filter.slice(0, i); |
| 14744 |
var args = filter.slice(i + 1); |
| 14745 |
return ("_f(\"" + name + "\")(" + exp + (args !== ')' ? ',' + args : args)) |
| 14746 |
} |
| 14747 |
} |
| 14748 |
|
| 14749 |
/* */ |
| 14750 |
|
| 14751 |
|
| 14752 |
|
| 14753 |
/* eslint-disable no-unused-vars */ |
| 14754 |
function baseWarn (msg, range) { |
| 14755 |
console.error(("[Vue compiler]: " + msg)); |
| 14756 |
} |
| 14757 |
/* eslint-enable no-unused-vars */ |
| 14758 |
|
| 14759 |
function pluckModuleFunction ( |
| 14760 |
modules, |
| 14761 |
key |
| 14762 |
) { |
| 14763 |
return modules |
| 14764 |
? modules.map(function (m) { return m[key]; }).filter(function (_) { return _; }) |
| 14765 |
: [] |
| 14766 |
} |
| 14767 |
|
| 14768 |
function addProp (el, name, value, range, dynamic) { |
| 14769 |
(el.props || (el.props = [])).push(rangeSetItem({ name: name, value: value, dynamic: dynamic }, range)); |
| 14770 |
el.plain = false; |
| 14771 |
} |
| 14772 |
|
| 14773 |
function addAttr (el, name, value, range, dynamic) { |
| 14774 |
var attrs = dynamic |
| 14775 |
? (el.dynamicAttrs || (el.dynamicAttrs = [])) |
| 14776 |
: (el.attrs || (el.attrs = [])); |
| 14777 |
attrs.push(rangeSetItem({ name: name, value: value, dynamic: dynamic }, range)); |
| 14778 |
el.plain = false; |
| 14779 |
} |
| 14780 |
|
| 14781 |
// add a raw attr (use this in preTransforms) |
| 14782 |
function addRawAttr (el, name, value, range) { |
| 14783 |
el.attrsMap[name] = value; |
| 14784 |
el.attrsList.push(rangeSetItem({ name: name, value: value }, range)); |
| 14785 |
} |
| 14786 |
|
| 14787 |
function addDirective ( |
| 14788 |
el, |
| 14789 |
name, |
| 14790 |
rawName, |
| 14791 |
value, |
| 14792 |
arg, |
| 14793 |
isDynamicArg, |
| 14794 |
modifiers, |
| 14795 |
range |
| 14796 |
) { |
| 14797 |
(el.directives || (el.directives = [])).push(rangeSetItem({ |
| 14798 |
name: name, |
| 14799 |
rawName: rawName, |
| 14800 |
value: value, |
| 14801 |
arg: arg, |
| 14802 |
isDynamicArg: isDynamicArg, |
| 14803 |
modifiers: modifiers |
| 14804 |
}, range)); |
| 14805 |
el.plain = false; |
| 14806 |
} |
| 14807 |
|
| 14808 |
function prependModifierMarker (symbol, name, dynamic) { |
| 14809 |
return dynamic |
| 14810 |
? ("_p(" + name + ",\"" + symbol + "\")") |
| 14811 |
: symbol + name // mark the event as captured |
| 14812 |
} |
| 14813 |
|
| 14814 |
function addHandler ( |
| 14815 |
el, |
| 14816 |
name, |
| 14817 |
value, |
| 14818 |
modifiers, |
| 14819 |
important, |
| 14820 |
warn, |
| 14821 |
range, |
| 14822 |
dynamic |
| 14823 |
) { |
| 14824 |
modifiers = modifiers || emptyObject; |
| 14825 |
// warn prevent and passive modifier |
| 14826 |
/* istanbul ignore if */ |
| 14827 |
if ( |
| 14828 |
true && warn && |
| 14829 |
modifiers.prevent && modifiers.passive |
| 14830 |
) { |
| 14831 |
warn( |
| 14832 |
'passive and prevent can\'t be used together. ' + |
| 14833 |
'Passive handler can\'t prevent default event.', |
| 14834 |
range |
| 14835 |
); |
| 14836 |
} |
| 14837 |
|
| 14838 |
// normalize click.right and click.middle since they don't actually fire |
| 14839 |
// this is technically browser-specific, but at least for now browsers are |
| 14840 |
// the only target envs that have right/middle clicks. |
| 14841 |
if (modifiers.right) { |
| 14842 |
if (dynamic) { |
| 14843 |
name = "(" + name + ")==='click'?'contextmenu':(" + name + ")"; |
| 14844 |
} else if (name === 'click') { |
| 14845 |
name = 'contextmenu'; |
| 14846 |
delete modifiers.right; |
| 14847 |
} |
| 14848 |
} else if (modifiers.middle) { |
| 14849 |
if (dynamic) { |
| 14850 |
name = "(" + name + ")==='click'?'mouseup':(" + name + ")"; |
| 14851 |
} else if (name === 'click') { |
| 14852 |
name = 'mouseup'; |
| 14853 |
} |
| 14854 |
} |
| 14855 |
|
| 14856 |
// check capture modifier |
| 14857 |
if (modifiers.capture) { |
| 14858 |
delete modifiers.capture; |
| 14859 |
name = prependModifierMarker('!', name, dynamic); |
| 14860 |
} |
| 14861 |
if (modifiers.once) { |
| 14862 |
delete modifiers.once; |
| 14863 |
name = prependModifierMarker('~', name, dynamic); |
| 14864 |
} |
| 14865 |
/* istanbul ignore if */ |
| 14866 |
if (modifiers.passive) { |
| 14867 |
delete modifiers.passive; |
| 14868 |
name = prependModifierMarker('&', name, dynamic); |
| 14869 |
} |
| 14870 |
|
| 14871 |
var events; |
| 14872 |
if (modifiers.native) { |
| 14873 |
delete modifiers.native; |
| 14874 |
events = el.nativeEvents || (el.nativeEvents = {}); |
| 14875 |
} else { |
| 14876 |
events = el.events || (el.events = {}); |
| 14877 |
} |
| 14878 |
|
| 14879 |
var newHandler = rangeSetItem({ value: value.trim(), dynamic: dynamic }, range); |
| 14880 |
if (modifiers !== emptyObject) { |
| 14881 |
newHandler.modifiers = modifiers; |
| 14882 |
} |
| 14883 |
|
| 14884 |
var handlers = events[name]; |
| 14885 |
/* istanbul ignore if */ |
| 14886 |
if (Array.isArray(handlers)) { |
| 14887 |
important ? handlers.unshift(newHandler) : handlers.push(newHandler); |
| 14888 |
} else if (handlers) { |
| 14889 |
events[name] = important ? [newHandler, handlers] : [handlers, newHandler]; |
| 14890 |
} else { |
| 14891 |
events[name] = newHandler; |
| 14892 |
} |
| 14893 |
|
| 14894 |
el.plain = false; |
| 14895 |
} |
| 14896 |
|
| 14897 |
function getRawBindingAttr ( |
| 14898 |
el, |
| 14899 |
name |
| 14900 |
) { |
| 14901 |
return el.rawAttrsMap[':' + name] || |
| 14902 |
el.rawAttrsMap['v-bind:' + name] || |
| 14903 |
el.rawAttrsMap[name] |
| 14904 |
} |
| 14905 |
|
| 14906 |
function getBindingAttr ( |
| 14907 |
el, |
| 14908 |
name, |
| 14909 |
getStatic |
| 14910 |
) { |
| 14911 |
var dynamicValue = |
| 14912 |
getAndRemoveAttr(el, ':' + name) || |
| 14913 |
getAndRemoveAttr(el, 'v-bind:' + name); |
| 14914 |
if (dynamicValue != null) { |
| 14915 |
return parseFilters(dynamicValue) |
| 14916 |
} else if (getStatic !== false) { |
| 14917 |
var staticValue = getAndRemoveAttr(el, name); |
| 14918 |
if (staticValue != null) { |
| 14919 |
return JSON.stringify(staticValue) |
| 14920 |
} |
| 14921 |
} |
| 14922 |
} |
| 14923 |
|
| 14924 |
// note: this only removes the attr from the Array (attrsList) so that it |
| 14925 |
// doesn't get processed by processAttrs. |
| 14926 |
// By default it does NOT remove it from the map (attrsMap) because the map is |
| 14927 |
// needed during codegen. |
| 14928 |
function getAndRemoveAttr ( |
| 14929 |
el, |
| 14930 |
name, |
| 14931 |
removeFromMap |
| 14932 |
) { |
| 14933 |
var val; |
| 14934 |
if ((val = el.attrsMap[name]) != null) { |
| 14935 |
var list = el.attrsList; |
| 14936 |
for (var i = 0, l = list.length; i < l; i++) { |
| 14937 |
if (list[i].name === name) { |
| 14938 |
list.splice(i, 1); |
| 14939 |
break |
| 14940 |
} |
| 14941 |
} |
| 14942 |
} |
| 14943 |
if (removeFromMap) { |
| 14944 |
delete el.attrsMap[name]; |
| 14945 |
} |
| 14946 |
return val |
| 14947 |
} |
| 14948 |
|
| 14949 |
function getAndRemoveAttrByRegex ( |
| 14950 |
el, |
| 14951 |
name |
| 14952 |
) { |
| 14953 |
var list = el.attrsList; |
| 14954 |
for (var i = 0, l = list.length; i < l; i++) { |
| 14955 |
var attr = list[i]; |
| 14956 |
if (name.test(attr.name)) { |
| 14957 |
list.splice(i, 1); |
| 14958 |
return attr |
| 14959 |
} |
| 14960 |
} |
| 14961 |
} |
| 14962 |
|
| 14963 |
function rangeSetItem ( |
| 14964 |
item, |
| 14965 |
range |
| 14966 |
) { |
| 14967 |
if (range) { |
| 14968 |
if (range.start != null) { |
| 14969 |
item.start = range.start; |
| 14970 |
} |
| 14971 |
if (range.end != null) { |
| 14972 |
item.end = range.end; |
| 14973 |
} |
| 14974 |
} |
| 14975 |
return item |
| 14976 |
} |
| 14977 |
|
| 14978 |
/* */ |
| 14979 |
|
| 14980 |
/** |
| 14981 |
* Cross-platform code generation for component v-model |
| 14982 |
*/ |
| 14983 |
function genComponentModel ( |
| 14984 |
el, |
| 14985 |
value, |
| 14986 |
modifiers |
| 14987 |
) { |
| 14988 |
var ref = modifiers || {}; |
| 14989 |
var number = ref.number; |
| 14990 |
var trim = ref.trim; |
| 14991 |
|
| 14992 |
var baseValueExpression = '$$v'; |
| 14993 |
var valueExpression = baseValueExpression; |
| 14994 |
if (trim) { |
| 14995 |
valueExpression = |
| 14996 |
"(typeof " + baseValueExpression + " === 'string'" + |
| 14997 |
"? " + baseValueExpression + ".trim()" + |
| 14998 |
": " + baseValueExpression + ")"; |
| 14999 |
} |
| 15000 |
if (number) { |
| 15001 |
valueExpression = "_n(" + valueExpression + ")"; |
| 15002 |
} |
| 15003 |
var assignment = genAssignmentCode(value, valueExpression); |
| 15004 |
|
| 15005 |
el.model = { |
| 15006 |
value: ("(" + value + ")"), |
| 15007 |
expression: JSON.stringify(value), |
| 15008 |
callback: ("function (" + baseValueExpression + ") {" + assignment + "}") |
| 15009 |
}; |
| 15010 |
} |
| 15011 |
|
| 15012 |
/** |
| 15013 |
* Cross-platform codegen helper for generating v-model value assignment code. |
| 15014 |
*/ |
| 15015 |
function genAssignmentCode ( |
| 15016 |
value, |
| 15017 |
assignment |
| 15018 |
) { |
| 15019 |
var res = parseModel(value); |
| 15020 |
if (res.key === null) { |
| 15021 |
return (value + "=" + assignment) |
| 15022 |
} else { |
| 15023 |
return ("$set(" + (res.exp) + ", " + (res.key) + ", " + assignment + ")") |
| 15024 |
} |
| 15025 |
} |
| 15026 |
|
| 15027 |
/** |
| 15028 |
* Parse a v-model expression into a base path and a final key segment. |
| 15029 |
* Handles both dot-path and possible square brackets. |
| 15030 |
* |
| 15031 |
* Possible cases: |
| 15032 |
* |
| 15033 |
* - test |
| 15034 |
* - test[key] |
| 15035 |
* - test[test1[key]] |
| 15036 |
* - test["a"][key] |
| 15037 |
* - xxx.test[a[a].test1[key]] |
| 15038 |
* - test.xxx.a["asa"][test1[key]] |
| 15039 |
* |
| 15040 |
*/ |
| 15041 |
|
| 15042 |
var len, str, chr, index$1, expressionPos, expressionEndPos; |
| 15043 |
|
| 15044 |
|
| 15045 |
|
| 15046 |
function parseModel (val) { |
| 15047 |
// Fix https://github.com/vuejs/vue/pull/7730 |
| 15048 |
// allow v-model="obj.val " (trailing whitespace) |
| 15049 |
val = val.trim(); |
| 15050 |
len = val.length; |
| 15051 |
|
| 15052 |
if (val.indexOf('[') < 0 || val.lastIndexOf(']') < len - 1) { |
| 15053 |
index$1 = val.lastIndexOf('.'); |
| 15054 |
if (index$1 > -1) { |
| 15055 |
return { |
| 15056 |
exp: val.slice(0, index$1), |
| 15057 |
key: '"' + val.slice(index$1 + 1) + '"' |
| 15058 |
} |
| 15059 |
} else { |
| 15060 |
return { |
| 15061 |
exp: val, |
| 15062 |
key: null |
| 15063 |
} |
| 15064 |
} |
| 15065 |
} |
| 15066 |
|
| 15067 |
str = val; |
| 15068 |
index$1 = expressionPos = expressionEndPos = 0; |
| 15069 |
|
| 15070 |
while (!eof()) { |
| 15071 |
chr = next(); |
| 15072 |
/* istanbul ignore if */ |
| 15073 |
if (isStringStart(chr)) { |
| 15074 |
parseString(chr); |
| 15075 |
} else if (chr === 0x5B) { |
| 15076 |
parseBracket(chr); |
| 15077 |
} |
| 15078 |
} |
| 15079 |
|
| 15080 |
return { |
| 15081 |
exp: val.slice(0, expressionPos), |
| 15082 |
key: val.slice(expressionPos + 1, expressionEndPos) |
| 15083 |
} |
| 15084 |
} |
| 15085 |
|
| 15086 |
function next () { |
| 15087 |
return str.charCodeAt(++index$1) |
| 15088 |
} |
| 15089 |
|
| 15090 |
function eof () { |
| 15091 |
return index$1 >= len |
| 15092 |
} |
| 15093 |
|
| 15094 |
function isStringStart (chr) { |
| 15095 |
return chr === 0x22 || chr === 0x27 |
| 15096 |
} |
| 15097 |
|
| 15098 |
function parseBracket (chr) { |
| 15099 |
var inBracket = 1; |
| 15100 |
expressionPos = index$1; |
| 15101 |
while (!eof()) { |
| 15102 |
chr = next(); |
| 15103 |
if (isStringStart(chr)) { |
| 15104 |
parseString(chr); |
| 15105 |
continue |
| 15106 |
} |
| 15107 |
if (chr === 0x5B) { inBracket++; } |
| 15108 |
if (chr === 0x5D) { inBracket--; } |
| 15109 |
if (inBracket === 0) { |
| 15110 |
expressionEndPos = index$1; |
| 15111 |
break |
| 15112 |
} |
| 15113 |
} |
| 15114 |
} |
| 15115 |
|
| 15116 |
function parseString (chr) { |
| 15117 |
var stringQuote = chr; |
| 15118 |
while (!eof()) { |
| 15119 |
chr = next(); |
| 15120 |
if (chr === stringQuote) { |
| 15121 |
break |
| 15122 |
} |
| 15123 |
} |
| 15124 |
} |
| 15125 |
|
| 15126 |
/* */ |
| 15127 |
|
| 15128 |
var warn$1; |
| 15129 |
|
| 15130 |
// in some cases, the event used has to be determined at runtime |
| 15131 |
// so we used some reserved tokens during compile. |
| 15132 |
var RANGE_TOKEN = '__r'; |
| 15133 |
var CHECKBOX_RADIO_TOKEN = '__c'; |
| 15134 |
|
| 15135 |
function model ( |
| 15136 |
el, |
| 15137 |
dir, |
| 15138 |
_warn |
| 15139 |
) { |
| 15140 |
warn$1 = _warn; |
| 15141 |
var value = dir.value; |
| 15142 |
var modifiers = dir.modifiers; |
| 15143 |
var tag = el.tag; |
| 15144 |
var type = el.attrsMap.type; |
| 15145 |
|
| 15146 |
if (true) { |
| 15147 |
// inputs with type="file" are read only and setting the input's |
| 15148 |
// value will throw an error. |
| 15149 |
if (tag === 'input' && type === 'file') { |
| 15150 |
warn$1( |
| 15151 |
"<" + (el.tag) + " v-model=\"" + value + "\" type=\"file\">:\n" + |
| 15152 |
"File inputs are read only. Use a v-on:change listener instead.", |
| 15153 |
el.rawAttrsMap['v-model'] |
| 15154 |
); |
| 15155 |
} |
| 15156 |
} |
| 15157 |
|
| 15158 |
if (el.component) { |
| 15159 |
genComponentModel(el, value, modifiers); |
| 15160 |
// component v-model doesn't need extra runtime |
| 15161 |
return false |
| 15162 |
} else if (tag === 'select') { |
| 15163 |
genSelect(el, value, modifiers); |
| 15164 |
} else if (tag === 'input' && type === 'checkbox') { |
| 15165 |
genCheckboxModel(el, value, modifiers); |
| 15166 |
} else if (tag === 'input' && type === 'radio') { |
| 15167 |
genRadioModel(el, value, modifiers); |
| 15168 |
} else if (tag === 'input' || tag === 'textarea') { |
| 15169 |
genDefaultModel(el, value, modifiers); |
| 15170 |
} else if (!config.isReservedTag(tag)) { |
| 15171 |
genComponentModel(el, value, modifiers); |
| 15172 |
// component v-model doesn't need extra runtime |
| 15173 |
return false |
| 15174 |
} else if (true) { |
| 15175 |
warn$1( |
| 15176 |
"<" + (el.tag) + " v-model=\"" + value + "\">: " + |
| 15177 |
"v-model is not supported on this element type. " + |
| 15178 |
'If you are working with contenteditable, it\'s recommended to ' + |
| 15179 |
'wrap a library dedicated for that purpose inside a custom component.', |
| 15180 |
el.rawAttrsMap['v-model'] |
| 15181 |
); |
| 15182 |
} |
| 15183 |
|
| 15184 |
// ensure runtime directive metadata |
| 15185 |
return true |
| 15186 |
} |
| 15187 |
|
| 15188 |
function genCheckboxModel ( |
| 15189 |
el, |
| 15190 |
value, |
| 15191 |
modifiers |
| 15192 |
) { |
| 15193 |
var number = modifiers && modifiers.number; |
| 15194 |
var valueBinding = getBindingAttr(el, 'value') || 'null'; |
| 15195 |
var trueValueBinding = getBindingAttr(el, 'true-value') || 'true'; |
| 15196 |
var falseValueBinding = getBindingAttr(el, 'false-value') || 'false'; |
| 15197 |
addProp(el, 'checked', |
| 15198 |
"Array.isArray(" + value + ")" + |
| 15199 |
"?_i(" + value + "," + valueBinding + ")>-1" + ( |
| 15200 |
trueValueBinding === 'true' |
| 15201 |
? (":(" + value + ")") |
| 15202 |
: (":_q(" + value + "," + trueValueBinding + ")") |
| 15203 |
) |
| 15204 |
); |
| 15205 |
addHandler(el, 'change', |
| 15206 |
"var $$a=" + value + "," + |
| 15207 |
'$$el=$event.target,' + |
| 15208 |
"$$c=$$el.checked?(" + trueValueBinding + "):(" + falseValueBinding + ");" + |
| 15209 |
'if(Array.isArray($$a)){' + |
| 15210 |
"var $$v=" + (number ? '_n(' + valueBinding + ')' : valueBinding) + "," + |
| 15211 |
'$$i=_i($$a,$$v);' + |
| 15212 |
"if($$el.checked){$$i<0&&(" + (genAssignmentCode(value, '$$a.concat([$$v])')) + ")}" + |
| 15213 |
"else{$$i>-1&&(" + (genAssignmentCode(value, '$$a.slice(0,$$i).concat($$a.slice($$i+1))')) + ")}" + |
| 15214 |
"}else{" + (genAssignmentCode(value, '$$c')) + "}", |
| 15215 |
null, true |
| 15216 |
); |
| 15217 |
} |
| 15218 |
|
| 15219 |
function genRadioModel ( |
| 15220 |
el, |
| 15221 |
value, |
| 15222 |
modifiers |
| 15223 |
) { |
| 15224 |
var number = modifiers && modifiers.number; |
| 15225 |
var valueBinding = getBindingAttr(el, 'value') || 'null'; |
| 15226 |
valueBinding = number ? ("_n(" + valueBinding + ")") : valueBinding; |
| 15227 |
addProp(el, 'checked', ("_q(" + value + "," + valueBinding + ")")); |
| 15228 |
addHandler(el, 'change', genAssignmentCode(value, valueBinding), null, true); |
| 15229 |
} |
| 15230 |
|
| 15231 |
function genSelect ( |
| 15232 |
el, |
| 15233 |
value, |
| 15234 |
modifiers |
| 15235 |
) { |
| 15236 |
var number = modifiers && modifiers.number; |
| 15237 |
var selectedVal = "Array.prototype.filter" + |
| 15238 |
".call($event.target.options,function(o){return o.selected})" + |
| 15239 |
".map(function(o){var val = \"_value\" in o ? o._value : o.value;" + |
| 15240 |
"return " + (number ? '_n(val)' : 'val') + "})"; |
| 15241 |
|
| 15242 |
var assignment = '$event.target.multiple ? $$selectedVal : $$selectedVal[0]'; |
| 15243 |
var code = "var $$selectedVal = " + selectedVal + ";"; |
| 15244 |
code = code + " " + (genAssignmentCode(value, assignment)); |
| 15245 |
addHandler(el, 'change', code, null, true); |
| 15246 |
} |
| 15247 |
|
| 15248 |
function genDefaultModel ( |
| 15249 |
el, |
| 15250 |
value, |
| 15251 |
modifiers |
| 15252 |
) { |
| 15253 |
var type = el.attrsMap.type; |
| 15254 |
|
| 15255 |
// warn if v-bind:value conflicts with v-model |
| 15256 |
// except for inputs with v-bind:type |
| 15257 |
if (true) { |
| 15258 |
var value$1 = el.attrsMap['v-bind:value'] || el.attrsMap[':value']; |
| 15259 |
var typeBinding = el.attrsMap['v-bind:type'] || el.attrsMap[':type']; |
| 15260 |
if (value$1 && !typeBinding) { |
| 15261 |
var binding = el.attrsMap['v-bind:value'] ? 'v-bind:value' : ':value'; |
| 15262 |
warn$1( |
| 15263 |
binding + "=\"" + value$1 + "\" conflicts with v-model on the same element " + |
| 15264 |
'because the latter already expands to a value binding internally', |
| 15265 |
el.rawAttrsMap[binding] |
| 15266 |
); |
| 15267 |
} |
| 15268 |
} |
| 15269 |
|
| 15270 |
var ref = modifiers || {}; |
| 15271 |
var lazy = ref.lazy; |
| 15272 |
var number = ref.number; |
| 15273 |
var trim = ref.trim; |
| 15274 |
var needCompositionGuard = !lazy && type !== 'range'; |
| 15275 |
var event = lazy |
| 15276 |
? 'change' |
| 15277 |
: type === 'range' |
| 15278 |
? RANGE_TOKEN |
| 15279 |
: 'input'; |
| 15280 |
|
| 15281 |
var valueExpression = '$event.target.value'; |
| 15282 |
if (trim) { |
| 15283 |
valueExpression = "$event.target.value.trim()"; |
| 15284 |
} |
| 15285 |
if (number) { |
| 15286 |
valueExpression = "_n(" + valueExpression + ")"; |
| 15287 |
} |
| 15288 |
|
| 15289 |
var code = genAssignmentCode(value, valueExpression); |
| 15290 |
if (needCompositionGuard) { |
| 15291 |
code = "if($event.target.composing)return;" + code; |
| 15292 |
} |
| 15293 |
|
| 15294 |
addProp(el, 'value', ("(" + value + ")")); |
| 15295 |
addHandler(el, event, code, null, true); |
| 15296 |
if (trim || number) { |
| 15297 |
addHandler(el, 'blur', '$forceUpdate()'); |
| 15298 |
} |
| 15299 |
} |
| 15300 |
|
| 15301 |
/* */ |
| 15302 |
|
| 15303 |
// normalize v-model event tokens that can only be determined at runtime. |
| 15304 |
// it's important to place the event as the first in the array because |
| 15305 |
// the whole point is ensuring the v-model callback gets called before |
| 15306 |
// user-attached handlers. |
| 15307 |
function normalizeEvents (on) { |
| 15308 |
/* istanbul ignore if */ |
| 15309 |
if (isDef(on[RANGE_TOKEN])) { |
| 15310 |
// IE input[type=range] only supports `change` event |
| 15311 |
var event = isIE ? 'change' : 'input'; |
| 15312 |
on[event] = [].concat(on[RANGE_TOKEN], on[event] || []); |
| 15313 |
delete on[RANGE_TOKEN]; |
| 15314 |
} |
| 15315 |
// This was originally intended to fix #4521 but no longer necessary |
| 15316 |
// after 2.5. Keeping it for backwards compat with generated code from < 2.4 |
| 15317 |
/* istanbul ignore if */ |
| 15318 |
if (isDef(on[CHECKBOX_RADIO_TOKEN])) { |
| 15319 |
on.change = [].concat(on[CHECKBOX_RADIO_TOKEN], on.change || []); |
| 15320 |
delete on[CHECKBOX_RADIO_TOKEN]; |
| 15321 |
} |
| 15322 |
} |
| 15323 |
|
| 15324 |
var target$1; |
| 15325 |
|
| 15326 |
function createOnceHandler$1 (event, handler, capture) { |
| 15327 |
var _target = target$1; // save current target element in closure |
| 15328 |
return function onceHandler () { |
| 15329 |
var res = handler.apply(null, arguments); |
| 15330 |
if (res !== null) { |
| 15331 |
remove$2(event, onceHandler, capture, _target); |
| 15332 |
} |
| 15333 |
} |
| 15334 |
} |
| 15335 |
|
| 15336 |
// #9446: Firefox <= 53 (in particular, ESR 52) has incorrect Event.timeStamp |
| 15337 |
// implementation and does not fire microtasks in between event propagation, so |
| 15338 |
// safe to exclude. |
| 15339 |
var useMicrotaskFix = isUsingMicroTask && !(isFF && Number(isFF[1]) <= 53); |
| 15340 |
|
| 15341 |
function add$1 ( |
| 15342 |
name, |
| 15343 |
handler, |
| 15344 |
capture, |
| 15345 |
passive |
| 15346 |
) { |
| 15347 |
// async edge case #6566: inner click event triggers patch, event handler |
| 15348 |
// attached to outer element during patch, and triggered again. This |
| 15349 |
// happens because browsers fire microtask ticks between event propagation. |
| 15350 |
// the solution is simple: we save the timestamp when a handler is attached, |
| 15351 |
// and the handler would only fire if the event passed to it was fired |
| 15352 |
// AFTER it was attached. |
| 15353 |
if (useMicrotaskFix) { |
| 15354 |
var attachedTimestamp = currentFlushTimestamp; |
| 15355 |
var original = handler; |
| 15356 |
handler = original._wrapper = function (e) { |
| 15357 |
if ( |
| 15358 |
// no bubbling, should always fire. |
| 15359 |
// this is just a safety net in case event.timeStamp is unreliable in |
| 15360 |
// certain weird environments... |
| 15361 |
e.target === e.currentTarget || |
| 15362 |
// event is fired after handler attachment |
| 15363 |
e.timeStamp >= attachedTimestamp || |
| 15364 |
// bail for environments that have buggy event.timeStamp implementations |
| 15365 |
// #9462 iOS 9 bug: event.timeStamp is 0 after history.pushState |
| 15366 |
// #9681 QtWebEngine event.timeStamp is negative value |
| 15367 |
e.timeStamp <= 0 || |
| 15368 |
// #9448 bail if event is fired in another document in a multi-page |
| 15369 |
// electron/nw.js app, since event.timeStamp will be using a different |
| 15370 |
// starting reference |
| 15371 |
e.target.ownerDocument !== document |
| 15372 |
) { |
| 15373 |
return original.apply(this, arguments) |
| 15374 |
} |
| 15375 |
}; |
| 15376 |
} |
| 15377 |
target$1.addEventListener( |
| 15378 |
name, |
| 15379 |
handler, |
| 15380 |
supportsPassive |
| 15381 |
? { capture: capture, passive: passive } |
| 15382 |
: capture |
| 15383 |
); |
| 15384 |
} |
| 15385 |
|
| 15386 |
function remove$2 ( |
| 15387 |
name, |
| 15388 |
handler, |
| 15389 |
capture, |
| 15390 |
_target |
| 15391 |
) { |
| 15392 |
(_target || target$1).removeEventListener( |
| 15393 |
name, |
| 15394 |
handler._wrapper || handler, |
| 15395 |
capture |
| 15396 |
); |
| 15397 |
} |
| 15398 |
|
| 15399 |
function updateDOMListeners (oldVnode, vnode) { |
| 15400 |
if (isUndef(oldVnode.data.on) && isUndef(vnode.data.on)) { |
| 15401 |
return |
| 15402 |
} |
| 15403 |
var on = vnode.data.on || {}; |
| 15404 |
var oldOn = oldVnode.data.on || {}; |
| 15405 |
target$1 = vnode.elm; |
| 15406 |
normalizeEvents(on); |
| 15407 |
updateListeners(on, oldOn, add$1, remove$2, createOnceHandler$1, vnode.context); |
| 15408 |
target$1 = undefined; |
| 15409 |
} |
| 15410 |
|
| 15411 |
var events = { |
| 15412 |
create: updateDOMListeners, |
| 15413 |
update: updateDOMListeners |
| 15414 |
}; |
| 15415 |
|
| 15416 |
/* */ |
| 15417 |
|
| 15418 |
var svgContainer; |
| 15419 |
|
| 15420 |
function updateDOMProps (oldVnode, vnode) { |
| 15421 |
if (isUndef(oldVnode.data.domProps) && isUndef(vnode.data.domProps)) { |
| 15422 |
return |
| 15423 |
} |
| 15424 |
var key, cur; |
| 15425 |
var elm = vnode.elm; |
| 15426 |
var oldProps = oldVnode.data.domProps || {}; |
| 15427 |
var props = vnode.data.domProps || {}; |
| 15428 |
// clone observed objects, as the user probably wants to mutate it |
| 15429 |
if (isDef(props.__ob__)) { |
| 15430 |
props = vnode.data.domProps = extend({}, props); |
| 15431 |
} |
| 15432 |
|
| 15433 |
for (key in oldProps) { |
| 15434 |
if (!(key in props)) { |
| 15435 |
elm[key] = ''; |
| 15436 |
} |
| 15437 |
} |
| 15438 |
|
| 15439 |
for (key in props) { |
| 15440 |
cur = props[key]; |
| 15441 |
// ignore children if the node has textContent or innerHTML, |
| 15442 |
// as these will throw away existing DOM nodes and cause removal errors |
| 15443 |
// on subsequent patches (#3360) |
| 15444 |
if (key === 'textContent' || key === 'innerHTML') { |
| 15445 |
if (vnode.children) { vnode.children.length = 0; } |
| 15446 |
if (cur === oldProps[key]) { continue } |
| 15447 |
// #6601 work around Chrome version <= 55 bug where single textNode |
| 15448 |
// replaced by innerHTML/textContent retains its parentNode property |
| 15449 |
if (elm.childNodes.length === 1) { |
| 15450 |
elm.removeChild(elm.childNodes[0]); |
| 15451 |
} |
| 15452 |
} |
| 15453 |
|
| 15454 |
if (key === 'value' && elm.tagName !== 'PROGRESS') { |
| 15455 |
// store value as _value as well since |
| 15456 |
// non-string values will be stringified |
| 15457 |
elm._value = cur; |
| 15458 |
// avoid resetting cursor position when value is the same |
| 15459 |
var strCur = isUndef(cur) ? '' : String(cur); |
| 15460 |
if (shouldUpdateValue(elm, strCur)) { |
| 15461 |
elm.value = strCur; |
| 15462 |
} |
| 15463 |
} else if (key === 'innerHTML' && isSVG(elm.tagName) && isUndef(elm.innerHTML)) { |
| 15464 |
// IE doesn't support innerHTML for SVG elements |
| 15465 |
svgContainer = svgContainer || document.createElement('div'); |
| 15466 |
svgContainer.innerHTML = "<svg>" + cur + "</svg>"; |
| 15467 |
var svg = svgContainer.firstChild; |
| 15468 |
while (elm.firstChild) { |
| 15469 |
elm.removeChild(elm.firstChild); |
| 15470 |
} |
| 15471 |
while (svg.firstChild) { |
| 15472 |
elm.appendChild(svg.firstChild); |
| 15473 |
} |
| 15474 |
} else if ( |
| 15475 |
// skip the update if old and new VDOM state is the same. |
| 15476 |
// `value` is handled separately because the DOM value may be temporarily |
| 15477 |
// out of sync with VDOM state due to focus, composition and modifiers. |
| 15478 |
// This #4521 by skipping the unnecessary `checked` update. |
| 15479 |
cur !== oldProps[key] |
| 15480 |
) { |
| 15481 |
// some property updates can throw |
| 15482 |
// e.g. `value` on <progress> w/ non-finite value |
| 15483 |
try { |
| 15484 |
elm[key] = cur; |
| 15485 |
} catch (e) {} |
| 15486 |
} |
| 15487 |
} |
| 15488 |
} |
| 15489 |
|
| 15490 |
// check platforms/web/util/attrs.js acceptValue |
| 15491 |
|
| 15492 |
|
| 15493 |
function shouldUpdateValue (elm, checkVal) { |
| 15494 |
return (!elm.composing && ( |
| 15495 |
elm.tagName === 'OPTION' || |
| 15496 |
isNotInFocusAndDirty(elm, checkVal) || |
| 15497 |
isDirtyWithModifiers(elm, checkVal) |
| 15498 |
)) |
| 15499 |
} |
| 15500 |
|
| 15501 |
function isNotInFocusAndDirty (elm, checkVal) { |
| 15502 |
// return true when textbox (.number and .trim) loses focus and its value is |
| 15503 |
// not equal to the updated value |
| 15504 |
var notInFocus = true; |
| 15505 |
// #6157 |
| 15506 |
// work around IE bug when accessing document.activeElement in an iframe |
| 15507 |
try { notInFocus = document.activeElement !== elm; } catch (e) {} |
| 15508 |
return notInFocus && elm.value !== checkVal |
| 15509 |
} |
| 15510 |
|
| 15511 |
function isDirtyWithModifiers (elm, newVal) { |
| 15512 |
var value = elm.value; |
| 15513 |
var modifiers = elm._vModifiers; // injected by v-model runtime |
| 15514 |
if (isDef(modifiers)) { |
| 15515 |
if (modifiers.number) { |
| 15516 |
return toNumber(value) !== toNumber(newVal) |
| 15517 |
} |
| 15518 |
if (modifiers.trim) { |
| 15519 |
return value.trim() !== newVal.trim() |
| 15520 |
} |
| 15521 |
} |
| 15522 |
return value !== newVal |
| 15523 |
} |
| 15524 |
|
| 15525 |
var domProps = { |
| 15526 |
create: updateDOMProps, |
| 15527 |
update: updateDOMProps |
| 15528 |
}; |
| 15529 |
|
| 15530 |
/* */ |
| 15531 |
|
| 15532 |
var parseStyleText = cached(function (cssText) { |
| 15533 |
var res = {}; |
| 15534 |
var listDelimiter = /;(?![^(]*\))/g; |
| 15535 |
var propertyDelimiter = /:(.+)/; |
| 15536 |
cssText.split(listDelimiter).forEach(function (item) { |
| 15537 |
if (item) { |
| 15538 |
var tmp = item.split(propertyDelimiter); |
| 15539 |
tmp.length > 1 && (res[tmp[0].trim()] = tmp[1].trim()); |
| 15540 |
} |
| 15541 |
}); |
| 15542 |
return res |
| 15543 |
}); |
| 15544 |
|
| 15545 |
// merge static and dynamic style data on the same vnode |
| 15546 |
function normalizeStyleData (data) { |
| 15547 |
var style = normalizeStyleBinding(data.style); |
| 15548 |
// static style is pre-processed into an object during compilation |
| 15549 |
// and is always a fresh object, so it's safe to merge into it |
| 15550 |
return data.staticStyle |
| 15551 |
? extend(data.staticStyle, style) |
| 15552 |
: style |
| 15553 |
} |
| 15554 |
|
| 15555 |
// normalize possible array / string values into Object |
| 15556 |
function normalizeStyleBinding (bindingStyle) { |
| 15557 |
if (Array.isArray(bindingStyle)) { |
| 15558 |
return toObject(bindingStyle) |
| 15559 |
} |
| 15560 |
if (typeof bindingStyle === 'string') { |
| 15561 |
return parseStyleText(bindingStyle) |
| 15562 |
} |
| 15563 |
return bindingStyle |
| 15564 |
} |
| 15565 |
|
| 15566 |
/** |
| 15567 |
* parent component style should be after child's |
| 15568 |
* so that parent component's style could override it |
| 15569 |
*/ |
| 15570 |
function getStyle (vnode, checkChild) { |
| 15571 |
var res = {}; |
| 15572 |
var styleData; |
| 15573 |
|
| 15574 |
if (checkChild) { |
| 15575 |
var childNode = vnode; |
| 15576 |
while (childNode.componentInstance) { |
| 15577 |
childNode = childNode.componentInstance._vnode; |
| 15578 |
if ( |
| 15579 |
childNode && childNode.data && |
| 15580 |
(styleData = normalizeStyleData(childNode.data)) |
| 15581 |
) { |
| 15582 |
extend(res, styleData); |
| 15583 |
} |
| 15584 |
} |
| 15585 |
} |
| 15586 |
|
| 15587 |
if ((styleData = normalizeStyleData(vnode.data))) { |
| 15588 |
extend(res, styleData); |
| 15589 |
} |
| 15590 |
|
| 15591 |
var parentNode = vnode; |
| 15592 |
while ((parentNode = parentNode.parent)) { |
| 15593 |
if (parentNode.data && (styleData = normalizeStyleData(parentNode.data))) { |
| 15594 |
extend(res, styleData); |
| 15595 |
} |
| 15596 |
} |
| 15597 |
return res |
| 15598 |
} |
| 15599 |
|
| 15600 |
/* */ |
| 15601 |
|
| 15602 |
var cssVarRE = /^--/; |
| 15603 |
var importantRE = /\s*!important$/; |
| 15604 |
var setProp = function (el, name, val) { |
| 15605 |
/* istanbul ignore if */ |
| 15606 |
if (cssVarRE.test(name)) { |
| 15607 |
el.style.setProperty(name, val); |
| 15608 |
} else if (importantRE.test(val)) { |
| 15609 |
el.style.setProperty(hyphenate(name), val.replace(importantRE, ''), 'important'); |
| 15610 |
} else { |
| 15611 |
var normalizedName = normalize(name); |
| 15612 |
if (Array.isArray(val)) { |
| 15613 |
// Support values array created by autoprefixer, e.g. |
| 15614 |
// {display: ["-webkit-box", "-ms-flexbox", "flex"]} |
| 15615 |
// Set them one by one, and the browser will only set those it can recognize |
| 15616 |
for (var i = 0, len = val.length; i < len; i++) { |
| 15617 |
el.style[normalizedName] = val[i]; |
| 15618 |
} |
| 15619 |
} else { |
| 15620 |
el.style[normalizedName] = val; |
| 15621 |
} |
| 15622 |
} |
| 15623 |
}; |
| 15624 |
|
| 15625 |
var vendorNames = ['Webkit', 'Moz', 'ms']; |
| 15626 |
|
| 15627 |
var emptyStyle; |
| 15628 |
var normalize = cached(function (prop) { |
| 15629 |
emptyStyle = emptyStyle || document.createElement('div').style; |
| 15630 |
prop = camelize(prop); |
| 15631 |
if (prop !== 'filter' && (prop in emptyStyle)) { |
| 15632 |
return prop |
| 15633 |
} |
| 15634 |
var capName = prop.charAt(0).toUpperCase() + prop.slice(1); |
| 15635 |
for (var i = 0; i < vendorNames.length; i++) { |
| 15636 |
var name = vendorNames[i] + capName; |
| 15637 |
if (name in emptyStyle) { |
| 15638 |
return name |
| 15639 |
} |
| 15640 |
} |
| 15641 |
}); |
| 15642 |
|
| 15643 |
function updateStyle (oldVnode, vnode) { |
| 15644 |
var data = vnode.data; |
| 15645 |
var oldData = oldVnode.data; |
| 15646 |
|
| 15647 |
if (isUndef(data.staticStyle) && isUndef(data.style) && |
| 15648 |
isUndef(oldData.staticStyle) && isUndef(oldData.style) |
| 15649 |
) { |
| 15650 |
return |
| 15651 |
} |
| 15652 |
|
| 15653 |
var cur, name; |
| 15654 |
var el = vnode.elm; |
| 15655 |
var oldStaticStyle = oldData.staticStyle; |
| 15656 |
var oldStyleBinding = oldData.normalizedStyle || oldData.style || {}; |
| 15657 |
|
| 15658 |
// if static style exists, stylebinding already merged into it when doing normalizeStyleData |
| 15659 |
var oldStyle = oldStaticStyle || oldStyleBinding; |
| 15660 |
|
| 15661 |
var style = normalizeStyleBinding(vnode.data.style) || {}; |
| 15662 |
|
| 15663 |
// store normalized style under a different key for next diff |
| 15664 |
// make sure to clone it if it's reactive, since the user likely wants |
| 15665 |
// to mutate it. |
| 15666 |
vnode.data.normalizedStyle = isDef(style.__ob__) |
| 15667 |
? extend({}, style) |
| 15668 |
: style; |
| 15669 |
|
| 15670 |
var newStyle = getStyle(vnode, true); |
| 15671 |
|
| 15672 |
for (name in oldStyle) { |
| 15673 |
if (isUndef(newStyle[name])) { |
| 15674 |
setProp(el, name, ''); |
| 15675 |
} |
| 15676 |
} |
| 15677 |
for (name in newStyle) { |
| 15678 |
cur = newStyle[name]; |
| 15679 |
if (cur !== oldStyle[name]) { |
| 15680 |
// ie9 setting to null has no effect, must use empty string |
| 15681 |
setProp(el, name, cur == null ? '' : cur); |
| 15682 |
} |
| 15683 |
} |
| 15684 |
} |
| 15685 |
|
| 15686 |
var style = { |
| 15687 |
create: updateStyle, |
| 15688 |
update: updateStyle |
| 15689 |
}; |
| 15690 |
|
| 15691 |
/* */ |
| 15692 |
|
| 15693 |
var whitespaceRE = /\s+/; |
| 15694 |
|
| 15695 |
/** |
| 15696 |
* Add class with compatibility for SVG since classList is not supported on |
| 15697 |
* SVG elements in IE |
| 15698 |
*/ |
| 15699 |
function addClass (el, cls) { |
| 15700 |
/* istanbul ignore if */ |
| 15701 |
if (!cls || !(cls = cls.trim())) { |
| 15702 |
return |
| 15703 |
} |
| 15704 |
|
| 15705 |
/* istanbul ignore else */ |
| 15706 |
if (el.classList) { |
| 15707 |
if (cls.indexOf(' ') > -1) { |
| 15708 |
cls.split(whitespaceRE).forEach(function (c) { return el.classList.add(c); }); |
| 15709 |
} else { |
| 15710 |
el.classList.add(cls); |
| 15711 |
} |
| 15712 |
} else { |
| 15713 |
var cur = " " + (el.getAttribute('class') || '') + " "; |
| 15714 |
if (cur.indexOf(' ' + cls + ' ') < 0) { |
| 15715 |
el.setAttribute('class', (cur + cls).trim()); |
| 15716 |
} |
| 15717 |
} |
| 15718 |
} |
| 15719 |
|
| 15720 |
/** |
| 15721 |
* Remove class with compatibility for SVG since classList is not supported on |
| 15722 |
* SVG elements in IE |
| 15723 |
*/ |
| 15724 |
function removeClass (el, cls) { |
| 15725 |
/* istanbul ignore if */ |
| 15726 |
if (!cls || !(cls = cls.trim())) { |
| 15727 |
return |
| 15728 |
} |
| 15729 |
|
| 15730 |
/* istanbul ignore else */ |
| 15731 |
if (el.classList) { |
| 15732 |
if (cls.indexOf(' ') > -1) { |
| 15733 |
cls.split(whitespaceRE).forEach(function (c) { return el.classList.remove(c); }); |
| 15734 |
} else { |
| 15735 |
el.classList.remove(cls); |
| 15736 |
} |
| 15737 |
if (!el.classList.length) { |
| 15738 |
el.removeAttribute('class'); |
| 15739 |
} |
| 15740 |
} else { |
| 15741 |
var cur = " " + (el.getAttribute('class') || '') + " "; |
| 15742 |
var tar = ' ' + cls + ' '; |
| 15743 |
while (cur.indexOf(tar) >= 0) { |
| 15744 |
cur = cur.replace(tar, ' '); |
| 15745 |
} |
| 15746 |
cur = cur.trim(); |
| 15747 |
if (cur) { |
| 15748 |
el.setAttribute('class', cur); |
| 15749 |
} else { |
| 15750 |
el.removeAttribute('class'); |
| 15751 |
} |
| 15752 |
} |
| 15753 |
} |
| 15754 |
|
| 15755 |
/* */ |
| 15756 |
|
| 15757 |
function resolveTransition (def$$1) { |
| 15758 |
if (!def$$1) { |
| 15759 |
return |
| 15760 |
} |
| 15761 |
/* istanbul ignore else */ |
| 15762 |
if (typeof def$$1 === 'object') { |
| 15763 |
var res = {}; |
| 15764 |
if (def$$1.css !== false) { |
| 15765 |
extend(res, autoCssTransition(def$$1.name || 'v')); |
| 15766 |
} |
| 15767 |
extend(res, def$$1); |
| 15768 |
return res |
| 15769 |
} else if (typeof def$$1 === 'string') { |
| 15770 |
return autoCssTransition(def$$1) |
| 15771 |
} |
| 15772 |
} |
| 15773 |
|
| 15774 |
var autoCssTransition = cached(function (name) { |
| 15775 |
return { |
| 15776 |
enterClass: (name + "-enter"), |
| 15777 |
enterToClass: (name + "-enter-to"), |
| 15778 |
enterActiveClass: (name + "-enter-active"), |
| 15779 |
leaveClass: (name + "-leave"), |
| 15780 |
leaveToClass: (name + "-leave-to"), |
| 15781 |
leaveActiveClass: (name + "-leave-active") |
| 15782 |
} |
| 15783 |
}); |
| 15784 |
|
| 15785 |
var hasTransition = inBrowser && !isIE9; |
| 15786 |
var TRANSITION = 'transition'; |
| 15787 |
var ANIMATION = 'animation'; |
| 15788 |
|
| 15789 |
// Transition property/event sniffing |
| 15790 |
var transitionProp = 'transition'; |
| 15791 |
var transitionEndEvent = 'transitionend'; |
| 15792 |
var animationProp = 'animation'; |
| 15793 |
var animationEndEvent = 'animationend'; |
| 15794 |
if (hasTransition) { |
| 15795 |
/* istanbul ignore if */ |
| 15796 |
if (window.ontransitionend === undefined && |
| 15797 |
window.onwebkittransitionend !== undefined |
| 15798 |
) { |
| 15799 |
transitionProp = 'WebkitTransition'; |
| 15800 |
transitionEndEvent = 'webkitTransitionEnd'; |
| 15801 |
} |
| 15802 |
if (window.onanimationend === undefined && |
| 15803 |
window.onwebkitanimationend !== undefined |
| 15804 |
) { |
| 15805 |
animationProp = 'WebkitAnimation'; |
| 15806 |
animationEndEvent = 'webkitAnimationEnd'; |
| 15807 |
} |
| 15808 |
} |
| 15809 |
|
| 15810 |
// binding to window is necessary to make hot reload work in IE in strict mode |
| 15811 |
var raf = inBrowser |
| 15812 |
? window.requestAnimationFrame |
| 15813 |
? window.requestAnimationFrame.bind(window) |
| 15814 |
: setTimeout |
| 15815 |
: /* istanbul ignore next */ function (fn) { return fn(); }; |
| 15816 |
|
| 15817 |
function nextFrame (fn) { |
| 15818 |
raf(function () { |
| 15819 |
raf(fn); |
| 15820 |
}); |
| 15821 |
} |
| 15822 |
|
| 15823 |
function addTransitionClass (el, cls) { |
| 15824 |
var transitionClasses = el._transitionClasses || (el._transitionClasses = []); |
| 15825 |
if (transitionClasses.indexOf(cls) < 0) { |
| 15826 |
transitionClasses.push(cls); |
| 15827 |
addClass(el, cls); |
| 15828 |
} |
| 15829 |
} |
| 15830 |
|
| 15831 |
function removeTransitionClass (el, cls) { |
| 15832 |
if (el._transitionClasses) { |
| 15833 |
remove(el._transitionClasses, cls); |
| 15834 |
} |
| 15835 |
removeClass(el, cls); |
| 15836 |
} |
| 15837 |
|
| 15838 |
function whenTransitionEnds ( |
| 15839 |
el, |
| 15840 |
expectedType, |
| 15841 |
cb |
| 15842 |
) { |
| 15843 |
var ref = getTransitionInfo(el, expectedType); |
| 15844 |
var type = ref.type; |
| 15845 |
var timeout = ref.timeout; |
| 15846 |
var propCount = ref.propCount; |
| 15847 |
if (!type) { return cb() } |
| 15848 |
var event = type === TRANSITION ? transitionEndEvent : animationEndEvent; |
| 15849 |
var ended = 0; |
| 15850 |
var end = function () { |
| 15851 |
el.removeEventListener(event, onEnd); |
| 15852 |
cb(); |
| 15853 |
}; |
| 15854 |
var onEnd = function (e) { |
| 15855 |
if (e.target === el) { |
| 15856 |
if (++ended >= propCount) { |
| 15857 |
end(); |
| 15858 |
} |
| 15859 |
} |
| 15860 |
}; |
| 15861 |
setTimeout(function () { |
| 15862 |
if (ended < propCount) { |
| 15863 |
end(); |
| 15864 |
} |
| 15865 |
}, timeout + 1); |
| 15866 |
el.addEventListener(event, onEnd); |
| 15867 |
} |
| 15868 |
|
| 15869 |
var transformRE = /\b(transform|all)(,|$)/; |
| 15870 |
|
| 15871 |
function getTransitionInfo (el, expectedType) { |
| 15872 |
var styles = window.getComputedStyle(el); |
| 15873 |
// JSDOM may return undefined for transition properties |
| 15874 |
var transitionDelays = (styles[transitionProp + 'Delay'] || '').split(', '); |
| 15875 |
var transitionDurations = (styles[transitionProp + 'Duration'] || '').split(', '); |
| 15876 |
var transitionTimeout = getTimeout(transitionDelays, transitionDurations); |
| 15877 |
var animationDelays = (styles[animationProp + 'Delay'] || '').split(', '); |
| 15878 |
var animationDurations = (styles[animationProp + 'Duration'] || '').split(', '); |
| 15879 |
var animationTimeout = getTimeout(animationDelays, animationDurations); |
| 15880 |
|
| 15881 |
var type; |
| 15882 |
var timeout = 0; |
| 15883 |
var propCount = 0; |
| 15884 |
/* istanbul ignore if */ |
| 15885 |
if (expectedType === TRANSITION) { |
| 15886 |
if (transitionTimeout > 0) { |
| 15887 |
type = TRANSITION; |
| 15888 |
timeout = transitionTimeout; |
| 15889 |
propCount = transitionDurations.length; |
| 15890 |
} |
| 15891 |
} else if (expectedType === ANIMATION) { |
| 15892 |
if (animationTimeout > 0) { |
| 15893 |
type = ANIMATION; |
| 15894 |
timeout = animationTimeout; |
| 15895 |
propCount = animationDurations.length; |
| 15896 |
} |
| 15897 |
} else { |
| 15898 |
timeout = Math.max(transitionTimeout, animationTimeout); |
| 15899 |
type = timeout > 0 |
| 15900 |
? transitionTimeout > animationTimeout |
| 15901 |
? TRANSITION |
| 15902 |
: ANIMATION |
| 15903 |
: null; |
| 15904 |
propCount = type |
| 15905 |
? type === TRANSITION |
| 15906 |
? transitionDurations.length |
| 15907 |
: animationDurations.length |
| 15908 |
: 0; |
| 15909 |
} |
| 15910 |
var hasTransform = |
| 15911 |
type === TRANSITION && |
| 15912 |
transformRE.test(styles[transitionProp + 'Property']); |
| 15913 |
return { |
| 15914 |
type: type, |
| 15915 |
timeout: timeout, |
| 15916 |
propCount: propCount, |
| 15917 |
hasTransform: hasTransform |
| 15918 |
} |
| 15919 |
} |
| 15920 |
|
| 15921 |
function getTimeout (delays, durations) { |
| 15922 |
/* istanbul ignore next */ |
| 15923 |
while (delays.length < durations.length) { |
| 15924 |
delays = delays.concat(delays); |
| 15925 |
} |
| 15926 |
|
| 15927 |
return Math.max.apply(null, durations.map(function (d, i) { |
| 15928 |
return toMs(d) + toMs(delays[i]) |
| 15929 |
})) |
| 15930 |
} |
| 15931 |
|
| 15932 |
// Old versions of Chromium (below 61.0.3163.100) formats floating pointer numbers |
| 15933 |
// in a locale-dependent way, using a comma instead of a dot. |
| 15934 |
// If comma is not replaced with a dot, the input will be rounded down (i.e. acting |
| 15935 |
// as a floor function) causing unexpected behaviors |
| 15936 |
function toMs (s) { |
| 15937 |
return Number(s.slice(0, -1).replace(',', '.')) * 1000 |
| 15938 |
} |
| 15939 |
|
| 15940 |
/* */ |
| 15941 |
|
| 15942 |
function enter (vnode, toggleDisplay) { |
| 15943 |
var el = vnode.elm; |
| 15944 |
|
| 15945 |
// call leave callback now |
| 15946 |
if (isDef(el._leaveCb)) { |
| 15947 |
el._leaveCb.cancelled = true; |
| 15948 |
el._leaveCb(); |
| 15949 |
} |
| 15950 |
|
| 15951 |
var data = resolveTransition(vnode.data.transition); |
| 15952 |
if (isUndef(data)) { |
| 15953 |
return |
| 15954 |
} |
| 15955 |
|
| 15956 |
/* istanbul ignore if */ |
| 15957 |
if (isDef(el._enterCb) || el.nodeType !== 1) { |
| 15958 |
return |
| 15959 |
} |
| 15960 |
|
| 15961 |
var css = data.css; |
| 15962 |
var type = data.type; |
| 15963 |
var enterClass = data.enterClass; |
| 15964 |
var enterToClass = data.enterToClass; |
| 15965 |
var enterActiveClass = data.enterActiveClass; |
| 15966 |
var appearClass = data.appearClass; |
| 15967 |
var appearToClass = data.appearToClass; |
| 15968 |
var appearActiveClass = data.appearActiveClass; |
| 15969 |
var beforeEnter = data.beforeEnter; |
| 15970 |
var enter = data.enter; |
| 15971 |
var afterEnter = data.afterEnter; |
| 15972 |
var enterCancelled = data.enterCancelled; |
| 15973 |
var beforeAppear = data.beforeAppear; |
| 15974 |
var appear = data.appear; |
| 15975 |
var afterAppear = data.afterAppear; |
| 15976 |
var appearCancelled = data.appearCancelled; |
| 15977 |
var duration = data.duration; |
| 15978 |
|
| 15979 |
// activeInstance will always be the <transition> component managing this |
| 15980 |
// transition. One edge case to check is when the <transition> is placed |
| 15981 |
// as the root node of a child component. In that case we need to check |
| 15982 |
// <transition>'s parent for appear check. |
| 15983 |
var context = activeInstance; |
| 15984 |
var transitionNode = activeInstance.$vnode; |
| 15985 |
while (transitionNode && transitionNode.parent) { |
| 15986 |
context = transitionNode.context; |
| 15987 |
transitionNode = transitionNode.parent; |
| 15988 |
} |
| 15989 |
|
| 15990 |
var isAppear = !context._isMounted || !vnode.isRootInsert; |
| 15991 |
|
| 15992 |
if (isAppear && !appear && appear !== '') { |
| 15993 |
return |
| 15994 |
} |
| 15995 |
|
| 15996 |
var startClass = isAppear && appearClass |
| 15997 |
? appearClass |
| 15998 |
: enterClass; |
| 15999 |
var activeClass = isAppear && appearActiveClass |
| 16000 |
? appearActiveClass |
| 16001 |
: enterActiveClass; |
| 16002 |
var toClass = isAppear && appearToClass |
| 16003 |
? appearToClass |
| 16004 |
: enterToClass; |
| 16005 |
|
| 16006 |
var beforeEnterHook = isAppear |
| 16007 |
? (beforeAppear || beforeEnter) |
| 16008 |
: beforeEnter; |
| 16009 |
var enterHook = isAppear |
| 16010 |
? (typeof appear === 'function' ? appear : enter) |
| 16011 |
: enter; |
| 16012 |
var afterEnterHook = isAppear |
| 16013 |
? (afterAppear || afterEnter) |
| 16014 |
: afterEnter; |
| 16015 |
var enterCancelledHook = isAppear |
| 16016 |
? (appearCancelled || enterCancelled) |
| 16017 |
: enterCancelled; |
| 16018 |
|
| 16019 |
var explicitEnterDuration = toNumber( |
| 16020 |
isObject(duration) |
| 16021 |
? duration.enter |
| 16022 |
: duration |
| 16023 |
); |
| 16024 |
|
| 16025 |
if ( true && explicitEnterDuration != null) { |
| 16026 |
checkDuration(explicitEnterDuration, 'enter', vnode); |
| 16027 |
} |
| 16028 |
|
| 16029 |
var expectsCSS = css !== false && !isIE9; |
| 16030 |
var userWantsControl = getHookArgumentsLength(enterHook); |
| 16031 |
|
| 16032 |
var cb = el._enterCb = once(function () { |
| 16033 |
if (expectsCSS) { |
| 16034 |
removeTransitionClass(el, toClass); |
| 16035 |
removeTransitionClass(el, activeClass); |
| 16036 |
} |
| 16037 |
if (cb.cancelled) { |
| 16038 |
if (expectsCSS) { |
| 16039 |
removeTransitionClass(el, startClass); |
| 16040 |
} |
| 16041 |
enterCancelledHook && enterCancelledHook(el); |
| 16042 |
} else { |
| 16043 |
afterEnterHook && afterEnterHook(el); |
| 16044 |
} |
| 16045 |
el._enterCb = null; |
| 16046 |
}); |
| 16047 |
|
| 16048 |
if (!vnode.data.show) { |
| 16049 |
// remove pending leave element on enter by injecting an insert hook |
| 16050 |
mergeVNodeHook(vnode, 'insert', function () { |
| 16051 |
var parent = el.parentNode; |
| 16052 |
var pendingNode = parent && parent._pending && parent._pending[vnode.key]; |
| 16053 |
if (pendingNode && |
| 16054 |
pendingNode.tag === vnode.tag && |
| 16055 |
pendingNode.elm._leaveCb |
| 16056 |
) { |
| 16057 |
pendingNode.elm._leaveCb(); |
| 16058 |
} |
| 16059 |
enterHook && enterHook(el, cb); |
| 16060 |
}); |
| 16061 |
} |
| 16062 |
|
| 16063 |
// start enter transition |
| 16064 |
beforeEnterHook && beforeEnterHook(el); |
| 16065 |
if (expectsCSS) { |
| 16066 |
addTransitionClass(el, startClass); |
| 16067 |
addTransitionClass(el, activeClass); |
| 16068 |
nextFrame(function () { |
| 16069 |
removeTransitionClass(el, startClass); |
| 16070 |
if (!cb.cancelled) { |
| 16071 |
addTransitionClass(el, toClass); |
| 16072 |
if (!userWantsControl) { |
| 16073 |
if (isValidDuration(explicitEnterDuration)) { |
| 16074 |
setTimeout(cb, explicitEnterDuration); |
| 16075 |
} else { |
| 16076 |
whenTransitionEnds(el, type, cb); |
| 16077 |
} |
| 16078 |
} |
| 16079 |
} |
| 16080 |
}); |
| 16081 |
} |
| 16082 |
|
| 16083 |
if (vnode.data.show) { |
| 16084 |
toggleDisplay && toggleDisplay(); |
| 16085 |
enterHook && enterHook(el, cb); |
| 16086 |
} |
| 16087 |
|
| 16088 |
if (!expectsCSS && !userWantsControl) { |
| 16089 |
cb(); |
| 16090 |
} |
| 16091 |
} |
| 16092 |
|
| 16093 |
function leave (vnode, rm) { |
| 16094 |
var el = vnode.elm; |
| 16095 |
|
| 16096 |
// call enter callback now |
| 16097 |
if (isDef(el._enterCb)) { |
| 16098 |
el._enterCb.cancelled = true; |
| 16099 |
el._enterCb(); |
| 16100 |
} |
| 16101 |
|
| 16102 |
var data = resolveTransition(vnode.data.transition); |
| 16103 |
if (isUndef(data) || el.nodeType !== 1) { |
| 16104 |
return rm() |
| 16105 |
} |
| 16106 |
|
| 16107 |
/* istanbul ignore if */ |
| 16108 |
if (isDef(el._leaveCb)) { |
| 16109 |
return |
| 16110 |
} |
| 16111 |
|
| 16112 |
var css = data.css; |
| 16113 |
var type = data.type; |
| 16114 |
var leaveClass = data.leaveClass; |
| 16115 |
var leaveToClass = data.leaveToClass; |
| 16116 |
var leaveActiveClass = data.leaveActiveClass; |
| 16117 |
var beforeLeave = data.beforeLeave; |
| 16118 |
var leave = data.leave; |
| 16119 |
var afterLeave = data.afterLeave; |
| 16120 |
var leaveCancelled = data.leaveCancelled; |
| 16121 |
var delayLeave = data.delayLeave; |
| 16122 |
var duration = data.duration; |
| 16123 |
|
| 16124 |
var expectsCSS = css !== false && !isIE9; |
| 16125 |
var userWantsControl = getHookArgumentsLength(leave); |
| 16126 |
|
| 16127 |
var explicitLeaveDuration = toNumber( |
| 16128 |
isObject(duration) |
| 16129 |
? duration.leave |
| 16130 |
: duration |
| 16131 |
); |
| 16132 |
|
| 16133 |
if ( true && isDef(explicitLeaveDuration)) { |
| 16134 |
checkDuration(explicitLeaveDuration, 'leave', vnode); |
| 16135 |
} |
| 16136 |
|
| 16137 |
var cb = el._leaveCb = once(function () { |
| 16138 |
if (el.parentNode && el.parentNode._pending) { |
| 16139 |
el.parentNode._pending[vnode.key] = null; |
| 16140 |
} |
| 16141 |
if (expectsCSS) { |
| 16142 |
removeTransitionClass(el, leaveToClass); |
| 16143 |
removeTransitionClass(el, leaveActiveClass); |
| 16144 |
} |
| 16145 |
if (cb.cancelled) { |
| 16146 |
if (expectsCSS) { |
| 16147 |
removeTransitionClass(el, leaveClass); |
| 16148 |
} |
| 16149 |
leaveCancelled && leaveCancelled(el); |
| 16150 |
} else { |
| 16151 |
rm(); |
| 16152 |
afterLeave && afterLeave(el); |
| 16153 |
} |
| 16154 |
el._leaveCb = null; |
| 16155 |
}); |
| 16156 |
|
| 16157 |
if (delayLeave) { |
| 16158 |
delayLeave(performLeave); |
| 16159 |
} else { |
| 16160 |
performLeave(); |
| 16161 |
} |
| 16162 |
|
| 16163 |
function performLeave () { |
| 16164 |
// the delayed leave may have already been cancelled |
| 16165 |
if (cb.cancelled) { |
| 16166 |
return |
| 16167 |
} |
| 16168 |
// record leaving element |
| 16169 |
if (!vnode.data.show && el.parentNode) { |
| 16170 |
(el.parentNode._pending || (el.parentNode._pending = {}))[(vnode.key)] = vnode; |
| 16171 |
} |
| 16172 |
beforeLeave && beforeLeave(el); |
| 16173 |
if (expectsCSS) { |
| 16174 |
addTransitionClass(el, leaveClass); |
| 16175 |
addTransitionClass(el, leaveActiveClass); |
| 16176 |
nextFrame(function () { |
| 16177 |
removeTransitionClass(el, leaveClass); |
| 16178 |
if (!cb.cancelled) { |
| 16179 |
addTransitionClass(el, leaveToClass); |
| 16180 |
if (!userWantsControl) { |
| 16181 |
if (isValidDuration(explicitLeaveDuration)) { |
| 16182 |
setTimeout(cb, explicitLeaveDuration); |
| 16183 |
} else { |
| 16184 |
whenTransitionEnds(el, type, cb); |
| 16185 |
} |
| 16186 |
} |
| 16187 |
} |
| 16188 |
}); |
| 16189 |
} |
| 16190 |
leave && leave(el, cb); |
| 16191 |
if (!expectsCSS && !userWantsControl) { |
| 16192 |
cb(); |
| 16193 |
} |
| 16194 |
} |
| 16195 |
} |
| 16196 |
|
| 16197 |
// only used in dev mode |
| 16198 |
function checkDuration (val, name, vnode) { |
| 16199 |
if (typeof val !== 'number') { |
| 16200 |
warn( |
| 16201 |
"<transition> explicit " + name + " duration is not a valid number - " + |
| 16202 |
"got " + (JSON.stringify(val)) + ".", |
| 16203 |
vnode.context |
| 16204 |
); |
| 16205 |
} else if (isNaN(val)) { |
| 16206 |
warn( |
| 16207 |
"<transition> explicit " + name + " duration is NaN - " + |
| 16208 |
'the duration expression might be incorrect.', |
| 16209 |
vnode.context |
| 16210 |
); |
| 16211 |
} |
| 16212 |
} |
| 16213 |
|
| 16214 |
function isValidDuration (val) { |
| 16215 |
return typeof val === 'number' && !isNaN(val) |
| 16216 |
} |
| 16217 |
|
| 16218 |
/** |
| 16219 |
* Normalize a transition hook's argument length. The hook may be: |
| 16220 |
* - a merged hook (invoker) with the original in .fns |
| 16221 |
* - a wrapped component method (check ._length) |
| 16222 |
* - a plain function (.length) |
| 16223 |
*/ |
| 16224 |
function getHookArgumentsLength (fn) { |
| 16225 |
if (isUndef(fn)) { |
| 16226 |
return false |
| 16227 |
} |
| 16228 |
var invokerFns = fn.fns; |
| 16229 |
if (isDef(invokerFns)) { |
| 16230 |
// invoker |
| 16231 |
return getHookArgumentsLength( |
| 16232 |
Array.isArray(invokerFns) |
| 16233 |
? invokerFns[0] |
| 16234 |
: invokerFns |
| 16235 |
) |
| 16236 |
} else { |
| 16237 |
return (fn._length || fn.length) > 1 |
| 16238 |
} |
| 16239 |
} |
| 16240 |
|
| 16241 |
function _enter (_, vnode) { |
| 16242 |
if (vnode.data.show !== true) { |
| 16243 |
enter(vnode); |
| 16244 |
} |
| 16245 |
} |
| 16246 |
|
| 16247 |
var transition = inBrowser ? { |
| 16248 |
create: _enter, |
| 16249 |
activate: _enter, |
| 16250 |
remove: function remove$$1 (vnode, rm) { |
| 16251 |
/* istanbul ignore else */ |
| 16252 |
if (vnode.data.show !== true) { |
| 16253 |
leave(vnode, rm); |
| 16254 |
} else { |
| 16255 |
rm(); |
| 16256 |
} |
| 16257 |
} |
| 16258 |
} : {}; |
| 16259 |
|
| 16260 |
var platformModules = [ |
| 16261 |
attrs, |
| 16262 |
klass, |
| 16263 |
events, |
| 16264 |
domProps, |
| 16265 |
style, |
| 16266 |
transition |
| 16267 |
]; |
| 16268 |
|
| 16269 |
/* */ |
| 16270 |
|
| 16271 |
// the directive module should be applied last, after all |
| 16272 |
// built-in modules have been applied. |
| 16273 |
var modules = platformModules.concat(baseModules); |
| 16274 |
|
| 16275 |
var patch = createPatchFunction({ nodeOps: nodeOps, modules: modules }); |
| 16276 |
|
| 16277 |
/** |
| 16278 |
* Not type checking this file because flow doesn't like attaching |
| 16279 |
* properties to Elements. |
| 16280 |
*/ |
| 16281 |
|
| 16282 |
/* istanbul ignore if */ |
| 16283 |
if (isIE9) { |
| 16284 |
// http://www.matts411.com/post/internet-explorer-9-oninput/ |
| 16285 |
document.addEventListener('selectionchange', function () { |
| 16286 |
var el = document.activeElement; |
| 16287 |
if (el && el.vmodel) { |
| 16288 |
trigger(el, 'input'); |
| 16289 |
} |
| 16290 |
}); |
| 16291 |
} |
| 16292 |
|
| 16293 |
var directive = { |
| 16294 |
inserted: function inserted (el, binding, vnode, oldVnode) { |
| 16295 |
if (vnode.tag === 'select') { |
| 16296 |
// #6903 |
| 16297 |
if (oldVnode.elm && !oldVnode.elm._vOptions) { |
| 16298 |
mergeVNodeHook(vnode, 'postpatch', function () { |
| 16299 |
directive.componentUpdated(el, binding, vnode); |
| 16300 |
}); |
| 16301 |
} else { |
| 16302 |
setSelected(el, binding, vnode.context); |
| 16303 |
} |
| 16304 |
el._vOptions = [].map.call(el.options, getValue); |
| 16305 |
} else if (vnode.tag === 'textarea' || isTextInputType(el.type)) { |
| 16306 |
el._vModifiers = binding.modifiers; |
| 16307 |
if (!binding.modifiers.lazy) { |
| 16308 |
el.addEventListener('compositionstart', onCompositionStart); |
| 16309 |
el.addEventListener('compositionend', onCompositionEnd); |
| 16310 |
// Safari < 10.2 & UIWebView doesn't fire compositionend when |
| 16311 |
// switching focus before confirming composition choice |
| 16312 |
// this also fixes the issue where some browsers e.g. iOS Chrome |
| 16313 |
// fires "change" instead of "input" on autocomplete. |
| 16314 |
el.addEventListener('change', onCompositionEnd); |
| 16315 |
/* istanbul ignore if */ |
| 16316 |
if (isIE9) { |
| 16317 |
el.vmodel = true; |
| 16318 |
} |
| 16319 |
} |
| 16320 |
} |
| 16321 |
}, |
| 16322 |
|
| 16323 |
componentUpdated: function componentUpdated (el, binding, vnode) { |
| 16324 |
if (vnode.tag === 'select') { |
| 16325 |
setSelected(el, binding, vnode.context); |
| 16326 |
// in case the options rendered by v-for have changed, |
| 16327 |
// it's possible that the value is out-of-sync with the rendered options. |
| 16328 |
// detect such cases and filter out values that no longer has a matching |
| 16329 |
// option in the DOM. |
| 16330 |
var prevOptions = el._vOptions; |
| 16331 |
var curOptions = el._vOptions = [].map.call(el.options, getValue); |
| 16332 |
if (curOptions.some(function (o, i) { return !looseEqual(o, prevOptions[i]); })) { |
| 16333 |
// trigger change event if |
| 16334 |
// no matching option found for at least one value |
| 16335 |
var needReset = el.multiple |
| 16336 |
? binding.value.some(function (v) { return hasNoMatchingOption(v, curOptions); }) |
| 16337 |
: binding.value !== binding.oldValue && hasNoMatchingOption(binding.value, curOptions); |
| 16338 |
if (needReset) { |
| 16339 |
trigger(el, 'change'); |
| 16340 |
} |
| 16341 |
} |
| 16342 |
} |
| 16343 |
} |
| 16344 |
}; |
| 16345 |
|
| 16346 |
function setSelected (el, binding, vm) { |
| 16347 |
actuallySetSelected(el, binding, vm); |
| 16348 |
/* istanbul ignore if */ |
| 16349 |
if (isIE || isEdge) { |
| 16350 |
setTimeout(function () { |
| 16351 |
actuallySetSelected(el, binding, vm); |
| 16352 |
}, 0); |
| 16353 |
} |
| 16354 |
} |
| 16355 |
|
| 16356 |
function actuallySetSelected (el, binding, vm) { |
| 16357 |
var value = binding.value; |
| 16358 |
var isMultiple = el.multiple; |
| 16359 |
if (isMultiple && !Array.isArray(value)) { |
| 16360 |
true && warn( |
| 16361 |
"<select multiple v-model=\"" + (binding.expression) + "\"> " + |
| 16362 |
"expects an Array value for its binding, but got " + (Object.prototype.toString.call(value).slice(8, -1)), |
| 16363 |
vm |
| 16364 |
); |
| 16365 |
return |
| 16366 |
} |
| 16367 |
var selected, option; |
| 16368 |
for (var i = 0, l = el.options.length; i < l; i++) { |
| 16369 |
option = el.options[i]; |
| 16370 |
if (isMultiple) { |
| 16371 |
selected = looseIndexOf(value, getValue(option)) > -1; |
| 16372 |
if (option.selected !== selected) { |
| 16373 |
option.selected = selected; |
| 16374 |
} |
| 16375 |
} else { |
| 16376 |
if (looseEqual(getValue(option), value)) { |
| 16377 |
if (el.selectedIndex !== i) { |
| 16378 |
el.selectedIndex = i; |
| 16379 |
} |
| 16380 |
return |
| 16381 |
} |
| 16382 |
} |
| 16383 |
} |
| 16384 |
if (!isMultiple) { |
| 16385 |
el.selectedIndex = -1; |
| 16386 |
} |
| 16387 |
} |
| 16388 |
|
| 16389 |
function hasNoMatchingOption (value, options) { |
| 16390 |
return options.every(function (o) { return !looseEqual(o, value); }) |
| 16391 |
} |
| 16392 |
|
| 16393 |
function getValue (option) { |
| 16394 |
return '_value' in option |
| 16395 |
? option._value |
| 16396 |
: option.value |
| 16397 |
} |
| 16398 |
|
| 16399 |
function onCompositionStart (e) { |
| 16400 |
e.target.composing = true; |
| 16401 |
} |
| 16402 |
|
| 16403 |
function onCompositionEnd (e) { |
| 16404 |
// prevent triggering an input event for no reason |
| 16405 |
if (!e.target.composing) { return } |
| 16406 |
e.target.composing = false; |
| 16407 |
trigger(e.target, 'input'); |
| 16408 |
} |
| 16409 |
|
| 16410 |
function trigger (el, type) { |
| 16411 |
var e = document.createEvent('HTMLEvents'); |
| 16412 |
e.initEvent(type, true, true); |
| 16413 |
el.dispatchEvent(e); |
| 16414 |
} |
| 16415 |
|
| 16416 |
/* */ |
| 16417 |
|
| 16418 |
// recursively search for possible transition defined inside the component root |
| 16419 |
function locateNode (vnode) { |
| 16420 |
return vnode.componentInstance && (!vnode.data || !vnode.data.transition) |
| 16421 |
? locateNode(vnode.componentInstance._vnode) |
| 16422 |
: vnode |
| 16423 |
} |
| 16424 |
|
| 16425 |
var show = { |
| 16426 |
bind: function bind (el, ref, vnode) { |
| 16427 |
var value = ref.value; |
| 16428 |
|
| 16429 |
vnode = locateNode(vnode); |
| 16430 |
var transition$$1 = vnode.data && vnode.data.transition; |
| 16431 |
var originalDisplay = el.__vOriginalDisplay = |
| 16432 |
el.style.display === 'none' ? '' : el.style.display; |
| 16433 |
if (value && transition$$1) { |
| 16434 |
vnode.data.show = true; |
| 16435 |
enter(vnode, function () { |
| 16436 |
el.style.display = originalDisplay; |
| 16437 |
}); |
| 16438 |
} else { |
| 16439 |
el.style.display = value ? originalDisplay : 'none'; |
| 16440 |
} |
| 16441 |
}, |
| 16442 |
|
| 16443 |
update: function update (el, ref, vnode) { |
| 16444 |
var value = ref.value; |
| 16445 |
var oldValue = ref.oldValue; |
| 16446 |
|
| 16447 |
/* istanbul ignore if */ |
| 16448 |
if (!value === !oldValue) { return } |
| 16449 |
vnode = locateNode(vnode); |
| 16450 |
var transition$$1 = vnode.data && vnode.data.transition; |
| 16451 |
if (transition$$1) { |
| 16452 |
vnode.data.show = true; |
| 16453 |
if (value) { |
| 16454 |
enter(vnode, function () { |
| 16455 |
el.style.display = el.__vOriginalDisplay; |
| 16456 |
}); |
| 16457 |
} else { |
| 16458 |
leave(vnode, function () { |
| 16459 |
el.style.display = 'none'; |
| 16460 |
}); |
| 16461 |
} |
| 16462 |
} else { |
| 16463 |
el.style.display = value ? el.__vOriginalDisplay : 'none'; |
| 16464 |
} |
| 16465 |
}, |
| 16466 |
|
| 16467 |
unbind: function unbind ( |
| 16468 |
el, |
| 16469 |
binding, |
| 16470 |
vnode, |
| 16471 |
oldVnode, |
| 16472 |
isDestroy |
| 16473 |
) { |
| 16474 |
if (!isDestroy) { |
| 16475 |
el.style.display = el.__vOriginalDisplay; |
| 16476 |
} |
| 16477 |
} |
| 16478 |
}; |
| 16479 |
|
| 16480 |
var platformDirectives = { |
| 16481 |
model: directive, |
| 16482 |
show: show |
| 16483 |
}; |
| 16484 |
|
| 16485 |
/* */ |
| 16486 |
|
| 16487 |
var transitionProps = { |
| 16488 |
name: String, |
| 16489 |
appear: Boolean, |
| 16490 |
css: Boolean, |
| 16491 |
mode: String, |
| 16492 |
type: String, |
| 16493 |
enterClass: String, |
| 16494 |
leaveClass: String, |
| 16495 |
enterToClass: String, |
| 16496 |
leaveToClass: String, |
| 16497 |
enterActiveClass: String, |
| 16498 |
leaveActiveClass: String, |
| 16499 |
appearClass: String, |
| 16500 |
appearActiveClass: String, |
| 16501 |
appearToClass: String, |
| 16502 |
duration: [Number, String, Object] |
| 16503 |
}; |
| 16504 |
|
| 16505 |
// in case the child is also an abstract component, e.g. <keep-alive> |
| 16506 |
// we want to recursively retrieve the real component to be rendered |
| 16507 |
function getRealChild (vnode) { |
| 16508 |
var compOptions = vnode && vnode.componentOptions; |
| 16509 |
if (compOptions && compOptions.Ctor.options.abstract) { |
| 16510 |
return getRealChild(getFirstComponentChild(compOptions.children)) |
| 16511 |
} else { |
| 16512 |
return vnode |
| 16513 |
} |
| 16514 |
} |
| 16515 |
|
| 16516 |
function extractTransitionData (comp) { |
| 16517 |
var data = {}; |
| 16518 |
var options = comp.$options; |
| 16519 |
// props |
| 16520 |
for (var key in options.propsData) { |
| 16521 |
data[key] = comp[key]; |
| 16522 |
} |
| 16523 |
// events. |
| 16524 |
// extract listeners and pass them directly to the transition methods |
| 16525 |
var listeners = options._parentListeners; |
| 16526 |
for (var key$1 in listeners) { |
| 16527 |
data[camelize(key$1)] = listeners[key$1]; |
| 16528 |
} |
| 16529 |
return data |
| 16530 |
} |
| 16531 |
|
| 16532 |
function placeholder (h, rawChild) { |
| 16533 |
if (/\d-keep-alive$/.test(rawChild.tag)) { |
| 16534 |
return h('keep-alive', { |
| 16535 |
props: rawChild.componentOptions.propsData |
| 16536 |
}) |
| 16537 |
} |
| 16538 |
} |
| 16539 |
|
| 16540 |
function hasParentTransition (vnode) { |
| 16541 |
while ((vnode = vnode.parent)) { |
| 16542 |
if (vnode.data.transition) { |
| 16543 |
return true |
| 16544 |
} |
| 16545 |
} |
| 16546 |
} |
| 16547 |
|
| 16548 |
function isSameChild (child, oldChild) { |
| 16549 |
return oldChild.key === child.key && oldChild.tag === child.tag |
| 16550 |
} |
| 16551 |
|
| 16552 |
var isNotTextNode = function (c) { return c.tag || isAsyncPlaceholder(c); }; |
| 16553 |
|
| 16554 |
var isVShowDirective = function (d) { return d.name === 'show'; }; |
| 16555 |
|
| 16556 |
var Transition = { |
| 16557 |
name: 'transition', |
| 16558 |
props: transitionProps, |
| 16559 |
abstract: true, |
| 16560 |
|
| 16561 |
render: function render (h) { |
| 16562 |
var this$1 = this; |
| 16563 |
|
| 16564 |
var children = this.$slots.default; |
| 16565 |
if (!children) { |
| 16566 |
return |
| 16567 |
} |
| 16568 |
|
| 16569 |
// filter out text nodes (possible whitespaces) |
| 16570 |
children = children.filter(isNotTextNode); |
| 16571 |
/* istanbul ignore if */ |
| 16572 |
if (!children.length) { |
| 16573 |
return |
| 16574 |
} |
| 16575 |
|
| 16576 |
// warn multiple elements |
| 16577 |
if ( true && children.length > 1) { |
| 16578 |
warn( |
| 16579 |
'<transition> can only be used on a single element. Use ' + |
| 16580 |
'<transition-group> for lists.', |
| 16581 |
this.$parent |
| 16582 |
); |
| 16583 |
} |
| 16584 |
|
| 16585 |
var mode = this.mode; |
| 16586 |
|
| 16587 |
// warn invalid mode |
| 16588 |
if ( true && |
| 16589 |
mode && mode !== 'in-out' && mode !== 'out-in' |
| 16590 |
) { |
| 16591 |
warn( |
| 16592 |
'invalid <transition> mode: ' + mode, |
| 16593 |
this.$parent |
| 16594 |
); |
| 16595 |
} |
| 16596 |
|
| 16597 |
var rawChild = children[0]; |
| 16598 |
|
| 16599 |
// if this is a component root node and the component's |
| 16600 |
// parent container node also has transition, skip. |
| 16601 |
if (hasParentTransition(this.$vnode)) { |
| 16602 |
return rawChild |
| 16603 |
} |
| 16604 |
|
| 16605 |
// apply transition data to child |
| 16606 |
// use getRealChild() to ignore abstract components e.g. keep-alive |
| 16607 |
var child = getRealChild(rawChild); |
| 16608 |
/* istanbul ignore if */ |
| 16609 |
if (!child) { |
| 16610 |
return rawChild |
| 16611 |
} |
| 16612 |
|
| 16613 |
if (this._leaving) { |
| 16614 |
return placeholder(h, rawChild) |
| 16615 |
} |
| 16616 |
|
| 16617 |
// ensure a key that is unique to the vnode type and to this transition |
| 16618 |
// component instance. This key will be used to remove pending leaving nodes |
| 16619 |
// during entering. |
| 16620 |
var id = "__transition-" + (this._uid) + "-"; |
| 16621 |
child.key = child.key == null |
| 16622 |
? child.isComment |
| 16623 |
? id + 'comment' |
| 16624 |
: id + child.tag |
| 16625 |
: isPrimitive(child.key) |
| 16626 |
? (String(child.key).indexOf(id) === 0 ? child.key : id + child.key) |
| 16627 |
: child.key; |
| 16628 |
|
| 16629 |
var data = (child.data || (child.data = {})).transition = extractTransitionData(this); |
| 16630 |
var oldRawChild = this._vnode; |
| 16631 |
var oldChild = getRealChild(oldRawChild); |
| 16632 |
|
| 16633 |
// mark v-show |
| 16634 |
// so that the transition module can hand over the control to the directive |
| 16635 |
if (child.data.directives && child.data.directives.some(isVShowDirective)) { |
| 16636 |
child.data.show = true; |
| 16637 |
} |
| 16638 |
|
| 16639 |
if ( |
| 16640 |
oldChild && |
| 16641 |
oldChild.data && |
| 16642 |
!isSameChild(child, oldChild) && |
| 16643 |
!isAsyncPlaceholder(oldChild) && |
| 16644 |
// #6687 component root is a comment node |
| 16645 |
!(oldChild.componentInstance && oldChild.componentInstance._vnode.isComment) |
| 16646 |
) { |
| 16647 |
// replace old child transition data with fresh one |
| 16648 |
// important for dynamic transitions! |
| 16649 |
var oldData = oldChild.data.transition = extend({}, data); |
| 16650 |
// handle transition mode |
| 16651 |
if (mode === 'out-in') { |
| 16652 |
// return placeholder node and queue update when leave finishes |
| 16653 |
this._leaving = true; |
| 16654 |
mergeVNodeHook(oldData, 'afterLeave', function () { |
| 16655 |
this$1._leaving = false; |
| 16656 |
this$1.$forceUpdate(); |
| 16657 |
}); |
| 16658 |
return placeholder(h, rawChild) |
| 16659 |
} else if (mode === 'in-out') { |
| 16660 |
if (isAsyncPlaceholder(child)) { |
| 16661 |
return oldRawChild |
| 16662 |
} |
| 16663 |
var delayedLeave; |
| 16664 |
var performLeave = function () { delayedLeave(); }; |
| 16665 |
mergeVNodeHook(data, 'afterEnter', performLeave); |
| 16666 |
mergeVNodeHook(data, 'enterCancelled', performLeave); |
| 16667 |
mergeVNodeHook(oldData, 'delayLeave', function (leave) { delayedLeave = leave; }); |
| 16668 |
} |
| 16669 |
} |
| 16670 |
|
| 16671 |
return rawChild |
| 16672 |
} |
| 16673 |
}; |
| 16674 |
|
| 16675 |
/* */ |
| 16676 |
|
| 16677 |
var props = extend({ |
| 16678 |
tag: String, |
| 16679 |
moveClass: String |
| 16680 |
}, transitionProps); |
| 16681 |
|
| 16682 |
delete props.mode; |
| 16683 |
|
| 16684 |
var TransitionGroup = { |
| 16685 |
props: props, |
| 16686 |
|
| 16687 |
beforeMount: function beforeMount () { |
| 16688 |
var this$1 = this; |
| 16689 |
|
| 16690 |
var update = this._update; |
| 16691 |
this._update = function (vnode, hydrating) { |
| 16692 |
var restoreActiveInstance = setActiveInstance(this$1); |
| 16693 |
// force removing pass |
| 16694 |
this$1.__patch__( |
| 16695 |
this$1._vnode, |
| 16696 |
this$1.kept, |
| 16697 |
false, // hydrating |
| 16698 |
true // removeOnly (!important, avoids unnecessary moves) |
| 16699 |
); |
| 16700 |
this$1._vnode = this$1.kept; |
| 16701 |
restoreActiveInstance(); |
| 16702 |
update.call(this$1, vnode, hydrating); |
| 16703 |
}; |
| 16704 |
}, |
| 16705 |
|
| 16706 |
render: function render (h) { |
| 16707 |
var tag = this.tag || this.$vnode.data.tag || 'span'; |
| 16708 |
var map = Object.create(null); |
| 16709 |
var prevChildren = this.prevChildren = this.children; |
| 16710 |
var rawChildren = this.$slots.default || []; |
| 16711 |
var children = this.children = []; |
| 16712 |
var transitionData = extractTransitionData(this); |
| 16713 |
|
| 16714 |
for (var i = 0; i < rawChildren.length; i++) { |
| 16715 |
var c = rawChildren[i]; |
| 16716 |
if (c.tag) { |
| 16717 |
if (c.key != null && String(c.key).indexOf('__vlist') !== 0) { |
| 16718 |
children.push(c); |
| 16719 |
map[c.key] = c |
| 16720 |
;(c.data || (c.data = {})).transition = transitionData; |
| 16721 |
} else if (true) { |
| 16722 |
var opts = c.componentOptions; |
| 16723 |
var name = opts ? (opts.Ctor.options.name || opts.tag || '') : c.tag; |
| 16724 |
warn(("<transition-group> children must be keyed: <" + name + ">")); |
| 16725 |
} |
| 16726 |
} |
| 16727 |
} |
| 16728 |
|
| 16729 |
if (prevChildren) { |
| 16730 |
var kept = []; |
| 16731 |
var removed = []; |
| 16732 |
for (var i$1 = 0; i$1 < prevChildren.length; i$1++) { |
| 16733 |
var c$1 = prevChildren[i$1]; |
| 16734 |
c$1.data.transition = transitionData; |
| 16735 |
c$1.data.pos = c$1.elm.getBoundingClientRect(); |
| 16736 |
if (map[c$1.key]) { |
| 16737 |
kept.push(c$1); |
| 16738 |
} else { |
| 16739 |
removed.push(c$1); |
| 16740 |
} |
| 16741 |
} |
| 16742 |
this.kept = h(tag, null, kept); |
| 16743 |
this.removed = removed; |
| 16744 |
} |
| 16745 |
|
| 16746 |
return h(tag, null, children) |
| 16747 |
}, |
| 16748 |
|
| 16749 |
updated: function updated () { |
| 16750 |
var children = this.prevChildren; |
| 16751 |
var moveClass = this.moveClass || ((this.name || 'v') + '-move'); |
| 16752 |
if (!children.length || !this.hasMove(children[0].elm, moveClass)) { |
| 16753 |
return |
| 16754 |
} |
| 16755 |
|
| 16756 |
// we divide the work into three loops to avoid mixing DOM reads and writes |
| 16757 |
// in each iteration - which helps prevent layout thrashing. |
| 16758 |
children.forEach(callPendingCbs); |
| 16759 |
children.forEach(recordPosition); |
| 16760 |
children.forEach(applyTranslation); |
| 16761 |
|
| 16762 |
// force reflow to put everything in position |
| 16763 |
// assign to this to avoid being removed in tree-shaking |
| 16764 |
// $flow-disable-line |
| 16765 |
this._reflow = document.body.offsetHeight; |
| 16766 |
|
| 16767 |
children.forEach(function (c) { |
| 16768 |
if (c.data.moved) { |
| 16769 |
var el = c.elm; |
| 16770 |
var s = el.style; |
| 16771 |
addTransitionClass(el, moveClass); |
| 16772 |
s.transform = s.WebkitTransform = s.transitionDuration = ''; |
| 16773 |
el.addEventListener(transitionEndEvent, el._moveCb = function cb (e) { |
| 16774 |
if (e && e.target !== el) { |
| 16775 |
return |
| 16776 |
} |
| 16777 |
if (!e || /transform$/.test(e.propertyName)) { |
| 16778 |
el.removeEventListener(transitionEndEvent, cb); |
| 16779 |
el._moveCb = null; |
| 16780 |
removeTransitionClass(el, moveClass); |
| 16781 |
} |
| 16782 |
}); |
| 16783 |
} |
| 16784 |
}); |
| 16785 |
}, |
| 16786 |
|
| 16787 |
methods: { |
| 16788 |
hasMove: function hasMove (el, moveClass) { |
| 16789 |
/* istanbul ignore if */ |
| 16790 |
if (!hasTransition) { |
| 16791 |
return false |
| 16792 |
} |
| 16793 |
/* istanbul ignore if */ |
| 16794 |
if (this._hasMove) { |
| 16795 |
return this._hasMove |
| 16796 |
} |
| 16797 |
// Detect whether an element with the move class applied has |
| 16798 |
// CSS transitions. Since the element may be inside an entering |
| 16799 |
// transition at this very moment, we make a clone of it and remove |
| 16800 |
// all other transition classes applied to ensure only the move class |
| 16801 |
// is applied. |
| 16802 |
var clone = el.cloneNode(); |
| 16803 |
if (el._transitionClasses) { |
| 16804 |
el._transitionClasses.forEach(function (cls) { removeClass(clone, cls); }); |
| 16805 |
} |
| 16806 |
addClass(clone, moveClass); |
| 16807 |
clone.style.display = 'none'; |
| 16808 |
this.$el.appendChild(clone); |
| 16809 |
var info = getTransitionInfo(clone); |
| 16810 |
this.$el.removeChild(clone); |
| 16811 |
return (this._hasMove = info.hasTransform) |
| 16812 |
} |
| 16813 |
} |
| 16814 |
}; |
| 16815 |
|
| 16816 |
function callPendingCbs (c) { |
| 16817 |
/* istanbul ignore if */ |
| 16818 |
if (c.elm._moveCb) { |
| 16819 |
c.elm._moveCb(); |
| 16820 |
} |
| 16821 |
/* istanbul ignore if */ |
| 16822 |
if (c.elm._enterCb) { |
| 16823 |
c.elm._enterCb(); |
| 16824 |
} |
| 16825 |
} |
| 16826 |
|
| 16827 |
function recordPosition (c) { |
| 16828 |
c.data.newPos = c.elm.getBoundingClientRect(); |
| 16829 |
} |
| 16830 |
|
| 16831 |
function applyTranslation (c) { |
| 16832 |
var oldPos = c.data.pos; |
| 16833 |
var newPos = c.data.newPos; |
| 16834 |
var dx = oldPos.left - newPos.left; |
| 16835 |
var dy = oldPos.top - newPos.top; |
| 16836 |
if (dx || dy) { |
| 16837 |
c.data.moved = true; |
| 16838 |
var s = c.elm.style; |
| 16839 |
s.transform = s.WebkitTransform = "translate(" + dx + "px," + dy + "px)"; |
| 16840 |
s.transitionDuration = '0s'; |
| 16841 |
} |
| 16842 |
} |
| 16843 |
|
| 16844 |
var platformComponents = { |
| 16845 |
Transition: Transition, |
| 16846 |
TransitionGroup: TransitionGroup |
| 16847 |
}; |
| 16848 |
|
| 16849 |
/* */ |
| 16850 |
|
| 16851 |
// install platform specific utils |
| 16852 |
Vue.config.mustUseProp = mustUseProp; |
| 16853 |
Vue.config.isReservedTag = isReservedTag; |
| 16854 |
Vue.config.isReservedAttr = isReservedAttr; |
| 16855 |
Vue.config.getTagNamespace = getTagNamespace; |
| 16856 |
Vue.config.isUnknownElement = isUnknownElement; |
| 16857 |
|
| 16858 |
// install platform runtime directives & components |
| 16859 |
extend(Vue.options.directives, platformDirectives); |
| 16860 |
extend(Vue.options.components, platformComponents); |
| 16861 |
|
| 16862 |
// install platform patch function |
| 16863 |
Vue.prototype.__patch__ = inBrowser ? patch : noop; |
| 16864 |
|
| 16865 |
// public mount method |
| 16866 |
Vue.prototype.$mount = function ( |
| 16867 |
el, |
| 16868 |
hydrating |
| 16869 |
) { |
| 16870 |
el = el && inBrowser ? query(el) : undefined; |
| 16871 |
return mountComponent(this, el, hydrating) |
| 16872 |
}; |
| 16873 |
|
| 16874 |
// devtools global hook |
| 16875 |
/* istanbul ignore next */ |
| 16876 |
if (inBrowser) { |
| 16877 |
setTimeout(function () { |
| 16878 |
if (config.devtools) { |
| 16879 |
if (devtools) { |
| 16880 |
devtools.emit('init', Vue); |
| 16881 |
} else if ( |
| 16882 |
true |
| 16883 |
) { |
| 16884 |
console[console.info ? 'info' : 'log']( |
| 16885 |
'Download the Vue Devtools extension for a better development experience:\n' + |
| 16886 |
'https://github.com/vuejs/vue-devtools' |
| 16887 |
); |
| 16888 |
} |
| 16889 |
} |
| 16890 |
if ( true && |
| 16891 |
config.productionTip !== false && |
| 16892 |
typeof console !== 'undefined' |
| 16893 |
) { |
| 16894 |
console[console.info ? 'info' : 'log']( |
| 16895 |
"You are running Vue in development mode.\n" + |
| 16896 |
"Make sure to turn on production mode when deploying for production.\n" + |
| 16897 |
"See more tips at https://vuejs.org/guide/deployment.html" |
| 16898 |
); |
| 16899 |
} |
| 16900 |
}, 0); |
| 16901 |
} |
| 16902 |
|
| 16903 |
/* */ |
| 16904 |
|
| 16905 |
var defaultTagRE = /\{\{((?:.|\r?\n)+?)\}\}/g; |
| 16906 |
var regexEscapeRE = /[-.*+?^${}()|[\]\/\\]/g; |
| 16907 |
|
| 16908 |
var buildRegex = cached(function (delimiters) { |
| 16909 |
var open = delimiters[0].replace(regexEscapeRE, '\\$&'); |
| 16910 |
var close = delimiters[1].replace(regexEscapeRE, '\\$&'); |
| 16911 |
return new RegExp(open + '((?:.|\\n)+?)' + close, 'g') |
| 16912 |
}); |
| 16913 |
|
| 16914 |
|
| 16915 |
|
| 16916 |
function parseText ( |
| 16917 |
text, |
| 16918 |
delimiters |
| 16919 |
) { |
| 16920 |
var tagRE = delimiters ? buildRegex(delimiters) : defaultTagRE; |
| 16921 |
if (!tagRE.test(text)) { |
| 16922 |
return |
| 16923 |
} |
| 16924 |
var tokens = []; |
| 16925 |
var rawTokens = []; |
| 16926 |
var lastIndex = tagRE.lastIndex = 0; |
| 16927 |
var match, index, tokenValue; |
| 16928 |
while ((match = tagRE.exec(text))) { |
| 16929 |
index = match.index; |
| 16930 |
// push text token |
| 16931 |
if (index > lastIndex) { |
| 16932 |
rawTokens.push(tokenValue = text.slice(lastIndex, index)); |
| 16933 |
tokens.push(JSON.stringify(tokenValue)); |
| 16934 |
} |
| 16935 |
// tag token |
| 16936 |
var exp = parseFilters(match[1].trim()); |
| 16937 |
tokens.push(("_s(" + exp + ")")); |
| 16938 |
rawTokens.push({ '@binding': exp }); |
| 16939 |
lastIndex = index + match[0].length; |
| 16940 |
} |
| 16941 |
if (lastIndex < text.length) { |
| 16942 |
rawTokens.push(tokenValue = text.slice(lastIndex)); |
| 16943 |
tokens.push(JSON.stringify(tokenValue)); |
| 16944 |
} |
| 16945 |
return { |
| 16946 |
expression: tokens.join('+'), |
| 16947 |
tokens: rawTokens |
| 16948 |
} |
| 16949 |
} |
| 16950 |
|
| 16951 |
/* */ |
| 16952 |
|
| 16953 |
function transformNode (el, options) { |
| 16954 |
var warn = options.warn || baseWarn; |
| 16955 |
var staticClass = getAndRemoveAttr(el, 'class'); |
| 16956 |
if ( true && staticClass) { |
| 16957 |
var res = parseText(staticClass, options.delimiters); |
| 16958 |
if (res) { |
| 16959 |
warn( |
| 16960 |
"class=\"" + staticClass + "\": " + |
| 16961 |
'Interpolation inside attributes has been removed. ' + |
| 16962 |
'Use v-bind or the colon shorthand instead. For example, ' + |
| 16963 |
'instead of <div class="{{ val }}">, use <div :class="val">.', |
| 16964 |
el.rawAttrsMap['class'] |
| 16965 |
); |
| 16966 |
} |
| 16967 |
} |
| 16968 |
if (staticClass) { |
| 16969 |
el.staticClass = JSON.stringify(staticClass); |
| 16970 |
} |
| 16971 |
var classBinding = getBindingAttr(el, 'class', false /* getStatic */); |
| 16972 |
if (classBinding) { |
| 16973 |
el.classBinding = classBinding; |
| 16974 |
} |
| 16975 |
} |
| 16976 |
|
| 16977 |
function genData (el) { |
| 16978 |
var data = ''; |
| 16979 |
if (el.staticClass) { |
| 16980 |
data += "staticClass:" + (el.staticClass) + ","; |
| 16981 |
} |
| 16982 |
if (el.classBinding) { |
| 16983 |
data += "class:" + (el.classBinding) + ","; |
| 16984 |
} |
| 16985 |
return data |
| 16986 |
} |
| 16987 |
|
| 16988 |
var klass$1 = { |
| 16989 |
staticKeys: ['staticClass'], |
| 16990 |
transformNode: transformNode, |
| 16991 |
genData: genData |
| 16992 |
}; |
| 16993 |
|
| 16994 |
/* */ |
| 16995 |
|
| 16996 |
function transformNode$1 (el, options) { |
| 16997 |
var warn = options.warn || baseWarn; |
| 16998 |
var staticStyle = getAndRemoveAttr(el, 'style'); |
| 16999 |
if (staticStyle) { |
| 17000 |
/* istanbul ignore if */ |
| 17001 |
if (true) { |
| 17002 |
var res = parseText(staticStyle, options.delimiters); |
| 17003 |
if (res) { |
| 17004 |
warn( |
| 17005 |
"style=\"" + staticStyle + "\": " + |
| 17006 |
'Interpolation inside attributes has been removed. ' + |
| 17007 |
'Use v-bind or the colon shorthand instead. For example, ' + |
| 17008 |
'instead of <div style="{{ val }}">, use <div :style="val">.', |
| 17009 |
el.rawAttrsMap['style'] |
| 17010 |
); |
| 17011 |
} |
| 17012 |
} |
| 17013 |
el.staticStyle = JSON.stringify(parseStyleText(staticStyle)); |
| 17014 |
} |
| 17015 |
|
| 17016 |
var styleBinding = getBindingAttr(el, 'style', false /* getStatic */); |
| 17017 |
if (styleBinding) { |
| 17018 |
el.styleBinding = styleBinding; |
| 17019 |
} |
| 17020 |
} |
| 17021 |
|
| 17022 |
function genData$1 (el) { |
| 17023 |
var data = ''; |
| 17024 |
if (el.staticStyle) { |
| 17025 |
data += "staticStyle:" + (el.staticStyle) + ","; |
| 17026 |
} |
| 17027 |
if (el.styleBinding) { |
| 17028 |
data += "style:(" + (el.styleBinding) + "),"; |
| 17029 |
} |
| 17030 |
return data |
| 17031 |
} |
| 17032 |
|
| 17033 |
var style$1 = { |
| 17034 |
staticKeys: ['staticStyle'], |
| 17035 |
transformNode: transformNode$1, |
| 17036 |
genData: genData$1 |
| 17037 |
}; |
| 17038 |
|
| 17039 |
/* */ |
| 17040 |
|
| 17041 |
var decoder; |
| 17042 |
|
| 17043 |
var he = { |
| 17044 |
decode: function decode (html) { |
| 17045 |
decoder = decoder || document.createElement('div'); |
| 17046 |
decoder.innerHTML = html; |
| 17047 |
return decoder.textContent |
| 17048 |
} |
| 17049 |
}; |
| 17050 |
|
| 17051 |
/* */ |
| 17052 |
|
| 17053 |
var isUnaryTag = makeMap( |
| 17054 |
'area,base,br,col,embed,frame,hr,img,input,isindex,keygen,' + |
| 17055 |
'link,meta,param,source,track,wbr' |
| 17056 |
); |
| 17057 |
|
| 17058 |
// Elements that you can, intentionally, leave open |
| 17059 |
// (and which close themselves) |
| 17060 |
var canBeLeftOpenTag = makeMap( |
| 17061 |
'colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr,source' |
| 17062 |
); |
| 17063 |
|
| 17064 |
// HTML5 tags https://html.spec.whatwg.org/multipage/indices.html#elements-3 |
| 17065 |
// Phrasing Content https://html.spec.whatwg.org/multipage/dom.html#phrasing-content |
| 17066 |
var isNonPhrasingTag = makeMap( |
| 17067 |
'address,article,aside,base,blockquote,body,caption,col,colgroup,dd,' + |
| 17068 |
'details,dialog,div,dl,dt,fieldset,figcaption,figure,footer,form,' + |
| 17069 |
'h1,h2,h3,h4,h5,h6,head,header,hgroup,hr,html,legend,li,menuitem,meta,' + |
| 17070 |
'optgroup,option,param,rp,rt,source,style,summary,tbody,td,tfoot,th,thead,' + |
| 17071 |
'title,tr,track' |
| 17072 |
); |
| 17073 |
|
| 17074 |
/** |
| 17075 |
* Not type-checking this file because it's mostly vendor code. |
| 17076 |
*/ |
| 17077 |
|
| 17078 |
// Regular Expressions for parsing tags and attributes |
| 17079 |
var attribute = /^\s*([^\s"'<>\/=]+)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/; |
| 17080 |
var dynamicArgAttribute = /^\s*((?:v-[\w-]+:|@|:|#)\[[^=]+?\][^\s"'<>\/=]*)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/; |
| 17081 |
var ncname = "[a-zA-Z_][\\-\\.0-9_a-zA-Z" + (unicodeRegExp.source) + "]*"; |
| 17082 |
var qnameCapture = "((?:" + ncname + "\\:)?" + ncname + ")"; |
| 17083 |
var startTagOpen = new RegExp(("^<" + qnameCapture)); |
| 17084 |
var startTagClose = /^\s*(\/?)>/; |
| 17085 |
var endTag = new RegExp(("^<\\/" + qnameCapture + "[^>]*>")); |
| 17086 |
var doctype = /^<!DOCTYPE [^>]+>/i; |
| 17087 |
// #7298: escape - to avoid being passed as HTML comment when inlined in page |
| 17088 |
var comment = /^<!\--/; |
| 17089 |
var conditionalComment = /^<!\[/; |
| 17090 |
|
| 17091 |
// Special Elements (can contain anything) |
| 17092 |
var isPlainTextElement = makeMap('script,style,textarea', true); |
| 17093 |
var reCache = {}; |
| 17094 |
|
| 17095 |
var decodingMap = { |
| 17096 |
'<': '<', |
| 17097 |
'>': '>', |
| 17098 |
'"': '"', |
| 17099 |
'&': '&', |
| 17100 |
' ': '\n', |
| 17101 |
'	': '\t', |
| 17102 |
''': "'" |
| 17103 |
}; |
| 17104 |
var encodedAttr = /&(?:lt|gt|quot|amp|#39);/g; |
| 17105 |
var encodedAttrWithNewLines = /&(?:lt|gt|quot|amp|#39|#10|#9);/g; |
| 17106 |
|
| 17107 |
// #5992 |
| 17108 |
var isIgnoreNewlineTag = makeMap('pre,textarea', true); |
| 17109 |
var shouldIgnoreFirstNewline = function (tag, html) { return tag && isIgnoreNewlineTag(tag) && html[0] === '\n'; }; |
| 17110 |
|
| 17111 |
function decodeAttr (value, shouldDecodeNewlines) { |
| 17112 |
var re = shouldDecodeNewlines ? encodedAttrWithNewLines : encodedAttr; |
| 17113 |
return value.replace(re, function (match) { return decodingMap[match]; }) |
| 17114 |
} |
| 17115 |
|
| 17116 |
function parseHTML (html, options) { |
| 17117 |
var stack = []; |
| 17118 |
var expectHTML = options.expectHTML; |
| 17119 |
var isUnaryTag$$1 = options.isUnaryTag || no; |
| 17120 |
var canBeLeftOpenTag$$1 = options.canBeLeftOpenTag || no; |
| 17121 |
var index = 0; |
| 17122 |
var last, lastTag; |
| 17123 |
while (html) { |
| 17124 |
last = html; |
| 17125 |
// Make sure we're not in a plaintext content element like script/style |
| 17126 |
if (!lastTag || !isPlainTextElement(lastTag)) { |
| 17127 |
var textEnd = html.indexOf('<'); |
| 17128 |
if (textEnd === 0) { |
| 17129 |
// Comment: |
| 17130 |
if (comment.test(html)) { |
| 17131 |
var commentEnd = html.indexOf('-->'); |
| 17132 |
|
| 17133 |
if (commentEnd >= 0) { |
| 17134 |
if (options.shouldKeepComment) { |
| 17135 |
options.comment(html.substring(4, commentEnd), index, index + commentEnd + 3); |
| 17136 |
} |
| 17137 |
advance(commentEnd + 3); |
| 17138 |
continue |
| 17139 |
} |
| 17140 |
} |
| 17141 |
|
| 17142 |
// http://en.wikipedia.org/wiki/Conditional_comment#Downlevel-revealed_conditional_comment |
| 17143 |
if (conditionalComment.test(html)) { |
| 17144 |
var conditionalEnd = html.indexOf(']>'); |
| 17145 |
|
| 17146 |
if (conditionalEnd >= 0) { |
| 17147 |
advance(conditionalEnd + 2); |
| 17148 |
continue |
| 17149 |
} |
| 17150 |
} |
| 17151 |
|
| 17152 |
// Doctype: |
| 17153 |
var doctypeMatch = html.match(doctype); |
| 17154 |
if (doctypeMatch) { |
| 17155 |
advance(doctypeMatch[0].length); |
| 17156 |
continue |
| 17157 |
} |
| 17158 |
|
| 17159 |
// End tag: |
| 17160 |
var endTagMatch = html.match(endTag); |
| 17161 |
if (endTagMatch) { |
| 17162 |
var curIndex = index; |
| 17163 |
advance(endTagMatch[0].length); |
| 17164 |
parseEndTag(endTagMatch[1], curIndex, index); |
| 17165 |
continue |
| 17166 |
} |
| 17167 |
|
| 17168 |
// Start tag: |
| 17169 |
var startTagMatch = parseStartTag(); |
| 17170 |
if (startTagMatch) { |
| 17171 |
handleStartTag(startTagMatch); |
| 17172 |
if (shouldIgnoreFirstNewline(startTagMatch.tagName, html)) { |
| 17173 |
advance(1); |
| 17174 |
} |
| 17175 |
continue |
| 17176 |
} |
| 17177 |
} |
| 17178 |
|
| 17179 |
var text = (void 0), rest = (void 0), next = (void 0); |
| 17180 |
if (textEnd >= 0) { |
| 17181 |
rest = html.slice(textEnd); |
| 17182 |
while ( |
| 17183 |
!endTag.test(rest) && |
| 17184 |
!startTagOpen.test(rest) && |
| 17185 |
!comment.test(rest) && |
| 17186 |
!conditionalComment.test(rest) |
| 17187 |
) { |
| 17188 |
// < in plain text, be forgiving and treat it as text |
| 17189 |
next = rest.indexOf('<', 1); |
| 17190 |
if (next < 0) { break } |
| 17191 |
textEnd += next; |
| 17192 |
rest = html.slice(textEnd); |
| 17193 |
} |
| 17194 |
text = html.substring(0, textEnd); |
| 17195 |
} |
| 17196 |
|
| 17197 |
if (textEnd < 0) { |
| 17198 |
text = html; |
| 17199 |
} |
| 17200 |
|
| 17201 |
if (text) { |
| 17202 |
advance(text.length); |
| 17203 |
} |
| 17204 |
|
| 17205 |
if (options.chars && text) { |
| 17206 |
options.chars(text, index - text.length, index); |
| 17207 |
} |
| 17208 |
} else { |
| 17209 |
var endTagLength = 0; |
| 17210 |
var stackedTag = lastTag.toLowerCase(); |
| 17211 |
var reStackedTag = reCache[stackedTag] || (reCache[stackedTag] = new RegExp('([\\s\\S]*?)(</' + stackedTag + '[^>]*>)', 'i')); |
| 17212 |
var rest$1 = html.replace(reStackedTag, function (all, text, endTag) { |
| 17213 |
endTagLength = endTag.length; |
| 17214 |
if (!isPlainTextElement(stackedTag) && stackedTag !== 'noscript') { |
| 17215 |
text = text |
| 17216 |
.replace(/<!\--([\s\S]*?)-->/g, '$1') // #7298 |
| 17217 |
.replace(/<!\[CDATA\[([\s\S]*?)]]>/g, '$1'); |
| 17218 |
} |
| 17219 |
if (shouldIgnoreFirstNewline(stackedTag, text)) { |
| 17220 |
text = text.slice(1); |
| 17221 |
} |
| 17222 |
if (options.chars) { |
| 17223 |
options.chars(text); |
| 17224 |
} |
| 17225 |
return '' |
| 17226 |
}); |
| 17227 |
index += html.length - rest$1.length; |
| 17228 |
html = rest$1; |
| 17229 |
parseEndTag(stackedTag, index - endTagLength, index); |
| 17230 |
} |
| 17231 |
|
| 17232 |
if (html === last) { |
| 17233 |
options.chars && options.chars(html); |
| 17234 |
if ( true && !stack.length && options.warn) { |
| 17235 |
options.warn(("Mal-formatted tag at end of template: \"" + html + "\""), { start: index + html.length }); |
| 17236 |
} |
| 17237 |
break |
| 17238 |
} |
| 17239 |
} |
| 17240 |
|
| 17241 |
// Clean up any remaining tags |
| 17242 |
parseEndTag(); |
| 17243 |
|
| 17244 |
function advance (n) { |
| 17245 |
index += n; |
| 17246 |
html = html.substring(n); |
| 17247 |
} |
| 17248 |
|
| 17249 |
function parseStartTag () { |
| 17250 |
var start = html.match(startTagOpen); |
| 17251 |
if (start) { |
| 17252 |
var match = { |
| 17253 |
tagName: start[1], |
| 17254 |
attrs: [], |
| 17255 |
start: index |
| 17256 |
}; |
| 17257 |
advance(start[0].length); |
| 17258 |
var end, attr; |
| 17259 |
while (!(end = html.match(startTagClose)) && (attr = html.match(dynamicArgAttribute) || html.match(attribute))) { |
| 17260 |
attr.start = index; |
| 17261 |
advance(attr[0].length); |
| 17262 |
attr.end = index; |
| 17263 |
match.attrs.push(attr); |
| 17264 |
} |
| 17265 |
if (end) { |
| 17266 |
match.unarySlash = end[1]; |
| 17267 |
advance(end[0].length); |
| 17268 |
match.end = index; |
| 17269 |
return match |
| 17270 |
} |
| 17271 |
} |
| 17272 |
} |
| 17273 |
|
| 17274 |
function handleStartTag (match) { |
| 17275 |
var tagName = match.tagName; |
| 17276 |
var unarySlash = match.unarySlash; |
| 17277 |
|
| 17278 |
if (expectHTML) { |
| 17279 |
if (lastTag === 'p' && isNonPhrasingTag(tagName)) { |
| 17280 |
parseEndTag(lastTag); |
| 17281 |
} |
| 17282 |
if (canBeLeftOpenTag$$1(tagName) && lastTag === tagName) { |
| 17283 |
parseEndTag(tagName); |
| 17284 |
} |
| 17285 |
} |
| 17286 |
|
| 17287 |
var unary = isUnaryTag$$1(tagName) || !!unarySlash; |
| 17288 |
|
| 17289 |
var l = match.attrs.length; |
| 17290 |
var attrs = new Array(l); |
| 17291 |
for (var i = 0; i < l; i++) { |
| 17292 |
var args = match.attrs[i]; |
| 17293 |
var value = args[3] || args[4] || args[5] || ''; |
| 17294 |
var shouldDecodeNewlines = tagName === 'a' && args[1] === 'href' |
| 17295 |
? options.shouldDecodeNewlinesForHref |
| 17296 |
: options.shouldDecodeNewlines; |
| 17297 |
attrs[i] = { |
| 17298 |
name: args[1], |
| 17299 |
value: decodeAttr(value, shouldDecodeNewlines) |
| 17300 |
}; |
| 17301 |
if ( true && options.outputSourceRange) { |
| 17302 |
attrs[i].start = args.start + args[0].match(/^\s*/).length; |
| 17303 |
attrs[i].end = args.end; |
| 17304 |
} |
| 17305 |
} |
| 17306 |
|
| 17307 |
if (!unary) { |
| 17308 |
stack.push({ tag: tagName, lowerCasedTag: tagName.toLowerCase(), attrs: attrs, start: match.start, end: match.end }); |
| 17309 |
lastTag = tagName; |
| 17310 |
} |
| 17311 |
|
| 17312 |
if (options.start) { |
| 17313 |
options.start(tagName, attrs, unary, match.start, match.end); |
| 17314 |
} |
| 17315 |
} |
| 17316 |
|
| 17317 |
function parseEndTag (tagName, start, end) { |
| 17318 |
var pos, lowerCasedTagName; |
| 17319 |
if (start == null) { start = index; } |
| 17320 |
if (end == null) { end = index; } |
| 17321 |
|
| 17322 |
// Find the closest opened tag of the same type |
| 17323 |
if (tagName) { |
| 17324 |
lowerCasedTagName = tagName.toLowerCase(); |
| 17325 |
for (pos = stack.length - 1; pos >= 0; pos--) { |
| 17326 |
if (stack[pos].lowerCasedTag === lowerCasedTagName) { |
| 17327 |
break |
| 17328 |
} |
| 17329 |
} |
| 17330 |
} else { |
| 17331 |
// If no tag name is provided, clean shop |
| 17332 |
pos = 0; |
| 17333 |
} |
| 17334 |
|
| 17335 |
if (pos >= 0) { |
| 17336 |
// Close all the open elements, up the stack |
| 17337 |
for (var i = stack.length - 1; i >= pos; i--) { |
| 17338 |
if ( true && |
| 17339 |
(i > pos || !tagName) && |
| 17340 |
options.warn |
| 17341 |
) { |
| 17342 |
options.warn( |
| 17343 |
("tag <" + (stack[i].tag) + "> has no matching end tag."), |
| 17344 |
{ start: stack[i].start, end: stack[i].end } |
| 17345 |
); |
| 17346 |
} |
| 17347 |
if (options.end) { |
| 17348 |
options.end(stack[i].tag, start, end); |
| 17349 |
} |
| 17350 |
} |
| 17351 |
|
| 17352 |
// Remove the open elements from the stack |
| 17353 |
stack.length = pos; |
| 17354 |
lastTag = pos && stack[pos - 1].tag; |
| 17355 |
} else if (lowerCasedTagName === 'br') { |
| 17356 |
if (options.start) { |
| 17357 |
options.start(tagName, [], true, start, end); |
| 17358 |
} |
| 17359 |
} else if (lowerCasedTagName === 'p') { |
| 17360 |
if (options.start) { |
| 17361 |
options.start(tagName, [], false, start, end); |
| 17362 |
} |
| 17363 |
if (options.end) { |
| 17364 |
options.end(tagName, start, end); |
| 17365 |
} |
| 17366 |
} |
| 17367 |
} |
| 17368 |
} |
| 17369 |
|
| 17370 |
/* */ |
| 17371 |
|
| 17372 |
var onRE = /^@|^v-on:/; |
| 17373 |
var dirRE = /^v-|^@|^:|^#/; |
| 17374 |
var forAliasRE = /([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/; |
| 17375 |
var forIteratorRE = /,([^,\}\]]*)(?:,([^,\}\]]*))?$/; |
| 17376 |
var stripParensRE = /^\(|\)$/g; |
| 17377 |
var dynamicArgRE = /^\[.*\]$/; |
| 17378 |
|
| 17379 |
var argRE = /:(.*)$/; |
| 17380 |
var bindRE = /^:|^\.|^v-bind:/; |
| 17381 |
var modifierRE = /\.[^.\]]+(?=[^\]]*$)/g; |
| 17382 |
|
| 17383 |
var slotRE = /^v-slot(:|$)|^#/; |
| 17384 |
|
| 17385 |
var lineBreakRE = /[\r\n]/; |
| 17386 |
var whitespaceRE$1 = /[ \f\t\r\n]+/g; |
| 17387 |
|
| 17388 |
var invalidAttributeRE = /[\s"'<>\/=]/; |
| 17389 |
|
| 17390 |
var decodeHTMLCached = cached(he.decode); |
| 17391 |
|
| 17392 |
var emptySlotScopeToken = "_empty_"; |
| 17393 |
|
| 17394 |
// configurable state |
| 17395 |
var warn$2; |
| 17396 |
var delimiters; |
| 17397 |
var transforms; |
| 17398 |
var preTransforms; |
| 17399 |
var postTransforms; |
| 17400 |
var platformIsPreTag; |
| 17401 |
var platformMustUseProp; |
| 17402 |
var platformGetTagNamespace; |
| 17403 |
var maybeComponent; |
| 17404 |
|
| 17405 |
function createASTElement ( |
| 17406 |
tag, |
| 17407 |
attrs, |
| 17408 |
parent |
| 17409 |
) { |
| 17410 |
return { |
| 17411 |
type: 1, |
| 17412 |
tag: tag, |
| 17413 |
attrsList: attrs, |
| 17414 |
attrsMap: makeAttrsMap(attrs), |
| 17415 |
rawAttrsMap: {}, |
| 17416 |
parent: parent, |
| 17417 |
children: [] |
| 17418 |
} |
| 17419 |
} |
| 17420 |
|
| 17421 |
/** |
| 17422 |
* Convert HTML string to AST. |
| 17423 |
*/ |
| 17424 |
function parse ( |
| 17425 |
template, |
| 17426 |
options |
| 17427 |
) { |
| 17428 |
warn$2 = options.warn || baseWarn; |
| 17429 |
|
| 17430 |
platformIsPreTag = options.isPreTag || no; |
| 17431 |
platformMustUseProp = options.mustUseProp || no; |
| 17432 |
platformGetTagNamespace = options.getTagNamespace || no; |
| 17433 |
var isReservedTag = options.isReservedTag || no; |
| 17434 |
maybeComponent = function (el) { return !!( |
| 17435 |
el.component || |
| 17436 |
el.attrsMap[':is'] || |
| 17437 |
el.attrsMap['v-bind:is'] || |
| 17438 |
!(el.attrsMap.is ? isReservedTag(el.attrsMap.is) : isReservedTag(el.tag)) |
| 17439 |
); }; |
| 17440 |
transforms = pluckModuleFunction(options.modules, 'transformNode'); |
| 17441 |
preTransforms = pluckModuleFunction(options.modules, 'preTransformNode'); |
| 17442 |
postTransforms = pluckModuleFunction(options.modules, 'postTransformNode'); |
| 17443 |
|
| 17444 |
delimiters = options.delimiters; |
| 17445 |
|
| 17446 |
var stack = []; |
| 17447 |
var preserveWhitespace = options.preserveWhitespace !== false; |
| 17448 |
var whitespaceOption = options.whitespace; |
| 17449 |
var root; |
| 17450 |
var currentParent; |
| 17451 |
var inVPre = false; |
| 17452 |
var inPre = false; |
| 17453 |
var warned = false; |
| 17454 |
|
| 17455 |
function warnOnce (msg, range) { |
| 17456 |
if (!warned) { |
| 17457 |
warned = true; |
| 17458 |
warn$2(msg, range); |
| 17459 |
} |
| 17460 |
} |
| 17461 |
|
| 17462 |
function closeElement (element) { |
| 17463 |
trimEndingWhitespace(element); |
| 17464 |
if (!inVPre && !element.processed) { |
| 17465 |
element = processElement(element, options); |
| 17466 |
} |
| 17467 |
// tree management |
| 17468 |
if (!stack.length && element !== root) { |
| 17469 |
// allow root elements with v-if, v-else-if and v-else |
| 17470 |
if (root.if && (element.elseif || element.else)) { |
| 17471 |
if (true) { |
| 17472 |
checkRootConstraints(element); |
| 17473 |
} |
| 17474 |
addIfCondition(root, { |
| 17475 |
exp: element.elseif, |
| 17476 |
block: element |
| 17477 |
}); |
| 17478 |
} else if (true) { |
| 17479 |
warnOnce( |
| 17480 |
"Component template should contain exactly one root element. " + |
| 17481 |
"If you are using v-if on multiple elements, " + |
| 17482 |
"use v-else-if to chain them instead.", |
| 17483 |
{ start: element.start } |
| 17484 |
); |
| 17485 |
} |
| 17486 |
} |
| 17487 |
if (currentParent && !element.forbidden) { |
| 17488 |
if (element.elseif || element.else) { |
| 17489 |
processIfConditions(element, currentParent); |
| 17490 |
} else { |
| 17491 |
if (element.slotScope) { |
| 17492 |
// scoped slot |
| 17493 |
// keep it in the children list so that v-else(-if) conditions can |
| 17494 |
// find it as the prev node. |
| 17495 |
var name = element.slotTarget || '"default"' |
| 17496 |
;(currentParent.scopedSlots || (currentParent.scopedSlots = {}))[name] = element; |
| 17497 |
} |
| 17498 |
currentParent.children.push(element); |
| 17499 |
element.parent = currentParent; |
| 17500 |
} |
| 17501 |
} |
| 17502 |
|
| 17503 |
// final children cleanup |
| 17504 |
// filter out scoped slots |
| 17505 |
element.children = element.children.filter(function (c) { return !(c).slotScope; }); |
| 17506 |
// remove trailing whitespace node again |
| 17507 |
trimEndingWhitespace(element); |
| 17508 |
|
| 17509 |
// check pre state |
| 17510 |
if (element.pre) { |
| 17511 |
inVPre = false; |
| 17512 |
} |
| 17513 |
if (platformIsPreTag(element.tag)) { |
| 17514 |
inPre = false; |
| 17515 |
} |
| 17516 |
// apply post-transforms |
| 17517 |
for (var i = 0; i < postTransforms.length; i++) { |
| 17518 |
postTransforms[i](element, options); |
| 17519 |
} |
| 17520 |
} |
| 17521 |
|
| 17522 |
function trimEndingWhitespace (el) { |
| 17523 |
// remove trailing whitespace node |
| 17524 |
if (!inPre) { |
| 17525 |
var lastNode; |
| 17526 |
while ( |
| 17527 |
(lastNode = el.children[el.children.length - 1]) && |
| 17528 |
lastNode.type === 3 && |
| 17529 |
lastNode.text === ' ' |
| 17530 |
) { |
| 17531 |
el.children.pop(); |
| 17532 |
} |
| 17533 |
} |
| 17534 |
} |
| 17535 |
|
| 17536 |
function checkRootConstraints (el) { |
| 17537 |
if (el.tag === 'slot' || el.tag === 'template') { |
| 17538 |
warnOnce( |
| 17539 |
"Cannot use <" + (el.tag) + "> as component root element because it may " + |
| 17540 |
'contain multiple nodes.', |
| 17541 |
{ start: el.start } |
| 17542 |
); |
| 17543 |
} |
| 17544 |
if (el.attrsMap.hasOwnProperty('v-for')) { |
| 17545 |
warnOnce( |
| 17546 |
'Cannot use v-for on stateful component root element because ' + |
| 17547 |
'it renders multiple elements.', |
| 17548 |
el.rawAttrsMap['v-for'] |
| 17549 |
); |
| 17550 |
} |
| 17551 |
} |
| 17552 |
|
| 17553 |
parseHTML(template, { |
| 17554 |
warn: warn$2, |
| 17555 |
expectHTML: options.expectHTML, |
| 17556 |
isUnaryTag: options.isUnaryTag, |
| 17557 |
canBeLeftOpenTag: options.canBeLeftOpenTag, |
| 17558 |
shouldDecodeNewlines: options.shouldDecodeNewlines, |
| 17559 |
shouldDecodeNewlinesForHref: options.shouldDecodeNewlinesForHref, |
| 17560 |
shouldKeepComment: options.comments, |
| 17561 |
outputSourceRange: options.outputSourceRange, |
| 17562 |
start: function start (tag, attrs, unary, start$1, end) { |
| 17563 |
// check namespace. |
| 17564 |
// inherit parent ns if there is one |
| 17565 |
var ns = (currentParent && currentParent.ns) || platformGetTagNamespace(tag); |
| 17566 |
|
| 17567 |
// handle IE svg bug |
| 17568 |
/* istanbul ignore if */ |
| 17569 |
if (isIE && ns === 'svg') { |
| 17570 |
attrs = guardIESVGBug(attrs); |
| 17571 |
} |
| 17572 |
|
| 17573 |
var element = createASTElement(tag, attrs, currentParent); |
| 17574 |
if (ns) { |
| 17575 |
element.ns = ns; |
| 17576 |
} |
| 17577 |
|
| 17578 |
if (true) { |
| 17579 |
if (options.outputSourceRange) { |
| 17580 |
element.start = start$1; |
| 17581 |
element.end = end; |
| 17582 |
element.rawAttrsMap = element.attrsList.reduce(function (cumulated, attr) { |
| 17583 |
cumulated[attr.name] = attr; |
| 17584 |
return cumulated |
| 17585 |
}, {}); |
| 17586 |
} |
| 17587 |
attrs.forEach(function (attr) { |
| 17588 |
if (invalidAttributeRE.test(attr.name)) { |
| 17589 |
warn$2( |
| 17590 |
"Invalid dynamic argument expression: attribute names cannot contain " + |
| 17591 |
"spaces, quotes, <, >, / or =.", |
| 17592 |
{ |
| 17593 |
start: attr.start + attr.name.indexOf("["), |
| 17594 |
end: attr.start + attr.name.length |
| 17595 |
} |
| 17596 |
); |
| 17597 |
} |
| 17598 |
}); |
| 17599 |
} |
| 17600 |
|
| 17601 |
if (isForbiddenTag(element) && !isServerRendering()) { |
| 17602 |
element.forbidden = true; |
| 17603 |
true && warn$2( |
| 17604 |
'Templates should only be responsible for mapping the state to the ' + |
| 17605 |
'UI. Avoid placing tags with side-effects in your templates, such as ' + |
| 17606 |
"<" + tag + ">" + ', as they will not be parsed.', |
| 17607 |
{ start: element.start } |
| 17608 |
); |
| 17609 |
} |
| 17610 |
|
| 17611 |
// apply pre-transforms |
| 17612 |
for (var i = 0; i < preTransforms.length; i++) { |
| 17613 |
element = preTransforms[i](element, options) || element; |
| 17614 |
} |
| 17615 |
|
| 17616 |
if (!inVPre) { |
| 17617 |
processPre(element); |
| 17618 |
if (element.pre) { |
| 17619 |
inVPre = true; |
| 17620 |
} |
| 17621 |
} |
| 17622 |
if (platformIsPreTag(element.tag)) { |
| 17623 |
inPre = true; |
| 17624 |
} |
| 17625 |
if (inVPre) { |
| 17626 |
processRawAttrs(element); |
| 17627 |
} else if (!element.processed) { |
| 17628 |
// structural directives |
| 17629 |
processFor(element); |
| 17630 |
processIf(element); |
| 17631 |
processOnce(element); |
| 17632 |
} |
| 17633 |
|
| 17634 |
if (!root) { |
| 17635 |
root = element; |
| 17636 |
if (true) { |
| 17637 |
checkRootConstraints(root); |
| 17638 |
} |
| 17639 |
} |
| 17640 |
|
| 17641 |
if (!unary) { |
| 17642 |
currentParent = element; |
| 17643 |
stack.push(element); |
| 17644 |
} else { |
| 17645 |
closeElement(element); |
| 17646 |
} |
| 17647 |
}, |
| 17648 |
|
| 17649 |
end: function end (tag, start, end$1) { |
| 17650 |
var element = stack[stack.length - 1]; |
| 17651 |
// pop stack |
| 17652 |
stack.length -= 1; |
| 17653 |
currentParent = stack[stack.length - 1]; |
| 17654 |
if ( true && options.outputSourceRange) { |
| 17655 |
element.end = end$1; |
| 17656 |
} |
| 17657 |
closeElement(element); |
| 17658 |
}, |
| 17659 |
|
| 17660 |
chars: function chars (text, start, end) { |
| 17661 |
if (!currentParent) { |
| 17662 |
if (true) { |
| 17663 |
if (text === template) { |
| 17664 |
warnOnce( |
| 17665 |
'Component template requires a root element, rather than just text.', |
| 17666 |
{ start: start } |
| 17667 |
); |
| 17668 |
} else if ((text = text.trim())) { |
| 17669 |
warnOnce( |
| 17670 |
("text \"" + text + "\" outside root element will be ignored."), |
| 17671 |
{ start: start } |
| 17672 |
); |
| 17673 |
} |
| 17674 |
} |
| 17675 |
return |
| 17676 |
} |
| 17677 |
// IE textarea placeholder bug |
| 17678 |
/* istanbul ignore if */ |
| 17679 |
if (isIE && |
| 17680 |
currentParent.tag === 'textarea' && |
| 17681 |
currentParent.attrsMap.placeholder === text |
| 17682 |
) { |
| 17683 |
return |
| 17684 |
} |
| 17685 |
var children = currentParent.children; |
| 17686 |
if (inPre || text.trim()) { |
| 17687 |
text = isTextTag(currentParent) ? text : decodeHTMLCached(text); |
| 17688 |
} else if (!children.length) { |
| 17689 |
// remove the whitespace-only node right after an opening tag |
| 17690 |
text = ''; |
| 17691 |
} else if (whitespaceOption) { |
| 17692 |
if (whitespaceOption === 'condense') { |
| 17693 |
// in condense mode, remove the whitespace node if it contains |
| 17694 |
// line break, otherwise condense to a single space |
| 17695 |
text = lineBreakRE.test(text) ? '' : ' '; |
| 17696 |
} else { |
| 17697 |
text = ' '; |
| 17698 |
} |
| 17699 |
} else { |
| 17700 |
text = preserveWhitespace ? ' ' : ''; |
| 17701 |
} |
| 17702 |
if (text) { |
| 17703 |
if (!inPre && whitespaceOption === 'condense') { |
| 17704 |
// condense consecutive whitespaces into single space |
| 17705 |
text = text.replace(whitespaceRE$1, ' '); |
| 17706 |
} |
| 17707 |
var res; |
| 17708 |
var child; |
| 17709 |
if (!inVPre && text !== ' ' && (res = parseText(text, delimiters))) { |
| 17710 |
child = { |
| 17711 |
type: 2, |
| 17712 |
expression: res.expression, |
| 17713 |
tokens: res.tokens, |
| 17714 |
text: text |
| 17715 |
}; |
| 17716 |
} else if (text !== ' ' || !children.length || children[children.length - 1].text !== ' ') { |
| 17717 |
child = { |
| 17718 |
type: 3, |
| 17719 |
text: text |
| 17720 |
}; |
| 17721 |
} |
| 17722 |
if (child) { |
| 17723 |
if ( true && options.outputSourceRange) { |
| 17724 |
child.start = start; |
| 17725 |
child.end = end; |
| 17726 |
} |
| 17727 |
children.push(child); |
| 17728 |
} |
| 17729 |
} |
| 17730 |
}, |
| 17731 |
comment: function comment (text, start, end) { |
| 17732 |
// adding anything as a sibling to the root node is forbidden |
| 17733 |
// comments should still be allowed, but ignored |
| 17734 |
if (currentParent) { |
| 17735 |
var child = { |
| 17736 |
type: 3, |
| 17737 |
text: text, |
| 17738 |
isComment: true |
| 17739 |
}; |
| 17740 |
if ( true && options.outputSourceRange) { |
| 17741 |
child.start = start; |
| 17742 |
child.end = end; |
| 17743 |
} |
| 17744 |
currentParent.children.push(child); |
| 17745 |
} |
| 17746 |
} |
| 17747 |
}); |
| 17748 |
return root |
| 17749 |
} |
| 17750 |
|
| 17751 |
function processPre (el) { |
| 17752 |
if (getAndRemoveAttr(el, 'v-pre') != null) { |
| 17753 |
el.pre = true; |
| 17754 |
} |
| 17755 |
} |
| 17756 |
|
| 17757 |
function processRawAttrs (el) { |
| 17758 |
var list = el.attrsList; |
| 17759 |
var len = list.length; |
| 17760 |
if (len) { |
| 17761 |
var attrs = el.attrs = new Array(len); |
| 17762 |
for (var i = 0; i < len; i++) { |
| 17763 |
attrs[i] = { |
| 17764 |
name: list[i].name, |
| 17765 |
value: JSON.stringify(list[i].value) |
| 17766 |
}; |
| 17767 |
if (list[i].start != null) { |
| 17768 |
attrs[i].start = list[i].start; |
| 17769 |
attrs[i].end = list[i].end; |
| 17770 |
} |
| 17771 |
} |
| 17772 |
} else if (!el.pre) { |
| 17773 |
// non root node in pre blocks with no attributes |
| 17774 |
el.plain = true; |
| 17775 |
} |
| 17776 |
} |
| 17777 |
|
| 17778 |
function processElement ( |
| 17779 |
element, |
| 17780 |
options |
| 17781 |
) { |
| 17782 |
processKey(element); |
| 17783 |
|
| 17784 |
// determine whether this is a plain element after |
| 17785 |
// removing structural attributes |
| 17786 |
element.plain = ( |
| 17787 |
!element.key && |
| 17788 |
!element.scopedSlots && |
| 17789 |
!element.attrsList.length |
| 17790 |
); |
| 17791 |
|
| 17792 |
processRef(element); |
| 17793 |
processSlotContent(element); |
| 17794 |
processSlotOutlet(element); |
| 17795 |
processComponent(element); |
| 17796 |
for (var i = 0; i < transforms.length; i++) { |
| 17797 |
element = transforms[i](element, options) || element; |
| 17798 |
} |
| 17799 |
processAttrs(element); |
| 17800 |
return element |
| 17801 |
} |
| 17802 |
|
| 17803 |
function processKey (el) { |
| 17804 |
var exp = getBindingAttr(el, 'key'); |
| 17805 |
if (exp) { |
| 17806 |
if (true) { |
| 17807 |
if (el.tag === 'template') { |
| 17808 |
warn$2( |
| 17809 |
"<template> cannot be keyed. Place the key on real elements instead.", |
| 17810 |
getRawBindingAttr(el, 'key') |
| 17811 |
); |
| 17812 |
} |
| 17813 |
if (el.for) { |
| 17814 |
var iterator = el.iterator2 || el.iterator1; |
| 17815 |
var parent = el.parent; |
| 17816 |
if (iterator && iterator === exp && parent && parent.tag === 'transition-group') { |
| 17817 |
warn$2( |
| 17818 |
"Do not use v-for index as key on <transition-group> children, " + |
| 17819 |
"this is the same as not using keys.", |
| 17820 |
getRawBindingAttr(el, 'key'), |
| 17821 |
true /* tip */ |
| 17822 |
); |
| 17823 |
} |
| 17824 |
} |
| 17825 |
} |
| 17826 |
el.key = exp; |
| 17827 |
} |
| 17828 |
} |
| 17829 |
|
| 17830 |
function processRef (el) { |
| 17831 |
var ref = getBindingAttr(el, 'ref'); |
| 17832 |
if (ref) { |
| 17833 |
el.ref = ref; |
| 17834 |
el.refInFor = checkInFor(el); |
| 17835 |
} |
| 17836 |
} |
| 17837 |
|
| 17838 |
function processFor (el) { |
| 17839 |
var exp; |
| 17840 |
if ((exp = getAndRemoveAttr(el, 'v-for'))) { |
| 17841 |
var res = parseFor(exp); |
| 17842 |
if (res) { |
| 17843 |
extend(el, res); |
| 17844 |
} else if (true) { |
| 17845 |
warn$2( |
| 17846 |
("Invalid v-for expression: " + exp), |
| 17847 |
el.rawAttrsMap['v-for'] |
| 17848 |
); |
| 17849 |
} |
| 17850 |
} |
| 17851 |
} |
| 17852 |
|
| 17853 |
|
| 17854 |
|
| 17855 |
function parseFor (exp) { |
| 17856 |
var inMatch = exp.match(forAliasRE); |
| 17857 |
if (!inMatch) { return } |
| 17858 |
var res = {}; |
| 17859 |
res.for = inMatch[2].trim(); |
| 17860 |
var alias = inMatch[1].trim().replace(stripParensRE, ''); |
| 17861 |
var iteratorMatch = alias.match(forIteratorRE); |
| 17862 |
if (iteratorMatch) { |
| 17863 |
res.alias = alias.replace(forIteratorRE, '').trim(); |
| 17864 |
res.iterator1 = iteratorMatch[1].trim(); |
| 17865 |
if (iteratorMatch[2]) { |
| 17866 |
res.iterator2 = iteratorMatch[2].trim(); |
| 17867 |
} |
| 17868 |
} else { |
| 17869 |
res.alias = alias; |
| 17870 |
} |
| 17871 |
return res |
| 17872 |
} |
| 17873 |
|
| 17874 |
function processIf (el) { |
| 17875 |
var exp = getAndRemoveAttr(el, 'v-if'); |
| 17876 |
if (exp) { |
| 17877 |
el.if = exp; |
| 17878 |
addIfCondition(el, { |
| 17879 |
exp: exp, |
| 17880 |
block: el |
| 17881 |
}); |
| 17882 |
} else { |
| 17883 |
if (getAndRemoveAttr(el, 'v-else') != null) { |
| 17884 |
el.else = true; |
| 17885 |
} |
| 17886 |
var elseif = getAndRemoveAttr(el, 'v-else-if'); |
| 17887 |
if (elseif) { |
| 17888 |
el.elseif = elseif; |
| 17889 |
} |
| 17890 |
} |
| 17891 |
} |
| 17892 |
|
| 17893 |
function processIfConditions (el, parent) { |
| 17894 |
var prev = findPrevElement(parent.children); |
| 17895 |
if (prev && prev.if) { |
| 17896 |
addIfCondition(prev, { |
| 17897 |
exp: el.elseif, |
| 17898 |
block: el |
| 17899 |
}); |
| 17900 |
} else if (true) { |
| 17901 |
warn$2( |
| 17902 |
"v-" + (el.elseif ? ('else-if="' + el.elseif + '"') : 'else') + " " + |
| 17903 |
"used on element <" + (el.tag) + "> without corresponding v-if.", |
| 17904 |
el.rawAttrsMap[el.elseif ? 'v-else-if' : 'v-else'] |
| 17905 |
); |
| 17906 |
} |
| 17907 |
} |
| 17908 |
|
| 17909 |
function findPrevElement (children) { |
| 17910 |
var i = children.length; |
| 17911 |
while (i--) { |
| 17912 |
if (children[i].type === 1) { |
| 17913 |
return children[i] |
| 17914 |
} else { |
| 17915 |
if ( true && children[i].text !== ' ') { |
| 17916 |
warn$2( |
| 17917 |
"text \"" + (children[i].text.trim()) + "\" between v-if and v-else(-if) " + |
| 17918 |
"will be ignored.", |
| 17919 |
children[i] |
| 17920 |
); |
| 17921 |
} |
| 17922 |
children.pop(); |
| 17923 |
} |
| 17924 |
} |
| 17925 |
} |
| 17926 |
|
| 17927 |
function addIfCondition (el, condition) { |
| 17928 |
if (!el.ifConditions) { |
| 17929 |
el.ifConditions = []; |
| 17930 |
} |
| 17931 |
el.ifConditions.push(condition); |
| 17932 |
} |
| 17933 |
|
| 17934 |
function processOnce (el) { |
| 17935 |
var once$$1 = getAndRemoveAttr(el, 'v-once'); |
| 17936 |
if (once$$1 != null) { |
| 17937 |
el.once = true; |
| 17938 |
} |
| 17939 |
} |
| 17940 |
|
| 17941 |
// handle content being passed to a component as slot, |
| 17942 |
// e.g. <template slot="xxx">, <div slot-scope="xxx"> |
| 17943 |
function processSlotContent (el) { |
| 17944 |
var slotScope; |
| 17945 |
if (el.tag === 'template') { |
| 17946 |
slotScope = getAndRemoveAttr(el, 'scope'); |
| 17947 |
/* istanbul ignore if */ |
| 17948 |
if ( true && slotScope) { |
| 17949 |
warn$2( |
| 17950 |
"the \"scope\" attribute for scoped slots have been deprecated and " + |
| 17951 |
"replaced by \"slot-scope\" since 2.5. The new \"slot-scope\" attribute " + |
| 17952 |
"can also be used on plain elements in addition to <template> to " + |
| 17953 |
"denote scoped slots.", |
| 17954 |
el.rawAttrsMap['scope'], |
| 17955 |
true |
| 17956 |
); |
| 17957 |
} |
| 17958 |
el.slotScope = slotScope || getAndRemoveAttr(el, 'slot-scope'); |
| 17959 |
} else if ((slotScope = getAndRemoveAttr(el, 'slot-scope'))) { |
| 17960 |
/* istanbul ignore if */ |
| 17961 |
if ( true && el.attrsMap['v-for']) { |
| 17962 |
warn$2( |
| 17963 |
"Ambiguous combined usage of slot-scope and v-for on <" + (el.tag) + "> " + |
| 17964 |
"(v-for takes higher priority). Use a wrapper <template> for the " + |
| 17965 |
"scoped slot to make it clearer.", |
| 17966 |
el.rawAttrsMap['slot-scope'], |
| 17967 |
true |
| 17968 |
); |
| 17969 |
} |
| 17970 |
el.slotScope = slotScope; |
| 17971 |
} |
| 17972 |
|
| 17973 |
// slot="xxx" |
| 17974 |
var slotTarget = getBindingAttr(el, 'slot'); |
| 17975 |
if (slotTarget) { |
| 17976 |
el.slotTarget = slotTarget === '""' ? '"default"' : slotTarget; |
| 17977 |
el.slotTargetDynamic = !!(el.attrsMap[':slot'] || el.attrsMap['v-bind:slot']); |
| 17978 |
// preserve slot as an attribute for native shadow DOM compat |
| 17979 |
// only for non-scoped slots. |
| 17980 |
if (el.tag !== 'template' && !el.slotScope) { |
| 17981 |
addAttr(el, 'slot', slotTarget, getRawBindingAttr(el, 'slot')); |
| 17982 |
} |
| 17983 |
} |
| 17984 |
|
| 17985 |
// 2.6 v-slot syntax |
| 17986 |
{ |
| 17987 |
if (el.tag === 'template') { |
| 17988 |
// v-slot on <template> |
| 17989 |
var slotBinding = getAndRemoveAttrByRegex(el, slotRE); |
| 17990 |
if (slotBinding) { |
| 17991 |
if (true) { |
| 17992 |
if (el.slotTarget || el.slotScope) { |
| 17993 |
warn$2( |
| 17994 |
"Unexpected mixed usage of different slot syntaxes.", |
| 17995 |
el |
| 17996 |
); |
| 17997 |
} |
| 17998 |
if (el.parent && !maybeComponent(el.parent)) { |
| 17999 |
warn$2( |
| 18000 |
"<template v-slot> can only appear at the root level inside " + |
| 18001 |
"the receiving component", |
| 18002 |
el |
| 18003 |
); |
| 18004 |
} |
| 18005 |
} |
| 18006 |
var ref = getSlotName(slotBinding); |
| 18007 |
var name = ref.name; |
| 18008 |
var dynamic = ref.dynamic; |
| 18009 |
el.slotTarget = name; |
| 18010 |
el.slotTargetDynamic = dynamic; |
| 18011 |
el.slotScope = slotBinding.value || emptySlotScopeToken; // force it into a scoped slot for perf |
| 18012 |
} |
| 18013 |
} else { |
| 18014 |
// v-slot on component, denotes default slot |
| 18015 |
var slotBinding$1 = getAndRemoveAttrByRegex(el, slotRE); |
| 18016 |
if (slotBinding$1) { |
| 18017 |
if (true) { |
| 18018 |
if (!maybeComponent(el)) { |
| 18019 |
warn$2( |
| 18020 |
"v-slot can only be used on components or <template>.", |
| 18021 |
slotBinding$1 |
| 18022 |
); |
| 18023 |
} |
| 18024 |
if (el.slotScope || el.slotTarget) { |
| 18025 |
warn$2( |
| 18026 |
"Unexpected mixed usage of different slot syntaxes.", |
| 18027 |
el |
| 18028 |
); |
| 18029 |
} |
| 18030 |
if (el.scopedSlots) { |
| 18031 |
warn$2( |
| 18032 |
"To avoid scope ambiguity, the default slot should also use " + |
| 18033 |
"<template> syntax when there are other named slots.", |
| 18034 |
slotBinding$1 |
| 18035 |
); |
| 18036 |
} |
| 18037 |
} |
| 18038 |
// add the component's children to its default slot |
| 18039 |
var slots = el.scopedSlots || (el.scopedSlots = {}); |
| 18040 |
var ref$1 = getSlotName(slotBinding$1); |
| 18041 |
var name$1 = ref$1.name; |
| 18042 |
var dynamic$1 = ref$1.dynamic; |
| 18043 |
var slotContainer = slots[name$1] = createASTElement('template', [], el); |
| 18044 |
slotContainer.slotTarget = name$1; |
| 18045 |
slotContainer.slotTargetDynamic = dynamic$1; |
| 18046 |
slotContainer.children = el.children.filter(function (c) { |
| 18047 |
if (!c.slotScope) { |
| 18048 |
c.parent = slotContainer; |
| 18049 |
return true |
| 18050 |
} |
| 18051 |
}); |
| 18052 |
slotContainer.slotScope = slotBinding$1.value || emptySlotScopeToken; |
| 18053 |
// remove children as they are returned from scopedSlots now |
| 18054 |
el.children = []; |
| 18055 |
// mark el non-plain so data gets generated |
| 18056 |
el.plain = false; |
| 18057 |
} |
| 18058 |
} |
| 18059 |
} |
| 18060 |
} |
| 18061 |
|
| 18062 |
function getSlotName (binding) { |
| 18063 |
var name = binding.name.replace(slotRE, ''); |
| 18064 |
if (!name) { |
| 18065 |
if (binding.name[0] !== '#') { |
| 18066 |
name = 'default'; |
| 18067 |
} else if (true) { |
| 18068 |
warn$2( |
| 18069 |
"v-slot shorthand syntax requires a slot name.", |
| 18070 |
binding |
| 18071 |
); |
| 18072 |
} |
| 18073 |
} |
| 18074 |
return dynamicArgRE.test(name) |
| 18075 |
// dynamic [name] |
| 18076 |
? { name: name.slice(1, -1), dynamic: true } |
| 18077 |
// static name |
| 18078 |
: { name: ("\"" + name + "\""), dynamic: false } |
| 18079 |
} |
| 18080 |
|
| 18081 |
// handle <slot/> outlets |
| 18082 |
function processSlotOutlet (el) { |
| 18083 |
if (el.tag === 'slot') { |
| 18084 |
el.slotName = getBindingAttr(el, 'name'); |
| 18085 |
if ( true && el.key) { |
| 18086 |
warn$2( |
| 18087 |
"`key` does not work on <slot> because slots are abstract outlets " + |
| 18088 |
"and can possibly expand into multiple elements. " + |
| 18089 |
"Use the key on a wrapping element instead.", |
| 18090 |
getRawBindingAttr(el, 'key') |
| 18091 |
); |
| 18092 |
} |
| 18093 |
} |
| 18094 |
} |
| 18095 |
|
| 18096 |
function processComponent (el) { |
| 18097 |
var binding; |
| 18098 |
if ((binding = getBindingAttr(el, 'is'))) { |
| 18099 |
el.component = binding; |
| 18100 |
} |
| 18101 |
if (getAndRemoveAttr(el, 'inline-template') != null) { |
| 18102 |
el.inlineTemplate = true; |
| 18103 |
} |
| 18104 |
} |
| 18105 |
|
| 18106 |
function processAttrs (el) { |
| 18107 |
var list = el.attrsList; |
| 18108 |
var i, l, name, rawName, value, modifiers, syncGen, isDynamic; |
| 18109 |
for (i = 0, l = list.length; i < l; i++) { |
| 18110 |
name = rawName = list[i].name; |
| 18111 |
value = list[i].value; |
| 18112 |
if (dirRE.test(name)) { |
| 18113 |
// mark element as dynamic |
| 18114 |
el.hasBindings = true; |
| 18115 |
// modifiers |
| 18116 |
modifiers = parseModifiers(name.replace(dirRE, '')); |
| 18117 |
// support .foo shorthand syntax for the .prop modifier |
| 18118 |
if (modifiers) { |
| 18119 |
name = name.replace(modifierRE, ''); |
| 18120 |
} |
| 18121 |
if (bindRE.test(name)) { // v-bind |
| 18122 |
name = name.replace(bindRE, ''); |
| 18123 |
value = parseFilters(value); |
| 18124 |
isDynamic = dynamicArgRE.test(name); |
| 18125 |
if (isDynamic) { |
| 18126 |
name = name.slice(1, -1); |
| 18127 |
} |
| 18128 |
if ( |
| 18129 |
true && |
| 18130 |
value.trim().length === 0 |
| 18131 |
) { |
| 18132 |
warn$2( |
| 18133 |
("The value for a v-bind expression cannot be empty. Found in \"v-bind:" + name + "\"") |
| 18134 |
); |
| 18135 |
} |
| 18136 |
if (modifiers) { |
| 18137 |
if (modifiers.prop && !isDynamic) { |
| 18138 |
name = camelize(name); |
| 18139 |
if (name === 'innerHtml') { name = 'innerHTML'; } |
| 18140 |
} |
| 18141 |
if (modifiers.camel && !isDynamic) { |
| 18142 |
name = camelize(name); |
| 18143 |
} |
| 18144 |
if (modifiers.sync) { |
| 18145 |
syncGen = genAssignmentCode(value, "$event"); |
| 18146 |
if (!isDynamic) { |
| 18147 |
addHandler( |
| 18148 |
el, |
| 18149 |
("update:" + (camelize(name))), |
| 18150 |
syncGen, |
| 18151 |
null, |
| 18152 |
false, |
| 18153 |
warn$2, |
| 18154 |
list[i] |
| 18155 |
); |
| 18156 |
if (hyphenate(name) !== camelize(name)) { |
| 18157 |
addHandler( |
| 18158 |
el, |
| 18159 |
("update:" + (hyphenate(name))), |
| 18160 |
syncGen, |
| 18161 |
null, |
| 18162 |
false, |
| 18163 |
warn$2, |
| 18164 |
list[i] |
| 18165 |
); |
| 18166 |
} |
| 18167 |
} else { |
| 18168 |
// handler w/ dynamic event name |
| 18169 |
addHandler( |
| 18170 |
el, |
| 18171 |
("\"update:\"+(" + name + ")"), |
| 18172 |
syncGen, |
| 18173 |
null, |
| 18174 |
false, |
| 18175 |
warn$2, |
| 18176 |
list[i], |
| 18177 |
true // dynamic |
| 18178 |
); |
| 18179 |
} |
| 18180 |
} |
| 18181 |
} |
| 18182 |
if ((modifiers && modifiers.prop) || ( |
| 18183 |
!el.component && platformMustUseProp(el.tag, el.attrsMap.type, name) |
| 18184 |
)) { |
| 18185 |
addProp(el, name, value, list[i], isDynamic); |
| 18186 |
} else { |
| 18187 |
addAttr(el, name, value, list[i], isDynamic); |
| 18188 |
} |
| 18189 |
} else if (onRE.test(name)) { // v-on |
| 18190 |
name = name.replace(onRE, ''); |
| 18191 |
isDynamic = dynamicArgRE.test(name); |
| 18192 |
if (isDynamic) { |
| 18193 |
name = name.slice(1, -1); |
| 18194 |
} |
| 18195 |
addHandler(el, name, value, modifiers, false, warn$2, list[i], isDynamic); |
| 18196 |
} else { // normal directives |
| 18197 |
name = name.replace(dirRE, ''); |
| 18198 |
// parse arg |
| 18199 |
var argMatch = name.match(argRE); |
| 18200 |
var arg = argMatch && argMatch[1]; |
| 18201 |
isDynamic = false; |
| 18202 |
if (arg) { |
| 18203 |
name = name.slice(0, -(arg.length + 1)); |
| 18204 |
if (dynamicArgRE.test(arg)) { |
| 18205 |
arg = arg.slice(1, -1); |
| 18206 |
isDynamic = true; |
| 18207 |
} |
| 18208 |
} |
| 18209 |
addDirective(el, name, rawName, value, arg, isDynamic, modifiers, list[i]); |
| 18210 |
if ( true && name === 'model') { |
| 18211 |
checkForAliasModel(el, value); |
| 18212 |
} |
| 18213 |
} |
| 18214 |
} else { |
| 18215 |
// literal attribute |
| 18216 |
if (true) { |
| 18217 |
var res = parseText(value, delimiters); |
| 18218 |
if (res) { |
| 18219 |
warn$2( |
| 18220 |
name + "=\"" + value + "\": " + |
| 18221 |
'Interpolation inside attributes has been removed. ' + |
| 18222 |
'Use v-bind or the colon shorthand instead. For example, ' + |
| 18223 |
'instead of <div id="{{ val }}">, use <div :id="val">.', |
| 18224 |
list[i] |
| 18225 |
); |
| 18226 |
} |
| 18227 |
} |
| 18228 |
addAttr(el, name, JSON.stringify(value), list[i]); |
| 18229 |
// #6887 firefox doesn't update muted state if set via attribute |
| 18230 |
// even immediately after element creation |
| 18231 |
if (!el.component && |
| 18232 |
name === 'muted' && |
| 18233 |
platformMustUseProp(el.tag, el.attrsMap.type, name)) { |
| 18234 |
addProp(el, name, 'true', list[i]); |
| 18235 |
} |
| 18236 |
} |
| 18237 |
} |
| 18238 |
} |
| 18239 |
|
| 18240 |
function checkInFor (el) { |
| 18241 |
var parent = el; |
| 18242 |
while (parent) { |
| 18243 |
if (parent.for !== undefined) { |
| 18244 |
return true |
| 18245 |
} |
| 18246 |
parent = parent.parent; |
| 18247 |
} |
| 18248 |
return false |
| 18249 |
} |
| 18250 |
|
| 18251 |
function parseModifiers (name) { |
| 18252 |
var match = name.match(modifierRE); |
| 18253 |
if (match) { |
| 18254 |
var ret = {}; |
| 18255 |
match.forEach(function (m) { ret[m.slice(1)] = true; }); |
| 18256 |
return ret |
| 18257 |
} |
| 18258 |
} |
| 18259 |
|
| 18260 |
function makeAttrsMap (attrs) { |
| 18261 |
var map = {}; |
| 18262 |
for (var i = 0, l = attrs.length; i < l; i++) { |
| 18263 |
if ( |
| 18264 |
true && |
| 18265 |
map[attrs[i].name] && !isIE && !isEdge |
| 18266 |
) { |
| 18267 |
warn$2('duplicate attribute: ' + attrs[i].name, attrs[i]); |
| 18268 |
} |
| 18269 |
map[attrs[i].name] = attrs[i].value; |
| 18270 |
} |
| 18271 |
return map |
| 18272 |
} |
| 18273 |
|
| 18274 |
// for script (e.g. type="x/template") or style, do not decode content |
| 18275 |
function isTextTag (el) { |
| 18276 |
return el.tag === 'script' || el.tag === 'style' |
| 18277 |
} |
| 18278 |
|
| 18279 |
function isForbiddenTag (el) { |
| 18280 |
return ( |
| 18281 |
el.tag === 'style' || |
| 18282 |
(el.tag === 'script' && ( |
| 18283 |
!el.attrsMap.type || |
| 18284 |
el.attrsMap.type === 'text/javascript' |
| 18285 |
)) |
| 18286 |
) |
| 18287 |
} |
| 18288 |
|
| 18289 |
var ieNSBug = /^xmlns:NS\d+/; |
| 18290 |
var ieNSPrefix = /^NS\d+:/; |
| 18291 |
|
| 18292 |
/* istanbul ignore next */ |
| 18293 |
function guardIESVGBug (attrs) { |
| 18294 |
var res = []; |
| 18295 |
for (var i = 0; i < attrs.length; i++) { |
| 18296 |
var attr = attrs[i]; |
| 18297 |
if (!ieNSBug.test(attr.name)) { |
| 18298 |
attr.name = attr.name.replace(ieNSPrefix, ''); |
| 18299 |
res.push(attr); |
| 18300 |
} |
| 18301 |
} |
| 18302 |
return res |
| 18303 |
} |
| 18304 |
|
| 18305 |
function checkForAliasModel (el, value) { |
| 18306 |
var _el = el; |
| 18307 |
while (_el) { |
| 18308 |
if (_el.for && _el.alias === value) { |
| 18309 |
warn$2( |
| 18310 |
"<" + (el.tag) + " v-model=\"" + value + "\">: " + |
| 18311 |
"You are binding v-model directly to a v-for iteration alias. " + |
| 18312 |
"This will not be able to modify the v-for source array because " + |
| 18313 |
"writing to the alias is like modifying a function local variable. " + |
| 18314 |
"Consider using an array of objects and use v-model on an object property instead.", |
| 18315 |
el.rawAttrsMap['v-model'] |
| 18316 |
); |
| 18317 |
} |
| 18318 |
_el = _el.parent; |
| 18319 |
} |
| 18320 |
} |
| 18321 |
|
| 18322 |
/* */ |
| 18323 |
|
| 18324 |
function preTransformNode (el, options) { |
| 18325 |
if (el.tag === 'input') { |
| 18326 |
var map = el.attrsMap; |
| 18327 |
if (!map['v-model']) { |
| 18328 |
return |
| 18329 |
} |
| 18330 |
|
| 18331 |
var typeBinding; |
| 18332 |
if (map[':type'] || map['v-bind:type']) { |
| 18333 |
typeBinding = getBindingAttr(el, 'type'); |
| 18334 |
} |
| 18335 |
if (!map.type && !typeBinding && map['v-bind']) { |
| 18336 |
typeBinding = "(" + (map['v-bind']) + ").type"; |
| 18337 |
} |
| 18338 |
|
| 18339 |
if (typeBinding) { |
| 18340 |
var ifCondition = getAndRemoveAttr(el, 'v-if', true); |
| 18341 |
var ifConditionExtra = ifCondition ? ("&&(" + ifCondition + ")") : ""; |
| 18342 |
var hasElse = getAndRemoveAttr(el, 'v-else', true) != null; |
| 18343 |
var elseIfCondition = getAndRemoveAttr(el, 'v-else-if', true); |
| 18344 |
// 1. checkbox |
| 18345 |
var branch0 = cloneASTElement(el); |
| 18346 |
// process for on the main node |
| 18347 |
processFor(branch0); |
| 18348 |
addRawAttr(branch0, 'type', 'checkbox'); |
| 18349 |
processElement(branch0, options); |
| 18350 |
branch0.processed = true; // prevent it from double-processed |
| 18351 |
branch0.if = "(" + typeBinding + ")==='checkbox'" + ifConditionExtra; |
| 18352 |
addIfCondition(branch0, { |
| 18353 |
exp: branch0.if, |
| 18354 |
block: branch0 |
| 18355 |
}); |
| 18356 |
// 2. add radio else-if condition |
| 18357 |
var branch1 = cloneASTElement(el); |
| 18358 |
getAndRemoveAttr(branch1, 'v-for', true); |
| 18359 |
addRawAttr(branch1, 'type', 'radio'); |
| 18360 |
processElement(branch1, options); |
| 18361 |
addIfCondition(branch0, { |
| 18362 |
exp: "(" + typeBinding + ")==='radio'" + ifConditionExtra, |
| 18363 |
block: branch1 |
| 18364 |
}); |
| 18365 |
// 3. other |
| 18366 |
var branch2 = cloneASTElement(el); |
| 18367 |
getAndRemoveAttr(branch2, 'v-for', true); |
| 18368 |
addRawAttr(branch2, ':type', typeBinding); |
| 18369 |
processElement(branch2, options); |
| 18370 |
addIfCondition(branch0, { |
| 18371 |
exp: ifCondition, |
| 18372 |
block: branch2 |
| 18373 |
}); |
| 18374 |
|
| 18375 |
if (hasElse) { |
| 18376 |
branch0.else = true; |
| 18377 |
} else if (elseIfCondition) { |
| 18378 |
branch0.elseif = elseIfCondition; |
| 18379 |
} |
| 18380 |
|
| 18381 |
return branch0 |
| 18382 |
} |
| 18383 |
} |
| 18384 |
} |
| 18385 |
|
| 18386 |
function cloneASTElement (el) { |
| 18387 |
return createASTElement(el.tag, el.attrsList.slice(), el.parent) |
| 18388 |
} |
| 18389 |
|
| 18390 |
var model$1 = { |
| 18391 |
preTransformNode: preTransformNode |
| 18392 |
}; |
| 18393 |
|
| 18394 |
var modules$1 = [ |
| 18395 |
klass$1, |
| 18396 |
style$1, |
| 18397 |
model$1 |
| 18398 |
]; |
| 18399 |
|
| 18400 |
/* */ |
| 18401 |
|
| 18402 |
function text (el, dir) { |
| 18403 |
if (dir.value) { |
| 18404 |
addProp(el, 'textContent', ("_s(" + (dir.value) + ")"), dir); |
| 18405 |
} |
| 18406 |
} |
| 18407 |
|
| 18408 |
/* */ |
| 18409 |
|
| 18410 |
function html (el, dir) { |
| 18411 |
if (dir.value) { |
| 18412 |
addProp(el, 'innerHTML', ("_s(" + (dir.value) + ")"), dir); |
| 18413 |
} |
| 18414 |
} |
| 18415 |
|
| 18416 |
var directives$1 = { |
| 18417 |
model: model, |
| 18418 |
text: text, |
| 18419 |
html: html |
| 18420 |
}; |
| 18421 |
|
| 18422 |
/* */ |
| 18423 |
|
| 18424 |
var baseOptions = { |
| 18425 |
expectHTML: true, |
| 18426 |
modules: modules$1, |
| 18427 |
directives: directives$1, |
| 18428 |
isPreTag: isPreTag, |
| 18429 |
isUnaryTag: isUnaryTag, |
| 18430 |
mustUseProp: mustUseProp, |
| 18431 |
canBeLeftOpenTag: canBeLeftOpenTag, |
| 18432 |
isReservedTag: isReservedTag, |
| 18433 |
getTagNamespace: getTagNamespace, |
| 18434 |
staticKeys: genStaticKeys(modules$1) |
| 18435 |
}; |
| 18436 |
|
| 18437 |
/* */ |
| 18438 |
|
| 18439 |
var isStaticKey; |
| 18440 |
var isPlatformReservedTag; |
| 18441 |
|
| 18442 |
var genStaticKeysCached = cached(genStaticKeys$1); |
| 18443 |
|
| 18444 |
/** |
| 18445 |
* Goal of the optimizer: walk the generated template AST tree |
| 18446 |
* and detect sub-trees that are purely static, i.e. parts of |
| 18447 |
* the DOM that never needs to change. |
| 18448 |
* |
| 18449 |
* Once we detect these sub-trees, we can: |
| 18450 |
* |
| 18451 |
* 1. Hoist them into constants, so that we no longer need to |
| 18452 |
* create fresh nodes for them on each re-render; |
| 18453 |
* 2. Completely skip them in the patching process. |
| 18454 |
*/ |
| 18455 |
function optimize (root, options) { |
| 18456 |
if (!root) { return } |
| 18457 |
isStaticKey = genStaticKeysCached(options.staticKeys || ''); |
| 18458 |
isPlatformReservedTag = options.isReservedTag || no; |
| 18459 |
// first pass: mark all non-static nodes. |
| 18460 |
markStatic$1(root); |
| 18461 |
// second pass: mark static roots. |
| 18462 |
markStaticRoots(root, false); |
| 18463 |
} |
| 18464 |
|
| 18465 |
function genStaticKeys$1 (keys) { |
| 18466 |
return makeMap( |
| 18467 |
'type,tag,attrsList,attrsMap,plain,parent,children,attrs,start,end,rawAttrsMap' + |
| 18468 |
(keys ? ',' + keys : '') |
| 18469 |
) |
| 18470 |
} |
| 18471 |
|
| 18472 |
function markStatic$1 (node) { |
| 18473 |
node.static = isStatic(node); |
| 18474 |
if (node.type === 1) { |
| 18475 |
// do not make component slot content static. this avoids |
| 18476 |
// 1. components not able to mutate slot nodes |
| 18477 |
// 2. static slot content fails for hot-reloading |
| 18478 |
if ( |
| 18479 |
!isPlatformReservedTag(node.tag) && |
| 18480 |
node.tag !== 'slot' && |
| 18481 |
node.attrsMap['inline-template'] == null |
| 18482 |
) { |
| 18483 |
return |
| 18484 |
} |
| 18485 |
for (var i = 0, l = node.children.length; i < l; i++) { |
| 18486 |
var child = node.children[i]; |
| 18487 |
markStatic$1(child); |
| 18488 |
if (!child.static) { |
| 18489 |
node.static = false; |
| 18490 |
} |
| 18491 |
} |
| 18492 |
if (node.ifConditions) { |
| 18493 |
for (var i$1 = 1, l$1 = node.ifConditions.length; i$1 < l$1; i$1++) { |
| 18494 |
var block = node.ifConditions[i$1].block; |
| 18495 |
markStatic$1(block); |
| 18496 |
if (!block.static) { |
| 18497 |
node.static = false; |
| 18498 |
} |
| 18499 |
} |
| 18500 |
} |
| 18501 |
} |
| 18502 |
} |
| 18503 |
|
| 18504 |
function markStaticRoots (node, isInFor) { |
| 18505 |
if (node.type === 1) { |
| 18506 |
if (node.static || node.once) { |
| 18507 |
node.staticInFor = isInFor; |
| 18508 |
} |
| 18509 |
// For a node to qualify as a static root, it should have children that |
| 18510 |
// are not just static text. Otherwise the cost of hoisting out will |
| 18511 |
// outweigh the benefits and it's better off to just always render it fresh. |
| 18512 |
if (node.static && node.children.length && !( |
| 18513 |
node.children.length === 1 && |
| 18514 |
node.children[0].type === 3 |
| 18515 |
)) { |
| 18516 |
node.staticRoot = true; |
| 18517 |
return |
| 18518 |
} else { |
| 18519 |
node.staticRoot = false; |
| 18520 |
} |
| 18521 |
if (node.children) { |
| 18522 |
for (var i = 0, l = node.children.length; i < l; i++) { |
| 18523 |
markStaticRoots(node.children[i], isInFor || !!node.for); |
| 18524 |
} |
| 18525 |
} |
| 18526 |
if (node.ifConditions) { |
| 18527 |
for (var i$1 = 1, l$1 = node.ifConditions.length; i$1 < l$1; i$1++) { |
| 18528 |
markStaticRoots(node.ifConditions[i$1].block, isInFor); |
| 18529 |
} |
| 18530 |
} |
| 18531 |
} |
| 18532 |
} |
| 18533 |
|
| 18534 |
function isStatic (node) { |
| 18535 |
if (node.type === 2) { // expression |
| 18536 |
return false |
| 18537 |
} |
| 18538 |
if (node.type === 3) { // text |
| 18539 |
return true |
| 18540 |
} |
| 18541 |
return !!(node.pre || ( |
| 18542 |
!node.hasBindings && // no dynamic bindings |
| 18543 |
!node.if && !node.for && // not v-if or v-for or v-else |
| 18544 |
!isBuiltInTag(node.tag) && // not a built-in |
| 18545 |
isPlatformReservedTag(node.tag) && // not a component |
| 18546 |
!isDirectChildOfTemplateFor(node) && |
| 18547 |
Object.keys(node).every(isStaticKey) |
| 18548 |
)) |
| 18549 |
} |
| 18550 |
|
| 18551 |
function isDirectChildOfTemplateFor (node) { |
| 18552 |
while (node.parent) { |
| 18553 |
node = node.parent; |
| 18554 |
if (node.tag !== 'template') { |
| 18555 |
return false |
| 18556 |
} |
| 18557 |
if (node.for) { |
| 18558 |
return true |
| 18559 |
} |
| 18560 |
} |
| 18561 |
return false |
| 18562 |
} |
| 18563 |
|
| 18564 |
/* */ |
| 18565 |
|
| 18566 |
var fnExpRE = /^([\w$_]+|\([^)]*?\))\s*=>|^function(?:\s+[\w$]+)?\s*\(/; |
| 18567 |
var fnInvokeRE = /\([^)]*?\);*$/; |
| 18568 |
var simplePathRE = /^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*|\['[^']*?']|\["[^"]*?"]|\[\d+]|\[[A-Za-z_$][\w$]*])*$/; |
| 18569 |
|
| 18570 |
// KeyboardEvent.keyCode aliases |
| 18571 |
var keyCodes = { |
| 18572 |
esc: 27, |
| 18573 |
tab: 9, |
| 18574 |
enter: 13, |
| 18575 |
space: 32, |
| 18576 |
up: 38, |
| 18577 |
left: 37, |
| 18578 |
right: 39, |
| 18579 |
down: 40, |
| 18580 |
'delete': [8, 46] |
| 18581 |
}; |
| 18582 |
|
| 18583 |
// KeyboardEvent.key aliases |
| 18584 |
var keyNames = { |
| 18585 |
// #7880: IE11 and Edge use `Esc` for Escape key name. |
| 18586 |
esc: ['Esc', 'Escape'], |
| 18587 |
tab: 'Tab', |
| 18588 |
enter: 'Enter', |
| 18589 |
// #9112: IE11 uses `Spacebar` for Space key name. |
| 18590 |
space: [' ', 'Spacebar'], |
| 18591 |
// #7806: IE11 uses key names without `Arrow` prefix for arrow keys. |
| 18592 |
up: ['Up', 'ArrowUp'], |
| 18593 |
left: ['Left', 'ArrowLeft'], |
| 18594 |
right: ['Right', 'ArrowRight'], |
| 18595 |
down: ['Down', 'ArrowDown'], |
| 18596 |
// #9112: IE11 uses `Del` for Delete key name. |
| 18597 |
'delete': ['Backspace', 'Delete', 'Del'] |
| 18598 |
}; |
| 18599 |
|
| 18600 |
// #4868: modifiers that prevent the execution of the listener |
| 18601 |
// need to explicitly return null so that we can determine whether to remove |
| 18602 |
// the listener for .once |
| 18603 |
var genGuard = function (condition) { return ("if(" + condition + ")return null;"); }; |
| 18604 |
|
| 18605 |
var modifierCode = { |
| 18606 |
stop: '$event.stopPropagation();', |
| 18607 |
prevent: '$event.preventDefault();', |
| 18608 |
self: genGuard("$event.target !== $event.currentTarget"), |
| 18609 |
ctrl: genGuard("!$event.ctrlKey"), |
| 18610 |
shift: genGuard("!$event.shiftKey"), |
| 18611 |
alt: genGuard("!$event.altKey"), |
| 18612 |
meta: genGuard("!$event.metaKey"), |
| 18613 |
left: genGuard("'button' in $event && $event.button !== 0"), |
| 18614 |
middle: genGuard("'button' in $event && $event.button !== 1"), |
| 18615 |
right: genGuard("'button' in $event && $event.button !== 2") |
| 18616 |
}; |
| 18617 |
|
| 18618 |
function genHandlers ( |
| 18619 |
events, |
| 18620 |
isNative |
| 18621 |
) { |
| 18622 |
var prefix = isNative ? 'nativeOn:' : 'on:'; |
| 18623 |
var staticHandlers = ""; |
| 18624 |
var dynamicHandlers = ""; |
| 18625 |
for (var name in events) { |
| 18626 |
var handlerCode = genHandler(events[name]); |
| 18627 |
if (events[name] && events[name].dynamic) { |
| 18628 |
dynamicHandlers += name + "," + handlerCode + ","; |
| 18629 |
} else { |
| 18630 |
staticHandlers += "\"" + name + "\":" + handlerCode + ","; |
| 18631 |
} |
| 18632 |
} |
| 18633 |
staticHandlers = "{" + (staticHandlers.slice(0, -1)) + "}"; |
| 18634 |
if (dynamicHandlers) { |
| 18635 |
return prefix + "_d(" + staticHandlers + ",[" + (dynamicHandlers.slice(0, -1)) + "])" |
| 18636 |
} else { |
| 18637 |
return prefix + staticHandlers |
| 18638 |
} |
| 18639 |
} |
| 18640 |
|
| 18641 |
function genHandler (handler) { |
| 18642 |
if (!handler) { |
| 18643 |
return 'function(){}' |
| 18644 |
} |
| 18645 |
|
| 18646 |
if (Array.isArray(handler)) { |
| 18647 |
return ("[" + (handler.map(function (handler) { return genHandler(handler); }).join(',')) + "]") |
| 18648 |
} |
| 18649 |
|
| 18650 |
var isMethodPath = simplePathRE.test(handler.value); |
| 18651 |
var isFunctionExpression = fnExpRE.test(handler.value); |
| 18652 |
var isFunctionInvocation = simplePathRE.test(handler.value.replace(fnInvokeRE, '')); |
| 18653 |
|
| 18654 |
if (!handler.modifiers) { |
| 18655 |
if (isMethodPath || isFunctionExpression) { |
| 18656 |
return handler.value |
| 18657 |
} |
| 18658 |
return ("function($event){" + (isFunctionInvocation ? ("return " + (handler.value)) : handler.value) + "}") // inline statement |
| 18659 |
} else { |
| 18660 |
var code = ''; |
| 18661 |
var genModifierCode = ''; |
| 18662 |
var keys = []; |
| 18663 |
for (var key in handler.modifiers) { |
| 18664 |
if (modifierCode[key]) { |
| 18665 |
genModifierCode += modifierCode[key]; |
| 18666 |
// left/right |
| 18667 |
if (keyCodes[key]) { |
| 18668 |
keys.push(key); |
| 18669 |
} |
| 18670 |
} else if (key === 'exact') { |
| 18671 |
var modifiers = (handler.modifiers); |
| 18672 |
genModifierCode += genGuard( |
| 18673 |
['ctrl', 'shift', 'alt', 'meta'] |
| 18674 |
.filter(function (keyModifier) { return !modifiers[keyModifier]; }) |
| 18675 |
.map(function (keyModifier) { return ("$event." + keyModifier + "Key"); }) |
| 18676 |
.join('||') |
| 18677 |
); |
| 18678 |
} else { |
| 18679 |
keys.push(key); |
| 18680 |
} |
| 18681 |
} |
| 18682 |
if (keys.length) { |
| 18683 |
code += genKeyFilter(keys); |
| 18684 |
} |
| 18685 |
// Make sure modifiers like prevent and stop get executed after key filtering |
| 18686 |
if (genModifierCode) { |
| 18687 |
code += genModifierCode; |
| 18688 |
} |
| 18689 |
var handlerCode = isMethodPath |
| 18690 |
? ("return " + (handler.value) + ".apply(null, arguments)") |
| 18691 |
: isFunctionExpression |
| 18692 |
? ("return (" + (handler.value) + ").apply(null, arguments)") |
| 18693 |
: isFunctionInvocation |
| 18694 |
? ("return " + (handler.value)) |
| 18695 |
: handler.value; |
| 18696 |
return ("function($event){" + code + handlerCode + "}") |
| 18697 |
} |
| 18698 |
} |
| 18699 |
|
| 18700 |
function genKeyFilter (keys) { |
| 18701 |
return ( |
| 18702 |
// make sure the key filters only apply to KeyboardEvents |
| 18703 |
// #9441: can't use 'keyCode' in $event because Chrome autofill fires fake |
| 18704 |
// key events that do not have keyCode property... |
| 18705 |
"if(!$event.type.indexOf('key')&&" + |
| 18706 |
(keys.map(genFilterCode).join('&&')) + ")return null;" |
| 18707 |
) |
| 18708 |
} |
| 18709 |
|
| 18710 |
function genFilterCode (key) { |
| 18711 |
var keyVal = parseInt(key, 10); |
| 18712 |
if (keyVal) { |
| 18713 |
return ("$event.keyCode!==" + keyVal) |
| 18714 |
} |
| 18715 |
var keyCode = keyCodes[key]; |
| 18716 |
var keyName = keyNames[key]; |
| 18717 |
return ( |
| 18718 |
"_k($event.keyCode," + |
| 18719 |
(JSON.stringify(key)) + "," + |
| 18720 |
(JSON.stringify(keyCode)) + "," + |
| 18721 |
"$event.key," + |
| 18722 |
"" + (JSON.stringify(keyName)) + |
| 18723 |
")" |
| 18724 |
) |
| 18725 |
} |
| 18726 |
|
| 18727 |
/* */ |
| 18728 |
|
| 18729 |
function on (el, dir) { |
| 18730 |
if ( true && dir.modifiers) { |
| 18731 |
warn("v-on without argument does not support modifiers."); |
| 18732 |
} |
| 18733 |
el.wrapListeners = function (code) { return ("_g(" + code + "," + (dir.value) + ")"); }; |
| 18734 |
} |
| 18735 |
|
| 18736 |
/* */ |
| 18737 |
|
| 18738 |
function bind$1 (el, dir) { |
| 18739 |
el.wrapData = function (code) { |
| 18740 |
return ("_b(" + code + ",'" + (el.tag) + "'," + (dir.value) + "," + (dir.modifiers && dir.modifiers.prop ? 'true' : 'false') + (dir.modifiers && dir.modifiers.sync ? ',true' : '') + ")") |
| 18741 |
}; |
| 18742 |
} |
| 18743 |
|
| 18744 |
/* */ |
| 18745 |
|
| 18746 |
var baseDirectives = { |
| 18747 |
on: on, |
| 18748 |
bind: bind$1, |
| 18749 |
cloak: noop |
| 18750 |
}; |
| 18751 |
|
| 18752 |
/* */ |
| 18753 |
|
| 18754 |
|
| 18755 |
|
| 18756 |
|
| 18757 |
|
| 18758 |
var CodegenState = function CodegenState (options) { |
| 18759 |
this.options = options; |
| 18760 |
this.warn = options.warn || baseWarn; |
| 18761 |
this.transforms = pluckModuleFunction(options.modules, 'transformCode'); |
| 18762 |
this.dataGenFns = pluckModuleFunction(options.modules, 'genData'); |
| 18763 |
this.directives = extend(extend({}, baseDirectives), options.directives); |
| 18764 |
var isReservedTag = options.isReservedTag || no; |
| 18765 |
this.maybeComponent = function (el) { return !!el.component || !isReservedTag(el.tag); }; |
| 18766 |
this.onceId = 0; |
| 18767 |
this.staticRenderFns = []; |
| 18768 |
this.pre = false; |
| 18769 |
}; |
| 18770 |
|
| 18771 |
|
| 18772 |
|
| 18773 |
function generate ( |
| 18774 |
ast, |
| 18775 |
options |
| 18776 |
) { |
| 18777 |
var state = new CodegenState(options); |
| 18778 |
// fix #11483, Root level <script> tags should not be rendered. |
| 18779 |
var code = ast ? (ast.tag === 'script' ? 'null' : genElement(ast, state)) : '_c("div")'; |
| 18780 |
return { |
| 18781 |
render: ("with(this){return " + code + "}"), |
| 18782 |
staticRenderFns: state.staticRenderFns |
| 18783 |
} |
| 18784 |
} |
| 18785 |
|
| 18786 |
function genElement (el, state) { |
| 18787 |
if (el.parent) { |
| 18788 |
el.pre = el.pre || el.parent.pre; |
| 18789 |
} |
| 18790 |
|
| 18791 |
if (el.staticRoot && !el.staticProcessed) { |
| 18792 |
return genStatic(el, state) |
| 18793 |
} else if (el.once && !el.onceProcessed) { |
| 18794 |
return genOnce(el, state) |
| 18795 |
} else if (el.for && !el.forProcessed) { |
| 18796 |
return genFor(el, state) |
| 18797 |
} else if (el.if && !el.ifProcessed) { |
| 18798 |
return genIf(el, state) |
| 18799 |
} else if (el.tag === 'template' && !el.slotTarget && !state.pre) { |
| 18800 |
return genChildren(el, state) || 'void 0' |
| 18801 |
} else if (el.tag === 'slot') { |
| 18802 |
return genSlot(el, state) |
| 18803 |
} else { |
| 18804 |
// component or element |
| 18805 |
var code; |
| 18806 |
if (el.component) { |
| 18807 |
code = genComponent(el.component, el, state); |
| 18808 |
} else { |
| 18809 |
var data; |
| 18810 |
if (!el.plain || (el.pre && state.maybeComponent(el))) { |
| 18811 |
data = genData$2(el, state); |
| 18812 |
} |
| 18813 |
|
| 18814 |
var children = el.inlineTemplate ? null : genChildren(el, state, true); |
| 18815 |
code = "_c('" + (el.tag) + "'" + (data ? ("," + data) : '') + (children ? ("," + children) : '') + ")"; |
| 18816 |
} |
| 18817 |
// module transforms |
| 18818 |
for (var i = 0; i < state.transforms.length; i++) { |
| 18819 |
code = state.transforms[i](el, code); |
| 18820 |
} |
| 18821 |
return code |
| 18822 |
} |
| 18823 |
} |
| 18824 |
|
| 18825 |
// hoist static sub-trees out |
| 18826 |
function genStatic (el, state) { |
| 18827 |
el.staticProcessed = true; |
| 18828 |
// Some elements (templates) need to behave differently inside of a v-pre |
| 18829 |
// node. All pre nodes are static roots, so we can use this as a location to |
| 18830 |
// wrap a state change and reset it upon exiting the pre node. |
| 18831 |
var originalPreState = state.pre; |
| 18832 |
if (el.pre) { |
| 18833 |
state.pre = el.pre; |
| 18834 |
} |
| 18835 |
state.staticRenderFns.push(("with(this){return " + (genElement(el, state)) + "}")); |
| 18836 |
state.pre = originalPreState; |
| 18837 |
return ("_m(" + (state.staticRenderFns.length - 1) + (el.staticInFor ? ',true' : '') + ")") |
| 18838 |
} |
| 18839 |
|
| 18840 |
// v-once |
| 18841 |
function genOnce (el, state) { |
| 18842 |
el.onceProcessed = true; |
| 18843 |
if (el.if && !el.ifProcessed) { |
| 18844 |
return genIf(el, state) |
| 18845 |
} else if (el.staticInFor) { |
| 18846 |
var key = ''; |
| 18847 |
var parent = el.parent; |
| 18848 |
while (parent) { |
| 18849 |
if (parent.for) { |
| 18850 |
key = parent.key; |
| 18851 |
break |
| 18852 |
} |
| 18853 |
parent = parent.parent; |
| 18854 |
} |
| 18855 |
if (!key) { |
| 18856 |
true && state.warn( |
| 18857 |
"v-once can only be used inside v-for that is keyed. ", |
| 18858 |
el.rawAttrsMap['v-once'] |
| 18859 |
); |
| 18860 |
return genElement(el, state) |
| 18861 |
} |
| 18862 |
return ("_o(" + (genElement(el, state)) + "," + (state.onceId++) + "," + key + ")") |
| 18863 |
} else { |
| 18864 |
return genStatic(el, state) |
| 18865 |
} |
| 18866 |
} |
| 18867 |
|
| 18868 |
function genIf ( |
| 18869 |
el, |
| 18870 |
state, |
| 18871 |
altGen, |
| 18872 |
altEmpty |
| 18873 |
) { |
| 18874 |
el.ifProcessed = true; // avoid recursion |
| 18875 |
return genIfConditions(el.ifConditions.slice(), state, altGen, altEmpty) |
| 18876 |
} |
| 18877 |
|
| 18878 |
function genIfConditions ( |
| 18879 |
conditions, |
| 18880 |
state, |
| 18881 |
altGen, |
| 18882 |
altEmpty |
| 18883 |
) { |
| 18884 |
if (!conditions.length) { |
| 18885 |
return altEmpty || '_e()' |
| 18886 |
} |
| 18887 |
|
| 18888 |
var condition = conditions.shift(); |
| 18889 |
if (condition.exp) { |
| 18890 |
return ("(" + (condition.exp) + ")?" + (genTernaryExp(condition.block)) + ":" + (genIfConditions(conditions, state, altGen, altEmpty))) |
| 18891 |
} else { |
| 18892 |
return ("" + (genTernaryExp(condition.block))) |
| 18893 |
} |
| 18894 |
|
| 18895 |
// v-if with v-once should generate code like (a)?_m(0):_m(1) |
| 18896 |
function genTernaryExp (el) { |
| 18897 |
return altGen |
| 18898 |
? altGen(el, state) |
| 18899 |
: el.once |
| 18900 |
? genOnce(el, state) |
| 18901 |
: genElement(el, state) |
| 18902 |
} |
| 18903 |
} |
| 18904 |
|
| 18905 |
function genFor ( |
| 18906 |
el, |
| 18907 |
state, |
| 18908 |
altGen, |
| 18909 |
altHelper |
| 18910 |
) { |
| 18911 |
var exp = el.for; |
| 18912 |
var alias = el.alias; |
| 18913 |
var iterator1 = el.iterator1 ? ("," + (el.iterator1)) : ''; |
| 18914 |
var iterator2 = el.iterator2 ? ("," + (el.iterator2)) : ''; |
| 18915 |
|
| 18916 |
if ( true && |
| 18917 |
state.maybeComponent(el) && |
| 18918 |
el.tag !== 'slot' && |
| 18919 |
el.tag !== 'template' && |
| 18920 |
!el.key |
| 18921 |
) { |
| 18922 |
state.warn( |
| 18923 |
"<" + (el.tag) + " v-for=\"" + alias + " in " + exp + "\">: component lists rendered with " + |
| 18924 |
"v-for should have explicit keys. " + |
| 18925 |
"See https://vuejs.org/guide/list.html#key for more info.", |
| 18926 |
el.rawAttrsMap['v-for'], |
| 18927 |
true /* tip */ |
| 18928 |
); |
| 18929 |
} |
| 18930 |
|
| 18931 |
el.forProcessed = true; // avoid recursion |
| 18932 |
return (altHelper || '_l') + "((" + exp + ")," + |
| 18933 |
"function(" + alias + iterator1 + iterator2 + "){" + |
| 18934 |
"return " + ((altGen || genElement)(el, state)) + |
| 18935 |
'})' |
| 18936 |
} |
| 18937 |
|
| 18938 |
function genData$2 (el, state) { |
| 18939 |
var data = '{'; |
| 18940 |
|
| 18941 |
// directives first. |
| 18942 |
// directives may mutate the el's other properties before they are generated. |
| 18943 |
var dirs = genDirectives(el, state); |
| 18944 |
if (dirs) { data += dirs + ','; } |
| 18945 |
|
| 18946 |
// key |
| 18947 |
if (el.key) { |
| 18948 |
data += "key:" + (el.key) + ","; |
| 18949 |
} |
| 18950 |
// ref |
| 18951 |
if (el.ref) { |
| 18952 |
data += "ref:" + (el.ref) + ","; |
| 18953 |
} |
| 18954 |
if (el.refInFor) { |
| 18955 |
data += "refInFor:true,"; |
| 18956 |
} |
| 18957 |
// pre |
| 18958 |
if (el.pre) { |
| 18959 |
data += "pre:true,"; |
| 18960 |
} |
| 18961 |
// record original tag name for components using "is" attribute |
| 18962 |
if (el.component) { |
| 18963 |
data += "tag:\"" + (el.tag) + "\","; |
| 18964 |
} |
| 18965 |
// module data generation functions |
| 18966 |
for (var i = 0; i < state.dataGenFns.length; i++) { |
| 18967 |
data += state.dataGenFns[i](el); |
| 18968 |
} |
| 18969 |
// attributes |
| 18970 |
if (el.attrs) { |
| 18971 |
data += "attrs:" + (genProps(el.attrs)) + ","; |
| 18972 |
} |
| 18973 |
// DOM props |
| 18974 |
if (el.props) { |
| 18975 |
data += "domProps:" + (genProps(el.props)) + ","; |
| 18976 |
} |
| 18977 |
// event handlers |
| 18978 |
if (el.events) { |
| 18979 |
data += (genHandlers(el.events, false)) + ","; |
| 18980 |
} |
| 18981 |
if (el.nativeEvents) { |
| 18982 |
data += (genHandlers(el.nativeEvents, true)) + ","; |
| 18983 |
} |
| 18984 |
// slot target |
| 18985 |
// only for non-scoped slots |
| 18986 |
if (el.slotTarget && !el.slotScope) { |
| 18987 |
data += "slot:" + (el.slotTarget) + ","; |
| 18988 |
} |
| 18989 |
// scoped slots |
| 18990 |
if (el.scopedSlots) { |
| 18991 |
data += (genScopedSlots(el, el.scopedSlots, state)) + ","; |
| 18992 |
} |
| 18993 |
// component v-model |
| 18994 |
if (el.model) { |
| 18995 |
data += "model:{value:" + (el.model.value) + ",callback:" + (el.model.callback) + ",expression:" + (el.model.expression) + "},"; |
| 18996 |
} |
| 18997 |
// inline-template |
| 18998 |
if (el.inlineTemplate) { |
| 18999 |
var inlineTemplate = genInlineTemplate(el, state); |
| 19000 |
if (inlineTemplate) { |
| 19001 |
data += inlineTemplate + ","; |
| 19002 |
} |
| 19003 |
} |
| 19004 |
data = data.replace(/,$/, '') + '}'; |
| 19005 |
// v-bind dynamic argument wrap |
| 19006 |
// v-bind with dynamic arguments must be applied using the same v-bind object |
| 19007 |
// merge helper so that class/style/mustUseProp attrs are handled correctly. |
| 19008 |
if (el.dynamicAttrs) { |
| 19009 |
data = "_b(" + data + ",\"" + (el.tag) + "\"," + (genProps(el.dynamicAttrs)) + ")"; |
| 19010 |
} |
| 19011 |
// v-bind data wrap |
| 19012 |
if (el.wrapData) { |
| 19013 |
data = el.wrapData(data); |
| 19014 |
} |
| 19015 |
// v-on data wrap |
| 19016 |
if (el.wrapListeners) { |
| 19017 |
data = el.wrapListeners(data); |
| 19018 |
} |
| 19019 |
return data |
| 19020 |
} |
| 19021 |
|
| 19022 |
function genDirectives (el, state) { |
| 19023 |
var dirs = el.directives; |
| 19024 |
if (!dirs) { return } |
| 19025 |
var res = 'directives:['; |
| 19026 |
var hasRuntime = false; |
| 19027 |
var i, l, dir, needRuntime; |
| 19028 |
for (i = 0, l = dirs.length; i < l; i++) { |
| 19029 |
dir = dirs[i]; |
| 19030 |
needRuntime = true; |
| 19031 |
var gen = state.directives[dir.name]; |
| 19032 |
if (gen) { |
| 19033 |
// compile-time directive that manipulates AST. |
| 19034 |
// returns true if it also needs a runtime counterpart. |
| 19035 |
needRuntime = !!gen(el, dir, state.warn); |
| 19036 |
} |
| 19037 |
if (needRuntime) { |
| 19038 |
hasRuntime = true; |
| 19039 |
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))) : '') + "},"; |
| 19040 |
} |
| 19041 |
} |
| 19042 |
if (hasRuntime) { |
| 19043 |
return res.slice(0, -1) + ']' |
| 19044 |
} |
| 19045 |
} |
| 19046 |
|
| 19047 |
function genInlineTemplate (el, state) { |
| 19048 |
var ast = el.children[0]; |
| 19049 |
if ( true && ( |
| 19050 |
el.children.length !== 1 || ast.type !== 1 |
| 19051 |
)) { |
| 19052 |
state.warn( |
| 19053 |
'Inline-template components must have exactly one child element.', |
| 19054 |
{ start: el.start } |
| 19055 |
); |
| 19056 |
} |
| 19057 |
if (ast && ast.type === 1) { |
| 19058 |
var inlineRenderFns = generate(ast, state.options); |
| 19059 |
return ("inlineTemplate:{render:function(){" + (inlineRenderFns.render) + "},staticRenderFns:[" + (inlineRenderFns.staticRenderFns.map(function (code) { return ("function(){" + code + "}"); }).join(',')) + "]}") |
| 19060 |
} |
| 19061 |
} |
| 19062 |
|
| 19063 |
function genScopedSlots ( |
| 19064 |
el, |
| 19065 |
slots, |
| 19066 |
state |
| 19067 |
) { |
| 19068 |
// by default scoped slots are considered "stable", this allows child |
| 19069 |
// components with only scoped slots to skip forced updates from parent. |
| 19070 |
// but in some cases we have to bail-out of this optimization |
| 19071 |
// for example if the slot contains dynamic names, has v-if or v-for on them... |
| 19072 |
var needsForceUpdate = el.for || Object.keys(slots).some(function (key) { |
| 19073 |
var slot = slots[key]; |
| 19074 |
return ( |
| 19075 |
slot.slotTargetDynamic || |
| 19076 |
slot.if || |
| 19077 |
slot.for || |
| 19078 |
containsSlotChild(slot) // is passing down slot from parent which may be dynamic |
| 19079 |
) |
| 19080 |
}); |
| 19081 |
|
| 19082 |
// #9534: if a component with scoped slots is inside a conditional branch, |
| 19083 |
// it's possible for the same component to be reused but with different |
| 19084 |
// compiled slot content. To avoid that, we generate a unique key based on |
| 19085 |
// the generated code of all the slot contents. |
| 19086 |
var needsKey = !!el.if; |
| 19087 |
|
| 19088 |
// OR when it is inside another scoped slot or v-for (the reactivity may be |
| 19089 |
// disconnected due to the intermediate scope variable) |
| 19090 |
// #9438, #9506 |
| 19091 |
// TODO: this can be further optimized by properly analyzing in-scope bindings |
| 19092 |
// and skip force updating ones that do not actually use scope variables. |
| 19093 |
if (!needsForceUpdate) { |
| 19094 |
var parent = el.parent; |
| 19095 |
while (parent) { |
| 19096 |
if ( |
| 19097 |
(parent.slotScope && parent.slotScope !== emptySlotScopeToken) || |
| 19098 |
parent.for |
| 19099 |
) { |
| 19100 |
needsForceUpdate = true; |
| 19101 |
break |
| 19102 |
} |
| 19103 |
if (parent.if) { |
| 19104 |
needsKey = true; |
| 19105 |
} |
| 19106 |
parent = parent.parent; |
| 19107 |
} |
| 19108 |
} |
| 19109 |
|
| 19110 |
var generatedSlots = Object.keys(slots) |
| 19111 |
.map(function (key) { return genScopedSlot(slots[key], state); }) |
| 19112 |
.join(','); |
| 19113 |
|
| 19114 |
return ("scopedSlots:_u([" + generatedSlots + "]" + (needsForceUpdate ? ",null,true" : "") + (!needsForceUpdate && needsKey ? (",null,false," + (hash(generatedSlots))) : "") + ")") |
| 19115 |
} |
| 19116 |
|
| 19117 |
function hash(str) { |
| 19118 |
var hash = 5381; |
| 19119 |
var i = str.length; |
| 19120 |
while(i) { |
| 19121 |
hash = (hash * 33) ^ str.charCodeAt(--i); |
| 19122 |
} |
| 19123 |
return hash >>> 0 |
| 19124 |
} |
| 19125 |
|
| 19126 |
function containsSlotChild (el) { |
| 19127 |
if (el.type === 1) { |
| 19128 |
if (el.tag === 'slot') { |
| 19129 |
return true |
| 19130 |
} |
| 19131 |
return el.children.some(containsSlotChild) |
| 19132 |
} |
| 19133 |
return false |
| 19134 |
} |
| 19135 |
|
| 19136 |
function genScopedSlot ( |
| 19137 |
el, |
| 19138 |
state |
| 19139 |
) { |
| 19140 |
var isLegacySyntax = el.attrsMap['slot-scope']; |
| 19141 |
if (el.if && !el.ifProcessed && !isLegacySyntax) { |
| 19142 |
return genIf(el, state, genScopedSlot, "null") |
| 19143 |
} |
| 19144 |
if (el.for && !el.forProcessed) { |
| 19145 |
return genFor(el, state, genScopedSlot) |
| 19146 |
} |
| 19147 |
var slotScope = el.slotScope === emptySlotScopeToken |
| 19148 |
? "" |
| 19149 |
: String(el.slotScope); |
| 19150 |
var fn = "function(" + slotScope + "){" + |
| 19151 |
"return " + (el.tag === 'template' |
| 19152 |
? el.if && isLegacySyntax |
| 19153 |
? ("(" + (el.if) + ")?" + (genChildren(el, state) || 'undefined') + ":undefined") |
| 19154 |
: genChildren(el, state) || 'undefined' |
| 19155 |
: genElement(el, state)) + "}"; |
| 19156 |
// reverse proxy v-slot without scope on this.$slots |
| 19157 |
var reverseProxy = slotScope ? "" : ",proxy:true"; |
| 19158 |
return ("{key:" + (el.slotTarget || "\"default\"") + ",fn:" + fn + reverseProxy + "}") |
| 19159 |
} |
| 19160 |
|
| 19161 |
function genChildren ( |
| 19162 |
el, |
| 19163 |
state, |
| 19164 |
checkSkip, |
| 19165 |
altGenElement, |
| 19166 |
altGenNode |
| 19167 |
) { |
| 19168 |
var children = el.children; |
| 19169 |
if (children.length) { |
| 19170 |
var el$1 = children[0]; |
| 19171 |
// optimize single v-for |
| 19172 |
if (children.length === 1 && |
| 19173 |
el$1.for && |
| 19174 |
el$1.tag !== 'template' && |
| 19175 |
el$1.tag !== 'slot' |
| 19176 |
) { |
| 19177 |
var normalizationType = checkSkip |
| 19178 |
? state.maybeComponent(el$1) ? ",1" : ",0" |
| 19179 |
: ""; |
| 19180 |
return ("" + ((altGenElement || genElement)(el$1, state)) + normalizationType) |
| 19181 |
} |
| 19182 |
var normalizationType$1 = checkSkip |
| 19183 |
? getNormalizationType(children, state.maybeComponent) |
| 19184 |
: 0; |
| 19185 |
var gen = altGenNode || genNode; |
| 19186 |
return ("[" + (children.map(function (c) { return gen(c, state); }).join(',')) + "]" + (normalizationType$1 ? ("," + normalizationType$1) : '')) |
| 19187 |
} |
| 19188 |
} |
| 19189 |
|
| 19190 |
// determine the normalization needed for the children array. |
| 19191 |
// 0: no normalization needed |
| 19192 |
// 1: simple normalization needed (possible 1-level deep nested array) |
| 19193 |
// 2: full normalization needed |
| 19194 |
function getNormalizationType ( |
| 19195 |
children, |
| 19196 |
maybeComponent |
| 19197 |
) { |
| 19198 |
var res = 0; |
| 19199 |
for (var i = 0; i < children.length; i++) { |
| 19200 |
var el = children[i]; |
| 19201 |
if (el.type !== 1) { |
| 19202 |
continue |
| 19203 |
} |
| 19204 |
if (needsNormalization(el) || |
| 19205 |
(el.ifConditions && el.ifConditions.some(function (c) { return needsNormalization(c.block); }))) { |
| 19206 |
res = 2; |
| 19207 |
break |
| 19208 |
} |
| 19209 |
if (maybeComponent(el) || |
| 19210 |
(el.ifConditions && el.ifConditions.some(function (c) { return maybeComponent(c.block); }))) { |
| 19211 |
res = 1; |
| 19212 |
} |
| 19213 |
} |
| 19214 |
return res |
| 19215 |
} |
| 19216 |
|
| 19217 |
function needsNormalization (el) { |
| 19218 |
return el.for !== undefined || el.tag === 'template' || el.tag === 'slot' |
| 19219 |
} |
| 19220 |
|
| 19221 |
function genNode (node, state) { |
| 19222 |
if (node.type === 1) { |
| 19223 |
return genElement(node, state) |
| 19224 |
} else if (node.type === 3 && node.isComment) { |
| 19225 |
return genComment(node) |
| 19226 |
} else { |
| 19227 |
return genText(node) |
| 19228 |
} |
| 19229 |
} |
| 19230 |
|
| 19231 |
function genText (text) { |
| 19232 |
return ("_v(" + (text.type === 2 |
| 19233 |
? text.expression // no need for () because already wrapped in _s() |
| 19234 |
: transformSpecialNewlines(JSON.stringify(text.text))) + ")") |
| 19235 |
} |
| 19236 |
|
| 19237 |
function genComment (comment) { |
| 19238 |
return ("_e(" + (JSON.stringify(comment.text)) + ")") |
| 19239 |
} |
| 19240 |
|
| 19241 |
function genSlot (el, state) { |
| 19242 |
var slotName = el.slotName || '"default"'; |
| 19243 |
var children = genChildren(el, state); |
| 19244 |
var res = "_t(" + slotName + (children ? (",function(){return " + children + "}") : ''); |
| 19245 |
var attrs = el.attrs || el.dynamicAttrs |
| 19246 |
? genProps((el.attrs || []).concat(el.dynamicAttrs || []).map(function (attr) { return ({ |
| 19247 |
// slot props are camelized |
| 19248 |
name: camelize(attr.name), |
| 19249 |
value: attr.value, |
| 19250 |
dynamic: attr.dynamic |
| 19251 |
}); })) |
| 19252 |
: null; |
| 19253 |
var bind$$1 = el.attrsMap['v-bind']; |
| 19254 |
if ((attrs || bind$$1) && !children) { |
| 19255 |
res += ",null"; |
| 19256 |
} |
| 19257 |
if (attrs) { |
| 19258 |
res += "," + attrs; |
| 19259 |
} |
| 19260 |
if (bind$$1) { |
| 19261 |
res += (attrs ? '' : ',null') + "," + bind$$1; |
| 19262 |
} |
| 19263 |
return res + ')' |
| 19264 |
} |
| 19265 |
|
| 19266 |
// componentName is el.component, take it as argument to shun flow's pessimistic refinement |
| 19267 |
function genComponent ( |
| 19268 |
componentName, |
| 19269 |
el, |
| 19270 |
state |
| 19271 |
) { |
| 19272 |
var children = el.inlineTemplate ? null : genChildren(el, state, true); |
| 19273 |
return ("_c(" + componentName + "," + (genData$2(el, state)) + (children ? ("," + children) : '') + ")") |
| 19274 |
} |
| 19275 |
|
| 19276 |
function genProps (props) { |
| 19277 |
var staticProps = ""; |
| 19278 |
var dynamicProps = ""; |
| 19279 |
for (var i = 0; i < props.length; i++) { |
| 19280 |
var prop = props[i]; |
| 19281 |
var value = transformSpecialNewlines(prop.value); |
| 19282 |
if (prop.dynamic) { |
| 19283 |
dynamicProps += (prop.name) + "," + value + ","; |
| 19284 |
} else { |
| 19285 |
staticProps += "\"" + (prop.name) + "\":" + value + ","; |
| 19286 |
} |
| 19287 |
} |
| 19288 |
staticProps = "{" + (staticProps.slice(0, -1)) + "}"; |
| 19289 |
if (dynamicProps) { |
| 19290 |
return ("_d(" + staticProps + ",[" + (dynamicProps.slice(0, -1)) + "])") |
| 19291 |
} else { |
| 19292 |
return staticProps |
| 19293 |
} |
| 19294 |
} |
| 19295 |
|
| 19296 |
// #3895, #4268 |
| 19297 |
function transformSpecialNewlines (text) { |
| 19298 |
return text |
| 19299 |
.replace(/\u2028/g, '\\u2028') |
| 19300 |
.replace(/\u2029/g, '\\u2029') |
| 19301 |
} |
| 19302 |
|
| 19303 |
/* */ |
| 19304 |
|
| 19305 |
|
| 19306 |
|
| 19307 |
// these keywords should not appear inside expressions, but operators like |
| 19308 |
// typeof, instanceof and in are allowed |
| 19309 |
var prohibitedKeywordRE = new RegExp('\\b' + ( |
| 19310 |
'do,if,for,let,new,try,var,case,else,with,await,break,catch,class,const,' + |
| 19311 |
'super,throw,while,yield,delete,export,import,return,switch,default,' + |
| 19312 |
'extends,finally,continue,debugger,function,arguments' |
| 19313 |
).split(',').join('\\b|\\b') + '\\b'); |
| 19314 |
|
| 19315 |
// these unary operators should not be used as property/method names |
| 19316 |
var unaryOperatorsRE = new RegExp('\\b' + ( |
| 19317 |
'delete,typeof,void' |
| 19318 |
).split(',').join('\\s*\\([^\\)]*\\)|\\b') + '\\s*\\([^\\)]*\\)'); |
| 19319 |
|
| 19320 |
// strip strings in expressions |
| 19321 |
var stripStringRE = /'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"|`(?:[^`\\]|\\.)*\$\{|\}(?:[^`\\]|\\.)*`|`(?:[^`\\]|\\.)*`/g; |
| 19322 |
|
| 19323 |
// detect problematic expressions in a template |
| 19324 |
function detectErrors (ast, warn) { |
| 19325 |
if (ast) { |
| 19326 |
checkNode(ast, warn); |
| 19327 |
} |
| 19328 |
} |
| 19329 |
|
| 19330 |
function checkNode (node, warn) { |
| 19331 |
if (node.type === 1) { |
| 19332 |
for (var name in node.attrsMap) { |
| 19333 |
if (dirRE.test(name)) { |
| 19334 |
var value = node.attrsMap[name]; |
| 19335 |
if (value) { |
| 19336 |
var range = node.rawAttrsMap[name]; |
| 19337 |
if (name === 'v-for') { |
| 19338 |
checkFor(node, ("v-for=\"" + value + "\""), warn, range); |
| 19339 |
} else if (name === 'v-slot' || name[0] === '#') { |
| 19340 |
checkFunctionParameterExpression(value, (name + "=\"" + value + "\""), warn, range); |
| 19341 |
} else if (onRE.test(name)) { |
| 19342 |
checkEvent(value, (name + "=\"" + value + "\""), warn, range); |
| 19343 |
} else { |
| 19344 |
checkExpression(value, (name + "=\"" + value + "\""), warn, range); |
| 19345 |
} |
| 19346 |
} |
| 19347 |
} |
| 19348 |
} |
| 19349 |
if (node.children) { |
| 19350 |
for (var i = 0; i < node.children.length; i++) { |
| 19351 |
checkNode(node.children[i], warn); |
| 19352 |
} |
| 19353 |
} |
| 19354 |
} else if (node.type === 2) { |
| 19355 |
checkExpression(node.expression, node.text, warn, node); |
| 19356 |
} |
| 19357 |
} |
| 19358 |
|
| 19359 |
function checkEvent (exp, text, warn, range) { |
| 19360 |
var stripped = exp.replace(stripStringRE, ''); |
| 19361 |
var keywordMatch = stripped.match(unaryOperatorsRE); |
| 19362 |
if (keywordMatch && stripped.charAt(keywordMatch.index - 1) !== '$') { |
| 19363 |
warn( |
| 19364 |
"avoid using JavaScript unary operator as property name: " + |
| 19365 |
"\"" + (keywordMatch[0]) + "\" in expression " + (text.trim()), |
| 19366 |
range |
| 19367 |
); |
| 19368 |
} |
| 19369 |
checkExpression(exp, text, warn, range); |
| 19370 |
} |
| 19371 |
|
| 19372 |
function checkFor (node, text, warn, range) { |
| 19373 |
checkExpression(node.for || '', text, warn, range); |
| 19374 |
checkIdentifier(node.alias, 'v-for alias', text, warn, range); |
| 19375 |
checkIdentifier(node.iterator1, 'v-for iterator', text, warn, range); |
| 19376 |
checkIdentifier(node.iterator2, 'v-for iterator', text, warn, range); |
| 19377 |
} |
| 19378 |
|
| 19379 |
function checkIdentifier ( |
| 19380 |
ident, |
| 19381 |
type, |
| 19382 |
text, |
| 19383 |
warn, |
| 19384 |
range |
| 19385 |
) { |
| 19386 |
if (typeof ident === 'string') { |
| 19387 |
try { |
| 19388 |
new Function(("var " + ident + "=_")); |
| 19389 |
} catch (e) { |
| 19390 |
warn(("invalid " + type + " \"" + ident + "\" in expression: " + (text.trim())), range); |
| 19391 |
} |
| 19392 |
} |
| 19393 |
} |
| 19394 |
|
| 19395 |
function checkExpression (exp, text, warn, range) { |
| 19396 |
try { |
| 19397 |
new Function(("return " + exp)); |
| 19398 |
} catch (e) { |
| 19399 |
var keywordMatch = exp.replace(stripStringRE, '').match(prohibitedKeywordRE); |
| 19400 |
if (keywordMatch) { |
| 19401 |
warn( |
| 19402 |
"avoid using JavaScript keyword as property name: " + |
| 19403 |
"\"" + (keywordMatch[0]) + "\"\n Raw expression: " + (text.trim()), |
| 19404 |
range |
| 19405 |
); |
| 19406 |
} else { |
| 19407 |
warn( |
| 19408 |
"invalid expression: " + (e.message) + " in\n\n" + |
| 19409 |
" " + exp + "\n\n" + |
| 19410 |
" Raw expression: " + (text.trim()) + "\n", |
| 19411 |
range |
| 19412 |
); |
| 19413 |
} |
| 19414 |
} |
| 19415 |
} |
| 19416 |
|
| 19417 |
function checkFunctionParameterExpression (exp, text, warn, range) { |
| 19418 |
try { |
| 19419 |
new Function(exp, ''); |
| 19420 |
} catch (e) { |
| 19421 |
warn( |
| 19422 |
"invalid function parameter expression: " + (e.message) + " in\n\n" + |
| 19423 |
" " + exp + "\n\n" + |
| 19424 |
" Raw expression: " + (text.trim()) + "\n", |
| 19425 |
range |
| 19426 |
); |
| 19427 |
} |
| 19428 |
} |
| 19429 |
|
| 19430 |
/* */ |
| 19431 |
|
| 19432 |
var range = 2; |
| 19433 |
|
| 19434 |
function generateCodeFrame ( |
| 19435 |
source, |
| 19436 |
start, |
| 19437 |
end |
| 19438 |
) { |
| 19439 |
if ( start === void 0 ) start = 0; |
| 19440 |
if ( end === void 0 ) end = source.length; |
| 19441 |
|
| 19442 |
var lines = source.split(/\r?\n/); |
| 19443 |
var count = 0; |
| 19444 |
var res = []; |
| 19445 |
for (var i = 0; i < lines.length; i++) { |
| 19446 |
count += lines[i].length + 1; |
| 19447 |
if (count >= start) { |
| 19448 |
for (var j = i - range; j <= i + range || end > count; j++) { |
| 19449 |
if (j < 0 || j >= lines.length) { continue } |
| 19450 |
res.push(("" + (j + 1) + (repeat$1(" ", 3 - String(j + 1).length)) + "| " + (lines[j]))); |
| 19451 |
var lineLength = lines[j].length; |
| 19452 |
if (j === i) { |
| 19453 |
// push underline |
| 19454 |
var pad = start - (count - lineLength) + 1; |
| 19455 |
var length = end > count ? lineLength - pad : end - start; |
| 19456 |
res.push(" | " + repeat$1(" ", pad) + repeat$1("^", length)); |
| 19457 |
} else if (j > i) { |
| 19458 |
if (end > count) { |
| 19459 |
var length$1 = Math.min(end - count, lineLength); |
| 19460 |
res.push(" | " + repeat$1("^", length$1)); |
| 19461 |
} |
| 19462 |
count += lineLength + 1; |
| 19463 |
} |
| 19464 |
} |
| 19465 |
break |
| 19466 |
} |
| 19467 |
} |
| 19468 |
return res.join('\n') |
| 19469 |
} |
| 19470 |
|
| 19471 |
function repeat$1 (str, n) { |
| 19472 |
var result = ''; |
| 19473 |
if (n > 0) { |
| 19474 |
while (true) { // eslint-disable-line |
| 19475 |
if (n & 1) { result += str; } |
| 19476 |
n >>>= 1; |
| 19477 |
if (n <= 0) { break } |
| 19478 |
str += str; |
| 19479 |
} |
| 19480 |
} |
| 19481 |
return result |
| 19482 |
} |
| 19483 |
|
| 19484 |
/* */ |
| 19485 |
|
| 19486 |
|
| 19487 |
|
| 19488 |
function createFunction (code, errors) { |
| 19489 |
try { |
| 19490 |
return new Function(code) |
| 19491 |
} catch (err) { |
| 19492 |
errors.push({ err: err, code: code }); |
| 19493 |
return noop |
| 19494 |
} |
| 19495 |
} |
| 19496 |
|
| 19497 |
function createCompileToFunctionFn (compile) { |
| 19498 |
var cache = Object.create(null); |
| 19499 |
|
| 19500 |
return function compileToFunctions ( |
| 19501 |
template, |
| 19502 |
options, |
| 19503 |
vm |
| 19504 |
) { |
| 19505 |
options = extend({}, options); |
| 19506 |
var warn$$1 = options.warn || warn; |
| 19507 |
delete options.warn; |
| 19508 |
|
| 19509 |
/* istanbul ignore if */ |
| 19510 |
if (true) { |
| 19511 |
// detect possible CSP restriction |
| 19512 |
try { |
| 19513 |
new Function('return 1'); |
| 19514 |
} catch (e) { |
| 19515 |
if (e.toString().match(/unsafe-eval|CSP/)) { |
| 19516 |
warn$$1( |
| 19517 |
'It seems you are using the standalone build of Vue.js in an ' + |
| 19518 |
'environment with Content Security Policy that prohibits unsafe-eval. ' + |
| 19519 |
'The template compiler cannot work in this environment. Consider ' + |
| 19520 |
'relaxing the policy to allow unsafe-eval or pre-compiling your ' + |
| 19521 |
'templates into render functions.' |
| 19522 |
); |
| 19523 |
} |
| 19524 |
} |
| 19525 |
} |
| 19526 |
|
| 19527 |
// check cache |
| 19528 |
var key = options.delimiters |
| 19529 |
? String(options.delimiters) + template |
| 19530 |
: template; |
| 19531 |
if (cache[key]) { |
| 19532 |
return cache[key] |
| 19533 |
} |
| 19534 |
|
| 19535 |
// compile |
| 19536 |
var compiled = compile(template, options); |
| 19537 |
|
| 19538 |
// check compilation errors/tips |
| 19539 |
if (true) { |
| 19540 |
if (compiled.errors && compiled.errors.length) { |
| 19541 |
if (options.outputSourceRange) { |
| 19542 |
compiled.errors.forEach(function (e) { |
| 19543 |
warn$$1( |
| 19544 |
"Error compiling template:\n\n" + (e.msg) + "\n\n" + |
| 19545 |
generateCodeFrame(template, e.start, e.end), |
| 19546 |
vm |
| 19547 |
); |
| 19548 |
}); |
| 19549 |
} else { |
| 19550 |
warn$$1( |
| 19551 |
"Error compiling template:\n\n" + template + "\n\n" + |
| 19552 |
compiled.errors.map(function (e) { return ("- " + e); }).join('\n') + '\n', |
| 19553 |
vm |
| 19554 |
); |
| 19555 |
} |
| 19556 |
} |
| 19557 |
if (compiled.tips && compiled.tips.length) { |
| 19558 |
if (options.outputSourceRange) { |
| 19559 |
compiled.tips.forEach(function (e) { return tip(e.msg, vm); }); |
| 19560 |
} else { |
| 19561 |
compiled.tips.forEach(function (msg) { return tip(msg, vm); }); |
| 19562 |
} |
| 19563 |
} |
| 19564 |
} |
| 19565 |
|
| 19566 |
// turn code into functions |
| 19567 |
var res = {}; |
| 19568 |
var fnGenErrors = []; |
| 19569 |
res.render = createFunction(compiled.render, fnGenErrors); |
| 19570 |
res.staticRenderFns = compiled.staticRenderFns.map(function (code) { |
| 19571 |
return createFunction(code, fnGenErrors) |
| 19572 |
}); |
| 19573 |
|
| 19574 |
// check function generation errors. |
| 19575 |
// this should only happen if there is a bug in the compiler itself. |
| 19576 |
// mostly for codegen development use |
| 19577 |
/* istanbul ignore if */ |
| 19578 |
if (true) { |
| 19579 |
if ((!compiled.errors || !compiled.errors.length) && fnGenErrors.length) { |
| 19580 |
warn$$1( |
| 19581 |
"Failed to generate render function:\n\n" + |
| 19582 |
fnGenErrors.map(function (ref) { |
| 19583 |
var err = ref.err; |
| 19584 |
var code = ref.code; |
| 19585 |
|
| 19586 |
return ((err.toString()) + " in\n\n" + code + "\n"); |
| 19587 |
}).join('\n'), |
| 19588 |
vm |
| 19589 |
); |
| 19590 |
} |
| 19591 |
} |
| 19592 |
|
| 19593 |
return (cache[key] = res) |
| 19594 |
} |
| 19595 |
} |
| 19596 |
|
| 19597 |
/* */ |
| 19598 |
|
| 19599 |
function createCompilerCreator (baseCompile) { |
| 19600 |
return function createCompiler (baseOptions) { |
| 19601 |
function compile ( |
| 19602 |
template, |
| 19603 |
options |
| 19604 |
) { |
| 19605 |
var finalOptions = Object.create(baseOptions); |
| 19606 |
var errors = []; |
| 19607 |
var tips = []; |
| 19608 |
|
| 19609 |
var warn = function (msg, range, tip) { |
| 19610 |
(tip ? tips : errors).push(msg); |
| 19611 |
}; |
| 19612 |
|
| 19613 |
if (options) { |
| 19614 |
if ( true && options.outputSourceRange) { |
| 19615 |
// $flow-disable-line |
| 19616 |
var leadingSpaceLength = template.match(/^\s*/)[0].length; |
| 19617 |
|
| 19618 |
warn = function (msg, range, tip) { |
| 19619 |
var data = { msg: msg }; |
| 19620 |
if (range) { |
| 19621 |
if (range.start != null) { |
| 19622 |
data.start = range.start + leadingSpaceLength; |
| 19623 |
} |
| 19624 |
if (range.end != null) { |
| 19625 |
data.end = range.end + leadingSpaceLength; |
| 19626 |
} |
| 19627 |
} |
| 19628 |
(tip ? tips : errors).push(data); |
| 19629 |
}; |
| 19630 |
} |
| 19631 |
// merge custom modules |
| 19632 |
if (options.modules) { |
| 19633 |
finalOptions.modules = |
| 19634 |
(baseOptions.modules || []).concat(options.modules); |
| 19635 |
} |
| 19636 |
// merge custom directives |
| 19637 |
if (options.directives) { |
| 19638 |
finalOptions.directives = extend( |
| 19639 |
Object.create(baseOptions.directives || null), |
| 19640 |
options.directives |
| 19641 |
); |
| 19642 |
} |
| 19643 |
// copy other options |
| 19644 |
for (var key in options) { |
| 19645 |
if (key !== 'modules' && key !== 'directives') { |
| 19646 |
finalOptions[key] = options[key]; |
| 19647 |
} |
| 19648 |
} |
| 19649 |
} |
| 19650 |
|
| 19651 |
finalOptions.warn = warn; |
| 19652 |
|
| 19653 |
var compiled = baseCompile(template.trim(), finalOptions); |
| 19654 |
if (true) { |
| 19655 |
detectErrors(compiled.ast, warn); |
| 19656 |
} |
| 19657 |
compiled.errors = errors; |
| 19658 |
compiled.tips = tips; |
| 19659 |
return compiled |
| 19660 |
} |
| 19661 |
|
| 19662 |
return { |
| 19663 |
compile: compile, |
| 19664 |
compileToFunctions: createCompileToFunctionFn(compile) |
| 19665 |
} |
| 19666 |
} |
| 19667 |
} |
| 19668 |
|
| 19669 |
/* */ |
| 19670 |
|
| 19671 |
// `createCompilerCreator` allows creating compilers that use alternative |
| 19672 |
// parser/optimizer/codegen, e.g the SSR optimizing compiler. |
| 19673 |
// Here we just export a default compiler using the default parts. |
| 19674 |
var createCompiler = createCompilerCreator(function baseCompile ( |
| 19675 |
template, |
| 19676 |
options |
| 19677 |
) { |
| 19678 |
var ast = parse(template.trim(), options); |
| 19679 |
if (options.optimize !== false) { |
| 19680 |
optimize(ast, options); |
| 19681 |
} |
| 19682 |
var code = generate(ast, options); |
| 19683 |
return { |
| 19684 |
ast: ast, |
| 19685 |
render: code.render, |
| 19686 |
staticRenderFns: code.staticRenderFns |
| 19687 |
} |
| 19688 |
}); |
| 19689 |
|
| 19690 |
/* */ |
| 19691 |
|
| 19692 |
var ref$1 = createCompiler(baseOptions); |
| 19693 |
var compile = ref$1.compile; |
| 19694 |
var compileToFunctions = ref$1.compileToFunctions; |
| 19695 |
|
| 19696 |
/* */ |
| 19697 |
|
| 19698 |
// check whether current browser encodes a char inside attribute values |
| 19699 |
var div; |
| 19700 |
function getShouldDecode (href) { |
| 19701 |
div = div || document.createElement('div'); |
| 19702 |
div.innerHTML = href ? "<a href=\"\n\"/>" : "<div a=\"\n\"/>"; |
| 19703 |
return div.innerHTML.indexOf(' ') > 0 |
| 19704 |
} |
| 19705 |
|
| 19706 |
// #3663: IE encodes newlines inside attribute values while other browsers don't |
| 19707 |
var shouldDecodeNewlines = inBrowser ? getShouldDecode(false) : false; |
| 19708 |
// #6828: chrome encodes content in a[href] |
| 19709 |
var shouldDecodeNewlinesForHref = inBrowser ? getShouldDecode(true) : false; |
| 19710 |
|
| 19711 |
/* */ |
| 19712 |
|
| 19713 |
var idToTemplate = cached(function (id) { |
| 19714 |
var el = query(id); |
| 19715 |
return el && el.innerHTML |
| 19716 |
}); |
| 19717 |
|
| 19718 |
var mount = Vue.prototype.$mount; |
| 19719 |
Vue.prototype.$mount = function ( |
| 19720 |
el, |
| 19721 |
hydrating |
| 19722 |
) { |
| 19723 |
el = el && query(el); |
| 19724 |
|
| 19725 |
/* istanbul ignore if */ |
| 19726 |
if (el === document.body || el === document.documentElement) { |
| 19727 |
true && warn( |
| 19728 |
"Do not mount Vue to <html> or <body> - mount to normal elements instead." |
| 19729 |
); |
| 19730 |
return this |
| 19731 |
} |
| 19732 |
|
| 19733 |
var options = this.$options; |
| 19734 |
// resolve template/el and convert to render function |
| 19735 |
if (!options.render) { |
| 19736 |
var template = options.template; |
| 19737 |
if (template) { |
| 19738 |
if (typeof template === 'string') { |
| 19739 |
if (template.charAt(0) === '#') { |
| 19740 |
template = idToTemplate(template); |
| 19741 |
/* istanbul ignore if */ |
| 19742 |
if ( true && !template) { |
| 19743 |
warn( |
| 19744 |
("Template element not found or is empty: " + (options.template)), |
| 19745 |
this |
| 19746 |
); |
| 19747 |
} |
| 19748 |
} |
| 19749 |
} else if (template.nodeType) { |
| 19750 |
template = template.innerHTML; |
| 19751 |
} else { |
| 19752 |
if (true) { |
| 19753 |
warn('invalid template option:' + template, this); |
| 19754 |
} |
| 19755 |
return this |
| 19756 |
} |
| 19757 |
} else if (el) { |
| 19758 |
template = getOuterHTML(el); |
| 19759 |
} |
| 19760 |
if (template) { |
| 19761 |
/* istanbul ignore if */ |
| 19762 |
if ( true && config.performance && mark) { |
| 19763 |
mark('compile'); |
| 19764 |
} |
| 19765 |
|
| 19766 |
var ref = compileToFunctions(template, { |
| 19767 |
outputSourceRange: "development" !== 'production', |
| 19768 |
shouldDecodeNewlines: shouldDecodeNewlines, |
| 19769 |
shouldDecodeNewlinesForHref: shouldDecodeNewlinesForHref, |
| 19770 |
delimiters: options.delimiters, |
| 19771 |
comments: options.comments |
| 19772 |
}, this); |
| 19773 |
var render = ref.render; |
| 19774 |
var staticRenderFns = ref.staticRenderFns; |
| 19775 |
options.render = render; |
| 19776 |
options.staticRenderFns = staticRenderFns; |
| 19777 |
|
| 19778 |
/* istanbul ignore if */ |
| 19779 |
if ( true && config.performance && mark) { |
| 19780 |
mark('compile end'); |
| 19781 |
measure(("vue " + (this._name) + " compile"), 'compile', 'compile end'); |
| 19782 |
} |
| 19783 |
} |
| 19784 |
} |
| 19785 |
return mount.call(this, el, hydrating) |
| 19786 |
}; |
| 19787 |
|
| 19788 |
/** |
| 19789 |
* Get outerHTML of elements, taking care |
| 19790 |
* of SVG elements in IE as well. |
| 19791 |
*/ |
| 19792 |
function getOuterHTML (el) { |
| 19793 |
if (el.outerHTML) { |
| 19794 |
return el.outerHTML |
| 19795 |
} else { |
| 19796 |
var container = document.createElement('div'); |
| 19797 |
container.appendChild(el.cloneNode(true)); |
| 19798 |
return container.innerHTML |
| 19799 |
} |
| 19800 |
} |
| 19801 |
|
| 19802 |
Vue.compile = compileToFunctions; |
| 19803 |
|
| 19804 |
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (Vue); |
| 19805 |
|
| 19806 |
|
| 19807 |
/***/ }), |
| 19808 |
|
| 19809 |
/***/ "./node_modules/vuedraggable/dist/vuedraggable.umd.js": |
| 19810 |
/*!************************************************************!*\ |
| 19811 |
!*** ./node_modules/vuedraggable/dist/vuedraggable.umd.js ***! |
| 19812 |
\************************************************************/ |
| 19813 |
/***/ (function(module, __unused_webpack_exports, __webpack_require__) { |
| 19814 |
|
| 19815 |
(function webpackUniversalModuleDefinition(root, factory) { |
| 19816 |
if(true) |
| 19817 |
module.exports = factory(__webpack_require__(/*! sortablejs */ "./node_modules/sortablejs/modular/sortable.esm.js")); |
| 19818 |
else {} |
| 19819 |
})((typeof self !== 'undefined' ? self : this), function(__WEBPACK_EXTERNAL_MODULE_a352__) { |
| 19820 |
return /******/ (function(modules) { // webpackBootstrap |
| 19821 |
/******/ // The module cache |
| 19822 |
/******/ var installedModules = {}; |
| 19823 |
/******/ |
| 19824 |
/******/ // The require function |
| 19825 |
/******/ function __nested_webpack_require_688__(moduleId) { |
| 19826 |
/******/ |
| 19827 |
/******/ // Check if module is in cache |
| 19828 |
/******/ if(installedModules[moduleId]) { |
| 19829 |
/******/ return installedModules[moduleId].exports; |
| 19830 |
/******/ } |
| 19831 |
/******/ // Create a new module (and put it into the cache) |
| 19832 |
/******/ var module = installedModules[moduleId] = { |
| 19833 |
/******/ i: moduleId, |
| 19834 |
/******/ l: false, |
| 19835 |
/******/ exports: {} |
| 19836 |
/******/ }; |
| 19837 |
/******/ |
| 19838 |
/******/ // Execute the module function |
| 19839 |
/******/ modules[moduleId].call(module.exports, module, module.exports, __nested_webpack_require_688__); |
| 19840 |
/******/ |
| 19841 |
/******/ // Flag the module as loaded |
| 19842 |
/******/ module.l = true; |
| 19843 |
/******/ |
| 19844 |
/******/ // Return the exports of the module |
| 19845 |
/******/ return module.exports; |
| 19846 |
/******/ } |
| 19847 |
/******/ |
| 19848 |
/******/ |
| 19849 |
/******/ // expose the modules object (__webpack_modules__) |
| 19850 |
/******/ __nested_webpack_require_688__.m = modules; |
| 19851 |
/******/ |
| 19852 |
/******/ // expose the module cache |
| 19853 |
/******/ __nested_webpack_require_688__.c = installedModules; |
| 19854 |
/******/ |
| 19855 |
/******/ // define getter function for harmony exports |
| 19856 |
/******/ __nested_webpack_require_688__.d = function(exports, name, getter) { |
| 19857 |
/******/ if(!__nested_webpack_require_688__.o(exports, name)) { |
| 19858 |
/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); |
| 19859 |
/******/ } |
| 19860 |
/******/ }; |
| 19861 |
/******/ |
| 19862 |
/******/ // define __esModule on exports |
| 19863 |
/******/ __nested_webpack_require_688__.r = function(exports) { |
| 19864 |
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { |
| 19865 |
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); |
| 19866 |
/******/ } |
| 19867 |
/******/ Object.defineProperty(exports, '__esModule', { value: true }); |
| 19868 |
/******/ }; |
| 19869 |
/******/ |
| 19870 |
/******/ // create a fake namespace object |
| 19871 |
/******/ // mode & 1: value is a module id, require it |
| 19872 |
/******/ // mode & 2: merge all properties of value into the ns |
| 19873 |
/******/ // mode & 4: return value when already ns object |
| 19874 |
/******/ // mode & 8|1: behave like require |
| 19875 |
/******/ __nested_webpack_require_688__.t = function(value, mode) { |
| 19876 |
/******/ if(mode & 1) value = __nested_webpack_require_688__(value); |
| 19877 |
/******/ if(mode & 8) return value; |
| 19878 |
/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; |
| 19879 |
/******/ var ns = Object.create(null); |
| 19880 |
/******/ __nested_webpack_require_688__.r(ns); |
| 19881 |
/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); |
| 19882 |
/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __nested_webpack_require_688__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); |
| 19883 |
/******/ return ns; |
| 19884 |
/******/ }; |
| 19885 |
/******/ |
| 19886 |
/******/ // getDefaultExport function for compatibility with non-harmony modules |
| 19887 |
/******/ __nested_webpack_require_688__.n = function(module) { |
| 19888 |
/******/ var getter = module && module.__esModule ? |
| 19889 |
/******/ function getDefault() { return module['default']; } : |
| 19890 |
/******/ function getModuleExports() { return module; }; |
| 19891 |
/******/ __nested_webpack_require_688__.d(getter, 'a', getter); |
| 19892 |
/******/ return getter; |
| 19893 |
/******/ }; |
| 19894 |
/******/ |
| 19895 |
/******/ // Object.prototype.hasOwnProperty.call |
| 19896 |
/******/ __nested_webpack_require_688__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; |
| 19897 |
/******/ |
| 19898 |
/******/ // __webpack_public_path__ |
| 19899 |
/******/ __nested_webpack_require_688__.p = ""; |
| 19900 |
/******/ |
| 19901 |
/******/ |
| 19902 |
/******/ // Load entry module and return exports |
| 19903 |
/******/ return __nested_webpack_require_688__(__nested_webpack_require_688__.s = "fb15"); |
| 19904 |
/******/ }) |
| 19905 |
/************************************************************************/ |
| 19906 |
/******/ ({ |
| 19907 |
|
| 19908 |
/***/ "01f9": |
| 19909 |
/***/ (function(module, exports, __nested_webpack_require_4164__) { |
| 19910 |
|
| 19911 |
"use strict"; |
| 19912 |
|
| 19913 |
var LIBRARY = __nested_webpack_require_4164__("2d00"); |
| 19914 |
var $export = __nested_webpack_require_4164__("5ca1"); |
| 19915 |
var redefine = __nested_webpack_require_4164__("2aba"); |
| 19916 |
var hide = __nested_webpack_require_4164__("32e9"); |
| 19917 |
var Iterators = __nested_webpack_require_4164__("84f2"); |
| 19918 |
var $iterCreate = __nested_webpack_require_4164__("41a0"); |
| 19919 |
var setToStringTag = __nested_webpack_require_4164__("7f20"); |
| 19920 |
var getPrototypeOf = __nested_webpack_require_4164__("38fd"); |
| 19921 |
var ITERATOR = __nested_webpack_require_4164__("2b4c")('iterator'); |
| 19922 |
var BUGGY = !([].keys && 'next' in [].keys()); // Safari has buggy iterators w/o `next` |
| 19923 |
var FF_ITERATOR = '@@iterator'; |
| 19924 |
var KEYS = 'keys'; |
| 19925 |
var VALUES = 'values'; |
| 19926 |
|
| 19927 |
var returnThis = function () { return this; }; |
| 19928 |
|
| 19929 |
module.exports = function (Base, NAME, Constructor, next, DEFAULT, IS_SET, FORCED) { |
| 19930 |
$iterCreate(Constructor, NAME, next); |
| 19931 |
var getMethod = function (kind) { |
| 19932 |
if (!BUGGY && kind in proto) return proto[kind]; |
| 19933 |
switch (kind) { |
| 19934 |
case KEYS: return function keys() { return new Constructor(this, kind); }; |
| 19935 |
case VALUES: return function values() { return new Constructor(this, kind); }; |
| 19936 |
} return function entries() { return new Constructor(this, kind); }; |
| 19937 |
}; |
| 19938 |
var TAG = NAME + ' Iterator'; |
| 19939 |
var DEF_VALUES = DEFAULT == VALUES; |
| 19940 |
var VALUES_BUG = false; |
| 19941 |
var proto = Base.prototype; |
| 19942 |
var $native = proto[ITERATOR] || proto[FF_ITERATOR] || DEFAULT && proto[DEFAULT]; |
| 19943 |
var $default = $native || getMethod(DEFAULT); |
| 19944 |
var $entries = DEFAULT ? !DEF_VALUES ? $default : getMethod('entries') : undefined; |
| 19945 |
var $anyNative = NAME == 'Array' ? proto.entries || $native : $native; |
| 19946 |
var methods, key, IteratorPrototype; |
| 19947 |
// Fix native |
| 19948 |
if ($anyNative) { |
| 19949 |
IteratorPrototype = getPrototypeOf($anyNative.call(new Base())); |
| 19950 |
if (IteratorPrototype !== Object.prototype && IteratorPrototype.next) { |
| 19951 |
// Set @@toStringTag to native iterators |
| 19952 |
setToStringTag(IteratorPrototype, TAG, true); |
| 19953 |
// fix for some old engines |
| 19954 |
if (!LIBRARY && typeof IteratorPrototype[ITERATOR] != 'function') hide(IteratorPrototype, ITERATOR, returnThis); |
| 19955 |
} |
| 19956 |
} |
| 19957 |
// fix Array#{values, @@iterator}.name in V8 / FF |
| 19958 |
if (DEF_VALUES && $native && $native.name !== VALUES) { |
| 19959 |
VALUES_BUG = true; |
| 19960 |
$default = function values() { return $native.call(this); }; |
| 19961 |
} |
| 19962 |
// Define iterator |
| 19963 |
if ((!LIBRARY || FORCED) && (BUGGY || VALUES_BUG || !proto[ITERATOR])) { |
| 19964 |
hide(proto, ITERATOR, $default); |
| 19965 |
} |
| 19966 |
// Plug for library |
| 19967 |
Iterators[NAME] = $default; |
| 19968 |
Iterators[TAG] = returnThis; |
| 19969 |
if (DEFAULT) { |
| 19970 |
methods = { |
| 19971 |
values: DEF_VALUES ? $default : getMethod(VALUES), |
| 19972 |
keys: IS_SET ? $default : getMethod(KEYS), |
| 19973 |
entries: $entries |
| 19974 |
}; |
| 19975 |
if (FORCED) for (key in methods) { |
| 19976 |
if (!(key in proto)) redefine(proto, key, methods[key]); |
| 19977 |
} else $export($export.P + $export.F * (BUGGY || VALUES_BUG), NAME, methods); |
| 19978 |
} |
| 19979 |
return methods; |
| 19980 |
}; |
| 19981 |
|
| 19982 |
|
| 19983 |
/***/ }), |
| 19984 |
|
| 19985 |
/***/ "02f4": |
| 19986 |
/***/ (function(module, exports, __nested_webpack_require_7070__) { |
| 19987 |
|
| 19988 |
var toInteger = __nested_webpack_require_7070__("4588"); |
| 19989 |
var defined = __nested_webpack_require_7070__("be13"); |
| 19990 |
// true -> String#at |
| 19991 |
// false -> String#codePointAt |
| 19992 |
module.exports = function (TO_STRING) { |
| 19993 |
return function (that, pos) { |
| 19994 |
var s = String(defined(that)); |
| 19995 |
var i = toInteger(pos); |
| 19996 |
var l = s.length; |
| 19997 |
var a, b; |
| 19998 |
if (i < 0 || i >= l) return TO_STRING ? '' : undefined; |
| 19999 |
a = s.charCodeAt(i); |
| 20000 |
return a < 0xd800 || a > 0xdbff || i + 1 === l || (b = s.charCodeAt(i + 1)) < 0xdc00 || b > 0xdfff |
| 20001 |
? TO_STRING ? s.charAt(i) : a |
| 20002 |
: TO_STRING ? s.slice(i, i + 2) : (a - 0xd800 << 10) + (b - 0xdc00) + 0x10000; |
| 20003 |
}; |
| 20004 |
}; |
| 20005 |
|
| 20006 |
|
| 20007 |
/***/ }), |
| 20008 |
|
| 20009 |
/***/ "0390": |
| 20010 |
/***/ (function(module, exports, __nested_webpack_require_7783__) { |
| 20011 |
|
| 20012 |
"use strict"; |
| 20013 |
|
| 20014 |
var at = __nested_webpack_require_7783__("02f4")(true); |
| 20015 |
|
| 20016 |
// `AdvanceStringIndex` abstract operation |
| 20017 |
// https://tc39.github.io/ecma262/#sec-advancestringindex |
| 20018 |
module.exports = function (S, index, unicode) { |
| 20019 |
return index + (unicode ? at(S, index).length : 1); |
| 20020 |
}; |
| 20021 |
|
| 20022 |
|
| 20023 |
/***/ }), |
| 20024 |
|
| 20025 |
/***/ "0bfb": |
| 20026 |
/***/ (function(module, exports, __nested_webpack_require_8134__) { |
| 20027 |
|
| 20028 |
"use strict"; |
| 20029 |
|
| 20030 |
// 21.2.5.3 get RegExp.prototype.flags |
| 20031 |
var anObject = __nested_webpack_require_8134__("cb7c"); |
| 20032 |
module.exports = function () { |
| 20033 |
var that = anObject(this); |
| 20034 |
var result = ''; |
| 20035 |
if (that.global) result += 'g'; |
| 20036 |
if (that.ignoreCase) result += 'i'; |
| 20037 |
if (that.multiline) result += 'm'; |
| 20038 |
if (that.unicode) result += 'u'; |
| 20039 |
if (that.sticky) result += 'y'; |
| 20040 |
return result; |
| 20041 |
}; |
| 20042 |
|
| 20043 |
|
| 20044 |
/***/ }), |
| 20045 |
|
| 20046 |
/***/ "0d58": |
| 20047 |
/***/ (function(module, exports, __nested_webpack_require_8593__) { |
| 20048 |
|
| 20049 |
// 19.1.2.14 / 15.2.3.14 Object.keys(O) |
| 20050 |
var $keys = __nested_webpack_require_8593__("ce10"); |
| 20051 |
var enumBugKeys = __nested_webpack_require_8593__("e11e"); |
| 20052 |
|
| 20053 |
module.exports = Object.keys || function keys(O) { |
| 20054 |
return $keys(O, enumBugKeys); |
| 20055 |
}; |
| 20056 |
|
| 20057 |
|
| 20058 |
/***/ }), |
| 20059 |
|
| 20060 |
/***/ "1495": |
| 20061 |
/***/ (function(module, exports, __nested_webpack_require_8892__) { |
| 20062 |
|
| 20063 |
var dP = __nested_webpack_require_8892__("86cc"); |
| 20064 |
var anObject = __nested_webpack_require_8892__("cb7c"); |
| 20065 |
var getKeys = __nested_webpack_require_8892__("0d58"); |
| 20066 |
|
| 20067 |
module.exports = __nested_webpack_require_8892__("9e1e") ? Object.defineProperties : function defineProperties(O, Properties) { |
| 20068 |
anObject(O); |
| 20069 |
var keys = getKeys(Properties); |
| 20070 |
var length = keys.length; |
| 20071 |
var i = 0; |
| 20072 |
var P; |
| 20073 |
while (length > i) dP.f(O, P = keys[i++], Properties[P]); |
| 20074 |
return O; |
| 20075 |
}; |
| 20076 |
|
| 20077 |
|
| 20078 |
/***/ }), |
| 20079 |
|
| 20080 |
/***/ "214f": |
| 20081 |
/***/ (function(module, exports, __nested_webpack_require_9392__) { |
| 20082 |
|
| 20083 |
"use strict"; |
| 20084 |
|
| 20085 |
__nested_webpack_require_9392__("b0c5"); |
| 20086 |
var redefine = __nested_webpack_require_9392__("2aba"); |
| 20087 |
var hide = __nested_webpack_require_9392__("32e9"); |
| 20088 |
var fails = __nested_webpack_require_9392__("79e5"); |
| 20089 |
var defined = __nested_webpack_require_9392__("be13"); |
| 20090 |
var wks = __nested_webpack_require_9392__("2b4c"); |
| 20091 |
var regexpExec = __nested_webpack_require_9392__("520a"); |
| 20092 |
|
| 20093 |
var SPECIES = wks('species'); |
| 20094 |
|
| 20095 |
var REPLACE_SUPPORTS_NAMED_GROUPS = !fails(function () { |
| 20096 |
// #replace needs built-in support for named groups. |
| 20097 |
// #match works fine because it just return the exec results, even if it has |
| 20098 |
// a "grops" property. |
| 20099 |
var re = /./; |
| 20100 |
re.exec = function () { |
| 20101 |
var result = []; |
| 20102 |
result.groups = { a: '7' }; |
| 20103 |
return result; |
| 20104 |
}; |
| 20105 |
return ''.replace(re, '$<a>') !== '7'; |
| 20106 |
}); |
| 20107 |
|
| 20108 |
var SPLIT_WORKS_WITH_OVERWRITTEN_EXEC = (function () { |
| 20109 |
// Chrome 51 has a buggy "split" implementation when RegExp#exec !== nativeExec |
| 20110 |
var re = /(?:)/; |
| 20111 |
var originalExec = re.exec; |
| 20112 |
re.exec = function () { return originalExec.apply(this, arguments); }; |
| 20113 |
var result = 'ab'.split(re); |
| 20114 |
return result.length === 2 && result[0] === 'a' && result[1] === 'b'; |
| 20115 |
})(); |
| 20116 |
|
| 20117 |
module.exports = function (KEY, length, exec) { |
| 20118 |
var SYMBOL = wks(KEY); |
| 20119 |
|
| 20120 |
var DELEGATES_TO_SYMBOL = !fails(function () { |
| 20121 |
// String methods call symbol-named RegEp methods |
| 20122 |
var O = {}; |
| 20123 |
O[SYMBOL] = function () { return 7; }; |
| 20124 |
return ''[KEY](O) != 7; |
| 20125 |
}); |
| 20126 |
|
| 20127 |
var DELEGATES_TO_EXEC = DELEGATES_TO_SYMBOL ? !fails(function () { |
| 20128 |
// Symbol-named RegExp methods call .exec |
| 20129 |
var execCalled = false; |
| 20130 |
var re = /a/; |
| 20131 |
re.exec = function () { execCalled = true; return null; }; |
| 20132 |
if (KEY === 'split') { |
| 20133 |
// RegExp[@@split] doesn't call the regex's exec method, but first creates |
| 20134 |
// a new one. We need to return the patched regex when creating the new one. |
| 20135 |
re.constructor = {}; |
| 20136 |
re.constructor[SPECIES] = function () { return re; }; |
| 20137 |
} |
| 20138 |
re[SYMBOL](''); |
| 20139 |
return !execCalled; |
| 20140 |
}) : undefined; |
| 20141 |
|
| 20142 |
if ( |
| 20143 |
!DELEGATES_TO_SYMBOL || |
| 20144 |
!DELEGATES_TO_EXEC || |
| 20145 |
(KEY === 'replace' && !REPLACE_SUPPORTS_NAMED_GROUPS) || |
| 20146 |
(KEY === 'split' && !SPLIT_WORKS_WITH_OVERWRITTEN_EXEC) |
| 20147 |
) { |
| 20148 |
var nativeRegExpMethod = /./[SYMBOL]; |
| 20149 |
var fns = exec( |
| 20150 |
defined, |
| 20151 |
SYMBOL, |
| 20152 |
''[KEY], |
| 20153 |
function maybeCallNative(nativeMethod, regexp, str, arg2, forceStringMethod) { |
| 20154 |
if (regexp.exec === regexpExec) { |
| 20155 |
if (DELEGATES_TO_SYMBOL && !forceStringMethod) { |
| 20156 |
// The native String method already delegates to @@method (this |
| 20157 |
// polyfilled function), leasing to infinite recursion. |
| 20158 |
// We avoid it by directly calling the native @@method method. |
| 20159 |
return { done: true, value: nativeRegExpMethod.call(regexp, str, arg2) }; |
| 20160 |
} |
| 20161 |
return { done: true, value: nativeMethod.call(str, regexp, arg2) }; |
| 20162 |
} |
| 20163 |
return { done: false }; |
| 20164 |
} |
| 20165 |
); |
| 20166 |
var strfn = fns[0]; |
| 20167 |
var rxfn = fns[1]; |
| 20168 |
|
| 20169 |
redefine(String.prototype, KEY, strfn); |
| 20170 |
hide(RegExp.prototype, SYMBOL, length == 2 |
| 20171 |
// 21.2.5.8 RegExp.prototype[@@replace](string, replaceValue) |
| 20172 |
// 21.2.5.11 RegExp.prototype[@@split](string, limit) |
| 20173 |
? function (string, arg) { return rxfn.call(string, this, arg); } |
| 20174 |
// 21.2.5.6 RegExp.prototype[@@match](string) |
| 20175 |
// 21.2.5.9 RegExp.prototype[@@search](string) |
| 20176 |
: function (string) { return rxfn.call(string, this); } |
| 20177 |
); |
| 20178 |
} |
| 20179 |
}; |
| 20180 |
|
| 20181 |
|
| 20182 |
/***/ }), |
| 20183 |
|
| 20184 |
/***/ "230e": |
| 20185 |
/***/ (function(module, exports, __nested_webpack_require_12849__) { |
| 20186 |
|
| 20187 |
var isObject = __nested_webpack_require_12849__("d3f4"); |
| 20188 |
var document = __nested_webpack_require_12849__("7726").document; |
| 20189 |
// typeof document.createElement is 'object' in old IE |
| 20190 |
var is = isObject(document) && isObject(document.createElement); |
| 20191 |
module.exports = function (it) { |
| 20192 |
return is ? document.createElement(it) : {}; |
| 20193 |
}; |
| 20194 |
|
| 20195 |
|
| 20196 |
/***/ }), |
| 20197 |
|
| 20198 |
/***/ "23c6": |
| 20199 |
/***/ (function(module, exports, __nested_webpack_require_13233__) { |
| 20200 |
|
| 20201 |
// getting tag from 19.1.3.6 Object.prototype.toString() |
| 20202 |
var cof = __nested_webpack_require_13233__("2d95"); |
| 20203 |
var TAG = __nested_webpack_require_13233__("2b4c")('toStringTag'); |
| 20204 |
// ES3 wrong here |
| 20205 |
var ARG = cof(function () { return arguments; }()) == 'Arguments'; |
| 20206 |
|
| 20207 |
// fallback for IE11 Script Access Denied error |
| 20208 |
var tryGet = function (it, key) { |
| 20209 |
try { |
| 20210 |
return it[key]; |
| 20211 |
} catch (e) { /* empty */ } |
| 20212 |
}; |
| 20213 |
|
| 20214 |
module.exports = function (it) { |
| 20215 |
var O, T, B; |
| 20216 |
return it === undefined ? 'Undefined' : it === null ? 'Null' |
| 20217 |
// @@toStringTag case |
| 20218 |
: typeof (T = tryGet(O = Object(it), TAG)) == 'string' ? T |
| 20219 |
// builtinTag case |
| 20220 |
: ARG ? cof(O) |
| 20221 |
// ES3 arguments fallback |
| 20222 |
: (B = cof(O)) == 'Object' && typeof O.callee == 'function' ? 'Arguments' : B; |
| 20223 |
}; |
| 20224 |
|
| 20225 |
|
| 20226 |
/***/ }), |
| 20227 |
|
| 20228 |
/***/ "2621": |
| 20229 |
/***/ (function(module, exports) { |
| 20230 |
|
| 20231 |
exports.f = Object.getOwnPropertySymbols; |
| 20232 |
|
| 20233 |
|
| 20234 |
/***/ }), |
| 20235 |
|
| 20236 |
/***/ "2aba": |
| 20237 |
/***/ (function(module, exports, __nested_webpack_require_14160__) { |
| 20238 |
|
| 20239 |
var global = __nested_webpack_require_14160__("7726"); |
| 20240 |
var hide = __nested_webpack_require_14160__("32e9"); |
| 20241 |
var has = __nested_webpack_require_14160__("69a8"); |
| 20242 |
var SRC = __nested_webpack_require_14160__("ca5a")('src'); |
| 20243 |
var $toString = __nested_webpack_require_14160__("fa5b"); |
| 20244 |
var TO_STRING = 'toString'; |
| 20245 |
var TPL = ('' + $toString).split(TO_STRING); |
| 20246 |
|
| 20247 |
__nested_webpack_require_14160__("8378").inspectSource = function (it) { |
| 20248 |
return $toString.call(it); |
| 20249 |
}; |
| 20250 |
|
| 20251 |
(module.exports = function (O, key, val, safe) { |
| 20252 |
var isFunction = typeof val == 'function'; |
| 20253 |
if (isFunction) has(val, 'name') || hide(val, 'name', key); |
| 20254 |
if (O[key] === val) return; |
| 20255 |
if (isFunction) has(val, SRC) || hide(val, SRC, O[key] ? '' + O[key] : TPL.join(String(key))); |
| 20256 |
if (O === global) { |
| 20257 |
O[key] = val; |
| 20258 |
} else if (!safe) { |
| 20259 |
delete O[key]; |
| 20260 |
hide(O, key, val); |
| 20261 |
} else if (O[key]) { |
| 20262 |
O[key] = val; |
| 20263 |
} else { |
| 20264 |
hide(O, key, val); |
| 20265 |
} |
| 20266 |
// add fake Function#toString for correct work wrapped methods / constructors with methods like LoDash isNative |
| 20267 |
})(Function.prototype, TO_STRING, function toString() { |
| 20268 |
return typeof this == 'function' && this[SRC] || $toString.call(this); |
| 20269 |
}); |
| 20270 |
|
| 20271 |
|
| 20272 |
/***/ }), |
| 20273 |
|
| 20274 |
/***/ "2aeb": |
| 20275 |
/***/ (function(module, exports, __nested_webpack_require_15334__) { |
| 20276 |
|
| 20277 |
// 19.1.2.2 / 15.2.3.5 Object.create(O [, Properties]) |
| 20278 |
var anObject = __nested_webpack_require_15334__("cb7c"); |
| 20279 |
var dPs = __nested_webpack_require_15334__("1495"); |
| 20280 |
var enumBugKeys = __nested_webpack_require_15334__("e11e"); |
| 20281 |
var IE_PROTO = __nested_webpack_require_15334__("613b")('IE_PROTO'); |
| 20282 |
var Empty = function () { /* empty */ }; |
| 20283 |
var PROTOTYPE = 'prototype'; |
| 20284 |
|
| 20285 |
// Create object with fake `null` prototype: use iframe Object with cleared prototype |
| 20286 |
var createDict = function () { |
| 20287 |
// Thrash, waste and sodomy: IE GC bug |
| 20288 |
var iframe = __nested_webpack_require_15334__("230e")('iframe'); |
| 20289 |
var i = enumBugKeys.length; |
| 20290 |
var lt = '<'; |
| 20291 |
var gt = '>'; |
| 20292 |
var iframeDocument; |
| 20293 |
iframe.style.display = 'none'; |
| 20294 |
__nested_webpack_require_15334__("fab2").appendChild(iframe); |
| 20295 |
iframe.src = 'javascript:'; // eslint-disable-line no-script-url |
| 20296 |
// createDict = iframe.contentWindow.Object; |
| 20297 |
// html.removeChild(iframe); |
| 20298 |
iframeDocument = iframe.contentWindow.document; |
| 20299 |
iframeDocument.open(); |
| 20300 |
iframeDocument.write(lt + 'script' + gt + 'document.F=Object' + lt + '/script' + gt); |
| 20301 |
iframeDocument.close(); |
| 20302 |
createDict = iframeDocument.F; |
| 20303 |
while (i--) delete createDict[PROTOTYPE][enumBugKeys[i]]; |
| 20304 |
return createDict(); |
| 20305 |
}; |
| 20306 |
|
| 20307 |
module.exports = Object.create || function create(O, Properties) { |
| 20308 |
var result; |
| 20309 |
if (O !== null) { |
| 20310 |
Empty[PROTOTYPE] = anObject(O); |
| 20311 |
result = new Empty(); |
| 20312 |
Empty[PROTOTYPE] = null; |
| 20313 |
// add "__proto__" for Object.getPrototypeOf polyfill |
| 20314 |
result[IE_PROTO] = O; |
| 20315 |
} else result = createDict(); |
| 20316 |
return Properties === undefined ? result : dPs(result, Properties); |
| 20317 |
}; |
| 20318 |
|
| 20319 |
|
| 20320 |
/***/ }), |
| 20321 |
|
| 20322 |
/***/ "2b4c": |
| 20323 |
/***/ (function(module, exports, __nested_webpack_require_16945__) { |
| 20324 |
|
| 20325 |
var store = __nested_webpack_require_16945__("5537")('wks'); |
| 20326 |
var uid = __nested_webpack_require_16945__("ca5a"); |
| 20327 |
var Symbol = __nested_webpack_require_16945__("7726").Symbol; |
| 20328 |
var USE_SYMBOL = typeof Symbol == 'function'; |
| 20329 |
|
| 20330 |
var $exports = module.exports = function (name) { |
| 20331 |
return store[name] || (store[name] = |
| 20332 |
USE_SYMBOL && Symbol[name] || (USE_SYMBOL ? Symbol : uid)('Symbol.' + name)); |
| 20333 |
}; |
| 20334 |
|
| 20335 |
$exports.store = store; |
| 20336 |
|
| 20337 |
|
| 20338 |
/***/ }), |
| 20339 |
|
| 20340 |
/***/ "2d00": |
| 20341 |
/***/ (function(module, exports) { |
| 20342 |
|
| 20343 |
module.exports = false; |
| 20344 |
|
| 20345 |
|
| 20346 |
/***/ }), |
| 20347 |
|
| 20348 |
/***/ "2d95": |
| 20349 |
/***/ (function(module, exports) { |
| 20350 |
|
| 20351 |
var toString = {}.toString; |
| 20352 |
|
| 20353 |
module.exports = function (it) { |
| 20354 |
return toString.call(it).slice(8, -1); |
| 20355 |
}; |
| 20356 |
|
| 20357 |
|
| 20358 |
/***/ }), |
| 20359 |
|
| 20360 |
/***/ "2fdb": |
| 20361 |
/***/ (function(module, exports, __nested_webpack_require_17667__) { |
| 20362 |
|
| 20363 |
"use strict"; |
| 20364 |
// 21.1.3.7 String.prototype.includes(searchString, position = 0) |
| 20365 |
|
| 20366 |
var $export = __nested_webpack_require_17667__("5ca1"); |
| 20367 |
var context = __nested_webpack_require_17667__("d2c8"); |
| 20368 |
var INCLUDES = 'includes'; |
| 20369 |
|
| 20370 |
$export($export.P + $export.F * __nested_webpack_require_17667__("5147")(INCLUDES), 'String', { |
| 20371 |
includes: function includes(searchString /* , position = 0 */) { |
| 20372 |
return !!~context(this, searchString, INCLUDES) |
| 20373 |
.indexOf(searchString, arguments.length > 1 ? arguments[1] : undefined); |
| 20374 |
} |
| 20375 |
}); |
| 20376 |
|
| 20377 |
|
| 20378 |
/***/ }), |
| 20379 |
|
| 20380 |
/***/ "32e9": |
| 20381 |
/***/ (function(module, exports, __nested_webpack_require_18235__) { |
| 20382 |
|
| 20383 |
var dP = __nested_webpack_require_18235__("86cc"); |
| 20384 |
var createDesc = __nested_webpack_require_18235__("4630"); |
| 20385 |
module.exports = __nested_webpack_require_18235__("9e1e") ? function (object, key, value) { |
| 20386 |
return dP.f(object, key, createDesc(1, value)); |
| 20387 |
} : function (object, key, value) { |
| 20388 |
object[key] = value; |
| 20389 |
return object; |
| 20390 |
}; |
| 20391 |
|
| 20392 |
|
| 20393 |
/***/ }), |
| 20394 |
|
| 20395 |
/***/ "38fd": |
| 20396 |
/***/ (function(module, exports, __nested_webpack_require_18611__) { |
| 20397 |
|
| 20398 |
// 19.1.2.9 / 15.2.3.2 Object.getPrototypeOf(O) |
| 20399 |
var has = __nested_webpack_require_18611__("69a8"); |
| 20400 |
var toObject = __nested_webpack_require_18611__("4bf8"); |
| 20401 |
var IE_PROTO = __nested_webpack_require_18611__("613b")('IE_PROTO'); |
| 20402 |
var ObjectProto = Object.prototype; |
| 20403 |
|
| 20404 |
module.exports = Object.getPrototypeOf || function (O) { |
| 20405 |
O = toObject(O); |
| 20406 |
if (has(O, IE_PROTO)) return O[IE_PROTO]; |
| 20407 |
if (typeof O.constructor == 'function' && O instanceof O.constructor) { |
| 20408 |
return O.constructor.prototype; |
| 20409 |
} return O instanceof Object ? ObjectProto : null; |
| 20410 |
}; |
| 20411 |
|
| 20412 |
|
| 20413 |
/***/ }), |
| 20414 |
|
| 20415 |
/***/ "41a0": |
| 20416 |
/***/ (function(module, exports, __nested_webpack_require_19205__) { |
| 20417 |
|
| 20418 |
"use strict"; |
| 20419 |
|
| 20420 |
var create = __nested_webpack_require_19205__("2aeb"); |
| 20421 |
var descriptor = __nested_webpack_require_19205__("4630"); |
| 20422 |
var setToStringTag = __nested_webpack_require_19205__("7f20"); |
| 20423 |
var IteratorPrototype = {}; |
| 20424 |
|
| 20425 |
// 25.1.2.1.1 %IteratorPrototype%[@@iterator]() |
| 20426 |
__nested_webpack_require_19205__("32e9")(IteratorPrototype, __nested_webpack_require_19205__("2b4c")('iterator'), function () { return this; }); |
| 20427 |
|
| 20428 |
module.exports = function (Constructor, NAME, next) { |
| 20429 |
Constructor.prototype = create(IteratorPrototype, { next: descriptor(1, next) }); |
| 20430 |
setToStringTag(Constructor, NAME + ' Iterator'); |
| 20431 |
}; |
| 20432 |
|
| 20433 |
|
| 20434 |
/***/ }), |
| 20435 |
|
| 20436 |
/***/ "456d": |
| 20437 |
/***/ (function(module, exports, __nested_webpack_require_19831__) { |
| 20438 |
|
| 20439 |
// 19.1.2.14 Object.keys(O) |
| 20440 |
var toObject = __nested_webpack_require_19831__("4bf8"); |
| 20441 |
var $keys = __nested_webpack_require_19831__("0d58"); |
| 20442 |
|
| 20443 |
__nested_webpack_require_19831__("5eda")('keys', function () { |
| 20444 |
return function keys(it) { |
| 20445 |
return $keys(toObject(it)); |
| 20446 |
}; |
| 20447 |
}); |
| 20448 |
|
| 20449 |
|
| 20450 |
/***/ }), |
| 20451 |
|
| 20452 |
/***/ "4588": |
| 20453 |
/***/ (function(module, exports) { |
| 20454 |
|
| 20455 |
// 7.1.4 ToInteger |
| 20456 |
var ceil = Math.ceil; |
| 20457 |
var floor = Math.floor; |
| 20458 |
module.exports = function (it) { |
| 20459 |
return isNaN(it = +it) ? 0 : (it > 0 ? floor : ceil)(it); |
| 20460 |
}; |
| 20461 |
|
| 20462 |
|
| 20463 |
/***/ }), |
| 20464 |
|
| 20465 |
/***/ "4630": |
| 20466 |
/***/ (function(module, exports) { |
| 20467 |
|
| 20468 |
module.exports = function (bitmap, value) { |
| 20469 |
return { |
| 20470 |
enumerable: !(bitmap & 1), |
| 20471 |
configurable: !(bitmap & 2), |
| 20472 |
writable: !(bitmap & 4), |
| 20473 |
value: value |
| 20474 |
}; |
| 20475 |
}; |
| 20476 |
|
| 20477 |
|
| 20478 |
/***/ }), |
| 20479 |
|
| 20480 |
/***/ "4bf8": |
| 20481 |
/***/ (function(module, exports, __nested_webpack_require_20609__) { |
| 20482 |
|
| 20483 |
// 7.1.13 ToObject(argument) |
| 20484 |
var defined = __nested_webpack_require_20609__("be13"); |
| 20485 |
module.exports = function (it) { |
| 20486 |
return Object(defined(it)); |
| 20487 |
}; |
| 20488 |
|
| 20489 |
|
| 20490 |
/***/ }), |
| 20491 |
|
| 20492 |
/***/ "5147": |
| 20493 |
/***/ (function(module, exports, __nested_webpack_require_20831__) { |
| 20494 |
|
| 20495 |
var MATCH = __nested_webpack_require_20831__("2b4c")('match'); |
| 20496 |
module.exports = function (KEY) { |
| 20497 |
var re = /./; |
| 20498 |
try { |
| 20499 |
'/./'[KEY](re); |
| 20500 |
} catch (e) { |
| 20501 |
try { |
| 20502 |
re[MATCH] = false; |
| 20503 |
return !'/./'[KEY](re); |
| 20504 |
} catch (f) { /* empty */ } |
| 20505 |
} return true; |
| 20506 |
}; |
| 20507 |
|
| 20508 |
|
| 20509 |
/***/ }), |
| 20510 |
|
| 20511 |
/***/ "520a": |
| 20512 |
/***/ (function(module, exports, __nested_webpack_require_21176__) { |
| 20513 |
|
| 20514 |
"use strict"; |
| 20515 |
|
| 20516 |
|
| 20517 |
var regexpFlags = __nested_webpack_require_21176__("0bfb"); |
| 20518 |
|
| 20519 |
var nativeExec = RegExp.prototype.exec; |
| 20520 |
// This always refers to the native implementation, because the |
| 20521 |
// String#replace polyfill uses ./fix-regexp-well-known-symbol-logic.js, |
| 20522 |
// which loads this file before patching the method. |
| 20523 |
var nativeReplace = String.prototype.replace; |
| 20524 |
|
| 20525 |
var patchedExec = nativeExec; |
| 20526 |
|
| 20527 |
var LAST_INDEX = 'lastIndex'; |
| 20528 |
|
| 20529 |
var UPDATES_LAST_INDEX_WRONG = (function () { |
| 20530 |
var re1 = /a/, |
| 20531 |
re2 = /b*/g; |
| 20532 |
nativeExec.call(re1, 'a'); |
| 20533 |
nativeExec.call(re2, 'a'); |
| 20534 |
return re1[LAST_INDEX] !== 0 || re2[LAST_INDEX] !== 0; |
| 20535 |
})(); |
| 20536 |
|
| 20537 |
// nonparticipating capturing group, copied from es5-shim's String#split patch. |
| 20538 |
var NPCG_INCLUDED = /()??/.exec('')[1] !== undefined; |
| 20539 |
|
| 20540 |
var PATCH = UPDATES_LAST_INDEX_WRONG || NPCG_INCLUDED; |
| 20541 |
|
| 20542 |
if (PATCH) { |
| 20543 |
patchedExec = function exec(str) { |
| 20544 |
var re = this; |
| 20545 |
var lastIndex, reCopy, match, i; |
| 20546 |
|
| 20547 |
if (NPCG_INCLUDED) { |
| 20548 |
reCopy = new RegExp('^' + re.source + '$(?!\\s)', regexpFlags.call(re)); |
| 20549 |
} |
| 20550 |
if (UPDATES_LAST_INDEX_WRONG) lastIndex = re[LAST_INDEX]; |
| 20551 |
|
| 20552 |
match = nativeExec.call(re, str); |
| 20553 |
|
| 20554 |
if (UPDATES_LAST_INDEX_WRONG && match) { |
| 20555 |
re[LAST_INDEX] = re.global ? match.index + match[0].length : lastIndex; |
| 20556 |
} |
| 20557 |
if (NPCG_INCLUDED && match && match.length > 1) { |
| 20558 |
// Fix browsers whose `exec` methods don't consistently return `undefined` |
| 20559 |
// for NPCG, like IE8. NOTE: This doesn' work for /(.?)?/ |
| 20560 |
// eslint-disable-next-line no-loop-func |
| 20561 |
nativeReplace.call(match[0], reCopy, function () { |
| 20562 |
for (i = 1; i < arguments.length - 2; i++) { |
| 20563 |
if (arguments[i] === undefined) match[i] = undefined; |
| 20564 |
} |
| 20565 |
}); |
| 20566 |
} |
| 20567 |
|
| 20568 |
return match; |
| 20569 |
}; |
| 20570 |
} |
| 20571 |
|
| 20572 |
module.exports = patchedExec; |
| 20573 |
|
| 20574 |
|
| 20575 |
/***/ }), |
| 20576 |
|
| 20577 |
/***/ "52a7": |
| 20578 |
/***/ (function(module, exports) { |
| 20579 |
|
| 20580 |
exports.f = {}.propertyIsEnumerable; |
| 20581 |
|
| 20582 |
|
| 20583 |
/***/ }), |
| 20584 |
|
| 20585 |
/***/ "5537": |
| 20586 |
/***/ (function(module, exports, __nested_webpack_require_23109__) { |
| 20587 |
|
| 20588 |
var core = __nested_webpack_require_23109__("8378"); |
| 20589 |
var global = __nested_webpack_require_23109__("7726"); |
| 20590 |
var SHARED = '__core-js_shared__'; |
| 20591 |
var store = global[SHARED] || (global[SHARED] = {}); |
| 20592 |
|
| 20593 |
(module.exports = function (key, value) { |
| 20594 |
return store[key] || (store[key] = value !== undefined ? value : {}); |
| 20595 |
})('versions', []).push({ |
| 20596 |
version: core.version, |
| 20597 |
mode: __nested_webpack_require_23109__("2d00") ? 'pure' : 'global', |
| 20598 |
copyright: '© 2019 Denis Pushkarev (zloirock.ru)' |
| 20599 |
}); |
| 20600 |
|
| 20601 |
|
| 20602 |
/***/ }), |
| 20603 |
|
| 20604 |
/***/ "5ca1": |
| 20605 |
/***/ (function(module, exports, __nested_webpack_require_23642__) { |
| 20606 |
|
| 20607 |
var global = __nested_webpack_require_23642__("7726"); |
| 20608 |
var core = __nested_webpack_require_23642__("8378"); |
| 20609 |
var hide = __nested_webpack_require_23642__("32e9"); |
| 20610 |
var redefine = __nested_webpack_require_23642__("2aba"); |
| 20611 |
var ctx = __nested_webpack_require_23642__("9b43"); |
| 20612 |
var PROTOTYPE = 'prototype'; |
| 20613 |
|
| 20614 |
var $export = function (type, name, source) { |
| 20615 |
var IS_FORCED = type & $export.F; |
| 20616 |
var IS_GLOBAL = type & $export.G; |
| 20617 |
var IS_STATIC = type & $export.S; |
| 20618 |
var IS_PROTO = type & $export.P; |
| 20619 |
var IS_BIND = type & $export.B; |
| 20620 |
var target = IS_GLOBAL ? global : IS_STATIC ? global[name] || (global[name] = {}) : (global[name] || {})[PROTOTYPE]; |
| 20621 |
var exports = IS_GLOBAL ? core : core[name] || (core[name] = {}); |
| 20622 |
var expProto = exports[PROTOTYPE] || (exports[PROTOTYPE] = {}); |
| 20623 |
var key, own, out, exp; |
| 20624 |
if (IS_GLOBAL) source = name; |
| 20625 |
for (key in source) { |
| 20626 |
// contains in native |
| 20627 |
own = !IS_FORCED && target && target[key] !== undefined; |
| 20628 |
// export native or passed |
| 20629 |
out = (own ? target : source)[key]; |
| 20630 |
// bind timers to global for call from export context |
| 20631 |
exp = IS_BIND && own ? ctx(out, global) : IS_PROTO && typeof out == 'function' ? ctx(Function.call, out) : out; |
| 20632 |
// extend global |
| 20633 |
if (target) redefine(target, key, out, type & $export.U); |
| 20634 |
// export |
| 20635 |
if (exports[key] != out) hide(exports, key, exp); |
| 20636 |
if (IS_PROTO && expProto[key] != out) expProto[key] = out; |
| 20637 |
} |
| 20638 |
}; |
| 20639 |
global.core = core; |
| 20640 |
// type bitmap |
| 20641 |
$export.F = 1; // forced |
| 20642 |
$export.G = 2; // global |
| 20643 |
$export.S = 4; // static |
| 20644 |
$export.P = 8; // proto |
| 20645 |
$export.B = 16; // bind |
| 20646 |
$export.W = 32; // wrap |
| 20647 |
$export.U = 64; // safe |
| 20648 |
$export.R = 128; // real proto method for `library` |
| 20649 |
module.exports = $export; |
| 20650 |
|
| 20651 |
|
| 20652 |
/***/ }), |
| 20653 |
|
| 20654 |
/***/ "5eda": |
| 20655 |
/***/ (function(module, exports, __nested_webpack_require_25367__) { |
| 20656 |
|
| 20657 |
// most Object methods by ES6 should accept primitives |
| 20658 |
var $export = __nested_webpack_require_25367__("5ca1"); |
| 20659 |
var core = __nested_webpack_require_25367__("8378"); |
| 20660 |
var fails = __nested_webpack_require_25367__("79e5"); |
| 20661 |
module.exports = function (KEY, exec) { |
| 20662 |
var fn = (core.Object || {})[KEY] || Object[KEY]; |
| 20663 |
var exp = {}; |
| 20664 |
exp[KEY] = exec(fn); |
| 20665 |
$export($export.S + $export.F * fails(function () { fn(1); }), 'Object', exp); |
| 20666 |
}; |
| 20667 |
|
| 20668 |
|
| 20669 |
/***/ }), |
| 20670 |
|
| 20671 |
/***/ "5f1b": |
| 20672 |
/***/ (function(module, exports, __nested_webpack_require_25845__) { |
| 20673 |
|
| 20674 |
"use strict"; |
| 20675 |
|
| 20676 |
|
| 20677 |
var classof = __nested_webpack_require_25845__("23c6"); |
| 20678 |
var builtinExec = RegExp.prototype.exec; |
| 20679 |
|
| 20680 |
// `RegExpExec` abstract operation |
| 20681 |
// https://tc39.github.io/ecma262/#sec-regexpexec |
| 20682 |
module.exports = function (R, S) { |
| 20683 |
var exec = R.exec; |
| 20684 |
if (typeof exec === 'function') { |
| 20685 |
var result = exec.call(R, S); |
| 20686 |
if (typeof result !== 'object') { |
| 20687 |
throw new TypeError('RegExp exec method returned something other than an Object or null'); |
| 20688 |
} |
| 20689 |
return result; |
| 20690 |
} |
| 20691 |
if (classof(R) !== 'RegExp') { |
| 20692 |
throw new TypeError('RegExp#exec called on incompatible receiver'); |
| 20693 |
} |
| 20694 |
return builtinExec.call(R, S); |
| 20695 |
}; |
| 20696 |
|
| 20697 |
|
| 20698 |
/***/ }), |
| 20699 |
|
| 20700 |
/***/ "613b": |
| 20701 |
/***/ (function(module, exports, __nested_webpack_require_26551__) { |
| 20702 |
|
| 20703 |
var shared = __nested_webpack_require_26551__("5537")('keys'); |
| 20704 |
var uid = __nested_webpack_require_26551__("ca5a"); |
| 20705 |
module.exports = function (key) { |
| 20706 |
return shared[key] || (shared[key] = uid(key)); |
| 20707 |
}; |
| 20708 |
|
| 20709 |
|
| 20710 |
/***/ }), |
| 20711 |
|
| 20712 |
/***/ "626a": |
| 20713 |
/***/ (function(module, exports, __nested_webpack_require_26811__) { |
| 20714 |
|
| 20715 |
// fallback for non-array-like ES3 and non-enumerable old V8 strings |
| 20716 |
var cof = __nested_webpack_require_26811__("2d95"); |
| 20717 |
// eslint-disable-next-line no-prototype-builtins |
| 20718 |
module.exports = Object('z').propertyIsEnumerable(0) ? Object : function (it) { |
| 20719 |
return cof(it) == 'String' ? it.split('') : Object(it); |
| 20720 |
}; |
| 20721 |
|
| 20722 |
|
| 20723 |
/***/ }), |
| 20724 |
|
| 20725 |
/***/ "6762": |
| 20726 |
/***/ (function(module, exports, __nested_webpack_require_27194__) { |
| 20727 |
|
| 20728 |
"use strict"; |
| 20729 |
|
| 20730 |
// https://github.com/tc39/Array.prototype.includes |
| 20731 |
var $export = __nested_webpack_require_27194__("5ca1"); |
| 20732 |
var $includes = __nested_webpack_require_27194__("c366")(true); |
| 20733 |
|
| 20734 |
$export($export.P, 'Array', { |
| 20735 |
includes: function includes(el /* , fromIndex = 0 */) { |
| 20736 |
return $includes(this, el, arguments.length > 1 ? arguments[1] : undefined); |
| 20737 |
} |
| 20738 |
}); |
| 20739 |
|
| 20740 |
__nested_webpack_require_27194__("9c6c")('includes'); |
| 20741 |
|
| 20742 |
|
| 20743 |
/***/ }), |
| 20744 |
|
| 20745 |
/***/ "6821": |
| 20746 |
/***/ (function(module, exports, __nested_webpack_require_27659__) { |
| 20747 |
|
| 20748 |
// to indexed object, toObject with fallback for non-array-like ES3 strings |
| 20749 |
var IObject = __nested_webpack_require_27659__("626a"); |
| 20750 |
var defined = __nested_webpack_require_27659__("be13"); |
| 20751 |
module.exports = function (it) { |
| 20752 |
return IObject(defined(it)); |
| 20753 |
}; |
| 20754 |
|
| 20755 |
|
| 20756 |
/***/ }), |
| 20757 |
|
| 20758 |
/***/ "69a8": |
| 20759 |
/***/ (function(module, exports) { |
| 20760 |
|
| 20761 |
var hasOwnProperty = {}.hasOwnProperty; |
| 20762 |
module.exports = function (it, key) { |
| 20763 |
return hasOwnProperty.call(it, key); |
| 20764 |
}; |
| 20765 |
|
| 20766 |
|
| 20767 |
/***/ }), |
| 20768 |
|
| 20769 |
/***/ "6a99": |
| 20770 |
/***/ (function(module, exports, __nested_webpack_require_28155__) { |
| 20771 |
|
| 20772 |
// 7.1.1 ToPrimitive(input [, PreferredType]) |
| 20773 |
var isObject = __nested_webpack_require_28155__("d3f4"); |
| 20774 |
// instead of the ES6 spec version, we didn't implement @@toPrimitive case |
| 20775 |
// and the second argument - flag - preferred type is a string |
| 20776 |
module.exports = function (it, S) { |
| 20777 |
if (!isObject(it)) return it; |
| 20778 |
var fn, val; |
| 20779 |
if (S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it))) return val; |
| 20780 |
if (typeof (fn = it.valueOf) == 'function' && !isObject(val = fn.call(it))) return val; |
| 20781 |
if (!S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it))) return val; |
| 20782 |
throw TypeError("Can't convert object to primitive value"); |
| 20783 |
}; |
| 20784 |
|
| 20785 |
|
| 20786 |
/***/ }), |
| 20787 |
|
| 20788 |
/***/ "7333": |
| 20789 |
/***/ (function(module, exports, __nested_webpack_require_28898__) { |
| 20790 |
|
| 20791 |
"use strict"; |
| 20792 |
|
| 20793 |
// 19.1.2.1 Object.assign(target, source, ...) |
| 20794 |
var getKeys = __nested_webpack_require_28898__("0d58"); |
| 20795 |
var gOPS = __nested_webpack_require_28898__("2621"); |
| 20796 |
var pIE = __nested_webpack_require_28898__("52a7"); |
| 20797 |
var toObject = __nested_webpack_require_28898__("4bf8"); |
| 20798 |
var IObject = __nested_webpack_require_28898__("626a"); |
| 20799 |
var $assign = Object.assign; |
| 20800 |
|
| 20801 |
// should work with symbols and should have deterministic property order (V8 bug) |
| 20802 |
module.exports = !$assign || __nested_webpack_require_28898__("79e5")(function () { |
| 20803 |
var A = {}; |
| 20804 |
var B = {}; |
| 20805 |
// eslint-disable-next-line no-undef |
| 20806 |
var S = Symbol(); |
| 20807 |
var K = 'abcdefghijklmnopqrst'; |
| 20808 |
A[S] = 7; |
| 20809 |
K.split('').forEach(function (k) { B[k] = k; }); |
| 20810 |
return $assign({}, A)[S] != 7 || Object.keys($assign({}, B)).join('') != K; |
| 20811 |
}) ? function assign(target, source) { // eslint-disable-line no-unused-vars |
| 20812 |
var T = toObject(target); |
| 20813 |
var aLen = arguments.length; |
| 20814 |
var index = 1; |
| 20815 |
var getSymbols = gOPS.f; |
| 20816 |
var isEnum = pIE.f; |
| 20817 |
while (aLen > index) { |
| 20818 |
var S = IObject(arguments[index++]); |
| 20819 |
var keys = getSymbols ? getKeys(S).concat(getSymbols(S)) : getKeys(S); |
| 20820 |
var length = keys.length; |
| 20821 |
var j = 0; |
| 20822 |
var key; |
| 20823 |
while (length > j) if (isEnum.call(S, key = keys[j++])) T[key] = S[key]; |
| 20824 |
} return T; |
| 20825 |
} : $assign; |
| 20826 |
|
| 20827 |
|
| 20828 |
/***/ }), |
| 20829 |
|
| 20830 |
/***/ "7726": |
| 20831 |
/***/ (function(module, exports) { |
| 20832 |
|
| 20833 |
// https://github.com/zloirock/core-js/issues/86#issuecomment-115759028 |
| 20834 |
var global = module.exports = typeof window != 'undefined' && window.Math == Math |
| 20835 |
? window : typeof self != 'undefined' && self.Math == Math ? self |
| 20836 |
// eslint-disable-next-line no-new-func |
| 20837 |
: Function('return this')(); |
| 20838 |
if (typeof __g == 'number') __g = global; // eslint-disable-line no-undef |
| 20839 |
|
| 20840 |
|
| 20841 |
/***/ }), |
| 20842 |
|
| 20843 |
/***/ "77f1": |
| 20844 |
/***/ (function(module, exports, __nested_webpack_require_30635__) { |
| 20845 |
|
| 20846 |
var toInteger = __nested_webpack_require_30635__("4588"); |
| 20847 |
var max = Math.max; |
| 20848 |
var min = Math.min; |
| 20849 |
module.exports = function (index, length) { |
| 20850 |
index = toInteger(index); |
| 20851 |
return index < 0 ? max(index + length, 0) : min(index, length); |
| 20852 |
}; |
| 20853 |
|
| 20854 |
|
| 20855 |
/***/ }), |
| 20856 |
|
| 20857 |
/***/ "79e5": |
| 20858 |
/***/ (function(module, exports) { |
| 20859 |
|
| 20860 |
module.exports = function (exec) { |
| 20861 |
try { |
| 20862 |
return !!exec(); |
| 20863 |
} catch (e) { |
| 20864 |
return true; |
| 20865 |
} |
| 20866 |
}; |
| 20867 |
|
| 20868 |
|
| 20869 |
/***/ }), |
| 20870 |
|
| 20871 |
/***/ "7f20": |
| 20872 |
/***/ (function(module, exports, __nested_webpack_require_31112__) { |
| 20873 |
|
| 20874 |
var def = __nested_webpack_require_31112__("86cc").f; |
| 20875 |
var has = __nested_webpack_require_31112__("69a8"); |
| 20876 |
var TAG = __nested_webpack_require_31112__("2b4c")('toStringTag'); |
| 20877 |
|
| 20878 |
module.exports = function (it, tag, stat) { |
| 20879 |
if (it && !has(it = stat ? it : it.prototype, TAG)) def(it, TAG, { configurable: true, value: tag }); |
| 20880 |
}; |
| 20881 |
|
| 20882 |
|
| 20883 |
/***/ }), |
| 20884 |
|
| 20885 |
/***/ "8378": |
| 20886 |
/***/ (function(module, exports) { |
| 20887 |
|
| 20888 |
var core = module.exports = { version: '2.6.5' }; |
| 20889 |
if (typeof __e == 'number') __e = core; // eslint-disable-line no-undef |
| 20890 |
|
| 20891 |
|
| 20892 |
/***/ }), |
| 20893 |
|
| 20894 |
/***/ "84f2": |
| 20895 |
/***/ (function(module, exports) { |
| 20896 |
|
| 20897 |
module.exports = {}; |
| 20898 |
|
| 20899 |
|
| 20900 |
/***/ }), |
| 20901 |
|
| 20902 |
/***/ "86cc": |
| 20903 |
/***/ (function(module, exports, __nested_webpack_require_31751__) { |
| 20904 |
|
| 20905 |
var anObject = __nested_webpack_require_31751__("cb7c"); |
| 20906 |
var IE8_DOM_DEFINE = __nested_webpack_require_31751__("c69a"); |
| 20907 |
var toPrimitive = __nested_webpack_require_31751__("6a99"); |
| 20908 |
var dP = Object.defineProperty; |
| 20909 |
|
| 20910 |
exports.f = __nested_webpack_require_31751__("9e1e") ? Object.defineProperty : function defineProperty(O, P, Attributes) { |
| 20911 |
anObject(O); |
| 20912 |
P = toPrimitive(P, true); |
| 20913 |
anObject(Attributes); |
| 20914 |
if (IE8_DOM_DEFINE) try { |
| 20915 |
return dP(O, P, Attributes); |
| 20916 |
} catch (e) { /* empty */ } |
| 20917 |
if ('get' in Attributes || 'set' in Attributes) throw TypeError('Accessors not supported!'); |
| 20918 |
if ('value' in Attributes) O[P] = Attributes.value; |
| 20919 |
return O; |
| 20920 |
}; |
| 20921 |
|
| 20922 |
|
| 20923 |
/***/ }), |
| 20924 |
|
| 20925 |
/***/ "9b43": |
| 20926 |
/***/ (function(module, exports, __nested_webpack_require_32441__) { |
| 20927 |
|
| 20928 |
// optional / simple context binding |
| 20929 |
var aFunction = __nested_webpack_require_32441__("d8e8"); |
| 20930 |
module.exports = function (fn, that, length) { |
| 20931 |
aFunction(fn); |
| 20932 |
if (that === undefined) return fn; |
| 20933 |
switch (length) { |
| 20934 |
case 1: return function (a) { |
| 20935 |
return fn.call(that, a); |
| 20936 |
}; |
| 20937 |
case 2: return function (a, b) { |
| 20938 |
return fn.call(that, a, b); |
| 20939 |
}; |
| 20940 |
case 3: return function (a, b, c) { |
| 20941 |
return fn.call(that, a, b, c); |
| 20942 |
}; |
| 20943 |
} |
| 20944 |
return function (/* ...args */) { |
| 20945 |
return fn.apply(that, arguments); |
| 20946 |
}; |
| 20947 |
}; |
| 20948 |
|
| 20949 |
|
| 20950 |
/***/ }), |
| 20951 |
|
| 20952 |
/***/ "9c6c": |
| 20953 |
/***/ (function(module, exports, __nested_webpack_require_33048__) { |
| 20954 |
|
| 20955 |
// 22.1.3.31 Array.prototype[@@unscopables] |
| 20956 |
var UNSCOPABLES = __nested_webpack_require_33048__("2b4c")('unscopables'); |
| 20957 |
var ArrayProto = Array.prototype; |
| 20958 |
if (ArrayProto[UNSCOPABLES] == undefined) __nested_webpack_require_33048__("32e9")(ArrayProto, UNSCOPABLES, {}); |
| 20959 |
module.exports = function (key) { |
| 20960 |
ArrayProto[UNSCOPABLES][key] = true; |
| 20961 |
}; |
| 20962 |
|
| 20963 |
|
| 20964 |
/***/ }), |
| 20965 |
|
| 20966 |
/***/ "9def": |
| 20967 |
/***/ (function(module, exports, __nested_webpack_require_33448__) { |
| 20968 |
|
| 20969 |
// 7.1.15 ToLength |
| 20970 |
var toInteger = __nested_webpack_require_33448__("4588"); |
| 20971 |
var min = Math.min; |
| 20972 |
module.exports = function (it) { |
| 20973 |
return it > 0 ? min(toInteger(it), 0x1fffffffffffff) : 0; // pow(2, 53) - 1 == 9007199254740991 |
| 20974 |
}; |
| 20975 |
|
| 20976 |
|
| 20977 |
/***/ }), |
| 20978 |
|
| 20979 |
/***/ "9e1e": |
| 20980 |
/***/ (function(module, exports, __nested_webpack_require_33750__) { |
| 20981 |
|
| 20982 |
// Thank's IE8 for his funny defineProperty |
| 20983 |
module.exports = !__nested_webpack_require_33750__("79e5")(function () { |
| 20984 |
return Object.defineProperty({}, 'a', { get: function () { return 7; } }).a != 7; |
| 20985 |
}); |
| 20986 |
|
| 20987 |
|
| 20988 |
/***/ }), |
| 20989 |
|
| 20990 |
/***/ "a352": |
| 20991 |
/***/ (function(module, exports) { |
| 20992 |
|
| 20993 |
module.exports = __WEBPACK_EXTERNAL_MODULE_a352__; |
| 20994 |
|
| 20995 |
/***/ }), |
| 20996 |
|
| 20997 |
/***/ "a481": |
| 20998 |
/***/ (function(module, exports, __nested_webpack_require_34139__) { |
| 20999 |
|
| 21000 |
"use strict"; |
| 21001 |
|
| 21002 |
|
| 21003 |
var anObject = __nested_webpack_require_34139__("cb7c"); |
| 21004 |
var toObject = __nested_webpack_require_34139__("4bf8"); |
| 21005 |
var toLength = __nested_webpack_require_34139__("9def"); |
| 21006 |
var toInteger = __nested_webpack_require_34139__("4588"); |
| 21007 |
var advanceStringIndex = __nested_webpack_require_34139__("0390"); |
| 21008 |
var regExpExec = __nested_webpack_require_34139__("5f1b"); |
| 21009 |
var max = Math.max; |
| 21010 |
var min = Math.min; |
| 21011 |
var floor = Math.floor; |
| 21012 |
var SUBSTITUTION_SYMBOLS = /\$([$&`']|\d\d?|<[^>]*>)/g; |
| 21013 |
var SUBSTITUTION_SYMBOLS_NO_NAMED = /\$([$&`']|\d\d?)/g; |
| 21014 |
|
| 21015 |
var maybeToString = function (it) { |
| 21016 |
return it === undefined ? it : String(it); |
| 21017 |
}; |
| 21018 |
|
| 21019 |
// @@replace logic |
| 21020 |
__nested_webpack_require_34139__("214f")('replace', 2, function (defined, REPLACE, $replace, maybeCallNative) { |
| 21021 |
return [ |
| 21022 |
// `String.prototype.replace` method |
| 21023 |
// https://tc39.github.io/ecma262/#sec-string.prototype.replace |
| 21024 |
function replace(searchValue, replaceValue) { |
| 21025 |
var O = defined(this); |
| 21026 |
var fn = searchValue == undefined ? undefined : searchValue[REPLACE]; |
| 21027 |
return fn !== undefined |
| 21028 |
? fn.call(searchValue, O, replaceValue) |
| 21029 |
: $replace.call(String(O), searchValue, replaceValue); |
| 21030 |
}, |
| 21031 |
// `RegExp.prototype[@@replace]` method |
| 21032 |
// https://tc39.github.io/ecma262/#sec-regexp.prototype-@@replace |
| 21033 |
function (regexp, replaceValue) { |
| 21034 |
var res = maybeCallNative($replace, regexp, this, replaceValue); |
| 21035 |
if (res.done) return res.value; |
| 21036 |
|
| 21037 |
var rx = anObject(regexp); |
| 21038 |
var S = String(this); |
| 21039 |
var functionalReplace = typeof replaceValue === 'function'; |
| 21040 |
if (!functionalReplace) replaceValue = String(replaceValue); |
| 21041 |
var global = rx.global; |
| 21042 |
if (global) { |
| 21043 |
var fullUnicode = rx.unicode; |
| 21044 |
rx.lastIndex = 0; |
| 21045 |
} |
| 21046 |
var results = []; |
| 21047 |
while (true) { |
| 21048 |
var result = regExpExec(rx, S); |
| 21049 |
if (result === null) break; |
| 21050 |
results.push(result); |
| 21051 |
if (!global) break; |
| 21052 |
var matchStr = String(result[0]); |
| 21053 |
if (matchStr === '') rx.lastIndex = advanceStringIndex(S, toLength(rx.lastIndex), fullUnicode); |
| 21054 |
} |
| 21055 |
var accumulatedResult = ''; |
| 21056 |
var nextSourcePosition = 0; |
| 21057 |
for (var i = 0; i < results.length; i++) { |
| 21058 |
result = results[i]; |
| 21059 |
var matched = String(result[0]); |
| 21060 |
var position = max(min(toInteger(result.index), S.length), 0); |
| 21061 |
var captures = []; |
| 21062 |
// NOTE: This is equivalent to |
| 21063 |
// captures = result.slice(1).map(maybeToString) |
| 21064 |
// but for some reason `nativeSlice.call(result, 1, result.length)` (called in |
| 21065 |
// the slice polyfill when slicing native arrays) "doesn't work" in safari 9 and |
| 21066 |
// causes a crash (https://pastebin.com/N21QzeQA) when trying to debug it. |
| 21067 |
for (var j = 1; j < result.length; j++) captures.push(maybeToString(result[j])); |
| 21068 |
var namedCaptures = result.groups; |
| 21069 |
if (functionalReplace) { |
| 21070 |
var replacerArgs = [matched].concat(captures, position, S); |
| 21071 |
if (namedCaptures !== undefined) replacerArgs.push(namedCaptures); |
| 21072 |
var replacement = String(replaceValue.apply(undefined, replacerArgs)); |
| 21073 |
} else { |
| 21074 |
replacement = getSubstitution(matched, S, position, captures, namedCaptures, replaceValue); |
| 21075 |
} |
| 21076 |
if (position >= nextSourcePosition) { |
| 21077 |
accumulatedResult += S.slice(nextSourcePosition, position) + replacement; |
| 21078 |
nextSourcePosition = position + matched.length; |
| 21079 |
} |
| 21080 |
} |
| 21081 |
return accumulatedResult + S.slice(nextSourcePosition); |
| 21082 |
} |
| 21083 |
]; |
| 21084 |
|
| 21085 |
// https://tc39.github.io/ecma262/#sec-getsubstitution |
| 21086 |
function getSubstitution(matched, str, position, captures, namedCaptures, replacement) { |
| 21087 |
var tailPos = position + matched.length; |
| 21088 |
var m = captures.length; |
| 21089 |
var symbols = SUBSTITUTION_SYMBOLS_NO_NAMED; |
| 21090 |
if (namedCaptures !== undefined) { |
| 21091 |
namedCaptures = toObject(namedCaptures); |
| 21092 |
symbols = SUBSTITUTION_SYMBOLS; |
| 21093 |
} |
| 21094 |
return $replace.call(replacement, symbols, function (match, ch) { |
| 21095 |
var capture; |
| 21096 |
switch (ch.charAt(0)) { |
| 21097 |
case '$': return '$'; |
| 21098 |
case '&': return matched; |
| 21099 |
case '`': return str.slice(0, position); |
| 21100 |
case "'": return str.slice(tailPos); |
| 21101 |
case '<': |
| 21102 |
capture = namedCaptures[ch.slice(1, -1)]; |
| 21103 |
break; |
| 21104 |
default: // \d\d? |
| 21105 |
var n = +ch; |
| 21106 |
if (n === 0) return match; |
| 21107 |
if (n > m) { |
| 21108 |
var f = floor(n / 10); |
| 21109 |
if (f === 0) return match; |
| 21110 |
if (f <= m) return captures[f - 1] === undefined ? ch.charAt(1) : captures[f - 1] + ch.charAt(1); |
| 21111 |
return match; |
| 21112 |
} |
| 21113 |
capture = captures[n - 1]; |
| 21114 |
} |
| 21115 |
return capture === undefined ? '' : capture; |
| 21116 |
}); |
| 21117 |
} |
| 21118 |
}); |
| 21119 |
|
| 21120 |
|
| 21121 |
/***/ }), |
| 21122 |
|
| 21123 |
/***/ "aae3": |
| 21124 |
/***/ (function(module, exports, __nested_webpack_require_38885__) { |
| 21125 |
|
| 21126 |
// 7.2.8 IsRegExp(argument) |
| 21127 |
var isObject = __nested_webpack_require_38885__("d3f4"); |
| 21128 |
var cof = __nested_webpack_require_38885__("2d95"); |
| 21129 |
var MATCH = __nested_webpack_require_38885__("2b4c")('match'); |
| 21130 |
module.exports = function (it) { |
| 21131 |
var isRegExp; |
| 21132 |
return isObject(it) && ((isRegExp = it[MATCH]) !== undefined ? !!isRegExp : cof(it) == 'RegExp'); |
| 21133 |
}; |
| 21134 |
|
| 21135 |
|
| 21136 |
/***/ }), |
| 21137 |
|
| 21138 |
/***/ "ac6a": |
| 21139 |
/***/ (function(module, exports, __nested_webpack_require_39282__) { |
| 21140 |
|
| 21141 |
var $iterators = __nested_webpack_require_39282__("cadf"); |
| 21142 |
var getKeys = __nested_webpack_require_39282__("0d58"); |
| 21143 |
var redefine = __nested_webpack_require_39282__("2aba"); |
| 21144 |
var global = __nested_webpack_require_39282__("7726"); |
| 21145 |
var hide = __nested_webpack_require_39282__("32e9"); |
| 21146 |
var Iterators = __nested_webpack_require_39282__("84f2"); |
| 21147 |
var wks = __nested_webpack_require_39282__("2b4c"); |
| 21148 |
var ITERATOR = wks('iterator'); |
| 21149 |
var TO_STRING_TAG = wks('toStringTag'); |
| 21150 |
var ArrayValues = Iterators.Array; |
| 21151 |
|
| 21152 |
var DOMIterables = { |
| 21153 |
CSSRuleList: true, // TODO: Not spec compliant, should be false. |
| 21154 |
CSSStyleDeclaration: false, |
| 21155 |
CSSValueList: false, |
| 21156 |
ClientRectList: false, |
| 21157 |
DOMRectList: false, |
| 21158 |
DOMStringList: false, |
| 21159 |
DOMTokenList: true, |
| 21160 |
DataTransferItemList: false, |
| 21161 |
FileList: false, |
| 21162 |
HTMLAllCollection: false, |
| 21163 |
HTMLCollection: false, |
| 21164 |
HTMLFormElement: false, |
| 21165 |
HTMLSelectElement: false, |
| 21166 |
MediaList: true, // TODO: Not spec compliant, should be false. |
| 21167 |
MimeTypeArray: false, |
| 21168 |
NamedNodeMap: false, |
| 21169 |
NodeList: true, |
| 21170 |
PaintRequestList: false, |
| 21171 |
Plugin: false, |
| 21172 |
PluginArray: false, |
| 21173 |
SVGLengthList: false, |
| 21174 |
SVGNumberList: false, |
| 21175 |
SVGPathSegList: false, |
| 21176 |
SVGPointList: false, |
| 21177 |
SVGStringList: false, |
| 21178 |
SVGTransformList: false, |
| 21179 |
SourceBufferList: false, |
| 21180 |
StyleSheetList: true, // TODO: Not spec compliant, should be false. |
| 21181 |
TextTrackCueList: false, |
| 21182 |
TextTrackList: false, |
| 21183 |
TouchList: false |
| 21184 |
}; |
| 21185 |
|
| 21186 |
for (var collections = getKeys(DOMIterables), i = 0; i < collections.length; i++) { |
| 21187 |
var NAME = collections[i]; |
| 21188 |
var explicit = DOMIterables[NAME]; |
| 21189 |
var Collection = global[NAME]; |
| 21190 |
var proto = Collection && Collection.prototype; |
| 21191 |
var key; |
| 21192 |
if (proto) { |
| 21193 |
if (!proto[ITERATOR]) hide(proto, ITERATOR, ArrayValues); |
| 21194 |
if (!proto[TO_STRING_TAG]) hide(proto, TO_STRING_TAG, NAME); |
| 21195 |
Iterators[NAME] = ArrayValues; |
| 21196 |
if (explicit) for (key in $iterators) if (!proto[key]) redefine(proto, key, $iterators[key], true); |
| 21197 |
} |
| 21198 |
} |
| 21199 |
|
| 21200 |
|
| 21201 |
/***/ }), |
| 21202 |
|
| 21203 |
/***/ "b0c5": |
| 21204 |
/***/ (function(module, exports, __nested_webpack_require_41209__) { |
| 21205 |
|
| 21206 |
"use strict"; |
| 21207 |
|
| 21208 |
var regexpExec = __nested_webpack_require_41209__("520a"); |
| 21209 |
__nested_webpack_require_41209__("5ca1")({ |
| 21210 |
target: 'RegExp', |
| 21211 |
proto: true, |
| 21212 |
forced: regexpExec !== /./.exec |
| 21213 |
}, { |
| 21214 |
exec: regexpExec |
| 21215 |
}); |
| 21216 |
|
| 21217 |
|
| 21218 |
/***/ }), |
| 21219 |
|
| 21220 |
/***/ "be13": |
| 21221 |
/***/ (function(module, exports) { |
| 21222 |
|
| 21223 |
// 7.2.1 RequireObjectCoercible(argument) |
| 21224 |
module.exports = function (it) { |
| 21225 |
if (it == undefined) throw TypeError("Can't call method on " + it); |
| 21226 |
return it; |
| 21227 |
}; |
| 21228 |
|
| 21229 |
|
| 21230 |
/***/ }), |
| 21231 |
|
| 21232 |
/***/ "c366": |
| 21233 |
/***/ (function(module, exports, __nested_webpack_require_41706__) { |
| 21234 |
|
| 21235 |
// false -> Array#indexOf |
| 21236 |
// true -> Array#includes |
| 21237 |
var toIObject = __nested_webpack_require_41706__("6821"); |
| 21238 |
var toLength = __nested_webpack_require_41706__("9def"); |
| 21239 |
var toAbsoluteIndex = __nested_webpack_require_41706__("77f1"); |
| 21240 |
module.exports = function (IS_INCLUDES) { |
| 21241 |
return function ($this, el, fromIndex) { |
| 21242 |
var O = toIObject($this); |
| 21243 |
var length = toLength(O.length); |
| 21244 |
var index = toAbsoluteIndex(fromIndex, length); |
| 21245 |
var value; |
| 21246 |
// Array#includes uses SameValueZero equality algorithm |
| 21247 |
// eslint-disable-next-line no-self-compare |
| 21248 |
if (IS_INCLUDES && el != el) while (length > index) { |
| 21249 |
value = O[index++]; |
| 21250 |
// eslint-disable-next-line no-self-compare |
| 21251 |
if (value != value) return true; |
| 21252 |
// Array#indexOf ignores holes, Array#includes - not |
| 21253 |
} else for (;length > index; index++) if (IS_INCLUDES || index in O) { |
| 21254 |
if (O[index] === el) return IS_INCLUDES || index || 0; |
| 21255 |
} return !IS_INCLUDES && -1; |
| 21256 |
}; |
| 21257 |
}; |
| 21258 |
|
| 21259 |
|
| 21260 |
/***/ }), |
| 21261 |
|
| 21262 |
/***/ "c649": |
| 21263 |
/***/ (function(module, __webpack_exports__, __nested_webpack_require_42729__) { |
| 21264 |
|
| 21265 |
"use strict"; |
| 21266 |
/* WEBPACK VAR INJECTION */(function(global) {/* harmony export (binding) */ __nested_webpack_require_42729__.d(__webpack_exports__, "c", function() { return insertNodeAt; }); |
| 21267 |
/* harmony export (binding) */ __nested_webpack_require_42729__.d(__webpack_exports__, "a", function() { return camelize; }); |
| 21268 |
/* harmony export (binding) */ __nested_webpack_require_42729__.d(__webpack_exports__, "b", function() { return console; }); |
| 21269 |
/* harmony export (binding) */ __nested_webpack_require_42729__.d(__webpack_exports__, "d", function() { return removeNode; }); |
| 21270 |
/* harmony import */ var core_js_modules_es6_regexp_replace__WEBPACK_IMPORTED_MODULE_0__ = __nested_webpack_require_42729__("a481"); |
| 21271 |
/* harmony import */ var core_js_modules_es6_regexp_replace__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__nested_webpack_require_42729__.n(core_js_modules_es6_regexp_replace__WEBPACK_IMPORTED_MODULE_0__); |
| 21272 |
|
| 21273 |
|
| 21274 |
function getConsole() { |
| 21275 |
if (typeof window !== "undefined") { |
| 21276 |
return window.console; |
| 21277 |
} |
| 21278 |
|
| 21279 |
return global.console; |
| 21280 |
} |
| 21281 |
|
| 21282 |
var console = getConsole(); |
| 21283 |
|
| 21284 |
function cached(fn) { |
| 21285 |
var cache = Object.create(null); |
| 21286 |
return function cachedFn(str) { |
| 21287 |
var hit = cache[str]; |
| 21288 |
return hit || (cache[str] = fn(str)); |
| 21289 |
}; |
| 21290 |
} |
| 21291 |
|
| 21292 |
var regex = /-(\w)/g; |
| 21293 |
var camelize = cached(function (str) { |
| 21294 |
return str.replace(regex, function (_, c) { |
| 21295 |
return c ? c.toUpperCase() : ""; |
| 21296 |
}); |
| 21297 |
}); |
| 21298 |
|
| 21299 |
function removeNode(node) { |
| 21300 |
if (node.parentElement !== null) { |
| 21301 |
node.parentElement.removeChild(node); |
| 21302 |
} |
| 21303 |
} |
| 21304 |
|
| 21305 |
function insertNodeAt(fatherNode, node, position) { |
| 21306 |
var refNode = position === 0 ? fatherNode.children[0] : fatherNode.children[position - 1].nextSibling; |
| 21307 |
fatherNode.insertBefore(node, refNode); |
| 21308 |
} |
| 21309 |
|
| 21310 |
|
| 21311 |
/* WEBPACK VAR INJECTION */}.call(this, __nested_webpack_require_42729__("c8ba"))) |
| 21312 |
|
| 21313 |
/***/ }), |
| 21314 |
|
| 21315 |
/***/ "c69a": |
| 21316 |
/***/ (function(module, exports, __nested_webpack_require_44512__) { |
| 21317 |
|
| 21318 |
module.exports = !__nested_webpack_require_44512__("9e1e") && !__nested_webpack_require_44512__("79e5")(function () { |
| 21319 |
return Object.defineProperty(__nested_webpack_require_44512__("230e")('div'), 'a', { get: function () { return 7; } }).a != 7; |
| 21320 |
}); |
| 21321 |
|
| 21322 |
|
| 21323 |
/***/ }), |
| 21324 |
|
| 21325 |
/***/ "c8ba": |
| 21326 |
/***/ (function(module, exports) { |
| 21327 |
|
| 21328 |
var g; |
| 21329 |
|
| 21330 |
// This works in non-strict mode |
| 21331 |
g = (function() { |
| 21332 |
return this; |
| 21333 |
})(); |
| 21334 |
|
| 21335 |
try { |
| 21336 |
// This works if eval is allowed (see CSP) |
| 21337 |
g = g || new Function("return this")(); |
| 21338 |
} catch (e) { |
| 21339 |
// This works if the window reference is available |
| 21340 |
if (typeof window === "object") g = window; |
| 21341 |
} |
| 21342 |
|
| 21343 |
// g can still be undefined, but nothing to do about it... |
| 21344 |
// We return undefined, instead of nothing here, so it's |
| 21345 |
// easier to handle this case. if(!global) { ...} |
| 21346 |
|
| 21347 |
module.exports = g; |
| 21348 |
|
| 21349 |
|
| 21350 |
/***/ }), |
| 21351 |
|
| 21352 |
/***/ "ca5a": |
| 21353 |
/***/ (function(module, exports) { |
| 21354 |
|
| 21355 |
var id = 0; |
| 21356 |
var px = Math.random(); |
| 21357 |
module.exports = function (key) { |
| 21358 |
return 'Symbol('.concat(key === undefined ? '' : key, ')_', (++id + px).toString(36)); |
| 21359 |
}; |
| 21360 |
|
| 21361 |
|
| 21362 |
/***/ }), |
| 21363 |
|
| 21364 |
/***/ "cadf": |
| 21365 |
/***/ (function(module, exports, __nested_webpack_require_45568__) { |
| 21366 |
|
| 21367 |
"use strict"; |
| 21368 |
|
| 21369 |
var addToUnscopables = __nested_webpack_require_45568__("9c6c"); |
| 21370 |
var step = __nested_webpack_require_45568__("d53b"); |
| 21371 |
var Iterators = __nested_webpack_require_45568__("84f2"); |
| 21372 |
var toIObject = __nested_webpack_require_45568__("6821"); |
| 21373 |
|
| 21374 |
// 22.1.3.4 Array.prototype.entries() |
| 21375 |
// 22.1.3.13 Array.prototype.keys() |
| 21376 |
// 22.1.3.29 Array.prototype.values() |
| 21377 |
// 22.1.3.30 Array.prototype[@@iterator]() |
| 21378 |
module.exports = __nested_webpack_require_45568__("01f9")(Array, 'Array', function (iterated, kind) { |
| 21379 |
this._t = toIObject(iterated); // target |
| 21380 |
this._i = 0; // next index |
| 21381 |
this._k = kind; // kind |
| 21382 |
// 22.1.5.2.1 %ArrayIteratorPrototype%.next() |
| 21383 |
}, function () { |
| 21384 |
var O = this._t; |
| 21385 |
var kind = this._k; |
| 21386 |
var index = this._i++; |
| 21387 |
if (!O || index >= O.length) { |
| 21388 |
this._t = undefined; |
| 21389 |
return step(1); |
| 21390 |
} |
| 21391 |
if (kind == 'keys') return step(0, index); |
| 21392 |
if (kind == 'values') return step(0, O[index]); |
| 21393 |
return step(0, [index, O[index]]); |
| 21394 |
}, 'values'); |
| 21395 |
|
| 21396 |
// argumentsList[@@iterator] is %ArrayProto_values% (9.4.4.6, 9.4.4.7) |
| 21397 |
Iterators.Arguments = Iterators.Array; |
| 21398 |
|
| 21399 |
addToUnscopables('keys'); |
| 21400 |
addToUnscopables('values'); |
| 21401 |
addToUnscopables('entries'); |
| 21402 |
|
| 21403 |
|
| 21404 |
/***/ }), |
| 21405 |
|
| 21406 |
/***/ "cb7c": |
| 21407 |
/***/ (function(module, exports, __nested_webpack_require_46777__) { |
| 21408 |
|
| 21409 |
var isObject = __nested_webpack_require_46777__("d3f4"); |
| 21410 |
module.exports = function (it) { |
| 21411 |
if (!isObject(it)) throw TypeError(it + ' is not an object!'); |
| 21412 |
return it; |
| 21413 |
}; |
| 21414 |
|
| 21415 |
|
| 21416 |
/***/ }), |
| 21417 |
|
| 21418 |
/***/ "ce10": |
| 21419 |
/***/ (function(module, exports, __nested_webpack_require_47019__) { |
| 21420 |
|
| 21421 |
var has = __nested_webpack_require_47019__("69a8"); |
| 21422 |
var toIObject = __nested_webpack_require_47019__("6821"); |
| 21423 |
var arrayIndexOf = __nested_webpack_require_47019__("c366")(false); |
| 21424 |
var IE_PROTO = __nested_webpack_require_47019__("613b")('IE_PROTO'); |
| 21425 |
|
| 21426 |
module.exports = function (object, names) { |
| 21427 |
var O = toIObject(object); |
| 21428 |
var i = 0; |
| 21429 |
var result = []; |
| 21430 |
var key; |
| 21431 |
for (key in O) if (key != IE_PROTO) has(O, key) && result.push(key); |
| 21432 |
// Don't enum bug & hidden keys |
| 21433 |
while (names.length > i) if (has(O, key = names[i++])) { |
| 21434 |
~arrayIndexOf(result, key) || result.push(key); |
| 21435 |
} |
| 21436 |
return result; |
| 21437 |
}; |
| 21438 |
|
| 21439 |
|
| 21440 |
/***/ }), |
| 21441 |
|
| 21442 |
/***/ "d2c8": |
| 21443 |
/***/ (function(module, exports, __nested_webpack_require_47655__) { |
| 21444 |
|
| 21445 |
// helper for String#{startsWith, endsWith, includes} |
| 21446 |
var isRegExp = __nested_webpack_require_47655__("aae3"); |
| 21447 |
var defined = __nested_webpack_require_47655__("be13"); |
| 21448 |
|
| 21449 |
module.exports = function (that, searchString, NAME) { |
| 21450 |
if (isRegExp(searchString)) throw TypeError('String#' + NAME + " doesn't accept regex!"); |
| 21451 |
return String(defined(that)); |
| 21452 |
}; |
| 21453 |
|
| 21454 |
|
| 21455 |
/***/ }), |
| 21456 |
|
| 21457 |
/***/ "d3f4": |
| 21458 |
/***/ (function(module, exports) { |
| 21459 |
|
| 21460 |
module.exports = function (it) { |
| 21461 |
return typeof it === 'object' ? it !== null : typeof it === 'function'; |
| 21462 |
}; |
| 21463 |
|
| 21464 |
|
| 21465 |
/***/ }), |
| 21466 |
|
| 21467 |
/***/ "d53b": |
| 21468 |
/***/ (function(module, exports) { |
| 21469 |
|
| 21470 |
module.exports = function (done, value) { |
| 21471 |
return { value: value, done: !!done }; |
| 21472 |
}; |
| 21473 |
|
| 21474 |
|
| 21475 |
/***/ }), |
| 21476 |
|
| 21477 |
/***/ "d8e8": |
| 21478 |
/***/ (function(module, exports) { |
| 21479 |
|
| 21480 |
module.exports = function (it) { |
| 21481 |
if (typeof it != 'function') throw TypeError(it + ' is not a function!'); |
| 21482 |
return it; |
| 21483 |
}; |
| 21484 |
|
| 21485 |
|
| 21486 |
/***/ }), |
| 21487 |
|
| 21488 |
/***/ "e11e": |
| 21489 |
/***/ (function(module, exports) { |
| 21490 |
|
| 21491 |
// IE 8- don't enum bug keys |
| 21492 |
module.exports = ( |
| 21493 |
'constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf' |
| 21494 |
).split(','); |
| 21495 |
|
| 21496 |
|
| 21497 |
/***/ }), |
| 21498 |
|
| 21499 |
/***/ "f559": |
| 21500 |
/***/ (function(module, exports, __nested_webpack_require_48796__) { |
| 21501 |
|
| 21502 |
"use strict"; |
| 21503 |
// 21.1.3.18 String.prototype.startsWith(searchString [, position ]) |
| 21504 |
|
| 21505 |
var $export = __nested_webpack_require_48796__("5ca1"); |
| 21506 |
var toLength = __nested_webpack_require_48796__("9def"); |
| 21507 |
var context = __nested_webpack_require_48796__("d2c8"); |
| 21508 |
var STARTS_WITH = 'startsWith'; |
| 21509 |
var $startsWith = ''[STARTS_WITH]; |
| 21510 |
|
| 21511 |
$export($export.P + $export.F * __nested_webpack_require_48796__("5147")(STARTS_WITH), 'String', { |
| 21512 |
startsWith: function startsWith(searchString /* , position = 0 */) { |
| 21513 |
var that = context(this, searchString, STARTS_WITH); |
| 21514 |
var index = toLength(Math.min(arguments.length > 1 ? arguments[1] : undefined, that.length)); |
| 21515 |
var search = String(searchString); |
| 21516 |
return $startsWith |
| 21517 |
? $startsWith.call(that, search, index) |
| 21518 |
: that.slice(index, index + search.length) === search; |
| 21519 |
} |
| 21520 |
}); |
| 21521 |
|
| 21522 |
|
| 21523 |
/***/ }), |
| 21524 |
|
| 21525 |
/***/ "f6fd": |
| 21526 |
/***/ (function(module, exports) { |
| 21527 |
|
| 21528 |
// document.currentScript polyfill by Adam Miller |
| 21529 |
|
| 21530 |
// MIT license |
| 21531 |
|
| 21532 |
(function(document){ |
| 21533 |
var currentScript = "currentScript", |
| 21534 |
scripts = document.getElementsByTagName('script'); // Live NodeList collection |
| 21535 |
|
| 21536 |
// If browser needs currentScript polyfill, add get currentScript() to the document object |
| 21537 |
if (!(currentScript in document)) { |
| 21538 |
Object.defineProperty(document, currentScript, { |
| 21539 |
get: function(){ |
| 21540 |
|
| 21541 |
// IE 6-10 supports script readyState |
| 21542 |
// IE 10+ support stack trace |
| 21543 |
try { throw new Error(); } |
| 21544 |
catch (err) { |
| 21545 |
|
| 21546 |
// Find the second match for the "at" string to get file src url from stack. |
| 21547 |
// Specifically works with the format of stack traces in IE. |
| 21548 |
var i, res = ((/.*at [^\(]*\((.*):.+:.+\)$/ig).exec(err.stack) || [false])[1]; |
| 21549 |
|
| 21550 |
// For all scripts on the page, if src matches or if ready state is interactive, return the script tag |
| 21551 |
for(i in scripts){ |
| 21552 |
if(scripts[i].src == res || scripts[i].readyState == "interactive"){ |
| 21553 |
return scripts[i]; |
| 21554 |
} |
| 21555 |
} |
| 21556 |
|
| 21557 |
// If no match, return null |
| 21558 |
return null; |
| 21559 |
} |
| 21560 |
} |
| 21561 |
}); |
| 21562 |
} |
| 21563 |
})(document); |
| 21564 |
|
| 21565 |
|
| 21566 |
/***/ }), |
| 21567 |
|
| 21568 |
/***/ "f751": |
| 21569 |
/***/ (function(module, exports, __nested_webpack_require_50913__) { |
| 21570 |
|
| 21571 |
// 19.1.3.1 Object.assign(target, source) |
| 21572 |
var $export = __nested_webpack_require_50913__("5ca1"); |
| 21573 |
|
| 21574 |
$export($export.S + $export.F, 'Object', { assign: __nested_webpack_require_50913__("7333") }); |
| 21575 |
|
| 21576 |
|
| 21577 |
/***/ }), |
| 21578 |
|
| 21579 |
/***/ "fa5b": |
| 21580 |
/***/ (function(module, exports, __nested_webpack_require_51166__) { |
| 21581 |
|
| 21582 |
module.exports = __nested_webpack_require_51166__("5537")('native-function-to-string', Function.toString); |
| 21583 |
|
| 21584 |
|
| 21585 |
/***/ }), |
| 21586 |
|
| 21587 |
/***/ "fab2": |
| 21588 |
/***/ (function(module, exports, __nested_webpack_require_51344__) { |
| 21589 |
|
| 21590 |
var document = __nested_webpack_require_51344__("7726").document; |
| 21591 |
module.exports = document && document.documentElement; |
| 21592 |
|
| 21593 |
|
| 21594 |
/***/ }), |
| 21595 |
|
| 21596 |
/***/ "fb15": |
| 21597 |
/***/ (function(module, __webpack_exports__, __nested_webpack_require_51548__) { |
| 21598 |
|
| 21599 |
"use strict"; |
| 21600 |
// ESM COMPAT FLAG |
| 21601 |
__nested_webpack_require_51548__.r(__webpack_exports__); |
| 21602 |
|
| 21603 |
// CONCATENATED MODULE: ./node_modules/@vue/cli-service/lib/commands/build/setPublicPath.js |
| 21604 |
// This file is imported into lib/wc client bundles. |
| 21605 |
|
| 21606 |
if (typeof window !== 'undefined') { |
| 21607 |
if (true) { |
| 21608 |
__nested_webpack_require_51548__("f6fd") |
| 21609 |
} |
| 21610 |
|
| 21611 |
var setPublicPath_i |
| 21612 |
if ((setPublicPath_i = window.document.currentScript) && (setPublicPath_i = setPublicPath_i.src.match(/(.+\/)[^/]+\.js(\?.*)?$/))) { |
| 21613 |
__nested_webpack_require_51548__.p = setPublicPath_i[1] // eslint-disable-line |
| 21614 |
} |
| 21615 |
} |
| 21616 |
|
| 21617 |
// Indicate to webpack that this file can be concatenated |
| 21618 |
/* harmony default export */ var setPublicPath = (null); |
| 21619 |
|
| 21620 |
// EXTERNAL MODULE: ./node_modules/core-js/modules/es6.object.assign.js |
| 21621 |
var es6_object_assign = __nested_webpack_require_51548__("f751"); |
| 21622 |
|
| 21623 |
// EXTERNAL MODULE: ./node_modules/core-js/modules/es6.string.starts-with.js |
| 21624 |
var es6_string_starts_with = __nested_webpack_require_51548__("f559"); |
| 21625 |
|
| 21626 |
// EXTERNAL MODULE: ./node_modules/core-js/modules/web.dom.iterable.js |
| 21627 |
var web_dom_iterable = __nested_webpack_require_51548__("ac6a"); |
| 21628 |
|
| 21629 |
// EXTERNAL MODULE: ./node_modules/core-js/modules/es6.array.iterator.js |
| 21630 |
var es6_array_iterator = __nested_webpack_require_51548__("cadf"); |
| 21631 |
|
| 21632 |
// EXTERNAL MODULE: ./node_modules/core-js/modules/es6.object.keys.js |
| 21633 |
var es6_object_keys = __nested_webpack_require_51548__("456d"); |
| 21634 |
|
| 21635 |
// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/arrayWithHoles.js |
| 21636 |
function _arrayWithHoles(arr) { |
| 21637 |
if (Array.isArray(arr)) return arr; |
| 21638 |
} |
| 21639 |
// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/iterableToArrayLimit.js |
| 21640 |
function _iterableToArrayLimit(arr, i) { |
| 21641 |
if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; |
| 21642 |
var _arr = []; |
| 21643 |
var _n = true; |
| 21644 |
var _d = false; |
| 21645 |
var _e = undefined; |
| 21646 |
|
| 21647 |
try { |
| 21648 |
for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { |
| 21649 |
_arr.push(_s.value); |
| 21650 |
|
| 21651 |
if (i && _arr.length === i) break; |
| 21652 |
} |
| 21653 |
} catch (err) { |
| 21654 |
_d = true; |
| 21655 |
_e = err; |
| 21656 |
} finally { |
| 21657 |
try { |
| 21658 |
if (!_n && _i["return"] != null) _i["return"](); |
| 21659 |
} finally { |
| 21660 |
if (_d) throw _e; |
| 21661 |
} |
| 21662 |
} |
| 21663 |
|
| 21664 |
return _arr; |
| 21665 |
} |
| 21666 |
// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/arrayLikeToArray.js |
| 21667 |
function _arrayLikeToArray(arr, len) { |
| 21668 |
if (len == null || len > arr.length) len = arr.length; |
| 21669 |
|
| 21670 |
for (var i = 0, arr2 = new Array(len); i < len; i++) { |
| 21671 |
arr2[i] = arr[i]; |
| 21672 |
} |
| 21673 |
|
| 21674 |
return arr2; |
| 21675 |
} |
| 21676 |
// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/unsupportedIterableToArray.js |
| 21677 |
|
| 21678 |
function _unsupportedIterableToArray(o, minLen) { |
| 21679 |
if (!o) return; |
| 21680 |
if (typeof o === "string") return _arrayLikeToArray(o, minLen); |
| 21681 |
var n = Object.prototype.toString.call(o).slice(8, -1); |
| 21682 |
if (n === "Object" && o.constructor) n = o.constructor.name; |
| 21683 |
if (n === "Map" || n === "Set") return Array.from(o); |
| 21684 |
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); |
| 21685 |
} |
| 21686 |
// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/nonIterableRest.js |
| 21687 |
function _nonIterableRest() { |
| 21688 |
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); |
| 21689 |
} |
| 21690 |
// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/slicedToArray.js |
| 21691 |
|
| 21692 |
|
| 21693 |
|
| 21694 |
|
| 21695 |
function _slicedToArray(arr, i) { |
| 21696 |
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); |
| 21697 |
} |
| 21698 |
// EXTERNAL MODULE: ./node_modules/core-js/modules/es7.array.includes.js |
| 21699 |
var es7_array_includes = __nested_webpack_require_51548__("6762"); |
| 21700 |
|
| 21701 |
// EXTERNAL MODULE: ./node_modules/core-js/modules/es6.string.includes.js |
| 21702 |
var es6_string_includes = __nested_webpack_require_51548__("2fdb"); |
| 21703 |
|
| 21704 |
// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/arrayWithoutHoles.js |
| 21705 |
|
| 21706 |
function _arrayWithoutHoles(arr) { |
| 21707 |
if (Array.isArray(arr)) return _arrayLikeToArray(arr); |
| 21708 |
} |
| 21709 |
// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/iterableToArray.js |
| 21710 |
function _iterableToArray(iter) { |
| 21711 |
if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); |
| 21712 |
} |
| 21713 |
// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/nonIterableSpread.js |
| 21714 |
function _nonIterableSpread() { |
| 21715 |
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); |
| 21716 |
} |
| 21717 |
// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/toConsumableArray.js |
| 21718 |
|
| 21719 |
|
| 21720 |
|
| 21721 |
|
| 21722 |
function _toConsumableArray(arr) { |
| 21723 |
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); |
| 21724 |
} |
| 21725 |
// EXTERNAL MODULE: external {"commonjs":"sortablejs","commonjs2":"sortablejs","amd":"sortablejs","root":"Sortable"} |
| 21726 |
var external_commonjs_sortablejs_commonjs2_sortablejs_amd_sortablejs_root_Sortable_ = __nested_webpack_require_51548__("a352"); |
| 21727 |
var external_commonjs_sortablejs_commonjs2_sortablejs_amd_sortablejs_root_Sortable_default = /*#__PURE__*/__nested_webpack_require_51548__.n(external_commonjs_sortablejs_commonjs2_sortablejs_amd_sortablejs_root_Sortable_); |
| 21728 |
|
| 21729 |
// EXTERNAL MODULE: ./src/util/helper.js |
| 21730 |
var helper = __nested_webpack_require_51548__("c649"); |
| 21731 |
|
| 21732 |
// CONCATENATED MODULE: ./src/vuedraggable.js |
| 21733 |
|
| 21734 |
|
| 21735 |
|
| 21736 |
|
| 21737 |
|
| 21738 |
|
| 21739 |
|
| 21740 |
|
| 21741 |
|
| 21742 |
|
| 21743 |
|
| 21744 |
|
| 21745 |
function buildAttribute(object, propName, value) { |
| 21746 |
if (value === undefined) { |
| 21747 |
return object; |
| 21748 |
} |
| 21749 |
|
| 21750 |
object = object || {}; |
| 21751 |
object[propName] = value; |
| 21752 |
return object; |
| 21753 |
} |
| 21754 |
|
| 21755 |
function computeVmIndex(vnodes, element) { |
| 21756 |
return vnodes.map(function (elt) { |
| 21757 |
return elt.elm; |
| 21758 |
}).indexOf(element); |
| 21759 |
} |
| 21760 |
|
| 21761 |
function _computeIndexes(slots, children, isTransition, footerOffset) { |
| 21762 |
if (!slots) { |
| 21763 |
return []; |
| 21764 |
} |
| 21765 |
|
| 21766 |
var elmFromNodes = slots.map(function (elt) { |
| 21767 |
return elt.elm; |
| 21768 |
}); |
| 21769 |
var footerIndex = children.length - footerOffset; |
| 21770 |
|
| 21771 |
var rawIndexes = _toConsumableArray(children).map(function (elt, idx) { |
| 21772 |
return idx >= footerIndex ? elmFromNodes.length : elmFromNodes.indexOf(elt); |
| 21773 |
}); |
| 21774 |
|
| 21775 |
return isTransition ? rawIndexes.filter(function (ind) { |
| 21776 |
return ind !== -1; |
| 21777 |
}) : rawIndexes; |
| 21778 |
} |
| 21779 |
|
| 21780 |
function emit(evtName, evtData) { |
| 21781 |
var _this = this; |
| 21782 |
|
| 21783 |
this.$nextTick(function () { |
| 21784 |
return _this.$emit(evtName.toLowerCase(), evtData); |
| 21785 |
}); |
| 21786 |
} |
| 21787 |
|
| 21788 |
function delegateAndEmit(evtName) { |
| 21789 |
var _this2 = this; |
| 21790 |
|
| 21791 |
return function (evtData) { |
| 21792 |
if (_this2.realList !== null) { |
| 21793 |
_this2["onDrag" + evtName](evtData); |
| 21794 |
} |
| 21795 |
|
| 21796 |
emit.call(_this2, evtName, evtData); |
| 21797 |
}; |
| 21798 |
} |
| 21799 |
|
| 21800 |
function isTransitionName(name) { |
| 21801 |
return ["transition-group", "TransitionGroup"].includes(name); |
| 21802 |
} |
| 21803 |
|
| 21804 |
function vuedraggable_isTransition(slots) { |
| 21805 |
if (!slots || slots.length !== 1) { |
| 21806 |
return false; |
| 21807 |
} |
| 21808 |
|
| 21809 |
var _slots = _slicedToArray(slots, 1), |
| 21810 |
componentOptions = _slots[0].componentOptions; |
| 21811 |
|
| 21812 |
if (!componentOptions) { |
| 21813 |
return false; |
| 21814 |
} |
| 21815 |
|
| 21816 |
return isTransitionName(componentOptions.tag); |
| 21817 |
} |
| 21818 |
|
| 21819 |
function getSlot(slot, scopedSlot, key) { |
| 21820 |
return slot[key] || (scopedSlot[key] ? scopedSlot[key]() : undefined); |
| 21821 |
} |
| 21822 |
|
| 21823 |
function computeChildrenAndOffsets(children, slot, scopedSlot) { |
| 21824 |
var headerOffset = 0; |
| 21825 |
var footerOffset = 0; |
| 21826 |
var header = getSlot(slot, scopedSlot, "header"); |
| 21827 |
|
| 21828 |
if (header) { |
| 21829 |
headerOffset = header.length; |
| 21830 |
children = children ? [].concat(_toConsumableArray(header), _toConsumableArray(children)) : _toConsumableArray(header); |
| 21831 |
} |
| 21832 |
|
| 21833 |
var footer = getSlot(slot, scopedSlot, "footer"); |
| 21834 |
|
| 21835 |
if (footer) { |
| 21836 |
footerOffset = footer.length; |
| 21837 |
children = children ? [].concat(_toConsumableArray(children), _toConsumableArray(footer)) : _toConsumableArray(footer); |
| 21838 |
} |
| 21839 |
|
| 21840 |
return { |
| 21841 |
children: children, |
| 21842 |
headerOffset: headerOffset, |
| 21843 |
footerOffset: footerOffset |
| 21844 |
}; |
| 21845 |
} |
| 21846 |
|
| 21847 |
function getComponentAttributes($attrs, componentData) { |
| 21848 |
var attributes = null; |
| 21849 |
|
| 21850 |
var update = function update(name, value) { |
| 21851 |
attributes = buildAttribute(attributes, name, value); |
| 21852 |
}; |
| 21853 |
|
| 21854 |
var attrs = Object.keys($attrs).filter(function (key) { |
| 21855 |
return key === "id" || key.startsWith("data-"); |
| 21856 |
}).reduce(function (res, key) { |
| 21857 |
res[key] = $attrs[key]; |
| 21858 |
return res; |
| 21859 |
}, {}); |
| 21860 |
update("attrs", attrs); |
| 21861 |
|
| 21862 |
if (!componentData) { |
| 21863 |
return attributes; |
| 21864 |
} |
| 21865 |
|
| 21866 |
var on = componentData.on, |
| 21867 |
props = componentData.props, |
| 21868 |
componentDataAttrs = componentData.attrs; |
| 21869 |
update("on", on); |
| 21870 |
update("props", props); |
| 21871 |
Object.assign(attributes.attrs, componentDataAttrs); |
| 21872 |
return attributes; |
| 21873 |
} |
| 21874 |
|
| 21875 |
var eventsListened = ["Start", "Add", "Remove", "Update", "End"]; |
| 21876 |
var eventsToEmit = ["Choose", "Unchoose", "Sort", "Filter", "Clone"]; |
| 21877 |
var readonlyProperties = ["Move"].concat(eventsListened, eventsToEmit).map(function (evt) { |
| 21878 |
return "on" + evt; |
| 21879 |
}); |
| 21880 |
var draggingElement = null; |
| 21881 |
var props = { |
| 21882 |
options: Object, |
| 21883 |
list: { |
| 21884 |
type: Array, |
| 21885 |
required: false, |
| 21886 |
default: null |
| 21887 |
}, |
| 21888 |
value: { |
| 21889 |
type: Array, |
| 21890 |
required: false, |
| 21891 |
default: null |
| 21892 |
}, |
| 21893 |
noTransitionOnDrag: { |
| 21894 |
type: Boolean, |
| 21895 |
default: false |
| 21896 |
}, |
| 21897 |
clone: { |
| 21898 |
type: Function, |
| 21899 |
default: function _default(original) { |
| 21900 |
return original; |
| 21901 |
} |
| 21902 |
}, |
| 21903 |
element: { |
| 21904 |
type: String, |
| 21905 |
default: "div" |
| 21906 |
}, |
| 21907 |
tag: { |
| 21908 |
type: String, |
| 21909 |
default: null |
| 21910 |
}, |
| 21911 |
move: { |
| 21912 |
type: Function, |
| 21913 |
default: null |
| 21914 |
}, |
| 21915 |
componentData: { |
| 21916 |
type: Object, |
| 21917 |
required: false, |
| 21918 |
default: null |
| 21919 |
} |
| 21920 |
}; |
| 21921 |
var draggableComponent = { |
| 21922 |
name: "draggable", |
| 21923 |
inheritAttrs: false, |
| 21924 |
props: props, |
| 21925 |
data: function data() { |
| 21926 |
return { |
| 21927 |
transitionMode: false, |
| 21928 |
noneFunctionalComponentMode: false |
| 21929 |
}; |
| 21930 |
}, |
| 21931 |
render: function render(h) { |
| 21932 |
var slots = this.$slots.default; |
| 21933 |
this.transitionMode = vuedraggable_isTransition(slots); |
| 21934 |
|
| 21935 |
var _computeChildrenAndOf = computeChildrenAndOffsets(slots, this.$slots, this.$scopedSlots), |
| 21936 |
children = _computeChildrenAndOf.children, |
| 21937 |
headerOffset = _computeChildrenAndOf.headerOffset, |
| 21938 |
footerOffset = _computeChildrenAndOf.footerOffset; |
| 21939 |
|
| 21940 |
this.headerOffset = headerOffset; |
| 21941 |
this.footerOffset = footerOffset; |
| 21942 |
var attributes = getComponentAttributes(this.$attrs, this.componentData); |
| 21943 |
return h(this.getTag(), attributes, children); |
| 21944 |
}, |
| 21945 |
created: function created() { |
| 21946 |
if (this.list !== null && this.value !== null) { |
| 21947 |
helper["b" /* console */].error("Value and list props are mutually exclusive! Please set one or another."); |
| 21948 |
} |
| 21949 |
|
| 21950 |
if (this.element !== "div") { |
| 21951 |
helper["b" /* console */].warn("Element props is deprecated please use tag props instead. See https://github.com/SortableJS/Vue.Draggable/blob/master/documentation/migrate.md#element-props"); |
| 21952 |
} |
| 21953 |
|
| 21954 |
if (this.options !== undefined) { |
| 21955 |
helper["b" /* console */].warn("Options props is deprecated, add sortable options directly as vue.draggable item, or use v-bind. See https://github.com/SortableJS/Vue.Draggable/blob/master/documentation/migrate.md#options-props"); |
| 21956 |
} |
| 21957 |
}, |
| 21958 |
mounted: function mounted() { |
| 21959 |
var _this3 = this; |
| 21960 |
|
| 21961 |
this.noneFunctionalComponentMode = this.getTag().toLowerCase() !== this.$el.nodeName.toLowerCase() && !this.getIsFunctional(); |
| 21962 |
|
| 21963 |
if (this.noneFunctionalComponentMode && this.transitionMode) { |
| 21964 |
throw new Error("Transition-group inside component is not supported. Please alter tag value or remove transition-group. Current tag value: ".concat(this.getTag())); |
| 21965 |
} |
| 21966 |
|
| 21967 |
var optionsAdded = {}; |
| 21968 |
eventsListened.forEach(function (elt) { |
| 21969 |
optionsAdded["on" + elt] = delegateAndEmit.call(_this3, elt); |
| 21970 |
}); |
| 21971 |
eventsToEmit.forEach(function (elt) { |
| 21972 |
optionsAdded["on" + elt] = emit.bind(_this3, elt); |
| 21973 |
}); |
| 21974 |
var attributes = Object.keys(this.$attrs).reduce(function (res, key) { |
| 21975 |
res[Object(helper["a" /* camelize */])(key)] = _this3.$attrs[key]; |
| 21976 |
return res; |
| 21977 |
}, {}); |
| 21978 |
var options = Object.assign({}, this.options, attributes, optionsAdded, { |
| 21979 |
onMove: function onMove(evt, originalEvent) { |
| 21980 |
return _this3.onDragMove(evt, originalEvent); |
| 21981 |
} |
| 21982 |
}); |
| 21983 |
!("draggable" in options) && (options.draggable = ">*"); |
| 21984 |
this._sortable = new external_commonjs_sortablejs_commonjs2_sortablejs_amd_sortablejs_root_Sortable_default.a(this.rootContainer, options); |
| 21985 |
this.computeIndexes(); |
| 21986 |
}, |
| 21987 |
beforeDestroy: function beforeDestroy() { |
| 21988 |
if (this._sortable !== undefined) this._sortable.destroy(); |
| 21989 |
}, |
| 21990 |
computed: { |
| 21991 |
rootContainer: function rootContainer() { |
| 21992 |
return this.transitionMode ? this.$el.children[0] : this.$el; |
| 21993 |
}, |
| 21994 |
realList: function realList() { |
| 21995 |
return this.list ? this.list : this.value; |
| 21996 |
} |
| 21997 |
}, |
| 21998 |
watch: { |
| 21999 |
options: { |
| 22000 |
handler: function handler(newOptionValue) { |
| 22001 |
this.updateOptions(newOptionValue); |
| 22002 |
}, |
| 22003 |
deep: true |
| 22004 |
}, |
| 22005 |
$attrs: { |
| 22006 |
handler: function handler(newOptionValue) { |
| 22007 |
this.updateOptions(newOptionValue); |
| 22008 |
}, |
| 22009 |
deep: true |
| 22010 |
}, |
| 22011 |
realList: function realList() { |
| 22012 |
this.computeIndexes(); |
| 22013 |
} |
| 22014 |
}, |
| 22015 |
methods: { |
| 22016 |
getIsFunctional: function getIsFunctional() { |
| 22017 |
var fnOptions = this._vnode.fnOptions; |
| 22018 |
return fnOptions && fnOptions.functional; |
| 22019 |
}, |
| 22020 |
getTag: function getTag() { |
| 22021 |
return this.tag || this.element; |
| 22022 |
}, |
| 22023 |
updateOptions: function updateOptions(newOptionValue) { |
| 22024 |
for (var property in newOptionValue) { |
| 22025 |
var value = Object(helper["a" /* camelize */])(property); |
| 22026 |
|
| 22027 |
if (readonlyProperties.indexOf(value) === -1) { |
| 22028 |
this._sortable.option(value, newOptionValue[property]); |
| 22029 |
} |
| 22030 |
} |
| 22031 |
}, |
| 22032 |
getChildrenNodes: function getChildrenNodes() { |
| 22033 |
if (this.noneFunctionalComponentMode) { |
| 22034 |
return this.$children[0].$slots.default; |
| 22035 |
} |
| 22036 |
|
| 22037 |
var rawNodes = this.$slots.default; |
| 22038 |
return this.transitionMode ? rawNodes[0].child.$slots.default : rawNodes; |
| 22039 |
}, |
| 22040 |
computeIndexes: function computeIndexes() { |
| 22041 |
var _this4 = this; |
| 22042 |
|
| 22043 |
this.$nextTick(function () { |
| 22044 |
_this4.visibleIndexes = _computeIndexes(_this4.getChildrenNodes(), _this4.rootContainer.children, _this4.transitionMode, _this4.footerOffset); |
| 22045 |
}); |
| 22046 |
}, |
| 22047 |
getUnderlyingVm: function getUnderlyingVm(htmlElt) { |
| 22048 |
var index = computeVmIndex(this.getChildrenNodes() || [], htmlElt); |
| 22049 |
|
| 22050 |
if (index === -1) { |
| 22051 |
//Edge case during move callback: related element might be |
| 22052 |
//an element different from collection |
| 22053 |
return null; |
| 22054 |
} |
| 22055 |
|
| 22056 |
var element = this.realList[index]; |
| 22057 |
return { |
| 22058 |
index: index, |
| 22059 |
element: element |
| 22060 |
}; |
| 22061 |
}, |
| 22062 |
getUnderlyingPotencialDraggableComponent: function getUnderlyingPotencialDraggableComponent(_ref) { |
| 22063 |
var vue = _ref.__vue__; |
| 22064 |
|
| 22065 |
if (!vue || !vue.$options || !isTransitionName(vue.$options._componentTag)) { |
| 22066 |
if (!("realList" in vue) && vue.$children.length === 1 && "realList" in vue.$children[0]) return vue.$children[0]; |
| 22067 |
return vue; |
| 22068 |
} |
| 22069 |
|
| 22070 |
return vue.$parent; |
| 22071 |
}, |
| 22072 |
emitChanges: function emitChanges(evt) { |
| 22073 |
var _this5 = this; |
| 22074 |
|
| 22075 |
this.$nextTick(function () { |
| 22076 |
_this5.$emit("change", evt); |
| 22077 |
}); |
| 22078 |
}, |
| 22079 |
alterList: function alterList(onList) { |
| 22080 |
if (this.list) { |
| 22081 |
onList(this.list); |
| 22082 |
return; |
| 22083 |
} |
| 22084 |
|
| 22085 |
var newList = _toConsumableArray(this.value); |
| 22086 |
|
| 22087 |
onList(newList); |
| 22088 |
this.$emit("input", newList); |
| 22089 |
}, |
| 22090 |
spliceList: function spliceList() { |
| 22091 |
var _arguments = arguments; |
| 22092 |
|
| 22093 |
var spliceList = function spliceList(list) { |
| 22094 |
return list.splice.apply(list, _toConsumableArray(_arguments)); |
| 22095 |
}; |
| 22096 |
|
| 22097 |
this.alterList(spliceList); |
| 22098 |
}, |
| 22099 |
updatePosition: function updatePosition(oldIndex, newIndex) { |
| 22100 |
var updatePosition = function updatePosition(list) { |
| 22101 |
return list.splice(newIndex, 0, list.splice(oldIndex, 1)[0]); |
| 22102 |
}; |
| 22103 |
|
| 22104 |
this.alterList(updatePosition); |
| 22105 |
}, |
| 22106 |
getRelatedContextFromMoveEvent: function getRelatedContextFromMoveEvent(_ref2) { |
| 22107 |
var to = _ref2.to, |
| 22108 |
related = _ref2.related; |
| 22109 |
var component = this.getUnderlyingPotencialDraggableComponent(to); |
| 22110 |
|
| 22111 |
if (!component) { |
| 22112 |
return { |
| 22113 |
component: component |
| 22114 |
}; |
| 22115 |
} |
| 22116 |
|
| 22117 |
var list = component.realList; |
| 22118 |
var context = { |
| 22119 |
list: list, |
| 22120 |
component: component |
| 22121 |
}; |
| 22122 |
|
| 22123 |
if (to !== related && list && component.getUnderlyingVm) { |
| 22124 |
var destination = component.getUnderlyingVm(related); |
| 22125 |
|
| 22126 |
if (destination) { |
| 22127 |
return Object.assign(destination, context); |
| 22128 |
} |
| 22129 |
} |
| 22130 |
|
| 22131 |
return context; |
| 22132 |
}, |
| 22133 |
getVmIndex: function getVmIndex(domIndex) { |
| 22134 |
var indexes = this.visibleIndexes; |
| 22135 |
var numberIndexes = indexes.length; |
| 22136 |
return domIndex > numberIndexes - 1 ? numberIndexes : indexes[domIndex]; |
| 22137 |
}, |
| 22138 |
getComponent: function getComponent() { |
| 22139 |
return this.$slots.default[0].componentInstance; |
| 22140 |
}, |
| 22141 |
resetTransitionData: function resetTransitionData(index) { |
| 22142 |
if (!this.noTransitionOnDrag || !this.transitionMode) { |
| 22143 |
return; |
| 22144 |
} |
| 22145 |
|
| 22146 |
var nodes = this.getChildrenNodes(); |
| 22147 |
nodes[index].data = null; |
| 22148 |
var transitionContainer = this.getComponent(); |
| 22149 |
transitionContainer.children = []; |
| 22150 |
transitionContainer.kept = undefined; |
| 22151 |
}, |
| 22152 |
onDragStart: function onDragStart(evt) { |
| 22153 |
this.context = this.getUnderlyingVm(evt.item); |
| 22154 |
evt.item._underlying_vm_ = this.clone(this.context.element); |
| 22155 |
draggingElement = evt.item; |
| 22156 |
}, |
| 22157 |
onDragAdd: function onDragAdd(evt) { |
| 22158 |
var element = evt.item._underlying_vm_; |
| 22159 |
|
| 22160 |
if (element === undefined) { |
| 22161 |
return; |
| 22162 |
} |
| 22163 |
|
| 22164 |
Object(helper["d" /* removeNode */])(evt.item); |
| 22165 |
var newIndex = this.getVmIndex(evt.newIndex); |
| 22166 |
this.spliceList(newIndex, 0, element); |
| 22167 |
this.computeIndexes(); |
| 22168 |
var added = { |
| 22169 |
element: element, |
| 22170 |
newIndex: newIndex |
| 22171 |
}; |
| 22172 |
this.emitChanges({ |
| 22173 |
added: added |
| 22174 |
}); |
| 22175 |
}, |
| 22176 |
onDragRemove: function onDragRemove(evt) { |
| 22177 |
Object(helper["c" /* insertNodeAt */])(this.rootContainer, evt.item, evt.oldIndex); |
| 22178 |
|
| 22179 |
if (evt.pullMode === "clone") { |
| 22180 |
Object(helper["d" /* removeNode */])(evt.clone); |
| 22181 |
return; |
| 22182 |
} |
| 22183 |
|
| 22184 |
var oldIndex = this.context.index; |
| 22185 |
this.spliceList(oldIndex, 1); |
| 22186 |
var removed = { |
| 22187 |
element: this.context.element, |
| 22188 |
oldIndex: oldIndex |
| 22189 |
}; |
| 22190 |
this.resetTransitionData(oldIndex); |
| 22191 |
this.emitChanges({ |
| 22192 |
removed: removed |
| 22193 |
}); |
| 22194 |
}, |
| 22195 |
onDragUpdate: function onDragUpdate(evt) { |
| 22196 |
Object(helper["d" /* removeNode */])(evt.item); |
| 22197 |
Object(helper["c" /* insertNodeAt */])(evt.from, evt.item, evt.oldIndex); |
| 22198 |
var oldIndex = this.context.index; |
| 22199 |
var newIndex = this.getVmIndex(evt.newIndex); |
| 22200 |
this.updatePosition(oldIndex, newIndex); |
| 22201 |
var moved = { |
| 22202 |
element: this.context.element, |
| 22203 |
oldIndex: oldIndex, |
| 22204 |
newIndex: newIndex |
| 22205 |
}; |
| 22206 |
this.emitChanges({ |
| 22207 |
moved: moved |
| 22208 |
}); |
| 22209 |
}, |
| 22210 |
updateProperty: function updateProperty(evt, propertyName) { |
| 22211 |
evt.hasOwnProperty(propertyName) && (evt[propertyName] += this.headerOffset); |
| 22212 |
}, |
| 22213 |
computeFutureIndex: function computeFutureIndex(relatedContext, evt) { |
| 22214 |
if (!relatedContext.element) { |
| 22215 |
return 0; |
| 22216 |
} |
| 22217 |
|
| 22218 |
var domChildren = _toConsumableArray(evt.to.children).filter(function (el) { |
| 22219 |
return el.style["display"] !== "none"; |
| 22220 |
}); |
| 22221 |
|
| 22222 |
var currentDOMIndex = domChildren.indexOf(evt.related); |
| 22223 |
var currentIndex = relatedContext.component.getVmIndex(currentDOMIndex); |
| 22224 |
var draggedInList = domChildren.indexOf(draggingElement) !== -1; |
| 22225 |
return draggedInList || !evt.willInsertAfter ? currentIndex : currentIndex + 1; |
| 22226 |
}, |
| 22227 |
onDragMove: function onDragMove(evt, originalEvent) { |
| 22228 |
var onMove = this.move; |
| 22229 |
|
| 22230 |
if (!onMove || !this.realList) { |
| 22231 |
return true; |
| 22232 |
} |
| 22233 |
|
| 22234 |
var relatedContext = this.getRelatedContextFromMoveEvent(evt); |
| 22235 |
var draggedContext = this.context; |
| 22236 |
var futureIndex = this.computeFutureIndex(relatedContext, evt); |
| 22237 |
Object.assign(draggedContext, { |
| 22238 |
futureIndex: futureIndex |
| 22239 |
}); |
| 22240 |
var sendEvt = Object.assign({}, evt, { |
| 22241 |
relatedContext: relatedContext, |
| 22242 |
draggedContext: draggedContext |
| 22243 |
}); |
| 22244 |
return onMove(sendEvt, originalEvent); |
| 22245 |
}, |
| 22246 |
onDragEnd: function onDragEnd() { |
| 22247 |
this.computeIndexes(); |
| 22248 |
draggingElement = null; |
| 22249 |
} |
| 22250 |
} |
| 22251 |
}; |
| 22252 |
|
| 22253 |
if (typeof window !== "undefined" && "Vue" in window) { |
| 22254 |
window.Vue.component("draggable", draggableComponent); |
| 22255 |
} |
| 22256 |
|
| 22257 |
/* harmony default export */ var vuedraggable = (draggableComponent); |
| 22258 |
// CONCATENATED MODULE: ./node_modules/@vue/cli-service/lib/commands/build/entry-lib.js |
| 22259 |
|
| 22260 |
|
| 22261 |
/* harmony default export */ var entry_lib = __webpack_exports__["default"] = (vuedraggable); |
| 22262 |
|
| 22263 |
|
| 22264 |
|
| 22265 |
/***/ }) |
| 22266 |
|
| 22267 |
/******/ })["default"]; |
| 22268 |
}); |
| 22269 |
//# sourceMappingURL=vuedraggable.umd.js.map |
| 22270 |
|
| 22271 |
/***/ }), |
| 22272 |
|
| 22273 |
/***/ "./node_modules/vuex/dist/vuex.esm.js": |
| 22274 |
/*!********************************************!*\ |
| 22275 |
!*** ./node_modules/vuex/dist/vuex.esm.js ***! |
| 22276 |
\********************************************/ |
| 22277 |
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { |
| 22278 |
|
| 22279 |
"use strict"; |
| 22280 |
__webpack_require__.r(__webpack_exports__); |
| 22281 |
/* harmony export */ __webpack_require__.d(__webpack_exports__, { |
| 22282 |
/* harmony export */ "Store": () => (/* binding */ Store), |
| 22283 |
/* harmony export */ "createLogger": () => (/* binding */ createLogger), |
| 22284 |
/* harmony export */ "createNamespacedHelpers": () => (/* binding */ createNamespacedHelpers), |
| 22285 |
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__), |
| 22286 |
/* harmony export */ "install": () => (/* binding */ install), |
| 22287 |
/* harmony export */ "mapActions": () => (/* binding */ mapActions), |
| 22288 |
/* harmony export */ "mapGetters": () => (/* binding */ mapGetters), |
| 22289 |
/* harmony export */ "mapMutations": () => (/* binding */ mapMutations), |
| 22290 |
/* harmony export */ "mapState": () => (/* binding */ mapState) |
| 22291 |
/* harmony export */ }); |
| 22292 |
/*! |
| 22293 |
* vuex v3.6.2 |
| 22294 |
* (c) 2021 Evan You |
| 22295 |
* @license MIT |
| 22296 |
*/ |
| 22297 |
function applyMixin (Vue) { |
| 22298 |
var version = Number(Vue.version.split('.')[0]); |
| 22299 |
|
| 22300 |
if (version >= 2) { |
| 22301 |
Vue.mixin({ beforeCreate: vuexInit }); |
| 22302 |
} else { |
| 22303 |
// override init and inject vuex init procedure |
| 22304 |
// for 1.x backwards compatibility. |
| 22305 |
var _init = Vue.prototype._init; |
| 22306 |
Vue.prototype._init = function (options) { |
| 22307 |
if ( options === void 0 ) options = {}; |
| 22308 |
|
| 22309 |
options.init = options.init |
| 22310 |
? [vuexInit].concat(options.init) |
| 22311 |
: vuexInit; |
| 22312 |
_init.call(this, options); |
| 22313 |
}; |
| 22314 |
} |
| 22315 |
|
| 22316 |
/** |
| 22317 |
* Vuex init hook, injected into each instances init hooks list. |
| 22318 |
*/ |
| 22319 |
|
| 22320 |
function vuexInit () { |
| 22321 |
var options = this.$options; |
| 22322 |
// store injection |
| 22323 |
if (options.store) { |
| 22324 |
this.$store = typeof options.store === 'function' |
| 22325 |
? options.store() |
| 22326 |
: options.store; |
| 22327 |
} else if (options.parent && options.parent.$store) { |
| 22328 |
this.$store = options.parent.$store; |
| 22329 |
} |
| 22330 |
} |
| 22331 |
} |
| 22332 |
|
| 22333 |
var target = typeof window !== 'undefined' |
| 22334 |
? window |
| 22335 |
: typeof __webpack_require__.g !== 'undefined' |
| 22336 |
? __webpack_require__.g |
| 22337 |
: {}; |
| 22338 |
var devtoolHook = target.__VUE_DEVTOOLS_GLOBAL_HOOK__; |
| 22339 |
|
| 22340 |
function devtoolPlugin (store) { |
| 22341 |
if (!devtoolHook) { return } |
| 22342 |
|
| 22343 |
store._devtoolHook = devtoolHook; |
| 22344 |
|
| 22345 |
devtoolHook.emit('vuex:init', store); |
| 22346 |
|
| 22347 |
devtoolHook.on('vuex:travel-to-state', function (targetState) { |
| 22348 |
store.replaceState(targetState); |
| 22349 |
}); |
| 22350 |
|
| 22351 |
store.subscribe(function (mutation, state) { |
| 22352 |
devtoolHook.emit('vuex:mutation', mutation, state); |
| 22353 |
}, { prepend: true }); |
| 22354 |
|
| 22355 |
store.subscribeAction(function (action, state) { |
| 22356 |
devtoolHook.emit('vuex:action', action, state); |
| 22357 |
}, { prepend: true }); |
| 22358 |
} |
| 22359 |
|
| 22360 |
/** |
| 22361 |
* Get the first item that pass the test |
| 22362 |
* by second argument function |
| 22363 |
* |
| 22364 |
* @param {Array} list |
| 22365 |
* @param {Function} f |
| 22366 |
* @return {*} |
| 22367 |
*/ |
| 22368 |
function find (list, f) { |
| 22369 |
return list.filter(f)[0] |
| 22370 |
} |
| 22371 |
|
| 22372 |
/** |
| 22373 |
* Deep copy the given object considering circular structure. |
| 22374 |
* This function caches all nested objects and its copies. |
| 22375 |
* If it detects circular structure, use cached copy to avoid infinite loop. |
| 22376 |
* |
| 22377 |
* @param {*} obj |
| 22378 |
* @param {Array<Object>} cache |
| 22379 |
* @return {*} |
| 22380 |
*/ |
| 22381 |
function deepCopy (obj, cache) { |
| 22382 |
if ( cache === void 0 ) cache = []; |
| 22383 |
|
| 22384 |
// just return if obj is immutable value |
| 22385 |
if (obj === null || typeof obj !== 'object') { |
| 22386 |
return obj |
| 22387 |
} |
| 22388 |
|
| 22389 |
// if obj is hit, it is in circular structure |
| 22390 |
var hit = find(cache, function (c) { return c.original === obj; }); |
| 22391 |
if (hit) { |
| 22392 |
return hit.copy |
| 22393 |
} |
| 22394 |
|
| 22395 |
var copy = Array.isArray(obj) ? [] : {}; |
| 22396 |
// put the copy into cache at first |
| 22397 |
// because we want to refer it in recursive deepCopy |
| 22398 |
cache.push({ |
| 22399 |
original: obj, |
| 22400 |
copy: copy |
| 22401 |
}); |
| 22402 |
|
| 22403 |
Object.keys(obj).forEach(function (key) { |
| 22404 |
copy[key] = deepCopy(obj[key], cache); |
| 22405 |
}); |
| 22406 |
|
| 22407 |
return copy |
| 22408 |
} |
| 22409 |
|
| 22410 |
/** |
| 22411 |
* forEach for object |
| 22412 |
*/ |
| 22413 |
function forEachValue (obj, fn) { |
| 22414 |
Object.keys(obj).forEach(function (key) { return fn(obj[key], key); }); |
| 22415 |
} |
| 22416 |
|
| 22417 |
function isObject (obj) { |
| 22418 |
return obj !== null && typeof obj === 'object' |
| 22419 |
} |
| 22420 |
|
| 22421 |
function isPromise (val) { |
| 22422 |
return val && typeof val.then === 'function' |
| 22423 |
} |
| 22424 |
|
| 22425 |
function assert (condition, msg) { |
| 22426 |
if (!condition) { throw new Error(("[vuex] " + msg)) } |
| 22427 |
} |
| 22428 |
|
| 22429 |
function partial (fn, arg) { |
| 22430 |
return function () { |
| 22431 |
return fn(arg) |
| 22432 |
} |
| 22433 |
} |
| 22434 |
|
| 22435 |
// Base data struct for store's module, package with some attribute and method |
| 22436 |
var Module = function Module (rawModule, runtime) { |
| 22437 |
this.runtime = runtime; |
| 22438 |
// Store some children item |
| 22439 |
this._children = Object.create(null); |
| 22440 |
// Store the origin module object which passed by programmer |
| 22441 |
this._rawModule = rawModule; |
| 22442 |
var rawState = rawModule.state; |
| 22443 |
|
| 22444 |
// Store the origin module's state |
| 22445 |
this.state = (typeof rawState === 'function' ? rawState() : rawState) || {}; |
| 22446 |
}; |
| 22447 |
|
| 22448 |
var prototypeAccessors = { namespaced: { configurable: true } }; |
| 22449 |
|
| 22450 |
prototypeAccessors.namespaced.get = function () { |
| 22451 |
return !!this._rawModule.namespaced |
| 22452 |
}; |
| 22453 |
|
| 22454 |
Module.prototype.addChild = function addChild (key, module) { |
| 22455 |
this._children[key] = module; |
| 22456 |
}; |
| 22457 |
|
| 22458 |
Module.prototype.removeChild = function removeChild (key) { |
| 22459 |
delete this._children[key]; |
| 22460 |
}; |
| 22461 |
|
| 22462 |
Module.prototype.getChild = function getChild (key) { |
| 22463 |
return this._children[key] |
| 22464 |
}; |
| 22465 |
|
| 22466 |
Module.prototype.hasChild = function hasChild (key) { |
| 22467 |
return key in this._children |
| 22468 |
}; |
| 22469 |
|
| 22470 |
Module.prototype.update = function update (rawModule) { |
| 22471 |
this._rawModule.namespaced = rawModule.namespaced; |
| 22472 |
if (rawModule.actions) { |
| 22473 |
this._rawModule.actions = rawModule.actions; |
| 22474 |
} |
| 22475 |
if (rawModule.mutations) { |
| 22476 |
this._rawModule.mutations = rawModule.mutations; |
| 22477 |
} |
| 22478 |
if (rawModule.getters) { |
| 22479 |
this._rawModule.getters = rawModule.getters; |
| 22480 |
} |
| 22481 |
}; |
| 22482 |
|
| 22483 |
Module.prototype.forEachChild = function forEachChild (fn) { |
| 22484 |
forEachValue(this._children, fn); |
| 22485 |
}; |
| 22486 |
|
| 22487 |
Module.prototype.forEachGetter = function forEachGetter (fn) { |
| 22488 |
if (this._rawModule.getters) { |
| 22489 |
forEachValue(this._rawModule.getters, fn); |
| 22490 |
} |
| 22491 |
}; |
| 22492 |
|
| 22493 |
Module.prototype.forEachAction = function forEachAction (fn) { |
| 22494 |
if (this._rawModule.actions) { |
| 22495 |
forEachValue(this._rawModule.actions, fn); |
| 22496 |
} |
| 22497 |
}; |
| 22498 |
|
| 22499 |
Module.prototype.forEachMutation = function forEachMutation (fn) { |
| 22500 |
if (this._rawModule.mutations) { |
| 22501 |
forEachValue(this._rawModule.mutations, fn); |
| 22502 |
} |
| 22503 |
}; |
| 22504 |
|
| 22505 |
Object.defineProperties( Module.prototype, prototypeAccessors ); |
| 22506 |
|
| 22507 |
var ModuleCollection = function ModuleCollection (rawRootModule) { |
| 22508 |
// register root module (Vuex.Store options) |
| 22509 |
this.register([], rawRootModule, false); |
| 22510 |
}; |
| 22511 |
|
| 22512 |
ModuleCollection.prototype.get = function get (path) { |
| 22513 |
return path.reduce(function (module, key) { |
| 22514 |
return module.getChild(key) |
| 22515 |
}, this.root) |
| 22516 |
}; |
| 22517 |
|
| 22518 |
ModuleCollection.prototype.getNamespace = function getNamespace (path) { |
| 22519 |
var module = this.root; |
| 22520 |
return path.reduce(function (namespace, key) { |
| 22521 |
module = module.getChild(key); |
| 22522 |
return namespace + (module.namespaced ? key + '/' : '') |
| 22523 |
}, '') |
| 22524 |
}; |
| 22525 |
|
| 22526 |
ModuleCollection.prototype.update = function update$1 (rawRootModule) { |
| 22527 |
update([], this.root, rawRootModule); |
| 22528 |
}; |
| 22529 |
|
| 22530 |
ModuleCollection.prototype.register = function register (path, rawModule, runtime) { |
| 22531 |
var this$1 = this; |
| 22532 |
if ( runtime === void 0 ) runtime = true; |
| 22533 |
|
| 22534 |
if ((true)) { |
| 22535 |
assertRawModule(path, rawModule); |
| 22536 |
} |
| 22537 |
|
| 22538 |
var newModule = new Module(rawModule, runtime); |
| 22539 |
if (path.length === 0) { |
| 22540 |
this.root = newModule; |
| 22541 |
} else { |
| 22542 |
var parent = this.get(path.slice(0, -1)); |
| 22543 |
parent.addChild(path[path.length - 1], newModule); |
| 22544 |
} |
| 22545 |
|
| 22546 |
// register nested modules |
| 22547 |
if (rawModule.modules) { |
| 22548 |
forEachValue(rawModule.modules, function (rawChildModule, key) { |
| 22549 |
this$1.register(path.concat(key), rawChildModule, runtime); |
| 22550 |
}); |
| 22551 |
} |
| 22552 |
}; |
| 22553 |
|
| 22554 |
ModuleCollection.prototype.unregister = function unregister (path) { |
| 22555 |
var parent = this.get(path.slice(0, -1)); |
| 22556 |
var key = path[path.length - 1]; |
| 22557 |
var child = parent.getChild(key); |
| 22558 |
|
| 22559 |
if (!child) { |
| 22560 |
if ((true)) { |
| 22561 |
console.warn( |
| 22562 |
"[vuex] trying to unregister module '" + key + "', which is " + |
| 22563 |
"not registered" |
| 22564 |
); |
| 22565 |
} |
| 22566 |
return |
| 22567 |
} |
| 22568 |
|
| 22569 |
if (!child.runtime) { |
| 22570 |
return |
| 22571 |
} |
| 22572 |
|
| 22573 |
parent.removeChild(key); |
| 22574 |
}; |
| 22575 |
|
| 22576 |
ModuleCollection.prototype.isRegistered = function isRegistered (path) { |
| 22577 |
var parent = this.get(path.slice(0, -1)); |
| 22578 |
var key = path[path.length - 1]; |
| 22579 |
|
| 22580 |
if (parent) { |
| 22581 |
return parent.hasChild(key) |
| 22582 |
} |
| 22583 |
|
| 22584 |
return false |
| 22585 |
}; |
| 22586 |
|
| 22587 |
function update (path, targetModule, newModule) { |
| 22588 |
if ((true)) { |
| 22589 |
assertRawModule(path, newModule); |
| 22590 |
} |
| 22591 |
|
| 22592 |
// update target module |
| 22593 |
targetModule.update(newModule); |
| 22594 |
|
| 22595 |
// update nested modules |
| 22596 |
if (newModule.modules) { |
| 22597 |
for (var key in newModule.modules) { |
| 22598 |
if (!targetModule.getChild(key)) { |
| 22599 |
if ((true)) { |
| 22600 |
console.warn( |
| 22601 |
"[vuex] trying to add a new module '" + key + "' on hot reloading, " + |
| 22602 |
'manual reload is needed' |
| 22603 |
); |
| 22604 |
} |
| 22605 |
return |
| 22606 |
} |
| 22607 |
update( |
| 22608 |
path.concat(key), |
| 22609 |
targetModule.getChild(key), |
| 22610 |
newModule.modules[key] |
| 22611 |
); |
| 22612 |
} |
| 22613 |
} |
| 22614 |
} |
| 22615 |
|
| 22616 |
var functionAssert = { |
| 22617 |
assert: function (value) { return typeof value === 'function'; }, |
| 22618 |
expected: 'function' |
| 22619 |
}; |
| 22620 |
|
| 22621 |
var objectAssert = { |
| 22622 |
assert: function (value) { return typeof value === 'function' || |
| 22623 |
(typeof value === 'object' && typeof value.handler === 'function'); }, |
| 22624 |
expected: 'function or object with "handler" function' |
| 22625 |
}; |
| 22626 |
|
| 22627 |
var assertTypes = { |
| 22628 |
getters: functionAssert, |
| 22629 |
mutations: functionAssert, |
| 22630 |
actions: objectAssert |
| 22631 |
}; |
| 22632 |
|
| 22633 |
function assertRawModule (path, rawModule) { |
| 22634 |
Object.keys(assertTypes).forEach(function (key) { |
| 22635 |
if (!rawModule[key]) { return } |
| 22636 |
|
| 22637 |
var assertOptions = assertTypes[key]; |
| 22638 |
|
| 22639 |
forEachValue(rawModule[key], function (value, type) { |
| 22640 |
assert( |
| 22641 |
assertOptions.assert(value), |
| 22642 |
makeAssertionMessage(path, key, type, value, assertOptions.expected) |
| 22643 |
); |
| 22644 |
}); |
| 22645 |
}); |
| 22646 |
} |
| 22647 |
|
| 22648 |
function makeAssertionMessage (path, key, type, value, expected) { |
| 22649 |
var buf = key + " should be " + expected + " but \"" + key + "." + type + "\""; |
| 22650 |
if (path.length > 0) { |
| 22651 |
buf += " in module \"" + (path.join('.')) + "\""; |
| 22652 |
} |
| 22653 |
buf += " is " + (JSON.stringify(value)) + "."; |
| 22654 |
return buf |
| 22655 |
} |
| 22656 |
|
| 22657 |
var Vue; // bind on install |
| 22658 |
|
| 22659 |
var Store = function Store (options) { |
| 22660 |
var this$1 = this; |
| 22661 |
if ( options === void 0 ) options = {}; |
| 22662 |
|
| 22663 |
// Auto install if it is not done yet and `window` has `Vue`. |
| 22664 |
// To allow users to avoid auto-installation in some cases, |
| 22665 |
// this code should be placed here. See #731 |
| 22666 |
if (!Vue && typeof window !== 'undefined' && window.Vue) { |
| 22667 |
install(window.Vue); |
| 22668 |
} |
| 22669 |
|
| 22670 |
if ((true)) { |
| 22671 |
assert(Vue, "must call Vue.use(Vuex) before creating a store instance."); |
| 22672 |
assert(typeof Promise !== 'undefined', "vuex requires a Promise polyfill in this browser."); |
| 22673 |
assert(this instanceof Store, "store must be called with the new operator."); |
| 22674 |
} |
| 22675 |
|
| 22676 |
var plugins = options.plugins; if ( plugins === void 0 ) plugins = []; |
| 22677 |
var strict = options.strict; if ( strict === void 0 ) strict = false; |
| 22678 |
|
| 22679 |
// store internal state |
| 22680 |
this._committing = false; |
| 22681 |
this._actions = Object.create(null); |
| 22682 |
this._actionSubscribers = []; |
| 22683 |
this._mutations = Object.create(null); |
| 22684 |
this._wrappedGetters = Object.create(null); |
| 22685 |
this._modules = new ModuleCollection(options); |
| 22686 |
this._modulesNamespaceMap = Object.create(null); |
| 22687 |
this._subscribers = []; |
| 22688 |
this._watcherVM = new Vue(); |
| 22689 |
this._makeLocalGettersCache = Object.create(null); |
| 22690 |
|
| 22691 |
// bind commit and dispatch to self |
| 22692 |
var store = this; |
| 22693 |
var ref = this; |
| 22694 |
var dispatch = ref.dispatch; |
| 22695 |
var commit = ref.commit; |
| 22696 |
this.dispatch = function boundDispatch (type, payload) { |
| 22697 |
return dispatch.call(store, type, payload) |
| 22698 |
}; |
| 22699 |
this.commit = function boundCommit (type, payload, options) { |
| 22700 |
return commit.call(store, type, payload, options) |
| 22701 |
}; |
| 22702 |
|
| 22703 |
// strict mode |
| 22704 |
this.strict = strict; |
| 22705 |
|
| 22706 |
var state = this._modules.root.state; |
| 22707 |
|
| 22708 |
// init root module. |
| 22709 |
// this also recursively registers all sub-modules |
| 22710 |
// and collects all module getters inside this._wrappedGetters |
| 22711 |
installModule(this, state, [], this._modules.root); |
| 22712 |
|
| 22713 |
// initialize the store vm, which is responsible for the reactivity |
| 22714 |
// (also registers _wrappedGetters as computed properties) |
| 22715 |
resetStoreVM(this, state); |
| 22716 |
|
| 22717 |
// apply plugins |
| 22718 |
plugins.forEach(function (plugin) { return plugin(this$1); }); |
| 22719 |
|
| 22720 |
var useDevtools = options.devtools !== undefined ? options.devtools : Vue.config.devtools; |
| 22721 |
if (useDevtools) { |
| 22722 |
devtoolPlugin(this); |
| 22723 |
} |
| 22724 |
}; |
| 22725 |
|
| 22726 |
var prototypeAccessors$1 = { state: { configurable: true } }; |
| 22727 |
|
| 22728 |
prototypeAccessors$1.state.get = function () { |
| 22729 |
return this._vm._data.$$state |
| 22730 |
}; |
| 22731 |
|
| 22732 |
prototypeAccessors$1.state.set = function (v) { |
| 22733 |
if ((true)) { |
| 22734 |
assert(false, "use store.replaceState() to explicit replace store state."); |
| 22735 |
} |
| 22736 |
}; |
| 22737 |
|
| 22738 |
Store.prototype.commit = function commit (_type, _payload, _options) { |
| 22739 |
var this$1 = this; |
| 22740 |
|
| 22741 |
// check object-style commit |
| 22742 |
var ref = unifyObjectStyle(_type, _payload, _options); |
| 22743 |
var type = ref.type; |
| 22744 |
var payload = ref.payload; |
| 22745 |
var options = ref.options; |
| 22746 |
|
| 22747 |
var mutation = { type: type, payload: payload }; |
| 22748 |
var entry = this._mutations[type]; |
| 22749 |
if (!entry) { |
| 22750 |
if ((true)) { |
| 22751 |
console.error(("[vuex] unknown mutation type: " + type)); |
| 22752 |
} |
| 22753 |
return |
| 22754 |
} |
| 22755 |
this._withCommit(function () { |
| 22756 |
entry.forEach(function commitIterator (handler) { |
| 22757 |
handler(payload); |
| 22758 |
}); |
| 22759 |
}); |
| 22760 |
|
| 22761 |
this._subscribers |
| 22762 |
.slice() // shallow copy to prevent iterator invalidation if subscriber synchronously calls unsubscribe |
| 22763 |
.forEach(function (sub) { return sub(mutation, this$1.state); }); |
| 22764 |
|
| 22765 |
if ( |
| 22766 |
( true) && |
| 22767 |
options && options.silent |
| 22768 |
) { |
| 22769 |
console.warn( |
| 22770 |
"[vuex] mutation type: " + type + ". Silent option has been removed. " + |
| 22771 |
'Use the filter functionality in the vue-devtools' |
| 22772 |
); |
| 22773 |
} |
| 22774 |
}; |
| 22775 |
|
| 22776 |
Store.prototype.dispatch = function dispatch (_type, _payload) { |
| 22777 |
var this$1 = this; |
| 22778 |
|
| 22779 |
// check object-style dispatch |
| 22780 |
var ref = unifyObjectStyle(_type, _payload); |
| 22781 |
var type = ref.type; |
| 22782 |
var payload = ref.payload; |
| 22783 |
|
| 22784 |
var action = { type: type, payload: payload }; |
| 22785 |
var entry = this._actions[type]; |
| 22786 |
if (!entry) { |
| 22787 |
if ((true)) { |
| 22788 |
console.error(("[vuex] unknown action type: " + type)); |
| 22789 |
} |
| 22790 |
return |
| 22791 |
} |
| 22792 |
|
| 22793 |
try { |
| 22794 |
this._actionSubscribers |
| 22795 |
.slice() // shallow copy to prevent iterator invalidation if subscriber synchronously calls unsubscribe |
| 22796 |
.filter(function (sub) { return sub.before; }) |
| 22797 |
.forEach(function (sub) { return sub.before(action, this$1.state); }); |
| 22798 |
} catch (e) { |
| 22799 |
if ((true)) { |
| 22800 |
console.warn("[vuex] error in before action subscribers: "); |
| 22801 |
console.error(e); |
| 22802 |
} |
| 22803 |
} |
| 22804 |
|
| 22805 |
var result = entry.length > 1 |
| 22806 |
? Promise.all(entry.map(function (handler) { return handler(payload); })) |
| 22807 |
: entry[0](payload); |
| 22808 |
|
| 22809 |
return new Promise(function (resolve, reject) { |
| 22810 |
result.then(function (res) { |
| 22811 |
try { |
| 22812 |
this$1._actionSubscribers |
| 22813 |
.filter(function (sub) { return sub.after; }) |
| 22814 |
.forEach(function (sub) { return sub.after(action, this$1.state); }); |
| 22815 |
} catch (e) { |
| 22816 |
if ((true)) { |
| 22817 |
console.warn("[vuex] error in after action subscribers: "); |
| 22818 |
console.error(e); |
| 22819 |
} |
| 22820 |
} |
| 22821 |
resolve(res); |
| 22822 |
}, function (error) { |
| 22823 |
try { |
| 22824 |
this$1._actionSubscribers |
| 22825 |
.filter(function (sub) { return sub.error; }) |
| 22826 |
.forEach(function (sub) { return sub.error(action, this$1.state, error); }); |
| 22827 |
} catch (e) { |
| 22828 |
if ((true)) { |
| 22829 |
console.warn("[vuex] error in error action subscribers: "); |
| 22830 |
console.error(e); |
| 22831 |
} |
| 22832 |
} |
| 22833 |
reject(error); |
| 22834 |
}); |
| 22835 |
}) |
| 22836 |
}; |
| 22837 |
|
| 22838 |
Store.prototype.subscribe = function subscribe (fn, options) { |
| 22839 |
return genericSubscribe(fn, this._subscribers, options) |
| 22840 |
}; |
| 22841 |
|
| 22842 |
Store.prototype.subscribeAction = function subscribeAction (fn, options) { |
| 22843 |
var subs = typeof fn === 'function' ? { before: fn } : fn; |
| 22844 |
return genericSubscribe(subs, this._actionSubscribers, options) |
| 22845 |
}; |
| 22846 |
|
| 22847 |
Store.prototype.watch = function watch (getter, cb, options) { |
| 22848 |
var this$1 = this; |
| 22849 |
|
| 22850 |
if ((true)) { |
| 22851 |
assert(typeof getter === 'function', "store.watch only accepts a function."); |
| 22852 |
} |
| 22853 |
return this._watcherVM.$watch(function () { return getter(this$1.state, this$1.getters); }, cb, options) |
| 22854 |
}; |
| 22855 |
|
| 22856 |
Store.prototype.replaceState = function replaceState (state) { |
| 22857 |
var this$1 = this; |
| 22858 |
|
| 22859 |
this._withCommit(function () { |
| 22860 |
this$1._vm._data.$$state = state; |
| 22861 |
}); |
| 22862 |
}; |
| 22863 |
|
| 22864 |
Store.prototype.registerModule = function registerModule (path, rawModule, options) { |
| 22865 |
if ( options === void 0 ) options = {}; |
| 22866 |
|
| 22867 |
if (typeof path === 'string') { path = [path]; } |
| 22868 |
|
| 22869 |
if ((true)) { |
| 22870 |
assert(Array.isArray(path), "module path must be a string or an Array."); |
| 22871 |
assert(path.length > 0, 'cannot register the root module by using registerModule.'); |
| 22872 |
} |
| 22873 |
|
| 22874 |
this._modules.register(path, rawModule); |
| 22875 |
installModule(this, this.state, path, this._modules.get(path), options.preserveState); |
| 22876 |
// reset store to update getters... |
| 22877 |
resetStoreVM(this, this.state); |
| 22878 |
}; |
| 22879 |
|
| 22880 |
Store.prototype.unregisterModule = function unregisterModule (path) { |
| 22881 |
var this$1 = this; |
| 22882 |
|
| 22883 |
if (typeof path === 'string') { path = [path]; } |
| 22884 |
|
| 22885 |
if ((true)) { |
| 22886 |
assert(Array.isArray(path), "module path must be a string or an Array."); |
| 22887 |
} |
| 22888 |
|
| 22889 |
this._modules.unregister(path); |
| 22890 |
this._withCommit(function () { |
| 22891 |
var parentState = getNestedState(this$1.state, path.slice(0, -1)); |
| 22892 |
Vue.delete(parentState, path[path.length - 1]); |
| 22893 |
}); |
| 22894 |
resetStore(this); |
| 22895 |
}; |
| 22896 |
|
| 22897 |
Store.prototype.hasModule = function hasModule (path) { |
| 22898 |
if (typeof path === 'string') { path = [path]; } |
| 22899 |
|
| 22900 |
if ((true)) { |
| 22901 |
assert(Array.isArray(path), "module path must be a string or an Array."); |
| 22902 |
} |
| 22903 |
|
| 22904 |
return this._modules.isRegistered(path) |
| 22905 |
}; |
| 22906 |
|
| 22907 |
Store.prototype.hotUpdate = function hotUpdate (newOptions) { |
| 22908 |
this._modules.update(newOptions); |
| 22909 |
resetStore(this, true); |
| 22910 |
}; |
| 22911 |
|
| 22912 |
Store.prototype._withCommit = function _withCommit (fn) { |
| 22913 |
var committing = this._committing; |
| 22914 |
this._committing = true; |
| 22915 |
fn(); |
| 22916 |
this._committing = committing; |
| 22917 |
}; |
| 22918 |
|
| 22919 |
Object.defineProperties( Store.prototype, prototypeAccessors$1 ); |
| 22920 |
|
| 22921 |
function genericSubscribe (fn, subs, options) { |
| 22922 |
if (subs.indexOf(fn) < 0) { |
| 22923 |
options && options.prepend |
| 22924 |
? subs.unshift(fn) |
| 22925 |
: subs.push(fn); |
| 22926 |
} |
| 22927 |
return function () { |
| 22928 |
var i = subs.indexOf(fn); |
| 22929 |
if (i > -1) { |
| 22930 |
subs.splice(i, 1); |
| 22931 |
} |
| 22932 |
} |
| 22933 |
} |
| 22934 |
|
| 22935 |
function resetStore (store, hot) { |
| 22936 |
store._actions = Object.create(null); |
| 22937 |
store._mutations = Object.create(null); |
| 22938 |
store._wrappedGetters = Object.create(null); |
| 22939 |
store._modulesNamespaceMap = Object.create(null); |
| 22940 |
var state = store.state; |
| 22941 |
// init all modules |
| 22942 |
installModule(store, state, [], store._modules.root, true); |
| 22943 |
// reset vm |
| 22944 |
resetStoreVM(store, state, hot); |
| 22945 |
} |
| 22946 |
|
| 22947 |
function resetStoreVM (store, state, hot) { |
| 22948 |
var oldVm = store._vm; |
| 22949 |
|
| 22950 |
// bind store public getters |
| 22951 |
store.getters = {}; |
| 22952 |
// reset local getters cache |
| 22953 |
store._makeLocalGettersCache = Object.create(null); |
| 22954 |
var wrappedGetters = store._wrappedGetters; |
| 22955 |
var computed = {}; |
| 22956 |
forEachValue(wrappedGetters, function (fn, key) { |
| 22957 |
// use computed to leverage its lazy-caching mechanism |
| 22958 |
// direct inline function use will lead to closure preserving oldVm. |
| 22959 |
// using partial to return function with only arguments preserved in closure environment. |
| 22960 |
computed[key] = partial(fn, store); |
| 22961 |
Object.defineProperty(store.getters, key, { |
| 22962 |
get: function () { return store._vm[key]; }, |
| 22963 |
enumerable: true // for local getters |
| 22964 |
}); |
| 22965 |
}); |
| 22966 |
|
| 22967 |
// use a Vue instance to store the state tree |
| 22968 |
// suppress warnings just in case the user has added |
| 22969 |
// some funky global mixins |
| 22970 |
var silent = Vue.config.silent; |
| 22971 |
Vue.config.silent = true; |
| 22972 |
store._vm = new Vue({ |
| 22973 |
data: { |
| 22974 |
$$state: state |
| 22975 |
}, |
| 22976 |
computed: computed |
| 22977 |
}); |
| 22978 |
Vue.config.silent = silent; |
| 22979 |
|
| 22980 |
// enable strict mode for new vm |
| 22981 |
if (store.strict) { |
| 22982 |
enableStrictMode(store); |
| 22983 |
} |
| 22984 |
|
| 22985 |
if (oldVm) { |
| 22986 |
if (hot) { |
| 22987 |
// dispatch changes in all subscribed watchers |
| 22988 |
// to force getter re-evaluation for hot reloading. |
| 22989 |
store._withCommit(function () { |
| 22990 |
oldVm._data.$$state = null; |
| 22991 |
}); |
| 22992 |
} |
| 22993 |
Vue.nextTick(function () { return oldVm.$destroy(); }); |
| 22994 |
} |
| 22995 |
} |
| 22996 |
|
| 22997 |
function installModule (store, rootState, path, module, hot) { |
| 22998 |
var isRoot = !path.length; |
| 22999 |
var namespace = store._modules.getNamespace(path); |
| 23000 |
|
| 23001 |
// register in namespace map |
| 23002 |
if (module.namespaced) { |
| 23003 |
if (store._modulesNamespaceMap[namespace] && ("development" !== 'production')) { |
| 23004 |
console.error(("[vuex] duplicate namespace " + namespace + " for the namespaced module " + (path.join('/')))); |
| 23005 |
} |
| 23006 |
store._modulesNamespaceMap[namespace] = module; |
| 23007 |
} |
| 23008 |
|
| 23009 |
// set state |
| 23010 |
if (!isRoot && !hot) { |
| 23011 |
var parentState = getNestedState(rootState, path.slice(0, -1)); |
| 23012 |
var moduleName = path[path.length - 1]; |
| 23013 |
store._withCommit(function () { |
| 23014 |
if ((true)) { |
| 23015 |
if (moduleName in parentState) { |
| 23016 |
console.warn( |
| 23017 |
("[vuex] state field \"" + moduleName + "\" was overridden by a module with the same name at \"" + (path.join('.')) + "\"") |
| 23018 |
); |
| 23019 |
} |
| 23020 |
} |
| 23021 |
Vue.set(parentState, moduleName, module.state); |
| 23022 |
}); |
| 23023 |
} |
| 23024 |
|
| 23025 |
var local = module.context = makeLocalContext(store, namespace, path); |
| 23026 |
|
| 23027 |
module.forEachMutation(function (mutation, key) { |
| 23028 |
var namespacedType = namespace + key; |
| 23029 |
registerMutation(store, namespacedType, mutation, local); |
| 23030 |
}); |
| 23031 |
|
| 23032 |
module.forEachAction(function (action, key) { |
| 23033 |
var type = action.root ? key : namespace + key; |
| 23034 |
var handler = action.handler || action; |
| 23035 |
registerAction(store, type, handler, local); |
| 23036 |
}); |
| 23037 |
|
| 23038 |
module.forEachGetter(function (getter, key) { |
| 23039 |
var namespacedType = namespace + key; |
| 23040 |
registerGetter(store, namespacedType, getter, local); |
| 23041 |
}); |
| 23042 |
|
| 23043 |
module.forEachChild(function (child, key) { |
| 23044 |
installModule(store, rootState, path.concat(key), child, hot); |
| 23045 |
}); |
| 23046 |
} |
| 23047 |
|
| 23048 |
/** |
| 23049 |
* make localized dispatch, commit, getters and state |
| 23050 |
* if there is no namespace, just use root ones |
| 23051 |
*/ |
| 23052 |
function makeLocalContext (store, namespace, path) { |
| 23053 |
var noNamespace = namespace === ''; |
| 23054 |
|
| 23055 |
var local = { |
| 23056 |
dispatch: noNamespace ? store.dispatch : function (_type, _payload, _options) { |
| 23057 |
var args = unifyObjectStyle(_type, _payload, _options); |
| 23058 |
var payload = args.payload; |
| 23059 |
var options = args.options; |
| 23060 |
var type = args.type; |
| 23061 |
|
| 23062 |
if (!options || !options.root) { |
| 23063 |
type = namespace + type; |
| 23064 |
if (( true) && !store._actions[type]) { |
| 23065 |
console.error(("[vuex] unknown local action type: " + (args.type) + ", global type: " + type)); |
| 23066 |
return |
| 23067 |
} |
| 23068 |
} |
| 23069 |
|
| 23070 |
return store.dispatch(type, payload) |
| 23071 |
}, |
| 23072 |
|
| 23073 |
commit: noNamespace ? store.commit : function (_type, _payload, _options) { |
| 23074 |
var args = unifyObjectStyle(_type, _payload, _options); |
| 23075 |
var payload = args.payload; |
| 23076 |
var options = args.options; |
| 23077 |
var type = args.type; |
| 23078 |
|
| 23079 |
if (!options || !options.root) { |
| 23080 |
type = namespace + type; |
| 23081 |
if (( true) && !store._mutations[type]) { |
| 23082 |
console.error(("[vuex] unknown local mutation type: " + (args.type) + ", global type: " + type)); |
| 23083 |
return |
| 23084 |
} |
| 23085 |
} |
| 23086 |
|
| 23087 |
store.commit(type, payload, options); |
| 23088 |
} |
| 23089 |
}; |
| 23090 |
|
| 23091 |
// getters and state object must be gotten lazily |
| 23092 |
// because they will be changed by vm update |
| 23093 |
Object.defineProperties(local, { |
| 23094 |
getters: { |
| 23095 |
get: noNamespace |
| 23096 |
? function () { return store.getters; } |
| 23097 |
: function () { return makeLocalGetters(store, namespace); } |
| 23098 |
}, |
| 23099 |
state: { |
| 23100 |
get: function () { return getNestedState(store.state, path); } |
| 23101 |
} |
| 23102 |
}); |
| 23103 |
|
| 23104 |
return local |
| 23105 |
} |
| 23106 |
|
| 23107 |
function makeLocalGetters (store, namespace) { |
| 23108 |
if (!store._makeLocalGettersCache[namespace]) { |
| 23109 |
var gettersProxy = {}; |
| 23110 |
var splitPos = namespace.length; |
| 23111 |
Object.keys(store.getters).forEach(function (type) { |
| 23112 |
// skip if the target getter is not match this namespace |
| 23113 |
if (type.slice(0, splitPos) !== namespace) { return } |
| 23114 |
|
| 23115 |
// extract local getter type |
| 23116 |
var localType = type.slice(splitPos); |
| 23117 |
|
| 23118 |
// Add a port to the getters proxy. |
| 23119 |
// Define as getter property because |
| 23120 |
// we do not want to evaluate the getters in this time. |
| 23121 |
Object.defineProperty(gettersProxy, localType, { |
| 23122 |
get: function () { return store.getters[type]; }, |
| 23123 |
enumerable: true |
| 23124 |
}); |
| 23125 |
}); |
| 23126 |
store._makeLocalGettersCache[namespace] = gettersProxy; |
| 23127 |
} |
| 23128 |
|
| 23129 |
return store._makeLocalGettersCache[namespace] |
| 23130 |
} |
| 23131 |
|
| 23132 |
function registerMutation (store, type, handler, local) { |
| 23133 |
var entry = store._mutations[type] || (store._mutations[type] = []); |
| 23134 |
entry.push(function wrappedMutationHandler (payload) { |
| 23135 |
handler.call(store, local.state, payload); |
| 23136 |
}); |
| 23137 |
} |
| 23138 |
|
| 23139 |
function registerAction (store, type, handler, local) { |
| 23140 |
var entry = store._actions[type] || (store._actions[type] = []); |
| 23141 |
entry.push(function wrappedActionHandler (payload) { |
| 23142 |
var res = handler.call(store, { |
| 23143 |
dispatch: local.dispatch, |
| 23144 |
commit: local.commit, |
| 23145 |
getters: local.getters, |
| 23146 |
state: local.state, |
| 23147 |
rootGetters: store.getters, |
| 23148 |
rootState: store.state |
| 23149 |
}, payload); |
| 23150 |
if (!isPromise(res)) { |
| 23151 |
res = Promise.resolve(res); |
| 23152 |
} |
| 23153 |
if (store._devtoolHook) { |
| 23154 |
return res.catch(function (err) { |
| 23155 |
store._devtoolHook.emit('vuex:error', err); |
| 23156 |
throw err |
| 23157 |
}) |
| 23158 |
} else { |
| 23159 |
return res |
| 23160 |
} |
| 23161 |
}); |
| 23162 |
} |
| 23163 |
|
| 23164 |
function registerGetter (store, type, rawGetter, local) { |
| 23165 |
if (store._wrappedGetters[type]) { |
| 23166 |
if ((true)) { |
| 23167 |
console.error(("[vuex] duplicate getter key: " + type)); |
| 23168 |
} |
| 23169 |
return |
| 23170 |
} |
| 23171 |
store._wrappedGetters[type] = function wrappedGetter (store) { |
| 23172 |
return rawGetter( |
| 23173 |
local.state, // local state |
| 23174 |
local.getters, // local getters |
| 23175 |
store.state, // root state |
| 23176 |
store.getters // root getters |
| 23177 |
) |
| 23178 |
}; |
| 23179 |
} |
| 23180 |
|
| 23181 |
function enableStrictMode (store) { |
| 23182 |
store._vm.$watch(function () { return this._data.$$state }, function () { |
| 23183 |
if ((true)) { |
| 23184 |
assert(store._committing, "do not mutate vuex store state outside mutation handlers."); |
| 23185 |
} |
| 23186 |
}, { deep: true, sync: true }); |
| 23187 |
} |
| 23188 |
|
| 23189 |
function getNestedState (state, path) { |
| 23190 |
return path.reduce(function (state, key) { return state[key]; }, state) |
| 23191 |
} |
| 23192 |
|
| 23193 |
function unifyObjectStyle (type, payload, options) { |
| 23194 |
if (isObject(type) && type.type) { |
| 23195 |
options = payload; |
| 23196 |
payload = type; |
| 23197 |
type = type.type; |
| 23198 |
} |
| 23199 |
|
| 23200 |
if ((true)) { |
| 23201 |
assert(typeof type === 'string', ("expects string as the type, but found " + (typeof type) + ".")); |
| 23202 |
} |
| 23203 |
|
| 23204 |
return { type: type, payload: payload, options: options } |
| 23205 |
} |
| 23206 |
|
| 23207 |
function install (_Vue) { |
| 23208 |
if (Vue && _Vue === Vue) { |
| 23209 |
if ((true)) { |
| 23210 |
console.error( |
| 23211 |
'[vuex] already installed. Vue.use(Vuex) should be called only once.' |
| 23212 |
); |
| 23213 |
} |
| 23214 |
return |
| 23215 |
} |
| 23216 |
Vue = _Vue; |
| 23217 |
applyMixin(Vue); |
| 23218 |
} |
| 23219 |
|
| 23220 |
/** |
| 23221 |
* Reduce the code which written in Vue.js for getting the state. |
| 23222 |
* @param {String} [namespace] - Module's namespace |
| 23223 |
* @param {Object|Array} states # Object's item can be a function which accept state and getters for param, you can do something for state and getters in it. |
| 23224 |
* @param {Object} |
| 23225 |
*/ |
| 23226 |
var mapState = normalizeNamespace(function (namespace, states) { |
| 23227 |
var res = {}; |
| 23228 |
if (( true) && !isValidMap(states)) { |
| 23229 |
console.error('[vuex] mapState: mapper parameter must be either an Array or an Object'); |
| 23230 |
} |
| 23231 |
normalizeMap(states).forEach(function (ref) { |
| 23232 |
var key = ref.key; |
| 23233 |
var val = ref.val; |
| 23234 |
|
| 23235 |
res[key] = function mappedState () { |
| 23236 |
var state = this.$store.state; |
| 23237 |
var getters = this.$store.getters; |
| 23238 |
if (namespace) { |
| 23239 |
var module = getModuleByNamespace(this.$store, 'mapState', namespace); |
| 23240 |
if (!module) { |
| 23241 |
return |
| 23242 |
} |
| 23243 |
state = module.context.state; |
| 23244 |
getters = module.context.getters; |
| 23245 |
} |
| 23246 |
return typeof val === 'function' |
| 23247 |
? val.call(this, state, getters) |
| 23248 |
: state[val] |
| 23249 |
}; |
| 23250 |
// mark vuex getter for devtools |
| 23251 |
res[key].vuex = true; |
| 23252 |
}); |
| 23253 |
return res |
| 23254 |
}); |
| 23255 |
|
| 23256 |
/** |
| 23257 |
* Reduce the code which written in Vue.js for committing the mutation |
| 23258 |
* @param {String} [namespace] - Module's namespace |
| 23259 |
* @param {Object|Array} mutations # Object's item can be a function which accept `commit` function as the first param, it can accept another params. You can commit mutation and do any other things in this function. specially, You need to pass anthor params from the mapped function. |
| 23260 |
* @return {Object} |
| 23261 |
*/ |
| 23262 |
var mapMutations = normalizeNamespace(function (namespace, mutations) { |
| 23263 |
var res = {}; |
| 23264 |
if (( true) && !isValidMap(mutations)) { |
| 23265 |
console.error('[vuex] mapMutations: mapper parameter must be either an Array or an Object'); |
| 23266 |
} |
| 23267 |
normalizeMap(mutations).forEach(function (ref) { |
| 23268 |
var key = ref.key; |
| 23269 |
var val = ref.val; |
| 23270 |
|
| 23271 |
res[key] = function mappedMutation () { |
| 23272 |
var args = [], len = arguments.length; |
| 23273 |
while ( len-- ) args[ len ] = arguments[ len ]; |
| 23274 |
|
| 23275 |
// Get the commit method from store |
| 23276 |
var commit = this.$store.commit; |
| 23277 |
if (namespace) { |
| 23278 |
var module = getModuleByNamespace(this.$store, 'mapMutations', namespace); |
| 23279 |
if (!module) { |
| 23280 |
return |
| 23281 |
} |
| 23282 |
commit = module.context.commit; |
| 23283 |
} |
| 23284 |
return typeof val === 'function' |
| 23285 |
? val.apply(this, [commit].concat(args)) |
| 23286 |
: commit.apply(this.$store, [val].concat(args)) |
| 23287 |
}; |
| 23288 |
}); |
| 23289 |
return res |
| 23290 |
}); |
| 23291 |
|
| 23292 |
/** |
| 23293 |
* Reduce the code which written in Vue.js for getting the getters |
| 23294 |
* @param {String} [namespace] - Module's namespace |
| 23295 |
* @param {Object|Array} getters |
| 23296 |
* @return {Object} |
| 23297 |
*/ |
| 23298 |
var mapGetters = normalizeNamespace(function (namespace, getters) { |
| 23299 |
var res = {}; |
| 23300 |
if (( true) && !isValidMap(getters)) { |
| 23301 |
console.error('[vuex] mapGetters: mapper parameter must be either an Array or an Object'); |
| 23302 |
} |
| 23303 |
normalizeMap(getters).forEach(function (ref) { |
| 23304 |
var key = ref.key; |
| 23305 |
var val = ref.val; |
| 23306 |
|
| 23307 |
// The namespace has been mutated by normalizeNamespace |
| 23308 |
val = namespace + val; |
| 23309 |
res[key] = function mappedGetter () { |
| 23310 |
if (namespace && !getModuleByNamespace(this.$store, 'mapGetters', namespace)) { |
| 23311 |
return |
| 23312 |
} |
| 23313 |
if (( true) && !(val in this.$store.getters)) { |
| 23314 |
console.error(("[vuex] unknown getter: " + val)); |
| 23315 |
return |
| 23316 |
} |
| 23317 |
return this.$store.getters[val] |
| 23318 |
}; |
| 23319 |
// mark vuex getter for devtools |
| 23320 |
res[key].vuex = true; |
| 23321 |
}); |
| 23322 |
return res |
| 23323 |
}); |
| 23324 |
|
| 23325 |
/** |
| 23326 |
* Reduce the code which written in Vue.js for dispatch the action |
| 23327 |
* @param {String} [namespace] - Module's namespace |
| 23328 |
* @param {Object|Array} actions # Object's item can be a function which accept `dispatch` function as the first param, it can accept anthor params. You can dispatch action and do any other things in this function. specially, You need to pass anthor params from the mapped function. |
| 23329 |
* @return {Object} |
| 23330 |
*/ |
| 23331 |
var mapActions = normalizeNamespace(function (namespace, actions) { |
| 23332 |
var res = {}; |
| 23333 |
if (( true) && !isValidMap(actions)) { |
| 23334 |
console.error('[vuex] mapActions: mapper parameter must be either an Array or an Object'); |
| 23335 |
} |
| 23336 |
normalizeMap(actions).forEach(function (ref) { |
| 23337 |
var key = ref.key; |
| 23338 |
var val = ref.val; |
| 23339 |
|
| 23340 |
res[key] = function mappedAction () { |
| 23341 |
var args = [], len = arguments.length; |
| 23342 |
while ( len-- ) args[ len ] = arguments[ len ]; |
| 23343 |
|
| 23344 |
// get dispatch function from store |
| 23345 |
var dispatch = this.$store.dispatch; |
| 23346 |
if (namespace) { |
| 23347 |
var module = getModuleByNamespace(this.$store, 'mapActions', namespace); |
| 23348 |
if (!module) { |
| 23349 |
return |
| 23350 |
} |
| 23351 |
dispatch = module.context.dispatch; |
| 23352 |
} |
| 23353 |
return typeof val === 'function' |
| 23354 |
? val.apply(this, [dispatch].concat(args)) |
| 23355 |
: dispatch.apply(this.$store, [val].concat(args)) |
| 23356 |
}; |
| 23357 |
}); |
| 23358 |
return res |
| 23359 |
}); |
| 23360 |
|
| 23361 |
/** |
| 23362 |
* Rebinding namespace param for mapXXX function in special scoped, and return them by simple object |
| 23363 |
* @param {String} namespace |
| 23364 |
* @return {Object} |
| 23365 |
*/ |
| 23366 |
var createNamespacedHelpers = function (namespace) { return ({ |
| 23367 |
mapState: mapState.bind(null, namespace), |
| 23368 |
mapGetters: mapGetters.bind(null, namespace), |
| 23369 |
mapMutations: mapMutations.bind(null, namespace), |
| 23370 |
mapActions: mapActions.bind(null, namespace) |
| 23371 |
}); }; |
| 23372 |
|
| 23373 |
/** |
| 23374 |
* Normalize the map |
| 23375 |
* normalizeMap([1, 2, 3]) => [ { key: 1, val: 1 }, { key: 2, val: 2 }, { key: 3, val: 3 } ] |
| 23376 |
* normalizeMap({a: 1, b: 2, c: 3}) => [ { key: 'a', val: 1 }, { key: 'b', val: 2 }, { key: 'c', val: 3 } ] |
| 23377 |
* @param {Array|Object} map |
| 23378 |
* @return {Object} |
| 23379 |
*/ |
| 23380 |
function normalizeMap (map) { |
| 23381 |
if (!isValidMap(map)) { |
| 23382 |
return [] |
| 23383 |
} |
| 23384 |
return Array.isArray(map) |
| 23385 |
? map.map(function (key) { return ({ key: key, val: key }); }) |
| 23386 |
: Object.keys(map).map(function (key) { return ({ key: key, val: map[key] }); }) |
| 23387 |
} |
| 23388 |
|
| 23389 |
/** |
| 23390 |
* Validate whether given map is valid or not |
| 23391 |
* @param {*} map |
| 23392 |
* @return {Boolean} |
| 23393 |
*/ |
| 23394 |
function isValidMap (map) { |
| 23395 |
return Array.isArray(map) || isObject(map) |
| 23396 |
} |
| 23397 |
|
| 23398 |
/** |
| 23399 |
* Return a function expect two param contains namespace and map. it will normalize the namespace and then the param's function will handle the new namespace and the map. |
| 23400 |
* @param {Function} fn |
| 23401 |
* @return {Function} |
| 23402 |
*/ |
| 23403 |
function normalizeNamespace (fn) { |
| 23404 |
return function (namespace, map) { |
| 23405 |
if (typeof namespace !== 'string') { |
| 23406 |
map = namespace; |
| 23407 |
namespace = ''; |
| 23408 |
} else if (namespace.charAt(namespace.length - 1) !== '/') { |
| 23409 |
namespace += '/'; |
| 23410 |
} |
| 23411 |
return fn(namespace, map) |
| 23412 |
} |
| 23413 |
} |
| 23414 |
|
| 23415 |
/** |
| 23416 |
* Search a special module from store by namespace. if module not exist, print error message. |
| 23417 |
* @param {Object} store |
| 23418 |
* @param {String} helper |
| 23419 |
* @param {String} namespace |
| 23420 |
* @return {Object} |
| 23421 |
*/ |
| 23422 |
function getModuleByNamespace (store, helper, namespace) { |
| 23423 |
var module = store._modulesNamespaceMap[namespace]; |
| 23424 |
if (( true) && !module) { |
| 23425 |
console.error(("[vuex] module namespace not found in " + helper + "(): " + namespace)); |
| 23426 |
} |
| 23427 |
return module |
| 23428 |
} |
| 23429 |
|
| 23430 |
// Credits: borrowed code from fcomb/redux-logger |
| 23431 |
|
| 23432 |
function createLogger (ref) { |
| 23433 |
if ( ref === void 0 ) ref = {}; |
| 23434 |
var collapsed = ref.collapsed; if ( collapsed === void 0 ) collapsed = true; |
| 23435 |
var filter = ref.filter; if ( filter === void 0 ) filter = function (mutation, stateBefore, stateAfter) { return true; }; |
| 23436 |
var transformer = ref.transformer; if ( transformer === void 0 ) transformer = function (state) { return state; }; |
| 23437 |
var mutationTransformer = ref.mutationTransformer; if ( mutationTransformer === void 0 ) mutationTransformer = function (mut) { return mut; }; |
| 23438 |
var actionFilter = ref.actionFilter; if ( actionFilter === void 0 ) actionFilter = function (action, state) { return true; }; |
| 23439 |
var actionTransformer = ref.actionTransformer; if ( actionTransformer === void 0 ) actionTransformer = function (act) { return act; }; |
| 23440 |
var logMutations = ref.logMutations; if ( logMutations === void 0 ) logMutations = true; |
| 23441 |
var logActions = ref.logActions; if ( logActions === void 0 ) logActions = true; |
| 23442 |
var logger = ref.logger; if ( logger === void 0 ) logger = console; |
| 23443 |
|
| 23444 |
return function (store) { |
| 23445 |
var prevState = deepCopy(store.state); |
| 23446 |
|
| 23447 |
if (typeof logger === 'undefined') { |
| 23448 |
return |
| 23449 |
} |
| 23450 |
|
| 23451 |
if (logMutations) { |
| 23452 |
store.subscribe(function (mutation, state) { |
| 23453 |
var nextState = deepCopy(state); |
| 23454 |
|
| 23455 |
if (filter(mutation, prevState, nextState)) { |
| 23456 |
var formattedTime = getFormattedTime(); |
| 23457 |
var formattedMutation = mutationTransformer(mutation); |
| 23458 |
var message = "mutation " + (mutation.type) + formattedTime; |
| 23459 |
|
| 23460 |
startMessage(logger, message, collapsed); |
| 23461 |
logger.log('%c prev state', 'color: #9E9E9E; font-weight: bold', transformer(prevState)); |
| 23462 |
logger.log('%c mutation', 'color: #03A9F4; font-weight: bold', formattedMutation); |
| 23463 |
logger.log('%c next state', 'color: #4CAF50; font-weight: bold', transformer(nextState)); |
| 23464 |
endMessage(logger); |
| 23465 |
} |
| 23466 |
|
| 23467 |
prevState = nextState; |
| 23468 |
}); |
| 23469 |
} |
| 23470 |
|
| 23471 |
if (logActions) { |
| 23472 |
store.subscribeAction(function (action, state) { |
| 23473 |
if (actionFilter(action, state)) { |
| 23474 |
var formattedTime = getFormattedTime(); |
| 23475 |
var formattedAction = actionTransformer(action); |
| 23476 |
var message = "action " + (action.type) + formattedTime; |
| 23477 |
|
| 23478 |
startMessage(logger, message, collapsed); |
| 23479 |
logger.log('%c action', 'color: #03A9F4; font-weight: bold', formattedAction); |
| 23480 |
endMessage(logger); |
| 23481 |
} |
| 23482 |
}); |
| 23483 |
} |
| 23484 |
} |
| 23485 |
} |
| 23486 |
|
| 23487 |
function startMessage (logger, message, collapsed) { |
| 23488 |
var startMessage = collapsed |
| 23489 |
? logger.groupCollapsed |
| 23490 |
: logger.group; |
| 23491 |
|
| 23492 |
// render |
| 23493 |
try { |
| 23494 |
startMessage.call(logger, message); |
| 23495 |
} catch (e) { |
| 23496 |
logger.log(message); |
| 23497 |
} |
| 23498 |
} |
| 23499 |
|
| 23500 |
function endMessage (logger) { |
| 23501 |
try { |
| 23502 |
logger.groupEnd(); |
| 23503 |
} catch (e) { |
| 23504 |
logger.log('—— log end ——'); |
| 23505 |
} |
| 23506 |
} |
| 23507 |
|
| 23508 |
function getFormattedTime () { |
| 23509 |
var time = new Date(); |
| 23510 |
return (" @ " + (pad(time.getHours(), 2)) + ":" + (pad(time.getMinutes(), 2)) + ":" + (pad(time.getSeconds(), 2)) + "." + (pad(time.getMilliseconds(), 3))) |
| 23511 |
} |
| 23512 |
|
| 23513 |
function repeat (str, times) { |
| 23514 |
return (new Array(times + 1)).join(str) |
| 23515 |
} |
| 23516 |
|
| 23517 |
function pad (num, maxLength) { |
| 23518 |
return repeat('0', maxLength - num.toString().length) + num |
| 23519 |
} |
| 23520 |
|
| 23521 |
var index = { |
| 23522 |
Store: Store, |
| 23523 |
install: install, |
| 23524 |
version: '3.6.2', |
| 23525 |
mapState: mapState, |
| 23526 |
mapMutations: mapMutations, |
| 23527 |
mapGetters: mapGetters, |
| 23528 |
mapActions: mapActions, |
| 23529 |
createNamespacedHelpers: createNamespacedHelpers, |
| 23530 |
createLogger: createLogger |
| 23531 |
}; |
| 23532 |
|
| 23533 |
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (index); |
| 23534 |
|
| 23535 |
|
| 23536 |
|
| 23537 |
/***/ }), |
| 23538 |
|
| 23539 |
/***/ "./node_modules/@babel/runtime/helpers/regeneratorRuntime.js": |
| 23540 |
/*!*******************************************************************!*\ |
| 23541 |
!*** ./node_modules/@babel/runtime/helpers/regeneratorRuntime.js ***! |
| 23542 |
\*******************************************************************/ |
| 23543 |
/***/ ((module, __unused_webpack_exports, __webpack_require__) => { |
| 23544 |
|
| 23545 |
var _typeof = (__webpack_require__(/*! ./typeof.js */ "./node_modules/@babel/runtime/helpers/typeof.js")["default"]); |
| 23546 |
|
| 23547 |
function _regeneratorRuntime() { |
| 23548 |
"use strict"; |
| 23549 |
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ |
| 23550 |
|
| 23551 |
module.exports = _regeneratorRuntime = function _regeneratorRuntime() { |
| 23552 |
return exports; |
| 23553 |
}, module.exports.__esModule = true, module.exports["default"] = module.exports; |
| 23554 |
var exports = {}, |
| 23555 |
Op = Object.prototype, |
| 23556 |
hasOwn = Op.hasOwnProperty, |
| 23557 |
$Symbol = "function" == typeof Symbol ? Symbol : {}, |
| 23558 |
iteratorSymbol = $Symbol.iterator || "@@iterator", |
| 23559 |
asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", |
| 23560 |
toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; |
| 23561 |
|
| 23562 |
function define(obj, key, value) { |
| 23563 |
return Object.defineProperty(obj, key, { |
| 23564 |
value: value, |
| 23565 |
enumerable: !0, |
| 23566 |
configurable: !0, |
| 23567 |
writable: !0 |
| 23568 |
}), obj[key]; |
| 23569 |
} |
| 23570 |
|
| 23571 |
try { |
| 23572 |
define({}, ""); |
| 23573 |
} catch (err) { |
| 23574 |
define = function define(obj, key, value) { |
| 23575 |
return obj[key] = value; |
| 23576 |
}; |
| 23577 |
} |
| 23578 |
|
| 23579 |
function wrap(innerFn, outerFn, self, tryLocsList) { |
| 23580 |
var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, |
| 23581 |
generator = Object.create(protoGenerator.prototype), |
| 23582 |
context = new Context(tryLocsList || []); |
| 23583 |
return generator._invoke = function (innerFn, self, context) { |
| 23584 |
var state = "suspendedStart"; |
| 23585 |
return function (method, arg) { |
| 23586 |
if ("executing" === state) throw new Error("Generator is already running"); |
| 23587 |
|
| 23588 |
if ("completed" === state) { |
| 23589 |
if ("throw" === method) throw arg; |
| 23590 |
return doneResult(); |
| 23591 |
} |
| 23592 |
|
| 23593 |
for (context.method = method, context.arg = arg;;) { |
| 23594 |
var delegate = context.delegate; |
| 23595 |
|
| 23596 |
if (delegate) { |
| 23597 |
var delegateResult = maybeInvokeDelegate(delegate, context); |
| 23598 |
|
| 23599 |
if (delegateResult) { |
| 23600 |
if (delegateResult === ContinueSentinel) continue; |
| 23601 |
return delegateResult; |
| 23602 |
} |
| 23603 |
} |
| 23604 |
|
| 23605 |
if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { |
| 23606 |
if ("suspendedStart" === state) throw state = "completed", context.arg; |
| 23607 |
context.dispatchException(context.arg); |
| 23608 |
} else "return" === context.method && context.abrupt("return", context.arg); |
| 23609 |
state = "executing"; |
| 23610 |
var record = tryCatch(innerFn, self, context); |
| 23611 |
|
| 23612 |
if ("normal" === record.type) { |
| 23613 |
if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; |
| 23614 |
return { |
| 23615 |
value: record.arg, |
| 23616 |
done: context.done |
| 23617 |
}; |
| 23618 |
} |
| 23619 |
|
| 23620 |
"throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); |
| 23621 |
} |
| 23622 |
}; |
| 23623 |
}(innerFn, self, context), generator; |
| 23624 |
} |
| 23625 |
|
| 23626 |
function tryCatch(fn, obj, arg) { |
| 23627 |
try { |
| 23628 |
return { |
| 23629 |
type: "normal", |
| 23630 |
arg: fn.call(obj, arg) |
| 23631 |
}; |
| 23632 |
} catch (err) { |
| 23633 |
return { |
| 23634 |
type: "throw", |
| 23635 |
arg: err |
| 23636 |
}; |
| 23637 |
} |
| 23638 |
} |
| 23639 |
|
| 23640 |
exports.wrap = wrap; |
| 23641 |
var ContinueSentinel = {}; |
| 23642 |
|
| 23643 |
function Generator() {} |
| 23644 |
|
| 23645 |
function GeneratorFunction() {} |
| 23646 |
|
| 23647 |
function GeneratorFunctionPrototype() {} |
| 23648 |
|
| 23649 |
var IteratorPrototype = {}; |
| 23650 |
define(IteratorPrototype, iteratorSymbol, function () { |
| 23651 |
return this; |
| 23652 |
}); |
| 23653 |
var getProto = Object.getPrototypeOf, |
| 23654 |
NativeIteratorPrototype = getProto && getProto(getProto(values([]))); |
| 23655 |
NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); |
| 23656 |
var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); |
| 23657 |
|
| 23658 |
function defineIteratorMethods(prototype) { |
| 23659 |
["next", "throw", "return"].forEach(function (method) { |
| 23660 |
define(prototype, method, function (arg) { |
| 23661 |
return this._invoke(method, arg); |
| 23662 |
}); |
| 23663 |
}); |
| 23664 |
} |
| 23665 |
|
| 23666 |
function AsyncIterator(generator, PromiseImpl) { |
| 23667 |
function invoke(method, arg, resolve, reject) { |
| 23668 |
var record = tryCatch(generator[method], generator, arg); |
| 23669 |
|
| 23670 |
if ("throw" !== record.type) { |
| 23671 |
var result = record.arg, |
| 23672 |
value = result.value; |
| 23673 |
return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { |
| 23674 |
invoke("next", value, resolve, reject); |
| 23675 |
}, function (err) { |
| 23676 |
invoke("throw", err, resolve, reject); |
| 23677 |
}) : PromiseImpl.resolve(value).then(function (unwrapped) { |
| 23678 |
result.value = unwrapped, resolve(result); |
| 23679 |
}, function (error) { |
| 23680 |
return invoke("throw", error, resolve, reject); |
| 23681 |
}); |
| 23682 |
} |
| 23683 |
|
| 23684 |
reject(record.arg); |
| 23685 |
} |
| 23686 |
|
| 23687 |
var previousPromise; |
| 23688 |
|
| 23689 |
this._invoke = function (method, arg) { |
| 23690 |
function callInvokeWithMethodAndArg() { |
| 23691 |
return new PromiseImpl(function (resolve, reject) { |
| 23692 |
invoke(method, arg, resolve, reject); |
| 23693 |
}); |
| 23694 |
} |
| 23695 |
|
| 23696 |
return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); |
| 23697 |
}; |
| 23698 |
} |
| 23699 |
|
| 23700 |
function maybeInvokeDelegate(delegate, context) { |
| 23701 |
var method = delegate.iterator[context.method]; |
| 23702 |
|
| 23703 |
if (undefined === method) { |
| 23704 |
if (context.delegate = null, "throw" === context.method) { |
| 23705 |
if (delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel; |
| 23706 |
context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method"); |
| 23707 |
} |
| 23708 |
|
| 23709 |
return ContinueSentinel; |
| 23710 |
} |
| 23711 |
|
| 23712 |
var record = tryCatch(method, delegate.iterator, context.arg); |
| 23713 |
if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; |
| 23714 |
var info = record.arg; |
| 23715 |
return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); |
| 23716 |
} |
| 23717 |
|
| 23718 |
function pushTryEntry(locs) { |
| 23719 |
var entry = { |
| 23720 |
tryLoc: locs[0] |
| 23721 |
}; |
| 23722 |
1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); |
| 23723 |
} |
| 23724 |
|
| 23725 |
function resetTryEntry(entry) { |
| 23726 |
var record = entry.completion || {}; |
| 23727 |
record.type = "normal", delete record.arg, entry.completion = record; |
| 23728 |
} |
| 23729 |
|
| 23730 |
function Context(tryLocsList) { |
| 23731 |
this.tryEntries = [{ |
| 23732 |
tryLoc: "root" |
| 23733 |
}], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); |
| 23734 |
} |
| 23735 |
|
| 23736 |
function values(iterable) { |
| 23737 |
if (iterable) { |
| 23738 |
var iteratorMethod = iterable[iteratorSymbol]; |
| 23739 |
if (iteratorMethod) return iteratorMethod.call(iterable); |
| 23740 |
if ("function" == typeof iterable.next) return iterable; |
| 23741 |
|
| 23742 |
if (!isNaN(iterable.length)) { |
| 23743 |
var i = -1, |
| 23744 |
next = function next() { |
| 23745 |
for (; ++i < iterable.length;) { |
| 23746 |
if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; |
| 23747 |
} |
| 23748 |
|
| 23749 |
return next.value = undefined, next.done = !0, next; |
| 23750 |
}; |
| 23751 |
|
| 23752 |
return next.next = next; |
| 23753 |
} |
| 23754 |
} |
| 23755 |
|
| 23756 |
return { |
| 23757 |
next: doneResult |
| 23758 |
}; |
| 23759 |
} |
| 23760 |
|
| 23761 |
function doneResult() { |
| 23762 |
return { |
| 23763 |
value: undefined, |
| 23764 |
done: !0 |
| 23765 |
}; |
| 23766 |
} |
| 23767 |
|
| 23768 |
return GeneratorFunction.prototype = GeneratorFunctionPrototype, define(Gp, "constructor", GeneratorFunctionPrototype), define(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { |
| 23769 |
var ctor = "function" == typeof genFun && genFun.constructor; |
| 23770 |
return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); |
| 23771 |
}, exports.mark = function (genFun) { |
| 23772 |
return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; |
| 23773 |
}, exports.awrap = function (arg) { |
| 23774 |
return { |
| 23775 |
__await: arg |
| 23776 |
}; |
| 23777 |
}, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { |
| 23778 |
return this; |
| 23779 |
}), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { |
| 23780 |
void 0 === PromiseImpl && (PromiseImpl = Promise); |
| 23781 |
var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); |
| 23782 |
return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { |
| 23783 |
return result.done ? result.value : iter.next(); |
| 23784 |
}); |
| 23785 |
}, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { |
| 23786 |
return this; |
| 23787 |
}), define(Gp, "toString", function () { |
| 23788 |
return "[object Generator]"; |
| 23789 |
}), exports.keys = function (object) { |
| 23790 |
var keys = []; |
| 23791 |
|
| 23792 |
for (var key in object) { |
| 23793 |
keys.push(key); |
| 23794 |
} |
| 23795 |
|
| 23796 |
return keys.reverse(), function next() { |
| 23797 |
for (; keys.length;) { |
| 23798 |
var key = keys.pop(); |
| 23799 |
if (key in object) return next.value = key, next.done = !1, next; |
| 23800 |
} |
| 23801 |
|
| 23802 |
return next.done = !0, next; |
| 23803 |
}; |
| 23804 |
}, exports.values = values, Context.prototype = { |
| 23805 |
constructor: Context, |
| 23806 |
reset: function reset(skipTempReset) { |
| 23807 |
if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) { |
| 23808 |
"t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); |
| 23809 |
} |
| 23810 |
}, |
| 23811 |
stop: function stop() { |
| 23812 |
this.done = !0; |
| 23813 |
var rootRecord = this.tryEntries[0].completion; |
| 23814 |
if ("throw" === rootRecord.type) throw rootRecord.arg; |
| 23815 |
return this.rval; |
| 23816 |
}, |
| 23817 |
dispatchException: function dispatchException(exception) { |
| 23818 |
if (this.done) throw exception; |
| 23819 |
var context = this; |
| 23820 |
|
| 23821 |
function handle(loc, caught) { |
| 23822 |
return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; |
| 23823 |
} |
| 23824 |
|
| 23825 |
for (var i = this.tryEntries.length - 1; i >= 0; --i) { |
| 23826 |
var entry = this.tryEntries[i], |
| 23827 |
record = entry.completion; |
| 23828 |
if ("root" === entry.tryLoc) return handle("end"); |
| 23829 |
|
| 23830 |
if (entry.tryLoc <= this.prev) { |
| 23831 |
var hasCatch = hasOwn.call(entry, "catchLoc"), |
| 23832 |
hasFinally = hasOwn.call(entry, "finallyLoc"); |
| 23833 |
|
| 23834 |
if (hasCatch && hasFinally) { |
| 23835 |
if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); |
| 23836 |
if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); |
| 23837 |
} else if (hasCatch) { |
| 23838 |
if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); |
| 23839 |
} else { |
| 23840 |
if (!hasFinally) throw new Error("try statement without catch or finally"); |
| 23841 |
if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); |
| 23842 |
} |
| 23843 |
} |
| 23844 |
} |
| 23845 |
}, |
| 23846 |
abrupt: function abrupt(type, arg) { |
| 23847 |
for (var i = this.tryEntries.length - 1; i >= 0; --i) { |
| 23848 |
var entry = this.tryEntries[i]; |
| 23849 |
|
| 23850 |
if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { |
| 23851 |
var finallyEntry = entry; |
| 23852 |
break; |
| 23853 |
} |
| 23854 |
} |
| 23855 |
|
| 23856 |
finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); |
| 23857 |
var record = finallyEntry ? finallyEntry.completion : {}; |
| 23858 |
return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); |
| 23859 |
}, |
| 23860 |
complete: function complete(record, afterLoc) { |
| 23861 |
if ("throw" === record.type) throw record.arg; |
| 23862 |
return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; |
| 23863 |
}, |
| 23864 |
finish: function finish(finallyLoc) { |
| 23865 |
for (var i = this.tryEntries.length - 1; i >= 0; --i) { |
| 23866 |
var entry = this.tryEntries[i]; |
| 23867 |
if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; |
| 23868 |
} |
| 23869 |
}, |
| 23870 |
"catch": function _catch(tryLoc) { |
| 23871 |
for (var i = this.tryEntries.length - 1; i >= 0; --i) { |
| 23872 |
var entry = this.tryEntries[i]; |
| 23873 |
|
| 23874 |
if (entry.tryLoc === tryLoc) { |
| 23875 |
var record = entry.completion; |
| 23876 |
|
| 23877 |
if ("throw" === record.type) { |
| 23878 |
var thrown = record.arg; |
| 23879 |
resetTryEntry(entry); |
| 23880 |
} |
| 23881 |
|
| 23882 |
return thrown; |
| 23883 |
} |
| 23884 |
} |
| 23885 |
|
| 23886 |
throw new Error("illegal catch attempt"); |
| 23887 |
}, |
| 23888 |
delegateYield: function delegateYield(iterable, resultName, nextLoc) { |
| 23889 |
return this.delegate = { |
| 23890 |
iterator: values(iterable), |
| 23891 |
resultName: resultName, |
| 23892 |
nextLoc: nextLoc |
| 23893 |
}, "next" === this.method && (this.arg = undefined), ContinueSentinel; |
| 23894 |
} |
| 23895 |
}, exports; |
| 23896 |
} |
| 23897 |
|
| 23898 |
module.exports = _regeneratorRuntime, module.exports.__esModule = true, module.exports["default"] = module.exports; |
| 23899 |
|
| 23900 |
/***/ }), |
| 23901 |
|
| 23902 |
/***/ "./node_modules/@babel/runtime/helpers/typeof.js": |
| 23903 |
/*!*******************************************************!*\ |
| 23904 |
!*** ./node_modules/@babel/runtime/helpers/typeof.js ***! |
| 23905 |
\*******************************************************/ |
| 23906 |
/***/ ((module) => { |
| 23907 |
|
| 23908 |
function _typeof(obj) { |
| 23909 |
"@babel/helpers - typeof"; |
| 23910 |
|
| 23911 |
return (module.exports = _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { |
| 23912 |
return typeof obj; |
| 23913 |
} : function (obj) { |
| 23914 |
return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; |
| 23915 |
}, module.exports.__esModule = true, module.exports["default"] = module.exports), _typeof(obj); |
| 23916 |
} |
| 23917 |
|
| 23918 |
module.exports = _typeof, module.exports.__esModule = true, module.exports["default"] = module.exports; |
| 23919 |
|
| 23920 |
/***/ }), |
| 23921 |
|
| 23922 |
/***/ "./node_modules/@babel/runtime/regenerator/index.js": |
| 23923 |
/*!**********************************************************!*\ |
| 23924 |
!*** ./node_modules/@babel/runtime/regenerator/index.js ***! |
| 23925 |
\**********************************************************/ |
| 23926 |
/***/ ((module, __unused_webpack_exports, __webpack_require__) => { |
| 23927 |
|
| 23928 |
// TODO(Babel 8): Remove this file. |
| 23929 |
|
| 23930 |
var runtime = __webpack_require__(/*! ../helpers/regeneratorRuntime */ "./node_modules/@babel/runtime/helpers/regeneratorRuntime.js")(); |
| 23931 |
module.exports = runtime; |
| 23932 |
|
| 23933 |
// Copied from https://github.com/facebook/regenerator/blob/main/packages/runtime/runtime.js#L736= |
| 23934 |
try { |
| 23935 |
regeneratorRuntime = runtime; |
| 23936 |
} catch (accidentalStrictMode) { |
| 23937 |
if (typeof globalThis === "object") { |
| 23938 |
globalThis.regeneratorRuntime = runtime; |
| 23939 |
} else { |
| 23940 |
Function("r", "regeneratorRuntime = r")(runtime); |
| 23941 |
} |
| 23942 |
} |
| 23943 |
|
| 23944 |
|
| 23945 |
/***/ }), |
| 23946 |
|
| 23947 |
/***/ "./node_modules/js-cookie/dist/js.cookie.mjs": |
| 23948 |
/*!***************************************************!*\ |
| 23949 |
!*** ./node_modules/js-cookie/dist/js.cookie.mjs ***! |
| 23950 |
\***************************************************/ |
| 23951 |
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { |
| 23952 |
|
| 23953 |
"use strict"; |
| 23954 |
__webpack_require__.r(__webpack_exports__); |
| 23955 |
/* harmony export */ __webpack_require__.d(__webpack_exports__, { |
| 23956 |
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) |
| 23957 |
/* harmony export */ }); |
| 23958 |
/*! js-cookie v3.0.0 | MIT */ |
| 23959 |
/* eslint-disable no-var */ |
| 23960 |
function assign (target) { |
| 23961 |
for (var i = 1; i < arguments.length; i++) { |
| 23962 |
var source = arguments[i]; |
| 23963 |
for (var key in source) { |
| 23964 |
target[key] = source[key]; |
| 23965 |
} |
| 23966 |
} |
| 23967 |
return target |
| 23968 |
} |
| 23969 |
/* eslint-enable no-var */ |
| 23970 |
|
| 23971 |
/* eslint-disable no-var */ |
| 23972 |
var defaultConverter = { |
| 23973 |
read: function (value) { |
| 23974 |
return value.replace(/(%[\dA-F]{2})+/gi, decodeURIComponent) |
| 23975 |
}, |
| 23976 |
write: function (value) { |
| 23977 |
return encodeURIComponent(value).replace( |
| 23978 |
/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g, |
| 23979 |
decodeURIComponent |
| 23980 |
) |
| 23981 |
} |
| 23982 |
}; |
| 23983 |
/* eslint-enable no-var */ |
| 23984 |
|
| 23985 |
/* eslint-disable no-var */ |
| 23986 |
|
| 23987 |
function init (converter, defaultAttributes) { |
| 23988 |
function set (key, value, attributes) { |
| 23989 |
if (typeof document === 'undefined') { |
| 23990 |
return |
| 23991 |
} |
| 23992 |
|
| 23993 |
attributes = assign({}, defaultAttributes, attributes); |
| 23994 |
|
| 23995 |
if (typeof attributes.expires === 'number') { |
| 23996 |
attributes.expires = new Date(Date.now() + attributes.expires * 864e5); |
| 23997 |
} |
| 23998 |
if (attributes.expires) { |
| 23999 |
attributes.expires = attributes.expires.toUTCString(); |
| 24000 |
} |
| 24001 |
|
| 24002 |
key = encodeURIComponent(key) |
| 24003 |
.replace(/%(2[346B]|5E|60|7C)/g, decodeURIComponent) |
| 24004 |
.replace(/[()]/g, escape); |
| 24005 |
|
| 24006 |
value = converter.write(value, key); |
| 24007 |
|
| 24008 |
var stringifiedAttributes = ''; |
| 24009 |
for (var attributeName in attributes) { |
| 24010 |
if (!attributes[attributeName]) { |
| 24011 |
continue |
| 24012 |
} |
| 24013 |
|
| 24014 |
stringifiedAttributes += '; ' + attributeName; |
| 24015 |
|
| 24016 |
if (attributes[attributeName] === true) { |
| 24017 |
continue |
| 24018 |
} |
| 24019 |
|
| 24020 |
// Considers RFC 6265 section 5.2: |
| 24021 |
// ... |
| 24022 |
// 3. If the remaining unparsed-attributes contains a %x3B (";") |
| 24023 |
// character: |
| 24024 |
// Consume the characters of the unparsed-attributes up to, |
| 24025 |
// not including, the first %x3B (";") character. |
| 24026 |
// ... |
| 24027 |
stringifiedAttributes += '=' + attributes[attributeName].split(';')[0]; |
| 24028 |
} |
| 24029 |
|
| 24030 |
return (document.cookie = key + '=' + value + stringifiedAttributes) |
| 24031 |
} |
| 24032 |
|
| 24033 |
function get (key) { |
| 24034 |
if (typeof document === 'undefined' || (arguments.length && !key)) { |
| 24035 |
return |
| 24036 |
} |
| 24037 |
|
| 24038 |
// To prevent the for loop in the first place assign an empty array |
| 24039 |
// in case there are no cookies at all. |
| 24040 |
var cookies = document.cookie ? document.cookie.split('; ') : []; |
| 24041 |
var jar = {}; |
| 24042 |
for (var i = 0; i < cookies.length; i++) { |
| 24043 |
var parts = cookies[i].split('='); |
| 24044 |
var value = parts.slice(1).join('='); |
| 24045 |
|
| 24046 |
if (value[0] === '"') { |
| 24047 |
value = value.slice(1, -1); |
| 24048 |
} |
| 24049 |
|
| 24050 |
try { |
| 24051 |
var foundKey = defaultConverter.read(parts[0]); |
| 24052 |
jar[foundKey] = converter.read(value, foundKey); |
| 24053 |
|
| 24054 |
if (key === foundKey) { |
| 24055 |
break |
| 24056 |
} |
| 24057 |
} catch (e) {} |
| 24058 |
} |
| 24059 |
|
| 24060 |
return key ? jar[key] : jar |
| 24061 |
} |
| 24062 |
|
| 24063 |
return Object.create( |
| 24064 |
{ |
| 24065 |
set: set, |
| 24066 |
get: get, |
| 24067 |
remove: function (key, attributes) { |
| 24068 |
set( |
| 24069 |
key, |
| 24070 |
'', |
| 24071 |
assign({}, attributes, { |
| 24072 |
expires: -1 |
| 24073 |
}) |
| 24074 |
); |
| 24075 |
}, |
| 24076 |
withAttributes: function (attributes) { |
| 24077 |
return init(this.converter, assign({}, this.attributes, attributes)) |
| 24078 |
}, |
| 24079 |
withConverter: function (converter) { |
| 24080 |
return init(assign({}, this.converter, converter), this.attributes) |
| 24081 |
} |
| 24082 |
}, |
| 24083 |
{ |
| 24084 |
attributes: { value: Object.freeze(defaultAttributes) }, |
| 24085 |
converter: { value: Object.freeze(converter) } |
| 24086 |
} |
| 24087 |
) |
| 24088 |
} |
| 24089 |
|
| 24090 |
var api = init(defaultConverter, { path: '/' }); |
| 24091 |
/* eslint-enable no-var */ |
| 24092 |
|
| 24093 |
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (api); |
| 24094 |
|
| 24095 |
|
| 24096 |
/***/ }) |
| 24097 |
|
| 24098 |
}]); |
| 24099 |
//# sourceMappingURL=vendor.js.map |