tethys/public/backend/publish/editDataset.js
Arno Kaimbacher 43d98a1f82 - edit Dataset before release to editor
- robots.txt avoid search bots
- adapt Dataset.ts and LocationsMap.ts for edit form
- edit createForm for new dataset attributes
- vue-countdown.vue 1800 seconds
2020-06-10 21:09:28 +02:00

502 lines
1.8 MiB
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId]) {
/******/ return installedModules[moduleId].exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ i: moduleId,
/******/ l: false,
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ // Flag the module as loaded
/******/ module.l = true;
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/******/
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/
/******/ // define getter function for harmony exports
/******/ __webpack_require__.d = function(exports, name, getter) {
/******/ if(!__webpack_require__.o(exports, name)) {
/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
/******/ }
/******/ };
/******/
/******/ // define __esModule on exports
/******/ __webpack_require__.r = function(exports) {
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ }
/******/ Object.defineProperty(exports, '__esModule', { value: true });
/******/ };
/******/
/******/ // create a fake namespace object
/******/ // mode & 1: value is a module id, require it
/******/ // mode & 2: merge all properties of value into the ns
/******/ // mode & 4: return value when already ns object
/******/ // mode & 8|1: behave like require
/******/ __webpack_require__.t = function(value, mode) {
/******/ if(mode & 1) value = __webpack_require__(value);
/******/ if(mode & 8) return value;
/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
/******/ var ns = Object.create(null);
/******/ __webpack_require__.r(ns);
/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
/******/ return ns;
/******/ };
/******/
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = function(module) {
/******/ var getter = module && module.__esModule ?
/******/ function getDefault() { return module['default']; } :
/******/ function getModuleExports() { return module; };
/******/ __webpack_require__.d(getter, 'a', getter);
/******/ return getter;
/******/ };
/******/
/******/ // Object.prototype.hasOwnProperty.call
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
/******/
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "/";
/******/
/******/
/******/ // Load entry module and return exports
/******/ return __webpack_require__(__webpack_require__.s = 5);
/******/ })
/************************************************************************/
/******/ ({
/***/ "./node_modules/axios/index.js":
/*!*************************************!*\
!*** ./node_modules/axios/index.js ***!
\*************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
eval("module.exports = __webpack_require__(/*! ./lib/axios */ \"./node_modules/axios/lib/axios.js\");//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvYXhpb3MvaW5kZXguanM/YmMzYSJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxpQkFBaUIsbUJBQU8sQ0FBQyxzREFBYSIsImZpbGUiOiIuL25vZGVfbW9kdWxlcy9heGlvcy9pbmRleC5qcy5qcyIsInNvdXJjZXNDb250ZW50IjpbIm1vZHVsZS5leHBvcnRzID0gcmVxdWlyZSgnLi9saWIvYXhpb3MnKTsiXSwic291cmNlUm9vdCI6IiJ9\n//# sourceURL=webpack-internal:///./node_modules/axios/index.js\n");
/***/ }),
/***/ "./node_modules/axios/lib/adapters/xhr.js":
/*!************************************************!*\
!*** ./node_modules/axios/lib/adapters/xhr.js ***!
\************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
eval("\n\nvar utils = __webpack_require__(/*! ./../utils */ \"./node_modules/axios/lib/utils.js\");\nvar settle = __webpack_require__(/*! ./../core/settle */ \"./node_modules/axios/lib/core/settle.js\");\nvar buildURL = __webpack_require__(/*! ./../helpers/buildURL */ \"./node_modules/axios/lib/helpers/buildURL.js\");\nvar parseHeaders = __webpack_require__(/*! ./../helpers/parseHeaders */ \"./node_modules/axios/lib/helpers/parseHeaders.js\");\nvar isURLSameOrigin = __webpack_require__(/*! ./../helpers/isURLSameOrigin */ \"./node_modules/axios/lib/helpers/isURLSameOrigin.js\");\nvar createError = __webpack_require__(/*! ../core/createError */ \"./node_modules/axios/lib/core/createError.js\");\n\nmodule.exports = function xhrAdapter(config) {\n return new Promise(function dispatchXhrRequest(resolve, reject) {\n var requestData = config.data;\n var requestHeaders = config.headers;\n\n if (utils.isFormData(requestData)) {\n delete requestHeaders['Content-Type']; // Let the browser set it\n }\n\n var request = new XMLHttpRequest();\n\n // HTTP basic authentication\n if (config.auth) {\n var username = config.auth.username || '';\n var password = config.auth.password || '';\n requestHeaders.Authorization = 'Basic ' + btoa(username + ':' + password);\n }\n\n request.open(config.method.toUpperCase(), buildURL(config.url, config.params, config.paramsSerializer), true);\n\n // Set the request timeout in MS\n request.timeout = config.timeout;\n\n // Listen for ready state\n request.onreadystatechange = function handleLoad() {\n if (!request || request.readyState !== 4) {\n return;\n }\n\n // The request errored out and we didn't get a response, this will be\n // handled by onerror instead\n // With one exception: request that using file: protocol, most browsers\n // will return status as 0 even though it's a successful request\n if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf('file:') === 0)) {\n return;\n }\n\n // Prepare the response\n var responseHeaders = 'getAllResponseHeaders' in request ? parseHeaders(request.getAllResponseHeaders()) : null;\n var responseData = !config.responseType || config.responseType === 'text' ? request.responseText : request.response;\n var response = {\n data: responseData,\n status: request.status,\n statusText: request.statusText,\n headers: responseHeaders,\n config: config,\n request: request\n };\n\n settle(resolve, reject, response);\n\n // Clean up request\n request = null;\n };\n\n // Handle browser request cancellation (as opposed to a manual cancellation)\n request.onabort = function handleAbort() {\n if (!request) {\n return;\n }\n\n reject(createError('Request aborted', config, 'ECONNABORTED', request));\n\n // Clean up request\n request = null;\n };\n\n // Handle low level network errors\n request.onerror = function handleError() {\n // Real errors are hidden from us by the browser\n // onerror should only fire if it's a network error\n reject(createError('Network Error', config, null, request));\n\n // Clean up request\n request = null;\n };\n\n // Handle timeout\n request.ontimeout = function handleTimeout() {\n reject(createError('timeout of ' + config.timeout + 'ms exceeded', config, 'ECONNABORTED',\n request));\n\n // Clean up request\n request = null;\n };\n\n // Add xsrf header\n // This is only done if running in a standard browser environment.\n // Specifically not if we're in a web worker, or react-native.\n if (utils.isStandardBrowserEnv()) {\n var cookies = __webpack_require__(/*! ./../helpers/cookies */ \"./node_modules/axios/lib/helpers/cookies.js\");\n\n // Add xsrf header\n var xsrfValue = (config.withCredentials || isURLSameOrigin(config.url)) && config.xsrfCookieName ?\n cookies.read(config.xsrfCookieName) :\n undefined;\n\n if (xsrfValue) {\n requestHeaders[config.xsrfHeaderName] = xsrfValue;\n }\n }\n\n // Add headers to the request\n if ('setRequestHeader' in request) {\n utils.forEach(requestHeaders, function setRequestHeader(val, key) {\n if (typeof requestData === 'undefined' && key.toLowerCase() === 'content-type') {\n // Remove Content-Type if data is undefined\n delete requestHeaders[key];\n } else {\n // Otherwise add header to the request\n request.setRequestHeader(key, val);\n }\n });\n }\n\n // Add withCredentials to request if needed\n if (config.withCredentials) {\n request.withCredentials = true;\n }\n\n // Add responseType to request if needed\n if (config.responseType) {\n try {\n request.responseType = config.responseType;\n } catch (e) {\n // Expected DOMException thrown by browsers not compatible XMLHttpRequest Level 2.\n // But, this can be suppressed for 'json' type as it can be parsed by default 'transformResponse' function.\n if (config.responseType !== 'json') {\n throw e;\n }\n }\n }\n\n // Handle progress if needed\n if (typeof config.onDownloadProgress === 'function') {\n request.addEventListener('progress', config.onDownloadProgress);\n }\n\n // Not all browsers support upload events\n if (typeof config.onUploadProgress === 'function' && request.upload) {\n request.upload.addEventListener('progress', config.onUploadProgress);\n }\n\n if (config.cancelToken) {\n // Handle cancellation\n config.cancelToken.promise.then(function onCanceled(cancel) {\n if (!request) {\n return;\n }\n\n request.abort();\n reject(cancel);\n // Clean up request\n request = null;\n });\n }\n\n if (requestData === undefined) {\n requestData = null;\n }\n\n // Send the request\n request.send(requestData);\n });\n};\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvYXhpb3MvbGliL2FkYXB0ZXJzL3hoci5qcz9iNTBkIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFhOztBQUViLFlBQVksbUJBQU8sQ0FBQyxxREFBWTtBQUNoQyxhQUFhLG1CQUFPLENBQUMsaUVBQWtCO0FBQ3ZDLGVBQWUsbUJBQU8sQ0FBQywyRUFBdUI7QUFDOUMsbUJBQW1CLG1CQUFPLENBQUMsbUZBQTJCO0FBQ3RELHNCQUFzQixtQkFBTyxDQUFDLHlGQUE4QjtBQUM1RCxrQkFBa0IsbUJBQU8sQ0FBQyx5RUFBcUI7O0FBRS9DO0FBQ0E7QUFDQTtBQUNBOztBQUVBO0FBQ0EsNENBQTRDO0FBQzVDOztBQUVBOztBQUVBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTs7QUFFQTs7QUFFQTtBQUNBOztBQUVBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7O0FBRUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQ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bmZpZy5vbkRvd25sb2FkUHJvZ3Jlc3MpO1xuICAgIH1cblxuICAgIC8vIE5vdCBhbGwgYnJvd3NlcnMgc3VwcG9ydCB1cGxvYWQgZXZlbnRzXG4gICAgaWYgKHR5cGVvZiBjb25maWcub25VcGxvYWRQcm9ncmVzcyA9PT0gJ2Z1bmN0aW9uJyAmJiByZXF1ZXN0LnVwbG9hZCkge1xuICAgICAgcmVxdWVzdC51cGxvYWQuYWRkRXZlbnRMaXN0ZW5lcigncHJvZ3Jlc3MnLCBjb25maWcub25VcGxvYWRQcm9ncmVzcyk7XG4gICAgfVxuXG4gICAgaWYgKGNvbmZpZy5jYW5jZWxUb2tlbikge1xuICAgICAgLy8gSGFuZGxlIGNhbmNlbGxhdGlvblxuICAgICAgY29uZmlnLmNhbmNlbFRva2VuLnByb21pc2UudGhlbihmdW5jdGlvbiBvbkNhbmNlbGVkKGNhbmNlbCkge1xuICAgICAgICBpZiAoIXJlcXVlc3QpIHtcbiAgICAgICAgICByZXR1cm47XG4gICAgICAgIH1cblxuICAgICAgICByZXF1ZXN0LmFib3J0KCk7XG4gICAgICAgIHJlamVjdChjYW5jZWwpO1xuICAgICAgICAvLyBDbGVhbiB1cCByZXF1ZXN0XG4gICAgICAgIHJlcXVlc3QgPSBudWxsO1xuICAgICAgfSk7XG4gICAgfVxuXG4gICAgaWYgKHJlcXVlc3REYXRhID09PSB1bmRlZmluZWQpIHtcbiAgICAgIHJlcXVlc3REYXRhID0gbnVsbDtcbiAgICB9XG5cbiAgICAvLyBTZW5kIHRoZSByZXF1ZXN0XG4gICAgcmVxdWVzdC5zZW5kKHJlcXVlc3REYXRhKTtcbiAgfSk7XG59O1xuIl0sInNvdXJjZVJvb3QiOiIifQ==\n//# sourceURL=webpack-internal:///./node_modules/axios/lib/adapters/xhr.js\n");
/***/ }),
/***/ "./node_modules/axios/lib/axios.js":
/*!*****************************************!*\
!*** ./node_modules/axios/lib/axios.js ***!
\*****************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
eval("\n\nvar utils = __webpack_require__(/*! ./utils */ \"./node_modules/axios/lib/utils.js\");\nvar bind = __webpack_require__(/*! ./helpers/bind */ \"./node_modules/axios/lib/helpers/bind.js\");\nvar Axios = __webpack_require__(/*! ./core/Axios */ \"./node_modules/axios/lib/core/Axios.js\");\nvar mergeConfig = __webpack_require__(/*! ./core/mergeConfig */ \"./node_modules/axios/lib/core/mergeConfig.js\");\nvar defaults = __webpack_require__(/*! ./defaults */ \"./node_modules/axios/lib/defaults.js\");\n\n/**\n * Create an instance of Axios\n *\n * @param {Object} defaultConfig The default config for the instance\n * @return {Axios} A new instance of Axios\n */\nfunction createInstance(defaultConfig) {\n var context = new Axios(defaultConfig);\n var instance = bind(Axios.prototype.request, context);\n\n // Copy axios.prototype to instance\n utils.extend(instance, Axios.prototype, context);\n\n // Copy context to instance\n utils.extend(instance, context);\n\n return instance;\n}\n\n// Create the default instance to be exported\nvar axios = createInstance(defaults);\n\n// Expose Axios class to allow class inheritance\naxios.Axios = Axios;\n\n// Factory for creating new instances\naxios.create = function create(instanceConfig) {\n return createInstance(mergeConfig(axios.defaults, instanceConfig));\n};\n\n// Expose Cancel & CancelToken\naxios.Cancel = __webpack_require__(/*! ./cancel/Cancel */ \"./node_modules/axios/lib/cancel/Cancel.js\");\naxios.CancelToken = __webpack_require__(/*! ./cancel/CancelToken */ \"./node_modules/axios/lib/cancel/CancelToken.js\");\naxios.isCancel = __webpack_require__(/*! ./cancel/isCancel */ \"./node_modules/axios/lib/cancel/isCancel.js\");\n\n// Expose all/spread\naxios.all = function all(promises) {\n return Promise.all(promises);\n};\naxios.spread = __webpack_require__(/*! ./helpers/spread */ \"./node_modules/axios/lib/helpers/spread.js\");\n\nmodule.exports = axios;\n\n// Allow use of default import syntax in TypeScript\nmodule.exports.default = axios;\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnB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vbmZpZyhheGlvcy5kZWZhdWx0cywgaW5zdGFuY2VDb25maWcpKTtcbn07XG5cbi8vIEV4cG9zZSBDYW5jZWwgJiBDYW5jZWxUb2tlblxuYXhpb3MuQ2FuY2VsID0gcmVxdWlyZSgnLi9jYW5jZWwvQ2FuY2VsJyk7XG5heGlvcy5DYW5jZWxUb2tlbiA9IHJlcXVpcmUoJy4vY2FuY2VsL0NhbmNlbFRva2VuJyk7XG5heGlvcy5pc0NhbmNlbCA9IHJlcXVpcmUoJy4vY2FuY2VsL2lzQ2FuY2VsJyk7XG5cbi8vIEV4cG9zZSBhbGwvc3ByZWFkXG5heGlvcy5hbGwgPSBmdW5jdGlvbiBhbGwocHJvbWlzZXMpIHtcbiAgcmV0dXJuIFByb21pc2UuYWxsKHByb21pc2VzKTtcbn07XG5heGlvcy5zcHJlYWQgPSByZXF1aXJlKCcuL2hlbHBlcnMvc3ByZWFkJyk7XG5cbm1vZHVsZS5leHBvcnRzID0gYXhpb3M7XG5cbi8vIEFsbG93IHVzZSBvZiBkZWZhdWx0IGltcG9ydCBzeW50YXggaW4gVHlwZVNjcmlwdFxubW9kdWxlLmV4cG9ydHMuZGVmYXVsdCA9IGF4aW9zO1xuIl0sInNvdXJjZVJvb3QiOiIifQ==\n//# sourceURL=webpack-internal:///./node_modules/axios/lib/axios.js\n");
/***/ }),
/***/ "./node_modules/axios/lib/cancel/Cancel.js":
/*!*************************************************!*\
!*** ./node_modules/axios/lib/cancel/Cancel.js ***!
\*************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
eval("\n\n/**\n * A `Cancel` is an object that is thrown when an operation is canceled.\n *\n * @class\n * @param {string=} message The message.\n */\nfunction Cancel(message) {\n this.message = message;\n}\n\nCancel.prototype.toString = function toString() {\n return 'Cancel' + (this.message ? ': ' + this.message : '');\n};\n\nCancel.prototype.__CANCEL__ = true;\n\nmodule.exports = Cancel;\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvYXhpb3MvbGliL2NhbmNlbC9DYW5jZWwuanM/N2E3NyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBYTs7QUFFYjtBQUNBO0FBQ0E7QUFDQTtBQUNBLFdBQVcsUUFBUTtBQUNuQjtBQUNBO0FBQ0E7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7O0FBRUE7O0FBRUEiLCJmaWxlIjoiLi9ub2RlX21vZHVsZXMvYXhpb3MvbGliL2NhbmNlbC9DYW5jZWwuanMuanMiLCJzb3VyY2VzQ29udGVudCI6WyIndXNlIHN0cmljdCc7XG5cbi8qKlxuICogQSBgQ2FuY2VsYCBpcyBhbiBvYmplY3QgdGhhdCBpcyB0aHJvd24gd2hlbiBhbiBvcGVyYXRpb24gaXMgY2FuY2VsZWQuXG4gKlxuICogQGNsYXNzXG4gKiBAcGFyYW0ge3N0cmluZz19IG1lc3NhZ2UgVGhlIG1lc3NhZ2UuXG4gKi9cbmZ1bmN0aW9uIENhbmNlbChtZXNzYWdlKSB7XG4gIHRoaXMubWVzc2FnZSA9IG1lc3NhZ2U7XG59XG5cbkNhbmNlbC5wcm90b3R5cGUudG9TdHJpbmcgPSBmdW5jdGlvbiB0b1N0cmluZygpIHtcbiAgcmV0dXJuICdDYW5jZWwnICsgKHRoaXMubWVzc2FnZSA/ICc6ICcgKyB0aGlzLm1lc3NhZ2UgOiAnJyk7XG59O1xuXG5DYW5jZWwucHJvdG90eXBlLl9fQ0FOQ0VMX18gPSB0cnVlO1xuXG5tb2R1bGUuZXhwb3J0cyA9IENhbmNlbDtcbiJdLCJzb3VyY2VSb290IjoiIn0=\n//# sourceURL=webpack-internal:///./node_modules/axios/lib/cancel/Cancel.js\n");
/***/ }),
/***/ "./node_modules/axios/lib/cancel/CancelToken.js":
/*!******************************************************!*\
!*** ./node_modules/axios/lib/cancel/CancelToken.js ***!
\******************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
eval("\n\nvar Cancel = __webpack_require__(/*! ./Cancel */ \"./node_modules/axios/lib/cancel/Cancel.js\");\n\n/**\n * A `CancelToken` is an object that can be used to request cancellation of an operation.\n *\n * @class\n * @param {Function} executor The executor function.\n */\nfunction CancelToken(executor) {\n if (typeof executor !== 'function') {\n throw new TypeError('executor must be a function.');\n }\n\n var resolvePromise;\n this.promise = new Promise(function promiseExecutor(resolve) {\n resolvePromise = resolve;\n });\n\n var token = this;\n executor(function cancel(message) {\n if (token.reason) {\n // Cancellation has already been requested\n return;\n }\n\n token.reason = new Cancel(message);\n resolvePromise(token.reason);\n });\n}\n\n/**\n * Throws a `Cancel` if cancellation has been requested.\n */\nCancelToken.prototype.throwIfRequested = function throwIfRequested() {\n if (this.reason) {\n throw this.reason;\n }\n};\n\n/**\n * Returns an object that contains a new `CancelToken` and a function that, when called,\n * cancels the `CancelToken`.\n */\nCancelToken.source = function source() {\n var cancel;\n var token = new CancelToken(function executor(c) {\n cancel = c;\n });\n return {\n token: token,\n cancel: cancel\n };\n};\n\nmodule.exports = CancelToken;\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvYXhpb3MvbGliL2NhbmNlbC9DYW5jZWxUb2tlbi5qcz84ZGY0Il0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFhOztBQUViLGFBQWEsbUJBQU8sQ0FBQywyREFBVTs7QUFFL0I7QUFDQTtBQUNBO0FBQ0E7QUFDQSxXQUFXLFNBQVM7QUFDcEI7QUFDQTtBQUNBO0FBQ0E7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7QUFDQSxHQUFHOztBQUVIO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTs7QUFFQTtBQUNBO0FBQ0EsR0FBRztB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GxhdGlvbiBoYXMgYWxyZWFkeSBiZWVuIHJlcXVlc3RlZFxuICAgICAgcmV0dXJuO1xuICAgIH1cblxuICAgIHRva2VuLnJlYXNvbiA9IG5ldyBDYW5jZWwobWVzc2FnZSk7XG4gICAgcmVzb2x2ZVByb21pc2UodG9rZW4ucmVhc29uKTtcbiAgfSk7XG59XG5cbi8qKlxuICogVGhyb3dzIGEgYENhbmNlbGAgaWYgY2FuY2VsbGF0aW9uIGhhcyBiZWVuIHJlcXVlc3RlZC5cbiAqL1xuQ2FuY2VsVG9rZW4ucHJvdG90eXBlLnRocm93SWZSZXF1ZXN0ZWQgPSBmdW5jdGlvbiB0aHJvd0lmUmVxdWVzdGVkKCkge1xuICBpZiAodGhpcy5yZWFzb24pIHtcbiAgICB0aHJvdyB0aGlzLnJlYXNvbjtcbiAgfVxufTtcblxuLyoqXG4gKiBSZXR1cm5zIGFuIG9iamVjdCB0aGF0IGNvbnRhaW5zIGEgbmV3IGBDYW5jZWxUb2tlbmAgYW5kIGEgZnVuY3Rpb24gdGhhdCwgd2hlbiBjYWxsZWQsXG4gKiBjYW5jZWxzIHRoZSBgQ2FuY2VsVG9rZW5gLlxuICovXG5DYW5jZWxUb2tlbi5zb3VyY2UgPSBmdW5jdGlvbiBzb3VyY2UoKSB7XG4gIHZhciBjYW5jZWw7XG4gIHZhciB0b2tlbiA9IG5ldyBDYW5jZWxUb2tlbihmdW5jdGlvbiBleGVjdXRvcihjKSB7XG4gICAgY2FuY2VsID0gYztcbiAgfSk7XG4gIHJldHVybiB7XG4gICAgdG9rZW46IHRva2VuLFxuICAgIGNhbmNlbDogY2FuY2VsXG4gIH07XG59O1xuXG5tb2R1bGUuZXhwb3J0cyA9IENhbmNlbFRva2VuO1xuIl0sInNvdXJjZVJvb3QiOiIifQ==\n//# sourceURL=webpack-internal:///./node_modules/axios/lib/cancel/CancelToken.js\n");
/***/ }),
/***/ "./node_modules/axios/lib/cancel/isCancel.js":
/*!***************************************************!*\
!*** ./node_modules/axios/lib/cancel/isCancel.js ***!
\***************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
eval("\n\nmodule.exports = function isCancel(value) {\n return !!(value && value.__CANCEL__);\n};\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvYXhpb3MvbGliL2NhbmNlbC9pc0NhbmNlbC5qcz8yZTY3Il0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFhOztBQUViO0FBQ0E7QUFDQSIsImZpbGUiOiIuL25vZGVfbW9kdWxlcy9heGlvcy9saWIvY2FuY2VsL2lzQ2FuY2VsLmpzLmpzIiwic291cmNlc0NvbnRlbnQiOlsiJ3VzZSBzdHJpY3QnO1xuXG5tb2R1bGUuZXhwb3J0cyA9IGZ1bmN0aW9uIGlzQ2FuY2VsKHZhbHVlKSB7XG4gIHJldHVybiAhISh2YWx1ZSAmJiB2YWx1ZS5fX0NBTkNFTF9fKTtcbn07XG4iXSwic291cmNlUm9vdCI6IiJ9\n//# sourceURL=webpack-internal:///./node_modules/axios/lib/cancel/isCancel.js\n");
/***/ }),
/***/ "./node_modules/axios/lib/core/Axios.js":
/*!**********************************************!*\
!*** ./node_modules/axios/lib/core/Axios.js ***!
\**********************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
eval("\n\nvar utils = __webpack_require__(/*! ./../utils */ \"./node_modules/axios/lib/utils.js\");\nvar buildURL = __webpack_require__(/*! ../helpers/buildURL */ \"./node_modules/axios/lib/helpers/buildURL.js\");\nvar InterceptorManager = __webpack_require__(/*! ./InterceptorManager */ \"./node_modules/axios/lib/core/InterceptorManager.js\");\nvar dispatchRequest = __webpack_require__(/*! ./dispatchRequest */ \"./node_modules/axios/lib/core/dispatchRequest.js\");\nvar mergeConfig = __webpack_require__(/*! ./mergeConfig */ \"./node_modules/axios/lib/core/mergeConfig.js\");\n\n/**\n * Create a new instance of Axios\n *\n * @param {Object} instanceConfig The default config for the instance\n */\nfunction Axios(instanceConfig) {\n this.defaults = instanceConfig;\n this.interceptors = {\n request: new InterceptorManager(),\n response: new InterceptorManager()\n };\n}\n\n/**\n * Dispatch a request\n *\n * @param {Object} config The config specific for this request (merged with this.defaults)\n */\nAxios.prototype.request = function request(config) {\n /*eslint no-param-reassign:0*/\n // Allow for axios('example/url'[, config]) a la fetch API\n if (typeof config === 'string') {\n config = arguments[1] || {};\n config.url = arguments[0];\n } else {\n config = config || {};\n }\n\n config = mergeConfig(this.defaults, config);\n config.method = config.method ? config.method.toLowerCase() : 'get';\n\n // Hook up interceptors middleware\n var chain = [dispatchRequest, undefined];\n var promise = Promise.resolve(config);\n\n this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) {\n chain.unshift(interceptor.fulfilled, interceptor.rejected);\n });\n\n this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) {\n chain.push(interceptor.fulfilled, interceptor.rejected);\n });\n\n while (chain.length) {\n promise = promise.then(chain.shift(), chain.shift());\n }\n\n return promise;\n};\n\nAxios.prototype.getUri = function getUri(config) {\n config = mergeConfig(this.defaults, config);\n return buildURL(config.url, config.params, config.paramsSerializer).replace(/^\\?/, '');\n};\n\n// Provide aliases for supported request methods\nutils.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) {\n /*eslint func-names:0*/\n Axios.prototype[method] = function(url, config) {\n return this.request(utils.merge(config || {}, {\n method: method,\n url: url\n }));\n };\n});\n\nutils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {\n /*eslint func-names:0*/\n Axios.prototype[method] = function(url, data, config) {\n return this.request(utils.merge(config || {}, {\n method: method,\n url: url,\n data: data\n }));\n };\n});\n\nmodule.exports = Axios;\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8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YXRhOiBkYXRhXG4gICAgfSkpO1xuICB9O1xufSk7XG5cbm1vZHVsZS5leHBvcnRzID0gQXhpb3M7XG4iXSwic291cmNlUm9vdCI6IiJ9\n//# sourceURL=webpack-internal:///./node_modules/axios/lib/core/Axios.js\n");
/***/ }),
/***/ "./node_modules/axios/lib/core/InterceptorManager.js":
/*!***********************************************************!*\
!*** ./node_modules/axios/lib/core/InterceptorManager.js ***!
\***********************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
eval("\n\nvar utils = __webpack_require__(/*! ./../utils */ \"./node_modules/axios/lib/utils.js\");\n\nfunction InterceptorManager() {\n this.handlers = [];\n}\n\n/**\n * Add a new interceptor to the stack\n *\n * @param {Function} fulfilled The function to handle `then` for a `Promise`\n * @param {Function} rejected The function to handle `reject` for a `Promise`\n *\n * @return {Number} An ID used to remove interceptor later\n */\nInterceptorManager.prototype.use = function use(fulfilled, rejected) {\n this.handlers.push({\n fulfilled: fulfilled,\n rejected: rejected\n });\n return this.handlers.length - 1;\n};\n\n/**\n * Remove an interceptor from the stack\n *\n * @param {Number} id The ID that was returned by `use`\n */\nInterceptorManager.prototype.eject = function eject(id) {\n if (this.handlers[id]) {\n this.handlers[id] = null;\n }\n};\n\n/**\n * Iterate over all the registered interceptors\n *\n * This method is particularly useful for skipping over any\n * interceptors that may have become `null` calling `eject`.\n *\n * @param {Function} fn The function to call for each interceptor\n */\nInterceptorManager.prototype.forEach = function forEach(fn) {\n utils.forEach(this.handlers, function forEachHandler(h) {\n if (h !== null) {\n fn(h);\n }\n });\n};\n\nmodule.exports = InterceptorManager;\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvYXhpb3MvbGliL2NvcmUvSW50ZXJjZXB0b3JNYW5hZ2VyLmpzP2Y2YjQiXSwibmFtZXMiOltdLCJtYXBwaW5nc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Y2godGhpcy5oYW5kbGVycywgZnVuY3Rpb24gZm9yRWFjaEhhbmRsZXIoaCkge1xuICAgIGlmIChoICE9PSBudWxsKSB7XG4gICAgICBmbihoKTtcbiAgICB9XG4gIH0pO1xufTtcblxubW9kdWxlLmV4cG9ydHMgPSBJbnRlcmNlcHRvck1hbmFnZXI7XG4iXSwic291cmNlUm9vdCI6IiJ9\n//# sourceURL=webpack-internal:///./node_modules/axios/lib/core/InterceptorManager.js\n");
/***/ }),
/***/ "./node_modules/axios/lib/core/createError.js":
/*!****************************************************!*\
!*** ./node_modules/axios/lib/core/createError.js ***!
\****************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
eval("\n\nvar enhanceError = __webpack_require__(/*! ./enhanceError */ \"./node_modules/axios/lib/core/enhanceError.js\");\n\n/**\n * Create an Error with the specified message, config, error code, request and response.\n *\n * @param {string} message The error message.\n * @param {Object} config The config.\n * @param {string} [code] The error code (for example, 'ECONNABORTED').\n * @param {Object} [request] The request.\n * @param {Object} [response] The response.\n * @returns {Error} The created error.\n */\nmodule.exports = function createError(message, config, code, request, response) {\n var error = new Error(message);\n return enhanceError(error, config, code, request, response);\n};\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvYXhpb3MvbGliL2NvcmUvY3JlYXRlRXJyb3IuanM/MmQ4MyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBYTs7QUFFYixtQkFBbUIsbUJBQU8sQ0FBQyxxRUFBZ0I7O0FBRTNDO0FBQ0E7QUFDQTtBQUNBLFdBQVcsT0FBTztBQUNsQixXQUFXLE9BQU87QUFDbEIsV0FBVyxPQUFPO0FBQ2xCLFdBQVcsT0FBTztBQUNsQixXQUFXLE9BQU87QUFDbEIsYUFBYSxNQUFNO0FBQ25CO0FBQ0E7QUFDQTtBQUNBO0FBQ0EiLCJmaWxlIjoiLi9ub2RlX21vZHVsZXMvYXhpb3MvbGliL2NvcmUvY3JlYXRlRXJyb3IuanMuanMiLCJzb3VyY2VzQ29udGVudCI6WyIndXNlIHN0cmljdCc7XG5cbnZhciBlbmhhbmNlRXJyb3IgPSByZXF1aXJlKCcuL2VuaGFuY2VFcnJvcicpO1xuXG4vKipcbiAqIENyZWF0ZSBhbiBFcnJvciB3aXRoIHRoZSBzcGVjaWZpZWQgbWVzc2FnZSwgY29uZmlnLCBlcnJvciBjb2RlLCByZXF1ZXN0IGFuZCByZXNwb25zZS5cbiAqXG4gKiBAcGFyYW0ge3N0cmluZ30gbWVzc2FnZSBUaGUgZXJyb3IgbWVzc2FnZS5cbiAqIEBwYXJhbSB7T2JqZWN0fSBjb25maWcgVGhlIGNvbmZpZy5cbiAqIEBwYXJhbSB7c3RyaW5nfSBbY29kZV0gVGhlIGVycm9yIGNvZGUgKGZvciBleGFtcGxlLCAnRUNPTk5BQk9SVEVEJykuXG4gKiBAcGFyYW0ge09iamVjdH0gW3JlcXVlc3RdIFRoZSByZXF1ZXN0LlxuICogQHBhcmFtIHtPYmplY3R9IFtyZXNwb25zZV0gVGhlIHJlc3BvbnNlLlxuICogQHJldHVybnMge0Vycm9yfSBUaGUgY3JlYXRlZCBlcnJvci5cbiAqL1xubW9kdWxlLmV4cG9ydHMgPSBmdW5jdGlvbiBjcmVhdGVFcnJvcihtZXNzYWdlLCBjb25maWcsIGNvZGUsIHJlcXVlc3QsIHJlc3BvbnNlKSB7XG4gIHZhciBlcnJvciA9IG5ldyBFcnJvcihtZXNzYWdlKTtcbiAgcmV0dXJuIGVuaGFuY2VFcnJvcihlcnJvciwgY29uZmlnLCBjb2RlLCByZXF1ZXN0LCByZXNwb25zZSk7XG59O1xuIl0sInNvdXJjZVJvb3QiOiIifQ==\n//# sourceURL=webpack-internal:///./node_modules/axios/lib/core/createError.js\n");
/***/ }),
/***/ "./node_modules/axios/lib/core/dispatchRequest.js":
/*!********************************************************!*\
!*** ./node_modules/axios/lib/core/dispatchRequest.js ***!
\********************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
eval("\n\nvar utils = __webpack_require__(/*! ./../utils */ \"./node_modules/axios/lib/utils.js\");\nvar transformData = __webpack_require__(/*! ./transformData */ \"./node_modules/axios/lib/core/transformData.js\");\nvar isCancel = __webpack_require__(/*! ../cancel/isCancel */ \"./node_modules/axios/lib/cancel/isCancel.js\");\nvar defaults = __webpack_require__(/*! ../defaults */ \"./node_modules/axios/lib/defaults.js\");\nvar isAbsoluteURL = __webpack_require__(/*! ./../helpers/isAbsoluteURL */ \"./node_modules/axios/lib/helpers/isAbsoluteURL.js\");\nvar combineURLs = __webpack_require__(/*! ./../helpers/combineURLs */ \"./node_modules/axios/lib/helpers/combineURLs.js\");\n\n/**\n * Throws a `Cancel` if cancellation has been requested.\n */\nfunction throwIfCancellationRequested(config) {\n if (config.cancelToken) {\n config.cancelToken.throwIfRequested();\n }\n}\n\n/**\n * Dispatch a request to the server using the configured adapter.\n *\n * @param {object} config The config that is to be used for the request\n * @returns {Promise} The Promise to be fulfilled\n */\nmodule.exports = function dispatchRequest(config) {\n throwIfCancellationRequested(config);\n\n // Support baseURL config\n if (config.baseURL && !isAbsoluteURL(config.url)) {\n config.url = combineURLs(config.baseURL, config.url);\n }\n\n // Ensure headers exist\n config.headers = config.headers || {};\n\n // Transform request data\n config.data = transformData(\n config.data,\n config.headers,\n config.transformRequest\n );\n\n // Flatten headers\n config.headers = utils.merge(\n config.headers.common || {},\n config.headers[config.method] || {},\n config.headers || {}\n );\n\n utils.forEach(\n ['delete', 'get', 'head', 'post', 'put', 'patch', 'common'],\n function cleanHeaderConfig(method) {\n delete config.headers[method];\n }\n );\n\n var adapter = config.adapter || defaults.adapter;\n\n return adapter(config).then(function onAdapterResolution(response) {\n throwIfCancellationRequested(config);\n\n // Transform response data\n response.data = transformData(\n response.data,\n response.headers,\n config.transformResponse\n );\n\n return response;\n }, function onAdapterRejection(reason) {\n if (!isCancel(reason)) {\n throwIfCancellationRequested(config);\n\n // Transform response data\n if (reason && reason.response) {\n reason.response.data = transformData(\n reason.response.data,\n reason.response.headers,\n config.transformResponse\n );\n }\n }\n\n return Promise.reject(reason);\n });\n};\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvYXhpb3MvbGliL2NvcmUvZGlzcGF0Y2hSZXF1ZXN0LmpzPzUyNzAiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQWE7O0FBRWIsWUFBWSxtQkFBTyxDQUFDLHFEQUFZO0FBQ2hDLG9CQUFvQixtQkFBTyxDQUFDLHVFQUFpQjtBQUM3QyxlQUFlLG1CQUFPLENBQUMsdUVBQW9CO0FBQzNDLGVBQWUsbUJBQU8sQ0FBQyx5REFBYTtBQUNwQyxvQkFBb0IsbUJBQU8sQ0FBQyxxRkFBNEI7QUFDeEQsa0JBQWtCLG1CQUFPLENBQUMsaUZBQTBCOztBQUVwRDtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBOztBQUVBO0FBQ0E7QUFDQTtBQUNBLFdBQVcsT0FBTztBQUNsQixhQUFhLFFBQVE7QUFDckI7QUFDQTtBQUNBOztBQUVBO0FBQ0E7QUFDQTtBQUNBOztBQUVBO0FBQ0E7O0FBRUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBOztBQUVBO0FBQ0E7QUFDQSwrQkFBK0I7QUFDL0IsdUNBQXVDO0FBQ3ZDO0FBQ0E7O0FBRUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBOztBQUVBOztBQUVBO0FBQ0E7O0FBRUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBOztBQUVBO0FBQ0EsR0FBRztBQUNIO0FBQ0E7O0FBRUE7QUFDQTtBQUNB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vZF07XG4gICAgfVxuICApO1xuXG4gIHZhciBhZGFwdGVyID0gY29uZmlnLmFkYXB0ZXIgfHwgZGVmYXVsdHMuYWRhcHRlcjtcblxuICByZXR1cm4gYWRhcHRlcihjb25maWcpLnRoZW4oZnVuY3Rpb24gb25BZGFwdGVyUmVzb2x1dGlvbihyZXNwb25zZSkge1xuICAgIHRocm93SWZDYW5jZWxsYXRpb25SZXF1ZXN0ZWQoY29uZmlnKTtcblxuICAgIC8vIFRyYW5zZm9ybSByZXNwb25zZSBkYXRhXG4gICAgcmVzcG9uc2UuZGF0YSA9IHRyYW5zZm9ybURhdGEoXG4gICAgICByZXNwb25zZS5kYXRhLFxuICAgICAgcmVzcG9uc2UuaGVhZGVycyxcbiAgICAgIGNvbmZpZy50cmFuc2Zvcm1SZXNwb25zZVxuICAgICk7XG5cbiAgICByZXR1cm4gcmVzcG9uc2U7XG4gIH0sIGZ1bmN0aW9uIG9uQWRhcHRlclJlamVjdGlvbihyZWFzb24pIHtcbiAgICBpZiAoIWlzQ2FuY2VsKHJlYXNvbikpIHtcbiAgICAgIHRocm93SWZDYW5jZWxsYXRpb25SZXF1ZXN0ZWQoY29uZmlnKTtcblxuICAgICAgLy8gVHJhbnNmb3JtIHJlc3BvbnNlIGRhdGFcbiAgICAgIGlmIChyZWFzb24gJiYgcmVhc29uLnJlc3BvbnNlKSB7XG4gICAgICAgIHJlYXNvbi5yZXNwb25zZS5kYXRhID0gdHJhbnNmb3JtRGF0YShcbiAgICAgICAgICByZWFzb24ucmVzcG9uc2UuZGF0YSxcbiAgICAgICAgICByZWFzb24ucmVzcG9uc2UuaGVhZGVycyxcbiAgICAgICAgICBjb25maWcudHJhbnNmb3JtUmVzcG9uc2VcbiAgICAgICAgKTtcbiAgICAgIH1cbiAgICB9XG5cbiAgICByZXR1cm4gUHJvbWlzZS5yZWplY3QocmVhc29uKTtcbiAgfSk7XG59O1xuIl0sInNvdXJjZVJvb3QiOiIifQ==\n//# sourceURL=webpack-internal:///./node_modules/axios/lib/core/dispatchRequest.js\n");
/***/ }),
/***/ "./node_modules/axios/lib/core/enhanceError.js":
/*!*****************************************************!*\
!*** ./node_modules/axios/lib/core/enhanceError.js ***!
\*****************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
eval("\n\n/**\n * Update an Error with the specified config, error code, and response.\n *\n * @param {Error} error The error to update.\n * @param {Object} config The config.\n * @param {string} [code] The error code (for example, 'ECONNABORTED').\n * @param {Object} [request] The request.\n * @param {Object} [response] The response.\n * @returns {Error} The error.\n */\nmodule.exports = function enhanceError(error, config, code, request, response) {\n error.config = config;\n if (code) {\n error.code = code;\n }\n\n error.request = request;\n error.response = response;\n error.isAxiosError = true;\n\n error.toJSON = function() {\n return {\n // Standard\n message: this.message,\n name: this.name,\n // Microsoft\n description: this.description,\n number: this.number,\n // Mozilla\n fileName: this.fileName,\n lineNumber: this.lineNumber,\n columnNumber: this.columnNumber,\n stack: this.stack,\n // Axios\n config: this.config,\n code: this.code\n };\n };\n return error;\n};\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvYXhpb3MvbGliL2NvcmUvZW5oYW5jZUVycm9yLmpzPzM4N2YiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQWE7O0FBRWI7QUFDQTtBQUNBO0FBQ0EsV0FBVyxNQUFNO0FBQ2pCLFdBQVcsT0FBTztBQUNsQixXQUFXLE9BQU87QUFDbEIsV0FBVyxPQUFPO0FBQ2xCLFdBQVcsT0FBTztBQUNsQixhQUFhLE1BQU07QUFDbkI7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBOztBQUVBO0FBQ0E7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTt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G1lc3NhZ2U6IHRoaXMubWVzc2FnZSxcbiAgICAgIG5hbWU6IHRoaXMubmFtZSxcbiAgICAgIC8vIE1pY3Jvc29mdFxuICAgICAgZGVzY3JpcHRpb246IHRoaXMuZGVzY3JpcHRpb24sXG4gICAgICBudW1iZXI6IHRoaXMubnVtYmVyLFxuICAgICAgLy8gTW96aWxsYVxuICAgICAgZmlsZU5hbWU6IHRoaXMuZmlsZU5hbWUsXG4gICAgICBsaW5lTnVtYmVyOiB0aGlzLmxpbmVOdW1iZXIsXG4gICAgICBjb2x1bW5OdW1iZXI6IHRoaXMuY29sdW1uTnVtYmVyLFxuICAgICAgc3RhY2s6IHRoaXMuc3RhY2ssXG4gICAgICAvLyBBeGlvc1xuICAgICAgY29uZmlnOiB0aGlzLmNvbmZpZyxcbiAgICAgIGNvZGU6IHRoaXMuY29kZVxuICAgIH07XG4gIH07XG4gIHJldHVybiBlcnJvcjtcbn07XG4iXSwic291cmNlUm9vdCI6IiJ9\n//# sourceURL=webpack-internal:///./node_modules/axios/lib/core/enhanceError.js\n");
/***/ }),
/***/ "./node_modules/axios/lib/core/mergeConfig.js":
/*!****************************************************!*\
!*** ./node_modules/axios/lib/core/mergeConfig.js ***!
\****************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
eval("\n\nvar utils = __webpack_require__(/*! ../utils */ \"./node_modules/axios/lib/utils.js\");\n\n/**\n * Config-specific merge-function which creates a new config-object\n * by merging two configuration objects together.\n *\n * @param {Object} config1\n * @param {Object} config2\n * @returns {Object} New object resulting from merging config2 to config1\n */\nmodule.exports = function mergeConfig(config1, config2) {\n // eslint-disable-next-line no-param-reassign\n config2 = config2 || {};\n var config = {};\n\n utils.forEach(['url', 'method', 'params', 'data'], function valueFromConfig2(prop) {\n if (typeof config2[prop] !== 'undefined') {\n config[prop] = config2[prop];\n }\n });\n\n utils.forEach(['headers', 'auth', 'proxy'], function mergeDeepProperties(prop) {\n if (utils.isObject(config2[prop])) {\n config[prop] = utils.deepMerge(config1[prop], config2[prop]);\n } else if (typeof config2[prop] !== 'undefined') {\n config[prop] = config2[prop];\n } else if (utils.isObject(config1[prop])) {\n config[prop] = utils.deepMerge(config1[prop]);\n } else if (typeof config1[prop] !== 'undefined') {\n config[prop] = config1[prop];\n }\n });\n\n utils.forEach([\n 'baseURL', 'transformRequest', 'transformResponse', 'paramsSerializer',\n 'timeout', 'withCredentials', 'adapter', 'responseType', 'xsrfCookieName',\n 'xsrfHeaderName', 'onUploadProgress', 'onDownloadProgress', 'maxContentLength',\n 'validateStatus', 'maxRedirects', 'httpAgent', 'httpsAgent', 'cancelToken',\n 'socketPath'\n ], function defaultToConfig2(prop) {\n if (typeof config2[prop] !== 'undefined') {\n config[prop] = config2[prop];\n } else if (typeof config1[prop] !== 'undefined') {\n config[prop] = config1[prop];\n }\n });\n\n return config;\n};\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvYXhpb3MvbGliL2NvcmUvbWVyZ2VDb25maWcuanM/NGE3YiJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBYTs7QUFFYixZQUFZLG1CQUFPLENBQUMsbURBQVU7O0FBRTlCO0FBQ0E7QUFDQTtBQUNBO0FBQ0EsV0FBVyxPQUFPO0FBQ2xCLFdBQVcsT0FBTztBQUNsQixhQUFhLE9BQU87QUFDcEI7QUFDQTtBQUNBO0FBQ0E7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7QUFDQTtBQUNBLEdBQUc7O0FBRUg7QUFDQTtBQUNBO0FBQ0EsS0FBSztBQUNMO0FBQ0EsS0FBSztBQUNMO0FBQ0EsS0FBSztBQUNMO0FBQ0E7QUFDQSxHQUFHOztBQUVIO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBLEtBQUs7QUFDT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IGZ1bmN0aW9uIGRlZmF1bHRUb0NvbmZpZzIocHJvcCkge1xuICAgIGlmICh0eXBlb2YgY29uZmlnMltwcm9wXSAhPT0gJ3VuZGVmaW5lZCcpIHtcbiAgICAgIGNvbmZpZ1twcm9wXSA9IGNvbmZpZzJbcHJvcF07XG4gICAgfSBlbHNlIGlmICh0eXBlb2YgY29uZmlnMVtwcm9wXSAhPT0gJ3VuZGVmaW5lZCcpIHtcbiAgICAgIGNvbmZpZ1twcm9wXSA9IGNvbmZpZzFbcHJvcF07XG4gICAgfVxuICB9KTtcblxuICByZXR1cm4gY29uZmlnO1xufTtcbiJdLCJzb3VyY2VSb290IjoiIn0=\n//# sourceURL=webpack-internal:///./node_modules/axios/lib/core/mergeConfig.js\n");
/***/ }),
/***/ "./node_modules/axios/lib/core/settle.js":
/*!***********************************************!*\
!*** ./node_modules/axios/lib/core/settle.js ***!
\***********************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
eval("\n\nvar createError = __webpack_require__(/*! ./createError */ \"./node_modules/axios/lib/core/createError.js\");\n\n/**\n * Resolve or reject a Promise based on response status.\n *\n * @param {Function} resolve A function that resolves the promise.\n * @param {Function} reject A function that rejects the promise.\n * @param {object} response The response.\n */\nmodule.exports = function settle(resolve, reject, response) {\n var validateStatus = response.config.validateStatus;\n if (!validateStatus || validateStatus(response.status)) {\n resolve(response);\n } else {\n reject(createError(\n 'Request failed with status code ' + response.status,\n response.config,\n null,\n response.request,\n response\n ));\n }\n};\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvYXhpb3MvbGliL2NvcmUvc2V0dGxlLmpzPzQ2N2YiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQWE7O0FBRWIsa0JBQWtCLG1CQUFPLENBQUMsbUVBQWU7O0FBRXpDO0FBQ0E7QUFD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HVzIGNvZGUgJyArIHJlc3BvbnNlLnN0YXR1cyxcbiAgICAgIHJlc3BvbnNlLmNvbmZpZyxcbiAgICAgIG51bGwsXG4gICAgICByZXNwb25zZS5yZXF1ZXN0LFxuICAgICAgcmVzcG9uc2VcbiAgICApKTtcbiAgfVxufTtcbiJdLCJzb3VyY2VSb290IjoiIn0=\n//# sourceURL=webpack-internal:///./node_modules/axios/lib/core/settle.js\n");
/***/ }),
/***/ "./node_modules/axios/lib/core/transformData.js":
/*!******************************************************!*\
!*** ./node_modules/axios/lib/core/transformData.js ***!
\******************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
eval("\n\nvar utils = __webpack_require__(/*! ./../utils */ \"./node_modules/axios/lib/utils.js\");\n\n/**\n * Transform the data for a request or a response\n *\n * @param {Object|String} data The data to be transformed\n * @param {Array} headers The headers for the request or response\n * @param {Array|Function} fns A single function or Array of functions\n * @returns {*} The resulting transformed data\n */\nmodule.exports = function transformData(data, headers, fns) {\n /*eslint no-param-reassign:0*/\n utils.forEach(fns, function transform(fn) {\n data = fn(data, headers);\n });\n\n return data;\n};\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvYXhpb3MvbGliL2NvcmUvdHJhbnNmb3JtRGF0YS5qcz9jNDAxIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFhOztBQUViLFlBQVksbUJBQU8sQ0FBQyxxREFBWTs7QUFFaEM7QUFDQTtBQUNBO0FBQ0EsV0FBVyxjQUFjO0FBQ3pCLFdBQVcsTUFBTTtBQUNqQixXQUFXLGVBQWU7QUFDMUIsYUFBYSxFQUFFO0FBQ2Y7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBLEdBQUc7O0FBRUg7QUFDQSIsImZpbGUiOiIuL25vZGVfbW9kdWxlcy9heGlvcy9saWIvY29yZS90cmFuc2Zvcm1EYXRhLmpzLmpzIiwic291cmNlc0NvbnRlbnQiOlsiJ3VzZSBzdHJpY3QnO1xuXG52YXIgdXRpbHMgPSByZXF1aXJlKCcuLy4uL3V0aWxzJyk7XG5cbi8qKlxuICogVHJhbnNmb3JtIHRoZSBkYXRhIGZvciBhIHJlcXVlc3Qgb3IgYSByZXNwb25zZVxuICpcbiAqIEBwYXJhbSB7T2JqZWN0fFN0cmluZ30gZGF0YSBUaGUgZGF0YSB0byBiZSB0cmFuc2Zvcm1lZFxuICogQHBhcmFtIHtBcnJheX0gaGVhZGVycyBUaGUgaGVhZGVycyBmb3IgdGhlIHJlcXVlc3Qgb3IgcmVzcG9uc2VcbiAqIEBwYXJhbSB7QXJyYXl8RnVuY3Rpb259IGZucyBBIHNpbmdsZSBmdW5jdGlvbiBvciBBcnJheSBvZiBmdW5jdGlvbnNcbiAqIEByZXR1cm5zIHsqfSBUaGUgcmVzdWx0aW5nIHRyYW5zZm9ybWVkIGRhdGFcbiAqL1xubW9kdWxlLmV4cG9ydHMgPSBmdW5jdGlvbiB0cmFuc2Zvcm1EYXRhKGRhdGEsIGhlYWRlcnMsIGZucykge1xuICAvKmVzbGludCBuby1wYXJhbS1yZWFzc2lnbjowKi9cbiAgdXRpbHMuZm9yRWFjaChmbnMsIGZ1bmN0aW9uIHRyYW5zZm9ybShmbikge1xuICAgIGRhdGEgPSBmbihkYXRhLCBoZWFkZXJzKTtcbiAgfSk7XG5cbiAgcmV0dXJuIGRhdGE7XG59O1xuIl0sInNvdXJjZVJvb3QiOiIifQ==\n//# sourceURL=webpack-internal:///./node_modules/axios/lib/core/transformData.js\n");
/***/ }),
/***/ "./node_modules/axios/lib/defaults.js":
/*!********************************************!*\
!*** ./node_modules/axios/lib/defaults.js ***!
\********************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
eval("/* WEBPACK VAR INJECTION */(function(process) {\n\nvar utils = __webpack_require__(/*! ./utils */ \"./node_modules/axios/lib/utils.js\");\nvar normalizeHeaderName = __webpack_require__(/*! ./helpers/normalizeHeaderName */ \"./node_modules/axios/lib/helpers/normalizeHeaderName.js\");\n\nvar DEFAULT_CONTENT_TYPE = {\n 'Content-Type': 'application/x-www-form-urlencoded'\n};\n\nfunction setContentTypeIfUnset(headers, value) {\n if (!utils.isUndefined(headers) && utils.isUndefined(headers['Content-Type'])) {\n headers['Content-Type'] = value;\n }\n}\n\nfunction getDefaultAdapter() {\n var adapter;\n // Only Node.JS has a process variable that is of [[Class]] process\n if (typeof process !== 'undefined' && Object.prototype.toString.call(process) === '[object process]') {\n // For node use HTTP adapter\n adapter = __webpack_require__(/*! ./adapters/http */ \"./node_modules/axios/lib/adapters/xhr.js\");\n } else if (typeof XMLHttpRequest !== 'undefined') {\n // For browsers use XHR adapter\n adapter = __webpack_require__(/*! ./adapters/xhr */ \"./node_modules/axios/lib/adapters/xhr.js\");\n }\n return adapter;\n}\n\nvar defaults = {\n adapter: getDefaultAdapter(),\n\n transformRequest: [function transformRequest(data, headers) {\n normalizeHeaderName(headers, 'Accept');\n normalizeHeaderName(headers, 'Content-Type');\n if (utils.isFormData(data) ||\n utils.isArrayBuffer(data) ||\n utils.isBuffer(data) ||\n utils.isStream(data) ||\n utils.isFile(data) ||\n utils.isBlob(data)\n ) {\n return data;\n }\n if (utils.isArrayBufferView(data)) {\n return data.buffer;\n }\n if (utils.isURLSearchParams(data)) {\n setContentTypeIfUnset(headers, 'application/x-www-form-urlencoded;charset=utf-8');\n return data.toString();\n }\n if (utils.isObject(data)) {\n setContentTypeIfUnset(headers, 'application/json;charset=utf-8');\n return JSON.stringify(data);\n }\n return data;\n }],\n\n transformResponse: [function transformResponse(data) {\n /*eslint no-param-reassign:0*/\n if (typeof data === 'string') {\n try {\n data = JSON.parse(data);\n } catch (e) { /* Ignore */ }\n }\n return data;\n }],\n\n /**\n * A timeout in milliseconds to abort a request. If set to 0 (default) a\n * timeout is not created.\n */\n timeout: 0,\n\n xsrfCookieName: 'XSRF-TOKEN',\n xsrfHeaderName: 'X-XSRF-TOKEN',\n\n maxContentLength: -1,\n\n validateStatus: function validateStatus(status) {\n return status >= 200 && status < 300;\n }\n};\n\ndefaults.headers = {\n common: {\n 'Accept': 'application/json, text/plain, */*'\n }\n};\n\nutils.forEach(['delete', 'get', 'head'], function forEachMethodNoData(method) {\n defaults.headers[method] = {};\n});\n\nutils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {\n defaults.headers[method] = utils.merge(DEFAULT_CONTENT_TYPE);\n});\n\nmodule.exports = defaults;\n\n/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../process/browser.js */ \"./node_modules/process/browser.js\")))//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvYXhpb3MvbGliL2RlZmF1bHRzLmpzPzI0NDQiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsK0NBQWE7O0FBRWIsWUFBWSxtQkFBTyxDQUFDLGtEQUFTO0FBQzdCLDBCQUEwQixtQkFBTyxDQUFDLDhGQUErQjs7QUFFakU7QUFDQTtBQUNBOztBQUVBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7O0FBRUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBLGNBQWMsbUJBQU8sQ0FBQyxpRUFBaUI7QUFDdkMsR0FBRztBQUNIO0FBQ0EsY0FBYyxtQkFBTyxDQUFDLGdFQUFnQjtBQUN0QztBQUNBO0FBQ0E7O0FBRUE7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBLHdFQUF3RTtBQUN4RTtBQUNBO0FBQ0E7QUFDQSx1REFBdUQ7QUFDdk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c3JmSGVhZGVyTmFtZTogJ1gtWFNSRi1UT0tFTicsXG5cbiAgbWF4Q29udGVudExlbmd0aDogLTEsXG5cbiAgdmFsaWRhdGVTdGF0dXM6IGZ1bmN0aW9uIHZhbGlkYXRlU3RhdHVzKHN0YXR1cykge1xuICAgIHJldHVybiBzdGF0dXMgPj0gMjAwICYmIHN0YXR1cyA8IDMwMDtcbiAgfVxufTtcblxuZGVmYXVsdHMuaGVhZGVycyA9IHtcbiAgY29tbW9uOiB7XG4gICAgJ0FjY2VwdCc6ICdhcHBsaWNhdGlvbi9qc29uLCB0ZXh0L3BsYWluLCAqLyonXG4gIH1cbn07XG5cbnV0aWxzLmZvckVhY2goWydkZWxldGUnLCAnZ2V0JywgJ2hlYWQnXSwgZnVuY3Rpb24gZm9yRWFjaE1ldGhvZE5vRGF0YShtZXRob2QpIHtcbiAgZGVmYXVsdHMuaGVhZGVyc1ttZXRob2RdID0ge307XG59KTtcblxudXRpbHMuZm9yRWFjaChbJ3Bvc3QnLCAncHV0JywgJ3BhdGNoJ10sIGZ1bmN0aW9uIGZvckVhY2hNZXRob2RXaXRoRGF0YShtZXRob2QpIHtcbiAgZGVmYXVsdHMuaGVhZGVyc1ttZXRob2RdID0gdXRpbHMubWVyZ2UoREVGQVVMVF9DT05URU5UX1RZUEUpO1xufSk7XG5cbm1vZHVsZS5leHBvcnRzID0gZGVmYXVsdHM7XG4iXSwic291cmNlUm9vdCI6IiJ9\n//# sourceURL=webpack-internal:///./node_modules/axios/lib/defaults.js\n");
/***/ }),
/***/ "./node_modules/axios/lib/helpers/bind.js":
/*!************************************************!*\
!*** ./node_modules/axios/lib/helpers/bind.js ***!
\************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
eval("\n\nmodule.exports = function bind(fn, thisArg) {\n return function wrap() {\n var args = new Array(arguments.length);\n for (var i = 0; i < args.length; i++) {\n args[i] = arguments[i];\n }\n return fn.apply(thisArg, args);\n };\n};\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvYXhpb3MvbGliL2hlbHBlcnMvYmluZC5qcz8xZDJiIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFhOztBQUViO0FBQ0E7QUFDQTtBQUNBLG1CQUFtQixpQkFBaUI7QUFDcEM7QUFDQTtBQUNBO0FBQ0E7QUFDQSIsImZpbGUiOiIuL25vZGVfbW9kdWxlcy9heGlvcy9saWIvaGVscGVycy9iaW5kLmpzLmpzIiwic291cmNlc0NvbnRlbnQiOlsiJ3VzZSBzdHJpY3QnO1xuXG5tb2R1bGUuZXhwb3J0cyA9IGZ1bmN0aW9uIGJpbmQoZm4sIHRoaXNBcmcpIHtcbiAgcmV0dXJuIGZ1bmN0aW9uIHdyYXAoKSB7XG4gICAgdmFyIGFyZ3MgPSBuZXcgQXJyYXkoYXJndW1lbnRzLmxlbmd0aCk7XG4gICAgZm9yICh2YXIgaSA9IDA7IGkgPCBhcmdzLmxlbmd0aDsgaSsrKSB7XG4gICAgICBhcmdzW2ldID0gYXJndW1lbnRzW2ldO1xuICAgIH1cbiAgICByZXR1cm4gZm4uYXBwbHkodGhpc0FyZywgYXJncyk7XG4gIH07XG59O1xuIl0sInNvdXJjZVJvb3QiOiIifQ==\n//# sourceURL=webpack-internal:///./node_modules/axios/lib/helpers/bind.js\n");
/***/ }),
/***/ "./node_modules/axios/lib/helpers/buildURL.js":
/*!****************************************************!*\
!*** ./node_modules/axios/lib/helpers/buildURL.js ***!
\****************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
eval("\n\nvar utils = __webpack_require__(/*! ./../utils */ \"./node_modules/axios/lib/utils.js\");\n\nfunction encode(val) {\n return encodeURIComponent(val).\n replace(/%40/gi, '@').\n replace(/%3A/gi, ':').\n replace(/%24/g, '$').\n replace(/%2C/gi, ',').\n replace(/%20/g, '+').\n replace(/%5B/gi, '[').\n replace(/%5D/gi, ']');\n}\n\n/**\n * Build a URL by appending params to the end\n *\n * @param {string} url The base of the url (e.g., http://www.google.com)\n * @param {object} [params] The params to be appended\n * @returns {string} The formatted url\n */\nmodule.exports = function buildURL(url, params, paramsSerializer) {\n /*eslint no-param-reassign:0*/\n if (!params) {\n return url;\n }\n\n var serializedParams;\n if (paramsSerializer) {\n serializedParams = paramsSerializer(params);\n } else if (utils.isURLSearchParams(params)) {\n serializedParams = params.toString();\n } else {\n var parts = [];\n\n utils.forEach(params, function serialize(val, key) {\n if (val === null || typeof val === 'undefined') {\n return;\n }\n\n if (utils.isArray(val)) {\n key = key + '[]';\n } else {\n val = [val];\n }\n\n utils.forEach(val, function parseValue(v) {\n if (utils.isDate(v)) {\n v = v.toISOString();\n } else if (utils.isObject(v)) {\n v = JSON.stringify(v);\n }\n parts.push(encode(key) + '=' + encode(v));\n });\n });\n\n serializedParams = parts.join('&');\n }\n\n if (serializedParams) {\n var hashmarkIndex = url.indexOf('#');\n if (hashmarkIndex !== -1) {\n url = url.slice(0, hashmarkIndex);\n }\n\n url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams;\n }\n\n return url;\n};\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvYXhpb3MvbGliL2hlbHBlcnMvYnVpbGRVUkwuanM/MzBiNSJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBYTs7QUFFYixZQUFZLG1CQUFPLENBQUMscURBQVk7O0FBRWhDO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBOztBQUVBO0FBQ0E7QUFDQTtBQUNBLFdBQVcsT0FBTztBQUNsQixXQUFXLE9BQU87QUFDbEIsYUFBYSxPQUFPO0FBQ3BCO0FBQ0E7QU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YgKHV0aWxzLmlzT2JqZWN0KHYpKSB7XG4gICAgICAgICAgdiA9IEpTT04uc3RyaW5naWZ5KHYpO1xuICAgICAgICB9XG4gICAgICAgIHBhcnRzLnB1c2goZW5jb2RlKGtleSkgKyAnPScgKyBlbmNvZGUodikpO1xuICAgICAgfSk7XG4gICAgfSk7XG5cbiAgICBzZXJpYWxpemVkUGFyYW1zID0gcGFydHMuam9pbignJicpO1xuICB9XG5cbiAgaWYgKHNlcmlhbGl6ZWRQYXJhbXMpIHtcbiAgICB2YXIgaGFzaG1hcmtJbmRleCA9IHVybC5pbmRleE9mKCcjJyk7XG4gICAgaWYgKGhhc2htYXJrSW5kZXggIT09IC0xKSB7XG4gICAgICB1cmwgPSB1cmwuc2xpY2UoMCwgaGFzaG1hcmtJbmRleCk7XG4gICAgfVxuXG4gICAgdXJsICs9ICh1cmwuaW5kZXhPZignPycpID09PSAtMSA/ICc/JyA6ICcmJykgKyBzZXJpYWxpemVkUGFyYW1zO1xuICB9XG5cbiAgcmV0dXJuIHVybDtcbn07XG4iXSwic291cmNlUm9vdCI6IiJ9\n//# sourceURL=webpack-internal:///./node_modules/axios/lib/helpers/buildURL.js\n");
/***/ }),
/***/ "./node_modules/axios/lib/helpers/combineURLs.js":
/*!*******************************************************!*\
!*** ./node_modules/axios/lib/helpers/combineURLs.js ***!
\*******************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
eval("\n\n/**\n * Creates a new URL by combining the specified URLs\n *\n * @param {string} baseURL The base URL\n * @param {string} relativeURL The relative URL\n * @returns {string} The combined URL\n */\nmodule.exports = function combineURLs(baseURL, relativeURL) {\n return relativeURL\n ? baseURL.replace(/\\/+$/, '') + '/' + relativeURL.replace(/^\\/+/, '')\n : baseURL;\n};\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvYXhpb3MvbGliL2hlbHBlcnMvY29tYmluZVVSTHMuanM/ZTY4MyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBYTs7QUFFYjtBQUNBO0FBQ0E7QUFDQSxXQUFXLE9BQU87QUFDbEIsV0FBVyxPQUFPO0FBQ2xCLGFBQWEsT0FBTztBQUNwQjtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0EiLCJmaWxlIjoiLi9ub2RlX21vZHVsZXMvYXhpb3MvbGliL2hlbHBlcnMvY29tYmluZVVSTHMuanMuanMiLCJzb3VyY2VzQ29udGVudCI6WyIndXNlIHN0cmljdCc7XG5cbi8qKlxuICogQ3JlYXRlcyBhIG5ldyBVUkwgYnkgY29tYmluaW5nIHRoZSBzcGVjaWZpZWQgVVJMc1xuICpcbiAqIEBwYXJhbSB7c3RyaW5nfSBiYXNlVVJMIFRoZSBiYXNlIFVSTFxuICogQHBhcmFtIHtzdHJpbmd9IHJlbGF0aXZlVVJMIFRoZSByZWxhdGl2ZSBVUkxcbiAqIEByZXR1cm5zIHtzdHJpbmd9IFRoZSBjb21iaW5lZCBVUkxcbiAqL1xubW9kdWxlLmV4cG9ydHMgPSBmdW5jdGlvbiBjb21iaW5lVVJMcyhiYXNlVVJMLCByZWxhdGl2ZVVSTCkge1xuICByZXR1cm4gcmVsYXRpdmVVUkxcbiAgICA/IGJhc2VVUkwucmVwbGFjZSgvXFwvKyQvLCAnJykgKyAnLycgKyByZWxhdGl2ZVVSTC5yZXBsYWNlKC9eXFwvKy8sICcnKVxuICAgIDogYmFzZVVSTDtcbn07XG4iXSwic291cmNlUm9vdCI6IiJ9\n//# sourceURL=webpack-internal:///./node_modules/axios/lib/helpers/combineURLs.js\n");
/***/ }),
/***/ "./node_modules/axios/lib/helpers/cookies.js":
/*!***************************************************!*\
!*** ./node_modules/axios/lib/helpers/cookies.js ***!
\***************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
eval("\n\nvar utils = __webpack_require__(/*! ./../utils */ \"./node_modules/axios/lib/utils.js\");\n\nmodule.exports = (\n utils.isStandardBrowserEnv() ?\n\n // Standard browser envs support document.cookie\n (function standardBrowserEnv() {\n return {\n write: function write(name, value, expires, path, domain, secure) {\n var cookie = [];\n cookie.push(name + '=' + encodeURIComponent(value));\n\n if (utils.isNumber(expires)) {\n cookie.push('expires=' + new Date(expires).toGMTString());\n }\n\n if (utils.isString(path)) {\n cookie.push('path=' + path);\n }\n\n if (utils.isString(domain)) {\n cookie.push('domain=' + domain);\n }\n\n if (secure === true) {\n cookie.push('secure');\n }\n\n document.cookie = cookie.join('; ');\n },\n\n read: function read(name) {\n var match = document.cookie.match(new RegExp('(^|;\\\\s*)(' + name + ')=([^;]*)'));\n return (match ? decodeURIComponent(match[3]) : null);\n },\n\n remove: function remove(name) {\n this.write(name, '', Date.now() - 86400000);\n }\n };\n })() :\n\n // Non standard browser env (web workers, react-native) lack needed support.\n (function nonStandardBrowserEnv() {\n return {\n write: function write() {},\n read: function read() { return null; },\n remove: function remove() {}\n };\n })()\n);\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvYXhpb3MvbGliL2hlbHBlcnMvY29va2llcy5qcz83YWFjIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFhOztBQUViLFlBQVksbUJBQU8sQ0FBQyxxREFBWTs7QUFFaEM7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7O0FBRUE7QUFDQTtBQUNBOztBQUVBO0FBQ0E7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7O0FBRUE7QUFDQTtBQUNBOztBQUVBLDBDQUEwQztBQUMxQyxTQUFTOztBQUVUO0FBQ0EsNERBQTRELHdCQUF3QjtBQUNwRjtBQUNBLFNBQVM7O0FBRVQ7QUFDQTtBQUNBO0FBQ0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\n//# sourceURL=webpack-internal:///./node_modules/axios/lib/helpers/cookies.js\n");
/***/ }),
/***/ "./node_modules/axios/lib/helpers/isAbsoluteURL.js":
/*!*********************************************************!*\
!*** ./node_modules/axios/lib/helpers/isAbsoluteURL.js ***!
\*********************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
eval("\n\n/**\n * Determines whether the specified URL is absolute\n *\n * @param {string} url The URL to test\n * @returns {boolean} True if the specified URL is absolute, otherwise false\n */\nmodule.exports = function isAbsoluteURL(url) {\n // A URL is considered absolute if it begins with \"<scheme>://\" or \"//\" (protocol-relative URL).\n // RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed\n // by any combination of letters, digits, plus, period, or hyphen.\n return /^([a-z][a-z\\d\\+\\-\\.]*:)?\\/\\//i.test(url);\n};\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvYXhpb3MvbGliL2hlbHBlcnMvaXNBYnNvbHV0ZVVSTC5qcz9kOTI1Il0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFhOztBQUViO0FBQ0E7QUFDQTtBQUNBLFdBQVcsT0FBTztBQUNsQixhQUFhLFFBQVE7QUFDckI7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0EiLCJmaWxlIjoiLi9ub2RlX21vZHVsZXMvYXhpb3MvbGliL2hlbHBlcnMvaXNBYnNvbHV0ZVVSTC5qcy5qcyIsInNvdXJjZXNDb250ZW50IjpbIid1c2Ugc3RyaWN0JztcblxuLyoqXG4gKiBEZXRlcm1pbmVzIHdoZXRoZXIgdGhlIHNwZWNpZmllZCBVUkwgaXMgYWJzb2x1dGVcbiAqXG4gKiBAcGFyYW0ge3N0cmluZ30gdXJsIFRoZSBVUkwgdG8gdGVzdFxuICogQHJldHVybnMge2Jvb2xlYW59IFRydWUgaWYgdGhlIHNwZWNpZmllZCBVUkwgaXMgYWJzb2x1dGUsIG90aGVyd2lzZSBmYWxzZVxuICovXG5tb2R1bGUuZXhwb3J0cyA9IGZ1bmN0aW9uIGlzQWJzb2x1dGVVUkwodXJsKSB7XG4gIC8vIEEgVVJMIGlzIGNvbnNpZGVyZWQgYWJzb2x1dGUgaWYgaXQgYmVnaW5zIHdpdGggXCI8c2NoZW1lPjovL1wiIG9yIFwiLy9cIiAocHJvdG9jb2wtcmVsYXRpdmUgVVJMKS5cbiAgLy8gUkZDIDM5ODYgZGVmaW5lcyBzY2hlbWUgbmFtZSBhcyBhIHNlcXVlbmNlIG9mIGNoYXJhY3RlcnMgYmVnaW5uaW5nIHdpdGggYSBsZXR0ZXIgYW5kIGZvbGxvd2VkXG4gIC8vIGJ5IGFueSBjb21iaW5hdGlvbiBvZiBsZXR0ZXJzLCBkaWdpdHMsIHBsdXMsIHBlcmlvZCwgb3IgaHlwaGVuLlxuICByZXR1cm4gL14oW2Etel1bYS16XFxkXFwrXFwtXFwuXSo6KT9cXC9cXC8vaS50ZXN0KHVybCk7XG59O1xuIl0sInNvdXJjZVJvb3QiOiIifQ==\n//# sourceURL=webpack-internal:///./node_modules/axios/lib/helpers/isAbsoluteURL.js\n");
/***/ }),
/***/ "./node_modules/axios/lib/helpers/isURLSameOrigin.js":
/*!***********************************************************!*\
!*** ./node_modules/axios/lib/helpers/isURLSameOrigin.js ***!
\***********************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
eval("\n\nvar utils = __webpack_require__(/*! ./../utils */ \"./node_modules/axios/lib/utils.js\");\n\nmodule.exports = (\n utils.isStandardBrowserEnv() ?\n\n // Standard browser envs have full support of the APIs needed to test\n // whether the request URL is of the same origin as current location.\n (function standardBrowserEnv() {\n var msie = /(msie|trident)/i.test(navigator.userAgent);\n var urlParsingNode = document.createElement('a');\n var originURL;\n\n /**\n * Parse a URL to discover it's components\n *\n * @param {String} url The URL to be parsed\n * @returns {Object}\n */\n function resolveURL(url) {\n var href = url;\n\n if (msie) {\n // IE needs attribute set twice to normalize properties\n urlParsingNode.setAttribute('href', href);\n href = urlParsingNode.href;\n }\n\n urlParsingNode.setAttribute('href', href);\n\n // urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils\n return {\n href: urlParsingNode.href,\n protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '',\n host: urlParsingNode.host,\n search: urlParsingNode.search ? urlParsingNode.search.replace(/^\\?/, '') : '',\n hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '',\n hostname: urlParsingNode.hostname,\n port: urlParsingNode.port,\n pathname: (urlParsingNode.pathname.charAt(0) === '/') ?\n urlParsingNode.pathname :\n '/' + urlParsingNode.pathname\n };\n }\n\n originURL = resolveURL(window.location.href);\n\n /**\n * Determine if a URL shares the same origin as the current location\n *\n * @param {String} requestURL The URL to test\n * @returns {boolean} True if URL shares the same origin, otherwise false\n */\n return function isURLSameOrigin(requestURL) {\n var parsed = (utils.isString(requestURL)) ? resolveURL(requestURL) : requestURL;\n return (parsed.protocol === originURL.protocol &&\n parsed.host === originURL.host);\n };\n })() :\n\n // Non standard browser envs (web workers, react-native) lack needed support.\n (function nonStandardBrowserEnv() {\n return function isURLSameOrigin() {\n return true;\n };\n })()\n);\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvYXhpb3MvbGliL2hlbHBlcnMvaXNVUkxTYW1lT3JpZ2luLmpzPzM5MzQiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQWE7O0FBRWIsWUFBWSxtQkFBTyxDQUFDLHFEQUFZOztBQUVoQztBQUNBOztBQUVBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7QUFDQSxjQUFjLE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jb2wgJiZcbiAgICAgICAgICAgIHBhcnNlZC5ob3N0ID09PSBvcmlnaW5VUkwuaG9zdCk7XG4gICAgICB9O1xuICAgIH0pKCkgOlxuXG4gIC8vIE5vbiBzdGFuZGFyZCBicm93c2VyIGVudnMgKHdlYiB3b3JrZXJzLCByZWFjdC1uYXRpdmUpIGxhY2sgbmVlZGVkIHN1cHBvcnQuXG4gICAgKGZ1bmN0aW9uIG5vblN0YW5kYXJkQnJvd3NlckVudigpIHtcbiAgICAgIHJldHVybiBmdW5jdGlvbiBpc1VSTFNhbWVPcmlnaW4oKSB7XG4gICAgICAgIHJldHVybiB0cnVlO1xuICAgICAgfTtcbiAgICB9KSgpXG4pO1xuIl0sInNvdXJjZVJvb3QiOiIifQ==\n//# sourceURL=webpack-internal:///./node_modules/axios/lib/helpers/isURLSameOrigin.js\n");
/***/ }),
/***/ "./node_modules/axios/lib/helpers/normalizeHeaderName.js":
/*!***************************************************************!*\
!*** ./node_modules/axios/lib/helpers/normalizeHeaderName.js ***!
\***************************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
eval("\n\nvar utils = __webpack_require__(/*! ../utils */ \"./node_modules/axios/lib/utils.js\");\n\nmodule.exports = function normalizeHeaderName(headers, normalizedName) {\n utils.forEach(headers, function processHeader(value, name) {\n if (name !== normalizedName && name.toUpperCase() === normalizedName.toUpperCase()) {\n headers[normalizedName] = value;\n delete headers[name];\n }\n });\n};\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvYXhpb3MvbGliL2hlbHBlcnMvbm9ybWFsaXplSGVhZGVyTmFtZS5qcz9jOGFmIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFhOztBQUViLFlBQVksbUJBQU8sQ0FBQyxtREFBVTs7QUFFOUI7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0EsR0FBRztBQUNIIiwiZmlsZSI6Ii4vbm9kZV9tb2R1bGVzL2F4aW9zL2xpYi9oZWxwZXJzL25vcm1hbGl6ZUhlYWRlck5hbWUuanMuanMiLCJzb3VyY2VzQ29udGVudCI6WyIndXNlIHN0cmljdCc7XG5cbnZhciB1dGlscyA9IHJlcXVpcmUoJy4uL3V0aWxzJyk7XG5cbm1vZHVsZS5leHBvcnRzID0gZnVuY3Rpb24gbm9ybWFsaXplSGVhZGVyTmFtZShoZWFkZXJzLCBub3JtYWxpemVkTmFtZSkge1xuICB1dGlscy5mb3JFYWNoKGhlYWRlcnMsIGZ1bmN0aW9uIHByb2Nlc3NIZWFkZXIodmFsdWUsIG5hbWUpIHtcbiAgICBpZiAobmFtZSAhPT0gbm9ybWFsaXplZE5hbWUgJiYgbmFtZS50b1VwcGVyQ2FzZSgpID09PSBub3JtYWxpemVkTmFtZS50b1VwcGVyQ2FzZSgpKSB7XG4gICAgICBoZWFkZXJzW25vcm1hbGl6ZWROYW1lXSA9IHZhbHVlO1xuICAgICAgZGVsZXRlIGhlYWRlcnNbbmFtZV07XG4gICAgfVxuICB9KTtcbn07XG4iXSwic291cmNlUm9vdCI6IiJ9\n//# sourceURL=webpack-internal:///./node_modules/axios/lib/helpers/normalizeHeaderName.js\n");
/***/ }),
/***/ "./node_modules/axios/lib/helpers/parseHeaders.js":
/*!********************************************************!*\
!*** ./node_modules/axios/lib/helpers/parseHeaders.js ***!
\********************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
eval("\n\nvar utils = __webpack_require__(/*! ./../utils */ \"./node_modules/axios/lib/utils.js\");\n\n// Headers whose duplicates are ignored by node\n// c.f. https://nodejs.org/api/http.html#http_message_headers\nvar ignoreDuplicateOf = [\n 'age', 'authorization', 'content-length', 'content-type', 'etag',\n 'expires', 'from', 'host', 'if-modified-since', 'if-unmodified-since',\n 'last-modified', 'location', 'max-forwards', 'proxy-authorization',\n 'referer', 'retry-after', 'user-agent'\n];\n\n/**\n * Parse headers into an object\n *\n * ```\n * Date: Wed, 27 Aug 2014 08:58:49 GMT\n * Content-Type: application/json\n * Connection: keep-alive\n * Transfer-Encoding: chunked\n * ```\n *\n * @param {String} headers Headers needing to be parsed\n * @returns {Object} Headers parsed into an object\n */\nmodule.exports = function parseHeaders(headers) {\n var parsed = {};\n var key;\n var val;\n var i;\n\n if (!headers) { return parsed; }\n\n utils.forEach(headers.split('\\n'), function parser(line) {\n i = line.indexOf(':');\n key = utils.trim(line.substr(0, i)).toLowerCase();\n val = utils.trim(line.substr(i + 1));\n\n if (key) {\n if (parsed[key] && ignoreDuplicateOf.indexOf(key) >= 0) {\n return;\n }\n if (key === 'set-cookie') {\n parsed[key] = (parsed[key] ? parsed[key] : []).concat([val]);\n } else {\n parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;\n }\n }\n });\n\n return parsed;\n};\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvYXhpb3MvbGliL2hlbHBlcnMvcGFyc2VIZWFkZXJzLmpzP2MzNDUiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQWE7O0FBRWIsWUFBWSxtQkFBTyxDQUFDLHFEQUFZOztBQUVoQztBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBOztBQUVBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0EsV0FBVyxPQUFPO0FBQ2xCLGFBQWEsT0FBTztBQUNwQjtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7O0FBRUEsaUJBQWlCLGVBQWU7O0FBRWhDO0FBQ0E7QUFDQTtBQUNBOztBQUVBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBLE9BQ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W5nIHRvIGJlIHBhcnNlZFxuICogQHJldHVybnMge09iamVjdH0gSGVhZGVycyBwYXJzZWQgaW50byBhbiBvYmplY3RcbiAqL1xubW9kdWxlLmV4cG9ydHMgPSBmdW5jdGlvbiBwYXJzZUhlYWRlcnMoaGVhZGVycykge1xuICB2YXIgcGFyc2VkID0ge307XG4gIHZhciBrZXk7XG4gIHZhciB2YWw7XG4gIHZhciBpO1xuXG4gIGlmICghaGVhZGVycykgeyByZXR1cm4gcGFyc2VkOyB9XG5cbiAgdXRpbHMuZm9yRWFjaChoZWFkZXJzLnNwbGl0KCdcXG4nKSwgZnVuY3Rpb24gcGFyc2VyKGxpbmUpIHtcbiAgICBpID0gbGluZS5pbmRleE9mKCc6Jyk7XG4gICAga2V5ID0gdXRpbHMudHJpbShsaW5lLnN1YnN0cigwLCBpKSkudG9Mb3dlckNhc2UoKTtcbiAgICB2YWwgPSB1dGlscy50cmltKGxpbmUuc3Vic3RyKGkgKyAxKSk7XG5cbiAgICBpZiAoa2V5KSB7XG4gICAgICBpZiAocGFyc2VkW2tleV0gJiYgaWdub3JlRHVwbGljYXRlT2YuaW5kZXhPZihrZXkpID49IDApIHtcbiAgICAgICAgcmV0dXJuO1xuICAgICAgfVxuICAgICAgaWYgKGtleSA9PT0gJ3NldC1jb29raWUnKSB7XG4gICAgICAgIHBhcnNlZFtrZXldID0gKHBhcnNlZFtrZXldID8gcGFyc2VkW2tleV0gOiBbXSkuY29uY2F0KFt2YWxdKTtcbiAgICAgIH0gZWxzZSB7XG4gICAgICAgIHBhcnNlZFtrZXldID0gcGFyc2VkW2tleV0gPyBwYXJzZWRba2V5XSArICcsICcgKyB2YWwgOiB2YWw7XG4gICAgICB9XG4gICAgfVxuICB9KTtcblxuICByZXR1cm4gcGFyc2VkO1xufTtcbiJdLCJzb3VyY2VSb290IjoiIn0=\n//# sourceURL=webpack-internal:///./node_modules/axios/lib/helpers/parseHeaders.js\n");
/***/ }),
/***/ "./node_modules/axios/lib/helpers/spread.js":
/*!**************************************************!*\
!*** ./node_modules/axios/lib/helpers/spread.js ***!
\**************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
eval("\n\n/**\n * Syntactic sugar for invoking a function and expanding an array for arguments.\n *\n * Common use case would be to use `Function.prototype.apply`.\n *\n * ```js\n * function f(x, y, z) {}\n * var args = [1, 2, 3];\n * f.apply(null, args);\n * ```\n *\n * With `spread` this example can be re-written.\n *\n * ```js\n * spread(function(x, y, z) {})([1, 2, 3]);\n * ```\n *\n * @param {Function} callback\n * @returns {Function}\n */\nmodule.exports = function spread(callback) {\n return function wrap(arr) {\n return callback.apply(null, arr);\n };\n};\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvYXhpb3MvbGliL2hlbHBlcnMvc3ByZWFkLmpzPzBkZjYiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQWE7O0FBRWI7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBLCtCQUErQjtBQUMvQjtBQUNBO0FBQ0EsV0FBVyxTQUFTO0FBQ3BCLGFBQWE7QUFDYjtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0EiLCJmaWxlIjoiLi9ub2RlX21vZHVsZXMvYXhpb3MvbGliL2hlbHBlcnMvc3ByZWFkLmpzLmpzIiwic291cmNlc0NvbnRlbnQiOlsiJ3VzZSBzdHJpY3QnO1xuXG4vKipcbiAqIFN5bnRhY3RpYyBzdWdhciBmb3IgaW52b2tpbmcgYSBmdW5jdGlvbiBhbmQgZXhwYW5kaW5nIGFuIGFycmF5IGZvciBhcmd1bWVudHMuXG4gKlxuICogQ29tbW9uIHVzZSBjYXNlIHdvdWxkIGJlIHRvIHVzZSBgRnVuY3Rpb24ucHJvdG90eXBlLmFwcGx5YC5cbiAqXG4gKiAgYGBganNcbiAqICBmdW5jdGlvbiBmKHgsIHksIHopIHt9XG4gKiAgdmFyIGFyZ3MgPSBbMSwgMiwgM107XG4gKiAgZi5hcHBseShudWxsLCBhcmdzKTtcbiAqICBgYGBcbiAqXG4gKiBXaXRoIGBzcHJlYWRgIHRoaXMgZXhhbXBsZSBjYW4gYmUgcmUtd3JpdHRlbi5cbiAqXG4gKiAgYGBganNcbiAqICBzcHJlYWQoZnVuY3Rpb24oeCwgeSwgeikge30pKFsxLCAyLCAzXSk7XG4gKiAgYGBgXG4gKlxuICogQHBhcmFtIHtGdW5jdGlvbn0gY2FsbGJhY2tcbiAqIEByZXR1cm5zIHtGdW5jdGlvbn1cbiAqL1xubW9kdWxlLmV4cG9ydHMgPSBmdW5jdGlvbiBzcHJlYWQoY2FsbGJhY2spIHtcbiAgcmV0dXJuIGZ1bmN0aW9uIHdyYXAoYXJyKSB7XG4gICAgcmV0dXJuIGNhbGxiYWNrLmFwcGx5KG51bGwsIGFycik7XG4gIH07XG59O1xuIl0sInNvdXJjZVJvb3QiOiIifQ==\n//# sourceURL=webpack-internal:///./node_modules/axios/lib/helpers/spread.js\n");
/***/ }),
/***/ "./node_modules/axios/lib/utils.js":
/*!*****************************************!*\
!*** ./node_modules/axios/lib/utils.js ***!
\*****************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
eval("\n\nvar bind = __webpack_require__(/*! ./helpers/bind */ \"./node_modules/axios/lib/helpers/bind.js\");\nvar isBuffer = __webpack_require__(/*! is-buffer */ \"./node_modules/is-buffer/index.js\");\n\n/*global toString:true*/\n\n// utils is a library of generic helper functions non-specific to axios\n\nvar toString = Object.prototype.toString;\n\n/**\n * Determine if a value is an Array\n *\n * @param {Object} val The value to test\n * @returns {boolean} True if value is an Array, otherwise false\n */\nfunction isArray(val) {\n return toString.call(val) === '[object Array]';\n}\n\n/**\n * Determine if a value is an ArrayBuffer\n *\n * @param {Object} val The value to test\n * @returns {boolean} True if value is an ArrayBuffer, otherwise false\n */\nfunction isArrayBuffer(val) {\n return toString.call(val) === '[object ArrayBuffer]';\n}\n\n/**\n * Determine if a value is a FormData\n *\n * @param {Object} val The value to test\n * @returns {boolean} True if value is an FormData, otherwise false\n */\nfunction isFormData(val) {\n return (typeof FormData !== 'undefined') && (val instanceof FormData);\n}\n\n/**\n * Determine if a value is a view on an ArrayBuffer\n *\n * @param {Object} val The value to test\n * @returns {boolean} True if value is a view on an ArrayBuffer, otherwise false\n */\nfunction isArrayBufferView(val) {\n var result;\n if ((typeof ArrayBuffer !== 'undefined') && (ArrayBuffer.isView)) {\n result = ArrayBuffer.isView(val);\n } else {\n result = (val) && (val.buffer) && (val.buffer instanceof ArrayBuffer);\n }\n return result;\n}\n\n/**\n * Determine if a value is a String\n *\n * @param {Object} val The value to test\n * @returns {boolean} True if value is a String, otherwise false\n */\nfunction isString(val) {\n return typeof val === 'string';\n}\n\n/**\n * Determine if a value is a Number\n *\n * @param {Object} val The value to test\n * @returns {boolean} True if value is a Number, otherwise false\n */\nfunction isNumber(val) {\n return typeof val === 'number';\n}\n\n/**\n * Determine if a value is undefined\n *\n * @param {Object} val The value to test\n * @returns {boolean} True if the value is undefined, otherwise false\n */\nfunction isUndefined(val) {\n return typeof val === 'undefined';\n}\n\n/**\n * Determine if a value is an Object\n *\n * @param {Object} val The value to test\n * @returns {boolean} True if value is an Object, otherwise false\n */\nfunction isObject(val) {\n return val !== null && typeof val === 'object';\n}\n\n/**\n * Determine if a value is a Date\n *\n * @param {Object} val The value to test\n * @returns {boolean} True if value is a Date, otherwise false\n */\nfunction isDate(val) {\n return toString.call(val) === '[object Date]';\n}\n\n/**\n * Determine if a value is a File\n *\n * @param {Object} val The value to test\n * @returns {boolean} True if value is a File, otherwise false\n */\nfunction isFile(val) {\n return toString.call(val) === '[object File]';\n}\n\n/**\n * Determine if a value is a Blob\n *\n * @param {Object} val The value to test\n * @returns {boolean} True if value is a Blob, otherwise false\n */\nfunction isBlob(val) {\n return toString.call(val) === '[object Blob]';\n}\n\n/**\n * Determine if a value is a Function\n *\n * @param {Object} val The value to test\n * @returns {boolean} True if value is a Function, otherwise false\n */\nfunction isFunction(val) {\n return toString.call(val) === '[object Function]';\n}\n\n/**\n * Determine if a value is a Stream\n *\n * @param {Object} val The value to test\n * @returns {boolean} True if value is a Stream, otherwise false\n */\nfunction isStream(val) {\n return isObject(val) && isFunction(val.pipe);\n}\n\n/**\n * Determine if a value is a URLSearchParams object\n *\n * @param {Object} val The value to test\n * @returns {boolean} True if value is a URLSearchParams object, otherwise false\n */\nfunction isURLSearchParams(val) {\n return typeof URLSearchParams !== 'undefined' && val instanceof URLSearchParams;\n}\n\n/**\n * Trim excess whitespace off the beginning and end of a string\n *\n * @param {String} str The String to trim\n * @returns {String} The String freed of excess whitespace\n */\nfunction trim(str) {\n return str.replace(/^\\s*/, '').replace(/\\s*$/, '');\n}\n\n/**\n * Determine if we're running in a standard browser environment\n *\n * This allows axios to run in a web worker, and react-native.\n * Both environments support XMLHttpRequest, but not fully standard globals.\n *\n * web workers:\n * typeof window -> undefined\n * typeof document -> undefined\n *\n * react-native:\n * navigator.product -> 'ReactNative'\n * nativescript\n * navigator.product -> 'NativeScript' or 'NS'\n */\nfunction isStandardBrowserEnv() {\n if (typeof navigator !== 'undefined' && (navigator.product === 'ReactNative' ||\n navigator.product === 'NativeScript' ||\n navigator.product === 'NS')) {\n return false;\n }\n return (\n typeof window !== 'undefined' &&\n typeof document !== 'undefined'\n );\n}\n\n/**\n * Iterate over an Array or an Object invoking a function for each item.\n *\n * If `obj` is an Array callback will be called passing\n * the value, index, and complete array for each item.\n *\n * If 'obj' is an Object callback will be called passing\n * the value, key, and complete object for each property.\n *\n * @param {Object|Array} obj The object to iterate\n * @param {Function} fn The callback to invoke for each item\n */\nfunction forEach(obj, fn) {\n // Don't bother if no value provided\n if (obj === null || typeof obj === 'undefined') {\n return;\n }\n\n // Force an array if not already something iterable\n if (typeof obj !== 'object') {\n /*eslint no-param-reassign:0*/\n obj = [obj];\n }\n\n if (isArray(obj)) {\n // Iterate over array values\n for (var i = 0, l = obj.length; i < l; i++) {\n fn.call(null, obj[i], i, obj);\n }\n } else {\n // Iterate over object keys\n for (var key in obj) {\n if (Object.prototype.hasOwnProperty.call(obj, key)) {\n fn.call(null, obj[key], key, obj);\n }\n }\n }\n}\n\n/**\n * Accepts varargs expecting each argument to be an object, then\n * immutably merges the properties of each object and returns result.\n *\n * When multiple objects contain the same key the later object in\n * the arguments list will take precedence.\n *\n * Example:\n *\n * ```js\n * var result = merge({foo: 123}, {foo: 456});\n * console.log(result.foo); // outputs 456\n * ```\n *\n * @param {Object} obj1 Object to merge\n * @returns {Object} Result of all merge properties\n */\nfunction merge(/* obj1, obj2, obj3, ... */) {\n var result = {};\n function assignValue(val, key) {\n if (typeof result[key] === 'object' && typeof val === 'object') {\n result[key] = merge(result[key], val);\n } else {\n result[key] = val;\n }\n }\n\n for (var i = 0, l = arguments.length; i < l; i++) {\n forEach(arguments[i], assignValue);\n }\n return result;\n}\n\n/**\n * Function equal to merge with the difference being that no reference\n * to original objects is kept.\n *\n * @see merge\n * @param {Object} obj1 Object to merge\n * @returns {Object} Result of all merge properties\n */\nfunction deepMerge(/* obj1, obj2, obj3, ... */) {\n var result = {};\n function assignValue(val, key) {\n if (typeof result[key] === 'object' && typeof val === 'object') {\n result[key] = deepMerge(result[key], val);\n } else if (typeof val === 'object') {\n result[key] = deepMerge({}, val);\n } else {\n result[key] = val;\n }\n }\n\n for (var i = 0, l = arguments.length; i < l; i++) {\n forEach(arguments[i], assignValue);\n }\n return result;\n}\n\n/**\n * Extends object a by mutably adding to it the properties of object b.\n *\n * @param {Object} a The object to be extended\n * @param {Object} b The object to copy properties from\n * @param {Object} thisArg The object to bind function to\n * @return {Object} The resulting value of object a\n */\nfunction extend(a, b, thisArg) {\n forEach(b, function assignValue(val, key) {\n if (thisArg && typeof val === 'function') {\n a[key] = bind(val, thisArg);\n } else {\n a[key] = val;\n }\n });\n return a;\n}\n\nmodule.exports = {\n isArray: isArray,\n isArrayBuffer: isArrayBuffer,\n isBuffer: isBuffer,\n isFormData: isFormData,\n isArrayBufferView: isArrayBufferView,\n isString: isString,\n isNumber: isNumber,\n isObject: isObject,\n isUndefined: isUndefined,\n isDate: isDate,\n isFile: isFile,\n isBlob: isBlob,\n isFunction: isFunction,\n isStream: isStream,\n isURLSearchParams: isURLSearchParams,\n isStandardBrowserEnv: isStandardBrowserEnv,\n forEach: forEach,\n merge: merge,\n deepMerge: deepMerge,\n extend: extend,\n trim: trim\n};\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvYXhpb3MvbGliL3V0aWxzLmpzP2M1MzIiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQWE7O0FBRWIsV0FBVyxtQkFBTyxDQUFDLGdFQUFnQjtBQUNuQyxlQUFlLG1CQUFPLENBQUMsb0RBQVc7O0FBRWxDOztBQUVBOztBQUVBOztBQUVBO0FBQ0E7QUFDQTtBQUNBLFdBQVcsT0FBTztBQUNsQixhQUFhLFFBQVE7QUFDckI7QUFDQTtBQUNBO0FBQ0E7O0FBRUE7QUFDQTtBQUNBO0FBQ0EsV0FBVyxPQUFPO0FBQ2xCLGFBQWEsUUFBUTtBQUNyQjtBQUNBO0FBQ0E7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7QUFDQSxXQUFXLE9BQU87QUFDbEIsYUFBYSxRQUFRO0FBQ3JCO0FBQ0E7QUFDQTtBQUNBOztBQUVBO0FBQ0E7QUFDQTtBQUNBLFdBQVcsT0FBTztBQUNsQixhQUFhLFFBQVE7QUFDckI7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBLEdBQUc7QUFDSDtBQUNBO0FBQ0E7QUFDQTs7QUFFQTtBQUNBO0FBQ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IGlzQmxvYixcbiAgaXNGdW5jdGlvbjogaXNGdW5jdGlvbixcbiAgaXNTdHJlYW06IGlzU3RyZWFtLFxuICBpc1VSTFNlYXJjaFBhcmFtczogaXNVUkxTZWFyY2hQYXJhbXMsXG4gIGlzU3RhbmRhcmRCcm93c2VyRW52OiBpc1N0YW5kYXJkQnJvd3NlckVudixcbiAgZm9yRWFjaDogZm9yRWFjaCxcbiAgbWVyZ2U6IG1lcmdlLFxuICBkZWVwTWVyZ2U6IGRlZXBNZXJnZSxcbiAgZXh0ZW5kOiBleHRlbmQsXG4gIHRyaW06IHRyaW1cbn07XG4iXSwic291cmNlUm9vdCI6IiJ9\n//# sourceURL=webpack-internal:///./node_modules/axios/lib/utils.js\n");
/***/ }),
/***/ "./node_modules/is-buffer/index.js":
/*!*****************************************!*\
!*** ./node_modules/is-buffer/index.js ***!
\*****************************************/
/*! no static exports found */
/***/ (function(module, exports) {
eval("/*!\n * Determine if an object is a Buffer\n *\n * @author Feross Aboukhadijeh <https://feross.org>\n * @license MIT\n */\n\nmodule.exports = function isBuffer (obj) {\n return obj != null && obj.constructor != null &&\n typeof obj.constructor.isBuffer === 'function' && obj.constructor.isBuffer(obj)\n}\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvaXMtYnVmZmVyL2luZGV4LmpzPzA0NGIiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBOztBQUVBO0FBQ0E7QUFDQTtBQUNBIiwiZmlsZSI6Ii4vbm9kZV9tb2R1bGVzL2lzLWJ1ZmZlci9pbmRleC5qcy5qcyIsInNvdXJjZXNDb250ZW50IjpbIi8qIVxuICogRGV0ZXJtaW5lIGlmIGFuIG9iamVjdCBpcyBhIEJ1ZmZlclxuICpcbiAqIEBhdXRob3IgICBGZXJvc3MgQWJvdWtoYWRpamVoIDxodHRwczovL2Zlcm9zcy5vcmc+XG4gKiBAbGljZW5zZSAgTUlUXG4gKi9cblxubW9kdWxlLmV4cG9ydHMgPSBmdW5jdGlvbiBpc0J1ZmZlciAob2JqKSB7XG4gIHJldHVybiBvYmogIT0gbnVsbCAmJiBvYmouY29uc3RydWN0b3IgIT0gbnVsbCAmJlxuICAgIHR5cGVvZiBvYmouY29uc3RydWN0b3IuaXNCdWZmZXIgPT09ICdmdW5jdGlvbicgJiYgb2JqLmNvbnN0cnVjdG9yLmlzQnVmZmVyKG9iailcbn1cbiJdLCJzb3VyY2VSb290IjoiIn0=\n//# sourceURL=webpack-internal:///./node_modules/is-buffer/index.js\n");
/***/ }),
/***/ "./node_modules/process/browser.js":
/*!*****************************************!*\
!*** ./node_modules/process/browser.js ***!
\*****************************************/
/*! no static exports found */
/***/ (function(module, exports) {
eval("// shim for using process in browser\nvar process = module.exports = {};\n\n// cached from whatever global is present so that test runners that stub it\n// don't break things. But we need to wrap it in a try catch in case it is\n// wrapped in strict mode code which doesn't define any globals. It's inside a\n// function because try/catches deoptimize in certain engines.\n\nvar cachedSetTimeout;\nvar cachedClearTimeout;\n\nfunction defaultSetTimout() {\n throw new Error('setTimeout has not been defined');\n}\nfunction defaultClearTimeout () {\n throw new Error('clearTimeout has not been defined');\n}\n(function () {\n try {\n if (typeof setTimeout === 'function') {\n cachedSetTimeout = setTimeout;\n } else {\n cachedSetTimeout = defaultSetTimout;\n }\n } catch (e) {\n cachedSetTimeout = defaultSetTimout;\n }\n try {\n if (typeof clearTimeout === 'function') {\n cachedClearTimeout = clearTimeout;\n } else {\n cachedClearTimeout = defaultClearTimeout;\n }\n } catch (e) {\n cachedClearTimeout = defaultClearTimeout;\n }\n} ())\nfunction runTimeout(fun) {\n if (cachedSetTimeout === setTimeout) {\n //normal enviroments in sane situations\n return setTimeout(fun, 0);\n }\n // if setTimeout wasn't available but was latter defined\n if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {\n cachedSetTimeout = setTimeout;\n return setTimeout(fun, 0);\n }\n try {\n // when when somebody has screwed with setTimeout but no I.E. maddness\n return cachedSetTimeout(fun, 0);\n } catch(e){\n try {\n // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally\n return cachedSetTimeout.call(null, fun, 0);\n } catch(e){\n // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error\n return cachedSetTimeout.call(this, fun, 0);\n }\n }\n\n\n}\nfunction runClearTimeout(marker) {\n if (cachedClearTimeout === clearTimeout) {\n //normal enviroments in sane situations\n return clearTimeout(marker);\n }\n // if clearTimeout wasn't available but was latter defined\n if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {\n cachedClearTimeout = clearTimeout;\n return clearTimeout(marker);\n }\n try {\n // when when somebody has screwed with setTimeout but no I.E. maddness\n return cachedClearTimeout(marker);\n } catch (e){\n try {\n // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally\n return cachedClearTimeout.call(null, marker);\n } catch (e){\n // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error.\n // Some versions of I.E. have different rules for clearTimeout vs setTimeout\n return cachedClearTimeout.call(this, marker);\n }\n }\n\n\n\n}\nvar queue = [];\nvar draining = false;\nvar currentQueue;\nvar queueIndex = -1;\n\nfunction cleanUpNextTick() {\n if (!draining || !currentQueue) {\n return;\n }\n draining = false;\n if (currentQueue.length) {\n queue = currentQueue.concat(queue);\n } else {\n queueIndex = -1;\n }\n if (queue.length) {\n drainQueue();\n }\n}\n\nfunction drainQueue() {\n if (draining) {\n return;\n }\n var timeout = runTimeout(cleanUpNextTick);\n draining = true;\n\n var len = queue.length;\n while(len) {\n currentQueue = queue;\n queue = [];\n while (++queueIndex < len) {\n if (currentQueue) {\n currentQueue[queueIndex].run();\n }\n }\n queueIndex = -1;\n len = queue.length;\n }\n currentQueue = null;\n draining = false;\n runClearTimeout(timeout);\n}\n\nprocess.nextTick = function (fun) {\n var args = new Array(arguments.length - 1);\n if (arguments.length > 1) {\n for (var i = 1; i < arguments.length; i++) {\n args[i - 1] = arguments[i];\n }\n }\n queue.push(new Item(fun, args));\n if (queue.length === 1 && !draining) {\n runTimeout(drainQueue);\n }\n};\n\n// v8 likes predictible objects\nfunction Item(fun, array) {\n this.fun = fun;\n this.array = array;\n}\nItem.prototype.run = function () {\n this.fun.apply(null, this.array);\n};\nprocess.title = 'browser';\nprocess.browser = true;\nprocess.env = {};\nprocess.argv = [];\nprocess.version = ''; // empty string to avoid regexp issues\nprocess.versions = {};\n\nfunction noop() {}\n\nprocess.on = noop;\nprocess.addListener = noop;\nprocess.once = noop;\nprocess.off = noop;\nprocess.removeListener = noop;\nprocess.removeAllListeners = noop;\nprocess.emit = noop;\nprocess.prependListener = noop;\nprocess.prependOnceListener = noop;\n\nprocess.listeners = function (name) { return [] }\n\nprocess.binding = function (name) {\n throw new Error('process.binding is not supported');\n};\n\nprocess.cwd = function () { return '/' };\nprocess.chdir = function (dir) {\n throw new Error('process.chdir is not supported');\n};\nprocess.umask = function() { return 0; };\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvcHJvY2Vzcy9icm93c2VyLmpzP2YyOGMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUE7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7QUFDQTs7QUFFQTtBQUNBOztBQUVBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0EsU0FBUztBQUNUO0FBQ0E7QUFDQSxLQUFLO0FBQ0w7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBLFNBQVM7QUFDVDtBQUNBO0FBQ0EsS0FBSztBQUNMO0FBQ0E7QUFD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_modules/setimmediate/setImmediate.js":
/*!***************************************************!*\
!*** ./node_modules/setimmediate/setImmediate.js ***!
\***************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
eval("/* WEBPACK VAR INJECTION */(function(global, process) {(function (global, undefined) {\n \"use strict\";\n\n if (global.setImmediate) {\n return;\n }\n\n var nextHandle = 1; // Spec says greater than zero\n var tasksByHandle = {};\n var currentlyRunningATask = false;\n var doc = global.document;\n var registerImmediate;\n\n function setImmediate(callback) {\n // Callback can either be a function or a string\n if (typeof callback !== \"function\") {\n callback = new Function(\"\" + callback);\n }\n // Copy function arguments\n var args = new Array(arguments.length - 1);\n for (var i = 0; i < args.length; i++) {\n args[i] = arguments[i + 1];\n }\n // Store and register the task\n var task = { callback: callback, args: args };\n tasksByHandle[nextHandle] = task;\n registerImmediate(nextHandle);\n return nextHandle++;\n }\n\n function clearImmediate(handle) {\n delete tasksByHandle[handle];\n }\n\n function run(task) {\n var callback = task.callback;\n var args = task.args;\n switch (args.length) {\n case 0:\n callback();\n break;\n case 1:\n callback(args[0]);\n break;\n case 2:\n callback(args[0], args[1]);\n break;\n case 3:\n callback(args[0], args[1], args[2]);\n break;\n default:\n callback.apply(undefined, args);\n break;\n }\n }\n\n function runIfPresent(handle) {\n // From the spec: \"Wait until any invocations of this algorithm started before this one have completed.\"\n // So if we're currently running a task, we'll need to delay this invocation.\n if (currentlyRunningATask) {\n // Delay by doing a setTimeout. setImmediate was tried instead, but in Firefox 7 it generated a\n // \"too much recursion\" error.\n setTimeout(runIfPresent, 0, handle);\n } else {\n var task = tasksByHandle[handle];\n if (task) {\n currentlyRunningATask = true;\n try {\n run(task);\n } finally {\n clearImmediate(handle);\n currentlyRunningATask = false;\n }\n }\n }\n }\n\n function installNextTickImplementation() {\n registerImmediate = function(handle) {\n process.nextTick(function () { runIfPresent(handle); });\n };\n }\n\n function canUsePostMessage() {\n // The test against `importScripts` prevents this implementation from being installed inside a web worker,\n // where `global.postMessage` means something completely different and can't be used for this purpose.\n if (global.postMessage && !global.importScripts) {\n var postMessageIsAsynchronous = true;\n var oldOnMessage = global.onmessage;\n global.onmessage = function() {\n postMessageIsAsynchronous = false;\n };\n global.postMessage(\"\", \"*\");\n global.onmessage = oldOnMessage;\n return postMessageIsAsynchronous;\n }\n }\n\n function installPostMessageImplementation() {\n // Installs an event handler on `global` for the `message` event: see\n // * https://developer.mozilla.org/en/DOM/window.postMessage\n // * http://www.whatwg.org/specs/web-apps/current-work/multipage/comms.html#crossDocumentMessages\n\n var messagePrefix = \"setImmediate$\" + Math.random() + \"$\";\n var onGlobalMessage = function(event) {\n if (event.source === global &&\n typeof event.data === \"string\" &&\n event.data.indexOf(messagePrefix) === 0) {\n runIfPresent(+event.data.slice(messagePrefix.length));\n }\n };\n\n if (global.addEventListener) {\n global.addEventListener(\"message\", onGlobalMessage, false);\n } else {\n global.attachEvent(\"onmessage\", onGlobalMessage);\n }\n\n registerImmediate = function(handle) {\n global.postMessage(messagePrefix + handle, \"*\");\n };\n }\n\n function installMessageChannelImplementation() {\n var channel = new MessageChannel();\n channel.port1.onmessage = function(event) {\n var handle = event.data;\n runIfPresent(handle);\n };\n\n registerImmediate = function(handle) {\n channel.port2.postMessage(handle);\n };\n }\n\n function installReadyStateChangeImplementation() {\n var html = doc.documentElement;\n registerImmediate = function(handle) {\n // Create a <script> element; its readystatechange event will be fired asynchronously once it is inserted\n // into the document. Do so, thus queuing up the task. Remember to clean up once it's been called.\n var script = doc.createElement(\"script\");\n script.onreadystatechange = function () {\n runIfPresent(handle);\n script.onreadystatechange = null;\n html.removeChild(script);\n script = null;\n };\n html.appendChild(script);\n };\n }\n\n function installSetTimeoutImplementation() {\n registerImmediate = function(handle) {\n setTimeout(runIfPresent, 0, handle);\n };\n }\n\n // If supported, we should attach to the prototype of global, since that is where setTimeout et al. live.\n var attachTo = Object.getPrototypeOf && Object.getPrototypeOf(global);\n attachTo = attachTo && attachTo.setTimeout ? attachTo : global;\n\n // Don't get fooled by e.g. browserify environments.\n if ({}.toString.call(global.process) === \"[object process]\") {\n // For Node.js before 0.9\n installNextTickImplementation();\n\n } else if (canUsePostMessage()) {\n // For non-IE10 modern browsers\n installPostMessageImplementation();\n\n } else if (global.MessageChannel) {\n // For web workers, where supported\n installMessageChannelImplementation();\n\n } else if (doc && \"onreadystatechange\" in doc.createElement(\"script\")) {\n // For IE 68\n installReadyStateChangeImplementation();\n\n } else {\n // For older browsers\n installSetTimeoutImplementation();\n }\n\n attachTo.setImmediate = setImmediate;\n attachTo.clearImmediate = clearImmediate;\n}(typeof self === \"undefined\" ? typeof global === \"undefined\" ? this : global : self));\n\n/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../webpack/buildin/global.js */ \"./node_modules/webpack/buildin/global.js\"), __webpack_require__(/*! ./../process/browser.js */ \"./node_modules/process/browser.js\")))//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvc2V0aW1tZWRpYXRlL3NldEltbWVkaWF0ZS5qcz82MDE3Il0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBO0FBQ0E7O0FBRUE7QUFDQTtBQUNBOztBQUVBLHVCQUF1QjtBQUN2QjtBQUNBO0FBQ0E7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBLHFCQUFxQixpQkFBaUI7QUFDdEM7QUFDQTtBQUNBO0FBQ0Esa0JBQWtCO0FBQ2xCO0FBQ0E7QUFDQTtBQUNBOztBQUVBO0FBQ0E7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7O0FBRUE7QUFDQTtBQ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mV4dEhhbmRsZSk7XG4gICAgICByZXR1cm4gbmV4dEhhbmRsZSsrO1xuICAgIH1cblxuICAgIGZ1bmN0aW9uIGNsZWFySW1tZWRpYXRlKGhhbmRsZSkge1xuICAgICAgICBkZWxldGUgdGFza3NCeUhhbmRsZVtoYW5kbGVdO1xuICAgIH1cblxuICAgIGZ1bmN0aW9uIHJ1bih0YXNrKSB7XG4gICAgICAgIHZhciBjYWxsYmFjayA9IHRhc2suY2FsbGJhY2s7XG4gICAgICAgIHZhciBhcmdzID0gdGFzay5hcmdzO1xuICAgICAgICBzd2l0Y2ggKGFyZ3MubGVuZ3RoKSB7XG4gICAgICAgIGNhc2UgMDpcbiAgICAgICAgICAgIGNhbGxiYWNrKCk7XG4gICAgICAgICAgICBicmVhaztcbiAgICAgICAgY2FzZSAxOlxuICAgICAgICAgICAgY2FsbGJhY2soYXJnc1swXSk7XG4gICAgICAgICAgICBicmVhaztcbiAgICAgICAgY2FzZSAyOlxuICAgICAgICAgICAgY2FsbGJhY2soYXJnc1swXSwgYXJnc1sxXSk7XG4gICAgICAgICAgICBicmVhaztcbiAgICAgICAgY2FzZSAzOlxuICAgICAgICAgICAgY2FsbGJhY2soYXJnc1swXSwgYXJnc1sxXSwgYXJnc1syXSk7XG4gICAgICAgICAgICBicmVhaztcbiAgICAgICAgZGVmYXVsdDpcbiAgICAgICAgICAgIGNhbGxiYWNrLmFwcGx5KHVuZGVmaW5lZCwgYXJncyk7XG4gICAgICAgICAgICBicmVhaztcbiAgICAgICAgfVxuICAgIH1cblxuICAgIGZ1bmN0aW9uIHJ1bklmUHJlc2VudChoYW5kbGUpIHtcbiAgICAgICAgLy8gRnJvbSB0aGUgc3BlYzogXCJXYWl0IHVudGlsIGFueSBpbnZvY2F0aW9ucyBvZiB0aGlzIGFsZ29yaXRobSBzdGFydGVkIGJlZm9yZSB0aGlzIG9uZSBoYXZlIGNvbXBsZXRlZC5cIlxuICAgICAgICAvLyBTbyBpZiB3ZSdyZSBjdXJyZW50bHkgcnVubmluZyBhIHRhc2ssIHdlJ2xsIG5lZWQgdG8gZGVsYXkgdGhpcyBpbnZvY2F0aW9uLlxuICAgICAgICBpZiAoY3VycmVudGx5UnVubmluZ0FUYXNrKSB7XG4gICAgICAgICAgICAvLyBEZWxheSBieSBkb2luZyBhIHNldFRpbWVvdXQuIHNldEltbWVkaWF0ZSB3YXMgdHJpZWQgaW5zdGVhZCwgYnV0IGluIEZpcmVmb3ggNyBpdCBnZW5lcmF0ZWQgYVxuICAgICAgICAgICAgLy8gXCJ0b28gbXVjaCByZWN1cnNpb25cIiBlcnJvci5cbiAgICAgICAgICAgIHNldFRpbWVvdXQocnVuSWZQcmVzZW50LCAwLCBoYW5kbGUpO1xuICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgdmFyIHRhc2sgPSB0YXNrc0J5SGFuZGxlW2hhbmRsZV07XG4gICAgICAgICAgICBpZiAodGFzaykge1xuICAgICAgICAgICAgICAgIGN1cnJlbnRseVJ1bm5pbmdBVGFzayA9IHRydWU7XG4gICAgICAgICAgICAgICAgdHJ5IHtcbiAgICAgICAgICAgICAgICAgICAgcnVuKHRhc2spO1xuICAgICAgICAgICAgICAgIH0gZmluYWxseSB7XG4gICAgICAgICAgICAgICAgICAgIGNsZWFySW1tZWRpYXRlKGhhbmRsZSk7XG4gICAgICAgICAgICAgICAgICAgIGN1cnJlbnRseVJ1bm5pbmdBVGFzayA9IGZhbHNlO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgIH1cblxuICAgIGZ1bmN0aW9uIGluc3RhbGxOZXh0VGlja0ltcGxlbWVudGF0aW9uKCkge1xuICAgICAgICByZWdpc3RlckltbWVkaWF0ZSA9IGZ1bmN0aW9uKGhhbmRsZSkge1xuICAgICAgICAgICAgcHJvY2Vzcy5uZXh0VGljayhmdW5jdGlvbiAoKSB7IHJ1bklmUHJlc2VudChoYW5kbGUpOyB9KTtcbiAgICAgICAgfTtcbiAgIC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BnbG9iYWwgPT09IFwidW5kZWZpbmVkXCIgPyB0aGlzIDogZ2xvYmFsIDogc2VsZikpO1xuIl0sInNvdXJjZVJvb3QiOiIifQ==\n//# sourceURL=webpack-internal:///./node_modules/setimmediate/setImmediate.js\n");
/***/ }),
/***/ "./node_modules/timers-browserify/main.js":
/*!************************************************!*\
!*** ./node_modules/timers-browserify/main.js ***!
\************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
eval("/* WEBPACK VAR INJECTION */(function(global) {var scope = (typeof global !== \"undefined\" && global) ||\n (typeof self !== \"undefined\" && self) ||\n window;\nvar apply = Function.prototype.apply;\n\n// DOM APIs, for completeness\n\nexports.setTimeout = function() {\n return new Timeout(apply.call(setTimeout, scope, arguments), clearTimeout);\n};\nexports.setInterval = function() {\n return new Timeout(apply.call(setInterval, scope, arguments), clearInterval);\n};\nexports.clearTimeout =\nexports.clearInterval = function(timeout) {\n if (timeout) {\n timeout.close();\n }\n};\n\nfunction Timeout(id, clearFn) {\n this._id = id;\n this._clearFn = clearFn;\n}\nTimeout.prototype.unref = Timeout.prototype.ref = function() {};\nTimeout.prototype.close = function() {\n this._clearFn.call(scope, this._id);\n};\n\n// Does not start the time, just sets up the members needed.\nexports.enroll = function(item, msecs) {\n clearTimeout(item._idleTimeoutId);\n item._idleTimeout = msecs;\n};\n\nexports.unenroll = function(item) {\n clearTimeout(item._idleTimeoutId);\n item._idleTimeout = -1;\n};\n\nexports._unrefActive = exports.active = function(item) {\n clearTimeout(item._idleTimeoutId);\n\n var msecs = item._idleTimeout;\n if (msecs >= 0) {\n item._idleTimeoutId = setTimeout(function onTimeout() {\n if (item._onTimeout)\n item._onTimeout();\n }, msecs);\n }\n};\n\n// setimmediate attaches itself to the global object\n__webpack_require__(/*! setimmediate */ \"./node_modules/setimmediate/setImmediate.js\");\n// On some exotic environments, it's not clear which object `setimmediate` was\n// able to install onto. Search each possibility in the same order as the\n// `setimmediate` library.\nexports.setImmediate = (typeof self !== \"undefined\" && self.setImmediate) ||\n (typeof global !== \"undefined\" && global.setImmediate) ||\n (this && this.setImmediate);\nexports.clearImmediate = (typeof self !== \"undefined\" && self.clearImmediate) ||\n (typeof global !== \"undefined\" && global.clearImmediate) ||\n (this && this.clearImmediate);\n\n/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../webpack/buildin/global.js */ \"./node_modules/webpack/buildin/global.js\")))//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvdGltZXJzLWJyb3dzZXJpZnkvbWFpbi5qcz81MTE4Il0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBO0FBQ0E7QUFDQTtBQUNBOztBQUVBOztBQUVBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBOztBQUVBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7O0FBRUE7QUFDQTtBQUNBO0FBQ0E7O0FBRUE7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0EsS0FBSztBQUNMO0FBQ0E7O0FBRUE7QUFDQSxtQkFBTyxDQUFDLGlFQUFjO0FBQ3RCO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQSIsImZpbGUiOiIuL25vZGVfbW9kdWxlcy90aW1lcnMtYnJvd3NlcmlmeS9tYWluLmpzLmpzIiwic291cmNlc0NvbnRlbnQiOlsidmFyIHNjb3BlID0gKHR5cGVvZiBnbG9iYWwgIT09IFwidW5kZWZpbmVkXCIgJiYgZ2xvYmFsKSB8fFxuICAgICAgICAgICAgKHR5cGVvZiBzZWxmICE9PSBcInVuZGVmaW5lZF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ICAgICAgICh0eXBlb2YgZ2xvYmFsICE9PSBcInVuZGVmaW5lZFwiICYmIGdsb2JhbC5zZXRJbW1lZGlhdGUpIHx8XG4gICAgICAgICAgICAgICAgICAgICAgICh0aGlzICYmIHRoaXMuc2V0SW1tZWRpYXRlKTtcbmV4cG9ydHMuY2xlYXJJbW1lZGlhdGUgPSAodHlwZW9mIHNlbGYgIT09IFwidW5kZWZpbmVkXCIgJiYgc2VsZi5jbGVhckltbWVkaWF0ZSkgfHxcbiAgICAgICAgICAgICAgICAgICAgICAgICAodHlwZW9mIGdsb2JhbCAhPT0gXCJ1bmRlZmluZWRcIiAmJiBnbG9iYWwuY2xlYXJJbW1lZGlhdGUpIHx8XG4gICAgICAgICAgICAgICAgICAgICAgICAgKHRoaXMgJiYgdGhpcy5jbGVhckltbWVkaWF0ZSk7XG4iXSwic291cmNlUm9vdCI6IiJ9\n//# sourceURL=webpack-internal:///./node_modules/timers-browserify/main.js\n");
/***/ }),
/***/ "./node_modules/vee-validate/dist/vee-validate.esm.js":
/*!************************************************************!*\
!*** ./node_modules/vee-validate/dist/vee-validate.esm.js ***!
\************************************************************/
/*! exports provided: default, ErrorBag, Rules, ValidationObserver, ValidationProvider, Validator, directive, install, mapFields, mixin, version, withValidation */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ErrorBag\", function() { return ErrorBag; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"Rules\", function() { return Rules; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ValidationObserver\", function() { return ValidationObserver; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ValidationProvider\", function() { return ValidationProvider; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"Validator\", function() { return Validator; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"directive\", function() { return directive; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"install\", function() { return install; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"mapFields\", function() { return mapFields; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"mixin\", function() { return mixin; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"version\", function() { return version; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"withValidation\", function() { return withValidation; });\n/**\n * vee-validate v2.2.15\n * (c) 2019 Abdelrahman Awad\n * @license MIT\n */\n// \n\nvar isTextInput = function (el) {\n return includes(['text', 'password', 'search', 'email', 'tel', 'url', 'textarea', 'number'], el.type);\n};\n\nvar isCheckboxOrRadioInput = function (el) {\n return includes(['radio', 'checkbox'], el.type);\n};\n\nvar isDateInput = function (el) {\n return includes(['date', 'week', 'month', 'datetime-local', 'time'], el.type);\n};\n\n/**\n * Gets the data attribute. the name must be kebab-case.\n */\nvar getDataAttribute = function (el, name) { return el.getAttribute((\"data-vv-\" + name)); };\n\nvar isNaN$1 = function (value) {\n if ('isNaN' in Number) {\n return Number.isNaN(value);\n }\n\n // eslint-disable-next-line\n return typeof(value) === 'number' && value !== value;\n};\n\n/**\n * Checks if the values are either null or undefined.\n */\nvar isNullOrUndefined = function () {\n var values = [], len = arguments.length;\n while ( len-- ) values[ len ] = arguments[ len ];\n\n return values.every(function (value) {\n return value === null || value === undefined;\n });\n};\n\n/**\n * Creates the default flags object.\n */\nvar createFlags = function () { return ({\n untouched: true,\n touched: false,\n dirty: false,\n pristine: true,\n valid: null,\n invalid: null,\n validated: false,\n pending: false,\n required: false,\n changed: false\n}); };\n\n/**\n * Shallow object comparison.\n */\nvar isEqual = function (lhs, rhs) {\n if (lhs instanceof RegExp && rhs instanceof RegExp) {\n return isEqual(lhs.source, rhs.source) && isEqual(lhs.flags, rhs.flags);\n }\n\n if (Array.isArray(lhs) && Array.isArray(rhs)) {\n if (lhs.length !== rhs.length) { return false; }\n\n for (var i = 0; i < lhs.length; i++) {\n if (!isEqual(lhs[i], rhs[i])) {\n return false;\n }\n }\n\n return true;\n }\n\n // if both are objects, compare each key recursively.\n if (isObject(lhs) && isObject(rhs)) {\n return Object.keys(lhs).every(function (key) {\n return isEqual(lhs[key], rhs[key]);\n }) && Object.keys(rhs).every(function (key) {\n return isEqual(lhs[key], rhs[key]);\n });\n }\n\n if (isNaN$1(lhs) && isNaN$1(rhs)) {\n return true;\n }\n\n return lhs === rhs;\n};\n\n/**\n * Determines the input field scope.\n */\nvar getScope = function (el) {\n var scope = getDataAttribute(el, 'scope');\n if (isNullOrUndefined(scope)) {\n var form = getForm(el);\n\n if (form) {\n scope = getDataAttribute(form, 'scope');\n }\n }\n\n return !isNullOrUndefined(scope) ? scope : null;\n};\n\n/**\n * Get the closest form element.\n */\nvar getForm = function (el) {\n if (isNullOrUndefined(el)) { return null; }\n\n if (el.tagName === 'FORM') { return el; }\n\n if (!isNullOrUndefined(el.form)) { return el.form; }\n\n return !isNullOrUndefined(el.parentNode) ? getForm(el.parentNode) : null;\n};\n\n/**\n * Gets the value in an object safely.\n */\nvar getPath = function (path, target, def) {\n if ( def === void 0 ) def = undefined;\n\n if (!path || !target) { return def; }\n\n var value = target;\n path.split('.').every(function (prop) {\n if (prop in value) {\n value = value[prop];\n\n return true;\n }\n\n value = def;\n\n return false;\n });\n\n return value;\n};\n\n/**\n * Checks if path exists within an object.\n */\nvar hasPath = function (path, target) {\n var obj = target;\n var previousPath = null;\n var isNullOrNonObject = false;\n var isValidPath = path.split('.').reduce(function (reducer, prop) {\n if (obj == null || typeof obj !== 'object') {\n isNullOrNonObject = true;\n return reducer && false;\n }\n\n if (prop in obj) {\n obj = obj[prop];\n previousPath = previousPath === null ? prop : previousPath + '.' + prop;\n\n return reducer && true;\n }\n\n return reducer && false;\n }, true);\n\n if (true) {\n if (isNullOrNonObject) {\n throw new Error(previousPath + ' is not an object');\n }\n }\n\n return isValidPath;\n};\n\n/**\n * Parses a rule string expression.\n */\nvar parseRule = function (rule) {\n var params = [];\n var name = rule.split(':')[0];\n\n if (includes(rule, ':')) {\n params = rule.split(':').slice(1).join(':').split(',');\n }\n\n return { name: name, params: params };\n};\n\n/**\n * Debounces a function.\n */\nvar debounce = function (fn, wait, token) {\n if ( wait === void 0 ) wait = 0;\n if ( token === void 0 ) token = { cancelled: false };\n\n if (wait === 0) {\n return fn;\n }\n\n var timeout;\n\n return function () {\n var args = [], len = arguments.length;\n while ( len-- ) args[ len ] = arguments[ len ];\n\n var later = function () {\n timeout = null;\n\n // check if the fn call was cancelled.\n if (!token.cancelled) { fn.apply(void 0, args); }\n };\n\n clearTimeout(timeout);\n timeout = setTimeout(later, wait);\n if (!timeout) { fn.apply(void 0, args); }\n };\n};\n\n/**\n * Appends a rule definition to a list of rules.\n */\nvar appendRule = function (rule, rules) {\n if (!rules) {\n return normalizeRules(rule);\n }\n\n if (!rule) {\n return normalizeRules(rules);\n }\n\n if (typeof rules === 'string') {\n rules = normalizeRules(rules);\n }\n\n return assign({}, rules, normalizeRules(rule));\n};\n\n/**\n * Normalizes the given rules expression.\n */\nvar normalizeRules = function (rules) {\n // if falsy value return an empty object.\n if (!rules) {\n return {};\n }\n\n if (isObject(rules)) {\n // $FlowFixMe\n return Object.keys(rules).reduce(function (prev, curr) {\n var params = [];\n // $FlowFixMe\n if (rules[curr] === true) {\n params = [];\n } else if (Array.isArray(rules[curr])) {\n params = rules[curr];\n } else if (isObject(rules[curr])) {\n params = rules[curr];\n } else {\n params = [rules[curr]];\n }\n\n // $FlowFixMe\n if (rules[curr] !== false) {\n prev[curr] = params;\n }\n\n return prev;\n }, {});\n }\n\n if (typeof rules !== 'string') {\n warn('rules must be either a string or an object.');\n return {};\n }\n\n return rules.split('|').reduce(function (prev, rule) {\n var parsedRule = parseRule(rule);\n if (!parsedRule.name) {\n return prev;\n }\n\n prev[parsedRule.name] = parsedRule.params;\n return prev;\n }, {});\n};\n\n/**\n * Emits a warning to the console.\n */\nvar warn = function (message) {\n console.warn((\"[vee-validate] \" + message)); // eslint-disable-line\n};\n\n/**\n * Creates a branded error object.\n */\nvar createError = function (message) { return new Error((\"[vee-validate] \" + message)); };\n\n/**\n * Checks if the value is an object.\n */\nvar isObject = function (obj) { return obj !== null && obj && typeof obj === 'object' && ! Array.isArray(obj); };\n\n/**\n * Checks if a function is callable.\n */\nvar isCallable = function (func) { return typeof func === 'function'; };\n\n/**\n * Check if element has the css class on it.\n */\nvar hasClass = function (el, className) {\n if (el.classList) {\n return el.classList.contains(className);\n }\n\n return !!el.className.match(new RegExp((\"(\\\\s|^)\" + className + \"(\\\\s|$)\")));\n};\n\n/**\n * Adds the provided css className to the element.\n */\nvar addClass = function (el, className) {\n if (el.classList) {\n el.classList.add(className);\n return;\n }\n\n if (!hasClass(el, className)) {\n el.className += \" \" + className;\n }\n};\n\n/**\n * Remove the provided css className from the element.\n */\nvar removeClass = function (el, className) {\n if (el.classList) {\n el.classList.remove(className);\n return;\n }\n\n if (hasClass(el, className)) {\n var reg = new RegExp((\"(\\\\s|^)\" + className + \"(\\\\s|$)\"));\n el.className = el.className.replace(reg, ' ');\n }\n};\n\n/**\n * Adds or removes a class name on the input depending on the status flag.\n */\nvar toggleClass = function (el, className, status) {\n if (!el || !className) { return; }\n\n if (Array.isArray(className)) {\n className.forEach(function (item) { return toggleClass(el, item, status); });\n return;\n }\n\n if (status) {\n return addClass(el, className);\n }\n\n removeClass(el, className);\n};\n\n/**\n * Converts an array-like object to array, provides a simple polyfill for Array.from\n */\nvar toArray = function (arrayLike) {\n if (isCallable(Array.from)) {\n return Array.from(arrayLike);\n }\n\n var array = [];\n var length = arrayLike.length;\n /* istanbul ignore next */\n for (var i = 0; i < length; i++) {\n array.push(arrayLike[i]);\n }\n\n /* istanbul ignore next */\n return array;\n};\n\n/**\n * Converts an array-like object to array and place other elements in an array\n */\nvar ensureArray = function (arrayLike) {\n if (Array.isArray(arrayLike)) {\n return [].concat( arrayLike );\n }\n var array = toArray(arrayLike);\n return isEmptyArray(array) ? [arrayLike] : array;\n};\n\n/**\n * Assign polyfill from the mdn.\n */\nvar assign = function (target) {\n var others = [], len = arguments.length - 1;\n while ( len-- > 0 ) others[ len ] = arguments[ len + 1 ];\n\n /* istanbul ignore else */\n if (isCallable(Object.assign)) {\n return Object.assign.apply(Object, [ target ].concat( others ));\n }\n\n /* istanbul ignore next */\n if (target == null) {\n throw new TypeError('Cannot convert undefined or null to object');\n }\n\n /* istanbul ignore next */\n var to = Object(target);\n /* istanbul ignore next */\n others.forEach(function (arg) {\n // Skip over if undefined or null\n if (arg != null) {\n Object.keys(arg).forEach(function (key) {\n to[key] = arg[key];\n });\n }\n });\n /* istanbul ignore next */\n return to;\n};\n\nvar id = 0;\nvar idTemplate = '{id}';\n\n/**\n * Generates a unique id.\n */\nvar uniqId = function () {\n // handle too many uses of uniqId, although unlikely.\n if (id >= 9999) {\n id = 0;\n // shift the template.\n idTemplate = idTemplate.replace('{id}', '_{id}');\n }\n\n id++;\n var newId = idTemplate.replace('{id}', String(id));\n\n return newId;\n};\n\nvar findIndex = function (arrayLike, predicate) {\n var array = Array.isArray(arrayLike) ? arrayLike : toArray(arrayLike);\n for (var i = 0; i < array.length; i++) {\n if (predicate(array[i])) {\n return i;\n }\n }\n\n return -1;\n};\n\n/**\n * finds the first element that satisfies the predicate callback, polyfills array.find\n */\nvar find = function (arrayLike, predicate) {\n var array = Array.isArray(arrayLike) ? arrayLike : toArray(arrayLike);\n var idx = findIndex(array, predicate);\n\n return idx === -1 ? undefined : array[idx];\n};\n\nvar isBuiltInComponent = function (vnode) {\n if (!vnode) {\n return false;\n }\n\n var tag = vnode.componentOptions.tag;\n\n return /^(keep-alive|transition|transition-group)$/.test(tag);\n};\n\nvar makeDelayObject = function (events, delay, delayConfig) {\n if (typeof delay === 'number') {\n return events.reduce(function (prev, e) {\n prev[e] = delay;\n return prev;\n }, {});\n }\n\n return events.reduce(function (prev, e) {\n if (typeof delay === 'object' && e in delay) {\n prev[e] = delay[e];\n return prev;\n }\n\n if (typeof delayConfig === 'number') {\n prev[e] = delayConfig;\n return prev;\n }\n\n prev[e] = (delayConfig && delayConfig[e]) || 0;\n\n return prev;\n }, {});\n};\n\nvar deepParseInt = function (input) {\n if (typeof input === 'number') { return input; }\n\n if (typeof input === 'string') { return parseInt(input); }\n\n var map = {};\n for (var element in input) {\n map[element] = parseInt(input[element]);\n }\n\n return map;\n};\n\nvar merge = function (target, source) {\n if (! (isObject(target) && isObject(source))) {\n return target;\n }\n\n Object.keys(source).forEach(function (key) {\n var obj, obj$1;\n\n if (isObject(source[key])) {\n if (! target[key]) {\n assign(target, ( obj = {}, obj[key] = {}, obj ));\n }\n\n merge(target[key], source[key]);\n return;\n }\n\n assign(target, ( obj$1 = {}, obj$1[key] = source[key], obj$1 ));\n });\n\n return target;\n};\n\nvar fillRulesFromElement = function (el, rules) {\n if (el.required) {\n rules = appendRule('required', rules);\n }\n\n if (isTextInput(el)) {\n if (el.type === 'email') {\n rules = appendRule((\"email\" + (el.multiple ? ':multiple' : '')), rules);\n }\n\n if (el.pattern) {\n rules = appendRule({ regex: el.pattern }, rules);\n }\n\n // 524288 is the max on some browsers and test environments.\n if (el.maxLength >= 0 && el.maxLength < 524288) {\n rules = appendRule((\"max:\" + (el.maxLength)), rules);\n }\n\n if (el.minLength > 0) {\n rules = appendRule((\"min:\" + (el.minLength)), rules);\n }\n\n if (el.type === 'number') {\n rules = appendRule('decimal', rules);\n if (el.min !== '') {\n rules = appendRule((\"min_value:\" + (el.min)), rules);\n }\n\n if (el.max !== '') {\n rules = appendRule((\"max_value:\" + (el.max)), rules);\n }\n }\n\n return rules;\n }\n\n if (isDateInput(el)) {\n var timeFormat = el.step && Number(el.step) < 60 ? 'HH:mm:ss' : 'HH:mm';\n\n if (el.type === 'date') {\n return appendRule('date_format:yyyy-MM-dd', rules);\n }\n\n if (el.type === 'datetime-local') {\n return appendRule((\"date_format:yyyy-MM-ddT\" + timeFormat), rules);\n }\n\n if (el.type === 'month') {\n return appendRule('date_format:yyyy-MM', rules);\n }\n\n if (el.type === 'week') {\n return appendRule('date_format:yyyy-[W]WW', rules);\n }\n\n if (el.type === 'time') {\n return appendRule((\"date_format:\" + timeFormat), rules);\n }\n }\n\n return rules;\n};\n\nvar values = function (obj) {\n if (isCallable(Object.values)) {\n return Object.values(obj);\n }\n\n // fallback to keys()\n /* istanbul ignore next */\n return Object.keys(obj).map(function (k) { return obj[k]; });\n};\n\nvar parseSelector = function (selector) {\n var rule = null;\n if (includes(selector, ':')) {\n rule = selector.split(':').pop();\n selector = selector.replace((\":\" + rule), '');\n }\n\n if (selector[0] === '#') {\n return {\n id: selector.slice(1),\n rule: rule,\n name: null,\n scope: null\n };\n }\n\n var scope = null;\n var name = selector;\n if (includes(selector, '.')) {\n var parts = selector.split('.');\n scope = parts[0];\n name = parts.slice(1).join('.');\n }\n\n return {\n id: null,\n scope: scope,\n name: name,\n rule: rule\n };\n};\n\nvar includes = function (collection, item) {\n return collection.indexOf(item) !== -1;\n};\n\nvar isEmptyArray = function (arr) {\n return Array.isArray(arr) && arr.length === 0;\n};\n\nvar defineNonReactive = function (obj, prop, value) {\n Object.defineProperty(obj, prop, {\n configurable: false,\n writable: true,\n value: value\n });\n};\n\n// \n\nvar LOCALE = 'en';\n\nvar Dictionary = function Dictionary (dictionary) {\n if ( dictionary === void 0 ) dictionary = {};\n\n this.container = {};\n this.merge(dictionary);\n};\n\nvar prototypeAccessors = { locale: { configurable: true } };\n\nprototypeAccessors.locale.get = function () {\n return LOCALE;\n};\n\nprototypeAccessors.locale.set = function (value) {\n LOCALE = value || 'en';\n};\n\nDictionary.prototype.hasLocale = function hasLocale (locale) {\n return !!this.container[locale];\n};\n\nDictionary.prototype.setDateFormat = function setDateFormat (locale, format) {\n if (!this.container[locale]) {\n this.container[locale] = {};\n }\n\n this.container[locale].dateFormat = format;\n};\n\nDictionary.prototype.getDateFormat = function getDateFormat (locale) {\n if (!this.container[locale] || !this.container[locale].dateFormat) {\n return null;\n }\n\n return this.container[locale].dateFormat;\n};\n\nDictionary.prototype.getMessage = function getMessage (locale, key, data) {\n var message = null;\n if (!this.hasMessage(locale, key)) {\n message = this._getDefaultMessage(locale);\n } else {\n message = this.container[locale].messages[key];\n }\n\n return isCallable(message) ? message.apply(void 0, data) : message;\n};\n\n/**\n * Gets a specific message for field. falls back to the rule message.\n */\nDictionary.prototype.getFieldMessage = function getFieldMessage (locale, field, key, data) {\n if (!this.hasLocale(locale)) {\n return this.getMessage(locale, key, data);\n }\n\n var dict = this.container[locale].custom && this.container[locale].custom[field];\n if (!dict || !dict[key]) {\n return this.getMessage(locale, key, data);\n }\n\n var message = dict[key];\n return isCallable(message) ? message.apply(void 0, data) : message;\n};\n\nDictionary.prototype._getDefaultMessage = function _getDefaultMessage (locale) {\n if (this.hasMessage(locale, '_default')) {\n return this.container[locale].messages._default;\n }\n\n return this.container.en.messages._default;\n};\n\nDictionary.prototype.getAttribute = function getAttribute (locale, key, fallback) {\n if ( fallback === void 0 ) fallback = '';\n\n if (!this.hasAttribute(locale, key)) {\n return fallback;\n }\n\n return this.container[locale].attributes[key];\n};\n\nDictionary.prototype.hasMessage = function hasMessage (locale, key) {\n return !! (\n this.hasLocale(locale) &&\n this.container[locale].messages &&\n this.container[locale].messages[key]\n );\n};\n\nDictionary.prototype.hasAttribute = function hasAttribute (locale, key) {\n return !! (\n this.hasLocale(locale) &&\n this.container[locale].attributes &&\n this.container[locale].attributes[key]\n );\n};\n\nDictionary.prototype.merge = function merge$1 (dictionary) {\n merge(this.container, dictionary);\n};\n\nDictionary.prototype.setMessage = function setMessage (locale, key, message) {\n if (! this.hasLocale(locale)) {\n this.container[locale] = {\n messages: {},\n attributes: {}\n };\n }\n \n if (!this.container[locale].messages) {\n this.container[locale].messages = {};\n }\n\n this.container[locale].messages[key] = message;\n};\n\nDictionary.prototype.setAttribute = function setAttribute (locale, key, attribute) {\n if (! this.hasLocale(locale)) {\n this.container[locale] = {\n messages: {},\n attributes: {}\n };\n }\n\n this.container[locale].attributes[key] = attribute;\n};\n\nObject.defineProperties( Dictionary.prototype, prototypeAccessors );\n\nvar drivers = {\n default: new Dictionary({\n en: {\n messages: {},\n attributes: {},\n custom: {}\n }\n })\n};\n\nvar currentDriver = 'default';\n\nvar DictionaryResolver = function DictionaryResolver () {};\n\nDictionaryResolver._checkDriverName = function _checkDriverName (driver) {\n if (!driver) {\n throw createError('you must provide a name to the dictionary driver');\n }\n};\n\nDictionaryResolver.setDriver = function setDriver (driver, implementation) {\n if ( implementation === void 0 ) implementation = null;\n\n this._checkDriverName(driver);\n if (implementation) {\n drivers[driver] = implementation;\n }\n\n currentDriver = driver;\n};\n\nDictionaryResolver.getDriver = function getDriver () {\n return drivers[currentDriver];\n};\n\n// \n\nvar ErrorBag = function ErrorBag (errorBag, id) {\n if ( errorBag === void 0 ) errorBag = null;\n if ( id === void 0 ) id = null;\n\n this.vmId = id || null;\n // make this bag a mirror of the provided one, sharing the same items reference.\n if (errorBag && errorBag instanceof ErrorBag) {\n this.items = errorBag.items;\n } else {\n this.items = [];\n }\n};\n\nErrorBag.prototype[typeof Symbol === 'function' ? Symbol.iterator : '@@iterator'] = function () {\n var this$1 = this;\n\n var index = 0;\n return {\n next: function () {\n return { value: this$1.items[index++], done: index > this$1.items.length };\n }\n };\n};\n\n/**\n * Adds an error to the internal array.\n */\nErrorBag.prototype.add = function add (error) {\n var ref;\n\n (ref = this.items).push.apply(\n ref, this._normalizeError(error)\n );\n};\n\n/**\n * Normalizes passed errors to an error array.\n */\nErrorBag.prototype._normalizeError = function _normalizeError (error) {\n var this$1 = this;\n\n if (Array.isArray(error)) {\n return error.map(function (e) {\n e.scope = !isNullOrUndefined(e.scope) ? e.scope : null;\n e.vmId = !isNullOrUndefined(e.vmId) ? e.vmId : (this$1.vmId || null);\n\n return e;\n });\n }\n\n error.scope = !isNullOrUndefined(error.scope) ? error.scope : null;\n error.vmId = !isNullOrUndefined(error.vmId) ? error.vmId : (this.vmId || null);\n\n return [error];\n};\n\n/**\n * Regenrates error messages if they have a generator function.\n */\nErrorBag.prototype.regenerate = function regenerate () {\n this.items.forEach(function (i) {\n i.msg = isCallable(i.regenerate) ? i.regenerate() : i.msg;\n });\n};\n\n/**\n * Updates a field error with the new field scope.\n */\nErrorBag.prototype.update = function update (id, error) {\n var item = find(this.items, function (i) { return i.id === id; });\n if (!item) {\n return;\n }\n\n var idx = this.items.indexOf(item);\n this.items.splice(idx, 1);\n item.scope = error.scope;\n this.items.push(item);\n};\n\n/**\n * Gets all error messages from the internal array.\n */\nErrorBag.prototype.all = function all (scope) {\n var this$1 = this;\n\n var filterFn = function (item) {\n var matchesScope = true;\n var matchesVM = true;\n if (!isNullOrUndefined(scope)) {\n matchesScope = item.scope === scope;\n }\n\n if (!isNullOrUndefined(this$1.vmId)) {\n matchesVM = item.vmId === this$1.vmId;\n }\n\n return matchesVM && matchesScope;\n };\n\n return this.items.filter(filterFn).map(function (e) { return e.msg; });\n};\n\n/**\n * Checks if there are any errors in the internal array.\n */\nErrorBag.prototype.any = function any (scope) {\n var this$1 = this;\n\n var filterFn = function (item) {\n var matchesScope = true;\n var matchesVM = true;\n if (!isNullOrUndefined(scope)) {\n matchesScope = item.scope === scope;\n }\n\n if (!isNullOrUndefined(this$1.vmId)) {\n matchesVM = item.vmId === this$1.vmId;\n }\n\n return matchesVM && matchesScope;\n };\n\n return !!this.items.filter(filterFn).length;\n};\n\n/**\n * Removes all items from the internal array.\n */\nErrorBag.prototype.clear = function clear (scope) {\n var this$1 = this;\n\n var matchesVM = isNullOrUndefined(this.vmId) ? function () { return true; } : function (i) { return i.vmId === this$1.vmId; };\n var matchesScope = function (i) { return i.scope === scope; };\n if (arguments.length === 0) {\n matchesScope = function () { return true; };\n } else if (isNullOrUndefined(scope)) {\n scope = null;\n }\n\n for (var i = 0; i < this.items.length; ++i) {\n if (matchesVM(this.items[i]) && matchesScope(this.items[i])) {\n this.items.splice(i, 1);\n --i;\n }\n }\n};\n\n/**\n * Collects errors into groups or for a specific field.\n */\nErrorBag.prototype.collect = function collect (field, scope, map) {\n var this$1 = this;\n if ( map === void 0 ) map = true;\n\n var isSingleField = !isNullOrUndefined(field) && !field.includes('*');\n var groupErrors = function (items) {\n var errors = items.reduce(function (collection, error) {\n if (!isNullOrUndefined(this$1.vmId) && error.vmId !== this$1.vmId) {\n return collection;\n }\n\n if (!collection[error.field]) {\n collection[error.field] = [];\n }\n\n collection[error.field].push(map ? error.msg : error);\n\n return collection;\n }, {});\n\n // reduce the collection to be a single array.\n if (isSingleField) {\n return values(errors)[0] || [];\n }\n\n return errors;\n };\n\n if (isNullOrUndefined(field)) {\n return groupErrors(this.items);\n }\n\n var selector = isNullOrUndefined(scope) ? String(field) : (scope + \".\" + field);\n var ref = this._makeCandidateFilters(selector);\n var isPrimary = ref.isPrimary;\n var isAlt = ref.isAlt;\n\n var collected = this.items.reduce(function (prev, curr) {\n if (isPrimary(curr)) {\n prev.primary.push(curr);\n }\n\n if (isAlt(curr)) {\n prev.alt.push(curr);\n }\n\n return prev;\n }, { primary: [], alt: [] });\n\n collected = collected.primary.length ? collected.primary : collected.alt;\n\n return groupErrors(collected);\n};\n\n/**\n * Gets the internal array length.\n */\nErrorBag.prototype.count = function count () {\n var this$1 = this;\n\n if (this.vmId) {\n return this.items.filter(function (e) { return e.vmId === this$1.vmId; }).length;\n }\n\n return this.items.length;\n};\n\n/**\n * Finds and fetches the first error message for the specified field id.\n */\nErrorBag.prototype.firstById = function firstById (id) {\n var error = find(this.items, function (i) { return i.id === id; });\n\n return error ? error.msg : undefined;\n};\n\n/**\n * Gets the first error message for a specific field.\n */\nErrorBag.prototype.first = function first (field, scope) {\n if ( scope === void 0 ) scope = null;\n\n var selector = isNullOrUndefined(scope) ? field : (scope + \".\" + field);\n var match = this._match(selector);\n\n return match && match.msg;\n};\n\n/**\n * Returns the first error rule for the specified field\n */\nErrorBag.prototype.firstRule = function firstRule (field, scope) {\n var errors = this.collect(field, scope, false);\n\n return (errors.length && errors[0].rule) || undefined;\n};\n\n/**\n * Checks if the internal array has at least one error for the specified field.\n */\nErrorBag.prototype.has = function has (field, scope) {\n if ( scope === void 0 ) scope = null;\n\n return !!this.first(field, scope);\n};\n\n/**\n * Gets the first error message for a specific field and a rule.\n */\nErrorBag.prototype.firstByRule = function firstByRule (name, rule, scope) {\n if ( scope === void 0 ) scope = null;\n\n var error = this.collect(name, scope, false).filter(function (e) { return e.rule === rule; })[0];\n\n return (error && error.msg) || undefined;\n};\n\n/**\n * Gets the first error message for a specific field that not match the rule.\n */\nErrorBag.prototype.firstNot = function firstNot (name, rule, scope) {\n if ( rule === void 0 ) rule = 'required';\n if ( scope === void 0 ) scope = null;\n\n var error = this.collect(name, scope, false).filter(function (e) { return e.rule !== rule; })[0];\n\n return (error && error.msg) || undefined;\n};\n\n/**\n * Removes errors by matching against the id or ids.\n */\nErrorBag.prototype.removeById = function removeById (id) {\n var condition = function (item) { return item.id === id; };\n if (Array.isArray(id)) {\n condition = function (item) { return id.indexOf(item.id) !== -1; };\n }\n\n for (var i = 0; i < this.items.length; ++i) {\n if (condition(this.items[i])) {\n this.items.splice(i, 1);\n --i;\n }\n }\n};\n\n/**\n * Removes all error messages associated with a specific field.\n */\nErrorBag.prototype.remove = function remove (field, scope, vmId) {\n if (isNullOrUndefined(field)) {\n return;\n }\n\n var selector = isNullOrUndefined(scope) ? String(field) : (scope + \".\" + field);\n var ref = this._makeCandidateFilters(selector);\n var isPrimary = ref.isPrimary;\n var isAlt = ref.isAlt;\n var matches = function (item) { return isPrimary(item) || isAlt(item); };\n var shouldRemove = function (item) {\n if (isNullOrUndefined(vmId)) { return matches(item); }\n\n return matches(item) && item.vmId === vmId;\n };\n\n for (var i = 0; i < this.items.length; ++i) {\n if (shouldRemove(this.items[i])) {\n this.items.splice(i, 1);\n --i;\n }\n }\n};\n\nErrorBag.prototype._makeCandidateFilters = function _makeCandidateFilters (selector) {\n var this$1 = this;\n\n var matchesRule = function () { return true; };\n var matchesScope = function () { return true; };\n var matchesName = function () { return true; };\n var matchesVM = function () { return true; };\n\n var ref = parseSelector(selector);\n var id = ref.id;\n var rule = ref.rule;\n var scope = ref.scope;\n var name = ref.name;\n\n if (rule) {\n matchesRule = function (item) { return item.rule === rule; };\n }\n\n // match by id, can be combined with rule selection.\n if (id) {\n return {\n isPrimary: function (item) { return matchesRule(item) && (function (item) { return id === item.id; }); },\n isAlt: function () { return false; }\n };\n }\n\n if (isNullOrUndefined(scope)) {\n // if no scope specified, make sure the found error has no scope.\n matchesScope = function (item) { return isNullOrUndefined(item.scope); };\n } else {\n matchesScope = function (item) { return item.scope === scope; };\n }\n\n if (!isNullOrUndefined(name) && name !== '*') {\n matchesName = function (item) { return item.field === name; };\n }\n\n if (!isNullOrUndefined(this.vmId)) {\n matchesVM = function (item) { return item.vmId === this$1.vmId; };\n }\n\n // matches the first candidate.\n var isPrimary = function (item) {\n return matchesVM(item) && matchesName(item) && matchesRule(item) && matchesScope(item);\n };\n\n // matches a second candidate, which is a field with a name containing the '.' character.\n var isAlt = function (item) {\n return matchesVM(item) && matchesRule(item) && item.field === (scope + \".\" + name);\n };\n\n return {\n isPrimary: isPrimary,\n isAlt: isAlt\n };\n};\n\nErrorBag.prototype._match = function _match (selector) {\n if (isNullOrUndefined(selector)) {\n return undefined;\n }\n\n var ref = this._makeCandidateFilters(selector);\n var isPrimary = ref.isPrimary;\n var isAlt = ref.isAlt;\n\n return this.items.reduce(function (prev, item, idx, arr) {\n var isLast = idx === arr.length - 1;\n if (prev.primary) {\n return isLast ? prev.primary : prev;\n }\n\n if (isPrimary(item)) {\n prev.primary = item;\n }\n\n if (isAlt(item)) {\n prev.alt = item;\n }\n\n // keep going.\n if (!isLast) {\n return prev;\n }\n\n return prev.primary || prev.alt;\n }, {});\n};\n\nvar DEFAULT_CONFIG = {\n locale: 'en',\n delay: 0,\n errorBagName: 'errors',\n dictionary: null,\n fieldsBagName: 'fields',\n classes: false,\n classNames: null,\n events: 'input',\n inject: true,\n fastExit: true,\n aria: true,\n validity: false,\n mode: 'aggressive',\n useConstraintAttrs: true,\n i18n: null,\n i18nRootKey: 'validation'\n};\n\nvar currentConfig = assign({}, DEFAULT_CONFIG);\n\nvar resolveConfig = function (ctx) {\n var selfConfig = getPath('$options.$_veeValidate', ctx, {});\n\n return assign({}, currentConfig, selfConfig);\n};\n\nvar getConfig = function () { return currentConfig; };\n\nvar setConfig = function (newConf) {\n currentConfig = assign({}, currentConfig, newConf);\n};\n\n// VNode Utils\n\n// Gets the model object on the vnode.\nfunction findModel (vnode) {\n if (!vnode.data) {\n return null;\n }\n\n // Component Model\n if (vnode.data.model) {\n return vnode.data.model;\n }\n\n return !!(vnode.data.directives) && find(vnode.data.directives, function (d) { return d.name === 'model'; });\n}\n\nfunction extractChildren (vnode) {\n if (Array.isArray(vnode)) {\n return vnode;\n }\n\n if (Array.isArray(vnode.children)) {\n return vnode.children;\n }\n\n if (vnode.componentOptions && Array.isArray(vnode.componentOptions.children)) {\n return vnode.componentOptions.children;\n }\n\n return [];\n}\n\nfunction extractVNodes (vnode) {\n if (findModel(vnode)) {\n return [vnode];\n }\n\n var children = extractChildren(vnode);\n\n return children.reduce(function (nodes, node) {\n var candidates = extractVNodes(node);\n if (candidates.length) {\n nodes.push.apply(nodes, candidates);\n }\n\n return nodes;\n }, []);\n}\n\n// Resolves v-model config if exists.\nfunction findModelConfig (vnode) {\n if (!vnode.componentOptions) { return null; }\n\n return vnode.componentOptions.Ctor.options.model;\n}\n// Adds a listener to vnode listener object.\nfunction mergeVNodeListeners (obj, eventName, handler) {\n // Has a single listener, convert to array.\n if (isCallable(obj[eventName])) {\n var prevHandler = obj[eventName];\n obj[eventName] = [prevHandler];\n }\n\n // no listeners, create the array.\n if (isNullOrUndefined(obj[eventName])) {\n obj[eventName] = [];\n }\n\n obj[eventName].push(handler);\n}\n\n// Adds a listener to a native HTML vnode.\nfunction addNativeNodeListener (node, eventName, handler) {\n if (isNullOrUndefined(node.data.on)) {\n node.data.on = {};\n }\n\n mergeVNodeListeners(node.data.on, eventName, handler);\n}\n\n// Adds a listener to a Vue component vnode.\nfunction addComponentNodeListener (node, eventName, handler) {\n /* istanbul ignore next */\n if (!node.componentOptions.listeners) {\n node.componentOptions.listeners = {};\n }\n\n mergeVNodeListeners(node.componentOptions.listeners, eventName, handler);\n}\nfunction addVNodeListener (vnode, eventName, handler) {\n if (vnode.componentOptions) {\n addComponentNodeListener(vnode, eventName, handler);\n return;\n }\n\n addNativeNodeListener(vnode, eventName, handler);\n}\n// Determines if `change` should be used over `input` for listeners.\nfunction getInputEventName (vnode, model) {\n // Is a component.\n if (vnode.componentOptions) {\n var ref = findModelConfig(vnode) || { event: 'input' };\n var event = ref.event;\n\n return event;\n }\n\n // Lazy Models and select tag typically use change event\n if ((model && model.modifiers && model.modifiers.lazy) || vnode.tag === 'select') {\n return 'change';\n }\n\n // is a textual-type input.\n if (vnode.data.attrs && isTextInput({ type: vnode.data.attrs.type || 'text' })) {\n return 'input';\n }\n\n return 'change';\n}\n\nfunction normalizeSlots (slots, ctx) {\n return Object.keys(slots).reduce(function (arr, key) {\n slots[key].forEach(function (vnode) {\n if (!vnode.context) {\n slots[key].context = ctx;\n if (!vnode.data) {\n vnode.data = {};\n }\n vnode.data.slot = key;\n }\n });\n\n return arr.concat(slots[key]);\n }, []);\n}\nfunction createRenderless (h, children) {\n // Only render the first item of the node.\n if (Array.isArray(children) && children[0]) {\n return children[0];\n }\n\n // a single node.\n if (children) {\n return children;\n }\n\n // No slots, render nothing.\n return h();\n}\n\n/**\n * Generates the options required to construct a field.\n */\nvar Resolver = function Resolver () {};\n\nResolver.generate = function generate (el, binding, vnode) {\n var model = Resolver.resolveModel(binding, vnode);\n var options = resolveConfig(vnode.context);\n\n return {\n name: Resolver.resolveName(el, vnode),\n el: el,\n listen: !binding.modifiers.disable,\n bails: binding.modifiers.bails ? true : (binding.modifiers.continues === true ? false : undefined),\n scope: Resolver.resolveScope(el, binding, vnode),\n vm: vnode.context,\n expression: binding.value,\n component: vnode.componentInstance,\n classes: options.classes,\n classNames: options.classNames,\n getter: Resolver.resolveGetter(el, vnode, model),\n events: Resolver.resolveEvents(el, vnode) || options.events,\n model: model,\n delay: Resolver.resolveDelay(el, vnode, options),\n rules: Resolver.resolveRules(el, binding, vnode),\n immediate: !!binding.modifiers.initial || !!binding.modifiers.immediate,\n persist: !!binding.modifiers.persist,\n validity: options.validity && !vnode.componentInstance,\n aria: options.aria && !vnode.componentInstance,\n initialValue: Resolver.resolveInitialValue(vnode)\n };\n};\n\nResolver.getCtorConfig = function getCtorConfig (vnode) {\n if (!vnode.componentInstance) { return null; }\n\n var config = getPath('componentInstance.$options.$_veeValidate', vnode);\n\n return config;\n};\n\n/**\n * Resolves the rules defined on an element.\n */\nResolver.resolveRules = function resolveRules (el, binding, vnode) {\n var rules = '';\n if (!binding.value && (!binding || !binding.expression)) {\n rules = getDataAttribute(el, 'rules');\n }\n\n if (binding.value && includes(['string', 'object'], typeof binding.value.rules)) {\n rules = binding.value.rules;\n } else if (binding.value) {\n rules = binding.value;\n }\n\n if (vnode.componentInstance) {\n return rules;\n }\n\n // If validity is disabled, ignore field rules.\n var normalized = normalizeRules(rules);\n if (!getConfig().useConstraintAttrs) {\n return normalized;\n }\n\n return assign({}, fillRulesFromElement(el, {}), normalized);\n};\n\n/**\n * @param {*} vnode\n */\nResolver.resolveInitialValue = function resolveInitialValue (vnode) {\n var model = vnode.data.model || find(vnode.data.directives, function (d) { return d.name === 'model'; });\n\n return model && model.value;\n};\n\n/**\n * Resolves the delay value.\n * @param {*} el\n * @param {*} vnode\n * @param {Object} options\n */\nResolver.resolveDelay = function resolveDelay (el, vnode, options) {\n var delay = getDataAttribute(el, 'delay');\n var globalDelay = (options && 'delay' in options) ? options.delay : 0;\n\n if (!delay && vnode.componentInstance && vnode.componentInstance.$attrs) {\n delay = vnode.componentInstance.$attrs['data-vv-delay'];\n }\n\n if (!isObject(globalDelay)) {\n return deepParseInt(delay || globalDelay);\n }\n\n if (!isNullOrUndefined(delay)) {\n globalDelay.input = delay;\n }\n\n return deepParseInt(globalDelay);\n};\n\n/**\n * Resolves the events to validate in response to.\n * @param {*} el\n * @param {*} vnode\n */\nResolver.resolveEvents = function resolveEvents (el, vnode) {\n // resolve it from the root element.\n var events = getDataAttribute(el, 'validate-on');\n\n // resolve from data-vv-validate-on if its a vue component.\n if (!events && vnode.componentInstance && vnode.componentInstance.$attrs) {\n events = vnode.componentInstance.$attrs['data-vv-validate-on'];\n }\n\n // resolve it from $_veeValidate options.\n if (!events && vnode.componentInstance) {\n var config = Resolver.getCtorConfig(vnode);\n events = config && config.events;\n }\n\n if (!events && getConfig().events) {\n events = getConfig().events;\n }\n\n // resolve the model event if its configured for custom components.\n if (events && vnode.componentInstance && includes(events, 'input')) {\n var ref = vnode.componentInstance.$options.model || { event: 'input' };\n var event = ref.event;\n // if the prop was configured but not the model.\n if (!event) {\n return events;\n }\n\n events = events.replace('input', event);\n }\n\n return events;\n};\n\n/**\n * Resolves the scope for the field.\n * @param {*} el\n * @param {*} binding\n */\nResolver.resolveScope = function resolveScope (el, binding, vnode) {\n if ( vnode === void 0 ) vnode = {};\n\n var scope = null;\n if (vnode.componentInstance && isNullOrUndefined(scope)) {\n scope = vnode.componentInstance.$attrs && vnode.componentInstance.$attrs['data-vv-scope'];\n }\n\n return !isNullOrUndefined(scope) ? scope : getScope(el);\n};\n\n/**\n * Checks if the node directives contains a v-model or a specified arg.\n * Args take priority over models.\n *\n * @return {Object}\n */\nResolver.resolveModel = function resolveModel (binding, vnode) {\n if (binding.arg) {\n return { expression: binding.arg };\n }\n\n var model = findModel(vnode);\n if (!model) {\n return null;\n }\n\n // https://github.com/vuejs/vue/blob/dev/src/core/util/lang.js#L26\n var watchable = !/[^\\w.$]/.test(model.expression) && hasPath(model.expression, vnode.context);\n var lazy = !!(model.modifiers && model.modifiers.lazy);\n\n if (!watchable) {\n return { expression: null, lazy: lazy };\n }\n\n return { expression: model.expression, lazy: lazy };\n};\n\n/**\n * Resolves the field name to trigger validations.\n * @return {String} The field name.\n */\nResolver.resolveName = function resolveName (el, vnode) {\n var name = getDataAttribute(el, 'name');\n\n if (!name && !vnode.componentInstance) {\n return el.name;\n }\n\n if (!name && vnode.componentInstance && vnode.componentInstance.$attrs) {\n name = vnode.componentInstance.$attrs['data-vv-name'] || vnode.componentInstance.$attrs['name'];\n }\n\n if (!name && vnode.componentInstance) {\n var config = Resolver.getCtorConfig(vnode);\n if (config && isCallable(config.name)) {\n var boundGetter = config.name.bind(vnode.componentInstance);\n\n return boundGetter();\n }\n\n return vnode.componentInstance.name;\n }\n\n return name;\n};\n\n/**\n * Returns a value getter input type.\n */\nResolver.resolveGetter = function resolveGetter (el, vnode, model) {\n if (model && model.expression) {\n return function () {\n return getPath(model.expression, vnode.context);\n };\n }\n\n if (vnode.componentInstance) {\n var path = getDataAttribute(el, 'value-path') || (vnode.componentInstance.$attrs && vnode.componentInstance.$attrs['data-vv-value-path']);\n if (path) {\n return function () {\n return getPath(path, vnode.componentInstance);\n };\n }\n\n var config = Resolver.getCtorConfig(vnode);\n if (config && isCallable(config.value)) {\n var boundGetter = config.value.bind(vnode.componentInstance);\n\n return function () {\n return boundGetter();\n };\n }\n\n var ref = vnode.componentInstance.$options.model || { prop: 'value' };\n var prop = ref.prop;\n\n return function () {\n return vnode.componentInstance[prop];\n };\n }\n\n switch (el.type) {\n case 'checkbox': return function () {\n var els = document.querySelectorAll((\"input[name=\\\"\" + (el.name) + \"\\\"]\"));\n\n els = toArray(els).filter(function (el) { return el.checked; });\n if (!els.length) { return undefined; }\n\n return els.map(function (checkbox) { return checkbox.value; });\n };\n case 'radio': return function () {\n var els = document.querySelectorAll((\"input[name=\\\"\" + (el.name) + \"\\\"]\"));\n var elm = find(els, function (el) { return el.checked; });\n\n return elm && elm.value;\n };\n case 'file': return function (context) {\n return toArray(el.files);\n };\n case 'select-multiple': return function () {\n return toArray(el.options).filter(function (opt) { return opt.selected; }).map(function (opt) { return opt.value; });\n };\n default: return function () {\n return el && el.value;\n };\n }\n};\n\nvar RULES = {};\n\nvar RuleContainer = function RuleContainer () {};\n\nvar staticAccessors = { rules: { configurable: true } };\n\nRuleContainer.add = function add (name, ref) {\n var validate = ref.validate;\n var options = ref.options;\n var paramNames = ref.paramNames;\n\n RULES[name] = {\n validate: validate,\n options: options,\n paramNames: paramNames\n };\n};\n\nstaticAccessors.rules.get = function () {\n return RULES;\n};\n\nRuleContainer.has = function has (name) {\n return !!RULES[name];\n};\n\nRuleContainer.isImmediate = function isImmediate (name) {\n return !!(RULES[name] && RULES[name].options.immediate);\n};\n\nRuleContainer.isRequireRule = function isRequireRule (name) {\n return !!(RULES[name] && RULES[name].options.computesRequired);\n};\n\nRuleContainer.isTargetRule = function isTargetRule (name) {\n return !!(RULES[name] && RULES[name].options.hasTarget);\n};\n\nRuleContainer.remove = function remove (ruleName) {\n delete RULES[ruleName];\n};\n\nRuleContainer.getParamNames = function getParamNames (ruleName) {\n return RULES[ruleName] && RULES[ruleName].paramNames;\n};\n\nRuleContainer.getOptions = function getOptions (ruleName) {\n return RULES[ruleName] && RULES[ruleName].options;\n};\n\nRuleContainer.getValidatorMethod = function getValidatorMethod (ruleName) {\n return RULES[ruleName] ? RULES[ruleName].validate : null;\n};\n\nObject.defineProperties( RuleContainer, staticAccessors );\n\n// \n\nvar isEvent = function (evt) {\n return (typeof Event !== 'undefined' && isCallable(Event) && evt instanceof Event) || (evt && evt.srcElement);\n};\n\nvar normalizeEvents = function (evts) {\n if (!evts) { return []; }\n\n return (typeof evts === 'string' ? evts.split('|') : evts);\n};\n\nvar supportsPassive = true;\n\nvar detectPassiveSupport = function () {\n try {\n var opts = Object.defineProperty({}, 'passive', {\n get: function get () {\n supportsPassive = true;\n }\n });\n window.addEventListener('testPassive', null, opts);\n window.removeEventListener('testPassive', null, opts);\n } catch (e) {\n supportsPassive = false;\n }\n return supportsPassive;\n};\n\nvar addEventListener = function (el, eventName, cb) {\n el.addEventListener(eventName, cb, supportsPassive ? { passive: true } : false);\n};\n\n// \n\nvar DEFAULT_OPTIONS = {\n targetOf: null,\n immediate: false,\n persist: false,\n scope: null,\n listen: true,\n name: null,\n rules: {},\n vm: null,\n classes: false,\n validity: true,\n aria: true,\n events: 'input|blur',\n delay: 0,\n classNames: {\n touched: 'touched', // the control has been blurred\n untouched: 'untouched', // the control hasn't been blurred\n valid: 'valid', // model is valid\n invalid: 'invalid', // model is invalid\n pristine: 'pristine', // control has not been interacted with\n dirty: 'dirty' // control has been interacted with\n }\n};\n\nvar Field = function Field (options) {\n if ( options === void 0 ) options = {};\n\n this.id = uniqId();\n this.el = options.el;\n this.updated = false;\n this.vmId = options.vmId;\n defineNonReactive(this, 'dependencies', []);\n defineNonReactive(this, 'watchers', []);\n defineNonReactive(this, 'events', []);\n this.delay = 0;\n this.rules = {};\n this.forceRequired = false;\n this._cacheId(options);\n this.classNames = assign({}, DEFAULT_OPTIONS.classNames);\n options = assign({}, DEFAULT_OPTIONS, options);\n this._delay = !isNullOrUndefined(options.delay) ? options.delay : 0; // cache initial delay\n this.validity = options.validity;\n this.aria = options.aria;\n this.flags = options.flags || createFlags();\n defineNonReactive(this, 'vm', options.vm);\n defineNonReactive(this, 'componentInstance', options.component);\n this.ctorConfig = this.componentInstance ? getPath('$options.$_veeValidate', this.componentInstance) : undefined;\n this.update(options);\n // set initial value.\n this.initialValue = this.value;\n this.updated = false;\n};\n\nvar prototypeAccessors$1 = { validator: { configurable: true },isRequired: { configurable: true },isDisabled: { configurable: true },alias: { configurable: true },value: { configurable: true },bails: { configurable: true },rejectsFalse: { configurable: true } };\n\nprototypeAccessors$1.validator.get = function () {\n if (!this.vm || !this.vm.$validator) {\n return { validate: function () { return Promise.resolve(true); } };\n }\n\n return this.vm.$validator;\n};\n\nprototypeAccessors$1.isRequired.get = function () {\n return !!this.rules.required || this.forceRequired;\n};\n\nprototypeAccessors$1.isDisabled.get = function () {\n return !!(this.el && this.el.disabled);\n};\n\n/**\n * Gets the display name (user-friendly name).\n */\nprototypeAccessors$1.alias.get = function () {\n if (this._alias) {\n return this._alias;\n }\n\n var alias = null;\n if (this.ctorConfig && this.ctorConfig.alias) {\n alias = isCallable(this.ctorConfig.alias) ? this.ctorConfig.alias.call(this.componentInstance) : this.ctorConfig.alias;\n }\n\n if (!alias && this.el) {\n alias = getDataAttribute(this.el, 'as');\n }\n\n if (!alias && this.componentInstance) {\n return this.componentInstance.$attrs && this.componentInstance.$attrs['data-vv-as'];\n }\n\n return alias;\n};\n\n/**\n * Gets the input value.\n */\n\nprototypeAccessors$1.value.get = function () {\n if (!isCallable(this.getter)) {\n return undefined;\n }\n\n return this.getter();\n};\n\nprototypeAccessors$1.bails.get = function () {\n return this._bails;\n};\n\n/**\n * If the field rejects false as a valid value for the required rule.\n */\n\nprototypeAccessors$1.rejectsFalse.get = function () {\n if (this.componentInstance && this.ctorConfig) {\n return !!this.ctorConfig.rejectsFalse;\n }\n\n if (!this.el) {\n return false;\n }\n\n return this.el.type === 'checkbox';\n};\n\n/**\n * Determines if the instance matches the options provided.\n */\nField.prototype.matches = function matches (options) {\n var this$1 = this;\n\n if (!options) {\n return true;\n }\n\n if (options.id) {\n return this.id === options.id;\n }\n\n var matchesComponentId = isNullOrUndefined(options.vmId) ? function () { return true; } : function (id) { return id === this$1.vmId; };\n if (!matchesComponentId(options.vmId)) {\n return false;\n }\n\n if (options.name === undefined && options.scope === undefined) {\n return true;\n }\n\n if (options.scope === undefined) {\n return this.name === options.name;\n }\n\n if (options.name === undefined) {\n return this.scope === options.scope;\n }\n\n return options.name === this.name && options.scope === this.scope;\n};\n\n/**\n * Caches the field id.\n */\nField.prototype._cacheId = function _cacheId (options) {\n if (this.el && !options.targetOf) {\n this.el._veeValidateId = this.id;\n }\n};\n\n/**\n * Keeps a reference of the most current validation run.\n */\nField.prototype.waitFor = function waitFor (pendingPromise) {\n this._waitingFor = pendingPromise;\n};\n\nField.prototype.isWaitingFor = function isWaitingFor (promise) {\n return this._waitingFor === promise;\n};\n\n/**\n * Updates the field with changed data.\n */\nField.prototype.update = function update (options) {\n var this$1 = this;\n\n this.targetOf = options.targetOf || null;\n this.immediate = options.immediate || this.immediate || false;\n this.persist = options.persist || this.persist || false;\n\n // update errors scope if the field scope was changed.\n if (!isNullOrUndefined(options.scope) && options.scope !== this.scope && isCallable(this.validator.update)) {\n this.validator.update(this.id, { scope: options.scope });\n }\n this.scope = !isNullOrUndefined(options.scope) ? options.scope\n : !isNullOrUndefined(this.scope) ? this.scope : null;\n this.name = (!isNullOrUndefined(options.name) ? String(options.name) : options.name) || this.name || null;\n this.rules = options.rules !== undefined ? normalizeRules(options.rules) : this.rules;\n this._bails = options.bails !== undefined ? options.bails : this._bails;\n this.model = options.model || this.model;\n this.listen = options.listen !== undefined ? options.listen : this.listen;\n this.classes = (options.classes || this.classes || false) && !this.componentInstance;\n this.classNames = isObject(options.classNames) ? merge(this.classNames, options.classNames) : this.classNames;\n this.getter = isCallable(options.getter) ? options.getter : this.getter;\n this._alias = options.alias || this._alias;\n this.events = (options.events) ? normalizeEvents(options.events) : this.events;\n this.delay = makeDelayObject(this.events, options.delay || this.delay, this._delay);\n this.updateDependencies();\n this.addActionListeners();\n\n if ( true && !this.name && !this.targetOf) {\n warn('A field is missing a \"name\" or \"data-vv-name\" attribute');\n }\n\n // update required flag flags\n if (options.rules !== undefined) {\n this.flags.required = this.isRequired;\n }\n\n if (Object.keys(options.rules || {}).length === 0 && this.updated) {\n var resetFlag = this.flags.validated;\n this.validator.validate((\"#\" + (this.id))).then(function () {\n this$1.flags.validated = resetFlag;\n });\n }\n\n // validate if it was validated before and field was updated and there was a rules mutation.\n if (this.flags.validated && options.rules !== undefined && this.updated) {\n this.validator.validate((\"#\" + (this.id)));\n }\n\n this.updated = true;\n this.addValueListeners();\n\n // no need to continue.\n if (!this.el) {\n return;\n }\n this.updateClasses();\n this.updateAriaAttrs();\n};\n\n/**\n * Resets field flags and errors.\n */\nField.prototype.reset = function reset () {\n var this$1 = this;\n\n if (this._cancellationToken) {\n this._cancellationToken.cancelled = true;\n delete this._cancellationToken;\n }\n\n var defaults = createFlags();\n Object.keys(this.flags).filter(function (flag) { return flag !== 'required'; }).forEach(function (flag) {\n this$1.flags[flag] = defaults[flag];\n });\n\n // update initial value\n this.initialValue = this.value;\n this.flags.changed = false;\n\n this.addValueListeners();\n this.addActionListeners();\n this.updateClasses(true);\n this.updateAriaAttrs();\n this.updateCustomValidity();\n};\n\n/**\n * Sets the flags and their negated counterparts, and updates the classes and re-adds action listeners.\n */\nField.prototype.setFlags = function setFlags (flags) {\n var this$1 = this;\n\n var negated = {\n pristine: 'dirty',\n dirty: 'pristine',\n valid: 'invalid',\n invalid: 'valid',\n touched: 'untouched',\n untouched: 'touched'\n };\n\n Object.keys(flags).forEach(function (flag) {\n this$1.flags[flag] = flags[flag];\n // if it has a negation and was not specified, set it as well.\n if (negated[flag] && flags[negated[flag]] === undefined) {\n this$1.flags[negated[flag]] = !flags[flag];\n }\n });\n\n if (\n flags.untouched !== undefined ||\n flags.touched !== undefined ||\n flags.dirty !== undefined ||\n flags.pristine !== undefined\n ) {\n this.addActionListeners();\n }\n this.updateClasses();\n this.updateAriaAttrs();\n this.updateCustomValidity();\n};\n\n/**\n * Determines if the field requires references to target fields.\n*/\nField.prototype.updateDependencies = function updateDependencies () {\n var this$1 = this;\n\n // reset dependencies.\n this.dependencies.forEach(function (d) { return d.field.destroy(); });\n this.dependencies = [];\n\n // we get the selectors for each field.\n var fields = Object.keys(this.rules).reduce(function (prev, r) {\n if (RuleContainer.isTargetRule(r)) {\n prev.push({ selector: this$1.rules[r][0], name: r });\n }\n\n return prev;\n }, []);\n\n if (!fields.length || !this.vm || !this.vm.$el) { return; }\n\n // must be contained within the same component, so we use the vm root element constrain our dom search.\n fields.forEach(function (ref$1) {\n var selector = ref$1.selector;\n var name = ref$1.name;\n\n var ref = this$1.vm.$refs[selector];\n var el = Array.isArray(ref) ? ref[0] : ref;\n if (!el) {\n return;\n }\n\n var options = {\n vm: this$1.vm,\n classes: this$1.classes,\n classNames: this$1.classNames,\n delay: this$1.delay,\n scope: this$1.scope,\n events: this$1.events.join('|'),\n immediate: this$1.immediate,\n targetOf: this$1.id\n };\n\n // probably a component.\n if (isCallable(el.$watch)) {\n options.component = el;\n options.el = el.$el;\n options.getter = Resolver.resolveGetter(el.$el, el.$vnode);\n } else {\n options.el = el;\n options.getter = Resolver.resolveGetter(el, {});\n }\n\n this$1.dependencies.push({ name: name, field: new Field(options) });\n });\n};\n\n/**\n * Removes listeners.\n */\nField.prototype.unwatch = function unwatch (tag) {\n if ( tag === void 0 ) tag = null;\n\n if (!tag) {\n this.watchers.forEach(function (w) { return w.unwatch(); });\n this.watchers = [];\n return;\n }\n\n this.watchers.filter(function (w) { return tag.test(w.tag); }).forEach(function (w) { return w.unwatch(); });\n this.watchers = this.watchers.filter(function (w) { return !tag.test(w.tag); });\n};\n\n/**\n * Updates the element classes depending on each field flag status.\n */\nField.prototype.updateClasses = function updateClasses (isReset) {\n var this$1 = this;\n if ( isReset === void 0 ) isReset = false;\n\n if (!this.classes || this.isDisabled) { return; }\n var applyClasses = function (el) {\n toggleClass(el, this$1.classNames.dirty, this$1.flags.dirty);\n toggleClass(el, this$1.classNames.pristine, this$1.flags.pristine);\n toggleClass(el, this$1.classNames.touched, this$1.flags.touched);\n toggleClass(el, this$1.classNames.untouched, this$1.flags.untouched);\n\n // remove valid/invalid classes on reset.\n if (isReset) {\n toggleClass(el, this$1.classNames.valid, false);\n toggleClass(el, this$1.classNames.invalid, false);\n }\n\n // make sure we don't set any classes if the state is undetermined.\n if (!isNullOrUndefined(this$1.flags.valid) && this$1.flags.validated) {\n toggleClass(el, this$1.classNames.valid, this$1.flags.valid);\n }\n\n if (!isNullOrUndefined(this$1.flags.invalid) && this$1.flags.validated) {\n toggleClass(el, this$1.classNames.invalid, this$1.flags.invalid);\n }\n };\n\n if (!isCheckboxOrRadioInput(this.el)) {\n applyClasses(this.el);\n return;\n }\n\n var els = document.querySelectorAll((\"input[name=\\\"\" + (this.el.name) + \"\\\"]\"));\n toArray(els).forEach(applyClasses);\n};\n\n/**\n * Adds the listeners required for automatic classes and some flags.\n */\nField.prototype.addActionListeners = function addActionListeners () {\n var this$1 = this;\n\n // remove previous listeners.\n this.unwatch(/class/);\n\n if (!this.el) { return; }\n\n var onBlur = function () {\n this$1.flags.touched = true;\n this$1.flags.untouched = false;\n if (this$1.classes) {\n toggleClass(this$1.el, this$1.classNames.touched, true);\n toggleClass(this$1.el, this$1.classNames.untouched, false);\n }\n\n // only needed once.\n this$1.unwatch(/^class_blur$/);\n };\n\n var inputEvent = isTextInput(this.el) ? 'input' : 'change';\n var onInput = function () {\n this$1.flags.dirty = true;\n this$1.flags.pristine = false;\n if (this$1.classes) {\n toggleClass(this$1.el, this$1.classNames.pristine, false);\n toggleClass(this$1.el, this$1.classNames.dirty, true);\n }\n\n // only needed once.\n this$1.unwatch(/^class_input$/);\n };\n\n if (this.componentInstance && isCallable(this.componentInstance.$once)) {\n this.componentInstance.$once('input', onInput);\n this.componentInstance.$once('blur', onBlur);\n this.watchers.push({\n tag: 'class_input',\n unwatch: function () {\n this$1.componentInstance.$off('input', onInput);\n }\n });\n this.watchers.push({\n tag: 'class_blur',\n unwatch: function () {\n this$1.componentInstance.$off('blur', onBlur);\n }\n });\n return;\n }\n\n if (!this.el) { return; }\n\n addEventListener(this.el, inputEvent, onInput);\n // Checkboxes and radio buttons on Mac don't emit blur naturally, so we listen on click instead.\n var blurEvent = isCheckboxOrRadioInput(this.el) ? 'change' : 'blur';\n addEventListener(this.el, blurEvent, onBlur);\n this.watchers.push({\n tag: 'class_input',\n unwatch: function () {\n this$1.el.removeEventListener(inputEvent, onInput);\n }\n });\n\n this.watchers.push({\n tag: 'class_blur',\n unwatch: function () {\n this$1.el.removeEventListener(blurEvent, onBlur);\n }\n });\n};\n\nField.prototype.checkValueChanged = function checkValueChanged () {\n // handle some people initialize the value to null, since text inputs have empty string value.\n if (this.initialValue === null && this.value === '' && isTextInput(this.el)) {\n return false;\n }\n\n return this.value !== this.initialValue;\n};\n\n/**\n * Determines the suitable primary event to listen for.\n */\nField.prototype._determineInputEvent = function _determineInputEvent () {\n // if its a custom component, use the customized model event or the input event.\n if (this.componentInstance) {\n return (this.componentInstance.$options.model && this.componentInstance.$options.model.event) || 'input';\n }\n\n if (this.model && this.model.lazy) {\n return 'change';\n }\n\n if (isTextInput(this.el)) {\n return 'input';\n }\n\n return 'change';\n};\n\n/**\n * Determines the list of events to listen to.\n */\nField.prototype._determineEventList = function _determineEventList (defaultInputEvent) {\n var this$1 = this;\n\n // if no event is configured, or it is a component or a text input then respect the user choice.\n if (!this.events.length || this.componentInstance || isTextInput(this.el)) {\n return [].concat( this.events ).map(function (evt) {\n if (evt === 'input' && this$1.model && this$1.model.lazy) {\n return 'change';\n }\n\n return evt;\n });\n }\n\n // force suitable event for non-text type fields.\n return this.events.map(function (e) {\n if (e === 'input') {\n return defaultInputEvent;\n }\n\n return e;\n });\n};\n\n/**\n * Adds the listeners required for validation.\n */\nField.prototype.addValueListeners = function addValueListeners () {\n var this$1 = this;\n\n this.unwatch(/^input_.+/);\n if (!this.listen || !this.el) { return; }\n\n var token = { cancelled: false };\n var fn = this.targetOf ? function () {\n var target = this$1.validator._resolveField((\"#\" + (this$1.targetOf)));\n if (target && target.flags.validated) {\n this$1.validator.validate((\"#\" + (this$1.targetOf)));\n }\n } : function () {\n var args = [], len = arguments.length;\n while ( len-- ) args[ len ] = arguments[ len ];\n\n // if its a DOM event, resolve the value, otherwise use the first parameter as the value.\n if (args.length === 0 || isEvent(args[0])) {\n args[0] = this$1.value;\n }\n\n this$1.flags.pending = true;\n this$1._cancellationToken = token;\n this$1.validator.validate((\"#\" + (this$1.id)), args[0]);\n };\n\n var inputEvent = this._determineInputEvent();\n var events = this._determineEventList(inputEvent);\n\n // if on input validation is requested.\n if (includes(events, inputEvent)) {\n var ctx = null;\n var expression = null;\n var watchCtxVm = false;\n // if its watchable from the context vm.\n if (this.model && this.model.expression) {\n ctx = this.vm;\n expression = this.model.expression;\n watchCtxVm = true;\n }\n\n // watch it from the custom component vm instead.\n if (!expression && this.componentInstance && this.componentInstance.$options.model) {\n ctx = this.componentInstance;\n expression = this.componentInstance.$options.model.prop || 'value';\n }\n\n if (ctx && expression) {\n var debouncedFn = debounce(fn, this.delay[inputEvent], token);\n var unwatch = ctx.$watch(expression, debouncedFn);\n this.watchers.push({\n tag: 'input_model',\n unwatch: function () {\n this$1.vm.$nextTick(function () {\n unwatch();\n });\n }\n });\n\n // filter out input event when we are watching from the context vm.\n if (watchCtxVm) {\n events = events.filter(function (e) { return e !== inputEvent; });\n }\n }\n }\n\n // Add events.\n events.forEach(function (e) {\n var debouncedFn = debounce(fn, this$1.delay[e], token);\n\n this$1._addComponentEventListener(e, debouncedFn);\n this$1._addHTMLEventListener(e, debouncedFn);\n });\n};\n\nField.prototype._addComponentEventListener = function _addComponentEventListener (evt, validate) {\n var this$1 = this;\n\n if (!this.componentInstance) { return; }\n\n this.componentInstance.$on(evt, validate);\n this.watchers.push({\n tag: 'input_vue',\n unwatch: function () {\n this$1.componentInstance.$off(evt, validate);\n }\n });\n};\n\nField.prototype._addHTMLEventListener = function _addHTMLEventListener (evt, validate) {\n var this$1 = this;\n\n if (!this.el || this.componentInstance) { return; }\n\n // listen for the current element.\n var addListener = function (el) {\n addEventListener(el, evt, validate);\n this$1.watchers.push({\n tag: 'input_native',\n unwatch: function () {\n el.removeEventListener(evt, validate);\n }\n });\n };\n\n addListener(this.el);\n if (!isCheckboxOrRadioInput(this.el)) {\n return;\n }\n\n var els = document.querySelectorAll((\"input[name=\\\"\" + (this.el.name) + \"\\\"]\"));\n toArray(els).forEach(function (el) {\n // skip if it is added by v-validate and is not the current element.\n if (el._veeValidateId && el !== this$1.el) {\n return;\n }\n\n addListener(el);\n });\n};\n\n/**\n * Updates aria attributes on the element.\n */\nField.prototype.updateAriaAttrs = function updateAriaAttrs () {\n var this$1 = this;\n\n if (!this.aria || !this.el || !isCallable(this.el.setAttribute)) { return; }\n\n var applyAriaAttrs = function (el) {\n el.setAttribute('aria-required', this$1.isRequired ? 'true' : 'false');\n el.setAttribute('aria-invalid', this$1.flags.invalid ? 'true' : 'false');\n };\n\n if (!isCheckboxOrRadioInput(this.el)) {\n applyAriaAttrs(this.el);\n return;\n }\n\n var els = document.querySelectorAll((\"input[name=\\\"\" + (this.el.name) + \"\\\"]\"));\n toArray(els).forEach(applyAriaAttrs);\n};\n\n/**\n * Updates the custom validity for the field.\n */\nField.prototype.updateCustomValidity = function updateCustomValidity () {\n if (!this.validity || !this.el || !isCallable(this.el.setCustomValidity) || !this.validator.errors) { return; }\n\n this.el.setCustomValidity(this.flags.valid ? '' : (this.validator.errors.firstById(this.id) || ''));\n};\n\n/**\n * Removes all listeners.\n */\nField.prototype.destroy = function destroy () {\n // ignore the result of any ongoing validation.\n if (this._cancellationToken) {\n this._cancellationToken.cancelled = true;\n }\n\n this.unwatch();\n this.dependencies.forEach(function (d) { return d.field.destroy(); });\n this.dependencies = [];\n};\n\nObject.defineProperties( Field.prototype, prototypeAccessors$1 );\n\n// \n\nvar FieldBag = function FieldBag (items) {\n if ( items === void 0 ) items = [];\n\n this.items = items || [];\n this.itemsById = this.items.reduce(function (itemsById, item) {\n itemsById[item.id] = item;\n return itemsById;\n }, {});\n};\n\nvar prototypeAccessors$2 = { length: { configurable: true } };\n\nFieldBag.prototype[typeof Symbol === 'function' ? Symbol.iterator : '@@iterator'] = function () {\n var this$1 = this;\n\n var index = 0;\n return {\n next: function () {\n return { value: this$1.items[index++], done: index > this$1.items.length };\n }\n };\n};\n\n/**\n * Gets the current items length.\n */\n\nprototypeAccessors$2.length.get = function () {\n return this.items.length;\n};\n\n/**\n * Finds the first field that matches the provided matcher object.\n */\nFieldBag.prototype.find = function find$1 (matcher) {\n return find(this.items, function (item) { return item.matches(matcher); });\n};\n\n/**\n * Finds the field with the given id, using a plain object as a map to link\n * ids to items faster than by looping over the array and matching.\n */\nFieldBag.prototype.findById = function findById (id) {\n return this.itemsById[id] || null;\n};\n\n/**\n * Filters the items down to the matched fields.\n */\nFieldBag.prototype.filter = function filter (matcher) {\n // multiple matchers to be tried.\n if (Array.isArray(matcher)) {\n return this.items.filter(function (item) { return matcher.some(function (m) { return item.matches(m); }); });\n }\n\n return this.items.filter(function (item) { return item.matches(matcher); });\n};\n\n/**\n * Maps the field items using the mapping function.\n */\nFieldBag.prototype.map = function map (mapper) {\n return this.items.map(mapper);\n};\n\n/**\n * Finds and removes the first field that matches the provided matcher object, returns the removed item.\n */\nFieldBag.prototype.remove = function remove (matcher) {\n var item = null;\n if (matcher instanceof Field) {\n item = matcher;\n } else {\n item = this.find(matcher);\n }\n\n if (!item) { return null; }\n\n var index = this.items.indexOf(item);\n this.items.splice(index, 1);\n delete this.itemsById[item.id];\n\n return item;\n};\n\n/**\n * Adds a field item to the list.\n */\nFieldBag.prototype.push = function push (item) {\n if (! (item instanceof Field)) {\n throw createError('FieldBag only accepts instances of Field that has an id defined.');\n }\n\n if (!item.id) {\n throw createError('Field id must be defined.');\n }\n\n if (this.findById(item.id)) {\n throw createError((\"Field with id \" + (item.id) + \" is already added.\"));\n }\n\n this.items.push(item);\n this.itemsById[item.id] = item;\n};\n\nObject.defineProperties( FieldBag.prototype, prototypeAccessors$2 );\n\nvar ScopedValidator = function ScopedValidator (base, vm) {\n this.id = vm._uid;\n this._base = base;\n this._paused = false;\n\n // create a mirror bag with limited component scope.\n this.errors = new ErrorBag(base.errors, this.id);\n};\n\nvar prototypeAccessors$3 = { flags: { configurable: true },rules: { configurable: true },fields: { configurable: true },dictionary: { configurable: true },locale: { configurable: true } };\n\nprototypeAccessors$3.flags.get = function () {\n var this$1 = this;\n\n return this._base.fields.items.filter(function (f) { return f.vmId === this$1.id; }).reduce(function (acc, field) {\n if (field.scope) {\n if (!acc[(\"$\" + (field.scope))]) {\n acc[(\"$\" + (field.scope))] = {};\n }\n\n acc[(\"$\" + (field.scope))][field.name] = field.flags;\n }\n\n acc[field.name] = field.flags;\n\n return acc;\n }, {});\n};\n\nprototypeAccessors$3.rules.get = function () {\n return this._base.rules;\n};\n\nprototypeAccessors$3.fields.get = function () {\n return new FieldBag(this._base.fields.filter({ vmId: this.id }));\n};\n\nprototypeAccessors$3.dictionary.get = function () {\n return this._base.dictionary;\n};\n\nprototypeAccessors$3.locale.get = function () {\n return this._base.locale;\n};\n\nprototypeAccessors$3.locale.set = function (val) {\n this._base.locale = val;\n};\n\nScopedValidator.prototype.localize = function localize () {\n var ref;\n\n var args = [], len = arguments.length;\n while ( len-- ) args[ len ] = arguments[ len ];\n return (ref = this._base).localize.apply(ref, args);\n};\n\nScopedValidator.prototype.update = function update () {\n var ref;\n\n var args = [], len = arguments.length;\n while ( len-- ) args[ len ] = arguments[ len ];\n return (ref = this._base).update.apply(ref, args);\n};\n\nScopedValidator.prototype.attach = function attach (opts) {\n var attachOpts = assign({}, opts, { vmId: this.id });\n\n return this._base.attach(attachOpts);\n};\n\nScopedValidator.prototype.pause = function pause () {\n this._paused = true;\n};\n\nScopedValidator.prototype.resume = function resume () {\n this._paused = false;\n};\n\nScopedValidator.prototype.remove = function remove (ruleName) {\n return this._base.remove(ruleName);\n};\n\nScopedValidator.prototype.detach = function detach (name, scope) {\n return this._base.detach(name, scope, this.id);\n};\n\nScopedValidator.prototype.extend = function extend () {\n var ref;\n\n var args = [], len = arguments.length;\n while ( len-- ) args[ len ] = arguments[ len ];\n return (ref = this._base).extend.apply(ref, args);\n};\n\nScopedValidator.prototype.validate = function validate (descriptor, value, opts) {\n if ( opts === void 0 ) opts = {};\n\n if (this._paused) { return Promise.resolve(true); }\n\n return this._base.validate(descriptor, value, assign({}, { vmId: this.id }, opts || {}));\n};\n\nScopedValidator.prototype.verify = function verify () {\n var ref;\n\n var args = [], len = arguments.length;\n while ( len-- ) args[ len ] = arguments[ len ];\n return (ref = this._base).verify.apply(ref, args);\n};\n\nScopedValidator.prototype.validateAll = function validateAll (values, opts) {\n if ( opts === void 0 ) opts = {};\n\n if (this._paused) { return Promise.resolve(true); }\n\n return this._base.validateAll(values, assign({}, { vmId: this.id }, opts || {}));\n};\n\nScopedValidator.prototype.validateScopes = function validateScopes (opts) {\n if ( opts === void 0 ) opts = {};\n\n if (this._paused) { return Promise.resolve(true); }\n\n return this._base.validateScopes(assign({}, { vmId: this.id }, opts || {}));\n};\n\nScopedValidator.prototype.destroy = function destroy () {\n delete this.id;\n delete this._base;\n};\n\nScopedValidator.prototype.reset = function reset (matcher) {\n return this._base.reset(Object.assign({}, matcher || {}, { vmId: this.id }));\n};\n\nScopedValidator.prototype.flag = function flag () {\n var ref;\n\n var args = [], len = arguments.length;\n while ( len-- ) args[ len ] = arguments[ len ];\n return (ref = this._base).flag.apply(ref, args.concat( [this.id] ));\n};\n\nScopedValidator.prototype._resolveField = function _resolveField () {\n var ref;\n\n var args = [], len = arguments.length;\n while ( len-- ) args[ len ] = arguments[ len ];\n return (ref = this._base)._resolveField.apply(ref, args);\n};\n\nObject.defineProperties( ScopedValidator.prototype, prototypeAccessors$3 );\n\nvar VALIDATOR = null;\n\nvar getValidator = function () {\n return VALIDATOR;\n};\n\nvar setValidator = function (value) {\n VALIDATOR = value;\n\n return value;\n};\n\n// \n\n/**\n * Checks if a parent validator instance was requested.\n */\nvar requestsValidator = function (injections) {\n if (isObject(injections) && injections.$validator) {\n return true;\n }\n\n return false;\n};\n\nvar mixin = {\n provide: function provide () {\n if (this.$validator && !isBuiltInComponent(this.$vnode)) {\n return {\n $validator: this.$validator\n };\n }\n\n return {};\n },\n beforeCreate: function beforeCreate () {\n // if built in do nothing.\n if (isBuiltInComponent(this.$vnode) || this.$options.$__veeInject === false) {\n return;\n }\n\n // if its a root instance set the config if it exists.\n if (!this.$parent) {\n setConfig(this.$options.$_veeValidate || {});\n }\n\n var options = resolveConfig(this);\n\n // if its a root instance, inject anyways, or if it requested a new instance.\n if (!this.$parent || (this.$options.$_veeValidate && /new/.test(this.$options.$_veeValidate.validator))) {\n this.$validator = new ScopedValidator(getValidator(), this);\n }\n\n var requested = requestsValidator(this.$options.inject);\n\n // if automatic injection is enabled and no instance was requested.\n if (! this.$validator && options.inject && !requested) {\n this.$validator = new ScopedValidator(getValidator(), this);\n }\n\n // don't inject errors or fieldBag as no validator was resolved.\n if (!requested && !this.$validator) {\n return;\n }\n\n // There is a validator but it isn't injected, mark as reactive.\n if (!requested && this.$validator) {\n var Vue = this.$options._base; // the vue constructor.\n Vue.util.defineReactive(this.$validator, 'errors', this.$validator.errors);\n }\n\n if (!this.$options.computed) {\n this.$options.computed = {};\n }\n\n this.$options.computed[options.errorBagName || 'errors'] = function errorBagGetter () {\n return this.$validator.errors;\n };\n this.$options.computed[options.fieldsBagName || 'fields'] = function fieldBagGetter () {\n return this.$validator.fields.items.reduce(function (acc, field) {\n if (field.scope) {\n if (!acc[(\"$\" + (field.scope))]) {\n acc[(\"$\" + (field.scope))] = {};\n }\n\n acc[(\"$\" + (field.scope))][field.name] = field.flags;\n\n return acc;\n }\n\n acc[field.name] = field.flags;\n\n return acc;\n }, {});\n };\n },\n beforeDestroy: function beforeDestroy () {\n if (this.$validator && this._uid === this.$validator.id) {\n this.$validator.errors.clear(); // remove errors generated by this component.\n }\n }\n};\n\n// \n\n/**\n * Finds the requested field by id from the context object.\n */\nfunction findField (el, context) {\n if (!context || !context.$validator) {\n return null;\n }\n\n return context.$validator.fields.findById(el._veeValidateId);\n}\nvar directive = {\n bind: function bind (el, binding, vnode) {\n var validator = vnode.context.$validator;\n if (!validator) {\n if (true) {\n warn(\"No validator instance is present on vm, did you forget to inject '$validator'?\");\n }\n\n return;\n }\n\n var fieldOptions = Resolver.generate(el, binding, vnode);\n validator.attach(fieldOptions);\n },\n inserted: function inserted (el, binding, vnode) {\n var field = findField(el, vnode.context);\n var scope = Resolver.resolveScope(el, binding, vnode);\n\n // skip if scope hasn't changed.\n if (!field || scope === field.scope) { return; }\n\n // only update scope.\n field.update({ scope: scope });\n\n // allows the field to re-evaluated once more in the update hook.\n field.updated = false;\n },\n update: function update (el, binding, vnode) {\n var field = findField(el, vnode.context);\n\n // make sure we don't do unneccasary work if no important change was done.\n if (!field || (field.updated && isEqual(binding.value, binding.oldValue))) { return; }\n var scope = Resolver.resolveScope(el, binding, vnode);\n var rules = Resolver.resolveRules(el, binding, vnode);\n\n field.update({\n scope: scope,\n rules: rules\n });\n },\n unbind: function unbind (el, binding, ref) {\n var context = ref.context;\n\n var field = findField(el, context);\n if (!field) { return; }\n\n context.$validator.detach(field);\n }\n};\n\n// \n\nvar Validator = function Validator (validations, options, pluginContainer) {\n if ( options === void 0 ) options = { fastExit: true };\n if ( pluginContainer === void 0 ) pluginContainer = null;\n\n this.errors = new ErrorBag();\n this.fields = new FieldBag();\n this._createFields(validations);\n this.paused = false;\n this.fastExit = !isNullOrUndefined(options && options.fastExit) ? options.fastExit : true;\n this.$vee = pluginContainer || {\n _vm: {\n $nextTick: function (cb) { return isCallable(cb) ? cb() : Promise.resolve(); },\n $emit: function () {},\n $off: function () {}\n }\n };\n};\n\nvar prototypeAccessors$4 = { rules: { configurable: true },dictionary: { configurable: true },flags: { configurable: true },locale: { configurable: true } };\nvar staticAccessors$1 = { rules: { configurable: true },dictionary: { configurable: true },locale: { configurable: true } };\n\n/**\n * @deprecated\n */\nstaticAccessors$1.rules.get = function () {\n if (true) {\n warn('this accessor will be deprecated, use `import { rules } from \"vee-validate\"` instead.');\n }\n\n return RuleContainer.rules;\n};\n\n/**\n * @deprecated\n */\nprototypeAccessors$4.rules.get = function () {\n if (true) {\n warn('this accessor will be deprecated, use `import { rules } from \"vee-validate\"` instead.');\n }\n\n return RuleContainer.rules;\n};\n\nprototypeAccessors$4.dictionary.get = function () {\n return DictionaryResolver.getDriver();\n};\n\nstaticAccessors$1.dictionary.get = function () {\n return DictionaryResolver.getDriver();\n};\n\nprototypeAccessors$4.flags.get = function () {\n return this.fields.items.reduce(function (acc, field) {\n var obj;\n\n if (field.scope) {\n acc[(\"$\" + (field.scope))] = ( obj = {}, obj[field.name] = field.flags, obj );\n\n return acc;\n }\n\n acc[field.name] = field.flags;\n\n return acc;\n }, {});\n};\n\n/**\n * Getter for the current locale.\n */\nprototypeAccessors$4.locale.get = function () {\n return Validator.locale;\n};\n\n/**\n * Setter for the validator locale.\n */\nprototypeAccessors$4.locale.set = function (value) {\n Validator.locale = value;\n};\n\nstaticAccessors$1.locale.get = function () {\n return DictionaryResolver.getDriver().locale;\n};\n\n/**\n * Setter for the validator locale.\n */\nstaticAccessors$1.locale.set = function (value) {\n var hasChanged = value !== DictionaryResolver.getDriver().locale;\n DictionaryResolver.getDriver().locale = value;\n if (hasChanged && Validator.$vee && Validator.$vee._vm) {\n Validator.$vee._vm.$emit('localeChanged');\n }\n};\n\n/**\n * Static constructor.\n * @deprecated\n */\nValidator.create = function create (validations, options) {\n if (true) {\n warn('Please use `new` to create new validator instances.');\n }\n\n return new Validator(validations, options);\n};\n\n/**\n * Adds a custom validator to the list of validation rules.\n */\nValidator.extend = function extend (name, validator, options) {\n if ( options === void 0 ) options = {};\n\n Validator._guardExtend(name, validator);\n // rules imported from the minimal bundle\n // will have the options embedded in them\n var mergedOpts = validator.options || {};\n Validator._merge(name, {\n validator: validator,\n paramNames: (options && options.paramNames) || validator.paramNames,\n options: assign({ hasTarget: false, immediate: true }, mergedOpts, options || {})\n });\n};\n\n/**\n * Removes a rule from the list of validators.\n * @deprecated\n */\nValidator.remove = function remove (name) {\n if (true) {\n warn('this method will be deprecated, you can still override your rules with `extend`');\n }\n\n RuleContainer.remove(name);\n};\n\n/**\n * Adds and sets the current locale for the validator.\n*/\nValidator.prototype.localize = function localize (lang, dictionary) {\n Validator.localize(lang, dictionary);\n};\n\n/**\n * Adds and sets the current locale for the validator.\n */\nValidator.localize = function localize (lang, dictionary) {\n var obj;\n\n if (isObject(lang)) {\n DictionaryResolver.getDriver().merge(lang);\n return;\n }\n\n // merge the dictionary.\n if (dictionary) {\n var locale = lang || dictionary.name;\n dictionary = assign({}, dictionary);\n DictionaryResolver.getDriver().merge(( obj = {}, obj[locale] = dictionary, obj ));\n }\n\n if (lang) {\n // set the locale.\n Validator.locale = lang;\n }\n};\n\n/**\n * Registers a field to be validated.\n */\nValidator.prototype.attach = function attach (fieldOpts) {\n var this$1 = this;\n\n // We search for a field with the same name & scope, having persist enabled\n var oldFieldMatcher = { name: fieldOpts.name, scope: fieldOpts.scope, persist: true };\n var oldField = fieldOpts.persist ? this.fields.find(oldFieldMatcher) : null;\n\n if (oldField) {\n // We keep the flags of the old field, then we remove its instance\n fieldOpts.flags = oldField.flags;\n oldField.destroy();\n this.fields.remove(oldField);\n }\n\n // fixes initial value detection with v-model and select elements.\n var value = fieldOpts.initialValue;\n var field = new Field(fieldOpts);\n this.fields.push(field);\n\n // validate the field initially\n if (field.immediate) {\n this.$vee._vm.$nextTick(function () { return this$1.validate((\"#\" + (field.id)), value || field.value, { vmId: fieldOpts.vmId }); });\n } else {\n this._validate(field, value || field.value, { initial: true }).then(function (result) {\n field.flags.valid = result.valid;\n field.flags.invalid = !result.valid;\n });\n }\n\n return field;\n};\n\n/**\n * Sets the flags on a field.\n */\nValidator.prototype.flag = function flag (name, flags, uid) {\n if ( uid === void 0 ) uid = null;\n\n var field = this._resolveField(name, undefined, uid);\n if (!field || !flags) {\n return;\n }\n\n field.setFlags(flags);\n};\n\n/**\n * Removes a field from the validator.\n */\nValidator.prototype.detach = function detach (name, scope, uid) {\n var field = isCallable(name.destroy) ? name : this._resolveField(name, scope, uid);\n if (!field) { return; }\n\n // We destroy/remove the field & error instances if it's not a `persist` one\n if (!field.persist) {\n field.destroy();\n this.errors.remove(field.name, field.scope, field.vmId);\n this.fields.remove(field);\n }\n};\n\n/**\n * Adds a custom validator to the list of validation rules.\n */\nValidator.prototype.extend = function extend (name, validator, options) {\n if ( options === void 0 ) options = {};\n\n Validator.extend(name, validator, options);\n};\n\nValidator.prototype.reset = function reset (matcher) {\n var this$1 = this;\n\n // two ticks\n return this.$vee._vm.$nextTick().then(function () {\n return this$1.$vee._vm.$nextTick();\n }).then(function () {\n this$1.fields.filter(matcher).forEach(function (field) {\n field.waitFor(null);\n field.reset(); // reset field flags.\n this$1.errors.remove(field.name, field.scope, matcher && matcher.vmId);\n });\n });\n};\n\n/**\n * Updates a field, updating both errors and flags.\n */\nValidator.prototype.update = function update (id, ref) {\n var scope = ref.scope;\n\n var field = this._resolveField((\"#\" + id));\n if (!field) { return; }\n\n // remove old scope.\n this.errors.update(id, { scope: scope });\n};\n\n/**\n * Removes a rule from the list of validators.\n * @deprecated\n */\nValidator.prototype.remove = function remove (name) {\n Validator.remove(name);\n};\n\n/**\n * Validates a value against a registered field validations.\n */\nValidator.prototype.validate = function validate (fieldDescriptor, value, ref) {\n var this$1 = this;\n if ( ref === void 0 ) ref = {};\n var silent = ref.silent;\n var vmId = ref.vmId;\n\n if (this.paused) { return Promise.resolve(true); }\n\n // overload to validate all.\n if (isNullOrUndefined(fieldDescriptor)) {\n return this.validateScopes({ silent: silent, vmId: vmId });\n }\n\n // overload to validate scope-less fields.\n if (fieldDescriptor === '*') {\n return this.validateAll(undefined, { silent: silent, vmId: vmId });\n }\n\n // if scope validation was requested.\n if (/^(.+)\\.\\*$/.test(fieldDescriptor)) {\n var matched = fieldDescriptor.match(/^(.+)\\.\\*$/)[1];\n return this.validateAll(matched);\n }\n\n var field = this._resolveField(fieldDescriptor);\n if (!field) {\n return this._handleFieldNotFound(fieldDescriptor);\n }\n\n if (!silent) { field.flags.pending = true; }\n if (value === undefined) {\n value = field.value;\n }\n\n var validationPromise = this._validate(field, value);\n field.waitFor(validationPromise);\n\n return validationPromise.then(function (result) {\n if (!silent && field.isWaitingFor(validationPromise)) {\n // allow next validation to mutate the state.\n field.waitFor(null);\n this$1._handleValidationResults([result], vmId);\n }\n\n return result.valid;\n });\n};\n\n/**\n * Pauses the validator.\n */\nValidator.prototype.pause = function pause () {\n this.paused = true;\n\n return this;\n};\n\n/**\n * Resumes the validator.\n */\nValidator.prototype.resume = function resume () {\n this.paused = false;\n\n return this;\n};\n\n/**\n * Validates each value against the corresponding field validations.\n */\nValidator.prototype.validateAll = function validateAll (values, ref) {\n var this$1 = this;\n if ( ref === void 0 ) ref = {};\n var silent = ref.silent;\n var vmId = ref.vmId;\n\n if (this.paused) { return Promise.resolve(true); }\n\n var matcher = null;\n var providedValues = false;\n\n if (typeof values === 'string') {\n matcher = { scope: values, vmId: vmId };\n } else if (isObject(values)) {\n matcher = Object.keys(values).map(function (key) {\n return { name: key, vmId: vmId, scope: null };\n });\n providedValues = true;\n } else if (Array.isArray(values)) {\n matcher = values.map(function (key) {\n return typeof key === 'object' ? Object.assign({ vmId: vmId }, key) : { name: key, vmId: vmId };\n });\n } else {\n matcher = { scope: null, vmId: vmId };\n }\n\n return Promise.all(\n this.fields.filter(matcher).map(function (field) { return this$1._validate(field, providedValues ? values[field.name] : field.value); })\n ).then(function (results) {\n if (!silent) {\n this$1._handleValidationResults(results, vmId);\n }\n\n return results.every(function (t) { return t.valid; });\n });\n};\n\n/**\n * Validates all scopes.\n */\nValidator.prototype.validateScopes = function validateScopes (ref) {\n var this$1 = this;\n if ( ref === void 0 ) ref = {};\n var silent = ref.silent;\n var vmId = ref.vmId;\n\n if (this.paused) { return Promise.resolve(true); }\n\n return Promise.all(\n this.fields.filter({ vmId: vmId }).map(function (field) { return this$1._validate(field, field.value); })\n ).then(function (results) {\n if (!silent) {\n this$1._handleValidationResults(results, vmId);\n }\n\n return results.every(function (t) { return t.valid; });\n });\n};\n\n/**\n * Validates a value against the rules.\n */\nValidator.prototype.verify = function verify (value, rules, options) {\n if ( options === void 0 ) options = {};\n\n var field = {\n name: (options && options.name) || '{field}',\n rules: normalizeRules(rules),\n bails: getPath('bails', options, true),\n forceRequired: false,\n get isRequired () {\n return !!this.rules.required || this.forceRequired;\n }\n };\n\n var targetRules = Object.keys(field.rules).filter(RuleContainer.isTargetRule);\n if (targetRules.length && options && isObject(options.values)) {\n field.dependencies = targetRules.map(function (rule) {\n var ref = field.rules[rule];\n var targetKey = ref[0];\n\n return {\n name: rule,\n field: { value: options.values[targetKey] }\n };\n });\n }\n\n return this._validate(field, value).then(function (result) {\n var errors = [];\n var ruleMap = {};\n result.errors.forEach(function (e) {\n errors.push(e.msg);\n ruleMap[e.rule] = e.msg;\n });\n\n return {\n valid: result.valid,\n errors: errors,\n failedRules: ruleMap\n };\n });\n};\n\n/**\n * Perform cleanup.\n */\nValidator.prototype.destroy = function destroy () {\n this.$vee._vm.$off('localeChanged');\n};\n\n/**\n * Creates the fields to be validated.\n */\nValidator.prototype._createFields = function _createFields (validations) {\n var this$1 = this;\n\n if (!validations) { return; }\n\n Object.keys(validations).forEach(function (field) {\n var options = assign({}, { name: field, rules: validations[field] });\n this$1.attach(options);\n });\n};\n\n/**\n * Date rules need the existence of a format, so date_format must be supplied.\n */\nValidator.prototype._getDateFormat = function _getDateFormat (validations) {\n var format = null;\n if (validations.date_format && Array.isArray(validations.date_format)) {\n format = validations.date_format[0];\n }\n\n return format || DictionaryResolver.getDriver().getDateFormat(this.locale);\n};\n\n/**\n * Formats an error message for field and a rule.\n */\nValidator.prototype._formatErrorMessage = function _formatErrorMessage (field, rule, data, targetName) {\n if ( data === void 0 ) data = {};\n if ( targetName === void 0 ) targetName = null;\n\n var name = this._getFieldDisplayName(field);\n var params = this._getLocalizedParams(rule, targetName);\n\n return DictionaryResolver.getDriver().getFieldMessage(this.locale, field.name, rule.name, [name, params, data]);\n};\n\n/**\n * We need to convert any object param to an array format since the locales do not handle params as objects yet.\n */\nValidator.prototype._convertParamObjectToArray = function _convertParamObjectToArray (obj, ruleName) {\n if (Array.isArray(obj)) {\n return obj;\n }\n\n var paramNames = RuleContainer.getParamNames(ruleName);\n if (!paramNames || !isObject(obj)) {\n return obj;\n }\n\n return paramNames.reduce(function (prev, paramName) {\n if (paramName in obj) {\n prev.push(obj[paramName]);\n }\n\n return prev;\n }, []);\n};\n\n/**\n * Translates the parameters passed to the rule (mainly for target fields).\n */\nValidator.prototype._getLocalizedParams = function _getLocalizedParams (rule, targetName) {\n if ( targetName === void 0 ) targetName = null;\n\n var params = this._convertParamObjectToArray(rule.params, rule.name);\n if (rule.options.hasTarget && params && params[0]) {\n var localizedName = targetName || DictionaryResolver.getDriver().getAttribute(this.locale, params[0], params[0]);\n return [localizedName].concat(params.slice(1));\n }\n\n return params;\n};\n\n/**\n * Resolves an appropriate display name, first checking 'data-as' or the registered 'prettyName'\n */\nValidator.prototype._getFieldDisplayName = function _getFieldDisplayName (field) {\n return field.alias || DictionaryResolver.getDriver().getAttribute(this.locale, field.name, field.name);\n};\n\n/**\n * Converts an array of params to an object with named properties.\n * Only works if the rule is configured with a paramNames array.\n * Returns the same params if it cannot convert it.\n */\nValidator.prototype._convertParamArrayToObj = function _convertParamArrayToObj (params, ruleName) {\n var paramNames = RuleContainer.getParamNames(ruleName);\n if (!paramNames) {\n return params;\n }\n\n if (isObject(params)) {\n // check if the object is either a config object or a single parameter that is an object.\n var hasKeys = paramNames.some(function (name) { return Object.keys(params).indexOf(name) !== -1; });\n // if it has some of the keys, return it as is.\n if (hasKeys) {\n return params;\n }\n // otherwise wrap the object in an array.\n params = [params];\n }\n\n // Reduce the paramsNames to a param object.\n return params.reduce(function (prev, value, idx) {\n prev[paramNames[idx]] = value;\n\n return prev;\n }, {});\n};\n\n/**\n * Tests a single input value against a rule.\n */\nValidator.prototype._test = function _test (field, value, rule) {\n var this$1 = this;\n\n var validator = RuleContainer.getValidatorMethod(rule.name);\n var params = Array.isArray(rule.params) ? toArray(rule.params) : rule.params;\n if (!params) {\n params = [];\n }\n\n var targetName = null;\n if (!validator || typeof validator !== 'function') {\n return Promise.reject(createError((\"No such validator '\" + (rule.name) + \"' exists.\")));\n }\n\n // has field dependencies.\n if (rule.options.hasTarget && field.dependencies) {\n var target = find(field.dependencies, function (d) { return d.name === rule.name; });\n if (target) {\n targetName = target.field.alias;\n params = [target.field.value].concat(params.slice(1));\n }\n } else if (rule.name === 'required' && field.rejectsFalse) {\n // invalidate false if no args were specified and the field rejects false by default.\n params = params.length ? params : [true];\n }\n\n if (rule.options.isDate) {\n var dateFormat = this._getDateFormat(field.rules);\n if (rule.name !== 'date_format') {\n params.push(dateFormat);\n }\n }\n\n var result = validator(value, this._convertParamArrayToObj(params, rule.name));\n\n // If it is a promise.\n if (isCallable(result.then)) {\n return result.then(function (values) {\n var allValid = true;\n var data = {};\n if (Array.isArray(values)) {\n allValid = values.every(function (t) { return (isObject(t) ? t.valid : t); });\n } else { // Is a single object/boolean.\n allValid = isObject(values) ? values.valid : values;\n data = values.data;\n }\n\n return {\n valid: allValid,\n data: result.data,\n errors: allValid ? [] : [this$1._createFieldError(field, rule, data, targetName)]\n };\n });\n }\n\n if (!isObject(result)) {\n result = { valid: result, data: {} };\n }\n\n return {\n valid: result.valid,\n data: result.data,\n errors: result.valid ? [] : [this._createFieldError(field, rule, result.data, targetName)]\n };\n};\n\n/**\n * Merges a validator object into the RULES and Messages.\n */\nValidator._merge = function _merge (name, ref) {\n var validator = ref.validator;\n var options = ref.options;\n var paramNames = ref.paramNames;\n\n var validate = isCallable(validator) ? validator : validator.validate;\n if (validator.getMessage) {\n DictionaryResolver.getDriver().setMessage(Validator.locale, name, validator.getMessage);\n }\n\n RuleContainer.add(name, {\n validate: validate,\n options: options,\n paramNames: paramNames\n });\n};\n\n/**\n * Guards from extension violations.\n */\nValidator._guardExtend = function _guardExtend (name, validator) {\n if (isCallable(validator)) {\n return;\n }\n\n if (!isCallable(validator.validate)) {\n throw createError(\n (\"Extension Error: The validator '\" + name + \"' must be a function or have a 'validate' method.\")\n );\n }\n};\n\n/**\n * Creates a Field Error Object.\n */\nValidator.prototype._createFieldError = function _createFieldError (field, rule, data, targetName) {\n var this$1 = this;\n\n return {\n id: field.id,\n vmId: field.vmId,\n field: field.name,\n msg: this._formatErrorMessage(field, rule, data, targetName),\n rule: rule.name,\n scope: field.scope,\n regenerate: function () {\n return this$1._formatErrorMessage(field, rule, data, targetName);\n }\n };\n};\n\n/**\n * Tries different strategies to find a field.\n */\nValidator.prototype._resolveField = function _resolveField (name, scope, uid) {\n if (name[0] === '#') {\n return this.fields.findById(name.slice(1));\n }\n\n if (!isNullOrUndefined(scope)) {\n return this.fields.find({ name: name, scope: scope, vmId: uid });\n }\n\n if (includes(name, '.')) {\n var ref = name.split('.');\n var fieldScope = ref[0];\n var fieldName = ref.slice(1);\n var field = this.fields.find({ name: fieldName.join('.'), scope: fieldScope, vmId: uid });\n if (field) {\n return field;\n }\n }\n\n return this.fields.find({ name: name, scope: null, vmId: uid });\n};\n\n/**\n * Handles when a field is not found.\n */\nValidator.prototype._handleFieldNotFound = function _handleFieldNotFound (name, scope) {\n var fullName = isNullOrUndefined(scope) ? name : (\"\" + (!isNullOrUndefined(scope) ? scope + '.' : '') + name);\n\n return Promise.reject(createError(\n (\"Validating a non-existent field: \\\"\" + fullName + \"\\\". Use \\\"attach()\\\" first.\")\n ));\n};\n\n/**\n * Handles validation results.\n */\nValidator.prototype._handleValidationResults = function _handleValidationResults (results, vmId) {\n var this$1 = this;\n\n var matchers = results.map(function (result) { return ({ id: result.id }); });\n this.errors.removeById(matchers.map(function (m) { return m.id; }));\n // remove by name and scope to remove any custom errors added.\n results.forEach(function (result) {\n this$1.errors.remove(result.field, result.scope, vmId);\n });\n var allErrors = results.reduce(function (prev, curr) {\n prev.push.apply(prev, curr.errors);\n\n return prev;\n }, []);\n\n this.errors.add(allErrors);\n\n // handle flags.\n this.fields.filter(matchers).forEach(function (field) {\n var result = find(results, function (r) { return r.id === field.id; });\n field.setFlags({\n pending: false,\n valid: result.valid,\n validated: true\n });\n });\n};\n\nValidator.prototype._shouldSkip = function _shouldSkip (field, value) {\n // field is configured to run through the pipeline regardless\n if (field.bails === false) {\n return false;\n }\n\n // disabled fields are skipped if useConstraintAttrs is enabled in config\n if (field.isDisabled && getConfig().useConstraintAttrs) {\n return true;\n }\n\n // skip if the field is not required and has an empty value.\n return !field.isRequired && (isNullOrUndefined(value) || value === '' || isEmptyArray(value));\n};\n\nValidator.prototype._shouldBail = function _shouldBail (field) {\n // if the field was configured explicitly.\n if (field.bails !== undefined) {\n return field.bails;\n }\n\n return this.fastExit;\n};\n\n/**\n * Starts the validation process.\n */\nValidator.prototype._validate = function _validate (field, value, ref) {\n var this$1 = this;\n if ( ref === void 0 ) ref = {};\n var initial = ref.initial;\n\n var requireRules = Object.keys(field.rules).filter(RuleContainer.isRequireRule);\n\n field.forceRequired = false;\n requireRules.forEach(function (rule) {\n var ruleOptions = RuleContainer.getOptions(rule);\n var result = this$1._test(field, value, { name: rule, params: field.rules[rule], options: ruleOptions });\n\n if (isCallable(result.then)) { throw createError('Require rules cannot be async'); }\n if (!isObject(result)) { throw createError('Require rules has to return an object (see docs)'); }\n\n if (result.data.required === true) {\n field.forceRequired = true;\n }\n });\n\n if (this._shouldSkip(field, value)) {\n return Promise.resolve({ valid: true, id: field.id, field: field.name, scope: field.scope, errors: [] });\n }\n\n var promises = [];\n var errors = [];\n var isExitEarly = false;\n if (isCallable(field.checkValueChanged)) {\n field.flags.changed = field.checkValueChanged();\n }\n\n // use of '.some()' is to break iteration in middle by returning true\n Object.keys(field.rules).filter(function (rule) {\n if (!initial || !RuleContainer.has(rule)) { return true; }\n\n return RuleContainer.isImmediate(rule);\n }).some(function (rule) {\n var ruleOptions = RuleContainer.getOptions(rule);\n var result = this$1._test(field, value, { name: rule, params: field.rules[rule], options: ruleOptions });\n if (isCallable(result.then)) {\n promises.push(result);\n } else if (!result.valid && this$1._shouldBail(field)) {\n errors.push.apply(errors, result.errors);\n isExitEarly = true;\n } else {\n // promisify the result.\n promises.push(new Promise(function (resolve) { return resolve(result); }));\n }\n\n return isExitEarly;\n });\n\n if (isExitEarly) {\n return Promise.resolve({ valid: false, errors: errors, id: field.id, field: field.name, scope: field.scope });\n }\n\n return Promise.all(promises).then(function (results) {\n return results.reduce(function (prev, v) {\n var ref;\n\n if (!v.valid) {\n (ref = prev.errors).push.apply(ref, v.errors);\n }\n\n prev.valid = prev.valid && v.valid;\n\n return prev;\n }, { valid: true, errors: errors, id: field.id, field: field.name, scope: field.scope });\n });\n};\n\nObject.defineProperties( Validator.prototype, prototypeAccessors$4 );\nObject.defineProperties( Validator, staticAccessors$1 );\n\n// \n\nvar normalizeValue = function (value) {\n if (isObject(value)) {\n return Object.keys(value).reduce(function (prev, key) {\n prev[key] = normalizeValue(value[key]);\n\n return prev;\n }, {});\n }\n\n if (isCallable(value)) {\n return value('{0}', ['{1}', '{2}', '{3}']);\n }\n\n return value;\n};\n\nvar normalizeFormat = function (locale) {\n // normalize messages\n var dictionary = {};\n if (locale.messages) {\n dictionary.messages = normalizeValue(locale.messages);\n }\n\n if (locale.custom) {\n dictionary.custom = normalizeValue(locale.custom);\n }\n\n if (locale.attributes) {\n dictionary.attributes = locale.attributes;\n }\n\n if (!isNullOrUndefined(locale.dateFormat)) {\n dictionary.dateFormat = locale.dateFormat;\n }\n\n return dictionary;\n};\n\nvar I18nDictionary = function I18nDictionary (i18n, rootKey) {\n this.i18n = i18n;\n this.rootKey = rootKey;\n};\n\nvar prototypeAccessors$5 = { locale: { configurable: true } };\n\nprototypeAccessors$5.locale.get = function () {\n return this.i18n.locale;\n};\n\nprototypeAccessors$5.locale.set = function (value) {\n warn('Cannot set locale from the validator when using vue-i18n, use i18n.locale setter instead');\n};\n\nI18nDictionary.prototype.getDateFormat = function getDateFormat (locale) {\n return this.i18n.getDateTimeFormat(locale || this.locale);\n};\n\nI18nDictionary.prototype.setDateFormat = function setDateFormat (locale, value) {\n this.i18n.setDateTimeFormat(locale || this.locale, value);\n};\n\nI18nDictionary.prototype.getMessage = function getMessage (_, key, data) {\n var path = (this.rootKey) + \".messages.\" + key;\n var dataOptions = data;\n\n if (Array.isArray(data)) {\n dataOptions = [].concat.apply([], data);\n }\n\n if (this.i18n.te(path)) {\n return this.i18n.t(path, dataOptions);\n }\n\n // fallback to the fallback message\n if (this.i18n.te(path, this.i18n.fallbackLocale)) {\n return this.i18n.t(path, this.i18n.fallbackLocale, dataOptions);\n }\n\n // fallback to the root message\n return this.i18n.t(((this.rootKey) + \".messages._default\"), dataOptions);\n};\n\nI18nDictionary.prototype.getAttribute = function getAttribute (_, key, fallback) {\n if ( fallback === void 0 ) fallback = '';\n\n var path = (this.rootKey) + \".attributes.\" + key;\n if (this.i18n.te(path)) {\n return this.i18n.t(path);\n }\n\n return fallback;\n};\n\nI18nDictionary.prototype.getFieldMessage = function getFieldMessage (_, field, key, data) {\n var path = (this.rootKey) + \".custom.\" + field + \".\" + key;\n if (this.i18n.te(path)) {\n return this.i18n.t(path, data);\n }\n\n return this.getMessage(_, key, data);\n};\n\nI18nDictionary.prototype.merge = function merge$1 (dictionary) {\n var this$1 = this;\n\n Object.keys(dictionary).forEach(function (localeKey) {\n var obj;\n\n // i18n doesn't deep merge\n // first clone the existing locale (avoid mutations to locale)\n var clone = merge({}, getPath((localeKey + \".\" + (this$1.rootKey)), this$1.i18n.messages, {}));\n // Merge cloned locale with new one\n var locale = merge(clone, normalizeFormat(dictionary[localeKey]));\n this$1.i18n.mergeLocaleMessage(localeKey, ( obj = {}, obj[this$1.rootKey] = locale, obj ));\n if (locale.dateFormat) {\n this$1.i18n.setDateTimeFormat(localeKey, locale.dateFormat);\n }\n });\n};\n\nI18nDictionary.prototype.setMessage = function setMessage (locale, key, value) {\n var obj, obj$1;\n\n this.merge(( obj$1 = {}, obj$1[locale] = {\n messages: ( obj = {}, obj[key] = value, obj )\n }, obj$1 ));\n};\n\nI18nDictionary.prototype.setAttribute = function setAttribute (locale, key, value) {\n var obj, obj$1;\n\n this.merge(( obj$1 = {}, obj$1[locale] = {\n attributes: ( obj = {}, obj[key] = value, obj )\n }, obj$1 ));\n};\n\nObject.defineProperties( I18nDictionary.prototype, prototypeAccessors$5 );\n\nvar aggressive = function () { return ({\n on: ['input']\n}); };\n\nvar lazy = function () { return ({\n on: ['change']\n}); };\n\nvar eager = function (ref) {\n var errors = ref.errors;\n\n if (errors.length) {\n return {\n on: ['input']\n };\n }\n\n return {\n on: ['change', 'blur']\n };\n};\n\nvar passive = function () { return ({\n on: []\n}); };\n\nvar modes = {\n aggressive: aggressive,\n eager: eager,\n passive: passive,\n lazy: lazy\n};\n\n// \n\nvar Vue;\nvar pendingPlugins;\nvar pluginInstance;\n\nvar VeeValidate$1 = function VeeValidate (config, _Vue) {\n this.configure(config);\n pluginInstance = this;\n if (_Vue) {\n Vue = _Vue;\n }\n this._validator = setValidator(\n new Validator(null, { fastExit: config && config.fastExit }, this)\n );\n this._initVM(this.config);\n this._initI18n(this.config);\n};\n\nvar prototypeAccessors$6 = { i18nDriver: { configurable: true },config: { configurable: true } };\nvar staticAccessors$2 = { i18nDriver: { configurable: true },config: { configurable: true } };\n\nVeeValidate$1.setI18nDriver = function setI18nDriver (driver, instance) {\n DictionaryResolver.setDriver(driver, instance);\n};\n\nVeeValidate$1.configure = function configure (cfg) {\n setConfig(cfg);\n};\n\nVeeValidate$1.setMode = function setMode (mode, implementation) {\n setConfig({ mode: mode });\n if (!implementation) {\n return;\n }\n\n if (!isCallable(implementation)) {\n throw new Error('A mode implementation must be a function');\n }\n\n modes[mode] = implementation;\n};\n\nVeeValidate$1.use = function use (plugin, options) {\n if ( options === void 0 ) options = {};\n\n if (!isCallable(plugin)) {\n return warn('The plugin must be a callable function');\n }\n\n // Don't install plugins until vee-validate is installed.\n if (!pluginInstance) {\n if (!pendingPlugins) {\n pendingPlugins = [];\n }\n pendingPlugins.push({ plugin: plugin, options: options });\n return;\n }\n\n plugin({ Validator: Validator, ErrorBag: ErrorBag, Rules: Validator.rules }, options);\n};\nVeeValidate$1.install = function install (_Vue, opts) {\n if (Vue && _Vue === Vue) {\n if (true) {\n warn('already installed, Vue.use(VeeValidate) should only be called once.');\n }\n return;\n }\n\n Vue = _Vue;\n pluginInstance = new VeeValidate$1(opts);\n // inject the plugin container statically into the validator class\n Validator.$vee = pluginInstance;\n\n detectPassiveSupport();\n\n Vue.mixin(mixin);\n Vue.directive('validate', directive);\n if (pendingPlugins) {\n pendingPlugins.forEach(function (ref) {\n var plugin = ref.plugin;\n var options = ref.options;\n\n VeeValidate$1.use(plugin, options);\n });\n pendingPlugins = null;\n }\n};\n\nprototypeAccessors$6.i18nDriver.get = function () {\n return DictionaryResolver.getDriver();\n};\n\nstaticAccessors$2.i18nDriver.get = function () {\n return DictionaryResolver.getDriver();\n};\n\nprototypeAccessors$6.config.get = function () {\n return getConfig();\n};\n\nstaticAccessors$2.config.get = function () {\n return getConfig();\n};\n\nVeeValidate$1.prototype._initVM = function _initVM (config) {\n var this$1 = this;\n\n this._vm = new Vue({\n data: function () { return ({\n errors: this$1._validator.errors,\n fields: this$1._validator.fields\n }); }\n });\n};\n\nVeeValidate$1.prototype._initI18n = function _initI18n (config) {\n var this$1 = this;\n\n var dictionary = config.dictionary;\n var i18n = config.i18n;\n var i18nRootKey = config.i18nRootKey;\n var locale = config.locale;\n var onLocaleChanged = function () {\n if (dictionary) {\n this$1.i18nDriver.merge(dictionary);\n }\n\n this$1._validator.errors.regenerate();\n };\n\n // i18 is being used for localization.\n if (i18n) {\n VeeValidate$1.setI18nDriver('i18n', new I18nDictionary(i18n, i18nRootKey));\n i18n._vm.$watch('locale', onLocaleChanged);\n } else if (typeof window !== 'undefined') {\n this._vm.$on('localeChanged', onLocaleChanged);\n }\n\n if (dictionary) {\n this.i18nDriver.merge(dictionary);\n }\n\n if (locale && !i18n) {\n this._validator.localize(locale);\n }\n};\n\nVeeValidate$1.prototype.configure = function configure (cfg) {\n setConfig(cfg);\n};\n\nObject.defineProperties( VeeValidate$1.prototype, prototypeAccessors$6 );\nObject.defineProperties( VeeValidate$1, staticAccessors$2 );\n\nVeeValidate$1.mixin = mixin;\nVeeValidate$1.directive = directive;\nVeeValidate$1.Validator = Validator;\nVeeValidate$1.ErrorBag = ErrorBag;\n\n/**\n * Formates file size.\n *\n * @param {Number|String} size\n */\nvar formatFileSize = function (size) {\n var units = ['Byte', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'];\n var threshold = 1024;\n size = Number(size) * threshold;\n var i = size === 0 ? 0 : Math.floor(Math.log(size) / Math.log(threshold));\n return (((size / Math.pow(threshold, i)).toFixed(2) * 1) + \" \" + (units[i]));\n};\n\n/**\n * Checks if vee-validate is defined globally.\n */\nvar isDefinedGlobally = function () {\n return typeof VeeValidate !== 'undefined';\n};\n\nvar obj;\n\nvar messages = {\n _default: function (field) { return (\"The \" + field + \" value is not valid\"); },\n after: function (field, ref) {\n var target = ref[0];\n var inclusion = ref[1];\n\n return (\"The \" + field + \" must be after \" + (inclusion ? 'or equal to ' : '') + target);\n},\n alpha: function (field) { return (\"The \" + field + \" field may only contain alphabetic characters\"); },\n alpha_dash: function (field) { return (\"The \" + field + \" field may contain alpha-numeric characters as well as dashes and underscores\"); },\n alpha_num: function (field) { return (\"The \" + field + \" field may only contain alpha-numeric characters\"); },\n alpha_spaces: function (field) { return (\"The \" + field + \" field may only contain alphabetic characters as well as spaces\"); },\n before: function (field, ref) {\n var target = ref[0];\n var inclusion = ref[1];\n\n return (\"The \" + field + \" must be before \" + (inclusion ? 'or equal to ' : '') + target);\n},\n between: function (field, ref) {\n var min = ref[0];\n var max = ref[1];\n\n return (\"The \" + field + \" field must be between \" + min + \" and \" + max);\n},\n confirmed: function (field) { return (\"The \" + field + \" confirmation does not match\"); },\n credit_card: function (field) { return (\"The \" + field + \" field is invalid\"); },\n date_between: function (field, ref) {\n var min = ref[0];\n var max = ref[1];\n\n return (\"The \" + field + \" must be between \" + min + \" and \" + max);\n},\n date_format: function (field, ref) {\n var format = ref[0];\n\n return (\"The \" + field + \" must be in the format \" + format);\n},\n decimal: function (field, ref) {\n if ( ref === void 0 ) ref = [];\n var decimals = ref[0]; if ( decimals === void 0 ) decimals = '*';\n\n return (\"The \" + field + \" field must be numeric and may contain\" + (!decimals || decimals === '*' ? '' : ' ' + decimals) + \" decimal points\");\n},\n digits: function (field, ref) {\n var length = ref[0];\n\n return (\"The \" + field + \" field must be numeric and contains exactly \" + length + \" digits\");\n},\n dimensions: function (field, ref) {\n var width = ref[0];\n var height = ref[1];\n\n return (\"The \" + field + \" field must be \" + width + \" pixels by \" + height + \" pixels\");\n},\n email: function (field) { return (\"The \" + field + \" field must be a valid email\"); },\n excluded: function (field) { return (\"The \" + field + \" field must be a valid value\"); },\n ext: function (field) { return (\"The \" + field + \" field must be a valid file\"); },\n image: function (field) { return (\"The \" + field + \" field must be an image\"); },\n included: function (field) { return (\"The \" + field + \" field must be a valid value\"); },\n integer: function (field) { return (\"The \" + field + \" field must be an integer\"); },\n ip: function (field) { return (\"The \" + field + \" field must be a valid ip address\"); },\n ip_or_fqdn: function (field) { return (\"The \" + field + \" field must be a valid ip address or FQDN\"); },\n length: function (field, ref) {\n var length = ref[0];\n var max = ref[1];\n\n if (max) {\n return (\"The \" + field + \" length must be between \" + length + \" and \" + max);\n }\n\n return (\"The \" + field + \" length must be \" + length);\n },\n max: function (field, ref) {\n var length = ref[0];\n\n return (\"The \" + field + \" field may not be greater than \" + length + \" characters\");\n},\n max_value: function (field, ref) {\n var max = ref[0];\n\n return (\"The \" + field + \" field must be \" + max + \" or less\");\n},\n mimes: function (field) { return (\"The \" + field + \" field must have a valid file type\"); },\n min: function (field, ref) {\n var length = ref[0];\n\n return (\"The \" + field + \" field must be at least \" + length + \" characters\");\n},\n min_value: function (field, ref) {\n var min = ref[0];\n\n return (\"The \" + field + \" field must be \" + min + \" or more\");\n},\n numeric: function (field) { return (\"The \" + field + \" field may only contain numeric characters\"); },\n regex: function (field) { return (\"The \" + field + \" field format is invalid\"); },\n required: function (field) { return (\"The \" + field + \" field is required\"); },\n required_if: function (field, ref) {\n var target = ref[0];\n\n return (\"The \" + field + \" field is required when the \" + target + \" field has this value\");\n},\n size: function (field, ref) {\n var size = ref[0];\n\n return (\"The \" + field + \" size must be less than \" + (formatFileSize(size)));\n},\n url: function (field) { return (\"The \" + field + \" field is not a valid URL\"); }\n};\n\nvar locale = {\n name: 'en',\n messages: messages,\n attributes: {}\n};\n\nif (isDefinedGlobally()) {\n // eslint-disable-next-line\n VeeValidate.Validator.localize(( obj = {}, obj[locale.name] = locale, obj ));\n}\n\nfunction toInteger (dirtyNumber) {\n if (dirtyNumber === null || dirtyNumber === true || dirtyNumber === false) {\n return NaN\n }\n\n var number = Number(dirtyNumber);\n\n if (isNaN(number)) {\n return number\n }\n\n return number < 0 ? Math.ceil(number) : Math.floor(number)\n}\n\nvar MILLISECONDS_IN_MINUTE = 60000;\n\n/**\n * Google Chrome as of 67.0.3396.87 introduced timezones with offset that includes seconds.\n * They usually appear for dates that denote time before the timezones were introduced\n * (e.g. for 'Europe/Prague' timezone the offset is GMT+00:57:44 before 1 October 1891\n * and GMT+01:00:00 after that date)\n *\n * Date#getTimezoneOffset returns the offset in minutes and would return 57 for the example above,\n * which would lead to incorrect calculations.\n *\n * This function returns the timezone offset in milliseconds that takes seconds in account.\n */\nfunction getTimezoneOffsetInMilliseconds (dirtyDate) {\n var date = new Date(dirtyDate.getTime());\n var baseTimezoneOffset = date.getTimezoneOffset();\n date.setSeconds(0, 0);\n var millisecondsPartOfTimezoneOffset = date.getTime() % MILLISECONDS_IN_MINUTE;\n\n return baseTimezoneOffset * MILLISECONDS_IN_MINUTE + millisecondsPartOfTimezoneOffset\n}\n\nvar MILLISECONDS_IN_HOUR = 3600000;\nvar MILLISECONDS_IN_MINUTE$1 = 60000;\nvar DEFAULT_ADDITIONAL_DIGITS = 2;\n\nvar patterns = {\n dateTimeDelimeter: /[T ]/,\n plainTime: /:/,\n timeZoneDelimeter: /[Z ]/i,\n\n // year tokens\n YY: /^(\\d{2})$/,\n YYY: [\n /^([+-]\\d{2})$/, // 0 additional digits\n /^([+-]\\d{3})$/, // 1 additional digit\n /^([+-]\\d{4})$/ // 2 additional digits\n ],\n YYYY: /^(\\d{4})/,\n YYYYY: [\n /^([+-]\\d{4})/, // 0 additional digits\n /^([+-]\\d{5})/, // 1 additional digit\n /^([+-]\\d{6})/ // 2 additional digits\n ],\n\n // date tokens\n MM: /^-(\\d{2})$/,\n DDD: /^-?(\\d{3})$/,\n MMDD: /^-?(\\d{2})-?(\\d{2})$/,\n Www: /^-?W(\\d{2})$/,\n WwwD: /^-?W(\\d{2})-?(\\d{1})$/,\n\n HH: /^(\\d{2}([.,]\\d*)?)$/,\n HHMM: /^(\\d{2}):?(\\d{2}([.,]\\d*)?)$/,\n HHMMSS: /^(\\d{2}):?(\\d{2}):?(\\d{2}([.,]\\d*)?)$/,\n\n // timezone tokens\n timezone: /([Z+-].*)$/,\n timezoneZ: /^(Z)$/,\n timezoneHH: /^([+-])(\\d{2})$/,\n timezoneHHMM: /^([+-])(\\d{2}):?(\\d{2})$/\n};\n\n/**\n * @name toDate\n * @category Common Helpers\n * @summary Convert the given argument to an instance of Date.\n *\n * @description\n * Convert the given argument to an instance of Date.\n *\n * If the argument is an instance of Date, the function returns its clone.\n *\n * If the argument is a number, it is treated as a timestamp.\n *\n * If an argument is a string, the function tries to parse it.\n * Function accepts complete ISO 8601 formats as well as partial implementations.\n * ISO 8601: http://en.wikipedia.org/wiki/ISO_8601\n * If the function cannot parse the string or the values are invalid, it returns Invalid Date.\n *\n * If the argument is none of the above, the function returns Invalid Date.\n *\n * **Note**: *all* Date arguments passed to any *date-fns* function is processed by `toDate`.\n * All *date-fns* functions will throw `RangeError` if `options.additionalDigits` is not 0, 1, 2 or undefined.\n *\n * @param {Date|String|Number} argument - the value to convert\n * @param {Options} [options] - the object with options. See [Options]{@link https://date-fns.org/docs/Options}\n * @param {0|1|2} [options.additionalDigits=2] - the additional number of digits in the extended year format\n * @returns {Date} the parsed date in the local time zone\n * @throws {TypeError} 1 argument required\n * @throws {RangeError} `options.additionalDigits` must be 0, 1 or 2\n *\n * @example\n * // Convert string '2014-02-11T11:30:30' to date:\n * var result = toDate('2014-02-11T11:30:30')\n * //=> Tue Feb 11 2014 11:30:30\n *\n * @example\n * // Convert string '+02014101' to date,\n * // if the additional number of digits in the extended year format is 1:\n * var result = toDate('+02014101', {additionalDigits: 1})\n * //=> Fri Apr 11 2014 00:00:00\n */\nfunction toDate (argument, dirtyOptions) {\n if (arguments.length < 1) {\n throw new TypeError('1 argument required, but only ' + arguments.length + ' present')\n }\n\n if (argument === null) {\n return new Date(NaN)\n }\n\n var options = dirtyOptions || {};\n\n var additionalDigits = options.additionalDigits == null ? DEFAULT_ADDITIONAL_DIGITS : toInteger(options.additionalDigits);\n if (additionalDigits !== 2 && additionalDigits !== 1 && additionalDigits !== 0) {\n throw new RangeError('additionalDigits must be 0, 1 or 2')\n }\n\n // Clone the date\n if (argument instanceof Date ||\n (typeof argument === 'object' && Object.prototype.toString.call(argument) === '[object Date]')\n ) {\n // Prevent the date to lose the milliseconds when passed to new Date() in IE10\n return new Date(argument.getTime())\n } else if (typeof argument === 'number' || Object.prototype.toString.call(argument) === '[object Number]') {\n return new Date(argument)\n } else if (!(typeof argument === 'string' || Object.prototype.toString.call(argument) === '[object String]')) {\n return new Date(NaN)\n }\n\n var dateStrings = splitDateString(argument);\n\n var parseYearResult = parseYear(dateStrings.date, additionalDigits);\n var year = parseYearResult.year;\n var restDateString = parseYearResult.restDateString;\n\n var date = parseDate(restDateString, year);\n\n if (isNaN(date)) {\n return new Date(NaN)\n }\n\n if (date) {\n var timestamp = date.getTime();\n var time = 0;\n var offset;\n\n if (dateStrings.time) {\n time = parseTime(dateStrings.time);\n\n if (isNaN(time)) {\n return new Date(NaN)\n }\n }\n\n if (dateStrings.timezone) {\n offset = parseTimezone(dateStrings.timezone);\n if (isNaN(offset)) {\n return new Date(NaN)\n }\n } else {\n // get offset accurate to hour in timezones that change offset\n offset = getTimezoneOffsetInMilliseconds(new Date(timestamp + time));\n offset = getTimezoneOffsetInMilliseconds(new Date(timestamp + time + offset));\n }\n\n return new Date(timestamp + time + offset)\n } else {\n return new Date(NaN)\n }\n}\n\nfunction splitDateString (dateString) {\n var dateStrings = {};\n var array = dateString.split(patterns.dateTimeDelimeter);\n var timeString;\n\n if (patterns.plainTime.test(array[0])) {\n dateStrings.date = null;\n timeString = array[0];\n } else {\n dateStrings.date = array[0];\n timeString = array[1];\n if (patterns.timeZoneDelimeter.test(dateStrings.date)) {\n dateStrings.date = dateString.split(patterns.timeZoneDelimeter)[0];\n timeString = dateString.substr(dateStrings.date.length, dateString.length);\n }\n }\n\n if (timeString) {\n var token = patterns.timezone.exec(timeString);\n if (token) {\n dateStrings.time = timeString.replace(token[1], '');\n dateStrings.timezone = token[1];\n } else {\n dateStrings.time = timeString;\n }\n }\n\n return dateStrings\n}\n\nfunction parseYear (dateString, additionalDigits) {\n var patternYYY = patterns.YYY[additionalDigits];\n var patternYYYYY = patterns.YYYYY[additionalDigits];\n\n var token;\n\n // YYYY or ±YYYYY\n token = patterns.YYYY.exec(dateString) || patternYYYYY.exec(dateString);\n if (token) {\n var yearString = token[1];\n return {\n year: parseInt(yearString, 10),\n restDateString: dateString.slice(yearString.length)\n }\n }\n\n // YY or ±YYY\n token = patterns.YY.exec(dateString) || patternYYY.exec(dateString);\n if (token) {\n var centuryString = token[1];\n return {\n year: parseInt(centuryString, 10) * 100,\n restDateString: dateString.slice(centuryString.length)\n }\n }\n\n // Invalid ISO-formatted year\n return {\n year: null\n }\n}\n\nfunction parseDate (dateString, year) {\n // Invalid ISO-formatted year\n if (year === null) {\n return null\n }\n\n var token;\n var date;\n var month;\n var week;\n\n // YYYY\n if (dateString.length === 0) {\n date = new Date(0);\n date.setUTCFullYear(year);\n return date\n }\n\n // YYYY-MM\n token = patterns.MM.exec(dateString);\n if (token) {\n date = new Date(0);\n month = parseInt(token[1], 10) - 1;\n\n if (!validateDate(year, month)) {\n return new Date(NaN)\n }\n\n date.setUTCFullYear(year, month);\n return date\n }\n\n // YYYY-DDD or YYYYDDD\n token = patterns.DDD.exec(dateString);\n if (token) {\n date = new Date(0);\n var dayOfYear = parseInt(token[1], 10);\n\n if (!validateDayOfYearDate(year, dayOfYear)) {\n return new Date(NaN)\n }\n\n date.setUTCFullYear(year, 0, dayOfYear);\n return date\n }\n\n // YYYY-MM-DD or YYYYMMDD\n token = patterns.MMDD.exec(dateString);\n if (token) {\n date = new Date(0);\n month = parseInt(token[1], 10) - 1;\n var day = parseInt(token[2], 10);\n\n if (!validateDate(year, month, day)) {\n return new Date(NaN)\n }\n\n date.setUTCFullYear(year, month, day);\n return date\n }\n\n // YYYY-Www or YYYYWww\n token = patterns.Www.exec(dateString);\n if (token) {\n week = parseInt(token[1], 10) - 1;\n\n if (!validateWeekDate(year, week)) {\n return new Date(NaN)\n }\n\n return dayOfISOWeekYear(year, week)\n }\n\n // YYYY-Www-D or YYYYWwwD\n token = patterns.WwwD.exec(dateString);\n if (token) {\n week = parseInt(token[1], 10) - 1;\n var dayOfWeek = parseInt(token[2], 10) - 1;\n\n if (!validateWeekDate(year, week, dayOfWeek)) {\n return new Date(NaN)\n }\n\n return dayOfISOWeekYear(year, week, dayOfWeek)\n }\n\n // Invalid ISO-formatted date\n return null\n}\n\nfunction parseTime (timeString) {\n var token;\n var hours;\n var minutes;\n\n // hh\n token = patterns.HH.exec(timeString);\n if (token) {\n hours = parseFloat(token[1].replace(',', '.'));\n\n if (!validateTime(hours)) {\n return NaN\n }\n\n return (hours % 24) * MILLISECONDS_IN_HOUR\n }\n\n // hh:mm or hhmm\n token = patterns.HHMM.exec(timeString);\n if (token) {\n hours = parseInt(token[1], 10);\n minutes = parseFloat(token[2].replace(',', '.'));\n\n if (!validateTime(hours, minutes)) {\n return NaN\n }\n\n return (hours % 24) * MILLISECONDS_IN_HOUR +\n minutes * MILLISECONDS_IN_MINUTE$1\n }\n\n // hh:mm:ss or hhmmss\n token = patterns.HHMMSS.exec(timeString);\n if (token) {\n hours = parseInt(token[1], 10);\n minutes = parseInt(token[2], 10);\n var seconds = parseFloat(token[3].replace(',', '.'));\n\n if (!validateTime(hours, minutes, seconds)) {\n return NaN\n }\n\n return (hours % 24) * MILLISECONDS_IN_HOUR +\n minutes * MILLISECONDS_IN_MINUTE$1 +\n seconds * 1000\n }\n\n // Invalid ISO-formatted time\n return null\n}\n\nfunction parseTimezone (timezoneString) {\n var token;\n var absoluteOffset;\n\n // Z\n token = patterns.timezoneZ.exec(timezoneString);\n if (token) {\n return 0\n }\n\n var hours;\n\n // ±hh\n token = patterns.timezoneHH.exec(timezoneString);\n if (token) {\n hours = parseInt(token[2], 10);\n\n if (!validateTimezone()) {\n return NaN\n }\n\n absoluteOffset = hours * MILLISECONDS_IN_HOUR;\n return (token[1] === '+') ? -absoluteOffset : absoluteOffset\n }\n\n // ±hh:mm or ±hhmm\n token = patterns.timezoneHHMM.exec(timezoneString);\n if (token) {\n hours = parseInt(token[2], 10);\n var minutes = parseInt(token[3], 10);\n\n if (!validateTimezone(hours, minutes)) {\n return NaN\n }\n\n absoluteOffset = hours * MILLISECONDS_IN_HOUR + minutes * MILLISECONDS_IN_MINUTE$1;\n return (token[1] === '+') ? -absoluteOffset : absoluteOffset\n }\n\n return 0\n}\n\nfunction dayOfISOWeekYear (isoWeekYear, week, day) {\n week = week || 0;\n day = day || 0;\n var date = new Date(0);\n date.setUTCFullYear(isoWeekYear, 0, 4);\n var fourthOfJanuaryDay = date.getUTCDay() || 7;\n var diff = week * 7 + day + 1 - fourthOfJanuaryDay;\n date.setUTCDate(date.getUTCDate() + diff);\n return date\n}\n\n// Validation functions\n\nvar DAYS_IN_MONTH = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];\nvar DAYS_IN_MONTH_LEAP_YEAR = [31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];\n\nfunction isLeapYearIndex (year) {\n return year % 400 === 0 || (year % 4 === 0 && year % 100 !== 0)\n}\n\nfunction validateDate (year, month, date) {\n if (month < 0 || month > 11) {\n return false\n }\n\n if (date != null) {\n if (date < 1) {\n return false\n }\n\n var isLeapYear = isLeapYearIndex(year);\n if (isLeapYear && date > DAYS_IN_MONTH_LEAP_YEAR[month]) {\n return false\n }\n if (!isLeapYear && date > DAYS_IN_MONTH[month]) {\n return false\n }\n }\n\n return true\n}\n\nfunction validateDayOfYearDate (year, dayOfYear) {\n if (dayOfYear < 1) {\n return false\n }\n\n var isLeapYear = isLeapYearIndex(year);\n if (isLeapYear && dayOfYear > 366) {\n return false\n }\n if (!isLeapYear && dayOfYear > 365) {\n return false\n }\n\n return true\n}\n\nfunction validateWeekDate (year, week, day) {\n if (week < 0 || week > 52) {\n return false\n }\n\n if (day != null && (day < 0 || day > 6)) {\n return false\n }\n\n return true\n}\n\nfunction validateTime (hours, minutes, seconds) {\n if (hours != null && (hours < 0 || hours >= 25)) {\n return false\n }\n\n if (minutes != null && (minutes < 0 || minutes >= 60)) {\n return false\n }\n\n if (seconds != null && (seconds < 0 || seconds >= 60)) {\n return false\n }\n\n return true\n}\n\nfunction validateTimezone (hours, minutes) {\n if (minutes != null && (minutes < 0 || minutes > 59)) {\n return false\n }\n\n return true\n}\n\n/**\n * @name addMilliseconds\n * @category Millisecond Helpers\n * @summary Add the specified number of milliseconds to the given date.\n *\n * @description\n * Add the specified number of milliseconds to the given date.\n *\n * @param {Date|String|Number} date - the date to be changed\n * @param {Number} amount - the amount of milliseconds to be added\n * @param {Options} [options] - the object with options. See [Options]{@link https://date-fns.org/docs/Options}\n * @param {0|1|2} [options.additionalDigits=2] - passed to `toDate`. See [toDate]{@link https://date-fns.org/docs/toDate}\n * @returns {Date} the new date with the milliseconds added\n * @throws {TypeError} 2 arguments required\n * @throws {RangeError} `options.additionalDigits` must be 0, 1 or 2\n *\n * @example\n * // Add 750 milliseconds to 10 July 2014 12:45:30.000:\n * var result = addMilliseconds(new Date(2014, 6, 10, 12, 45, 30, 0), 750)\n * //=> Thu Jul 10 2014 12:45:30.750\n */\nfunction addMilliseconds (dirtyDate, dirtyAmount, dirtyOptions) {\n if (arguments.length < 2) {\n throw new TypeError('2 arguments required, but only ' + arguments.length + ' present')\n }\n\n var timestamp = toDate(dirtyDate, dirtyOptions).getTime();\n var amount = toInteger(dirtyAmount);\n return new Date(timestamp + amount)\n}\n\n/**\n * @name isValid\n * @category Common Helpers\n * @summary Is the given date valid?\n *\n * @description\n * Returns false if argument is Invalid Date and true otherwise.\n * Argument is converted to Date using `toDate`. See [toDate]{@link https://date-fns.org/docs/toDate}\n * Invalid Date is a Date, whose time value is NaN.\n *\n * Time value of Date: http://es5.github.io/#x15.9.1.1\n *\n * @param {*} date - the date to check\n * @param {Options} [options] - the object with options. See [Options]{@link https://date-fns.org/docs/Options}\n * @param {0|1|2} [options.additionalDigits=2] - passed to `toDate`. See [toDate]{@link https://date-fns.org/docs/toDate}\n * @returns {Boolean} the date is valid\n * @throws {TypeError} 1 argument required\n * @throws {RangeError} `options.additionalDigits` must be 0, 1 or 2\n *\n * @example\n * // For the valid date:\n * var result = isValid(new Date(2014, 1, 31))\n * //=> true\n *\n * @example\n * // For the value, convertable into a date:\n * var result = isValid('2014-02-31')\n * //=> true\n *\n * @example\n * // For the invalid date:\n * var result = isValid(new Date(''))\n * //=> false\n */\nfunction isValid (dirtyDate, dirtyOptions) {\n if (arguments.length < 1) {\n throw new TypeError('1 argument required, but only ' + arguments.length + ' present')\n }\n\n var date = toDate(dirtyDate, dirtyOptions);\n return !isNaN(date)\n}\n\nvar formatDistanceLocale = {\n lessThanXSeconds: {\n one: 'less than a second',\n other: 'less than {{count}} seconds'\n },\n\n xSeconds: {\n one: '1 second',\n other: '{{count}} seconds'\n },\n\n halfAMinute: 'half a minute',\n\n lessThanXMinutes: {\n one: 'less than a minute',\n other: 'less than {{count}} minutes'\n },\n\n xMinutes: {\n one: '1 minute',\n other: '{{count}} minutes'\n },\n\n aboutXHours: {\n one: 'about 1 hour',\n other: 'about {{count}} hours'\n },\n\n xHours: {\n one: '1 hour',\n other: '{{count}} hours'\n },\n\n xDays: {\n one: '1 day',\n other: '{{count}} days'\n },\n\n aboutXMonths: {\n one: 'about 1 month',\n other: 'about {{count}} months'\n },\n\n xMonths: {\n one: '1 month',\n other: '{{count}} months'\n },\n\n aboutXYears: {\n one: 'about 1 year',\n other: 'about {{count}} years'\n },\n\n xYears: {\n one: '1 year',\n other: '{{count}} years'\n },\n\n overXYears: {\n one: 'over 1 year',\n other: 'over {{count}} years'\n },\n\n almostXYears: {\n one: 'almost 1 year',\n other: 'almost {{count}} years'\n }\n};\n\nfunction formatDistance (token, count, options) {\n options = options || {};\n\n var result;\n if (typeof formatDistanceLocale[token] === 'string') {\n result = formatDistanceLocale[token];\n } else if (count === 1) {\n result = formatDistanceLocale[token].one;\n } else {\n result = formatDistanceLocale[token].other.replace('{{count}}', count);\n }\n\n if (options.addSuffix) {\n if (options.comparison > 0) {\n return 'in ' + result\n } else {\n return result + ' ago'\n }\n }\n\n return result\n}\n\nfunction buildFormatLongFn (args) {\n return function (dirtyOptions) {\n var options = dirtyOptions || {};\n var width = options.width ? String(options.width) : args.defaultWidth;\n var format = args.formats[width] || args.formats[args.defaultWidth];\n return format\n }\n}\n\nvar dateFormats = {\n full: 'EEEE, MMMM do, y',\n long: 'MMMM do, y',\n medium: 'MMM d, y',\n short: 'MM/dd/yyyy'\n};\n\nvar timeFormats = {\n full: 'h:mm:ss a zzzz',\n long: 'h:mm:ss a z',\n medium: 'h:mm:ss a',\n short: 'h:mm a'\n};\n\nvar dateTimeFormats = {\n full: \"{{date}} 'at' {{time}}\",\n long: \"{{date}} 'at' {{time}}\",\n medium: '{{date}}, {{time}}',\n short: '{{date}}, {{time}}'\n};\n\nvar formatLong = {\n date: buildFormatLongFn({\n formats: dateFormats,\n defaultWidth: 'full'\n }),\n\n time: buildFormatLongFn({\n formats: timeFormats,\n defaultWidth: 'full'\n }),\n\n dateTime: buildFormatLongFn({\n formats: dateTimeFormats,\n defaultWidth: 'full'\n })\n};\n\nvar formatRelativeLocale = {\n lastWeek: \"'last' eeee 'at' p\",\n yesterday: \"'yesterday at' p\",\n today: \"'today at' p\",\n tomorrow: \"'tomorrow at' p\",\n nextWeek: \"eeee 'at' p\",\n other: 'P'\n};\n\nfunction formatRelative (token, date, baseDate, options) {\n return formatRelativeLocale[token]\n}\n\nfunction buildLocalizeFn (args) {\n return function (dirtyIndex, dirtyOptions) {\n var options = dirtyOptions || {};\n var width = options.width ? String(options.width) : args.defaultWidth;\n var context = options.context ? String(options.context) : 'standalone';\n\n var valuesArray;\n if (context === 'formatting' && args.formattingValues) {\n valuesArray = args.formattingValues[width] || args.formattingValues[args.defaultFormattingWidth];\n } else {\n valuesArray = args.values[width] || args.values[args.defaultWidth];\n }\n var index = args.argumentCallback ? args.argumentCallback(dirtyIndex) : dirtyIndex;\n return valuesArray[index]\n }\n}\n\nvar eraValues = {\n narrow: ['B', 'A'],\n abbreviated: ['BC', 'AD'],\n wide: ['Before Christ', 'Anno Domini']\n};\n\nvar quarterValues = {\n narrow: ['1', '2', '3', '4'],\n abbreviated: ['Q1', 'Q2', 'Q3', 'Q4'],\n wide: ['1st quarter', '2nd quarter', '3rd quarter', '4th quarter']\n};\n\n// Note: in English, the names of days of the week and months are capitalized.\n// If you are making a new locale based on this one, check if the same is true for the language you're working on.\n// Generally, formatted dates should look like they are in the middle of a sentence,\n// e.g. in Spanish language the weekdays and months should be in the lowercase.\nvar monthValues = {\n narrow: ['J', 'F', 'M', 'A', 'M', 'J', 'J', 'A', 'S', 'O', 'N', 'D'],\n abbreviated: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],\n wide: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']\n};\n\nvar dayValues = {\n narrow: ['S', 'M', 'T', 'W', 'T', 'F', 'S'],\n short: ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'],\n abbreviated: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],\n wide: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday']\n};\n\nvar dayPeriodValues = {\n narrow: {\n am: 'a',\n pm: 'p',\n midnight: 'mi',\n noon: 'n',\n morning: 'morning',\n afternoon: 'afternoon',\n evening: 'evening',\n night: 'night'\n },\n abbreviated: {\n am: 'AM',\n pm: 'PM',\n midnight: 'midnight',\n noon: 'noon',\n morning: 'morning',\n afternoon: 'afternoon',\n evening: 'evening',\n night: 'night'\n },\n wide: {\n am: 'a.m.',\n pm: 'p.m.',\n midnight: 'midnight',\n noon: 'noon',\n morning: 'morning',\n afternoon: 'afternoon',\n evening: 'evening',\n night: 'night'\n }\n};\nvar formattingDayPeriodValues = {\n narrow: {\n am: 'a',\n pm: 'p',\n midnight: 'mi',\n noon: 'n',\n morning: 'in the morning',\n afternoon: 'in the afternoon',\n evening: 'in the evening',\n night: 'at night'\n },\n abbreviated: {\n am: 'AM',\n pm: 'PM',\n midnight: 'midnight',\n noon: 'noon',\n morning: 'in the morning',\n afternoon: 'in the afternoon',\n evening: 'in the evening',\n night: 'at night'\n },\n wide: {\n am: 'a.m.',\n pm: 'p.m.',\n midnight: 'midnight',\n noon: 'noon',\n morning: 'in the morning',\n afternoon: 'in the afternoon',\n evening: 'in the evening',\n night: 'at night'\n }\n};\n\nfunction ordinalNumber (dirtyNumber, dirtyOptions) {\n var number = Number(dirtyNumber);\n\n // If ordinal numbers depend on context, for example,\n // if they are different for different grammatical genders,\n // use `options.unit`:\n //\n // var options = dirtyOptions || {}\n // var unit = String(options.unit)\n //\n // where `unit` can be 'year', 'quarter', 'month', 'week', 'date', 'dayOfYear',\n // 'day', 'hour', 'minute', 'second'\n\n var rem100 = number % 100;\n if (rem100 > 20 || rem100 < 10) {\n switch (rem100 % 10) {\n case 1:\n return number + 'st'\n case 2:\n return number + 'nd'\n case 3:\n return number + 'rd'\n }\n }\n return number + 'th'\n}\n\nvar localize = {\n ordinalNumber: ordinalNumber,\n\n era: buildLocalizeFn({\n values: eraValues,\n defaultWidth: 'wide'\n }),\n\n quarter: buildLocalizeFn({\n values: quarterValues,\n defaultWidth: 'wide',\n argumentCallback: function (quarter) {\n return Number(quarter) - 1\n }\n }),\n\n month: buildLocalizeFn({\n values: monthValues,\n defaultWidth: 'wide'\n }),\n\n day: buildLocalizeFn({\n values: dayValues,\n defaultWidth: 'wide'\n }),\n\n dayPeriod: buildLocalizeFn({\n values: dayPeriodValues,\n defaultWidth: 'wide',\n formattingValues: formattingDayPeriodValues,\n defaulFormattingWidth: 'wide'\n })\n};\n\nfunction buildMatchPatternFn (args) {\n return function (dirtyString, dirtyOptions) {\n var string = String(dirtyString);\n var options = dirtyOptions || {};\n\n var matchResult = string.match(args.matchPattern);\n if (!matchResult) {\n return null\n }\n var matchedString = matchResult[0];\n\n var parseResult = string.match(args.parsePattern);\n if (!parseResult) {\n return null\n }\n var value = args.valueCallback ? args.valueCallback(parseResult[0]) : parseResult[0];\n value = options.valueCallback ? options.valueCallback(value) : value;\n\n return {\n value: value,\n rest: string.slice(matchedString.length)\n }\n }\n}\n\nfunction buildMatchFn (args) {\n return function (dirtyString, dirtyOptions) {\n var string = String(dirtyString);\n var options = dirtyOptions || {};\n var width = options.width;\n\n var matchPattern = (width && args.matchPatterns[width]) || args.matchPatterns[args.defaultMatchWidth];\n var matchResult = string.match(matchPattern);\n\n if (!matchResult) {\n return null\n }\n var matchedString = matchResult[0];\n\n var parsePatterns = (width && args.parsePatterns[width]) || args.parsePatterns[args.defaultParseWidth];\n\n var value;\n if (Object.prototype.toString.call(parsePatterns) === '[object Array]') {\n value = parsePatterns.findIndex(function (pattern) {\n return pattern.test(string)\n });\n } else {\n value = findKey(parsePatterns, function (pattern) {\n return pattern.test(string)\n });\n }\n\n value = args.valueCallback ? args.valueCallback(value) : value;\n value = options.valueCallback ? options.valueCallback(value) : value;\n\n return {\n value: value,\n rest: string.slice(matchedString.length)\n }\n }\n}\n\nfunction findKey (object, predicate) {\n for (var key in object) {\n if (object.hasOwnProperty(key) && predicate(object[key])) {\n return key\n }\n }\n}\n\nvar matchOrdinalNumberPattern = /^(\\d+)(th|st|nd|rd)?/i;\nvar parseOrdinalNumberPattern = /\\d+/i;\n\nvar matchEraPatterns = {\n narrow: /^(b|a)/i,\n abbreviated: /^(b\\.?\\s?c\\.?|b\\.?\\s?c\\.?\\s?e\\.?|a\\.?\\s?d\\.?|c\\.?\\s?e\\.?)/i,\n wide: /^(before christ|before common era|anno domini|common era)/i\n};\nvar parseEraPatterns = {\n any: [/^b/i, /^(a|c)/i]\n};\n\nvar matchQuarterPatterns = {\n narrow: /^[1234]/i,\n abbreviated: /^q[1234]/i,\n wide: /^[1234](th|st|nd|rd)? quarter/i\n};\nvar parseQuarterPatterns = {\n any: [/1/i, /2/i, /3/i, /4/i]\n};\n\nvar matchMonthPatterns = {\n narrow: /^[jfmasond]/i,\n abbreviated: /^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,\n wide: /^(january|february|march|april|may|june|july|august|september|october|november|december)/i\n};\nvar parseMonthPatterns = {\n narrow: [/^j/i, /^f/i, /^m/i, /^a/i, /^m/i, /^j/i, /^j/i, /^a/i, /^s/i, /^o/i, /^n/i, /^d/i],\n any: [/^ja/i, /^f/i, /^mar/i, /^ap/i, /^may/i, /^jun/i, /^jul/i, /^au/i, /^s/i, /^o/i, /^n/i, /^d/i]\n};\n\nvar matchDayPatterns = {\n narrow: /^[smtwf]/i,\n short: /^(su|mo|tu|we|th|fr|sa)/i,\n abbreviated: /^(sun|mon|tue|wed|thu|fri|sat)/i,\n wide: /^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i\n};\nvar parseDayPatterns = {\n narrow: [/^s/i, /^m/i, /^t/i, /^w/i, /^t/i, /^f/i, /^s/i],\n any: [/^su/i, /^m/i, /^tu/i, /^w/i, /^th/i, /^f/i, /^sa/i]\n};\n\nvar matchDayPeriodPatterns = {\n narrow: /^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,\n any: /^([ap]\\.?\\s?m\\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i\n};\nvar parseDayPeriodPatterns = {\n any: {\n am: /^a/i,\n pm: /^p/i,\n midnight: /^mi/i,\n noon: /^no/i,\n morning: /morning/i,\n afternoon: /afternoon/i,\n evening: /evening/i,\n night: /night/i\n }\n};\n\nvar match = {\n ordinalNumber: buildMatchPatternFn({\n matchPattern: matchOrdinalNumberPattern,\n parsePattern: parseOrdinalNumberPattern,\n valueCallback: function (value) {\n return parseInt(value, 10)\n }\n }),\n\n era: buildMatchFn({\n matchPatterns: matchEraPatterns,\n defaultMatchWidth: 'wide',\n parsePatterns: parseEraPatterns,\n defaultParseWidth: 'any'\n }),\n\n quarter: buildMatchFn({\n matchPatterns: matchQuarterPatterns,\n defaultMatchWidth: 'wide',\n parsePatterns: parseQuarterPatterns,\n defaultParseWidth: 'any',\n valueCallback: function (index) {\n return index + 1\n }\n }),\n\n month: buildMatchFn({\n matchPatterns: matchMonthPatterns,\n defaultMatchWidth: 'wide',\n parsePatterns: parseMonthPatterns,\n defaultParseWidth: 'any'\n }),\n\n day: buildMatchFn({\n matchPatterns: matchDayPatterns,\n defaultMatchWidth: 'wide',\n parsePatterns: parseDayPatterns,\n defaultParseWidth: 'any'\n }),\n\n dayPeriod: buildMatchFn({\n matchPatterns: matchDayPeriodPatterns,\n defaultMatchWidth: 'any',\n parsePatterns: parseDayPeriodPatterns,\n defaultParseWidth: 'any'\n })\n};\n\n/**\n * @type {Locale}\n * @category Locales\n * @summary English locale (United States).\n * @language English\n * @iso-639-2 eng\n * @author Sasha Koss [@kossnocorp]{@link https://github.com/kossnocorp}\n * @author Lesha Koss [@leshakoss]{@link https://github.com/leshakoss}\n */\nvar locale$1 = {\n formatDistance: formatDistance,\n formatLong: formatLong,\n formatRelative: formatRelative,\n localize: localize,\n match: match,\n options: {\n weekStartsOn: 0 /* Sunday */,\n firstWeekContainsDate: 1\n }\n};\n\nvar MILLISECONDS_IN_DAY = 86400000;\n\n// This function will be a part of public API when UTC function will be implemented.\n// See issue: https://github.com/date-fns/date-fns/issues/376\nfunction getUTCDayOfYear (dirtyDate, dirtyOptions) {\n if (arguments.length < 1) {\n throw new TypeError('1 argument required, but only ' + arguments.length + ' present')\n }\n\n var date = toDate(dirtyDate, dirtyOptions);\n var timestamp = date.getTime();\n date.setUTCMonth(0, 1);\n date.setUTCHours(0, 0, 0, 0);\n var startOfYearTimestamp = date.getTime();\n var difference = timestamp - startOfYearTimestamp;\n return Math.floor(difference / MILLISECONDS_IN_DAY) + 1\n}\n\n// This function will be a part of public API when UTC function will be implemented.\n// See issue: https://github.com/date-fns/date-fns/issues/376\nfunction startOfUTCISOWeek (dirtyDate, dirtyOptions) {\n if (arguments.length < 1) {\n throw new TypeError('1 argument required, but only ' + arguments.length + ' present')\n }\n\n var weekStartsOn = 1;\n\n var date = toDate(dirtyDate, dirtyOptions);\n var day = date.getUTCDay();\n var diff = (day < weekStartsOn ? 7 : 0) + day - weekStartsOn;\n\n date.setUTCDate(date.getUTCDate() - diff);\n date.setUTCHours(0, 0, 0, 0);\n return date\n}\n\n// This function will be a part of public API when UTC function will be implemented.\n// See issue: https://github.com/date-fns/date-fns/issues/376\nfunction getUTCISOWeekYear (dirtyDate, dirtyOptions) {\n if (arguments.length < 1) {\n throw new TypeError('1 argument required, but only ' + arguments.length + ' present')\n }\n\n var date = toDate(dirtyDate, dirtyOptions);\n var year = date.getUTCFullYear();\n\n var fourthOfJanuaryOfNextYear = new Date(0);\n fourthOfJanuaryOfNextYear.setUTCFullYear(year + 1, 0, 4);\n fourthOfJanuaryOfNextYear.setUTCHours(0, 0, 0, 0);\n var startOfNextYear = startOfUTCISOWeek(fourthOfJanuaryOfNextYear, dirtyOptions);\n\n var fourthOfJanuaryOfThisYear = new Date(0);\n fourthOfJanuaryOfThisYear.setUTCFullYear(year, 0, 4);\n fourthOfJanuaryOfThisYear.setUTCHours(0, 0, 0, 0);\n var startOfThisYear = startOfUTCISOWeek(fourthOfJanuaryOfThisYear, dirtyOptions);\n\n if (date.getTime() >= startOfNextYear.getTime()) {\n return year + 1\n } else if (date.getTime() >= startOfThisYear.getTime()) {\n return year\n } else {\n return year - 1\n }\n}\n\n// This function will be a part of public API when UTC function will be implemented.\n// See issue: https://github.com/date-fns/date-fns/issues/376\nfunction startOfUTCISOWeekYear (dirtyDate, dirtyOptions) {\n if (arguments.length < 1) {\n throw new TypeError('1 argument required, but only ' + arguments.length + ' present')\n }\n\n var year = getUTCISOWeekYear(dirtyDate, dirtyOptions);\n var fourthOfJanuary = new Date(0);\n fourthOfJanuary.setUTCFullYear(year, 0, 4);\n fourthOfJanuary.setUTCHours(0, 0, 0, 0);\n var date = startOfUTCISOWeek(fourthOfJanuary, dirtyOptions);\n return date\n}\n\nvar MILLISECONDS_IN_WEEK = 604800000;\n\n// This function will be a part of public API when UTC function will be implemented.\n// See issue: https://github.com/date-fns/date-fns/issues/376\nfunction getUTCISOWeek (dirtyDate, dirtyOptions) {\n if (arguments.length < 1) {\n throw new TypeError('1 argument required, but only ' + arguments.length + ' present')\n }\n\n var date = toDate(dirtyDate, dirtyOptions);\n var diff = startOfUTCISOWeek(date, dirtyOptions).getTime() - startOfUTCISOWeekYear(date, dirtyOptions).getTime();\n\n // Round the number of days to the nearest integer\n // because the number of milliseconds in a week is not constant\n // (e.g. it's different in the week of the daylight saving time clock shift)\n return Math.round(diff / MILLISECONDS_IN_WEEK) + 1\n}\n\n// This function will be a part of public API when UTC function will be implemented.\n// See issue: https://github.com/date-fns/date-fns/issues/376\nfunction startOfUTCWeek (dirtyDate, dirtyOptions) {\n if (arguments.length < 1) {\n throw new TypeError('1 argument required, but only ' + arguments.length + ' present')\n }\n\n var options = dirtyOptions || {};\n var locale = options.locale;\n var localeWeekStartsOn = locale && locale.options && locale.options.weekStartsOn;\n var defaultWeekStartsOn = localeWeekStartsOn == null ? 0 : toInteger(localeWeekStartsOn);\n var weekStartsOn = options.weekStartsOn == null ? defaultWeekStartsOn : toInteger(options.weekStartsOn);\n\n // Test if weekStartsOn is between 0 and 6 _and_ is not NaN\n if (!(weekStartsOn >= 0 && weekStartsOn <= 6)) {\n throw new RangeError('weekStartsOn must be between 0 and 6 inclusively')\n }\n\n var date = toDate(dirtyDate, options);\n var day = date.getUTCDay();\n var diff = (day < weekStartsOn ? 7 : 0) + day - weekStartsOn;\n\n date.setUTCDate(date.getUTCDate() - diff);\n date.setUTCHours(0, 0, 0, 0);\n return date\n}\n\n// This function will be a part of public API when UTC function will be implemented.\n// See issue: https://github.com/date-fns/date-fns/issues/376\nfunction getUTCWeekYear (dirtyDate, dirtyOptions) {\n if (arguments.length < 1) {\n throw new TypeError('1 argument required, but only ' + arguments.length + ' present')\n }\n\n var date = toDate(dirtyDate, dirtyOptions);\n var year = date.getUTCFullYear();\n\n var options = dirtyOptions || {};\n var locale = options.locale;\n var localeFirstWeekContainsDate = locale &&\n locale.options &&\n locale.options.firstWeekContainsDate;\n var defaultFirstWeekContainsDate =\n localeFirstWeekContainsDate == null\n ? 1\n : toInteger(localeFirstWeekContainsDate);\n var firstWeekContainsDate =\n options.firstWeekContainsDate == null\n ? defaultFirstWeekContainsDate\n : toInteger(options.firstWeekContainsDate);\n\n // Test if weekStartsOn is between 1 and 7 _and_ is not NaN\n if (!(firstWeekContainsDate >= 1 && firstWeekContainsDate <= 7)) {\n throw new RangeError('firstWeekContainsDate must be between 1 and 7 inclusively')\n }\n\n var firstWeekOfNextYear = new Date(0);\n firstWeekOfNextYear.setUTCFullYear(year + 1, 0, firstWeekContainsDate);\n firstWeekOfNextYear.setUTCHours(0, 0, 0, 0);\n var startOfNextYear = startOfUTCWeek(firstWeekOfNextYear, dirtyOptions);\n\n var firstWeekOfThisYear = new Date(0);\n firstWeekOfThisYear.setUTCFullYear(year, 0, firstWeekContainsDate);\n firstWeekOfThisYear.setUTCHours(0, 0, 0, 0);\n var startOfThisYear = startOfUTCWeek(firstWeekOfThisYear, dirtyOptions);\n\n if (date.getTime() >= startOfNextYear.getTime()) {\n return year + 1\n } else if (date.getTime() >= startOfThisYear.getTime()) {\n return year\n } else {\n return year - 1\n }\n}\n\n// This function will be a part of public API when UTC function will be implemented.\n// See issue: https://github.com/date-fns/date-fns/issues/376\nfunction startOfUTCWeekYear (dirtyDate, dirtyOptions) {\n if (arguments.length < 1) {\n throw new TypeError('1 argument required, but only ' + arguments.length + ' present')\n }\n\n var options = dirtyOptions || {};\n var locale = options.locale;\n var localeFirstWeekContainsDate = locale &&\n locale.options &&\n locale.options.firstWeekContainsDate;\n var defaultFirstWeekContainsDate =\n localeFirstWeekContainsDate == null\n ? 1\n : toInteger(localeFirstWeekContainsDate);\n var firstWeekContainsDate =\n options.firstWeekContainsDate == null\n ? defaultFirstWeekContainsDate\n : toInteger(options.firstWeekContainsDate);\n\n var year = getUTCWeekYear(dirtyDate, dirtyOptions);\n var firstWeek = new Date(0);\n firstWeek.setUTCFullYear(year, 0, firstWeekContainsDate);\n firstWeek.setUTCHours(0, 0, 0, 0);\n var date = startOfUTCWeek(firstWeek, dirtyOptions);\n return date\n}\n\nvar MILLISECONDS_IN_WEEK$1 = 604800000;\n\n// This function will be a part of public API when UTC function will be implemented.\n// See issue: https://github.com/date-fns/date-fns/issues/376\nfunction getUTCWeek (dirtyDate, dirtyOptions) {\n if (arguments.length < 1) {\n throw new TypeError('1 argument required, but only ' + arguments.length + ' present')\n }\n\n var date = toDate(dirtyDate, dirtyOptions);\n var diff = startOfUTCWeek(date, dirtyOptions).getTime() - startOfUTCWeekYear(date, dirtyOptions).getTime();\n\n // Round the number of days to the nearest integer\n // because the number of milliseconds in a week is not constant\n // (e.g. it's different in the week of the daylight saving time clock shift)\n return Math.round(diff / MILLISECONDS_IN_WEEK$1) + 1\n}\n\nvar dayPeriodEnum = {\n am: 'am',\n pm: 'pm',\n midnight: 'midnight',\n noon: 'noon',\n morning: 'morning',\n afternoon: 'afternoon',\n evening: 'evening',\n night: 'night'\n};\n\n/*\n * | | Unit | | Unit |\n * |-----|--------------------------------|-----|--------------------------------|\n * | a | AM, PM | A* | Milliseconds in day |\n * | b | AM, PM, noon, midnight | B | Flexible day period |\n * | c | Stand-alone local day of week | C* | Localized hour w/ day period |\n * | d | Day of month | D | Day of year |\n * | e | Local day of week | E | Day of week |\n * | f | | F* | Day of week in month |\n * | g* | Modified Julian day | G | Era |\n * | h | Hour [1-12] | H | Hour [0-23] |\n * | i! | ISO day of week | I! | ISO week of year |\n * | j* | Localized hour w/ day period | J* | Localized hour w/o day period |\n * | k | Hour [1-24] | K | Hour [0-11] |\n * | l* | (deprecated) | L | Stand-alone month |\n * | m | Minute | M | Month |\n * | n | | N | |\n * | o! | Ordinal number modifier | O | Timezone (GMT) |\n * | p! | Long localized time | P! | Long localized date |\n * | q | Stand-alone quarter | Q | Quarter |\n * | r* | Related Gregorian year | R! | ISO week-numbering year |\n * | s | Second | S | Fraction of second |\n * | t! | Seconds timestamp | T! | Milliseconds timestamp |\n * | u | Extended year | U* | Cyclic year |\n * | v* | Timezone (generic non-locat.) | V* | Timezone (location) |\n * | w | Local week of year | W* | Week of month |\n * | x | Timezone (ISO-8601 w/o Z) | X | Timezone (ISO-8601) |\n * | y | Year (abs) | Y | Local week-numbering year |\n * | z | Timezone (specific non-locat.) | Z* | Timezone (aliases) |\n *\n * Letters marked by * are not implemented but reserved by Unicode standard.\n *\n * Letters marked by ! are non-standard, but implemented by date-fns:\n * - `o` modifies the previous token to turn it into an ordinal (see `format` docs)\n * - `i` is ISO day of week. For `i` and `ii` is returns numeric ISO week days,\n * i.e. 7 for Sunday, 1 for Monday, etc.\n * - `I` is ISO week of year, as opposed to `w` which is local week of year.\n * - `R` is ISO week-numbering year, as opposed to `Y` which is local week-numbering year.\n * `R` is supposed to be used in conjunction with `I` and `i`\n * for universal ISO week-numbering date, whereas\n * `Y` is supposed to be used in conjunction with `w` and `e`\n * for week-numbering date specific to the locale.\n * - `P` is long localized date format\n * - `p` is long localized time format\n */\n\nvar formatters = {\n // Era\n G: function (date, token, localize) {\n var era = date.getUTCFullYear() > 0 ? 1 : 0;\n switch (token) {\n // AD, BC\n case 'G':\n case 'GG':\n case 'GGG':\n return localize.era(era, {width: 'abbreviated'})\n // A, B\n case 'GGGGG':\n return localize.era(era, {width: 'narrow'})\n // Anno Domini, Before Christ\n case 'GGGG':\n default:\n return localize.era(era, {width: 'wide'})\n }\n },\n\n // Year\n y: function (date, token, localize, options) {\n // From http://www.unicode.org/reports/tr35/tr35-31/tr35-dates.html#Date_Format_tokens\n // | Year | y | yy | yyy | yyyy | yyyyy |\n // |----------|-------|----|-------|-------|-------|\n // | AD 1 | 1 | 01 | 001 | 0001 | 00001 |\n // | AD 12 | 12 | 12 | 012 | 0012 | 00012 |\n // | AD 123 | 123 | 23 | 123 | 0123 | 00123 |\n // | AD 1234 | 1234 | 34 | 1234 | 1234 | 01234 |\n // | AD 12345 | 12345 | 45 | 12345 | 12345 | 12345 |\n\n var signedYear = date.getUTCFullYear();\n\n // Returns 1 for 1 BC (which is year 0 in JavaScript)\n var year = signedYear > 0 ? signedYear : 1 - signedYear;\n\n // Two digit year\n if (token === 'yy') {\n var twoDigitYear = year % 100;\n return addLeadingZeros(twoDigitYear, 2)\n }\n\n // Ordinal number\n if (token === 'yo') {\n return localize.ordinalNumber(year, {unit: 'year'})\n }\n\n // Padding\n return addLeadingZeros(year, token.length)\n },\n\n // Local week-numbering year\n Y: function (date, token, localize, options) {\n var signedWeekYear = getUTCWeekYear(date, options);\n var weekYear = signedWeekYear > 0 ? signedWeekYear : 1 - signedWeekYear;\n\n // Two digit year\n if (token === 'YY') {\n var twoDigitYear = weekYear % 100;\n return addLeadingZeros(twoDigitYear, 2)\n }\n\n // Ordinal number\n if (token === 'Yo') {\n return localize.ordinalNumber(weekYear, {unit: 'year'})\n }\n\n // Padding\n return addLeadingZeros(weekYear, token.length)\n },\n\n // ISO week-numbering year\n R: function (date, token, localize, options) {\n var isoWeekYear = getUTCISOWeekYear(date, options);\n\n // Padding\n return addLeadingZeros(isoWeekYear, token.length)\n },\n\n // Extended year. This is a single number designating the year of this calendar system.\n // The main difference between `y` and `u` localizers are B.C. years:\n // | Year | `y` | `u` |\n // |------|-----|-----|\n // | AC 1 | 1 | 1 |\n // | BC 1 | 1 | 0 |\n // | BC 2 | 2 | -1 |\n // Also `yy` always returns the last two digits of a year,\n // while `uu` pads single digit years to 2 characters and returns other years unchanged.\n u: function (date, token, localize, options) {\n var year = date.getUTCFullYear();\n return addLeadingZeros(year, token.length)\n },\n\n // Quarter\n Q: function (date, token, localize, options) {\n var quarter = Math.ceil((date.getUTCMonth() + 1) / 3);\n switch (token) {\n // 1, 2, 3, 4\n case 'Q':\n return String(quarter)\n // 01, 02, 03, 04\n case 'QQ':\n return addLeadingZeros(quarter, 2)\n // 1st, 2nd, 3rd, 4th\n case 'Qo':\n return localize.ordinalNumber(quarter, {unit: 'quarter'})\n // Q1, Q2, Q3, Q4\n case 'QQQ':\n return localize.quarter(quarter, {width: 'abbreviated', context: 'formatting'})\n // 1, 2, 3, 4 (narrow quarter; could be not numerical)\n case 'QQQQQ':\n return localize.quarter(quarter, {width: 'narrow', context: 'formatting'})\n // 1st quarter, 2nd quarter, ...\n case 'QQQQ':\n default:\n return localize.quarter(quarter, {width: 'wide', context: 'formatting'})\n }\n },\n\n // Stand-alone quarter\n q: function (date, token, localize, options) {\n var quarter = Math.ceil((date.getUTCMonth() + 1) / 3);\n switch (token) {\n // 1, 2, 3, 4\n case 'q':\n return String(quarter)\n // 01, 02, 03, 04\n case 'qq':\n return addLeadingZeros(quarter, 2)\n // 1st, 2nd, 3rd, 4th\n case 'qo':\n return localize.ordinalNumber(quarter, {unit: 'quarter'})\n // Q1, Q2, Q3, Q4\n case 'qqq':\n return localize.quarter(quarter, {width: 'abbreviated', context: 'standalone'})\n // 1, 2, 3, 4 (narrow quarter; could be not numerical)\n case 'qqqqq':\n return localize.quarter(quarter, {width: 'narrow', context: 'standalone'})\n // 1st quarter, 2nd quarter, ...\n case 'qqqq':\n default:\n return localize.quarter(quarter, {width: 'wide', context: 'standalone'})\n }\n },\n\n // Month\n M: function (date, token, localize, options) {\n var month = date.getUTCMonth();\n switch (token) {\n // 1, 2, ..., 12\n case 'M':\n return String(month + 1)\n // 01, 02, ..., 12\n case 'MM':\n return addLeadingZeros(month + 1, 2)\n // 1st, 2nd, ..., 12th\n case 'Mo':\n return localize.ordinalNumber(month + 1, {unit: 'month'})\n // Jan, Feb, ..., Dec\n case 'MMM':\n return localize.month(month, {width: 'abbreviated', context: 'formatting'})\n // J, F, ..., D\n case 'MMMMM':\n return localize.month(month, {width: 'narrow', context: 'formatting'})\n // January, February, ..., December\n case 'MMMM':\n default:\n return localize.month(month, {width: 'wide', context: 'formatting'})\n }\n },\n\n // Stand-alone month\n L: function (date, token, localize, options) {\n var month = date.getUTCMonth();\n switch (token) {\n // 1, 2, ..., 12\n case 'L':\n return String(month + 1)\n // 01, 02, ..., 12\n case 'LL':\n return addLeadingZeros(month + 1, 2)\n // 1st, 2nd, ..., 12th\n case 'Lo':\n return localize.ordinalNumber(month + 1, {unit: 'month'})\n // Jan, Feb, ..., Dec\n case 'LLL':\n return localize.month(month, {width: 'abbreviated', context: 'standalone'})\n // J, F, ..., D\n case 'LLLLL':\n return localize.month(month, {width: 'narrow', context: 'standalone'})\n // January, February, ..., December\n case 'LLLL':\n default:\n return localize.month(month, {width: 'wide', context: 'standalone'})\n }\n },\n\n // Local week of year\n w: function (date, token, localize, options) {\n var week = getUTCWeek(date, options);\n\n if (token === 'wo') {\n return localize.ordinalNumber(week, {unit: 'week'})\n }\n\n return addLeadingZeros(week, token.length)\n },\n\n // ISO week of year\n I: function (date, token, localize, options) {\n var isoWeek = getUTCISOWeek(date, options);\n\n if (token === 'Io') {\n return localize.ordinalNumber(isoWeek, {unit: 'week'})\n }\n\n return addLeadingZeros(isoWeek, token.length)\n },\n\n // Day of the month\n d: function (date, token, localize, options) {\n var dayOfMonth = date.getUTCDate();\n\n if (token === 'do') {\n return localize.ordinalNumber(dayOfMonth, {unit: 'date'})\n }\n\n return addLeadingZeros(dayOfMonth, token.length)\n },\n\n // Day of year\n D: function (date, token, localize, options) {\n var dayOfYear = getUTCDayOfYear(date, options);\n\n if (token === 'Do') {\n return localize.ordinalNumber(dayOfYear, {unit: 'dayOfYear'})\n }\n\n return addLeadingZeros(dayOfYear, token.length)\n },\n\n // Day of week\n E: function (date, token, localize, options) {\n var dayOfWeek = date.getUTCDay();\n switch (token) {\n // Tue\n case 'E':\n case 'EE':\n case 'EEE':\n return localize.day(dayOfWeek, {width: 'abbreviated', context: 'formatting'})\n // T\n case 'EEEEE':\n return localize.day(dayOfWeek, {width: 'narrow', context: 'formatting'})\n // Tu\n case 'EEEEEE':\n return localize.day(dayOfWeek, {width: 'short', context: 'formatting'})\n // Tuesday\n case 'EEEE':\n default:\n return localize.day(dayOfWeek, {width: 'wide', context: 'formatting'})\n }\n },\n\n // Local day of week\n e: function (date, token, localize, options) {\n var dayOfWeek = date.getUTCDay();\n var localDayOfWeek = ((dayOfWeek - options.weekStartsOn + 8) % 7) || 7;\n switch (token) {\n // Numerical value (Nth day of week with current locale or weekStartsOn)\n case 'e':\n return String(localDayOfWeek)\n // Padded numerical value\n case 'ee':\n return addLeadingZeros(localDayOfWeek, 2)\n // 1st, 2nd, ..., 7th\n case 'eo':\n return localize.ordinalNumber(localDayOfWeek, {unit: 'day'})\n case 'eee':\n return localize.day(dayOfWeek, {width: 'abbreviated', context: 'formatting'})\n // T\n case 'eeeee':\n return localize.day(dayOfWeek, {width: 'narrow', context: 'formatting'})\n // Tu\n case 'eeeeee':\n return localize.day(dayOfWeek, {width: 'short', context: 'formatting'})\n // Tuesday\n case 'eeee':\n default:\n return localize.day(dayOfWeek, {width: 'wide', context: 'formatting'})\n }\n },\n\n // Stand-alone local day of week\n c: function (date, token, localize, options) {\n var dayOfWeek = date.getUTCDay();\n var localDayOfWeek = ((dayOfWeek - options.weekStartsOn + 8) % 7) || 7;\n switch (token) {\n // Numerical value (same as in `e`)\n case 'c':\n return String(localDayOfWeek)\n // Padded numberical value\n case 'cc':\n return addLeadingZeros(localDayOfWeek, token.length)\n // 1st, 2nd, ..., 7th\n case 'co':\n return localize.ordinalNumber(localDayOfWeek, {unit: 'day'})\n case 'ccc':\n return localize.day(dayOfWeek, {width: 'abbreviated', context: 'standalone'})\n // T\n case 'ccccc':\n return localize.day(dayOfWeek, {width: 'narrow', context: 'standalone'})\n // Tu\n case 'cccccc':\n return localize.day(dayOfWeek, {width: 'short', context: 'standalone'})\n // Tuesday\n case 'cccc':\n default:\n return localize.day(dayOfWeek, {width: 'wide', context: 'standalone'})\n }\n },\n\n // ISO day of week\n i: function (date, token, localize, options) {\n var dayOfWeek = date.getUTCDay();\n var isoDayOfWeek = dayOfWeek === 0 ? 7 : dayOfWeek;\n switch (token) {\n // 2\n case 'i':\n return String(isoDayOfWeek)\n // 02\n case 'ii':\n return addLeadingZeros(isoDayOfWeek, token.length)\n // 2nd\n case 'io':\n return localize.ordinalNumber(isoDayOfWeek, {unit: 'day'})\n // Tue\n case 'iii':\n return localize.day(dayOfWeek, {width: 'abbreviated', context: 'formatting'})\n // T\n case 'iiiii':\n return localize.day(dayOfWeek, {width: 'narrow', context: 'formatting'})\n // Tu\n case 'iiiiii':\n return localize.day(dayOfWeek, {width: 'short', context: 'formatting'})\n // Tuesday\n case 'iiii':\n default:\n return localize.day(dayOfWeek, {width: 'wide', context: 'formatting'})\n }\n },\n\n // AM or PM\n a: function (date, token, localize) {\n var hours = date.getUTCHours();\n var dayPeriodEnumValue = (hours / 12) >= 1 ? 'pm' : 'am';\n\n switch (token) {\n case 'a':\n case 'aa':\n case 'aaa':\n return localize.dayPeriod(dayPeriodEnumValue, {width: 'abbreviated', context: 'formatting'})\n case 'aaaaa':\n return localize.dayPeriod(dayPeriodEnumValue, {width: 'narrow', context: 'formatting'})\n case 'aaaa':\n default:\n return localize.dayPeriod(dayPeriodEnumValue, {width: 'wide', context: 'formatting'})\n }\n },\n\n // AM, PM, midnight, noon\n b: function (date, token, localize) {\n var hours = date.getUTCHours();\n var dayPeriodEnumValue;\n if (hours === 12) {\n dayPeriodEnumValue = dayPeriodEnum.noon;\n } else if (hours === 0) {\n dayPeriodEnumValue = dayPeriodEnum.midnight;\n } else {\n dayPeriodEnumValue = (hours / 12) >= 1 ? 'pm' : 'am';\n }\n\n switch (token) {\n case 'b':\n case 'bb':\n case 'bbb':\n return localize.dayPeriod(dayPeriodEnumValue, {width: 'abbreviated', context: 'formatting'})\n case 'bbbbb':\n return localize.dayPeriod(dayPeriodEnumValue, {width: 'narrow', context: 'formatting'})\n case 'bbbb':\n default:\n return localize.dayPeriod(dayPeriodEnumValue, {width: 'wide', context: 'formatting'})\n }\n },\n\n // in the morning, in the afternoon, in the evening, at night\n B: function (date, token, localize) {\n var hours = date.getUTCHours();\n var dayPeriodEnumValue;\n if (hours >= 17) {\n dayPeriodEnumValue = dayPeriodEnum.evening;\n } else if (hours >= 12) {\n dayPeriodEnumValue = dayPeriodEnum.afternoon;\n } else if (hours >= 4) {\n dayPeriodEnumValue = dayPeriodEnum.morning;\n } else {\n dayPeriodEnumValue = dayPeriodEnum.night;\n }\n\n switch (token) {\n case 'B':\n case 'BB':\n case 'BBB':\n return localize.dayPeriod(dayPeriodEnumValue, {width: 'abbreviated', context: 'formatting'})\n case 'BBBBB':\n return localize.dayPeriod(dayPeriodEnumValue, {width: 'narrow', context: 'formatting'})\n case 'BBBB':\n default:\n return localize.dayPeriod(dayPeriodEnumValue, {width: 'wide', context: 'formatting'})\n }\n },\n\n // Hour [1-12]\n h: function (date, token, localize, options) {\n var hours = date.getUTCHours() % 12;\n\n if (hours === 0) {\n hours = 12;\n }\n\n if (token === 'ho') {\n return localize.ordinalNumber(hours, {unit: 'hour'})\n }\n\n return addLeadingZeros(hours, token.length)\n },\n\n // Hour [0-23]\n H: function (date, token, localize, options) {\n var hours = date.getUTCHours();\n\n if (token === 'Ho') {\n return localize.ordinalNumber(hours, {unit: 'hour'})\n }\n\n return addLeadingZeros(hours, token.length)\n },\n\n // Hour [0-11]\n K: function (date, token, localize, options) {\n var hours = date.getUTCHours() % 12;\n\n if (token === 'Ko') {\n return localize.ordinalNumber(hours, {unit: 'hour'})\n }\n\n return addLeadingZeros(hours, token.length)\n },\n\n // Hour [1-24]\n k: function (date, token, localize, options) {\n var hours = date.getUTCHours();\n\n if (hours === 0) {\n hours = 24;\n }\n\n if (token === 'ko') {\n return localize.ordinalNumber(hours, {unit: 'hour'})\n }\n\n return addLeadingZeros(hours, token.length)\n },\n\n // Minute\n m: function (date, token, localize, options) {\n var minutes = date.getUTCMinutes();\n\n if (token === 'mo') {\n return localize.ordinalNumber(minutes, {unit: 'minute'})\n }\n\n return addLeadingZeros(minutes, token.length)\n },\n\n // Second\n s: function (date, token, localize, options) {\n var seconds = date.getUTCSeconds();\n\n if (token === 'so') {\n return localize.ordinalNumber(seconds, {unit: 'second'})\n }\n\n return addLeadingZeros(seconds, token.length)\n },\n\n // Fraction of second\n S: function (date, token, localize, options) {\n var numberOfDigits = token.length;\n var milliseconds = date.getUTCMilliseconds();\n var fractionalSeconds = Math.floor(milliseconds * Math.pow(10, numberOfDigits - 3));\n return addLeadingZeros(fractionalSeconds, numberOfDigits)\n },\n\n // Timezone (ISO-8601. If offset is 0, output is always `'Z'`)\n X: function (date, token, localize, options) {\n var originalDate = options._originalDate || date;\n var timezoneOffset = originalDate.getTimezoneOffset();\n\n if (timezoneOffset === 0) {\n return 'Z'\n }\n\n switch (token) {\n // Hours and optional minutes\n case 'X':\n return formatTimezoneWithOptionalMinutes(timezoneOffset)\n\n // Hours, minutes and optional seconds without `:` delimeter\n // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets\n // so this token always has the same output as `XX`\n case 'XXXX':\n case 'XX': // Hours and minutes without `:` delimeter\n return formatTimezone(timezoneOffset)\n\n // Hours, minutes and optional seconds with `:` delimeter\n // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets\n // so this token always has the same output as `XXX`\n case 'XXXXX':\n case 'XXX': // Hours and minutes with `:` delimeter\n default:\n return formatTimezone(timezoneOffset, ':')\n }\n },\n\n // Timezone (ISO-8601. If offset is 0, output is `'+00:00'` or equivalent)\n x: function (date, token, localize, options) {\n var originalDate = options._originalDate || date;\n var timezoneOffset = originalDate.getTimezoneOffset();\n\n switch (token) {\n // Hours and optional minutes\n case 'x':\n return formatTimezoneWithOptionalMinutes(timezoneOffset)\n\n // Hours, minutes and optional seconds without `:` delimeter\n // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets\n // so this token always has the same output as `xx`\n case 'xxxx':\n case 'xx': // Hours and minutes without `:` delimeter\n return formatTimezone(timezoneOffset)\n\n // Hours, minutes and optional seconds with `:` delimeter\n // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets\n // so this token always has the same output as `xxx`\n case 'xxxxx':\n case 'xxx': // Hours and minutes with `:` delimeter\n default:\n return formatTimezone(timezoneOffset, ':')\n }\n },\n\n // Timezone (GMT)\n O: function (date, token, localize, options) {\n var originalDate = options._originalDate || date;\n var timezoneOffset = originalDate.getTimezoneOffset();\n\n switch (token) {\n // Short\n case 'O':\n case 'OO':\n case 'OOO':\n return 'GMT' + formatTimezoneShort(timezoneOffset, ':')\n // Long\n case 'OOOO':\n default:\n return 'GMT' + formatTimezone(timezoneOffset, ':')\n }\n },\n\n // Timezone (specific non-location)\n z: function (date, token, localize, options) {\n var originalDate = options._originalDate || date;\n var timezoneOffset = originalDate.getTimezoneOffset();\n\n switch (token) {\n // Short\n case 'z':\n case 'zz':\n case 'zzz':\n return 'GMT' + formatTimezoneShort(timezoneOffset, ':')\n // Long\n case 'zzzz':\n default:\n return 'GMT' + formatTimezone(timezoneOffset, ':')\n }\n },\n\n // Seconds timestamp\n t: function (date, token, localize, options) {\n var originalDate = options._originalDate || date;\n var timestamp = Math.floor(originalDate.getTime() / 1000);\n return addLeadingZeros(timestamp, token.length)\n },\n\n // Milliseconds timestamp\n T: function (date, token, localize, options) {\n var originalDate = options._originalDate || date;\n var timestamp = originalDate.getTime();\n return addLeadingZeros(timestamp, token.length)\n }\n};\n\nfunction addLeadingZeros (number, targetLength) {\n var sign = number < 0 ? '-' : '';\n var output = Math.abs(number).toString();\n while (output.length < targetLength) {\n output = '0' + output;\n }\n return sign + output\n}\n\nfunction formatTimezone (offset, dirtyDelimeter) {\n var delimeter = dirtyDelimeter || '';\n var sign = offset > 0 ? '-' : '+';\n var absOffset = Math.abs(offset);\n var hours = addLeadingZeros(Math.floor(absOffset / 60), 2);\n var minutes = addLeadingZeros(absOffset % 60, 2);\n return sign + hours + delimeter + minutes\n}\n\nfunction formatTimezoneWithOptionalMinutes (offset, dirtyDelimeter) {\n if (offset % 60 === 0) {\n var sign = offset > 0 ? '-' : '+';\n return sign + addLeadingZeros(Math.abs(offset) / 60, 2)\n }\n return formatTimezone(offset, dirtyDelimeter)\n}\n\nfunction formatTimezoneShort (offset, dirtyDelimeter) {\n var sign = offset > 0 ? '-' : '+';\n var absOffset = Math.abs(offset);\n var hours = Math.floor(absOffset / 60);\n var minutes = absOffset % 60;\n if (minutes === 0) {\n return sign + String(hours)\n }\n var delimeter = dirtyDelimeter || '';\n return sign + String(hours) + delimeter + addLeadingZeros(minutes, 2)\n}\n\nfunction dateLongFormatter (pattern, formatLong, options) {\n switch (pattern) {\n case 'P':\n return formatLong.date({width: 'short'})\n case 'PP':\n return formatLong.date({width: 'medium'})\n case 'PPP':\n return formatLong.date({width: 'long'})\n case 'PPPP':\n default:\n return formatLong.date({width: 'full'})\n }\n}\n\nfunction timeLongFormatter (pattern, formatLong, options) {\n switch (pattern) {\n case 'p':\n return formatLong.time({width: 'short'})\n case 'pp':\n return formatLong.time({width: 'medium'})\n case 'ppp':\n return formatLong.time({width: 'long'})\n case 'pppp':\n default:\n return formatLong.time({width: 'full'})\n }\n}\n\nfunction dateTimeLongFormatter (pattern, formatLong, options) {\n var matchResult = pattern.match(/(P+)(p+)?/);\n var datePattern = matchResult[1];\n var timePattern = matchResult[2];\n\n if (!timePattern) {\n return dateLongFormatter(pattern, formatLong)\n }\n\n var dateTimeFormat;\n\n switch (datePattern) {\n case 'P':\n dateTimeFormat = formatLong.dateTime({width: 'short'});\n break\n case 'PP':\n dateTimeFormat = formatLong.dateTime({width: 'medium'});\n break\n case 'PPP':\n dateTimeFormat = formatLong.dateTime({width: 'long'});\n break\n case 'PPPP':\n default:\n dateTimeFormat = formatLong.dateTime({width: 'full'});\n break\n }\n\n return dateTimeFormat\n .replace('{{date}}', dateLongFormatter(datePattern, formatLong))\n .replace('{{time}}', timeLongFormatter(timePattern, formatLong))\n}\n\nvar longFormatters = {\n p: timeLongFormatter,\n P: dateTimeLongFormatter\n};\n\n/**\n * @name subMilliseconds\n * @category Millisecond Helpers\n * @summary Subtract the specified number of milliseconds from the given date.\n *\n * @description\n * Subtract the specified number of milliseconds from the given date.\n *\n * @param {Date|String|Number} date - the date to be changed\n * @param {Number} amount - the amount of milliseconds to be subtracted\n * @param {Options} [options] - the object with options. See [Options]{@link https://date-fns.org/docs/Options}\n * @param {0|1|2} [options.additionalDigits=2] - passed to `toDate`. See [toDate]{@link https://date-fns.org/docs/toDate}\n * @returns {Date} the new date with the milliseconds subtracted\n * @throws {TypeError} 2 arguments required\n * @throws {RangeError} `options.additionalDigits` must be 0, 1 or 2\n *\n * @example\n * // Subtract 750 milliseconds from 10 July 2014 12:45:30.000:\n * var result = subMilliseconds(new Date(2014, 6, 10, 12, 45, 30, 0), 750)\n * //=> Thu Jul 10 2014 12:45:29.250\n */\nfunction subMilliseconds (dirtyDate, dirtyAmount, dirtyOptions) {\n if (arguments.length < 2) {\n throw new TypeError('2 arguments required, but only ' + arguments.length + ' present')\n }\n\n var amount = toInteger(dirtyAmount);\n return addMilliseconds(dirtyDate, -amount, dirtyOptions)\n}\n\nvar protectedTokens = ['D', 'DD', 'YY', 'YYYY'];\n\nfunction isProtectedToken(token) {\n return protectedTokens.indexOf(token) !== -1\n}\n\nfunction throwProtectedError(token) {\n throw new RangeError(\n '`options.awareOfUnicodeTokens` must be set to `true` to use `' +\n token +\n '` token; see: https://git.io/fxCyr'\n )\n}\n\n// This RegExp consists of three parts separated by `|`:\n// - [yYQqMLwIdDecihHKkms]o matches any available ordinal number token\n// (one of the certain letters followed by `o`)\n// - (\\w)\\1* matches any sequences of the same letter\n// - '' matches two quote characters in a row\n// - '(''|[^'])+('|$) matches anything surrounded by two quote characters ('),\n// except a single quote symbol, which ends the sequence.\n// Two quote characters do not end the sequence.\n// If there is no matching single quote\n// then the sequence will continue until the end of the string.\n// - . matches any single character unmatched by previous parts of the RegExps\nvar formattingTokensRegExp = /[yYQqMLwIdDecihHKkms]o|(\\w)\\1*|''|'(''|[^'])+('|$)|./g;\n\n// This RegExp catches symbols escaped by quotes, and also\n// sequences of symbols P, p, and the combinations like `PPPPPPPppppp`\nvar longFormattingTokensRegExp = /P+p+|P+|p+|''|'(''|[^'])+('|$)|./g;\n\nvar escapedStringRegExp = /^'(.*?)'?$/;\nvar doubleQuoteRegExp = /''/g;\n\n/**\n * @name format\n * @category Common Helpers\n * @summary Format the date.\n *\n * @description\n * Return the formatted date string in the given format. The result may vary by locale.\n *\n * > ⚠️ Please note that the `format` tokens differ from Moment.js and other libraries.\n * > See: https://git.io/fxCyr\n *\n * The characters wrapped between two single quotes characters (') are escaped.\n * Two single quotes in a row, whether inside or outside a quoted sequence, represent a 'real' single quote.\n * (see the last example)\n *\n * Format of the string is based on Unicode Technical Standard #35:\n * https://www.unicode.org/reports/tr35/tr35-dates.html#Date_Field_Symbol_Table\n * with a few additions (see note 7 below the table).\n *\n * Accepted patterns:\n * | Unit | Pattern | Result examples | Notes |\n * |---------------------------------|---------|-----------------------------------|-------|\n * | Era | G..GGG | AD, BC | |\n * | | GGGG | Anno Domini, Before Christ | 2 |\n * | | GGGGG | A, B | |\n * | Calendar year | y | 44, 1, 1900, 2017 | 5 |\n * | | yo | 44th, 1st, 0th, 17th | 5,7 |\n * | | yy | 44, 01, 00, 17 | 5 |\n * | | yyy | 044, 001, 1900, 2017 | 5 |\n * | | yyyy | 0044, 0001, 1900, 2017 | 5 |\n * | | yyyyy | ... | 3,5 |\n * | Local week-numbering year | Y | 44, 1, 1900, 2017 | 5 |\n * | | Yo | 44th, 1st, 1900th, 2017th | 5,7 |\n * | | YY | 44, 01, 00, 17 | 5,8 |\n * | | YYY | 044, 001, 1900, 2017 | 5 |\n * | | YYYY | 0044, 0001, 1900, 2017 | 5,8 |\n * | | YYYYY | ... | 3,5 |\n * | ISO week-numbering year | R | -43, 0, 1, 1900, 2017 | 5,7 |\n * | | RR | -43, 00, 01, 1900, 2017 | 5,7 |\n * | | RRR | -043, 000, 001, 1900, 2017 | 5,7 |\n * | | RRRR | -0043, 0000, 0001, 1900, 2017 | 5,7 |\n * | | RRRRR | ... | 3,5,7 |\n * | Extended year | u | -43, 0, 1, 1900, 2017 | 5 |\n * | | uu | -43, 01, 1900, 2017 | 5 |\n * | | uuu | -043, 001, 1900, 2017 | 5 |\n * | | uuuu | -0043, 0001, 1900, 2017 | 5 |\n * | | uuuuu | ... | 3,5 |\n * | Quarter (formatting) | Q | 1, 2, 3, 4 | |\n * | | Qo | 1st, 2nd, 3rd, 4th | 7 |\n * | | QQ | 01, 02, 03, 04 | |\n * | | QQQ | Q1, Q2, Q3, Q4 | |\n * | | QQQQ | 1st quarter, 2nd quarter, ... | 2 |\n * | | QQQQQ | 1, 2, 3, 4 | 4 |\n * | Quarter (stand-alone) | q | 1, 2, 3, 4 | |\n * | | qo | 1st, 2nd, 3rd, 4th | 7 |\n * | | qq | 01, 02, 03, 04 | |\n * | | qqq | Q1, Q2, Q3, Q4 | |\n * | | qqqq | 1st quarter, 2nd quarter, ... | 2 |\n * | | qqqqq | 1, 2, 3, 4 | 4 |\n * | Month (formatting) | M | 1, 2, ..., 12 | |\n * | | Mo | 1st, 2nd, ..., 12th | 7 |\n * | | MM | 01, 02, ..., 12 | |\n * | | MMM | Jan, Feb, ..., Dec | |\n * | | MMMM | January, February, ..., December | 2 |\n * | | MMMMM | J, F, ..., D | |\n * | Month (stand-alone) | L | 1, 2, ..., 12 | |\n * | | Lo | 1st, 2nd, ..., 12th | 7 |\n * | | LL | 01, 02, ..., 12 | |\n * | | LLL | Jan, Feb, ..., Dec | |\n * | | LLLL | January, February, ..., December | 2 |\n * | | LLLLL | J, F, ..., D | |\n * | Local week of year | w | 1, 2, ..., 53 | |\n * | | wo | 1st, 2nd, ..., 53th | 7 |\n * | | ww | 01, 02, ..., 53 | |\n * | ISO week of year | I | 1, 2, ..., 53 | 7 |\n * | | Io | 1st, 2nd, ..., 53th | 7 |\n * | | II | 01, 02, ..., 53 | 7 |\n * | Day of month | d | 1, 2, ..., 31 | |\n * | | do | 1st, 2nd, ..., 31st | 7 |\n * | | dd | 01, 02, ..., 31 | |\n * | Day of year | D | 1, 2, ..., 365, 366 | 8 |\n * | | Do | 1st, 2nd, ..., 365th, 366th | 7 |\n * | | DD | 01, 02, ..., 365, 366 | 8 |\n * | | DDD | 001, 002, ..., 365, 366 | |\n * | | DDDD | ... | 3 |\n * | Day of week (formatting) | E..EEE | Mon, Tue, Wed, ..., Su | |\n * | | EEEE | Monday, Tuesday, ..., Sunday | 2 |\n * | | EEEEE | M, T, W, T, F, S, S | |\n * | | EEEEEE | Mo, Tu, We, Th, Fr, Su, Sa | |\n * | ISO day of week (formatting) | i | 1, 2, 3, ..., 7 | 7 |\n * | | io | 1st, 2nd, ..., 7th | 7 |\n * | | ii | 01, 02, ..., 07 | 7 |\n * | | iii | Mon, Tue, Wed, ..., Su | 7 |\n * | | iiii | Monday, Tuesday, ..., Sunday | 2,7 |\n * | | iiiii | M, T, W, T, F, S, S | 7 |\n * | | iiiiii | Mo, Tu, We, Th, Fr, Su, Sa | 7 |\n * | Local day of week (formatting) | e | 2, 3, 4, ..., 1 | |\n * | | eo | 2nd, 3rd, ..., 1st | 7 |\n * | | ee | 02, 03, ..., 01 | |\n * | | eee | Mon, Tue, Wed, ..., Su | |\n * | | eeee | Monday, Tuesday, ..., Sunday | 2 |\n * | | eeeee | M, T, W, T, F, S, S | |\n * | | eeeeee | Mo, Tu, We, Th, Fr, Su, Sa | |\n * | Local day of week (stand-alone) | c | 2, 3, 4, ..., 1 | |\n * | | co | 2nd, 3rd, ..., 1st | 7 |\n * | | cc | 02, 03, ..., 01 | |\n * | | ccc | Mon, Tue, Wed, ..., Su | |\n * | | cccc | Monday, Tuesday, ..., Sunday | 2 |\n * | | ccccc | M, T, W, T, F, S, S | |\n * | | cccccc | Mo, Tu, We, Th, Fr, Su, Sa | |\n * | AM, PM | a..aaa | AM, PM | |\n * | | aaaa | a.m., p.m. | 2 |\n * | | aaaaa | a, p | |\n * | AM, PM, noon, midnight | b..bbb | AM, PM, noon, midnight | |\n * | | bbbb | a.m., p.m., noon, midnight | 2 |\n * | | bbbbb | a, p, n, mi | |\n * | Flexible day period | B..BBB | at night, in the morning, ... | |\n * | | BBBB | at night, in the morning, ... | 2 |\n * | | BBBBB | at night, in the morning, ... | |\n * | Hour [1-12] | h | 1, 2, ..., 11, 12 | |\n * | | ho | 1st, 2nd, ..., 11th, 12th | 7 |\n * | | hh | 01, 02, ..., 11, 12 | |\n * | Hour [0-23] | H | 0, 1, 2, ..., 23 | |\n * | | Ho | 0th, 1st, 2nd, ..., 23rd | 7 |\n * | | HH | 00, 01, 02, ..., 23 | |\n * | Hour [0-11] | K | 1, 2, ..., 11, 0 | |\n * | | Ko | 1st, 2nd, ..., 11th, 0th | 7 |\n * | | KK | 1, 2, ..., 11, 0 | |\n * | Hour [1-24] | k | 24, 1, 2, ..., 23 | |\n * | | ko | 24th, 1st, 2nd, ..., 23rd | 7 |\n * | | kk | 24, 01, 02, ..., 23 | |\n * | Minute | m | 0, 1, ..., 59 | |\n * | | mo | 0th, 1st, ..., 59th | 7 |\n * | | mm | 00, 01, ..., 59 | |\n * | Second | s | 0, 1, ..., 59 | |\n * | | so | 0th, 1st, ..., 59th | 7 |\n * | | ss | 00, 01, ..., 59 | |\n * | Fraction of second | S | 0, 1, ..., 9 | |\n * | | SS | 00, 01, ..., 99 | |\n * | | SSS | 000, 0001, ..., 999 | |\n * | | SSSS | ... | 3 |\n * | Timezone (ISO-8601 w/ Z) | X | -08, +0530, Z | |\n * | | XX | -0800, +0530, Z | |\n * | | XXX | -08:00, +05:30, Z | |\n * | | XXXX | -0800, +0530, Z, +123456 | 2 |\n * | | XXXXX | -08:00, +05:30, Z, +12:34:56 | |\n * | Timezone (ISO-8601 w/o Z) | x | -08, +0530, +00 | |\n * | | xx | -0800, +0530, +0000 | |\n * | | xxx | -08:00, +05:30, +00:00 | 2 |\n * | | xxxx | -0800, +0530, +0000, +123456 | |\n * | | xxxxx | -08:00, +05:30, +00:00, +12:34:56 | |\n * | Timezone (GMT) | O...OOO | GMT-8, GMT+5:30, GMT+0 | |\n * | | OOOO | GMT-08:00, GMT+05:30, GMT+00:00 | 2 |\n * | Timezone (specific non-locat.) | z...zzz | GMT-8, GMT+5:30, GMT+0 | 6 |\n * | | zzzz | GMT-08:00, GMT+05:30, GMT+00:00 | 2,6 |\n * | Seconds timestamp | t | 512969520 | 7 |\n * | | tt | ... | 3,7 |\n * | Milliseconds timestamp | T | 512969520900 | 7 |\n * | | TT | ... | 3,7 |\n * | Long localized date | P | 05/29/1453 | 7 |\n * | | PP | May 29, 1453 | 7 |\n * | | PPP | May 29th, 1453 | 7 |\n * | | PPPP | Sunday, May 29th, 1453 | 2,7 |\n * | Long localized time | p | 12:00 AM | 7 |\n * | | pp | 12:00:00 AM | 7 |\n * | | ppp | 12:00:00 AM GMT+2 | 7 |\n * | | pppp | 12:00:00 AM GMT+02:00 | 2,7 |\n * | Combination of date and time | Pp | 05/29/1453, 12:00 AM | 7 |\n * | | PPpp | May 29, 1453, 12:00:00 AM | 7 |\n * | | PPPppp | May 29th, 1453 at ... | 7 |\n * | | PPPPpppp| Sunday, May 29th, 1453 at ... | 2,7 |\n * Notes:\n * 1. \"Formatting\" units (e.g. formatting quarter) in the default en-US locale\n * are the same as \"stand-alone\" units, but are different in some languages.\n * \"Formatting\" units are declined according to the rules of the language\n * in the context of a date. \"Stand-alone\" units are always nominative singular:\n *\n * `format(new Date(2017, 10, 6), 'do LLLL', {locale: cs}) //=> '6. listopad'`\n *\n * `format(new Date(2017, 10, 6), 'do MMMM', {locale: cs}) //=> '6. listopadu'`\n *\n * 2. Any sequence of the identical letters is a pattern, unless it is escaped by\n * the single quote characters (see below).\n * If the sequence is longer than listed in table (e.g. `EEEEEEEEEEE`)\n * the output will be the same as default pattern for this unit, usually\n * the longest one (in case of ISO weekdays, `EEEE`). Default patterns for units\n * are marked with \"2\" in the last column of the table.\n *\n * `format(new Date(2017, 10, 6), 'MMM') //=> 'Nov'`\n *\n * `format(new Date(2017, 10, 6), 'MMMM') //=> 'November'`\n *\n * `format(new Date(2017, 10, 6), 'MMMMM') //=> 'N'`\n *\n * `format(new Date(2017, 10, 6), 'MMMMMM') //=> 'November'`\n *\n * `format(new Date(2017, 10, 6), 'MMMMMMM') //=> 'November'`\n *\n * 3. Some patterns could be unlimited length (such as `yyyyyyyy`).\n * The output will be padded with zeros to match the length of the pattern.\n *\n * `format(new Date(2017, 10, 6), 'yyyyyyyy') //=> '00002017'`\n *\n * 4. `QQQQQ` and `qqqqq` could be not strictly numerical in some locales.\n * These tokens represent the shortest form of the quarter.\n *\n * 5. The main difference between `y` and `u` patterns are B.C. years:\n *\n * | Year | `y` | `u` |\n * |------|-----|-----|\n * | AC 1 | 1 | 1 |\n * | BC 1 | 1 | 0 |\n * | BC 2 | 2 | -1 |\n *\n * Also `yy` always returns the last two digits of a year,\n * while `uu` pads single digit years to 2 characters and returns other years unchanged:\n *\n * | Year | `yy` | `uu` |\n * |------|------|------|\n * | 1 | 01 | 01 |\n * | 14 | 14 | 14 |\n * | 376 | 76 | 376 |\n * | 1453 | 53 | 1453 |\n *\n * The same difference is true for local and ISO week-numbering years (`Y` and `R`),\n * except local week-numbering years are dependent on `options.weekStartsOn`\n * and `options.firstWeekContainsDate` (compare [getISOWeekYear]{@link https://date-fns.org/docs/getISOWeekYear}\n * and [getWeekYear]{@link https://date-fns.org/docs/getWeekYear}).\n *\n * 6. Specific non-location timezones are currently unavailable in `date-fns`,\n * so right now these tokens fall back to GMT timezones.\n *\n * 7. These patterns are not in the Unicode Technical Standard #35:\n * - `i`: ISO day of week\n * - `I`: ISO week of year\n * - `R`: ISO week-numbering year\n * - `t`: seconds timestamp\n * - `T`: milliseconds timestamp\n * - `o`: ordinal number modifier\n * - `P`: long localized date\n * - `p`: long localized time\n *\n * 8. These tokens are often confused with others. See: https://git.io/fxCyr\n *\n * @param {Date|String|Number} date - the original date\n * @param {String} format - the string of tokens\n * @param {Options} [options] - the object with options. See [Options]{@link https://date-fns.org/docs/Options}\n * @param {0|1|2} [options.additionalDigits=2] - passed to `toDate`. See [toDate]{@link https://date-fns.org/docs/toDate}\n * @param {0|1|2|3|4|5|6} [options.weekStartsOn=0] - the index of the first day of the week (0 - Sunday)\n * @param {Number} [options.firstWeekContainsDate=1] - the day of January, which is\n * @param {Locale} [options.locale=defaultLocale] - the locale object. See [Locale]{@link https://date-fns.org/docs/Locale}\n * @param {Boolean} [options.awareOfUnicodeTokens=false] - if true, allows usage of Unicode tokens causes confusion:\n * - Some of the day of year tokens (`D`, `DD`) that are confused with the day of month tokens (`d`, `dd`).\n * - Some of the local week-numbering year tokens (`YY`, `YYYY`) that are confused with the calendar year tokens (`yy`, `yyyy`).\n * See: https://git.io/fxCyr\n * @returns {String} the formatted date string\n * @throws {TypeError} 2 arguments required\n * @throws {RangeError} `options.additionalDigits` must be 0, 1 or 2\n * @throws {RangeError} `options.locale` must contain `localize` property\n * @throws {RangeError} `options.locale` must contain `formatLong` property\n * @throws {RangeError} `options.weekStartsOn` must be between 0 and 6\n * @throws {RangeError} `options.firstWeekContainsDate` must be between 1 and 7\n * @throws {RangeError} `options.awareOfUnicodeTokens` must be set to `true` to use `XX` token; see: https://git.io/fxCyr\n *\n * @example\n * // Represent 11 February 2014 in middle-endian format:\n * var result = format(\n * new Date(2014, 1, 11),\n * 'MM/dd/yyyy'\n * )\n * //=> '02/11/2014'\n *\n * @example\n * // Represent 2 July 2014 in Esperanto:\n * import { eoLocale } from 'date-fns/locale/eo'\n * var result = format(\n * new Date(2014, 6, 2),\n * \"do 'de' MMMM yyyy\",\n * {locale: eoLocale}\n * )\n * //=> '2-a de julio 2014'\n *\n * @example\n * // Escape string by single quote characters:\n * var result = format(\n * new Date(2014, 6, 2, 15),\n * \"h 'o''clock'\"\n * )\n * //=> \"3 o'clock\"\n */\nfunction format(dirtyDate, dirtyFormatStr, dirtyOptions) {\n if (arguments.length < 2) {\n throw new TypeError(\n '2 arguments required, but only ' + arguments.length + ' present'\n )\n }\n\n var formatStr = String(dirtyFormatStr);\n var options = dirtyOptions || {};\n\n var locale = options.locale || locale$1;\n\n var localeFirstWeekContainsDate =\n locale.options && locale.options.firstWeekContainsDate;\n var defaultFirstWeekContainsDate =\n localeFirstWeekContainsDate == null\n ? 1\n : toInteger(localeFirstWeekContainsDate);\n var firstWeekContainsDate =\n options.firstWeekContainsDate == null\n ? defaultFirstWeekContainsDate\n : toInteger(options.firstWeekContainsDate);\n\n // Test if weekStartsOn is between 1 and 7 _and_ is not NaN\n if (!(firstWeekContainsDate >= 1 && firstWeekContainsDate <= 7)) {\n throw new RangeError(\n 'firstWeekContainsDate must be between 1 and 7 inclusively'\n )\n }\n\n var localeWeekStartsOn = locale.options && locale.options.weekStartsOn;\n var defaultWeekStartsOn =\n localeWeekStartsOn == null ? 0 : toInteger(localeWeekStartsOn);\n var weekStartsOn =\n options.weekStartsOn == null\n ? defaultWeekStartsOn\n : toInteger(options.weekStartsOn);\n\n // Test if weekStartsOn is between 0 and 6 _and_ is not NaN\n if (!(weekStartsOn >= 0 && weekStartsOn <= 6)) {\n throw new RangeError('weekStartsOn must be between 0 and 6 inclusively')\n }\n\n if (!locale.localize) {\n throw new RangeError('locale must contain localize property')\n }\n\n if (!locale.formatLong) {\n throw new RangeError('locale must contain formatLong property')\n }\n\n var originalDate = toDate(dirtyDate, options);\n\n if (!isValid(originalDate, options)) {\n return 'Invalid Date'\n }\n\n // Convert the date in system timezone to the same date in UTC+00:00 timezone.\n // This ensures that when UTC functions will be implemented, locales will be compatible with them.\n // See an issue about UTC functions: https://github.com/date-fns/date-fns/issues/376\n var timezoneOffset = getTimezoneOffsetInMilliseconds(originalDate);\n var utcDate = subMilliseconds(originalDate, timezoneOffset, options);\n\n var formatterOptions = {\n firstWeekContainsDate: firstWeekContainsDate,\n weekStartsOn: weekStartsOn,\n locale: locale,\n _originalDate: originalDate\n };\n\n var result = formatStr\n .match(longFormattingTokensRegExp)\n .map(function(substring) {\n var firstCharacter = substring[0];\n if (firstCharacter === 'p' || firstCharacter === 'P') {\n var longFormatter = longFormatters[firstCharacter];\n return longFormatter(substring, locale.formatLong, formatterOptions)\n }\n return substring\n })\n .join('')\n .match(formattingTokensRegExp)\n .map(function(substring) {\n // Replace two single quote characters with one single quote character\n if (substring === \"''\") {\n return \"'\"\n }\n\n var firstCharacter = substring[0];\n if (firstCharacter === \"'\") {\n return cleanEscapedString(substring)\n }\n\n var formatter = formatters[firstCharacter];\n if (formatter) {\n if (!options.awareOfUnicodeTokens && isProtectedToken(substring)) {\n throwProtectedError(substring);\n }\n return formatter(utcDate, substring, locale.localize, formatterOptions)\n }\n\n return substring\n })\n .join('');\n\n return result\n}\n\nfunction cleanEscapedString(input) {\n return input.match(escapedStringRegExp)[1].replace(doubleQuoteRegExp, \"'\")\n}\n\n/**\n * @name isAfter\n * @category Common Helpers\n * @summary Is the first date after the second one?\n *\n * @description\n * Is the first date after the second one?\n *\n * @param {Date|String|Number} date - the date that should be after the other one to return true\n * @param {Date|String|Number} dateToCompare - the date to compare with\n * @param {Options} [options] - the object with options. See [Options]{@link https://date-fns.org/docs/Options}\n * @param {0|1|2} [options.additionalDigits=2] - passed to `toDate`. See [toDate]{@link https://date-fns.org/docs/toDate}\n * @returns {Boolean} the first date is after the second date\n * @throws {TypeError} 2 arguments required\n * @throws {RangeError} `options.additionalDigits` must be 0, 1 or 2\n *\n * @example\n * // Is 10 July 1989 after 11 February 1987?\n * var result = isAfter(new Date(1989, 6, 10), new Date(1987, 1, 11))\n * //=> true\n */\nfunction isAfter (dirtyDate, dirtyDateToCompare, dirtyOptions) {\n if (arguments.length < 2) {\n throw new TypeError('2 arguments required, but only ' + arguments.length + ' present')\n }\n\n var date = toDate(dirtyDate, dirtyOptions);\n var dateToCompare = toDate(dirtyDateToCompare, dirtyOptions);\n return date.getTime() > dateToCompare.getTime()\n}\n\n/**\n * @name isBefore\n * @category Common Helpers\n * @summary Is the first date before the second one?\n *\n * @description\n * Is the first date before the second one?\n *\n * @param {Date|String|Number} date - the date that should be before the other one to return true\n * @param {Date|String|Number} dateToCompare - the date to compare with\n * @param {Options} [options] - the object with options. See [Options]{@link https://date-fns.org/docs/Options}\n * @param {0|1|2} [options.additionalDigits=2] - passed to `toDate`. See [toDate]{@link https://date-fns.org/docs/toDate}\n * @returns {Boolean} the first date is before the second date\n * @throws {TypeError} 2 arguments required\n * @throws {RangeError} `options.additionalDigits` must be 0, 1 or 2\n *\n * @example\n * // Is 10 July 1989 before 11 February 1987?\n * var result = isBefore(new Date(1989, 6, 10), new Date(1987, 1, 11))\n * //=> false\n */\nfunction isBefore (dirtyDate, dirtyDateToCompare, dirtyOptions) {\n if (arguments.length < 2) {\n throw new TypeError('2 arguments required, but only ' + arguments.length + ' present')\n }\n\n var date = toDate(dirtyDate, dirtyOptions);\n var dateToCompare = toDate(dirtyDateToCompare, dirtyOptions);\n return date.getTime() < dateToCompare.getTime()\n}\n\n/**\n * @name isEqual\n * @category Common Helpers\n * @summary Are the given dates equal?\n *\n * @description\n * Are the given dates equal?\n *\n * @param {Date|String|Number} dateLeft - the first date to compare\n * @param {Date|String|Number} dateRight - the second date to compare\n * @param {Options} [options] - the object with options. See [Options]{@link https://date-fns.org/docs/Options}\n * @param {0|1|2} [options.additionalDigits=2] - passed to `toDate`. See [toDate]{@link https://date-fns.org/docs/toDate}\n * @returns {Boolean} the dates are equal\n * @throws {TypeError} 2 arguments required\n * @throws {RangeError} `options.additionalDigits` must be 0, 1 or 2\n *\n * @example\n * // Are 2 July 2014 06:30:45.000 and 2 July 2014 06:30:45.500 equal?\n * var result = isEqual(\n * new Date(2014, 6, 2, 6, 30, 45, 0)\n * new Date(2014, 6, 2, 6, 30, 45, 500)\n * )\n * //=> false\n */\nfunction isEqual$1 (dirtyLeftDate, dirtyRightDate, dirtyOptions) {\n if (arguments.length < 2) {\n throw new TypeError('2 arguments required, but only ' + arguments.length + ' present')\n }\n\n var dateLeft = toDate(dirtyLeftDate, dirtyOptions);\n var dateRight = toDate(dirtyRightDate, dirtyOptions);\n return dateLeft.getTime() === dateRight.getTime()\n}\n\n// This function will be a part of public API when UTC function will be implemented.\n// See issue: https://github.com/date-fns/date-fns/issues/376\nfunction setUTCDay (dirtyDate, dirtyDay, dirtyOptions) {\n if (arguments.length < 2) {\n throw new TypeError('2 arguments required, but only ' + arguments.length + ' present')\n }\n\n var options = dirtyOptions || {};\n var locale = options.locale;\n var localeWeekStartsOn = locale && locale.options && locale.options.weekStartsOn;\n var defaultWeekStartsOn = localeWeekStartsOn == null ? 0 : toInteger(localeWeekStartsOn);\n var weekStartsOn = options.weekStartsOn == null ? defaultWeekStartsOn : toInteger(options.weekStartsOn);\n\n // Test if weekStartsOn is between 0 and 6 _and_ is not NaN\n if (!(weekStartsOn >= 0 && weekStartsOn <= 6)) {\n throw new RangeError('weekStartsOn must be between 0 and 6 inclusively')\n }\n\n var date = toDate(dirtyDate, dirtyOptions);\n var day = toInteger(dirtyDay);\n\n var currentDay = date.getUTCDay();\n\n var remainder = day % 7;\n var dayIndex = (remainder + 7) % 7;\n\n var diff = (dayIndex < weekStartsOn ? 7 : 0) + day - currentDay;\n\n date.setUTCDate(date.getUTCDate() + diff);\n return date\n}\n\n// This function will be a part of public API when UTC function will be implemented.\n// See issue: https://github.com/date-fns/date-fns/issues/376\nfunction setUTCWeek (dirtyDate, dirtyWeek, dirtyOptions) {\n if (arguments.length < 2) {\n throw new TypeError('2 arguments required, but only ' + arguments.length + ' present')\n }\n\n var date = toDate(dirtyDate, dirtyOptions);\n var week = toInteger(dirtyWeek);\n var diff = getUTCWeek(date, dirtyOptions) - week;\n date.setUTCDate(date.getUTCDate() - diff * 7);\n return date\n}\n\n// This function will be a part of public API when UTC function will be implemented.\n// See issue: https://github.com/date-fns/date-fns/issues/376\nfunction setUTCISODay (dirtyDate, dirtyDay, dirtyOptions) {\n if (arguments.length < 2) {\n throw new TypeError('2 arguments required, but only ' + arguments.length + ' present')\n }\n\n var day = toInteger(dirtyDay);\n\n if (day % 7 === 0) {\n day = day - 7;\n }\n\n var weekStartsOn = 1;\n var date = toDate(dirtyDate, dirtyOptions);\n var currentDay = date.getUTCDay();\n\n var remainder = day % 7;\n var dayIndex = (remainder + 7) % 7;\n\n var diff = (dayIndex < weekStartsOn ? 7 : 0) + day - currentDay;\n\n date.setUTCDate(date.getUTCDate() + diff);\n return date\n}\n\n// This function will be a part of public API when UTC function will be implemented.\n// See issue: https://github.com/date-fns/date-fns/issues/376\nfunction setUTCISOWeek (dirtyDate, dirtyISOWeek, dirtyOptions) {\n if (arguments.length < 2) {\n throw new TypeError('2 arguments required, but only ' + arguments.length + ' present')\n }\n\n var date = toDate(dirtyDate, dirtyOptions);\n var isoWeek = toInteger(dirtyISOWeek);\n var diff = getUTCISOWeek(date, dirtyOptions) - isoWeek;\n date.setUTCDate(date.getUTCDate() - diff * 7);\n return date\n}\n\nvar MILLISECONDS_IN_HOUR$1 = 3600000;\nvar MILLISECONDS_IN_MINUTE$2 = 60000;\nvar MILLISECONDS_IN_SECOND = 1000;\n\nvar numericPatterns = {\n month: /^(1[0-2]|0?\\d)/, // 0 to 12\n date: /^(3[0-1]|[0-2]?\\d)/, // 0 to 31\n dayOfYear: /^(36[0-6]|3[0-5]\\d|[0-2]?\\d?\\d)/, // 0 to 366\n week: /^(5[0-3]|[0-4]?\\d)/, // 0 to 53\n hour23h: /^(2[0-3]|[0-1]?\\d)/, // 0 to 23\n hour24h: /^(2[0-4]|[0-1]?\\d)/, // 0 to 24\n hour11h: /^(1[0-1]|0?\\d)/, // 0 to 11\n hour12h: /^(1[0-2]|0?\\d)/, // 0 to 12\n minute: /^[0-5]?\\d/, // 0 to 59\n second: /^[0-5]?\\d/, // 0 to 59\n\n singleDigit: /^\\d/, // 0 to 9\n twoDigits: /^\\d{1,2}/, // 0 to 99\n threeDigits: /^\\d{1,3}/, // 0 to 999\n fourDigits: /^\\d{1,4}/, // 0 to 9999\n\n anyDigitsSigned: /^-?\\d+/,\n singleDigitSigned: /^-?\\d/, // 0 to 9, -0 to -9\n twoDigitsSigned: /^-?\\d{1,2}/, // 0 to 99, -0 to -99\n threeDigitsSigned: /^-?\\d{1,3}/, // 0 to 999, -0 to -999\n fourDigitsSigned: /^-?\\d{1,4}/ // 0 to 9999, -0 to -9999\n};\n\nvar timezonePatterns = {\n basicOptionalMinutes: /^([+-])(\\d{2})(\\d{2})?|Z/,\n basic: /^([+-])(\\d{2})(\\d{2})|Z/,\n basicOptionalSeconds: /^([+-])(\\d{2})(\\d{2})((\\d{2}))?|Z/,\n extended: /^([+-])(\\d{2}):(\\d{2})|Z/,\n extendedOptionalSeconds: /^([+-])(\\d{2}):(\\d{2})(:(\\d{2}))?|Z/\n};\n\nfunction parseNumericPattern (pattern, string, valueCallback) {\n var matchResult = string.match(pattern);\n\n if (!matchResult) {\n return null\n }\n\n var value = parseInt(matchResult[0], 10);\n\n return {\n value: valueCallback ? valueCallback(value) : value,\n rest: string.slice(matchResult[0].length)\n }\n}\n\nfunction parseTimezonePattern (pattern, string) {\n var matchResult = string.match(pattern);\n\n if (!matchResult) {\n return null\n }\n\n // Input is 'Z'\n if (matchResult[0] === 'Z') {\n return {\n value: 0,\n rest: string.slice(1)\n }\n }\n\n var sign = matchResult[1] === '+' ? 1 : -1;\n var hours = matchResult[2] ? parseInt(matchResult[2], 10) : 0;\n var minutes = matchResult[3] ? parseInt(matchResult[3], 10) : 0;\n var seconds = matchResult[5] ? parseInt(matchResult[5], 10) : 0;\n\n return {\n value: sign * (\n hours * MILLISECONDS_IN_HOUR$1 +\n minutes * MILLISECONDS_IN_MINUTE$2 +\n seconds * MILLISECONDS_IN_SECOND\n ),\n rest: string.slice(matchResult[0].length)\n }\n}\n\nfunction parseAnyDigitsSigned (string, valueCallback) {\n return parseNumericPattern(numericPatterns.anyDigitsSigned, string, valueCallback)\n}\n\nfunction parseNDigits (n, string, valueCallback) {\n switch (n) {\n case 1:\n return parseNumericPattern(numericPatterns.singleDigit, string, valueCallback)\n case 2:\n return parseNumericPattern(numericPatterns.twoDigits, string, valueCallback)\n case 3:\n return parseNumericPattern(numericPatterns.threeDigits, string, valueCallback)\n case 4:\n return parseNumericPattern(numericPatterns.fourDigits, string, valueCallback)\n default:\n return parseNumericPattern(new RegExp('^\\\\d{1,' + n + '}'), string, valueCallback)\n }\n}\n\nfunction parseNDigitsSigned (n, string, valueCallback) {\n switch (n) {\n case 1:\n return parseNumericPattern(numericPatterns.singleDigitSigned, string, valueCallback)\n case 2:\n return parseNumericPattern(numericPatterns.twoDigitsSigned, string, valueCallback)\n case 3:\n return parseNumericPattern(numericPatterns.threeDigitsSigned, string, valueCallback)\n case 4:\n return parseNumericPattern(numericPatterns.fourDigitsSigned, string, valueCallback)\n default:\n return parseNumericPattern(new RegExp('^-?\\\\d{1,' + n + '}'), string, valueCallback)\n }\n}\n\nfunction dayPeriodEnumToHours (enumValue) {\n switch (enumValue) {\n case 'morning':\n return 4\n case 'evening':\n return 17\n case 'pm':\n case 'noon':\n case 'afternoon':\n return 12\n case 'am':\n case 'midnight':\n case 'night':\n default:\n return 0\n }\n}\n\nfunction normalizeTwoDigitYear (twoDigitYear, currentYear) {\n var isCommonEra = currentYear > 0;\n // Absolute number of the current year:\n // 1 -> 1 AC\n // 0 -> 1 BC\n // -1 -> 2 BC\n var absCurrentYear = isCommonEra ? currentYear : 1 - currentYear;\n\n var result;\n if (absCurrentYear <= 50) {\n result = twoDigitYear || 100;\n } else {\n var rangeEnd = absCurrentYear + 50;\n var rangeEndCentury = Math.floor(rangeEnd / 100) * 100;\n var isPreviousCentury = twoDigitYear >= rangeEnd % 100;\n result = twoDigitYear + rangeEndCentury - (isPreviousCentury ? 100 : 0);\n }\n\n return isCommonEra ? result : 1 - result\n}\n\nvar DAYS_IN_MONTH$1 = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];\nvar DAYS_IN_MONTH_LEAP_YEAR$1 = [31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];\n\n// User for validation\nfunction isLeapYearIndex$1 (year) {\n return year % 400 === 0 || (year % 4 === 0 && year % 100 !== 0)\n}\n\n/*\n * | | Unit | | Unit |\n * |-----|--------------------------------|-----|--------------------------------|\n * | a | AM, PM | A* | Milliseconds in day |\n * | b | AM, PM, noon, midnight | B | Flexible day period |\n * | c | Stand-alone local day of week | C* | Localized hour w/ day period |\n * | d | Day of month | D | Day of year |\n * | e | Local day of week | E | Day of week |\n * | f | | F* | Day of week in month |\n * | g* | Modified Julian day | G | Era |\n * | h | Hour [1-12] | H | Hour [0-23] |\n * | i! | ISO day of week | I! | ISO week of year |\n * | j* | Localized hour w/ day period | J* | Localized hour w/o day period |\n * | k | Hour [1-24] | K | Hour [0-11] |\n * | l* | (deprecated) | L | Stand-alone month |\n * | m | Minute | M | Month |\n * | n | | N | |\n * | o! | Ordinal number modifier | O* | Timezone (GMT) |\n * | p | | P | |\n * | q | Stand-alone quarter | Q | Quarter |\n * | r* | Related Gregorian year | R! | ISO week-numbering year |\n * | s | Second | S | Fraction of second |\n * | t! | Seconds timestamp | T! | Milliseconds timestamp |\n * | u | Extended year | U* | Cyclic year |\n * | v* | Timezone (generic non-locat.) | V* | Timezone (location) |\n * | w | Local week of year | W* | Week of month |\n * | x | Timezone (ISO-8601 w/o Z) | X | Timezone (ISO-8601) |\n * | y | Year (abs) | Y | Local week-numbering year |\n * | z* | Timezone (specific non-locat.) | Z* | Timezone (aliases) |\n *\n * Letters marked by * are not implemented but reserved by Unicode standard.\n *\n * Letters marked by ! are non-standard, but implemented by date-fns:\n * - `o` modifies the previous token to turn it into an ordinal (see `parse` docs)\n * - `i` is ISO day of week. For `i` and `ii` is returns numeric ISO week days,\n * i.e. 7 for Sunday, 1 for Monday, etc.\n * - `I` is ISO week of year, as opposed to `w` which is local week of year.\n * - `R` is ISO week-numbering year, as opposed to `Y` which is local week-numbering year.\n * `R` is supposed to be used in conjunction with `I` and `i`\n * for universal ISO week-numbering date, whereas\n * `Y` is supposed to be used in conjunction with `w` and `e`\n * for week-numbering date specific to the locale.\n */\nvar parsers = {\n // Era\n G: {\n priority: 140,\n parse: function (string, token, match, options) {\n switch (token) {\n // AD, BC\n case 'G':\n case 'GG':\n case 'GGG':\n return match.era(string, {width: 'abbreviated'}) ||\n match.era(string, {width: 'narrow'})\n // A, B\n case 'GGGGG':\n return match.era(string, {width: 'narrow'})\n // Anno Domini, Before Christ\n case 'GGGG':\n default:\n return match.era(string, {width: 'wide'}) ||\n match.era(string, {width: 'abbreviated'}) ||\n match.era(string, {width: 'narrow'})\n }\n },\n set: function (date, value, options) {\n // Sets year 10 BC if BC, or 10 AC if AC\n date.setUTCFullYear(value === 1 ? 10 : -9, 0, 1);\n date.setUTCHours(0, 0, 0, 0);\n return date\n }\n },\n\n // Year\n y: {\n // From http://www.unicode.org/reports/tr35/tr35-31/tr35-dates.html#Date_Format_Patterns\n // | Year | y | yy | yyy | yyyy | yyyyy |\n // |----------|-------|----|-------|-------|-------|\n // | AD 1 | 1 | 01 | 001 | 0001 | 00001 |\n // | AD 12 | 12 | 12 | 012 | 0012 | 00012 |\n // | AD 123 | 123 | 23 | 123 | 0123 | 00123 |\n // | AD 1234 | 1234 | 34 | 1234 | 1234 | 01234 |\n // | AD 12345 | 12345 | 45 | 12345 | 12345 | 12345 |\n\n priority: 130,\n parse: function (string, token, match, options) {\n var valueCallback = function (year) {\n return {\n year: year,\n isTwoDigitYear: token === 'yy'\n }\n };\n\n switch (token) {\n case 'y':\n return parseNDigits(4, string, valueCallback)\n case 'yo':\n return match.ordinalNumber(string, {unit: 'year', valueCallback: valueCallback})\n default:\n return parseNDigits(token.length, string, valueCallback)\n }\n },\n validate: function (date, value, options) {\n return value.isTwoDigitYear || value.year > 0\n },\n set: function (date, value, options) {\n var currentYear = getUTCWeekYear(date, options);\n\n if (value.isTwoDigitYear) {\n var normalizedTwoDigitYear = normalizeTwoDigitYear(value.year, currentYear);\n date.setUTCFullYear(normalizedTwoDigitYear, 0, 1);\n date.setUTCHours(0, 0, 0, 0);\n return date\n }\n\n var year = currentYear > 0 ? value.year : 1 - value.year;\n date.setUTCFullYear(year, 0, 1);\n date.setUTCHours(0, 0, 0, 0);\n return date\n }\n },\n\n // Local week-numbering year\n Y: {\n priority: 130,\n parse: function (string, token, match, options) {\n var valueCallback = function (year) {\n return {\n year: year,\n isTwoDigitYear: token === 'YY'\n }\n };\n\n switch (token) {\n case 'Y':\n return parseNDigits(4, string, valueCallback)\n case 'Yo':\n return match.ordinalNumber(string, {unit: 'year', valueCallback: valueCallback})\n default:\n return parseNDigits(token.length, string, valueCallback)\n }\n },\n validate: function (date, value, options) {\n return value.isTwoDigitYear || value.year > 0\n },\n set: function (date, value, options) {\n var currentYear = date.getUTCFullYear();\n\n if (value.isTwoDigitYear) {\n var normalizedTwoDigitYear = normalizeTwoDigitYear(value.year, currentYear);\n date.setUTCFullYear(normalizedTwoDigitYear, 0, options.firstWeekContainsDate);\n date.setUTCHours(0, 0, 0, 0);\n return startOfUTCWeek(date, options)\n }\n\n var year = currentYear > 0 ? value.year : 1 - value.year;\n date.setUTCFullYear(year, 0, options.firstWeekContainsDate);\n date.setUTCHours(0, 0, 0, 0);\n return startOfUTCWeek(date, options)\n }\n },\n\n // ISO week-numbering year\n R: {\n priority: 130,\n parse: function (string, token, match, options) {\n if (token === 'R') {\n return parseNDigitsSigned(4, string)\n }\n\n return parseNDigitsSigned(token.length, string)\n },\n set: function (date, value, options) {\n var firstWeekOfYear = new Date(0);\n firstWeekOfYear.setUTCFullYear(value, 0, 4);\n firstWeekOfYear.setUTCHours(0, 0, 0, 0);\n return startOfUTCISOWeek(firstWeekOfYear)\n }\n },\n\n // Extended year\n u: {\n priority: 130,\n parse: function (string, token, match, options) {\n if (token === 'u') {\n return parseNDigitsSigned(4, string)\n }\n\n return parseNDigitsSigned(token.length, string)\n },\n set: function (date, value, options) {\n date.setUTCFullYear(value, 0, 1);\n date.setUTCHours(0, 0, 0, 0);\n return date\n }\n },\n\n // Quarter\n Q: {\n priority: 120,\n parse: function (string, token, match, options) {\n switch (token) {\n // 1, 2, 3, 4\n case 'Q':\n case 'QQ': // 01, 02, 03, 04\n return parseNDigits(token.length, string)\n // 1st, 2nd, 3rd, 4th\n case 'Qo':\n return match.ordinalNumber(string, {unit: 'quarter'})\n // Q1, Q2, Q3, Q4\n case 'QQQ':\n return match.quarter(string, {width: 'abbreviated', context: 'formatting'}) ||\n match.quarter(string, {width: 'narrow', context: 'formatting'})\n // 1, 2, 3, 4 (narrow quarter; could be not numerical)\n case 'QQQQQ':\n return match.quarter(string, {width: 'narrow', context: 'formatting'})\n // 1st quarter, 2nd quarter, ...\n case 'QQQQ':\n default:\n return match.quarter(string, {width: 'wide', context: 'formatting'}) ||\n match.quarter(string, {width: 'abbreviated', context: 'formatting'}) ||\n match.quarter(string, {width: 'narrow', context: 'formatting'})\n }\n },\n validate: function (date, value, options) {\n return value >= 1 && value <= 4\n },\n set: function (date, value, options) {\n date.setUTCMonth((value - 1) * 3, 1);\n date.setUTCHours(0, 0, 0, 0);\n return date\n }\n },\n\n // Stand-alone quarter\n q: {\n priority: 120,\n parse: function (string, token, match, options) {\n switch (token) {\n // 1, 2, 3, 4\n case 'q':\n case 'qq': // 01, 02, 03, 04\n return parseNDigits(token.length, string)\n // 1st, 2nd, 3rd, 4th\n case 'qo':\n return match.ordinalNumber(string, {unit: 'quarter'})\n // Q1, Q2, Q3, Q4\n case 'qqq':\n return match.quarter(string, {width: 'abbreviated', context: 'standalone'}) ||\n match.quarter(string, {width: 'narrow', context: 'standalone'})\n // 1, 2, 3, 4 (narrow quarter; could be not numerical)\n case 'qqqqq':\n return match.quarter(string, {width: 'narrow', context: 'standalone'})\n // 1st quarter, 2nd quarter, ...\n case 'qqqq':\n default:\n return match.quarter(string, {width: 'wide', context: 'standalone'}) ||\n match.quarter(string, {width: 'abbreviated', context: 'standalone'}) ||\n match.quarter(string, {width: 'narrow', context: 'standalone'})\n }\n },\n validate: function (date, value, options) {\n return value >= 1 && value <= 4\n },\n set: function (date, value, options) {\n date.setUTCMonth((value - 1) * 3, 1);\n date.setUTCHours(0, 0, 0, 0);\n return date\n }\n },\n\n // Month\n M: {\n priority: 110,\n parse: function (string, token, match, options) {\n var valueCallback = function (value) {\n return value - 1\n };\n\n switch (token) {\n // 1, 2, ..., 12\n case 'M':\n return parseNumericPattern(numericPatterns.month, string, valueCallback)\n // 01, 02, ..., 12\n case 'MM':\n return parseNDigits(2, string, valueCallback)\n // 1st, 2nd, ..., 12th\n case 'Mo':\n return match.ordinalNumber(string, {unit: 'month', valueCallback: valueCallback})\n // Jan, Feb, ..., Dec\n case 'MMM':\n return match.month(string, {width: 'abbreviated', context: 'formatting'}) ||\n match.month(string, {width: 'narrow', context: 'formatting'})\n // J, F, ..., D\n case 'MMMMM':\n return match.month(string, {width: 'narrow', context: 'formatting'})\n // January, February, ..., December\n case 'MMMM':\n default:\n return match.month(string, {width: 'wide', context: 'formatting'}) ||\n match.month(string, {width: 'abbreviated', context: 'formatting'}) ||\n match.month(string, {width: 'narrow', context: 'formatting'})\n }\n },\n validate: function (date, value, options) {\n return value >= 0 && value <= 11\n },\n set: function (date, value, options) {\n date.setUTCMonth(value, 1);\n date.setUTCHours(0, 0, 0, 0);\n return date\n }\n },\n\n // Stand-alone month\n L: {\n priority: 110,\n parse: function (string, token, match, options) {\n var valueCallback = function (value) {\n return value - 1\n };\n\n switch (token) {\n // 1, 2, ..., 12\n case 'L':\n return parseNumericPattern(numericPatterns.month, string, valueCallback)\n // 01, 02, ..., 12\n case 'LL':\n return parseNDigits(2, string, valueCallback)\n // 1st, 2nd, ..., 12th\n case 'Lo':\n return match.ordinalNumber(string, {unit: 'month', valueCallback: valueCallback})\n // Jan, Feb, ..., Dec\n case 'LLL':\n return match.month(string, {width: 'abbreviated', context: 'standalone'}) ||\n match.month(string, {width: 'narrow', context: 'standalone'})\n // J, F, ..., D\n case 'LLLLL':\n return match.month(string, {width: 'narrow', context: 'standalone'})\n // January, February, ..., December\n case 'LLLL':\n default:\n return match.month(string, {width: 'wide', context: 'standalone'}) ||\n match.month(string, {width: 'abbreviated', context: 'standalone'}) ||\n match.month(string, {width: 'narrow', context: 'standalone'})\n }\n },\n validate: function (date, value, options) {\n return value >= 0 && value <= 11\n },\n set: function (date, value, options) {\n date.setUTCMonth(value, 1);\n date.setUTCHours(0, 0, 0, 0);\n return date\n }\n },\n\n // Local week of year\n w: {\n priority: 100,\n parse: function (string, token, match, options) {\n switch (token) {\n case 'w':\n return parseNumericPattern(numericPatterns.week, string)\n case 'wo':\n return match.ordinalNumber(string, {unit: 'week'})\n default:\n return parseNDigits(token.length, string)\n }\n },\n validate: function (date, value, options) {\n return value >= 1 && value <= 53\n },\n set: function (date, value, options) {\n return startOfUTCWeek(setUTCWeek(date, value, options), options)\n }\n },\n\n // ISO week of year\n I: {\n priority: 100,\n parse: function (string, token, match, options) {\n switch (token) {\n case 'I':\n return parseNumericPattern(numericPatterns.week, string)\n case 'Io':\n return match.ordinalNumber(string, {unit: 'week'})\n default:\n return parseNDigits(token.length, string)\n }\n },\n validate: function (date, value, options) {\n return value >= 1 && value <= 53\n },\n set: function (date, value, options) {\n return startOfUTCISOWeek(setUTCISOWeek(date, value, options), options)\n }\n },\n\n // Day of the month\n d: {\n priority: 90,\n parse: function (string, token, match, options) {\n switch (token) {\n case 'd':\n return parseNumericPattern(numericPatterns.date, string)\n case 'do':\n return match.ordinalNumber(string, {unit: 'date'})\n default:\n return parseNDigits(token.length, string)\n }\n },\n validate: function (date, value, options) {\n var year = date.getUTCFullYear();\n var isLeapYear = isLeapYearIndex$1(year);\n var month = date.getUTCMonth();\n if (isLeapYear) {\n return value >= 1 && value <= DAYS_IN_MONTH_LEAP_YEAR$1[month]\n } else {\n return value >= 1 && value <= DAYS_IN_MONTH$1[month]\n }\n },\n set: function (date, value, options) {\n date.setUTCDate(value);\n date.setUTCHours(0, 0, 0, 0);\n return date\n }\n },\n\n // Day of year\n D: {\n priority: 90,\n parse: function (string, token, match, options) {\n switch (token) {\n case 'D':\n case 'DD':\n return parseNumericPattern(numericPatterns.dayOfYear, string)\n case 'Do':\n return match.ordinalNumber(string, {unit: 'date'})\n default:\n return parseNDigits(token.length, string)\n }\n },\n validate: function (date, value, options) {\n var year = date.getUTCFullYear();\n var isLeapYear = isLeapYearIndex$1(year);\n if (isLeapYear) {\n return value >= 1 && value <= 366\n } else {\n return value >= 1 && value <= 365\n }\n },\n set: function (date, value, options) {\n date.setUTCMonth(0, value);\n date.setUTCHours(0, 0, 0, 0);\n return date\n }\n },\n\n // Day of week\n E: {\n priority: 90,\n parse: function (string, token, match, options) {\n switch (token) {\n // Tue\n case 'E':\n case 'EE':\n case 'EEE':\n return match.day(string, {width: 'abbreviated', context: 'formatting'}) ||\n match.day(string, {width: 'short', context: 'formatting'}) ||\n match.day(string, {width: 'narrow', context: 'formatting'})\n // T\n case 'EEEEE':\n return match.day(string, {width: 'narrow', context: 'formatting'})\n // Tu\n case 'EEEEEE':\n return match.day(string, {width: 'short', context: 'formatting'}) ||\n match.day(string, {width: 'narrow', context: 'formatting'})\n // Tuesday\n case 'EEEE':\n default:\n return match.day(string, {width: 'wide', context: 'formatting'}) ||\n match.day(string, {width: 'abbreviated', context: 'formatting'}) ||\n match.day(string, {width: 'short', context: 'formatting'}) ||\n match.day(string, {width: 'narrow', context: 'formatting'})\n }\n },\n validate: function (date, value, options) {\n return value >= 0 && value <= 6\n },\n set: function (date, value, options) {\n date = setUTCDay(date, value, options);\n date.setUTCHours(0, 0, 0, 0);\n return date\n }\n },\n\n // Local day of week\n e: {\n priority: 90,\n parse: function (string, token, match, options) {\n var valueCallback = function (value) {\n var wholeWeekDays = Math.floor((value - 1) / 7) * 7;\n return (value + options.weekStartsOn + 6) % 7 + wholeWeekDays\n };\n\n switch (token) {\n // 3\n case 'e':\n case 'ee': // 03\n return parseNDigits(token.length, string, valueCallback)\n // 3rd\n case 'eo':\n return match.ordinalNumber(string, {unit: 'day', valueCallback: valueCallback})\n // Tue\n case 'eee':\n return match.day(string, {width: 'abbreviated', context: 'formatting'}) ||\n match.day(string, {width: 'short', context: 'formatting'}) ||\n match.day(string, {width: 'narrow', context: 'formatting'})\n // T\n case 'eeeee':\n return match.day(string, {width: 'narrow', context: 'formatting'})\n // Tu\n case 'eeeeee':\n return match.day(string, {width: 'short', context: 'formatting'}) ||\n match.day(string, {width: 'narrow', context: 'formatting'})\n // Tuesday\n case 'eeee':\n default:\n return match.day(string, {width: 'wide', context: 'formatting'}) ||\n match.day(string, {width: 'abbreviated', context: 'formatting'}) ||\n match.day(string, {width: 'short', context: 'formatting'}) ||\n match.day(string, {width: 'narrow', context: 'formatting'})\n }\n },\n validate: function (date, value, options) {\n return value >= 0 && value <= 6\n },\n set: function (date, value, options) {\n date = setUTCDay(date, value, options);\n date.setUTCHours(0, 0, 0, 0);\n return date\n }\n },\n\n // Stand-alone local day of week\n c: {\n priority: 90,\n parse: function (string, token, match, options) {\n var valueCallback = function (value) {\n var wholeWeekDays = Math.floor((value - 1) / 7) * 7;\n return (value + options.weekStartsOn + 6) % 7 + wholeWeekDays\n };\n\n switch (token) {\n // 3\n case 'c':\n case 'cc': // 03\n return parseNDigits(token.length, string, valueCallback)\n // 3rd\n case 'co':\n return match.ordinalNumber(string, {unit: 'day', valueCallback: valueCallback})\n // Tue\n case 'ccc':\n return match.day(string, {width: 'abbreviated', context: 'standalone'}) ||\n match.day(string, {width: 'short', context: 'standalone'}) ||\n match.day(string, {width: 'narrow', context: 'standalone'})\n // T\n case 'ccccc':\n return match.day(string, {width: 'narrow', context: 'standalone'})\n // Tu\n case 'cccccc':\n return match.day(string, {width: 'short', context: 'standalone'}) ||\n match.day(string, {width: 'narrow', context: 'standalone'})\n // Tuesday\n case 'cccc':\n default:\n return match.day(string, {width: 'wide', context: 'standalone'}) ||\n match.day(string, {width: 'abbreviated', context: 'standalone'}) ||\n match.day(string, {width: 'short', context: 'standalone'}) ||\n match.day(string, {width: 'narrow', context: 'standalone'})\n }\n },\n validate: function (date, value, options) {\n return value >= 0 && value <= 6\n },\n set: function (date, value, options) {\n date = setUTCDay(date, value, options);\n date.setUTCHours(0, 0, 0, 0);\n return date\n }\n },\n\n // ISO day of week\n i: {\n priority: 90,\n parse: function (string, token, match, options) {\n var valueCallback = function (value) {\n if (value === 0) {\n return 7\n }\n return value\n };\n\n switch (token) {\n // 2\n case 'i':\n case 'ii': // 02\n return parseNDigits(token.length, string)\n // 2nd\n case 'io':\n return match.ordinalNumber(string, {unit: 'day'})\n // Tue\n case 'iii':\n return match.day(string, {width: 'abbreviated', context: 'formatting', valueCallback: valueCallback}) ||\n match.day(string, {width: 'short', context: 'formatting', valueCallback: valueCallback}) ||\n match.day(string, {width: 'narrow', context: 'formatting', valueCallback: valueCallback})\n // T\n case 'iiiii':\n return match.day(string, {width: 'narrow', context: 'formatting', valueCallback: valueCallback})\n // Tu\n case 'iiiiii':\n return match.day(string, {width: 'short', context: 'formatting', valueCallback: valueCallback}) ||\n match.day(string, {width: 'narrow', context: 'formatting', valueCallback: valueCallback})\n // Tuesday\n case 'iiii':\n default:\n return match.day(string, {width: 'wide', context: 'formatting', valueCallback: valueCallback}) ||\n match.day(string, {width: 'abbreviated', context: 'formatting', valueCallback: valueCallback}) ||\n match.day(string, {width: 'short', context: 'formatting', valueCallback: valueCallback}) ||\n match.day(string, {width: 'narrow', context: 'formatting', valueCallback: valueCallback})\n }\n },\n validate: function (date, value, options) {\n return value >= 1 && value <= 7\n },\n set: function (date, value, options) {\n date = setUTCISODay(date, value, options);\n date.setUTCHours(0, 0, 0, 0);\n return date\n }\n },\n\n // AM or PM\n a: {\n priority: 80,\n parse: function (string, token, match, options) {\n switch (token) {\n case 'a':\n case 'aa':\n case 'aaa':\n return match.dayPeriod(string, {width: 'abbreviated', context: 'formatting'}) ||\n match.dayPeriod(string, {width: 'narrow', context: 'formatting'})\n case 'aaaaa':\n return match.dayPeriod(string, {width: 'narrow', context: 'formatting'})\n case 'aaaa':\n default:\n return match.dayPeriod(string, {width: 'wide', context: 'formatting'}) ||\n match.dayPeriod(string, {width: 'abbreviated', context: 'formatting'}) ||\n match.dayPeriod(string, {width: 'narrow', context: 'formatting'})\n }\n },\n set: function (date, value, options) {\n date.setUTCHours(dayPeriodEnumToHours(value), 0, 0, 0);\n return date\n }\n },\n\n // AM, PM, midnight\n b: {\n priority: 80,\n parse: function (string, token, match, options) {\n switch (token) {\n case 'b':\n case 'bb':\n case 'bbb':\n return match.dayPeriod(string, {width: 'abbreviated', context: 'formatting'}) ||\n match.dayPeriod(string, {width: 'narrow', context: 'formatting'})\n case 'bbbbb':\n return match.dayPeriod(string, {width: 'narrow', context: 'formatting'})\n case 'bbbb':\n default:\n return match.dayPeriod(string, {width: 'wide', context: 'formatting'}) ||\n match.dayPeriod(string, {width: 'abbreviated', context: 'formatting'}) ||\n match.dayPeriod(string, {width: 'narrow', context: 'formatting'})\n }\n },\n set: function (date, value, options) {\n date.setUTCHours(dayPeriodEnumToHours(value), 0, 0, 0);\n return date\n }\n },\n\n // in the morning, in the afternoon, in the evening, at night\n B: {\n priority: 80,\n parse: function (string, token, match, options) {\n switch (token) {\n case 'B':\n case 'BB':\n case 'BBB':\n return match.dayPeriod(string, {width: 'abbreviated', context: 'formatting'}) ||\n match.dayPeriod(string, {width: 'narrow', context: 'formatting'})\n case 'BBBBB':\n return match.dayPeriod(string, {width: 'narrow', context: 'formatting'})\n case 'BBBB':\n default:\n return match.dayPeriod(string, {width: 'wide', context: 'formatting'}) ||\n match.dayPeriod(string, {width: 'abbreviated', context: 'formatting'}) ||\n match.dayPeriod(string, {width: 'narrow', context: 'formatting'})\n }\n },\n set: function (date, value, options) {\n date.setUTCHours(dayPeriodEnumToHours(value), 0, 0, 0);\n return date\n }\n },\n\n // Hour [1-12]\n h: {\n priority: 70,\n parse: function (string, token, match, options) {\n switch (token) {\n case 'h':\n return parseNumericPattern(numericPatterns.hour12h, string)\n case 'ho':\n return match.ordinalNumber(string, {unit: 'hour'})\n default:\n return parseNDigits(token.length, string)\n }\n },\n validate: function (date, value, options) {\n return value >= 1 && value <= 12\n },\n set: function (date, value, options) {\n var isPM = date.getUTCHours() >= 12;\n if (isPM && value < 12) {\n date.setUTCHours(value + 12, 0, 0, 0);\n } else if (!isPM && value === 12) {\n date.setUTCHours(0, 0, 0, 0);\n } else {\n date.setUTCHours(value, 0, 0, 0);\n }\n return date\n }\n },\n\n // Hour [0-23]\n H: {\n priority: 70,\n parse: function (string, token, match, options) {\n switch (token) {\n case 'H':\n return parseNumericPattern(numericPatterns.hour23h, string)\n case 'Ho':\n return match.ordinalNumber(string, {unit: 'hour'})\n default:\n return parseNDigits(token.length, string)\n }\n },\n validate: function (date, value, options) {\n return value >= 0 && value <= 23\n },\n set: function (date, value, options) {\n date.setUTCHours(value, 0, 0, 0);\n return date\n }\n },\n\n // Hour [0-11]\n K: {\n priority: 70,\n parse: function (string, token, match, options) {\n switch (token) {\n case 'K':\n return parseNumericPattern(numericPatterns.hour11h, string)\n case 'Ko':\n return match.ordinalNumber(string, {unit: 'hour'})\n default:\n return parseNDigits(token.length, string)\n }\n },\n validate: function (date, value, options) {\n return value >= 0 && value <= 11\n },\n set: function (date, value, options) {\n var isPM = date.getUTCHours() >= 12;\n if (isPM && value < 12) {\n date.setUTCHours(value + 12, 0, 0, 0);\n } else {\n date.setUTCHours(value, 0, 0, 0);\n }\n return date\n }\n },\n\n // Hour [1-24]\n k: {\n priority: 70,\n parse: function (string, token, match, options) {\n switch (token) {\n case 'k':\n return parseNumericPattern(numericPatterns.hour24h, string)\n case 'ko':\n return match.ordinalNumber(string, {unit: 'hour'})\n default:\n return parseNDigits(token.length, string)\n }\n },\n validate: function (date, value, options) {\n return value >= 1 && value <= 24\n },\n set: function (date, value, options) {\n var hours = value <= 24 ? value % 24 : value;\n date.setUTCHours(hours, 0, 0, 0);\n return date\n }\n },\n\n // Minute\n m: {\n priority: 60,\n parse: function (string, token, match, options) {\n switch (token) {\n case 'm':\n return parseNumericPattern(numericPatterns.minute, string)\n case 'mo':\n return match.ordinalNumber(string, {unit: 'minute'})\n default:\n return parseNDigits(token.length, string)\n }\n },\n validate: function (date, value, options) {\n return value >= 0 && value <= 59\n },\n set: function (date, value, options) {\n date.setUTCMinutes(value, 0, 0);\n return date\n }\n },\n\n // Second\n s: {\n priority: 50,\n parse: function (string, token, match, options) {\n switch (token) {\n case 's':\n return parseNumericPattern(numericPatterns.second, string)\n case 'so':\n return match.ordinalNumber(string, {unit: 'second'})\n default:\n return parseNDigits(token.length, string)\n }\n },\n validate: function (date, value, options) {\n return value >= 0 && value <= 59\n },\n set: function (date, value, options) {\n date.setUTCSeconds(value, 0);\n return date\n }\n },\n\n // Fraction of second\n S: {\n priority: 40,\n parse: function (string, token, match, options) {\n var valueCallback = function (value) {\n return Math.floor(value * Math.pow(10, -token.length + 3))\n };\n return parseNDigits(token.length, string, valueCallback)\n },\n set: function (date, value, options) {\n date.setUTCMilliseconds(value);\n return date\n }\n },\n\n // Timezone (ISO-8601. +00:00 is `'Z'`)\n X: {\n priority: 20,\n parse: function (string, token, match, options) {\n switch (token) {\n case 'X':\n return parseTimezonePattern(timezonePatterns.basicOptionalMinutes, string)\n case 'XX':\n return parseTimezonePattern(timezonePatterns.basic, string)\n case 'XXXX':\n return parseTimezonePattern(timezonePatterns.basicOptionalSeconds, string)\n case 'XXXXX':\n return parseTimezonePattern(timezonePatterns.extendedOptionalSeconds, string)\n case 'XXX':\n default:\n return parseTimezonePattern(timezonePatterns.extended, string)\n }\n },\n set: function (date, value, options) {\n return new Date(date.getTime() - value)\n }\n },\n\n // Timezone (ISO-8601)\n x: {\n priority: 20,\n parse: function (string, token, match, options) {\n switch (token) {\n case 'x':\n return parseTimezonePattern(timezonePatterns.basicOptionalMinutes, string)\n case 'xx':\n return parseTimezonePattern(timezonePatterns.basic, string)\n case 'xxxx':\n return parseTimezonePattern(timezonePatterns.basicOptionalSeconds, string)\n case 'xxxxx':\n return parseTimezonePattern(timezonePatterns.extendedOptionalSeconds, string)\n case 'xxx':\n default:\n return parseTimezonePattern(timezonePatterns.extended, string)\n }\n },\n set: function (date, value, options) {\n return new Date(date.getTime() - value)\n }\n },\n\n // Seconds timestamp\n t: {\n priority: 10,\n parse: function (string, token, match, options) {\n return parseAnyDigitsSigned(string)\n },\n set: function (date, value, options) {\n return new Date(value * 1000)\n }\n },\n\n // Milliseconds timestamp\n T: {\n priority: 10,\n parse: function (string, token, match, options) {\n return parseAnyDigitsSigned(string)\n },\n set: function (date, value, options) {\n return new Date(value)\n }\n }\n};\n\nvar TIMEZONE_UNIT_PRIORITY = 20;\n\n// This RegExp consists of three parts separated by `|`:\n// - [yYQqMLwIdDecihHKkms]o matches any available ordinal number token\n// (one of the certain letters followed by `o`)\n// - (\\w)\\1* matches any sequences of the same letter\n// - '' matches two quote characters in a row\n// - '(''|[^'])+('|$) matches anything surrounded by two quote characters ('),\n// except a single quote symbol, which ends the sequence.\n// Two quote characters do not end the sequence.\n// If there is no matching single quote\n// then the sequence will continue until the end of the string.\n// - . matches any single character unmatched by previous parts of the RegExps\nvar formattingTokensRegExp$1 = /[yYQqMLwIdDecihHKkms]o|(\\w)\\1*|''|'(''|[^'])+('|$)|./g;\n\nvar escapedStringRegExp$1 = /^'(.*?)'?$/;\nvar doubleQuoteRegExp$1 = /''/g;\n\nvar notWhitespaceRegExp = /\\S/;\n\n/**\n * @name parse\n * @category Common Helpers\n * @summary Parse the date.\n *\n * @description\n * Return the date parsed from string using the given format string.\n *\n * > ⚠️ Please note that the `format` tokens differ from Moment.js and other libraries.\n * > See: https://git.io/fxCyr\n *\n * The characters in the format string wrapped between two single quotes characters (') are escaped.\n * Two single quotes in a row, whether inside or outside a quoted sequence, represent a 'real' single quote.\n *\n * Format of the format string is based on Unicode Technical Standard #35:\n * https://www.unicode.org/reports/tr35/tr35-dates.html#Date_Field_Symbol_Table\n * with a few additions (see note 5 below the table).\n *\n * Accepted format string patterns:\n * | Unit |Prior| Pattern | Result examples | Notes |\n * |---------------------------------|-----|---------|-----------------------------------|-------|\n * | Era | 140 | G..GGG | AD, BC | |\n * | | | GGGG | Anno Domini, Before Christ | 2 |\n * | | | GGGGG | A, B | |\n * | Calendar year | 130 | y | 44, 1, 1900, 2017, 9999 | 4 |\n * | | | yo | 44th, 1st, 1900th, 9999999th | 4,5 |\n * | | | yy | 44, 01, 00, 17 | 4 |\n * | | | yyy | 044, 001, 123, 999 | 4 |\n * | | | yyyy | 0044, 0001, 1900, 2017 | 4 |\n * | | | yyyyy | ... | 2,4 |\n * | Local week-numbering year | 130 | Y | 44, 1, 1900, 2017, 9000 | 4 |\n * | | | Yo | 44th, 1st, 1900th, 9999999th | 4,5 |\n * | | | YY | 44, 01, 00, 17 | 4,6 |\n * | | | YYY | 044, 001, 123, 999 | 4 |\n * | | | YYYY | 0044, 0001, 1900, 2017 | 4,6 |\n * | | | YYYYY | ... | 2,4 |\n * | ISO week-numbering year | 130 | R | -43, 1, 1900, 2017, 9999, -9999 | 4,5 |\n * | | | RR | -43, 01, 00, 17 | 4,5 |\n * | | | RRR | -043, 001, 123, 999, -999 | 4,5 |\n * | | | RRRR | -0043, 0001, 2017, 9999, -9999 | 4,5 |\n * | | | RRRRR | ... | 2,4,5 |\n * | Extended year | 130 | u | -43, 1, 1900, 2017, 9999, -999 | 4 |\n * | | | uu | -43, 01, 99, -99 | 4 |\n * | | | uuu | -043, 001, 123, 999, -999 | 4 |\n * | | | uuuu | -0043, 0001, 2017, 9999, -9999 | 4 |\n * | | | uuuuu | ... | 2,4 |\n * | Quarter (formatting) | 120 | Q | 1, 2, 3, 4 | |\n * | | | Qo | 1st, 2nd, 3rd, 4th | 5 |\n * | | | QQ | 01, 02, 03, 04 | |\n * | | | QQQ | Q1, Q2, Q3, Q4 | |\n * | | | QQQQ | 1st quarter, 2nd quarter, ... | 2 |\n * | | | QQQQQ | 1, 2, 3, 4 | 4 |\n * | Quarter (stand-alone) | 120 | q | 1, 2, 3, 4 | |\n * | | | qo | 1st, 2nd, 3rd, 4th | 5 |\n * | | | qq | 01, 02, 03, 04 | |\n * | | | qqq | Q1, Q2, Q3, Q4 | |\n * | | | qqqq | 1st quarter, 2nd quarter, ... | 2 |\n * | | | qqqqq | 1, 2, 3, 4 | 3 |\n * | Month (formatting) | 110 | M | 1, 2, ..., 12 | |\n * | | | Mo | 1st, 2nd, ..., 12th | 5 |\n * | | | MM | 01, 02, ..., 12 | |\n * | | | MMM | Jan, Feb, ..., Dec | |\n * | | | MMMM | January, February, ..., December | 2 |\n * | | | MMMMM | J, F, ..., D | |\n * | Month (stand-alone) | 110 | L | 1, 2, ..., 12 | |\n * | | | Lo | 1st, 2nd, ..., 12th | 5 |\n * | | | LL | 01, 02, ..., 12 | |\n * | | | LLL | Jan, Feb, ..., Dec | |\n * | | | LLLL | January, February, ..., December | 2 |\n * | | | LLLLL | J, F, ..., D | |\n * | Local week of year | 100 | w | 1, 2, ..., 53 | |\n * | | | wo | 1st, 2nd, ..., 53th | 5 |\n * | | | ww | 01, 02, ..., 53 | |\n * | ISO week of year | 100 | I | 1, 2, ..., 53 | 5 |\n * | | | Io | 1st, 2nd, ..., 53th | 5 |\n * | | | II | 01, 02, ..., 53 | 5 |\n * | Day of month | 90 | d | 1, 2, ..., 31 | |\n * | | | do | 1st, 2nd, ..., 31st | 5 |\n * | | | dd | 01, 02, ..., 31 | |\n * | Day of year | 90 | D | 1, 2, ..., 365, 366 | 6 |\n * | | | Do | 1st, 2nd, ..., 365th, 366th | 5 |\n * | | | DD | 01, 02, ..., 365, 366 | 6 |\n * | | | DDD | 001, 002, ..., 365, 366 | |\n * | | | DDDD | ... | 2 |\n * | Day of week (formatting) | 90 | E..EEE | Mon, Tue, Wed, ..., Su | |\n * | | | EEEE | Monday, Tuesday, ..., Sunday | 2 |\n * | | | EEEEE | M, T, W, T, F, S, S | |\n * | | | EEEEEE | Mo, Tu, We, Th, Fr, Su, Sa | |\n * | ISO day of week (formatting) | 90 | i | 1, 2, 3, ..., 7 | 5 |\n * | | | io | 1st, 2nd, ..., 7th | 5 |\n * | | | ii | 01, 02, ..., 07 | 5 |\n * | | | iii | Mon, Tue, Wed, ..., Su | 5 |\n * | | | iiii | Monday, Tuesday, ..., Sunday | 2,5 |\n * | | | iiiii | M, T, W, T, F, S, S | 5 |\n * | | | iiiiii | Mo, Tu, We, Th, Fr, Su, Sa | 5 |\n * | Local day of week (formatting) | 90 | e | 2, 3, 4, ..., 1 | |\n * | | | eo | 2nd, 3rd, ..., 1st | 5 |\n * | | | ee | 02, 03, ..., 01 | |\n * | | | eee | Mon, Tue, Wed, ..., Su | |\n * | | | eeee | Monday, Tuesday, ..., Sunday | 2 |\n * | | | eeeee | M, T, W, T, F, S, S | |\n * | | | eeeeee | Mo, Tu, We, Th, Fr, Su, Sa | |\n * | Local day of week (stand-alone) | 90 | c | 2, 3, 4, ..., 1 | |\n * | | | co | 2nd, 3rd, ..., 1st | 5 |\n * | | | cc | 02, 03, ..., 01 | |\n * | | | ccc | Mon, Tue, Wed, ..., Su | |\n * | | | cccc | Monday, Tuesday, ..., Sunday | 2 |\n * | | | ccccc | M, T, W, T, F, S, S | |\n * | | | cccccc | Mo, Tu, We, Th, Fr, Su, Sa | |\n * | AM, PM | 80 | a..aaa | AM, PM | |\n * | | | aaaa | a.m., p.m. | 2 |\n * | | | aaaaa | a, p | |\n * | AM, PM, noon, midnight | 80 | b..bbb | AM, PM, noon, midnight | |\n * | | | bbbb | a.m., p.m., noon, midnight | 2 |\n * | | | bbbbb | a, p, n, mi | |\n * | Flexible day period | 80 | B..BBB | at night, in the morning, ... | |\n * | | | BBBB | at night, in the morning, ... | 2 |\n * | | | BBBBB | at night, in the morning, ... | |\n * | Hour [1-12] | 70 | h | 1, 2, ..., 11, 12 | |\n * | | | ho | 1st, 2nd, ..., 11th, 12th | 5 |\n * | | | hh | 01, 02, ..., 11, 12 | |\n * | Hour [0-23] | 70 | H | 0, 1, 2, ..., 23 | |\n * | | | Ho | 0th, 1st, 2nd, ..., 23rd | 5 |\n * | | | HH | 00, 01, 02, ..., 23 | |\n * | Hour [0-11] | 70 | K | 1, 2, ..., 11, 0 | |\n * | | | Ko | 1st, 2nd, ..., 11th, 0th | 5 |\n * | | | KK | 1, 2, ..., 11, 0 | |\n * | Hour [1-24] | 70 | k | 24, 1, 2, ..., 23 | |\n * | | | ko | 24th, 1st, 2nd, ..., 23rd | 5 |\n * | | | kk | 24, 01, 02, ..., 23 | |\n * | Minute | 60 | m | 0, 1, ..., 59 | |\n * | | | mo | 0th, 1st, ..., 59th | 5 |\n * | | | mm | 00, 01, ..., 59 | |\n * | Second | 50 | s | 0, 1, ..., 59 | |\n * | | | so | 0th, 1st, ..., 59th | 5 |\n * | | | ss | 00, 01, ..., 59 | |\n * | Fraction of second | 40 | S | 0, 1, ..., 9 | |\n * | | | SS | 00, 01, ..., 99 | |\n * | | | SSS | 000, 0001, ..., 999 | |\n * | | | SSSS | ... | 2 |\n * | Timezone (ISO-8601 w/ Z) | 20 | X | -08, +0530, Z | |\n * | | | XX | -0800, +0530, Z | |\n * | | | XXX | -08:00, +05:30, Z | |\n * | | | XXXX | -0800, +0530, Z, +123456 | 2 |\n * | | | XXXXX | -08:00, +05:30, Z, +12:34:56 | |\n * | Timezone (ISO-8601 w/o Z) | 20 | x | -08, +0530, +00 | |\n * | | | xx | -0800, +0530, +0000 | |\n * | | | xxx | -08:00, +05:30, +00:00 | 2 |\n * | | | xxxx | -0800, +0530, +0000, +123456 | |\n * | | | xxxxx | -08:00, +05:30, +00:00, +12:34:56 | |\n * | Seconds timestamp | 10 | t | 512969520 | |\n * | | | tt | ... | 2 |\n * | Milliseconds timestamp | 10 | T | 512969520900 | |\n * | | | TT | ... | 2 |\n * Notes:\n * 1. \"Formatting\" units (e.g. formatting quarter) in the default en-US locale\n * are the same as \"stand-alone\" units, but are different in some languages.\n * \"Formatting\" units are declined according to the rules of the language\n * in the context of a date. \"Stand-alone\" units are always nominative singular.\n * In `format` function, they will produce different result:\n *\n * `format(new Date(2017, 10, 6), 'do LLLL', {locale: cs}) //=> '6. listopad'`\n *\n * `format(new Date(2017, 10, 6), 'do MMMM', {locale: cs}) //=> '6. listopadu'`\n *\n * `parse` will try to match both formatting and stand-alone units interchangably.\n *\n * 2. Any sequence of the identical letters is a pattern, unless it is escaped by\n * the single quote characters (see below).\n * If the sequence is longer than listed in table:\n * - for numerical units (`yyyyyyyy`) `parse` will try to match a number\n * as wide as the sequence\n * - for text units (`MMMMMMMM`) `parse` will try to match the widest variation of the unit.\n * These variations are marked with \"2\" in the last column of the table.\n *\n * 3. `QQQQQ` and `qqqqq` could be not strictly numerical in some locales.\n * These tokens represent the shortest form of the quarter.\n *\n * 4. The main difference between `y` and `u` patterns are B.C. years:\n *\n * | Year | `y` | `u` |\n * |------|-----|-----|\n * | AC 1 | 1 | 1 |\n * | BC 1 | 1 | 0 |\n * | BC 2 | 2 | -1 |\n *\n * Also `yy` will try to guess the century of two digit year by proximity with `baseDate`:\n *\n * `parse('50', 'yy', new Date(2018, 0, 1)) //=> Sat Jan 01 2050 00:00:00`\n *\n * `parse('75', 'yy', new Date(2018, 0, 1)) //=> Wed Jan 01 1975 00:00:00`\n *\n * while `uu` will just assign the year as is:\n *\n * `parse('50', 'uu', new Date(2018, 0, 1)) //=> Sat Jan 01 0050 00:00:00`\n *\n * `parse('75', 'uu', new Date(2018, 0, 1)) //=> Tue Jan 01 0075 00:00:00`\n *\n * The same difference is true for local and ISO week-numbering years (`Y` and `R`),\n * except local week-numbering years are dependent on `options.weekStartsOn`\n * and `options.firstWeekContainsDate` (compare [setISOWeekYear]{@link https://date-fns.org/docs/setISOWeekYear}\n * and [setWeekYear]{@link https://date-fns.org/docs/setWeekYear}).\n *\n * 5. These patterns are not in the Unicode Technical Standard #35:\n * - `i`: ISO day of week\n * - `I`: ISO week of year\n * - `R`: ISO week-numbering year\n * - `o`: ordinal number modifier\n *\n * 6. These tokens are often confused with others. See: https://git.io/fxCyr\n *\n * Values will be assigned to the date in the descending order of its unit's priority.\n * Units of an equal priority overwrite each other in the order of appearance.\n *\n * If no values of higher priority are parsed (e.g. when parsing string 'January 1st' without a year),\n * the values will be taken from 3rd argument `baseDate` which works as a context of parsing.\n *\n * `baseDate` must be passed for correct work of the function.\n * If you're not sure which `baseDate` to supply, create a new instance of Date:\n * `parse('02/11/2014', 'MM/dd/yyyy', new Date())`\n * In this case parsing will be done in the context of the current date.\n * If `baseDate` is `Invalid Date` or a value not convertible to valid `Date`,\n * then `Invalid Date` will be returned.\n *\n * The result may vary by locale.\n *\n * If `formatString` matches with `dateString` but does not provides tokens, `baseDate` will be returned.\n *\n * If parsing failed, `Invalid Date` will be returned.\n * Invalid Date is a Date, whose time value is NaN.\n * Time value of Date: http://es5.github.io/#x15.9.1.1\n *\n * @param {String} dateString - the string to parse\n * @param {String} formatString - the string of tokens\n * @param {Date|String|Number} baseDate - defines values missing from the parsed dateString\n * @param {Options} [options] - the object with options. See [Options]{@link https://date-fns.org/docs/Options}\n * @param {0|1|2} [options.additionalDigits=2] - passed to `toDate`. See [toDate]{@link https://date-fns.org/docs/toDate}\n * @param {Locale} [options.locale=defaultLocale] - the locale object. See [Locale]{@link https://date-fns.org/docs/Locale}\n * @param {0|1|2|3|4|5|6} [options.weekStartsOn=0] - the index of the first day of the week (0 - Sunday)\n * @param {1|2|3|4|5|6|7} [options.firstWeekContainsDate=1] - the day of January, which is always in the first week of the year\n * @param {Boolean} [options.awareOfUnicodeTokens=false] - if true, allows usage of Unicode tokens causes confusion:\n * - Some of the day of year tokens (`D`, `DD`) that are confused with the day of month tokens (`d`, `dd`).\n * - Some of the local week-numbering year tokens (`YY`, `YYYY`) that are confused with the calendar year tokens (`yy`, `yyyy`).\n * See: https://git.io/fxCyr\n * @returns {Date} the parsed date\n * @throws {TypeError} 3 arguments required\n * @throws {RangeError} `options.additionalDigits` must be 0, 1 or 2\n * @throws {RangeError} `options.weekStartsOn` must be between 0 and 6\n * @throws {RangeError} `options.firstWeekContainsDate` must be between 1 and 7\n * @throws {RangeError} `options.locale` must contain `match` property\n * @throws {RangeError} `options.awareOfUnicodeTokens` must be set to `true` to use `XX` token; see: https://git.io/fxCyr\n *\n * @example\n * // Parse 11 February 2014 from middle-endian format:\n * var result = parse(\n * '02/11/2014',\n * 'MM/dd/yyyy',\n * new Date()\n * )\n * //=> Tue Feb 11 2014 00:00:00\n *\n * @example\n * // Parse 28th of February in Esperanto locale in the context of 2010 year:\n * import eo from 'date-fns/locale/eo'\n * var result = parse(\n * '28-a de februaro',\n * \"do 'de' MMMM\",\n * new Date(2010, 0, 1),\n * {locale: eo}\n * )\n * //=> Sun Feb 28 2010 00:00:00\n */\nfunction parse(\n dirtyDateString,\n dirtyFormatString,\n dirtyBaseDate,\n dirtyOptions\n) {\n if (arguments.length < 3) {\n throw new TypeError(\n '3 arguments required, but only ' + arguments.length + ' present'\n )\n }\n\n var dateString = String(dirtyDateString);\n var formatString = String(dirtyFormatString);\n var options = dirtyOptions || {};\n\n var locale = options.locale || locale$1;\n\n if (!locale.match) {\n throw new RangeError('locale must contain match property')\n }\n\n var localeFirstWeekContainsDate =\n locale.options && locale.options.firstWeekContainsDate;\n var defaultFirstWeekContainsDate =\n localeFirstWeekContainsDate == null\n ? 1\n : toInteger(localeFirstWeekContainsDate);\n var firstWeekContainsDate =\n options.firstWeekContainsDate == null\n ? defaultFirstWeekContainsDate\n : toInteger(options.firstWeekContainsDate);\n\n // Test if weekStartsOn is between 1 and 7 _and_ is not NaN\n if (!(firstWeekContainsDate >= 1 && firstWeekContainsDate <= 7)) {\n throw new RangeError(\n 'firstWeekContainsDate must be between 1 and 7 inclusively'\n )\n }\n\n var localeWeekStartsOn = locale.options && locale.options.weekStartsOn;\n var defaultWeekStartsOn =\n localeWeekStartsOn == null ? 0 : toInteger(localeWeekStartsOn);\n var weekStartsOn =\n options.weekStartsOn == null\n ? defaultWeekStartsOn\n : toInteger(options.weekStartsOn);\n\n // Test if weekStartsOn is between 0 and 6 _and_ is not NaN\n if (!(weekStartsOn >= 0 && weekStartsOn <= 6)) {\n throw new RangeError('weekStartsOn must be between 0 and 6 inclusively')\n }\n\n if (formatString === '') {\n if (dateString === '') {\n return toDate(dirtyBaseDate, options)\n } else {\n return new Date(NaN)\n }\n }\n\n var subFnOptions = {\n firstWeekContainsDate: firstWeekContainsDate,\n weekStartsOn: weekStartsOn,\n locale: locale\n };\n\n // If timezone isn't specified, it will be set to the system timezone\n var setters = [\n {\n priority: TIMEZONE_UNIT_PRIORITY,\n set: dateToSystemTimezone,\n index: 0\n }\n ];\n\n var i;\n\n var tokens = formatString.match(formattingTokensRegExp$1);\n\n for (i = 0; i < tokens.length; i++) {\n var token = tokens[i];\n\n if (!options.awareOfUnicodeTokens && isProtectedToken(token)) {\n throwProtectedError(token);\n }\n\n var firstCharacter = token[0];\n var parser = parsers[firstCharacter];\n if (parser) {\n var parseResult = parser.parse(\n dateString,\n token,\n locale.match,\n subFnOptions\n );\n\n if (!parseResult) {\n return new Date(NaN)\n }\n\n setters.push({\n priority: parser.priority,\n set: parser.set,\n validate: parser.validate,\n value: parseResult.value,\n index: setters.length\n });\n\n dateString = parseResult.rest;\n } else {\n // Replace two single quote characters with one single quote character\n if (token === \"''\") {\n token = \"'\";\n } else if (firstCharacter === \"'\") {\n token = cleanEscapedString$1(token);\n }\n\n // Cut token from string, or, if string doesn't match the token, return Invalid Date\n if (dateString.indexOf(token) === 0) {\n dateString = dateString.slice(token.length);\n } else {\n return new Date(NaN)\n }\n }\n }\n\n // Check if the remaining input contains something other than whitespace\n if (dateString.length > 0 && notWhitespaceRegExp.test(dateString)) {\n return new Date(NaN)\n }\n\n var uniquePrioritySetters = setters\n .map(function(setter) {\n return setter.priority\n })\n .sort(function(a, b) {\n return b - a\n })\n .filter(function(priority, index, array) {\n return array.indexOf(priority) === index\n })\n .map(function(priority) {\n return setters\n .filter(function(setter) {\n return setter.priority === priority\n })\n .reverse()\n })\n .map(function(setterArray) {\n return setterArray[0]\n });\n\n var date = toDate(dirtyBaseDate, options);\n\n if (isNaN(date)) {\n return new Date(NaN)\n }\n\n // Convert the date in system timezone to the same date in UTC+00:00 timezone.\n // This ensures that when UTC functions will be implemented, locales will be compatible with them.\n // See an issue about UTC functions: https://github.com/date-fns/date-fns/issues/37\n var utcDate = subMilliseconds(date, getTimezoneOffsetInMilliseconds(date));\n\n for (i = 0; i < uniquePrioritySetters.length; i++) {\n var setter = uniquePrioritySetters[i];\n\n if (\n setter.validate &&\n !setter.validate(utcDate, setter.value, subFnOptions)\n ) {\n return new Date(NaN)\n }\n\n utcDate = setter.set(utcDate, setter.value, subFnOptions);\n }\n\n return utcDate\n}\n\nfunction dateToSystemTimezone(date) {\n var convertedDate = new Date(0);\n convertedDate.setFullYear(\n date.getUTCFullYear(),\n date.getUTCMonth(),\n date.getUTCDate()\n );\n convertedDate.setHours(\n date.getUTCHours(),\n date.getUTCMinutes(),\n date.getUTCSeconds(),\n date.getUTCMilliseconds()\n );\n return convertedDate\n}\n\nfunction cleanEscapedString$1(input) {\n return input.match(escapedStringRegExp$1)[1].replace(doubleQuoteRegExp$1, \"'\")\n}\n\n// \n\n/**\n * Custom parse behavior on top of date-fns parse function.\n */\nfunction parseDate$1 (date, format$1) {\n if (typeof date !== 'string') {\n return isValid(date) ? date : null;\n }\n\n var parsed = parse(date, format$1, new Date());\n\n // if date is not valid or the formatted output after parsing does not match\n // the string value passed in (avoids overflows)\n if (!isValid(parsed) || format(parsed, format$1) !== date) {\n return null;\n }\n\n return parsed;\n}\n\nvar afterValidator = function (value, ref) {\n if ( ref === void 0 ) ref = {};\n var targetValue = ref.targetValue;\n var inclusion = ref.inclusion; if ( inclusion === void 0 ) inclusion = false;\n var format = ref.format;\n\n if (typeof format === 'undefined') {\n format = inclusion;\n inclusion = false;\n }\n\n value = parseDate$1(value, format);\n targetValue = parseDate$1(targetValue, format);\n\n // if either is not valid.\n if (!value || !targetValue) {\n return false;\n }\n\n return isAfter(value, targetValue) || (inclusion && isEqual$1(value, targetValue));\n};\n\nvar options = {\n hasTarget: true,\n isDate: true\n};\n\n// required to convert from a list of array values to an object.\nvar paramNames = ['targetValue', 'inclusion', 'format'];\n\nvar after = {\n validate: afterValidator,\n options: options,\n paramNames: paramNames\n};\n\n/**\n * Some Alpha Regex helpers.\n * https://github.com/chriso/validator.js/blob/master/src/lib/alpha.js\n */\n\nvar alpha = {\n en: /^[A-Z]*$/i,\n cs: /^[A-ZÁČĎÉĚÍŇÓŘŠŤÚŮÝŽ]*$/i,\n da: /^[A-ZÆØÅ]*$/i,\n de: /^[A-ZÄÖÜß]*$/i,\n es: /^[A-ZÁÉÍÑÓÚÜ]*$/i,\n fa: /^[ءآأؤإئابةتثجحخدذرزسشصضطظعغفقكلمنهوىيًٌٍَُِّْٰپژگچکی]*$/,\n fr: /^[A-ZÀÂÆÇÉÈÊËÏÎÔŒÙÛÜŸ]*$/i,\n it: /^[A-Z\\xC0-\\xFF]*$/i,\n lt: /^[A-ZĄČĘĖĮŠŲŪŽ]*$/i,\n nl: /^[A-ZÉËÏÓÖÜ]*$/i,\n hu: /^[A-ZÁÉÍÓÖŐÚÜŰ]*$/i,\n pl: /^[A-ZĄĆĘŚŁŃÓŻŹ]*$/i,\n pt: /^[A-ZÃÁÀÂÇÉÊÍÕÓÔÚÜ]*$/i,\n ru: /^[А-ЯЁ]*$/i,\n sk: /^[A-ZÁÄČĎÉÍĹĽŇÓŔŠŤÚÝŽ]*$/i,\n sr: /^[A-ZČĆŽŠĐ]*$/i,\n sv: /^[A-ZÅÄÖ]*$/i,\n tr: /^[A-ZÇĞİıÖŞÜ]*$/i,\n uk: /^[А-ЩЬЮЯЄІЇҐ]*$/i,\n ar: /^[ءآأؤإئابةتثجحخدذرزسشصضطظعغفقكلمنهوىيًٌٍَُِّْٰ]*$/,\n az: /^[A-ZÇƏĞİıÖŞÜ]*$/i\n};\n\nvar alphaSpaces = {\n en: /^[A-Z\\s]*$/i,\n cs: /^[A-ZÁČĎÉĚÍŇÓŘŠŤÚŮÝŽ\\s]*$/i,\n da: /^[A-ZÆØÅ\\s]*$/i,\n de: /^[A-ZÄÖÜß\\s]*$/i,\n es: /^[A-ZÁÉÍÑÓÚÜ\\s]*$/i,\n fa: /^[ءآأؤإئابةتثجحخدذرزسشصضطظعغفقكلمنهوىيًٌٍَُِّْٰپژگچکی\\s]*$/,\n fr: /^[A-ZÀÂÆÇÉÈÊËÏÎÔŒÙÛÜŸ\\s]*$/i,\n it: /^[A-Z\\xC0-\\xFF\\s]*$/i,\n lt: /^[A-ZĄČĘĖĮŠŲŪŽ\\s]*$/i,\n nl: /^[A-ZÉËÏÓÖÜ\\s]*$/i,\n hu: /^[A-ZÁÉÍÓÖŐÚÜŰ\\s]*$/i,\n pl: /^[A-ZĄĆĘŚŁŃÓŻŹ\\s]*$/i,\n pt: /^[A-ZÃÁÀÂÇÉÊÍÕÓÔÚÜ\\s]*$/i,\n ru: /^[А-ЯЁ\\s]*$/i,\n sk: /^[A-ZÁÄČĎÉÍĹĽŇÓŔŠŤÚÝŽ\\s]*$/i,\n sr: /^[A-ZČĆŽŠĐ\\s]*$/i,\n sv: /^[A-ZÅÄÖ\\s]*$/i,\n tr: /^[A-ZÇĞİıÖŞÜ\\s]*$/i,\n uk: /^[А-ЩЬЮЯЄІЇҐ\\s]*$/i,\n ar: /^[ءآأؤإئابةتثجحخدذرزسشصضطظعغفقكلمنهوىيًٌٍَُِّْٰ\\s]*$/,\n az: /^[A-ZÇƏĞİıÖŞÜ\\s]*$/i\n};\n\nvar alphanumeric = {\n en: /^[0-9A-Z]*$/i,\n cs: /^[0-9A-ZÁČĎÉĚÍŇÓŘŠŤÚŮÝŽ]*$/i,\n da: /^[0-9A-ZÆØÅ]$/i,\n de: /^[0-9A-ZÄÖÜß]*$/i,\n es: /^[0-9A-ZÁÉÍÑÓÚÜ]*$/i,\n fa: /^[٠١٢٣٤٥٦٧٨٩0-9ءآأؤإئابةتثجحخدذرزسشصضطظعغفقكلمنهوىيًٌٍَُِّْٰپژگچکی]*$/,\n fr: /^[0-9A-ZÀÂÆÇÉÈÊËÏÎÔŒÙÛÜŸ]*$/i,\n it: /^[0-9A-Z\\xC0-\\xFF]*$/i,\n lt: /^[0-9A-ZĄČĘĖĮŠŲŪŽ]*$/i,\n hu: /^[0-9A-ZÁÉÍÓÖŐÚÜŰ]*$/i,\n nl: /^[0-9A-ZÉËÏÓÖÜ]*$/i,\n pl: /^[0-9A-ZĄĆĘŚŁŃÓŻŹ]*$/i,\n pt: /^[0-9A-ZÃÁÀÂÇÉÊÍÕÓÔÚÜ]*$/i,\n ru: /^[0-9А-ЯЁ]*$/i,\n sk: /^[0-9A-ZÁÄČĎÉÍĹĽŇÓŔŠŤÚÝŽ]*$/i,\n sr: /^[0-9A-ZČĆŽŠĐ]*$/i,\n sv: /^[0-9A-ZÅÄÖ]*$/i,\n tr: /^[0-9A-ZÇĞİıÖŞÜ]*$/i,\n uk: /^[0-9А-ЩЬЮЯЄІЇҐ]*$/i,\n ar: /^[٠١٢٣٤٥٦٧٨٩0-9ءآأؤإئابةتثجحخدذرزسشصضطظعغفقكلمنهوىيًٌٍَُِّْٰ]*$/,\n az: /^[0-9A-ZÇƏĞİıÖŞÜ]*$/i\n};\n\nvar alphaDash = {\n en: /^[0-9A-Z_-]*$/i,\n cs: /^[0-9A-ZÁČĎÉĚÍŇÓŘŠŤÚŮÝŽ_-]*$/i,\n da: /^[0-9A-ZÆØÅ_-]*$/i,\n de: /^[0-9A-ZÄÖÜß_-]*$/i,\n es: /^[0-9A-ZÁÉÍÑÓÚÜ_-]*$/i,\n fa: /^[٠١٢٣٤٥٦٧٨٩0-9ءآأؤإئابةتثجحخدذرزسشصضطظعغفقكلمنهوىيًٌٍَُِّْٰپژگچکی_-]*$/,\n fr: /^[0-9A-ZÀÂÆÇÉÈÊËÏÎÔŒÙÛÜŸ_-]*$/i,\n it: /^[0-9A-Z\\xC0-\\xFF_-]*$/i,\n lt: /^[0-9A-ZĄČĘĖĮŠŲŪŽ_-]*$/i,\n nl: /^[0-9A-ZÉËÏÓÖÜ_-]*$/i,\n hu: /^[0-9A-ZÁÉÍÓÖŐÚÜŰ_-]*$/i,\n pl: /^[0-9A-ZĄĆĘŚŁŃÓŻŹ_-]*$/i,\n pt: /^[0-9A-ZÃÁÀÂÇÉÊÍÕÓÔÚÜ_-]*$/i,\n ru: /^[0-9А-ЯЁ_-]*$/i,\n sk: /^[0-9A-ZÁÄČĎÉÍĹĽŇÓŔŠŤÚÝŽ_-]*$/i,\n sr: /^[0-9A-ZČĆŽŠĐ_-]*$/i,\n sv: /^[0-9A-ZÅÄÖ_-]*$/i,\n tr: /^[0-9A-ZÇĞİıÖŞÜ_-]*$/i,\n uk: /^[0-9АЬЮЯЄІЇҐ_-]*$/i,\n ar: /^[٠١٢٣٤٥٦٧٨٩0-9ءآأؤإئابةتثجحخدذرزسشصضطظعغفقكلمنهوىيًٌٍَُِّْٰ_-]*$/,\n az: /^[0-9A-ZÇƏĞİıÖŞÜ_-]*$/i\n};\n\nvar validate = function (value, ref) {\n if ( ref === void 0 ) ref = {};\n var locale = ref.locale;\n\n if (Array.isArray(value)) {\n return value.every(function (val) { return validate(val, [locale]); });\n }\n\n // Match at least one locale.\n if (! locale) {\n return Object.keys(alpha).some(function (loc) { return alpha[loc].test(value); });\n }\n\n return (alpha[locale] || alpha.en).test(value);\n};\n\nvar paramNames$1 = ['locale'];\n\nvar alpha$1 = {\n validate: validate,\n paramNames: paramNames$1\n};\n\nvar validate$1 = function (value, ref) {\n if ( ref === void 0 ) ref = {};\n var locale = ref.locale;\n\n if (Array.isArray(value)) {\n return value.every(function (val) { return validate$1(val, [locale]); });\n }\n\n // Match at least one locale.\n if (! locale) {\n return Object.keys(alphaDash).some(function (loc) { return alphaDash[loc].test(value); });\n }\n\n return (alphaDash[locale] || alphaDash.en).test(value);\n};\n\nvar paramNames$2 = ['locale'];\n\nvar alpha_dash = {\n validate: validate$1,\n paramNames: paramNames$2\n};\n\nvar validate$2 = function (value, ref) {\n if ( ref === void 0 ) ref = {};\n var locale = ref.locale;\n\n if (Array.isArray(value)) {\n return value.every(function (val) { return validate$2(val, [locale]); });\n }\n\n // Match at least one locale.\n if (! locale) {\n return Object.keys(alphanumeric).some(function (loc) { return alphanumeric[loc].test(value); });\n }\n\n return (alphanumeric[locale] || alphanumeric.en).test(value);\n};\n\nvar paramNames$3 = ['locale'];\n\nvar alpha_num = {\n validate: validate$2,\n paramNames: paramNames$3\n};\n\nvar validate$3 = function (value, ref) {\n if ( ref === void 0 ) ref = {};\n var locale = ref.locale;\n\n if (Array.isArray(value)) {\n return value.every(function (val) { return validate$3(val, [locale]); });\n }\n\n // Match at least one locale.\n if (! locale) {\n return Object.keys(alphaSpaces).some(function (loc) { return alphaSpaces[loc].test(value); });\n }\n\n return (alphaSpaces[locale] || alphaSpaces.en).test(value);\n};\n\nvar paramNames$4 = ['locale'];\n\nvar alpha_spaces = {\n validate: validate$3,\n paramNames: paramNames$4\n};\n\nvar validate$4 = function (value, ref) {\n if ( ref === void 0 ) ref = {};\n var targetValue = ref.targetValue;\n var inclusion = ref.inclusion; if ( inclusion === void 0 ) inclusion = false;\n var format = ref.format;\n\n if (typeof format === 'undefined') {\n format = inclusion;\n inclusion = false;\n }\n\n value = parseDate$1(value, format);\n targetValue = parseDate$1(targetValue, format);\n\n // if either is not valid.\n if (!value || !targetValue) {\n return false;\n }\n\n return isBefore(value, targetValue) || (inclusion && isEqual$1(value, targetValue));\n};\n\nvar options$1 = {\n hasTarget: true,\n isDate: true\n};\n\nvar paramNames$5 = ['targetValue', 'inclusion', 'format'];\n\nvar before = {\n validate: validate$4,\n options: options$1,\n paramNames: paramNames$5\n};\n\nvar validate$5 = function (value, ref) {\n if ( ref === void 0 ) ref = {};\n var min = ref.min;\n var max = ref.max;\n\n if (Array.isArray(value)) {\n return value.every(function (val) { return validate$5(val, { min: min, max: max }); });\n }\n\n return Number(min) <= value && Number(max) >= value;\n};\n\nvar paramNames$6 = ['min', 'max'];\n\nvar between = {\n validate: validate$5,\n paramNames: paramNames$6\n};\n\nvar validate$6 = function (value, ref) {\n var targetValue = ref.targetValue;\n\n return String(value) === String(targetValue);\n};\nvar options$2 = {\n hasTarget: true\n};\n\nvar paramNames$7 = ['targetValue'];\n\nvar confirmed = {\n validate: validate$6,\n options: options$2,\n paramNames: paramNames$7\n};\n\nfunction unwrapExports (x) {\n\treturn x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;\n}\n\nfunction createCommonjsModule(fn, module) {\n\treturn module = { exports: {} }, fn(module, module.exports), module.exports;\n}\n\nvar assertString_1 = createCommonjsModule(function (module, exports) {\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = assertString;\n\nfunction _typeof(obj) { if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nfunction assertString(input) {\n var isString = typeof input === 'string' || input instanceof String;\n\n if (!isString) {\n var invalidType;\n\n if (input === null) {\n invalidType = 'null';\n } else {\n invalidType = _typeof(input);\n\n if (invalidType === 'object' && input.constructor && input.constructor.hasOwnProperty('name')) {\n invalidType = input.constructor.name;\n } else {\n invalidType = \"a \".concat(invalidType);\n }\n }\n\n throw new TypeError(\"Expected string but received \".concat(invalidType, \".\"));\n }\n}\n\nmodule.exports = exports.default;\nmodule.exports.default = exports.default;\n});\n\nunwrapExports(assertString_1);\n\nvar isCreditCard_1 = createCommonjsModule(function (module, exports) {\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = isCreditCard;\n\nvar _assertString = _interopRequireDefault(assertString_1);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\n/* eslint-disable max-len */\nvar creditCard = /^(?:4[0-9]{12}(?:[0-9]{3})?|5[1-5][0-9]{14}|(222[1-9]|22[3-9][0-9]|2[3-6][0-9]{2}|27[01][0-9]|2720)[0-9]{12}|6(?:011|5[0-9][0-9])[0-9]{12}|3[47][0-9]{13}|3(?:0[0-5]|[68][0-9])[0-9]{11}|(?:2131|1800|35\\d{3})\\d{11}|6[27][0-9]{14})$/;\n/* eslint-enable max-len */\n\nfunction isCreditCard(str) {\n (0, _assertString.default)(str);\n var sanitized = str.replace(/[- ]+/g, '');\n\n if (!creditCard.test(sanitized)) {\n return false;\n }\n\n var sum = 0;\n var digit;\n var tmpNum;\n var shouldDouble;\n\n for (var i = sanitized.length - 1; i >= 0; i--) {\n digit = sanitized.substring(i, i + 1);\n tmpNum = parseInt(digit, 10);\n\n if (shouldDouble) {\n tmpNum *= 2;\n\n if (tmpNum >= 10) {\n sum += tmpNum % 10 + 1;\n } else {\n sum += tmpNum;\n }\n } else {\n sum += tmpNum;\n }\n\n shouldDouble = !shouldDouble;\n }\n\n return !!(sum % 10 === 0 ? sanitized : false);\n}\n\nmodule.exports = exports.default;\nmodule.exports.default = exports.default;\n});\n\nvar isCreditCard = unwrapExports(isCreditCard_1);\n\nvar validate$7 = function (value) { return isCreditCard(String(value)); };\n\nvar credit_card = {\n validate: validate$7\n};\n\nvar validate$8 = function (value, ref) {\n if ( ref === void 0 ) ref = {};\n var min = ref.min;\n var max = ref.max;\n var inclusivity = ref.inclusivity; if ( inclusivity === void 0 ) inclusivity = '()';\n var format = ref.format;\n\n if (typeof format === 'undefined') {\n format = inclusivity;\n inclusivity = '()';\n }\n\n var minDate = parseDate$1(String(min), format);\n var maxDate = parseDate$1(String(max), format);\n var dateVal = parseDate$1(String(value), format);\n\n if (!minDate || !maxDate || !dateVal) {\n return false;\n }\n\n if (inclusivity === '()') {\n return isAfter(dateVal, minDate) && isBefore(dateVal, maxDate);\n }\n\n if (inclusivity === '(]') {\n return isAfter(dateVal, minDate) && (isEqual$1(dateVal, maxDate) || isBefore(dateVal, maxDate));\n }\n\n if (inclusivity === '[)') {\n return isBefore(dateVal, maxDate) && (isEqual$1(dateVal, minDate) || isAfter(dateVal, minDate));\n }\n\n return isEqual$1(dateVal, maxDate) || isEqual$1(dateVal, minDate) ||\n (isBefore(dateVal, maxDate) && isAfter(dateVal, minDate));\n};\n\nvar options$3 = {\n isDate: true\n};\n\nvar paramNames$8 = ['min', 'max', 'inclusivity', 'format'];\n\nvar date_between = {\n validate: validate$8,\n options: options$3,\n paramNames: paramNames$8\n};\n\nvar validate$9 = function (value, ref) {\n var format = ref.format;\n\n return !!parseDate$1(value, format);\n};\n\nvar options$4 = {\n isDate: true\n};\n\nvar paramNames$9 = ['format'];\n\nvar date_format = {\n validate: validate$9,\n options: options$4,\n paramNames: paramNames$9\n};\n\nvar validate$a = function (value, ref) {\n if ( ref === void 0 ) ref = {};\n var decimals = ref.decimals; if ( decimals === void 0 ) decimals = '*';\n var separator = ref.separator; if ( separator === void 0 ) separator = '.';\n\n if (isNullOrUndefined(value) || value === '') {\n return false;\n }\n\n if (Array.isArray(value)) {\n return value.every(function (val) { return validate$a(val, { decimals: decimals, separator: separator }); });\n }\n\n // if is 0.\n if (Number(decimals) === 0) {\n return /^-?\\d*$/.test(value);\n }\n\n var regexPart = decimals === '*' ? '+' : (\"{1,\" + decimals + \"}\");\n var regex = new RegExp((\"^[-+]?\\\\d*(\\\\\" + separator + \"\\\\d\" + regexPart + \")?([eE]{1}[-]?\\\\d+)?$\"));\n\n if (! regex.test(value)) {\n return false;\n }\n\n var parsedValue = parseFloat(value);\n\n // eslint-disable-next-line\n return parsedValue === parsedValue;\n};\n\nvar paramNames$a = ['decimals', 'separator'];\n\nvar decimal = {\n validate: validate$a,\n paramNames: paramNames$a\n};\n\nvar validate$b = function (value, ref) {\n var length = ref[0];\n\n if (Array.isArray(value)) {\n return value.every(function (val) { return validate$b(val, [length]); });\n }\n var strVal = String(value);\n\n return /^[0-9]*$/.test(strVal) && strVal.length === Number(length);\n};\n\nvar digits = {\n validate: validate$b\n};\n\nvar imageRegex = /\\.(jpg|svg|jpeg|png|bmp|gif)$/i;\n\nvar validateImage = function (file, width, height) {\n var URL = window.URL || window.webkitURL;\n return new Promise(function (resolve) {\n var image = new Image();\n image.onerror = function () { return resolve({ valid: false }); };\n image.onload = function () { return resolve({\n valid: image.width === Number(width) && image.height === Number(height)\n }); };\n\n image.src = URL.createObjectURL(file);\n });\n};\n\nvar validate$c = function (files, ref) {\n var width = ref[0];\n var height = ref[1];\n\n var images = ensureArray(files).filter(function (file) { return imageRegex.test(file.name); });\n if (images.length === 0) {\n return false;\n }\n return Promise.all(images.map(function (image) { return validateImage(image, width, height); }));\n};\n\nvar dimensions = {\n validate: validate$c\n};\n\nvar merge_1 = createCommonjsModule(function (module, exports) {\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = merge;\n\nfunction merge() {\n var obj = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n var defaults = arguments.length > 1 ? arguments[1] : undefined;\n\n for (var key in defaults) {\n if (typeof obj[key] === 'undefined') {\n obj[key] = defaults[key];\n }\n }\n\n return obj;\n}\n\nmodule.exports = exports.default;\nmodule.exports.default = exports.default;\n});\n\nunwrapExports(merge_1);\n\nvar isByteLength_1 = createCommonjsModule(function (module, exports) {\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = isByteLength;\n\nvar _assertString = _interopRequireDefault(assertString_1);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction _typeof(obj) { if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\n/* eslint-disable prefer-rest-params */\nfunction isByteLength(str, options) {\n (0, _assertString.default)(str);\n var min;\n var max;\n\n if (_typeof(options) === 'object') {\n min = options.min || 0;\n max = options.max;\n } else {\n // backwards compatibility: isByteLength(str, min [, max])\n min = arguments[1];\n max = arguments[2];\n }\n\n var len = encodeURI(str).split(/%..|./).length - 1;\n return len >= min && (typeof max === 'undefined' || len <= max);\n}\n\nmodule.exports = exports.default;\nmodule.exports.default = exports.default;\n});\n\nunwrapExports(isByteLength_1);\n\nvar isFQDN_1 = createCommonjsModule(function (module, exports) {\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = isFQDN;\n\nvar _assertString = _interopRequireDefault(assertString_1);\n\nvar _merge = _interopRequireDefault(merge_1);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nvar default_fqdn_options = {\n require_tld: true,\n allow_underscores: false,\n allow_trailing_dot: false\n};\n\nfunction isFQDN(str, options) {\n (0, _assertString.default)(str);\n options = (0, _merge.default)(options, default_fqdn_options);\n /* Remove the optional trailing dot before checking validity */\n\n if (options.allow_trailing_dot && str[str.length - 1] === '.') {\n str = str.substring(0, str.length - 1);\n }\n\n var parts = str.split('.');\n\n for (var i = 0; i < parts.length; i++) {\n if (parts[i].length > 63) {\n return false;\n }\n }\n\n if (options.require_tld) {\n var tld = parts.pop();\n\n if (!parts.length || !/^([a-z\\u00a1-\\uffff]{2,}|xn[a-z0-9-]{2,})$/i.test(tld)) {\n return false;\n } // disallow spaces\n\n\n if (/[\\s\\u2002-\\u200B\\u202F\\u205F\\u3000\\uFEFF\\uDB40\\uDC20]/.test(tld)) {\n return false;\n }\n }\n\n for (var part, _i = 0; _i < parts.length; _i++) {\n part = parts[_i];\n\n if (options.allow_underscores) {\n part = part.replace(/_/g, '');\n }\n\n if (!/^[a-z\\u00a1-\\uffff0-9-]+$/i.test(part)) {\n return false;\n } // disallow full-width chars\n\n\n if (/[\\uff01-\\uff5e]/.test(part)) {\n return false;\n }\n\n if (part[0] === '-' || part[part.length - 1] === '-') {\n return false;\n }\n }\n\n return true;\n}\n\nmodule.exports = exports.default;\nmodule.exports.default = exports.default;\n});\n\nvar isFQDN = unwrapExports(isFQDN_1);\n\nvar isIP_1 = createCommonjsModule(function (module, exports) {\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = isIP;\n\nvar _assertString = _interopRequireDefault(assertString_1);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nvar ipv4Maybe = /^(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})$/;\nvar ipv6Block = /^[0-9A-F]{1,4}$/i;\n\nfunction isIP(str) {\n var version = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';\n (0, _assertString.default)(str);\n version = String(version);\n\n if (!version) {\n return isIP(str, 4) || isIP(str, 6);\n } else if (version === '4') {\n if (!ipv4Maybe.test(str)) {\n return false;\n }\n\n var parts = str.split('.').sort(function (a, b) {\n return a - b;\n });\n return parts[3] <= 255;\n } else if (version === '6') {\n var blocks = str.split(':');\n var foundOmissionBlock = false; // marker to indicate ::\n // At least some OS accept the last 32 bits of an IPv6 address\n // (i.e. 2 of the blocks) in IPv4 notation, and RFC 3493 says\n // that '::ffff:a.b.c.d' is valid for IPv4-mapped IPv6 addresses,\n // and '::a.b.c.d' is deprecated, but also valid.\n\n var foundIPv4TransitionBlock = isIP(blocks[blocks.length - 1], 4);\n var expectedNumberOfBlocks = foundIPv4TransitionBlock ? 7 : 8;\n\n if (blocks.length > expectedNumberOfBlocks) {\n return false;\n } // initial or final ::\n\n\n if (str === '::') {\n return true;\n } else if (str.substr(0, 2) === '::') {\n blocks.shift();\n blocks.shift();\n foundOmissionBlock = true;\n } else if (str.substr(str.length - 2) === '::') {\n blocks.pop();\n blocks.pop();\n foundOmissionBlock = true;\n }\n\n for (var i = 0; i < blocks.length; ++i) {\n // test for a :: which can not be at the string start/end\n // since those cases have been handled above\n if (blocks[i] === '' && i > 0 && i < blocks.length - 1) {\n if (foundOmissionBlock) {\n return false; // multiple :: in address\n }\n\n foundOmissionBlock = true;\n } else if (foundIPv4TransitionBlock && i === blocks.length - 1) ; else if (!ipv6Block.test(blocks[i])) {\n return false;\n }\n }\n\n if (foundOmissionBlock) {\n return blocks.length >= 1;\n }\n\n return blocks.length === expectedNumberOfBlocks;\n }\n\n return false;\n}\n\nmodule.exports = exports.default;\nmodule.exports.default = exports.default;\n});\n\nvar isIP = unwrapExports(isIP_1);\n\nvar isEmail_1 = createCommonjsModule(function (module, exports) {\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = isEmail;\n\nvar _assertString = _interopRequireDefault(assertString_1);\n\nvar _merge = _interopRequireDefault(merge_1);\n\nvar _isByteLength = _interopRequireDefault(isByteLength_1);\n\nvar _isFQDN = _interopRequireDefault(isFQDN_1);\n\nvar _isIP = _interopRequireDefault(isIP_1);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nvar default_email_options = {\n allow_display_name: false,\n require_display_name: false,\n allow_utf8_local_part: true,\n require_tld: true\n};\n/* eslint-disable max-len */\n\n/* eslint-disable no-control-regex */\n\nvar displayName = /^[a-z\\d!#\\$%&'\\*\\+\\-\\/=\\?\\^_`{\\|}~\\.\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]+[a-z\\d!#\\$%&'\\*\\+\\-\\/=\\?\\^_`{\\|}~\\,\\.\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF\\s]*<(.+)>$/i;\nvar emailUserPart = /^[a-z\\d!#\\$%&'\\*\\+\\-\\/=\\?\\^_`{\\|}~]+$/i;\nvar gmailUserPart = /^[a-z\\d]+$/;\nvar quotedEmailUser = /^([\\s\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x7f\\x21\\x23-\\x5b\\x5d-\\x7e]|(\\\\[\\x01-\\x09\\x0b\\x0c\\x0d-\\x7f]))*$/i;\nvar emailUserUtf8Part = /^[a-z\\d!#\\$%&'\\*\\+\\-\\/=\\?\\^_`{\\|}~\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]+$/i;\nvar quotedEmailUserUtf8 = /^([\\s\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x7f\\x21\\x23-\\x5b\\x5d-\\x7e\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]|(\\\\[\\x01-\\x09\\x0b\\x0c\\x0d-\\x7f\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]))*$/i;\n/* eslint-enable max-len */\n\n/* eslint-enable no-control-regex */\n\nfunction isEmail(str, options) {\n (0, _assertString.default)(str);\n options = (0, _merge.default)(options, default_email_options);\n\n if (options.require_display_name || options.allow_display_name) {\n var display_email = str.match(displayName);\n\n if (display_email) {\n str = display_email[1];\n } else if (options.require_display_name) {\n return false;\n }\n }\n\n var parts = str.split('@');\n var domain = parts.pop();\n var user = parts.join('@');\n var lower_domain = domain.toLowerCase();\n\n if (options.domain_specific_validation && (lower_domain === 'gmail.com' || lower_domain === 'googlemail.com')) {\n /*\n Previously we removed dots for gmail addresses before validating.\n This was removed because it allows `multiple..dots@gmail.com`\n to be reported as valid, but it is not.\n Gmail only normalizes single dots, removing them from here is pointless,\n should be done in normalizeEmail\n */\n user = user.toLowerCase(); // Removing sub-address from username before gmail validation\n\n var username = user.split('+')[0]; // Dots are not included in gmail length restriction\n\n if (!(0, _isByteLength.default)(username.replace('.', ''), {\n min: 6,\n max: 30\n })) {\n return false;\n }\n\n var _user_parts = username.split('.');\n\n for (var i = 0; i < _user_parts.length; i++) {\n if (!gmailUserPart.test(_user_parts[i])) {\n return false;\n }\n }\n }\n\n if (!(0, _isByteLength.default)(user, {\n max: 64\n }) || !(0, _isByteLength.default)(domain, {\n max: 254\n })) {\n return false;\n }\n\n if (!(0, _isFQDN.default)(domain, {\n require_tld: options.require_tld\n })) {\n if (!options.allow_ip_domain) {\n return false;\n }\n\n if (!(0, _isIP.default)(domain)) {\n if (!domain.startsWith('[') || !domain.endsWith(']')) {\n return false;\n }\n\n var noBracketdomain = domain.substr(1, domain.length - 2);\n\n if (noBracketdomain.length === 0 || !(0, _isIP.default)(noBracketdomain)) {\n return false;\n }\n }\n }\n\n if (user[0] === '\"') {\n user = user.slice(1, user.length - 1);\n return options.allow_utf8_local_part ? quotedEmailUserUtf8.test(user) : quotedEmailUser.test(user);\n }\n\n var pattern = options.allow_utf8_local_part ? emailUserUtf8Part : emailUserPart;\n var user_parts = user.split('.');\n\n for (var _i = 0; _i < user_parts.length; _i++) {\n if (!pattern.test(user_parts[_i])) {\n return false;\n }\n }\n\n return true;\n}\n\nmodule.exports = exports.default;\nmodule.exports.default = exports.default;\n});\n\nvar isEmail = unwrapExports(isEmail_1);\n\nfunction objectWithoutProperties (obj, exclude) { var target = {}; for (var k in obj) if (Object.prototype.hasOwnProperty.call(obj, k) && exclude.indexOf(k) === -1) target[k] = obj[k]; return target; }\n\nvar validate$d = function (value, ref) {\n if ( ref === void 0 ) ref = {};\n var multiple = ref.multiple; if ( multiple === void 0 ) multiple = false;\n var rest = objectWithoutProperties( ref, [\"multiple\"] );\n var options = rest;\n\n if (multiple && !Array.isArray(value)) {\n value = String(value).split(',').map(function (emailStr) { return emailStr.trim(); });\n }\n\n var validatorOptions = assign({}, options);\n\n if (Array.isArray(value)) {\n return value.every(function (val) { return isEmail(String(val), validatorOptions); });\n }\n\n return isEmail(String(value), validatorOptions);\n};\n\nvar email = {\n validate: validate$d\n};\n\nvar validate$e = function (value, options) {\n if (Array.isArray(value)) {\n return value.every(function (val) { return validate$e(val, options); });\n }\n\n return toArray(options).some(function (item) {\n // eslint-disable-next-line\n return item == value;\n });\n};\n\nvar included = {\n validate: validate$e\n};\n\nvar validate$f = function () {\n var args = [], len = arguments.length;\n while ( len-- ) args[ len ] = arguments[ len ];\n\n return !validate$e.apply(void 0, args);\n};\n\nvar excluded = {\n validate: validate$f\n};\n\nvar validate$g = function (files, extensions) {\n var regex = new RegExp((\".(\" + (extensions.join('|')) + \")$\"), 'i');\n return ensureArray(files).every(function (file) { return regex.test(file.name); });\n};\n\nvar ext = {\n validate: validate$g\n};\n\nvar validate$h = function (files) { return (Array.isArray(files) ? files : [files]).every(function (file) { return /\\.(jpg|svg|jpeg|png|bmp|gif)$/i.test(file.name); }); };\n\nvar image = {\n validate: validate$h\n};\n\nvar validate$i = function (value) {\n if (Array.isArray(value)) {\n return value.every(function (val) { return /^-?[0-9]+$/.test(String(val)); });\n }\n\n return /^-?[0-9]+$/.test(String(value));\n};\n\nvar integer = {\n validate: validate$i\n};\n\nvar validate$j = function (value, ref) {\n if ( ref === void 0 ) ref = {};\n var version = ref.version; if ( version === void 0 ) version = 4;\n\n if (isNullOrUndefined(value)) {\n value = '';\n }\n\n if (Array.isArray(value)) {\n return value.every(function (val) { return isIP(val, version); });\n }\n\n return isIP(value, version);\n};\n\nvar paramNames$b = ['version'];\n\nvar ip = {\n validate: validate$j,\n paramNames: paramNames$b\n};\n\nvar validate$k = function (value) {\n if (isNullOrUndefined(value)) {\n value = '';\n }\n\n if (Array.isArray(value)) {\n return value.every(function (val) { return (isIP(val, '') || isFQDN(val)); });\n }\n\n return isIP(value, '') || isFQDN(value);\n};\n\nvar ip_or_fqdn = {\n validate: validate$k\n};\n\nvar validate$l = function (value, ref) {\n if ( ref === void 0 ) ref = [];\n var other = ref[0];\n\n return value === other;\n};\n\nvar is = {\n validate: validate$l\n};\n\nvar validate$m = function (value, ref) {\n if ( ref === void 0 ) ref = [];\n var other = ref[0];\n\n return value !== other;\n};\n\nvar is_not = {\n validate: validate$m\n};\n\n/**\n * @param {Array|String} value\n * @param {Number} length\n * @param {Number} max\n */\nvar compare = function (value, length, max) {\n if (max === undefined) {\n return value.length === length;\n }\n\n // cast to number.\n max = Number(max);\n\n return value.length >= length && value.length <= max;\n};\n\nvar validate$n = function (value, ref) {\n var length = ref[0];\n var max = ref[1]; if ( max === void 0 ) max = undefined;\n\n if (isNullOrUndefined(value)) {\n return false;\n }\n\n length = Number(length);\n if (typeof value === 'number') {\n value = String(value);\n }\n\n if (!value.length) {\n value = toArray(value);\n }\n\n return compare(value, length, max);\n};\n\nvar length = {\n validate: validate$n\n};\n\nvar validate$o = function (value, ref) {\n var length = ref[0];\n\n if (isNullOrUndefined(value)) {\n return length >= 0;\n }\n\n if (Array.isArray(value)) {\n return value.every(function (val) { return validate$o(val, [length]); });\n }\n\n return String(value).length <= length;\n};\n\nvar max = {\n validate: validate$o\n};\n\nvar validate$p = function (value, ref) {\n var max = ref[0];\n\n if (isNullOrUndefined(value) || value === '') {\n return false;\n }\n\n if (Array.isArray(value)) {\n return value.length > 0 && value.every(function (val) { return validate$p(val, [max]); });\n }\n\n return Number(value) <= max;\n};\n\nvar max_value = {\n validate: validate$p\n};\n\nvar validate$q = function (files, mimes) {\n var regex = new RegExp(((mimes.join('|').replace('*', '.+')) + \"$\"), 'i');\n return ensureArray(files).every(function (file) { return regex.test(file.type); });\n};\n\nvar mimes = {\n validate: validate$q\n};\n\nvar validate$r = function (value, ref) {\n var length = ref[0];\n\n if (isNullOrUndefined(value)) {\n return false;\n }\n\n if (Array.isArray(value)) {\n return value.every(function (val) { return validate$r(val, [length]); });\n }\n\n return String(value).length >= length;\n};\n\nvar min = {\n validate: validate$r\n};\n\nvar validate$s = function (value, ref) {\n var min = ref[0];\n\n if (isNullOrUndefined(value) || value === '') {\n return false;\n }\n\n if (Array.isArray(value)) {\n return value.length > 0 && value.every(function (val) { return validate$s(val, [min]); });\n }\n\n return Number(value) >= min;\n};\n\nvar min_value = {\n validate: validate$s\n};\n\nvar ar = /^[٠١٢٣٤٥٦٧٨٩]+$/;\nvar en = /^[0-9]+$/;\n\nvar validate$t = function (value) {\n var testValue = function (val) {\n var strValue = String(val);\n\n return en.test(strValue) || ar.test(strValue);\n };\n\n if (Array.isArray(value)) {\n return value.every(testValue);\n }\n\n return testValue(value);\n};\n\nvar numeric = {\n validate: validate$t\n};\n\nvar validate$u = function (value, ref) {\n var expression = ref.expression;\n\n if (typeof expression === 'string') {\n expression = new RegExp(expression);\n }\n\n if (Array.isArray(value)) {\n return value.every(function (val) { return validate$u(val, { expression: expression }); });\n }\n\n return expression.test(String(value));\n};\n\nvar paramNames$c = ['expression'];\n\nvar regex = {\n validate: validate$u,\n paramNames: paramNames$c\n};\n\nvar validate$v = function (value, ref) {\n if ( ref === void 0 ) ref = [];\n var invalidateFalse = ref[0]; if ( invalidateFalse === void 0 ) invalidateFalse = false;\n\n if (isNullOrUndefined(value) || isEmptyArray(value)) {\n return false;\n }\n\n // incase a field considers `false` as an empty value like checkboxes.\n if (value === false && invalidateFalse) {\n return false;\n }\n\n return !!String(value).trim().length;\n};\n\nvar required = {\n validate: validate$v\n};\n\nvar validate$w = function (value, ref) {\n if ( ref === void 0 ) ref = [];\n var otherFieldVal = ref[0];\n var possibleVals = ref.slice(1);\n\n var required = possibleVals.includes(String(otherFieldVal).trim());\n\n if (!required) {\n return {\n valid: true,\n data: {\n required: required\n }\n };\n }\n\n var invalid = (isEmptyArray(value) || [false, null, undefined].includes(value));\n\n invalid = invalid || !String(value).trim().length;\n\n return {\n valid: !invalid,\n data: {\n required: required\n }\n };\n};\n\nvar options$5 = {\n hasTarget: true,\n computesRequired: true\n};\n\nvar required_if = {\n validate: validate$w,\n options: options$5\n};\n\nvar validate$x = function (files, ref) {\n var size = ref[0];\n\n if (isNaN(size)) {\n return false;\n }\n var nSize = Number(size) * 1024;\n return ensureArray(files).every(function (file) { return file.size <= nSize; });\n};\n\nvar size = {\n validate: validate$x\n};\n\nvar isURL_1 = createCommonjsModule(function (module, exports) {\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = isURL;\n\nvar _assertString = _interopRequireDefault(assertString_1);\n\nvar _isFQDN = _interopRequireDefault(isFQDN_1);\n\nvar _isIP = _interopRequireDefault(isIP_1);\n\nvar _merge = _interopRequireDefault(merge_1);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nvar default_url_options = {\n protocols: ['http', 'https', 'ftp'],\n require_tld: true,\n require_protocol: false,\n require_host: true,\n require_valid_protocol: true,\n allow_underscores: false,\n allow_trailing_dot: false,\n allow_protocol_relative_urls: false\n};\nvar wrapped_ipv6 = /^\\[([^\\]]+)\\](?::([0-9]+))?$/;\n\nfunction isRegExp(obj) {\n return Object.prototype.toString.call(obj) === '[object RegExp]';\n}\n\nfunction checkHost(host, matches) {\n for (var i = 0; i < matches.length; i++) {\n var match = matches[i];\n\n if (host === match || isRegExp(match) && match.test(host)) {\n return true;\n }\n }\n\n return false;\n}\n\nfunction isURL(url, options) {\n (0, _assertString.default)(url);\n\n if (!url || url.length >= 2083 || /[\\s<>]/.test(url)) {\n return false;\n }\n\n if (url.indexOf('mailto:') === 0) {\n return false;\n }\n\n options = (0, _merge.default)(options, default_url_options);\n var protocol, auth, host, hostname, port, port_str, split, ipv6;\n split = url.split('#');\n url = split.shift();\n split = url.split('?');\n url = split.shift();\n split = url.split('://');\n\n if (split.length > 1) {\n protocol = split.shift().toLowerCase();\n\n if (options.require_valid_protocol && options.protocols.indexOf(protocol) === -1) {\n return false;\n }\n } else if (options.require_protocol) {\n return false;\n } else if (url.substr(0, 2) === '//') {\n if (!options.allow_protocol_relative_urls) {\n return false;\n }\n\n split[0] = url.substr(2);\n }\n\n url = split.join('://');\n\n if (url === '') {\n return false;\n }\n\n split = url.split('/');\n url = split.shift();\n\n if (url === '' && !options.require_host) {\n return true;\n }\n\n split = url.split('@');\n\n if (split.length > 1) {\n if (options.disallow_auth) {\n return false;\n }\n\n auth = split.shift();\n\n if (auth.indexOf(':') >= 0 && auth.split(':').length > 2) {\n return false;\n }\n }\n\n hostname = split.join('@');\n port_str = null;\n ipv6 = null;\n var ipv6_match = hostname.match(wrapped_ipv6);\n\n if (ipv6_match) {\n host = '';\n ipv6 = ipv6_match[1];\n port_str = ipv6_match[2] || null;\n } else {\n split = hostname.split(':');\n host = split.shift();\n\n if (split.length) {\n port_str = split.join(':');\n }\n }\n\n if (port_str !== null) {\n port = parseInt(port_str, 10);\n\n if (!/^[0-9]+$/.test(port_str) || port <= 0 || port > 65535) {\n return false;\n }\n }\n\n if (!(0, _isIP.default)(host) && !(0, _isFQDN.default)(host, options) && (!ipv6 || !(0, _isIP.default)(ipv6, 6))) {\n return false;\n }\n\n host = host || ipv6;\n\n if (options.host_whitelist && !checkHost(host, options.host_whitelist)) {\n return false;\n }\n\n if (options.host_blacklist && checkHost(host, options.host_blacklist)) {\n return false;\n }\n\n return true;\n}\n\nmodule.exports = exports.default;\nmodule.exports.default = exports.default;\n});\n\nvar isURL = unwrapExports(isURL_1);\n\nvar validate$y = function (value, options) {\n if ( options === void 0 ) options = {};\n\n if (isNullOrUndefined(value)) {\n value = '';\n }\n\n var validatorOptions = assign({}, options);\n\n if (Array.isArray(value)) {\n return value.every(function (val) { return isURL(val, validatorOptions); });\n }\n\n return isURL(value, validatorOptions);\n};\n\nvar url = {\n validate: validate$y\n};\n\n/* eslint-disable camelcase */\n\nvar Rules = /*#__PURE__*/Object.freeze({\n after: after,\n alpha_dash: alpha_dash,\n alpha_num: alpha_num,\n alpha_spaces: alpha_spaces,\n alpha: alpha$1,\n before: before,\n between: between,\n confirmed: confirmed,\n credit_card: credit_card,\n date_between: date_between,\n date_format: date_format,\n decimal: decimal,\n digits: digits,\n dimensions: dimensions,\n email: email,\n ext: ext,\n image: image,\n included: included,\n integer: integer,\n length: length,\n ip: ip,\n ip_or_fqdn: ip_or_fqdn,\n is_not: is_not,\n is: is,\n max: max,\n max_value: max_value,\n mimes: mimes,\n min: min,\n min_value: min_value,\n excluded: excluded,\n numeric: numeric,\n regex: regex,\n required: required,\n required_if: required_if,\n size: size,\n url: url\n});\n\n// \n\nvar normalize = function (fields) {\n if (Array.isArray(fields)) {\n return fields.reduce(function (prev, curr) {\n if (includes(curr, '.')) {\n prev[curr.split('.')[1]] = curr;\n } else {\n prev[curr] = curr;\n }\n\n return prev;\n }, {});\n }\n\n return fields;\n};\n\n// Combines two flags using either AND or OR depending on the flag type.\nvar combine = function (lhs, rhs) {\n var mapper = {\n pristine: function (lhs, rhs) { return lhs && rhs; },\n dirty: function (lhs, rhs) { return lhs || rhs; },\n touched: function (lhs, rhs) { return lhs || rhs; },\n untouched: function (lhs, rhs) { return lhs && rhs; },\n valid: function (lhs, rhs) { return lhs && rhs; },\n invalid: function (lhs, rhs) { return lhs || rhs; },\n pending: function (lhs, rhs) { return lhs || rhs; },\n required: function (lhs, rhs) { return lhs || rhs; },\n validated: function (lhs, rhs) { return lhs && rhs; }\n };\n\n return Object.keys(mapper).reduce(function (flags, flag) {\n flags[flag] = mapper[flag](lhs[flag], rhs[flag]);\n\n return flags;\n }, {});\n};\n\nvar mapScope = function (scope, deep) {\n if ( deep === void 0 ) deep = true;\n\n return Object.keys(scope).reduce(function (flags, field) {\n if (!flags) {\n flags = assign({}, scope[field]);\n return flags;\n }\n\n // scope.\n var isScope = field.indexOf('$') === 0;\n if (deep && isScope) {\n return combine(mapScope(scope[field]), flags);\n } else if (!deep && isScope) {\n return flags;\n }\n\n flags = combine(flags, scope[field]);\n\n return flags;\n }, null);\n};\n\n/**\n * Maps fields to computed functions.\n */\nvar mapFields = function (fields) {\n if (!fields) {\n return function () {\n return mapScope(this.$validator.flags);\n };\n }\n\n var normalized = normalize(fields);\n return Object.keys(normalized).reduce(function (prev, curr) {\n var field = normalized[curr];\n prev[curr] = function mappedField () {\n // if field exists\n if (this.$validator.flags[field]) {\n return this.$validator.flags[field];\n }\n\n // scopeless fields were selected.\n if (normalized[curr] === '*') {\n return mapScope(this.$validator.flags, false);\n }\n\n // if it has a scope defined\n var index = field.indexOf('.');\n if (index <= 0) {\n return {};\n }\n\n var ref = field.split('.');\n var scope = ref[0];\n var name = ref.slice(1);\n\n scope = this.$validator.flags[(\"$\" + scope)];\n name = name.join('.');\n\n // an entire scope was selected: scope.*\n if (name === '*' && scope) {\n return mapScope(scope);\n }\n\n if (scope && scope[name]) {\n return scope[name];\n }\n\n return {};\n };\n\n return prev;\n }, {});\n};\n\nvar $validator = null;\n\nvar PROVIDER_COUNTER = 0;\n\nvar ValidationProvider = {\n $__veeInject: false,\n inject: {\n $_veeObserver: {\n from: '$_veeObserver',\n default: function default$1 () {\n if (!this.$vnode.context.$_veeObserver) {\n this.$vnode.context.$_veeObserver = createObserver();\n }\n\n return this.$vnode.context.$_veeObserver;\n }\n }\n },\n props: {\n vid: {\n type: [String, Number],\n default: function () {\n PROVIDER_COUNTER++;\n\n return (\"_vee_\" + PROVIDER_COUNTER);\n }\n },\n name: {\n type: String,\n default: null\n },\n mode: {\n type: [String, Function],\n default: function () {\n return getConfig().mode;\n }\n },\n events: {\n type: Array,\n validate: function () {\n /* istanbul ignore next */\n if (true) {\n warn('events prop and config will be deprecated in future version please use the interaction modes instead');\n }\n\n return true;\n },\n default: function () {\n var events = getConfig().events;\n if (typeof events === 'string') {\n return events.split('|');\n }\n\n return events;\n }\n },\n rules: {\n type: [Object, String],\n default: null\n },\n immediate: {\n type: Boolean,\n default: false\n },\n persist: {\n type: Boolean,\n default: false\n },\n bails: {\n type: Boolean,\n default: function () { return getConfig().fastExit; }\n },\n debounce: {\n type: Number,\n default: function () { return getConfig().delay || 0; }\n },\n tag: {\n type: String,\n default: 'span'\n },\n slim: {\n type: Boolean,\n default: false\n }\n },\n watch: {\n rules: {\n deep: true,\n handler: function handler (val, oldVal) {\n this._needsValidation = !isEqual(val, oldVal);\n }\n }\n },\n data: function () { return ({\n messages: [],\n value: undefined,\n initialized: false,\n initialValue: undefined,\n flags: createFlags(),\n failedRules: {},\n forceRequired: false,\n isDeactivated: false,\n id: null\n }); },\n computed: {\n isValid: function isValid () {\n return this.flags.valid;\n },\n fieldDeps: function fieldDeps () {\n var this$1 = this;\n\n var rules = normalizeRules(this.rules);\n\n return Object.keys(rules).filter(RuleContainer.isTargetRule).map(function (rule) {\n var depName = rules[rule][0];\n watchCrossFieldDep(this$1, depName);\n\n return depName;\n });\n },\n normalizedEvents: function normalizedEvents () {\n var this$1 = this;\n\n var ref = computeModeSetting(this);\n var on = ref.on;\n\n return normalizeEvents(on || this.events || []).map(function (e) {\n if (e === 'input') {\n return this$1._inputEventName;\n }\n\n return e;\n });\n },\n isRequired: function isRequired () {\n var rules = normalizeRules(this.rules);\n var forceRequired = this.forceRequired;\n\n var isRequired = rules.required || forceRequired;\n this.flags.required = isRequired;\n\n return isRequired;\n },\n classes: function classes () {\n var this$1 = this;\n\n var names = getConfig().classNames;\n return Object.keys(this.flags).reduce(function (classes, flag) {\n var className = (names && names[flag]) || flag;\n if (isNullOrUndefined(this$1.flags[flag])) {\n return classes;\n }\n\n if (className) {\n classes[className] = this$1.flags[flag];\n }\n\n return classes;\n }, {});\n }\n },\n render: function render (h) {\n var this$1 = this;\n\n this.registerField();\n var ctx = createValidationCtx(this);\n\n // Gracefully handle non-existent scoped slots.\n var slot = this.$scopedSlots.default;\n /* istanbul ignore next */\n if (!isCallable(slot)) {\n if (true) {\n warn('ValidationProvider expects a scoped slot. Did you forget to add \"v-slot\" to your slot?');\n }\n\n return h(this.tag, this.$slots.default);\n }\n\n var nodes = slot(ctx);\n // Handle single-root slot.\n extractVNodes(nodes).forEach(function (input) {\n addListeners.call(this$1, input);\n });\n\n return this.slim ? createRenderless(h, nodes) : h(this.tag, nodes);\n },\n beforeDestroy: function beforeDestroy () {\n // cleanup reference.\n this.$_veeObserver.unsubscribe(this);\n },\n activated: function activated () {\n this.$_veeObserver.subscribe(this);\n this.isDeactivated = false;\n },\n deactivated: function deactivated () {\n this.$_veeObserver.unsubscribe(this);\n this.isDeactivated = true;\n },\n methods: {\n setFlags: function setFlags (flags) {\n var this$1 = this;\n\n Object.keys(flags).forEach(function (flag) {\n this$1.flags[flag] = flags[flag];\n });\n },\n syncValue: function syncValue (e) {\n var value = normalizeValue$1(e);\n this.value = value;\n this.flags.changed = this.initialValue !== value;\n },\n reset: function reset () {\n this.messages = [];\n this._pendingValidation = null;\n this.initialValue = this.value;\n var flags = createFlags();\n this.setFlags(flags);\n },\n validate: function validate () {\n var this$1 = this;\n var args = [], len = arguments.length;\n while ( len-- ) args[ len ] = arguments[ len ];\n\n if (args.length > 0) {\n this.syncValue(args[0]);\n }\n\n return this.validateSilent().then(function (result) {\n this$1.applyResult(result);\n\n return result;\n });\n },\n validateSilent: function validateSilent () {\n var this$1 = this;\n\n this.setFlags({ pending: true });\n\n return $validator.verify(this.value, this.rules, {\n name: this.name,\n values: createValuesLookup(this),\n bails: this.bails\n }).then(function (result) {\n this$1.setFlags({ pending: false });\n if (!this$1.isRequired) {\n this$1.setFlags({ valid: result.valid, invalid: !result.valid });\n }\n\n return result;\n });\n },\n applyResult: function applyResult (ref) {\n var errors = ref.errors;\n var failedRules = ref.failedRules;\n\n this.messages = errors;\n this.failedRules = assign({}, failedRules);\n this.setFlags({\n valid: !errors.length,\n changed: this.value !== this.initialValue,\n invalid: !!errors.length,\n validated: true\n });\n },\n registerField: function registerField () {\n if (!$validator) {\n $validator = getValidator() || new Validator(null, { fastExit: getConfig().fastExit });\n }\n\n updateRenderingContextRefs(this);\n }\n }\n};\n\nfunction createValidationCtx (ctx) {\n return {\n errors: ctx.messages,\n flags: ctx.flags,\n classes: ctx.classes,\n valid: ctx.isValid,\n failedRules: ctx.failedRules,\n reset: function () { return ctx.reset(); },\n validate: function () {\n var args = [], len = arguments.length;\n while ( len-- ) args[ len ] = arguments[ len ];\n\n return ctx.validate.apply(ctx, args);\n },\n aria: {\n 'aria-invalid': ctx.flags.invalid ? 'true' : 'false',\n 'aria-required': ctx.isRequired ? 'true' : 'false'\n }\n };\n}\n\nfunction normalizeValue$1 (value) {\n if (isEvent(value)) {\n return value.target.type === 'file' ? toArray(value.target.files) : value.target.value;\n }\n\n return value;\n}\n\n/**\n * Determines if a provider needs to run validation.\n */\nfunction shouldValidate (ctx, model) {\n // when an immediate/initial validation is needed and wasn't done before.\n if (!ctx._ignoreImmediate && ctx.immediate) {\n return true;\n }\n\n // when the value changes for whatever reason.\n if (ctx.value !== model.value) {\n return true;\n }\n\n // when it needs validation due to props/cross-fields changes.\n if (ctx._needsValidation) {\n return true;\n }\n\n // when the initial value is undefined and the field wasn't rendered yet.\n if (!ctx.initialized && model.value === undefined) {\n return true;\n }\n\n return false;\n}\n\nfunction computeModeSetting (ctx) {\n var compute = isCallable(ctx.mode) ? ctx.mode : modes[ctx.mode];\n\n return compute({\n errors: ctx.messages,\n value: ctx.value,\n flags: ctx.flags\n });\n}\n\nfunction onRenderUpdate (model) {\n if (!this.initialized) {\n this.initialValue = model.value;\n }\n\n var validateNow = shouldValidate(this, model);\n this._needsValidation = false;\n this.value = model.value;\n this._ignoreImmediate = true;\n\n if (!validateNow) {\n return;\n }\n\n this.validateSilent().then(this.immediate || this.flags.validated ? this.applyResult : function (x) { return x; });\n}\n\n// Creates the common handlers for a validatable context.\nfunction createCommonHandlers (ctx) {\n var onInput = function (e) {\n ctx.syncValue(e); // track and keep the value updated.\n ctx.setFlags({ dirty: true, pristine: false });\n };\n\n // Blur event listener.\n var onBlur = function () {\n ctx.setFlags({ touched: true, untouched: false });\n };\n\n var onValidate = ctx.$veeHandler;\n var mode = computeModeSetting(ctx);\n\n // Handle debounce changes.\n if (!onValidate || ctx.$veeDebounce !== ctx.debounce) {\n onValidate = debounce(\n function () {\n ctx.$nextTick(function () {\n var pendingPromise = ctx.validateSilent();\n // avoids race conditions between successive validations.\n ctx._pendingValidation = pendingPromise;\n pendingPromise.then(function (result) {\n if (pendingPromise === ctx._pendingValidation) {\n ctx.applyResult(result);\n ctx._pendingValidation = null;\n }\n });\n });\n },\n mode.debounce || ctx.debounce\n );\n\n // Cache the handler so we don't create it each time.\n ctx.$veeHandler = onValidate;\n // cache the debounce value so we detect if it was changed.\n ctx.$veeDebounce = ctx.debounce;\n }\n\n return { onInput: onInput, onBlur: onBlur, onValidate: onValidate };\n}\n\n// Adds all plugin listeners to the vnode.\nfunction addListeners (node) {\n var model = findModel(node);\n // cache the input eventName.\n this._inputEventName = this._inputEventName || getInputEventName(node, model);\n\n onRenderUpdate.call(this, model);\n\n var ref = createCommonHandlers(this);\n var onInput = ref.onInput;\n var onBlur = ref.onBlur;\n var onValidate = ref.onValidate;\n addVNodeListener(node, this._inputEventName, onInput);\n addVNodeListener(node, 'blur', onBlur);\n\n // add the validation listeners.\n this.normalizedEvents.forEach(function (evt) {\n addVNodeListener(node, evt, onValidate);\n });\n\n this.initialized = true;\n}\n\nfunction createValuesLookup (ctx) {\n var providers = ctx.$_veeObserver.refs;\n\n return ctx.fieldDeps.reduce(function (acc, depName) {\n if (!providers[depName]) {\n return acc;\n }\n\n acc[depName] = providers[depName].value;\n\n return acc;\n }, {});\n}\n\nfunction updateRenderingContextRefs (ctx) {\n // IDs should not be nullable.\n if (isNullOrUndefined(ctx.id) && ctx.id === ctx.vid) {\n ctx.id = PROVIDER_COUNTER;\n PROVIDER_COUNTER++;\n }\n\n var id = ctx.id;\n var vid = ctx.vid;\n // Nothing has changed.\n if (ctx.isDeactivated || (id === vid && ctx.$_veeObserver.refs[id])) {\n return;\n }\n\n // vid was changed.\n if (id !== vid && ctx.$_veeObserver.refs[id] === ctx) {\n ctx.$_veeObserver.unsubscribe({ vid: id });\n }\n\n ctx.$_veeObserver.subscribe(ctx);\n ctx.id = vid;\n}\n\nfunction createObserver () {\n return {\n refs: {},\n subscribe: function subscribe (ctx) {\n this.refs[ctx.vid] = ctx;\n },\n unsubscribe: function unsubscribe (ctx) {\n delete this.refs[ctx.vid];\n }\n };\n}\n\nfunction watchCrossFieldDep (ctx, depName, withHooks) {\n if ( withHooks === void 0 ) withHooks = true;\n\n var providers = ctx.$_veeObserver.refs;\n if (!ctx._veeWatchers) {\n ctx._veeWatchers = {};\n }\n\n if (!providers[depName] && withHooks) {\n return ctx.$once('hook:mounted', function () {\n watchCrossFieldDep(ctx, depName, false);\n });\n }\n\n if (!isCallable(ctx._veeWatchers[depName]) && providers[depName]) {\n ctx._veeWatchers[depName] = providers[depName].$watch('value', function () {\n if (ctx.flags.validated) {\n ctx._needsValidation = true;\n ctx.validate();\n }\n });\n }\n}\n\nvar flagMergingStrategy = {\n pristine: 'every',\n dirty: 'some',\n touched: 'some',\n untouched: 'every',\n valid: 'every',\n invalid: 'some',\n pending: 'some',\n validated: 'every'\n};\n\nfunction mergeFlags (lhs, rhs, strategy) {\n var stratName = flagMergingStrategy[strategy];\n\n return [lhs, rhs][stratName](function (f) { return f; });\n}\n\nvar OBSERVER_COUNTER = 0;\n\nvar ValidationObserver = {\n name: 'ValidationObserver',\n provide: function provide () {\n return {\n $_veeObserver: this\n };\n },\n inject: {\n $_veeObserver: {\n from: '$_veeObserver',\n default: function default$1 () {\n if (!this.$vnode.context.$_veeObserver) {\n return null;\n }\n\n return this.$vnode.context.$_veeObserver;\n }\n }\n },\n props: {\n tag: {\n type: String,\n default: 'span'\n },\n slim: {\n type: Boolean,\n default: false\n }\n },\n data: function () { return ({\n vid: (\"obs_\" + (OBSERVER_COUNTER++)),\n refs: {},\n observers: [],\n persistedStore: {}\n }); },\n computed: {\n ctx: function ctx () {\n var this$1 = this;\n\n var ctx = {\n errors: {},\n validate: function (arg) {\n var promise = this$1.validate(arg);\n\n return {\n then: function then (thenable) {\n return promise.then(function (success) {\n if (success && isCallable(thenable)) {\n return Promise.resolve(thenable());\n }\n\n return Promise.resolve(success);\n });\n }\n };\n },\n reset: function () { return this$1.reset(); }\n };\n\n return values(this.refs).concat( Object.keys(this.persistedStore).map(function (key) {\n return {\n vid: key,\n flags: this$1.persistedStore[key].flags,\n messages: this$1.persistedStore[key].errors\n };\n }),\n this.observers ).reduce(function (acc, provider) {\n Object.keys(flagMergingStrategy).forEach(function (flag) {\n var flags = provider.flags || provider.ctx;\n if (!(flag in acc)) {\n acc[flag] = flags[flag];\n return;\n }\n\n acc[flag] = mergeFlags(acc[flag], flags[flag], flag);\n });\n\n acc.errors[provider.vid] = provider.messages || values(provider.ctx.errors).reduce(function (errs, obsErrors) {\n return errs.concat(obsErrors);\n }, []);\n\n return acc;\n }, ctx);\n }\n },\n created: function created () {\n if (this.$_veeObserver) {\n this.$_veeObserver.subscribe(this, 'observer');\n }\n },\n activated: function activated () {\n if (this.$_veeObserver) {\n this.$_veeObserver.subscribe(this, 'observer');\n }\n },\n deactivated: function deactivated () {\n if (this.$_veeObserver) {\n this.$_veeObserver.unsubscribe(this, 'observer');\n }\n },\n beforeDestroy: function beforeDestroy () {\n if (this.$_veeObserver) {\n this.$_veeObserver.unsubscribe(this, 'observer');\n }\n },\n render: function render (h) {\n var slots = this.$slots.default || this.$scopedSlots.default || [];\n if (isCallable(slots)) {\n slots = slots(this.ctx);\n }\n\n return this.slim ? createRenderless(h, slots) : h(this.tag, { on: this.$listeners, attrs: this.$attrs }, slots);\n },\n methods: {\n subscribe: function subscribe (subscriber, kind) {\n var obj;\n\n if ( kind === void 0 ) kind = 'provider';\n if (kind === 'observer') {\n this.observers.push(subscriber);\n return;\n }\n\n this.refs = Object.assign({}, this.refs, ( obj = {}, obj[subscriber.vid] = subscriber, obj ));\n if (subscriber.persist && this.persistedStore[subscriber.vid]) {\n this.restoreProviderState(subscriber);\n }\n },\n unsubscribe: function unsubscribe (ref, kind) {\n var vid = ref.vid;\n if ( kind === void 0 ) kind = 'provider';\n\n if (kind === 'provider') {\n this.removeProvider(vid);\n }\n\n var idx = findIndex(this.observers, function (o) { return o.vid === vid; });\n if (idx !== -1) {\n this.observers.splice(idx, 1);\n }\n },\n validate: function validate (ref) {\n if ( ref === void 0 ) ref = { silent: false };\n var silent = ref.silent;\n\n return Promise.all(values(this.refs).map(function (ref) { return ref[silent ? 'validateSilent' : 'validate']().then(function (r) { return r.valid; }); }).concat( this.observers.map(function (obs) { return obs.validate({ silent: silent }); })\n )).then(function (results) { return results.every(function (r) { return r; }); });\n },\n reset: function reset () {\n var this$1 = this;\n\n Object.keys(this.persistedStore).forEach(function (key) {\n this$1.$delete(this$1.persistedStore, key);\n });\n return values(this.refs).concat( this.observers).forEach(function (ref) { return ref.reset(); });\n },\n restoreProviderState: function restoreProviderState (provider) {\n var state = this.persistedStore[provider.vid];\n provider.setFlags(state.flags);\n provider.applyResult(state);\n this.$delete(this.persistedStore, provider.vid);\n },\n removeProvider: function removeProvider (vid) {\n var obj;\n\n var provider = this.refs[vid];\n // save it for the next time.\n if (provider && provider.persist) {\n /* istanbul ignore else */\n if (true) {\n if (vid.indexOf('_vee_') === 0) {\n warn('Please provide a `vid` prop when using `persist`, there might be unexpected issues otherwise.');\n }\n }\n\n this.persistedStore = assign({}, this.persistedStore, ( obj = {}, obj[vid] = {\n flags: provider.flags,\n errors: provider.messages,\n failedRules: provider.failedRules\n }, obj ));\n }\n\n this.$delete(this.refs, vid);\n },\n }\n};\n\nfunction withValidation (component, ctxToProps) {\n if ( ctxToProps === void 0 ) ctxToProps = null;\n\n var options = isCallable(component) ? component.options : component;\n options.$__veeInject = false;\n var hoc = {\n name: ((options.name || 'AnonymousHoc') + \"WithValidation\"),\n props: assign({}, ValidationProvider.props),\n data: ValidationProvider.data,\n computed: assign({}, ValidationProvider.computed),\n methods: assign({}, ValidationProvider.methods),\n $__veeInject: false,\n beforeDestroy: ValidationProvider.beforeDestroy,\n inject: ValidationProvider.inject\n };\n\n // Default ctx converts ctx props to component props.\n if (!ctxToProps) {\n ctxToProps = function (ctx) { return ctx; };\n }\n\n var eventName = (options.model && options.model.event) || 'input';\n\n hoc.render = function (h) {\n var obj;\n\n this.registerField();\n var vctx = createValidationCtx(this);\n var listeners = assign({}, this.$listeners);\n\n var model = findModel(this.$vnode);\n this._inputEventName = this._inputEventName || getInputEventName(this.$vnode, model);\n onRenderUpdate.call(this, model);\n\n var ref = createCommonHandlers(this);\n var onInput = ref.onInput;\n var onBlur = ref.onBlur;\n var onValidate = ref.onValidate;\n\n mergeVNodeListeners(listeners, eventName, onInput);\n mergeVNodeListeners(listeners, 'blur', onBlur);\n this.normalizedEvents.forEach(function (evt, idx) {\n mergeVNodeListeners(listeners, evt, onValidate);\n });\n\n // Props are any attrs not associated with ValidationProvider Plus the model prop.\n // WARNING: Accidental prop overwrite will probably happen.\n var ref$1 = findModelConfig(this.$vnode) || { prop: 'value' };\n var prop = ref$1.prop;\n var props = assign({}, this.$attrs, ( obj = {}, obj[prop] = model.value, obj ), ctxToProps(vctx));\n\n return h(options, {\n attrs: this.$attrs,\n props: props,\n on: listeners\n }, normalizeSlots(this.$slots, this.$vnode.context));\n };\n\n return hoc;\n}\n\nvar version = '2.2.15';\n\nObject.keys(Rules).forEach(function (rule) {\n Validator.extend(rule, Rules[rule].validate, assign({}, Rules[rule].options, { paramNames: Rules[rule].paramNames }));\n});\n\n// Merge the english messages.\nValidator.localize({ en: locale });\n\nvar install = VeeValidate$1.install;\n\nVeeValidate$1.version = version;\nVeeValidate$1.mapFields = mapFields;\nVeeValidate$1.ValidationProvider = ValidationProvider;\nVeeValidate$1.ValidationObserver = ValidationObserver;\nVeeValidate$1.withValidation = withValidation;\n\n/* harmony default export */ __webpack_exports__[\"default\"] = (VeeValidate$1);\n\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvdmVlLXZhbGlkYXRlL2Rpc3QvdmVlLXZhbGlkYXRlLmVzbS5qcz83YmIxIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBO0FBQUE7QUFBQTtBQUFBO0FBQUE7QUFBQTtBQUFBO0FBQUE7QUFBQTtBQUFBO0FBQUE7QUFBQTtBQUFBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7O0FBRUE7QUFDQTtBQUNBOztBQUVBO0FBQ0E7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7QUFDQSw0Q0FBNEMsNkNBQTZDOztBQUV6RjtBQUNBO0FBQ0E7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7O0FBRUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBOztBQUVBO0FBQ0E7QUFDQSxHQUFHO0FBQ0g7O0FBRUE7QUFDQTtBQUNBO0FBQ0EsK0JBQStCO0FBQy9CO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQ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HwgRGF5IG9mIHdlZWsgaW4gbW9udGggICAgICAgICAgIHxcbiAqIHwgIGcqIHwgTW9kaWZpZWQgSnVsaWFuIGRheSAgICAgICAgICAgIHwgIEcgIHwgRXJhICAgICAgICAgICAgICAgICAgICAgICAgICAgIHxcbiAqIHwgIGggIHwgSG91ciBbMS0xMl0gICAgICAgICAgICAgICAgICAgIHwgIEggIHwgSG91ciBbMC0yM10gICAgICAgICAgICAgICAgICAgIHxcbiAqIHwgIGkhIHwgSVNPIGRheSBvZiB3ZWVrICAgICAgICAgICAgICAgIHwgIEkhIHwgSVNPIHdlZWsgb2YgeWVhciAgICAgICAgICAgICAgIHxcbiAqIHwgIGoqIHwgTG9jYWxpemVkIGhvdXIgdy8gZGF5IHBlcmlvZCAgIHwgIEoqIHwgTG9jYWxpemVkIGhvdXIgdy9vIGRheSBwZXJpb2QgIHxcbiAqIHwgIGsgIHwgSG91ciBbMS0yNF0gICAgICAgICAgICAgICAgICAgIHwgIEsgIHwgSG91ciBbMC0xMV0gICAgICAgICAgICAgICAgICAgIHxcbiAqIHwgIGwqIHwgKGRlcHJlY2F0ZWQpICAgICAgICAgICAgICAgICAgIHwgIEwgIHwgU3RhbmQtYWxvbmUgbW9udGggICAgICAgICAgICAgIHxcbiAqIHwgIG0gIHwgTWludXRlICAgICAgICAgICAgICAgICAgICAgICAgIHwgIE0gIHwgTW9udGggICAgICAgICAgICAgICAgICAgICAgICAgIHxcbiAqIHwgIG4gIHwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHwgIE4gIHwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHxcbiAqIHwgIG8hIHwgT3JkaW5hbCBudW1iZXIgbW9kaWZpZXIgICAgICAgIHwgIE8gIHwgVGltZXpvbmUgKEdNVCkgICAgICAgICAgICAgICAgIHxcbiAqIHwgIHAhIHwgTG9uZyBsb2NhbGl6ZWQgdGltZSAgICAgICAgICAgIHwgIFAhIHwgTG9uZyBsb2NhbGl6ZWQgZGF0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0cgICB8IEEsIEIgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB8ICAgICAgIHxcbiAqIHwgQ2FsZW5kYXIgeWVhciAgICAgICAgICAgICAgICAgICB8IHkgICAgICAgfCA0NCwgMSwgMTkwMCwgMjAxNyAgICAgICAgICAgICAgICAgfCA1ICAgICB8XG4gKiB8ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfCB5byAgICAgIHwgNDR0aCwgMXN0LCAwdGgsIDE3dGggICAgICAgICAgICAgIHwgNSw3ICAgfFxuICogfCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHwgeXkgICAgICB8IDQ0LCAwMSwgMDAsIDE3ICAgICAgICAgICAgICAgICAgICB8IDUgICAgIHxcbiAqIHwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB8IHl5eSAgICAgfCAwNDQsIDAwMSwgMTkwMCwgMjAxNyAgICAgICAgICAgICAgfCA1ICAgICB8XG4gKiB8ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfCB5eXl5ICAgIHwgMDA0NCwgMDAwMSwgMTkwMCwgMjAxNyAgICAgICAgICAgIHwgNSAgICAgfFxuICogfCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHwgeXl5eXkgICB8IC4uLiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB8IDMsNSAgIHxcbiAqIHwgTG9jYWwgd2Vlay1udW1iZXJpbmcgeWVhciAgICAgICB8IFkgICAgICAgfCA0NCwgMSwgMTkwMCwgMjAxNyAgICAgICAgICAgICAgICAgfCA1ICAgICB8XG4gKiB8ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfCBZbyAgICAgIHwgNDR0aCwgMXN0LCAxOTAwdGgsIDIwMTd0aCAgICAgICAgIHwgNSw3ICAgfFxuICogfCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHwgWVkgICAgICB8IDQ0LCAwMSwgMDAsIDE3ICAgICAgICAgICAgICAgICAgICB8IDUsOCAgIHxcbiAqIHwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB8IFlZWSAgICAgfCAwNDQsIDAwMSwgMTkwMCwgMjAxNyAgICAgICAgICAgICAgfCA1ICAgICB8XG4gKiB8ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfCBZWVlZICAgIHwgMDA0NCwgMDAwMSwgMTkwMCwgMjAxNyAgICAgICAgICAgIHwgNSw4ICAgfFxuICogfCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHwgWVlZWVkgICB8IC4uLiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB8IDMsNSAgIHxcbiAqIHwgSVNPIHdlZWstbnVtYmVyaW5nIHllYXIgICAgICAgICB8IFIgICAgICAgfCAtNDMsIDAsIDEsIDE5MDAsIDIwMTcgICAgICAgICAgICAgfCA1LDcgICB8XG4gKiB8ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfCBSUiAgICAgIHwgLTQzLCAwMCwgMDEsIDE5MDAsIDIwMTcgICAgICAgICAgIHwgNSw3ICAgfFxuICogfCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHwgUlJSICAgICB8IC0wNDMsIDAwMCwgMDAxLCAxOTAwLCAyMDE3ICAgICAgICB8IDUsNyAgIHxcbiAqIHwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB8IFJSUlIgICAgfCAtMDA0MywgMDAwMCwgMDAwMSwgMTkwMCwgMjAxNyAgICAgfCA1LDcgICB8XG4gKiB8ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfCBSUlJSUiAgIHwgLi4uICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHwgMyw1LDcgfFxuICogfCBFeHRlbmRlZCB5ZWFyICAgICAgICAgICAgICAgICAgIHwgdSAgICAgICB8IC00MywgMCwgMSwgMTkwMCwgMjAxNyAgICAgICAgICAgICB8IDUgICAgIHxcbiAqIHwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB8IHV1ICAgICAgfCAtNDMsIDAxLCAxOTAwLCAyMDE3ICAgICAgICAgICAgICAgfCA1ICAgICB8XG4gKiB8ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfCB1dXUgICAgIHwgLTA0MywgMDAxLCAxOTAwLCAyMDE3ICAgICAgICAgICAgIHwgNSAgICAgfFxuICogfCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHwgdXV1dSAgICB8IC0wMDQzLCAwMDAxLCAxOTAwLCAyMDE3ICAgICAgICAgICB8IDUgICAgIHxcbiAqIHwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB8IHV1dXV1ICAgfCAuLi4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfCAzLDUgICB8XG4gKiB8IFF1YXJ0ZXIgKGZvcm1hdHRpbmcpICAgICAgICAgICAgfCBRICAgICAgIHwgMSwgMiwgMywgNCAgICAgICAgICAgICAgICAgICAgICAgIHwgICAgICAgfFxuICogfCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHwgUW8gICAgICB8IDFzdCwgMm5kLCAzcmQsIDR0aCAgICAgICAgICAgICAgICB8IDcgICAgIHxcbiAqIHwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB8IFFRICAgICAgfCAwMSwgMDIsIDAzLCAwNCAgICAgICAgICAgICAgICAgICAgfCAgICAgICB8XG4gKiB8ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfCBRUVEgICAgIHwgUTEsIFEyLCBRMywgUTQgICAgICAgICAgICAgICAgICAgIHwgICAgICAgfFxuICogfCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHwgUVFRUSAgICB8IDFzdCBxdWFydGVyLCAybmQgcXVhcnRlciwgLi4uICAgICB8IDIgICAgIHxcbiAqIHwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB8IFFRUVFRICAgfCAxLCAyLCAzLCA0ICAgICAgICAgICAgICAgICAgICAgICAgfCA0ICAgICB8XG4gKiB8IFF1YXJ0ZXIgKHN0YW5kLWFsb25lKSAgICAgICAgICAgfCBxICAgICAgIHwgMSwgMiwgMywgNCAgICAgICAgICAgICAgICAgICAgICAgIHwgICAgICAgfFxuICogfCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHwgcW8gICAgICB8IDFzdCwgMm5kLCAzcmQsIDR0aCAgICAgICAgICAgICAgICB8IDcgICAgIHxcbiAqIHwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB8IHFxICAgICAgfCAwMSwgMDIsIDAzLCAwNCAgICAgICAgICAgICAgICAgICAgfCAgICAgICB8XG4gKiB8ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfCBxcXEgICAgIHwgUTEsIFEyLCBRMywgUTQgICAgICAgICAgICAgICAgICAgIHwgICAgICAgfFxuICogfCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHwgcXFxcSAgICB8IDFzdCBxdWFydGVyLCAybmQgcXVhcnRlciwgLi4uICAgICB8IDIgICAgIHxcbiAqIHwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB8IHFxcXFxICAgfCAxLCAyLCAzLCA0ICAgICAgICAgICAgICAgICAgICAgICAgfCA0ICAgICB8XG4gKiB8IE1vbnRoIChmb3JtYXR0aW5nKSAgICAgICAgICAgICAgfCBNICAgICAgIHwgMSwgMiwgLi4uLCAxMiAgICAgICAgICAgICAgICAgICAgIHwgICAgICAgfFxuICogfCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHwgTW8gICAgICB8IDFzdCwgMm5kLCAuLi4sIDEydGggICAgICAgICAgICAgICB8IDcgICAgIHxcbiAqIHwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB8IE1NICAgICAgfCAwMSwgMDIsIC4uLiwgMTIgICAgICAgICAgICAgICAgICAgfCAgICAgICB8XG4gKiB8ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfCBNTU0gICAgIHwgSmFuLCBGZWIsIC4uLiwgRGVjICAgICAgICAgICAgICAgIHwgICAgICAgfFxuICogfCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHwgTU1NTSAgICB8IEphbnVhcnksIEZlYnJ1YXJ5LCAuLi4sIERlY2VtYmVyICB8IDIgICAgIHxcbiAqIHwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB8IE1NTU1NICAgfCBKLCBGLCAuLi4sIEQgICAgICAgICAgICAgICAgICAgICAgfCAgICAgICB8XG4gKiB8IE1vbnRoIChzdGFuZC1hbG9uZSkgICAgICAgICAgICAgfCBMICAgICAgIHwgMSwgMiwgLi4uLCAxMiAgICAgICAgICAgICAgICAgICAgIHwgICAgICAgfFxuICogfCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHwgTG8gICAgICB8IDFzdCwgMm5kLCAuLi4sIDEydGggICAgICAgICAgICAgICB8IDcgICAgIHxcbiAqIHwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB8IExMICAgICAgfCAwMSwgMDIsIC4uLiwgMTIgICAgICAgICAgICAgICAgICAgfCAgICAgICB8XG4gKiB8ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfCBMTEwgICAgIHwgSmFuLCBGZWIsIC4uLiwgRGVjICAgICAgICAgICAgICAgIHwgICAgICAgfFxuICogfCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHwgTExMTCAgICB8IEphbnVhcnksIEZlYnJ1YXJ5LCAuLi4sIERlY2VtYmVyICB8IDIgICAgIHxcbiAqIHwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB8IExMTExMICAgfCBKLCBGLCAuLi4sIEQgICAgICAgICAgICAgICAgICAgICAgfCAgICAgICB8XG4gKiB8IExvY2FsIHdlZWsgb2YgeWVhciAgICAgICAgICAgICAgfCB3ICAgICAgIHwgMSwgMiwgLi4uLCA1MyAgICAgICAgICAgICAgICAgICAgIHwgICAgICAgfFxuICogfCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHwgd28gICAgICB8IDFzdCwgMm5kLCAuLi4sIDUzdGggICAgICAgICAgICAgICB8IDcgICAgIHxcbiAqIHwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB8IHd3ICAgICAgfCAwMSwgMDIsIC4uLiwgNTMgICAgICAgICAgICAgICAgICAgfCAgICAgICB8XG4gKiB8IElTTyB3ZWVrIG9mIHllYXIgICAgICAgICAgICAgICAgfCBJICAgICAgIHwgMSwgMiwgLi4uLCA1MyAgICAgICAgICAgICAgICAgICAgIHwgNyAgICAgfFxuICogfCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHwgSW8gICAgICB8IDFzdCwgMm5kLCAuLi4sIDUzdGggICAgICAgICAgICAgICB8IDcgICAgIHxcbiAqIHwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB8IElJICAgICAgfCAwMSwgMDIsIC4uLiwgNTMgICAgICAgICAgICAgICAgICAgfCA3ICAgICB8XG4gKiB8IERheSBvZiBtb250aCAgICAgICAgICAgICAgICAgICAgfCBkICAgICAgIHwgMSwgMiwgLi4uLCAzMSAgICAgICAgICAgICAgICAgICAgIHwgICAgICAgfFxuICogfCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHwgZG8gICAgICB8IDFzdCwgMm5kLCAuLi4sIDMxc3QgICAgICAgICAgICAgICB8IDcgICAgIHxcbiAqIHwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB8IGRkICAgICAgfCAwMSwgMDIsIC4uLiwgMzEgICAgICAgICAgICAgICAgICAgfCAgICAgICB8XG4gKiB8IERheSBvZiB5ZWFyICAgICAgICAgICAgICAgICAgICAgfCBEICAgICAgIHwgMSwgMiwgLi4uLCAzNjUsIDM2NiAgICAgICAgICAgICAgIHwgOCAgICAgfFxuICogfCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHwgRG8gICAgICB8IDFzdCwgMm5kLCAuLi4sIDM2NXRoLCAzNjZ0aCAgICAgICB8IDcgICAgIHxcbiAqIHwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB8IEREICAgICAgfCAwMSwgMDIsIC4uLiwgMzY1LCAzNjYgICAgICAgICAgICAgfCA4ICAgICB8XG4gKiB8ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfCBEREQgICAgIHwgMDAxLCAwMDIsIC4uLiwgMzY1LCAzNjYgICAgICAgICAgIHwgICAgICAgfFxuICogfCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHwgRERERCAgICB8IC4uLiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB8IDMgICAgIHxcbiAqIHwgRGF5IG9mIHdlZWsgKGZvcm1hdHRpbmcpICAgICAgICB8IEUuLkVFRSAgfCBNb24sIFR1ZSwgV2VkLCAuLi4sIFN1ICAgICAgICAgICAgfCAgICAgICB8XG4gKiB8ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfCBFRUVFICAgIHwgTW9uZGF5LCBUdWVzZGF5LCAuLi4sIFN1bmRheSAgICAgIHwgMiAgICAgfFxuICogfCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHwgRUVFRUUgICB8IE0sIFQsIFcsIFQsIEYsIFMsIFMgICAgICAgICAgICAgICB8ICAgICAgIHxcbiAqIHwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB8IEVFRUVFRSAgfCBNbywgVHUsIFdlLCBUaCwgRnIsIFN1LCBTYSAgICAgICAgfCAgICAgICB8XG4gKiB8IElTTyBkYXkgb2Ygd2VlayAoZm9ybWF0dGluZykgICAgfCBpICAgICAgIHwgMSwgMiwgMywgLi4uLCA3ICAgICAgICAgICAgICAgICAgIHwgNyAgICAgfFxuICogfCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHwgaW8gICAgICB8IDFzdCwgMm5kLCAuLi4sIDd0aCAgICAgICAgICAgICAgICB8IDcgICAgIHxcbiAqIHwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB8IGlpICAgICAgfCAwMSwgMDIsIC4uLiwgMDcgICAgICAgICAgICAgICAgICAgfCA3ICAgICB8XG4gKiB8ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfCBpaWkgICAgIHwgTW9uLCBUdWUsIFdlZCwgLi4uLCBTdSAgICAgICAgICAgIHwgNyAgICAgfFxuICogfCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHwgaWlpaSAgICB8IE1vbmRheSwgVHVlc2RheSwgLi4uLCBTdW5kYXkgICAgICB8IDIsNyAgIHxcbiAqIHwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB8IGlpaWlpICAgfCBNLCBULCBXLCBULCBGLCBTLCBTICAgICAgICAgICAgICAgfCA3ICAgICB8XG4gKiB8ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfCBpaWlpaWkgIHwgTW8sIFR1LCBXZSwgVGgsIEZyLCBTdSwgU2EgICAgICAgIHwgNyAgICAgfFxuICogfCBMb2NhbCBkYXkgb2Ygd2VlayAoZm9ybWF0dGluZykgIHwgZSAgICAgICB8IDIsIDMsIDQsIC4uLiwgMSAgICAgICAgICAgICAgICAgICB8ICAgICAgIHxcbiAqIHwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB8IGVvICAgICAgfCAybmQsIDNyZCwgLi4uLCAxc3QgICAgICAgICAgICAgICAgfCA3ICAgICB8XG4gKiB8ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfCBlZSAgICAgIHwgMDIsIDAzLCAuLi4sIDAxICAgICAgICAgICAgICAgICAgIHwgICAgICAgfFxuICogfCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHwgZWVlICAgICB8IE1vbiwgVHVlLCBXZWQsIC4uLiwgU3UgICAgICAgICAgICB8ICAgICAgIHxcbiAqIHwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB8IGVlZWUgICAgfCBNb25kYXksIFR1ZXNkYXksIC4uLiwgU3VuZGF5ICAgICAgfCAyICAgICB8XG4gKiB8ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfCBlZWVlZSAgIHwgTSwgVCwgVywgVCwgRiwgUywgUyAgICAgICAgICAgICAgIHwgICAgICAgfFxuICogfCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHwgZWVlZWVlICB8IE1vLCBUdSwgV2UsIFRoLCBGciwgU3UsIFNhICAgICAgICB8ICAgICAgIHxcbiAqIHwgTG9jYWwgZGF5IG9mIHdlZWsgKHN0YW5kLWFsb25lKSB8IGMgICAgICAgfCAyLCAzLCA0LCAuLi4sIDEgICAgICAgICAgICAgICAgICAgfCAgICAgICB8XG4gKiB8ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfCBjbyAgICAgIHwgMm5kLCAzcmQsIC4uLiwgMXN0ICAgICAgICAgICAgICAgIHwgNyAgICAgfFxuICogfCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHwgY2MgICAgICB8IDAyLCAwMywgLi4uLCAwMSAgICAgICAgICAgICAgICAgICB8ICAgICAgIHxcbiAqIHwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB8IGNjYyAgICAgfCBNb24sIFR1ZSwgV2VkLCAuLi4sIFN1ICAgICAgICAgICAgfCAgICAgICB8XG4gKiB8ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfCBjY2NjICAgIHwgTW9uZGF5LCBUdWVzZGF5LCAuLi4sIFN1bmRheSAgICAgIHwgMiAgICAgfFxuICogfCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHwgY2NjY2MgICB8IE0sIFQsIFcsIFQsIEYsIFMsIFMgICAgICAgICAgICAgICB8ICAgICAgIHxcbiAqIHwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB8IGNjY2NjYyAgfCBNbywgVHUsIFdlLCBUaCwgRnIsIFN1LCBTYSAgICAgICAgfCAgICAgICB8XG4gKiB8IEFNLCBQTSAgICAgICAgICAgICAgICAgICAgICAgICAgfCBhLi5hYWEgIHwgQU0sIFBNICAgICAgICAgICAgICAgICAgICAgICAgICAgIHwgICAgICAgfFxuICogfCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHwgYWFhYSAgICB8IGEubS4sIHAubS4gICAgICAgICAgICAgICAgICAgICAgICB8IDIgICAgIHxcbiAqIHwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB8IGFhYWFhICAgfCBhLCBwICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfCAgICAgICB8XG4gKiB8IEFNLCBQTSwgbm9vbiwgbWlkbmlnaHQgICAgICAgICAgfCBiLi5iYmIgIHwgQU0sIFBNLCBub29uLCBtaWRuaWdodCAgICAgICAgICAgIHwgICAgICAgfFxuICogfCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHwgYmJiYiAgICB8IGEubS4sIHAubS4sIG5vb24sIG1pZG5pZ2h0ICAgICAgICB8IDIgICAgIHxcbiAqIHwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB8IGJiYmJiICAgfCBhLCBwLCBuLCBtaSAgICAgICAgICAgICAgICAgICAgICAgfCAgICAgICB8XG4gKiB8IEZsZXhpYmxlIGRheSBwZXJpb2QgICAgICAgICAgICAgfCBCLi5CQkIgIHwgYXQgbmlnaHQsIGluIHRoZSBtb3JuaW5nLCAuLi4gICAgIHwgICAgICAgfFxuICogfCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHwgQkJCQiAgICB8IGF0IG5pZ2h0LCBpbiB0aGUgbW9ybmluZywgLi4uICAgICB8IDIgICAgIHxcbiAqIHwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB8IEJCQkJCICAgfCBhdCBuaWdodCwgaW4gdGhlIG1vcm5pbmcsIC4uLiAgICAgfCAgICAgICB8XG4gKiB8IEhvdXIgWzEtMTJdICAgICAgICAgICAgICAgICAgICAgfCBoICAgICAgIHwgMSwgMiwgLi4uLCAxMSwgMTIgICAgICAgICAgICAgICAgIHwgICAgICAgfFxuICogfCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHwgaG8gICAgICB8IDFzdCwgMm5kLCAuLi4sIDExdGgsIDEydGggICAgICAgICB8IDcgICAgIHxcbiAqIHwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB8IGhoICAgICAgfCAwMSwgMDIsIC4uLiwgMTEsIDEyICAgICAgICAgICAgICAgfCAgICAgICB8XG4gKiB8IEhvdXIgWzAtMjNdICAgICAgICAgICAgICAgICAgICAgfCBIICAgICAgIHwgMCwgMSwgMiwgLi4uLCAyMyAgICAgICAgICAgICAgICAgIHwgICAgICAgfFxuICogfCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHwgSG8gICAgICB8IDB0aCwgMXN0LCAybmQsIC4uLiwgMjNyZCAgICAgICAgICB8IDcgICAgIHxcbiAqIHwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB8IEhIICAgICAgfCAwMCwgMDEsIDAyLCAuLi4sIDIzICAgICAgICAgICAgICAgfCAgICAgICB8XG4gKiB8IEhvdXIgWzAtMTFdICAgICAgICAgICAgICAgICAgICAgfCBLICAgICAgIHwgMSwgMiwgLi4uLCAxMSwgMCAgICAgICAgICAgICAgICAgIHwgICAgICAgfFxuICogfCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHwgS28gICAgICB8IDFzdCwgMm5kLCAuLi4sIDExdGgsIDB0aCAgICAgICAgICB8IDcgICAgIHxcbiAqIHwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB8IEtLICAgICAgfCAxLCAyLCAuLi4sIDExLCAwICAgICAgICAgICAgICAgICAgfCAgICAgICB8XG4gKiB8IEhvdXIgWzEtMjRdICAgICAgICAgICAgICAgICAgICAgfCBrICAgICAgIHwgMjQsIDEsIDIsIC4uLiwgMjMgICAgICAgICAgICAgICAgIHwgICAgICAgfFxuICogfCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHwga28gICAgICB8IDI0dGgsIDFzdCwgMm5kLCAuLi4sIDIzcmQgICAgICAgICB8IDcgICAgIHxcbiAqIHwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB8IGtrICAgICAgfCAyNCwgMDEsIDAyLCAuLi4sIDIzICAgICAgICAgICAgICAgfCAgICAgICB8XG4gKiB8IE1pbnV0ZSAgICAgICAgICAgICAgICAgICAgICAgICAgfCBtICAgICAgIHwgMCwgMSwgLi4uLCA1OSAgICAgICAgICAgICAgICAgICAgIHwgICAgICAgfFxuICogfCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHwgbW8gICAgICB8IDB0aCwgMXN0LCAuLi4sIDU5dGggICAgICAgICAgICAgICB8IDcgICAgIHxcbiAqIHwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB8IG1tICAgICAgfCAwMCwgMDEsIC4uLiwgNTkgICAgICAgICAgICAgICAgICAgfCAgICAgICB8XG4gKiB8IFNlY29uZCAgICAgICAgICAgICAgICAgICAgICAgICAgfCBzICAgICAgIHwgMCwgMSwgLi4uLCA1OSAgICAgICAgICAgICAgICAgICAgIHwgICAgICAgfFxuICogfCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHwgc28gICAgICB8IDB0aCwgMXN0LCAuLi4sIDU5dGggICAgICAgICAgICAgICB8IDcgICAgIHxcbiAqIHwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB8IHNzICAgICAgfCAwMCwgMDEsIC4uLiwgNTkgICAgICAgICAgICAgICAgICAgfCAgICAgICB8XG4gKiB8IEZyYWN0aW9uIG9mIHNlY29uZCAgICAgICAgICAgICAgfCBTICAgICAgIHwgMCwgMSwgLi4uLCA5ICAgICAgICAgICAgICAgICAgICAgIHwgICAgICAgfFxuICogfCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHwgU1MgICAgICB8IDAwLCAwMSwgLi4uLCA5OSAgICAgICAgICAgICAgICAgICB8ICAgICAgIHxcbiAqIHwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB8IFNTUyAgICAgfCAwMDAsIDAwMDEsIC4uLiwgOTk5ICAgICAgICAgICAgICAgfCAgICAgICB8XG4gKiB8ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfCBTU1NTICAgIHwgLi4uICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHwgMyAgICAgfFxuICogfCBUaW1lem9uZSAoSVNPLTg2MDEgdy8gWikgICAgICAgIHwgWCAgICAgICB8IC0wOCwgKzA1MzAsIFogICAgICAgICAgICAgICAgICAgICB8ICAgICAgIHxcbiAqIHwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB8IFhYICAgICAgfCAtMDgwMCwgKzA1MzAsIFogICAgICAgICAgICAgICAgICAgfCAgICAgICB8XG4gKiB8ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfCBYWFggICAgIHwgLTA4OjAwLCArMDU6MzAsIFogICAgICAgICAgICAgICAgIHwgICAgICAgfFxuICogfCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHwgWFhYWCAgICB8IC0wODAwLCArMDUzMCwgWiwgKzEyMzQ1NiAgICAgICAgICB8IDIgICAgIHxcbiAqIHwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB8IFhYWFhYICAgfCAtMDg6MDAsICswNTozMCwgWiwgKzEyOjM0OjU2ICAgICAgfCAgICAgICB8XG4gKiB8IFRpbWV6b25lIChJU08tODYwMSB3L28gWikgICAgICAgfCB4ICAgICAgIHwgLTA4LCArMDUzMCwgKzAwICAgICAgICAgICAgICAgICAgIHwgICAgICAgfFxuICogfCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHwgeHggICAgICB8IC0wODAwLCArMDUzMCwgKzAwMDAgICAgICAgICAgICAgICB8ICAgICAgIHxcbiAqIHwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB8IHh4eCAgICAgfCAtMDg6MDAsICswNTozMCwgKzAwOjAwICAgICAgICAgICAgfCAyICAgICB8XG4gKiB8ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfCB4eHh4ICAgIHwgLTA4MDAsICswNTMwLCArMDAwMCwgKzEyMzQ1NiAgICAgIHwgICAgICAgfFxuICogfCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHwgeHh4eHggICB8IC0wODowMCwgKzA1OjMwLCArMDA6MDAsICsxMjozNDo1NiB8ICAgICAgIHxcbiAqIHwgVGltZXpvbmUgKEdNVCkgICAgICAgICAgICAgICAgICB8IE8uLi5PT08gfCBHTVQtOCwgR01UKzU6MzAsIEdNVCswICAgICAgICAgICAgfCAgICAgICB8XG4gKiB8ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfCBPT09PICAgIHwgR01ULTA4OjAwLCBHTVQrMDU6MzAsIEdNVCswMDowMCAgIHwgMiAgICAgfFxuICogfCBUaW1lem9uZSAoc3BlY2lmaWMgbm9uLWxvY2F0LikgIHwgei4uLnp6eiB8IEdNVC04LCBHTVQrNTozMCwgR01UKzAgICAgICAgICAgICB8IDYgICAgIHxcbiAqIHwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB8IHp6enogICAgfCBHTVQtMDg6MDAsIEdNVCswNTozMCwgR01UKzAwOjAwICAgfCAyLDYgICB8XG4gKiB8IFNlY29uZHMgdGltZXN0YW1wICAgICAgICAgICAgICAgfCB0ICAgICAgIHwgNTEyOTY5NTIwICAgICAgICAgICAgICAgICAgICAgICAgIHwgNyAgICAgfFxuICogfCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHwgdHQgICAgICB8IC4uLiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB8IDMsNyAgIHxcbiAqIHwgTWlsbGlzZWNvbmRzIHRpbWVzdGFtcCAgICAgICAgICB8IFQgICAgICAgfCA1MTI5Njk1MjA5MDAgICAgICAgICAgICAgICAgICAgICAgfCA3ICAgICB8XG4gKiB8ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfCBUVCAgICAgIHwgLi4uICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHwgMyw3ICAgfFxuICogfCBMb25nIGxvY2FsaXplZCBkYXRlICAgICAgICAgICAgIHwgUCAgICAgICB8IDA1LzI5LzE0NTMgICAgICAgICAgICAgICAgICAgICAgICB8IDcgICAgIHxcbiAqIHwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB8IFBQICAgICAgfCBNYXkgMjksIDE0NTMgICAgICAgICAgICAgICAgICAgICAgfCA3ICAgICB8XG4gKiB8ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfCBQUFAgICAgIHwgTWF5IDI5dGgsIDE0NTMgICAgICAgICAgICAgICAgICAgIHwgNyAgICAgfFxuICogfCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHwgUFBQUCAgICB8IFN1bmRheSwgTWF5IDI5dGgsIDE0NTMgICAgICAgICAgICB8IDIsNyAgIHxcbiAqIHwgTG9uZyBsb2NhbGl6ZWQgdGltZSAgICAgICAgICAgICB8IHAgICAgICAgfCAxMjowMCBBTSAgICAgICAgICAgICAgICAgICAgICAgICAgfCA3ICAgICB8XG4gKiB8ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfCBwcCAgICAgIHwgMTI6MDA6MDAgQU0gICAgICAgICAgICAgICAgICAgICAgIHwgNyAgICAgfFxuICogfCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHwgcHBwICAgICB8IDEyOjAwOjAwIEFNIEdNVCsyICAgICAgICAgICAgICAgICB8IDcgICAgIHxcbiAqIHwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB8IHBwcHAgICAgfCAxMjowMDowMCBBTSBHTVQrMDI6MDAgICAgICAgICAgICAgfCAyLDcgICB8XG4gKiB8IENvbWJpbmF0aW9uIG9mIGRhdGUgYW5kIHRpbWUgICAgfCBQcCAgICAgIHwgMDUvMjkvMTQ1MywgMT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gIEQgIHwgRGF5IG9mIHllYXIgICAgICAgICAgICAgICAgICAgIHxcbiAqIHwgIGUgIHwgTG9jYWwgZGF5IG9mIHdlZWsgICAgICAgICAgICAgIHwgIEUgIHwgRGF5IG9mIHdlZWsgICAgICAgICAgICAgICAgICAgIHxcbiAqIHwgIGYgIHwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHwgIEYqIHwgRGF5IG9mIHdlZWsgaW4gbW9udGggICAgICAgICAgIHxcbiAqIHwgIGcqIHwgTW9kaWZpZWQgSnVsaWFuIGRheSAgICAgICAgICAgIHwgIEcgIHwgRXJhICAgICAgICAgICAgICAgICAgICAgICAgICAgIHxcbiAqIHwgIGggIHwgSG91ciBbMS0xMl0gICAgICAgICAgICAgICAgICAgIHwgIEggIHwgSG91ciBbMC0yM10gICAgICAgICAgICAgICAgICAgIHxcbiAqIHwgIGkhIHwgSVNPIGRheSBvZiB3ZWVrICAgICAgICAgICAgICAgIHwgIEkhIHwgSVNPIHdlZWsgb2YgeWVhciAgICAgICAgICAgICAgIHxcbiAqIHwgIGoqIHwgTG9jYWxpemVkIGhvdXIgdy8gZGF5IHBlcmlvZCAgIHwgIEoqIHwgTG9jYWxpemVkIGhvdXIgdy9vIGRheSBwZXJpb2QgIHxcbiAqIHwgIGsgIHwgSG91ciBbMS0yNF0gICAgICAgICAgICAgICAgICAgIHwgIEsgIHwgSG91ciBbMC0xMV0gICAgICAgICAgICAgICAgICAgIHxcbiAqIHwgIGwqIHwgKGRlcHJlY2F0ZWQpICAgICAgICAgICAgICAgICAgIHwgIEwgIHwgU3RhbmQtYWxvbmUgbW9udGggICAgICAgICAgICAgIHxcbiAqIHwgIG0gIHwgTWludXRlICAgICAgICAgICAgICAgICAgICAgICAgIHwgIE0gIHwgTW9udGggICAgICAgICAgICAgICAgICAgICAgICAgIHxcbiAqIHwgIG4gIHwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHwgIE4gIHwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHxcbiAqIHwgIG8hIHwgT3JkaW5hbCBudW1iZXIgbW9kaWZpZXIgICAgICAgIHwgIE8qIHwgVGltZXpvbmUgKEdNVCkgICAgICAgICAgICAgICAgIHxcbiAqIHwgIHAgIHwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHwgIFAgIHwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHxcbiAqIHwgIHEgIHwgU3RhbmQtYWxvbmUgcXVhcnRlciAgICAgICAgICAgIHwgIFEgIHwgUXVhcnRlciAgICAgICAgICAgICAgICAgICAgICAgIHxcbiAqIHwgIHIqIHwgUmVsYXRlZCBHcmVnb3JpYW4geWVhciAgICAgICAgIHwgIFIhIHwgSVNPIHdlZWstbnVtYmVyaW5nIHllYXIgICAgICAgIHxcbiAqIHwgIHMgIHwgU2Vjb25kICAgICAgICAgICAgICAgICAgICAgICAgIHwgIFMgIHwgRnJhY3Rpb24gb2Ygc2Vjb25kICAgICAgICAgICAgIHxcbiAqIHwgIHQhIHwgU2Vjb25kcyB0aW1lc3RhbXAgICAgICAgICAgICAgIHwgIFQhIHwgTWlsbGlzZWNvbmRzIHRpbWVzdGFtcCAgICAgICAgIHxcbiAqIHwgIHUgIHwgRXh0ZW5kZWQgeWVhciAgICAgICAgICAgICAgICAgIHwgIFUqIHwgQ3ljbGljIHllYXIgICAgICAgICAgICAgICAgICAgIHxcbiAqIHwgIHYqIHwgVGltZXpvbmUgKGdlbmVyaWMgbm9uLWxvY2F0LikgIHwgIFYqIHwgVGltZXpvbmUgKGxvY2F0aW9uKSAgICAgICAgICAgIHxcbiAqIHwgIHcgIHwgTG9jYWwgd2VlayBvZiB5ZWFyICAgICAgICAgICAgIHwgIFcqIHwgV2VlayBvZiBtb250aCAgICAgICAgICAgICAgICAgIHxcbiAqIHwgIHggIHwgVGltZXpvbmUgKElTTy04NjAxIHcvbyBaKSAgICAgIHwgIFggIHwgVGltZXpvbmUgKElTTy04NjAxKSAgICAgICAgICAgIHxcbiA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AgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB8ICAgICB8IEdHR0dHICAgfCBBLCBCICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfCAgICAgICB8XG4gKiB8IENhbGVuZGFyIHllYXIgICAgICAgICAgICAgICAgICAgfCAxMzAgfCB5ICAgICAgIHwgNDQsIDEsIDE5MDAsIDIwMTcsIDk5OTkgICAgICAgICAgIHwgNCAgICAgfFxuICogfCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHwgICAgIHwgeW8gICAgICB8IDQ0dGgsIDFzdCwgMTkwMHRoLCA5OTk5OTk5dGggICAgICB8IDQsNSAgIHxcbiAqIHwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB8ICAgICB8IHl5ICAgICAgfCA0NCwgMDEsIDAwLCAxNyAgICAgICAgICAgICAgICAgICAgfCA0ICAgICB8XG4gKiB8ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfCAgICAgfCB5eXkgICAgIHwgMDQ0LCAwMDEsIDEyMywgOTk5ICAgICAgICAgICAgICAgIHwgNCAgICAgfFxuICogfCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHwgICAgIHwgeXl5eSAgICB8IDAwNDQsIDAwMDEsIDE5MDAsIDIwMTcgICAgICAgICAgICB8IDQgICAgIHxcbiAqIHwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB8ICAgICB8IHl5eXl5ICAgfCAuLi4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfCAyLDQgICB8XG4gKiB8IExvY2FsIHdlZWstbnVtYmVyaW5nIHllYXIgICAgICAgfCAxMzAgfCBZICAgICAgIHwgNDQsIDEsIDE5MDAsIDIwMTcsIDkwMDAgICAgICAgICAgIHwgNCAgICAgfFxuICogfCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHwgICAgIHwgWW8gICAgICB8IDQ0dGgsIDFzdCwgMTkwMHRoLCA5OTk5OTk5dGggICAgICB8IDQsNSAgIHxcbiAqIHwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB8ICAgICB8IFlZICAgICAgfCA0NCwgMDEsIDAwLCAxNyAgICAgICAgICAgICAgICAgICAgfCA0LDYgICB8XG4gKiB8ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfCAgICAgfCBZWVkgICAgIHwgMDQ0LCAwMDEsIDEyMywgOTk5ICAgICAgICAgICAgICAgIHwgNCAgICAgfFxuICogfCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHwgICAgIHwgWVlZWSAgICB8IDAwNDQsIDAwMDEsIDE5MDAsIDIwMTcgICAgICAgICAgICB8IDQsNiAgIHxcbiAqIHwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB8ICAgICB8IFlZWVlZICAgfCAuLi4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfCAyLDQgICB8XG4gKiB8IElTTyB3ZWVrLW51bWJlcmluZyB5ZWFyICAgICAgICAgfCAxMzAgfCBSICAgICAgIHwgLTQzLCAxLCAxOTAwLCAyMDE3LCA5OTk5LCAtOTk5OSAgIHwgNCw1ICAgfFxuICogfCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHwgICAgIHwgUlIgICAgICB8IC00MywgMDEsIDAwLCAxNyAgICAgICAgICAgICAgICAgICB8IDQsNSAgIHxcbiAqIHwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB8ICAgICB8IFJSUiAgICAgfCAtMDQzLCAwMDEsIDEyMywgOTk5LCAtOTk5ICAgICAgICAgfCA0LDUgICB8XG4gKiB8ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfCAgICAgfCBSUlJSICAgIHwgLTAwNDMsIDAwMDEsIDIwMTcsIDk5OTksIC05OTk5ICAgIHwgNCw1ICAgfFxuICogfCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHwgICAgIHwgUlJSUlIgICB8IC4uLiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB8IDIsNCw1IHxcbiAqIHwgRXh0ZW5kZWQgeWVhciAgICAgICAgICAgICAgICAgICB8IDEzMCB8IHUgICAgICAgfCAtNDMsIDEsIDE5MDAsIDIwMTcsIDk5OTksIC05OTkgICAgfCA0ICAgICB8XG4gKiB8ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfCAgICAgfCB1dSAgICAgIHwgLTQzLCAwMSwgOTksIC05OSAgICAgICAgICAgICAgICAgIHwgNCAgICAgfFxuICogfCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHwgICAgIHwgdXV1ICAgICB8IC0wNDMsIDAwMSwgMTIzLCA5OTksIC05OTkgICAgICAgICB8IDQgICAgIHxcbiAqIHwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB8ICAgICB8IHV1dXUgICAgfCAtMDA0MywgMDAwMSwgMjAxNywgOTk5OSwgLTk5OTkgICAgfCA0ICAgICB8XG4gKiB8ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfCAgICAgfCB1dXV1dSAgIHwgLi4uICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHwgMiw0ICAgfFxuICogfCBRdWFydGVyIChmb3JtYXR0aW5nKSAgICAgICAgICAgIHwgMTIwIHwgUSAgICAgICB8IDEsIDIsIDMsIDQgICAgICAgICAgICAgICAgICAgICAgICB8ICAgICAgIHxcbiAqIHwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB8ICAgICB8IFFvICAgICAgfCAxc3QsIDJuZCwgM3JkLCA0dGggICAgICAgICAgICAgICAgfCA1ICAgICB8XG4gKiB8ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfCAgICAgfCBRUSAgICAgIHwgMDEsIDAyLCAwMywgMDQgICAgICAgICAgICAgICAgICAgIHwgICAgICAgfFxuICogfCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHwgICAgIHwgUVFRICAgICB8IFExLCBRMiwgUTMsIFE0ICAgICAgICAgICAgICAgICAgICB8ICAgICAgIHxcbiAqIHwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB8ICAgICB8IFFRUVEgICAgfCAxc3QgcXVhcnRlciwgMm5kIHF1YXJ0ZXIsIC4uLiAgICAgfCAyICAgICB8XG4gKiB8ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfCAgICAgfCBRUVFRUSAgIHwgMSwgMiwgMywgNCAgICAgICAgICAgICAgICAgICAgICAgIHwgNCAgICAgfFxuICogfCBRdWFydGVyIChzdGFuZC1hbG9uZSkgICAgICAgICAgIHwgMTIwIHwgcSAgICAgICB8IDEsIDIsIDMsIDQgICAgICAgICAgICAgICAgICAgICAgICB8ICAgICAgIHxcbiAqIHwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB8ICAgICB8IHFvICAgICAgfCAxc3QsIDJuZCwgM3JkLCA0dGggICAgICAgICAgICAgICAgfCA1ICAgICB8XG4gKiB8ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfCAgICAgfCBxcSAgICAgIHwgMDEsIDAyLCAwMywgMDQgICAgICAgICAgICAgICAgICAgIHwgICAgICAgfFxuICogfCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHwgICAgIHwgcXFxICAgICB8IFExLCBRMiwgUTMsIFE0ICAgICAgICAgICAgICAgICAgICB8ICAgICAgIHxcbiAqIHwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB8ICAgICB8IHFxcXEgICAgfCAxc3QgcXVhcnRlciwgMm5kIHF1YXJ0ZXIsIC4uLiAgICAgfCAyICAgICB8XG4gKiB8ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfCAgICAgfCBxcXFxcSAgIHwgMSwgMiwgMywgNCAgICAgICAgICAgICAgICAgICAgICAgIHwgMyAgICAgfFxuICogfCBNb250aCAoZm9ybWF0dGluZykgICAgICAgICAgICAgIHwgMTEwIHwgTSAgICAgICB8IDEsIDIsIC4uLiwgMTIgICAgICAgICAgICAgICAgICAgICB8ICAgICAgIHxcbiAqIHwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB8ICAgICB8IE1vICAgICAgfCAxc3QsIDJuZCwgLi4uLCAxMnRoICAgICAgICAgICAgICAgfCA1ICAgICB8XG4gKiB8ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfCAgICAgfCBNTSAgICAgIHwgMDEsIDAyLCAuLi4sIDEyICAgICAgICAgICAgICAgICAgIHwgICAgICAgfFxuICogfCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHwgICAgIHwgTU1NICAgICB8IEphbiwgRmViLCAuLi4sIERlYyAgICAgICAgICAgICAgICB8ICAgICAgIHxcbiAqIHwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB8ICAgICB8IE1NTU0gICAgfCBKYW51YXJ5LCBGZWJydWFyeSwgLi4uLCBEZWNlbWJlciAgfCAyICAgICB8XG4gKiB8ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfCAgICAgfCBNTU1NTSAgIHwgSiwgRiwgLi4uLCBEICAgICAgICAgICAgICAgICAgICAgIHwgICAgICAgfFxuICogfCBNb250aCAoc3RhbmQtYWxvbmUpICAgICAgICAgICAgIHwgMTEwIHwgTCAgICAgICB8IDEsIDIsIC4uLiwgMTIgICAgICAgICAgICAgICAgICAgICB8ICAgICAgIHxcbiAqIHwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB8ICAgICB8IExvICAgICAgfCAxc3QsIDJuZCwgLi4uLCAxMnRoICAgICAgICAgICAgICAgfCA1ICAgICB8XG4gKiB8ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfCAgICAgfCBMTCAgICAgIHwgMDEsIDAyLCAuLi4sIDEyICAgICAgICAgICAgICAgICAgIHwgICAgICAgfFxuICogfCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHwgICAgIHwgTExMICAgICB8IEphbiwgRmViLCAuLi4sIERlYyAgICAgICAgICAgICAgICB8ICAgICAgIHxcbiAqIHwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB8ICAgICB8IExMTEwgICAgfCBKYW51YXJ5LCBGZWJydWFyeSwgLi4uLCBEZWNlbWJlciAgfCAyICAgICB8XG4gKiB8ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfCAgICAgfCBMTExMTCAgIHwgSiwgRiwgLi4uLCBEICAgICAgICAgICAgICAgICAgICAgIHwgICAgICAgfFxuICogfCBMb2NhbCB3ZWVrIG9mIHllYXIgICAgICAgICAgICAgIHwgMTAwIHwgdyAgICAgICB8IDEsIDIsIC4uLiwgNTMgICAgICAgICAgICAgICAgICAgICB8ICAgICAgIHxcbiAqIHwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB8ICAgICB8IHdvICAgICAgfCAxc3QsIDJuZCwgLi4uLCA1M3RoICAgICAgICAgICAgICAgfCA1ICAgICB8XG4gKiB8ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfCAgICAgfCB3dyAgICAgIHwgMDEsIDAyLCAuLi4sIDUzICAgICAgICAgICAgICAgICAgIHwgICAgICAgfFxuICogfCBJU08gd2VlayBvZiB5ZWFyICAgICAgICAgICAgICAgIHwgMTAwIHwgSSAgICAgICB8IDEsIDIsIC4uLiwgNTMgICAgICAgICAgICAgICAgICAgICB8IDUgICAgIHxcbiAqIHwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB8ICAgICB8IElvICAgICAgfCAxc3QsIDJuZCwgLi4uLCA1M3RoICAgICAgICAgICAgICAgfCA1ICAgICB8XG4gKiB8ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfCAgICAgfCBJSSAgICAgIHwgMDEsIDAyLCAuLi4sIDUzICAgICAgICAgICAgICAgICAgIHwgNSAgICAgfFxuICogfCBEYXkgb2YgbW9udGggICAgICAgICAgICAgICAgICAgIHwgIDkwIHwgZCAgICAgICB8IDEsIDIsIC4uLiwgMzEgICAgICAgICAgICAgICAgICAgICB8ICAgICAgIHxcbiAqIHwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB8ICAgICB8IGRvICAgICAgfCAxc3QsIDJuZCwgLi4uLCAzMXN0ICAgICAgICAgICAgICAgfCA1ICAgICB8XG4gKiB8ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfCAgICAgfCBkZCAgICAgIHwgMDEsIDAyLCAuLi4sIDMxICAgICAgICAgICAgICAgICAgIHwgICAgICAgfFxuICogfCBEYXkgb2YgeWVhciAgICAgICAgICAgICAgICAgICAgIHwgIDkwIHwgRCAgICAgICB8IDEsIDIsIC4uLiwgMzY1LCAzNjYgICAgICAgICAgICAgICB8IDYgICAgIHxcbiAqIHwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB8ICAgICB8IERvICAgICAgfCAxc3QsIDJuZCwgLi4uLCAzNjV0aCwgMzY2dGggICAgICAgfCA1ICAgICB8XG4gKiB8ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfCAgICAgfCBERCAgICAgIHwgMDEsIDAyLCAuLi4sIDM2NSwgMzY2ICAgICAgICAgICAgIHwgNiAgICAgfFxuICogfCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHwgICAgIHwgREREICAgICB8IDAwMSwgMDAyLCAuLi4sIDM2NSwgMzY2ICAgICAgICAgICB8ICAgICAgIHxcbiAqIHwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB8ICAgICB8IEREREQgICAgfCAuLi4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfCAyICAgICB8XG4gKiB8IERheSBvZiB3ZWVrIChmb3JtYXR0aW5nKSAgICAgICAgfCAgOTAgfCBFLi5FRUUgIHwgTW9uLCBUdWUsIFdlZCwgLi4uLCBTdSAgICAgICAgICAgIHwgICAgICAgfFxuICogfCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHwgICAgIHwgRUVFRSAgICB8IE1vbmRheSwgVHVlc2RheSwgLi4uLCBTdW5kYXkgICAgICB8IDIgICAgIHxcbiAqIHwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB8ICAgICB8IEVFRUVFICAgfCBNLCBULCBXLCBULCBGLCBTLCBTICAgICAgICAgICAgICAgfCAgICAgICB8XG4gKiB8ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfCAgICAgfCBFRUVFRUUgIHwgTW8sIFR1LCBXZSwgVGgsIEZyLCBTdSwgU2EgICAgICAgIHwgICAgICAgfFxuICogfCBJU08gZGF5IG9mIHdlZWsgKGZvcm1hdHRpbmcpICAgIHwgIDkwIHwgaSAgICAgICB8IDEsIDIsIDMsIC4uLiwgNyAgICAgICAgICAgICAgICAgICB8IDUgICAgIHxcbiAqIHwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB8ICAgICB8IGlvICAgICAgfCAxc3QsIDJuZCwgLi4uLCA3dGggICAgICAgICAgICAgICAgfCA1ICAgICB8XG4gKiB8ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfCAgICAgfCBpaSAgICAgIHwgMDEsIDAyLCAuLi4sIDA3ICAgICAgICAgICAgICAgICAgIHwgNSAgICAgfFxuICogfCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHwgICAgIHwgaWlpICAgICB8IE1vbiwgVHVlLCBXZWQsIC4uLiwgU3UgICAgICAgICAgICB8IDUgICAgIHxcbiAqIHwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB8ICAgICB8IGlpaWkgICAgfCBNb25kYXksIFR1ZXNkYXksIC4uLiwgU3VuZGF5ICAgICAgfCAyLDUgICB8XG4gKiB8ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfCAgICAgfCBpaWlpaSAgIHwgTSwgVCwgVywgVCwgRiwgUywgUyAgICAgICAgICAgICAgIHwgNSAgICAgfFxuICogfCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHwgICAgIHwgaWlpaWlpICB8IE1vLCBUdSwgV2UsIFRoLCBGciwgU3UsIFNhICAgICAgICB8IDUgICAgIHxcbiAqIHwgTG9jYWwgZGF5IG9mIHdlZWsgKGZvcm1hdHRpbmcpICB8ICA5MCB8IGUgICAgICAgfCAyLCAzLCA0LCAuLi4sIDEgICAgICAgICAgICAgICAgICAgfCAgICAgICB8XG4gKiB8ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfCAgICAgfCBlbyAgICAgIHwgMm5kLCAzcmQsIC4uLiwgMXN0ICAgICAgICAgICAgICAgIHwgNSAgICAgfFxuICogfCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHwgICAgIHwgZWUgICAgICB8IDAyLCAwMywgLi4uLCAwMSAgICAgICAgICAgICAgICAgICB8ICAgICAgIHxcbiAqIHwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB8ICAgICB8IGVlZSAgICAgfCBNb24sIFR1ZSwgV2VkLCAuLi4sIFN1ICAgICAgICAgICAgfCAgICAgICB8XG4gKiB8ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfCAgICAgfCBlZWVlICAgIHwgTW9uZGF5LCBUdWVzZGF5LCAuLi4sIFN1bmRheSAgICAgIHwgMiAgICAgfFxuICogfCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHwgICAgIHwgZWVlZWUgICB8IE0sIFQsIFcsIFQsIEYsIFMsIFMgICAgICAgICAgICAgICB8ICAgICAgIHxcbiAqIHwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB8ICAgICB8IGVlZWVlZSAgfCBNbywgVHUsIFdlLCBUaCwgRnIsIFN1LCBTYSAgICAgICAgfCAgICAgICB8XG4gKiB8IExvY2FsIGRheSBvZiB3ZWVrIChzdGFuZC1hbG9uZSkgfCAgOTAgfCBjICAgICAgIHwgMiwgMywgNCwgLi4uLCAxICAgICAgICAgICAgICAgICAgIHwgICAgICAgfFxuICogfCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHwgICAgIHwgY28gICAgICB8IDJuZCwgM3JkLCAuLi4sIDFzdCAgICAgICAgICAgICAgICB8IDUgICAgIHxcbiAqIHwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB8ICAgICB8IGNjICAgICAgfCAwMiwgMDMsIC4uLiwgMDEgICAgICAgICAgICAgICAgICAgfCAgICAgICB8XG4gKiB8ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfCAgICAgfCBjY2MgICAgIHwgTW9uLCBUdWUsIFdlZCwgLi4uLCBTdSAgICAgICAgICAgIHwgICAgICAgfFxuICogfCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHwgICAgIHwgY2NjYyAgICB8IE1vbmRheSwgVHVlc2RheSwgLi4uLCBTdW5kYXkgICAgICB8IDIgICAgIHxcbiAqIHwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB8ICAgICB8IGNjY2NjICAgfCBNLCBULCBXLCBULCBGLCBTLCBTICAgICAgICAgICAgICAgfCAgICAgICB8XG4gKiB8ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfCAgICAgfCBjY2NjY2MgIHwgTW8sIFR1LCBXZSwgVGgsIEZyLCBTdSwgU2EgICAgICAgIHwgICAgICAgfFxuICogfCBBTSwgUE0gICAgICAgICAgICAgICAgICAgICAgICAgIHwgIDgwIHwgYS4uYWFhICB8IEFNLCBQTSAgICAgICAgICAgICAgICAgICAgICAgICAgICB8ICAgICAgIHxcbiAqIHwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB8ICAgICB8IGFhYWEgICAgfCBhLm0uLCBwLm0uICAgICAgICAgICAgICAgICAgICAgICAgfCAyICAgICB8XG4gKiB8ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfCAgICAgfCBhYWFhYSAgIHwgYSwgcCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHwgICAgICAgfFxuICogfCBBTSwgUE0sIG5vb24sIG1pZG5pZ2h0ICAgICAgICAgIHwgIDgwIHwgYi4uYmJiICB8IEFNLCBQTSwgbm9vbiwgbWlkbmlnaHQgICAgICAgICAgICB8ICAgICAgIHxcbiAqIHwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB8ICAgICB8IGJiYmIgICAgfCBhLm0uLCBwLm0uLCBub29uLCBtaWRuaWdodCAgICAgICAgfCAyICAgICB8XG4gKiB8ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfCAgICAgfCBiYmJiYiAgIHwgYSwgcCwgbiwgbWkgICAgICAgICAgICAgICAgICAgICAgIHwgICAgICAgfFxuICogfCBGbGV4aWJsZSBkYXkgcGVyaW9kICAgICAgICAgICAgIHwgIDgwIHwgQi4uQkJCICB8IGF0IG5pZ2h0LCBpbiB0aGUgbW9ybmluZywgLi4uICAgICB8ICAgICAgIHxcbiAqIHwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB8ICAgICB8IEJCQkIgICAgfCBhdCBuaWdodCwgaW4gdGhlIG1vcm5pbmcsIC4uLiAgICAgfCAyICAgICB8XG4gKiB8ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfCAgICAgfCBCQkJCQiAgIHwgYXQgbmlnaHQsIGluIHRoZSBtb3JuaW5nLCAuLi4gICAgIHwgICAgICAgfFxuICogfCBIb3VyIFsxLTEyXSAgICAgICAgICAgICAgICAgICAgIHwgIDcwIHwgaCAgICAgICB8IDEsIDIsIC4uLiwgMTEsIDEyICAgICAgICAgICAgICAgICB8ICAgICAgIHxcbiAqIHwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB8ICAgICB8IGhvICAgICAgfCAxc3QsIDJuZCwgLi4uLCAxMXRoLCAxMnRoICAgICAgICAgfCA1ICAgICB8XG4gKiB8ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfCAgICAgfCBoaCAgICAgIHwgMDEsIDAyLCAuLi4sIDExLCAxMiAgICAgICAgICAgICAgIHwgICAgICAgfFxuICogfCBIb3VyIFswLTIzXSAgICAgICAgICAgICAgICAgICAgIHwgIDcwIHwgSCAgICAgICB8IDAsIDEsIDIsIC4uLiwgMjMgICAgICAgICAgICAgICAgICB8ICAgICAgIHxcbiAqIHwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB8ICAgICB8IEhvICAgICAgfCAwdGgsIDFzdCwgMm5kLCAuLi4sIDIzcmQgICAgICAgICAgfCA1ICAgICB8XG4gKiB8ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfCAgICAgfCBISCAgICAgIHwgMDAsIDAxLCAwMiwgLi4uLCAyMyAgICAgICAgICAgICAgIHwgICAgICAgfFxuICogfCBIb3VyIFswLTExXSAgICAgICAgICAgICAgICAgICAgIHwgIDcwIHwgSyAgICAgICB8IDEsIDIsIC4uLiwgMTEsIDAgICAgICAgICAgICAgICAgICB8ICAgICAgIHxcbiAqIHwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB8ICAgICB8IEtvICAgICAgfCAxc3QsIDJuZCwgLi4uLCAxMXRoLCAwdGggICAgICAgICAgfCA1ICAgICB8XG4gKiB8ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfCAgICAgfCBLSyAgICAgIHwgMSwgMiwgLi4uLCAxMSwgMCAgICAgICAgICAgICAgICAgIHwgICAgICAgfFxuICogfCBIb3VyIFsxLTI0XSAgICAgICAgICAgICAgICAgICAgIHwgIDcwIHwgayAgICAgICB8IDI0LCAxLCAyLCAuLi4sIDIzICAgICAgICAgICAgICAgICB8ICAgICAgIHxcbiAqIHwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB8ICAgICB8IGtvICAgICAgfCAyNHRoLCAxc3QsIDJuZCwgLi4uLCAyM3JkICAgICAgICAgfCA1ICAgICB8XG4gKiB8ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfCAgICAgfCBrayAgICAgIHwgMjQsIDAxLCAwMiwgLi4uLCAyMyAgICAgICAgICAgICAgIHwgICAgICAgfFxuICogfCBNaW51dGUgICAgICAgICAgICAgICAgICAgICAgICAgIHwgIDYwIHwgbSAgICAgICB8IDAsIDEsIC4uLiwgNTkgICAgICAgICAgICAgICAgICAgICB8ICAgICAgIHxcbiAqIHwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB8ICAgICB8IG1vICAgICAgfCAwdGgsIDFzdCwgLi4uLCA1OXRoICAgICAgICAgICAgICAgfCA1ICAgICB8XG4gKiB8ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfCAgICAgfCBtbSAgICAgIHwgMDAsIDAxLCAuLi4sIDU5ICAgICAgICAgICAgICAgICAgIHwgICAgICAgfFxuICogfCBTZWNvbmQgICAgICAgICAgICAgICAgICAgICAgICAgIHwgIDUwIHwgcyAgICAgICB8IDAsIDEsIC4uLiwgNTkgICAgICAgICAgICAgICAgICAgICB8ICAgICAgIHxcbiAqIHwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB8ICAgICB8IHNvICAgICAgfCAwdGgsIDFzdCwgLi4uLCA1OXRoICAgICAgICAgICAgICAgfCA1ICAgICB8XG4gKiB8ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfCAgICAgfCBzcyAgICAgIHwgMDAsIDAxLCAuLi4sIDU5ICAgICAgICAgICAgICAgICAgIHwgICAgICAgfFxuICogfCBGcmFjdGlvbiBvZiBzZWNvbmQgICAgICAgICAgICAgIHwgIDQwIHwgUyAgICAgICB8IDAsIDEsIC4uLiwgOSAgICAgICAgICAgICAgICAgICAgICB8ICAgICAgIHxcbiAqIHwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB8ICAgICB8IFNTICAgICAgfCAwMCwgMDEsIC4uLiwgOTkgICAgICAgICAgICAgICAgICAgfCAgICAgICB8XG4gKiB8ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfCAgICAgfCBTU1MgICAgIHwgMDAwLCAwMDAxLCAuLi4sIDk5OSAgICAgICAgICAgICAgIHwgICAgICAgfFxuICogfCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHwgICAgIHwgU1NTUyAgICB8IC4uLiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB8IDIgICAgIHxcbiAqIHwgVGltZXpvbmUgKElTTy04NjAxIHcvIFopICAgICAgICB8ICAyMCB8IFggICAgICAgfCAtMDgsICswNTMwLCBaICAgICAgICAgICAgICAgICAgICAgfCAgICAgICB8XG4gKiB8ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfCAgICAgfCBYWCAgICAgIHwgLTA4MDAsICswNTMwLCBaICAgICAgICAgICAgICAgICAgIHwgICAgICAgfFxuICogfCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHwgICAgIHwgWFhYICAgICB8IC0wODowMCwgKzA1OjMwLCBaICAgICAgICAgICAgICAgICB8ICAgICAgIHxcbiAqIHwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB8ICAgICB8IFhYWFggICAgfCAtMDgwMCwgKzA1MzAsIFosICsxMjM0NTYgICAgICAgICAgfCAyICAgICB8XG4gKiB8ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfCAgICAgfCBYWFhYWCAgIHwgLTA4OjAwLCArMDU6MzAsIFosICsxMjozNDo1NiAgICAgIHwgICAgICAgfFxuICogfCBUaW1lem9uZSAoSVNPLTg2MDEgdy9vIFopICAgICAgIHwgIDIwIHwgeCAgICAgICB8IC0wOCwgKzA1MzAsICswMCAgICAgICAgICAgICAgICAgICB8ICAgICAgIHxcbiAqIHwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB8ICAgICB8IHh4ICAgICAgfCAtMDgwMCwgKzA1MzAsICswMDAwICAgICAgICAgICAgICAgfCAgICAgICB8XG4gKiB8ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfCAgICAgfCB4eHggICAgIHwgLTA4OjAwLCArMDU6MzAsICswMDowMCAgICAgICAgICAgIHwgMiAgICAgfFxuICogfCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHwgICAgIHwgeHh4eCAgICB8IC0wODAwLCArMDUzMCwgKzAwMDAsICsxMjM0NTYgICAgICB8ICAgICAgIHxcbiAqIHwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB8ICAgICB8IHh4eHh4ICAgfCAtMDg6MDAsICswNTozMCwgKzAwOjAwLCArMTI6MzQ6NTYgfCAgICAgICB8XG4gKiB8IFNlY29uZHMgdGltZXN0YW1wICAgICAgICAgICAgICAgfCAgMTAgfCB0ICAgICAgIHwgNTEyOTY5NTIwICAgICAgICAgICAgICAgICAgICAgICAgIHwgICAgICAgfFxuICogfCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHwgICAgIHwgdHQgICAgICB8IC4uLiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB8IDIgICAgIHxcbiAqIHwgTWlsbGlzZWNvbmRzIHRpbWVzdGFtcCAgICAgICAgICB8ICAxMCB8IFQgICAgICAgfCA1MTI5Njk1MjA5MDAgICAgICAgICAgICAgICAgICAgICAgfCAgICAgICB8XG4gKiB8ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfCAgICAgfCBUVCAgICAgIHwgLi4uICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHwgMiAgICAgfFxuICogTm90ZXM6XG4gKiAxLiBcIkZvcm1hdHRpbmdcIiB1bml0cyAoZS5nLiBmb3JtYXR0aW5nIHF1YXJ0ZXIpIGluIHRoZSBkZWZhdWx0IGVuLVVTIGxvY2FsZVxuICogICAgYXJlIHRoZSBzYW1lIGFzIFwic3RhbmQtYWxvbmVcIiB1bml0cywgYnV0IGFyZSBkaWZmZXJlbnQgaW4gc29tZSBsYW5ndWFnZXMuXG4gKiAgICBcIkZvcm1hdHRpbmdcIiB1bml0cyBhcmUgZGVjbGluZWQgYWNjb3JkaW5nIHRvIHRoZSBydWxlcyBvZiB0aGUgbGFuZ3VhZ2VcbiAqICAgIGluIHRoZSBjb250ZXh0IG9mIGEgZGF0ZS4gXCJTdG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ICAgIGVycm9yczoge30sXG4gICAgICAgIHZhbGlkYXRlOiBmdW5jdGlvbiAoYXJnKSB7XG4gICAgICAgICAgdmFyIHByb21pc2UgPSB0aGlzJDEudmFsaWRhdGUoYXJnKTtcblxuICAgICAgICAgIHJldHVybiB7XG4gICAgICAgICAgICB0aGVuOiBmdW5jdGlvbiB0aGVuICh0aGVuYWJsZSkge1xuICAgICAgICAgICAgICByZXR1cm4gcHJvbWlzZS50aGVuKGZ1bmN0aW9uIChzdWNjZXNzKSB7XG4gICAgICAgICAgICAgICAgaWYgKHN1Y2Nlc3MgJiYgaXNDYWxsYWJsZSh0aGVuYWJsZSkpIHtcbiAgICAgICAgICAgICAgICAgIHJldHVybiBQcm9taXNlLnJlc29sdmUodGhlbmFibGUoKSk7XG4gICAgICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICAgICAgcmV0dXJuIFByb21pc2UucmVzb2x2ZShzdWNjZXNzKTtcbiAgICAgICAgICAgICAgfSk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgfTtcbiAgICAgICAgfSxcbiAgICAgICAgcmVzZXQ6IGZ1bmN0aW9uICgpIHsgcmV0dXJuIHRoaXMkMS5yZXNldCgpOyB9XG4gICAgICB9O1xuXG4gICAgICByZXR1cm4gdmFsdWVzKHRoaXMucmVmcykuY29uY2F0KCBPYmplY3Qua2V5cyh0aGlzLnBlcnNpc3RlZFN0b3JlKS5tYXAoZnVuY3Rpb24gKGtleSkge1xuICAgICAgICAgIHJldHVybiB7XG4gICAgICAgICAgICB2aWQ6IGtleSxcbiAgICAgICAgICAgIGZsYWdzOiB0aGlzJDEucGVyc2lzdGVkU3RvcmVba2V5XS5mbGFncyxcbiAgICAgICAgICAgIG1lc3NhZ2VzOiB0aGlzJDEucGVyc2lzdGVkU3RvcmVba2V5XS5lcnJvcnNcbiAgICAgICAgICB9O1xuICAgICAgICB9KSxcbiAgICAgICAgdGhpcy5vYnNlcnZlcnMgKS5yZWR1Y2UoZnVuY3Rpb24gKGF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hcEZpZWxkcztcblZlZVZhbGlkYXRlJDEuVmFsaWRhdGlvblByb3ZpZGVyID0gVmFsaWRhdGlvblByb3ZpZGVyO1xuVmVlVmFsaWRhdGUkMS5WYWxpZGF0aW9uT2JzZXJ2ZXIgPSBWYWxpZGF0aW9uT2JzZXJ2ZXI7XG5WZWVWYWxpZGF0ZSQxLndpdGhWYWxpZGF0aW9uID0gd2l0aFZhbGlkYXRpb247XG5cbmV4cG9ydCBkZWZhdWx0IFZlZVZhbGlkYXRlJDE7XG5leHBvcnQgeyBFcnJvckJhZywgUnVsZXMsIFZhbGlkYXRpb25PYnNlcnZlciwgVmFsaWRhdGlvblByb3ZpZGVyLCBWYWxpZGF0b3IsIGRpcmVjdGl2ZSwgaW5zdGFsbCwgbWFwRmllbGRzLCBtaXhpbiwgdmVyc2lvbiwgd2l0aFZhbGlkYXRpb24gfTtcbiJdLCJzb3VyY2VSb290IjoiIn0=\n//# sourceURL=webpack-internal:///./node_modules/vee-validate/dist/vee-validate.esm.js\n");
/***/ }),
/***/ "./node_modules/vue/dist/vue.common.dev.js":
/*!*************************************************!*\
!*** ./node_modules/vue/dist/vue.common.dev.js ***!
\*************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
eval("/* WEBPACK VAR INJECTION */(function(global, setImmediate) {/*!\n * Vue.js v2.6.10\n * (c) 2014-2019 Evan You\n * Released under the MIT License.\n */\n\n\n/* */\n\nvar emptyObject = Object.freeze({});\n\n// These helpers produce better VM code in JS engines due to their\n// explicitness and function inlining.\nfunction isUndef (v) {\n return v === undefined || v === null\n}\n\nfunction isDef (v) {\n return v !== undefined && v !== null\n}\n\nfunction isTrue (v) {\n return v === true\n}\n\nfunction isFalse (v) {\n return v === false\n}\n\n/**\n * Check if value is primitive.\n */\nfunction isPrimitive (value) {\n return (\n typeof value === 'string' ||\n typeof value === 'number' ||\n // $flow-disable-line\n typeof value === 'symbol' ||\n typeof value === 'boolean'\n )\n}\n\n/**\n * Quick object check - this is primarily used to tell\n * Objects from primitive values when we know the value\n * is a JSON-compliant type.\n */\nfunction isObject (obj) {\n return obj !== null && typeof obj === 'object'\n}\n\n/**\n * Get the raw type string of a value, e.g., [object Object].\n */\nvar _toString = Object.prototype.toString;\n\nfunction toRawType (value) {\n return _toString.call(value).slice(8, -1)\n}\n\n/**\n * Strict object type check. Only returns true\n * for plain JavaScript objects.\n */\nfunction isPlainObject (obj) {\n return _toString.call(obj) === '[object Object]'\n}\n\nfunction isRegExp (v) {\n return _toString.call(v) === '[object RegExp]'\n}\n\n/**\n * Check if val is a valid array index.\n */\nfunction isValidArrayIndex (val) {\n var n = parseFloat(String(val));\n return n >= 0 && Math.floor(n) === n && isFinite(val)\n}\n\nfunction isPromise (val) {\n return (\n isDef(val) &&\n typeof val.then === 'function' &&\n typeof val.catch === 'function'\n )\n}\n\n/**\n * Convert a value to a string that is actually rendered.\n */\nfunction toString (val) {\n return val == null\n ? ''\n : Array.isArray(val) || (isPlainObject(val) && val.toString === _toString)\n ? JSON.stringify(val, null, 2)\n : String(val)\n}\n\n/**\n * Convert an input value to a number for persistence.\n * If the conversion fails, return original string.\n */\nfunction toNumber (val) {\n var n = parseFloat(val);\n return isNaN(n) ? val : n\n}\n\n/**\n * Make a map and return a function for checking if a key\n * is in that map.\n */\nfunction makeMap (\n str,\n expectsLowerCase\n) {\n var map = Object.create(null);\n var list = str.split(',');\n for (var i = 0; i < list.length; i++) {\n map[list[i]] = true;\n }\n return expectsLowerCase\n ? function (val) { return map[val.toLowerCase()]; }\n : function (val) { return map[val]; }\n}\n\n/**\n * Check if a tag is a built-in tag.\n */\nvar isBuiltInTag = makeMap('slot,component', true);\n\n/**\n * Check if an attribute is a reserved attribute.\n */\nvar isReservedAttribute = makeMap('key,ref,slot,slot-scope,is');\n\n/**\n * Remove an item from an array.\n */\nfunction remove (arr, item) {\n if (arr.length) {\n var index = arr.indexOf(item);\n if (index > -1) {\n return arr.splice(index, 1)\n }\n }\n}\n\n/**\n * Check whether an object has the property.\n */\nvar hasOwnProperty = Object.prototype.hasOwnProperty;\nfunction hasOwn (obj, key) {\n return hasOwnProperty.call(obj, key)\n}\n\n/**\n * Create a cached version of a pure function.\n */\nfunction cached (fn) {\n var cache = Object.create(null);\n return (function cachedFn (str) {\n var hit = cache[str];\n return hit || (cache[str] = fn(str))\n })\n}\n\n/**\n * Camelize a hyphen-delimited string.\n */\nvar camelizeRE = /-(\\w)/g;\nvar camelize = cached(function (str) {\n return str.replace(camelizeRE, function (_, c) { return c ? c.toUpperCase() : ''; })\n});\n\n/**\n * Capitalize a string.\n */\nvar capitalize = cached(function (str) {\n return str.charAt(0).toUpperCase() + str.slice(1)\n});\n\n/**\n * Hyphenate a camelCase string.\n */\nvar hyphenateRE = /\\B([A-Z])/g;\nvar hyphenate = cached(function (str) {\n return str.replace(hyphenateRE, '-$1').toLowerCase()\n});\n\n/**\n * Simple bind polyfill for environments that do not support it,\n * e.g., PhantomJS 1.x. Technically, we don't need this anymore\n * since native bind is now performant enough in most browsers.\n * But removing it would mean breaking code that was able to run in\n * PhantomJS 1.x, so this must be kept for backward compatibility.\n */\n\n/* istanbul ignore next */\nfunction polyfillBind (fn, ctx) {\n function boundFn (a) {\n var l = arguments.length;\n return l\n ? l > 1\n ? fn.apply(ctx, arguments)\n : fn.call(ctx, a)\n : fn.call(ctx)\n }\n\n boundFn._length = fn.length;\n return boundFn\n}\n\nfunction nativeBind (fn, ctx) {\n return fn.bind(ctx)\n}\n\nvar bind = Function.prototype.bind\n ? nativeBind\n : polyfillBind;\n\n/**\n * Convert an Array-like object to a real Array.\n */\nfunction toArray (list, start) {\n start = start || 0;\n var i = list.length - start;\n var ret = new Array(i);\n while (i--) {\n ret[i] = list[i + start];\n }\n return ret\n}\n\n/**\n * Mix properties into target object.\n */\nfunction extend (to, _from) {\n for (var key in _from) {\n to[key] = _from[key];\n }\n return to\n}\n\n/**\n * Merge an Array of Objects into a single Object.\n */\nfunction toObject (arr) {\n var res = {};\n for (var i = 0; i < arr.length; i++) {\n if (arr[i]) {\n extend(res, arr[i]);\n }\n }\n return res\n}\n\n/* eslint-disable no-unused-vars */\n\n/**\n * Perform no operation.\n * Stubbing args to make Flow happy without leaving useless transpiled code\n * with ...rest (https://flow.org/blog/2017/05/07/Strict-Function-Call-Arity/).\n */\nfunction noop (a, b, c) {}\n\n/**\n * Always return false.\n */\nvar no = function (a, b, c) { return false; };\n\n/* eslint-enable no-unused-vars */\n\n/**\n * Return the same value.\n */\nvar identity = function (_) { return _; };\n\n/**\n * Generate a string containing static keys from compiler modules.\n */\nfunction genStaticKeys (modules) {\n return modules.reduce(function (keys, m) {\n return keys.concat(m.staticKeys || [])\n }, []).join(',')\n}\n\n/**\n * Check if two values are loosely equal - that is,\n * if they are plain objects, do they have the same shape?\n */\nfunction looseEqual (a, b) {\n if (a === b) { return true }\n var isObjectA = isObject(a);\n var isObjectB = isObject(b);\n if (isObjectA && isObjectB) {\n try {\n var isArrayA = Array.isArray(a);\n var isArrayB = Array.isArray(b);\n if (isArrayA && isArrayB) {\n return a.length === b.length && a.every(function (e, i) {\n return looseEqual(e, b[i])\n })\n } else if (a instanceof Date && b instanceof Date) {\n return a.getTime() === b.getTime()\n } else if (!isArrayA && !isArrayB) {\n var keysA = Object.keys(a);\n var keysB = Object.keys(b);\n return keysA.length === keysB.length && keysA.every(function (key) {\n return looseEqual(a[key], b[key])\n })\n } else {\n /* istanbul ignore next */\n return false\n }\n } catch (e) {\n /* istanbul ignore next */\n return false\n }\n } else if (!isObjectA && !isObjectB) {\n return String(a) === String(b)\n } else {\n return false\n }\n}\n\n/**\n * Return the first index at which a loosely equal value can be\n * found in the array (if value is a plain object, the array must\n * contain an object of the same shape), or -1 if it is not present.\n */\nfunction looseIndexOf (arr, val) {\n for (var i = 0; i < arr.length; i++) {\n if (looseEqual(arr[i], val)) { return i }\n }\n return -1\n}\n\n/**\n * Ensure a function is called only once.\n */\nfunction once (fn) {\n var called = false;\n return function () {\n if (!called) {\n called = true;\n fn.apply(this, arguments);\n }\n }\n}\n\nvar SSR_ATTR = 'data-server-rendered';\n\nvar ASSET_TYPES = [\n 'component',\n 'directive',\n 'filter'\n];\n\nvar LIFECYCLE_HOOKS = [\n 'beforeCreate',\n 'created',\n 'beforeMount',\n 'mounted',\n 'beforeUpdate',\n 'updated',\n 'beforeDestroy',\n 'destroyed',\n 'activated',\n 'deactivated',\n 'errorCaptured',\n 'serverPrefetch'\n];\n\n/* */\n\n\n\nvar config = ({\n /**\n * Option merge strategies (used in core/util/options)\n */\n // $flow-disable-line\n optionMergeStrategies: Object.create(null),\n\n /**\n * Whether to suppress warnings.\n */\n silent: false,\n\n /**\n * Show production mode tip message on boot?\n */\n productionTip: \"development\" !== 'production',\n\n /**\n * Whether to enable devtools\n */\n devtools: \"development\" !== 'production',\n\n /**\n * Whether to record perf\n */\n performance: false,\n\n /**\n * Error handler for watcher errors\n */\n errorHandler: null,\n\n /**\n * Warn handler for watcher warns\n */\n warnHandler: null,\n\n /**\n * Ignore certain custom elements\n */\n ignoredElements: [],\n\n /**\n * Custom user key aliases for v-on\n */\n // $flow-disable-line\n keyCodes: Object.create(null),\n\n /**\n * Check if a tag is reserved so that it cannot be registered as a\n * component. This is platform-dependent and may be overwritten.\n */\n isReservedTag: no,\n\n /**\n * Check if an attribute is reserved so that it cannot be used as a component\n * prop. This is platform-dependent and may be overwritten.\n */\n isReservedAttr: no,\n\n /**\n * Check if a tag is an unknown element.\n * Platform-dependent.\n */\n isUnknownElement: no,\n\n /**\n * Get the namespace of an element\n */\n getTagNamespace: noop,\n\n /**\n * Parse the real tag name for the specific platform.\n */\n parsePlatformTagName: identity,\n\n /**\n * Check if an attribute must be bound using property, e.g. value\n * Platform-dependent.\n */\n mustUseProp: no,\n\n /**\n * Perform updates asynchronously. Intended to be used by Vue Test Utils\n * This will significantly reduce performance if set to false.\n */\n async: true,\n\n /**\n * Exposed for legacy reasons\n */\n _lifecycleHooks: LIFECYCLE_HOOKS\n});\n\n/* */\n\n/**\n * unicode letters used for parsing html tags, component names and property paths.\n * using https://www.w3.org/TR/html53/semantics-scripting.html#potentialcustomelementname\n * skipping \\u10000-\\uEFFFF due to it freezing up PhantomJS\n */\nvar 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/;\n\n/**\n * Check if a string starts with $ or _\n */\nfunction isReserved (str) {\n var c = (str + '').charCodeAt(0);\n return c === 0x24 || c === 0x5F\n}\n\n/**\n * Define a property.\n */\nfunction def (obj, key, val, enumerable) {\n Object.defineProperty(obj, key, {\n value: val,\n enumerable: !!enumerable,\n writable: true,\n configurable: true\n });\n}\n\n/**\n * Parse simple path.\n */\nvar bailRE = new RegExp((\"[^\" + (unicodeRegExp.source) + \".$_\\\\d]\"));\nfunction parsePath (path) {\n if (bailRE.test(path)) {\n return\n }\n var segments = path.split('.');\n return function (obj) {\n for (var i = 0; i < segments.length; i++) {\n if (!obj) { return }\n obj = obj[segments[i]];\n }\n return obj\n }\n}\n\n/* */\n\n// can we use __proto__?\nvar hasProto = '__proto__' in {};\n\n// Browser environment sniffing\nvar inBrowser = typeof window !== 'undefined';\nvar inWeex = typeof WXEnvironment !== 'undefined' && !!WXEnvironment.platform;\nvar weexPlatform = inWeex && WXEnvironment.platform.toLowerCase();\nvar UA = inBrowser && window.navigator.userAgent.toLowerCase();\nvar isIE = UA && /msie|trident/.test(UA);\nvar isIE9 = UA && UA.indexOf('msie 9.0') > 0;\nvar isEdge = UA && UA.indexOf('edge/') > 0;\nvar isAndroid = (UA && UA.indexOf('android') > 0) || (weexPlatform === 'android');\nvar isIOS = (UA && /iphone|ipad|ipod|ios/.test(UA)) || (weexPlatform === 'ios');\nvar isChrome = UA && /chrome\\/\\d+/.test(UA) && !isEdge;\nvar isPhantomJS = UA && /phantomjs/.test(UA);\nvar isFF = UA && UA.match(/firefox\\/(\\d+)/);\n\n// Firefox has a \"watch\" function on Object.prototype...\nvar nativeWatch = ({}).watch;\n\nvar supportsPassive = false;\nif (inBrowser) {\n try {\n var opts = {};\n Object.defineProperty(opts, 'passive', ({\n get: function get () {\n /* istanbul ignore next */\n supportsPassive = true;\n }\n })); // https://github.com/facebook/flow/issues/285\n window.addEventListener('test-passive', null, opts);\n } catch (e) {}\n}\n\n// this needs to be lazy-evaled because vue may be required before\n// vue-server-renderer can set VUE_ENV\nvar _isServer;\nvar isServerRendering = function () {\n if (_isServer === undefined) {\n /* istanbul ignore if */\n if (!inBrowser && !inWeex && typeof global !== 'undefined') {\n // detect presence of vue-server-renderer and avoid\n // Webpack shimming the process\n _isServer = global['process'] && global['process'].env.VUE_ENV === 'server';\n } else {\n _isServer = false;\n }\n }\n return _isServer\n};\n\n// detect devtools\nvar devtools = inBrowser && window.__VUE_DEVTOOLS_GLOBAL_HOOK__;\n\n/* istanbul ignore next */\nfunction isNative (Ctor) {\n return typeof Ctor === 'function' && /native code/.test(Ctor.toString())\n}\n\nvar hasSymbol =\n typeof Symbol !== 'undefined' && isNative(Symbol) &&\n typeof Reflect !== 'undefined' && isNative(Reflect.ownKeys);\n\nvar _Set;\n/* istanbul ignore if */ // $flow-disable-line\nif (typeof Set !== 'undefined' && isNative(Set)) {\n // use native Set when available.\n _Set = Set;\n} else {\n // a non-standard Set polyfill that only works with primitive keys.\n _Set = /*@__PURE__*/(function () {\n function Set () {\n this.set = Object.create(null);\n }\n Set.prototype.has = function has (key) {\n return this.set[key] === true\n };\n Set.prototype.add = function add (key) {\n this.set[key] = true;\n };\n Set.prototype.clear = function clear () {\n this.set = Object.create(null);\n };\n\n return Set;\n }());\n}\n\n/* */\n\nvar warn = noop;\nvar tip = noop;\nvar generateComponentTrace = (noop); // work around flow check\nvar formatComponentName = (noop);\n\n{\n var hasConsole = typeof console !== 'undefined';\n var classifyRE = /(?:^|[-_])(\\w)/g;\n var classify = function (str) { return str\n .replace(classifyRE, function (c) { return c.toUpperCase(); })\n .replace(/[-_]/g, ''); };\n\n warn = function (msg, vm) {\n var trace = vm ? generateComponentTrace(vm) : '';\n\n if (config.warnHandler) {\n config.warnHandler.call(null, msg, vm, trace);\n } else if (hasConsole && (!config.silent)) {\n console.error((\"[Vue warn]: \" + msg + trace));\n }\n };\n\n tip = function (msg, vm) {\n if (hasConsole && (!config.silent)) {\n console.warn(\"[Vue tip]: \" + msg + (\n vm ? generateComponentTrace(vm) : ''\n ));\n }\n };\n\n formatComponentName = function (vm, includeFile) {\n if (vm.$root === vm) {\n return '<Root>'\n }\n var options = typeof vm === 'function' && vm.cid != null\n ? vm.options\n : vm._isVue\n ? vm.$options || vm.constructor.options\n : vm;\n var name = options.name || options._componentTag;\n var file = options.__file;\n if (!name && file) {\n var match = file.match(/([^/\\\\]+)\\.vue$/);\n name = match && match[1];\n }\n\n return (\n (name ? (\"<\" + (classify(name)) + \">\") : \"<Anonymous>\") +\n (file && includeFile !== false ? (\" at \" + file) : '')\n )\n };\n\n var repeat = function (str, n) {\n var res = '';\n while (n) {\n if (n % 2 === 1) { res += str; }\n if (n > 1) { str += str; }\n n >>= 1;\n }\n return res\n };\n\n generateComponentTrace = function (vm) {\n if (vm._isVue && vm.$parent) {\n var tree = [];\n var currentRecursiveSequence = 0;\n while (vm) {\n if (tree.length > 0) {\n var last = tree[tree.length - 1];\n if (last.constructor === vm.constructor) {\n currentRecursiveSequence++;\n vm = vm.$parent;\n continue\n } else if (currentRecursiveSequence > 0) {\n tree[tree.length - 1] = [last, currentRecursiveSequence];\n currentRecursiveSequence = 0;\n }\n }\n tree.push(vm);\n vm = vm.$parent;\n }\n return '\\n\\nfound in\\n\\n' + tree\n .map(function (vm, i) { return (\"\" + (i === 0 ? '---> ' : repeat(' ', 5 + i * 2)) + (Array.isArray(vm)\n ? ((formatComponentName(vm[0])) + \"... (\" + (vm[1]) + \" recursive calls)\")\n : formatComponentName(vm))); })\n .join('\\n')\n } else {\n return (\"\\n\\n(found in \" + (formatComponentName(vm)) + \")\")\n }\n };\n}\n\n/* */\n\nvar uid = 0;\n\n/**\n * A dep is an observable that can have multiple\n * directives subscribing to it.\n */\nvar Dep = function Dep () {\n this.id = uid++;\n this.subs = [];\n};\n\nDep.prototype.addSub = function addSub (sub) {\n this.subs.push(sub);\n};\n\nDep.prototype.removeSub = function removeSub (sub) {\n remove(this.subs, sub);\n};\n\nDep.prototype.depend = function depend () {\n if (Dep.target) {\n Dep.target.addDep(this);\n }\n};\n\nDep.prototype.notify = function notify () {\n // stabilize the subscriber list first\n var subs = this.subs.slice();\n if (!config.async) {\n // subs aren't sorted in scheduler if not running async\n // we need to sort them now to make sure they fire in correct\n // order\n subs.sort(function (a, b) { return a.id - b.id; });\n }\n for (var i = 0, l = subs.length; i < l; i++) {\n subs[i].update();\n }\n};\n\n// The current target watcher being evaluated.\n// This is globally unique because only one watcher\n// can be evaluated at a time.\nDep.target = null;\nvar targetStack = [];\n\nfunction pushTarget (target) {\n targetStack.push(target);\n Dep.target = target;\n}\n\nfunction popTarget () {\n targetStack.pop();\n Dep.target = targetStack[targetStack.length - 1];\n}\n\n/* */\n\nvar VNode = function VNode (\n tag,\n data,\n children,\n text,\n elm,\n context,\n componentOptions,\n asyncFactory\n) {\n this.tag = tag;\n this.data = data;\n this.children = children;\n this.text = text;\n this.elm = elm;\n this.ns = undefined;\n this.context = context;\n this.fnContext = undefined;\n this.fnOptions = undefined;\n this.fnScopeId = undefined;\n this.key = data && data.key;\n this.componentOptions = componentOptions;\n this.componentInstance = undefined;\n this.parent = undefined;\n this.raw = false;\n this.isStatic = false;\n this.isRootInsert = true;\n this.isComment = false;\n this.isCloned = false;\n this.isOnce = false;\n this.asyncFactory = asyncFactory;\n this.asyncMeta = undefined;\n this.isAsyncPlaceholder = false;\n};\n\nvar prototypeAccessors = { child: { configurable: true } };\n\n// DEPRECATED: alias for componentInstance for backwards compat.\n/* istanbul ignore next */\nprototypeAccessors.child.get = function () {\n return this.componentInstance\n};\n\nObject.defineProperties( VNode.prototype, prototypeAccessors );\n\nvar createEmptyVNode = function (text) {\n if ( text === void 0 ) text = '';\n\n var node = new VNode();\n node.text = text;\n node.isComment = true;\n return node\n};\n\nfunction createTextVNode (val) {\n return new VNode(undefined, undefined, undefined, String(val))\n}\n\n// optimized shallow clone\n// used for static nodes and slot nodes because they may be reused across\n// multiple renders, cloning them avoids errors when DOM manipulations rely\n// on their elm reference.\nfunction cloneVNode (vnode) {\n var cloned = new VNode(\n vnode.tag,\n vnode.data,\n // #7975\n // clone children array to avoid mutating original in case of cloning\n // a child.\n vnode.children && vnode.children.slice(),\n vnode.text,\n vnode.elm,\n vnode.context,\n vnode.componentOptions,\n vnode.asyncFactory\n );\n cloned.ns = vnode.ns;\n cloned.isStatic = vnode.isStatic;\n cloned.key = vnode.key;\n cloned.isComment = vnode.isComment;\n cloned.fnContext = vnode.fnContext;\n cloned.fnOptions = vnode.fnOptions;\n cloned.fnScopeId = vnode.fnScopeId;\n cloned.asyncMeta = vnode.asyncMeta;\n cloned.isCloned = true;\n return cloned\n}\n\n/*\n * not type checking this file because flow doesn't play well with\n * dynamically accessing methods on Array prototype\n */\n\nvar arrayProto = Array.prototype;\nvar arrayMethods = Object.create(arrayProto);\n\nvar methodsToPatch = [\n 'push',\n 'pop',\n 'shift',\n 'unshift',\n 'splice',\n 'sort',\n 'reverse'\n];\n\n/**\n * Intercept mutating methods and emit events\n */\nmethodsToPatch.forEach(function (method) {\n // cache original method\n var original = arrayProto[method];\n def(arrayMethods, method, function mutator () {\n var args = [], len = arguments.length;\n while ( len-- ) args[ len ] = arguments[ len ];\n\n var result = original.apply(this, args);\n var ob = this.__ob__;\n var inserted;\n switch (method) {\n case 'push':\n case 'unshift':\n inserted = args;\n break\n case 'splice':\n inserted = args.slice(2);\n break\n }\n if (inserted) { ob.observeArray(inserted); }\n // notify change\n ob.dep.notify();\n return result\n });\n});\n\n/* */\n\nvar arrayKeys = Object.getOwnPropertyNames(arrayMethods);\n\n/**\n * In some cases we may want to disable observation inside a component's\n * update computation.\n */\nvar shouldObserve = true;\n\nfunction toggleObserving (value) {\n shouldObserve = value;\n}\n\n/**\n * Observer class that is attached to each observed\n * object. Once attached, the observer converts the target\n * object's property keys into getter/setters that\n * collect dependencies and dispatch updates.\n */\nvar Observer = function Observer (value) {\n this.value = value;\n this.dep = new Dep();\n this.vmCount = 0;\n def(value, '__ob__', this);\n if (Array.isArray(value)) {\n if (hasProto) {\n protoAugment(value, arrayMethods);\n } else {\n copyAugment(value, arrayMethods, arrayKeys);\n }\n this.observeArray(value);\n } else {\n this.walk(value);\n }\n};\n\n/**\n * Walk through all properties and convert them into\n * getter/setters. This method should only be called when\n * value type is Object.\n */\nObserver.prototype.walk = function walk (obj) {\n var keys = Object.keys(obj);\n for (var i = 0; i < keys.length; i++) {\n defineReactive$$1(obj, keys[i]);\n }\n};\n\n/**\n * Observe a list of Array items.\n */\nObserver.prototype.observeArray = function observeArray (items) {\n for (var i = 0, l = items.length; i < l; i++) {\n observe(items[i]);\n }\n};\n\n// helpers\n\n/**\n * Augment a target Object or Array by intercepting\n * the prototype chain using __proto__\n */\nfunction protoAugment (target, src) {\n /* eslint-disable no-proto */\n target.__proto__ = src;\n /* eslint-enable no-proto */\n}\n\n/**\n * Augment a target Object or Array by defining\n * hidden properties.\n */\n/* istanbul ignore next */\nfunction copyAugment (target, src, keys) {\n for (var i = 0, l = keys.length; i < l; i++) {\n var key = keys[i];\n def(target, key, src[key]);\n }\n}\n\n/**\n * Attempt to create an observer instance for a value,\n * returns the new observer if successfully observed,\n * or the existing observer if the value already has one.\n */\nfunction observe (value, asRootData) {\n if (!isObject(value) || value instanceof VNode) {\n return\n }\n var ob;\n if (hasOwn(value, '__ob__') && value.__ob__ instanceof Observer) {\n ob = value.__ob__;\n } else if (\n shouldObserve &&\n !isServerRendering() &&\n (Array.isArray(value) || isPlainObject(value)) &&\n Object.isExtensible(value) &&\n !value._isVue\n ) {\n ob = new Observer(value);\n }\n if (asRootData && ob) {\n ob.vmCount++;\n }\n return ob\n}\n\n/**\n * Define a reactive property on an Object.\n */\nfunction defineReactive$$1 (\n obj,\n key,\n val,\n customSetter,\n shallow\n) {\n var dep = new Dep();\n\n var property = Object.getOwnPropertyDescriptor(obj, key);\n if (property && property.configurable === false) {\n return\n }\n\n // cater for pre-defined getter/setters\n var getter = property && property.get;\n var setter = property && property.set;\n if ((!getter || setter) && arguments.length === 2) {\n val = obj[key];\n }\n\n var childOb = !shallow && observe(val);\n Object.defineProperty(obj, key, {\n enumerable: true,\n configurable: true,\n get: function reactiveGetter () {\n var value = getter ? getter.call(obj) : val;\n if (Dep.target) {\n dep.depend();\n if (childOb) {\n childOb.dep.depend();\n if (Array.isArray(value)) {\n dependArray(value);\n }\n }\n }\n return value\n },\n set: function reactiveSetter (newVal) {\n var value = getter ? getter.call(obj) : val;\n /* eslint-disable no-self-compare */\n if (newVal === value || (newVal !== newVal && value !== value)) {\n return\n }\n /* eslint-enable no-self-compare */\n if (customSetter) {\n customSetter();\n }\n // #7981: for accessor properties without setter\n if (getter && !setter) { return }\n if (setter) {\n setter.call(obj, newVal);\n } else {\n val = newVal;\n }\n childOb = !shallow && observe(newVal);\n dep.notify();\n }\n });\n}\n\n/**\n * Set a property on an object. Adds the new property and\n * triggers change notification if the property doesn't\n * already exist.\n */\nfunction set (target, key, val) {\n if (isUndef(target) || isPrimitive(target)\n ) {\n warn((\"Cannot set reactive property on undefined, null, or primitive value: \" + ((target))));\n }\n if (Array.isArray(target) && isValidArrayIndex(key)) {\n target.length = Math.max(target.length, key);\n target.splice(key, 1, val);\n return val\n }\n if (key in target && !(key in Object.prototype)) {\n target[key] = val;\n return val\n }\n var ob = (target).__ob__;\n if (target._isVue || (ob && ob.vmCount)) {\n warn(\n 'Avoid adding reactive properties to a Vue instance or its root $data ' +\n 'at runtime - declare it upfront in the data option.'\n );\n return val\n }\n if (!ob) {\n target[key] = val;\n return val\n }\n defineReactive$$1(ob.value, key, val);\n ob.dep.notify();\n return val\n}\n\n/**\n * Delete a property and trigger change if necessary.\n */\nfunction del (target, key) {\n if (isUndef(target) || isPrimitive(target)\n ) {\n warn((\"Cannot delete reactive property on undefined, null, or primitive value: \" + ((target))));\n }\n if (Array.isArray(target) && isValidArrayIndex(key)) {\n target.splice(key, 1);\n return\n }\n var ob = (target).__ob__;\n if (target._isVue || (ob && ob.vmCount)) {\n warn(\n 'Avoid deleting properties on a Vue instance or its root $data ' +\n '- just set it to null.'\n );\n return\n }\n if (!hasOwn(target, key)) {\n return\n }\n delete target[key];\n if (!ob) {\n return\n }\n ob.dep.notify();\n}\n\n/**\n * Collect dependencies on array elements when the array is touched, since\n * we cannot intercept array element access like property getters.\n */\nfunction dependArray (value) {\n for (var e = (void 0), i = 0, l = value.length; i < l; i++) {\n e = value[i];\n e && e.__ob__ && e.__ob__.dep.depend();\n if (Array.isArray(e)) {\n dependArray(e);\n }\n }\n}\n\n/* */\n\n/**\n * Option overwriting strategies are functions that handle\n * how to merge a parent option value and a child option\n * value into the final value.\n */\nvar strats = config.optionMergeStrategies;\n\n/**\n * Options with restrictions\n */\n{\n strats.el = strats.propsData = function (parent, child, vm, key) {\n if (!vm) {\n warn(\n \"option \\\"\" + key + \"\\\" can only be used during instance \" +\n 'creation with the `new` keyword.'\n );\n }\n return defaultStrat(parent, child)\n };\n}\n\n/**\n * Helper that recursively merges two data objects together.\n */\nfunction mergeData (to, from) {\n if (!from) { return to }\n var key, toVal, fromVal;\n\n var keys = hasSymbol\n ? Reflect.ownKeys(from)\n : Object.keys(from);\n\n for (var i = 0; i < keys.length; i++) {\n key = keys[i];\n // in case the object is already observed...\n if (key === '__ob__') { continue }\n toVal = to[key];\n fromVal = from[key];\n if (!hasOwn(to, key)) {\n set(to, key, fromVal);\n } else if (\n toVal !== fromVal &&\n isPlainObject(toVal) &&\n isPlainObject(fromVal)\n ) {\n mergeData(toVal, fromVal);\n }\n }\n return to\n}\n\n/**\n * Data\n */\nfunction mergeDataOrFn (\n parentVal,\n childVal,\n vm\n) {\n if (!vm) {\n // in a Vue.extend merge, both should be functions\n if (!childVal) {\n return parentVal\n }\n if (!parentVal) {\n return childVal\n }\n // when parentVal & childVal are both present,\n // we need to return a function that returns the\n // merged result of both functions... no need to\n // check if parentVal is a function here because\n // it has to be a function to pass previous merges.\n return function mergedDataFn () {\n return mergeData(\n typeof childVal === 'function' ? childVal.call(this, this) : childVal,\n typeof parentVal === 'function' ? parentVal.call(this, this) : parentVal\n )\n }\n } else {\n return function mergedInstanceDataFn () {\n // instance merge\n var instanceData = typeof childVal === 'function'\n ? childVal.call(vm, vm)\n : childVal;\n var defaultData = typeof parentVal === 'function'\n ? parentVal.call(vm, vm)\n : parentVal;\n if (instanceData) {\n return mergeData(instanceData, defaultData)\n } else {\n return defaultData\n }\n }\n }\n}\n\nstrats.data = function (\n parentVal,\n childVal,\n vm\n) {\n if (!vm) {\n if (childVal && typeof childVal !== 'function') {\n warn(\n 'The \"data\" option should be a function ' +\n 'that returns a per-instance value in component ' +\n 'definitions.',\n vm\n );\n\n return parentVal\n }\n return mergeDataOrFn(parentVal, childVal)\n }\n\n return mergeDataOrFn(parentVal, childVal, vm)\n};\n\n/**\n * Hooks and props are merged as arrays.\n */\nfunction mergeHook (\n parentVal,\n childVal\n) {\n var res = childVal\n ? parentVal\n ? parentVal.concat(childVal)\n : Array.isArray(childVal)\n ? childVal\n : [childVal]\n : parentVal;\n return res\n ? dedupeHooks(res)\n : res\n}\n\nfunction dedupeHooks (hooks) {\n var res = [];\n for (var i = 0; i < hooks.length; i++) {\n if (res.indexOf(hooks[i]) === -1) {\n res.push(hooks[i]);\n }\n }\n return res\n}\n\nLIFECYCLE_HOOKS.forEach(function (hook) {\n strats[hook] = mergeHook;\n});\n\n/**\n * Assets\n *\n * When a vm is present (instance creation), we need to do\n * a three-way merge between constructor options, instance\n * options and parent options.\n */\nfunction mergeAssets (\n parentVal,\n childVal,\n vm,\n key\n) {\n var res = Object.create(parentVal || null);\n if (childVal) {\n assertObjectType(key, childVal, vm);\n return extend(res, childVal)\n } else {\n return res\n }\n}\n\nASSET_TYPES.forEach(function (type) {\n strats[type + 's'] = mergeAssets;\n});\n\n/**\n * Watchers.\n *\n * Watchers hashes should not overwrite one\n * another, so we merge them as arrays.\n */\nstrats.watch = function (\n parentVal,\n childVal,\n vm,\n key\n) {\n // work around Firefox's Object.prototype.watch...\n if (parentVal === nativeWatch) { parentVal = undefined; }\n if (childVal === nativeWatch) { childVal = undefined; }\n /* istanbul ignore if */\n if (!childVal) { return Object.create(parentVal || null) }\n {\n assertObjectType(key, childVal, vm);\n }\n if (!parentVal) { return childVal }\n var ret = {};\n extend(ret, parentVal);\n for (var key$1 in childVal) {\n var parent = ret[key$1];\n var child = childVal[key$1];\n if (parent && !Array.isArray(parent)) {\n parent = [parent];\n }\n ret[key$1] = parent\n ? parent.concat(child)\n : Array.isArray(child) ? child : [child];\n }\n return ret\n};\n\n/**\n * Other object hashes.\n */\nstrats.props =\nstrats.methods =\nstrats.inject =\nstrats.computed = function (\n parentVal,\n childVal,\n vm,\n key\n) {\n if (childVal && \"development\" !== 'production') {\n assertObjectType(key, childVal, vm);\n }\n if (!parentVal) { return childVal }\n var ret = Object.create(null);\n extend(ret, parentVal);\n if (childVal) { extend(ret, childVal); }\n return ret\n};\nstrats.provide = mergeDataOrFn;\n\n/**\n * Default strategy.\n */\nvar defaultStrat = function (parentVal, childVal) {\n return childVal === undefined\n ? parentVal\n : childVal\n};\n\n/**\n * Validate component names\n */\nfunction checkComponents (options) {\n for (var key in options.components) {\n validateComponentName(key);\n }\n}\n\nfunction validateComponentName (name) {\n if (!new RegExp((\"^[a-zA-Z][\\\\-\\\\.0-9_\" + (unicodeRegExp.source) + \"]*$\")).test(name)) {\n warn(\n 'Invalid component name: \"' + name + '\". Component names ' +\n 'should conform to valid custom element name in html5 specification.'\n );\n }\n if (isBuiltInTag(name) || config.isReservedTag(name)) {\n warn(\n 'Do not use built-in or reserved HTML elements as component ' +\n 'id: ' + name\n );\n }\n}\n\n/**\n * Ensure all props option syntax are normalized into the\n * Object-based format.\n */\nfunction normalizeProps (options, vm) {\n var props = options.props;\n if (!props) { return }\n var res = {};\n var i, val, name;\n if (Array.isArray(props)) {\n i = props.length;\n while (i--) {\n val = props[i];\n if (typeof val === 'string') {\n name = camelize(val);\n res[name] = { type: null };\n } else {\n warn('props must be strings when using array syntax.');\n }\n }\n } else if (isPlainObject(props)) {\n for (var key in props) {\n val = props[key];\n name = camelize(key);\n res[name] = isPlainObject(val)\n ? val\n : { type: val };\n }\n } else {\n warn(\n \"Invalid value for option \\\"props\\\": expected an Array or an Object, \" +\n \"but got \" + (toRawType(props)) + \".\",\n vm\n );\n }\n options.props = res;\n}\n\n/**\n * Normalize all injections into Object-based format\n */\nfunction normalizeInject (options, vm) {\n var inject = options.inject;\n if (!inject) { return }\n var normalized = options.inject = {};\n if (Array.isArray(inject)) {\n for (var i = 0; i < inject.length; i++) {\n normalized[inject[i]] = { from: inject[i] };\n }\n } else if (isPlainObject(inject)) {\n for (var key in inject) {\n var val = inject[key];\n normalized[key] = isPlainObject(val)\n ? extend({ from: key }, val)\n : { from: val };\n }\n } else {\n warn(\n \"Invalid value for option \\\"inject\\\": expected an Array or an Object, \" +\n \"but got \" + (toRawType(inject)) + \".\",\n vm\n );\n }\n}\n\n/**\n * Normalize raw function directives into object format.\n */\nfunction normalizeDirectives (options) {\n var dirs = options.directives;\n if (dirs) {\n for (var key in dirs) {\n var def$$1 = dirs[key];\n if (typeof def$$1 === 'function') {\n dirs[key] = { bind: def$$1, update: def$$1 };\n }\n }\n }\n}\n\nfunction assertObjectType (name, value, vm) {\n if (!isPlainObject(value)) {\n warn(\n \"Invalid value for option \\\"\" + name + \"\\\": expected an Object, \" +\n \"but got \" + (toRawType(value)) + \".\",\n vm\n );\n }\n}\n\n/**\n * Merge two option objects into a new one.\n * Core utility used in both instantiation and inheritance.\n */\nfunction mergeOptions (\n parent,\n child,\n vm\n) {\n {\n checkComponents(child);\n }\n\n if (typeof child === 'function') {\n child = child.options;\n }\n\n normalizeProps(child, vm);\n normalizeInject(child, vm);\n normalizeDirectives(child);\n\n // Apply extends and mixins on the child options,\n // but only if it is a raw options object that isn't\n // the result of another mergeOptions call.\n // Only merged options has the _base property.\n if (!child._base) {\n if (child.extends) {\n parent = mergeOptions(parent, child.extends, vm);\n }\n if (child.mixins) {\n for (var i = 0, l = child.mixins.length; i < l; i++) {\n parent = mergeOptions(parent, child.mixins[i], vm);\n }\n }\n }\n\n var options = {};\n var key;\n for (key in parent) {\n mergeField(key);\n }\n for (key in child) {\n if (!hasOwn(parent, key)) {\n mergeField(key);\n }\n }\n function mergeField (key) {\n var strat = strats[key] || defaultStrat;\n options[key] = strat(parent[key], child[key], vm, key);\n }\n return options\n}\n\n/**\n * Resolve an asset.\n * This function is used because child instances need access\n * to assets defined in its ancestor chain.\n */\nfunction resolveAsset (\n options,\n type,\n id,\n warnMissing\n) {\n /* istanbul ignore if */\n if (typeof id !== 'string') {\n return\n }\n var assets = options[type];\n // check local registration variations first\n if (hasOwn(assets, id)) { return assets[id] }\n var camelizedId = camelize(id);\n if (hasOwn(assets, camelizedId)) { return assets[camelizedId] }\n var PascalCaseId = capitalize(camelizedId);\n if (hasOwn(assets, PascalCaseId)) { return assets[PascalCaseId] }\n // fallback to prototype chain\n var res = assets[id] || assets[camelizedId] || assets[PascalCaseId];\n if (warnMissing && !res) {\n warn(\n 'Failed to resolve ' + type.slice(0, -1) + ': ' + id,\n options\n );\n }\n return res\n}\n\n/* */\n\n\n\nfunction validateProp (\n key,\n propOptions,\n propsData,\n vm\n) {\n var prop = propOptions[key];\n var absent = !hasOwn(propsData, key);\n var value = propsData[key];\n // boolean casting\n var booleanIndex = getTypeIndex(Boolean, prop.type);\n if (booleanIndex > -1) {\n if (absent && !hasOwn(prop, 'default')) {\n value = false;\n } else if (value === '' || value === hyphenate(key)) {\n // only cast empty string / same name to boolean if\n // boolean has higher priority\n var stringIndex = getTypeIndex(String, prop.type);\n if (stringIndex < 0 || booleanIndex < stringIndex) {\n value = true;\n }\n }\n }\n // check default value\n if (value === undefined) {\n value = getPropDefaultValue(vm, prop, key);\n // since the default value is a fresh copy,\n // make sure to observe it.\n var prevShouldObserve = shouldObserve;\n toggleObserving(true);\n observe(value);\n toggleObserving(prevShouldObserve);\n }\n {\n assertProp(prop, key, value, vm, absent);\n }\n return value\n}\n\n/**\n * Get the default value of a prop.\n */\nfunction getPropDefaultValue (vm, prop, key) {\n // no default, return undefined\n if (!hasOwn(prop, 'default')) {\n return undefined\n }\n var def = prop.default;\n // warn against non-factory defaults for Object & Array\n if (isObject(def)) {\n warn(\n 'Invalid default value for prop \"' + key + '\": ' +\n 'Props with type Object/Array must use a factory function ' +\n 'to return the default value.',\n vm\n );\n }\n // the raw prop value was also undefined from previous render,\n // return previous default value to avoid unnecessary watcher trigger\n if (vm && vm.$options.propsData &&\n vm.$options.propsData[key] === undefined &&\n vm._props[key] !== undefined\n ) {\n return vm._props[key]\n }\n // call factory function for non-Function types\n // a value is Function if its prototype is function even across different execution context\n return typeof def === 'function' && getType(prop.type) !== 'Function'\n ? def.call(vm)\n : def\n}\n\n/**\n * Assert whether a prop is valid.\n */\nfunction assertProp (\n prop,\n name,\n value,\n vm,\n absent\n) {\n if (prop.required && absent) {\n warn(\n 'Missing required prop: \"' + name + '\"',\n vm\n );\n return\n }\n if (value == null && !prop.required) {\n return\n }\n var type = prop.type;\n var valid = !type || type === true;\n var expectedTypes = [];\n if (type) {\n if (!Array.isArray(type)) {\n type = [type];\n }\n for (var i = 0; i < type.length && !valid; i++) {\n var assertedType = assertType(value, type[i]);\n expectedTypes.push(assertedType.expectedType || '');\n valid = assertedType.valid;\n }\n }\n\n if (!valid) {\n warn(\n getInvalidTypeMessage(name, value, expectedTypes),\n vm\n );\n return\n }\n var validator = prop.validator;\n if (validator) {\n if (!validator(value)) {\n warn(\n 'Invalid prop: custom validator check failed for prop \"' + name + '\".',\n vm\n );\n }\n }\n}\n\nvar simpleCheckRE = /^(String|Number|Boolean|Function|Symbol)$/;\n\nfunction assertType (value, type) {\n var valid;\n var expectedType = getType(type);\n if (simpleCheckRE.test(expectedType)) {\n var t = typeof value;\n valid = t === expectedType.toLowerCase();\n // for primitive wrapper objects\n if (!valid && t === 'object') {\n valid = value instanceof type;\n }\n } else if (expectedType === 'Object') {\n valid = isPlainObject(value);\n } else if (expectedType === 'Array') {\n valid = Array.isArray(value);\n } else {\n valid = value instanceof type;\n }\n return {\n valid: valid,\n expectedType: expectedType\n }\n}\n\n/**\n * Use function string name to check built-in types,\n * because a simple equality check will fail when running\n * across different vms / iframes.\n */\nfunction getType (fn) {\n var match = fn && fn.toString().match(/^\\s*function (\\w+)/);\n return match ? match[1] : ''\n}\n\nfunction isSameType (a, b) {\n return getType(a) === getType(b)\n}\n\nfunction getTypeIndex (type, expectedTypes) {\n if (!Array.isArray(expectedTypes)) {\n return isSameType(expectedTypes, type) ? 0 : -1\n }\n for (var i = 0, len = expectedTypes.length; i < len; i++) {\n if (isSameType(expectedTypes[i], type)) {\n return i\n }\n }\n return -1\n}\n\nfunction getInvalidTypeMessage (name, value, expectedTypes) {\n var message = \"Invalid prop: type check failed for prop \\\"\" + name + \"\\\".\" +\n \" Expected \" + (expectedTypes.map(capitalize).join(', '));\n var expectedType = expectedTypes[0];\n var receivedType = toRawType(value);\n var expectedValue = styleValue(value, expectedType);\n var receivedValue = styleValue(value, receivedType);\n // check if we need to specify expected value\n if (expectedTypes.length === 1 &&\n isExplicable(expectedType) &&\n !isBoolean(expectedType, receivedType)) {\n message += \" with value \" + expectedValue;\n }\n message += \", got \" + receivedType + \" \";\n // check if we need to specify received value\n if (isExplicable(receivedType)) {\n message += \"with value \" + receivedValue + \".\";\n }\n return message\n}\n\nfunction styleValue (value, type) {\n if (type === 'String') {\n return (\"\\\"\" + value + \"\\\"\")\n } else if (type === 'Number') {\n return (\"\" + (Number(value)))\n } else {\n return (\"\" + value)\n }\n}\n\nfunction isExplicable (value) {\n var explicitTypes = ['string', 'number', 'boolean'];\n return explicitTypes.some(function (elem) { return value.toLowerCase() === elem; })\n}\n\nfunction isBoolean () {\n var args = [], len = arguments.length;\n while ( len-- ) args[ len ] = arguments[ len ];\n\n return args.some(function (elem) { return elem.toLowerCase() === 'boolean'; })\n}\n\n/* */\n\nfunction handleError (err, vm, info) {\n // Deactivate deps tracking while processing error handler to avoid possible infinite rendering.\n // See: https://github.com/vuejs/vuex/issues/1505\n pushTarget();\n try {\n if (vm) {\n var cur = vm;\n while ((cur = cur.$parent)) {\n var hooks = cur.$options.errorCaptured;\n if (hooks) {\n for (var i = 0; i < hooks.length; i++) {\n try {\n var capture = hooks[i].call(cur, err, vm, info) === false;\n if (capture) { return }\n } catch (e) {\n globalHandleError(e, cur, 'errorCaptured hook');\n }\n }\n }\n }\n }\n globalHandleError(err, vm, info);\n } finally {\n popTarget();\n }\n}\n\nfunction invokeWithErrorHandling (\n handler,\n context,\n args,\n vm,\n info\n) {\n var res;\n try {\n res = args ? handler.apply(context, args) : handler.call(context);\n if (res && !res._isVue && isPromise(res) && !res._handled) {\n res.catch(function (e) { return handleError(e, vm, info + \" (Promise/async)\"); });\n // issue #9511\n // avoid catch triggering multiple times when nested calls\n res._handled = true;\n }\n } catch (e) {\n handleError(e, vm, info);\n }\n return res\n}\n\nfunction globalHandleError (err, vm, info) {\n if (config.errorHandler) {\n try {\n return config.errorHandler.call(null, err, vm, info)\n } catch (e) {\n // if the user intentionally throws the original error in the handler,\n // do not log it twice\n if (e !== err) {\n logError(e, null, 'config.errorHandler');\n }\n }\n }\n logError(err, vm, info);\n}\n\nfunction logError (err, vm, info) {\n {\n warn((\"Error in \" + info + \": \\\"\" + (err.toString()) + \"\\\"\"), vm);\n }\n /* istanbul ignore else */\n if ((inBrowser || inWeex) && typeof console !== 'undefined') {\n console.error(err);\n } else {\n throw err\n }\n}\n\n/* */\n\nvar isUsingMicroTask = false;\n\nvar callbacks = [];\nvar pending = false;\n\nfunction flushCallbacks () {\n pending = false;\n var copies = callbacks.slice(0);\n callbacks.length = 0;\n for (var i = 0; i < copies.length; i++) {\n copies[i]();\n }\n}\n\n// Here we have async deferring wrappers using microtasks.\n// In 2.5 we used (macro) tasks (in combination with microtasks).\n// However, it has subtle problems when state is changed right before repaint\n// (e.g. #6813, out-in transitions).\n// Also, using (macro) tasks in event handler would cause some weird behaviors\n// that cannot be circumvented (e.g. #7109, #7153, #7546, #7834, #8109).\n// So we now use microtasks everywhere, again.\n// A major drawback of this tradeoff is that there are some scenarios\n// where microtasks have too high a priority and fire in between supposedly\n// sequential events (e.g. #4521, #6690, which have workarounds)\n// or even between bubbling of the same event (#6566).\nvar timerFunc;\n\n// The nextTick behavior leverages the microtask queue, which can be accessed\n// via either native Promise.then or MutationObserver.\n// MutationObserver has wider support, however it is seriously bugged in\n// UIWebView in iOS >= 9.3.3 when triggered in touch event handlers. It\n// completely stops working after triggering a few times... so, if native\n// Promise is available, we will use it:\n/* istanbul ignore next, $flow-disable-line */\nif (typeof Promise !== 'undefined' && isNative(Promise)) {\n var p = Promise.resolve();\n timerFunc = function () {\n p.then(flushCallbacks);\n // In problematic UIWebViews, Promise.then doesn't completely break, but\n // it can get stuck in a weird state where callbacks are pushed into the\n // microtask queue but the queue isn't being flushed, until the browser\n // needs to do some other work, e.g. handle a timer. Therefore we can\n // \"force\" the microtask queue to be flushed by adding an empty timer.\n if (isIOS) { setTimeout(noop); }\n };\n isUsingMicroTask = true;\n} else if (!isIE && typeof MutationObserver !== 'undefined' && (\n isNative(MutationObserver) ||\n // PhantomJS and iOS 7.x\n MutationObserver.toString() === '[object MutationObserverConstructor]'\n)) {\n // Use MutationObserver where native Promise is not available,\n // e.g. PhantomJS, iOS7, Android 4.4\n // (#6466 MutationObserver is unreliable in IE11)\n var counter = 1;\n var observer = new MutationObserver(flushCallbacks);\n var textNode = document.createTextNode(String(counter));\n observer.observe(textNode, {\n characterData: true\n });\n timerFunc = function () {\n counter = (counter + 1) % 2;\n textNode.data = String(counter);\n };\n isUsingMicroTask = true;\n} else if (typeof setImmediate !== 'undefined' && isNative(setImmediate)) {\n // Fallback to setImmediate.\n // Techinically it leverages the (macro) task queue,\n // but it is still a better choice than setTimeout.\n timerFunc = function () {\n setImmediate(flushCallbacks);\n };\n} else {\n // Fallback to setTimeout.\n timerFunc = function () {\n setTimeout(flushCallbacks, 0);\n };\n}\n\nfunction nextTick (cb, ctx) {\n var _resolve;\n callbacks.push(function () {\n if (cb) {\n try {\n cb.call(ctx);\n } catch (e) {\n handleError(e, ctx, 'nextTick');\n }\n } else if (_resolve) {\n _resolve(ctx);\n }\n });\n if (!pending) {\n pending = true;\n timerFunc();\n }\n // $flow-disable-line\n if (!cb && typeof Promise !== 'undefined') {\n return new Promise(function (resolve) {\n _resolve = resolve;\n })\n }\n}\n\n/* */\n\nvar mark;\nvar measure;\n\n{\n var perf = inBrowser && window.performance;\n /* istanbul ignore if */\n if (\n perf &&\n perf.mark &&\n perf.measure &&\n perf.clearMarks &&\n perf.clearMeasures\n ) {\n mark = function (tag) { return perf.mark(tag); };\n measure = function (name, startTag, endTag) {\n perf.measure(name, startTag, endTag);\n perf.clearMarks(startTag);\n perf.clearMarks(endTag);\n // perf.clearMeasures(name)\n };\n }\n}\n\n/* not type checking this file because flow doesn't play well with Proxy */\n\nvar initProxy;\n\n{\n var allowedGlobals = makeMap(\n 'Infinity,undefined,NaN,isFinite,isNaN,' +\n 'parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,' +\n 'Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,' +\n 'require' // for Webpack/Browserify\n );\n\n var warnNonPresent = function (target, key) {\n warn(\n \"Property or method \\\"\" + key + \"\\\" is not defined on the instance but \" +\n 'referenced during render. Make sure that this property is reactive, ' +\n 'either in the data option, or for class-based components, by ' +\n 'initializing the property. ' +\n 'See: https://vuejs.org/v2/guide/reactivity.html#Declaring-Reactive-Properties.',\n target\n );\n };\n\n var warnReservedPrefix = function (target, key) {\n warn(\n \"Property \\\"\" + key + \"\\\" must be accessed with \\\"$data.\" + key + \"\\\" because \" +\n 'properties starting with \"$\" or \"_\" are not proxied in the Vue instance to ' +\n 'prevent conflicts with Vue internals' +\n 'See: https://vuejs.org/v2/api/#data',\n target\n );\n };\n\n var hasProxy =\n typeof Proxy !== 'undefined' && isNative(Proxy);\n\n if (hasProxy) {\n var isBuiltInModifier = makeMap('stop,prevent,self,ctrl,shift,alt,meta,exact');\n config.keyCodes = new Proxy(config.keyCodes, {\n set: function set (target, key, value) {\n if (isBuiltInModifier(key)) {\n warn((\"Avoid overwriting built-in modifier in config.keyCodes: .\" + key));\n return false\n } else {\n target[key] = value;\n return true\n }\n }\n });\n }\n\n var hasHandler = {\n has: function has (target, key) {\n var has = key in target;\n var isAllowed = allowedGlobals(key) ||\n (typeof key === 'string' && key.charAt(0) === '_' && !(key in target.$data));\n if (!has && !isAllowed) {\n if (key in target.$data) { warnReservedPrefix(target, key); }\n else { warnNonPresent(target, key); }\n }\n return has || !isAllowed\n }\n };\n\n var getHandler = {\n get: function get (target, key) {\n if (typeof key === 'string' && !(key in target)) {\n if (key in target.$data) { warnReservedPrefix(target, key); }\n else { warnNonPresent(target, key); }\n }\n return target[key]\n }\n };\n\n initProxy = function initProxy (vm) {\n if (hasProxy) {\n // determine which proxy handler to use\n var options = vm.$options;\n var handlers = options.render && options.render._withStripped\n ? getHandler\n : hasHandler;\n vm._renderProxy = new Proxy(vm, handlers);\n } else {\n vm._renderProxy = vm;\n }\n };\n}\n\n/* */\n\nvar seenObjects = new _Set();\n\n/**\n * Recursively traverse an object to evoke all converted\n * getters, so that every nested property inside the object\n * is collected as a \"deep\" dependency.\n */\nfunction traverse (val) {\n _traverse(val, seenObjects);\n seenObjects.clear();\n}\n\nfunction _traverse (val, seen) {\n var i, keys;\n var isA = Array.isArray(val);\n if ((!isA && !isObject(val)) || Object.isFrozen(val) || val instanceof VNode) {\n return\n }\n if (val.__ob__) {\n var depId = val.__ob__.dep.id;\n if (seen.has(depId)) {\n return\n }\n seen.add(depId);\n }\n if (isA) {\n i = val.length;\n while (i--) { _traverse(val[i], seen); }\n } else {\n keys = Object.keys(val);\n i = keys.length;\n while (i--) { _traverse(val[keys[i]], seen); }\n }\n}\n\n/* */\n\nvar normalizeEvent = cached(function (name) {\n var passive = name.charAt(0) === '&';\n name = passive ? name.slice(1) : name;\n var once$$1 = name.charAt(0) === '~'; // Prefixed last, checked first\n name = once$$1 ? name.slice(1) : name;\n var capture = name.charAt(0) === '!';\n name = capture ? name.slice(1) : name;\n return {\n name: name,\n once: once$$1,\n capture: capture,\n passive: passive\n }\n});\n\nfunction createFnInvoker (fns, vm) {\n function invoker () {\n var arguments$1 = arguments;\n\n var fns = invoker.fns;\n if (Array.isArray(fns)) {\n var cloned = fns.slice();\n for (var i = 0; i < cloned.length; i++) {\n invokeWithErrorHandling(cloned[i], null, arguments$1, vm, \"v-on handler\");\n }\n } else {\n // return handler return value for single handlers\n return invokeWithErrorHandling(fns, null, arguments, vm, \"v-on handler\")\n }\n }\n invoker.fns = fns;\n return invoker\n}\n\nfunction updateListeners (\n on,\n oldOn,\n add,\n remove$$1,\n createOnceHandler,\n vm\n) {\n var name, def$$1, cur, old, event;\n for (name in on) {\n def$$1 = cur = on[name];\n old = oldOn[name];\n event = normalizeEvent(name);\n if (isUndef(cur)) {\n warn(\n \"Invalid handler for event \\\"\" + (event.name) + \"\\\": got \" + String(cur),\n vm\n );\n } else if (isUndef(old)) {\n if (isUndef(cur.fns)) {\n cur = on[name] = createFnInvoker(cur, vm);\n }\n if (isTrue(event.once)) {\n cur = on[name] = createOnceHandler(event.name, cur, event.capture);\n }\n add(event.name, cur, event.capture, event.passive, event.params);\n } else if (cur !== old) {\n old.fns = cur;\n on[name] = old;\n }\n }\n for (name in oldOn) {\n if (isUndef(on[name])) {\n event = normalizeEvent(name);\n remove$$1(event.name, oldOn[name], event.capture);\n }\n }\n}\n\n/* */\n\nfunction mergeVNodeHook (def, hookKey, hook) {\n if (def instanceof VNode) {\n def = def.data.hook || (def.data.hook = {});\n }\n var invoker;\n var oldHook = def[hookKey];\n\n function wrappedHook () {\n hook.apply(this, arguments);\n // important: remove merged hook to ensure it's called only once\n // and prevent memory leak\n remove(invoker.fns, wrappedHook);\n }\n\n if (isUndef(oldHook)) {\n // no existing hook\n invoker = createFnInvoker([wrappedHook]);\n } else {\n /* istanbul ignore if */\n if (isDef(oldHook.fns) && isTrue(oldHook.merged)) {\n // already a merged invoker\n invoker = oldHook;\n invoker.fns.push(wrappedHook);\n } else {\n // existing plain hook\n invoker = createFnInvoker([oldHook, wrappedHook]);\n }\n }\n\n invoker.merged = true;\n def[hookKey] = invoker;\n}\n\n/* */\n\nfunction extractPropsFromVNodeData (\n data,\n Ctor,\n tag\n) {\n // we are only extracting raw values here.\n // validation and default values are handled in the child\n // component itself.\n var propOptions = Ctor.options.props;\n if (isUndef(propOptions)) {\n return\n }\n var res = {};\n var attrs = data.attrs;\n var props = data.props;\n if (isDef(attrs) || isDef(props)) {\n for (var key in propOptions) {\n var altKey = hyphenate(key);\n {\n var keyInLowerCase = key.toLowerCase();\n if (\n key !== keyInLowerCase &&\n attrs && hasOwn(attrs, keyInLowerCase)\n ) {\n tip(\n \"Prop \\\"\" + keyInLowerCase + \"\\\" is passed to component \" +\n (formatComponentName(tag || Ctor)) + \", but the declared prop name is\" +\n \" \\\"\" + key + \"\\\". \" +\n \"Note that HTML attributes are case-insensitive and camelCased \" +\n \"props need to use their kebab-case equivalents when using in-DOM \" +\n \"templates. You should probably use \\\"\" + altKey + \"\\\" instead of \\\"\" + key + \"\\\".\"\n );\n }\n }\n checkProp(res, props, key, altKey, true) ||\n checkProp(res, attrs, key, altKey, false);\n }\n }\n return res\n}\n\nfunction checkProp (\n res,\n hash,\n key,\n altKey,\n preserve\n) {\n if (isDef(hash)) {\n if (hasOwn(hash, key)) {\n res[key] = hash[key];\n if (!preserve) {\n delete hash[key];\n }\n return true\n } else if (hasOwn(hash, altKey)) {\n res[key] = hash[altKey];\n if (!preserve) {\n delete hash[altKey];\n }\n return true\n }\n }\n return false\n}\n\n/* */\n\n// The template compiler attempts to minimize the need for normalization by\n// statically analyzing the template at compile time.\n//\n// For plain HTML markup, normalization can be completely skipped because the\n// generated render function is guaranteed to return Array<VNode>. There are\n// two cases where extra normalization is needed:\n\n// 1. When the children contains components - because a functional component\n// may return an Array instead of a single root. In this case, just a simple\n// normalization is needed - if any child is an Array, we flatten the whole\n// thing with Array.prototype.concat. It is guaranteed to be only 1-level deep\n// because functional components already normalize their own children.\nfunction simpleNormalizeChildren (children) {\n for (var i = 0; i < children.length; i++) {\n if (Array.isArray(children[i])) {\n return Array.prototype.concat.apply([], children)\n }\n }\n return children\n}\n\n// 2. When the children contains constructs that always generated nested Arrays,\n// e.g. <template>, <slot>, v-for, or when the children is provided by user\n// with hand-written render functions / JSX. In such cases a full normalization\n// is needed to cater to all possible types of children values.\nfunction normalizeChildren (children) {\n return isPrimitive(children)\n ? [createTextVNode(children)]\n : Array.isArray(children)\n ? normalizeArrayChildren(children)\n : undefined\n}\n\nfunction isTextNode (node) {\n return isDef(node) && isDef(node.text) && isFalse(node.isComment)\n}\n\nfunction normalizeArrayChildren (children, nestedIndex) {\n var res = [];\n var i, c, lastIndex, last;\n for (i = 0; i < children.length; i++) {\n c = children[i];\n if (isUndef(c) || typeof c === 'boolean') { continue }\n lastIndex = res.length - 1;\n last = res[lastIndex];\n // nested\n if (Array.isArray(c)) {\n if (c.length > 0) {\n c = normalizeArrayChildren(c, ((nestedIndex || '') + \"_\" + i));\n // merge adjacent text nodes\n if (isTextNode(c[0]) && isTextNode(last)) {\n res[lastIndex] = createTextVNode(last.text + (c[0]).text);\n c.shift();\n }\n res.push.apply(res, c);\n }\n } else if (isPrimitive(c)) {\n if (isTextNode(last)) {\n // merge adjacent text nodes\n // this is necessary for SSR hydration because text nodes are\n // essentially merged when rendered to HTML strings\n res[lastIndex] = createTextVNode(last.text + c);\n } else if (c !== '') {\n // convert primitive to vnode\n res.push(createTextVNode(c));\n }\n } else {\n if (isTextNode(c) && isTextNode(last)) {\n // merge adjacent text nodes\n res[lastIndex] = createTextVNode(last.text + c.text);\n } else {\n // default key for nested array children (likely generated by v-for)\n if (isTrue(children._isVList) &&\n isDef(c.tag) &&\n isUndef(c.key) &&\n isDef(nestedIndex)) {\n c.key = \"__vlist\" + nestedIndex + \"_\" + i + \"__\";\n }\n res.push(c);\n }\n }\n }\n return res\n}\n\n/* */\n\nfunction initProvide (vm) {\n var provide = vm.$options.provide;\n if (provide) {\n vm._provided = typeof provide === 'function'\n ? provide.call(vm)\n : provide;\n }\n}\n\nfunction initInjections (vm) {\n var result = resolveInject(vm.$options.inject, vm);\n if (result) {\n toggleObserving(false);\n Object.keys(result).forEach(function (key) {\n /* istanbul ignore else */\n {\n defineReactive$$1(vm, key, result[key], function () {\n warn(\n \"Avoid mutating an injected value directly since the changes will be \" +\n \"overwritten whenever the provided component re-renders. \" +\n \"injection being mutated: \\\"\" + key + \"\\\"\",\n vm\n );\n });\n }\n });\n toggleObserving(true);\n }\n}\n\nfunction resolveInject (inject, vm) {\n if (inject) {\n // inject is :any because flow is not smart enough to figure out cached\n var result = Object.create(null);\n var keys = hasSymbol\n ? Reflect.ownKeys(inject)\n : Object.keys(inject);\n\n for (var i = 0; i < keys.length; i++) {\n var key = keys[i];\n // #6574 in case the inject object is observed...\n if (key === '__ob__') { continue }\n var provideKey = inject[key].from;\n var source = vm;\n while (source) {\n if (source._provided && hasOwn(source._provided, provideKey)) {\n result[key] = source._provided[provideKey];\n break\n }\n source = source.$parent;\n }\n if (!source) {\n if ('default' in inject[key]) {\n var provideDefault = inject[key].default;\n result[key] = typeof provideDefault === 'function'\n ? provideDefault.call(vm)\n : provideDefault;\n } else {\n warn((\"Injection \\\"\" + key + \"\\\" not found\"), vm);\n }\n }\n }\n return result\n }\n}\n\n/* */\n\n\n\n/**\n * Runtime helper for resolving raw children VNodes into a slot object.\n */\nfunction resolveSlots (\n children,\n context\n) {\n if (!children || !children.length) {\n return {}\n }\n var slots = {};\n for (var i = 0, l = children.length; i < l; i++) {\n var child = children[i];\n var data = child.data;\n // remove slot attribute if the node is resolved as a Vue slot node\n if (data && data.attrs && data.attrs.slot) {\n delete data.attrs.slot;\n }\n // named slots should only be respected if the vnode was rendered in the\n // same context.\n if ((child.context === context || child.fnContext === context) &&\n data && data.slot != null\n ) {\n var name = data.slot;\n var slot = (slots[name] || (slots[name] = []));\n if (child.tag === 'template') {\n slot.push.apply(slot, child.children || []);\n } else {\n slot.push(child);\n }\n } else {\n (slots.default || (slots.default = [])).push(child);\n }\n }\n // ignore slots that contains only whitespace\n for (var name$1 in slots) {\n if (slots[name$1].every(isWhitespace)) {\n delete slots[name$1];\n }\n }\n return slots\n}\n\nfunction isWhitespace (node) {\n return (node.isComment && !node.asyncFactory) || node.text === ' '\n}\n\n/* */\n\nfunction normalizeScopedSlots (\n slots,\n normalSlots,\n prevSlots\n) {\n var res;\n var hasNormalSlots = Object.keys(normalSlots).length > 0;\n var isStable = slots ? !!slots.$stable : !hasNormalSlots;\n var key = slots && slots.$key;\n if (!slots) {\n res = {};\n } else if (slots._normalized) {\n // fast path 1: child component re-render only, parent did not change\n return slots._normalized\n } else if (\n isStable &&\n prevSlots &&\n prevSlots !== emptyObject &&\n key === prevSlots.$key &&\n !hasNormalSlots &&\n !prevSlots.$hasNormal\n ) {\n // fast path 2: stable scoped slots w/ no normal slots to proxy,\n // only need to normalize once\n return prevSlots\n } else {\n res = {};\n for (var key$1 in slots) {\n if (slots[key$1] && key$1[0] !== '$') {\n res[key$1] = normalizeScopedSlot(normalSlots, key$1, slots[key$1]);\n }\n }\n }\n // expose normal slots on scopedSlots\n for (var key$2 in normalSlots) {\n if (!(key$2 in res)) {\n res[key$2] = proxyNormalSlot(normalSlots, key$2);\n }\n }\n // avoriaz seems to mock a non-extensible $scopedSlots object\n // and when that is passed down this would cause an error\n if (slots && Object.isExtensible(slots)) {\n (slots)._normalized = res;\n }\n def(res, '$stable', isStable);\n def(res, '$key', key);\n def(res, '$hasNormal', hasNormalSlots);\n return res\n}\n\nfunction normalizeScopedSlot(normalSlots, key, fn) {\n var normalized = function () {\n var res = arguments.length ? fn.apply(null, arguments) : fn({});\n res = res && typeof res === 'object' && !Array.isArray(res)\n ? [res] // single vnode\n : normalizeChildren(res);\n return res && (\n res.length === 0 ||\n (res.length === 1 && res[0].isComment) // #9658\n ) ? undefined\n : res\n };\n // this is a slot using the new v-slot syntax without scope. although it is\n // compiled as a scoped slot, render fn users would expect it to be present\n // on this.$slots because the usage is semantically a normal slot.\n if (fn.proxy) {\n Object.defineProperty(normalSlots, key, {\n get: normalized,\n enumerable: true,\n configurable: true\n });\n }\n return normalized\n}\n\nfunction proxyNormalSlot(slots, key) {\n return function () { return slots[key]; }\n}\n\n/* */\n\n/**\n * Runtime helper for rendering v-for lists.\n */\nfunction renderList (\n val,\n render\n) {\n var ret, i, l, keys, key;\n if (Array.isArray(val) || typeof val === 'string') {\n ret = new Array(val.length);\n for (i = 0, l = val.length; i < l; i++) {\n ret[i] = render(val[i], i);\n }\n } else if (typeof val === 'number') {\n ret = new Array(val);\n for (i = 0; i < val; i++) {\n ret[i] = render(i + 1, i);\n }\n } else if (isObject(val)) {\n if (hasSymbol && val[Symbol.iterator]) {\n ret = [];\n var iterator = val[Symbol.iterator]();\n var result = iterator.next();\n while (!result.done) {\n ret.push(render(result.value, ret.length));\n result = iterator.next();\n }\n } else {\n keys = Object.keys(val);\n ret = new Array(keys.length);\n for (i = 0, l = keys.length; i < l; i++) {\n key = keys[i];\n ret[i] = render(val[key], key, i);\n }\n }\n }\n if (!isDef(ret)) {\n ret = [];\n }\n (ret)._isVList = true;\n return ret\n}\n\n/* */\n\n/**\n * Runtime helper for rendering <slot>\n */\nfunction renderSlot (\n name,\n fallback,\n props,\n bindObject\n) {\n var scopedSlotFn = this.$scopedSlots[name];\n var nodes;\n if (scopedSlotFn) { // scoped slot\n props = props || {};\n if (bindObject) {\n if (!isObject(bindObject)) {\n warn(\n 'slot v-bind without argument expects an Object',\n this\n );\n }\n props = extend(extend({}, bindObject), props);\n }\n nodes = scopedSlotFn(props) || fallback;\n } else {\n nodes = this.$slots[name] || fallback;\n }\n\n var target = props && props.slot;\n if (target) {\n return this.$createElement('template', { slot: target }, nodes)\n } else {\n return nodes\n }\n}\n\n/* */\n\n/**\n * Runtime helper for resolving filters\n */\nfunction resolveFilter (id) {\n return resolveAsset(this.$options, 'filters', id, true) || identity\n}\n\n/* */\n\nfunction isKeyNotMatch (expect, actual) {\n if (Array.isArray(expect)) {\n return expect.indexOf(actual) === -1\n } else {\n return expect !== actual\n }\n}\n\n/**\n * Runtime helper for checking keyCodes from config.\n * exposed as Vue.prototype._k\n * passing in eventKeyName as last argument separately for backwards compat\n */\nfunction checkKeyCodes (\n eventKeyCode,\n key,\n builtInKeyCode,\n eventKeyName,\n builtInKeyName\n) {\n var mappedKeyCode = config.keyCodes[key] || builtInKeyCode;\n if (builtInKeyName && eventKeyName && !config.keyCodes[key]) {\n return isKeyNotMatch(builtInKeyName, eventKeyName)\n } else if (mappedKeyCode) {\n return isKeyNotMatch(mappedKeyCode, eventKeyCode)\n } else if (eventKeyName) {\n return hyphenate(eventKeyName) !== key\n }\n}\n\n/* */\n\n/**\n * Runtime helper for merging v-bind=\"object\" into a VNode's data.\n */\nfunction bindObjectProps (\n data,\n tag,\n value,\n asProp,\n isSync\n) {\n if (value) {\n if (!isObject(value)) {\n warn(\n 'v-bind without argument expects an Object or Array value',\n this\n );\n } else {\n if (Array.isArray(value)) {\n value = toObject(value);\n }\n var hash;\n var loop = function ( key ) {\n if (\n key === 'class' ||\n key === 'style' ||\n isReservedAttribute(key)\n ) {\n hash = data;\n } else {\n var type = data.attrs && data.attrs.type;\n hash = asProp || config.mustUseProp(tag, type, key)\n ? data.domProps || (data.domProps = {})\n : data.attrs || (data.attrs = {});\n }\n var camelizedKey = camelize(key);\n var hyphenatedKey = hyphenate(key);\n if (!(camelizedKey in hash) && !(hyphenatedKey in hash)) {\n hash[key] = value[key];\n\n if (isSync) {\n var on = data.on || (data.on = {});\n on[(\"update:\" + key)] = function ($event) {\n value[key] = $event;\n };\n }\n }\n };\n\n for (var key in value) loop( key );\n }\n }\n return data\n}\n\n/* */\n\n/**\n * Runtime helper for rendering static trees.\n */\nfunction renderStatic (\n index,\n isInFor\n) {\n var cached = this._staticTrees || (this._staticTrees = []);\n var tree = cached[index];\n // if has already-rendered static tree and not inside v-for,\n // we can reuse the same tree.\n if (tree && !isInFor) {\n return tree\n }\n // otherwise, render a fresh tree.\n tree = cached[index] = this.$options.staticRenderFns[index].call(\n this._renderProxy,\n null,\n this // for render fns generated for functional component templates\n );\n markStatic(tree, (\"__static__\" + index), false);\n return tree\n}\n\n/**\n * Runtime helper for v-once.\n * Effectively it means marking the node as static with a unique key.\n */\nfunction markOnce (\n tree,\n index,\n key\n) {\n markStatic(tree, (\"__once__\" + index + (key ? (\"_\" + key) : \"\")), true);\n return tree\n}\n\nfunction markStatic (\n tree,\n key,\n isOnce\n) {\n if (Array.isArray(tree)) {\n for (var i = 0; i < tree.length; i++) {\n if (tree[i] && typeof tree[i] !== 'string') {\n markStaticNode(tree[i], (key + \"_\" + i), isOnce);\n }\n }\n } else {\n markStaticNode(tree, key, isOnce);\n }\n}\n\nfunction markStaticNode (node, key, isOnce) {\n node.isStatic = true;\n node.key = key;\n node.isOnce = isOnce;\n}\n\n/* */\n\nfunction bindObjectListeners (data, value) {\n if (value) {\n if (!isPlainObject(value)) {\n warn(\n 'v-on without argument expects an Object value',\n this\n );\n } else {\n var on = data.on = data.on ? extend({}, data.on) : {};\n for (var key in value) {\n var existing = on[key];\n var ours = value[key];\n on[key] = existing ? [].concat(existing, ours) : ours;\n }\n }\n }\n return data\n}\n\n/* */\n\nfunction resolveScopedSlots (\n fns, // see flow/vnode\n res,\n // the following are added in 2.6\n hasDynamicKeys,\n contentHashKey\n) {\n res = res || { $stable: !hasDynamicKeys };\n for (var i = 0; i < fns.length; i++) {\n var slot = fns[i];\n if (Array.isArray(slot)) {\n resolveScopedSlots(slot, res, hasDynamicKeys);\n } else if (slot) {\n // marker for reverse proxying v-slot without scope on this.$slots\n if (slot.proxy) {\n slot.fn.proxy = true;\n }\n res[slot.key] = slot.fn;\n }\n }\n if (contentHashKey) {\n (res).$key = contentHashKey;\n }\n return res\n}\n\n/* */\n\nfunction bindDynamicKeys (baseObj, values) {\n for (var i = 0; i < values.length; i += 2) {\n var key = values[i];\n if (typeof key === 'string' && key) {\n baseObj[values[i]] = values[i + 1];\n } else if (key !== '' && key !== null) {\n // null is a speical value for explicitly removing a binding\n warn(\n (\"Invalid value for dynamic directive argument (expected string or null): \" + key),\n this\n );\n }\n }\n return baseObj\n}\n\n// helper to dynamically append modifier runtime markers to event names.\n// ensure only append when value is already string, otherwise it will be cast\n// to string and cause the type check to miss.\nfunction prependModifier (value, symbol) {\n return typeof value === 'string' ? symbol + value : value\n}\n\n/* */\n\nfunction installRenderHelpers (target) {\n target._o = markOnce;\n target._n = toNumber;\n target._s = toString;\n target._l = renderList;\n target._t = renderSlot;\n target._q = looseEqual;\n target._i = looseIndexOf;\n target._m = renderStatic;\n target._f = resolveFilter;\n target._k = checkKeyCodes;\n target._b = bindObjectProps;\n target._v = createTextVNode;\n target._e = createEmptyVNode;\n target._u = resolveScopedSlots;\n target._g = bindObjectListeners;\n target._d = bindDynamicKeys;\n target._p = prependModifier;\n}\n\n/* */\n\nfunction FunctionalRenderContext (\n data,\n props,\n children,\n parent,\n Ctor\n) {\n var this$1 = this;\n\n var options = Ctor.options;\n // ensure the createElement function in functional components\n // gets a unique context - this is necessary for correct named slot check\n var contextVm;\n if (hasOwn(parent, '_uid')) {\n contextVm = Object.create(parent);\n // $flow-disable-line\n contextVm._original = parent;\n } else {\n // the context vm passed in is a functional context as well.\n // in this case we want to make sure we are able to get a hold to the\n // real context instance.\n contextVm = parent;\n // $flow-disable-line\n parent = parent._original;\n }\n var isCompiled = isTrue(options._compiled);\n var needNormalization = !isCompiled;\n\n this.data = data;\n this.props = props;\n this.children = children;\n this.parent = parent;\n this.listeners = data.on || emptyObject;\n this.injections = resolveInject(options.inject, parent);\n this.slots = function () {\n if (!this$1.$slots) {\n normalizeScopedSlots(\n data.scopedSlots,\n this$1.$slots = resolveSlots(children, parent)\n );\n }\n return this$1.$slots\n };\n\n Object.defineProperty(this, 'scopedSlots', ({\n enumerable: true,\n get: function get () {\n return normalizeScopedSlots(data.scopedSlots, this.slots())\n }\n }));\n\n // support for compiled functional template\n if (isCompiled) {\n // exposing $options for renderStatic()\n this.$options = options;\n // pre-resolve slots for renderSlot()\n this.$slots = this.slots();\n this.$scopedSlots = normalizeScopedSlots(data.scopedSlots, this.$slots);\n }\n\n if (options._scopeId) {\n this._c = function (a, b, c, d) {\n var vnode = createElement(contextVm, a, b, c, d, needNormalization);\n if (vnode && !Array.isArray(vnode)) {\n vnode.fnScopeId = options._scopeId;\n vnode.fnContext = parent;\n }\n return vnode\n };\n } else {\n this._c = function (a, b, c, d) { return createElement(contextVm, a, b, c, d, needNormalization); };\n }\n}\n\ninstallRenderHelpers(FunctionalRenderContext.prototype);\n\nfunction createFunctionalComponent (\n Ctor,\n propsData,\n data,\n contextVm,\n children\n) {\n var options = Ctor.options;\n var props = {};\n var propOptions = options.props;\n if (isDef(propOptions)) {\n for (var key in propOptions) {\n props[key] = validateProp(key, propOptions, propsData || emptyObject);\n }\n } else {\n if (isDef(data.attrs)) { mergeProps(props, data.attrs); }\n if (isDef(data.props)) { mergeProps(props, data.props); }\n }\n\n var renderContext = new FunctionalRenderContext(\n data,\n props,\n children,\n contextVm,\n Ctor\n );\n\n var vnode = options.render.call(null, renderContext._c, renderContext);\n\n if (vnode instanceof VNode) {\n return cloneAndMarkFunctionalResult(vnode, data, renderContext.parent, options, renderContext)\n } else if (Array.isArray(vnode)) {\n var vnodes = normalizeChildren(vnode) || [];\n var res = new Array(vnodes.length);\n for (var i = 0; i < vnodes.length; i++) {\n res[i] = cloneAndMarkFunctionalResult(vnodes[i], data, renderContext.parent, options, renderContext);\n }\n return res\n }\n}\n\nfunction cloneAndMarkFunctionalResult (vnode, data, contextVm, options, renderContext) {\n // #7817 clone node before setting fnContext, otherwise if the node is reused\n // (e.g. it was from a cached normal slot) the fnContext causes named slots\n // that should not be matched to match.\n var clone = cloneVNode(vnode);\n clone.fnContext = contextVm;\n clone.fnOptions = options;\n {\n (clone.devtoolsMeta = clone.devtoolsMeta || {}).renderContext = renderContext;\n }\n if (data.slot) {\n (clone.data || (clone.data = {})).slot = data.slot;\n }\n return clone\n}\n\nfunction mergeProps (to, from) {\n for (var key in from) {\n to[camelize(key)] = from[key];\n }\n}\n\n/* */\n\n/* */\n\n/* */\n\n/* */\n\n// inline hooks to be invoked on component VNodes during patch\nvar componentVNodeHooks = {\n init: function init (vnode, hydrating) {\n if (\n vnode.componentInstance &&\n !vnode.componentInstance._isDestroyed &&\n vnode.data.keepAlive\n ) {\n // kept-alive components, treat as a patch\n var mountedNode = vnode; // work around flow\n componentVNodeHooks.prepatch(mountedNode, mountedNode);\n } else {\n var child = vnode.componentInstance = createComponentInstanceForVnode(\n vnode,\n activeInstance\n );\n child.$mount(hydrating ? vnode.elm : undefined, hydrating);\n }\n },\n\n prepatch: function prepatch (oldVnode, vnode) {\n var options = vnode.componentOptions;\n var child = vnode.componentInstance = oldVnode.componentInstance;\n updateChildComponent(\n child,\n options.propsData, // updated props\n options.listeners, // updated listeners\n vnode, // new parent vnode\n options.children // new children\n );\n },\n\n insert: function insert (vnode) {\n var context = vnode.context;\n var componentInstance = vnode.componentInstance;\n if (!componentInstance._isMounted) {\n componentInstance._isMounted = true;\n callHook(componentInstance, 'mounted');\n }\n if (vnode.data.keepAlive) {\n if (context._isMounted) {\n // vue-router#1212\n // During updates, a kept-alive component's child components may\n // change, so directly walking the tree here may call activated hooks\n // on incorrect children. Instead we push them into a queue which will\n // be processed after the whole patch process ended.\n queueActivatedComponent(componentInstance);\n } else {\n activateChildComponent(componentInstance, true /* direct */);\n }\n }\n },\n\n destroy: function destroy (vnode) {\n var componentInstance = vnode.componentInstance;\n if (!componentInstance._isDestroyed) {\n if (!vnode.data.keepAlive) {\n componentInstance.$destroy();\n } else {\n deactivateChildComponent(componentInstance, true /* direct */);\n }\n }\n }\n};\n\nvar hooksToMerge = Object.keys(componentVNodeHooks);\n\nfunction createComponent (\n Ctor,\n data,\n context,\n children,\n tag\n) {\n if (isUndef(Ctor)) {\n return\n }\n\n var baseCtor = context.$options._base;\n\n // plain options object: turn it into a constructor\n if (isObject(Ctor)) {\n Ctor = baseCtor.extend(Ctor);\n }\n\n // if at this stage it's not a constructor or an async component factory,\n // reject.\n if (typeof Ctor !== 'function') {\n {\n warn((\"Invalid Component definition: \" + (String(Ctor))), context);\n }\n return\n }\n\n // async component\n var asyncFactory;\n if (isUndef(Ctor.cid)) {\n asyncFactory = Ctor;\n Ctor = resolveAsyncComponent(asyncFactory, baseCtor);\n if (Ctor === undefined) {\n // return a placeholder node for async component, which is rendered\n // as a comment node but preserves all the raw information for the node.\n // the information will be used for async server-rendering and hydration.\n return createAsyncPlaceholder(\n asyncFactory,\n data,\n context,\n children,\n tag\n )\n }\n }\n\n data = data || {};\n\n // resolve constructor options in case global mixins are applied after\n // component constructor creation\n resolveConstructorOptions(Ctor);\n\n // transform component v-model data into props & events\n if (isDef(data.model)) {\n transformModel(Ctor.options, data);\n }\n\n // extract props\n var propsData = extractPropsFromVNodeData(data, Ctor, tag);\n\n // functional component\n if (isTrue(Ctor.options.functional)) {\n return createFunctionalComponent(Ctor, propsData, data, context, children)\n }\n\n // extract listeners, since these needs to be treated as\n // child component listeners instead of DOM listeners\n var listeners = data.on;\n // replace with listeners with .native modifier\n // so it gets processed during parent component patch.\n data.on = data.nativeOn;\n\n if (isTrue(Ctor.options.abstract)) {\n // abstract components do not keep anything\n // other than props & listeners & slot\n\n // work around flow\n var slot = data.slot;\n data = {};\n if (slot) {\n data.slot = slot;\n }\n }\n\n // install component management hooks onto the placeholder node\n installComponentHooks(data);\n\n // return a placeholder vnode\n var name = Ctor.options.name || tag;\n var vnode = new VNode(\n (\"vue-component-\" + (Ctor.cid) + (name ? (\"-\" + name) : '')),\n data, undefined, undefined, undefined, context,\n { Ctor: Ctor, propsData: propsData, listeners: listeners, tag: tag, children: children },\n asyncFactory\n );\n\n return vnode\n}\n\nfunction createComponentInstanceForVnode (\n vnode, // we know it's MountedComponentVNode but flow doesn't\n parent // activeInstance in lifecycle state\n) {\n var options = {\n _isComponent: true,\n _parentVnode: vnode,\n parent: parent\n };\n // check inline-template render functions\n var inlineTemplate = vnode.data.inlineTemplate;\n if (isDef(inlineTemplate)) {\n options.render = inlineTemplate.render;\n options.staticRenderFns = inlineTemplate.staticRenderFns;\n }\n return new vnode.componentOptions.Ctor(options)\n}\n\nfunction installComponentHooks (data) {\n var hooks = data.hook || (data.hook = {});\n for (var i = 0; i < hooksToMerge.length; i++) {\n var key = hooksToMerge[i];\n var existing = hooks[key];\n var toMerge = componentVNodeHooks[key];\n if (existing !== toMerge && !(existing && existing._merged)) {\n hooks[key] = existing ? mergeHook$1(toMerge, existing) : toMerge;\n }\n }\n}\n\nfunction mergeHook$1 (f1, f2) {\n var merged = function (a, b) {\n // flow complains about extra args which is why we use any\n f1(a, b);\n f2(a, b);\n };\n merged._merged = true;\n return merged\n}\n\n// transform component v-model info (value and callback) into\n// prop and event handler respectively.\nfunction transformModel (options, data) {\n var prop = (options.model && options.model.prop) || 'value';\n var event = (options.model && options.model.event) || 'input'\n ;(data.attrs || (data.attrs = {}))[prop] = data.model.value;\n var on = data.on || (data.on = {});\n var existing = on[event];\n var callback = data.model.callback;\n if (isDef(existing)) {\n if (\n Array.isArray(existing)\n ? existing.indexOf(callback) === -1\n : existing !== callback\n ) {\n on[event] = [callback].concat(existing);\n }\n } else {\n on[event] = callback;\n }\n}\n\n/* */\n\nvar SIMPLE_NORMALIZE = 1;\nvar ALWAYS_NORMALIZE = 2;\n\n// wrapper function for providing a more flexible interface\n// without getting yelled at by flow\nfunction createElement (\n context,\n tag,\n data,\n children,\n normalizationType,\n alwaysNormalize\n) {\n if (Array.isArray(data) || isPrimitive(data)) {\n normalizationType = children;\n children = data;\n data = undefined;\n }\n if (isTrue(alwaysNormalize)) {\n normalizationType = ALWAYS_NORMALIZE;\n }\n return _createElement(context, tag, data, children, normalizationType)\n}\n\nfunction _createElement (\n context,\n tag,\n data,\n children,\n normalizationType\n) {\n if (isDef(data) && isDef((data).__ob__)) {\n warn(\n \"Avoid using observed data object as vnode data: \" + (JSON.stringify(data)) + \"\\n\" +\n 'Always create fresh vnode data objects in each render!',\n context\n );\n return createEmptyVNode()\n }\n // object syntax in v-bind\n if (isDef(data) && isDef(data.is)) {\n tag = data.is;\n }\n if (!tag) {\n // in case of component :is set to falsy value\n return createEmptyVNode()\n }\n // warn against non-primitive key\n if (isDef(data) && isDef(data.key) && !isPrimitive(data.key)\n ) {\n {\n warn(\n 'Avoid using non-primitive value as key, ' +\n 'use string/number value instead.',\n context\n );\n }\n }\n // support single function children as default scoped slot\n if (Array.isArray(children) &&\n typeof children[0] === 'function'\n ) {\n data = data || {};\n data.scopedSlots = { default: children[0] };\n children.length = 0;\n }\n if (normalizationType === ALWAYS_NORMALIZE) {\n children = normalizeChildren(children);\n } else if (normalizationType === SIMPLE_NORMALIZE) {\n children = simpleNormalizeChildren(children);\n }\n var vnode, ns;\n if (typeof tag === 'string') {\n var Ctor;\n ns = (context.$vnode && context.$vnode.ns) || config.getTagNamespace(tag);\n if (config.isReservedTag(tag)) {\n // platform built-in elements\n vnode = new VNode(\n config.parsePlatformTagName(tag), data, children,\n undefined, undefined, context\n );\n } else if ((!data || !data.pre) && isDef(Ctor = resolveAsset(context.$options, 'components', tag))) {\n // component\n vnode = createComponent(Ctor, data, context, children, tag);\n } else {\n // unknown or unlisted namespaced elements\n // check at runtime because it may get assigned a namespace when its\n // parent normalizes children\n vnode = new VNode(\n tag, data, children,\n undefined, undefined, context\n );\n }\n } else {\n // direct component options / constructor\n vnode = createComponent(tag, data, context, children);\n }\n if (Array.isArray(vnode)) {\n return vnode\n } else if (isDef(vnode)) {\n if (isDef(ns)) { applyNS(vnode, ns); }\n if (isDef(data)) { registerDeepBindings(data); }\n return vnode\n } else {\n return createEmptyVNode()\n }\n}\n\nfunction applyNS (vnode, ns, force) {\n vnode.ns = ns;\n if (vnode.tag === 'foreignObject') {\n // use default namespace inside foreignObject\n ns = undefined;\n force = true;\n }\n if (isDef(vnode.children)) {\n for (var i = 0, l = vnode.children.length; i < l; i++) {\n var child = vnode.children[i];\n if (isDef(child.tag) && (\n isUndef(child.ns) || (isTrue(force) && child.tag !== 'svg'))) {\n applyNS(child, ns, force);\n }\n }\n }\n}\n\n// ref #5318\n// necessary to ensure parent re-render when deep bindings like :style and\n// :class are used on slot nodes\nfunction registerDeepBindings (data) {\n if (isObject(data.style)) {\n traverse(data.style);\n }\n if (isObject(data.class)) {\n traverse(data.class);\n }\n}\n\n/* */\n\nfunction initRender (vm) {\n vm._vnode = null; // the root of the child tree\n vm._staticTrees = null; // v-once cached trees\n var options = vm.$options;\n var parentVnode = vm.$vnode = options._parentVnode; // the placeholder node in parent tree\n var renderContext = parentVnode && parentVnode.context;\n vm.$slots = resolveSlots(options._renderChildren, renderContext);\n vm.$scopedSlots = emptyObject;\n // bind the createElement fn to this instance\n // so that we get proper render context inside it.\n // args order: tag, data, children, normalizationType, alwaysNormalize\n // internal version is used by render functions compiled from templates\n vm._c = function (a, b, c, d) { return createElement(vm, a, b, c, d, false); };\n // normalization is always applied for the public version, used in\n // user-written render functions.\n vm.$createElement = function (a, b, c, d) { return createElement(vm, a, b, c, d, true); };\n\n // $attrs & $listeners are exposed for easier HOC creation.\n // they need to be reactive so that HOCs using them are always updated\n var parentData = parentVnode && parentVnode.data;\n\n /* istanbul ignore else */\n {\n defineReactive$$1(vm, '$attrs', parentData && parentData.attrs || emptyObject, function () {\n !isUpdatingChildComponent && warn(\"$attrs is readonly.\", vm);\n }, true);\n defineReactive$$1(vm, '$listeners', options._parentListeners || emptyObject, function () {\n !isUpdatingChildComponent && warn(\"$listeners is readonly.\", vm);\n }, true);\n }\n}\n\nvar currentRenderingInstance = null;\n\nfunction renderMixin (Vue) {\n // install runtime convenience helpers\n installRenderHelpers(Vue.prototype);\n\n Vue.prototype.$nextTick = function (fn) {\n return nextTick(fn, this)\n };\n\n Vue.prototype._render = function () {\n var vm = this;\n var ref = vm.$options;\n var render = ref.render;\n var _parentVnode = ref._parentVnode;\n\n if (_parentVnode) {\n vm.$scopedSlots = normalizeScopedSlots(\n _parentVnode.data.scopedSlots,\n vm.$slots,\n vm.$scopedSlots\n );\n }\n\n // set parent vnode. this allows render functions to have access\n // to the data on the placeholder node.\n vm.$vnode = _parentVnode;\n // render self\n var vnode;\n try {\n // There's no need to maintain a stack becaues all render fns are called\n // separately from one another. Nested component's render fns are called\n // when parent component is patched.\n currentRenderingInstance = vm;\n vnode = render.call(vm._renderProxy, vm.$createElement);\n } catch (e) {\n handleError(e, vm, \"render\");\n // return error render result,\n // or previous vnode to prevent render error causing blank component\n /* istanbul ignore else */\n if (vm.$options.renderError) {\n try {\n vnode = vm.$options.renderError.call(vm._renderProxy, vm.$createElement, e);\n } catch (e) {\n handleError(e, vm, \"renderError\");\n vnode = vm._vnode;\n }\n } else {\n vnode = vm._vnode;\n }\n } finally {\n currentRenderingInstance = null;\n }\n // if the returned array contains only a single node, allow it\n if (Array.isArray(vnode) && vnode.length === 1) {\n vnode = vnode[0];\n }\n // return empty vnode in case the render function errored out\n if (!(vnode instanceof VNode)) {\n if (Array.isArray(vnode)) {\n warn(\n 'Multiple root nodes returned from render function. Render function ' +\n 'should return a single root node.',\n vm\n );\n }\n vnode = createEmptyVNode();\n }\n // set parent\n vnode.parent = _parentVnode;\n return vnode\n };\n}\n\n/* */\n\nfunction ensureCtor (comp, base) {\n if (\n comp.__esModule ||\n (hasSymbol && comp[Symbol.toStringTag] === 'Module')\n ) {\n comp = comp.default;\n }\n return isObject(comp)\n ? base.extend(comp)\n : comp\n}\n\nfunction createAsyncPlaceholder (\n factory,\n data,\n context,\n children,\n tag\n) {\n var node = createEmptyVNode();\n node.asyncFactory = factory;\n node.asyncMeta = { data: data, context: context, children: children, tag: tag };\n return node\n}\n\nfunction resolveAsyncComponent (\n factory,\n baseCtor\n) {\n if (isTrue(factory.error) && isDef(factory.errorComp)) {\n return factory.errorComp\n }\n\n if (isDef(factory.resolved)) {\n return factory.resolved\n }\n\n var owner = currentRenderingInstance;\n if (owner && isDef(factory.owners) && factory.owners.indexOf(owner) === -1) {\n // already pending\n factory.owners.push(owner);\n }\n\n if (isTrue(factory.loading) && isDef(factory.loadingComp)) {\n return factory.loadingComp\n }\n\n if (owner && !isDef(factory.owners)) {\n var owners = factory.owners = [owner];\n var sync = true;\n var timerLoading = null;\n var timerTimeout = null\n\n ;(owner).$on('hook:destroyed', function () { return remove(owners, owner); });\n\n var forceRender = function (renderCompleted) {\n for (var i = 0, l = owners.length; i < l; i++) {\n (owners[i]).$forceUpdate();\n }\n\n if (renderCompleted) {\n owners.length = 0;\n if (timerLoading !== null) {\n clearTimeout(timerLoading);\n timerLoading = null;\n }\n if (timerTimeout !== null) {\n clearTimeout(timerTimeout);\n timerTimeout = null;\n }\n }\n };\n\n var resolve = once(function (res) {\n // cache resolved\n factory.resolved = ensureCtor(res, baseCtor);\n // invoke callbacks only if this is not a synchronous resolve\n // (async resolves are shimmed as synchronous during SSR)\n if (!sync) {\n forceRender(true);\n } else {\n owners.length = 0;\n }\n });\n\n var reject = once(function (reason) {\n warn(\n \"Failed to resolve async component: \" + (String(factory)) +\n (reason ? (\"\\nReason: \" + reason) : '')\n );\n if (isDef(factory.errorComp)) {\n factory.error = true;\n forceRender(true);\n }\n });\n\n var res = factory(resolve, reject);\n\n if (isObject(res)) {\n if (isPromise(res)) {\n // () => Promise\n if (isUndef(factory.resolved)) {\n res.then(resolve, reject);\n }\n } else if (isPromise(res.component)) {\n res.component.then(resolve, reject);\n\n if (isDef(res.error)) {\n factory.errorComp = ensureCtor(res.error, baseCtor);\n }\n\n if (isDef(res.loading)) {\n factory.loadingComp = ensureCtor(res.loading, baseCtor);\n if (res.delay === 0) {\n factory.loading = true;\n } else {\n timerLoading = setTimeout(function () {\n timerLoading = null;\n if (isUndef(factory.resolved) && isUndef(factory.error)) {\n factory.loading = true;\n forceRender(false);\n }\n }, res.delay || 200);\n }\n }\n\n if (isDef(res.timeout)) {\n timerTimeout = setTimeout(function () {\n timerTimeout = null;\n if (isUndef(factory.resolved)) {\n reject(\n \"timeout (\" + (res.timeout) + \"ms)\"\n );\n }\n }, res.timeout);\n }\n }\n }\n\n sync = false;\n // return in case resolved synchronously\n return factory.loading\n ? factory.loadingComp\n : factory.resolved\n }\n}\n\n/* */\n\nfunction isAsyncPlaceholder (node) {\n return node.isComment && node.asyncFactory\n}\n\n/* */\n\nfunction getFirstComponentChild (children) {\n if (Array.isArray(children)) {\n for (var i = 0; i < children.length; i++) {\n var c = children[i];\n if (isDef(c) && (isDef(c.componentOptions) || isAsyncPlaceholder(c))) {\n return c\n }\n }\n }\n}\n\n/* */\n\n/* */\n\nfunction initEvents (vm) {\n vm._events = Object.create(null);\n vm._hasHookEvent = false;\n // init parent attached events\n var listeners = vm.$options._parentListeners;\n if (listeners) {\n updateComponentListeners(vm, listeners);\n }\n}\n\nvar target;\n\nfunction add (event, fn) {\n target.$on(event, fn);\n}\n\nfunction remove$1 (event, fn) {\n target.$off(event, fn);\n}\n\nfunction createOnceHandler (event, fn) {\n var _target = target;\n return function onceHandler () {\n var res = fn.apply(null, arguments);\n if (res !== null) {\n _target.$off(event, onceHandler);\n }\n }\n}\n\nfunction updateComponentListeners (\n vm,\n listeners,\n oldListeners\n) {\n target = vm;\n updateListeners(listeners, oldListeners || {}, add, remove$1, createOnceHandler, vm);\n target = undefined;\n}\n\nfunction eventsMixin (Vue) {\n var hookRE = /^hook:/;\n Vue.prototype.$on = function (event, fn) {\n var vm = this;\n if (Array.isArray(event)) {\n for (var i = 0, l = event.length; i < l; i++) {\n vm.$on(event[i], fn);\n }\n } else {\n (vm._events[event] || (vm._events[event] = [])).push(fn);\n // optimize hook:event cost by using a boolean flag marked at registration\n // instead of a hash lookup\n if (hookRE.test(event)) {\n vm._hasHookEvent = true;\n }\n }\n return vm\n };\n\n Vue.prototype.$once = function (event, fn) {\n var vm = this;\n function on () {\n vm.$off(event, on);\n fn.apply(vm, arguments);\n }\n on.fn = fn;\n vm.$on(event, on);\n return vm\n };\n\n Vue.prototype.$off = function (event, fn) {\n var vm = this;\n // all\n if (!arguments.length) {\n vm._events = Object.create(null);\n return vm\n }\n // array of events\n if (Array.isArray(event)) {\n for (var i$1 = 0, l = event.length; i$1 < l; i$1++) {\n vm.$off(event[i$1], fn);\n }\n return vm\n }\n // specific event\n var cbs = vm._events[event];\n if (!cbs) {\n return vm\n }\n if (!fn) {\n vm._events[event] = null;\n return vm\n }\n // specific handler\n var cb;\n var i = cbs.length;\n while (i--) {\n cb = cbs[i];\n if (cb === fn || cb.fn === fn) {\n cbs.splice(i, 1);\n break\n }\n }\n return vm\n };\n\n Vue.prototype.$emit = function (event) {\n var vm = this;\n {\n var lowerCaseEvent = event.toLowerCase();\n if (lowerCaseEvent !== event && vm._events[lowerCaseEvent]) {\n tip(\n \"Event \\\"\" + lowerCaseEvent + \"\\\" is emitted in component \" +\n (formatComponentName(vm)) + \" but the handler is registered for \\\"\" + event + \"\\\". \" +\n \"Note that HTML attributes are case-insensitive and you cannot use \" +\n \"v-on to listen to camelCase events when using in-DOM templates. \" +\n \"You should probably use \\\"\" + (hyphenate(event)) + \"\\\" instead of \\\"\" + event + \"\\\".\"\n );\n }\n }\n var cbs = vm._events[event];\n if (cbs) {\n cbs = cbs.length > 1 ? toArray(cbs) : cbs;\n var args = toArray(arguments, 1);\n var info = \"event handler for \\\"\" + event + \"\\\"\";\n for (var i = 0, l = cbs.length; i < l; i++) {\n invokeWithErrorHandling(cbs[i], vm, args, vm, info);\n }\n }\n return vm\n };\n}\n\n/* */\n\nvar activeInstance = null;\nvar isUpdatingChildComponent = false;\n\nfunction setActiveInstance(vm) {\n var prevActiveInstance = activeInstance;\n activeInstance = vm;\n return function () {\n activeInstance = prevActiveInstance;\n }\n}\n\nfunction initLifecycle (vm) {\n var options = vm.$options;\n\n // locate first non-abstract parent\n var parent = options.parent;\n if (parent && !options.abstract) {\n while (parent.$options.abstract && parent.$parent) {\n parent = parent.$parent;\n }\n parent.$children.push(vm);\n }\n\n vm.$parent = parent;\n vm.$root = parent ? parent.$root : vm;\n\n vm.$children = [];\n vm.$refs = {};\n\n vm._watcher = null;\n vm._inactive = null;\n vm._directInactive = false;\n vm._isMounted = false;\n vm._isDestroyed = false;\n vm._isBeingDestroyed = false;\n}\n\nfunction lifecycleMixin (Vue) {\n Vue.prototype._update = function (vnode, hydrating) {\n var vm = this;\n var prevEl = vm.$el;\n var prevVnode = vm._vnode;\n var restoreActiveInstance = setActiveInstance(vm);\n vm._vnode = vnode;\n // Vue.prototype.__patch__ is injected in entry points\n // based on the rendering backend used.\n if (!prevVnode) {\n // initial render\n vm.$el = vm.__patch__(vm.$el, vnode, hydrating, false /* removeOnly */);\n } else {\n // updates\n vm.$el = vm.__patch__(prevVnode, vnode);\n }\n restoreActiveInstance();\n // update __vue__ reference\n if (prevEl) {\n prevEl.__vue__ = null;\n }\n if (vm.$el) {\n vm.$el.__vue__ = vm;\n }\n // if parent is an HOC, update its $el as well\n if (vm.$vnode && vm.$parent && vm.$vnode === vm.$parent._vnode) {\n vm.$parent.$el = vm.$el;\n }\n // updated hook is called by the scheduler to ensure that children are\n // updated in a parent's updated hook.\n };\n\n Vue.prototype.$forceUpdate = function () {\n var vm = this;\n if (vm._watcher) {\n vm._watcher.update();\n }\n };\n\n Vue.prototype.$destroy = function () {\n var vm = this;\n if (vm._isBeingDestroyed) {\n return\n }\n callHook(vm, 'beforeDestroy');\n vm._isBeingDestroyed = true;\n // remove self from parent\n var parent = vm.$parent;\n if (parent && !parent._isBeingDestroyed && !vm.$options.abstract) {\n remove(parent.$children, vm);\n }\n // teardown watchers\n if (vm._watcher) {\n vm._watcher.teardown();\n }\n var i = vm._watchers.length;\n while (i--) {\n vm._watchers[i].teardown();\n }\n // remove reference from data ob\n // frozen object may not have observer.\n if (vm._data.__ob__) {\n vm._data.__ob__.vmCount--;\n }\n // call the last hook...\n vm._isDestroyed = true;\n // invoke destroy hooks on current rendered tree\n vm.__patch__(vm._vnode, null);\n // fire destroyed hook\n callHook(vm, 'destroyed');\n // turn off all instance listeners.\n vm.$off();\n // remove __vue__ reference\n if (vm.$el) {\n vm.$el.__vue__ = null;\n }\n // release circular reference (#6759)\n if (vm.$vnode) {\n vm.$vnode.parent = null;\n }\n };\n}\n\nfunction mountComponent (\n vm,\n el,\n hydrating\n) {\n vm.$el = el;\n if (!vm.$options.render) {\n vm.$options.render = createEmptyVNode;\n {\n /* istanbul ignore if */\n if ((vm.$options.template && vm.$options.template.charAt(0) !== '#') ||\n vm.$options.el || el) {\n warn(\n 'You are using the runtime-only build of Vue where the template ' +\n 'compiler is not available. Either pre-compile the templates into ' +\n 'render functions, or use the compiler-included build.',\n vm\n );\n } else {\n warn(\n 'Failed to mount component: template or render function not defined.',\n vm\n );\n }\n }\n }\n callHook(vm, 'beforeMount');\n\n var updateComponent;\n /* istanbul ignore if */\n if (config.performance && mark) {\n updateComponent = function () {\n var name = vm._name;\n var id = vm._uid;\n var startTag = \"vue-perf-start:\" + id;\n var endTag = \"vue-perf-end:\" + id;\n\n mark(startTag);\n var vnode = vm._render();\n mark(endTag);\n measure((\"vue \" + name + \" render\"), startTag, endTag);\n\n mark(startTag);\n vm._update(vnode, hydrating);\n mark(endTag);\n measure((\"vue \" + name + \" patch\"), startTag, endTag);\n };\n } else {\n updateComponent = function () {\n vm._update(vm._render(), hydrating);\n };\n }\n\n // we set this to vm._watcher inside the watcher's constructor\n // since the watcher's initial patch may call $forceUpdate (e.g. inside child\n // component's mounted hook), which relies on vm._watcher being already defined\n new Watcher(vm, updateComponent, noop, {\n before: function before () {\n if (vm._isMounted && !vm._isDestroyed) {\n callHook(vm, 'beforeUpdate');\n }\n }\n }, true /* isRenderWatcher */);\n hydrating = false;\n\n // manually mounted instance, call mounted on self\n // mounted is called for render-created child components in its inserted hook\n if (vm.$vnode == null) {\n vm._isMounted = true;\n callHook(vm, 'mounted');\n }\n return vm\n}\n\nfunction updateChildComponent (\n vm,\n propsData,\n listeners,\n parentVnode,\n renderChildren\n) {\n {\n isUpdatingChildComponent = true;\n }\n\n // determine whether component has slot children\n // we need to do this before overwriting $options._renderChildren.\n\n // check if there are dynamic scopedSlots (hand-written or compiled but with\n // dynamic slot names). Static scoped slots compiled from template has the\n // \"$stable\" marker.\n var newScopedSlots = parentVnode.data.scopedSlots;\n var oldScopedSlots = vm.$scopedSlots;\n var hasDynamicScopedSlot = !!(\n (newScopedSlots && !newScopedSlots.$stable) ||\n (oldScopedSlots !== emptyObject && !oldScopedSlots.$stable) ||\n (newScopedSlots && vm.$scopedSlots.$key !== newScopedSlots.$key)\n );\n\n // Any static slot children from the parent may have changed during parent's\n // update. Dynamic scoped slots may also have changed. In such cases, a forced\n // update is necessary to ensure correctness.\n var needsForceUpdate = !!(\n renderChildren || // has new static slots\n vm.$options._renderChildren || // has old static slots\n hasDynamicScopedSlot\n );\n\n vm.$options._parentVnode = parentVnode;\n vm.$vnode = parentVnode; // update vm's placeholder node without re-render\n\n if (vm._vnode) { // update child tree's parent\n vm._vnode.parent = parentVnode;\n }\n vm.$options._renderChildren = renderChildren;\n\n // update $attrs and $listeners hash\n // these are also reactive so they may trigger child update if the child\n // used them during render\n vm.$attrs = parentVnode.data.attrs || emptyObject;\n vm.$listeners = listeners || emptyObject;\n\n // update props\n if (propsData && vm.$options.props) {\n toggleObserving(false);\n var props = vm._props;\n var propKeys = vm.$options._propKeys || [];\n for (var i = 0; i < propKeys.length; i++) {\n var key = propKeys[i];\n var propOptions = vm.$options.props; // wtf flow?\n props[key] = validateProp(key, propOptions, propsData, vm);\n }\n toggleObserving(true);\n // keep a copy of raw propsData\n vm.$options.propsData = propsData;\n }\n\n // update listeners\n listeners = listeners || emptyObject;\n var oldListeners = vm.$options._parentListeners;\n vm.$options._parentListeners = listeners;\n updateComponentListeners(vm, listeners, oldListeners);\n\n // resolve slots + force update if has children\n if (needsForceUpdate) {\n vm.$slots = resolveSlots(renderChildren, parentVnode.context);\n vm.$forceUpdate();\n }\n\n {\n isUpdatingChildComponent = false;\n }\n}\n\nfunction isInInactiveTree (vm) {\n while (vm && (vm = vm.$parent)) {\n if (vm._inactive) { return true }\n }\n return false\n}\n\nfunction activateChildComponent (vm, direct) {\n if (direct) {\n vm._directInactive = false;\n if (isInInactiveTree(vm)) {\n return\n }\n } else if (vm._directInactive) {\n return\n }\n if (vm._inactive || vm._inactive === null) {\n vm._inactive = false;\n for (var i = 0; i < vm.$children.length; i++) {\n activateChildComponent(vm.$children[i]);\n }\n callHook(vm, 'activated');\n }\n}\n\nfunction deactivateChildComponent (vm, direct) {\n if (direct) {\n vm._directInactive = true;\n if (isInInactiveTree(vm)) {\n return\n }\n }\n if (!vm._inactive) {\n vm._inactive = true;\n for (var i = 0; i < vm.$children.length; i++) {\n deactivateChildComponent(vm.$children[i]);\n }\n callHook(vm, 'deactivated');\n }\n}\n\nfunction callHook (vm, hook) {\n // #7573 disable dep collection when invoking lifecycle hooks\n pushTarget();\n var handlers = vm.$options[hook];\n var info = hook + \" hook\";\n if (handlers) {\n for (var i = 0, j = handlers.length; i < j; i++) {\n invokeWithErrorHandling(handlers[i], vm, null, vm, info);\n }\n }\n if (vm._hasHookEvent) {\n vm.$emit('hook:' + hook);\n }\n popTarget();\n}\n\n/* */\n\nvar MAX_UPDATE_COUNT = 100;\n\nvar queue = [];\nvar activatedChildren = [];\nvar has = {};\nvar circular = {};\nvar waiting = false;\nvar flushing = false;\nvar index = 0;\n\n/**\n * Reset the scheduler's state.\n */\nfunction resetSchedulerState () {\n index = queue.length = activatedChildren.length = 0;\n has = {};\n {\n circular = {};\n }\n waiting = flushing = false;\n}\n\n// Async edge case #6566 requires saving the timestamp when event listeners are\n// attached. However, calling performance.now() has a perf overhead especially\n// if the page has thousands of event listeners. Instead, we take a timestamp\n// every time the scheduler flushes and use that for all event listeners\n// attached during that flush.\nvar currentFlushTimestamp = 0;\n\n// Async edge case fix requires storing an event listener's attach timestamp.\nvar getNow = Date.now;\n\n// Determine what event timestamp the browser is using. Annoyingly, the\n// timestamp can either be hi-res (relative to page load) or low-res\n// (relative to UNIX epoch), so in order to compare time we have to use the\n// same timestamp type when saving the flush timestamp.\n// All IE versions use low-res event timestamps, and have problematic clock\n// implementations (#9632)\nif (inBrowser && !isIE) {\n var performance = window.performance;\n if (\n performance &&\n typeof performance.now === 'function' &&\n getNow() > document.createEvent('Event').timeStamp\n ) {\n // if the event timestamp, although evaluated AFTER the Date.now(), is\n // smaller than it, it means the event is using a hi-res timestamp,\n // and we need to use the hi-res version for event listener timestamps as\n // well.\n getNow = function () { return performance.now(); };\n }\n}\n\n/**\n * Flush both queues and run the watchers.\n */\nfunction flushSchedulerQueue () {\n currentFlushTimestamp = getNow();\n flushing = true;\n var watcher, id;\n\n // Sort queue before flush.\n // This ensures that:\n // 1. Components are updated from parent to child. (because parent is always\n // created before the child)\n // 2. A component's user watchers are run before its render watcher (because\n // user watchers are created before the render watcher)\n // 3. If a component is destroyed during a parent component's watcher run,\n // its watchers can be skipped.\n queue.sort(function (a, b) { return a.id - b.id; });\n\n // do not cache length because more watchers might be pushed\n // as we run existing watchers\n for (index = 0; index < queue.length; index++) {\n watcher = queue[index];\n if (watcher.before) {\n watcher.before();\n }\n id = watcher.id;\n has[id] = null;\n watcher.run();\n // in dev build, check and stop circular updates.\n if (has[id] != null) {\n circular[id] = (circular[id] || 0) + 1;\n if (circular[id] > MAX_UPDATE_COUNT) {\n warn(\n 'You may have an infinite update loop ' + (\n watcher.user\n ? (\"in watcher with expression \\\"\" + (watcher.expression) + \"\\\"\")\n : \"in a component render function.\"\n ),\n watcher.vm\n );\n break\n }\n }\n }\n\n // keep copies of post queues before resetting state\n var activatedQueue = activatedChildren.slice();\n var updatedQueue = queue.slice();\n\n resetSchedulerState();\n\n // call component updated and activated hooks\n callActivatedHooks(activatedQueue);\n callUpdatedHooks(updatedQueue);\n\n // devtool hook\n /* istanbul ignore if */\n if (devtools && config.devtools) {\n devtools.emit('flush');\n }\n}\n\nfunction callUpdatedHooks (queue) {\n var i = queue.length;\n while (i--) {\n var watcher = queue[i];\n var vm = watcher.vm;\n if (vm._watcher === watcher && vm._isMounted && !vm._isDestroyed) {\n callHook(vm, 'updated');\n }\n }\n}\n\n/**\n * Queue a kept-alive component that was activated during patch.\n * The queue will be processed after the entire tree has been patched.\n */\nfunction queueActivatedComponent (vm) {\n // setting _inactive to false here so that a render function can\n // rely on checking whether it's in an inactive tree (e.g. router-view)\n vm._inactive = false;\n activatedChildren.push(vm);\n}\n\nfunction callActivatedHooks (queue) {\n for (var i = 0; i < queue.length; i++) {\n queue[i]._inactive = true;\n activateChildComponent(queue[i], true /* true */);\n }\n}\n\n/**\n * Push a watcher into the watcher queue.\n * Jobs with duplicate IDs will be skipped unless it's\n * pushed when the queue is being flushed.\n */\nfunction queueWatcher (watcher) {\n var id = watcher.id;\n if (has[id] == null) {\n has[id] = true;\n if (!flushing) {\n queue.push(watcher);\n } else {\n // if already flushing, splice the watcher based on its id\n // if already past its id, it will be run next immediately.\n var i = queue.length - 1;\n while (i > index && queue[i].id > watcher.id) {\n i--;\n }\n queue.splice(i + 1, 0, watcher);\n }\n // queue the flush\n if (!waiting) {\n waiting = true;\n\n if (!config.async) {\n flushSchedulerQueue();\n return\n }\n nextTick(flushSchedulerQueue);\n }\n }\n}\n\n/* */\n\n\n\nvar uid$2 = 0;\n\n/**\n * A watcher parses an expression, collects dependencies,\n * and fires callback when the expression value changes.\n * This is used for both the $watch() api and directives.\n */\nvar Watcher = function Watcher (\n vm,\n expOrFn,\n cb,\n options,\n isRenderWatcher\n) {\n this.vm = vm;\n if (isRenderWatcher) {\n vm._watcher = this;\n }\n vm._watchers.push(this);\n // options\n if (options) {\n this.deep = !!options.deep;\n this.user = !!options.user;\n this.lazy = !!options.lazy;\n this.sync = !!options.sync;\n this.before = options.before;\n } else {\n this.deep = this.user = this.lazy = this.sync = false;\n }\n this.cb = cb;\n this.id = ++uid$2; // uid for batching\n this.active = true;\n this.dirty = this.lazy; // for lazy watchers\n this.deps = [];\n this.newDeps = [];\n this.depIds = new _Set();\n this.newDepIds = new _Set();\n this.expression = expOrFn.toString();\n // parse expression for getter\n if (typeof expOrFn === 'function') {\n this.getter = expOrFn;\n } else {\n this.getter = parsePath(expOrFn);\n if (!this.getter) {\n this.getter = noop;\n warn(\n \"Failed watching path: \\\"\" + expOrFn + \"\\\" \" +\n 'Watcher only accepts simple dot-delimited paths. ' +\n 'For full control, use a function instead.',\n vm\n );\n }\n }\n this.value = this.lazy\n ? undefined\n : this.get();\n};\n\n/**\n * Evaluate the getter, and re-collect dependencies.\n */\nWatcher.prototype.get = function get () {\n pushTarget(this);\n var value;\n var vm = this.vm;\n try {\n value = this.getter.call(vm, vm);\n } catch (e) {\n if (this.user) {\n handleError(e, vm, (\"getter for watcher \\\"\" + (this.expression) + \"\\\"\"));\n } else {\n throw e\n }\n } finally {\n // \"touch\" every property so they are all tracked as\n // dependencies for deep watching\n if (this.deep) {\n traverse(value);\n }\n popTarget();\n this.cleanupDeps();\n }\n return value\n};\n\n/**\n * Add a dependency to this directive.\n */\nWatcher.prototype.addDep = function addDep (dep) {\n var id = dep.id;\n if (!this.newDepIds.has(id)) {\n this.newDepIds.add(id);\n this.newDeps.push(dep);\n if (!this.depIds.has(id)) {\n dep.addSub(this);\n }\n }\n};\n\n/**\n * Clean up for dependency collection.\n */\nWatcher.prototype.cleanupDeps = function cleanupDeps () {\n var i = this.deps.length;\n while (i--) {\n var dep = this.deps[i];\n if (!this.newDepIds.has(dep.id)) {\n dep.removeSub(this);\n }\n }\n var tmp = this.depIds;\n this.depIds = this.newDepIds;\n this.newDepIds = tmp;\n this.newDepIds.clear();\n tmp = this.deps;\n this.deps = this.newDeps;\n this.newDeps = tmp;\n this.newDeps.length = 0;\n};\n\n/**\n * Subscriber interface.\n * Will be called when a dependency changes.\n */\nWatcher.prototype.update = function update () {\n /* istanbul ignore else */\n if (this.lazy) {\n this.dirty = true;\n } else if (this.sync) {\n this.run();\n } else {\n queueWatcher(this);\n }\n};\n\n/**\n * Scheduler job interface.\n * Will be called by the scheduler.\n */\nWatcher.prototype.run = function run () {\n if (this.active) {\n var value = this.get();\n if (\n value !== this.value ||\n // Deep watchers and watchers on Object/Arrays should fire even\n // when the value is the same, because the value may\n // have mutated.\n isObject(value) ||\n this.deep\n ) {\n // set new value\n var oldValue = this.value;\n this.value = value;\n if (this.user) {\n try {\n this.cb.call(this.vm, value, oldValue);\n } catch (e) {\n handleError(e, this.vm, (\"callback for watcher \\\"\" + (this.expression) + \"\\\"\"));\n }\n } else {\n this.cb.call(this.vm, value, oldValue);\n }\n }\n }\n};\n\n/**\n * Evaluate the value of the watcher.\n * This only gets called for lazy watchers.\n */\nWatcher.prototype.evaluate = function evaluate () {\n this.value = this.get();\n this.dirty = false;\n};\n\n/**\n * Depend on all deps collected by this watcher.\n */\nWatcher.prototype.depend = function depend () {\n var i = this.deps.length;\n while (i--) {\n this.deps[i].depend();\n }\n};\n\n/**\n * Remove self from all dependencies' subscriber list.\n */\nWatcher.prototype.teardown = function teardown () {\n if (this.active) {\n // remove self from vm's watcher list\n // this is a somewhat expensive operation so we skip it\n // if the vm is being destroyed.\n if (!this.vm._isBeingDestroyed) {\n remove(this.vm._watchers, this);\n }\n var i = this.deps.length;\n while (i--) {\n this.deps[i].removeSub(this);\n }\n this.active = false;\n }\n};\n\n/* */\n\nvar sharedPropertyDefinition = {\n enumerable: true,\n configurable: true,\n get: noop,\n set: noop\n};\n\nfunction proxy (target, sourceKey, key) {\n sharedPropertyDefinition.get = function proxyGetter () {\n return this[sourceKey][key]\n };\n sharedPropertyDefinition.set = function proxySetter (val) {\n this[sourceKey][key] = val;\n };\n Object.defineProperty(target, key, sharedPropertyDefinition);\n}\n\nfunction initState (vm) {\n vm._watchers = [];\n var opts = vm.$options;\n if (opts.props) { initProps(vm, opts.props); }\n if (opts.methods) { initMethods(vm, opts.methods); }\n if (opts.data) {\n initData(vm);\n } else {\n observe(vm._data = {}, true /* asRootData */);\n }\n if (opts.computed) { initComputed(vm, opts.computed); }\n if (opts.watch && opts.watch !== nativeWatch) {\n initWatch(vm, opts.watch);\n }\n}\n\nfunction initProps (vm, propsOptions) {\n var propsData = vm.$options.propsData || {};\n var props = vm._props = {};\n // cache prop keys so that future props updates can iterate using Array\n // instead of dynamic object key enumeration.\n var keys = vm.$options._propKeys = [];\n var isRoot = !vm.$parent;\n // root instance props should be converted\n if (!isRoot) {\n toggleObserving(false);\n }\n var loop = function ( key ) {\n keys.push(key);\n var value = validateProp(key, propsOptions, propsData, vm);\n /* istanbul ignore else */\n {\n var hyphenatedKey = hyphenate(key);\n if (isReservedAttribute(hyphenatedKey) ||\n config.isReservedAttr(hyphenatedKey)) {\n warn(\n (\"\\\"\" + hyphenatedKey + \"\\\" is a reserved attribute and cannot be used as component prop.\"),\n vm\n );\n }\n defineReactive$$1(props, key, value, function () {\n if (!isRoot && !isUpdatingChildComponent) {\n warn(\n \"Avoid mutating a prop directly since the value will be \" +\n \"overwritten whenever the parent component re-renders. \" +\n \"Instead, use a data or computed property based on the prop's \" +\n \"value. Prop being mutated: \\\"\" + key + \"\\\"\",\n vm\n );\n }\n });\n }\n // static props are already proxied on the component's prototype\n // during Vue.extend(). We only need to proxy props defined at\n // instantiation here.\n if (!(key in vm)) {\n proxy(vm, \"_props\", key);\n }\n };\n\n for (var key in propsOptions) loop( key );\n toggleObserving(true);\n}\n\nfunction initData (vm) {\n var data = vm.$options.data;\n data = vm._data = typeof data === 'function'\n ? getData(data, vm)\n : data || {};\n if (!isPlainObject(data)) {\n data = {};\n warn(\n 'data functions should return an object:\\n' +\n 'https://vuejs.org/v2/guide/components.html#data-Must-Be-a-Function',\n vm\n );\n }\n // proxy data on instance\n var keys = Object.keys(data);\n var props = vm.$options.props;\n var methods = vm.$options.methods;\n var i = keys.length;\n while (i--) {\n var key = keys[i];\n {\n if (methods && hasOwn(methods, key)) {\n warn(\n (\"Method \\\"\" + key + \"\\\" has already been defined as a data property.\"),\n vm\n );\n }\n }\n if (props && hasOwn(props, key)) {\n warn(\n \"The data property \\\"\" + key + \"\\\" is already declared as a prop. \" +\n \"Use prop default value instead.\",\n vm\n );\n } else if (!isReserved(key)) {\n proxy(vm, \"_data\", key);\n }\n }\n // observe data\n observe(data, true /* asRootData */);\n}\n\nfunction getData (data, vm) {\n // #7573 disable dep collection when invoking data getters\n pushTarget();\n try {\n return data.call(vm, vm)\n } catch (e) {\n handleError(e, vm, \"data()\");\n return {}\n } finally {\n popTarget();\n }\n}\n\nvar computedWatcherOptions = { lazy: true };\n\nfunction initComputed (vm, computed) {\n // $flow-disable-line\n var watchers = vm._computedWatchers = Object.create(null);\n // computed properties are just getters during SSR\n var isSSR = isServerRendering();\n\n for (var key in computed) {\n var userDef = computed[key];\n var getter = typeof userDef === 'function' ? userDef : userDef.get;\n if (getter == null) {\n warn(\n (\"Getter is missing for computed property \\\"\" + key + \"\\\".\"),\n vm\n );\n }\n\n if (!isSSR) {\n // create internal watcher for the computed property.\n watchers[key] = new Watcher(\n vm,\n getter || noop,\n noop,\n computedWatcherOptions\n );\n }\n\n // component-defined computed properties are already defined on the\n // component prototype. We only need to define computed properties defined\n // at instantiation here.\n if (!(key in vm)) {\n defineComputed(vm, key, userDef);\n } else {\n if (key in vm.$data) {\n warn((\"The computed property \\\"\" + key + \"\\\" is already defined in data.\"), vm);\n } else if (vm.$options.props && key in vm.$options.props) {\n warn((\"The computed property \\\"\" + key + \"\\\" is already defined as a prop.\"), vm);\n }\n }\n }\n}\n\nfunction defineComputed (\n target,\n key,\n userDef\n) {\n var shouldCache = !isServerRendering();\n if (typeof userDef === 'function') {\n sharedPropertyDefinition.get = shouldCache\n ? createComputedGetter(key)\n : createGetterInvoker(userDef);\n sharedPropertyDefinition.set = noop;\n } else {\n sharedPropertyDefinition.get = userDef.get\n ? shouldCache && userDef.cache !== false\n ? createComputedGetter(key)\n : createGetterInvoker(userDef.get)\n : noop;\n sharedPropertyDefinition.set = userDef.set || noop;\n }\n if (sharedPropertyDefinition.set === noop) {\n sharedPropertyDefinition.set = function () {\n warn(\n (\"Computed property \\\"\" + key + \"\\\" was assigned to but it has no setter.\"),\n this\n );\n };\n }\n Object.defineProperty(target, key, sharedPropertyDefinition);\n}\n\nfunction createComputedGetter (key) {\n return function computedGetter () {\n var watcher = this._computedWatchers && this._computedWatchers[key];\n if (watcher) {\n if (watcher.dirty) {\n watcher.evaluate();\n }\n if (Dep.target) {\n watcher.depend();\n }\n return watcher.value\n }\n }\n}\n\nfunction createGetterInvoker(fn) {\n return function computedGetter () {\n return fn.call(this, this)\n }\n}\n\nfunction initMethods (vm, methods) {\n var props = vm.$options.props;\n for (var key in methods) {\n {\n if (typeof methods[key] !== 'function') {\n warn(\n \"Method \\\"\" + key + \"\\\" has type \\\"\" + (typeof methods[key]) + \"\\\" in the component definition. \" +\n \"Did you reference the function correctly?\",\n vm\n );\n }\n if (props && hasOwn(props, key)) {\n warn(\n (\"Method \\\"\" + key + \"\\\" has already been defined as a prop.\"),\n vm\n );\n }\n if ((key in vm) && isReserved(key)) {\n warn(\n \"Method \\\"\" + key + \"\\\" conflicts with an existing Vue instance method. \" +\n \"Avoid defining component methods that start with _ or $.\"\n );\n }\n }\n vm[key] = typeof methods[key] !== 'function' ? noop : bind(methods[key], vm);\n }\n}\n\nfunction initWatch (vm, watch) {\n for (var key in watch) {\n var handler = watch[key];\n if (Array.isArray(handler)) {\n for (var i = 0; i < handler.length; i++) {\n createWatcher(vm, key, handler[i]);\n }\n } else {\n createWatcher(vm, key, handler);\n }\n }\n}\n\nfunction createWatcher (\n vm,\n expOrFn,\n handler,\n options\n) {\n if (isPlainObject(handler)) {\n options = handler;\n handler = handler.handler;\n }\n if (typeof handler === 'string') {\n handler = vm[handler];\n }\n return vm.$watch(expOrFn, handler, options)\n}\n\nfunction stateMixin (Vue) {\n // flow somehow has problems with directly declared definition object\n // when using Object.defineProperty, so we have to procedurally build up\n // the object here.\n var dataDef = {};\n dataDef.get = function () { return this._data };\n var propsDef = {};\n propsDef.get = function () { return this._props };\n {\n dataDef.set = function () {\n warn(\n 'Avoid replacing instance root $data. ' +\n 'Use nested data properties instead.',\n this\n );\n };\n propsDef.set = function () {\n warn(\"$props is readonly.\", this);\n };\n }\n Object.defineProperty(Vue.prototype, '$data', dataDef);\n Object.defineProperty(Vue.prototype, '$props', propsDef);\n\n Vue.prototype.$set = set;\n Vue.prototype.$delete = del;\n\n Vue.prototype.$watch = function (\n expOrFn,\n cb,\n options\n ) {\n var vm = this;\n if (isPlainObject(cb)) {\n return createWatcher(vm, expOrFn, cb, options)\n }\n options = options || {};\n options.user = true;\n var watcher = new Watcher(vm, expOrFn, cb, options);\n if (options.immediate) {\n try {\n cb.call(vm, watcher.value);\n } catch (error) {\n handleError(error, vm, (\"callback for immediate watcher \\\"\" + (watcher.expression) + \"\\\"\"));\n }\n }\n return function unwatchFn () {\n watcher.teardown();\n }\n };\n}\n\n/* */\n\nvar uid$3 = 0;\n\nfunction initMixin (Vue) {\n Vue.prototype._init = function (options) {\n var vm = this;\n // a uid\n vm._uid = uid$3++;\n\n var startTag, endTag;\n /* istanbul ignore if */\n if (config.performance && mark) {\n startTag = \"vue-perf-start:\" + (vm._uid);\n endTag = \"vue-perf-end:\" + (vm._uid);\n mark(startTag);\n }\n\n // a flag to avoid this being observed\n vm._isVue = true;\n // merge options\n if (options && options._isComponent) {\n // optimize internal component instantiation\n // since dynamic options merging is pretty slow, and none of the\n // internal component options needs special treatment.\n initInternalComponent(vm, options);\n } else {\n vm.$options = mergeOptions(\n resolveConstructorOptions(vm.constructor),\n options || {},\n vm\n );\n }\n /* istanbul ignore else */\n {\n initProxy(vm);\n }\n // expose real self\n vm._self = vm;\n initLifecycle(vm);\n initEvents(vm);\n initRender(vm);\n callHook(vm, 'beforeCreate');\n initInjections(vm); // resolve injections before data/props\n initState(vm);\n initProvide(vm); // resolve provide after data/props\n callHook(vm, 'created');\n\n /* istanbul ignore if */\n if (config.performance && mark) {\n vm._name = formatComponentName(vm, false);\n mark(endTag);\n measure((\"vue \" + (vm._name) + \" init\"), startTag, endTag);\n }\n\n if (vm.$options.el) {\n vm.$mount(vm.$options.el);\n }\n };\n}\n\nfunction initInternalComponent (vm, options) {\n var opts = vm.$options = Object.create(vm.constructor.options);\n // doing this because it's faster than dynamic enumeration.\n var parentVnode = options._parentVnode;\n opts.parent = options.parent;\n opts._parentVnode = parentVnode;\n\n var vnodeComponentOptions = parentVnode.componentOptions;\n opts.propsData = vnodeComponentOptions.propsData;\n opts._parentListeners = vnodeComponentOptions.listeners;\n opts._renderChildren = vnodeComponentOptions.children;\n opts._componentTag = vnodeComponentOptions.tag;\n\n if (options.render) {\n opts.render = options.render;\n opts.staticRenderFns = options.staticRenderFns;\n }\n}\n\nfunction resolveConstructorOptions (Ctor) {\n var options = Ctor.options;\n if (Ctor.super) {\n var superOptions = resolveConstructorOptions(Ctor.super);\n var cachedSuperOptions = Ctor.superOptions;\n if (superOptions !== cachedSuperOptions) {\n // super option changed,\n // need to resolve new options.\n Ctor.superOptions = superOptions;\n // check if there are any late-modified/attached options (#4976)\n var modifiedOptions = resolveModifiedOptions(Ctor);\n // update base extend options\n if (modifiedOptions) {\n extend(Ctor.extendOptions, modifiedOptions);\n }\n options = Ctor.options = mergeOptions(superOptions, Ctor.extendOptions);\n if (options.name) {\n options.components[options.name] = Ctor;\n }\n }\n }\n return options\n}\n\nfunction resolveModifiedOptions (Ctor) {\n var modified;\n var latest = Ctor.options;\n var sealed = Ctor.sealedOptions;\n for (var key in latest) {\n if (latest[key] !== sealed[key]) {\n if (!modified) { modified = {}; }\n modified[key] = latest[key];\n }\n }\n return modified\n}\n\nfunction Vue (options) {\n if (!(this instanceof Vue)\n ) {\n warn('Vue is a constructor and should be called with the `new` keyword');\n }\n this._init(options);\n}\n\ninitMixin(Vue);\nstateMixin(Vue);\neventsMixin(Vue);\nlifecycleMixin(Vue);\nrenderMixin(Vue);\n\n/* */\n\nfunction initUse (Vue) {\n Vue.use = function (plugin) {\n var installedPlugins = (this._installedPlugins || (this._installedPlugins = []));\n if (installedPlugins.indexOf(plugin) > -1) {\n return this\n }\n\n // additional parameters\n var args = toArray(arguments, 1);\n args.unshift(this);\n if (typeof plugin.install === 'function') {\n plugin.install.apply(plugin, args);\n } else if (typeof plugin === 'function') {\n plugin.apply(null, args);\n }\n installedPlugins.push(plugin);\n return this\n };\n}\n\n/* */\n\nfunction initMixin$1 (Vue) {\n Vue.mixin = function (mixin) {\n this.options = mergeOptions(this.options, mixin);\n return this\n };\n}\n\n/* */\n\nfunction initExtend (Vue) {\n /**\n * Each instance constructor, including Vue, has a unique\n * cid. This enables us to create wrapped \"child\n * constructors\" for prototypal inheritance and cache them.\n */\n Vue.cid = 0;\n var cid = 1;\n\n /**\n * Class inheritance\n */\n Vue.extend = function (extendOptions) {\n extendOptions = extendOptions || {};\n var Super = this;\n var SuperId = Super.cid;\n var cachedCtors = extendOptions._Ctor || (extendOptions._Ctor = {});\n if (cachedCtors[SuperId]) {\n return cachedCtors[SuperId]\n }\n\n var name = extendOptions.name || Super.options.name;\n if (name) {\n validateComponentName(name);\n }\n\n var Sub = function VueComponent (options) {\n this._init(options);\n };\n Sub.prototype = Object.create(Super.prototype);\n Sub.prototype.constructor = Sub;\n Sub.cid = cid++;\n Sub.options = mergeOptions(\n Super.options,\n extendOptions\n );\n Sub['super'] = Super;\n\n // For props and computed properties, we define the proxy getters on\n // the Vue instances at extension time, on the extended prototype. This\n // avoids Object.defineProperty calls for each instance created.\n if (Sub.options.props) {\n initProps$1(Sub);\n }\n if (Sub.options.computed) {\n initComputed$1(Sub);\n }\n\n // allow further extension/mixin/plugin usage\n Sub.extend = Super.extend;\n Sub.mixin = Super.mixin;\n Sub.use = Super.use;\n\n // create asset registers, so extended classes\n // can have their private assets too.\n ASSET_TYPES.forEach(function (type) {\n Sub[type] = Super[type];\n });\n // enable recursive self-lookup\n if (name) {\n Sub.options.components[name] = Sub;\n }\n\n // keep a reference to the super options at extension time.\n // later at instantiation we can check if Super's options have\n // been updated.\n Sub.superOptions = Super.options;\n Sub.extendOptions = extendOptions;\n Sub.sealedOptions = extend({}, Sub.options);\n\n // cache constructor\n cachedCtors[SuperId] = Sub;\n return Sub\n };\n}\n\nfunction initProps$1 (Comp) {\n var props = Comp.options.props;\n for (var key in props) {\n proxy(Comp.prototype, \"_props\", key);\n }\n}\n\nfunction initComputed$1 (Comp) {\n var computed = Comp.options.computed;\n for (var key in computed) {\n defineComputed(Comp.prototype, key, computed[key]);\n }\n}\n\n/* */\n\nfunction initAssetRegisters (Vue) {\n /**\n * Create asset registration methods.\n */\n ASSET_TYPES.forEach(function (type) {\n Vue[type] = function (\n id,\n definition\n ) {\n if (!definition) {\n return this.options[type + 's'][id]\n } else {\n /* istanbul ignore if */\n if (type === 'component') {\n validateComponentName(id);\n }\n if (type === 'component' && isPlainObject(definition)) {\n definition.name = definition.name || id;\n definition = this.options._base.extend(definition);\n }\n if (type === 'directive' && typeof definition === 'function') {\n definition = { bind: definition, update: definition };\n }\n this.options[type + 's'][id] = definition;\n return definition\n }\n };\n });\n}\n\n/* */\n\n\n\nfunction getComponentName (opts) {\n return opts && (opts.Ctor.options.name || opts.tag)\n}\n\nfunction matches (pattern, name) {\n if (Array.isArray(pattern)) {\n return pattern.indexOf(name) > -1\n } else if (typeof pattern === 'string') {\n return pattern.split(',').indexOf(name) > -1\n } else if (isRegExp(pattern)) {\n return pattern.test(name)\n }\n /* istanbul ignore next */\n return false\n}\n\nfunction pruneCache (keepAliveInstance, filter) {\n var cache = keepAliveInstance.cache;\n var keys = keepAliveInstance.keys;\n var _vnode = keepAliveInstance._vnode;\n for (var key in cache) {\n var cachedNode = cache[key];\n if (cachedNode) {\n var name = getComponentName(cachedNode.componentOptions);\n if (name && !filter(name)) {\n pruneCacheEntry(cache, key, keys, _vnode);\n }\n }\n }\n}\n\nfunction pruneCacheEntry (\n cache,\n key,\n keys,\n current\n) {\n var cached$$1 = cache[key];\n if (cached$$1 && (!current || cached$$1.tag !== current.tag)) {\n cached$$1.componentInstance.$destroy();\n }\n cache[key] = null;\n remove(keys, key);\n}\n\nvar patternTypes = [String, RegExp, Array];\n\nvar KeepAlive = {\n name: 'keep-alive',\n abstract: true,\n\n props: {\n include: patternTypes,\n exclude: patternTypes,\n max: [String, Number]\n },\n\n created: function created () {\n this.cache = Object.create(null);\n this.keys = [];\n },\n\n destroyed: function destroyed () {\n for (var key in this.cache) {\n pruneCacheEntry(this.cache, key, this.keys);\n }\n },\n\n mounted: function mounted () {\n var this$1 = this;\n\n this.$watch('include', function (val) {\n pruneCache(this$1, function (name) { return matches(val, name); });\n });\n this.$watch('exclude', function (val) {\n pruneCache(this$1, function (name) { return !matches(val, name); });\n });\n },\n\n render: function render () {\n var slot = this.$slots.default;\n var vnode = getFirstComponentChild(slot);\n var componentOptions = vnode && vnode.componentOptions;\n if (componentOptions) {\n // check pattern\n var name = getComponentName(componentOptions);\n var ref = this;\n var include = ref.include;\n var exclude = ref.exclude;\n if (\n // not included\n (include && (!name || !matches(include, name))) ||\n // excluded\n (exclude && name && matches(exclude, name))\n ) {\n return vnode\n }\n\n var ref$1 = this;\n var cache = ref$1.cache;\n var keys = ref$1.keys;\n var key = vnode.key == null\n // same constructor may get registered as different local components\n // so cid alone is not enough (#3269)\n ? componentOptions.Ctor.cid + (componentOptions.tag ? (\"::\" + (componentOptions.tag)) : '')\n : vnode.key;\n if (cache[key]) {\n vnode.componentInstance = cache[key].componentInstance;\n // make current key freshest\n remove(keys, key);\n keys.push(key);\n } else {\n cache[key] = vnode;\n keys.push(key);\n // prune oldest entry\n if (this.max && keys.length > parseInt(this.max)) {\n pruneCacheEntry(cache, keys[0], keys, this._vnode);\n }\n }\n\n vnode.data.keepAlive = true;\n }\n return vnode || (slot && slot[0])\n }\n};\n\nvar builtInComponents = {\n KeepAlive: KeepAlive\n};\n\n/* */\n\nfunction initGlobalAPI (Vue) {\n // config\n var configDef = {};\n configDef.get = function () { return config; };\n {\n configDef.set = function () {\n warn(\n 'Do not replace the Vue.config object, set individual fields instead.'\n );\n };\n }\n Object.defineProperty(Vue, 'config', configDef);\n\n // exposed util methods.\n // NOTE: these are not considered part of the public API - avoid relying on\n // them unless you are aware of the risk.\n Vue.util = {\n warn: warn,\n extend: extend,\n mergeOptions: mergeOptions,\n defineReactive: defineReactive$$1\n };\n\n Vue.set = set;\n Vue.delete = del;\n Vue.nextTick = nextTick;\n\n // 2.6 explicit observable API\n Vue.observable = function (obj) {\n observe(obj);\n return obj\n };\n\n Vue.options = Object.create(null);\n ASSET_TYPES.forEach(function (type) {\n Vue.options[type + 's'] = Object.create(null);\n });\n\n // this is used to identify the \"base\" constructor to extend all plain-object\n // components with in Weex's multi-instance scenarios.\n Vue.options._base = Vue;\n\n extend(Vue.options.components, builtInComponents);\n\n initUse(Vue);\n initMixin$1(Vue);\n initExtend(Vue);\n initAssetRegisters(Vue);\n}\n\ninitGlobalAPI(Vue);\n\nObject.defineProperty(Vue.prototype, '$isServer', {\n get: isServerRendering\n});\n\nObject.defineProperty(Vue.prototype, '$ssrContext', {\n get: function get () {\n /* istanbul ignore next */\n return this.$vnode && this.$vnode.ssrContext\n }\n});\n\n// expose FunctionalRenderContext for ssr runtime helper installation\nObject.defineProperty(Vue, 'FunctionalRenderContext', {\n value: FunctionalRenderContext\n});\n\nVue.version = '2.6.10';\n\n/* */\n\n// these are reserved for web because they are directly compiled away\n// during template compilation\nvar isReservedAttr = makeMap('style,class');\n\n// attributes that should be using props for binding\nvar acceptValue = makeMap('input,textarea,option,select,progress');\nvar mustUseProp = function (tag, type, attr) {\n return (\n (attr === 'value' && acceptValue(tag)) && type !== 'button' ||\n (attr === 'selected' && tag === 'option') ||\n (attr === 'checked' && tag === 'input') ||\n (attr === 'muted' && tag === 'video')\n )\n};\n\nvar isEnumeratedAttr = makeMap('contenteditable,draggable,spellcheck');\n\nvar isValidContentEditableValue = makeMap('events,caret,typing,plaintext-only');\n\nvar convertEnumeratedValue = function (key, value) {\n return isFalsyAttrValue(value) || value === 'false'\n ? 'false'\n // allow arbitrary string value for contenteditable\n : key === 'contenteditable' && isValidContentEditableValue(value)\n ? value\n : 'true'\n};\n\nvar isBooleanAttr = makeMap(\n 'allowfullscreen,async,autofocus,autoplay,checked,compact,controls,declare,' +\n 'default,defaultchecked,defaultmuted,defaultselected,defer,disabled,' +\n 'enabled,formnovalidate,hidden,indeterminate,inert,ismap,itemscope,loop,multiple,' +\n 'muted,nohref,noresize,noshade,novalidate,nowrap,open,pauseonexit,readonly,' +\n 'required,reversed,scoped,seamless,selected,sortable,translate,' +\n 'truespeed,typemustmatch,visible'\n);\n\nvar xlinkNS = 'http://www.w3.org/1999/xlink';\n\nvar isXlink = function (name) {\n return name.charAt(5) === ':' && name.slice(0, 5) === 'xlink'\n};\n\nvar getXlinkProp = function (name) {\n return isXlink(name) ? name.slice(6, name.length) : ''\n};\n\nvar isFalsyAttrValue = function (val) {\n return val == null || val === false\n};\n\n/* */\n\nfunction genClassForVnode (vnode) {\n var data = vnode.data;\n var parentNode = vnode;\n var childNode = vnode;\n while (isDef(childNode.componentInstance)) {\n childNode = childNode.componentInstance._vnode;\n if (childNode && childNode.data) {\n data = mergeClassData(childNode.data, data);\n }\n }\n while (isDef(parentNode = parentNode.parent)) {\n if (parentNode && parentNode.data) {\n data = mergeClassData(data, parentNode.data);\n }\n }\n return renderClass(data.staticClass, data.class)\n}\n\nfunction mergeClassData (child, parent) {\n return {\n staticClass: concat(child.staticClass, parent.staticClass),\n class: isDef(child.class)\n ? [child.class, parent.class]\n : parent.class\n }\n}\n\nfunction renderClass (\n staticClass,\n dynamicClass\n) {\n if (isDef(staticClass) || isDef(dynamicClass)) {\n return concat(staticClass, stringifyClass(dynamicClass))\n }\n /* istanbul ignore next */\n return ''\n}\n\nfunction concat (a, b) {\n return a ? b ? (a + ' ' + b) : a : (b || '')\n}\n\nfunction stringifyClass (value) {\n if (Array.isArray(value)) {\n return stringifyArray(value)\n }\n if (isObject(value)) {\n return stringifyObject(value)\n }\n if (typeof value === 'string') {\n return value\n }\n /* istanbul ignore next */\n return ''\n}\n\nfunction stringifyArray (value) {\n var res = '';\n var stringified;\n for (var i = 0, l = value.length; i < l; i++) {\n if (isDef(stringified = stringifyClass(value[i])) && stringified !== '') {\n if (res) { res += ' '; }\n res += stringified;\n }\n }\n return res\n}\n\nfunction stringifyObject (value) {\n var res = '';\n for (var key in value) {\n if (value[key]) {\n if (res) { res += ' '; }\n res += key;\n }\n }\n return res\n}\n\n/* */\n\nvar namespaceMap = {\n svg: 'http://www.w3.org/2000/svg',\n math: 'http://www.w3.org/1998/Math/MathML'\n};\n\nvar isHTMLTag = makeMap(\n 'html,body,base,head,link,meta,style,title,' +\n 'address,article,aside,footer,header,h1,h2,h3,h4,h5,h6,hgroup,nav,section,' +\n 'div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,' +\n 'a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,rtc,ruby,' +\n 's,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,' +\n 'embed,object,param,source,canvas,script,noscript,del,ins,' +\n 'caption,col,colgroup,table,thead,tbody,td,th,tr,' +\n 'button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,' +\n 'output,progress,select,textarea,' +\n 'details,dialog,menu,menuitem,summary,' +\n 'content,element,shadow,template,blockquote,iframe,tfoot'\n);\n\n// this map is intentionally selective, only covering SVG elements that may\n// contain child elements.\nvar isSVG = makeMap(\n 'svg,animate,circle,clippath,cursor,defs,desc,ellipse,filter,font-face,' +\n 'foreignObject,g,glyph,image,line,marker,mask,missing-glyph,path,pattern,' +\n 'polygon,polyline,rect,switch,symbol,text,textpath,tspan,use,view',\n true\n);\n\nvar isPreTag = function (tag) { return tag === 'pre'; };\n\nvar isReservedTag = function (tag) {\n return isHTMLTag(tag) || isSVG(tag)\n};\n\nfunction getTagNamespace (tag) {\n if (isSVG(tag)) {\n return 'svg'\n }\n // basic support for MathML\n // note it doesn't support other MathML elements being component roots\n if (tag === 'math') {\n return 'math'\n }\n}\n\nvar unknownElementCache = Object.create(null);\nfunction isUnknownElement (tag) {\n /* istanbul ignore if */\n if (!inBrowser) {\n return true\n }\n if (isReservedTag(tag)) {\n return false\n }\n tag = tag.toLowerCase();\n /* istanbul ignore if */\n if (unknownElementCache[tag] != null) {\n return unknownElementCache[tag]\n }\n var el = document.createElement(tag);\n if (tag.indexOf('-') > -1) {\n // http://stackoverflow.com/a/28210364/1070244\n return (unknownElementCache[tag] = (\n el.constructor === window.HTMLUnknownElement ||\n el.constructor === window.HTMLElement\n ))\n } else {\n return (unknownElementCache[tag] = /HTMLUnknownElement/.test(el.toString()))\n }\n}\n\nvar isTextInputType = makeMap('text,number,password,search,email,tel,url');\n\n/* */\n\n/**\n * Query an element selector if it's not an element already.\n */\nfunction query (el) {\n if (typeof el === 'string') {\n var selected = document.querySelector(el);\n if (!selected) {\n warn(\n 'Cannot find element: ' + el\n );\n return document.createElement('div')\n }\n return selected\n } else {\n return el\n }\n}\n\n/* */\n\nfunction createElement$1 (tagName, vnode) {\n var elm = document.createElement(tagName);\n if (tagName !== 'select') {\n return elm\n }\n // false or null will remove the attribute but undefined will not\n if (vnode.data && vnode.data.attrs && vnode.data.attrs.multiple !== undefined) {\n elm.setAttribute('multiple', 'multiple');\n }\n return elm\n}\n\nfunction createElementNS (namespace, tagName) {\n return document.createElementNS(namespaceMap[namespace], tagName)\n}\n\nfunction createTextNode (text) {\n return document.createTextNode(text)\n}\n\nfunction createComment (text) {\n return document.createComment(text)\n}\n\nfunction insertBefore (parentNode, newNode, referenceNode) {\n parentNode.insertBefore(newNode, referenceNode);\n}\n\nfunction removeChild (node, child) {\n node.removeChild(child);\n}\n\nfunction appendChild (node, child) {\n node.appendChild(child);\n}\n\nfunction parentNode (node) {\n return node.parentNode\n}\n\nfunction nextSibling (node) {\n return node.nextSibling\n}\n\nfunction tagName (node) {\n return node.tagName\n}\n\nfunction setTextContent (node, text) {\n node.textContent = text;\n}\n\nfunction setStyleScope (node, scopeId) {\n node.setAttribute(scopeId, '');\n}\n\nvar nodeOps = /*#__PURE__*/Object.freeze({\n createElement: createElement$1,\n createElementNS: createElementNS,\n createTextNode: createTextNode,\n createComment: createComment,\n insertBefore: insertBefore,\n removeChild: removeChild,\n appendChild: appendChild,\n parentNode: parentNode,\n nextSibling: nextSibling,\n tagName: tagName,\n setTextContent: setTextContent,\n setStyleScope: setStyleScope\n});\n\n/* */\n\nvar ref = {\n create: function create (_, vnode) {\n registerRef(vnode);\n },\n update: function update (oldVnode, vnode) {\n if (oldVnode.data.ref !== vnode.data.ref) {\n registerRef(oldVnode, true);\n registerRef(vnode);\n }\n },\n destroy: function destroy (vnode) {\n registerRef(vnode, true);\n }\n};\n\nfunction registerRef (vnode, isRemoval) {\n var key = vnode.data.ref;\n if (!isDef(key)) { return }\n\n var vm = vnode.context;\n var ref = vnode.componentInstance || vnode.elm;\n var refs = vm.$refs;\n if (isRemoval) {\n if (Array.isArray(refs[key])) {\n remove(refs[key], ref);\n } else if (refs[key] === ref) {\n refs[key] = undefined;\n }\n } else {\n if (vnode.data.refInFor) {\n if (!Array.isArray(refs[key])) {\n refs[key] = [ref];\n } else if (refs[key].indexOf(ref) < 0) {\n // $flow-disable-line\n refs[key].push(ref);\n }\n } else {\n refs[key] = ref;\n }\n }\n}\n\n/**\n * Virtual DOM patching algorithm based on Snabbdom by\n * Simon Friis Vindum (@paldepind)\n * Licensed under the MIT License\n * https://github.com/paldepind/snabbdom/blob/master/LICENSE\n *\n * modified by Evan You (@yyx990803)\n *\n * Not type-checking this because this file is perf-critical and the cost\n * of making flow understand it is not worth it.\n */\n\nvar emptyNode = new VNode('', {}, []);\n\nvar hooks = ['create', 'activate', 'update', 'remove', 'destroy'];\n\nfunction sameVnode (a, b) {\n return (\n a.key === b.key && (\n (\n a.tag === b.tag &&\n a.isComment === b.isComment &&\n isDef(a.data) === isDef(b.data) &&\n sameInputType(a, b)\n ) || (\n isTrue(a.isAsyncPlaceholder) &&\n a.asyncFactory === b.asyncFactory &&\n isUndef(b.asyncFactory.error)\n )\n )\n )\n}\n\nfunction sameInputType (a, b) {\n if (a.tag !== 'input') { return true }\n var i;\n var typeA = isDef(i = a.data) && isDef(i = i.attrs) && i.type;\n var typeB = isDef(i = b.data) && isDef(i = i.attrs) && i.type;\n return typeA === typeB || isTextInputType(typeA) && isTextInputType(typeB)\n}\n\nfunction createKeyToOldIdx (children, beginIdx, endIdx) {\n var i, key;\n var map = {};\n for (i = beginIdx; i <= endIdx; ++i) {\n key = children[i].key;\n if (isDef(key)) { map[key] = i; }\n }\n return map\n}\n\nfunction createPatchFunction (backend) {\n var i, j;\n var cbs = {};\n\n var modules = backend.modules;\n var nodeOps = backend.nodeOps;\n\n for (i = 0; i < hooks.length; ++i) {\n cbs[hooks[i]] = [];\n for (j = 0; j < modules.length; ++j) {\n if (isDef(modules[j][hooks[i]])) {\n cbs[hooks[i]].push(modules[j][hooks[i]]);\n }\n }\n }\n\n function emptyNodeAt (elm) {\n return new VNode(nodeOps.tagName(elm).toLowerCase(), {}, [], undefined, elm)\n }\n\n function createRmCb (childElm, listeners) {\n function remove$$1 () {\n if (--remove$$1.listeners === 0) {\n removeNode(childElm);\n }\n }\n remove$$1.listeners = listeners;\n return remove$$1\n }\n\n function removeNode (el) {\n var parent = nodeOps.parentNode(el);\n // element may have already been removed due to v-html / v-text\n if (isDef(parent)) {\n nodeOps.removeChild(parent, el);\n }\n }\n\n function isUnknownElement$$1 (vnode, inVPre) {\n return (\n !inVPre &&\n !vnode.ns &&\n !(\n config.ignoredElements.length &&\n config.ignoredElements.some(function (ignore) {\n return isRegExp(ignore)\n ? ignore.test(vnode.tag)\n : ignore === vnode.tag\n })\n ) &&\n config.isUnknownElement(vnode.tag)\n )\n }\n\n var creatingElmInVPre = 0;\n\n function createElm (\n vnode,\n insertedVnodeQueue,\n parentElm,\n refElm,\n nested,\n ownerArray,\n index\n ) {\n if (isDef(vnode.elm) && isDef(ownerArray)) {\n // This vnode was used in a previous render!\n // now it's used as a new node, overwriting its elm would cause\n // potential patch errors down the road when it's used as an insertion\n // reference node. Instead, we clone the node on-demand before creating\n // associated DOM element for it.\n vnode = ownerArray[index] = cloneVNode(vnode);\n }\n\n vnode.isRootInsert = !nested; // for transition enter check\n if (createComponent(vnode, insertedVnodeQueue, parentElm, refElm)) {\n return\n }\n\n var data = vnode.data;\n var children = vnode.children;\n var tag = vnode.tag;\n if (isDef(tag)) {\n {\n if (data && data.pre) {\n creatingElmInVPre++;\n }\n if (isUnknownElement$$1(vnode, creatingElmInVPre)) {\n warn(\n 'Unknown custom element: <' + tag + '> - did you ' +\n 'register the component correctly? For recursive components, ' +\n 'make sure to provide the \"name\" option.',\n vnode.context\n );\n }\n }\n\n vnode.elm = vnode.ns\n ? nodeOps.createElementNS(vnode.ns, tag)\n : nodeOps.createElement(tag, vnode);\n setScope(vnode);\n\n /* istanbul ignore if */\n {\n createChildren(vnode, children, insertedVnodeQueue);\n if (isDef(data)) {\n invokeCreateHooks(vnode, insertedVnodeQueue);\n }\n insert(parentElm, vnode.elm, refElm);\n }\n\n if (data && data.pre) {\n creatingElmInVPre--;\n }\n } else if (isTrue(vnode.isComment)) {\n vnode.elm = nodeOps.createComment(vnode.text);\n insert(parentElm, vnode.elm, refElm);\n } else {\n vnode.elm = nodeOps.createTextNode(vnode.text);\n insert(parentElm, vnode.elm, refElm);\n }\n }\n\n function createComponent (vnode, insertedVnodeQueue, parentElm, refElm) {\n var i = vnode.data;\n if (isDef(i)) {\n var isReactivated = isDef(vnode.componentInstance) && i.keepAlive;\n if (isDef(i = i.hook) && isDef(i = i.init)) {\n i(vnode, false /* hydrating */);\n }\n // after calling the init hook, if the vnode is a child component\n // it should've created a child instance and mounted it. the child\n // component also has set the placeholder vnode's elm.\n // in that case we can just return the element and be done.\n if (isDef(vnode.componentInstance)) {\n initComponent(vnode, insertedVnodeQueue);\n insert(parentElm, vnode.elm, refElm);\n if (isTrue(isReactivated)) {\n reactivateComponent(vnode, insertedVnodeQueue, parentElm, refElm);\n }\n return true\n }\n }\n }\n\n function initComponent (vnode, insertedVnodeQueue) {\n if (isDef(vnode.data.pendingInsert)) {\n insertedVnodeQueue.push.apply(insertedVnodeQueue, vnode.data.pendingInsert);\n vnode.data.pendingInsert = null;\n }\n vnode.elm = vnode.componentInstance.$el;\n if (isPatchable(vnode)) {\n invokeCreateHooks(vnode, insertedVnodeQueue);\n setScope(vnode);\n } else {\n // empty component root.\n // skip all element-related modules except for ref (#3455)\n registerRef(vnode);\n // make sure to invoke the insert hook\n insertedVnodeQueue.push(vnode);\n }\n }\n\n function reactivateComponent (vnode, insertedVnodeQueue, parentElm, refElm) {\n var i;\n // hack for #4339: a reactivated component with inner transition\n // does not trigger because the inner node's created hooks are not called\n // again. It's not ideal to involve module-specific logic in here but\n // there doesn't seem to be a better way to do it.\n var innerNode = vnode;\n while (innerNode.componentInstance) {\n innerNode = innerNode.componentInstance._vnode;\n if (isDef(i = innerNode.data) && isDef(i = i.transition)) {\n for (i = 0; i < cbs.activate.length; ++i) {\n cbs.activate[i](emptyNode, innerNode);\n }\n insertedVnodeQueue.push(innerNode);\n break\n }\n }\n // unlike a newly created component,\n // a reactivated keep-alive component doesn't insert itself\n insert(parentElm, vnode.elm, refElm);\n }\n\n function insert (parent, elm, ref$$1) {\n if (isDef(parent)) {\n if (isDef(ref$$1)) {\n if (nodeOps.parentNode(ref$$1) === parent) {\n nodeOps.insertBefore(parent, elm, ref$$1);\n }\n } else {\n nodeOps.appendChild(parent, elm);\n }\n }\n }\n\n function createChildren (vnode, children, insertedVnodeQueue) {\n if (Array.isArray(children)) {\n {\n checkDuplicateKeys(children);\n }\n for (var i = 0; i < children.length; ++i) {\n createElm(children[i], insertedVnodeQueue, vnode.elm, null, true, children, i);\n }\n } else if (isPrimitive(vnode.text)) {\n nodeOps.appendChild(vnode.elm, nodeOps.createTextNode(String(vnode.text)));\n }\n }\n\n function isPatchable (vnode) {\n while (vnode.componentInstance) {\n vnode = vnode.componentInstance._vnode;\n }\n return isDef(vnode.tag)\n }\n\n function invokeCreateHooks (vnode, insertedVnodeQueue) {\n for (var i$1 = 0; i$1 < cbs.create.length; ++i$1) {\n cbs.create[i$1](emptyNode, vnode);\n }\n i = vnode.data.hook; // Reuse variable\n if (isDef(i)) {\n if (isDef(i.create)) { i.create(emptyNode, vnode); }\n if (isDef(i.insert)) { insertedVnodeQueue.push(vnode); }\n }\n }\n\n // set scope id attribute for scoped CSS.\n // this is implemented as a special case to avoid the overhead\n // of going through the normal attribute patching process.\n function setScope (vnode) {\n var i;\n if (isDef(i = vnode.fnScopeId)) {\n nodeOps.setStyleScope(vnode.elm, i);\n } else {\n var ancestor = vnode;\n while (ancestor) {\n if (isDef(i = ancestor.context) && isDef(i = i.$options._scopeId)) {\n nodeOps.setStyleScope(vnode.elm, i);\n }\n ancestor = ancestor.parent;\n }\n }\n // for slot content they should also get the scopeId from the host instance.\n if (isDef(i = activeInstance) &&\n i !== vnode.context &&\n i !== vnode.fnContext &&\n isDef(i = i.$options._scopeId)\n ) {\n nodeOps.setStyleScope(vnode.elm, i);\n }\n }\n\n function addVnodes (parentElm, refElm, vnodes, startIdx, endIdx, insertedVnodeQueue) {\n for (; startIdx <= endIdx; ++startIdx) {\n createElm(vnodes[startIdx], insertedVnodeQueue, parentElm, refElm, false, vnodes, startIdx);\n }\n }\n\n function invokeDestroyHook (vnode) {\n var i, j;\n var data = vnode.data;\n if (isDef(data)) {\n if (isDef(i = data.hook) && isDef(i = i.destroy)) { i(vnode); }\n for (i = 0; i < cbs.destroy.length; ++i) { cbs.destroy[i](vnode); }\n }\n if (isDef(i = vnode.children)) {\n for (j = 0; j < vnode.children.length; ++j) {\n invokeDestroyHook(vnode.children[j]);\n }\n }\n }\n\n function removeVnodes (parentElm, vnodes, startIdx, endIdx) {\n for (; startIdx <= endIdx; ++startIdx) {\n var ch = vnodes[startIdx];\n if (isDef(ch)) {\n if (isDef(ch.tag)) {\n removeAndInvokeRemoveHook(ch);\n invokeDestroyHook(ch);\n } else { // Text node\n removeNode(ch.elm);\n }\n }\n }\n }\n\n function removeAndInvokeRemoveHook (vnode, rm) {\n if (isDef(rm) || isDef(vnode.data)) {\n var i;\n var listeners = cbs.remove.length + 1;\n if (isDef(rm)) {\n // we have a recursively passed down rm callback\n // increase the listeners count\n rm.listeners += listeners;\n } else {\n // directly removing\n rm = createRmCb(vnode.elm, listeners);\n }\n // recursively invoke hooks on child component root node\n if (isDef(i = vnode.componentInstance) && isDef(i = i._vnode) && isDef(i.data)) {\n removeAndInvokeRemoveHook(i, rm);\n }\n for (i = 0; i < cbs.remove.length; ++i) {\n cbs.remove[i](vnode, rm);\n }\n if (isDef(i = vnode.data.hook) && isDef(i = i.remove)) {\n i(vnode, rm);\n } else {\n rm();\n }\n } else {\n removeNode(vnode.elm);\n }\n }\n\n function updateChildren (parentElm, oldCh, newCh, insertedVnodeQueue, removeOnly) {\n var oldStartIdx = 0;\n var newStartIdx = 0;\n var oldEndIdx = oldCh.length - 1;\n var oldStartVnode = oldCh[0];\n var oldEndVnode = oldCh[oldEndIdx];\n var newEndIdx = newCh.length - 1;\n var newStartVnode = newCh[0];\n var newEndVnode = newCh[newEndIdx];\n var oldKeyToIdx, idxInOld, vnodeToMove, refElm;\n\n // removeOnly is a special flag used only by <transition-group>\n // to ensure removed elements stay in correct relative positions\n // during leaving transitions\n var canMove = !removeOnly;\n\n {\n checkDuplicateKeys(newCh);\n }\n\n while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {\n if (isUndef(oldStartVnode)) {\n oldStartVnode = oldCh[++oldStartIdx]; // Vnode has been moved left\n } else if (isUndef(oldEndVnode)) {\n oldEndVnode = oldCh[--oldEndIdx];\n } else if (sameVnode(oldStartVnode, newStartVnode)) {\n patchVnode(oldStartVnode, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);\n oldStartVnode = oldCh[++oldStartIdx];\n newStartVnode = newCh[++newStartIdx];\n } else if (sameVnode(oldEndVnode, newEndVnode)) {\n patchVnode(oldEndVnode, newEndVnode, insertedVnodeQueue, newCh, newEndIdx);\n oldEndVnode = oldCh[--oldEndIdx];\n newEndVnode = newCh[--newEndIdx];\n } else if (sameVnode(oldStartVnode, newEndVnode)) { // Vnode moved right\n patchVnode(oldStartVnode, newEndVnode, insertedVnodeQueue, newCh, newEndIdx);\n canMove && nodeOps.insertBefore(parentElm, oldStartVnode.elm, nodeOps.nextSibling(oldEndVnode.elm));\n oldStartVnode = oldCh[++oldStartIdx];\n newEndVnode = newCh[--newEndIdx];\n } else if (sameVnode(oldEndVnode, newStartVnode)) { // Vnode moved left\n patchVnode(oldEndVnode, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);\n canMove && nodeOps.insertBefore(parentElm, oldEndVnode.elm, oldStartVnode.elm);\n oldEndVnode = oldCh[--oldEndIdx];\n newStartVnode = newCh[++newStartIdx];\n } else {\n if (isUndef(oldKeyToIdx)) { oldKeyToIdx = createKeyToOldIdx(oldCh, oldStartIdx, oldEndIdx); }\n idxInOld = isDef(newStartVnode.key)\n ? oldKeyToIdx[newStartVnode.key]\n : findIdxInOld(newStartVnode, oldCh, oldStartIdx, oldEndIdx);\n if (isUndef(idxInOld)) { // New element\n createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm, false, newCh, newStartIdx);\n } else {\n vnodeToMove = oldCh[idxInOld];\n if (sameVnode(vnodeToMove, newStartVnode)) {\n patchVnode(vnodeToMove, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);\n oldCh[idxInOld] = undefined;\n canMove && nodeOps.insertBefore(parentElm, vnodeToMove.elm, oldStartVnode.elm);\n } else {\n // same key but different element. treat as new element\n createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm, false, newCh, newStartIdx);\n }\n }\n newStartVnode = newCh[++newStartIdx];\n }\n }\n if (oldStartIdx > oldEndIdx) {\n refElm = isUndef(newCh[newEndIdx + 1]) ? null : newCh[newEndIdx + 1].elm;\n addVnodes(parentElm, refElm, newCh, newStartIdx, newEndIdx, insertedVnodeQueue);\n } else if (newStartIdx > newEndIdx) {\n removeVnodes(parentElm, oldCh, oldStartIdx, oldEndIdx);\n }\n }\n\n function checkDuplicateKeys (children) {\n var seenKeys = {};\n for (var i = 0; i < children.length; i++) {\n var vnode = children[i];\n var key = vnode.key;\n if (isDef(key)) {\n if (seenKeys[key]) {\n warn(\n (\"Duplicate keys detected: '\" + key + \"'. This may cause an update error.\"),\n vnode.context\n );\n } else {\n seenKeys[key] = true;\n }\n }\n }\n }\n\n function findIdxInOld (node, oldCh, start, end) {\n for (var i = start; i < end; i++) {\n var c = oldCh[i];\n if (isDef(c) && sameVnode(node, c)) { return i }\n }\n }\n\n function patchVnode (\n oldVnode,\n vnode,\n insertedVnodeQueue,\n ownerArray,\n index,\n removeOnly\n ) {\n if (oldVnode === vnode) {\n return\n }\n\n if (isDef(vnode.elm) && isDef(ownerArray)) {\n // clone reused vnode\n vnode = ownerArray[index] = cloneVNode(vnode);\n }\n\n var elm = vnode.elm = oldVnode.elm;\n\n if (isTrue(oldVnode.isAsyncPlaceholder)) {\n if (isDef(vnode.asyncFactory.resolved)) {\n hydrate(oldVnode.elm, vnode, insertedVnodeQueue);\n } else {\n vnode.isAsyncPlaceholder = true;\n }\n return\n }\n\n // reuse element for static trees.\n // note we only do this if the vnode is cloned -\n // if the new node is not cloned it means the render functions have been\n // reset by the hot-reload-api and we need to do a proper re-render.\n if (isTrue(vnode.isStatic) &&\n isTrue(oldVnode.isStatic) &&\n vnode.key === oldVnode.key &&\n (isTrue(vnode.isCloned) || isTrue(vnode.isOnce))\n ) {\n vnode.componentInstance = oldVnode.componentInstance;\n return\n }\n\n var i;\n var data = vnode.data;\n if (isDef(data) && isDef(i = data.hook) && isDef(i = i.prepatch)) {\n i(oldVnode, vnode);\n }\n\n var oldCh = oldVnode.children;\n var ch = vnode.children;\n if (isDef(data) && isPatchable(vnode)) {\n for (i = 0; i < cbs.update.length; ++i) { cbs.update[i](oldVnode, vnode); }\n if (isDef(i = data.hook) && isDef(i = i.update)) { i(oldVnode, vnode); }\n }\n if (isUndef(vnode.text)) {\n if (isDef(oldCh) && isDef(ch)) {\n if (oldCh !== ch) { updateChildren(elm, oldCh, ch, insertedVnodeQueue, removeOnly); }\n } else if (isDef(ch)) {\n {\n checkDuplicateKeys(ch);\n }\n if (isDef(oldVnode.text)) { nodeOps.setTextContent(elm, ''); }\n addVnodes(elm, null, ch, 0, ch.length - 1, insertedVnodeQueue);\n } else if (isDef(oldCh)) {\n removeVnodes(elm, oldCh, 0, oldCh.length - 1);\n } else if (isDef(oldVnode.text)) {\n nodeOps.setTextContent(elm, '');\n }\n } else if (oldVnode.text !== vnode.text) {\n nodeOps.setTextContent(elm, vnode.text);\n }\n if (isDef(data)) {\n if (isDef(i = data.hook) && isDef(i = i.postpatch)) { i(oldVnode, vnode); }\n }\n }\n\n function invokeInsertHook (vnode, queue, initial) {\n // delay insert hooks for component root nodes, invoke them after the\n // element is really inserted\n if (isTrue(initial) && isDef(vnode.parent)) {\n vnode.parent.data.pendingInsert = queue;\n } else {\n for (var i = 0; i < queue.length; ++i) {\n queue[i].data.hook.insert(queue[i]);\n }\n }\n }\n\n var hydrationBailed = false;\n // list of modules that can skip create hook during hydration because they\n // are already rendered on the client or has no need for initialization\n // Note: style is excluded because it relies on initial clone for future\n // deep updates (#7063).\n var isRenderedModule = makeMap('attrs,class,staticClass,staticStyle,key');\n\n // Note: this is a browser-only function so we can assume elms are DOM nodes.\n function hydrate (elm, vnode, insertedVnodeQueue, inVPre) {\n var i;\n var tag = vnode.tag;\n var data = vnode.data;\n var children = vnode.children;\n inVPre = inVPre || (data && data.pre);\n vnode.elm = elm;\n\n if (isTrue(vnode.isComment) && isDef(vnode.asyncFactory)) {\n vnode.isAsyncPlaceholder = true;\n return true\n }\n // assert node match\n {\n if (!assertNodeMatch(elm, vnode, inVPre)) {\n return false\n }\n }\n if (isDef(data)) {\n if (isDef(i = data.hook) && isDef(i = i.init)) { i(vnode, true /* hydrating */); }\n if (isDef(i = vnode.componentInstance)) {\n // child component. it should have hydrated its own tree.\n initComponent(vnode, insertedVnodeQueue);\n return true\n }\n }\n if (isDef(tag)) {\n if (isDef(children)) {\n // empty element, allow client to pick up and populate children\n if (!elm.hasChildNodes()) {\n createChildren(vnode, children, insertedVnodeQueue);\n } else {\n // v-html and domProps: innerHTML\n if (isDef(i = data) && isDef(i = i.domProps) && isDef(i = i.innerHTML)) {\n if (i !== elm.innerHTML) {\n /* istanbul ignore if */\n if (typeof console !== 'undefined' &&\n !hydrationBailed\n ) {\n hydrationBailed = true;\n console.warn('Parent: ', elm);\n console.warn('server innerHTML: ', i);\n console.warn('client innerHTML: ', elm.innerHTML);\n }\n return false\n }\n } else {\n // iterate and compare children lists\n var childrenMatch = true;\n var childNode = elm.firstChild;\n for (var i$1 = 0; i$1 < children.length; i$1++) {\n if (!childNode || !hydrate(childNode, children[i$1], insertedVnodeQueue, inVPre)) {\n childrenMatch = false;\n break\n }\n childNode = childNode.nextSibling;\n }\n // if childNode is not null, it means the actual childNodes list is\n // longer than the virtual children list.\n if (!childrenMatch || childNode) {\n /* istanbul ignore if */\n if (typeof console !== 'undefined' &&\n !hydrationBailed\n ) {\n hydrationBailed = true;\n console.warn('Parent: ', elm);\n console.warn('Mismatching childNodes vs. VNodes: ', elm.childNodes, children);\n }\n return false\n }\n }\n }\n }\n if (isDef(data)) {\n var fullInvoke = false;\n for (var key in data) {\n if (!isRenderedModule(key)) {\n fullInvoke = true;\n invokeCreateHooks(vnode, insertedVnodeQueue);\n break\n }\n }\n if (!fullInvoke && data['class']) {\n // ensure collecting deps for deep class bindings for future updates\n traverse(data['class']);\n }\n }\n } else if (elm.data !== vnode.text) {\n elm.data = vnode.text;\n }\n return true\n }\n\n function assertNodeMatch (node, vnode, inVPre) {\n if (isDef(vnode.tag)) {\n return vnode.tag.indexOf('vue-component') === 0 || (\n !isUnknownElement$$1(vnode, inVPre) &&\n vnode.tag.toLowerCase() === (node.tagName && node.tagName.toLowerCase())\n )\n } else {\n return node.nodeType === (vnode.isComment ? 8 : 3)\n }\n }\n\n return function patch (oldVnode, vnode, hydrating, removeOnly) {\n if (isUndef(vnode)) {\n if (isDef(oldVnode)) { invokeDestroyHook(oldVnode); }\n return\n }\n\n var isInitialPatch = false;\n var insertedVnodeQueue = [];\n\n if (isUndef(oldVnode)) {\n // empty mount (likely as component), create new root element\n isInitialPatch = true;\n createElm(vnode, insertedVnodeQueue);\n } else {\n var isRealElement = isDef(oldVnode.nodeType);\n if (!isRealElement && sameVnode(oldVnode, vnode)) {\n // patch existing root node\n patchVnode(oldVnode, vnode, insertedVnodeQueue, null, null, removeOnly);\n } else {\n if (isRealElement) {\n // mounting to a real element\n // check if this is server-rendered content and if we can perform\n // a successful hydration.\n if (oldVnode.nodeType === 1 && oldVnode.hasAttribute(SSR_ATTR)) {\n oldVnode.removeAttribute(SSR_ATTR);\n hydrating = true;\n }\n if (isTrue(hydrating)) {\n if (hydrate(oldVnode, vnode, insertedVnodeQueue)) {\n invokeInsertHook(vnode, insertedVnodeQueue, true);\n return oldVnode\n } else {\n warn(\n 'The client-side rendered virtual DOM tree is not matching ' +\n 'server-rendered content. This is likely caused by incorrect ' +\n 'HTML markup, for example nesting block-level elements inside ' +\n '<p>, or missing <tbody>. Bailing hydration and performing ' +\n 'full client-side render.'\n );\n }\n }\n // either not server-rendered, or hydration failed.\n // create an empty node and replace it\n oldVnode = emptyNodeAt(oldVnode);\n }\n\n // replacing existing element\n var oldElm = oldVnode.elm;\n var parentElm = nodeOps.parentNode(oldElm);\n\n // create new node\n createElm(\n vnode,\n insertedVnodeQueue,\n // extremely rare edge case: do not insert if old element is in a\n // leaving transition. Only happens when combining transition +\n // keep-alive + HOCs. (#4590)\n oldElm._leaveCb ? null : parentElm,\n nodeOps.nextSibling(oldElm)\n );\n\n // update parent placeholder node element, recursively\n if (isDef(vnode.parent)) {\n var ancestor = vnode.parent;\n var patchable = isPatchable(vnode);\n while (ancestor) {\n for (var i = 0; i < cbs.destroy.length; ++i) {\n cbs.destroy[i](ancestor);\n }\n ancestor.elm = vnode.elm;\n if (patchable) {\n for (var i$1 = 0; i$1 < cbs.create.length; ++i$1) {\n cbs.create[i$1](emptyNode, ancestor);\n }\n // #6513\n // invoke insert hooks that may have been merged by create hooks.\n // e.g. for directives that uses the \"inserted\" hook.\n var insert = ancestor.data.hook.insert;\n if (insert.merged) {\n // start at index 1 to avoid re-invoking component mounted hook\n for (var i$2 = 1; i$2 < insert.fns.length; i$2++) {\n insert.fns[i$2]();\n }\n }\n } else {\n registerRef(ancestor);\n }\n ancestor = ancestor.parent;\n }\n }\n\n // destroy old node\n if (isDef(parentElm)) {\n removeVnodes(parentElm, [oldVnode], 0, 0);\n } else if (isDef(oldVnode.tag)) {\n invokeDestroyHook(oldVnode);\n }\n }\n }\n\n invokeInsertHook(vnode, insertedVnodeQueue, isInitialPatch);\n return vnode.elm\n }\n}\n\n/* */\n\nvar directives = {\n create: updateDirectives,\n update: updateDirectives,\n destroy: function unbindDirectives (vnode) {\n updateDirectives(vnode, emptyNode);\n }\n};\n\nfunction updateDirectives (oldVnode, vnode) {\n if (oldVnode.data.directives || vnode.data.directives) {\n _update(oldVnode, vnode);\n }\n}\n\nfunction _update (oldVnode, vnode) {\n var isCreate = oldVnode === emptyNode;\n var isDestroy = vnode === emptyNode;\n var oldDirs = normalizeDirectives$1(oldVnode.data.directives, oldVnode.context);\n var newDirs = normalizeDirectives$1(vnode.data.directives, vnode.context);\n\n var dirsWithInsert = [];\n var dirsWithPostpatch = [];\n\n var key, oldDir, dir;\n for (key in newDirs) {\n oldDir = oldDirs[key];\n dir = newDirs[key];\n if (!oldDir) {\n // new directive, bind\n callHook$1(dir, 'bind', vnode, oldVnode);\n if (dir.def && dir.def.inserted) {\n dirsWithInsert.push(dir);\n }\n } else {\n // existing directive, update\n dir.oldValue = oldDir.value;\n dir.oldArg = oldDir.arg;\n callHook$1(dir, 'update', vnode, oldVnode);\n if (dir.def && dir.def.componentUpdated) {\n dirsWithPostpatch.push(dir);\n }\n }\n }\n\n if (dirsWithInsert.length) {\n var callInsert = function () {\n for (var i = 0; i < dirsWithInsert.length; i++) {\n callHook$1(dirsWithInsert[i], 'inserted', vnode, oldVnode);\n }\n };\n if (isCreate) {\n mergeVNodeHook(vnode, 'insert', callInsert);\n } else {\n callInsert();\n }\n }\n\n if (dirsWithPostpatch.length) {\n mergeVNodeHook(vnode, 'postpatch', function () {\n for (var i = 0; i < dirsWithPostpatch.length; i++) {\n callHook$1(dirsWithPostpatch[i], 'componentUpdated', vnode, oldVnode);\n }\n });\n }\n\n if (!isCreate) {\n for (key in oldDirs) {\n if (!newDirs[key]) {\n // no longer present, unbind\n callHook$1(oldDirs[key], 'unbind', oldVnode, oldVnode, isDestroy);\n }\n }\n }\n}\n\nvar emptyModifiers = Object.create(null);\n\nfunction normalizeDirectives$1 (\n dirs,\n vm\n) {\n var res = Object.create(null);\n if (!dirs) {\n // $flow-disable-line\n return res\n }\n var i, dir;\n for (i = 0; i < dirs.length; i++) {\n dir = dirs[i];\n if (!dir.modifiers) {\n // $flow-disable-line\n dir.modifiers = emptyModifiers;\n }\n res[getRawDirName(dir)] = dir;\n dir.def = resolveAsset(vm.$options, 'directives', dir.name, true);\n }\n // $flow-disable-line\n return res\n}\n\nfunction getRawDirName (dir) {\n return dir.rawName || ((dir.name) + \".\" + (Object.keys(dir.modifiers || {}).join('.')))\n}\n\nfunction callHook$1 (dir, hook, vnode, oldVnode, isDestroy) {\n var fn = dir.def && dir.def[hook];\n if (fn) {\n try {\n fn(vnode.elm, dir, vnode, oldVnode, isDestroy);\n } catch (e) {\n handleError(e, vnode.context, (\"directive \" + (dir.name) + \" \" + hook + \" hook\"));\n }\n }\n}\n\nvar baseModules = [\n ref,\n directives\n];\n\n/* */\n\nfunction updateAttrs (oldVnode, vnode) {\n var opts = vnode.componentOptions;\n if (isDef(opts) && opts.Ctor.options.inheritAttrs === false) {\n return\n }\n if (isUndef(oldVnode.data.attrs) && isUndef(vnode.data.attrs)) {\n return\n }\n var key, cur, old;\n var elm = vnode.elm;\n var oldAttrs = oldVnode.data.attrs || {};\n var attrs = vnode.data.attrs || {};\n // clone observed objects, as the user probably wants to mutate it\n if (isDef(attrs.__ob__)) {\n attrs = vnode.data.attrs = extend({}, attrs);\n }\n\n for (key in attrs) {\n cur = attrs[key];\n old = oldAttrs[key];\n if (old !== cur) {\n setAttr(elm, key, cur);\n }\n }\n // #4391: in IE9, setting type can reset value for input[type=radio]\n // #6666: IE/Edge forces progress value down to 1 before setting a max\n /* istanbul ignore if */\n if ((isIE || isEdge) && attrs.value !== oldAttrs.value) {\n setAttr(elm, 'value', attrs.value);\n }\n for (key in oldAttrs) {\n if (isUndef(attrs[key])) {\n if (isXlink(key)) {\n elm.removeAttributeNS(xlinkNS, getXlinkProp(key));\n } else if (!isEnumeratedAttr(key)) {\n elm.removeAttribute(key);\n }\n }\n }\n}\n\nfunction setAttr (el, key, value) {\n if (el.tagName.indexOf('-') > -1) {\n baseSetAttr(el, key, value);\n } else if (isBooleanAttr(key)) {\n // set attribute for blank value\n // e.g. <option disabled>Select one</option>\n if (isFalsyAttrValue(value)) {\n el.removeAttribute(key);\n } else {\n // technically allowfullscreen is a boolean attribute for <iframe>,\n // but Flash expects a value of \"true\" when used on <embed> tag\n value = key === 'allowfullscreen' && el.tagName === 'EMBED'\n ? 'true'\n : key;\n el.setAttribute(key, value);\n }\n } else if (isEnumeratedAttr(key)) {\n el.setAttribute(key, convertEnumeratedValue(key, value));\n } else if (isXlink(key)) {\n if (isFalsyAttrValue(value)) {\n el.removeAttributeNS(xlinkNS, getXlinkProp(key));\n } else {\n el.setAttributeNS(xlinkNS, key, value);\n }\n } else {\n baseSetAttr(el, key, value);\n }\n}\n\nfunction baseSetAttr (el, key, value) {\n if (isFalsyAttrValue(value)) {\n el.removeAttribute(key);\n } else {\n // #7138: IE10 & 11 fires input event when setting placeholder on\n // <textarea>... block the first input event and remove the blocker\n // immediately.\n /* istanbul ignore if */\n if (\n isIE && !isIE9 &&\n el.tagName === 'TEXTAREA' &&\n key === 'placeholder' && value !== '' && !el.__ieph\n ) {\n var blocker = function (e) {\n e.stopImmediatePropagation();\n el.removeEventListener('input', blocker);\n };\n el.addEventListener('input', blocker);\n // $flow-disable-line\n el.__ieph = true; /* IE placeholder patched */\n }\n el.setAttribute(key, value);\n }\n}\n\nvar attrs = {\n create: updateAttrs,\n update: updateAttrs\n};\n\n/* */\n\nfunction updateClass (oldVnode, vnode) {\n var el = vnode.elm;\n var data = vnode.data;\n var oldData = oldVnode.data;\n if (\n isUndef(data.staticClass) &&\n isUndef(data.class) && (\n isUndef(oldData) || (\n isUndef(oldData.staticClass) &&\n isUndef(oldData.class)\n )\n )\n ) {\n return\n }\n\n var cls = genClassForVnode(vnode);\n\n // handle transition classes\n var transitionClass = el._transitionClasses;\n if (isDef(transitionClass)) {\n cls = concat(cls, stringifyClass(transitionClass));\n }\n\n // set the class\n if (cls !== el._prevClass) {\n el.setAttribute('class', cls);\n el._prevClass = cls;\n }\n}\n\nvar klass = {\n create: updateClass,\n update: updateClass\n};\n\n/* */\n\nvar validDivisionCharRE = /[\\w).+\\-_$\\]]/;\n\nfunction parseFilters (exp) {\n var inSingle = false;\n var inDouble = false;\n var inTemplateString = false;\n var inRegex = false;\n var curly = 0;\n var square = 0;\n var paren = 0;\n var lastFilterIndex = 0;\n var c, prev, i, expression, filters;\n\n for (i = 0; i < exp.length; i++) {\n prev = c;\n c = exp.charCodeAt(i);\n if (inSingle) {\n if (c === 0x27 && prev !== 0x5C) { inSingle = false; }\n } else if (inDouble) {\n if (c === 0x22 && prev !== 0x5C) { inDouble = false; }\n } else if (inTemplateString) {\n if (c === 0x60 && prev !== 0x5C) { inTemplateString = false; }\n } else if (inRegex) {\n if (c === 0x2f && prev !== 0x5C) { inRegex = false; }\n } else if (\n c === 0x7C && // pipe\n exp.charCodeAt(i + 1) !== 0x7C &&\n exp.charCodeAt(i - 1) !== 0x7C &&\n !curly && !square && !paren\n ) {\n if (expression === undefined) {\n // first filter, end of expression\n lastFilterIndex = i + 1;\n expression = exp.slice(0, i).trim();\n } else {\n pushFilter();\n }\n } else {\n switch (c) {\n case 0x22: inDouble = true; break // \"\n case 0x27: inSingle = true; break // '\n case 0x60: inTemplateString = true; break // `\n case 0x28: paren++; break // (\n case 0x29: paren--; break // )\n case 0x5B: square++; break // [\n case 0x5D: square--; break // ]\n case 0x7B: curly++; break // {\n case 0x7D: curly--; break // }\n }\n if (c === 0x2f) { // /\n var j = i - 1;\n var p = (void 0);\n // find first non-whitespace prev char\n for (; j >= 0; j--) {\n p = exp.charAt(j);\n if (p !== ' ') { break }\n }\n if (!p || !validDivisionCharRE.test(p)) {\n inRegex = true;\n }\n }\n }\n }\n\n if (expression === undefined) {\n expression = exp.slice(0, i).trim();\n } else if (lastFilterIndex !== 0) {\n pushFilter();\n }\n\n function pushFilter () {\n (filters || (filters = [])).push(exp.slice(lastFilterIndex, i).trim());\n lastFilterIndex = i + 1;\n }\n\n if (filters) {\n for (i = 0; i < filters.length; i++) {\n expression = wrapFilter(expression, filters[i]);\n }\n }\n\n return expression\n}\n\nfunction wrapFilter (exp, filter) {\n var i = filter.indexOf('(');\n if (i < 0) {\n // _f: resolveFilter\n return (\"_f(\\\"\" + filter + \"\\\")(\" + exp + \")\")\n } else {\n var name = filter.slice(0, i);\n var args = filter.slice(i + 1);\n return (\"_f(\\\"\" + name + \"\\\")(\" + exp + (args !== ')' ? ',' + args : args))\n }\n}\n\n/* */\n\n\n\n/* eslint-disable no-unused-vars */\nfunction baseWarn (msg, range) {\n console.error((\"[Vue compiler]: \" + msg));\n}\n/* eslint-enable no-unused-vars */\n\nfunction pluckModuleFunction (\n modules,\n key\n) {\n return modules\n ? modules.map(function (m) { return m[key]; }).filter(function (_) { return _; })\n : []\n}\n\nfunction addProp (el, name, value, range, dynamic) {\n (el.props || (el.props = [])).push(rangeSetItem({ name: name, value: value, dynamic: dynamic }, range));\n el.plain = false;\n}\n\nfunction addAttr (el, name, value, range, dynamic) {\n var attrs = dynamic\n ? (el.dynamicAttrs || (el.dynamicAttrs = []))\n : (el.attrs || (el.attrs = []));\n attrs.push(rangeSetItem({ name: name, value: value, dynamic: dynamic }, range));\n el.plain = false;\n}\n\n// add a raw attr (use this in preTransforms)\nfunction addRawAttr (el, name, value, range) {\n el.attrsMap[name] = value;\n el.attrsList.push(rangeSetItem({ name: name, value: value }, range));\n}\n\nfunction addDirective (\n el,\n name,\n rawName,\n value,\n arg,\n isDynamicArg,\n modifiers,\n range\n) {\n (el.directives || (el.directives = [])).push(rangeSetItem({\n name: name,\n rawName: rawName,\n value: value,\n arg: arg,\n isDynamicArg: isDynamicArg,\n modifiers: modifiers\n }, range));\n el.plain = false;\n}\n\nfunction prependModifierMarker (symbol, name, dynamic) {\n return dynamic\n ? (\"_p(\" + name + \",\\\"\" + symbol + \"\\\")\")\n : symbol + name // mark the event as captured\n}\n\nfunction addHandler (\n el,\n name,\n value,\n modifiers,\n important,\n warn,\n range,\n dynamic\n) {\n modifiers = modifiers || emptyObject;\n // warn prevent and passive modifier\n /* istanbul ignore if */\n if (\n warn &&\n modifiers.prevent && modifiers.passive\n ) {\n warn(\n 'passive and prevent can\\'t be used together. ' +\n 'Passive handler can\\'t prevent default event.',\n range\n );\n }\n\n // normalize click.right and click.middle since they don't actually fire\n // this is technically browser-specific, but at least for now browsers are\n // the only target envs that have right/middle clicks.\n if (modifiers.right) {\n if (dynamic) {\n name = \"(\" + name + \")==='click'?'contextmenu':(\" + name + \")\";\n } else if (name === 'click') {\n name = 'contextmenu';\n delete modifiers.right;\n }\n } else if (modifiers.middle) {\n if (dynamic) {\n name = \"(\" + name + \")==='click'?'mouseup':(\" + name + \")\";\n } else if (name === 'click') {\n name = 'mouseup';\n }\n }\n\n // check capture modifier\n if (modifiers.capture) {\n delete modifiers.capture;\n name = prependModifierMarker('!', name, dynamic);\n }\n if (modifiers.once) {\n delete modifiers.once;\n name = prependModifierMarker('~', name, dynamic);\n }\n /* istanbul ignore if */\n if (modifiers.passive) {\n delete modifiers.passive;\n name = prependModifierMarker('&', name, dynamic);\n }\n\n var events;\n if (modifiers.native) {\n delete modifiers.native;\n events = el.nativeEvents || (el.nativeEvents = {});\n } else {\n events = el.events || (el.events = {});\n }\n\n var newHandler = rangeSetItem({ value: value.trim(), dynamic: dynamic }, range);\n if (modifiers !== emptyObject) {\n newHandler.modifiers = modifiers;\n }\n\n var handlers = events[name];\n /* istanbul ignore if */\n if (Array.isArray(handlers)) {\n important ? handlers.unshift(newHandler) : handlers.push(newHandler);\n } else if (handlers) {\n events[name] = important ? [newHandler, handlers] : [handlers, newHandler];\n } else {\n events[name] = newHandler;\n }\n\n el.plain = false;\n}\n\nfunction getRawBindingAttr (\n el,\n name\n) {\n return el.rawAttrsMap[':' + name] ||\n el.rawAttrsMap['v-bind:' + name] ||\n el.rawAttrsMap[name]\n}\n\nfunction getBindingAttr (\n el,\n name,\n getStatic\n) {\n var dynamicValue =\n getAndRemoveAttr(el, ':' + name) ||\n getAndRemoveAttr(el, 'v-bind:' + name);\n if (dynamicValue != null) {\n return parseFilters(dynamicValue)\n } else if (getStatic !== false) {\n var staticValue = getAndRemoveAttr(el, name);\n if (staticValue != null) {\n return JSON.stringify(staticValue)\n }\n }\n}\n\n// note: this only removes the attr from the Array (attrsList) so that it\n// doesn't get processed by processAttrs.\n// By default it does NOT remove it from the map (attrsMap) because the map is\n// needed during codegen.\nfunction getAndRemoveAttr (\n el,\n name,\n removeFromMap\n) {\n var val;\n if ((val = el.attrsMap[name]) != null) {\n var list = el.attrsList;\n for (var i = 0, l = list.length; i < l; i++) {\n if (list[i].name === name) {\n list.splice(i, 1);\n break\n }\n }\n }\n if (removeFromMap) {\n delete el.attrsMap[name];\n }\n return val\n}\n\nfunction getAndRemoveAttrByRegex (\n el,\n name\n) {\n var list = el.attrsList;\n for (var i = 0, l = list.length; i < l; i++) {\n var attr = list[i];\n if (name.test(attr.name)) {\n list.splice(i, 1);\n return attr\n }\n }\n}\n\nfunction rangeSetItem (\n item,\n range\n) {\n if (range) {\n if (range.start != null) {\n item.start = range.start;\n }\n if (range.end != null) {\n item.end = range.end;\n }\n }\n return item\n}\n\n/* */\n\n/**\n * Cross-platform code generation for component v-model\n */\nfunction genComponentModel (\n el,\n value,\n modifiers\n) {\n var ref = modifiers || {};\n var number = ref.number;\n var trim = ref.trim;\n\n var baseValueExpression = '$$v';\n var valueExpression = baseValueExpression;\n if (trim) {\n valueExpression =\n \"(typeof \" + baseValueExpression + \" === 'string'\" +\n \"? \" + baseValueExpression + \".trim()\" +\n \": \" + baseValueExpression + \")\";\n }\n if (number) {\n valueExpression = \"_n(\" + valueExpression + \")\";\n }\n var assignment = genAssignmentCode(value, valueExpression);\n\n el.model = {\n value: (\"(\" + value + \")\"),\n expression: JSON.stringify(value),\n callback: (\"function (\" + baseValueExpression + \") {\" + assignment + \"}\")\n };\n}\n\n/**\n * Cross-platform codegen helper for generating v-model value assignment code.\n */\nfunction genAssignmentCode (\n value,\n assignment\n) {\n var res = parseModel(value);\n if (res.key === null) {\n return (value + \"=\" + assignment)\n } else {\n return (\"$set(\" + (res.exp) + \", \" + (res.key) + \", \" + assignment + \")\")\n }\n}\n\n/**\n * Parse a v-model expression into a base path and a final key segment.\n * Handles both dot-path and possible square brackets.\n *\n * Possible cases:\n *\n * - test\n * - test[key]\n * - test[test1[key]]\n * - test[\"a\"][key]\n * - xxx.test[a[a].test1[key]]\n * - test.xxx.a[\"asa\"][test1[key]]\n *\n */\n\nvar len, str, chr, index$1, expressionPos, expressionEndPos;\n\n\n\nfunction parseModel (val) {\n // Fix https://github.com/vuejs/vue/pull/7730\n // allow v-model=\"obj.val \" (trailing whitespace)\n val = val.trim();\n len = val.length;\n\n if (val.indexOf('[') < 0 || val.lastIndexOf(']') < len - 1) {\n index$1 = val.lastIndexOf('.');\n if (index$1 > -1) {\n return {\n exp: val.slice(0, index$1),\n key: '\"' + val.slice(index$1 + 1) + '\"'\n }\n } else {\n return {\n exp: val,\n key: null\n }\n }\n }\n\n str = val;\n index$1 = expressionPos = expressionEndPos = 0;\n\n while (!eof()) {\n chr = next();\n /* istanbul ignore if */\n if (isStringStart(chr)) {\n parseString(chr);\n } else if (chr === 0x5B) {\n parseBracket(chr);\n }\n }\n\n return {\n exp: val.slice(0, expressionPos),\n key: val.slice(expressionPos + 1, expressionEndPos)\n }\n}\n\nfunction next () {\n return str.charCodeAt(++index$1)\n}\n\nfunction eof () {\n return index$1 >= len\n}\n\nfunction isStringStart (chr) {\n return chr === 0x22 || chr === 0x27\n}\n\nfunction parseBracket (chr) {\n var inBracket = 1;\n expressionPos = index$1;\n while (!eof()) {\n chr = next();\n if (isStringStart(chr)) {\n parseString(chr);\n continue\n }\n if (chr === 0x5B) { inBracket++; }\n if (chr === 0x5D) { inBracket--; }\n if (inBracket === 0) {\n expressionEndPos = index$1;\n break\n }\n }\n}\n\nfunction parseString (chr) {\n var stringQuote = chr;\n while (!eof()) {\n chr = next();\n if (chr === stringQuote) {\n break\n }\n }\n}\n\n/* */\n\nvar warn$1;\n\n// in some cases, the event used has to be determined at runtime\n// so we used some reserved tokens during compile.\nvar RANGE_TOKEN = '__r';\nvar CHECKBOX_RADIO_TOKEN = '__c';\n\nfunction model (\n el,\n dir,\n _warn\n) {\n warn$1 = _warn;\n var value = dir.value;\n var modifiers = dir.modifiers;\n var tag = el.tag;\n var type = el.attrsMap.type;\n\n {\n // inputs with type=\"file\" are read only and setting the input's\n // value will throw an error.\n if (tag === 'input' && type === 'file') {\n warn$1(\n \"<\" + (el.tag) + \" v-model=\\\"\" + value + \"\\\" type=\\\"file\\\">:\\n\" +\n \"File inputs are read only. Use a v-on:change listener instead.\",\n el.rawAttrsMap['v-model']\n );\n }\n }\n\n if (el.component) {\n genComponentModel(el, value, modifiers);\n // component v-model doesn't need extra runtime\n return false\n } else if (tag === 'select') {\n genSelect(el, value, modifiers);\n } else if (tag === 'input' && type === 'checkbox') {\n genCheckboxModel(el, value, modifiers);\n } else if (tag === 'input' && type === 'radio') {\n genRadioModel(el, value, modifiers);\n } else if (tag === 'input' || tag === 'textarea') {\n genDefaultModel(el, value, modifiers);\n } else if (!config.isReservedTag(tag)) {\n genComponentModel(el, value, modifiers);\n // component v-model doesn't need extra runtime\n return false\n } else {\n warn$1(\n \"<\" + (el.tag) + \" v-model=\\\"\" + value + \"\\\">: \" +\n \"v-model is not supported on this element type. \" +\n 'If you are working with contenteditable, it\\'s recommended to ' +\n 'wrap a library dedicated for that purpose inside a custom component.',\n el.rawAttrsMap['v-model']\n );\n }\n\n // ensure runtime directive metadata\n return true\n}\n\nfunction genCheckboxModel (\n el,\n value,\n modifiers\n) {\n var number = modifiers && modifiers.number;\n var valueBinding = getBindingAttr(el, 'value') || 'null';\n var trueValueBinding = getBindingAttr(el, 'true-value') || 'true';\n var falseValueBinding = getBindingAttr(el, 'false-value') || 'false';\n addProp(el, 'checked',\n \"Array.isArray(\" + value + \")\" +\n \"?_i(\" + value + \",\" + valueBinding + \")>-1\" + (\n trueValueBinding === 'true'\n ? (\":(\" + value + \")\")\n : (\":_q(\" + value + \",\" + trueValueBinding + \")\")\n )\n );\n addHandler(el, 'change',\n \"var $$a=\" + value + \",\" +\n '$$el=$event.target,' +\n \"$$c=$$el.checked?(\" + trueValueBinding + \"):(\" + falseValueBinding + \");\" +\n 'if(Array.isArray($$a)){' +\n \"var $$v=\" + (number ? '_n(' + valueBinding + ')' : valueBinding) + \",\" +\n '$$i=_i($$a,$$v);' +\n \"if($$el.checked){$$i<0&&(\" + (genAssignmentCode(value, '$$a.concat([$$v])')) + \")}\" +\n \"else{$$i>-1&&(\" + (genAssignmentCode(value, '$$a.slice(0,$$i).concat($$a.slice($$i+1))')) + \")}\" +\n \"}else{\" + (genAssignmentCode(value, '$$c')) + \"}\",\n null, true\n );\n}\n\nfunction genRadioModel (\n el,\n value,\n modifiers\n) {\n var number = modifiers && modifiers.number;\n var valueBinding = getBindingAttr(el, 'value') || 'null';\n valueBinding = number ? (\"_n(\" + valueBinding + \")\") : valueBinding;\n addProp(el, 'checked', (\"_q(\" + value + \",\" + valueBinding + \")\"));\n addHandler(el, 'change', genAssignmentCode(value, valueBinding), null, true);\n}\n\nfunction genSelect (\n el,\n value,\n modifiers\n) {\n var number = modifiers && modifiers.number;\n var selectedVal = \"Array.prototype.filter\" +\n \".call($event.target.options,function(o){return o.selected})\" +\n \".map(function(o){var val = \\\"_value\\\" in o ? o._value : o.value;\" +\n \"return \" + (number ? '_n(val)' : 'val') + \"})\";\n\n var assignment = '$event.target.multiple ? $$selectedVal : $$selectedVal[0]';\n var code = \"var $$selectedVal = \" + selectedVal + \";\";\n code = code + \" \" + (genAssignmentCode(value, assignment));\n addHandler(el, 'change', code, null, true);\n}\n\nfunction genDefaultModel (\n el,\n value,\n modifiers\n) {\n var type = el.attrsMap.type;\n\n // warn if v-bind:value conflicts with v-model\n // except for inputs with v-bind:type\n {\n var value$1 = el.attrsMap['v-bind:value'] || el.attrsMap[':value'];\n var typeBinding = el.attrsMap['v-bind:type'] || el.attrsMap[':type'];\n if (value$1 && !typeBinding) {\n var binding = el.attrsMap['v-bind:value'] ? 'v-bind:value' : ':value';\n warn$1(\n binding + \"=\\\"\" + value$1 + \"\\\" conflicts with v-model on the same element \" +\n 'because the latter already expands to a value binding internally',\n el.rawAttrsMap[binding]\n );\n }\n }\n\n var ref = modifiers || {};\n var lazy = ref.lazy;\n var number = ref.number;\n var trim = ref.trim;\n var needCompositionGuard = !lazy && type !== 'range';\n var event = lazy\n ? 'change'\n : type === 'range'\n ? RANGE_TOKEN\n : 'input';\n\n var valueExpression = '$event.target.value';\n if (trim) {\n valueExpression = \"$event.target.value.trim()\";\n }\n if (number) {\n valueExpression = \"_n(\" + valueExpression + \")\";\n }\n\n var code = genAssignmentCode(value, valueExpression);\n if (needCompositionGuard) {\n code = \"if($event.target.composing)return;\" + code;\n }\n\n addProp(el, 'value', (\"(\" + value + \")\"));\n addHandler(el, event, code, null, true);\n if (trim || number) {\n addHandler(el, 'blur', '$forceUpdate()');\n }\n}\n\n/* */\n\n// normalize v-model event tokens that can only be determined at runtime.\n// it's important to place the event as the first in the array because\n// the whole point is ensuring the v-model callback gets called before\n// user-attached handlers.\nfunction normalizeEvents (on) {\n /* istanbul ignore if */\n if (isDef(on[RANGE_TOKEN])) {\n // IE input[type=range] only supports `change` event\n var event = isIE ? 'change' : 'input';\n on[event] = [].concat(on[RANGE_TOKEN], on[event] || []);\n delete on[RANGE_TOKEN];\n }\n // This was originally intended to fix #4521 but no longer necessary\n // after 2.5. Keeping it for backwards compat with generated code from < 2.4\n /* istanbul ignore if */\n if (isDef(on[CHECKBOX_RADIO_TOKEN])) {\n on.change = [].concat(on[CHECKBOX_RADIO_TOKEN], on.change || []);\n delete on[CHECKBOX_RADIO_TOKEN];\n }\n}\n\nvar target$1;\n\nfunction createOnceHandler$1 (event, handler, capture) {\n var _target = target$1; // save current target element in closure\n return function onceHandler () {\n var res = handler.apply(null, arguments);\n if (res !== null) {\n remove$2(event, onceHandler, capture, _target);\n }\n }\n}\n\n// #9446: Firefox <= 53 (in particular, ESR 52) has incorrect Event.timeStamp\n// implementation and does not fire microtasks in between event propagation, so\n// safe to exclude.\nvar useMicrotaskFix = isUsingMicroTask && !(isFF && Number(isFF[1]) <= 53);\n\nfunction add$1 (\n name,\n handler,\n capture,\n passive\n) {\n // async edge case #6566: inner click event triggers patch, event handler\n // attached to outer element during patch, and triggered again. This\n // happens because browsers fire microtask ticks between event propagation.\n // the solution is simple: we save the timestamp when a handler is attached,\n // and the handler would only fire if the event passed to it was fired\n // AFTER it was attached.\n if (useMicrotaskFix) {\n var attachedTimestamp = currentFlushTimestamp;\n var original = handler;\n handler = original._wrapper = function (e) {\n if (\n // no bubbling, should always fire.\n // this is just a safety net in case event.timeStamp is unreliable in\n // certain weird environments...\n e.target === e.currentTarget ||\n // event is fired after handler attachment\n e.timeStamp >= attachedTimestamp ||\n // bail for environments that have buggy event.timeStamp implementations\n // #9462 iOS 9 bug: event.timeStamp is 0 after history.pushState\n // #9681 QtWebEngine event.timeStamp is negative value\n e.timeStamp <= 0 ||\n // #9448 bail if event is fired in another document in a multi-page\n // electron/nw.js app, since event.timeStamp will be using a different\n // starting reference\n e.target.ownerDocument !== document\n ) {\n return original.apply(this, arguments)\n }\n };\n }\n target$1.addEventListener(\n name,\n handler,\n supportsPassive\n ? { capture: capture, passive: passive }\n : capture\n );\n}\n\nfunction remove$2 (\n name,\n handler,\n capture,\n _target\n) {\n (_target || target$1).removeEventListener(\n name,\n handler._wrapper || handler,\n capture\n );\n}\n\nfunction updateDOMListeners (oldVnode, vnode) {\n if (isUndef(oldVnode.data.on) && isUndef(vnode.data.on)) {\n return\n }\n var on = vnode.data.on || {};\n var oldOn = oldVnode.data.on || {};\n target$1 = vnode.elm;\n normalizeEvents(on);\n updateListeners(on, oldOn, add$1, remove$2, createOnceHandler$1, vnode.context);\n target$1 = undefined;\n}\n\nvar events = {\n create: updateDOMListeners,\n update: updateDOMListeners\n};\n\n/* */\n\nvar svgContainer;\n\nfunction updateDOMProps (oldVnode, vnode) {\n if (isUndef(oldVnode.data.domProps) && isUndef(vnode.data.domProps)) {\n return\n }\n var key, cur;\n var elm = vnode.elm;\n var oldProps = oldVnode.data.domProps || {};\n var props = vnode.data.domProps || {};\n // clone observed objects, as the user probably wants to mutate it\n if (isDef(props.__ob__)) {\n props = vnode.data.domProps = extend({}, props);\n }\n\n for (key in oldProps) {\n if (!(key in props)) {\n elm[key] = '';\n }\n }\n\n for (key in props) {\n cur = props[key];\n // ignore children if the node has textContent or innerHTML,\n // as these will throw away existing DOM nodes and cause removal errors\n // on subsequent patches (#3360)\n if (key === 'textContent' || key === 'innerHTML') {\n if (vnode.children) { vnode.children.length = 0; }\n if (cur === oldProps[key]) { continue }\n // #6601 work around Chrome version <= 55 bug where single textNode\n // replaced by innerHTML/textContent retains its parentNode property\n if (elm.childNodes.length === 1) {\n elm.removeChild(elm.childNodes[0]);\n }\n }\n\n if (key === 'value' && elm.tagName !== 'PROGRESS') {\n // store value as _value as well since\n // non-string values will be stringified\n elm._value = cur;\n // avoid resetting cursor position when value is the same\n var strCur = isUndef(cur) ? '' : String(cur);\n if (shouldUpdateValue(elm, strCur)) {\n elm.value = strCur;\n }\n } else if (key === 'innerHTML' && isSVG(elm.tagName) && isUndef(elm.innerHTML)) {\n // IE doesn't support innerHTML for SVG elements\n svgContainer = svgContainer || document.createElement('div');\n svgContainer.innerHTML = \"<svg>\" + cur + \"</svg>\";\n var svg = svgContainer.firstChild;\n while (elm.firstChild) {\n elm.removeChild(elm.firstChild);\n }\n while (svg.firstChild) {\n elm.appendChild(svg.firstChild);\n }\n } else if (\n // skip the update if old and new VDOM state is the same.\n // `value` is handled separately because the DOM value may be temporarily\n // out of sync with VDOM state due to focus, composition and modifiers.\n // This #4521 by skipping the unnecesarry `checked` update.\n cur !== oldProps[key]\n ) {\n // some property updates can throw\n // e.g. `value` on <progress> w/ non-finite value\n try {\n elm[key] = cur;\n } catch (e) {}\n }\n }\n}\n\n// check platforms/web/util/attrs.js acceptValue\n\n\nfunction shouldUpdateValue (elm, checkVal) {\n return (!elm.composing && (\n elm.tagName === 'OPTION' ||\n isNotInFocusAndDirty(elm, checkVal) ||\n isDirtyWithModifiers(elm, checkVal)\n ))\n}\n\nfunction isNotInFocusAndDirty (elm, checkVal) {\n // return true when textbox (.number and .trim) loses focus and its value is\n // not equal to the updated value\n var notInFocus = true;\n // #6157\n // work around IE bug when accessing document.activeElement in an iframe\n try { notInFocus = document.activeElement !== elm; } catch (e) {}\n return notInFocus && elm.value !== checkVal\n}\n\nfunction isDirtyWithModifiers (elm, newVal) {\n var value = elm.value;\n var modifiers = elm._vModifiers; // injected by v-model runtime\n if (isDef(modifiers)) {\n if (modifiers.number) {\n return toNumber(value) !== toNumber(newVal)\n }\n if (modifiers.trim) {\n return value.trim() !== newVal.trim()\n }\n }\n return value !== newVal\n}\n\nvar domProps = {\n create: updateDOMProps,\n update: updateDOMProps\n};\n\n/* */\n\nvar parseStyleText = cached(function (cssText) {\n var res = {};\n var listDelimiter = /;(?![^(]*\\))/g;\n var propertyDelimiter = /:(.+)/;\n cssText.split(listDelimiter).forEach(function (item) {\n if (item) {\n var tmp = item.split(propertyDelimiter);\n tmp.length > 1 && (res[tmp[0].trim()] = tmp[1].trim());\n }\n });\n return res\n});\n\n// merge static and dynamic style data on the same vnode\nfunction normalizeStyleData (data) {\n var style = normalizeStyleBinding(data.style);\n // static style is pre-processed into an object during compilation\n // and is always a fresh object, so it's safe to merge into it\n return data.staticStyle\n ? extend(data.staticStyle, style)\n : style\n}\n\n// normalize possible array / string values into Object\nfunction normalizeStyleBinding (bindingStyle) {\n if (Array.isArray(bindingStyle)) {\n return toObject(bindingStyle)\n }\n if (typeof bindingStyle === 'string') {\n return parseStyleText(bindingStyle)\n }\n return bindingStyle\n}\n\n/**\n * parent component style should be after child's\n * so that parent component's style could override it\n */\nfunction getStyle (vnode, checkChild) {\n var res = {};\n var styleData;\n\n if (checkChild) {\n var childNode = vnode;\n while (childNode.componentInstance) {\n childNode = childNode.componentInstance._vnode;\n if (\n childNode && childNode.data &&\n (styleData = normalizeStyleData(childNode.data))\n ) {\n extend(res, styleData);\n }\n }\n }\n\n if ((styleData = normalizeStyleData(vnode.data))) {\n extend(res, styleData);\n }\n\n var parentNode = vnode;\n while ((parentNode = parentNode.parent)) {\n if (parentNode.data && (styleData = normalizeStyleData(parentNode.data))) {\n extend(res, styleData);\n }\n }\n return res\n}\n\n/* */\n\nvar cssVarRE = /^--/;\nvar importantRE = /\\s*!important$/;\nvar setProp = function (el, name, val) {\n /* istanbul ignore if */\n if (cssVarRE.test(name)) {\n el.style.setProperty(name, val);\n } else if (importantRE.test(val)) {\n el.style.setProperty(hyphenate(name), val.replace(importantRE, ''), 'important');\n } else {\n var normalizedName = normalize(name);\n if (Array.isArray(val)) {\n // Support values array created by autoprefixer, e.g.\n // {display: [\"-webkit-box\", \"-ms-flexbox\", \"flex\"]}\n // Set them one by one, and the browser will only set those it can recognize\n for (var i = 0, len = val.length; i < len; i++) {\n el.style[normalizedName] = val[i];\n }\n } else {\n el.style[normalizedName] = val;\n }\n }\n};\n\nvar vendorNames = ['Webkit', 'Moz', 'ms'];\n\nvar emptyStyle;\nvar normalize = cached(function (prop) {\n emptyStyle = emptyStyle || document.createElement('div').style;\n prop = camelize(prop);\n if (prop !== 'filter' && (prop in emptyStyle)) {\n return prop\n }\n var capName = prop.charAt(0).toUpperCase() + prop.slice(1);\n for (var i = 0; i < vendorNames.length; i++) {\n var name = vendorNames[i] + capName;\n if (name in emptyStyle) {\n return name\n }\n }\n});\n\nfunction updateStyle (oldVnode, vnode) {\n var data = vnode.data;\n var oldData = oldVnode.data;\n\n if (isUndef(data.staticStyle) && isUndef(data.style) &&\n isUndef(oldData.staticStyle) && isUndef(oldData.style)\n ) {\n return\n }\n\n var cur, name;\n var el = vnode.elm;\n var oldStaticStyle = oldData.staticStyle;\n var oldStyleBinding = oldData.normalizedStyle || oldData.style || {};\n\n // if static style exists, stylebinding already merged into it when doing normalizeStyleData\n var oldStyle = oldStaticStyle || oldStyleBinding;\n\n var style = normalizeStyleBinding(vnode.data.style) || {};\n\n // store normalized style under a different key for next diff\n // make sure to clone it if it's reactive, since the user likely wants\n // to mutate it.\n vnode.data.normalizedStyle = isDef(style.__ob__)\n ? extend({}, style)\n : style;\n\n var newStyle = getStyle(vnode, true);\n\n for (name in oldStyle) {\n if (isUndef(newStyle[name])) {\n setProp(el, name, '');\n }\n }\n for (name in newStyle) {\n cur = newStyle[name];\n if (cur !== oldStyle[name]) {\n // ie9 setting to null has no effect, must use empty string\n setProp(el, name, cur == null ? '' : cur);\n }\n }\n}\n\nvar style = {\n create: updateStyle,\n update: updateStyle\n};\n\n/* */\n\nvar whitespaceRE = /\\s+/;\n\n/**\n * Add class with compatibility for SVG since classList is not supported on\n * SVG elements in IE\n */\nfunction addClass (el, cls) {\n /* istanbul ignore if */\n if (!cls || !(cls = cls.trim())) {\n return\n }\n\n /* istanbul ignore else */\n if (el.classList) {\n if (cls.indexOf(' ') > -1) {\n cls.split(whitespaceRE).forEach(function (c) { return el.classList.add(c); });\n } else {\n el.classList.add(cls);\n }\n } else {\n var cur = \" \" + (el.getAttribute('class') || '') + \" \";\n if (cur.indexOf(' ' + cls + ' ') < 0) {\n el.setAttribute('class', (cur + cls).trim());\n }\n }\n}\n\n/**\n * Remove class with compatibility for SVG since classList is not supported on\n * SVG elements in IE\n */\nfunction removeClass (el, cls) {\n /* istanbul ignore if */\n if (!cls || !(cls = cls.trim())) {\n return\n }\n\n /* istanbul ignore else */\n if (el.classList) {\n if (cls.indexOf(' ') > -1) {\n cls.split(whitespaceRE).forEach(function (c) { return el.classList.remove(c); });\n } else {\n el.classList.remove(cls);\n }\n if (!el.classList.length) {\n el.removeAttribute('class');\n }\n } else {\n var cur = \" \" + (el.getAttribute('class') || '') + \" \";\n var tar = ' ' + cls + ' ';\n while (cur.indexOf(tar) >= 0) {\n cur = cur.replace(tar, ' ');\n }\n cur = cur.trim();\n if (cur) {\n el.setAttribute('class', cur);\n } else {\n el.removeAttribute('class');\n }\n }\n}\n\n/* */\n\nfunction resolveTransition (def$$1) {\n if (!def$$1) {\n return\n }\n /* istanbul ignore else */\n if (typeof def$$1 === 'object') {\n var res = {};\n if (def$$1.css !== false) {\n extend(res, autoCssTransition(def$$1.name || 'v'));\n }\n extend(res, def$$1);\n return res\n } else if (typeof def$$1 === 'string') {\n return autoCssTransition(def$$1)\n }\n}\n\nvar autoCssTransition = cached(function (name) {\n return {\n enterClass: (name + \"-enter\"),\n enterToClass: (name + \"-enter-to\"),\n enterActiveClass: (name + \"-enter-active\"),\n leaveClass: (name + \"-leave\"),\n leaveToClass: (name + \"-leave-to\"),\n leaveActiveClass: (name + \"-leave-active\")\n }\n});\n\nvar hasTransition = inBrowser && !isIE9;\nvar TRANSITION = 'transition';\nvar ANIMATION = 'animation';\n\n// Transition property/event sniffing\nvar transitionProp = 'transition';\nvar transitionEndEvent = 'transitionend';\nvar animationProp = 'animation';\nvar animationEndEvent = 'animationend';\nif (hasTransition) {\n /* istanbul ignore if */\n if (window.ontransitionend === undefined &&\n window.onwebkittransitionend !== undefined\n ) {\n transitionProp = 'WebkitTransition';\n transitionEndEvent = 'webkitTransitionEnd';\n }\n if (window.onanimationend === undefined &&\n window.onwebkitanimationend !== undefined\n ) {\n animationProp = 'WebkitAnimation';\n animationEndEvent = 'webkitAnimationEnd';\n }\n}\n\n// binding to window is necessary to make hot reload work in IE in strict mode\nvar raf = inBrowser\n ? window.requestAnimationFrame\n ? window.requestAnimationFrame.bind(window)\n : setTimeout\n : /* istanbul ignore next */ function (fn) { return fn(); };\n\nfunction nextFrame (fn) {\n raf(function () {\n raf(fn);\n });\n}\n\nfunction addTransitionClass (el, cls) {\n var transitionClasses = el._transitionClasses || (el._transitionClasses = []);\n if (transitionClasses.indexOf(cls) < 0) {\n transitionClasses.push(cls);\n addClass(el, cls);\n }\n}\n\nfunction removeTransitionClass (el, cls) {\n if (el._transitionClasses) {\n remove(el._transitionClasses, cls);\n }\n removeClass(el, cls);\n}\n\nfunction whenTransitionEnds (\n el,\n expectedType,\n cb\n) {\n var ref = getTransitionInfo(el, expectedType);\n var type = ref.type;\n var timeout = ref.timeout;\n var propCount = ref.propCount;\n if (!type) { return cb() }\n var event = type === TRANSITION ? transitionEndEvent : animationEndEvent;\n var ended = 0;\n var end = function () {\n el.removeEventListener(event, onEnd);\n cb();\n };\n var onEnd = function (e) {\n if (e.target === el) {\n if (++ended >= propCount) {\n end();\n }\n }\n };\n setTimeout(function () {\n if (ended < propCount) {\n end();\n }\n }, timeout + 1);\n el.addEventListener(event, onEnd);\n}\n\nvar transformRE = /\\b(transform|all)(,|$)/;\n\nfunction getTransitionInfo (el, expectedType) {\n var styles = window.getComputedStyle(el);\n // JSDOM may return undefined for transition properties\n var transitionDelays = (styles[transitionProp + 'Delay'] || '').split(', ');\n var transitionDurations = (styles[transitionProp + 'Duration'] || '').split(', ');\n var transitionTimeout = getTimeout(transitionDelays, transitionDurations);\n var animationDelays = (styles[animationProp + 'Delay'] || '').split(', ');\n var animationDurations = (styles[animationProp + 'Duration'] || '').split(', ');\n var animationTimeout = getTimeout(animationDelays, animationDurations);\n\n var type;\n var timeout = 0;\n var propCount = 0;\n /* istanbul ignore if */\n if (expectedType === TRANSITION) {\n if (transitionTimeout > 0) {\n type = TRANSITION;\n timeout = transitionTimeout;\n propCount = transitionDurations.length;\n }\n } else if (expectedType === ANIMATION) {\n if (animationTimeout > 0) {\n type = ANIMATION;\n timeout = animationTimeout;\n propCount = animationDurations.length;\n }\n } else {\n timeout = Math.max(transitionTimeout, animationTimeout);\n type = timeout > 0\n ? transitionTimeout > animationTimeout\n ? TRANSITION\n : ANIMATION\n : null;\n propCount = type\n ? type === TRANSITION\n ? transitionDurations.length\n : animationDurations.length\n : 0;\n }\n var hasTransform =\n type === TRANSITION &&\n transformRE.test(styles[transitionProp + 'Property']);\n return {\n type: type,\n timeout: timeout,\n propCount: propCount,\n hasTransform: hasTransform\n }\n}\n\nfunction getTimeout (delays, durations) {\n /* istanbul ignore next */\n while (delays.length < durations.length) {\n delays = delays.concat(delays);\n }\n\n return Math.max.apply(null, durations.map(function (d, i) {\n return toMs(d) + toMs(delays[i])\n }))\n}\n\n// Old versions of Chromium (below 61.0.3163.100) formats floating pointer numbers\n// in a locale-dependent way, using a comma instead of a dot.\n// If comma is not replaced with a dot, the input will be rounded down (i.e. acting\n// as a floor function) causing unexpected behaviors\nfunction toMs (s) {\n return Number(s.slice(0, -1).replace(',', '.')) * 1000\n}\n\n/* */\n\nfunction enter (vnode, toggleDisplay) {\n var el = vnode.elm;\n\n // call leave callback now\n if (isDef(el._leaveCb)) {\n el._leaveCb.cancelled = true;\n el._leaveCb();\n }\n\n var data = resolveTransition(vnode.data.transition);\n if (isUndef(data)) {\n return\n }\n\n /* istanbul ignore if */\n if (isDef(el._enterCb) || el.nodeType !== 1) {\n return\n }\n\n var css = data.css;\n var type = data.type;\n var enterClass = data.enterClass;\n var enterToClass = data.enterToClass;\n var enterActiveClass = data.enterActiveClass;\n var appearClass = data.appearClass;\n var appearToClass = data.appearToClass;\n var appearActiveClass = data.appearActiveClass;\n var beforeEnter = data.beforeEnter;\n var enter = data.enter;\n var afterEnter = data.afterEnter;\n var enterCancelled = data.enterCancelled;\n var beforeAppear = data.beforeAppear;\n var appear = data.appear;\n var afterAppear = data.afterAppear;\n var appearCancelled = data.appearCancelled;\n var duration = data.duration;\n\n // activeInstance will always be the <transition> component managing this\n // transition. One edge case to check is when the <transition> is placed\n // as the root node of a child component. In that case we need to check\n // <transition>'s parent for appear check.\n var context = activeInstance;\n var transitionNode = activeInstance.$vnode;\n while (transitionNode && transitionNode.parent) {\n context = transitionNode.context;\n transitionNode = transitionNode.parent;\n }\n\n var isAppear = !context._isMounted || !vnode.isRootInsert;\n\n if (isAppear && !appear && appear !== '') {\n return\n }\n\n var startClass = isAppear && appearClass\n ? appearClass\n : enterClass;\n var activeClass = isAppear && appearActiveClass\n ? appearActiveClass\n : enterActiveClass;\n var toClass = isAppear && appearToClass\n ? appearToClass\n : enterToClass;\n\n var beforeEnterHook = isAppear\n ? (beforeAppear || beforeEnter)\n : beforeEnter;\n var enterHook = isAppear\n ? (typeof appear === 'function' ? appear : enter)\n : enter;\n var afterEnterHook = isAppear\n ? (afterAppear || afterEnter)\n : afterEnter;\n var enterCancelledHook = isAppear\n ? (appearCancelled || enterCancelled)\n : enterCancelled;\n\n var explicitEnterDuration = toNumber(\n isObject(duration)\n ? duration.enter\n : duration\n );\n\n if (explicitEnterDuration != null) {\n checkDuration(explicitEnterDuration, 'enter', vnode);\n }\n\n var expectsCSS = css !== false && !isIE9;\n var userWantsControl = getHookArgumentsLength(enterHook);\n\n var cb = el._enterCb = once(function () {\n if (expectsCSS) {\n removeTransitionClass(el, toClass);\n removeTransitionClass(el, activeClass);\n }\n if (cb.cancelled) {\n if (expectsCSS) {\n removeTransitionClass(el, startClass);\n }\n enterCancelledHook && enterCancelledHook(el);\n } else {\n afterEnterHook && afterEnterHook(el);\n }\n el._enterCb = null;\n });\n\n if (!vnode.data.show) {\n // remove pending leave element on enter by injecting an insert hook\n mergeVNodeHook(vnode, 'insert', function () {\n var parent = el.parentNode;\n var pendingNode = parent && parent._pending && parent._pending[vnode.key];\n if (pendingNode &&\n pendingNode.tag === vnode.tag &&\n pendingNode.elm._leaveCb\n ) {\n pendingNode.elm._leaveCb();\n }\n enterHook && enterHook(el, cb);\n });\n }\n\n // start enter transition\n beforeEnterHook && beforeEnterHook(el);\n if (expectsCSS) {\n addTransitionClass(el, startClass);\n addTransitionClass(el, activeClass);\n nextFrame(function () {\n removeTransitionClass(el, startClass);\n if (!cb.cancelled) {\n addTransitionClass(el, toClass);\n if (!userWantsControl) {\n if (isValidDuration(explicitEnterDuration)) {\n setTimeout(cb, explicitEnterDuration);\n } else {\n whenTransitionEnds(el, type, cb);\n }\n }\n }\n });\n }\n\n if (vnode.data.show) {\n toggleDisplay && toggleDisplay();\n enterHook && enterHook(el, cb);\n }\n\n if (!expectsCSS && !userWantsControl) {\n cb();\n }\n}\n\nfunction leave (vnode, rm) {\n var el = vnode.elm;\n\n // call enter callback now\n if (isDef(el._enterCb)) {\n el._enterCb.cancelled = true;\n el._enterCb();\n }\n\n var data = resolveTransition(vnode.data.transition);\n if (isUndef(data) || el.nodeType !== 1) {\n return rm()\n }\n\n /* istanbul ignore if */\n if (isDef(el._leaveCb)) {\n return\n }\n\n var css = data.css;\n var type = data.type;\n var leaveClass = data.leaveClass;\n var leaveToClass = data.leaveToClass;\n var leaveActiveClass = data.leaveActiveClass;\n var beforeLeave = data.beforeLeave;\n var leave = data.leave;\n var afterLeave = data.afterLeave;\n var leaveCancelled = data.leaveCancelled;\n var delayLeave = data.delayLeave;\n var duration = data.duration;\n\n var expectsCSS = css !== false && !isIE9;\n var userWantsControl = getHookArgumentsLength(leave);\n\n var explicitLeaveDuration = toNumber(\n isObject(duration)\n ? duration.leave\n : duration\n );\n\n if (isDef(explicitLeaveDuration)) {\n checkDuration(explicitLeaveDuration, 'leave', vnode);\n }\n\n var cb = el._leaveCb = once(function () {\n if (el.parentNode && el.parentNode._pending) {\n el.parentNode._pending[vnode.key] = null;\n }\n if (expectsCSS) {\n removeTransitionClass(el, leaveToClass);\n removeTransitionClass(el, leaveActiveClass);\n }\n if (cb.cancelled) {\n if (expectsCSS) {\n removeTransitionClass(el, leaveClass);\n }\n leaveCancelled && leaveCancelled(el);\n } else {\n rm();\n afterLeave && afterLeave(el);\n }\n el._leaveCb = null;\n });\n\n if (delayLeave) {\n delayLeave(performLeave);\n } else {\n performLeave();\n }\n\n function performLeave () {\n // the delayed leave may have already been cancelled\n if (cb.cancelled) {\n return\n }\n // record leaving element\n if (!vnode.data.show && el.parentNode) {\n (el.parentNode._pending || (el.parentNode._pending = {}))[(vnode.key)] = vnode;\n }\n beforeLeave && beforeLeave(el);\n if (expectsCSS) {\n addTransitionClass(el, leaveClass);\n addTransitionClass(el, leaveActiveClass);\n nextFrame(function () {\n removeTransitionClass(el, leaveClass);\n if (!cb.cancelled) {\n addTransitionClass(el, leaveToClass);\n if (!userWantsControl) {\n if (isValidDuration(explicitLeaveDuration)) {\n setTimeout(cb, explicitLeaveDuration);\n } else {\n whenTransitionEnds(el, type, cb);\n }\n }\n }\n });\n }\n leave && leave(el, cb);\n if (!expectsCSS && !userWantsControl) {\n cb();\n }\n }\n}\n\n// only used in dev mode\nfunction checkDuration (val, name, vnode) {\n if (typeof val !== 'number') {\n warn(\n \"<transition> explicit \" + name + \" duration is not a valid number - \" +\n \"got \" + (JSON.stringify(val)) + \".\",\n vnode.context\n );\n } else if (isNaN(val)) {\n warn(\n \"<transition> explicit \" + name + \" duration is NaN - \" +\n 'the duration expression might be incorrect.',\n vnode.context\n );\n }\n}\n\nfunction isValidDuration (val) {\n return typeof val === 'number' && !isNaN(val)\n}\n\n/**\n * Normalize a transition hook's argument length. The hook may be:\n * - a merged hook (invoker) with the original in .fns\n * - a wrapped component method (check ._length)\n * - a plain function (.length)\n */\nfunction getHookArgumentsLength (fn) {\n if (isUndef(fn)) {\n return false\n }\n var invokerFns = fn.fns;\n if (isDef(invokerFns)) {\n // invoker\n return getHookArgumentsLength(\n Array.isArray(invokerFns)\n ? invokerFns[0]\n : invokerFns\n )\n } else {\n return (fn._length || fn.length) > 1\n }\n}\n\nfunction _enter (_, vnode) {\n if (vnode.data.show !== true) {\n enter(vnode);\n }\n}\n\nvar transition = inBrowser ? {\n create: _enter,\n activate: _enter,\n remove: function remove$$1 (vnode, rm) {\n /* istanbul ignore else */\n if (vnode.data.show !== true) {\n leave(vnode, rm);\n } else {\n rm();\n }\n }\n} : {};\n\nvar platformModules = [\n attrs,\n klass,\n events,\n domProps,\n style,\n transition\n];\n\n/* */\n\n// the directive module should be applied last, after all\n// built-in modules have been applied.\nvar modules = platformModules.concat(baseModules);\n\nvar patch = createPatchFunction({ nodeOps: nodeOps, modules: modules });\n\n/**\n * Not type checking this file because flow doesn't like attaching\n * properties to Elements.\n */\n\n/* istanbul ignore if */\nif (isIE9) {\n // http://www.matts411.com/post/internet-explorer-9-oninput/\n document.addEventListener('selectionchange', function () {\n var el = document.activeElement;\n if (el && el.vmodel) {\n trigger(el, 'input');\n }\n });\n}\n\nvar directive = {\n inserted: function inserted (el, binding, vnode, oldVnode) {\n if (vnode.tag === 'select') {\n // #6903\n if (oldVnode.elm && !oldVnode.elm._vOptions) {\n mergeVNodeHook(vnode, 'postpatch', function () {\n directive.componentUpdated(el, binding, vnode);\n });\n } else {\n setSelected(el, binding, vnode.context);\n }\n el._vOptions = [].map.call(el.options, getValue);\n } else if (vnode.tag === 'textarea' || isTextInputType(el.type)) {\n el._vModifiers = binding.modifiers;\n if (!binding.modifiers.lazy) {\n el.addEventListener('compositionstart', onCompositionStart);\n el.addEventListener('compositionend', onCompositionEnd);\n // Safari < 10.2 & UIWebView doesn't fire compositionend when\n // switching focus before confirming composition choice\n // this also fixes the issue where some browsers e.g. iOS Chrome\n // fires \"change\" instead of \"input\" on autocomplete.\n el.addEventListener('change', onCompositionEnd);\n /* istanbul ignore if */\n if (isIE9) {\n el.vmodel = true;\n }\n }\n }\n },\n\n componentUpdated: function componentUpdated (el, binding, vnode) {\n if (vnode.tag === 'select') {\n setSelected(el, binding, vnode.context);\n // in case the options rendered by v-for have changed,\n // it's possible that the value is out-of-sync with the rendered options.\n // detect such cases and filter out values that no longer has a matching\n // option in the DOM.\n var prevOptions = el._vOptions;\n var curOptions = el._vOptions = [].map.call(el.options, getValue);\n if (curOptions.some(function (o, i) { return !looseEqual(o, prevOptions[i]); })) {\n // trigger change event if\n // no matching option found for at least one value\n var needReset = el.multiple\n ? binding.value.some(function (v) { return hasNoMatchingOption(v, curOptions); })\n : binding.value !== binding.oldValue && hasNoMatchingOption(binding.value, curOptions);\n if (needReset) {\n trigger(el, 'change');\n }\n }\n }\n }\n};\n\nfunction setSelected (el, binding, vm) {\n actuallySetSelected(el, binding, vm);\n /* istanbul ignore if */\n if (isIE || isEdge) {\n setTimeout(function () {\n actuallySetSelected(el, binding, vm);\n }, 0);\n }\n}\n\nfunction actuallySetSelected (el, binding, vm) {\n var value = binding.value;\n var isMultiple = el.multiple;\n if (isMultiple && !Array.isArray(value)) {\n warn(\n \"<select multiple v-model=\\\"\" + (binding.expression) + \"\\\"> \" +\n \"expects an Array value for its binding, but got \" + (Object.prototype.toString.call(value).slice(8, -1)),\n vm\n );\n return\n }\n var selected, option;\n for (var i = 0, l = el.options.length; i < l; i++) {\n option = el.options[i];\n if (isMultiple) {\n selected = looseIndexOf(value, getValue(option)) > -1;\n if (option.selected !== selected) {\n option.selected = selected;\n }\n } else {\n if (looseEqual(getValue(option), value)) {\n if (el.selectedIndex !== i) {\n el.selectedIndex = i;\n }\n return\n }\n }\n }\n if (!isMultiple) {\n el.selectedIndex = -1;\n }\n}\n\nfunction hasNoMatchingOption (value, options) {\n return options.every(function (o) { return !looseEqual(o, value); })\n}\n\nfunction getValue (option) {\n return '_value' in option\n ? option._value\n : option.value\n}\n\nfunction onCompositionStart (e) {\n e.target.composing = true;\n}\n\nfunction onCompositionEnd (e) {\n // prevent triggering an input event for no reason\n if (!e.target.composing) { return }\n e.target.composing = false;\n trigger(e.target, 'input');\n}\n\nfunction trigger (el, type) {\n var e = document.createEvent('HTMLEvents');\n e.initEvent(type, true, true);\n el.dispatchEvent(e);\n}\n\n/* */\n\n// recursively search for possible transition defined inside the component root\nfunction locateNode (vnode) {\n return vnode.componentInstance && (!vnode.data || !vnode.data.transition)\n ? locateNode(vnode.componentInstance._vnode)\n : vnode\n}\n\nvar show = {\n bind: function bind (el, ref, vnode) {\n var value = ref.value;\n\n vnode = locateNode(vnode);\n var transition$$1 = vnode.data && vnode.data.transition;\n var originalDisplay = el.__vOriginalDisplay =\n el.style.display === 'none' ? '' : el.style.display;\n if (value && transition$$1) {\n vnode.data.show = true;\n enter(vnode, function () {\n el.style.display = originalDisplay;\n });\n } else {\n el.style.display = value ? originalDisplay : 'none';\n }\n },\n\n update: function update (el, ref, vnode) {\n var value = ref.value;\n var oldValue = ref.oldValue;\n\n /* istanbul ignore if */\n if (!value === !oldValue) { return }\n vnode = locateNode(vnode);\n var transition$$1 = vnode.data && vnode.data.transition;\n if (transition$$1) {\n vnode.data.show = true;\n if (value) {\n enter(vnode, function () {\n el.style.display = el.__vOriginalDisplay;\n });\n } else {\n leave(vnode, function () {\n el.style.display = 'none';\n });\n }\n } else {\n el.style.display = value ? el.__vOriginalDisplay : 'none';\n }\n },\n\n unbind: function unbind (\n el,\n binding,\n vnode,\n oldVnode,\n isDestroy\n ) {\n if (!isDestroy) {\n el.style.display = el.__vOriginalDisplay;\n }\n }\n};\n\nvar platformDirectives = {\n model: directive,\n show: show\n};\n\n/* */\n\nvar transitionProps = {\n name: String,\n appear: Boolean,\n css: Boolean,\n mode: String,\n type: String,\n enterClass: String,\n leaveClass: String,\n enterToClass: String,\n leaveToClass: String,\n enterActiveClass: String,\n leaveActiveClass: String,\n appearClass: String,\n appearActiveClass: String,\n appearToClass: String,\n duration: [Number, String, Object]\n};\n\n// in case the child is also an abstract component, e.g. <keep-alive>\n// we want to recursively retrieve the real component to be rendered\nfunction getRealChild (vnode) {\n var compOptions = vnode && vnode.componentOptions;\n if (compOptions && compOptions.Ctor.options.abstract) {\n return getRealChild(getFirstComponentChild(compOptions.children))\n } else {\n return vnode\n }\n}\n\nfunction extractTransitionData (comp) {\n var data = {};\n var options = comp.$options;\n // props\n for (var key in options.propsData) {\n data[key] = comp[key];\n }\n // events.\n // extract listeners and pass them directly to the transition methods\n var listeners = options._parentListeners;\n for (var key$1 in listeners) {\n data[camelize(key$1)] = listeners[key$1];\n }\n return data\n}\n\nfunction placeholder (h, rawChild) {\n if (/\\d-keep-alive$/.test(rawChild.tag)) {\n return h('keep-alive', {\n props: rawChild.componentOptions.propsData\n })\n }\n}\n\nfunction hasParentTransition (vnode) {\n while ((vnode = vnode.parent)) {\n if (vnode.data.transition) {\n return true\n }\n }\n}\n\nfunction isSameChild (child, oldChild) {\n return oldChild.key === child.key && oldChild.tag === child.tag\n}\n\nvar isNotTextNode = function (c) { return c.tag || isAsyncPlaceholder(c); };\n\nvar isVShowDirective = function (d) { return d.name === 'show'; };\n\nvar Transition = {\n name: 'transition',\n props: transitionProps,\n abstract: true,\n\n render: function render (h) {\n var this$1 = this;\n\n var children = this.$slots.default;\n if (!children) {\n return\n }\n\n // filter out text nodes (possible whitespaces)\n children = children.filter(isNotTextNode);\n /* istanbul ignore if */\n if (!children.length) {\n return\n }\n\n // warn multiple elements\n if (children.length > 1) {\n warn(\n '<transition> can only be used on a single element. Use ' +\n '<transition-group> for lists.',\n this.$parent\n );\n }\n\n var mode = this.mode;\n\n // warn invalid mode\n if (mode && mode !== 'in-out' && mode !== 'out-in'\n ) {\n warn(\n 'invalid <transition> mode: ' + mode,\n this.$parent\n );\n }\n\n var rawChild = children[0];\n\n // if this is a component root node and the component's\n // parent container node also has transition, skip.\n if (hasParentTransition(this.$vnode)) {\n return rawChild\n }\n\n // apply transition data to child\n // use getRealChild() to ignore abstract components e.g. keep-alive\n var child = getRealChild(rawChild);\n /* istanbul ignore if */\n if (!child) {\n return rawChild\n }\n\n if (this._leaving) {\n return placeholder(h, rawChild)\n }\n\n // ensure a key that is unique to the vnode type and to this transition\n // component instance. This key will be used to remove pending leaving nodes\n // during entering.\n var id = \"__transition-\" + (this._uid) + \"-\";\n child.key = child.key == null\n ? child.isComment\n ? id + 'comment'\n : id + child.tag\n : isPrimitive(child.key)\n ? (String(child.key).indexOf(id) === 0 ? child.key : id + child.key)\n : child.key;\n\n var data = (child.data || (child.data = {})).transition = extractTransitionData(this);\n var oldRawChild = this._vnode;\n var oldChild = getRealChild(oldRawChild);\n\n // mark v-show\n // so that the transition module can hand over the control to the directive\n if (child.data.directives && child.data.directives.some(isVShowDirective)) {\n child.data.show = true;\n }\n\n if (\n oldChild &&\n oldChild.data &&\n !isSameChild(child, oldChild) &&\n !isAsyncPlaceholder(oldChild) &&\n // #6687 component root is a comment node\n !(oldChild.componentInstance && oldChild.componentInstance._vnode.isComment)\n ) {\n // replace old child transition data with fresh one\n // important for dynamic transitions!\n var oldData = oldChild.data.transition = extend({}, data);\n // handle transition mode\n if (mode === 'out-in') {\n // return placeholder node and queue update when leave finishes\n this._leaving = true;\n mergeVNodeHook(oldData, 'afterLeave', function () {\n this$1._leaving = false;\n this$1.$forceUpdate();\n });\n return placeholder(h, rawChild)\n } else if (mode === 'in-out') {\n if (isAsyncPlaceholder(child)) {\n return oldRawChild\n }\n var delayedLeave;\n var performLeave = function () { delayedLeave(); };\n mergeVNodeHook(data, 'afterEnter', performLeave);\n mergeVNodeHook(data, 'enterCancelled', performLeave);\n mergeVNodeHook(oldData, 'delayLeave', function (leave) { delayedLeave = leave; });\n }\n }\n\n return rawChild\n }\n};\n\n/* */\n\nvar props = extend({\n tag: String,\n moveClass: String\n}, transitionProps);\n\ndelete props.mode;\n\nvar TransitionGroup = {\n props: props,\n\n beforeMount: function beforeMount () {\n var this$1 = this;\n\n var update = this._update;\n this._update = function (vnode, hydrating) {\n var restoreActiveInstance = setActiveInstance(this$1);\n // force removing pass\n this$1.__patch__(\n this$1._vnode,\n this$1.kept,\n false, // hydrating\n true // removeOnly (!important, avoids unnecessary moves)\n );\n this$1._vnode = this$1.kept;\n restoreActiveInstance();\n update.call(this$1, vnode, hydrating);\n };\n },\n\n render: function render (h) {\n var tag = this.tag || this.$vnode.data.tag || 'span';\n var map = Object.create(null);\n var prevChildren = this.prevChildren = this.children;\n var rawChildren = this.$slots.default || [];\n var children = this.children = [];\n var transitionData = extractTransitionData(this);\n\n for (var i = 0; i < rawChildren.length; i++) {\n var c = rawChildren[i];\n if (c.tag) {\n if (c.key != null && String(c.key).indexOf('__vlist') !== 0) {\n children.push(c);\n map[c.key] = c\n ;(c.data || (c.data = {})).transition = transitionData;\n } else {\n var opts = c.componentOptions;\n var name = opts ? (opts.Ctor.options.name || opts.tag || '') : c.tag;\n warn((\"<transition-group> children must be keyed: <\" + name + \">\"));\n }\n }\n }\n\n if (prevChildren) {\n var kept = [];\n var removed = [];\n for (var i$1 = 0; i$1 < prevChildren.length; i$1++) {\n var c$1 = prevChildren[i$1];\n c$1.data.transition = transitionData;\n c$1.data.pos = c$1.elm.getBoundingClientRect();\n if (map[c$1.key]) {\n kept.push(c$1);\n } else {\n removed.push(c$1);\n }\n }\n this.kept = h(tag, null, kept);\n this.removed = removed;\n }\n\n return h(tag, null, children)\n },\n\n updated: function updated () {\n var children = this.prevChildren;\n var moveClass = this.moveClass || ((this.name || 'v') + '-move');\n if (!children.length || !this.hasMove(children[0].elm, moveClass)) {\n return\n }\n\n // we divide the work into three loops to avoid mixing DOM reads and writes\n // in each iteration - which helps prevent layout thrashing.\n children.forEach(callPendingCbs);\n children.forEach(recordPosition);\n children.forEach(applyTranslation);\n\n // force reflow to put everything in position\n // assign to this to avoid being removed in tree-shaking\n // $flow-disable-line\n this._reflow = document.body.offsetHeight;\n\n children.forEach(function (c) {\n if (c.data.moved) {\n var el = c.elm;\n var s = el.style;\n addTransitionClass(el, moveClass);\n s.transform = s.WebkitTransform = s.transitionDuration = '';\n el.addEventListener(transitionEndEvent, el._moveCb = function cb (e) {\n if (e && e.target !== el) {\n return\n }\n if (!e || /transform$/.test(e.propertyName)) {\n el.removeEventListener(transitionEndEvent, cb);\n el._moveCb = null;\n removeTransitionClass(el, moveClass);\n }\n });\n }\n });\n },\n\n methods: {\n hasMove: function hasMove (el, moveClass) {\n /* istanbul ignore if */\n if (!hasTransition) {\n return false\n }\n /* istanbul ignore if */\n if (this._hasMove) {\n return this._hasMove\n }\n // Detect whether an element with the move class applied has\n // CSS transitions. Since the element may be inside an entering\n // transition at this very moment, we make a clone of it and remove\n // all other transition classes applied to ensure only the move class\n // is applied.\n var clone = el.cloneNode();\n if (el._transitionClasses) {\n el._transitionClasses.forEach(function (cls) { removeClass(clone, cls); });\n }\n addClass(clone, moveClass);\n clone.style.display = 'none';\n this.$el.appendChild(clone);\n var info = getTransitionInfo(clone);\n this.$el.removeChild(clone);\n return (this._hasMove = info.hasTransform)\n }\n }\n};\n\nfunction callPendingCbs (c) {\n /* istanbul ignore if */\n if (c.elm._moveCb) {\n c.elm._moveCb();\n }\n /* istanbul ignore if */\n if (c.elm._enterCb) {\n c.elm._enterCb();\n }\n}\n\nfunction recordPosition (c) {\n c.data.newPos = c.elm.getBoundingClientRect();\n}\n\nfunction applyTranslation (c) {\n var oldPos = c.data.pos;\n var newPos = c.data.newPos;\n var dx = oldPos.left - newPos.left;\n var dy = oldPos.top - newPos.top;\n if (dx || dy) {\n c.data.moved = true;\n var s = c.elm.style;\n s.transform = s.WebkitTransform = \"translate(\" + dx + \"px,\" + dy + \"px)\";\n s.transitionDuration = '0s';\n }\n}\n\nvar platformComponents = {\n Transition: Transition,\n TransitionGroup: TransitionGroup\n};\n\n/* */\n\n// install platform specific utils\nVue.config.mustUseProp = mustUseProp;\nVue.config.isReservedTag = isReservedTag;\nVue.config.isReservedAttr = isReservedAttr;\nVue.config.getTagNamespace = getTagNamespace;\nVue.config.isUnknownElement = isUnknownElement;\n\n// install platform runtime directives & components\nextend(Vue.options.directives, platformDirectives);\nextend(Vue.options.components, platformComponents);\n\n// install platform patch function\nVue.prototype.__patch__ = inBrowser ? patch : noop;\n\n// public mount method\nVue.prototype.$mount = function (\n el,\n hydrating\n) {\n el = el && inBrowser ? query(el) : undefined;\n return mountComponent(this, el, hydrating)\n};\n\n// devtools global hook\n/* istanbul ignore next */\nif (inBrowser) {\n setTimeout(function () {\n if (config.devtools) {\n if (devtools) {\n devtools.emit('init', Vue);\n } else {\n console[console.info ? 'info' : 'log'](\n 'Download the Vue Devtools extension for a better development experience:\\n' +\n 'https://github.com/vuejs/vue-devtools'\n );\n }\n }\n if (config.productionTip !== false &&\n typeof console !== 'undefined'\n ) {\n console[console.info ? 'info' : 'log'](\n \"You are running Vue in development mode.\\n\" +\n \"Make sure to turn on production mode when deploying for production.\\n\" +\n \"See more tips at https://vuejs.org/guide/deployment.html\"\n );\n }\n }, 0);\n}\n\n/* */\n\nvar defaultTagRE = /\\{\\{((?:.|\\r?\\n)+?)\\}\\}/g;\nvar regexEscapeRE = /[-.*+?^${}()|[\\]\\/\\\\]/g;\n\nvar buildRegex = cached(function (delimiters) {\n var open = delimiters[0].replace(regexEscapeRE, '\\\\$&');\n var close = delimiters[1].replace(regexEscapeRE, '\\\\$&');\n return new RegExp(open + '((?:.|\\\\n)+?)' + close, 'g')\n});\n\n\n\nfunction parseText (\n text,\n delimiters\n) {\n var tagRE = delimiters ? buildRegex(delimiters) : defaultTagRE;\n if (!tagRE.test(text)) {\n return\n }\n var tokens = [];\n var rawTokens = [];\n var lastIndex = tagRE.lastIndex = 0;\n var match, index, tokenValue;\n while ((match = tagRE.exec(text))) {\n index = match.index;\n // push text token\n if (index > lastIndex) {\n rawTokens.push(tokenValue = text.slice(lastIndex, index));\n tokens.push(JSON.stringify(tokenValue));\n }\n // tag token\n var exp = parseFilters(match[1].trim());\n tokens.push((\"_s(\" + exp + \")\"));\n rawTokens.push({ '@binding': exp });\n lastIndex = index + match[0].length;\n }\n if (lastIndex < text.length) {\n rawTokens.push(tokenValue = text.slice(lastIndex));\n tokens.push(JSON.stringify(tokenValue));\n }\n return {\n expression: tokens.join('+'),\n tokens: rawTokens\n }\n}\n\n/* */\n\nfunction transformNode (el, options) {\n var warn = options.warn || baseWarn;\n var staticClass = getAndRemoveAttr(el, 'class');\n if (staticClass) {\n var res = parseText(staticClass, options.delimiters);\n if (res) {\n warn(\n \"class=\\\"\" + staticClass + \"\\\": \" +\n 'Interpolation inside attributes has been removed. ' +\n 'Use v-bind or the colon shorthand instead. For example, ' +\n 'instead of <div class=\"{{ val }}\">, use <div :class=\"val\">.',\n el.rawAttrsMap['class']\n );\n }\n }\n if (staticClass) {\n el.staticClass = JSON.stringify(staticClass);\n }\n var classBinding = getBindingAttr(el, 'class', false /* getStatic */);\n if (classBinding) {\n el.classBinding = classBinding;\n }\n}\n\nfunction genData (el) {\n var data = '';\n if (el.staticClass) {\n data += \"staticClass:\" + (el.staticClass) + \",\";\n }\n if (el.classBinding) {\n data += \"class:\" + (el.classBinding) + \",\";\n }\n return data\n}\n\nvar klass$1 = {\n staticKeys: ['staticClass'],\n transformNode: transformNode,\n genData: genData\n};\n\n/* */\n\nfunction transformNode$1 (el, options) {\n var warn = options.warn || baseWarn;\n var staticStyle = getAndRemoveAttr(el, 'style');\n if (staticStyle) {\n /* istanbul ignore if */\n {\n var res = parseText(staticStyle, options.delimiters);\n if (res) {\n warn(\n \"style=\\\"\" + staticStyle + \"\\\": \" +\n 'Interpolation inside attributes has been removed. ' +\n 'Use v-bind or the colon shorthand instead. For example, ' +\n 'instead of <div style=\"{{ val }}\">, use <div :style=\"val\">.',\n el.rawAttrsMap['style']\n );\n }\n }\n el.staticStyle = JSON.stringify(parseStyleText(staticStyle));\n }\n\n var styleBinding = getBindingAttr(el, 'style', false /* getStatic */);\n if (styleBinding) {\n el.styleBinding = styleBinding;\n }\n}\n\nfunction genData$1 (el) {\n var data = '';\n if (el.staticStyle) {\n data += \"staticStyle:\" + (el.staticStyle) + \",\";\n }\n if (el.styleBinding) {\n data += \"style:(\" + (el.styleBinding) + \"),\";\n }\n return data\n}\n\nvar style$1 = {\n staticKeys: ['staticStyle'],\n transformNode: transformNode$1,\n genData: genData$1\n};\n\n/* */\n\nvar decoder;\n\nvar he = {\n decode: function decode (html) {\n decoder = decoder || document.createElement('div');\n decoder.innerHTML = html;\n return decoder.textContent\n }\n};\n\n/* */\n\nvar isUnaryTag = makeMap(\n 'area,base,br,col,embed,frame,hr,img,input,isindex,keygen,' +\n 'link,meta,param,source,track,wbr'\n);\n\n// Elements that you can, intentionally, leave open\n// (and which close themselves)\nvar canBeLeftOpenTag = makeMap(\n 'colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr,source'\n);\n\n// HTML5 tags https://html.spec.whatwg.org/multipage/indices.html#elements-3\n// Phrasing Content https://html.spec.whatwg.org/multipage/dom.html#phrasing-content\nvar isNonPhrasingTag = makeMap(\n 'address,article,aside,base,blockquote,body,caption,col,colgroup,dd,' +\n 'details,dialog,div,dl,dt,fieldset,figcaption,figure,footer,form,' +\n 'h1,h2,h3,h4,h5,h6,head,header,hgroup,hr,html,legend,li,menuitem,meta,' +\n 'optgroup,option,param,rp,rt,source,style,summary,tbody,td,tfoot,th,thead,' +\n 'title,tr,track'\n);\n\n/**\n * Not type-checking this file because it's mostly vendor code.\n */\n\n// Regular Expressions for parsing tags and attributes\nvar attribute = /^\\s*([^\\s\"'<>\\/=]+)(?:\\s*(=)\\s*(?:\"([^\"]*)\"+|'([^']*)'+|([^\\s\"'=<>`]+)))?/;\nvar dynamicArgAttribute = /^\\s*((?:v-[\\w-]+:|@|:|#)\\[[^=]+\\][^\\s\"'<>\\/=]*)(?:\\s*(=)\\s*(?:\"([^\"]*)\"+|'([^']*)'+|([^\\s\"'=<>`]+)))?/;\nvar ncname = \"[a-zA-Z_][\\\\-\\\\.0-9_a-zA-Z\" + (unicodeRegExp.source) + \"]*\";\nvar qnameCapture = \"((?:\" + ncname + \"\\\\:)?\" + ncname + \")\";\nvar startTagOpen = new RegExp((\"^<\" + qnameCapture));\nvar startTagClose = /^\\s*(\\/?)>/;\nvar endTag = new RegExp((\"^<\\\\/\" + qnameCapture + \"[^>]*>\"));\nvar doctype = /^<!DOCTYPE [^>]+>/i;\n// #7298: escape - to avoid being pased as HTML comment when inlined in page\nvar comment = /^<!\\--/;\nvar conditionalComment = /^<!\\[/;\n\n// Special Elements (can contain anything)\nvar isPlainTextElement = makeMap('script,style,textarea', true);\nvar reCache = {};\n\nvar decodingMap = {\n '&lt;': '<',\n '&gt;': '>',\n '&quot;': '\"',\n '&amp;': '&',\n '&#10;': '\\n',\n '&#9;': '\\t',\n '&#39;': \"'\"\n};\nvar encodedAttr = /&(?:lt|gt|quot|amp|#39);/g;\nvar encodedAttrWithNewLines = /&(?:lt|gt|quot|amp|#39|#10|#9);/g;\n\n// #5992\nvar isIgnoreNewlineTag = makeMap('pre,textarea', true);\nvar shouldIgnoreFirstNewline = function (tag, html) { return tag && isIgnoreNewlineTag(tag) && html[0] === '\\n'; };\n\nfunction decodeAttr (value, shouldDecodeNewlines) {\n var re = shouldDecodeNewlines ? encodedAttrWithNewLines : encodedAttr;\n return value.replace(re, function (match) { return decodingMap[match]; })\n}\n\nfunction parseHTML (html, options) {\n var stack = [];\n var expectHTML = options.expectHTML;\n var isUnaryTag$$1 = options.isUnaryTag || no;\n var canBeLeftOpenTag$$1 = options.canBeLeftOpenTag || no;\n var index = 0;\n var last, lastTag;\n while (html) {\n last = html;\n // Make sure we're not in a plaintext content element like script/style\n if (!lastTag || !isPlainTextElement(lastTag)) {\n var textEnd = html.indexOf('<');\n if (textEnd === 0) {\n // Comment:\n if (comment.test(html)) {\n var commentEnd = html.indexOf('-->');\n\n if (commentEnd >= 0) {\n if (options.shouldKeepComment) {\n options.comment(html.substring(4, commentEnd), index, index + commentEnd + 3);\n }\n advance(commentEnd + 3);\n continue\n }\n }\n\n // http://en.wikipedia.org/wiki/Conditional_comment#Downlevel-revealed_conditional_comment\n if (conditionalComment.test(html)) {\n var conditionalEnd = html.indexOf(']>');\n\n if (conditionalEnd >= 0) {\n advance(conditionalEnd + 2);\n continue\n }\n }\n\n // Doctype:\n var doctypeMatch = html.match(doctype);\n if (doctypeMatch) {\n advance(doctypeMatch[0].length);\n continue\n }\n\n // End tag:\n var endTagMatch = html.match(endTag);\n if (endTagMatch) {\n var curIndex = index;\n advance(endTagMatch[0].length);\n parseEndTag(endTagMatch[1], curIndex, index);\n continue\n }\n\n // Start tag:\n var startTagMatch = parseStartTag();\n if (startTagMatch) {\n handleStartTag(startTagMatch);\n if (shouldIgnoreFirstNewline(startTagMatch.tagName, html)) {\n advance(1);\n }\n continue\n }\n }\n\n var text = (void 0), rest = (void 0), next = (void 0);\n if (textEnd >= 0) {\n rest = html.slice(textEnd);\n while (\n !endTag.test(rest) &&\n !startTagOpen.test(rest) &&\n !comment.test(rest) &&\n !conditionalComment.test(rest)\n ) {\n // < in plain text, be forgiving and treat it as text\n next = rest.indexOf('<', 1);\n if (next < 0) { break }\n textEnd += next;\n rest = html.slice(textEnd);\n }\n text = html.substring(0, textEnd);\n }\n\n if (textEnd < 0) {\n text = html;\n }\n\n if (text) {\n advance(text.length);\n }\n\n if (options.chars && text) {\n options.chars(text, index - text.length, index);\n }\n } else {\n var endTagLength = 0;\n var stackedTag = lastTag.toLowerCase();\n var reStackedTag = reCache[stackedTag] || (reCache[stackedTag] = new RegExp('([\\\\s\\\\S]*?)(</' + stackedTag + '[^>]*>)', 'i'));\n var rest$1 = html.replace(reStackedTag, function (all, text, endTag) {\n endTagLength = endTag.length;\n if (!isPlainTextElement(stackedTag) && stackedTag !== 'noscript') {\n text = text\n .replace(/<!\\--([\\s\\S]*?)-->/g, '$1') // #7298\n .replace(/<!\\[CDATA\\[([\\s\\S]*?)]]>/g, '$1');\n }\n if (shouldIgnoreFirstNewline(stackedTag, text)) {\n text = text.slice(1);\n }\n if (options.chars) {\n options.chars(text);\n }\n return ''\n });\n index += html.length - rest$1.length;\n html = rest$1;\n parseEndTag(stackedTag, index - endTagLength, index);\n }\n\n if (html === last) {\n options.chars && options.chars(html);\n if (!stack.length && options.warn) {\n options.warn((\"Mal-formatted tag at end of template: \\\"\" + html + \"\\\"\"), { start: index + html.length });\n }\n break\n }\n }\n\n // Clean up any remaining tags\n parseEndTag();\n\n function advance (n) {\n index += n;\n html = html.substring(n);\n }\n\n function parseStartTag () {\n var start = html.match(startTagOpen);\n if (start) {\n var match = {\n tagName: start[1],\n attrs: [],\n start: index\n };\n advance(start[0].length);\n var end, attr;\n while (!(end = html.match(startTagClose)) && (attr = html.match(dynamicArgAttribute) || html.match(attribute))) {\n attr.start = index;\n advance(attr[0].length);\n attr.end = index;\n match.attrs.push(attr);\n }\n if (end) {\n match.unarySlash = end[1];\n advance(end[0].length);\n match.end = index;\n return match\n }\n }\n }\n\n function handleStartTag (match) {\n var tagName = match.tagName;\n var unarySlash = match.unarySlash;\n\n if (expectHTML) {\n if (lastTag === 'p' && isNonPhrasingTag(tagName)) {\n parseEndTag(lastTag);\n }\n if (canBeLeftOpenTag$$1(tagName) && lastTag === tagName) {\n parseEndTag(tagName);\n }\n }\n\n var unary = isUnaryTag$$1(tagName) || !!unarySlash;\n\n var l = match.attrs.length;\n var attrs = new Array(l);\n for (var i = 0; i < l; i++) {\n var args = match.attrs[i];\n var value = args[3] || args[4] || args[5] || '';\n var shouldDecodeNewlines = tagName === 'a' && args[1] === 'href'\n ? options.shouldDecodeNewlinesForHref\n : options.shouldDecodeNewlines;\n attrs[i] = {\n name: args[1],\n value: decodeAttr(value, shouldDecodeNewlines)\n };\n if (options.outputSourceRange) {\n attrs[i].start = args.start + args[0].match(/^\\s*/).length;\n attrs[i].end = args.end;\n }\n }\n\n if (!unary) {\n stack.push({ tag: tagName, lowerCasedTag: tagName.toLowerCase(), attrs: attrs, start: match.start, end: match.end });\n lastTag = tagName;\n }\n\n if (options.start) {\n options.start(tagName, attrs, unary, match.start, match.end);\n }\n }\n\n function parseEndTag (tagName, start, end) {\n var pos, lowerCasedTagName;\n if (start == null) { start = index; }\n if (end == null) { end = index; }\n\n // Find the closest opened tag of the same type\n if (tagName) {\n lowerCasedTagName = tagName.toLowerCase();\n for (pos = stack.length - 1; pos >= 0; pos--) {\n if (stack[pos].lowerCasedTag === lowerCasedTagName) {\n break\n }\n }\n } else {\n // If no tag name is provided, clean shop\n pos = 0;\n }\n\n if (pos >= 0) {\n // Close all the open elements, up the stack\n for (var i = stack.length - 1; i >= pos; i--) {\n if (i > pos || !tagName &&\n options.warn\n ) {\n options.warn(\n (\"tag <\" + (stack[i].tag) + \"> has no matching end tag.\"),\n { start: stack[i].start, end: stack[i].end }\n );\n }\n if (options.end) {\n options.end(stack[i].tag, start, end);\n }\n }\n\n // Remove the open elements from the stack\n stack.length = pos;\n lastTag = pos && stack[pos - 1].tag;\n } else if (lowerCasedTagName === 'br') {\n if (options.start) {\n options.start(tagName, [], true, start, end);\n }\n } else if (lowerCasedTagName === 'p') {\n if (options.start) {\n options.start(tagName, [], false, start, end);\n }\n if (options.end) {\n options.end(tagName, start, end);\n }\n }\n }\n}\n\n/* */\n\nvar onRE = /^@|^v-on:/;\nvar dirRE = /^v-|^@|^:/;\nvar forAliasRE = /([\\s\\S]*?)\\s+(?:in|of)\\s+([\\s\\S]*)/;\nvar forIteratorRE = /,([^,\\}\\]]*)(?:,([^,\\}\\]]*))?$/;\nvar stripParensRE = /^\\(|\\)$/g;\nvar dynamicArgRE = /^\\[.*\\]$/;\n\nvar argRE = /:(.*)$/;\nvar bindRE = /^:|^\\.|^v-bind:/;\nvar modifierRE = /\\.[^.\\]]+(?=[^\\]]*$)/g;\n\nvar slotRE = /^v-slot(:|$)|^#/;\n\nvar lineBreakRE = /[\\r\\n]/;\nvar whitespaceRE$1 = /\\s+/g;\n\nvar invalidAttributeRE = /[\\s\"'<>\\/=]/;\n\nvar decodeHTMLCached = cached(he.decode);\n\nvar emptySlotScopeToken = \"_empty_\";\n\n// configurable state\nvar warn$2;\nvar delimiters;\nvar transforms;\nvar preTransforms;\nvar postTransforms;\nvar platformIsPreTag;\nvar platformMustUseProp;\nvar platformGetTagNamespace;\nvar maybeComponent;\n\nfunction createASTElement (\n tag,\n attrs,\n parent\n) {\n return {\n type: 1,\n tag: tag,\n attrsList: attrs,\n attrsMap: makeAttrsMap(attrs),\n rawAttrsMap: {},\n parent: parent,\n children: []\n }\n}\n\n/**\n * Convert HTML string to AST.\n */\nfunction parse (\n template,\n options\n) {\n warn$2 = options.warn || baseWarn;\n\n platformIsPreTag = options.isPreTag || no;\n platformMustUseProp = options.mustUseProp || no;\n platformGetTagNamespace = options.getTagNamespace || no;\n var isReservedTag = options.isReservedTag || no;\n maybeComponent = function (el) { return !!el.component || !isReservedTag(el.tag); };\n\n transforms = pluckModuleFunction(options.modules, 'transformNode');\n preTransforms = pluckModuleFunction(options.modules, 'preTransformNode');\n postTransforms = pluckModuleFunction(options.modules, 'postTransformNode');\n\n delimiters = options.delimiters;\n\n var stack = [];\n var preserveWhitespace = options.preserveWhitespace !== false;\n var whitespaceOption = options.whitespace;\n var root;\n var currentParent;\n var inVPre = false;\n var inPre = false;\n var warned = false;\n\n function warnOnce (msg, range) {\n if (!warned) {\n warned = true;\n warn$2(msg, range);\n }\n }\n\n function closeElement (element) {\n trimEndingWhitespace(element);\n if (!inVPre && !element.processed) {\n element = processElement(element, options);\n }\n // tree management\n if (!stack.length && element !== root) {\n // allow root elements with v-if, v-else-if and v-else\n if (root.if && (element.elseif || element.else)) {\n {\n checkRootConstraints(element);\n }\n addIfCondition(root, {\n exp: element.elseif,\n block: element\n });\n } else {\n warnOnce(\n \"Component template should contain exactly one root element. \" +\n \"If you are using v-if on multiple elements, \" +\n \"use v-else-if to chain them instead.\",\n { start: element.start }\n );\n }\n }\n if (currentParent && !element.forbidden) {\n if (element.elseif || element.else) {\n processIfConditions(element, currentParent);\n } else {\n if (element.slotScope) {\n // scoped slot\n // keep it in the children list so that v-else(-if) conditions can\n // find it as the prev node.\n var name = element.slotTarget || '\"default\"'\n ;(currentParent.scopedSlots || (currentParent.scopedSlots = {}))[name] = element;\n }\n currentParent.children.push(element);\n element.parent = currentParent;\n }\n }\n\n // final children cleanup\n // filter out scoped slots\n element.children = element.children.filter(function (c) { return !(c).slotScope; });\n // remove trailing whitespace node again\n trimEndingWhitespace(element);\n\n // check pre state\n if (element.pre) {\n inVPre = false;\n }\n if (platformIsPreTag(element.tag)) {\n inPre = false;\n }\n // apply post-transforms\n for (var i = 0; i < postTransforms.length; i++) {\n postTransforms[i](element, options);\n }\n }\n\n function trimEndingWhitespace (el) {\n // remove trailing whitespace node\n if (!inPre) {\n var lastNode;\n while (\n (lastNode = el.children[el.children.length - 1]) &&\n lastNode.type === 3 &&\n lastNode.text === ' '\n ) {\n el.children.pop();\n }\n }\n }\n\n function checkRootConstraints (el) {\n if (el.tag === 'slot' || el.tag === 'template') {\n warnOnce(\n \"Cannot use <\" + (el.tag) + \"> as component root element because it may \" +\n 'contain multiple nodes.',\n { start: el.start }\n );\n }\n if (el.attrsMap.hasOwnProperty('v-for')) {\n warnOnce(\n 'Cannot use v-for on stateful component root element because ' +\n 'it renders multiple elements.',\n el.rawAttrsMap['v-for']\n );\n }\n }\n\n parseHTML(template, {\n warn: warn$2,\n expectHTML: options.expectHTML,\n isUnaryTag: options.isUnaryTag,\n canBeLeftOpenTag: options.canBeLeftOpenTag,\n shouldDecodeNewlines: options.shouldDecodeNewlines,\n shouldDecodeNewlinesForHref: options.shouldDecodeNewlinesForHref,\n shouldKeepComment: options.comments,\n outputSourceRange: options.outputSourceRange,\n start: function start (tag, attrs, unary, start$1, end) {\n // check namespace.\n // inherit parent ns if there is one\n var ns = (currentParent && currentParent.ns) || platformGetTagNamespace(tag);\n\n // handle IE svg bug\n /* istanbul ignore if */\n if (isIE && ns === 'svg') {\n attrs = guardIESVGBug(attrs);\n }\n\n var element = createASTElement(tag, attrs, currentParent);\n if (ns) {\n element.ns = ns;\n }\n\n {\n if (options.outputSourceRange) {\n element.start = start$1;\n element.end = end;\n element.rawAttrsMap = element.attrsList.reduce(function (cumulated, attr) {\n cumulated[attr.name] = attr;\n return cumulated\n }, {});\n }\n attrs.forEach(function (attr) {\n if (invalidAttributeRE.test(attr.name)) {\n warn$2(\n \"Invalid dynamic argument expression: attribute names cannot contain \" +\n \"spaces, quotes, <, >, / or =.\",\n {\n start: attr.start + attr.name.indexOf(\"[\"),\n end: attr.start + attr.name.length\n }\n );\n }\n });\n }\n\n if (isForbiddenTag(element) && !isServerRendering()) {\n element.forbidden = true;\n warn$2(\n 'Templates should only be responsible for mapping the state to the ' +\n 'UI. Avoid placing tags with side-effects in your templates, such as ' +\n \"<\" + tag + \">\" + ', as they will not be parsed.',\n { start: element.start }\n );\n }\n\n // apply pre-transforms\n for (var i = 0; i < preTransforms.length; i++) {\n element = preTransforms[i](element, options) || element;\n }\n\n if (!inVPre) {\n processPre(element);\n if (element.pre) {\n inVPre = true;\n }\n }\n if (platformIsPreTag(element.tag)) {\n inPre = true;\n }\n if (inVPre) {\n processRawAttrs(element);\n } else if (!element.processed) {\n // structural directives\n processFor(element);\n processIf(element);\n processOnce(element);\n }\n\n if (!root) {\n root = element;\n {\n checkRootConstraints(root);\n }\n }\n\n if (!unary) {\n currentParent = element;\n stack.push(element);\n } else {\n closeElement(element);\n }\n },\n\n end: function end (tag, start, end$1) {\n var element = stack[stack.length - 1];\n // pop stack\n stack.length -= 1;\n currentParent = stack[stack.length - 1];\n if (options.outputSourceRange) {\n element.end = end$1;\n }\n closeElement(element);\n },\n\n chars: function chars (text, start, end) {\n if (!currentParent) {\n {\n if (text === template) {\n warnOnce(\n 'Component template requires a root element, rather than just text.',\n { start: start }\n );\n } else if ((text = text.trim())) {\n warnOnce(\n (\"text \\\"\" + text + \"\\\" outside root element will be ignored.\"),\n { start: start }\n );\n }\n }\n return\n }\n // IE textarea placeholder bug\n /* istanbul ignore if */\n if (isIE &&\n currentParent.tag === 'textarea' &&\n currentParent.attrsMap.placeholder === text\n ) {\n return\n }\n var children = currentParent.children;\n if (inPre || text.trim()) {\n text = isTextTag(currentParent) ? text : decodeHTMLCached(text);\n } else if (!children.length) {\n // remove the whitespace-only node right after an opening tag\n text = '';\n } else if (whitespaceOption) {\n if (whitespaceOption === 'condense') {\n // in condense mode, remove the whitespace node if it contains\n // line break, otherwise condense to a single space\n text = lineBreakRE.test(text) ? '' : ' ';\n } else {\n text = ' ';\n }\n } else {\n text = preserveWhitespace ? ' ' : '';\n }\n if (text) {\n if (!inPre && whitespaceOption === 'condense') {\n // condense consecutive whitespaces into single space\n text = text.replace(whitespaceRE$1, ' ');\n }\n var res;\n var child;\n if (!inVPre && text !== ' ' && (res = parseText(text, delimiters))) {\n child = {\n type: 2,\n expression: res.expression,\n tokens: res.tokens,\n text: text\n };\n } else if (text !== ' ' || !children.length || children[children.length - 1].text !== ' ') {\n child = {\n type: 3,\n text: text\n };\n }\n if (child) {\n if (options.outputSourceRange) {\n child.start = start;\n child.end = end;\n }\n children.push(child);\n }\n }\n },\n comment: function comment (text, start, end) {\n // adding anyting as a sibling to the root node is forbidden\n // comments should still be allowed, but ignored\n if (currentParent) {\n var child = {\n type: 3,\n text: text,\n isComment: true\n };\n if (options.outputSourceRange) {\n child.start = start;\n child.end = end;\n }\n currentParent.children.push(child);\n }\n }\n });\n return root\n}\n\nfunction processPre (el) {\n if (getAndRemoveAttr(el, 'v-pre') != null) {\n el.pre = true;\n }\n}\n\nfunction processRawAttrs (el) {\n var list = el.attrsList;\n var len = list.length;\n if (len) {\n var attrs = el.attrs = new Array(len);\n for (var i = 0; i < len; i++) {\n attrs[i] = {\n name: list[i].name,\n value: JSON.stringify(list[i].value)\n };\n if (list[i].start != null) {\n attrs[i].start = list[i].start;\n attrs[i].end = list[i].end;\n }\n }\n } else if (!el.pre) {\n // non root node in pre blocks with no attributes\n el.plain = true;\n }\n}\n\nfunction processElement (\n element,\n options\n) {\n processKey(element);\n\n // determine whether this is a plain element after\n // removing structural attributes\n element.plain = (\n !element.key &&\n !element.scopedSlots &&\n !element.attrsList.length\n );\n\n processRef(element);\n processSlotContent(element);\n processSlotOutlet(element);\n processComponent(element);\n for (var i = 0; i < transforms.length; i++) {\n element = transforms[i](element, options) || element;\n }\n processAttrs(element);\n return element\n}\n\nfunction processKey (el) {\n var exp = getBindingAttr(el, 'key');\n if (exp) {\n {\n if (el.tag === 'template') {\n warn$2(\n \"<template> cannot be keyed. Place the key on real elements instead.\",\n getRawBindingAttr(el, 'key')\n );\n }\n if (el.for) {\n var iterator = el.iterator2 || el.iterator1;\n var parent = el.parent;\n if (iterator && iterator === exp && parent && parent.tag === 'transition-group') {\n warn$2(\n \"Do not use v-for index as key on <transition-group> children, \" +\n \"this is the same as not using keys.\",\n getRawBindingAttr(el, 'key'),\n true /* tip */\n );\n }\n }\n }\n el.key = exp;\n }\n}\n\nfunction processRef (el) {\n var ref = getBindingAttr(el, 'ref');\n if (ref) {\n el.ref = ref;\n el.refInFor = checkInFor(el);\n }\n}\n\nfunction processFor (el) {\n var exp;\n if ((exp = getAndRemoveAttr(el, 'v-for'))) {\n var res = parseFor(exp);\n if (res) {\n extend(el, res);\n } else {\n warn$2(\n (\"Invalid v-for expression: \" + exp),\n el.rawAttrsMap['v-for']\n );\n }\n }\n}\n\n\n\nfunction parseFor (exp) {\n var inMatch = exp.match(forAliasRE);\n if (!inMatch) { return }\n var res = {};\n res.for = inMatch[2].trim();\n var alias = inMatch[1].trim().replace(stripParensRE, '');\n var iteratorMatch = alias.match(forIteratorRE);\n if (iteratorMatch) {\n res.alias = alias.replace(forIteratorRE, '').trim();\n res.iterator1 = iteratorMatch[1].trim();\n if (iteratorMatch[2]) {\n res.iterator2 = iteratorMatch[2].trim();\n }\n } else {\n res.alias = alias;\n }\n return res\n}\n\nfunction processIf (el) {\n var exp = getAndRemoveAttr(el, 'v-if');\n if (exp) {\n el.if = exp;\n addIfCondition(el, {\n exp: exp,\n block: el\n });\n } else {\n if (getAndRemoveAttr(el, 'v-else') != null) {\n el.else = true;\n }\n var elseif = getAndRemoveAttr(el, 'v-else-if');\n if (elseif) {\n el.elseif = elseif;\n }\n }\n}\n\nfunction processIfConditions (el, parent) {\n var prev = findPrevElement(parent.children);\n if (prev && prev.if) {\n addIfCondition(prev, {\n exp: el.elseif,\n block: el\n });\n } else {\n warn$2(\n \"v-\" + (el.elseif ? ('else-if=\"' + el.elseif + '\"') : 'else') + \" \" +\n \"used on element <\" + (el.tag) + \"> without corresponding v-if.\",\n el.rawAttrsMap[el.elseif ? 'v-else-if' : 'v-else']\n );\n }\n}\n\nfunction findPrevElement (children) {\n var i = children.length;\n while (i--) {\n if (children[i].type === 1) {\n return children[i]\n } else {\n if (children[i].text !== ' ') {\n warn$2(\n \"text \\\"\" + (children[i].text.trim()) + \"\\\" between v-if and v-else(-if) \" +\n \"will be ignored.\",\n children[i]\n );\n }\n children.pop();\n }\n }\n}\n\nfunction addIfCondition (el, condition) {\n if (!el.ifConditions) {\n el.ifConditions = [];\n }\n el.ifConditions.push(condition);\n}\n\nfunction processOnce (el) {\n var once$$1 = getAndRemoveAttr(el, 'v-once');\n if (once$$1 != null) {\n el.once = true;\n }\n}\n\n// handle content being passed to a component as slot,\n// e.g. <template slot=\"xxx\">, <div slot-scope=\"xxx\">\nfunction processSlotContent (el) {\n var slotScope;\n if (el.tag === 'template') {\n slotScope = getAndRemoveAttr(el, 'scope');\n /* istanbul ignore if */\n if (slotScope) {\n warn$2(\n \"the \\\"scope\\\" attribute for scoped slots have been deprecated and \" +\n \"replaced by \\\"slot-scope\\\" since 2.5. The new \\\"slot-scope\\\" attribute \" +\n \"can also be used on plain elements in addition to <template> to \" +\n \"denote scoped slots.\",\n el.rawAttrsMap['scope'],\n true\n );\n }\n el.slotScope = slotScope || getAndRemoveAttr(el, 'slot-scope');\n } else if ((slotScope = getAndRemoveAttr(el, 'slot-scope'))) {\n /* istanbul ignore if */\n if (el.attrsMap['v-for']) {\n warn$2(\n \"Ambiguous combined usage of slot-scope and v-for on <\" + (el.tag) + \"> \" +\n \"(v-for takes higher priority). Use a wrapper <template> for the \" +\n \"scoped slot to make it clearer.\",\n el.rawAttrsMap['slot-scope'],\n true\n );\n }\n el.slotScope = slotScope;\n }\n\n // slot=\"xxx\"\n var slotTarget = getBindingAttr(el, 'slot');\n if (slotTarget) {\n el.slotTarget = slotTarget === '\"\"' ? '\"default\"' : slotTarget;\n el.slotTargetDynamic = !!(el.attrsMap[':slot'] || el.attrsMap['v-bind:slot']);\n // preserve slot as an attribute for native shadow DOM compat\n // only for non-scoped slots.\n if (el.tag !== 'template' && !el.slotScope) {\n addAttr(el, 'slot', slotTarget, getRawBindingAttr(el, 'slot'));\n }\n }\n\n // 2.6 v-slot syntax\n {\n if (el.tag === 'template') {\n // v-slot on <template>\n var slotBinding = getAndRemoveAttrByRegex(el, slotRE);\n if (slotBinding) {\n {\n if (el.slotTarget || el.slotScope) {\n warn$2(\n \"Unexpected mixed usage of different slot syntaxes.\",\n el\n );\n }\n if (el.parent && !maybeComponent(el.parent)) {\n warn$2(\n \"<template v-slot> can only appear at the root level inside \" +\n \"the receiving the component\",\n el\n );\n }\n }\n var ref = getSlotName(slotBinding);\n var name = ref.name;\n var dynamic = ref.dynamic;\n el.slotTarget = name;\n el.slotTargetDynamic = dynamic;\n el.slotScope = slotBinding.value || emptySlotScopeToken; // force it into a scoped slot for perf\n }\n } else {\n // v-slot on component, denotes default slot\n var slotBinding$1 = getAndRemoveAttrByRegex(el, slotRE);\n if (slotBinding$1) {\n {\n if (!maybeComponent(el)) {\n warn$2(\n \"v-slot can only be used on components or <template>.\",\n slotBinding$1\n );\n }\n if (el.slotScope || el.slotTarget) {\n warn$2(\n \"Unexpected mixed usage of different slot syntaxes.\",\n el\n );\n }\n if (el.scopedSlots) {\n warn$2(\n \"To avoid scope ambiguity, the default slot should also use \" +\n \"<template> syntax when there are other named slots.\",\n slotBinding$1\n );\n }\n }\n // add the component's children to its default slot\n var slots = el.scopedSlots || (el.scopedSlots = {});\n var ref$1 = getSlotName(slotBinding$1);\n var name$1 = ref$1.name;\n var dynamic$1 = ref$1.dynamic;\n var slotContainer = slots[name$1] = createASTElement('template', [], el);\n slotContainer.slotTarget = name$1;\n slotContainer.slotTargetDynamic = dynamic$1;\n slotContainer.children = el.children.filter(function (c) {\n if (!c.slotScope) {\n c.parent = slotContainer;\n return true\n }\n });\n slotContainer.slotScope = slotBinding$1.value || emptySlotScopeToken;\n // remove children as they are returned from scopedSlots now\n el.children = [];\n // mark el non-plain so data gets generated\n el.plain = false;\n }\n }\n }\n}\n\nfunction getSlotName (binding) {\n var name = binding.name.replace(slotRE, '');\n if (!name) {\n if (binding.name[0] !== '#') {\n name = 'default';\n } else {\n warn$2(\n \"v-slot shorthand syntax requires a slot name.\",\n binding\n );\n }\n }\n return dynamicArgRE.test(name)\n // dynamic [name]\n ? { name: name.slice(1, -1), dynamic: true }\n // static name\n : { name: (\"\\\"\" + name + \"\\\"\"), dynamic: false }\n}\n\n// handle <slot/> outlets\nfunction processSlotOutlet (el) {\n if (el.tag === 'slot') {\n el.slotName = getBindingAttr(el, 'name');\n if (el.key) {\n warn$2(\n \"`key` does not work on <slot> because slots are abstract outlets \" +\n \"and can possibly expand into multiple elements. \" +\n \"Use the key on a wrapping element instead.\",\n getRawBindingAttr(el, 'key')\n );\n }\n }\n}\n\nfunction processComponent (el) {\n var binding;\n if ((binding = getBindingAttr(el, 'is'))) {\n el.component = binding;\n }\n if (getAndRemoveAttr(el, 'inline-template') != null) {\n el.inlineTemplate = true;\n }\n}\n\nfunction processAttrs (el) {\n var list = el.attrsList;\n var i, l, name, rawName, value, modifiers, syncGen, isDynamic;\n for (i = 0, l = list.length; i < l; i++) {\n name = rawName = list[i].name;\n value = list[i].value;\n if (dirRE.test(name)) {\n // mark element as dynamic\n el.hasBindings = true;\n // modifiers\n modifiers = parseModifiers(name.replace(dirRE, ''));\n // support .foo shorthand syntax for the .prop modifier\n if (modifiers) {\n name = name.replace(modifierRE, '');\n }\n if (bindRE.test(name)) { // v-bind\n name = name.replace(bindRE, '');\n value = parseFilters(value);\n isDynamic = dynamicArgRE.test(name);\n if (isDynamic) {\n name = name.slice(1, -1);\n }\n if (\n value.trim().length === 0\n ) {\n warn$2(\n (\"The value for a v-bind expression cannot be empty. Found in \\\"v-bind:\" + name + \"\\\"\")\n );\n }\n if (modifiers) {\n if (modifiers.prop && !isDynamic) {\n name = camelize(name);\n if (name === 'innerHtml') { name = 'innerHTML'; }\n }\n if (modifiers.camel && !isDynamic) {\n name = camelize(name);\n }\n if (modifiers.sync) {\n syncGen = genAssignmentCode(value, \"$event\");\n if (!isDynamic) {\n addHandler(\n el,\n (\"update:\" + (camelize(name))),\n syncGen,\n null,\n false,\n warn$2,\n list[i]\n );\n if (hyphenate(name) !== camelize(name)) {\n addHandler(\n el,\n (\"update:\" + (hyphenate(name))),\n syncGen,\n null,\n false,\n warn$2,\n list[i]\n );\n }\n } else {\n // handler w/ dynamic event name\n addHandler(\n el,\n (\"\\\"update:\\\"+(\" + name + \")\"),\n syncGen,\n null,\n false,\n warn$2,\n list[i],\n true // dynamic\n );\n }\n }\n }\n if ((modifiers && modifiers.prop) || (\n !el.component && platformMustUseProp(el.tag, el.attrsMap.type, name)\n )) {\n addProp(el, name, value, list[i], isDynamic);\n } else {\n addAttr(el, name, value, list[i], isDynamic);\n }\n } else if (onRE.test(name)) { // v-on\n name = name.replace(onRE, '');\n isDynamic = dynamicArgRE.test(name);\n if (isDynamic) {\n name = name.slice(1, -1);\n }\n addHandler(el, name, value, modifiers, false, warn$2, list[i], isDynamic);\n } else { // normal directives\n name = name.replace(dirRE, '');\n // parse arg\n var argMatch = name.match(argRE);\n var arg = argMatch && argMatch[1];\n isDynamic = false;\n if (arg) {\n name = name.slice(0, -(arg.length + 1));\n if (dynamicArgRE.test(arg)) {\n arg = arg.slice(1, -1);\n isDynamic = true;\n }\n }\n addDirective(el, name, rawName, value, arg, isDynamic, modifiers, list[i]);\n if (name === 'model') {\n checkForAliasModel(el, value);\n }\n }\n } else {\n // literal attribute\n {\n var res = parseText(value, delimiters);\n if (res) {\n warn$2(\n name + \"=\\\"\" + value + \"\\\": \" +\n 'Interpolation inside attributes has been removed. ' +\n 'Use v-bind or the colon shorthand instead. For example, ' +\n 'instead of <div id=\"{{ val }}\">, use <div :id=\"val\">.',\n list[i]\n );\n }\n }\n addAttr(el, name, JSON.stringify(value), list[i]);\n // #6887 firefox doesn't update muted state if set via attribute\n // even immediately after element creation\n if (!el.component &&\n name === 'muted' &&\n platformMustUseProp(el.tag, el.attrsMap.type, name)) {\n addProp(el, name, 'true', list[i]);\n }\n }\n }\n}\n\nfunction checkInFor (el) {\n var parent = el;\n while (parent) {\n if (parent.for !== undefined) {\n return true\n }\n parent = parent.parent;\n }\n return false\n}\n\nfunction parseModifiers (name) {\n var match = name.match(modifierRE);\n if (match) {\n var ret = {};\n match.forEach(function (m) { ret[m.slice(1)] = true; });\n return ret\n }\n}\n\nfunction makeAttrsMap (attrs) {\n var map = {};\n for (var i = 0, l = attrs.length; i < l; i++) {\n if (\n map[attrs[i].name] && !isIE && !isEdge\n ) {\n warn$2('duplicate attribute: ' + attrs[i].name, attrs[i]);\n }\n map[attrs[i].name] = attrs[i].value;\n }\n return map\n}\n\n// for script (e.g. type=\"x/template\") or style, do not decode content\nfunction isTextTag (el) {\n return el.tag === 'script' || el.tag === 'style'\n}\n\nfunction isForbiddenTag (el) {\n return (\n el.tag === 'style' ||\n (el.tag === 'script' && (\n !el.attrsMap.type ||\n el.attrsMap.type === 'text/javascript'\n ))\n )\n}\n\nvar ieNSBug = /^xmlns:NS\\d+/;\nvar ieNSPrefix = /^NS\\d+:/;\n\n/* istanbul ignore next */\nfunction guardIESVGBug (attrs) {\n var res = [];\n for (var i = 0; i < attrs.length; i++) {\n var attr = attrs[i];\n if (!ieNSBug.test(attr.name)) {\n attr.name = attr.name.replace(ieNSPrefix, '');\n res.push(attr);\n }\n }\n return res\n}\n\nfunction checkForAliasModel (el, value) {\n var _el = el;\n while (_el) {\n if (_el.for && _el.alias === value) {\n warn$2(\n \"<\" + (el.tag) + \" v-model=\\\"\" + value + \"\\\">: \" +\n \"You are binding v-model directly to a v-for iteration alias. \" +\n \"This will not be able to modify the v-for source array because \" +\n \"writing to the alias is like modifying a function local variable. \" +\n \"Consider using an array of objects and use v-model on an object property instead.\",\n el.rawAttrsMap['v-model']\n );\n }\n _el = _el.parent;\n }\n}\n\n/* */\n\nfunction preTransformNode (el, options) {\n if (el.tag === 'input') {\n var map = el.attrsMap;\n if (!map['v-model']) {\n return\n }\n\n var typeBinding;\n if (map[':type'] || map['v-bind:type']) {\n typeBinding = getBindingAttr(el, 'type');\n }\n if (!map.type && !typeBinding && map['v-bind']) {\n typeBinding = \"(\" + (map['v-bind']) + \").type\";\n }\n\n if (typeBinding) {\n var ifCondition = getAndRemoveAttr(el, 'v-if', true);\n var ifConditionExtra = ifCondition ? (\"&&(\" + ifCondition + \")\") : \"\";\n var hasElse = getAndRemoveAttr(el, 'v-else', true) != null;\n var elseIfCondition = getAndRemoveAttr(el, 'v-else-if', true);\n // 1. checkbox\n var branch0 = cloneASTElement(el);\n // process for on the main node\n processFor(branch0);\n addRawAttr(branch0, 'type', 'checkbox');\n processElement(branch0, options);\n branch0.processed = true; // prevent it from double-processed\n branch0.if = \"(\" + typeBinding + \")==='checkbox'\" + ifConditionExtra;\n addIfCondition(branch0, {\n exp: branch0.if,\n block: branch0\n });\n // 2. add radio else-if condition\n var branch1 = cloneASTElement(el);\n getAndRemoveAttr(branch1, 'v-for', true);\n addRawAttr(branch1, 'type', 'radio');\n processElement(branch1, options);\n addIfCondition(branch0, {\n exp: \"(\" + typeBinding + \")==='radio'\" + ifConditionExtra,\n block: branch1\n });\n // 3. other\n var branch2 = cloneASTElement(el);\n getAndRemoveAttr(branch2, 'v-for', true);\n addRawAttr(branch2, ':type', typeBinding);\n processElement(branch2, options);\n addIfCondition(branch0, {\n exp: ifCondition,\n block: branch2\n });\n\n if (hasElse) {\n branch0.else = true;\n } else if (elseIfCondition) {\n branch0.elseif = elseIfCondition;\n }\n\n return branch0\n }\n }\n}\n\nfunction cloneASTElement (el) {\n return createASTElement(el.tag, el.attrsList.slice(), el.parent)\n}\n\nvar model$1 = {\n preTransformNode: preTransformNode\n};\n\nvar modules$1 = [\n klass$1,\n style$1,\n model$1\n];\n\n/* */\n\nfunction text (el, dir) {\n if (dir.value) {\n addProp(el, 'textContent', (\"_s(\" + (dir.value) + \")\"), dir);\n }\n}\n\n/* */\n\nfunction html (el, dir) {\n if (dir.value) {\n addProp(el, 'innerHTML', (\"_s(\" + (dir.value) + \")\"), dir);\n }\n}\n\nvar directives$1 = {\n model: model,\n text: text,\n html: html\n};\n\n/* */\n\nvar baseOptions = {\n expectHTML: true,\n modules: modules$1,\n directives: directives$1,\n isPreTag: isPreTag,\n isUnaryTag: isUnaryTag,\n mustUseProp: mustUseProp,\n canBeLeftOpenTag: canBeLeftOpenTag,\n isReservedTag: isReservedTag,\n getTagNamespace: getTagNamespace,\n staticKeys: genStaticKeys(modules$1)\n};\n\n/* */\n\nvar isStaticKey;\nvar isPlatformReservedTag;\n\nvar genStaticKeysCached = cached(genStaticKeys$1);\n\n/**\n * Goal of the optimizer: walk the generated template AST tree\n * and detect sub-trees that are purely static, i.e. parts of\n * the DOM that never needs to change.\n *\n * Once we detect these sub-trees, we can:\n *\n * 1. Hoist them into constants, so that we no longer need to\n * create fresh nodes for them on each re-render;\n * 2. Completely skip them in the patching process.\n */\nfunction optimize (root, options) {\n if (!root) { return }\n isStaticKey = genStaticKeysCached(options.staticKeys || '');\n isPlatformReservedTag = options.isReservedTag || no;\n // first pass: mark all non-static nodes.\n markStatic$1(root);\n // second pass: mark static roots.\n markStaticRoots(root, false);\n}\n\nfunction genStaticKeys$1 (keys) {\n return makeMap(\n 'type,tag,attrsList,attrsMap,plain,parent,children,attrs,start,end,rawAttrsMap' +\n (keys ? ',' + keys : '')\n )\n}\n\nfunction markStatic$1 (node) {\n node.static = isStatic(node);\n if (node.type === 1) {\n // do not make component slot content static. this avoids\n // 1. components not able to mutate slot nodes\n // 2. static slot content fails for hot-reloading\n if (\n !isPlatformReservedTag(node.tag) &&\n node.tag !== 'slot' &&\n node.attrsMap['inline-template'] == null\n ) {\n return\n }\n for (var i = 0, l = node.children.length; i < l; i++) {\n var child = node.children[i];\n markStatic$1(child);\n if (!child.static) {\n node.static = false;\n }\n }\n if (node.ifConditions) {\n for (var i$1 = 1, l$1 = node.ifConditions.length; i$1 < l$1; i$1++) {\n var block = node.ifConditions[i$1].block;\n markStatic$1(block);\n if (!block.static) {\n node.static = false;\n }\n }\n }\n }\n}\n\nfunction markStaticRoots (node, isInFor) {\n if (node.type === 1) {\n if (node.static || node.once) {\n node.staticInFor = isInFor;\n }\n // For a node to qualify as a static root, it should have children that\n // are not just static text. Otherwise the cost of hoisting out will\n // outweigh the benefits and it's better off to just always render it fresh.\n if (node.static && node.children.length && !(\n node.children.length === 1 &&\n node.children[0].type === 3\n )) {\n node.staticRoot = true;\n return\n } else {\n node.staticRoot = false;\n }\n if (node.children) {\n for (var i = 0, l = node.children.length; i < l; i++) {\n markStaticRoots(node.children[i], isInFor || !!node.for);\n }\n }\n if (node.ifConditions) {\n for (var i$1 = 1, l$1 = node.ifConditions.length; i$1 < l$1; i$1++) {\n markStaticRoots(node.ifConditions[i$1].block, isInFor);\n }\n }\n }\n}\n\nfunction isStatic (node) {\n if (node.type === 2) { // expression\n return false\n }\n if (node.type === 3) { // text\n return true\n }\n return !!(node.pre || (\n !node.hasBindings && // no dynamic bindings\n !node.if && !node.for && // not v-if or v-for or v-else\n !isBuiltInTag(node.tag) && // not a built-in\n isPlatformReservedTag(node.tag) && // not a component\n !isDirectChildOfTemplateFor(node) &&\n Object.keys(node).every(isStaticKey)\n ))\n}\n\nfunction isDirectChildOfTemplateFor (node) {\n while (node.parent) {\n node = node.parent;\n if (node.tag !== 'template') {\n return false\n }\n if (node.for) {\n return true\n }\n }\n return false\n}\n\n/* */\n\nvar fnExpRE = /^([\\w$_]+|\\([^)]*?\\))\\s*=>|^function\\s*(?:[\\w$]+)?\\s*\\(/;\nvar fnInvokeRE = /\\([^)]*?\\);*$/;\nvar simplePathRE = /^[A-Za-z_$][\\w$]*(?:\\.[A-Za-z_$][\\w$]*|\\['[^']*?']|\\[\"[^\"]*?\"]|\\[\\d+]|\\[[A-Za-z_$][\\w$]*])*$/;\n\n// KeyboardEvent.keyCode aliases\nvar keyCodes = {\n esc: 27,\n tab: 9,\n enter: 13,\n space: 32,\n up: 38,\n left: 37,\n right: 39,\n down: 40,\n 'delete': [8, 46]\n};\n\n// KeyboardEvent.key aliases\nvar keyNames = {\n // #7880: IE11 and Edge use `Esc` for Escape key name.\n esc: ['Esc', 'Escape'],\n tab: 'Tab',\n enter: 'Enter',\n // #9112: IE11 uses `Spacebar` for Space key name.\n space: [' ', 'Spacebar'],\n // #7806: IE11 uses key names without `Arrow` prefix for arrow keys.\n up: ['Up', 'ArrowUp'],\n left: ['Left', 'ArrowLeft'],\n right: ['Right', 'ArrowRight'],\n down: ['Down', 'ArrowDown'],\n // #9112: IE11 uses `Del` for Delete key name.\n 'delete': ['Backspace', 'Delete', 'Del']\n};\n\n// #4868: modifiers that prevent the execution of the listener\n// need to explicitly return null so that we can determine whether to remove\n// the listener for .once\nvar genGuard = function (condition) { return (\"if(\" + condition + \")return null;\"); };\n\nvar modifierCode = {\n stop: '$event.stopPropagation();',\n prevent: '$event.preventDefault();',\n self: genGuard(\"$event.target !== $event.currentTarget\"),\n ctrl: genGuard(\"!$event.ctrlKey\"),\n shift: genGuard(\"!$event.shiftKey\"),\n alt: genGuard(\"!$event.altKey\"),\n meta: genGuard(\"!$event.metaKey\"),\n left: genGuard(\"'button' in $event && $event.button !== 0\"),\n middle: genGuard(\"'button' in $event && $event.button !== 1\"),\n right: genGuard(\"'button' in $event && $event.button !== 2\")\n};\n\nfunction genHandlers (\n events,\n isNative\n) {\n var prefix = isNative ? 'nativeOn:' : 'on:';\n var staticHandlers = \"\";\n var dynamicHandlers = \"\";\n for (var name in events) {\n var handlerCode = genHandler(events[name]);\n if (events[name] && events[name].dynamic) {\n dynamicHandlers += name + \",\" + handlerCode + \",\";\n } else {\n staticHandlers += \"\\\"\" + name + \"\\\":\" + handlerCode + \",\";\n }\n }\n staticHandlers = \"{\" + (staticHandlers.slice(0, -1)) + \"}\";\n if (dynamicHandlers) {\n return prefix + \"_d(\" + staticHandlers + \",[\" + (dynamicHandlers.slice(0, -1)) + \"])\"\n } else {\n return prefix + staticHandlers\n }\n}\n\nfunction genHandler (handler) {\n if (!handler) {\n return 'function(){}'\n }\n\n if (Array.isArray(handler)) {\n return (\"[\" + (handler.map(function (handler) { return genHandler(handler); }).join(',')) + \"]\")\n }\n\n var isMethodPath = simplePathRE.test(handler.value);\n var isFunctionExpression = fnExpRE.test(handler.value);\n var isFunctionInvocation = simplePathRE.test(handler.value.replace(fnInvokeRE, ''));\n\n if (!handler.modifiers) {\n if (isMethodPath || isFunctionExpression) {\n return handler.value\n }\n return (\"function($event){\" + (isFunctionInvocation ? (\"return \" + (handler.value)) : handler.value) + \"}\") // inline statement\n } else {\n var code = '';\n var genModifierCode = '';\n var keys = [];\n for (var key in handler.modifiers) {\n if (modifierCode[key]) {\n genModifierCode += modifierCode[key];\n // left/right\n if (keyCodes[key]) {\n keys.push(key);\n }\n } else if (key === 'exact') {\n var modifiers = (handler.modifiers);\n genModifierCode += genGuard(\n ['ctrl', 'shift', 'alt', 'meta']\n .filter(function (keyModifier) { return !modifiers[keyModifier]; })\n .map(function (keyModifier) { return (\"$event.\" + keyModifier + \"Key\"); })\n .join('||')\n );\n } else {\n keys.push(key);\n }\n }\n if (keys.length) {\n code += genKeyFilter(keys);\n }\n // Make sure modifiers like prevent and stop get executed after key filtering\n if (genModifierCode) {\n code += genModifierCode;\n }\n var handlerCode = isMethodPath\n ? (\"return \" + (handler.value) + \"($event)\")\n : isFunctionExpression\n ? (\"return (\" + (handler.value) + \")($event)\")\n : isFunctionInvocation\n ? (\"return \" + (handler.value))\n : handler.value;\n return (\"function($event){\" + code + handlerCode + \"}\")\n }\n}\n\nfunction genKeyFilter (keys) {\n return (\n // make sure the key filters only apply to KeyboardEvents\n // #9441: can't use 'keyCode' in $event because Chrome autofill fires fake\n // key events that do not have keyCode property...\n \"if(!$event.type.indexOf('key')&&\" +\n (keys.map(genFilterCode).join('&&')) + \")return null;\"\n )\n}\n\nfunction genFilterCode (key) {\n var keyVal = parseInt(key, 10);\n if (keyVal) {\n return (\"$event.keyCode!==\" + keyVal)\n }\n var keyCode = keyCodes[key];\n var keyName = keyNames[key];\n return (\n \"_k($event.keyCode,\" +\n (JSON.stringify(key)) + \",\" +\n (JSON.stringify(keyCode)) + \",\" +\n \"$event.key,\" +\n \"\" + (JSON.stringify(keyName)) +\n \")\"\n )\n}\n\n/* */\n\nfunction on (el, dir) {\n if (dir.modifiers) {\n warn(\"v-on without argument does not support modifiers.\");\n }\n el.wrapListeners = function (code) { return (\"_g(\" + code + \",\" + (dir.value) + \")\"); };\n}\n\n/* */\n\nfunction bind$1 (el, dir) {\n el.wrapData = function (code) {\n return (\"_b(\" + code + \",'\" + (el.tag) + \"',\" + (dir.value) + \",\" + (dir.modifiers && dir.modifiers.prop ? 'true' : 'false') + (dir.modifiers && dir.modifiers.sync ? ',true' : '') + \")\")\n };\n}\n\n/* */\n\nvar baseDirectives = {\n on: on,\n bind: bind$1,\n cloak: noop\n};\n\n/* */\n\n\n\n\n\nvar CodegenState = function CodegenState (options) {\n this.options = options;\n this.warn = options.warn || baseWarn;\n this.transforms = pluckModuleFunction(options.modules, 'transformCode');\n this.dataGenFns = pluckModuleFunction(options.modules, 'genData');\n this.directives = extend(extend({}, baseDirectives), options.directives);\n var isReservedTag = options.isReservedTag || no;\n this.maybeComponent = function (el) { return !!el.component || !isReservedTag(el.tag); };\n this.onceId = 0;\n this.staticRenderFns = [];\n this.pre = false;\n};\n\n\n\nfunction generate (\n ast,\n options\n) {\n var state = new CodegenState(options);\n var code = ast ? genElement(ast, state) : '_c(\"div\")';\n return {\n render: (\"with(this){return \" + code + \"}\"),\n staticRenderFns: state.staticRenderFns\n }\n}\n\nfunction genElement (el, state) {\n if (el.parent) {\n el.pre = el.pre || el.parent.pre;\n }\n\n if (el.staticRoot && !el.staticProcessed) {\n return genStatic(el, state)\n } else if (el.once && !el.onceProcessed) {\n return genOnce(el, state)\n } else if (el.for && !el.forProcessed) {\n return genFor(el, state)\n } else if (el.if && !el.ifProcessed) {\n return genIf(el, state)\n } else if (el.tag === 'template' && !el.slotTarget && !state.pre) {\n return genChildren(el, state) || 'void 0'\n } else if (el.tag === 'slot') {\n return genSlot(el, state)\n } else {\n // component or element\n var code;\n if (el.component) {\n code = genComponent(el.component, el, state);\n } else {\n var data;\n if (!el.plain || (el.pre && state.maybeComponent(el))) {\n data = genData$2(el, state);\n }\n\n var children = el.inlineTemplate ? null : genChildren(el, state, true);\n code = \"_c('\" + (el.tag) + \"'\" + (data ? (\",\" + data) : '') + (children ? (\",\" + children) : '') + \")\";\n }\n // module transforms\n for (var i = 0; i < state.transforms.length; i++) {\n code = state.transforms[i](el, code);\n }\n return code\n }\n}\n\n// hoist static sub-trees out\nfunction genStatic (el, state) {\n el.staticProcessed = true;\n // Some elements (templates) need to behave differently inside of a v-pre\n // node. All pre nodes are static roots, so we can use this as a location to\n // wrap a state change and reset it upon exiting the pre node.\n var originalPreState = state.pre;\n if (el.pre) {\n state.pre = el.pre;\n }\n state.staticRenderFns.push((\"with(this){return \" + (genElement(el, state)) + \"}\"));\n state.pre = originalPreState;\n return (\"_m(\" + (state.staticRenderFns.length - 1) + (el.staticInFor ? ',true' : '') + \")\")\n}\n\n// v-once\nfunction genOnce (el, state) {\n el.onceProcessed = true;\n if (el.if && !el.ifProcessed) {\n return genIf(el, state)\n } else if (el.staticInFor) {\n var key = '';\n var parent = el.parent;\n while (parent) {\n if (parent.for) {\n key = parent.key;\n break\n }\n parent = parent.parent;\n }\n if (!key) {\n state.warn(\n \"v-once can only be used inside v-for that is keyed. \",\n el.rawAttrsMap['v-once']\n );\n return genElement(el, state)\n }\n return (\"_o(\" + (genElement(el, state)) + \",\" + (state.onceId++) + \",\" + key + \")\")\n } else {\n return genStatic(el, state)\n }\n}\n\nfunction genIf (\n el,\n state,\n altGen,\n altEmpty\n) {\n el.ifProcessed = true; // avoid recursion\n return genIfConditions(el.ifConditions.slice(), state, altGen, altEmpty)\n}\n\nfunction genIfConditions (\n conditions,\n state,\n altGen,\n altEmpty\n) {\n if (!conditions.length) {\n return altEmpty || '_e()'\n }\n\n var condition = conditions.shift();\n if (condition.exp) {\n return (\"(\" + (condition.exp) + \")?\" + (genTernaryExp(condition.block)) + \":\" + (genIfConditions(conditions, state, altGen, altEmpty)))\n } else {\n return (\"\" + (genTernaryExp(condition.block)))\n }\n\n // v-if with v-once should generate code like (a)?_m(0):_m(1)\n function genTernaryExp (el) {\n return altGen\n ? altGen(el, state)\n : el.once\n ? genOnce(el, state)\n : genElement(el, state)\n }\n}\n\nfunction genFor (\n el,\n state,\n altGen,\n altHelper\n) {\n var exp = el.for;\n var alias = el.alias;\n var iterator1 = el.iterator1 ? (\",\" + (el.iterator1)) : '';\n var iterator2 = el.iterator2 ? (\",\" + (el.iterator2)) : '';\n\n if (state.maybeComponent(el) &&\n el.tag !== 'slot' &&\n el.tag !== 'template' &&\n !el.key\n ) {\n state.warn(\n \"<\" + (el.tag) + \" v-for=\\\"\" + alias + \" in \" + exp + \"\\\">: component lists rendered with \" +\n \"v-for should have explicit keys. \" +\n \"See https://vuejs.org/guide/list.html#key for more info.\",\n el.rawAttrsMap['v-for'],\n true /* tip */\n );\n }\n\n el.forProcessed = true; // avoid recursion\n return (altHelper || '_l') + \"((\" + exp + \"),\" +\n \"function(\" + alias + iterator1 + iterator2 + \"){\" +\n \"return \" + ((altGen || genElement)(el, state)) +\n '})'\n}\n\nfunction genData$2 (el, state) {\n var data = '{';\n\n // directives first.\n // directives may mutate the el's other properties before they are generated.\n var dirs = genDirectives(el, state);\n if (dirs) { data += dirs + ','; }\n\n // key\n if (el.key) {\n data += \"key:\" + (el.key) + \",\";\n }\n // ref\n if (el.ref) {\n data += \"ref:\" + (el.ref) + \",\";\n }\n if (el.refInFor) {\n data += \"refInFor:true,\";\n }\n // pre\n if (el.pre) {\n data += \"pre:true,\";\n }\n // record original tag name for components using \"is\" attribute\n if (el.component) {\n data += \"tag:\\\"\" + (el.tag) + \"\\\",\";\n }\n // module data generation functions\n for (var i = 0; i < state.dataGenFns.length; i++) {\n data += state.dataGenFns[i](el);\n }\n // attributes\n if (el.attrs) {\n data += \"attrs:\" + (genProps(el.attrs)) + \",\";\n }\n // DOM props\n if (el.props) {\n data += \"domProps:\" + (genProps(el.props)) + \",\";\n }\n // event handlers\n if (el.events) {\n data += (genHandlers(el.events, false)) + \",\";\n }\n if (el.nativeEvents) {\n data += (genHandlers(el.nativeEvents, true)) + \",\";\n }\n // slot target\n // only for non-scoped slots\n if (el.slotTarget && !el.slotScope) {\n data += \"slot:\" + (el.slotTarget) + \",\";\n }\n // scoped slots\n if (el.scopedSlots) {\n data += (genScopedSlots(el, el.scopedSlots, state)) + \",\";\n }\n // component v-model\n if (el.model) {\n data += \"model:{value:\" + (el.model.value) + \",callback:\" + (el.model.callback) + \",expression:\" + (el.model.expression) + \"},\";\n }\n // inline-template\n if (el.inlineTemplate) {\n var inlineTemplate = genInlineTemplate(el, state);\n if (inlineTemplate) {\n data += inlineTemplate + \",\";\n }\n }\n data = data.replace(/,$/, '') + '}';\n // v-bind dynamic argument wrap\n // v-bind with dynamic arguments must be applied using the same v-bind object\n // merge helper so that class/style/mustUseProp attrs are handled correctly.\n if (el.dynamicAttrs) {\n data = \"_b(\" + data + \",\\\"\" + (el.tag) + \"\\\",\" + (genProps(el.dynamicAttrs)) + \")\";\n }\n // v-bind data wrap\n if (el.wrapData) {\n data = el.wrapData(data);\n }\n // v-on data wrap\n if (el.wrapListeners) {\n data = el.wrapListeners(data);\n }\n return data\n}\n\nfunction genDirectives (el, state) {\n var dirs = el.directives;\n if (!dirs) { return }\n var res = 'directives:[';\n var hasRuntime = false;\n var i, l, dir, needRuntime;\n for (i = 0, l = dirs.length; i < l; i++) {\n dir = dirs[i];\n needRuntime = true;\n var gen = state.directives[dir.name];\n if (gen) {\n // compile-time directive that manipulates AST.\n // returns true if it also needs a runtime counterpart.\n needRuntime = !!gen(el, dir, state.warn);\n }\n if (needRuntime) {\n hasRuntime = true;\n 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))) : '') + \"},\";\n }\n }\n if (hasRuntime) {\n return res.slice(0, -1) + ']'\n }\n}\n\nfunction genInlineTemplate (el, state) {\n var ast = el.children[0];\n if (el.children.length !== 1 || ast.type !== 1) {\n state.warn(\n 'Inline-template components must have exactly one child element.',\n { start: el.start }\n );\n }\n if (ast && ast.type === 1) {\n var inlineRenderFns = generate(ast, state.options);\n return (\"inlineTemplate:{render:function(){\" + (inlineRenderFns.render) + \"},staticRenderFns:[\" + (inlineRenderFns.staticRenderFns.map(function (code) { return (\"function(){\" + code + \"}\"); }).join(',')) + \"]}\")\n }\n}\n\nfunction genScopedSlots (\n el,\n slots,\n state\n) {\n // by default scoped slots are considered \"stable\", this allows child\n // components with only scoped slots to skip forced updates from parent.\n // but in some cases we have to bail-out of this optimization\n // for example if the slot contains dynamic names, has v-if or v-for on them...\n var needsForceUpdate = el.for || Object.keys(slots).some(function (key) {\n var slot = slots[key];\n return (\n slot.slotTargetDynamic ||\n slot.if ||\n slot.for ||\n containsSlotChild(slot) // is passing down slot from parent which may be dynamic\n )\n });\n\n // #9534: if a component with scoped slots is inside a conditional branch,\n // it's possible for the same component to be reused but with different\n // compiled slot content. To avoid that, we generate a unique key based on\n // the generated code of all the slot contents.\n var needsKey = !!el.if;\n\n // OR when it is inside another scoped slot or v-for (the reactivity may be\n // disconnected due to the intermediate scope variable)\n // #9438, #9506\n // TODO: this can be further optimized by properly analyzing in-scope bindings\n // and skip force updating ones that do not actually use scope variables.\n if (!needsForceUpdate) {\n var parent = el.parent;\n while (parent) {\n if (\n (parent.slotScope && parent.slotScope !== emptySlotScopeToken) ||\n parent.for\n ) {\n needsForceUpdate = true;\n break\n }\n if (parent.if) {\n needsKey = true;\n }\n parent = parent.parent;\n }\n }\n\n var generatedSlots = Object.keys(slots)\n .map(function (key) { return genScopedSlot(slots[key], state); })\n .join(',');\n\n return (\"scopedSlots:_u([\" + generatedSlots + \"]\" + (needsForceUpdate ? \",null,true\" : \"\") + (!needsForceUpdate && needsKey ? (\",null,false,\" + (hash(generatedSlots))) : \"\") + \")\")\n}\n\nfunction hash(str) {\n var hash = 5381;\n var i = str.length;\n while(i) {\n hash = (hash * 33) ^ str.charCodeAt(--i);\n }\n return hash >>> 0\n}\n\nfunction containsSlotChild (el) {\n if (el.type === 1) {\n if (el.tag === 'slot') {\n return true\n }\n return el.children.some(containsSlotChild)\n }\n return false\n}\n\nfunction genScopedSlot (\n el,\n state\n) {\n var isLegacySyntax = el.attrsMap['slot-scope'];\n if (el.if && !el.ifProcessed && !isLegacySyntax) {\n return genIf(el, state, genScopedSlot, \"null\")\n }\n if (el.for && !el.forProcessed) {\n return genFor(el, state, genScopedSlot)\n }\n var slotScope = el.slotScope === emptySlotScopeToken\n ? \"\"\n : String(el.slotScope);\n var fn = \"function(\" + slotScope + \"){\" +\n \"return \" + (el.tag === 'template'\n ? el.if && isLegacySyntax\n ? (\"(\" + (el.if) + \")?\" + (genChildren(el, state) || 'undefined') + \":undefined\")\n : genChildren(el, state) || 'undefined'\n : genElement(el, state)) + \"}\";\n // reverse proxy v-slot without scope on this.$slots\n var reverseProxy = slotScope ? \"\" : \",proxy:true\";\n return (\"{key:\" + (el.slotTarget || \"\\\"default\\\"\") + \",fn:\" + fn + reverseProxy + \"}\")\n}\n\nfunction genChildren (\n el,\n state,\n checkSkip,\n altGenElement,\n altGenNode\n) {\n var children = el.children;\n if (children.length) {\n var el$1 = children[0];\n // optimize single v-for\n if (children.length === 1 &&\n el$1.for &&\n el$1.tag !== 'template' &&\n el$1.tag !== 'slot'\n ) {\n var normalizationType = checkSkip\n ? state.maybeComponent(el$1) ? \",1\" : \",0\"\n : \"\";\n return (\"\" + ((altGenElement || genElement)(el$1, state)) + normalizationType)\n }\n var normalizationType$1 = checkSkip\n ? getNormalizationType(children, state.maybeComponent)\n : 0;\n var gen = altGenNode || genNode;\n return (\"[\" + (children.map(function (c) { return gen(c, state); }).join(',')) + \"]\" + (normalizationType$1 ? (\",\" + normalizationType$1) : ''))\n }\n}\n\n// determine the normalization needed for the children array.\n// 0: no normalization needed\n// 1: simple normalization needed (possible 1-level deep nested array)\n// 2: full normalization needed\nfunction getNormalizationType (\n children,\n maybeComponent\n) {\n var res = 0;\n for (var i = 0; i < children.length; i++) {\n var el = children[i];\n if (el.type !== 1) {\n continue\n }\n if (needsNormalization(el) ||\n (el.ifConditions && el.ifConditions.some(function (c) { return needsNormalization(c.block); }))) {\n res = 2;\n break\n }\n if (maybeComponent(el) ||\n (el.ifConditions && el.ifConditions.some(function (c) { return maybeComponent(c.block); }))) {\n res = 1;\n }\n }\n return res\n}\n\nfunction needsNormalization (el) {\n return el.for !== undefined || el.tag === 'template' || el.tag === 'slot'\n}\n\nfunction genNode (node, state) {\n if (node.type === 1) {\n return genElement(node, state)\n } else if (node.type === 3 && node.isComment) {\n return genComment(node)\n } else {\n return genText(node)\n }\n}\n\nfunction genText (text) {\n return (\"_v(\" + (text.type === 2\n ? text.expression // no need for () because already wrapped in _s()\n : transformSpecialNewlines(JSON.stringify(text.text))) + \")\")\n}\n\nfunction genComment (comment) {\n return (\"_e(\" + (JSON.stringify(comment.text)) + \")\")\n}\n\nfunction genSlot (el, state) {\n var slotName = el.slotName || '\"default\"';\n var children = genChildren(el, state);\n var res = \"_t(\" + slotName + (children ? (\",\" + children) : '');\n var attrs = el.attrs || el.dynamicAttrs\n ? genProps((el.attrs || []).concat(el.dynamicAttrs || []).map(function (attr) { return ({\n // slot props are camelized\n name: camelize(attr.name),\n value: attr.value,\n dynamic: attr.dynamic\n }); }))\n : null;\n var bind$$1 = el.attrsMap['v-bind'];\n if ((attrs || bind$$1) && !children) {\n res += \",null\";\n }\n if (attrs) {\n res += \",\" + attrs;\n }\n if (bind$$1) {\n res += (attrs ? '' : ',null') + \",\" + bind$$1;\n }\n return res + ')'\n}\n\n// componentName is el.component, take it as argument to shun flow's pessimistic refinement\nfunction genComponent (\n componentName,\n el,\n state\n) {\n var children = el.inlineTemplate ? null : genChildren(el, state, true);\n return (\"_c(\" + componentName + \",\" + (genData$2(el, state)) + (children ? (\",\" + children) : '') + \")\")\n}\n\nfunction genProps (props) {\n var staticProps = \"\";\n var dynamicProps = \"\";\n for (var i = 0; i < props.length; i++) {\n var prop = props[i];\n var value = transformSpecialNewlines(prop.value);\n if (prop.dynamic) {\n dynamicProps += (prop.name) + \",\" + value + \",\";\n } else {\n staticProps += \"\\\"\" + (prop.name) + \"\\\":\" + value + \",\";\n }\n }\n staticProps = \"{\" + (staticProps.slice(0, -1)) + \"}\";\n if (dynamicProps) {\n return (\"_d(\" + staticProps + \",[\" + (dynamicProps.slice(0, -1)) + \"])\")\n } else {\n return staticProps\n }\n}\n\n// #3895, #4268\nfunction transformSpecialNewlines (text) {\n return text\n .replace(/\\u2028/g, '\\\\u2028')\n .replace(/\\u2029/g, '\\\\u2029')\n}\n\n/* */\n\n\n\n// these keywords should not appear inside expressions, but operators like\n// typeof, instanceof and in are allowed\nvar prohibitedKeywordRE = new RegExp('\\\\b' + (\n 'do,if,for,let,new,try,var,case,else,with,await,break,catch,class,const,' +\n 'super,throw,while,yield,delete,export,import,return,switch,default,' +\n 'extends,finally,continue,debugger,function,arguments'\n).split(',').join('\\\\b|\\\\b') + '\\\\b');\n\n// these unary operators should not be used as property/method names\nvar unaryOperatorsRE = new RegExp('\\\\b' + (\n 'delete,typeof,void'\n).split(',').join('\\\\s*\\\\([^\\\\)]*\\\\)|\\\\b') + '\\\\s*\\\\([^\\\\)]*\\\\)');\n\n// strip strings in expressions\nvar stripStringRE = /'(?:[^'\\\\]|\\\\.)*'|\"(?:[^\"\\\\]|\\\\.)*\"|`(?:[^`\\\\]|\\\\.)*\\$\\{|\\}(?:[^`\\\\]|\\\\.)*`|`(?:[^`\\\\]|\\\\.)*`/g;\n\n// detect problematic expressions in a template\nfunction detectErrors (ast, warn) {\n if (ast) {\n checkNode(ast, warn);\n }\n}\n\nfunction checkNode (node, warn) {\n if (node.type === 1) {\n for (var name in node.attrsMap) {\n if (dirRE.test(name)) {\n var value = node.attrsMap[name];\n if (value) {\n var range = node.rawAttrsMap[name];\n if (name === 'v-for') {\n checkFor(node, (\"v-for=\\\"\" + value + \"\\\"\"), warn, range);\n } else if (onRE.test(name)) {\n checkEvent(value, (name + \"=\\\"\" + value + \"\\\"\"), warn, range);\n } else {\n checkExpression(value, (name + \"=\\\"\" + value + \"\\\"\"), warn, range);\n }\n }\n }\n }\n if (node.children) {\n for (var i = 0; i < node.children.length; i++) {\n checkNode(node.children[i], warn);\n }\n }\n } else if (node.type === 2) {\n checkExpression(node.expression, node.text, warn, node);\n }\n}\n\nfunction checkEvent (exp, text, warn, range) {\n var stipped = exp.replace(stripStringRE, '');\n var keywordMatch = stipped.match(unaryOperatorsRE);\n if (keywordMatch && stipped.charAt(keywordMatch.index - 1) !== '$') {\n warn(\n \"avoid using JavaScript unary operator as property name: \" +\n \"\\\"\" + (keywordMatch[0]) + \"\\\" in expression \" + (text.trim()),\n range\n );\n }\n checkExpression(exp, text, warn, range);\n}\n\nfunction checkFor (node, text, warn, range) {\n checkExpression(node.for || '', text, warn, range);\n checkIdentifier(node.alias, 'v-for alias', text, warn, range);\n checkIdentifier(node.iterator1, 'v-for iterator', text, warn, range);\n checkIdentifier(node.iterator2, 'v-for iterator', text, warn, range);\n}\n\nfunction checkIdentifier (\n ident,\n type,\n text,\n warn,\n range\n) {\n if (typeof ident === 'string') {\n try {\n new Function((\"var \" + ident + \"=_\"));\n } catch (e) {\n warn((\"invalid \" + type + \" \\\"\" + ident + \"\\\" in expression: \" + (text.trim())), range);\n }\n }\n}\n\nfunction checkExpression (exp, text, warn, range) {\n try {\n new Function((\"return \" + exp));\n } catch (e) {\n var keywordMatch = exp.replace(stripStringRE, '').match(prohibitedKeywordRE);\n if (keywordMatch) {\n warn(\n \"avoid using JavaScript keyword as property name: \" +\n \"\\\"\" + (keywordMatch[0]) + \"\\\"\\n Raw expression: \" + (text.trim()),\n range\n );\n } else {\n warn(\n \"invalid expression: \" + (e.message) + \" in\\n\\n\" +\n \" \" + exp + \"\\n\\n\" +\n \" Raw expression: \" + (text.trim()) + \"\\n\",\n range\n );\n }\n }\n}\n\n/* */\n\nvar range = 2;\n\nfunction generateCodeFrame (\n source,\n start,\n end\n) {\n if ( start === void 0 ) start = 0;\n if ( end === void 0 ) end = source.length;\n\n var lines = source.split(/\\r?\\n/);\n var count = 0;\n var res = [];\n for (var i = 0; i < lines.length; i++) {\n count += lines[i].length + 1;\n if (count >= start) {\n for (var j = i - range; j <= i + range || end > count; j++) {\n if (j < 0 || j >= lines.length) { continue }\n res.push((\"\" + (j + 1) + (repeat$1(\" \", 3 - String(j + 1).length)) + \"| \" + (lines[j])));\n var lineLength = lines[j].length;\n if (j === i) {\n // push underline\n var pad = start - (count - lineLength) + 1;\n var length = end > count ? lineLength - pad : end - start;\n res.push(\" | \" + repeat$1(\" \", pad) + repeat$1(\"^\", length));\n } else if (j > i) {\n if (end > count) {\n var length$1 = Math.min(end - count, lineLength);\n res.push(\" | \" + repeat$1(\"^\", length$1));\n }\n count += lineLength + 1;\n }\n }\n break\n }\n }\n return res.join('\\n')\n}\n\nfunction repeat$1 (str, n) {\n var result = '';\n if (n > 0) {\n while (true) { // eslint-disable-line\n if (n & 1) { result += str; }\n n >>>= 1;\n if (n <= 0) { break }\n str += str;\n }\n }\n return result\n}\n\n/* */\n\n\n\nfunction createFunction (code, errors) {\n try {\n return new Function(code)\n } catch (err) {\n errors.push({ err: err, code: code });\n return noop\n }\n}\n\nfunction createCompileToFunctionFn (compile) {\n var cache = Object.create(null);\n\n return function compileToFunctions (\n template,\n options,\n vm\n ) {\n options = extend({}, options);\n var warn$$1 = options.warn || warn;\n delete options.warn;\n\n /* istanbul ignore if */\n {\n // detect possible CSP restriction\n try {\n new Function('return 1');\n } catch (e) {\n if (e.toString().match(/unsafe-eval|CSP/)) {\n warn$$1(\n 'It seems you are using the standalone build of Vue.js in an ' +\n 'environment with Content Security Policy that prohibits unsafe-eval. ' +\n 'The template compiler cannot work in this environment. Consider ' +\n 'relaxing the policy to allow unsafe-eval or pre-compiling your ' +\n 'templates into render functions.'\n );\n }\n }\n }\n\n // check cache\n var key = options.delimiters\n ? String(options.delimiters) + template\n : template;\n if (cache[key]) {\n return cache[key]\n }\n\n // compile\n var compiled = compile(template, options);\n\n // check compilation errors/tips\n {\n if (compiled.errors && compiled.errors.length) {\n if (options.outputSourceRange) {\n compiled.errors.forEach(function (e) {\n warn$$1(\n \"Error compiling template:\\n\\n\" + (e.msg) + \"\\n\\n\" +\n generateCodeFrame(template, e.start, e.end),\n vm\n );\n });\n } else {\n warn$$1(\n \"Error compiling template:\\n\\n\" + template + \"\\n\\n\" +\n compiled.errors.map(function (e) { return (\"- \" + e); }).join('\\n') + '\\n',\n vm\n );\n }\n }\n if (compiled.tips && compiled.tips.length) {\n if (options.outputSourceRange) {\n compiled.tips.forEach(function (e) { return tip(e.msg, vm); });\n } else {\n compiled.tips.forEach(function (msg) { return tip(msg, vm); });\n }\n }\n }\n\n // turn code into functions\n var res = {};\n var fnGenErrors = [];\n res.render = createFunction(compiled.render, fnGenErrors);\n res.staticRenderFns = compiled.staticRenderFns.map(function (code) {\n return createFunction(code, fnGenErrors)\n });\n\n // check function generation errors.\n // this should only happen if there is a bug in the compiler itself.\n // mostly for codegen development use\n /* istanbul ignore if */\n {\n if ((!compiled.errors || !compiled.errors.length) && fnGenErrors.length) {\n warn$$1(\n \"Failed to generate render function:\\n\\n\" +\n fnGenErrors.map(function (ref) {\n var err = ref.err;\n var code = ref.code;\n\n return ((err.toString()) + \" in\\n\\n\" + code + \"\\n\");\n }).join('\\n'),\n vm\n );\n }\n }\n\n return (cache[key] = res)\n }\n}\n\n/* */\n\nfunction createCompilerCreator (baseCompile) {\n return function createCompiler (baseOptions) {\n function compile (\n template,\n options\n ) {\n var finalOptions = Object.create(baseOptions);\n var errors = [];\n var tips = [];\n\n var warn = function (msg, range, tip) {\n (tip ? tips : errors).push(msg);\n };\n\n if (options) {\n if (options.outputSourceRange) {\n // $flow-disable-line\n var leadingSpaceLength = template.match(/^\\s*/)[0].length;\n\n warn = function (msg, range, tip) {\n var data = { msg: msg };\n if (range) {\n if (range.start != null) {\n data.start = range.start + leadingSpaceLength;\n }\n if (range.end != null) {\n data.end = range.end + leadingSpaceLength;\n }\n }\n (tip ? tips : errors).push(data);\n };\n }\n // merge custom modules\n if (options.modules) {\n finalOptions.modules =\n (baseOptions.modules || []).concat(options.modules);\n }\n // merge custom directives\n if (options.directives) {\n finalOptions.directives = extend(\n Object.create(baseOptions.directives || null),\n options.directives\n );\n }\n // copy other options\n for (var key in options) {\n if (key !== 'modules' && key !== 'directives') {\n finalOptions[key] = options[key];\n }\n }\n }\n\n finalOptions.warn = warn;\n\n var compiled = baseCompile(template.trim(), finalOptions);\n {\n detectErrors(compiled.ast, warn);\n }\n compiled.errors = errors;\n compiled.tips = tips;\n return compiled\n }\n\n return {\n compile: compile,\n compileToFunctions: createCompileToFunctionFn(compile)\n }\n }\n}\n\n/* */\n\n// `createCompilerCreator` allows creating compilers that use alternative\n// parser/optimizer/codegen, e.g the SSR optimizing compiler.\n// Here we just export a default compiler using the default parts.\nvar createCompiler = createCompilerCreator(function baseCompile (\n template,\n options\n) {\n var ast = parse(template.trim(), options);\n if (options.optimize !== false) {\n optimize(ast, options);\n }\n var code = generate(ast, options);\n return {\n ast: ast,\n render: code.render,\n staticRenderFns: code.staticRenderFns\n }\n});\n\n/* */\n\nvar ref$1 = createCompiler(baseOptions);\nvar compile = ref$1.compile;\nvar compileToFunctions = ref$1.compileToFunctions;\n\n/* */\n\n// check whether current browser encodes a char inside attribute values\nvar div;\nfunction getShouldDecode (href) {\n div = div || document.createElement('div');\n div.innerHTML = href ? \"<a href=\\\"\\n\\\"/>\" : \"<div a=\\\"\\n\\\"/>\";\n return div.innerHTML.indexOf('&#10;') > 0\n}\n\n// #3663: IE encodes newlines inside attribute values while other browsers don't\nvar shouldDecodeNewlines = inBrowser ? getShouldDecode(false) : false;\n// #6828: chrome encodes content in a[href]\nvar shouldDecodeNewlinesForHref = inBrowser ? getShouldDecode(true) : false;\n\n/* */\n\nvar idToTemplate = cached(function (id) {\n var el = query(id);\n return el && el.innerHTML\n});\n\nvar mount = Vue.prototype.$mount;\nVue.prototype.$mount = function (\n el,\n hydrating\n) {\n el = el && query(el);\n\n /* istanbul ignore if */\n if (el === document.body || el === document.documentElement) {\n warn(\n \"Do not mount Vue to <html> or <body> - mount to normal elements instead.\"\n );\n return this\n }\n\n var options = this.$options;\n // resolve template/el and convert to render function\n if (!options.render) {\n var template = options.template;\n if (template) {\n if (typeof template === 'string') {\n if (template.charAt(0) === '#') {\n template = idToTemplate(template);\n /* istanbul ignore if */\n if (!template) {\n warn(\n (\"Template element not found or is empty: \" + (options.template)),\n this\n );\n }\n }\n } else if (template.nodeType) {\n template = template.innerHTML;\n } else {\n {\n warn('invalid template option:' + template, this);\n }\n return this\n }\n } else if (el) {\n template = getOuterHTML(el);\n }\n if (template) {\n /* istanbul ignore if */\n if (config.performance && mark) {\n mark('compile');\n }\n\n var ref = compileToFunctions(template, {\n outputSourceRange: \"development\" !== 'production',\n shouldDecodeNewlines: shouldDecodeNewlines,\n shouldDecodeNewlinesForHref: shouldDecodeNewlinesForHref,\n delimiters: options.delimiters,\n comments: options.comments\n }, this);\n var render = ref.render;\n var staticRenderFns = ref.staticRenderFns;\n options.render = render;\n options.staticRenderFns = staticRenderFns;\n\n /* istanbul ignore if */\n if (config.performance && mark) {\n mark('compile end');\n measure((\"vue \" + (this._name) + \" compile\"), 'compile', 'compile end');\n }\n }\n }\n return mount.call(this, el, hydrating)\n};\n\n/**\n * Get outerHTML of elements, taking care\n * of SVG elements in IE as well.\n */\nfunction getOuterHTML (el) {\n if (el.outerHTML) {\n return el.outerHTML\n } else {\n var container = document.createElement('div');\n container.appendChild(el.cloneNode(true));\n return container.innerHTML\n }\n}\n\nVue.compile = compileToFunctions;\n\nmodule.exports = Vue;\n\n/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../webpack/buildin/global.js */ \"./node_modules/webpack/buildin/global.js\"), __webpack_require__(/*! ./../../timers-browserify/main.js */ \"./node_modules/timers-browserify/main.js\").setImmediate))//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvdnVlL2Rpc3QvdnVlLmNvbW1vbi5kZXYuanM/NDY1MCJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ2E7O0FBRWI7O0FBRUEsa0NBQWtDOztBQUVsQztBQUNBO0FBQ0E7QUFDQTtBQUNBOztBQUVBO0FBQ0E7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7O0FBRUE7QUFDQTtBQUNBOztBQUVBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7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aWYgKEFycmF5LmlzQXJyYXkodmFsdWUpKSB7XG4gICAgICAgIHZhbHVlID0gdG9PYmplY3QodmFsdWUpO1xuICAgICAgfVxuICAgICAgdmFyIGhhc2g7XG4gICAgICB2YXIgbG9vcCA9IGZ1bmN0aW9uICgga2V5ICkge1xuICAgICAgICBpZiAoXG4gICAgICAgICAga2V5ID09PSAnY2xhc3MnIHx8XG4gICAgICAgICAga2V5ID09PSAnc3R5bGUnIHx8XG4gICAgICAgICAgaXNSZXNlcnZlZEF0dHJpYnV0ZShrZXkpXG4gICAgICAgICkge1xuICAgICAgICAgIGhhc2ggPSBkYXRhO1xuICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgIHZhciB0eXBlID0gZGF0YS5hdHRycyAmJiBkYXRhLmF0dHJzLnR5cGU7XG4gICAgICAgICAgaGFzaCA9IGFzUHJvcCB8fCBjb25maWcubXVzdFVzZVByb3AodGFnLCB0eXBlLCBrZXkpXG4gICAgICAgICAgICA/IGRhdGEuZG9tUHJvcHMgfHwgKGRhdGEuZG9tUHJvcHMgPSB7fSlcbiAgICAgICAgICAgIDogZGF0YS5hdHRycyB8fCAoZGF0YS5hdHRycyA9IHt9KTtcbiAgICAgICAgfVxuICAgICAgICB2YXIgY2FtZWxpemVkS2V5ID0gY2FtZWxpemUoa2V5KTtcbiAgICAgICAgdmFyIGh5cGhlbmF0ZWRLZXkgPSBoeXBoZW5hdGUoa2V5KTtcbiAgICAgICAgaWYgKCEoY2FtZWxpemVkS2V5IGluIGhhc2gpICYmICEoaHlwaGVuYXRlZEtleSBpbiBoYXNoKSkge1xuICAgICAgICAgIGhhc2hba2V5XSA9IHZhbHVlW2tleV07XG5cbiAgICAgICAgICBpZiAoaXNTeW5jKSB7XG4gICAgICAgICAgICB2YXIgb24gPSBkYXRhLm9uIHx8IChkYXRhLm9uID0ge30pO1xuICAgICAgICAgICAgb25bKFwidXBkYXRlOlwiICsga2V5KV0gPSBmdW5jdGlvbiAoJGV2ZW50KSB7XG4gICA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29tcCA9IGVuc3VyZUN0b3IocmVzLmVycm9yLCBiYXNlQ3Rvcik7XG4gICAgICAgIH1cblxuICAgICAgICBpZiAoaXNEZWYocmVzLmxvYWRpbmcpKSB7XG4gICAgICAgICAgZmFjdG9yeS5sb2FkaW5nQ29tcCA9IGVuc3VyZUN0b3IocmVzLmxvYWRpbmcsIGJhc2VDdG9yKTtcbiAgICAgICAgICBpZiAocmVzLmRlbGF5ID09PSAwKSB7XG4gICAgICAgICAgICBmYWN0b3J5LmxvYWRpbmcgPSB0cnVlO1xuICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICB0aW1lckxvYWRpbmcgPSBzZXRUaW1lb3V0KGZ1bmN0aW9uICgpIHtcbiAgICAgICAgICAgICAgdGltZXJMb2FkaW5nID0gbnVsbDtcbiAgICAgICAgICAgICAgaWYgKGlzVW5kZWYoZmFjdG9yeS5yZXNvbHZlZCkgJiYgaXNVbmRlZihmYWN0b3J5LmVycm9yKSkge1xuICAgICAgICAgICAgICAgIGZhY3RvcnkubG9hZGluZyA9IHRydWU7XG4gICAgICAgICAgICAgICAgZm9yY2VSZW5kZXIoZmFsc2UpO1xuICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9LCByZXMuZGVsYXkgfHwgMjAwKTtcbiAgICAgICAgICB9XG4gICAgICAgIH1cblxuICAgICAgICBpZiAoaXNEZWYocmVzLnRpbWVvdXQpKSB7XG4gICAgICAgICAgdGltZXJUaW1lb3V0ID0gc2V0VGltZW91dChmdW5jdGlvbiAoKSB7XG4gICAgICAgICAgICB0aW1lclRpbWVvdXQgPSBudWxsO1xuICAgICAgICAgICAgaWYgKGlzVW5kZWYoZmFjdG9yeS5yZXNvbHZlZCkpIHtcbiAgICAgICAgICAgICAgcmVqZWN0KFxuICAgICAgICAgICAgICAgIFwidGltZW91dCAoXCIgKyAocmVzLnRpbWVvdXQpICsgXCJtcylcIlxuICAgICAgICAgICAgICApO1xuICAgICAgICAgICAgfVxuICAgICAgICAgIH0sI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FxuICAgICAgICAgIGlmIChpc0RlZihpID0gZGF0YSkgJiYgaXNEZWYoaSA9IGkuZG9tUHJvcHMpICYmIGlzRGVmKGkgPSBpLmlubmVySFRNTCkpIHtcbiAgICAgICAgICAgIGlmIChpICE9PSBlbG0uaW5uZXJIVE1MKSB7XG4gICAgICAgICAgICAgIC8qIGlzdGFuYnVsIGlnbm9yZSBpZiAqL1xuICAgICAgICAgICAgICBpZiAodHlwZW9mIGNvbnNvbGUgIT09ICd1bmRlZmluZWQnICYmXG4gICAgICAgICAgICAgICAgIWh5ZHJhdGlvbkJhaWxlZFxuICAgICAgICAgICAgICApIHtcbiAgICAgICAgICAgICAgICBoeWRyYXRpb25CYWlsZWQgPSB0cnVlO1xuICAgICAgICAgICAgICAgIGNvbnNvbGUud2FybignUGFyZW50OiAnLCBlbG0pO1xuICAgICAgICAgICAgICAgIGNvbnNvbGUud2Fybignc2VydmVyIGlubmVySFRNTDogJywgaSk7XG4gICAgICAgICAgICAgICAgY29uc29sZS53YXJuKCdjbGllbnQgaW5uZXJIVE1MOiAnLCBlbG0uaW5uZXJIVE1MKTtcbiAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICByZXR1cm4gZmFsc2VcbiAgICAgICAgICAgIH1cbiAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgLy8gaXRlcmF0ZSBhbmQgY29tcGFyZSBjaGlsZHJlbiBsaXN0c1xuICAgICAgICAgICAgdmFyIGNoaWxkcmVuTWF0Y2ggPSB0cnVlO1xuICAgICAgICAgICAgdmFyIGNoaWxkTm9kZSA9IGVsbS5maXJzdENoaWxkO1xuICAgICAgICAgICAgZm9yICh2YXIgaSQxID0gMDsgaSQxIDwgY2hpbGRyZW4ubGVuZ3RoOyBpJDErKykge1xuICAgICAgICAgICAgICBpZiAoIWNoaWxkTm9kZSB8fCAhaHlkcmF0ZShjaGlsZE5vZGUsIGNoaWxkcmVuW2kkMV0sIGluc2VydGVkVm5vZGVRdWV1ZSwgaW5WUHJlKSkge1xuICAgICAgICAgICAgICAgIGNoaWxkcmVuTWF0Y2ggPSBmYWxzZTtcbiAgICAgICAgICAgICAgICBicmVha1xuICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgIGNoaWxkTm9kZSA9IGNoaWxkTm9kZS5uZXh0U2libGluZztcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIC8vIGlmIGNoaWxkTm9kZSBpcyBub3QgbnVsbCwgaXQgbWVhbnMgdGhlIGFjdHVhbCBjaGlsZE5vZGVzIGxpc3QgaXNcbiAgICAgICAgICAgIC8vIGxvbmdlciB0aGFuIHRoZSB2aXJ0dWFsIGNoaWxkcmVuIGxpc3QuXG4gICAgICAgICAgICBpZiAoIWNoaWxkcmVuTWF0Y2ggfHwgY2hpbGROb2RlKSB7XG4gICAgICAgICAgICAgIC8qIGlzdGFuYnVsIGlnbm9yZSBpZiAqL1xuICAgICAgICAgICAgICBpZiAodHlwZW9mIGNvbnNvbGUgIT09ICd1bmRlZmluZWQnICYmXG4gICAgICAgICAgICAgICAgIWh5ZHJhdGlvbkJhaWxlZFxuICAgICAgICAgICAgICApIHtcbiAgICAgICAgICAgICAgICBoeWRyYXRpb25CYWlsZWQgPSB0cnVlO1xuICAgICAgICAgICAgICAgIGNvbnNvbGUud2FybignUGFyZW50OiAnLCBlbG0pO1xuICAgICAgICAgICAgICAgIGNvbnNvbGUud2FybignTWlzbWF0Y2hpbmcgY2hpbGROb2RlcyB2cy4gVk5vZGVzOiAnLCBlbG0uY2hpbGROb2RlcywgY2hpbGRyZW4pO1xuICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgIHJldHVybiBmYWxzZVxuICAgICAgICAgICAgfVxuICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgfVxuICAgICAgaWYgKGlzRGVmKGRhdGEpKSB7XG4gICAgICAgIHZhciBmdWxsSW52b2tlID0gZmFsc2U7XG4gICAgICAgIGZvciAodmFyIGtleSBpbiBkYXRhKSB7XG4gICAgICAgICAga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vZGUucGFyZW50O1xuICAgICAgICAgIHZhciBwYXRjaGFibGUgPSBpc1BhdGNoYWJsZSh2bm9kZSk7XG4gICAgICAgICAgd2hpbGUgKGFuY2VzdG9yKSB7XG4gICAgICAgICAgICBmb3IgKHZhciBpID0gMDsgaSA8IGNicy5kZXN0cm95Lmxlbmd0aDsgKytpKSB7XG4gICAgICAgICAgICAgIGNicy5kZXN0cm95W2ldKGFuY2VzdG9yKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGFuY2VzdG9yLmVsbSA9IHZub2RlLmVsbTtcbiAgICAgICAgICAgIGlmIChwYXRjaGFibGUpIHtcbiAgICAgICAgICAgICAgZm9yICh2YXIgaSQxID0gMDsgaSQxIDwgY2JzLmNyZWF0ZS5sZW5ndGg7ICsraSQxKSB7XG4gICAgICAgICAgICAgICAgY2JzLmNyZWF0ZVtpJDFdKGVtcHR5Tm9kZSwgYW5jZXN0b3IpO1xuICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgIC8vICM2NTEzXG4gICAgICAgICAgICAgIC8vIGludm9rZSBpbnNlcnQgaG9va3MgdGhhdCBtYXkgaGF2ZSBiZWVuIG1lcmdlZCBieSBjcmVhdGUgaG9va3MuXG4gICAgICAgICAgICAgIC8vIGUuZy4gZm9yIGRpcmVjdGl2ZXMgdGhhdCB1c2VzIHRoZSBcImluc2VydGVkXCIgaG9vay5cbiAgICAgICAgICAgICAgdmFyIGluc2VydCA9IGFuY2VzdG9yLmRhdGEuaG9vay5pbnNlcnQ7XG4gICAgICAgICAgICAgIGlmIChpbnNlcnQubWVyZ2VkKSB7XG4gICAgICAgICAgICAgICAgLy8gc3RhcnQgYXQgaW5kZXggMSB0byBhdm9pZCByZS1pbnZva2luZyBjb21wb25lbnQgbW91bnRlZCBob29rXG4gICAgICAgICAgICAgICAgZm9yICh2YXIgaSQyID0gMTsgaSQyIDwgaW5zZXJ0LmZucy5sZW5ndGg7IGkkMisrKSB7XG4gICAgICAgICAgICAgICAgICBpb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gIH0gZWxzZSBpZiAoXG4gICAgICBjID09PSAweDdDICYmIC8vIHBpcGVcbiAgICAgIGV4cC5jaGFyQ29kZUF0KGkgKyAxKSAhPT0gMHg3QyAmJlxuICAgICAgZXhwLmNoYXJDb2RlQXQoaSAtIDEpICE9PSAweDdDICYmXG4gICAgICAhY3VybHkgJiYgIXNxdWFyZSAmJiAhcGFyZW5cbiAgICApIHtcbiAgICAgIGlmIChleHByZXNzaW9uID09PSB1bmRlZmluZWQpIHtcbiAgICAgICAgLy8gZmlyc3QgZmlsdGVyLCBlbmQgb2YgZXhwcmVzc2lvblxuICAgICAgICBsYXN0RmlsdGVySW5kZXggPSBpICsgMTtcbiAgICAgICAgZXhwcmVzc2lvbiA9IGV4cC5zbGljZSgwLCBpKS50cmltKCk7XG4gICAgICB9IGVsc2Uge1xuICAgICAgICBwdXNoRmlsdGVyKCk7XG4gICAgICB9XG4gICAgfSBlbHNlIHtcbiAgICAgIHN3aXRjaCAoYykge1xuICAgICAgICBjYXNlIDB4MjI6IGluRG91YmxlID0gdHJ1ZTsgYnJlYWsgICAgICAgICAvLyBcIlxuICAgICAgICBjYXNlIDB4Mjc6IGluU2luZ2xlID0gdHJ1ZTsgYnJlYWsgICAgICAgICAvLyAnXG4gICAgICAgIGNhc2UgMHg2MDogaW5UZW1wbGF0ZVN0cmluZyA9IHRydWU7IGJyZWFrIC8vIGBcbiAgICAgICAgY2FzZSAweDI4OiBwYXJlbisrOyBicmVhayAgICAgICAgICAgICAgICAgLy8gKFxuICAgICAgICBjYXNlIDB4Mjk6IHBhcmVuLS07IGJyZWFrICAgICAgICAgICAgICAgICAvLyApXG4gICAgICAgIGNhc2UgMHg1Qjogc3F1YXJlKys7IGJyZWFrICAgICAgICAgICAgICAgIC8vIFtcbiAgICAgICAgY2FzZSAweDVEOiBzcXVhcmUtLTsgYnJlYWsgICAgICAgICAgICAgICAgLy8gXVxuICAgICAgICBjYXNlIDB4N0I6IGN1cmx5Kys7IGJyZWFrICAgICAgICA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AgICAgb3B0aW9ucy5jb21tZW50KGh0bWwuc3Vic3RyaW5nKDQsIGNvbW1lbnRFbmQpLCBpbmRleCwgaW5kZXggKyBjb21tZW50RW5kICsgMyk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBhZHZhbmNlKGNvbW1lbnRFbmQgKyAzKTtcbiAgICAgICAgICAgIGNvbnRpbnVlXG4gICAgICAgICAgfVxuICAgICAgICB9XG5cbiAgICAgICAgLy8gaHR0cDovL2VuLndpa2lwZWRpYS5vcmcvd2lraS9Db25kaXRpb25hbF9jb21tZW50I0Rvd25sZXZlbC1yZXZlYWxlZF9jb25kaXRpb25hbF9jb21tZW50XG4gICAgICAgIGlmIChjb25kaXRpb25hbENvbW1lbnQudGVzdChodG1sKSkge1xuICAgICAgICAgIHZhciBjb25kaXRpb25hbEVuZCA9IGh0bWwuaW5kZXhPZignXT4nKTtcblxuICAgICAgICAgIGlmIChjb25kaXRpb25hbEVuZCA+PSAwKSB7XG4gICAgICAgICAgICBhZHZhbmNlKGNvbmRpdGlvbmFsRW5kICsgMik7XG4gICAgICAgICAgICBjb250aW51ZVxuICAgICAgICAgIH1cbiAgICAgICAgfVxuXG4gICAgICAgIC8vIERvY3R5cGU6XG4gICAgICAgIHZhciBkb2N0eXBlTWF0Y2ggPSBodG1sLm1hdGNoKGRvY3R5cGUpO1xuICAgICAgICBpZiAoZG9jdHlwZU1hdGNoKSB7XG4gICAgICAgICAgYWR2YW5jZShkb2N0eXBlTWF0Y2hbMF0ubGVuZ3RoKTtcbiAgICAgICAgICBjb250aW51ZVxuICAgICAgICB9XG5cbiAgICAgICAgLy8gRW5kIHRhZzpcbiAgICAgICAgdmFyIGVuZFRhZ01hdGNoID0gaHRtbC5tYXRjaChlbmRUYWcpO1xuICAgICAgICBpZiAoZW5kVGFnTWF0Y2gpIHtcbiAgICAgICAgICB2YXIgY3VySW5kZXggPSBpbmRleDtcbiAgICAgICAgICBhZHZhbmNlKGVuZFRhZ01hdGNoWzBdLmxlbmd0aCk7XG4gICAgICAgICAgcGFyc2VFbmRUYWcoZW5kVGFnTWF0Y2hbMV0sIGN1ckluZGV4LCBpbmRleCk7XG4gICAgICAgICAgY29udGludWVcbiAgICAgICAgfVxuXG4gICAgICAgIC8vIFN0YXJ0IHRhZzpcbiAgICAgICAgdmFyIHN0YXJ0VGFnTWF0Y2ggPSBwYXJzZVN0YXJ0VGFnKCk7XG4gICAgICAgIGlmIChzdGFydFRhZ01hdGNoKSB7XG4gICAgICAgICAgaGFuZGxlU3RhcnRUYWcoc3RhcnRUYWdNYXRjaCk7XG4gICAgICAgICAgaWYgKHNob3VsZElnbm9yZUZpcnN0TmV3bGluZShzdGFydFRhZ01hdGNoLnRhZ05hbWUsIGh0bWwpKSB7XG4gICAgICAgICAgICBhZHZhbmNlKDEpO1xuICAgICAgICAgIH1cbiAgICAgICAgICBjb250aW51ZVxuICAgICAgICB9XG4gICAgICB9XG5cbiAgICAgIHZhciB0ZXh0ID0gKHZvaWQgMCksIHJlc3QgPSAodm9pZCAwKSwgbmV4dCA9ICh2b2lkIDApO1xuICAgICAgaWYgKHRleHRFbmQgPj0gMCkge1xuICAgICAgICByZXN0ID0gaHRtbC5zbGljZSh0ZXh0RW5kKTtcbiAgICAgICAgd2hpbGUgKFxuICAgICAgICAgICFlbmRUYWcudGVzdChyZXN0KSAmJlxuICAgICAgICAgICFzdGFydFRhZ09wZW4udGVzdChyZXN0KSAmJlxuICAgICAgICAgICFjb21tZW50LnRlc3QocmVzdCkgJiZcbiAgICAgICAgICAhY29uZGl0aW9uYWxDb21tZW50LnRlc3QocmVzdClcbiAgICAgICAgKSB7XG4gICAgICAgICAgLy8gPCBpbiBwbGFpbiB0ZXh0LCBiZSBmb3JnaXZpbmcgYW5kIHRyZWF0IGl0IGFzIHRleHRcbiAgICAgICAgICBuZXh0ID0gcmVzdC5pbmRleE9mKCc8JywgMSk7XG4gICAgICAgICAgaWYgKG5leHQgPCAwKSB7IGJyZWFrIH1cbiAgICAgICAgICB0Z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AgIC8vIGhhbmRsZSBJRSBzdmcgYnVnXG4gICAgICAvKiBpc3RhbmJ1bCBpZ25vcmUgaWYgKi9cbiAgICAgIGlmIChpc0lFICYmIG5zID09PSAnc3ZnJykge1xuICAgICAgICBhdHRycyA9IGd1YXJkSUVTVkdCdWcoYXR0cnMpO1xuICAgICAgfVxuXG4gICAgICB2YXIgZWxlbWVudCA9IGNyZWF0ZUFTVEVsZW1lbnQodGFnLCBhdHRycywgY3VycmVudFBhcmVudCk7XG4gICAgICBpZiAobnMpIHtcbiAgICAgICAgZWxlbWVudC5ucyA9IG5zO1xuICAgICAgfVxuXG4gICAgICB7XG4gICAgICAgIGlmIChvcHRpb25zLm91dHB1dFNvdXJjZVJhbmdlKSB7XG4gICAgICAgICAgZWxlbWVudC5zdGFydCA9IHN0YXJ0JDE7XG4gICAgICAgICAgZWxlbWVudC5lbmQgPSBlbmQ7XG4gICAgICAgICAgZWxlbWVudC5yYXdBdHRyc01hcCA9IGVsZW1lbnQuYXR0cnNMaXN0LnJlZHVjZShmdW5jdGlvbiAoY3VtdWxhdGVkLCBhdHRyKSB7XG4gICAgICAgICAgICBjdW11bGF0ZWRbYXR0ci5uYW1lXSA9IGF0dHI7XG4gICAgICAgICAgICByZXR1cm4gY3VtdWxhdGVkXG4gICAgICAgICAgfSwge30pO1xuICAgICAgICB9XG4gICAgICAgIGF0dHJzLmZvckVhY2goZnVuY3Rpb24gKGF0dHIpIHtcbiAgICAgICAgICBpZiAoaW52YWxpZEF0dHJpYnV0ZVJFLnRlc3QoYXR0ci5uYW1lKSkge1xuICAgICAgICAgICAgd2FybiQyKFxuICAgICAgICAgICAgICBcIkludmFsaWQgZHluYW1pYyBhcmd1bWVudCBleHByZXNzaW9uOiBhdHRyaWJ1dGUgbmFtZXMgY2Fubm90IGNvbnRhaW4gXCIgK1xuICAgICAgICAgICAgICBcInNwYWNlcywgcXVvdGVzLCA8LCA+LCAvIG9yID0uXCIsXG4gICAgICAgICAgICAgIHtcbiAgICAgIC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W1lbnQuZW5kID0gZW5kJDE7XG4gICAgICB9XG4gICAgICBjbG9zZUVsZW1lbnQoZWxlbWVudCk7XG4gICAgfSxcblxuICAgIGNoYXJzOiBmdW5jdGlvbiBjaGFycyAodGV4dCwgc3RhcnQsIGVuZCkge1xuICAgICAgaWYgKCFjdXJyZW50UGFyZW50KSB7XG4gICAgICAgIHtcbiAgICAgICAgICBpZiAodGV4dCA9PT0gdGVtcGxhdGUpIHtcbiAgICAgICAgICAgIHdhcm5PbmNlKFxuICAgICAgICAgICAgICAnQ29tcG9uZW50IHRlbXBsYXRlIHJlcXVpcmVzIGEgcm9vdCBlbGVtZW50LCByYXRoZXIgdGhhbiBqdXN0IHRleHQuJyxcbiAgICAgICAgICAgICAgeyBzdGFydDogc3RhcnQgfVxuICAgICAgICAgICAgKTtcbiAgICAgICAgICB9IGVsc2UgaWYgKCh0ZXh0ID0gdGV4dC50cmltKCkpKSB7XG4gICAgICAgICAgICB3YXJuT25jZShcbiAgICAgICAgICAgICAgKFwidGV4dCBcXFwiXCIgKyB0ZXh0ICsgXCJcXFwiIG91dHNpZGUgcm9vdCBlbGVtZW50IHdpbGwgYmUgaWdub3JlZC5cIiksXG4gICAgICAgICAgICAgIHsgc3RhcnQ6IHN0YXJ0IH1cbiAgICAgICAgICAgICk7XG4gICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHJldHVyblxuICAgICAgfVxuICAgICAgLy8gSUUgdGV4dGFyZWEgcGxhY2Vob2xkZXIgYnVnXG4gICAgICAvKiBpc3RhbmJ1bCBpZ25vcmUgaWYgKi9cbiAgICAgIGlmIChpc0lFICYmXG4gICAgICAgIGN1cnJlbnRQYXJlbnQudGFnID09PSAndGV4dGFyZWEnICYmXG4gICAgICAgIGN1cnJlbnRQYXJlbnQuYXR0cnNNYXAucGxhY2Vob2xkZXIgPT09IHRleHRcbiAgICAgICkge1xuICAgICAgICByZXR1cm5cbiAgICAgIH1cbiAgICAgIHZhciBjaGlsZHJlbiA9IGN1c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A9IHRleHQucmVwbGFjZSh3aGl0ZXNwYWNlUkUkMSwgJyAnKTtcbiAgICAgICAgfVxuICAgICAgICB2YXIgcmVzO1xuICAgICAgICB2YXIgY2hpbGQ7XG4gICAgICAgIGlmICghaW5WUHJlICYmIHRleHQgIT09ICcgJyAmJiAocmVzID0gcGFyc2VUZXh0KHRleHQsIGRlbGltaXRlcnMpKSkge1xuICAgICAgICAgIGNoaWxkID0ge1xuICAgICAgICAgICAgdHlwZTogMixcbiAgICAgICAgICAgIGV4cHJlc3Npb246IHJlcy5leHByZXNzaW9uLFxuICAgICAgICAgICAgdG9rZW5zOiByZXMudG9rZW5zLFxuICAgICAgICAgICAgdGV4dDogdGV4dFxuICAgICAgICAgIH07XG4gICAgICAgIH0gZWxzZSBpZiAodGV4dCAhPT0gJyAnIHx8ICFjaGlsZHJlbi5sZW5ndGggfHwgY2hpbGRyZW5bY2hpbGRyZW4ubGVuZ3RoIC0gMV0udGV4dCAhPT0gJyAnKSB7XG4gICAgICAgICAgY2hpbGQgPSB7XG4gICAgICAgICAgICB0eXBlOiAzLFxuICAgICAgICAgICAgdGV4dDogdGV4dFxuICAgICAgICAgIH07XG4gICAgICAgIH1cbiAgICAgICAgaWYgKGNoaWxkKSB7XG4gICAgICAgICAgaWYgKG9wdGlvbnMub3V0cHV0U291cmNlUmFuZ2UpIHtcbiAgICAgICAgICAgIGNoaWxkLnN0YXJ0ID0gc3RhcnQ7XG4gICAgICAgICAgICBjaGlsZC5lbmQgPSBlbmQ7XG4gICAgICAgICAgfVxuICAgICAgICAgIGNoaWxkcmVuLnB1c2goY2hpbGQpO1xuICAgICAgICB9XG4gICAgICB9XG4gICAgfSxcbiAgICBjb21tZW50OiBmdW5jdGlvbiBjb21tZW50ICh0ZXh0LCBzdGFydCwgZW5kKSB7XG4gICAgICAvLyBhZGRpbmcgYW55dGluZyBhcyBhIHNpYmxpbmcgdG8gdGhlIHJvb3Qgbm9kZSBpcyBmb3JiaWRkZW5cbiAgICAgIC8vI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nKSk7XG4gICAgfVxuICB9XG5cbiAgLy8gMi42IHYtc2xvdCBzeW50YXhcbiAge1xuICAgIGlmIChlbC50YWcgPT09ICd0ZW1wbGF0ZScpIHtcbiAgICAgIC8vIHYtc2xvdCBvbiA8dGVtcGxhdGU+XG4gICAgICB2YXIgc2xvdEJpbmRpbmcgPSBnZXRBbmRSZW1vdmVBdHRyQnlSZWdleChlbCwgc2xvdFJFKTtcbiAgICAgIGlmIChzbG90QmluZGluZykge1xuICAgICAgICB7XG4gICAgICAgICAgaWYgKGVsLnNsb3RUYXJnZXQgfHwgZWwuc2xvdFNjb3BlKSB7XG4gICAgICAgICAgICB3YXJuJDIoXG4gICAgICAgICAgICAgIFwiVW5leHBlY3RlZCBtaXhlZCB1c2FnZSBvZiBkaWZmZXJlbnQgc2xvdCBzeW50YXhlcy5cIixcbiAgICAgICAgICAgICAgZWxcbiAgICAgICAgICAgICk7XG4gICAgICAgICAgfVxuICAgICAgICAgIGlmIChlbC5wYXJlbnQgJiYgIW1heWJlQ29tcG9uZW50KGVsLnBhcmVudCkpIHtcbiAgICAgICAgICAgIHdhcm4kMihcbiAgICAgICAgICAgICAgXCI8dGVtcGxhdGUgdi1zbG90PiBjYW4gb25seSBhcHBlYXIgYXQgdGhlIHJvb3QgbGV2ZWwgaW5zaWRlIFwiICtcbiAgICAgICAgICAgICAgXCJ0aGUgcmVjZWl2aW5nIHRoZSBjb21wb25lbnRcIixcbiAgICAgICAgICAgICAgZWxcbiAgICAgICAgICAgICk7XG4gICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHZhciByZWYgPSBnZXRTbG90TmFtZShzbG90QmluZGluZyk7XG4gICAgICAgIHZhciBuYW1lID0gcmVmLm5hbWU7XG4gICAgICAgIHZhciBkeW5hbWljID0gcmVmLmR5bmFtaWM7XG4gICAgICAgIGVsLnNsb3RUYXJnZXQgPSBuYW1lO1xuICAgICAgICBlbC5zbG90VGFyZ2V0RHluYW1pYyA9IGR5bmFtaWM7XG4gICAgICAgIGVsLnNsb3RTY29wZSA9IHNsb3RCaW5kaW5nLnZhbHVlIHx8IGVtcHR5U2xvdFNjb3BlVG9rZW47IC8vIGZvcmNlIGl0IGludG8gYSBzY29wZWQgc2xvdCBmb3IgcGVyZlxuICAgICAgfVxuICAgIH0gZWxzZSB7XG4gICAgICAvLyB2LXNsb3Qgb24gY29tcG9uZW50LCBkZW5vdGVzIGRlZmF1bHQgc2xvdFxuICAgICAgdmFyIHNsb3RCaW5kaW5nJDEgPSBnZXRBbmRSZW1vdmVBdHRyQnlSZWdleChlbCwgc2xvdFJFKTtcbiAgICAgIGlmIChzbG90QmluZGluZyQxKSB7XG4gICAgICAgIHtcbiAgICAgICAgICBpZiAoIW1heWJlQ29tcG9uZW50KGVsKSkge1xuICAgICAgICAgICAgd2FybiQyKFxuICAgICAgICAgICAgICBcInYtc2xvdCBjYW4gb25seSBiZSB1c2VkIG9uIGNvbXBvbmVudHMgb3IgPHRlbXBsYXRlPi5cIixcbiAgICAgICAgICAgICAgc2xvdEJpbmRpbmckMVxuICAgICAgICAgICAgKTtcbiAgICAgICAgICB9XG4gICAgICAgICAgaWYgKGVsLnNsb3RTY29wZSB8fCBlbC5zbG90VGFyZ2V0KSB7XG4gICAgICAgICAgICB3YXJuJDIoXG4gICAgICAgICAgICAgIFwiVW5leHBlY3RlZCBtaXhlZCB1c2FnZSBvZiBkaWZmZXJlbnQgc2xvdCBzeW50YXhlcy5cIixcbiAgICAgICAgICAgICAgZWxcbiAgICAgICAgICAgICk7XG4gICAgICAgICAgfVxuICAgICAgICAgIGlmIChlbC5zY29wZWRTbG90cykge1xuICAgICAgICAgICAgd2FybiQyKFxuICAgICAgICAgICAgICBcIlRvIGF2b2lkIHNjb3BlIGFtYmlndWl0eSwgdGhlIGRlZmF1bHQgc2xvdCBzaG91bGQgYWxzbyB1c2UgXCIgK1xuICAgICAgICAgICAgICBcIjx0ZW1wbGF0ZT4gc3ludGF4IHdoZW4gdGhlcmUgYXJlIG90aGVyIG5hbWVkIHNsb3RzLlwiLFxuICAgICAgICAgICAgICBzbG90QmluZGluZyQxXG4gICAgICAgICAgICApO1xuICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICAvLyBhZGQgdGhlIGNvbXBvbmVudCdzIGNoaWxkcmVuIHRvIGl0cyBkZWZhdWx0IHNsb3RcbiAgICAgICAgdmFyIHNsb3RzID0gZWwuc2NvcGVkU2xvdHMgfHwgKGVsLnNjb3BlZFNsb3RzID0ge30pO1xuICAgICAgICB2YXIgcmVmJDEgPSBnZXRTbG90TmFtZShzbG90QmluZGluZyQxKTtcbiAgICAgICAgdmFyIG5hbWUkMSA9IHJlZiQxLm5hbWU7XG4gICAgICAgIHZhciBkeW5hbWljJDEgPSByZWYkMS5keW5hbWljO1xuICAgICAgICB2YXIgc2xvdENvbnRhaW5lciA9IHNsb3RzW25hbWUkMV0gPSBjcmVhdGVBU1RFbGVtZW50KCd0ZW1wbGF0ZScsIFtdLCBlbCk7XG4gICAgICAgIHNsb3RDb250YWluZXIuc2xvdFRhcmdldCA9IG5hbWUkMTtcbiAgICAgICAgc2xvdENvbnRhaW5lci5zbG90VGFyZ2V0RHluYW1pYyA9IGR5bmFtaWMkMTtcbiAgICAgICAgc2xvdENvbnRhaW5lci5jaGlsZHJlbiA9IGVsLmNoaWxkcmVuLmZpbHRlcihmdW5jdGlvbiAoYykge1xuICAgICAgICAgIGlmICghYy5zbG90U2NvcGUpIHtcbiAgICAgICAgICAgIGMucGFyZW50ID0gc2xvdENvbnRhaW5lcjtcbiAgICAgICAgICAgIHJldHVybiB0cnVlXG4gICAgICAgICAgfVxuICAgICAgICB9KTtcbiAgICAgICAgc2xvdENvbnRhaW5lci5zbG90U2NvcGUgPSBzbG90QmluZGluZyQxLnZhbHVlIHx8IGVtcHR5U2xvdFNjb3BlVG9rZW47XG4gICAgICAgIC8vIHJlbW92ZSBjaGlsZHJlbiBhcyB0aGV5IGFyZSByZXR1cm5lZCBmcm9tIHNjb3BlZFNsb3RzI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gICAgbW9kaWZpZXJzID0gcGFyc2VNb2RpZmllcnMobmFtZS5yZXBsYWNlKGRpclJFLCAnJykpO1xuICAgICAgLy8gc3VwcG9ydCAuZm9vIHNob3J0aGFuZCBzeW50YXggZm9yIHRoZSAucHJvcCBtb2RpZmllclxuICAgICAgaWYgKG1vZGlmaWVycykge1xuICAgICAgICBuYW1lID0gbmFtZS5yZXBsYWNlKG1vZGlmaWVyUkUsICcnKTtcbiAgICAgIH1cbiAgICAgIGlmIChiaW5kUkUudGVzdChuYW1lKSkgeyAvLyB2LWJpbmRcbiAgICAgICAgbmFtZSA9IG5hbWUucmVwbGFjZShiaW5kUkUsICcnKTtcbiAgICAgICAgdmFsdWUgPSBwYXJzZUZpbHRlcnModmFsdWUpO1xuICAgICAgICBpc0R5bmFtaWMgPSBkeW5hbWljQXJnUkUudGVzdChuYW1lKTtcbiAgICAgICAgaWYgKGlzRHluYW1pYykge1xuICAgICAgICAgIG5hbWUgPSBuYW1lLnNsaWNlKDEsIC0xKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAoXG4gICAgICAgICAgdmFsdWUudHJpbSgpLmxlbmd0aCA9PT0gMFxuICAgICAgICApIHtcbiAgICAgICAgICB3YXJuJDIoXG4gICAgICAgICAgICAoXCJUaGUgdmFsdWUgZm9yIGEgdi1iaW5kIGV4cHJlc3Npb24gY2Fubm90IGJlIGVtcHR5LiBGb3VuZCBpbiBcXFwidi1iaW5kOlwiICsgbmFtZSArIFwiXFxcIlwiKVxuICAgICAgICAgICk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKG1vZGlmaWVycykge1xuICAgICAgICAgIGlmIChtb2RpZmllcnMucHJvcCAmJiAhaXNEeW5hbWljKSB7XG4gICAgICAgICAgICBuYW1lID0gY2FtZWxpemUobmFtZSk7XG4gICAgICAgICAgICBpZiAobmFtZSA9PT0gJ2lubmVySHRtbCcpIHsgbmFtZSA9ICdpbm5lckhUTUwnOyB9XG4gICAgICAgICAgfVxuICAgICAgICAgIGlmIChtb2RpZmllcnMuY2FtZWwgJiYgIWlzRHluYW1pYykge1xuICAgICAgICAgICAgbmFtZSA9IGNhbWVsaXplKG5hbWUpO1xuICAgICAgICAgIH1cbiAgICAgICAgICBpZiAobW9kaWZpZXJzLnN5bmMpIHtcbiAgICAgICAgICAgIHN5bmNHZW4gPSBnZW5Bc3NpZ25tZW50Q29kZSh2YWx1ZSwgXCIkZXZlbnRcIik7XG4gICAgICAgICAgICBpZiAoIWlzRHluYW1pYykge1xuICAgICAgICAgICAgICBhZGRIYW5kbGVyKFxuICAgICAgICAgICAgICAgIGVsLFxuICAgICAgICAgICAgICAgIChcInVwZGF0ZTpcIiArIChjYW1lbGl6ZShuYW1lKSkpLFxuICAgICAgICAgICAgICAgIHN5bmNHZW4sXG4gICAgICAgICAgICAgICAgbnVsbCxcbiAgICAgICAgICAgICAgICBmYWxzZSxcbiAgICAgICAgICAgICAgICB3YXJuJDIsXG4gICAgICAgICAgICAgICAgbGlzdFtpXVxuICAgICAgICAgICAgICApO1xuICAgICAgICAgICAgICBpZiAoaHlwaGVuYXRlKG5hbWUpICE9PSBjYW1lbGl6ZShuYW1lKSkge1xuICAgICAgICAgICAgICAgIGFkZEhhbmRsZXIoXG4gICAgICAgICAgICAgICAgICBlbCxcbiAgICAgICAgICAgICAgICAgIChcInVwZGF0ZTpcIiArIChoeXBoZW5hdGUobmFtZSkpKSxcbiAgICAgICAgICAgICAgICAgIHN5bmNHZW4sXG4gICAgICAgICAgICAgICAgICBudWxsLFxuICAgICAgICAgICAgICAgICAgZmFsc2UsXG4gICAgICAgICAgICAgICAgICB3YXJuJDIsXG4gICAgICAgICAgICAgICAgICBsaXN0W2ldXG4gICAgICAgICAgICAgICAgKTtcbiAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgLy8gaGFuZGxlciB3LyBkeW5hbWljIGV2ZW50IG5hbWVcbiAgICAgICAgICAgICAgYWRkSGFuZGxlcihcbiAgICAgICAgICAgICAgICBlbCxcbiAgICAgICAgICAgICAgICAoXCJcXFwidXBkYXRlOlxcXCIrKFwiICsgbmFtZSArIFwiKVwiKSxcbiAgICAgICAgICAgICAgICBzeW5jR2VuLFxuICAgICAgICAgICAgICAgIG51bGwsXG4gICAgICAgICAgICAgICAgZmFsc2UsXG4gICAgICAgICAgICAgICAgd2FybiQyLFxuICAgICAgICAgICAgICAgIGxpc3RbaV0sXG4gICAgICAgICAgICAgICAgdHJ1ZSAvLyBkeW5hbWljXG4gICAgICAgICAgICAgICk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIGlmICgobW9kaWZpZXJzICYmIG1vZGlmaWVycy5wcm9wKSB8fCAoXG4gICAgICAgICAgIWVsLmNvbXBvbmVudCAmJiBwbGF0Zm9ybU11c3RVc2VQcm9wKGVsLnRhZywgZWwuYXR0cnNNYXAudHlwZSwgbmFtZSlcbiAgICAgICAgKSkge1xuICAgICAgICAgIGFkZFByb3AoZWwsIG5hbWUsIHZhbHVlLCBsaXN0W2ldLCBpc0R5bmFtaWMpO1xuICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgIGFkZEF0dHIoZWwsIG5hbWUsIHZhbHVlLCBsaXN0W2ldLCBpc0R5bmFtaWMpO1xuICAgICAgICB9XG4gICAgICB9IGVsc2UgaWYgKG9uUkUudGVzdChuYW1lKSkgeyAvLyB2LW9uXG4gICAgICAgIG5hbWUgPSBuYW1lLnJlcGxhY2Uob25SRSwgJycpO1xuICAgICAgICBpc0R5bmFtaWMgPSBkeW5hbWljQXJnUkUudGVzdChuYW1lKTtcbiAgICAgICAgaWYgKGlzRHluYW1pYykge1xuICAgICAgICAgIG5hbWUgPSBuYW1lLnNsaWNlKDEsIC0xKTtcbiAgICAgICAgfVxuICAgICAgICBhZGRIYW5kbGVyKGVsLCBuYW1lLCB2YWx1ZSwgbW9kaWZpZXJzLCBmYWxzZSwgd2FybiQyLCBsaXN0W2ldLCBpc0R5b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nVuY3Rpb25JbnZvY2F0aW9uID8gKFwicmV0dXJuIFwiICsgKGhhbmRsZXIudmFsdWUpKSA6IGhhbmRsZXIudmFsdWUpICsgXCJ9XCIpIC8vIGlubGluZSBzdGF0ZW1lbnRcbiAgfSBlbHNlIHtcbiAgICB2YXIgY29kZSA9ICcnO1xuICAgIHZhciBnZW5Nb2RpZmllckNvZGUgPSAnJztcbiAgICB2YXIga2V5cyA9IFtdO1xuICAgIGZvciAodmFyIGtleSBpbiBoYW5kbGVyLm1vZGlmaWVycykge1xuICAgICAgaWYgKG1vZGlmaWVyQ29kZVtrZXldKSB7XG4gICAgICAgIGdlbk1vZGlmaWVyQ29kZSArPSBtb2RpZmllckNvZGVba2V5XTtcbiAgICAgICAgLy8gbGVmdC9yaWdodFxuICAgICAgICBpZiAoa2V5Q29kZXNba2V5XSkge1xuICAgICAgICAgIGtleXMucHVzaChrZXkpO1xuICAgICAgICB9XG4gICAgICB9IGVsc2UgaWYgKGtleSA9PT0gJ2V4YWN0Jykge1xuICAgICAgICB2YXIgbW9kaWZpZXJzID0gKGhhbmRsZXIubW9kaWZpZXJzKTtcbiAgICAgICAgZ2VuTW9kaWZpZXJDb2RlICs9IGdlbkd1YXJkKFxuICAgICAgICAgIFsnY3RybCcsICdzaGlmdCcsICdhbHQnLCAnbWV0YSddXG4gICAgICAgICAgICAuZmlsdGVyKGZ1bmN0aW9uIChrZXlNb2RpZmllcikgeyByZXR1cm4gIW1vZGlmaWVyc1trZXlNb2RpZmllcl07IH0pXG4gICAgICAgICAgICAubWFwKGZ1bmN0aW9uIChrZXlNb2RpZmllcikgeyByZXR1cm4gKFwiJGV2ZW50LlwiICsga2V5TW9kaWZpZXIgKyBcIktleVwiKTsgfSlcbiAgICAgICAgICAgIC5qb2luKCd8fCcpXG4gICAgICAgICk7XG4gICAgICB9IGVsc2Uge1xuICAgICAgICBrZXlzLnB1c2goa2V5KTtcbiAgICAgIH1cbiAgICB9XG4gICAgaWYgKGtleXMubGVuZ3Ro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ByZW5kZXIgZnVuY3Rpb25zLidcbiAgICAgICAgICApO1xuICAgICAgICB9XG4gICAgICB9XG4gICAgfVxuXG4gICAgLy8gY2hlY2sgY2FjaGVcbiAgICB2YXIga2V5ID0gb3B0aW9ucy5kZWxpbWl0ZXJzXG4gICAgICA/IFN0cmluZyhvcHRpb25zLmRlbGltaXRlcnMpICsgdGVtcGxhdGVcbiAgICAgIDogdGVtcGxhdGU7XG4gICAgaWYgKGNhY2hlW2tleV0pIHtcbiAgICAgIHJldHVybiBjYWNoZVtrZXldXG4gICAgfVxuXG4gICAgLy8gY29tcGlsZVxuICAgIHZhciBjb21waWxlZCA9IGNvbXBpbGUodGVtcGxhdGUsIG9wdGlvbnMpO1xuXG4gICAgLy8gY2hlY2sgY29tcGlsYXRpb24gZXJyb3JzL3RpcHNcbiAgICB7XG4gICAgICBpZiAoY29tcGlsZWQuZXJyb3JzICYmIGNvbXBpbGVkLmVycm9ycy5sZW5ndGgpIHtcbiAgICAgICAgaWYgKG9wdGlvbnMub3V0cHV0U291cmNlUmFuZ2UpIHtcbiAgICAgICAgICBjb21waWxlZC5lcnJvcnMuZm9yRWFjaChmdW5jdGlvbiAoZSkge1xuICAgICAgICAgICAgd2FybiQkMShcbiAgICAgICAgICAgICAgXCJFcnJvciBjb21waWxpbmcgdGVtcGxhdGU6XFxuXFxuXCIgKyAoZS5tc2cpICsgXCJcXG5cXG5cIiArXG4gICAgICAgICAgICAgIGdlbmVyYXRlQ29kZUZyYW1lKHRlbXBsYXRlLCBlLnN0YXJ0LCBlLmVuZCksXG4gICAgICAgICAgICAgIHZtXG4gICAgICAgICAgICApO1xuICAgICAgICAgIH0pO1xuICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgIHdhcm4kJDEoXG4gICAgICAgICAgICBcIkVycm9yIGNvbXBpbGluZyB0ZW1wbGF0ZTpcXG5cXG5cIiArIHRlbXBsYXRlICsgXCJcXG5cXG5cIiArXG4gICAgICAgICAgICBjb21waWxlZC5lcnJvcnMub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AgICAgKHRpcCA/IHRpcHMgOiBlcnJvcnMpLnB1c2gobXNnKTtcbiAgICAgIH07XG5cbiAgICAgIGlmIChvcHRpb25zKSB7XG4gICAgICAgIGlmIChvcHRpb25zLm91dHB1dFNvdXJjZVJhbmdlKSB7XG4gICAgICAgICAgLy8gJGZsb3ctZGlzYWJsZS1saW5lXG4gICAgICAgICAgdmFyIGxlYWRpbmdTcGFjZUxlbmd0aCA9IHRlbXBsYXRlLm1hdGNoKC9eXFxzKi8pWzBdLmxlbmd0aDtcblxuICAgICAgICAgIHdhcm4gPSBmdW5jdGlvbiAobXNnLCByYW5nZSwgdGlwKSB7XG4gICAgICAgICAgICB2YXIgZGF0YSA9IHsgbXNnOiBtc2cgfTtcbiAgICAgICAgICAgIGlmIChyYW5nZSkge1xuICAgICAgICAgICAgICBpZiAocmFuZ2Uuc3RhcnQgIT0gbnVsbCkge1xuICAgICAgICAgICAgICAgIGRhdGEuc3RhcnQgPSByYW5nZS5zdGFydCArIGxlYWRpbmdTcGFjZUxlbmd0aDtcbiAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICBpZiAocmFuZ2UuZW5kICE9IG51bGwpIHtcbiAgICAgICAgICAgICAgICBkYXRhLmVuZCA9IHJhbmdlLmVuZCArIGxlYWRpbmdTcGFjZUxlbmd0aDtcbiAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICAgICAgKHRpcCA/IHRpcHMgOiBlcnJvcnMpLnB1c2goZGF0YSk7XG4gICAgICAgICAgfTtcbiAgICAgICAgfVxuICAgICAgICAvLyBtZXJnZSBjdXN0b20gbW9kdWxlc1xuICAgICAgICBpZiAob3B0aW9ucy5tb2R1bGVzKSB7XG4gICAgICAgICAgZmluYWxPcHRpb25zLm1vZHVsZXMgPVxuICAgICAgICAgICAgKGJhc2VPcHRpb25zLm1vZHVsZXMgfHwgW10pLmNvbmNhdChvcHRpb25zLm1vZHVsZXMpO1xuICAgICAgICB9XG4gICAgICAgIC8vIG1lcm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gICAgcmV0dXJuIHRoaXNcbiAgICAgIH1cbiAgICB9IGVsc2UgaWYgKGVsKSB7XG4gICAgICB0ZW1wbGF0ZSA9IGdldE91dGVySFRNTChlbCk7XG4gICAgfVxuICAgIGlmICh0ZW1wbGF0ZSkge1xuICAgICAgLyogaXN0YW5idWwgaWdub3JlIGlmICovXG4gICAgICBpZiAoY29uZmlnLnBlcmZvcm1hbmNlICYmIG1hcmspIHtcbiAgICAgICAgbWFyaygnY29tcGlsZScpO1xuICAgICAgfVxuXG4gICAgICB2YXIgcmVmID0gY29tcGlsZVRvRnVuY3Rpb25zKHRlbXBsYXRlLCB7XG4gICAgICAgIG91dHB1dFNvdXJjZVJhbmdlOiBcImRldmVsb3BtZW50XCIgIT09ICdwcm9kdWN0aW9uJyxcbiAgICAgICAgc2hvdWxkRGVjb2RlTmV3bGluZXM6IHNob3VsZERlY29kZU5ld2xpbmVzLFxuICAgICAgICBzaG91bGREZWNvZGVOZXdsaW5lc0ZvckhyZWY6IHNob3VsZERlY29kZU5ld2xpbmVzRm9ySHJlZixcbiAgICAgICAgZGVsaW1pdGVyczogb3B0aW9ucy5kZWxpbWl0ZXJzLFxuICAgICAgICBjb21tZW50czogb3B0aW9ucy5jb21tZW50c1xuICAgICAgfSwgdGhpcyk7XG4gICAgICB2YXIgcmVuZGVyID0gcmVmLnJlbmRlcjtcbiAgICAgIHZhciBzdGF0aWNSZW5kZXJGbnMgPSByZWYuc3RhdGljUmVuZGVyRm5zO1xuICAgICAgb3B0aW9ucy5yZW5kZXIgPSByZW5kZXI7XG4gICAgICBvcHRpb25zLnN0YXRpY1JlbmRlckZucyA9IHN0YXRpY1JlbmRlckZucztcblxuICAgICAgLyogaXN0YW5idWwgaWdub3JlIGlmICovXG4gICAgICBpZiAoY29uZmlnLnBlcmZvcm1hbmNlICYmIG1hcmspIHtcbiAgICAgICAgbWFyaygnY29tcGlsZSBlbmQnKTtcbiAgICAgICAgbWVhc3VyZSgoXCJ2dWUgXCIgKyAodGhpcy5fbmFtZSkgKyBcIiBjb21waWxlXCIpLCAnY29tcGlsZScsICdjb21waWxlIGVuZCcpO1xuICAgICAgfVxuICAgIH1cbiAgfVxuICByZXR1cm4gbW91bnQuY2FsbCh0aGlzLCBlbCwgaHlkcmF0aW5nKVxufTtcblxuLyoqXG4gKiBHZXQgb3V0ZXJIVE1MIG9mIGVsZW1lbnRzLCB0YWtpbmcgY2FyZVxuICogb2YgU1ZHIGVsZW1lbnRzIGluIElFIGFzIHdlbGwuXG4gKi9cbmZ1bmN0aW9uIGdldE91dGVySFRNTCAoZWwpIHtcbiAgaWYgKGVsLm91dGVySFRNTCkge1xuICAgIHJldHVybiBlbC5vdXRlckhUTUxcbiAgfSBlbHNlIHtcbiAgICB2YXIgY29udGFpbmVyID0gZG9jdW1lbnQuY3JlYXRlRWxlbWVudCgnZGl2Jyk7XG4gICAgY29udGFpbmVyLmFwcGVuZENoaWxkKGVsLmNsb25lTm9kZSh0cnVlKSk7XG4gICAgcmV0dXJuIGNvbnRhaW5lci5pbm5lckhUTUxcbiAgfVxufVxuXG5WdWUuY29tcGlsZSA9IGNvbXBpbGVUb0Z1bmN0aW9ucztcblxubW9kdWxlLmV4cG9ydHMgPSBWdWU7XG4iXSwic291cmNlUm9vdCI6IiJ9\n//# sourceURL=webpack-internal:///./node_modules/vue/dist/vue.common.dev.js\n");
/***/ }),
/***/ "./node_modules/vue/dist/vue.common.js":
/*!*********************************************!*\
!*** ./node_modules/vue/dist/vue.common.js ***!
\*********************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
eval("if (false) {} else {\n module.exports = __webpack_require__(/*! ./vue.common.dev.js */ \"./node_modules/vue/dist/vue.common.dev.js\")\n}\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvdnVlL2Rpc3QvdnVlLmNvbW1vbi5qcz81ZWU1Il0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLElBQUksS0FBcUMsRUFBRSxFQUUxQztBQUNELG1CQUFtQixtQkFBTyxDQUFDLHNFQUFxQjtBQUNoRCIsImZpbGUiOiIuL25vZGVfbW9kdWxlcy92dWUvZGlzdC92dWUuY29tbW9uLmpzLmpzIiwic291cmNlc0NvbnRlbnQiOlsiaWYgKHByb2Nlc3MuZW52Lk5PREVfRU5WID09PSAncHJvZHVjdGlvbicpIHtcbiAgbW9kdWxlLmV4cG9ydHMgPSByZXF1aXJlKCcuL3Z1ZS5jb21tb24ucHJvZC5qcycpXG59IGVsc2Uge1xuICBtb2R1bGUuZXhwb3J0cyA9IHJlcXVpcmUoJy4vdnVlLmNvbW1vbi5kZXYuanMnKVxufVxuIl0sInNvdXJjZVJvb3QiOiIifQ==\n//# sourceURL=webpack-internal:///./node_modules/vue/dist/vue.common.js\n");
/***/ }),
/***/ "./node_modules/webpack/buildin/global.js":
/*!***********************************!*\
!*** (webpack)/buildin/global.js ***!
\***********************************/
/*! no static exports found */
/***/ (function(module, exports) {
eval("var g;\n\n// This works in non-strict mode\ng = (function() {\n\treturn this;\n})();\n\ntry {\n\t// This works if eval is allowed (see CSP)\n\tg = g || new Function(\"return this\")();\n} catch (e) {\n\t// This works if the window reference is available\n\tif (typeof window === \"object\") g = window;\n}\n\n// g can still be undefined, but nothing to do about it...\n// We return undefined, instead of nothing here, so it's\n// easier to handle this case. if(!global) { ...}\n\nmodule.exports = g;\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vKHdlYnBhY2spL2J1aWxkaW4vZ2xvYmFsLmpzP2NkMDAiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUE7O0FBRUE7QUFDQTtBQUNBO0FBQ0EsQ0FBQzs7QUFFRDtBQUNBO0FBQ0E7QUFDQSxDQUFDO0FBQ0Q7QUFDQTtBQUNBOztBQUVBO0FBQ0E7QUFDQSw0Q0FBNEM7O0FBRTVDIiwiZmlsZSI6Ii4vbm9kZV9tb2R1bGVzL3dlYnBhY2svYnVpbGRpbi9nbG9iYWwuanMuanMiLCJzb3VyY2VzQ29udGVudCI6WyJ2YXIgZztcblxuLy8gVGhpcyB3b3JrcyBpbiBub24tc3RyaWN0IG1vZGVcbmcgPSAoZnVuY3Rpb24oKSB7XG5cdHJldHVybiB0aGlzO1xufSkoKTtcblxudHJ5IHtcblx0Ly8gVGhpcyB3b3JrcyBpZiBldmFsIGlzIGFsbG93ZWQgKHNlZSBDU1ApXG5cdGcgPSBnIHx8IG5ldyBGdW5jdGlvbihcInJldHVybiB0aGlzXCIpKCk7XG59IGNhdGNoIChlKSB7XG5cdC8vIFRoaXMgd29ya3MgaWYgdGhlIHdpbmRvdyByZWZlcmVuY2UgaXMgYXZhaWxhYmxlXG5cdGlmICh0eXBlb2Ygd2luZG93ID09PSBcIm9iamVjdFwiKSBnID0gd2luZG93O1xufVxuXG4vLyBnIGNhbiBzdGlsbCBiZSB1bmRlZmluZWQsIGJ1dCBub3RoaW5nIHRvIGRvIGFib3V0IGl0Li4uXG4vLyBXZSByZXR1cm4gdW5kZWZpbmVkLCBpbnN0ZWFkIG9mIG5vdGhpbmcgaGVyZSwgc28gaXQnc1xuLy8gZWFzaWVyIHRvIGhhbmRsZSB0aGlzIGNhc2UuIGlmKCFnbG9iYWwpIHsgLi4ufVxuXG5tb2R1bGUuZXhwb3J0cyA9IGc7XG4iXSwic291cmNlUm9vdCI6IiJ9\n//# sourceURL=webpack-internal:///./node_modules/webpack/buildin/global.js\n");
/***/ }),
/***/ "./resources/js/editDataset.js":
/*!*************************************!*\
!*** ./resources/js/editDataset.js ***!
\*************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! vue */ \"./node_modules/vue/dist/vue.common.js\");\n/* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(vue__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var axios__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! axios */ \"./node_modules/axios/index.js\");\n/* harmony import */ var axios__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(axios__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var vee_validate__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! vee-validate */ \"./node_modules/vee-validate/dist/vee-validate.esm.js\");\n\n\n\nvue__WEBPACK_IMPORTED_MODULE_0___default.a.use(vee_validate__WEBPACK_IMPORTED_MODULE_2__[\"default\"]);\n/* harmony default export */ __webpack_exports__[\"default\"] = (EditDataset = new vue__WEBPACK_IMPORTED_MODULE_0___default.a({\n // export default class EditDataset extends Vue {\n // el: '#app1',\n data: function data() {\n return {\n // form: {},\n form: {\n // reject_reviewer_note: '',\n // server_state: '',\n // language: '',\n name: '',\n comments: [],\n // creating_corporation: '2',\n // embargo_date: '',\n coverage: {\n xmin: \"\",\n ymin: \"\",\n xmax: \"\",\n ymax: \"\",\n elevation_min: \"\",\n elevation_max: \"\",\n elevation_absolut: \"\",\n depth_min: \"\",\n depth_max: \"\",\n depth_absolut: \"\",\n time_min: \"\",\n time_max: \"\",\n time_absolut: \"\"\n } // checkedAuthors: [],\n // checkedLicenses: [],\n // files: [],\n // keywords: [],\n // references: [],\n // titles: [],\n // descriptions: [],\n // checkedContributors: []\n\n },\n allerros: [],\n success: false\n };\n },\n beforeMount: function beforeMount() {\n this.form = window.Laravel.form;\n },\n methods: {\n onSubmit: function onSubmit() {\n var _this = this;\n\n var dataform = new FormData();\n dataform.append('name', this.form.name); // dataform.append('comments', this.form.comments);\n\n console.log(this.form.name);\n axios__WEBPACK_IMPORTED_MODULE_1___default.a.post('/vuevalidation/form', dataform).then(function (response) {\n console.log(response);\n _this.allerros = [];\n _this.form.name = '';\n _this.form.comments = [];\n _this.success = true;\n })[\"catch\"](function (error) {\n _this.allerros = error.response.data.errors;\n _this.success = false;\n });\n }\n }\n}));//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9yZXNvdXJjZXMvanMvZWRpdERhdGFzZXQuanM/NWQwOCJdLCJuYW1lcyI6WyJWdWUiLCJ1c2UiLCJWZWVWYWxpZGF0ZSIsIkVkaXREYXRhc2V0IiwiZGF0YSIsImZvcm0iLCJuYW1lIiwiY29tbWVudHMiLCJjb3ZlcmFnZSIsInhtaW4iLCJ5bWluIiwieG1heCIsInltYXgiLCJlbGV2YXRpb25fbWluIiwiZWxldmF0aW9uX21heCIsImVsZXZhdGlvbl9hYnNvbHV0IiwiZGVwdGhfbWluIiwiZGVwdGhfbWF4IiwiZGVwdGhfYWJzb2x1dCIsInRpbWVfbWluIiwidGltZV9tYXgiLCJ0aW1lX2Fic29sdXQiLCJhbGxlcnJvcyIsInN1Y2Nlc3MiLCJiZWZvcmVNb3VudCIsIndpbmRvdyIsIkxhcmF2ZWwiLCJtZXRob2RzIiwib25TdWJtaXQiLCJkYXRhZm9ybSIsIkZvcm1EYXRhIiwiYXBwZW5kIiwiY29uc29sZSIsImxvZyIsImF4aW9zIiwicG9zdCIsInRoZW4iLCJyZXNwb25zZSIsImVycm9yIiwiZXJyb3JzIl0sIm1hcHBpbmdzIjoiQUFBQTtBQUFBO0FBQUE7QUFBQTtBQUFBO0FBQUE7QUFBQTtBQUNBO0FBQ0E7QUFDQUEsMENBQUcsQ0FBQ0MsR0FBSixDQUFRQyxvREFBUjtBQUllQywwRUFBVyxHQUFHLElBQUlILDBDQUFKLENBQVE7QUFDakM7QUFDQTtBQUNBSSxNQUhpQyxrQkFHMUI7QUFDSCxXQUFPO0FBQ0g7QUFDQUMsVU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Ckge1xuICAgICAgICByZXR1cm4ge1xuICAgICAgICAgICAgLy8gZm9ybToge30sXG4gICAgICAgICAgICBmb3JtOiB7XG4gICAgICAgICAgICAgICAgLy8gcmVqZWN0X3Jldmlld2VyX25vdGU6ICcnLFxuICAgICAgICAgICAgICAgIC8vIHNlcnZlcl9zdGF0ZTogJycsXG4gICAgICAgICAgICAgICAgLy8gbGFuZ3VhZ2U6ICcnLFxuICAgICAgICAgICAgICAgIG5hbWU6ICcnLFxuICAgICAgICAgICAgICAgIGNvbW1lbnRzOiBbXSxcblxuICAgICAgICAgICAgICAgIC8vIGNyZWF0aW5nX2NvcnBvcmF0aW9uOiAnMicsXG4gICAgICAgICAgICAgICAgLy8gZW1iYXJnb19kYXRlOiAnJyxcbiAgICAgICAgICAgICAgICBjb3ZlcmFnZToge1xuICAgICAgICAgICAgICAgICAgICB4bWluOiBcIlwiLFxuICAgICAgICAgICAgICAgICAgICB5bWluOiBcIlwiLFxuICAgICAgICAgICAgICAgICAgICB4bWF4OiBcIlwiLFxuICAgICAgICAgICAgICAgICAgICB5bWF4OiBcIlwiLFxuICAgICAgICAgICAgICAgICAgICBlbGV2YXRpb25fbWluOiBcIlwiLFxuICAgICAgICAgICAgICAgICAgICBlbGV2YXRpb25fbWF4OiBcIlwiLFxuICAgICAgICAgICAgICAgICAgICBlbGV2YXRpb25fYWJzb2x1dDogXCJcIixcbiAgICAgICAgICAgICAgICAgICAgZGVwdGhfbWluOiBcIlwiLFxuICAgICAgICAgICAgICAgICAgICBkZXB0aF9tYXg6IFwiXCIsXG4gICAgICAgICAgICAgICAgICAgIGRlcHRoX2Fic29sdXQ6IFwiXCIsXG4gICAgICAgICAgICAgICAgICAgIHRpbWVfbWluOiBcIlwiLFxuICAgICAgICAgICAgICAgICAgICB0aW1lX21heDogXCJcIixcbiAgICAgICAgICAgICAgICAgICAgdGltZV9hYnNvbHV0OiBcIlwiXG4gICAgICAgICAgICAgICAgfSxcbiAgICAgICAgICAgICAgICAvLyBjaGVja2VkQXV0aG9yczogW10sXG4gICAgICAgICAgICAgICAgLy8gY2hlY2tlZExpY2Vuc2VzOiBbXSxcbiAgICAgICAgICAgICAgICAvLyBmaWxlczogW10sXG4gICAgICAgICAgICAgICAgLy8ga2V5d29yZHM6IFtdLFxuICAgICAgICAgICAgICAgIC8vIHJlZmVyZW5jZXM6IFtdLFxuICAgICAgICAgICAgICAgIC8vIHRpdGxlczogW10sXG4gICAgICAgICAgICAgICAgLy8gZGVzY3JpcHRpb25zOiBbXSxcbiAgICAgICAgICAgICAgICAvLyBjaGVja2VkQ29udHJpYnV0b3JzOiBbXVxuICAgICAgICAgICAgfSxcbiAgICAgICAgICAgIGFsbGVycm9zOiBbXSxcbiAgICAgICAgICAgIHN1Y2Nlc3M6IGZhbHNlXG4gICAgICAgIH1cbiAgICB9LFxuXG5cbiAgICBiZWZvcmVNb3VudCgpIHtcbiAgICAgICAgdGhpcy5mb3JtID0gd2luZG93LkxhcmF2ZWwuZm9ybTtcbiAgICB9LFxuXG4gICAgbWV0aG9kczoge1xuXG4gICAgICAgIG9uU3VibWl0KCkge1xuICAgICAgICAgICAgdmFyIGRhdGFmb3JtID0gbmV3IEZvcm1EYXRhKCk7XG4gICAgICAgICAgICBkYXRhZm9ybS5hcHBlbmQoJ25hbWUnLCB0aGlzLmZvcm0ubmFtZSk7XG4gICAgICAgICAgICAvLyBkYXRhZm9ybS5hcHBlbmQoJ2NvbW1lbnRzJywgdGhpcy5mb3JtLmNvbW1lbnRzKTtcbiAgICAgICAgICAgIGNvbnNvbGUubG9nKHRoaXMuZm9ybS5uYW1lKTtcbiAgICAgICAgICAgIGF4aW9zLnBvc3QoJy92dWV2YWxpZGF0aW9uL2Zvcm0nLCBkYXRhZm9ybSkudGhlbihyZXNwb25zZSA9PiB7XG4gICAgICAgICAgICAgICAgY29uc29sZS5sb2cocmVzcG9uc2UpO1xuICAgICAgICAgICAgICAgIHRoaXMuYWxsZXJyb3MgPSBbXTtcbiAgICAgICAgICAgICAgICB0aGlzLmZvcm0ubmFtZSA9ICcnO1xuICAgICAgICAgICAgICAgIHRoaXMuZm9ybS5jb21tZW50cyA9IFtdO1xuICAgICAgICAgICAgICAgIHRoaXMuc3VjY2VzcyA9IHRydWU7XG4gICAgICAgICAgICB9KS5jYXRjaCgoZXJyb3IpID0+IHtcbiAgICAgICAgICAgICAgICB0aGlzLmFsbGVycm9zID0gZXJyb3IucmVzcG9uc2UuZGF0YS5lcnJvcnM7XG4gICAgICAgICAgICAgICAgdGhpcy5zdWNjZXNzID0gZmFsc2U7XG4gICAgICAgICAgICB9KTtcbiAgICAgICAgfVxuICAgIH1cbn0pOyJdLCJzb3VyY2VSb290IjoiIn0=\n//# sourceURL=webpack-internal:///./resources/js/editDataset.js\n");
/***/ }),
/***/ 5:
/*!*******************************************!*\
!*** multi ./resources/js/editDataset.js ***!
\*******************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
module.exports = __webpack_require__(/*! D:\Software\lms\lms\resources\js\editDataset.js */"./resources/js/editDataset.js");
/***/ })
/******/ });