From 2217c0dc979e55a6b336ef2ee59a4d6ada620a42 Mon Sep 17 00:00:00 2001 From: Tyler Torola Date: Tue, 31 May 2016 12:49:53 -0700 Subject: [PATCH] fixed backend public offers --- app/Http/Controllers/PublicController.php | 27 +++++++++++++++++++ app/Http/routes.php | 6 +++++ app/Item.php | 5 ++-- app/Offer.php | 5 ++-- app/Search.php | 24 +++++++++++------ public/js/main.min.js | 4 ++- public/js/main.min.js.map | 2 +- .../assets/js/components/offer/offerInfo.vue | 9 ++++++- resources/assets/js/pages/offer.vue | 16 ++++++----- 9 files changed, 76 insertions(+), 22 deletions(-) create mode 100644 app/Http/Controllers/PublicController.php diff --git a/app/Http/Controllers/PublicController.php b/app/Http/Controllers/PublicController.php new file mode 100644 index 0000000..d569c6c --- /dev/null +++ b/app/Http/Controllers/PublicController.php @@ -0,0 +1,27 @@ +public) { + return $offer->toPublicArray(); + } + App::abort(404); + } +} diff --git a/app/Http/routes.php b/app/Http/routes.php index 18e2c50..f6b7aa2 100644 --- a/app/Http/routes.php +++ b/app/Http/routes.php @@ -270,6 +270,12 @@ }); }); +Route::group(['prefix' => 'public-api'], function() { + + Route::get('offer/{id}', 'PublicController@offer'); + +}); + /* |-------------------------------------------------------------------------- | Admin panel diff --git a/app/Item.php b/app/Item.php index 53a4c4f..7b1f3bb 100644 --- a/app/Item.php +++ b/app/Item.php @@ -51,7 +51,8 @@ public static function saveMany($items, $offer_id) * @var array */ protected $casts = [ - 'infinite' => 'boolean', + 'infinite' => 'boolean', + 'public' => 'boolean', 'type_info' => 'array', ]; @@ -160,7 +161,7 @@ public function getFullNewlineNameAttribute() |-------------------------------------------------------------------------- */ - static public function extractTypeInfo($item) + static public function extractTypeInfo($item) { $type = $item['type']; $schema = config("samwise.type_schema.item.$type"); diff --git a/app/Offer.php b/app/Offer.php index 6490b8a..18ca88f 100644 --- a/app/Offer.php +++ b/app/Offer.php @@ -55,6 +55,7 @@ class Offer extends Model */ protected $casts = [ 'type_info' => 'array', + 'public' => 'boolean' ]; /* @@ -184,7 +185,7 @@ public function getTimestampAttribute() |-------------------------------------------------------------------------- */ - static public function extractTypeInfo($offer) + static public function extractTypeInfo($offer) { $type = $offer['type']; $schema = config("samwise.type_schema.offer.$type"); @@ -260,7 +261,7 @@ public function toPublicArray() * Set mapping properties */ - + protected $mappingProperties = array( 'tag_array' => [ 'type' => 'string', diff --git a/app/Search.php b/app/Search.php index b62f1ed..a6b3197 100644 --- a/app/Search.php +++ b/app/Search.php @@ -50,14 +50,22 @@ static public function index() Offer::putMapping($ignoreConflicts = true); $offer_chunks = Offer::all()->chunk(50); foreach ($offer_chunks as $offers) { - $offers->addToIndex(); + foreach ($offers as $offer ) { + if ($offer->public) { + $offer->addToIndex(); + } + } } // Item index // Item::putMapping($ignoreConflicts = true); $item_chunks = Item::all()->chunk(50); foreach ($item_chunks as $items) { - $items->addToIndex(); + foreach ($items as $item ) { + if ($item->public) { + $item->addToIndex(); + } + } } } @@ -79,7 +87,7 @@ static public function reindex() * @param string $index the index to query * @param Request $request the client provided request * - * @return array + * @return array */ public function query($index, Request $request) { @@ -202,7 +210,7 @@ public function query($index, Request $request) * @param string $index the index to query * @param Request $request the client provided request * - * @return array + * @return array */ public function search($index, Request $request) { @@ -336,7 +344,7 @@ public function search($index, Request $request) * @param string $index the index to query * @param Request $request the client provided request * - * @return array + * @return array */ public function collect($index, Request $request) { @@ -385,11 +393,11 @@ public function collect($index, Request $request) $page = count($collection) - 1; } - if ($page < 0) { - $page = 0; + if ($page < 0) { + $page = 0; $collection = []; } else { - $collection = $collection[$page]; + $collection = $collection[$page]; } return [ diff --git a/public/js/main.min.js b/public/js/main.min.js index 6258e55..b90ed8d 100644 --- a/public/js/main.min.js +++ b/public/js/main.min.js @@ -18005,7 +18005,7 @@ if (module.hot) {(function () { module.hot.accept() module.exports = { props: ['offer'] }; -;(typeof module.exports === "function"? module.exports.options: module.exports).template = "\n
\n\t
\n\t\t

General Info

\n\n\t\t
\n\t\t\t\n\t\t
\n\t
\n\t
\n\t\t
\n\t\t\t\n\t\t\t
\n\t\t\t\t\n\t\t\t
\n\t\t
\n\n\t\t
\n\t\t\t\n\t\t\t
\n\t\t\t\t\n\t\t\t
\n\t\t
\n\t
\n
\n" +;(typeof module.exports === "function"? module.exports.options: module.exports).template = "\n
\n\t
\n\t\t

General Info

\n\n\t\t
\n\t\t\t\n\t\t
\n\t
\n\t
\n\t\t
\n\t\t\t\n\t\t\t
\n\t\t\t\t\n\t\t\t
\n\t\t
\n\n\t\t
\n\t\t\t\n\t\t\t
\n\t\t\t\t\n\t\t\t
\n\t\t
\n\n\t\t
\n\t\t\t\n\t\t
\n\t
\n
\n" if (module.hot) {(function () { module.hot.accept() var hotAPI = require("vue-hot-reload-api") hotAPI.install(require("vue"), true) @@ -19614,6 +19614,8 @@ module.exports = { this.$refs.store.working(); + console.log(this.offer); + this.$http.patch('offer/' + this.offer.id, this.offer).then(function (response) { response.data['deleted_pictures'] = []; _this2.$set('offer', response.data); diff --git a/public/js/main.min.js.map b/public/js/main.min.js.map index 8fa3bc7..7fb88a2 100644 --- a/public/js/main.min.js.map +++ b/public/js/main.min.js.map @@ -1 +1 @@ -{"version":3,"names":[],"mappings":"","sources":["main.min.js"],"sourcesContent":["(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require==\"function\"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error(\"Cannot find module '\"+o+\"'\");throw f.code=\"MODULE_NOT_FOUND\",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require==\"function\"&&require;for(var o=0;o 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 setTimeout(drainQueue, 0);\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;\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\n},{}],2:[function(require,module,exports){\nvar Vue // late bind\nvar map = Object.create(null)\nvar shimmed = false\nvar isBrowserify = false\n\n/**\n * Determine compatibility and apply patch.\n *\n * @param {Function} vue\n * @param {Boolean} browserify\n */\n\nexports.install = function (vue, browserify) {\n if (shimmed) return\n shimmed = true\n\n Vue = vue\n isBrowserify = browserify\n\n exports.compatible = !!Vue.internalDirectives\n if (!exports.compatible) {\n console.warn(\n '[HMR] vue-loader hot reload is only compatible with ' +\n 'Vue.js 1.0.0+.'\n )\n return\n }\n\n // patch view directive\n patchView(Vue.internalDirectives.component)\n console.log('[HMR] Vue component hot reload shim applied.')\n // shim router-view if present\n var routerView = Vue.elementDirective('router-view')\n if (routerView) {\n patchView(routerView)\n console.log('[HMR] vue-router hot reload shim applied.')\n }\n}\n\n/**\n * Shim the view directive (component or router-view).\n *\n * @param {Object} View\n */\n\nfunction patchView (View) {\n var unbuild = View.unbuild\n View.unbuild = function (defer) {\n if (!this.hotUpdating) {\n var prevComponent = this.childVM && this.childVM.constructor\n removeView(prevComponent, this)\n // defer = true means we are transitioning to a new\n // Component. Register this new component to the list.\n if (defer) {\n addView(this.Component, this)\n }\n }\n // call original\n return unbuild.call(this, defer)\n }\n}\n\n/**\n * Add a component view to a Component's hot list\n *\n * @param {Function} Component\n * @param {Directive} view - view directive instance\n */\n\nfunction addView (Component, view) {\n var id = Component && Component.options.hotID\n if (id) {\n if (!map[id]) {\n map[id] = {\n Component: Component,\n views: [],\n instances: []\n }\n }\n map[id].views.push(view)\n }\n}\n\n/**\n * Remove a component view from a Component's hot list\n *\n * @param {Function} Component\n * @param {Directive} view - view directive instance\n */\n\nfunction removeView (Component, view) {\n var id = Component && Component.options.hotID\n if (id) {\n map[id].views.$remove(view)\n }\n}\n\n/**\n * Create a record for a hot module, which keeps track of its construcotr,\n * instnaces and views (component directives or router-views).\n *\n * @param {String} id\n * @param {Object} options\n */\n\nexports.createRecord = function (id, options) {\n if (typeof options === 'function') {\n options = options.options\n }\n if (typeof options.el !== 'string' && typeof options.data !== 'object') {\n makeOptionsHot(id, options)\n map[id] = {\n Component: null,\n views: [],\n instances: []\n }\n }\n}\n\n/**\n * Make a Component options object hot.\n *\n * @param {String} id\n * @param {Object} options\n */\n\nfunction makeOptionsHot (id, options) {\n options.hotID = id\n injectHook(options, 'created', function () {\n var record = map[id]\n if (!record.Component) {\n record.Component = this.constructor\n }\n record.instances.push(this)\n })\n injectHook(options, 'beforeDestroy', function () {\n map[id].instances.$remove(this)\n })\n}\n\n/**\n * Inject a hook to a hot reloadable component so that\n * we can keep track of it.\n *\n * @param {Object} options\n * @param {String} name\n * @param {Function} hook\n */\n\nfunction injectHook (options, name, hook) {\n var existing = options[name]\n options[name] = existing\n ? Array.isArray(existing)\n ? existing.concat(hook)\n : [existing, hook]\n : [hook]\n}\n\n/**\n * Update a hot component.\n *\n * @param {String} id\n * @param {Object|null} newOptions\n * @param {String|null} newTemplate\n */\n\nexports.update = function (id, newOptions, newTemplate) {\n var record = map[id]\n // force full-reload if an instance of the component is active but is not\n // managed by a view\n if (!record || (record.instances.length && !record.views.length)) {\n console.log('[HMR] Root or manually-mounted instance modified. Full reload may be required.')\n if (!isBrowserify) {\n window.location.reload()\n } else {\n // browserify-hmr somehow sends incomplete bundle if we reload here\n return\n }\n }\n if (!isBrowserify) {\n // browserify-hmr already logs this\n console.log('[HMR] Updating component: ' + format(id))\n }\n var Component = record.Component\n // update constructor\n if (newOptions) {\n // in case the user exports a constructor\n Component = record.Component = typeof newOptions === 'function'\n ? newOptions\n : Vue.extend(newOptions)\n makeOptionsHot(id, Component.options)\n }\n if (newTemplate) {\n Component.options.template = newTemplate\n }\n // handle recursive lookup\n if (Component.options.name) {\n Component.options.components[Component.options.name] = Component\n }\n // reset constructor cached linker\n Component.linker = null\n // reload all views\n record.views.forEach(function (view) {\n updateView(view, Component)\n })\n // flush devtools\n if (window.__VUE_DEVTOOLS_GLOBAL_HOOK__) {\n window.__VUE_DEVTOOLS_GLOBAL_HOOK__.emit('flush')\n }\n}\n\n/**\n * Update a component view instance\n *\n * @param {Directive} view\n * @param {Function} Component\n */\n\nfunction updateView (view, Component) {\n if (!view._bound) {\n return\n }\n view.Component = Component\n view.hotUpdating = true\n // disable transitions\n view.vm._isCompiled = false\n // save state\n var state = extractState(view.childVM)\n // remount, make sure to disable keep-alive\n var keepAlive = view.keepAlive\n view.keepAlive = false\n view.mountComponent()\n view.keepAlive = keepAlive\n // restore state\n restoreState(view.childVM, state, true)\n // re-eanble transitions\n view.vm._isCompiled = true\n view.hotUpdating = false\n}\n\n/**\n * Extract state from a Vue instance.\n *\n * @param {Vue} vm\n * @return {Object}\n */\n\nfunction extractState (vm) {\n return {\n cid: vm.constructor.cid,\n data: vm.$data,\n children: vm.$children.map(extractState)\n }\n}\n\n/**\n * Restore state to a reloaded Vue instance.\n *\n * @param {Vue} vm\n * @param {Object} state\n */\n\nfunction restoreState (vm, state, isRoot) {\n var oldAsyncConfig\n if (isRoot) {\n // set Vue into sync mode during state rehydration\n oldAsyncConfig = Vue.config.async\n Vue.config.async = false\n }\n // actual restore\n if (isRoot || !vm._props) {\n vm.$data = state.data\n } else {\n Object.keys(state.data).forEach(function (key) {\n if (!vm._props[key]) {\n // for non-root, only restore non-props fields\n vm.$data[key] = state.data[key]\n }\n })\n }\n // verify child consistency\n var hasSameChildren = vm.$children.every(function (c, i) {\n return state.children[i] && state.children[i].cid === c.constructor.cid\n })\n if (hasSameChildren) {\n // rehydrate children\n vm.$children.forEach(function (c, i) {\n restoreState(c, state.children[i])\n })\n }\n if (isRoot) {\n Vue.config.async = oldAsyncConfig\n }\n}\n\nfunction format (id) {\n return id.match(/[^\\/]+\\.vue$/)[0]\n}\n\n},{}],3:[function(require,module,exports){\n/**\n * Before Interceptor.\n */\n\nvar _ = require('../util');\n\nmodule.exports = {\n\n request: function (request) {\n\n if (_.isFunction(request.beforeSend)) {\n request.beforeSend.call(this, request);\n }\n\n return request;\n }\n\n};\n\n},{\"../util\":26}],4:[function(require,module,exports){\n/**\n * Base client.\n */\n\nvar _ = require('../../util');\nvar Promise = require('../../promise');\nvar xhrClient = require('./xhr');\n\nmodule.exports = function (request) {\n\n var response = (request.client || xhrClient)(request);\n\n return Promise.resolve(response).then(function (response) {\n\n if (response.headers) {\n\n var headers = parseHeaders(response.headers);\n\n response.headers = function (name) {\n\n if (name) {\n return headers[_.toLower(name)];\n }\n\n return headers;\n };\n\n }\n\n response.ok = response.status >= 200 && response.status < 300;\n\n return response;\n });\n\n};\n\nfunction parseHeaders(str) {\n\n var headers = {}, value, name, i;\n\n if (_.isString(str)) {\n _.each(str.split('\\n'), function (row) {\n\n i = row.indexOf(':');\n name = _.trim(_.toLower(row.slice(0, i)));\n value = _.trim(row.slice(i + 1));\n\n if (headers[name]) {\n\n if (_.isArray(headers[name])) {\n headers[name].push(value);\n } else {\n headers[name] = [headers[name], value];\n }\n\n } else {\n\n headers[name] = value;\n }\n\n });\n }\n\n return headers;\n}\n\n},{\"../../promise\":19,\"../../util\":26,\"./xhr\":7}],5:[function(require,module,exports){\n/**\n * JSONP client.\n */\n\nvar _ = require('../../util');\nvar Promise = require('../../promise');\n\nmodule.exports = function (request) {\n return new Promise(function (resolve) {\n\n var callback = '_jsonp' + Math.random().toString(36).substr(2), response = {request: request, data: null}, handler, script;\n\n request.params[request.jsonp] = callback;\n request.cancel = function () {\n handler({type: 'cancel'});\n };\n\n script = document.createElement('script');\n script.src = _.url(request);\n script.type = 'text/javascript';\n script.async = true;\n\n window[callback] = function (data) {\n response.data = data;\n };\n\n handler = function (event) {\n\n if (event.type === 'load' && response.data !== null) {\n response.status = 200;\n } else if (event.type === 'error') {\n response.status = 404;\n } else {\n response.status = 0;\n }\n\n resolve(response);\n\n delete window[callback];\n document.body.removeChild(script);\n };\n\n script.onload = handler;\n script.onerror = handler;\n\n document.body.appendChild(script);\n });\n};\n\n},{\"../../promise\":19,\"../../util\":26}],6:[function(require,module,exports){\n/**\n * XDomain client (Internet Explorer).\n */\n\nvar _ = require('../../util');\nvar Promise = require('../../promise');\n\nmodule.exports = function (request) {\n return new Promise(function (resolve) {\n\n var xdr = new XDomainRequest(), response = {request: request}, handler;\n\n request.cancel = function () {\n xdr.abort();\n };\n\n xdr.open(request.method, _.url(request), true);\n\n handler = function (event) {\n\n response.data = xdr.responseText;\n response.status = xdr.status;\n response.statusText = xdr.statusText;\n\n resolve(response);\n };\n\n xdr.timeout = 0;\n xdr.onload = handler;\n xdr.onabort = handler;\n xdr.onerror = handler;\n xdr.ontimeout = function () {};\n xdr.onprogress = function () {};\n\n xdr.send(request.data);\n });\n};\n\n},{\"../../promise\":19,\"../../util\":26}],7:[function(require,module,exports){\n/**\n * XMLHttp client.\n */\n\nvar _ = require('../../util');\nvar Promise = require('../../promise');\n\nmodule.exports = function (request) {\n return new Promise(function (resolve) {\n\n var xhr = new XMLHttpRequest(), response = {request: request}, handler;\n\n request.cancel = function () {\n xhr.abort();\n };\n\n xhr.open(request.method, _.url(request), true);\n\n handler = function (event) {\n\n response.data = xhr.responseText;\n response.status = xhr.status;\n response.statusText = xhr.statusText;\n response.headers = xhr.getAllResponseHeaders();\n\n resolve(response);\n };\n\n xhr.timeout = 0;\n xhr.onload = handler;\n xhr.onabort = handler;\n xhr.onerror = handler;\n xhr.ontimeout = function () {};\n xhr.onprogress = function () {};\n\n if (_.isPlainObject(request.xhr)) {\n _.extend(xhr, request.xhr);\n }\n\n if (_.isPlainObject(request.upload)) {\n _.extend(xhr.upload, request.upload);\n }\n\n _.each(request.headers || {}, function (value, header) {\n xhr.setRequestHeader(header, value);\n });\n\n xhr.send(request.data);\n });\n};\n\n},{\"../../promise\":19,\"../../util\":26}],8:[function(require,module,exports){\n/**\n * CORS Interceptor.\n */\n\nvar _ = require('../util');\nvar xdrClient = require('./client/xdr');\nvar xhrCors = 'withCredentials' in new XMLHttpRequest();\nvar originUrl = _.url.parse(location.href);\n\nmodule.exports = {\n\n request: function (request) {\n\n if (request.crossOrigin === null) {\n request.crossOrigin = crossOrigin(request);\n }\n\n if (request.crossOrigin) {\n\n if (!xhrCors) {\n request.client = xdrClient;\n }\n\n request.emulateHTTP = false;\n }\n\n return request;\n }\n\n};\n\nfunction crossOrigin(request) {\n\n var requestUrl = _.url.parse(_.url(request));\n\n return (requestUrl.protocol !== originUrl.protocol || requestUrl.host !== originUrl.host);\n}\n\n},{\"../util\":26,\"./client/xdr\":6}],9:[function(require,module,exports){\n/**\n * Header Interceptor.\n */\n\nvar _ = require('../util');\n\nmodule.exports = {\n\n request: function (request) {\n\n request.method = request.method.toUpperCase();\n request.headers = _.extend({}, _.http.headers.common,\n !request.crossOrigin ? _.http.headers.custom : {},\n _.http.headers[request.method.toLowerCase()],\n request.headers\n );\n\n if (_.isPlainObject(request.data) && /^(GET|JSONP)$/i.test(request.method)) {\n _.extend(request.params, request.data);\n delete request.data;\n }\n\n return request;\n }\n\n};\n\n},{\"../util\":26}],10:[function(require,module,exports){\n/**\n * Service for sending network requests.\n */\n\nvar _ = require('../util');\nvar Client = require('./client');\nvar Promise = require('../promise');\nvar interceptor = require('./interceptor');\nvar jsonType = {'Content-Type': 'application/json'};\n\nfunction Http(url, options) {\n\n var client = Client, request, promise;\n\n Http.interceptors.forEach(function (handler) {\n client = interceptor(handler, this.$vm)(client);\n }, this);\n\n options = _.isObject(url) ? url : _.extend({url: url}, options);\n request = _.merge({}, Http.options, this.$options, options);\n promise = client(request).bind(this.$vm).then(function (response) {\n\n return response.ok ? response : Promise.reject(response);\n\n }, function (response) {\n\n if (response instanceof Error) {\n _.error(response);\n }\n\n return Promise.reject(response);\n });\n\n if (request.success) {\n promise.success(request.success);\n }\n\n if (request.error) {\n promise.error(request.error);\n }\n\n return promise;\n}\n\nHttp.options = {\n method: 'get',\n data: '',\n params: {},\n headers: {},\n xhr: null,\n upload: null,\n jsonp: 'callback',\n beforeSend: null,\n crossOrigin: null,\n emulateHTTP: false,\n emulateJSON: false,\n timeout: 0\n};\n\nHttp.interceptors = [\n require('./before'),\n require('./timeout'),\n require('./jsonp'),\n require('./method'),\n require('./mime'),\n require('./header'),\n require('./cors')\n];\n\nHttp.headers = {\n put: jsonType,\n post: jsonType,\n patch: jsonType,\n delete: jsonType,\n common: {'Accept': 'application/json, text/plain, */*'},\n custom: {'X-Requested-With': 'XMLHttpRequest'}\n};\n\n['get', 'put', 'post', 'patch', 'delete', 'jsonp'].forEach(function (method) {\n\n Http[method] = function (url, data, success, options) {\n\n if (_.isFunction(data)) {\n options = success;\n success = data;\n data = undefined;\n }\n\n if (_.isObject(success)) {\n options = success;\n success = undefined;\n }\n\n return this(url, _.extend({method: method, data: data, success: success}, options));\n };\n});\n\nmodule.exports = _.http = Http;\n\n},{\"../promise\":19,\"../util\":26,\"./before\":3,\"./client\":4,\"./cors\":8,\"./header\":9,\"./interceptor\":11,\"./jsonp\":12,\"./method\":13,\"./mime\":14,\"./timeout\":15}],11:[function(require,module,exports){\n/**\n * Interceptor factory.\n */\n\nvar _ = require('../util');\nvar Promise = require('../promise');\n\nmodule.exports = function (handler, vm) {\n\n return function (client) {\n\n if (_.isFunction(handler)) {\n handler = handler.call(vm, Promise);\n }\n\n return function (request) {\n\n if (_.isFunction(handler.request)) {\n request = handler.request.call(vm, request);\n }\n\n return when(request, function (request) {\n return when(client(request), function (response) {\n\n if (_.isFunction(handler.response)) {\n response = handler.response.call(vm, response);\n }\n\n return response;\n });\n });\n };\n };\n};\n\nfunction when(value, fulfilled, rejected) {\n\n var promise = Promise.resolve(value);\n\n if (arguments.length < 2) {\n return promise;\n }\n\n return promise.then(fulfilled, rejected);\n}\n\n},{\"../promise\":19,\"../util\":26}],12:[function(require,module,exports){\n/**\n * JSONP Interceptor.\n */\n\nvar jsonpClient = require('./client/jsonp');\n\nmodule.exports = {\n\n request: function (request) {\n\n if (request.method == 'JSONP') {\n request.client = jsonpClient;\n }\n\n return request;\n }\n\n};\n\n},{\"./client/jsonp\":5}],13:[function(require,module,exports){\n/**\n * HTTP method override Interceptor.\n */\n\nmodule.exports = {\n\n request: function (request) {\n\n if (request.emulateHTTP && /^(PUT|PATCH|DELETE)$/i.test(request.method)) {\n request.headers['X-HTTP-Method-Override'] = request.method;\n request.method = 'POST';\n }\n\n return request;\n }\n\n};\n\n},{}],14:[function(require,module,exports){\n/**\n * Mime Interceptor.\n */\n\nvar _ = require('../util');\n\nmodule.exports = {\n\n request: function (request) {\n\n if (request.emulateJSON && _.isPlainObject(request.data)) {\n request.headers['Content-Type'] = 'application/x-www-form-urlencoded';\n request.data = _.url.params(request.data);\n }\n\n if (_.isObject(request.data) && /FormData/i.test(request.data.toString())) {\n delete request.headers['Content-Type'];\n }\n\n if (_.isPlainObject(request.data)) {\n request.data = JSON.stringify(request.data);\n }\n\n return request;\n },\n\n response: function (response) {\n\n try {\n response.data = JSON.parse(response.data);\n } catch (e) {}\n\n return response;\n }\n\n};\n\n},{\"../util\":26}],15:[function(require,module,exports){\n/**\n * Timeout Interceptor.\n */\n\nmodule.exports = function () {\n\n var timeout;\n\n return {\n\n request: function (request) {\n\n if (request.timeout) {\n timeout = setTimeout(function () {\n request.cancel();\n }, request.timeout);\n }\n\n return request;\n },\n\n response: function (response) {\n\n clearTimeout(timeout);\n\n return response;\n }\n\n };\n};\n\n},{}],16:[function(require,module,exports){\n/**\n * Install plugin.\n */\n\nfunction install(Vue) {\n\n var _ = require('./util');\n\n _.config = Vue.config;\n _.warning = Vue.util.warn;\n _.nextTick = Vue.util.nextTick;\n\n Vue.url = require('./url');\n Vue.http = require('./http');\n Vue.resource = require('./resource');\n Vue.Promise = require('./promise');\n\n Object.defineProperties(Vue.prototype, {\n\n $url: {\n get: function () {\n return _.options(Vue.url, this, this.$options.url);\n }\n },\n\n $http: {\n get: function () {\n return _.options(Vue.http, this, this.$options.http);\n }\n },\n\n $resource: {\n get: function () {\n return Vue.resource.bind(this);\n }\n },\n\n $promise: {\n get: function () {\n return function (executor) {\n return new Vue.Promise(executor, this);\n }.bind(this);\n }\n }\n\n });\n}\n\nif (window.Vue) {\n Vue.use(install);\n}\n\nmodule.exports = install;\n\n},{\"./http\":10,\"./promise\":19,\"./resource\":20,\"./url\":21,\"./util\":26}],17:[function(require,module,exports){\n/**\n * Promises/A+ polyfill v1.1.4 (https://github.com/bramstein/promis)\n */\n\nvar _ = require('../util');\n\nvar RESOLVED = 0;\nvar REJECTED = 1;\nvar PENDING = 2;\n\nfunction Promise(executor) {\n\n this.state = PENDING;\n this.value = undefined;\n this.deferred = [];\n\n var promise = this;\n\n try {\n executor(function (x) {\n promise.resolve(x);\n }, function (r) {\n promise.reject(r);\n });\n } catch (e) {\n promise.reject(e);\n }\n}\n\nPromise.reject = function (r) {\n return new Promise(function (resolve, reject) {\n reject(r);\n });\n};\n\nPromise.resolve = function (x) {\n return new Promise(function (resolve, reject) {\n resolve(x);\n });\n};\n\nPromise.all = function all(iterable) {\n return new Promise(function (resolve, reject) {\n var count = 0, result = [];\n\n if (iterable.length === 0) {\n resolve(result);\n }\n\n function resolver(i) {\n return function (x) {\n result[i] = x;\n count += 1;\n\n if (count === iterable.length) {\n resolve(result);\n }\n };\n }\n\n for (var i = 0; i < iterable.length; i += 1) {\n Promise.resolve(iterable[i]).then(resolver(i), reject);\n }\n });\n};\n\nPromise.race = function race(iterable) {\n return new Promise(function (resolve, reject) {\n for (var i = 0; i < iterable.length; i += 1) {\n Promise.resolve(iterable[i]).then(resolve, reject);\n }\n });\n};\n\nvar p = Promise.prototype;\n\np.resolve = function resolve(x) {\n var promise = this;\n\n if (promise.state === PENDING) {\n if (x === promise) {\n throw new TypeError('Promise settled with itself.');\n }\n\n var called = false;\n\n try {\n var then = x && x['then'];\n\n if (x !== null && typeof x === 'object' && typeof then === 'function') {\n then.call(x, function (x) {\n if (!called) {\n promise.resolve(x);\n }\n called = true;\n\n }, function (r) {\n if (!called) {\n promise.reject(r);\n }\n called = true;\n });\n return;\n }\n } catch (e) {\n if (!called) {\n promise.reject(e);\n }\n return;\n }\n\n promise.state = RESOLVED;\n promise.value = x;\n promise.notify();\n }\n};\n\np.reject = function reject(reason) {\n var promise = this;\n\n if (promise.state === PENDING) {\n if (reason === promise) {\n throw new TypeError('Promise settled with itself.');\n }\n\n promise.state = REJECTED;\n promise.value = reason;\n promise.notify();\n }\n};\n\np.notify = function notify() {\n var promise = this;\n\n _.nextTick(function () {\n if (promise.state !== PENDING) {\n while (promise.deferred.length) {\n var deferred = promise.deferred.shift(),\n onResolved = deferred[0],\n onRejected = deferred[1],\n resolve = deferred[2],\n reject = deferred[3];\n\n try {\n if (promise.state === RESOLVED) {\n if (typeof onResolved === 'function') {\n resolve(onResolved.call(undefined, promise.value));\n } else {\n resolve(promise.value);\n }\n } else if (promise.state === REJECTED) {\n if (typeof onRejected === 'function') {\n resolve(onRejected.call(undefined, promise.value));\n } else {\n reject(promise.value);\n }\n }\n } catch (e) {\n reject(e);\n }\n }\n }\n });\n};\n\np.then = function then(onResolved, onRejected) {\n var promise = this;\n\n return new Promise(function (resolve, reject) {\n promise.deferred.push([onResolved, onRejected, resolve, reject]);\n promise.notify();\n });\n};\n\np.catch = function (onRejected) {\n return this.then(undefined, onRejected);\n};\n\nmodule.exports = Promise;\n\n},{\"../util\":26}],18:[function(require,module,exports){\n/**\n * URL Template v2.0.6 (https://github.com/bramstein/url-template)\n */\n\nexports.expand = function (url, params, variables) {\n\n var tmpl = this.parse(url), expanded = tmpl.expand(params);\n\n if (variables) {\n variables.push.apply(variables, tmpl.vars);\n }\n\n return expanded;\n};\n\nexports.parse = function (template) {\n\n var operators = ['+', '#', '.', '/', ';', '?', '&'], variables = [];\n\n return {\n vars: variables,\n expand: function (context) {\n return template.replace(/\\{([^\\{\\}]+)\\}|([^\\{\\}]+)/g, function (_, expression, literal) {\n if (expression) {\n\n var operator = null, values = [];\n\n if (operators.indexOf(expression.charAt(0)) !== -1) {\n operator = expression.charAt(0);\n expression = expression.substr(1);\n }\n\n expression.split(/,/g).forEach(function (variable) {\n var tmp = /([^:\\*]*)(?::(\\d+)|(\\*))?/.exec(variable);\n values.push.apply(values, exports.getValues(context, operator, tmp[1], tmp[2] || tmp[3]));\n variables.push(tmp[1]);\n });\n\n if (operator && operator !== '+') {\n\n var separator = ',';\n\n if (operator === '?') {\n separator = '&';\n } else if (operator !== '#') {\n separator = operator;\n }\n\n return (values.length !== 0 ? operator : '') + values.join(separator);\n } else {\n return values.join(',');\n }\n\n } else {\n return exports.encodeReserved(literal);\n }\n });\n }\n };\n};\n\nexports.getValues = function (context, operator, key, modifier) {\n\n var value = context[key], result = [];\n\n if (this.isDefined(value) && value !== '') {\n if (typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean') {\n value = value.toString();\n\n if (modifier && modifier !== '*') {\n value = value.substring(0, parseInt(modifier, 10));\n }\n\n result.push(this.encodeValue(operator, value, this.isKeyOperator(operator) ? key : null));\n } else {\n if (modifier === '*') {\n if (Array.isArray(value)) {\n value.filter(this.isDefined).forEach(function (value) {\n result.push(this.encodeValue(operator, value, this.isKeyOperator(operator) ? key : null));\n }, this);\n } else {\n Object.keys(value).forEach(function (k) {\n if (this.isDefined(value[k])) {\n result.push(this.encodeValue(operator, value[k], k));\n }\n }, this);\n }\n } else {\n var tmp = [];\n\n if (Array.isArray(value)) {\n value.filter(this.isDefined).forEach(function (value) {\n tmp.push(this.encodeValue(operator, value));\n }, this);\n } else {\n Object.keys(value).forEach(function (k) {\n if (this.isDefined(value[k])) {\n tmp.push(encodeURIComponent(k));\n tmp.push(this.encodeValue(operator, value[k].toString()));\n }\n }, this);\n }\n\n if (this.isKeyOperator(operator)) {\n result.push(encodeURIComponent(key) + '=' + tmp.join(','));\n } else if (tmp.length !== 0) {\n result.push(tmp.join(','));\n }\n }\n }\n } else {\n if (operator === ';') {\n result.push(encodeURIComponent(key));\n } else if (value === '' && (operator === '&' || operator === '?')) {\n result.push(encodeURIComponent(key) + '=');\n } else if (value === '') {\n result.push('');\n }\n }\n\n return result;\n};\n\nexports.isDefined = function (value) {\n return value !== undefined && value !== null;\n};\n\nexports.isKeyOperator = function (operator) {\n return operator === ';' || operator === '&' || operator === '?';\n};\n\nexports.encodeValue = function (operator, value, key) {\n\n value = (operator === '+' || operator === '#') ? this.encodeReserved(value) : encodeURIComponent(value);\n\n if (key) {\n return encodeURIComponent(key) + '=' + value;\n } else {\n return value;\n }\n};\n\nexports.encodeReserved = function (str) {\n return str.split(/(%[0-9A-Fa-f]{2})/g).map(function (part) {\n if (!/%[0-9A-Fa-f]/.test(part)) {\n part = encodeURI(part);\n }\n return part;\n }).join('');\n};\n\n},{}],19:[function(require,module,exports){\n/**\n * Promise adapter.\n */\n\nvar _ = require('./util');\nvar PromiseObj = window.Promise || require('./lib/promise');\n\nfunction Promise(executor, context) {\n\n if (executor instanceof PromiseObj) {\n this.promise = executor;\n } else {\n this.promise = new PromiseObj(executor.bind(context));\n }\n\n this.context = context;\n}\n\nPromise.all = function (iterable, context) {\n return new Promise(PromiseObj.all(iterable), context);\n};\n\nPromise.resolve = function (value, context) {\n return new Promise(PromiseObj.resolve(value), context);\n};\n\nPromise.reject = function (reason, context) {\n return new Promise(PromiseObj.reject(reason), context);\n};\n\nPromise.race = function (iterable, context) {\n return new Promise(PromiseObj.race(iterable), context);\n};\n\nvar p = Promise.prototype;\n\np.bind = function (context) {\n this.context = context;\n return this;\n};\n\np.then = function (fulfilled, rejected) {\n\n if (fulfilled && fulfilled.bind && this.context) {\n fulfilled = fulfilled.bind(this.context);\n }\n\n if (rejected && rejected.bind && this.context) {\n rejected = rejected.bind(this.context);\n }\n\n this.promise = this.promise.then(fulfilled, rejected);\n\n return this;\n};\n\np.catch = function (rejected) {\n\n if (rejected && rejected.bind && this.context) {\n rejected = rejected.bind(this.context);\n }\n\n this.promise = this.promise.catch(rejected);\n\n return this;\n};\n\np.finally = function (callback) {\n\n return this.then(function (value) {\n callback.call(this);\n return value;\n }, function (reason) {\n callback.call(this);\n return PromiseObj.reject(reason);\n }\n );\n};\n\np.success = function (callback) {\n\n _.warn('The `success` method has been deprecated. Use the `then` method instead.');\n\n return this.then(function (response) {\n return callback.call(this, response.data, response.status, response) || response;\n });\n};\n\np.error = function (callback) {\n\n _.warn('The `error` method has been deprecated. Use the `catch` method instead.');\n\n return this.catch(function (response) {\n return callback.call(this, response.data, response.status, response) || response;\n });\n};\n\np.always = function (callback) {\n\n _.warn('The `always` method has been deprecated. Use the `finally` method instead.');\n\n var cb = function (response) {\n return callback.call(this, response.data, response.status, response) || response;\n };\n\n return this.then(cb, cb);\n};\n\nmodule.exports = Promise;\n\n},{\"./lib/promise\":17,\"./util\":26}],20:[function(require,module,exports){\n/**\n * Service for interacting with RESTful services.\n */\n\nvar _ = require('./util');\n\nfunction Resource(url, params, actions, options) {\n\n var self = this, resource = {};\n\n actions = _.extend({},\n Resource.actions,\n actions\n );\n\n _.each(actions, function (action, name) {\n\n action = _.merge({url: url, params: params || {}}, options, action);\n\n resource[name] = function () {\n return (self.$http || _.http)(opts(action, arguments));\n };\n });\n\n return resource;\n}\n\nfunction opts(action, args) {\n\n var options = _.extend({}, action), params = {}, data, success, error;\n\n switch (args.length) {\n\n case 4:\n\n error = args[3];\n success = args[2];\n\n case 3:\n case 2:\n\n if (_.isFunction(args[1])) {\n\n if (_.isFunction(args[0])) {\n\n success = args[0];\n error = args[1];\n\n break;\n }\n\n success = args[1];\n error = args[2];\n\n } else {\n\n params = args[0];\n data = args[1];\n success = args[2];\n\n break;\n }\n\n case 1:\n\n if (_.isFunction(args[0])) {\n success = args[0];\n } else if (/^(POST|PUT|PATCH)$/i.test(options.method)) {\n data = args[0];\n } else {\n params = args[0];\n }\n\n break;\n\n case 0:\n\n break;\n\n default:\n\n throw 'Expected up to 4 arguments [params, data, success, error], got ' + args.length + ' arguments';\n }\n\n options.data = data;\n options.params = _.extend({}, options.params, params);\n\n if (success) {\n options.success = success;\n }\n\n if (error) {\n options.error = error;\n }\n\n return options;\n}\n\nResource.actions = {\n\n get: {method: 'GET'},\n save: {method: 'POST'},\n query: {method: 'GET'},\n update: {method: 'PUT'},\n remove: {method: 'DELETE'},\n delete: {method: 'DELETE'}\n\n};\n\nmodule.exports = _.resource = Resource;\n\n},{\"./util\":26}],21:[function(require,module,exports){\n/**\n * Service for URL templating.\n */\n\nvar _ = require('../util');\nvar ie = document.documentMode;\nvar el = document.createElement('a');\n\nfunction Url(url, params) {\n\n var options = url, transform;\n\n if (_.isString(url)) {\n options = {url: url, params: params};\n }\n\n options = _.merge({}, Url.options, this.$options, options);\n\n Url.transforms.forEach(function (handler) {\n transform = factory(handler, transform, this.$vm);\n }, this);\n\n return transform(options);\n};\n\n/**\n * Url options.\n */\n\nUrl.options = {\n url: '',\n root: null,\n params: {}\n};\n\n/**\n * Url transforms.\n */\n\nUrl.transforms = [\n require('./template'),\n require('./legacy'),\n require('./query'),\n require('./root')\n];\n\n/**\n * Encodes a Url parameter string.\n *\n * @param {Object} obj\n */\n\nUrl.params = function (obj) {\n\n var params = [], escape = encodeURIComponent;\n\n params.add = function (key, value) {\n\n if (_.isFunction(value)) {\n value = value();\n }\n\n if (value === null) {\n value = '';\n }\n\n this.push(escape(key) + '=' + escape(value));\n };\n\n serialize(params, obj);\n\n return params.join('&').replace(/%20/g, '+');\n};\n\n/**\n * Parse a URL and return its components.\n *\n * @param {String} url\n */\n\nUrl.parse = function (url) {\n\n if (ie) {\n el.href = url;\n url = el.href;\n }\n\n el.href = url;\n\n return {\n href: el.href,\n protocol: el.protocol ? el.protocol.replace(/:$/, '') : '',\n port: el.port,\n host: el.host,\n hostname: el.hostname,\n pathname: el.pathname.charAt(0) === '/' ? el.pathname : '/' + el.pathname,\n search: el.search ? el.search.replace(/^\\?/, '') : '',\n hash: el.hash ? el.hash.replace(/^#/, '') : ''\n };\n};\n\nfunction factory(handler, next, vm) {\n return function (options) {\n return handler.call(vm, options, next);\n };\n}\n\nfunction serialize(params, obj, scope) {\n\n var array = _.isArray(obj), plain = _.isPlainObject(obj), hash;\n\n _.each(obj, function (value, key) {\n\n hash = _.isObject(value) || _.isArray(value);\n\n if (scope) {\n key = scope + '[' + (plain || hash ? key : '') + ']';\n }\n\n if (!scope && array) {\n params.add(value.name, value.value);\n } else if (hash) {\n serialize(params, value, key);\n } else {\n params.add(key, value);\n }\n });\n}\n\nmodule.exports = _.url = Url;\n\n},{\"../util\":26,\"./legacy\":22,\"./query\":23,\"./root\":24,\"./template\":25}],22:[function(require,module,exports){\n/**\n * Legacy Transform.\n */\n\nvar _ = require('../util');\n\nmodule.exports = function (options, next) {\n\n var variables = [], url = next(options);\n\n url = url.replace(/(\\/?):([a-z]\\w*)/gi, function (match, slash, name) {\n\n _.warn('The `:' + name + '` parameter syntax has been deprecated. Use the `{' + name + '}` syntax instead.');\n\n if (options.params[name]) {\n variables.push(name);\n return slash + encodeUriSegment(options.params[name]);\n }\n\n return '';\n });\n\n variables.forEach(function (key) {\n delete options.params[key];\n });\n\n return url;\n};\n\nfunction encodeUriSegment(value) {\n\n return encodeUriQuery(value, true).\n replace(/%26/gi, '&').\n replace(/%3D/gi, '=').\n replace(/%2B/gi, '+');\n}\n\nfunction encodeUriQuery(value, spaces) {\n\n return encodeURIComponent(value).\n replace(/%40/gi, '@').\n replace(/%3A/gi, ':').\n replace(/%24/g, '$').\n replace(/%2C/gi, ',').\n replace(/%20/g, (spaces ? '%20' : '+'));\n}\n\n},{\"../util\":26}],23:[function(require,module,exports){\n/**\n * Query Parameter Transform.\n */\n\nvar _ = require('../util');\n\nmodule.exports = function (options, next) {\n\n var urlParams = Object.keys(_.url.options.params), query = {}, url = next(options);\n\n _.each(options.params, function (value, key) {\n if (urlParams.indexOf(key) === -1) {\n query[key] = value;\n }\n });\n\n query = _.url.params(query);\n\n if (query) {\n url += (url.indexOf('?') == -1 ? '?' : '&') + query;\n }\n\n return url;\n};\n\n},{\"../util\":26}],24:[function(require,module,exports){\n/**\n * Root Prefix Transform.\n */\n\nvar _ = require('../util');\n\nmodule.exports = function (options, next) {\n\n var url = next(options);\n\n if (_.isString(options.root) && !url.match(/^(https?:)?\\//)) {\n url = options.root + '/' + url;\n }\n\n return url;\n};\n\n},{\"../util\":26}],25:[function(require,module,exports){\n/**\n * URL Template (RFC 6570) Transform.\n */\n\nvar UrlTemplate = require('../lib/url-template');\n\nmodule.exports = function (options) {\n\n var variables = [], url = UrlTemplate.expand(options.url, options.params, variables);\n\n variables.forEach(function (key) {\n delete options.params[key];\n });\n\n return url;\n};\n\n},{\"../lib/url-template\":18}],26:[function(require,module,exports){\n/**\n * Utility functions.\n */\n\nvar _ = exports, array = [], console = window.console;\n\n_.warn = function (msg) {\n if (console && _.warning && (!_.config.silent || _.config.debug)) {\n console.warn('[VueResource warn]: ' + msg);\n }\n};\n\n_.error = function (msg) {\n if (console) {\n console.error(msg);\n }\n};\n\n_.trim = function (str) {\n return str.replace(/^\\s*|\\s*$/g, '');\n};\n\n_.toLower = function (str) {\n return str ? str.toLowerCase() : '';\n};\n\n_.isArray = Array.isArray;\n\n_.isString = function (val) {\n return typeof val === 'string';\n};\n\n_.isFunction = function (val) {\n return typeof val === 'function';\n};\n\n_.isObject = function (obj) {\n return obj !== null && typeof obj === 'object';\n};\n\n_.isPlainObject = function (obj) {\n return _.isObject(obj) && Object.getPrototypeOf(obj) == Object.prototype;\n};\n\n_.options = function (fn, obj, options) {\n\n options = options || {};\n\n if (_.isFunction(options)) {\n options = options.call(obj);\n }\n\n return _.merge(fn.bind({$vm: obj, $options: options}), fn, {$options: options});\n};\n\n_.each = function (obj, iterator) {\n\n var i, key;\n\n if (typeof obj.length == 'number') {\n for (i = 0; i < obj.length; i++) {\n iterator.call(obj[i], obj[i], i);\n }\n } else if (_.isObject(obj)) {\n for (key in obj) {\n if (obj.hasOwnProperty(key)) {\n iterator.call(obj[key], obj[key], key);\n }\n }\n }\n\n return obj;\n};\n\n_.defaults = function (target, source) {\n\n for (var key in source) {\n if (target[key] === undefined) {\n target[key] = source[key];\n }\n }\n\n return target;\n};\n\n_.extend = function (target) {\n\n var args = array.slice.call(arguments, 1);\n\n args.forEach(function (arg) {\n merge(target, arg);\n });\n\n return target;\n};\n\n_.merge = function (target) {\n\n var args = array.slice.call(arguments, 1);\n\n args.forEach(function (arg) {\n merge(target, arg, true);\n });\n\n return target;\n};\n\nfunction merge(target, source, deep) {\n for (var key in source) {\n if (deep && (_.isPlainObject(source[key]) || _.isArray(source[key]))) {\n if (_.isPlainObject(source[key]) && !_.isPlainObject(target[key])) {\n target[key] = {};\n }\n if (_.isArray(source[key]) && !_.isArray(target[key])) {\n target[key] = [];\n }\n merge(target[key], source[key], deep);\n } else if (source[key] !== undefined) {\n target[key] = source[key];\n }\n }\n}\n\n},{}],27:[function(require,module,exports){\n/*!\n * vue-router v0.7.13\n * (c) 2016 Evan You\n * Released under the MIT License.\n */\n(function (global, factory) {\n typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :\n typeof define === 'function' && define.amd ? define(factory) :\n global.VueRouter = factory();\n}(this, function () { 'use strict';\n\n var babelHelpers = {};\n\n babelHelpers.classCallCheck = function (instance, Constructor) {\n if (!(instance instanceof Constructor)) {\n throw new TypeError(\"Cannot call a class as a function\");\n }\n };\n function Target(path, matcher, delegate) {\n this.path = path;\n this.matcher = matcher;\n this.delegate = delegate;\n }\n\n Target.prototype = {\n to: function to(target, callback) {\n var delegate = this.delegate;\n\n if (delegate && delegate.willAddRoute) {\n target = delegate.willAddRoute(this.matcher.target, target);\n }\n\n this.matcher.add(this.path, target);\n\n if (callback) {\n if (callback.length === 0) {\n throw new Error(\"You must have an argument in the function passed to `to`\");\n }\n this.matcher.addChild(this.path, target, callback, this.delegate);\n }\n return this;\n }\n };\n\n function Matcher(target) {\n this.routes = {};\n this.children = {};\n this.target = target;\n }\n\n Matcher.prototype = {\n add: function add(path, handler) {\n this.routes[path] = handler;\n },\n\n addChild: function addChild(path, target, callback, delegate) {\n var matcher = new Matcher(target);\n this.children[path] = matcher;\n\n var match = generateMatch(path, matcher, delegate);\n\n if (delegate && delegate.contextEntered) {\n delegate.contextEntered(target, match);\n }\n\n callback(match);\n }\n };\n\n function generateMatch(startingPath, matcher, delegate) {\n return function (path, nestedCallback) {\n var fullPath = startingPath + path;\n\n if (nestedCallback) {\n nestedCallback(generateMatch(fullPath, matcher, delegate));\n } else {\n return new Target(startingPath + path, matcher, delegate);\n }\n };\n }\n\n function addRoute(routeArray, path, handler) {\n var len = 0;\n for (var i = 0, l = routeArray.length; i < l; i++) {\n len += routeArray[i].path.length;\n }\n\n path = path.substr(len);\n var route = { path: path, handler: handler };\n routeArray.push(route);\n }\n\n function eachRoute(baseRoute, matcher, callback, binding) {\n var routes = matcher.routes;\n\n for (var path in routes) {\n if (routes.hasOwnProperty(path)) {\n var routeArray = baseRoute.slice();\n addRoute(routeArray, path, routes[path]);\n\n if (matcher.children[path]) {\n eachRoute(routeArray, matcher.children[path], callback, binding);\n } else {\n callback.call(binding, routeArray);\n }\n }\n }\n }\n\n function map (callback, addRouteCallback) {\n var matcher = new Matcher();\n\n callback(generateMatch(\"\", matcher, this.delegate));\n\n eachRoute([], matcher, function (route) {\n if (addRouteCallback) {\n addRouteCallback(this, route);\n } else {\n this.add(route);\n }\n }, this);\n }\n\n var specials = ['/', '.', '*', '+', '?', '|', '(', ')', '[', ']', '{', '}', '\\\\'];\n\n var escapeRegex = new RegExp('(\\\\' + specials.join('|\\\\') + ')', 'g');\n\n var noWarning = false;\n function warn(msg) {\n if (!noWarning && typeof console !== 'undefined') {\n console.error('[vue-router] ' + msg);\n }\n }\n\n function tryDecode(uri, asComponent) {\n try {\n return asComponent ? decodeURIComponent(uri) : decodeURI(uri);\n } catch (e) {\n warn('malformed URI' + (asComponent ? ' component: ' : ': ') + uri);\n }\n }\n\n function isArray(test) {\n return Object.prototype.toString.call(test) === \"[object Array]\";\n }\n\n // A Segment represents a segment in the original route description.\n // Each Segment type provides an `eachChar` and `regex` method.\n //\n // The `eachChar` method invokes the callback with one or more character\n // specifications. A character specification consumes one or more input\n // characters.\n //\n // The `regex` method returns a regex fragment for the segment. If the\n // segment is a dynamic of star segment, the regex fragment also includes\n // a capture.\n //\n // A character specification contains:\n //\n // * `validChars`: a String with a list of all valid characters, or\n // * `invalidChars`: a String with a list of all invalid characters\n // * `repeat`: true if the character specification can repeat\n\n function StaticSegment(string) {\n this.string = string;\n }\n StaticSegment.prototype = {\n eachChar: function eachChar(callback) {\n var string = this.string,\n ch;\n\n for (var i = 0, l = string.length; i < l; i++) {\n ch = string.charAt(i);\n callback({ validChars: ch });\n }\n },\n\n regex: function regex() {\n return this.string.replace(escapeRegex, '\\\\$1');\n },\n\n generate: function generate() {\n return this.string;\n }\n };\n\n function DynamicSegment(name) {\n this.name = name;\n }\n DynamicSegment.prototype = {\n eachChar: function eachChar(callback) {\n callback({ invalidChars: \"/\", repeat: true });\n },\n\n regex: function regex() {\n return \"([^/]+)\";\n },\n\n generate: function generate(params) {\n var val = params[this.name];\n return val == null ? \":\" + this.name : val;\n }\n };\n\n function StarSegment(name) {\n this.name = name;\n }\n StarSegment.prototype = {\n eachChar: function eachChar(callback) {\n callback({ invalidChars: \"\", repeat: true });\n },\n\n regex: function regex() {\n return \"(.+)\";\n },\n\n generate: function generate(params) {\n var val = params[this.name];\n return val == null ? \":\" + this.name : val;\n }\n };\n\n function EpsilonSegment() {}\n EpsilonSegment.prototype = {\n eachChar: function eachChar() {},\n regex: function regex() {\n return \"\";\n },\n generate: function generate() {\n return \"\";\n }\n };\n\n function parse(route, names, specificity) {\n // normalize route as not starting with a \"/\". Recognition will\n // also normalize.\n if (route.charAt(0) === \"/\") {\n route = route.substr(1);\n }\n\n var segments = route.split(\"/\"),\n results = [];\n\n // A routes has specificity determined by the order that its different segments\n // appear in. This system mirrors how the magnitude of numbers written as strings\n // works.\n // Consider a number written as: \"abc\". An example would be \"200\". Any other number written\n // \"xyz\" will be smaller than \"abc\" so long as `a > z`. For instance, \"199\" is smaller\n // then \"200\", even though \"y\" and \"z\" (which are both 9) are larger than \"0\" (the value\n // of (`b` and `c`). This is because the leading symbol, \"2\", is larger than the other\n // leading symbol, \"1\".\n // The rule is that symbols to the left carry more weight than symbols to the right\n // when a number is written out as a string. In the above strings, the leading digit\n // represents how many 100's are in the number, and it carries more weight than the middle\n // number which represents how many 10's are in the number.\n // This system of number magnitude works well for route specificity, too. A route written as\n // `a/b/c` will be more specific than `x/y/z` as long as `a` is more specific than\n // `x`, irrespective of the other parts.\n // Because of this similarity, we assign each type of segment a number value written as a\n // string. We can find the specificity of compound routes by concatenating these strings\n // together, from left to right. After we have looped through all of the segments,\n // we convert the string to a number.\n specificity.val = '';\n\n for (var i = 0, l = segments.length; i < l; i++) {\n var segment = segments[i],\n match;\n\n if (match = segment.match(/^:([^\\/]+)$/)) {\n results.push(new DynamicSegment(match[1]));\n names.push(match[1]);\n specificity.val += '3';\n } else if (match = segment.match(/^\\*([^\\/]+)$/)) {\n results.push(new StarSegment(match[1]));\n specificity.val += '2';\n names.push(match[1]);\n } else if (segment === \"\") {\n results.push(new EpsilonSegment());\n specificity.val += '1';\n } else {\n results.push(new StaticSegment(segment));\n specificity.val += '4';\n }\n }\n\n specificity.val = +specificity.val;\n\n return results;\n }\n\n // A State has a character specification and (`charSpec`) and a list of possible\n // subsequent states (`nextStates`).\n //\n // If a State is an accepting state, it will also have several additional\n // properties:\n //\n // * `regex`: A regular expression that is used to extract parameters from paths\n // that reached this accepting state.\n // * `handlers`: Information on how to convert the list of captures into calls\n // to registered handlers with the specified parameters\n // * `types`: How many static, dynamic or star segments in this route. Used to\n // decide which route to use if multiple registered routes match a path.\n //\n // Currently, State is implemented naively by looping over `nextStates` and\n // comparing a character specification against a character. A more efficient\n // implementation would use a hash of keys pointing at one or more next states.\n\n function State(charSpec) {\n this.charSpec = charSpec;\n this.nextStates = [];\n }\n\n State.prototype = {\n get: function get(charSpec) {\n var nextStates = this.nextStates;\n\n for (var i = 0, l = nextStates.length; i < l; i++) {\n var child = nextStates[i];\n\n var isEqual = child.charSpec.validChars === charSpec.validChars;\n isEqual = isEqual && child.charSpec.invalidChars === charSpec.invalidChars;\n\n if (isEqual) {\n return child;\n }\n }\n },\n\n put: function put(charSpec) {\n var state;\n\n // If the character specification already exists in a child of the current\n // state, just return that state.\n if (state = this.get(charSpec)) {\n return state;\n }\n\n // Make a new state for the character spec\n state = new State(charSpec);\n\n // Insert the new state as a child of the current state\n this.nextStates.push(state);\n\n // If this character specification repeats, insert the new state as a child\n // of itself. Note that this will not trigger an infinite loop because each\n // transition during recognition consumes a character.\n if (charSpec.repeat) {\n state.nextStates.push(state);\n }\n\n // Return the new state\n return state;\n },\n\n // Find a list of child states matching the next character\n match: function match(ch) {\n // DEBUG \"Processing `\" + ch + \"`:\"\n var nextStates = this.nextStates,\n child,\n charSpec,\n chars;\n\n // DEBUG \" \" + debugState(this)\n var returned = [];\n\n for (var i = 0, l = nextStates.length; i < l; i++) {\n child = nextStates[i];\n\n charSpec = child.charSpec;\n\n if (typeof (chars = charSpec.validChars) !== 'undefined') {\n if (chars.indexOf(ch) !== -1) {\n returned.push(child);\n }\n } else if (typeof (chars = charSpec.invalidChars) !== 'undefined') {\n if (chars.indexOf(ch) === -1) {\n returned.push(child);\n }\n }\n }\n\n return returned;\n }\n\n /** IF DEBUG\n , debug: function() {\n var charSpec = this.charSpec,\n debug = \"[\",\n chars = charSpec.validChars || charSpec.invalidChars;\n if (charSpec.invalidChars) { debug += \"^\"; }\n debug += chars;\n debug += \"]\";\n if (charSpec.repeat) { debug += \"+\"; }\n return debug;\n }\n END IF **/\n };\n\n /** IF DEBUG\n function debug(log) {\n console.log(log);\n }\n\n function debugState(state) {\n return state.nextStates.map(function(n) {\n if (n.nextStates.length === 0) { return \"( \" + n.debug() + \" [accepting] )\"; }\n return \"( \" + n.debug() + \" \" + n.nextStates.map(function(s) { return s.debug() }).join(\" or \") + \" )\";\n }).join(\", \")\n }\n END IF **/\n\n // Sort the routes by specificity\n function sortSolutions(states) {\n return states.sort(function (a, b) {\n return b.specificity.val - a.specificity.val;\n });\n }\n\n function recognizeChar(states, ch) {\n var nextStates = [];\n\n for (var i = 0, l = states.length; i < l; i++) {\n var state = states[i];\n\n nextStates = nextStates.concat(state.match(ch));\n }\n\n return nextStates;\n }\n\n var oCreate = Object.create || function (proto) {\n function F() {}\n F.prototype = proto;\n return new F();\n };\n\n function RecognizeResults(queryParams) {\n this.queryParams = queryParams || {};\n }\n RecognizeResults.prototype = oCreate({\n splice: Array.prototype.splice,\n slice: Array.prototype.slice,\n push: Array.prototype.push,\n length: 0,\n queryParams: null\n });\n\n function findHandler(state, path, queryParams) {\n var handlers = state.handlers,\n regex = state.regex;\n var captures = path.match(regex),\n currentCapture = 1;\n var result = new RecognizeResults(queryParams);\n\n for (var i = 0, l = handlers.length; i < l; i++) {\n var handler = handlers[i],\n names = handler.names,\n params = {};\n\n for (var j = 0, m = names.length; j < m; j++) {\n params[names[j]] = captures[currentCapture++];\n }\n\n result.push({ handler: handler.handler, params: params, isDynamic: !!names.length });\n }\n\n return result;\n }\n\n function addSegment(currentState, segment) {\n segment.eachChar(function (ch) {\n var state;\n\n currentState = currentState.put(ch);\n });\n\n return currentState;\n }\n\n function decodeQueryParamPart(part) {\n // http://www.w3.org/TR/html401/interact/forms.html#h-17.13.4.1\n part = part.replace(/\\+/gm, '%20');\n return tryDecode(part, true);\n }\n\n // The main interface\n\n var RouteRecognizer = function RouteRecognizer() {\n this.rootState = new State();\n this.names = {};\n };\n\n RouteRecognizer.prototype = {\n add: function add(routes, options) {\n var currentState = this.rootState,\n regex = \"^\",\n specificity = {},\n handlers = [],\n allSegments = [],\n name;\n\n var isEmpty = true;\n\n for (var i = 0, l = routes.length; i < l; i++) {\n var route = routes[i],\n names = [];\n\n var segments = parse(route.path, names, specificity);\n\n allSegments = allSegments.concat(segments);\n\n for (var j = 0, m = segments.length; j < m; j++) {\n var segment = segments[j];\n\n if (segment instanceof EpsilonSegment) {\n continue;\n }\n\n isEmpty = false;\n\n // Add a \"/\" for the new segment\n currentState = currentState.put({ validChars: \"/\" });\n regex += \"/\";\n\n // Add a representation of the segment to the NFA and regex\n currentState = addSegment(currentState, segment);\n regex += segment.regex();\n }\n\n var handler = { handler: route.handler, names: names };\n handlers.push(handler);\n }\n\n if (isEmpty) {\n currentState = currentState.put({ validChars: \"/\" });\n regex += \"/\";\n }\n\n currentState.handlers = handlers;\n currentState.regex = new RegExp(regex + \"$\");\n currentState.specificity = specificity;\n\n if (name = options && options.as) {\n this.names[name] = {\n segments: allSegments,\n handlers: handlers\n };\n }\n },\n\n handlersFor: function handlersFor(name) {\n var route = this.names[name],\n result = [];\n if (!route) {\n throw new Error(\"There is no route named \" + name);\n }\n\n for (var i = 0, l = route.handlers.length; i < l; i++) {\n result.push(route.handlers[i]);\n }\n\n return result;\n },\n\n hasRoute: function hasRoute(name) {\n return !!this.names[name];\n },\n\n generate: function generate(name, params) {\n var route = this.names[name],\n output = \"\";\n if (!route) {\n throw new Error(\"There is no route named \" + name);\n }\n\n var segments = route.segments;\n\n for (var i = 0, l = segments.length; i < l; i++) {\n var segment = segments[i];\n\n if (segment instanceof EpsilonSegment) {\n continue;\n }\n\n output += \"/\";\n output += segment.generate(params);\n }\n\n if (output.charAt(0) !== '/') {\n output = '/' + output;\n }\n\n if (params && params.queryParams) {\n output += this.generateQueryString(params.queryParams);\n }\n\n return output;\n },\n\n generateQueryString: function generateQueryString(params) {\n var pairs = [];\n var keys = [];\n for (var key in params) {\n if (params.hasOwnProperty(key)) {\n keys.push(key);\n }\n }\n keys.sort();\n for (var i = 0, len = keys.length; i < len; i++) {\n key = keys[i];\n var value = params[key];\n if (value == null) {\n continue;\n }\n var pair = encodeURIComponent(key);\n if (isArray(value)) {\n for (var j = 0, l = value.length; j < l; j++) {\n var arrayPair = key + '[]' + '=' + encodeURIComponent(value[j]);\n pairs.push(arrayPair);\n }\n } else {\n pair += \"=\" + encodeURIComponent(value);\n pairs.push(pair);\n }\n }\n\n if (pairs.length === 0) {\n return '';\n }\n\n return \"?\" + pairs.join(\"&\");\n },\n\n parseQueryString: function parseQueryString(queryString) {\n var pairs = queryString.split(\"&\"),\n queryParams = {};\n for (var i = 0; i < pairs.length; i++) {\n var pair = pairs[i].split('='),\n key = decodeQueryParamPart(pair[0]),\n keyLength = key.length,\n isArray = false,\n value;\n if (pair.length === 1) {\n value = 'true';\n } else {\n //Handle arrays\n if (keyLength > 2 && key.slice(keyLength - 2) === '[]') {\n isArray = true;\n key = key.slice(0, keyLength - 2);\n if (!queryParams[key]) {\n queryParams[key] = [];\n }\n }\n value = pair[1] ? decodeQueryParamPart(pair[1]) : '';\n }\n if (isArray) {\n queryParams[key].push(value);\n } else {\n queryParams[key] = value;\n }\n }\n return queryParams;\n },\n\n recognize: function recognize(path, silent) {\n noWarning = silent;\n var states = [this.rootState],\n pathLen,\n i,\n l,\n queryStart,\n queryParams = {},\n isSlashDropped = false;\n\n queryStart = path.indexOf('?');\n if (queryStart !== -1) {\n var queryString = path.substr(queryStart + 1, path.length);\n path = path.substr(0, queryStart);\n if (queryString) {\n queryParams = this.parseQueryString(queryString);\n }\n }\n\n path = tryDecode(path);\n if (!path) return;\n\n // DEBUG GROUP path\n\n if (path.charAt(0) !== \"/\") {\n path = \"/\" + path;\n }\n\n pathLen = path.length;\n if (pathLen > 1 && path.charAt(pathLen - 1) === \"/\") {\n path = path.substr(0, pathLen - 1);\n isSlashDropped = true;\n }\n\n for (i = 0, l = path.length; i < l; i++) {\n states = recognizeChar(states, path.charAt(i));\n if (!states.length) {\n break;\n }\n }\n\n // END DEBUG GROUP\n\n var solutions = [];\n for (i = 0, l = states.length; i < l; i++) {\n if (states[i].handlers) {\n solutions.push(states[i]);\n }\n }\n\n states = sortSolutions(solutions);\n\n var state = solutions[0];\n\n if (state && state.handlers) {\n // if a trailing slash was dropped and a star segment is the last segment\n // specified, put the trailing slash back\n if (isSlashDropped && state.regex.source.slice(-5) === \"(.+)$\") {\n path = path + \"/\";\n }\n return findHandler(state, path, queryParams);\n }\n }\n };\n\n RouteRecognizer.prototype.map = map;\n\n var genQuery = RouteRecognizer.prototype.generateQueryString;\n\n // export default for holding the Vue reference\n var exports$1 = {};\n /**\n * Warn stuff.\n *\n * @param {String} msg\n */\n\n function warn$1(msg) {\n /* istanbul ignore next */\n if (typeof console !== 'undefined') {\n console.error('[vue-router] ' + msg);\n }\n }\n\n /**\n * Resolve a relative path.\n *\n * @param {String} base\n * @param {String} relative\n * @param {Boolean} append\n * @return {String}\n */\n\n function resolvePath(base, relative, append) {\n var query = base.match(/(\\?.*)$/);\n if (query) {\n query = query[1];\n base = base.slice(0, -query.length);\n }\n // a query!\n if (relative.charAt(0) === '?') {\n return base + relative;\n }\n var stack = base.split('/');\n // remove trailing segment if:\n // - not appending\n // - appending to trailing slash (last segment is empty)\n if (!append || !stack[stack.length - 1]) {\n stack.pop();\n }\n // resolve relative path\n var segments = relative.replace(/^\\//, '').split('/');\n for (var i = 0; i < segments.length; i++) {\n var segment = segments[i];\n if (segment === '.') {\n continue;\n } else if (segment === '..') {\n stack.pop();\n } else {\n stack.push(segment);\n }\n }\n // ensure leading slash\n if (stack[0] !== '') {\n stack.unshift('');\n }\n return stack.join('/');\n }\n\n /**\n * Forgiving check for a promise\n *\n * @param {Object} p\n * @return {Boolean}\n */\n\n function isPromise(p) {\n return p && typeof p.then === 'function';\n }\n\n /**\n * Retrive a route config field from a component instance\n * OR a component contructor.\n *\n * @param {Function|Vue} component\n * @param {String} name\n * @return {*}\n */\n\n function getRouteConfig(component, name) {\n var options = component && (component.$options || component.options);\n return options && options.route && options.route[name];\n }\n\n /**\n * Resolve an async component factory. Have to do a dirty\n * mock here because of Vue core's internal API depends on\n * an ID check.\n *\n * @param {Object} handler\n * @param {Function} cb\n */\n\n var resolver = undefined;\n\n function resolveAsyncComponent(handler, cb) {\n if (!resolver) {\n resolver = {\n resolve: exports$1.Vue.prototype._resolveComponent,\n $options: {\n components: {\n _: handler.component\n }\n }\n };\n } else {\n resolver.$options.components._ = handler.component;\n }\n resolver.resolve('_', function (Component) {\n handler.component = Component;\n cb(Component);\n });\n }\n\n /**\n * Map the dynamic segments in a path to params.\n *\n * @param {String} path\n * @param {Object} params\n * @param {Object} query\n */\n\n function mapParams(path, params, query) {\n if (params === undefined) params = {};\n\n path = path.replace(/:([^\\/]+)/g, function (_, key) {\n var val = params[key];\n /* istanbul ignore if */\n if (!val) {\n warn$1('param \"' + key + '\" not found when generating ' + 'path for \"' + path + '\" with params ' + JSON.stringify(params));\n }\n return val || '';\n });\n if (query) {\n path += genQuery(query);\n }\n return path;\n }\n\n var hashRE = /#.*$/;\n\n var HTML5History = (function () {\n function HTML5History(_ref) {\n var root = _ref.root;\n var onChange = _ref.onChange;\n babelHelpers.classCallCheck(this, HTML5History);\n\n if (root && root !== '/') {\n // make sure there's the starting slash\n if (root.charAt(0) !== '/') {\n root = '/' + root;\n }\n // remove trailing slash\n this.root = root.replace(/\\/$/, '');\n this.rootRE = new RegExp('^\\\\' + this.root);\n } else {\n this.root = null;\n }\n this.onChange = onChange;\n // check base tag\n var baseEl = document.querySelector('base');\n this.base = baseEl && baseEl.getAttribute('href');\n }\n\n HTML5History.prototype.start = function start() {\n var _this = this;\n\n this.listener = function (e) {\n var url = location.pathname + location.search;\n if (_this.root) {\n url = url.replace(_this.rootRE, '');\n }\n _this.onChange(url, e && e.state, location.hash);\n };\n window.addEventListener('popstate', this.listener);\n this.listener();\n };\n\n HTML5History.prototype.stop = function stop() {\n window.removeEventListener('popstate', this.listener);\n };\n\n HTML5History.prototype.go = function go(path, replace, append) {\n var url = this.formatPath(path, append);\n if (replace) {\n history.replaceState({}, '', url);\n } else {\n // record scroll position by replacing current state\n history.replaceState({\n pos: {\n x: window.pageXOffset,\n y: window.pageYOffset\n }\n }, '', location.href);\n // then push new state\n history.pushState({}, '', url);\n }\n var hashMatch = path.match(hashRE);\n var hash = hashMatch && hashMatch[0];\n path = url\n // strip hash so it doesn't mess up params\n .replace(hashRE, '')\n // remove root before matching\n .replace(this.rootRE, '');\n this.onChange(path, null, hash);\n };\n\n HTML5History.prototype.formatPath = function formatPath(path, append) {\n return path.charAt(0) === '/'\n // absolute path\n ? this.root ? this.root + '/' + path.replace(/^\\//, '') : path : resolvePath(this.base || location.pathname, path, append);\n };\n\n return HTML5History;\n })();\n\n var HashHistory = (function () {\n function HashHistory(_ref) {\n var hashbang = _ref.hashbang;\n var onChange = _ref.onChange;\n babelHelpers.classCallCheck(this, HashHistory);\n\n this.hashbang = hashbang;\n this.onChange = onChange;\n }\n\n HashHistory.prototype.start = function start() {\n var self = this;\n this.listener = function () {\n var path = location.hash;\n var raw = path.replace(/^#!?/, '');\n // always\n if (raw.charAt(0) !== '/') {\n raw = '/' + raw;\n }\n var formattedPath = self.formatPath(raw);\n if (formattedPath !== path) {\n location.replace(formattedPath);\n return;\n }\n // determine query\n // note it's possible to have queries in both the actual URL\n // and the hash fragment itself.\n var query = location.search && path.indexOf('?') > -1 ? '&' + location.search.slice(1) : location.search;\n self.onChange(path.replace(/^#!?/, '') + query);\n };\n window.addEventListener('hashchange', this.listener);\n this.listener();\n };\n\n HashHistory.prototype.stop = function stop() {\n window.removeEventListener('hashchange', this.listener);\n };\n\n HashHistory.prototype.go = function go(path, replace, append) {\n path = this.formatPath(path, append);\n if (replace) {\n location.replace(path);\n } else {\n location.hash = path;\n }\n };\n\n HashHistory.prototype.formatPath = function formatPath(path, append) {\n var isAbsoloute = path.charAt(0) === '/';\n var prefix = '#' + (this.hashbang ? '!' : '');\n return isAbsoloute ? prefix + path : prefix + resolvePath(location.hash.replace(/^#!?/, ''), path, append);\n };\n\n return HashHistory;\n })();\n\n var AbstractHistory = (function () {\n function AbstractHistory(_ref) {\n var onChange = _ref.onChange;\n babelHelpers.classCallCheck(this, AbstractHistory);\n\n this.onChange = onChange;\n this.currentPath = '/';\n }\n\n AbstractHistory.prototype.start = function start() {\n this.onChange('/');\n };\n\n AbstractHistory.prototype.stop = function stop() {\n // noop\n };\n\n AbstractHistory.prototype.go = function go(path, replace, append) {\n path = this.currentPath = this.formatPath(path, append);\n this.onChange(path);\n };\n\n AbstractHistory.prototype.formatPath = function formatPath(path, append) {\n return path.charAt(0) === '/' ? path : resolvePath(this.currentPath, path, append);\n };\n\n return AbstractHistory;\n })();\n\n /**\n * Determine the reusability of an existing router view.\n *\n * @param {Directive} view\n * @param {Object} handler\n * @param {Transition} transition\n */\n\n function canReuse(view, handler, transition) {\n var component = view.childVM;\n if (!component || !handler) {\n return false;\n }\n // important: check view.Component here because it may\n // have been changed in activate hook\n if (view.Component !== handler.component) {\n return false;\n }\n var canReuseFn = getRouteConfig(component, 'canReuse');\n return typeof canReuseFn === 'boolean' ? canReuseFn : canReuseFn ? canReuseFn.call(component, {\n to: transition.to,\n from: transition.from\n }) : true; // defaults to true\n }\n\n /**\n * Check if a component can deactivate.\n *\n * @param {Directive} view\n * @param {Transition} transition\n * @param {Function} next\n */\n\n function canDeactivate(view, transition, next) {\n var fromComponent = view.childVM;\n var hook = getRouteConfig(fromComponent, 'canDeactivate');\n if (!hook) {\n next();\n } else {\n transition.callHook(hook, fromComponent, next, {\n expectBoolean: true\n });\n }\n }\n\n /**\n * Check if a component can activate.\n *\n * @param {Object} handler\n * @param {Transition} transition\n * @param {Function} next\n */\n\n function canActivate(handler, transition, next) {\n resolveAsyncComponent(handler, function (Component) {\n // have to check due to async-ness\n if (transition.aborted) {\n return;\n }\n // determine if this component can be activated\n var hook = getRouteConfig(Component, 'canActivate');\n if (!hook) {\n next();\n } else {\n transition.callHook(hook, null, next, {\n expectBoolean: true\n });\n }\n });\n }\n\n /**\n * Call deactivate hooks for existing router-views.\n *\n * @param {Directive} view\n * @param {Transition} transition\n * @param {Function} next\n */\n\n function deactivate(view, transition, next) {\n var component = view.childVM;\n var hook = getRouteConfig(component, 'deactivate');\n if (!hook) {\n next();\n } else {\n transition.callHooks(hook, component, next);\n }\n }\n\n /**\n * Activate / switch component for a router-view.\n *\n * @param {Directive} view\n * @param {Transition} transition\n * @param {Number} depth\n * @param {Function} [cb]\n */\n\n function activate(view, transition, depth, cb, reuse) {\n var handler = transition.activateQueue[depth];\n if (!handler) {\n saveChildView(view);\n if (view._bound) {\n view.setComponent(null);\n }\n cb && cb();\n return;\n }\n\n var Component = view.Component = handler.component;\n var activateHook = getRouteConfig(Component, 'activate');\n var dataHook = getRouteConfig(Component, 'data');\n var waitForData = getRouteConfig(Component, 'waitForData');\n\n view.depth = depth;\n view.activated = false;\n\n var component = undefined;\n var loading = !!(dataHook && !waitForData);\n\n // \"reuse\" is a flag passed down when the parent view is\n // either reused via keep-alive or as a child of a kept-alive view.\n // of course we can only reuse if the current kept-alive instance\n // is of the correct type.\n reuse = reuse && view.childVM && view.childVM.constructor === Component;\n\n if (reuse) {\n // just reuse\n component = view.childVM;\n component.$loadingRouteData = loading;\n } else {\n saveChildView(view);\n\n // unbuild current component. this step also destroys\n // and removes all nested child views.\n view.unbuild(true);\n\n // build the new component. this will also create the\n // direct child view of the current one. it will register\n // itself as view.childView.\n component = view.build({\n _meta: {\n $loadingRouteData: loading\n },\n created: function created() {\n this._routerView = view;\n }\n });\n\n // handle keep-alive.\n // when a kept-alive child vm is restored, we need to\n // add its cached child views into the router's view list,\n // and also properly update current view's child view.\n if (view.keepAlive) {\n component.$loadingRouteData = loading;\n var cachedChildView = component._keepAliveRouterView;\n if (cachedChildView) {\n view.childView = cachedChildView;\n component._keepAliveRouterView = null;\n }\n }\n }\n\n // cleanup the component in case the transition is aborted\n // before the component is ever inserted.\n var cleanup = function cleanup() {\n component.$destroy();\n };\n\n // actually insert the component and trigger transition\n var insert = function insert() {\n if (reuse) {\n cb && cb();\n return;\n }\n var router = transition.router;\n if (router._rendered || router._transitionOnLoad) {\n view.transition(component);\n } else {\n // no transition on first render, manual transition\n /* istanbul ignore if */\n if (view.setCurrent) {\n // 0.12 compat\n view.setCurrent(component);\n } else {\n // 1.0\n view.childVM = component;\n }\n component.$before(view.anchor, null, false);\n }\n cb && cb();\n };\n\n var afterData = function afterData() {\n // activate the child view\n if (view.childView) {\n activate(view.childView, transition, depth + 1, null, reuse || view.keepAlive);\n }\n insert();\n };\n\n // called after activation hook is resolved\n var afterActivate = function afterActivate() {\n view.activated = true;\n if (dataHook && waitForData) {\n // wait until data loaded to insert\n loadData(component, transition, dataHook, afterData, cleanup);\n } else {\n // load data and insert at the same time\n if (dataHook) {\n loadData(component, transition, dataHook);\n }\n afterData();\n }\n };\n\n if (activateHook) {\n transition.callHooks(activateHook, component, afterActivate, {\n cleanup: cleanup,\n postActivate: true\n });\n } else {\n afterActivate();\n }\n }\n\n /**\n * Reuse a view, just reload data if necessary.\n *\n * @param {Directive} view\n * @param {Transition} transition\n */\n\n function reuse(view, transition) {\n var component = view.childVM;\n var dataHook = getRouteConfig(component, 'data');\n if (dataHook) {\n loadData(component, transition, dataHook);\n }\n }\n\n /**\n * Asynchronously load and apply data to component.\n *\n * @param {Vue} component\n * @param {Transition} transition\n * @param {Function} hook\n * @param {Function} cb\n * @param {Function} cleanup\n */\n\n function loadData(component, transition, hook, cb, cleanup) {\n component.$loadingRouteData = true;\n transition.callHooks(hook, component, function () {\n component.$loadingRouteData = false;\n component.$emit('route-data-loaded', component);\n cb && cb();\n }, {\n cleanup: cleanup,\n postActivate: true,\n processData: function processData(data) {\n // handle promise sugar syntax\n var promises = [];\n if (isPlainObject(data)) {\n Object.keys(data).forEach(function (key) {\n var val = data[key];\n if (isPromise(val)) {\n promises.push(val.then(function (resolvedVal) {\n component.$set(key, resolvedVal);\n }));\n } else {\n component.$set(key, val);\n }\n });\n }\n if (promises.length) {\n return promises[0].constructor.all(promises);\n }\n }\n });\n }\n\n /**\n * Save the child view for a kept-alive view so that\n * we can restore it when it is switched back to.\n *\n * @param {Directive} view\n */\n\n function saveChildView(view) {\n if (view.keepAlive && view.childVM && view.childView) {\n view.childVM._keepAliveRouterView = view.childView;\n }\n view.childView = null;\n }\n\n /**\n * Check plain object.\n *\n * @param {*} val\n */\n\n function isPlainObject(val) {\n return Object.prototype.toString.call(val) === '[object Object]';\n }\n\n /**\n * A RouteTransition object manages the pipeline of a\n * router-view switching process. This is also the object\n * passed into user route hooks.\n *\n * @param {Router} router\n * @param {Route} to\n * @param {Route} from\n */\n\n var RouteTransition = (function () {\n function RouteTransition(router, to, from) {\n babelHelpers.classCallCheck(this, RouteTransition);\n\n this.router = router;\n this.to = to;\n this.from = from;\n this.next = null;\n this.aborted = false;\n this.done = false;\n }\n\n /**\n * Abort current transition and return to previous location.\n */\n\n RouteTransition.prototype.abort = function abort() {\n if (!this.aborted) {\n this.aborted = true;\n // if the root path throws an error during validation\n // on initial load, it gets caught in an infinite loop.\n var abortingOnLoad = !this.from.path && this.to.path === '/';\n if (!abortingOnLoad) {\n this.router.replace(this.from.path || '/');\n }\n }\n };\n\n /**\n * Abort current transition and redirect to a new location.\n *\n * @param {String} path\n */\n\n RouteTransition.prototype.redirect = function redirect(path) {\n if (!this.aborted) {\n this.aborted = true;\n if (typeof path === 'string') {\n path = mapParams(path, this.to.params, this.to.query);\n } else {\n path.params = path.params || this.to.params;\n path.query = path.query || this.to.query;\n }\n this.router.replace(path);\n }\n };\n\n /**\n * A router view transition's pipeline can be described as\n * follows, assuming we are transitioning from an existing\n * chain [Component A, Component B] to a new\n * chain [Component A, Component C]:\n *\n * A A\n * | => |\n * B C\n *\n * 1. Reusablity phase:\n * -> canReuse(A, A)\n * -> canReuse(B, C)\n * -> determine new queues:\n * - deactivation: [B]\n * - activation: [C]\n *\n * 2. Validation phase:\n * -> canDeactivate(B)\n * -> canActivate(C)\n *\n * 3. Activation phase:\n * -> deactivate(B)\n * -> activate(C)\n *\n * Each of these steps can be asynchronous, and any\n * step can potentially abort the transition.\n *\n * @param {Function} cb\n */\n\n RouteTransition.prototype.start = function start(cb) {\n var transition = this;\n\n // determine the queue of views to deactivate\n var deactivateQueue = [];\n var view = this.router._rootView;\n while (view) {\n deactivateQueue.unshift(view);\n view = view.childView;\n }\n var reverseDeactivateQueue = deactivateQueue.slice().reverse();\n\n // determine the queue of route handlers to activate\n var activateQueue = this.activateQueue = toArray(this.to.matched).map(function (match) {\n return match.handler;\n });\n\n // 1. Reusability phase\n var i = undefined,\n reuseQueue = undefined;\n for (i = 0; i < reverseDeactivateQueue.length; i++) {\n if (!canReuse(reverseDeactivateQueue[i], activateQueue[i], transition)) {\n break;\n }\n }\n if (i > 0) {\n reuseQueue = reverseDeactivateQueue.slice(0, i);\n deactivateQueue = reverseDeactivateQueue.slice(i).reverse();\n activateQueue = activateQueue.slice(i);\n }\n\n // 2. Validation phase\n transition.runQueue(deactivateQueue, canDeactivate, function () {\n transition.runQueue(activateQueue, canActivate, function () {\n transition.runQueue(deactivateQueue, deactivate, function () {\n // 3. Activation phase\n\n // Update router current route\n transition.router._onTransitionValidated(transition);\n\n // trigger reuse for all reused views\n reuseQueue && reuseQueue.forEach(function (view) {\n return reuse(view, transition);\n });\n\n // the root of the chain that needs to be replaced\n // is the top-most non-reusable view.\n if (deactivateQueue.length) {\n var _view = deactivateQueue[deactivateQueue.length - 1];\n var depth = reuseQueue ? reuseQueue.length : 0;\n activate(_view, transition, depth, cb);\n } else {\n cb();\n }\n });\n });\n });\n };\n\n /**\n * Asynchronously and sequentially apply a function to a\n * queue.\n *\n * @param {Array} queue\n * @param {Function} fn\n * @param {Function} cb\n */\n\n RouteTransition.prototype.runQueue = function runQueue(queue, fn, cb) {\n var transition = this;\n step(0);\n function step(index) {\n if (index >= queue.length) {\n cb();\n } else {\n fn(queue[index], transition, function () {\n step(index + 1);\n });\n }\n }\n };\n\n /**\n * Call a user provided route transition hook and handle\n * the response (e.g. if the user returns a promise).\n *\n * If the user neither expects an argument nor returns a\n * promise, the hook is assumed to be synchronous.\n *\n * @param {Function} hook\n * @param {*} [context]\n * @param {Function} [cb]\n * @param {Object} [options]\n * - {Boolean} expectBoolean\n * - {Boolean} postActive\n * - {Function} processData\n * - {Function} cleanup\n */\n\n RouteTransition.prototype.callHook = function callHook(hook, context, cb) {\n var _ref = arguments.length <= 3 || arguments[3] === undefined ? {} : arguments[3];\n\n var _ref$expectBoolean = _ref.expectBoolean;\n var expectBoolean = _ref$expectBoolean === undefined ? false : _ref$expectBoolean;\n var _ref$postActivate = _ref.postActivate;\n var postActivate = _ref$postActivate === undefined ? false : _ref$postActivate;\n var processData = _ref.processData;\n var cleanup = _ref.cleanup;\n\n var transition = this;\n var nextCalled = false;\n\n // abort the transition\n var abort = function abort() {\n cleanup && cleanup();\n transition.abort();\n };\n\n // handle errors\n var onError = function onError(err) {\n postActivate ? next() : abort();\n if (err && !transition.router._suppress) {\n warn$1('Uncaught error during transition: ');\n throw err instanceof Error ? err : new Error(err);\n }\n };\n\n // since promise swallows errors, we have to\n // throw it in the next tick...\n var onPromiseError = function onPromiseError(err) {\n try {\n onError(err);\n } catch (e) {\n setTimeout(function () {\n throw e;\n }, 0);\n }\n };\n\n // advance the transition to the next step\n var next = function next() {\n if (nextCalled) {\n warn$1('transition.next() should be called only once.');\n return;\n }\n nextCalled = true;\n if (transition.aborted) {\n cleanup && cleanup();\n return;\n }\n cb && cb();\n };\n\n var nextWithBoolean = function nextWithBoolean(res) {\n if (typeof res === 'boolean') {\n res ? next() : abort();\n } else if (isPromise(res)) {\n res.then(function (ok) {\n ok ? next() : abort();\n }, onPromiseError);\n } else if (!hook.length) {\n next();\n }\n };\n\n var nextWithData = function nextWithData(data) {\n var res = undefined;\n try {\n res = processData(data);\n } catch (err) {\n return onError(err);\n }\n if (isPromise(res)) {\n res.then(next, onPromiseError);\n } else {\n next();\n }\n };\n\n // expose a clone of the transition object, so that each\n // hook gets a clean copy and prevent the user from\n // messing with the internals.\n var exposed = {\n to: transition.to,\n from: transition.from,\n abort: abort,\n next: processData ? nextWithData : next,\n redirect: function redirect() {\n transition.redirect.apply(transition, arguments);\n }\n };\n\n // actually call the hook\n var res = undefined;\n try {\n res = hook.call(context, exposed);\n } catch (err) {\n return onError(err);\n }\n\n if (expectBoolean) {\n // boolean hooks\n nextWithBoolean(res);\n } else if (isPromise(res)) {\n // promise\n if (processData) {\n res.then(nextWithData, onPromiseError);\n } else {\n res.then(next, onPromiseError);\n }\n } else if (processData && isPlainOjbect(res)) {\n // data promise sugar\n nextWithData(res);\n } else if (!hook.length) {\n next();\n }\n };\n\n /**\n * Call a single hook or an array of async hooks in series.\n *\n * @param {Array} hooks\n * @param {*} context\n * @param {Function} cb\n * @param {Object} [options]\n */\n\n RouteTransition.prototype.callHooks = function callHooks(hooks, context, cb, options) {\n var _this = this;\n\n if (Array.isArray(hooks)) {\n this.runQueue(hooks, function (hook, _, next) {\n if (!_this.aborted) {\n _this.callHook(hook, context, next, options);\n }\n }, cb);\n } else {\n this.callHook(hooks, context, cb, options);\n }\n };\n\n return RouteTransition;\n })();\n\n function isPlainOjbect(val) {\n return Object.prototype.toString.call(val) === '[object Object]';\n }\n\n function toArray(val) {\n return val ? Array.prototype.slice.call(val) : [];\n }\n\n var internalKeysRE = /^(component|subRoutes|fullPath)$/;\n\n /**\n * Route Context Object\n *\n * @param {String} path\n * @param {Router} router\n */\n\n var Route = function Route(path, router) {\n var _this = this;\n\n babelHelpers.classCallCheck(this, Route);\n\n var matched = router._recognizer.recognize(path);\n if (matched) {\n // copy all custom fields from route configs\n [].forEach.call(matched, function (match) {\n for (var key in match.handler) {\n if (!internalKeysRE.test(key)) {\n _this[key] = match.handler[key];\n }\n }\n });\n // set query and params\n this.query = matched.queryParams;\n this.params = [].reduce.call(matched, function (prev, cur) {\n if (cur.params) {\n for (var key in cur.params) {\n prev[key] = cur.params[key];\n }\n }\n return prev;\n }, {});\n }\n // expose path and router\n this.path = path;\n // for internal use\n this.matched = matched || router._notFoundHandler;\n // internal reference to router\n Object.defineProperty(this, 'router', {\n enumerable: false,\n value: router\n });\n // Important: freeze self to prevent observation\n Object.freeze(this);\n };\n\n function applyOverride (Vue) {\n var _Vue$util = Vue.util;\n var extend = _Vue$util.extend;\n var isArray = _Vue$util.isArray;\n var defineReactive = _Vue$util.defineReactive;\n\n // override Vue's init and destroy process to keep track of router instances\n var init = Vue.prototype._init;\n Vue.prototype._init = function (options) {\n options = options || {};\n var root = options._parent || options.parent || this;\n var router = root.$router;\n var route = root.$route;\n if (router) {\n // expose router\n this.$router = router;\n router._children.push(this);\n /* istanbul ignore if */\n if (this._defineMeta) {\n // 0.12\n this._defineMeta('$route', route);\n } else {\n // 1.0\n defineReactive(this, '$route', route);\n }\n }\n init.call(this, options);\n };\n\n var destroy = Vue.prototype._destroy;\n Vue.prototype._destroy = function () {\n if (!this._isBeingDestroyed && this.$router) {\n this.$router._children.$remove(this);\n }\n destroy.apply(this, arguments);\n };\n\n // 1.0 only: enable route mixins\n var strats = Vue.config.optionMergeStrategies;\n var hooksToMergeRE = /^(data|activate|deactivate)$/;\n\n if (strats) {\n strats.route = function (parentVal, childVal) {\n if (!childVal) return parentVal;\n if (!parentVal) return childVal;\n var ret = {};\n extend(ret, parentVal);\n for (var key in childVal) {\n var a = ret[key];\n var b = childVal[key];\n // for data, activate and deactivate, we need to merge them into\n // arrays similar to lifecycle hooks.\n if (a && hooksToMergeRE.test(key)) {\n ret[key] = (isArray(a) ? a : [a]).concat(b);\n } else {\n ret[key] = b;\n }\n }\n return ret;\n };\n }\n }\n\n function View (Vue) {\n\n var _ = Vue.util;\n var componentDef =\n // 0.12\n Vue.directive('_component') ||\n // 1.0\n Vue.internalDirectives.component;\n // extends the internal component directive\n var viewDef = _.extend({}, componentDef);\n\n // with some overrides\n _.extend(viewDef, {\n\n _isRouterView: true,\n\n bind: function bind() {\n var route = this.vm.$route;\n /* istanbul ignore if */\n if (!route) {\n warn$1(' can only be used inside a ' + 'router-enabled app.');\n return;\n }\n // force dynamic directive so v-component doesn't\n // attempt to build right now\n this._isDynamicLiteral = true;\n // finally, init by delegating to v-component\n componentDef.bind.call(this);\n\n // locate the parent view\n var parentView = undefined;\n var parent = this.vm;\n while (parent) {\n if (parent._routerView) {\n parentView = parent._routerView;\n break;\n }\n parent = parent.$parent;\n }\n if (parentView) {\n // register self as a child of the parent view,\n // instead of activating now. This is so that the\n // child's activate hook is called after the\n // parent's has resolved.\n this.parentView = parentView;\n parentView.childView = this;\n } else {\n // this is the root view!\n var router = route.router;\n router._rootView = this;\n }\n\n // handle late-rendered view\n // two possibilities:\n // 1. root view rendered after transition has been\n // validated;\n // 2. child view rendered after parent view has been\n // activated.\n var transition = route.router._currentTransition;\n if (!parentView && transition.done || parentView && parentView.activated) {\n var depth = parentView ? parentView.depth + 1 : 0;\n activate(this, transition, depth);\n }\n },\n\n unbind: function unbind() {\n if (this.parentView) {\n this.parentView.childView = null;\n }\n componentDef.unbind.call(this);\n }\n });\n\n Vue.elementDirective('router-view', viewDef);\n }\n\n var trailingSlashRE = /\\/$/;\n var regexEscapeRE = /[-.*+?^${}()|[\\]\\/\\\\]/g;\n var queryStringRE = /\\?.*$/;\n\n // install v-link, which provides navigation support for\n // HTML5 history mode\n function Link (Vue) {\n var _Vue$util = Vue.util;\n var _bind = _Vue$util.bind;\n var isObject = _Vue$util.isObject;\n var addClass = _Vue$util.addClass;\n var removeClass = _Vue$util.removeClass;\n\n var onPriority = Vue.directive('on').priority;\n var LINK_UPDATE = '__vue-router-link-update__';\n\n var activeId = 0;\n\n Vue.directive('link-active', {\n priority: 9999,\n bind: function bind() {\n var _this = this;\n\n var id = String(activeId++);\n // collect v-links contained within this element.\n // we need do this here before the parent-child relationship\n // gets messed up by terminal directives (if, for, components)\n var childLinks = this.el.querySelectorAll('[v-link]');\n for (var i = 0, l = childLinks.length; i < l; i++) {\n var link = childLinks[i];\n var existingId = link.getAttribute(LINK_UPDATE);\n var value = existingId ? existingId + ',' + id : id;\n // leave a mark on the link element which can be persisted\n // through fragment clones.\n link.setAttribute(LINK_UPDATE, value);\n }\n this.vm.$on(LINK_UPDATE, this.cb = function (link, path) {\n if (link.activeIds.indexOf(id) > -1) {\n link.updateClasses(path, _this.el);\n }\n });\n },\n unbind: function unbind() {\n this.vm.$off(LINK_UPDATE, this.cb);\n }\n });\n\n Vue.directive('link', {\n priority: onPriority - 2,\n\n bind: function bind() {\n var vm = this.vm;\n /* istanbul ignore if */\n if (!vm.$route) {\n warn$1('v-link can only be used inside a router-enabled app.');\n return;\n }\n this.router = vm.$route.router;\n // update things when the route changes\n this.unwatch = vm.$watch('$route', _bind(this.onRouteUpdate, this));\n // check v-link-active ids\n var activeIds = this.el.getAttribute(LINK_UPDATE);\n if (activeIds) {\n this.el.removeAttribute(LINK_UPDATE);\n this.activeIds = activeIds.split(',');\n }\n // no need to handle click if link expects to be opened\n // in a new window/tab.\n /* istanbul ignore if */\n if (this.el.tagName === 'A' && this.el.getAttribute('target') === '_blank') {\n return;\n }\n // handle click\n this.handler = _bind(this.onClick, this);\n this.el.addEventListener('click', this.handler);\n },\n\n update: function update(target) {\n this.target = target;\n if (isObject(target)) {\n this.append = target.append;\n this.exact = target.exact;\n this.prevActiveClass = this.activeClass;\n this.activeClass = target.activeClass;\n }\n this.onRouteUpdate(this.vm.$route);\n },\n\n onClick: function onClick(e) {\n // don't redirect with control keys\n /* istanbul ignore if */\n if (e.metaKey || e.ctrlKey || e.shiftKey) return;\n // don't redirect when preventDefault called\n /* istanbul ignore if */\n if (e.defaultPrevented) return;\n // don't redirect on right click\n /* istanbul ignore if */\n if (e.button !== 0) return;\n\n var target = this.target;\n if (target) {\n // v-link with expression, just go\n e.preventDefault();\n this.router.go(target);\n } else {\n // no expression, delegate for an inside\n var el = e.target;\n while (el.tagName !== 'A' && el !== this.el) {\n el = el.parentNode;\n }\n if (el.tagName === 'A' && sameOrigin(el)) {\n e.preventDefault();\n var path = el.pathname;\n if (this.router.history.root) {\n path = path.replace(this.router.history.rootRE, '');\n }\n this.router.go({\n path: path,\n replace: target && target.replace,\n append: target && target.append\n });\n }\n }\n },\n\n onRouteUpdate: function onRouteUpdate(route) {\n // router.stringifyPath is dependent on current route\n // and needs to be called again whenver route changes.\n var newPath = this.router.stringifyPath(this.target);\n if (this.path !== newPath) {\n this.path = newPath;\n this.updateActiveMatch();\n this.updateHref();\n }\n if (this.activeIds) {\n this.vm.$emit(LINK_UPDATE, this, route.path);\n } else {\n this.updateClasses(route.path, this.el);\n }\n },\n\n updateActiveMatch: function updateActiveMatch() {\n this.activeRE = this.path && !this.exact ? new RegExp('^' + this.path.replace(/\\/$/, '').replace(queryStringRE, '').replace(regexEscapeRE, '\\\\$&') + '(\\\\/|$)') : null;\n },\n\n updateHref: function updateHref() {\n if (this.el.tagName !== 'A') {\n return;\n }\n var path = this.path;\n var router = this.router;\n var isAbsolute = path.charAt(0) === '/';\n // do not format non-hash relative paths\n var href = path && (router.mode === 'hash' || isAbsolute) ? router.history.formatPath(path, this.append) : path;\n if (href) {\n this.el.href = href;\n } else {\n this.el.removeAttribute('href');\n }\n },\n\n updateClasses: function updateClasses(path, el) {\n var activeClass = this.activeClass || this.router._linkActiveClass;\n // clear old class\n if (this.prevActiveClass && this.prevActiveClass !== activeClass) {\n toggleClasses(el, this.prevActiveClass, removeClass);\n }\n // remove query string before matching\n var dest = this.path.replace(queryStringRE, '');\n path = path.replace(queryStringRE, '');\n // add new class\n if (this.exact) {\n if (dest === path ||\n // also allow additional trailing slash\n dest.charAt(dest.length - 1) !== '/' && dest === path.replace(trailingSlashRE, '')) {\n toggleClasses(el, activeClass, addClass);\n } else {\n toggleClasses(el, activeClass, removeClass);\n }\n } else {\n if (this.activeRE && this.activeRE.test(path)) {\n toggleClasses(el, activeClass, addClass);\n } else {\n toggleClasses(el, activeClass, removeClass);\n }\n }\n },\n\n unbind: function unbind() {\n this.el.removeEventListener('click', this.handler);\n this.unwatch && this.unwatch();\n }\n });\n\n function sameOrigin(link) {\n return link.protocol === location.protocol && link.hostname === location.hostname && link.port === location.port;\n }\n\n // this function is copied from v-bind:class implementation until\n // we properly expose it...\n function toggleClasses(el, key, fn) {\n key = key.trim();\n if (key.indexOf(' ') === -1) {\n fn(el, key);\n return;\n }\n var keys = key.split(/\\s+/);\n for (var i = 0, l = keys.length; i < l; i++) {\n fn(el, keys[i]);\n }\n }\n }\n\n var historyBackends = {\n abstract: AbstractHistory,\n hash: HashHistory,\n html5: HTML5History\n };\n\n // late bind during install\n var Vue = undefined;\n\n /**\n * Router constructor\n *\n * @param {Object} [options]\n */\n\n var Router = (function () {\n function Router() {\n var _this = this;\n\n var _ref = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];\n\n var _ref$hashbang = _ref.hashbang;\n var hashbang = _ref$hashbang === undefined ? true : _ref$hashbang;\n var _ref$abstract = _ref.abstract;\n var abstract = _ref$abstract === undefined ? false : _ref$abstract;\n var _ref$history = _ref.history;\n var history = _ref$history === undefined ? false : _ref$history;\n var _ref$saveScrollPosition = _ref.saveScrollPosition;\n var saveScrollPosition = _ref$saveScrollPosition === undefined ? false : _ref$saveScrollPosition;\n var _ref$transitionOnLoad = _ref.transitionOnLoad;\n var transitionOnLoad = _ref$transitionOnLoad === undefined ? false : _ref$transitionOnLoad;\n var _ref$suppressTransitionError = _ref.suppressTransitionError;\n var suppressTransitionError = _ref$suppressTransitionError === undefined ? false : _ref$suppressTransitionError;\n var _ref$root = _ref.root;\n var root = _ref$root === undefined ? null : _ref$root;\n var _ref$linkActiveClass = _ref.linkActiveClass;\n var linkActiveClass = _ref$linkActiveClass === undefined ? 'v-link-active' : _ref$linkActiveClass;\n babelHelpers.classCallCheck(this, Router);\n\n /* istanbul ignore if */\n if (!Router.installed) {\n throw new Error('Please install the Router with Vue.use() before ' + 'creating an instance.');\n }\n\n // Vue instances\n this.app = null;\n this._children = [];\n\n // route recognizer\n this._recognizer = new RouteRecognizer();\n this._guardRecognizer = new RouteRecognizer();\n\n // state\n this._started = false;\n this._startCb = null;\n this._currentRoute = {};\n this._currentTransition = null;\n this._previousTransition = null;\n this._notFoundHandler = null;\n this._notFoundRedirect = null;\n this._beforeEachHooks = [];\n this._afterEachHooks = [];\n\n // trigger transition on initial render?\n this._rendered = false;\n this._transitionOnLoad = transitionOnLoad;\n\n // history mode\n this._root = root;\n this._abstract = abstract;\n this._hashbang = hashbang;\n\n // check if HTML5 history is available\n var hasPushState = typeof window !== 'undefined' && window.history && window.history.pushState;\n this._history = history && hasPushState;\n this._historyFallback = history && !hasPushState;\n\n // create history object\n var inBrowser = Vue.util.inBrowser;\n this.mode = !inBrowser || this._abstract ? 'abstract' : this._history ? 'html5' : 'hash';\n\n var History = historyBackends[this.mode];\n this.history = new History({\n root: root,\n hashbang: this._hashbang,\n onChange: function onChange(path, state, anchor) {\n _this._match(path, state, anchor);\n }\n });\n\n // other options\n this._saveScrollPosition = saveScrollPosition;\n this._linkActiveClass = linkActiveClass;\n this._suppress = suppressTransitionError;\n }\n\n /**\n * Allow directly passing components to a route\n * definition.\n *\n * @param {String} path\n * @param {Object} handler\n */\n\n // API ===================================================\n\n /**\n * Register a map of top-level paths.\n *\n * @param {Object} map\n */\n\n Router.prototype.map = function map(_map) {\n for (var route in _map) {\n this.on(route, _map[route]);\n }\n return this;\n };\n\n /**\n * Register a single root-level path\n *\n * @param {String} rootPath\n * @param {Object} handler\n * - {String} component\n * - {Object} [subRoutes]\n * - {Boolean} [forceRefresh]\n * - {Function} [before]\n * - {Function} [after]\n */\n\n Router.prototype.on = function on(rootPath, handler) {\n if (rootPath === '*') {\n this._notFound(handler);\n } else {\n this._addRoute(rootPath, handler, []);\n }\n return this;\n };\n\n /**\n * Set redirects.\n *\n * @param {Object} map\n */\n\n Router.prototype.redirect = function redirect(map) {\n for (var path in map) {\n this._addRedirect(path, map[path]);\n }\n return this;\n };\n\n /**\n * Set aliases.\n *\n * @param {Object} map\n */\n\n Router.prototype.alias = function alias(map) {\n for (var path in map) {\n this._addAlias(path, map[path]);\n }\n return this;\n };\n\n /**\n * Set global before hook.\n *\n * @param {Function} fn\n */\n\n Router.prototype.beforeEach = function beforeEach(fn) {\n this._beforeEachHooks.push(fn);\n return this;\n };\n\n /**\n * Set global after hook.\n *\n * @param {Function} fn\n */\n\n Router.prototype.afterEach = function afterEach(fn) {\n this._afterEachHooks.push(fn);\n return this;\n };\n\n /**\n * Navigate to a given path.\n * The path can be an object describing a named path in\n * the format of { name: '...', params: {}, query: {}}\n * The path is assumed to be already decoded, and will\n * be resolved against root (if provided)\n *\n * @param {String|Object} path\n * @param {Boolean} [replace]\n */\n\n Router.prototype.go = function go(path) {\n var replace = false;\n var append = false;\n if (Vue.util.isObject(path)) {\n replace = path.replace;\n append = path.append;\n }\n path = this.stringifyPath(path);\n if (path) {\n this.history.go(path, replace, append);\n }\n };\n\n /**\n * Short hand for replacing current path\n *\n * @param {String} path\n */\n\n Router.prototype.replace = function replace(path) {\n if (typeof path === 'string') {\n path = { path: path };\n }\n path.replace = true;\n this.go(path);\n };\n\n /**\n * Start the router.\n *\n * @param {VueConstructor} App\n * @param {String|Element} container\n * @param {Function} [cb]\n */\n\n Router.prototype.start = function start(App, container, cb) {\n /* istanbul ignore if */\n if (this._started) {\n warn$1('already started.');\n return;\n }\n this._started = true;\n this._startCb = cb;\n if (!this.app) {\n /* istanbul ignore if */\n if (!App || !container) {\n throw new Error('Must start vue-router with a component and a ' + 'root container.');\n }\n /* istanbul ignore if */\n if (App instanceof Vue) {\n throw new Error('Must start vue-router with a component, not a ' + 'Vue instance.');\n }\n this._appContainer = container;\n var Ctor = this._appConstructor = typeof App === 'function' ? App : Vue.extend(App);\n // give it a name for better debugging\n Ctor.options.name = Ctor.options.name || 'RouterApp';\n }\n\n // handle history fallback in browsers that do not\n // support HTML5 history API\n if (this._historyFallback) {\n var _location = window.location;\n var _history = new HTML5History({ root: this._root });\n var path = _history.root ? _location.pathname.replace(_history.rootRE, '') : _location.pathname;\n if (path && path !== '/') {\n _location.assign((_history.root || '') + '/' + this.history.formatPath(path) + _location.search);\n return;\n }\n }\n\n this.history.start();\n };\n\n /**\n * Stop listening to route changes.\n */\n\n Router.prototype.stop = function stop() {\n this.history.stop();\n this._started = false;\n };\n\n /**\n * Normalize named route object / string paths into\n * a string.\n *\n * @param {Object|String|Number} path\n * @return {String}\n */\n\n Router.prototype.stringifyPath = function stringifyPath(path) {\n var generatedPath = '';\n if (path && typeof path === 'object') {\n if (path.name) {\n var extend = Vue.util.extend;\n var currentParams = this._currentTransition && this._currentTransition.to.params;\n var targetParams = path.params || {};\n var params = currentParams ? extend(extend({}, currentParams), targetParams) : targetParams;\n generatedPath = encodeURI(this._recognizer.generate(path.name, params));\n } else if (path.path) {\n generatedPath = encodeURI(path.path);\n }\n if (path.query) {\n // note: the generated query string is pre-URL-encoded by the recognizer\n var query = this._recognizer.generateQueryString(path.query);\n if (generatedPath.indexOf('?') > -1) {\n generatedPath += '&' + query.slice(1);\n } else {\n generatedPath += query;\n }\n }\n } else {\n generatedPath = encodeURI(path ? path + '' : '');\n }\n return generatedPath;\n };\n\n // Internal methods ======================================\n\n /**\n * Add a route containing a list of segments to the internal\n * route recognizer. Will be called recursively to add all\n * possible sub-routes.\n *\n * @param {String} path\n * @param {Object} handler\n * @param {Array} segments\n */\n\n Router.prototype._addRoute = function _addRoute(path, handler, segments) {\n guardComponent(path, handler);\n handler.path = path;\n handler.fullPath = (segments.reduce(function (path, segment) {\n return path + segment.path;\n }, '') + path).replace('//', '/');\n segments.push({\n path: path,\n handler: handler\n });\n this._recognizer.add(segments, {\n as: handler.name\n });\n // add sub routes\n if (handler.subRoutes) {\n for (var subPath in handler.subRoutes) {\n // recursively walk all sub routes\n this._addRoute(subPath, handler.subRoutes[subPath],\n // pass a copy in recursion to avoid mutating\n // across branches\n segments.slice());\n }\n }\n };\n\n /**\n * Set the notFound route handler.\n *\n * @param {Object} handler\n */\n\n Router.prototype._notFound = function _notFound(handler) {\n guardComponent('*', handler);\n this._notFoundHandler = [{ handler: handler }];\n };\n\n /**\n * Add a redirect record.\n *\n * @param {String} path\n * @param {String} redirectPath\n */\n\n Router.prototype._addRedirect = function _addRedirect(path, redirectPath) {\n if (path === '*') {\n this._notFoundRedirect = redirectPath;\n } else {\n this._addGuard(path, redirectPath, this.replace);\n }\n };\n\n /**\n * Add an alias record.\n *\n * @param {String} path\n * @param {String} aliasPath\n */\n\n Router.prototype._addAlias = function _addAlias(path, aliasPath) {\n this._addGuard(path, aliasPath, this._match);\n };\n\n /**\n * Add a path guard.\n *\n * @param {String} path\n * @param {String} mappedPath\n * @param {Function} handler\n */\n\n Router.prototype._addGuard = function _addGuard(path, mappedPath, _handler) {\n var _this2 = this;\n\n this._guardRecognizer.add([{\n path: path,\n handler: function handler(match, query) {\n var realPath = mapParams(mappedPath, match.params, query);\n _handler.call(_this2, realPath);\n }\n }]);\n };\n\n /**\n * Check if a path matches any redirect records.\n *\n * @param {String} path\n * @return {Boolean} - if true, will skip normal match.\n */\n\n Router.prototype._checkGuard = function _checkGuard(path) {\n var matched = this._guardRecognizer.recognize(path, true);\n if (matched) {\n matched[0].handler(matched[0], matched.queryParams);\n return true;\n } else if (this._notFoundRedirect) {\n matched = this._recognizer.recognize(path);\n if (!matched) {\n this.replace(this._notFoundRedirect);\n return true;\n }\n }\n };\n\n /**\n * Match a URL path and set the route context on vm,\n * triggering view updates.\n *\n * @param {String} path\n * @param {Object} [state]\n * @param {String} [anchor]\n */\n\n Router.prototype._match = function _match(path, state, anchor) {\n var _this3 = this;\n\n if (this._checkGuard(path)) {\n return;\n }\n\n var currentRoute = this._currentRoute;\n var currentTransition = this._currentTransition;\n\n if (currentTransition) {\n if (currentTransition.to.path === path) {\n // do nothing if we have an active transition going to the same path\n return;\n } else if (currentRoute.path === path) {\n // We are going to the same path, but we also have an ongoing but\n // not-yet-validated transition. Abort that transition and reset to\n // prev transition.\n currentTransition.aborted = true;\n this._currentTransition = this._prevTransition;\n return;\n } else {\n // going to a totally different path. abort ongoing transition.\n currentTransition.aborted = true;\n }\n }\n\n // construct new route and transition context\n var route = new Route(path, this);\n var transition = new RouteTransition(this, route, currentRoute);\n\n // current transition is updated right now.\n // however, current route will only be updated after the transition has\n // been validated.\n this._prevTransition = currentTransition;\n this._currentTransition = transition;\n\n if (!this.app) {\n (function () {\n // initial render\n var router = _this3;\n _this3.app = new _this3._appConstructor({\n el: _this3._appContainer,\n created: function created() {\n this.$router = router;\n },\n _meta: {\n $route: route\n }\n });\n })();\n }\n\n // check global before hook\n var beforeHooks = this._beforeEachHooks;\n var startTransition = function startTransition() {\n transition.start(function () {\n _this3._postTransition(route, state, anchor);\n });\n };\n\n if (beforeHooks.length) {\n transition.runQueue(beforeHooks, function (hook, _, next) {\n if (transition === _this3._currentTransition) {\n transition.callHook(hook, null, next, {\n expectBoolean: true\n });\n }\n }, startTransition);\n } else {\n startTransition();\n }\n\n if (!this._rendered && this._startCb) {\n this._startCb.call(null);\n }\n\n // HACK:\n // set rendered to true after the transition start, so\n // that components that are acitvated synchronously know\n // whether it is the initial render.\n this._rendered = true;\n };\n\n /**\n * Set current to the new transition.\n * This is called by the transition object when the\n * validation of a route has succeeded.\n *\n * @param {Transition} transition\n */\n\n Router.prototype._onTransitionValidated = function _onTransitionValidated(transition) {\n // set current route\n var route = this._currentRoute = transition.to;\n // update route context for all children\n if (this.app.$route !== route) {\n this.app.$route = route;\n this._children.forEach(function (child) {\n child.$route = route;\n });\n }\n // call global after hook\n if (this._afterEachHooks.length) {\n this._afterEachHooks.forEach(function (hook) {\n return hook.call(null, {\n to: transition.to,\n from: transition.from\n });\n });\n }\n this._currentTransition.done = true;\n };\n\n /**\n * Handle stuff after the transition.\n *\n * @param {Route} route\n * @param {Object} [state]\n * @param {String} [anchor]\n */\n\n Router.prototype._postTransition = function _postTransition(route, state, anchor) {\n // handle scroll positions\n // saved scroll positions take priority\n // then we check if the path has an anchor\n var pos = state && state.pos;\n if (pos && this._saveScrollPosition) {\n Vue.nextTick(function () {\n window.scrollTo(pos.x, pos.y);\n });\n } else if (anchor) {\n Vue.nextTick(function () {\n var el = document.getElementById(anchor.slice(1));\n if (el) {\n window.scrollTo(window.scrollX, el.offsetTop);\n }\n });\n }\n };\n\n return Router;\n })();\n\n function guardComponent(path, handler) {\n var comp = handler.component;\n if (Vue.util.isPlainObject(comp)) {\n comp = handler.component = Vue.extend(comp);\n }\n /* istanbul ignore if */\n if (typeof comp !== 'function') {\n handler.component = null;\n warn$1('invalid component for route \"' + path + '\".');\n }\n }\n\n /* Installation */\n\n Router.installed = false;\n\n /**\n * Installation interface.\n * Install the necessary directives.\n */\n\n Router.install = function (externalVue) {\n /* istanbul ignore if */\n if (Router.installed) {\n warn$1('already installed.');\n return;\n }\n Vue = externalVue;\n applyOverride(Vue);\n View(Vue);\n Link(Vue);\n exports$1.Vue = Vue;\n Router.installed = true;\n };\n\n // auto install\n /* istanbul ignore if */\n if (typeof window !== 'undefined' && window.Vue) {\n window.Vue.use(Router);\n }\n\n return Router;\n\n}));\n},{}],28:[function(require,module,exports){\n(function (process,global){\n/*!\n * Vue.js v1.0.22\n * (c) 2016 Evan You\n * Released under the MIT License.\n */\n'use strict';\n\nfunction set(obj, key, val) {\n if (hasOwn(obj, key)) {\n obj[key] = val;\n return;\n }\n if (obj._isVue) {\n set(obj._data, key, val);\n return;\n }\n var ob = obj.__ob__;\n if (!ob) {\n obj[key] = val;\n return;\n }\n ob.convert(key, val);\n ob.dep.notify();\n if (ob.vms) {\n var i = ob.vms.length;\n while (i--) {\n var vm = ob.vms[i];\n vm._proxy(key);\n vm._digest();\n }\n }\n return val;\n}\n\n/**\n * Delete a property and trigger change if necessary.\n *\n * @param {Object} obj\n * @param {String} key\n */\n\nfunction del(obj, key) {\n if (!hasOwn(obj, key)) {\n return;\n }\n delete obj[key];\n var ob = obj.__ob__;\n if (!ob) {\n if (obj._isVue) {\n delete obj._data[key];\n obj._digest();\n }\n return;\n }\n ob.dep.notify();\n if (ob.vms) {\n var i = ob.vms.length;\n while (i--) {\n var vm = ob.vms[i];\n vm._unproxy(key);\n vm._digest();\n }\n }\n}\n\nvar hasOwnProperty = Object.prototype.hasOwnProperty;\n/**\n * Check whether the object has the property.\n *\n * @param {Object} obj\n * @param {String} key\n * @return {Boolean}\n */\n\nfunction hasOwn(obj, key) {\n return hasOwnProperty.call(obj, key);\n}\n\n/**\n * Check if an expression is a literal value.\n *\n * @param {String} exp\n * @return {Boolean}\n */\n\nvar literalValueRE = /^\\s?(true|false|-?[\\d\\.]+|'[^']*'|\"[^\"]*\")\\s?$/;\n\nfunction isLiteral(exp) {\n return literalValueRE.test(exp);\n}\n\n/**\n * Check if a string starts with $ or _\n *\n * @param {String} str\n * @return {Boolean}\n */\n\nfunction isReserved(str) {\n var c = (str + '').charCodeAt(0);\n return c === 0x24 || c === 0x5F;\n}\n\n/**\n * Guard text output, make sure undefined outputs\n * empty string\n *\n * @param {*} value\n * @return {String}\n */\n\nfunction _toString(value) {\n return value == null ? '' : value.toString();\n}\n\n/**\n * Check and convert possible numeric strings to numbers\n * before setting back to data\n *\n * @param {*} value\n * @return {*|Number}\n */\n\nfunction toNumber(value) {\n if (typeof value !== 'string') {\n return value;\n } else {\n var parsed = Number(value);\n return isNaN(parsed) ? value : parsed;\n }\n}\n\n/**\n * Convert string boolean literals into real booleans.\n *\n * @param {*} value\n * @return {*|Boolean}\n */\n\nfunction toBoolean(value) {\n return value === 'true' ? true : value === 'false' ? false : value;\n}\n\n/**\n * Strip quotes from a string\n *\n * @param {String} str\n * @return {String | false}\n */\n\nfunction stripQuotes(str) {\n var a = str.charCodeAt(0);\n var b = str.charCodeAt(str.length - 1);\n return a === b && (a === 0x22 || a === 0x27) ? str.slice(1, -1) : str;\n}\n\n/**\n * Camelize a hyphen-delmited string.\n *\n * @param {String} str\n * @return {String}\n */\n\nvar camelizeRE = /-(\\w)/g;\n\nfunction camelize(str) {\n return str.replace(camelizeRE, toUpper);\n}\n\nfunction toUpper(_, c) {\n return c ? c.toUpperCase() : '';\n}\n\n/**\n * Hyphenate a camelCase string.\n *\n * @param {String} str\n * @return {String}\n */\n\nvar hyphenateRE = /([a-z\\d])([A-Z])/g;\n\nfunction hyphenate(str) {\n return str.replace(hyphenateRE, '$1-$2').toLowerCase();\n}\n\n/**\n * Converts hyphen/underscore/slash delimitered names into\n * camelized classNames.\n *\n * e.g. my-component => MyComponent\n * some_else => SomeElse\n * some/comp => SomeComp\n *\n * @param {String} str\n * @return {String}\n */\n\nvar classifyRE = /(?:^|[-_\\/])(\\w)/g;\n\nfunction classify(str) {\n return str.replace(classifyRE, toUpper);\n}\n\n/**\n * Simple bind, faster than native\n *\n * @param {Function} fn\n * @param {Object} ctx\n * @return {Function}\n */\n\nfunction bind(fn, ctx) {\n return function (a) {\n var l = arguments.length;\n return l ? l > 1 ? fn.apply(ctx, arguments) : fn.call(ctx, a) : fn.call(ctx);\n };\n}\n\n/**\n * Convert an Array-like object to a real Array.\n *\n * @param {Array-like} list\n * @param {Number} [start] - start index\n * @return {Array}\n */\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 *\n * @param {Object} to\n * @param {Object} from\n */\n\nfunction extend(to, from) {\n var keys = Object.keys(from);\n var i = keys.length;\n while (i--) {\n to[keys[i]] = from[keys[i]];\n }\n return to;\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 *\n * @param {*} obj\n * @return {Boolean}\n */\n\nfunction isObject(obj) {\n return obj !== null && typeof obj === 'object';\n}\n\n/**\n * Strict object type check. Only returns true\n * for plain JavaScript objects.\n *\n * @param {*} obj\n * @return {Boolean}\n */\n\nvar toString = Object.prototype.toString;\nvar OBJECT_STRING = '[object Object]';\n\nfunction isPlainObject(obj) {\n return toString.call(obj) === OBJECT_STRING;\n}\n\n/**\n * Array type check.\n *\n * @param {*} obj\n * @return {Boolean}\n */\n\nvar isArray = Array.isArray;\n\n/**\n * Define a property.\n *\n * @param {Object} obj\n * @param {String} key\n * @param {*} val\n * @param {Boolean} [enumerable]\n */\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 * Debounce a function so it only gets called after the\n * input stops arriving after the given wait period.\n *\n * @param {Function} func\n * @param {Number} wait\n * @return {Function} - the debounced function\n */\n\nfunction _debounce(func, wait) {\n var timeout, args, context, timestamp, result;\n var later = function later() {\n var last = Date.now() - timestamp;\n if (last < wait && last >= 0) {\n timeout = setTimeout(later, wait - last);\n } else {\n timeout = null;\n result = func.apply(context, args);\n if (!timeout) context = args = null;\n }\n };\n return function () {\n context = this;\n args = arguments;\n timestamp = Date.now();\n if (!timeout) {\n timeout = setTimeout(later, wait);\n }\n return result;\n };\n}\n\n/**\n * Manual indexOf because it's slightly faster than\n * native.\n *\n * @param {Array} arr\n * @param {*} obj\n */\n\nfunction indexOf(arr, obj) {\n var i = arr.length;\n while (i--) {\n if (arr[i] === obj) return i;\n }\n return -1;\n}\n\n/**\n * Make a cancellable version of an async callback.\n *\n * @param {Function} fn\n * @return {Function}\n */\n\nfunction cancellable(fn) {\n var cb = function cb() {\n if (!cb.cancelled) {\n return fn.apply(this, arguments);\n }\n };\n cb.cancel = function () {\n cb.cancelled = true;\n };\n return cb;\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 *\n * @param {*} a\n * @param {*} b\n * @return {Boolean}\n */\n\nfunction looseEqual(a, b) {\n /* eslint-disable eqeqeq */\n return a == b || (isObject(a) && isObject(b) ? JSON.stringify(a) === JSON.stringify(b) : false);\n /* eslint-enable eqeqeq */\n}\n\nvar hasProto = ('__proto__' in {});\n\n// Browser environment sniffing\nvar inBrowser = typeof window !== 'undefined' && Object.prototype.toString.call(window) !== '[object Object]';\n\n// detect devtools\nvar devtools = inBrowser && window.__VUE_DEVTOOLS_GLOBAL_HOOK__;\n\n// UA sniffing for working around browser-specific quirks\nvar UA = inBrowser && window.navigator.userAgent.toLowerCase();\nvar isIE9 = UA && UA.indexOf('msie 9.0') > 0;\nvar isAndroid = UA && UA.indexOf('android') > 0;\nvar isIos = UA && /(iphone|ipad|ipod|ios)/i.test(UA);\nvar isWechat = UA && UA.indexOf('micromessenger') > 0;\n\nvar transitionProp = undefined;\nvar transitionEndEvent = undefined;\nvar animationProp = undefined;\nvar animationEndEvent = undefined;\n\n// Transition property/event sniffing\nif (inBrowser && !isIE9) {\n var isWebkitTrans = window.ontransitionend === undefined && window.onwebkittransitionend !== undefined;\n var isWebkitAnim = window.onanimationend === undefined && window.onwebkitanimationend !== undefined;\n transitionProp = isWebkitTrans ? 'WebkitTransition' : 'transition';\n transitionEndEvent = isWebkitTrans ? 'webkitTransitionEnd' : 'transitionend';\n animationProp = isWebkitAnim ? 'WebkitAnimation' : 'animation';\n animationEndEvent = isWebkitAnim ? 'webkitAnimationEnd' : 'animationend';\n}\n\n/**\n * Defer a task to execute it asynchronously. Ideally this\n * should be executed as a microtask, so we leverage\n * MutationObserver if it's available, and fallback to\n * setTimeout(0).\n *\n * @param {Function} cb\n * @param {Object} ctx\n */\n\nvar nextTick = (function () {\n var callbacks = [];\n var pending = false;\n var timerFunc;\n function nextTickHandler() {\n pending = false;\n var copies = callbacks.slice(0);\n callbacks = [];\n for (var i = 0; i < copies.length; i++) {\n copies[i]();\n }\n }\n\n /* istanbul ignore if */\n if (typeof MutationObserver !== 'undefined' && !(isWechat && isIos)) {\n var counter = 1;\n var observer = new MutationObserver(nextTickHandler);\n var textNode = document.createTextNode(counter);\n observer.observe(textNode, {\n characterData: true\n });\n timerFunc = function () {\n counter = (counter + 1) % 2;\n textNode.data = counter;\n };\n } else {\n // webpack attempts to inject a shim for setImmediate\n // if it is used as a global, so we have to work around that to\n // avoid bundling unnecessary code.\n var context = inBrowser ? window : typeof global !== 'undefined' ? global : {};\n timerFunc = context.setImmediate || setTimeout;\n }\n return function (cb, ctx) {\n var func = ctx ? function () {\n cb.call(ctx);\n } : cb;\n callbacks.push(func);\n if (pending) return;\n pending = true;\n timerFunc(nextTickHandler, 0);\n };\n})();\n\nvar _Set = undefined;\n/* istanbul ignore if */\nif (typeof Set !== 'undefined' && Set.toString().match(/native code/)) {\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 = function () {\n this.set = Object.create(null);\n };\n _Set.prototype.has = function (key) {\n return this.set[key] !== undefined;\n };\n _Set.prototype.add = function (key) {\n this.set[key] = 1;\n };\n _Set.prototype.clear = function () {\n this.set = Object.create(null);\n };\n}\n\nfunction Cache(limit) {\n this.size = 0;\n this.limit = limit;\n this.head = this.tail = undefined;\n this._keymap = Object.create(null);\n}\n\nvar p = Cache.prototype;\n\n/**\n * Put into the cache associated with .\n * Returns the entry which was removed to make room for\n * the new entry. Otherwise undefined is returned.\n * (i.e. if there was enough room already).\n *\n * @param {String} key\n * @param {*} value\n * @return {Entry|undefined}\n */\n\np.put = function (key, value) {\n var removed;\n if (this.size === this.limit) {\n removed = this.shift();\n }\n\n var entry = this.get(key, true);\n if (!entry) {\n entry = {\n key: key\n };\n this._keymap[key] = entry;\n if (this.tail) {\n this.tail.newer = entry;\n entry.older = this.tail;\n } else {\n this.head = entry;\n }\n this.tail = entry;\n this.size++;\n }\n entry.value = value;\n\n return removed;\n};\n\n/**\n * Purge the least recently used (oldest) entry from the\n * cache. Returns the removed entry or undefined if the\n * cache was empty.\n */\n\np.shift = function () {\n var entry = this.head;\n if (entry) {\n this.head = this.head.newer;\n this.head.older = undefined;\n entry.newer = entry.older = undefined;\n this._keymap[entry.key] = undefined;\n this.size--;\n }\n return entry;\n};\n\n/**\n * Get and register recent use of . Returns the value\n * associated with or undefined if not in cache.\n *\n * @param {String} key\n * @param {Boolean} returnEntry\n * @return {Entry|*}\n */\n\np.get = function (key, returnEntry) {\n var entry = this._keymap[key];\n if (entry === undefined) return;\n if (entry === this.tail) {\n return returnEntry ? entry : entry.value;\n }\n // HEAD--------------TAIL\n // <.older .newer>\n // <--- add direction --\n // A B C E\n if (entry.newer) {\n if (entry === this.head) {\n this.head = entry.newer;\n }\n entry.newer.older = entry.older; // C <-- E.\n }\n if (entry.older) {\n entry.older.newer = entry.newer; // C. --> E\n }\n entry.newer = undefined; // D --x\n entry.older = this.tail; // D. --> E\n if (this.tail) {\n this.tail.newer = entry; // E. <-- D\n }\n this.tail = entry;\n return returnEntry ? entry : entry.value;\n};\n\nvar cache$1 = new Cache(1000);\nvar filterTokenRE = /[^\\s'\"]+|'[^']*'|\"[^\"]*\"/g;\nvar reservedArgRE = /^in$|^-?\\d+/;\n\n/**\n * Parser state\n */\n\nvar str;\nvar dir;\nvar c;\nvar prev;\nvar i;\nvar l;\nvar lastFilterIndex;\nvar inSingle;\nvar inDouble;\nvar curly;\nvar square;\nvar paren;\n/**\n * Push a filter to the current directive object\n */\n\nfunction pushFilter() {\n var exp = str.slice(lastFilterIndex, i).trim();\n var filter;\n if (exp) {\n filter = {};\n var tokens = exp.match(filterTokenRE);\n filter.name = tokens[0];\n if (tokens.length > 1) {\n filter.args = tokens.slice(1).map(processFilterArg);\n }\n }\n if (filter) {\n (dir.filters = dir.filters || []).push(filter);\n }\n lastFilterIndex = i + 1;\n}\n\n/**\n * Check if an argument is dynamic and strip quotes.\n *\n * @param {String} arg\n * @return {Object}\n */\n\nfunction processFilterArg(arg) {\n if (reservedArgRE.test(arg)) {\n return {\n value: toNumber(arg),\n dynamic: false\n };\n } else {\n var stripped = stripQuotes(arg);\n var dynamic = stripped === arg;\n return {\n value: dynamic ? arg : stripped,\n dynamic: dynamic\n };\n }\n}\n\n/**\n * Parse a directive value and extract the expression\n * and its filters into a descriptor.\n *\n * Example:\n *\n * \"a + 1 | uppercase\" will yield:\n * {\n * expression: 'a + 1',\n * filters: [\n * { name: 'uppercase', args: null }\n * ]\n * }\n *\n * @param {String} s\n * @return {Object}\n */\n\nfunction parseDirective(s) {\n var hit = cache$1.get(s);\n if (hit) {\n return hit;\n }\n\n // reset parser state\n str = s;\n inSingle = inDouble = false;\n curly = square = paren = 0;\n lastFilterIndex = 0;\n dir = {};\n\n for (i = 0, l = str.length; i < l; i++) {\n prev = c;\n c = str.charCodeAt(i);\n if (inSingle) {\n // check single quote\n if (c === 0x27 && prev !== 0x5C) inSingle = !inSingle;\n } else if (inDouble) {\n // check double quote\n if (c === 0x22 && prev !== 0x5C) inDouble = !inDouble;\n } else if (c === 0x7C && // pipe\n str.charCodeAt(i + 1) !== 0x7C && str.charCodeAt(i - 1) !== 0x7C) {\n if (dir.expression == null) {\n // first filter, end of expression\n lastFilterIndex = i + 1;\n dir.expression = str.slice(0, i).trim();\n } else {\n // already has filter\n pushFilter();\n }\n } else {\n switch (c) {\n case 0x22:\n inDouble = true;break; // \"\n case 0x27:\n inSingle = true;break; // '\n case 0x28:\n paren++;break; // (\n case 0x29:\n paren--;break; // )\n case 0x5B:\n square++;break; // [\n case 0x5D:\n square--;break; // ]\n case 0x7B:\n curly++;break; // {\n case 0x7D:\n curly--;break; // }\n }\n }\n }\n\n if (dir.expression == null) {\n dir.expression = str.slice(0, i).trim();\n } else if (lastFilterIndex !== 0) {\n pushFilter();\n }\n\n cache$1.put(s, dir);\n return dir;\n}\n\nvar directive = Object.freeze({\n parseDirective: parseDirective\n});\n\nvar regexEscapeRE = /[-.*+?^${}()|[\\]\\/\\\\]/g;\nvar cache = undefined;\nvar tagRE = undefined;\nvar htmlRE = undefined;\n/**\n * Escape a string so it can be used in a RegExp\n * constructor.\n *\n * @param {String} str\n */\n\nfunction escapeRegex(str) {\n return str.replace(regexEscapeRE, '\\\\$&');\n}\n\nfunction compileRegex() {\n var open = escapeRegex(config.delimiters[0]);\n var close = escapeRegex(config.delimiters[1]);\n var unsafeOpen = escapeRegex(config.unsafeDelimiters[0]);\n var unsafeClose = escapeRegex(config.unsafeDelimiters[1]);\n tagRE = new RegExp(unsafeOpen + '((?:.|\\\\n)+?)' + unsafeClose + '|' + open + '((?:.|\\\\n)+?)' + close, 'g');\n htmlRE = new RegExp('^' + unsafeOpen + '.*' + unsafeClose + '$');\n // reset cache\n cache = new Cache(1000);\n}\n\n/**\n * Parse a template text string into an array of tokens.\n *\n * @param {String} text\n * @return {Array | null}\n * - {String} type\n * - {String} value\n * - {Boolean} [html]\n * - {Boolean} [oneTime]\n */\n\nfunction parseText(text) {\n if (!cache) {\n compileRegex();\n }\n var hit = cache.get(text);\n if (hit) {\n return hit;\n }\n if (!tagRE.test(text)) {\n return null;\n }\n var tokens = [];\n var lastIndex = tagRE.lastIndex = 0;\n var match, index, html, value, first, oneTime;\n /* eslint-disable no-cond-assign */\n while (match = tagRE.exec(text)) {\n /* eslint-enable no-cond-assign */\n index = match.index;\n // push text token\n if (index > lastIndex) {\n tokens.push({\n value: text.slice(lastIndex, index)\n });\n }\n // tag token\n html = htmlRE.test(match[0]);\n value = html ? match[1] : match[2];\n first = value.charCodeAt(0);\n oneTime = first === 42; // *\n value = oneTime ? value.slice(1) : value;\n tokens.push({\n tag: true,\n value: value.trim(),\n html: html,\n oneTime: oneTime\n });\n lastIndex = index + match[0].length;\n }\n if (lastIndex < text.length) {\n tokens.push({\n value: text.slice(lastIndex)\n });\n }\n cache.put(text, tokens);\n return tokens;\n}\n\n/**\n * Format a list of tokens into an expression.\n * e.g. tokens parsed from 'a {{b}} c' can be serialized\n * into one single expression as '\"a \" + b + \" c\"'.\n *\n * @param {Array} tokens\n * @param {Vue} [vm]\n * @return {String}\n */\n\nfunction tokensToExp(tokens, vm) {\n if (tokens.length > 1) {\n return tokens.map(function (token) {\n return formatToken(token, vm);\n }).join('+');\n } else {\n return formatToken(tokens[0], vm, true);\n }\n}\n\n/**\n * Format a single token.\n *\n * @param {Object} token\n * @param {Vue} [vm]\n * @param {Boolean} [single]\n * @return {String}\n */\n\nfunction formatToken(token, vm, single) {\n return token.tag ? token.oneTime && vm ? '\"' + vm.$eval(token.value) + '\"' : inlineFilters(token.value, single) : '\"' + token.value + '\"';\n}\n\n/**\n * For an attribute with multiple interpolation tags,\n * e.g. attr=\"some-{{thing | filter}}\", in order to combine\n * the whole thing into a single watchable expression, we\n * have to inline those filters. This function does exactly\n * that. This is a bit hacky but it avoids heavy changes\n * to directive parser and watcher mechanism.\n *\n * @param {String} exp\n * @param {Boolean} single\n * @return {String}\n */\n\nvar filterRE = /[^|]\\|[^|]/;\nfunction inlineFilters(exp, single) {\n if (!filterRE.test(exp)) {\n return single ? exp : '(' + exp + ')';\n } else {\n var dir = parseDirective(exp);\n if (!dir.filters) {\n return '(' + exp + ')';\n } else {\n return 'this._applyFilters(' + dir.expression + // value\n ',null,' + // oldValue (null for read)\n JSON.stringify(dir.filters) + // filter descriptors\n ',false)'; // write?\n }\n }\n}\n\nvar text = Object.freeze({\n compileRegex: compileRegex,\n parseText: parseText,\n tokensToExp: tokensToExp\n});\n\nvar delimiters = ['{{', '}}'];\nvar unsafeDelimiters = ['{{{', '}}}'];\n\nvar config = Object.defineProperties({\n\n /**\n * Whether to print debug messages.\n * Also enables stack trace for warnings.\n *\n * @type {Boolean}\n */\n\n debug: false,\n\n /**\n * Whether to suppress warnings.\n *\n * @type {Boolean}\n */\n\n silent: false,\n\n /**\n * Whether to use async rendering.\n */\n\n async: true,\n\n /**\n * Whether to warn against errors caught when evaluating\n * expressions.\n */\n\n warnExpressionErrors: true,\n\n /**\n * Whether to allow devtools inspection.\n * Disabled by default in production builds.\n */\n\n devtools: process.env.NODE_ENV !== 'production',\n\n /**\n * Internal flag to indicate the delimiters have been\n * changed.\n *\n * @type {Boolean}\n */\n\n _delimitersChanged: true,\n\n /**\n * List of asset types that a component can own.\n *\n * @type {Array}\n */\n\n _assetTypes: ['component', 'directive', 'elementDirective', 'filter', 'transition', 'partial'],\n\n /**\n * prop binding modes\n */\n\n _propBindingModes: {\n ONE_WAY: 0,\n TWO_WAY: 1,\n ONE_TIME: 2\n },\n\n /**\n * Max circular updates allowed in a batcher flush cycle.\n */\n\n _maxUpdateCount: 100\n\n}, {\n delimiters: { /**\n * Interpolation delimiters. Changing these would trigger\n * the text parser to re-compile the regular expressions.\n *\n * @type {Array}\n */\n\n get: function get() {\n return delimiters;\n },\n set: function set(val) {\n delimiters = val;\n compileRegex();\n },\n configurable: true,\n enumerable: true\n },\n unsafeDelimiters: {\n get: function get() {\n return unsafeDelimiters;\n },\n set: function set(val) {\n unsafeDelimiters = val;\n compileRegex();\n },\n configurable: true,\n enumerable: true\n }\n});\n\nvar warn = undefined;\nvar formatComponentName = undefined;\n\nif (process.env.NODE_ENV !== 'production') {\n (function () {\n var hasConsole = typeof console !== 'undefined';\n\n warn = function (msg, vm) {\n if (hasConsole && !config.silent) {\n console.error('[Vue warn]: ' + msg + (vm ? formatComponentName(vm) : ''));\n }\n };\n\n formatComponentName = function (vm) {\n var name = vm._isVue ? vm.$options.name : vm.name;\n return name ? ' (found in component: <' + hyphenate(name) + '>)' : '';\n };\n })();\n}\n\n/**\n * Append with transition.\n *\n * @param {Element} el\n * @param {Element} target\n * @param {Vue} vm\n * @param {Function} [cb]\n */\n\nfunction appendWithTransition(el, target, vm, cb) {\n applyTransition(el, 1, function () {\n target.appendChild(el);\n }, vm, cb);\n}\n\n/**\n * InsertBefore with transition.\n *\n * @param {Element} el\n * @param {Element} target\n * @param {Vue} vm\n * @param {Function} [cb]\n */\n\nfunction beforeWithTransition(el, target, vm, cb) {\n applyTransition(el, 1, function () {\n before(el, target);\n }, vm, cb);\n}\n\n/**\n * Remove with transition.\n *\n * @param {Element} el\n * @param {Vue} vm\n * @param {Function} [cb]\n */\n\nfunction removeWithTransition(el, vm, cb) {\n applyTransition(el, -1, function () {\n remove(el);\n }, vm, cb);\n}\n\n/**\n * Apply transitions with an operation callback.\n *\n * @param {Element} el\n * @param {Number} direction\n * 1: enter\n * -1: leave\n * @param {Function} op - the actual DOM operation\n * @param {Vue} vm\n * @param {Function} [cb]\n */\n\nfunction applyTransition(el, direction, op, vm, cb) {\n var transition = el.__v_trans;\n if (!transition ||\n // skip if there are no js hooks and CSS transition is\n // not supported\n !transition.hooks && !transitionEndEvent ||\n // skip transitions for initial compile\n !vm._isCompiled ||\n // if the vm is being manipulated by a parent directive\n // during the parent's compilation phase, skip the\n // animation.\n vm.$parent && !vm.$parent._isCompiled) {\n op();\n if (cb) cb();\n return;\n }\n var action = direction > 0 ? 'enter' : 'leave';\n transition[action](op, cb);\n}\n\nvar transition = Object.freeze({\n appendWithTransition: appendWithTransition,\n beforeWithTransition: beforeWithTransition,\n removeWithTransition: removeWithTransition,\n applyTransition: applyTransition\n});\n\n/**\n * Query an element selector if it's not an element already.\n *\n * @param {String|Element} el\n * @return {Element}\n */\n\nfunction query(el) {\n if (typeof el === 'string') {\n var selector = el;\n el = document.querySelector(el);\n if (!el) {\n process.env.NODE_ENV !== 'production' && warn('Cannot find element: ' + selector);\n }\n }\n return el;\n}\n\n/**\n * Check if a node is in the document.\n * Note: document.documentElement.contains should work here\n * but always returns false for comment nodes in phantomjs,\n * making unit tests difficult. This is fixed by doing the\n * contains() check on the node's parentNode instead of\n * the node itself.\n *\n * @param {Node} node\n * @return {Boolean}\n */\n\nfunction inDoc(node) {\n var doc = document.documentElement;\n var parent = node && node.parentNode;\n return doc === node || doc === parent || !!(parent && parent.nodeType === 1 && doc.contains(parent));\n}\n\n/**\n * Get and remove an attribute from a node.\n *\n * @param {Node} node\n * @param {String} _attr\n */\n\nfunction getAttr(node, _attr) {\n var val = node.getAttribute(_attr);\n if (val !== null) {\n node.removeAttribute(_attr);\n }\n return val;\n}\n\n/**\n * Get an attribute with colon or v-bind: prefix.\n *\n * @param {Node} node\n * @param {String} name\n * @return {String|null}\n */\n\nfunction getBindAttr(node, name) {\n var val = getAttr(node, ':' + name);\n if (val === null) {\n val = getAttr(node, 'v-bind:' + name);\n }\n return val;\n}\n\n/**\n * Check the presence of a bind attribute.\n *\n * @param {Node} node\n * @param {String} name\n * @return {Boolean}\n */\n\nfunction hasBindAttr(node, name) {\n return node.hasAttribute(name) || node.hasAttribute(':' + name) || node.hasAttribute('v-bind:' + name);\n}\n\n/**\n * Insert el before target\n *\n * @param {Element} el\n * @param {Element} target\n */\n\nfunction before(el, target) {\n target.parentNode.insertBefore(el, target);\n}\n\n/**\n * Insert el after target\n *\n * @param {Element} el\n * @param {Element} target\n */\n\nfunction after(el, target) {\n if (target.nextSibling) {\n before(el, target.nextSibling);\n } else {\n target.parentNode.appendChild(el);\n }\n}\n\n/**\n * Remove el from DOM\n *\n * @param {Element} el\n */\n\nfunction remove(el) {\n el.parentNode.removeChild(el);\n}\n\n/**\n * Prepend el to target\n *\n * @param {Element} el\n * @param {Element} target\n */\n\nfunction prepend(el, target) {\n if (target.firstChild) {\n before(el, target.firstChild);\n } else {\n target.appendChild(el);\n }\n}\n\n/**\n * Replace target with el\n *\n * @param {Element} target\n * @param {Element} el\n */\n\nfunction replace(target, el) {\n var parent = target.parentNode;\n if (parent) {\n parent.replaceChild(el, target);\n }\n}\n\n/**\n * Add event listener shorthand.\n *\n * @param {Element} el\n * @param {String} event\n * @param {Function} cb\n * @param {Boolean} [useCapture]\n */\n\nfunction on(el, event, cb, useCapture) {\n el.addEventListener(event, cb, useCapture);\n}\n\n/**\n * Remove event listener shorthand.\n *\n * @param {Element} el\n * @param {String} event\n * @param {Function} cb\n */\n\nfunction off(el, event, cb) {\n el.removeEventListener(event, cb);\n}\n\n/**\n * For IE9 compat: when both class and :class are present\n * getAttribute('class') returns wrong value...\n *\n * @param {Element} el\n * @return {String}\n */\n\nfunction getClass(el) {\n var classname = el.className;\n if (typeof classname === 'object') {\n classname = classname.baseVal || '';\n }\n return classname;\n}\n\n/**\n * In IE9, setAttribute('class') will result in empty class\n * if the element also has the :class attribute; However in\n * PhantomJS, setting `className` does not work on SVG elements...\n * So we have to do a conditional check here.\n *\n * @param {Element} el\n * @param {String} cls\n */\n\nfunction setClass(el, cls) {\n /* istanbul ignore if */\n if (isIE9 && !/svg$/.test(el.namespaceURI)) {\n el.className = cls;\n } else {\n el.setAttribute('class', cls);\n }\n}\n\n/**\n * Add class with compatibility for IE & SVG\n *\n * @param {Element} el\n * @param {String} cls\n */\n\nfunction addClass(el, cls) {\n if (el.classList) {\n el.classList.add(cls);\n } else {\n var cur = ' ' + getClass(el) + ' ';\n if (cur.indexOf(' ' + cls + ' ') < 0) {\n setClass(el, (cur + cls).trim());\n }\n }\n}\n\n/**\n * Remove class with compatibility for IE & SVG\n *\n * @param {Element} el\n * @param {String} cls\n */\n\nfunction removeClass(el, cls) {\n if (el.classList) {\n el.classList.remove(cls);\n } else {\n var cur = ' ' + getClass(el) + ' ';\n var tar = ' ' + cls + ' ';\n while (cur.indexOf(tar) >= 0) {\n cur = cur.replace(tar, ' ');\n }\n setClass(el, cur.trim());\n }\n if (!el.className) {\n el.removeAttribute('class');\n }\n}\n\n/**\n * Extract raw content inside an element into a temporary\n * container div\n *\n * @param {Element} el\n * @param {Boolean} asFragment\n * @return {Element|DocumentFragment}\n */\n\nfunction extractContent(el, asFragment) {\n var child;\n var rawContent;\n /* istanbul ignore if */\n if (isTemplate(el) && isFragment(el.content)) {\n el = el.content;\n }\n if (el.hasChildNodes()) {\n trimNode(el);\n rawContent = asFragment ? document.createDocumentFragment() : document.createElement('div');\n /* eslint-disable no-cond-assign */\n while (child = el.firstChild) {\n /* eslint-enable no-cond-assign */\n rawContent.appendChild(child);\n }\n }\n return rawContent;\n}\n\n/**\n * Trim possible empty head/tail text and comment\n * nodes inside a parent.\n *\n * @param {Node} node\n */\n\nfunction trimNode(node) {\n var child;\n /* eslint-disable no-sequences */\n while ((child = node.firstChild, isTrimmable(child))) {\n node.removeChild(child);\n }\n while ((child = node.lastChild, isTrimmable(child))) {\n node.removeChild(child);\n }\n /* eslint-enable no-sequences */\n}\n\nfunction isTrimmable(node) {\n return node && (node.nodeType === 3 && !node.data.trim() || node.nodeType === 8);\n}\n\n/**\n * Check if an element is a template tag.\n * Note if the template appears inside an SVG its tagName\n * will be in lowercase.\n *\n * @param {Element} el\n */\n\nfunction isTemplate(el) {\n return el.tagName && el.tagName.toLowerCase() === 'template';\n}\n\n/**\n * Create an \"anchor\" for performing dom insertion/removals.\n * This is used in a number of scenarios:\n * - fragment instance\n * - v-html\n * - v-if\n * - v-for\n * - component\n *\n * @param {String} content\n * @param {Boolean} persist - IE trashes empty textNodes on\n * cloneNode(true), so in certain\n * cases the anchor needs to be\n * non-empty to be persisted in\n * templates.\n * @return {Comment|Text}\n */\n\nfunction createAnchor(content, persist) {\n var anchor = config.debug ? document.createComment(content) : document.createTextNode(persist ? ' ' : '');\n anchor.__v_anchor = true;\n return anchor;\n}\n\n/**\n * Find a component ref attribute that starts with $.\n *\n * @param {Element} node\n * @return {String|undefined}\n */\n\nvar refRE = /^v-ref:/;\n\nfunction findRef(node) {\n if (node.hasAttributes()) {\n var attrs = node.attributes;\n for (var i = 0, l = attrs.length; i < l; i++) {\n var name = attrs[i].name;\n if (refRE.test(name)) {\n return camelize(name.replace(refRE, ''));\n }\n }\n }\n}\n\n/**\n * Map a function to a range of nodes .\n *\n * @param {Node} node\n * @param {Node} end\n * @param {Function} op\n */\n\nfunction mapNodeRange(node, end, op) {\n var next;\n while (node !== end) {\n next = node.nextSibling;\n op(node);\n node = next;\n }\n op(end);\n}\n\n/**\n * Remove a range of nodes with transition, store\n * the nodes in a fragment with correct ordering,\n * and call callback when done.\n *\n * @param {Node} start\n * @param {Node} end\n * @param {Vue} vm\n * @param {DocumentFragment} frag\n * @param {Function} cb\n */\n\nfunction removeNodeRange(start, end, vm, frag, cb) {\n var done = false;\n var removed = 0;\n var nodes = [];\n mapNodeRange(start, end, function (node) {\n if (node === end) done = true;\n nodes.push(node);\n removeWithTransition(node, vm, onRemoved);\n });\n function onRemoved() {\n removed++;\n if (done && removed >= nodes.length) {\n for (var i = 0; i < nodes.length; i++) {\n frag.appendChild(nodes[i]);\n }\n cb && cb();\n }\n }\n}\n\n/**\n * Check if a node is a DocumentFragment.\n *\n * @param {Node} node\n * @return {Boolean}\n */\n\nfunction isFragment(node) {\n return node && node.nodeType === 11;\n}\n\n/**\n * Get outerHTML of elements, taking care\n * of SVG elements in IE as well.\n *\n * @param {Element} el\n * @return {String}\n */\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\nvar commonTagRE = /^(div|p|span|img|a|b|i|br|ul|ol|li|h1|h2|h3|h4|h5|h6|code|pre|table|th|td|tr|form|label|input|select|option|nav|article|section|header|footer)$/i;\nvar reservedTagRE = /^(slot|partial|component)$/i;\n\nvar isUnknownElement = undefined;\nif (process.env.NODE_ENV !== 'production') {\n isUnknownElement = function (el, tag) {\n if (tag.indexOf('-') > -1) {\n // http://stackoverflow.com/a/28210364/1070244\n return el.constructor === window.HTMLUnknownElement || el.constructor === window.HTMLElement;\n } else {\n return (/HTMLUnknownElement/.test(el.toString()) &&\n // Chrome returns unknown for several HTML5 elements.\n // https://code.google.com/p/chromium/issues/detail?id=540526\n !/^(data|time|rtc|rb)$/.test(tag)\n );\n }\n };\n}\n\n/**\n * Check if an element is a component, if yes return its\n * component id.\n *\n * @param {Element} el\n * @param {Object} options\n * @return {Object|undefined}\n */\n\nfunction checkComponentAttr(el, options) {\n var tag = el.tagName.toLowerCase();\n var hasAttrs = el.hasAttributes();\n if (!commonTagRE.test(tag) && !reservedTagRE.test(tag)) {\n if (resolveAsset(options, 'components', tag)) {\n return { id: tag };\n } else {\n var is = hasAttrs && getIsBinding(el, options);\n if (is) {\n return is;\n } else if (process.env.NODE_ENV !== 'production') {\n var expectedTag = options._componentNameMap && options._componentNameMap[tag];\n if (expectedTag) {\n warn('Unknown custom element: <' + tag + '> - ' + 'did you mean <' + expectedTag + '>? ' + 'HTML is case-insensitive, remember to use kebab-case in templates.');\n } else if (isUnknownElement(el, tag)) {\n warn('Unknown custom element: <' + tag + '> - did you ' + 'register the component correctly? For recursive components, ' + 'make sure to provide the \"name\" option.');\n }\n }\n }\n } else if (hasAttrs) {\n return getIsBinding(el, options);\n }\n}\n\n/**\n * Get \"is\" binding from an element.\n *\n * @param {Element} el\n * @param {Object} options\n * @return {Object|undefined}\n */\n\nfunction getIsBinding(el, options) {\n // dynamic syntax\n var exp = el.getAttribute('is');\n if (exp != null) {\n if (resolveAsset(options, 'components', exp)) {\n el.removeAttribute('is');\n return { id: exp };\n }\n } else {\n exp = getBindAttr(el, 'is');\n if (exp != null) {\n return { id: exp, dynamic: true };\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 *\n * All strategy functions follow the same signature:\n *\n * @param {*} parentVal\n * @param {*} childVal\n * @param {Vue} [vm]\n */\n\nvar strats = config.optionMergeStrategies = Object.create(null);\n\n/**\n * Helper that recursively merges two data objects together.\n */\n\nfunction mergeData(to, from) {\n var key, toVal, fromVal;\n for (key in from) {\n toVal = to[key];\n fromVal = from[key];\n if (!hasOwn(to, key)) {\n set(to, key, fromVal);\n } else if (isObject(toVal) && isObject(fromVal)) {\n mergeData(toVal, fromVal);\n }\n }\n return to;\n}\n\n/**\n * Data\n */\n\nstrats.data = function (parentVal, childVal, vm) {\n if (!vm) {\n // in a Vue.extend merge, both should be functions\n if (!childVal) {\n return parentVal;\n }\n if (typeof childVal !== 'function') {\n process.env.NODE_ENV !== 'production' && warn('The \"data\" option should be a function ' + 'that returns a per-instance value in component ' + 'definitions.', vm);\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(childVal.call(this), parentVal.call(this));\n };\n } else if (parentVal || childVal) {\n return function mergedInstanceDataFn() {\n // instance merge\n var instanceData = typeof childVal === 'function' ? childVal.call(vm) : childVal;\n var defaultData = typeof parentVal === 'function' ? parentVal.call(vm) : undefined;\n if (instanceData) {\n return mergeData(instanceData, defaultData);\n } else {\n return defaultData;\n }\n };\n }\n};\n\n/**\n * El\n */\n\nstrats.el = function (parentVal, childVal, vm) {\n if (!vm && childVal && typeof childVal !== 'function') {\n process.env.NODE_ENV !== 'production' && warn('The \"el\" option should be a function ' + 'that returns a per-instance value in component ' + 'definitions.', vm);\n return;\n }\n var ret = childVal || parentVal;\n // invoke the element factory if this is instance merge\n return vm && typeof ret === 'function' ? ret.call(vm) : ret;\n};\n\n/**\n * Hooks and param attributes are merged as arrays.\n */\n\nstrats.init = strats.created = strats.ready = strats.attached = strats.detached = strats.beforeCompile = strats.compiled = strats.beforeDestroy = strats.destroyed = strats.activate = function (parentVal, childVal) {\n return childVal ? parentVal ? parentVal.concat(childVal) : isArray(childVal) ? childVal : [childVal] : parentVal;\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 */\n\nfunction mergeAssets(parentVal, childVal) {\n var res = Object.create(parentVal || null);\n return childVal ? extend(res, guardArrayAssets(childVal)) : res;\n}\n\nconfig._assetTypes.forEach(function (type) {\n strats[type + 's'] = mergeAssets;\n});\n\n/**\n * Events & Watchers.\n *\n * Events & watchers hashes should not overwrite one\n * another, so we merge them as arrays.\n */\n\nstrats.watch = strats.events = function (parentVal, childVal) {\n if (!childVal) return parentVal;\n if (!parentVal) return childVal;\n var ret = {};\n extend(ret, parentVal);\n for (var key in childVal) {\n var parent = ret[key];\n var child = childVal[key];\n if (parent && !isArray(parent)) {\n parent = [parent];\n }\n ret[key] = parent ? parent.concat(child) : [child];\n }\n return ret;\n};\n\n/**\n * Other object hashes.\n */\n\nstrats.props = strats.methods = strats.computed = function (parentVal, childVal) {\n if (!childVal) return parentVal;\n if (!parentVal) return childVal;\n var ret = Object.create(null);\n extend(ret, parentVal);\n extend(ret, childVal);\n return ret;\n};\n\n/**\n * Default strategy.\n */\n\nvar defaultStrat = function defaultStrat(parentVal, childVal) {\n return childVal === undefined ? parentVal : childVal;\n};\n\n/**\n * Make sure component options get converted to actual\n * constructors.\n *\n * @param {Object} options\n */\n\nfunction guardComponents(options) {\n if (options.components) {\n var components = options.components = guardArrayAssets(options.components);\n var ids = Object.keys(components);\n var def;\n if (process.env.NODE_ENV !== 'production') {\n var map = options._componentNameMap = {};\n }\n for (var i = 0, l = ids.length; i < l; i++) {\n var key = ids[i];\n if (commonTagRE.test(key) || reservedTagRE.test(key)) {\n process.env.NODE_ENV !== 'production' && warn('Do not use built-in or reserved HTML elements as component ' + 'id: ' + key);\n continue;\n }\n // record a all lowercase <-> kebab-case mapping for\n // possible custom element case error warning\n if (process.env.NODE_ENV !== 'production') {\n map[key.replace(/-/g, '').toLowerCase()] = hyphenate(key);\n }\n def = components[key];\n if (isPlainObject(def)) {\n components[key] = Vue.extend(def);\n }\n }\n }\n}\n\n/**\n * Ensure all props option syntax are normalized into the\n * Object-based format.\n *\n * @param {Object} options\n */\n\nfunction guardProps(options) {\n var props = options.props;\n var i, val;\n if (isArray(props)) {\n options.props = {};\n i = props.length;\n while (i--) {\n val = props[i];\n if (typeof val === 'string') {\n options.props[val] = null;\n } else if (val.name) {\n options.props[val.name] = val;\n }\n }\n } else if (isPlainObject(props)) {\n var keys = Object.keys(props);\n i = keys.length;\n while (i--) {\n val = props[keys[i]];\n if (typeof val === 'function') {\n props[keys[i]] = { type: val };\n }\n }\n }\n}\n\n/**\n * Guard an Array-format assets option and converted it\n * into the key-value Object format.\n *\n * @param {Object|Array} assets\n * @return {Object}\n */\n\nfunction guardArrayAssets(assets) {\n if (isArray(assets)) {\n var res = {};\n var i = assets.length;\n var asset;\n while (i--) {\n asset = assets[i];\n var id = typeof asset === 'function' ? asset.options && asset.options.name || asset.id : asset.name || asset.id;\n if (!id) {\n process.env.NODE_ENV !== 'production' && warn('Array-syntax assets must provide a \"name\" or \"id\" field.');\n } else {\n res[id] = asset;\n }\n }\n return res;\n }\n return assets;\n}\n\n/**\n * Merge two option objects into a new one.\n * Core utility used in both instantiation and inheritance.\n *\n * @param {Object} parent\n * @param {Object} child\n * @param {Vue} [vm] - if vm is present, indicates this is\n * an instantiation merge.\n */\n\nfunction mergeOptions(parent, child, vm) {\n guardComponents(child);\n guardProps(child);\n if (process.env.NODE_ENV !== 'production') {\n if (child.propsData && !vm) {\n warn('propsData can only be used as an instantiation option.');\n }\n }\n var options = {};\n var key;\n if (child['extends']) {\n parent = typeof child['extends'] === 'function' ? mergeOptions(parent, child['extends'].options, vm) : 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 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 *\n * @param {Object} options\n * @param {String} type\n * @param {String} id\n * @param {Boolean} warnMissing\n * @return {Object|Function}\n */\n\nfunction resolveAsset(options, type, id, warnMissing) {\n /* istanbul ignore if */\n if (typeof id !== 'string') {\n return;\n }\n var assets = options[type];\n var camelizedId;\n var res = assets[id] ||\n // camelCase ID\n assets[camelizedId = camelize(id)] ||\n // Pascal Case ID\n assets[camelizedId.charAt(0).toUpperCase() + camelizedId.slice(1)];\n if (process.env.NODE_ENV !== 'production' && warnMissing && !res) {\n warn('Failed to resolve ' + type.slice(0, -1) + ': ' + id, options);\n }\n return res;\n}\n\nvar uid$1 = 0;\n\n/**\n * A dep is an observable that can have multiple\n * directives subscribing to it.\n *\n * @constructor\n */\nfunction Dep() {\n this.id = uid$1++;\n this.subs = [];\n}\n\n// the current target watcher being evaluated.\n// this is globally unique because there could be only one\n// watcher being evaluated at any time.\nDep.target = null;\n\n/**\n * Add a directive subscriber.\n *\n * @param {Directive} sub\n */\n\nDep.prototype.addSub = function (sub) {\n this.subs.push(sub);\n};\n\n/**\n * Remove a directive subscriber.\n *\n * @param {Directive} sub\n */\n\nDep.prototype.removeSub = function (sub) {\n this.subs.$remove(sub);\n};\n\n/**\n * Add self as a dependency to the target watcher.\n */\n\nDep.prototype.depend = function () {\n Dep.target.addDep(this);\n};\n\n/**\n * Notify all subscribers of a new value.\n */\n\nDep.prototype.notify = function () {\n // stablize the subscriber list first\n var subs = toArray(this.subs);\n for (var i = 0, l = subs.length; i < l; i++) {\n subs[i].update();\n }\n};\n\nvar arrayProto = Array.prototype;\nvar arrayMethods = Object.create(arrayProto)\n\n/**\n * Intercept mutating methods and emit events\n */\n\n;['push', 'pop', 'shift', 'unshift', 'splice', 'sort', 'reverse'].forEach(function (method) {\n // cache original method\n var original = arrayProto[method];\n def(arrayMethods, method, function mutator() {\n // avoid leaking arguments:\n // http://jsperf.com/closure-with-arguments\n var i = arguments.length;\n var args = new Array(i);\n while (i--) {\n args[i] = arguments[i];\n }\n var result = original.apply(this, args);\n var ob = this.__ob__;\n var inserted;\n switch (method) {\n case 'push':\n inserted = args;\n break;\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 * Swap the element at the given index with a new value\n * and emits corresponding event.\n *\n * @param {Number} index\n * @param {*} val\n * @return {*} - replaced element\n */\n\ndef(arrayProto, '$set', function $set(index, val) {\n if (index >= this.length) {\n this.length = Number(index) + 1;\n }\n return this.splice(index, 1, val)[0];\n});\n\n/**\n * Convenience method to remove the element at given index or target element reference.\n *\n * @param {*} item\n */\n\ndef(arrayProto, '$remove', function $remove(item) {\n /* istanbul ignore if */\n if (!this.length) return;\n var index = indexOf(this, item);\n if (index > -1) {\n return this.splice(index, 1);\n }\n});\n\nvar arrayKeys = Object.getOwnPropertyNames(arrayMethods);\n\n/**\n * By default, when a reactive property is set, the new value is\n * also converted to become reactive. However in certain cases, e.g.\n * v-for scope alias and props, we don't want to force conversion\n * because the value may be a nested value under a frozen data structure.\n *\n * So whenever we want to set a reactive property without forcing\n * conversion on the new value, we wrap that call inside this function.\n */\n\nvar shouldConvert = true;\n\nfunction withoutConversion(fn) {\n shouldConvert = false;\n fn();\n shouldConvert = true;\n}\n\n/**\n * Observer class that are attached to each observed\n * object. Once attached, the observer converts target\n * object's property keys into getter/setters that\n * collect dependencies and dispatches updates.\n *\n * @param {Array|Object} value\n * @constructor\n */\n\nfunction Observer(value) {\n this.value = value;\n this.dep = new Dep();\n def(value, '__ob__', this);\n if (isArray(value)) {\n var augment = hasProto ? protoAugment : copyAugment;\n augment(value, arrayMethods, arrayKeys);\n this.observeArray(value);\n } else {\n this.walk(value);\n }\n}\n\n// Instance methods\n\n/**\n * Walk through each property and convert them into\n * getter/setters. This method should only be called when\n * value type is Object.\n *\n * @param {Object} obj\n */\n\nObserver.prototype.walk = function (obj) {\n var keys = Object.keys(obj);\n for (var i = 0, l = keys.length; i < l; i++) {\n this.convert(keys[i], obj[keys[i]]);\n }\n};\n\n/**\n * Observe a list of Array items.\n *\n * @param {Array} items\n */\n\nObserver.prototype.observeArray = function (items) {\n for (var i = 0, l = items.length; i < l; i++) {\n observe(items[i]);\n }\n};\n\n/**\n * Convert a property into getter/setter so we can emit\n * the events when the property is accessed/changed.\n *\n * @param {String} key\n * @param {*} val\n */\n\nObserver.prototype.convert = function (key, val) {\n defineReactive(this.value, key, val);\n};\n\n/**\n * Add an owner vm, so that when $set/$delete mutations\n * happen we can notify owner vms to proxy the keys and\n * digest the watchers. This is only called when the object\n * is observed as an instance's root $data.\n *\n * @param {Vue} vm\n */\n\nObserver.prototype.addVm = function (vm) {\n (this.vms || (this.vms = [])).push(vm);\n};\n\n/**\n * Remove an owner vm. This is called when the object is\n * swapped out as an instance's $data object.\n *\n * @param {Vue} vm\n */\n\nObserver.prototype.removeVm = function (vm) {\n this.vms.$remove(vm);\n};\n\n// helpers\n\n/**\n * Augment an target Object or Array by intercepting\n * the prototype chain using __proto__\n *\n * @param {Object|Array} target\n * @param {Object} src\n */\n\nfunction protoAugment(target, src) {\n /* eslint-disable no-proto */\n target.__proto__ = src;\n /* eslint-enable no-proto */\n}\n\n/**\n * Augment an target Object or Array by defining\n * hidden properties.\n *\n * @param {Object|Array} target\n * @param {Object} proto\n */\n\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 *\n * @param {*} value\n * @param {Vue} [vm]\n * @return {Observer|undefined}\n * @static\n */\n\nfunction observe(value, vm) {\n if (!value || typeof value !== 'object') {\n return;\n }\n var ob;\n if (hasOwn(value, '__ob__') && value.__ob__ instanceof Observer) {\n ob = value.__ob__;\n } else if (shouldConvert && (isArray(value) || isPlainObject(value)) && Object.isExtensible(value) && !value._isVue) {\n ob = new Observer(value);\n }\n if (ob && vm) {\n ob.addVm(vm);\n }\n return ob;\n}\n\n/**\n * Define a reactive property on an Object.\n *\n * @param {Object} obj\n * @param {String} key\n * @param {*} val\n */\n\nfunction defineReactive(obj, key, val) {\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\n var childOb = 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 }\n if (isArray(value)) {\n for (var e, i = 0, l = value.length; i < l; i++) {\n e = value[i];\n e && e.__ob__ && e.__ob__.dep.depend();\n }\n }\n }\n return value;\n },\n set: function reactiveSetter(newVal) {\n var value = getter ? getter.call(obj) : val;\n if (newVal === value) {\n return;\n }\n if (setter) {\n setter.call(obj, newVal);\n } else {\n val = newVal;\n }\n childOb = observe(newVal);\n dep.notify();\n }\n });\n}\n\n\n\nvar util = Object.freeze({\n\tdefineReactive: defineReactive,\n\tset: set,\n\tdel: del,\n\thasOwn: hasOwn,\n\tisLiteral: isLiteral,\n\tisReserved: isReserved,\n\t_toString: _toString,\n\ttoNumber: toNumber,\n\ttoBoolean: toBoolean,\n\tstripQuotes: stripQuotes,\n\tcamelize: camelize,\n\thyphenate: hyphenate,\n\tclassify: classify,\n\tbind: bind,\n\ttoArray: toArray,\n\textend: extend,\n\tisObject: isObject,\n\tisPlainObject: isPlainObject,\n\tdef: def,\n\tdebounce: _debounce,\n\tindexOf: indexOf,\n\tcancellable: cancellable,\n\tlooseEqual: looseEqual,\n\tisArray: isArray,\n\thasProto: hasProto,\n\tinBrowser: inBrowser,\n\tdevtools: devtools,\n\tisIE9: isIE9,\n\tisAndroid: isAndroid,\n\tisIos: isIos,\n\tisWechat: isWechat,\n\tget transitionProp () { return transitionProp; },\n\tget transitionEndEvent () { return transitionEndEvent; },\n\tget animationProp () { return animationProp; },\n\tget animationEndEvent () { return animationEndEvent; },\n\tnextTick: nextTick,\n\tget _Set () { return _Set; },\n\tquery: query,\n\tinDoc: inDoc,\n\tgetAttr: getAttr,\n\tgetBindAttr: getBindAttr,\n\thasBindAttr: hasBindAttr,\n\tbefore: before,\n\tafter: after,\n\tremove: remove,\n\tprepend: prepend,\n\treplace: replace,\n\ton: on,\n\toff: off,\n\tsetClass: setClass,\n\taddClass: addClass,\n\tremoveClass: removeClass,\n\textractContent: extractContent,\n\ttrimNode: trimNode,\n\tisTemplate: isTemplate,\n\tcreateAnchor: createAnchor,\n\tfindRef: findRef,\n\tmapNodeRange: mapNodeRange,\n\tremoveNodeRange: removeNodeRange,\n\tisFragment: isFragment,\n\tgetOuterHTML: getOuterHTML,\n\tmergeOptions: mergeOptions,\n\tresolveAsset: resolveAsset,\n\tcheckComponentAttr: checkComponentAttr,\n\tcommonTagRE: commonTagRE,\n\treservedTagRE: reservedTagRE,\n\tget warn () { return warn; }\n});\n\nvar uid = 0;\n\nfunction initMixin (Vue) {\n /**\n * The main init sequence. This is called for every\n * instance, including ones that are created from extended\n * constructors.\n *\n * @param {Object} options - this options object should be\n * the result of merging class\n * options and the options passed\n * in to the constructor.\n */\n\n Vue.prototype._init = function (options) {\n options = options || {};\n\n this.$el = null;\n this.$parent = options.parent;\n this.$root = this.$parent ? this.$parent.$root : this;\n this.$children = [];\n this.$refs = {}; // child vm references\n this.$els = {}; // element references\n this._watchers = []; // all watchers as an array\n this._directives = []; // all directives\n\n // a uid\n this._uid = uid++;\n\n // a flag to avoid this being observed\n this._isVue = true;\n\n // events bookkeeping\n this._events = {}; // registered callbacks\n this._eventsCount = {}; // for $broadcast optimization\n\n // fragment instance properties\n this._isFragment = false;\n this._fragment = // @type {DocumentFragment}\n this._fragmentStart = // @type {Text|Comment}\n this._fragmentEnd = null; // @type {Text|Comment}\n\n // lifecycle state\n this._isCompiled = this._isDestroyed = this._isReady = this._isAttached = this._isBeingDestroyed = this._vForRemoving = false;\n this._unlinkFn = null;\n\n // context:\n // if this is a transcluded component, context\n // will be the common parent vm of this instance\n // and its host.\n this._context = options._context || this.$parent;\n\n // scope:\n // if this is inside an inline v-for, the scope\n // will be the intermediate scope created for this\n // repeat fragment. this is used for linking props\n // and container directives.\n this._scope = options._scope;\n\n // fragment:\n // if this instance is compiled inside a Fragment, it\n // needs to reigster itself as a child of that fragment\n // for attach/detach to work properly.\n this._frag = options._frag;\n if (this._frag) {\n this._frag.children.push(this);\n }\n\n // push self into parent / transclusion host\n if (this.$parent) {\n this.$parent.$children.push(this);\n }\n\n // merge options.\n options = this.$options = mergeOptions(this.constructor.options, options, this);\n\n // set ref\n this._updateRef();\n\n // initialize data as empty object.\n // it will be filled up in _initData().\n this._data = {};\n\n // call init hook\n this._callHook('init');\n\n // initialize data observation and scope inheritance.\n this._initState();\n\n // setup event system and option events.\n this._initEvents();\n\n // call created hook\n this._callHook('created');\n\n // if `el` option is passed, start compilation.\n if (options.el) {\n this.$mount(options.el);\n }\n };\n}\n\nvar pathCache = new Cache(1000);\n\n// actions\nvar APPEND = 0;\nvar PUSH = 1;\nvar INC_SUB_PATH_DEPTH = 2;\nvar PUSH_SUB_PATH = 3;\n\n// states\nvar BEFORE_PATH = 0;\nvar IN_PATH = 1;\nvar BEFORE_IDENT = 2;\nvar IN_IDENT = 3;\nvar IN_SUB_PATH = 4;\nvar IN_SINGLE_QUOTE = 5;\nvar IN_DOUBLE_QUOTE = 6;\nvar AFTER_PATH = 7;\nvar ERROR = 8;\n\nvar pathStateMachine = [];\n\npathStateMachine[BEFORE_PATH] = {\n 'ws': [BEFORE_PATH],\n 'ident': [IN_IDENT, APPEND],\n '[': [IN_SUB_PATH],\n 'eof': [AFTER_PATH]\n};\n\npathStateMachine[IN_PATH] = {\n 'ws': [IN_PATH],\n '.': [BEFORE_IDENT],\n '[': [IN_SUB_PATH],\n 'eof': [AFTER_PATH]\n};\n\npathStateMachine[BEFORE_IDENT] = {\n 'ws': [BEFORE_IDENT],\n 'ident': [IN_IDENT, APPEND]\n};\n\npathStateMachine[IN_IDENT] = {\n 'ident': [IN_IDENT, APPEND],\n '0': [IN_IDENT, APPEND],\n 'number': [IN_IDENT, APPEND],\n 'ws': [IN_PATH, PUSH],\n '.': [BEFORE_IDENT, PUSH],\n '[': [IN_SUB_PATH, PUSH],\n 'eof': [AFTER_PATH, PUSH]\n};\n\npathStateMachine[IN_SUB_PATH] = {\n \"'\": [IN_SINGLE_QUOTE, APPEND],\n '\"': [IN_DOUBLE_QUOTE, APPEND],\n '[': [IN_SUB_PATH, INC_SUB_PATH_DEPTH],\n ']': [IN_PATH, PUSH_SUB_PATH],\n 'eof': ERROR,\n 'else': [IN_SUB_PATH, APPEND]\n};\n\npathStateMachine[IN_SINGLE_QUOTE] = {\n \"'\": [IN_SUB_PATH, APPEND],\n 'eof': ERROR,\n 'else': [IN_SINGLE_QUOTE, APPEND]\n};\n\npathStateMachine[IN_DOUBLE_QUOTE] = {\n '\"': [IN_SUB_PATH, APPEND],\n 'eof': ERROR,\n 'else': [IN_DOUBLE_QUOTE, APPEND]\n};\n\n/**\n * Determine the type of a character in a keypath.\n *\n * @param {Char} ch\n * @return {String} type\n */\n\nfunction getPathCharType(ch) {\n if (ch === undefined) {\n return 'eof';\n }\n\n var code = ch.charCodeAt(0);\n\n switch (code) {\n case 0x5B: // [\n case 0x5D: // ]\n case 0x2E: // .\n case 0x22: // \"\n case 0x27: // '\n case 0x30:\n // 0\n return ch;\n\n case 0x5F: // _\n case 0x24:\n // $\n return 'ident';\n\n case 0x20: // Space\n case 0x09: // Tab\n case 0x0A: // Newline\n case 0x0D: // Return\n case 0xA0: // No-break space\n case 0xFEFF: // Byte Order Mark\n case 0x2028: // Line Separator\n case 0x2029:\n // Paragraph Separator\n return 'ws';\n }\n\n // a-z, A-Z\n if (code >= 0x61 && code <= 0x7A || code >= 0x41 && code <= 0x5A) {\n return 'ident';\n }\n\n // 1-9\n if (code >= 0x31 && code <= 0x39) {\n return 'number';\n }\n\n return 'else';\n}\n\n/**\n * Format a subPath, return its plain form if it is\n * a literal string or number. Otherwise prepend the\n * dynamic indicator (*).\n *\n * @param {String} path\n * @return {String}\n */\n\nfunction formatSubPath(path) {\n var trimmed = path.trim();\n // invalid leading 0\n if (path.charAt(0) === '0' && isNaN(path)) {\n return false;\n }\n return isLiteral(trimmed) ? stripQuotes(trimmed) : '*' + trimmed;\n}\n\n/**\n * Parse a string path into an array of segments\n *\n * @param {String} path\n * @return {Array|undefined}\n */\n\nfunction parse(path) {\n var keys = [];\n var index = -1;\n var mode = BEFORE_PATH;\n var subPathDepth = 0;\n var c, newChar, key, type, transition, action, typeMap;\n\n var actions = [];\n\n actions[PUSH] = function () {\n if (key !== undefined) {\n keys.push(key);\n key = undefined;\n }\n };\n\n actions[APPEND] = function () {\n if (key === undefined) {\n key = newChar;\n } else {\n key += newChar;\n }\n };\n\n actions[INC_SUB_PATH_DEPTH] = function () {\n actions[APPEND]();\n subPathDepth++;\n };\n\n actions[PUSH_SUB_PATH] = function () {\n if (subPathDepth > 0) {\n subPathDepth--;\n mode = IN_SUB_PATH;\n actions[APPEND]();\n } else {\n subPathDepth = 0;\n key = formatSubPath(key);\n if (key === false) {\n return false;\n } else {\n actions[PUSH]();\n }\n }\n };\n\n function maybeUnescapeQuote() {\n var nextChar = path[index + 1];\n if (mode === IN_SINGLE_QUOTE && nextChar === \"'\" || mode === IN_DOUBLE_QUOTE && nextChar === '\"') {\n index++;\n newChar = '\\\\' + nextChar;\n actions[APPEND]();\n return true;\n }\n }\n\n while (mode != null) {\n index++;\n c = path[index];\n\n if (c === '\\\\' && maybeUnescapeQuote()) {\n continue;\n }\n\n type = getPathCharType(c);\n typeMap = pathStateMachine[mode];\n transition = typeMap[type] || typeMap['else'] || ERROR;\n\n if (transition === ERROR) {\n return; // parse error\n }\n\n mode = transition[0];\n action = actions[transition[1]];\n if (action) {\n newChar = transition[2];\n newChar = newChar === undefined ? c : newChar;\n if (action() === false) {\n return;\n }\n }\n\n if (mode === AFTER_PATH) {\n keys.raw = path;\n return keys;\n }\n }\n}\n\n/**\n * External parse that check for a cache hit first\n *\n * @param {String} path\n * @return {Array|undefined}\n */\n\nfunction parsePath(path) {\n var hit = pathCache.get(path);\n if (!hit) {\n hit = parse(path);\n if (hit) {\n pathCache.put(path, hit);\n }\n }\n return hit;\n}\n\n/**\n * Get from an object from a path string\n *\n * @param {Object} obj\n * @param {String} path\n */\n\nfunction getPath(obj, path) {\n return parseExpression(path).get(obj);\n}\n\n/**\n * Warn against setting non-existent root path on a vm.\n */\n\nvar warnNonExistent;\nif (process.env.NODE_ENV !== 'production') {\n warnNonExistent = function (path, vm) {\n warn('You are setting a non-existent path \"' + path.raw + '\" ' + 'on a vm instance. Consider pre-initializing the property ' + 'with the \"data\" option for more reliable reactivity ' + 'and better performance.', vm);\n };\n}\n\n/**\n * Set on an object from a path\n *\n * @param {Object} obj\n * @param {String | Array} path\n * @param {*} val\n */\n\nfunction setPath(obj, path, val) {\n var original = obj;\n if (typeof path === 'string') {\n path = parse(path);\n }\n if (!path || !isObject(obj)) {\n return false;\n }\n var last, key;\n for (var i = 0, l = path.length; i < l; i++) {\n last = obj;\n key = path[i];\n if (key.charAt(0) === '*') {\n key = parseExpression(key.slice(1)).get.call(original, original);\n }\n if (i < l - 1) {\n obj = obj[key];\n if (!isObject(obj)) {\n obj = {};\n if (process.env.NODE_ENV !== 'production' && last._isVue) {\n warnNonExistent(path, last);\n }\n set(last, key, obj);\n }\n } else {\n if (isArray(obj)) {\n obj.$set(key, val);\n } else if (key in obj) {\n obj[key] = val;\n } else {\n if (process.env.NODE_ENV !== 'production' && obj._isVue) {\n warnNonExistent(path, obj);\n }\n set(obj, key, val);\n }\n }\n }\n return true;\n}\n\nvar path = Object.freeze({\n parsePath: parsePath,\n getPath: getPath,\n setPath: setPath\n});\n\nvar expressionCache = new Cache(1000);\n\nvar allowedKeywords = 'Math,Date,this,true,false,null,undefined,Infinity,NaN,' + 'isNaN,isFinite,decodeURI,decodeURIComponent,encodeURI,' + 'encodeURIComponent,parseInt,parseFloat';\nvar allowedKeywordsRE = new RegExp('^(' + allowedKeywords.replace(/,/g, '\\\\b|') + '\\\\b)');\n\n// keywords that don't make sense inside expressions\nvar improperKeywords = 'break,case,class,catch,const,continue,debugger,default,' + 'delete,do,else,export,extends,finally,for,function,if,' + 'import,in,instanceof,let,return,super,switch,throw,try,' + 'var,while,with,yield,enum,await,implements,package,' + 'protected,static,interface,private,public';\nvar improperKeywordsRE = new RegExp('^(' + improperKeywords.replace(/,/g, '\\\\b|') + '\\\\b)');\n\nvar wsRE = /\\s/g;\nvar newlineRE = /\\n/g;\nvar saveRE = /[\\{,]\\s*[\\w\\$_]+\\s*:|('(?:[^'\\\\]|\\\\.)*'|\"(?:[^\"\\\\]|\\\\.)*\"|`(?:[^`\\\\]|\\\\.)*\\$\\{|\\}(?:[^`\\\\]|\\\\.)*`|`(?:[^`\\\\]|\\\\.)*`)|new |typeof |void /g;\nvar restoreRE = /\"(\\d+)\"/g;\nvar pathTestRE = /^[A-Za-z_$][\\w$]*(?:\\.[A-Za-z_$][\\w$]*|\\['.*?'\\]|\\[\".*?\"\\]|\\[\\d+\\]|\\[[A-Za-z_$][\\w$]*\\])*$/;\nvar identRE = /[^\\w$\\.](?:[A-Za-z_$][\\w$]*)/g;\nvar booleanLiteralRE = /^(?:true|false)$/;\n\n/**\n * Save / Rewrite / Restore\n *\n * When rewriting paths found in an expression, it is\n * possible for the same letter sequences to be found in\n * strings and Object literal property keys. Therefore we\n * remove and store these parts in a temporary array, and\n * restore them after the path rewrite.\n */\n\nvar saved = [];\n\n/**\n * Save replacer\n *\n * The save regex can match two possible cases:\n * 1. An opening object literal\n * 2. A string\n * If matched as a plain string, we need to escape its\n * newlines, since the string needs to be preserved when\n * generating the function body.\n *\n * @param {String} str\n * @param {String} isString - str if matched as a string\n * @return {String} - placeholder with index\n */\n\nfunction save(str, isString) {\n var i = saved.length;\n saved[i] = isString ? str.replace(newlineRE, '\\\\n') : str;\n return '\"' + i + '\"';\n}\n\n/**\n * Path rewrite replacer\n *\n * @param {String} raw\n * @return {String}\n */\n\nfunction rewrite(raw) {\n var c = raw.charAt(0);\n var path = raw.slice(1);\n if (allowedKeywordsRE.test(path)) {\n return raw;\n } else {\n path = path.indexOf('\"') > -1 ? path.replace(restoreRE, restore) : path;\n return c + 'scope.' + path;\n }\n}\n\n/**\n * Restore replacer\n *\n * @param {String} str\n * @param {String} i - matched save index\n * @return {String}\n */\n\nfunction restore(str, i) {\n return saved[i];\n}\n\n/**\n * Rewrite an expression, prefixing all path accessors with\n * `scope.` and generate getter/setter functions.\n *\n * @param {String} exp\n * @return {Function}\n */\n\nfunction compileGetter(exp) {\n if (improperKeywordsRE.test(exp)) {\n process.env.NODE_ENV !== 'production' && warn('Avoid using reserved keywords in expression: ' + exp);\n }\n // reset state\n saved.length = 0;\n // save strings and object literal keys\n var body = exp.replace(saveRE, save).replace(wsRE, '');\n // rewrite all paths\n // pad 1 space here becaue the regex matches 1 extra char\n body = (' ' + body).replace(identRE, rewrite).replace(restoreRE, restore);\n return makeGetterFn(body);\n}\n\n/**\n * Build a getter function. Requires eval.\n *\n * We isolate the try/catch so it doesn't affect the\n * optimization of the parse function when it is not called.\n *\n * @param {String} body\n * @return {Function|undefined}\n */\n\nfunction makeGetterFn(body) {\n try {\n /* eslint-disable no-new-func */\n return new Function('scope', 'return ' + body + ';');\n /* eslint-enable no-new-func */\n } catch (e) {\n process.env.NODE_ENV !== 'production' && warn('Invalid expression. ' + 'Generated function body: ' + body);\n }\n}\n\n/**\n * Compile a setter function for the expression.\n *\n * @param {String} exp\n * @return {Function|undefined}\n */\n\nfunction compileSetter(exp) {\n var path = parsePath(exp);\n if (path) {\n return function (scope, val) {\n setPath(scope, path, val);\n };\n } else {\n process.env.NODE_ENV !== 'production' && warn('Invalid setter expression: ' + exp);\n }\n}\n\n/**\n * Parse an expression into re-written getter/setters.\n *\n * @param {String} exp\n * @param {Boolean} needSet\n * @return {Function}\n */\n\nfunction parseExpression(exp, needSet) {\n exp = exp.trim();\n // try cache\n var hit = expressionCache.get(exp);\n if (hit) {\n if (needSet && !hit.set) {\n hit.set = compileSetter(hit.exp);\n }\n return hit;\n }\n var res = { exp: exp };\n res.get = isSimplePath(exp) && exp.indexOf('[') < 0\n // optimized super simple getter\n ? makeGetterFn('scope.' + exp)\n // dynamic getter\n : compileGetter(exp);\n if (needSet) {\n res.set = compileSetter(exp);\n }\n expressionCache.put(exp, res);\n return res;\n}\n\n/**\n * Check if an expression is a simple path.\n *\n * @param {String} exp\n * @return {Boolean}\n */\n\nfunction isSimplePath(exp) {\n return pathTestRE.test(exp) &&\n // don't treat true/false as paths\n !booleanLiteralRE.test(exp) &&\n // Math constants e.g. Math.PI, Math.E etc.\n exp.slice(0, 5) !== 'Math.';\n}\n\nvar expression = Object.freeze({\n parseExpression: parseExpression,\n isSimplePath: isSimplePath\n});\n\n// we have two separate queues: one for directive updates\n// and one for user watcher registered via $watch().\n// we want to guarantee directive updates to be called\n// before user watchers so that when user watchers are\n// triggered, the DOM would have already been in updated\n// state.\n\nvar queue = [];\nvar userQueue = [];\nvar has = {};\nvar circular = {};\nvar waiting = false;\n\n/**\n * Reset the batcher's state.\n */\n\nfunction resetBatcherState() {\n queue.length = 0;\n userQueue.length = 0;\n has = {};\n circular = {};\n waiting = false;\n}\n\n/**\n * Flush both queues and run the watchers.\n */\n\nfunction flushBatcherQueue() {\n runBatcherQueue(queue);\n queue.length = 0;\n runBatcherQueue(userQueue);\n // user watchers triggered more internal watchers\n if (queue.length) {\n runBatcherQueue(queue);\n }\n // dev tool hook\n /* istanbul ignore if */\n if (devtools && config.devtools) {\n devtools.emit('flush');\n }\n resetBatcherState();\n}\n\n/**\n * Run the watchers in a single queue.\n *\n * @param {Array} queue\n */\n\nfunction runBatcherQueue(queue) {\n // do not cache length because more watchers might be pushed\n // as we run existing watchers\n for (var i = 0; i < queue.length; i++) {\n var watcher = queue[i];\n var id = watcher.id;\n has[id] = null;\n watcher.run();\n // in dev build, check and stop circular updates.\n if (process.env.NODE_ENV !== 'production' && has[id] != null) {\n circular[id] = (circular[id] || 0) + 1;\n if (circular[id] > config._maxUpdateCount) {\n warn('You may have an infinite update loop for watcher ' + 'with expression \"' + watcher.expression + '\"', watcher.vm);\n break;\n }\n }\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 *\n * @param {Watcher} watcher\n * properties:\n * - {Number} id\n * - {Function} run\n */\n\nfunction pushWatcher(watcher) {\n var id = watcher.id;\n if (has[id] == null) {\n // push watcher into appropriate queue\n var q = watcher.user ? userQueue : queue;\n has[id] = q.length;\n q.push(watcher);\n // queue the flush\n if (!waiting) {\n waiting = true;\n nextTick(flushBatcherQueue);\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 *\n * @param {Vue} vm\n * @param {String|Function} expOrFn\n * @param {Function} cb\n * @param {Object} options\n * - {Array} filters\n * - {Boolean} twoWay\n * - {Boolean} deep\n * - {Boolean} user\n * - {Boolean} sync\n * - {Boolean} lazy\n * - {Function} [preProcess]\n * - {Function} [postProcess]\n * @constructor\n */\nfunction Watcher(vm, expOrFn, cb, options) {\n // mix in options\n if (options) {\n extend(this, options);\n }\n var isFn = typeof expOrFn === 'function';\n this.vm = vm;\n vm._watchers.push(this);\n this.expression = expOrFn;\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.prevError = null; // for async error stacks\n // parse expression for getter/setter\n if (isFn) {\n this.getter = expOrFn;\n this.setter = undefined;\n } else {\n var res = parseExpression(expOrFn, this.twoWay);\n this.getter = res.get;\n this.setter = res.set;\n }\n this.value = this.lazy ? undefined : this.get();\n // state for avoiding false triggers for deep and Array\n // watchers during vm._digest()\n this.queued = this.shallow = false;\n}\n\n/**\n * Evaluate the getter, and re-collect dependencies.\n */\n\nWatcher.prototype.get = function () {\n this.beforeGet();\n var scope = this.scope || this.vm;\n var value;\n try {\n value = this.getter.call(scope, scope);\n } catch (e) {\n if (process.env.NODE_ENV !== 'production' && config.warnExpressionErrors) {\n warn('Error when evaluating expression ' + '\"' + this.expression + '\": ' + e.toString(), this.vm);\n }\n }\n // \"touch\" every property so they are all tracked as\n // dependencies for deep watching\n if (this.deep) {\n traverse(value);\n }\n if (this.preProcess) {\n value = this.preProcess(value);\n }\n if (this.filters) {\n value = scope._applyFilters(value, null, this.filters, false);\n }\n if (this.postProcess) {\n value = this.postProcess(value);\n }\n this.afterGet();\n return value;\n};\n\n/**\n * Set the corresponding value with the setter.\n *\n * @param {*} value\n */\n\nWatcher.prototype.set = function (value) {\n var scope = this.scope || this.vm;\n if (this.filters) {\n value = scope._applyFilters(value, this.value, this.filters, true);\n }\n try {\n this.setter.call(scope, scope, value);\n } catch (e) {\n if (process.env.NODE_ENV !== 'production' && config.warnExpressionErrors) {\n warn('Error when evaluating setter ' + '\"' + this.expression + '\": ' + e.toString(), this.vm);\n }\n }\n // two-way sync for v-for alias\n var forContext = scope.$forContext;\n if (forContext && forContext.alias === this.expression) {\n if (forContext.filters) {\n process.env.NODE_ENV !== 'production' && warn('It seems you are using two-way binding on ' + 'a v-for alias (' + this.expression + '), and the ' + 'v-for has filters. This will not work properly. ' + 'Either remove the filters or use an array of ' + 'objects and bind to object properties instead.', this.vm);\n return;\n }\n forContext._withLock(function () {\n if (scope.$key) {\n // original is an object\n forContext.rawValue[scope.$key] = value;\n } else {\n forContext.rawValue.$set(scope.$index, value);\n }\n });\n }\n};\n\n/**\n * Prepare for dependency collection.\n */\n\nWatcher.prototype.beforeGet = function () {\n Dep.target = this;\n};\n\n/**\n * Add a dependency to this directive.\n *\n * @param {Dep} dep\n */\n\nWatcher.prototype.addDep = function (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 */\n\nWatcher.prototype.afterGet = function () {\n Dep.target = null;\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 *\n * @param {Boolean} shallow\n */\n\nWatcher.prototype.update = function (shallow) {\n if (this.lazy) {\n this.dirty = true;\n } else if (this.sync || !config.async) {\n this.run();\n } else {\n // if queued, only overwrite shallow with non-shallow,\n // but not the other way around.\n this.shallow = this.queued ? shallow ? this.shallow : false : !!shallow;\n this.queued = true;\n // record before-push error stack in debug mode\n /* istanbul ignore if */\n if (process.env.NODE_ENV !== 'production' && config.debug) {\n this.prevError = new Error('[vue] async stack trace');\n }\n pushWatcher(this);\n }\n};\n\n/**\n * Batcher job interface.\n * Will be called by the batcher.\n */\n\nWatcher.prototype.run = function () {\n if (this.active) {\n var value = this.get();\n if (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; but only do so if this is a\n // non-shallow update (caused by a vm digest).\n (isObject(value) || this.deep) && !this.shallow) {\n // set new value\n var oldValue = this.value;\n this.value = value;\n // in debug + async mode, when a watcher callbacks\n // throws, we also throw the saved before-push error\n // so the full cross-tick stack trace is available.\n var prevError = this.prevError;\n /* istanbul ignore if */\n if (process.env.NODE_ENV !== 'production' && config.debug && prevError) {\n this.prevError = null;\n try {\n this.cb.call(this.vm, value, oldValue);\n } catch (e) {\n nextTick(function () {\n throw prevError;\n }, 0);\n throw e;\n }\n } else {\n this.cb.call(this.vm, value, oldValue);\n }\n }\n this.queued = this.shallow = false;\n }\n};\n\n/**\n * Evaluate the value of the watcher.\n * This only gets called for lazy watchers.\n */\n\nWatcher.prototype.evaluate = function () {\n // avoid overwriting another watcher that is being\n // collected.\n var current = Dep.target;\n this.value = this.get();\n this.dirty = false;\n Dep.target = current;\n};\n\n/**\n * Depend on all deps collected by this watcher.\n */\n\nWatcher.prototype.depend = function () {\n var i = this.deps.length;\n while (i--) {\n this.deps[i].depend();\n }\n};\n\n/**\n * Remove self from all dependencies' subcriber list.\n */\n\nWatcher.prototype.teardown = function () {\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 or is performing a v-for\n // re-render (the watcher list is then filtered by v-for).\n if (!this.vm._isBeingDestroyed && !this.vm._vForRemoving) {\n this.vm._watchers.$remove(this);\n }\n var i = this.deps.length;\n while (i--) {\n this.deps[i].removeSub(this);\n }\n this.active = false;\n this.vm = this.cb = this.value = null;\n }\n};\n\n/**\n * Recrusively 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 *\n * @param {*} val\n */\n\nvar seenObjects = new _Set();\nfunction traverse(val, seen) {\n var i = undefined,\n keys = undefined;\n if (!seen) {\n seen = seenObjects;\n seen.clear();\n }\n var isA = isArray(val);\n var isO = isObject(val);\n if (isA || isO) {\n if (val.__ob__) {\n var depId = val.__ob__.dep.id;\n if (seen.has(depId)) {\n return;\n } else {\n seen.add(depId);\n }\n }\n if (isA) {\n i = val.length;\n while (i--) traverse(val[i], seen);\n } else if (isO) {\n keys = Object.keys(val);\n i = keys.length;\n while (i--) traverse(val[keys[i]], seen);\n }\n }\n}\n\nvar text$1 = {\n\n bind: function bind() {\n this.attr = this.el.nodeType === 3 ? 'data' : 'textContent';\n },\n\n update: function update(value) {\n this.el[this.attr] = _toString(value);\n }\n};\n\nvar templateCache = new Cache(1000);\nvar idSelectorCache = new Cache(1000);\n\nvar map = {\n efault: [0, '', ''],\n legend: [1, '
', '
'],\n tr: [2, '', '
'],\n col: [2, '', '
']\n};\n\nmap.td = map.th = [3, '', '
'];\n\nmap.option = map.optgroup = [1, ''];\n\nmap.thead = map.tbody = map.colgroup = map.caption = map.tfoot = [1, '', '
'];\n\nmap.g = map.defs = map.symbol = map.use = map.image = map.text = map.circle = map.ellipse = map.line = map.path = map.polygon = map.polyline = map.rect = [1, '', ''];\n\n/**\n * Check if a node is a supported template node with a\n * DocumentFragment content.\n *\n * @param {Node} node\n * @return {Boolean}\n */\n\nfunction isRealTemplate(node) {\n return isTemplate(node) && isFragment(node.content);\n}\n\nvar tagRE$1 = /<([\\w:-]+)/;\nvar entityRE = /&#?\\w+?;/;\n\n/**\n * Convert a string template to a DocumentFragment.\n * Determines correct wrapping by tag types. Wrapping\n * strategy found in jQuery & component/domify.\n *\n * @param {String} templateString\n * @param {Boolean} raw\n * @return {DocumentFragment}\n */\n\nfunction stringToFragment(templateString, raw) {\n // try a cache hit first\n var cacheKey = raw ? templateString : templateString.trim();\n var hit = templateCache.get(cacheKey);\n if (hit) {\n return hit;\n }\n\n var frag = document.createDocumentFragment();\n var tagMatch = templateString.match(tagRE$1);\n var entityMatch = entityRE.test(templateString);\n\n if (!tagMatch && !entityMatch) {\n // text only, return a single text node.\n frag.appendChild(document.createTextNode(templateString));\n } else {\n var tag = tagMatch && tagMatch[1];\n var wrap = map[tag] || map.efault;\n var depth = wrap[0];\n var prefix = wrap[1];\n var suffix = wrap[2];\n var node = document.createElement('div');\n\n node.innerHTML = prefix + templateString + suffix;\n while (depth--) {\n node = node.lastChild;\n }\n\n var child;\n /* eslint-disable no-cond-assign */\n while (child = node.firstChild) {\n /* eslint-enable no-cond-assign */\n frag.appendChild(child);\n }\n }\n if (!raw) {\n trimNode(frag);\n }\n templateCache.put(cacheKey, frag);\n return frag;\n}\n\n/**\n * Convert a template node to a DocumentFragment.\n *\n * @param {Node} node\n * @return {DocumentFragment}\n */\n\nfunction nodeToFragment(node) {\n // if its a template tag and the browser supports it,\n // its content is already a document fragment. However, iOS Safari has\n // bug when using directly cloned template content with touch\n // events and can cause crashes when the nodes are removed from DOM, so we\n // have to treat template elements as string templates. (#2805)\n /* istanbul ignore if */\n if (isRealTemplate(node)) {\n return stringToFragment(node.innerHTML);\n }\n // script template\n if (node.tagName === 'SCRIPT') {\n return stringToFragment(node.textContent);\n }\n // normal node, clone it to avoid mutating the original\n var clonedNode = cloneNode(node);\n var frag = document.createDocumentFragment();\n var child;\n /* eslint-disable no-cond-assign */\n while (child = clonedNode.firstChild) {\n /* eslint-enable no-cond-assign */\n frag.appendChild(child);\n }\n trimNode(frag);\n return frag;\n}\n\n// Test for the presence of the Safari template cloning bug\n// https://bugs.webkit.org/showug.cgi?id=137755\nvar hasBrokenTemplate = (function () {\n /* istanbul ignore else */\n if (inBrowser) {\n var a = document.createElement('div');\n a.innerHTML = '';\n return !a.cloneNode(true).firstChild.innerHTML;\n } else {\n return false;\n }\n})();\n\n// Test for IE10/11 textarea placeholder clone bug\nvar hasTextareaCloneBug = (function () {\n /* istanbul ignore else */\n if (inBrowser) {\n var t = document.createElement('textarea');\n t.placeholder = 't';\n return t.cloneNode(true).value === 't';\n } else {\n return false;\n }\n})();\n\n/**\n * 1. Deal with Safari cloning nested