jwt-ui 1.0.4 → 1.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -41549,7 +41549,7 @@ const __exports__ = /*#__PURE__*/(0,exportHelper/* default */.Z)(JwtIconvue_type
41549
41549
 
41550
41550
  /***/ }),
41551
41551
 
41552
- /***/ 7363:
41552
+ /***/ 7047:
41553
41553
  /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
41554
41554
 
41555
41555
  "use strict";
@@ -41563,10 +41563,10 @@ __webpack_require__.d(__webpack_exports__, {
41563
41563
 
41564
41564
  // EXTERNAL MODULE: external {"commonjs":"vue","commonjs2":"vue","root":"Vue"}
41565
41565
  var external_commonjs_vue_commonjs2_vue_root_Vue_ = __webpack_require__(3797);
41566
- ;// CONCATENATED MODULE: ./node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib/index.js??clonedRuleSet-40.use[1]!./node_modules/vue-loader/dist/templateLoader.js??ruleSet[1].rules[3]!./node_modules/vue-loader/dist/index.js??ruleSet[0].use[0]!./src/packages/JwtIconSelect/index.vue?vue&type=template&id=5e3b233f&scoped=true
41566
+ ;// CONCATENATED MODULE: ./node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib/index.js??clonedRuleSet-40.use[1]!./node_modules/vue-loader/dist/templateLoader.js??ruleSet[1].rules[3]!./node_modules/vue-loader/dist/index.js??ruleSet[0].use[0]!./src/packages/JwtIconSelect/index.vue?vue&type=template&id=45bb6640&scoped=true
41567
41567
 
41568
41568
 
41569
- const _withScopeId = n => ((0,external_commonjs_vue_commonjs2_vue_root_Vue_.pushScopeId)("data-v-5e3b233f"), n = n(), (0,external_commonjs_vue_commonjs2_vue_root_Vue_.popScopeId)(), n);
41569
+ const _withScopeId = n => ((0,external_commonjs_vue_commonjs2_vue_root_Vue_.pushScopeId)("data-v-45bb6640"), n = n(), (0,external_commonjs_vue_commonjs2_vue_root_Vue_.popScopeId)(), n);
41570
41570
 
41571
41571
  const _hoisted_1 = /*#__PURE__*/_withScopeId(() => /*#__PURE__*/(0,external_commonjs_vue_commonjs2_vue_root_Vue_.createElementVNode)("span", {
41572
41572
  style: {
@@ -41685,7 +41685,7 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
41685
41685
  _: 1
41686
41686
  });
41687
41687
  }
41688
- ;// CONCATENATED MODULE: ./src/packages/JwtIconSelect/index.vue?vue&type=template&id=5e3b233f&scoped=true
41688
+ ;// CONCATENATED MODULE: ./src/packages/JwtIconSelect/index.vue?vue&type=template&id=45bb6640&scoped=true
41689
41689
 
41690
41690
  // EXTERNAL MODULE: ./node_modules/core-js/modules/es.array.includes.js
41691
41691
  var es_array_includes = __webpack_require__(6699);
@@ -41772,10 +41772,10 @@ const pageSize = 16;
41772
41772
  }));
41773
41773
  ;// CONCATENATED MODULE: ./src/packages/JwtIconSelect/index.vue?vue&type=script&lang=js
41774
41774
 
41775
- ;// CONCATENATED MODULE: ./node_modules/mini-css-extract-plugin/dist/loader.js??clonedRuleSet-22.use[0]!./node_modules/css-loader/dist/cjs.js??clonedRuleSet-22.use[1]!./node_modules/vue-loader/dist/stylePostLoader.js!./node_modules/postcss-loader/dist/cjs.js??clonedRuleSet-22.use[2]!./node_modules/sass-loader/dist/cjs.js??clonedRuleSet-22.use[3]!./node_modules/vue-loader/dist/index.js??ruleSet[0].use[0]!./src/packages/JwtIconSelect/index.vue?vue&type=style&index=0&id=5e3b233f&lang=scss&scoped=true
41775
+ ;// CONCATENATED MODULE: ./node_modules/mini-css-extract-plugin/dist/loader.js??clonedRuleSet-22.use[0]!./node_modules/css-loader/dist/cjs.js??clonedRuleSet-22.use[1]!./node_modules/vue-loader/dist/stylePostLoader.js!./node_modules/postcss-loader/dist/cjs.js??clonedRuleSet-22.use[2]!./node_modules/sass-loader/dist/cjs.js??clonedRuleSet-22.use[3]!./node_modules/vue-loader/dist/index.js??ruleSet[0].use[0]!./src/packages/JwtIconSelect/index.vue?vue&type=style&index=0&id=45bb6640&lang=scss&scoped=true
41776
41776
  // extracted by mini-css-extract-plugin
41777
41777
 
41778
- ;// CONCATENATED MODULE: ./src/packages/JwtIconSelect/index.vue?vue&type=style&index=0&id=5e3b233f&lang=scss&scoped=true
41778
+ ;// CONCATENATED MODULE: ./src/packages/JwtIconSelect/index.vue?vue&type=style&index=0&id=45bb6640&lang=scss&scoped=true
41779
41779
 
41780
41780
  // EXTERNAL MODULE: ./node_modules/vue-loader/dist/exportHelper.js
41781
41781
  var exportHelper = __webpack_require__(3744);
@@ -41787,7 +41787,7 @@ var exportHelper = __webpack_require__(3744);
41787
41787
  ;
41788
41788
 
41789
41789
 
41790
- const __exports__ = /*#__PURE__*/(0,exportHelper/* default */.Z)(JwtIconSelectvue_type_script_lang_js, [['render',render],['__scopeId',"data-v-5e3b233f"]])
41790
+ const __exports__ = /*#__PURE__*/(0,exportHelper/* default */.Z)(JwtIconSelectvue_type_script_lang_js, [['render',render],['__scopeId',"data-v-45bb6640"]])
41791
41791
 
41792
41792
  /* harmony default export */ var JwtIconSelect = (__exports__);
41793
41793
 
@@ -42410,7 +42410,7 @@ const __exports__ = /*#__PURE__*/(0,exportHelper/* default */.Z)(JwtSelectServer
42410
42410
 
42411
42411
  /***/ }),
42412
42412
 
42413
- /***/ 9566:
42413
+ /***/ 3829:
42414
42414
  /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
42415
42415
 
42416
42416
  "use strict";
@@ -42424,10 +42424,10 @@ __webpack_require__.d(__webpack_exports__, {
42424
42424
 
42425
42425
  // EXTERNAL MODULE: external {"commonjs":"vue","commonjs2":"vue","root":"Vue"}
42426
42426
  var external_commonjs_vue_commonjs2_vue_root_Vue_ = __webpack_require__(3797);
42427
- ;// CONCATENATED MODULE: ./node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib/index.js??clonedRuleSet-40.use[1]!./node_modules/vue-loader/dist/templateLoader.js??ruleSet[1].rules[3]!./node_modules/vue-loader/dist/index.js??ruleSet[0].use[0]!./src/packages/JwtTable/index.vue?vue&type=template&id=755af22e&scoped=true
42427
+ ;// CONCATENATED MODULE: ./node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib/index.js??clonedRuleSet-40.use[1]!./node_modules/vue-loader/dist/templateLoader.js??ruleSet[1].rules[3]!./node_modules/vue-loader/dist/index.js??ruleSet[0].use[0]!./src/packages/JwtTable/index.vue?vue&type=template&id=9e6b1136&scoped=true
42428
42428
 
42429
42429
 
42430
- const _withScopeId = n => (_pushScopeId("data-v-755af22e"), n = n(), _popScopeId(), n);
42430
+ const _withScopeId = n => (_pushScopeId("data-v-9e6b1136"), n = n(), _popScopeId(), n);
42431
42431
 
42432
42432
  const _hoisted_1 = {
42433
42433
  class: "app-table-wrapper"
@@ -42663,7 +42663,7 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
42663
42663
  }, undefined, true)])])
42664
42664
  } : undefined]), 1040, ["modelValue", "title"])], 64);
42665
42665
  }
42666
- ;// CONCATENATED MODULE: ./src/packages/JwtTable/index.vue?vue&type=template&id=755af22e&scoped=true
42666
+ ;// CONCATENATED MODULE: ./src/packages/JwtTable/index.vue?vue&type=template&id=9e6b1136&scoped=true
42667
42667
 
42668
42668
  // EXTERNAL MODULE: ./node_modules/@vueuse/shared/index.mjs
42669
42669
  var shared = __webpack_require__(7475);
@@ -48225,3393 +48225,6 @@ const ElMessageBox = _MessageBox;
48225
48225
  var message = __webpack_require__(9489);
48226
48226
  // EXTERNAL MODULE: ./node_modules/lodash/lodash.js
48227
48227
  var lodash = __webpack_require__(6486);
48228
- ;// CONCATENATED MODULE: ./node_modules/vue-router/dist/vue-router.mjs
48229
- /*!
48230
- * vue-router v4.1.2
48231
- * (c) 2022 Eduardo San Martin Morote
48232
- * @license MIT
48233
- */
48234
-
48235
-
48236
-
48237
- const isBrowser = typeof window !== 'undefined';
48238
-
48239
- function isESModule(obj) {
48240
- return obj.__esModule || obj[Symbol.toStringTag] === 'Module';
48241
- }
48242
- const vue_router_assign = Object.assign;
48243
- function applyToParams(fn, params) {
48244
- const newParams = {};
48245
- for (const key in params) {
48246
- const value = params[key];
48247
- newParams[key] = vue_router_isArray(value)
48248
- ? value.map(fn)
48249
- : fn(value);
48250
- }
48251
- return newParams;
48252
- }
48253
- const noop = () => { };
48254
- /**
48255
- * Typesafe alternative to Array.isArray
48256
- * https://github.com/microsoft/TypeScript/pull/48228
48257
- */
48258
- const vue_router_isArray = Array.isArray;
48259
-
48260
- function warn(msg) {
48261
- // avoid using ...args as it breaks in older Edge builds
48262
- const args = Array.from(arguments).slice(1);
48263
- console.warn.apply(console, ['[Vue Router warn]: ' + msg].concat(args));
48264
- }
48265
-
48266
- const TRAILING_SLASH_RE = /\/$/;
48267
- const removeTrailingSlash = (path) => path.replace(TRAILING_SLASH_RE, '');
48268
- /**
48269
- * Transforms an URI into a normalized history location
48270
- *
48271
- * @param parseQuery
48272
- * @param location - URI to normalize
48273
- * @param currentLocation - current absolute location. Allows resolving relative
48274
- * paths. Must start with `/`. Defaults to `/`
48275
- * @returns a normalized history location
48276
- */
48277
- function parseURL(parseQuery, location, currentLocation = '/') {
48278
- let path, query = {}, searchString = '', hash = '';
48279
- // Could use URL and URLSearchParams but IE 11 doesn't support it
48280
- // TODO: move to new URL()
48281
- const hashPos = location.indexOf('#');
48282
- let searchPos = location.indexOf('?');
48283
- // the hash appears before the search, so it's not part of the search string
48284
- if (hashPos < searchPos && hashPos >= 0) {
48285
- searchPos = -1;
48286
- }
48287
- if (searchPos > -1) {
48288
- path = location.slice(0, searchPos);
48289
- searchString = location.slice(searchPos + 1, hashPos > -1 ? hashPos : location.length);
48290
- query = parseQuery(searchString);
48291
- }
48292
- if (hashPos > -1) {
48293
- path = path || location.slice(0, hashPos);
48294
- // keep the # character
48295
- hash = location.slice(hashPos, location.length);
48296
- }
48297
- // no search and no query
48298
- path = resolveRelativePath(path != null ? path : location, currentLocation);
48299
- // empty path means a relative query or hash `?foo=f`, `#thing`
48300
- return {
48301
- fullPath: path + (searchString && '?') + searchString + hash,
48302
- path,
48303
- query,
48304
- hash,
48305
- };
48306
- }
48307
- /**
48308
- * Stringifies a URL object
48309
- *
48310
- * @param stringifyQuery
48311
- * @param location
48312
- */
48313
- function stringifyURL(stringifyQuery, location) {
48314
- const query = location.query ? stringifyQuery(location.query) : '';
48315
- return location.path + (query && '?') + query + (location.hash || '');
48316
- }
48317
- /**
48318
- * Strips off the base from the beginning of a location.pathname in a non
48319
- * case-sensitive way.
48320
- *
48321
- * @param pathname - location.pathname
48322
- * @param base - base to strip off
48323
- */
48324
- function stripBase(pathname, base) {
48325
- // no base or base is not found at the beginning
48326
- if (!base || !pathname.toLowerCase().startsWith(base.toLowerCase()))
48327
- return pathname;
48328
- return pathname.slice(base.length) || '/';
48329
- }
48330
- /**
48331
- * Checks if two RouteLocation are equal. This means that both locations are
48332
- * pointing towards the same {@link RouteRecord} and that all `params`, `query`
48333
- * parameters and `hash` are the same
48334
- *
48335
- * @param a - first {@link RouteLocation}
48336
- * @param b - second {@link RouteLocation}
48337
- */
48338
- function isSameRouteLocation(stringifyQuery, a, b) {
48339
- const aLastIndex = a.matched.length - 1;
48340
- const bLastIndex = b.matched.length - 1;
48341
- return (aLastIndex > -1 &&
48342
- aLastIndex === bLastIndex &&
48343
- isSameRouteRecord(a.matched[aLastIndex], b.matched[bLastIndex]) &&
48344
- isSameRouteLocationParams(a.params, b.params) &&
48345
- stringifyQuery(a.query) === stringifyQuery(b.query) &&
48346
- a.hash === b.hash);
48347
- }
48348
- /**
48349
- * Check if two `RouteRecords` are equal. Takes into account aliases: they are
48350
- * considered equal to the `RouteRecord` they are aliasing.
48351
- *
48352
- * @param a - first {@link RouteRecord}
48353
- * @param b - second {@link RouteRecord}
48354
- */
48355
- function isSameRouteRecord(a, b) {
48356
- // since the original record has an undefined value for aliasOf
48357
- // but all aliases point to the original record, this will always compare
48358
- // the original record
48359
- return (a.aliasOf || a) === (b.aliasOf || b);
48360
- }
48361
- function isSameRouteLocationParams(a, b) {
48362
- if (Object.keys(a).length !== Object.keys(b).length)
48363
- return false;
48364
- for (const key in a) {
48365
- if (!isSameRouteLocationParamsValue(a[key], b[key]))
48366
- return false;
48367
- }
48368
- return true;
48369
- }
48370
- function isSameRouteLocationParamsValue(a, b) {
48371
- return vue_router_isArray(a)
48372
- ? isEquivalentArray(a, b)
48373
- : vue_router_isArray(b)
48374
- ? isEquivalentArray(b, a)
48375
- : a === b;
48376
- }
48377
- /**
48378
- * Check if two arrays are the same or if an array with one single entry is the
48379
- * same as another primitive value. Used to check query and parameters
48380
- *
48381
- * @param a - array of values
48382
- * @param b - array of values or a single value
48383
- */
48384
- function isEquivalentArray(a, b) {
48385
- return vue_router_isArray(b)
48386
- ? a.length === b.length && a.every((value, i) => value === b[i])
48387
- : a.length === 1 && a[0] === b;
48388
- }
48389
- /**
48390
- * Resolves a relative path that starts with `.`.
48391
- *
48392
- * @param to - path location we are resolving
48393
- * @param from - currentLocation.path, should start with `/`
48394
- */
48395
- function resolveRelativePath(to, from) {
48396
- if (to.startsWith('/'))
48397
- return to;
48398
- if (false) {}
48399
- if (!to)
48400
- return from;
48401
- const fromSegments = from.split('/');
48402
- const toSegments = to.split('/');
48403
- let position = fromSegments.length - 1;
48404
- let toPosition;
48405
- let segment;
48406
- for (toPosition = 0; toPosition < toSegments.length; toPosition++) {
48407
- segment = toSegments[toPosition];
48408
- // we stay on the same position
48409
- if (segment === '.')
48410
- continue;
48411
- // go up in the from array
48412
- if (segment === '..') {
48413
- // we can't go below zero but we still need to increment toPosition
48414
- if (position > 1)
48415
- position--;
48416
- // continue
48417
- }
48418
- // we reached a non relative path, we stop here
48419
- else
48420
- break;
48421
- }
48422
- return (fromSegments.slice(0, position).join('/') +
48423
- '/' +
48424
- toSegments
48425
- // ensure we use at least the last element in the toSegments
48426
- .slice(toPosition - (toPosition === toSegments.length ? 1 : 0))
48427
- .join('/'));
48428
- }
48429
-
48430
- var NavigationType;
48431
- (function (NavigationType) {
48432
- NavigationType["pop"] = "pop";
48433
- NavigationType["push"] = "push";
48434
- })(NavigationType || (NavigationType = {}));
48435
- var NavigationDirection;
48436
- (function (NavigationDirection) {
48437
- NavigationDirection["back"] = "back";
48438
- NavigationDirection["forward"] = "forward";
48439
- NavigationDirection["unknown"] = "";
48440
- })(NavigationDirection || (NavigationDirection = {}));
48441
- /**
48442
- * Starting location for Histories
48443
- */
48444
- const START = '';
48445
- // Generic utils
48446
- /**
48447
- * Normalizes a base by removing any trailing slash and reading the base tag if
48448
- * present.
48449
- *
48450
- * @param base - base to normalize
48451
- */
48452
- function normalizeBase(base) {
48453
- if (!base) {
48454
- if (isBrowser) {
48455
- // respect <base> tag
48456
- const baseEl = document.querySelector('base');
48457
- base = (baseEl && baseEl.getAttribute('href')) || '/';
48458
- // strip full URL origin
48459
- base = base.replace(/^\w+:\/\/[^\/]+/, '');
48460
- }
48461
- else {
48462
- base = '/';
48463
- }
48464
- }
48465
- // ensure leading slash when it was removed by the regex above avoid leading
48466
- // slash with hash because the file could be read from the disk like file://
48467
- // and the leading slash would cause problems
48468
- if (base[0] !== '/' && base[0] !== '#')
48469
- base = '/' + base;
48470
- // remove the trailing slash so all other method can just do `base + fullPath`
48471
- // to build an href
48472
- return removeTrailingSlash(base);
48473
- }
48474
- // remove any character before the hash
48475
- const BEFORE_HASH_RE = /^[^#]+#/;
48476
- function createHref(base, location) {
48477
- return base.replace(BEFORE_HASH_RE, '#') + location;
48478
- }
48479
-
48480
- function getElementPosition(el, offset) {
48481
- const docRect = document.documentElement.getBoundingClientRect();
48482
- const elRect = el.getBoundingClientRect();
48483
- return {
48484
- behavior: offset.behavior,
48485
- left: elRect.left - docRect.left - (offset.left || 0),
48486
- top: elRect.top - docRect.top - (offset.top || 0),
48487
- };
48488
- }
48489
- const computeScrollPosition = () => ({
48490
- left: window.pageXOffset,
48491
- top: window.pageYOffset,
48492
- });
48493
- function scrollToPosition(position) {
48494
- let scrollToOptions;
48495
- if ('el' in position) {
48496
- const positionEl = position.el;
48497
- const isIdSelector = typeof positionEl === 'string' && positionEl.startsWith('#');
48498
- /**
48499
- * `id`s can accept pretty much any characters, including CSS combinators
48500
- * like `>` or `~`. It's still possible to retrieve elements using
48501
- * `document.getElementById('~')` but it needs to be escaped when using
48502
- * `document.querySelector('#\\~')` for it to be valid. The only
48503
- * requirements for `id`s are them to be unique on the page and to not be
48504
- * empty (`id=""`). Because of that, when passing an id selector, it should
48505
- * be properly escaped for it to work with `querySelector`. We could check
48506
- * for the id selector to be simple (no CSS combinators `+ >~`) but that
48507
- * would make things inconsistent since they are valid characters for an
48508
- * `id` but would need to be escaped when using `querySelector`, breaking
48509
- * their usage and ending up in no selector returned. Selectors need to be
48510
- * escaped:
48511
- *
48512
- * - `#1-thing` becomes `#\31 -thing`
48513
- * - `#with~symbols` becomes `#with\\~symbols`
48514
- *
48515
- * - More information about the topic can be found at
48516
- * https://mathiasbynens.be/notes/html5-id-class.
48517
- * - Practical example: https://mathiasbynens.be/demo/html5-id
48518
- */
48519
- if (false) {}
48520
- const el = typeof positionEl === 'string'
48521
- ? isIdSelector
48522
- ? document.getElementById(positionEl.slice(1))
48523
- : document.querySelector(positionEl)
48524
- : positionEl;
48525
- if (!el) {
48526
- ( false) &&
48527
- 0;
48528
- return;
48529
- }
48530
- scrollToOptions = getElementPosition(el, position);
48531
- }
48532
- else {
48533
- scrollToOptions = position;
48534
- }
48535
- if ('scrollBehavior' in document.documentElement.style)
48536
- window.scrollTo(scrollToOptions);
48537
- else {
48538
- window.scrollTo(scrollToOptions.left != null ? scrollToOptions.left : window.pageXOffset, scrollToOptions.top != null ? scrollToOptions.top : window.pageYOffset);
48539
- }
48540
- }
48541
- function getScrollKey(path, delta) {
48542
- const position = history.state ? history.state.position - delta : -1;
48543
- return position + path;
48544
- }
48545
- const scrollPositions = new Map();
48546
- function saveScrollPosition(key, scrollPosition) {
48547
- scrollPositions.set(key, scrollPosition);
48548
- }
48549
- function getSavedScrollPosition(key) {
48550
- const scroll = scrollPositions.get(key);
48551
- // consume it so it's not used again
48552
- scrollPositions.delete(key);
48553
- return scroll;
48554
- }
48555
- // TODO: RFC about how to save scroll position
48556
- /**
48557
- * ScrollBehavior instance used by the router to compute and restore the scroll
48558
- * position when navigating.
48559
- */
48560
- // export interface ScrollHandler<ScrollPositionEntry extends HistoryStateValue, ScrollPosition extends ScrollPositionEntry> {
48561
- // // returns a scroll position that can be saved in history
48562
- // compute(): ScrollPositionEntry
48563
- // // can take an extended ScrollPositionEntry
48564
- // scroll(position: ScrollPosition): void
48565
- // }
48566
- // export const scrollHandler: ScrollHandler<ScrollPosition> = {
48567
- // compute: computeScroll,
48568
- // scroll: scrollToPosition,
48569
- // }
48570
-
48571
- let createBaseLocation = () => location.protocol + '//' + location.host;
48572
- /**
48573
- * Creates a normalized history location from a window.location object
48574
- * @param location -
48575
- */
48576
- function createCurrentLocation(base, location) {
48577
- const { pathname, search, hash } = location;
48578
- // allows hash bases like #, /#, #/, #!, #!/, /#!/, or even /folder#end
48579
- const hashPos = base.indexOf('#');
48580
- if (hashPos > -1) {
48581
- let slicePos = hash.includes(base.slice(hashPos))
48582
- ? base.slice(hashPos).length
48583
- : 1;
48584
- let pathFromHash = hash.slice(slicePos);
48585
- // prepend the starting slash to hash so the url starts with /#
48586
- if (pathFromHash[0] !== '/')
48587
- pathFromHash = '/' + pathFromHash;
48588
- return stripBase(pathFromHash, '');
48589
- }
48590
- const path = stripBase(pathname, base);
48591
- return path + search + hash;
48592
- }
48593
- function useHistoryListeners(base, historyState, currentLocation, replace) {
48594
- let listeners = [];
48595
- let teardowns = [];
48596
- // TODO: should it be a stack? a Dict. Check if the popstate listener
48597
- // can trigger twice
48598
- let pauseState = null;
48599
- const popStateHandler = ({ state, }) => {
48600
- const to = createCurrentLocation(base, location);
48601
- const from = currentLocation.value;
48602
- const fromState = historyState.value;
48603
- let delta = 0;
48604
- if (state) {
48605
- currentLocation.value = to;
48606
- historyState.value = state;
48607
- // ignore the popstate and reset the pauseState
48608
- if (pauseState && pauseState === from) {
48609
- pauseState = null;
48610
- return;
48611
- }
48612
- delta = fromState ? state.position - fromState.position : 0;
48613
- }
48614
- else {
48615
- replace(to);
48616
- }
48617
- // console.log({ deltaFromCurrent })
48618
- // Here we could also revert the navigation by calling history.go(-delta)
48619
- // this listener will have to be adapted to not trigger again and to wait for the url
48620
- // to be updated before triggering the listeners. Some kind of validation function would also
48621
- // need to be passed to the listeners so the navigation can be accepted
48622
- // call all listeners
48623
- listeners.forEach(listener => {
48624
- listener(currentLocation.value, from, {
48625
- delta,
48626
- type: NavigationType.pop,
48627
- direction: delta
48628
- ? delta > 0
48629
- ? NavigationDirection.forward
48630
- : NavigationDirection.back
48631
- : NavigationDirection.unknown,
48632
- });
48633
- });
48634
- };
48635
- function pauseListeners() {
48636
- pauseState = currentLocation.value;
48637
- }
48638
- function listen(callback) {
48639
- // setup the listener and prepare teardown callbacks
48640
- listeners.push(callback);
48641
- const teardown = () => {
48642
- const index = listeners.indexOf(callback);
48643
- if (index > -1)
48644
- listeners.splice(index, 1);
48645
- };
48646
- teardowns.push(teardown);
48647
- return teardown;
48648
- }
48649
- function beforeUnloadListener() {
48650
- const { history } = window;
48651
- if (!history.state)
48652
- return;
48653
- history.replaceState(vue_router_assign({}, history.state, { scroll: computeScrollPosition() }), '');
48654
- }
48655
- function destroy() {
48656
- for (const teardown of teardowns)
48657
- teardown();
48658
- teardowns = [];
48659
- window.removeEventListener('popstate', popStateHandler);
48660
- window.removeEventListener('beforeunload', beforeUnloadListener);
48661
- }
48662
- // setup the listeners and prepare teardown callbacks
48663
- window.addEventListener('popstate', popStateHandler);
48664
- window.addEventListener('beforeunload', beforeUnloadListener);
48665
- return {
48666
- pauseListeners,
48667
- listen,
48668
- destroy,
48669
- };
48670
- }
48671
- /**
48672
- * Creates a state object
48673
- */
48674
- function buildState(back, current, forward, replaced = false, computeScroll = false) {
48675
- return {
48676
- back,
48677
- current,
48678
- forward,
48679
- replaced,
48680
- position: window.history.length,
48681
- scroll: computeScroll ? computeScrollPosition() : null,
48682
- };
48683
- }
48684
- function useHistoryStateNavigation(base) {
48685
- const { history, location } = window;
48686
- // private variables
48687
- const currentLocation = {
48688
- value: createCurrentLocation(base, location),
48689
- };
48690
- const historyState = { value: history.state };
48691
- // build current history entry as this is a fresh navigation
48692
- if (!historyState.value) {
48693
- changeLocation(currentLocation.value, {
48694
- back: null,
48695
- current: currentLocation.value,
48696
- forward: null,
48697
- // the length is off by one, we need to decrease it
48698
- position: history.length - 1,
48699
- replaced: true,
48700
- // don't add a scroll as the user may have an anchor and we want
48701
- // scrollBehavior to be triggered without a saved position
48702
- scroll: null,
48703
- }, true);
48704
- }
48705
- function changeLocation(to, state, replace) {
48706
- /**
48707
- * if a base tag is provided and we are on a normal domain, we have to
48708
- * respect the provided `base` attribute because pushState() will use it and
48709
- * potentially erase anything before the `#` like at
48710
- * https://github.com/vuejs/router/issues/685 where a base of
48711
- * `/folder/#` but a base of `/` would erase the `/folder/` section. If
48712
- * there is no host, the `<base>` tag makes no sense and if there isn't a
48713
- * base tag we can just use everything after the `#`.
48714
- */
48715
- const hashIndex = base.indexOf('#');
48716
- const url = hashIndex > -1
48717
- ? (location.host && document.querySelector('base')
48718
- ? base
48719
- : base.slice(hashIndex)) + to
48720
- : createBaseLocation() + base + to;
48721
- try {
48722
- // BROWSER QUIRK
48723
- // NOTE: Safari throws a SecurityError when calling this function 100 times in 30 seconds
48724
- history[replace ? 'replaceState' : 'pushState'](state, '', url);
48725
- historyState.value = state;
48726
- }
48727
- catch (err) {
48728
- if ((false)) {}
48729
- else {
48730
- console.error(err);
48731
- }
48732
- // Force the navigation, this also resets the call count
48733
- location[replace ? 'replace' : 'assign'](url);
48734
- }
48735
- }
48736
- function replace(to, data) {
48737
- const state = vue_router_assign({}, history.state, buildState(historyState.value.back,
48738
- // keep back and forward entries but override current position
48739
- to, historyState.value.forward, true), data, { position: historyState.value.position });
48740
- changeLocation(to, state, true);
48741
- currentLocation.value = to;
48742
- }
48743
- function push(to, data) {
48744
- // Add to current entry the information of where we are going
48745
- // as well as saving the current position
48746
- const currentState = vue_router_assign({},
48747
- // use current history state to gracefully handle a wrong call to
48748
- // history.replaceState
48749
- // https://github.com/vuejs/router/issues/366
48750
- historyState.value, history.state, {
48751
- forward: to,
48752
- scroll: computeScrollPosition(),
48753
- });
48754
- if (false) {}
48755
- changeLocation(currentState.current, currentState, true);
48756
- const state = vue_router_assign({}, buildState(currentLocation.value, to, null), { position: currentState.position + 1 }, data);
48757
- changeLocation(to, state, false);
48758
- currentLocation.value = to;
48759
- }
48760
- return {
48761
- location: currentLocation,
48762
- state: historyState,
48763
- push,
48764
- replace,
48765
- };
48766
- }
48767
- /**
48768
- * Creates an HTML5 history. Most common history for single page applications.
48769
- *
48770
- * @param base -
48771
- */
48772
- function createWebHistory(base) {
48773
- base = normalizeBase(base);
48774
- const historyNavigation = useHistoryStateNavigation(base);
48775
- const historyListeners = useHistoryListeners(base, historyNavigation.state, historyNavigation.location, historyNavigation.replace);
48776
- function go(delta, triggerListeners = true) {
48777
- if (!triggerListeners)
48778
- historyListeners.pauseListeners();
48779
- history.go(delta);
48780
- }
48781
- const routerHistory = vue_router_assign({
48782
- // it's overridden right after
48783
- location: '',
48784
- base,
48785
- go,
48786
- createHref: createHref.bind(null, base),
48787
- }, historyNavigation, historyListeners);
48788
- Object.defineProperty(routerHistory, 'location', {
48789
- enumerable: true,
48790
- get: () => historyNavigation.location.value,
48791
- });
48792
- Object.defineProperty(routerHistory, 'state', {
48793
- enumerable: true,
48794
- get: () => historyNavigation.state.value,
48795
- });
48796
- return routerHistory;
48797
- }
48798
-
48799
- /**
48800
- * Creates a in-memory based history. The main purpose of this history is to handle SSR. It starts in a special location that is nowhere.
48801
- * It's up to the user to replace that location with the starter location by either calling `router.push` or `router.replace`.
48802
- *
48803
- * @param base - Base applied to all urls, defaults to '/'
48804
- * @returns a history object that can be passed to the router constructor
48805
- */
48806
- function createMemoryHistory(base = '') {
48807
- let listeners = [];
48808
- let queue = [START];
48809
- let position = 0;
48810
- base = normalizeBase(base);
48811
- function setLocation(location) {
48812
- position++;
48813
- if (position === queue.length) {
48814
- // we are at the end, we can simply append a new entry
48815
- queue.push(location);
48816
- }
48817
- else {
48818
- // we are in the middle, we remove everything from here in the queue
48819
- queue.splice(position);
48820
- queue.push(location);
48821
- }
48822
- }
48823
- function triggerListeners(to, from, { direction, delta }) {
48824
- const info = {
48825
- direction,
48826
- delta,
48827
- type: NavigationType.pop,
48828
- };
48829
- for (const callback of listeners) {
48830
- callback(to, from, info);
48831
- }
48832
- }
48833
- const routerHistory = {
48834
- // rewritten by Object.defineProperty
48835
- location: START,
48836
- // TODO: should be kept in queue
48837
- state: {},
48838
- base,
48839
- createHref: createHref.bind(null, base),
48840
- replace(to) {
48841
- // remove current entry and decrement position
48842
- queue.splice(position--, 1);
48843
- setLocation(to);
48844
- },
48845
- push(to, data) {
48846
- setLocation(to);
48847
- },
48848
- listen(callback) {
48849
- listeners.push(callback);
48850
- return () => {
48851
- const index = listeners.indexOf(callback);
48852
- if (index > -1)
48853
- listeners.splice(index, 1);
48854
- };
48855
- },
48856
- destroy() {
48857
- listeners = [];
48858
- queue = [START];
48859
- position = 0;
48860
- },
48861
- go(delta, shouldTrigger = true) {
48862
- const from = this.location;
48863
- const direction =
48864
- // we are considering delta === 0 going forward, but in abstract mode
48865
- // using 0 for the delta doesn't make sense like it does in html5 where
48866
- // it reloads the page
48867
- delta < 0 ? NavigationDirection.back : NavigationDirection.forward;
48868
- position = Math.max(0, Math.min(position + delta, queue.length - 1));
48869
- if (shouldTrigger) {
48870
- triggerListeners(this.location, from, {
48871
- direction,
48872
- delta,
48873
- });
48874
- }
48875
- },
48876
- };
48877
- Object.defineProperty(routerHistory, 'location', {
48878
- enumerable: true,
48879
- get: () => queue[position],
48880
- });
48881
- return routerHistory;
48882
- }
48883
-
48884
- /**
48885
- * Creates a hash history. Useful for web applications with no host (e.g. `file://`) or when configuring a server to
48886
- * handle any URL is not possible.
48887
- *
48888
- * @param base - optional base to provide. Defaults to `location.pathname + location.search` If there is a `<base>` tag
48889
- * in the `head`, its value will be ignored in favor of this parameter **but note it affects all the history.pushState()
48890
- * calls**, meaning that if you use a `<base>` tag, it's `href` value **has to match this parameter** (ignoring anything
48891
- * after the `#`).
48892
- *
48893
- * @example
48894
- * ```js
48895
- * // at https://example.com/folder
48896
- * createWebHashHistory() // gives a url of `https://example.com/folder#`
48897
- * createWebHashHistory('/folder/') // gives a url of `https://example.com/folder/#`
48898
- * // if the `#` is provided in the base, it won't be added by `createWebHashHistory`
48899
- * createWebHashHistory('/folder/#/app/') // gives a url of `https://example.com/folder/#/app/`
48900
- * // you should avoid doing this because it changes the original url and breaks copying urls
48901
- * createWebHashHistory('/other-folder/') // gives a url of `https://example.com/other-folder/#`
48902
- *
48903
- * // at file:///usr/etc/folder/index.html
48904
- * // for locations with no `host`, the base is ignored
48905
- * createWebHashHistory('/iAmIgnored') // gives a url of `file:///usr/etc/folder/index.html#`
48906
- * ```
48907
- */
48908
- function createWebHashHistory(base) {
48909
- // Make sure this implementation is fine in terms of encoding, specially for IE11
48910
- // for `file://`, directly use the pathname and ignore the base
48911
- // location.pathname contains an initial `/` even at the root: `https://example.com`
48912
- base = location.host ? base || location.pathname + location.search : '';
48913
- // allow the user to provide a `#` in the middle: `/base/#/app`
48914
- if (!base.includes('#'))
48915
- base += '#';
48916
- if (false) {}
48917
- return createWebHistory(base);
48918
- }
48919
-
48920
- function isRouteLocation(route) {
48921
- return typeof route === 'string' || (route && typeof route === 'object');
48922
- }
48923
- function isRouteName(name) {
48924
- return typeof name === 'string' || typeof name === 'symbol';
48925
- }
48926
-
48927
- /**
48928
- * Initial route location where the router is. Can be used in navigation guards
48929
- * to differentiate the initial navigation.
48930
- *
48931
- * @example
48932
- * ```js
48933
- * import { START_LOCATION } from 'vue-router'
48934
- *
48935
- * router.beforeEach((to, from) => {
48936
- * if (from === START_LOCATION) {
48937
- * // initial navigation
48938
- * }
48939
- * })
48940
- * ```
48941
- */
48942
- const START_LOCATION_NORMALIZED = {
48943
- path: '/',
48944
- name: undefined,
48945
- params: {},
48946
- query: {},
48947
- hash: '',
48948
- fullPath: '/',
48949
- matched: [],
48950
- meta: {},
48951
- redirectedFrom: undefined,
48952
- };
48953
-
48954
- const NavigationFailureSymbol = Symbol(( false) ? 0 : '');
48955
- /**
48956
- * Enumeration with all possible types for navigation failures. Can be passed to
48957
- * {@link isNavigationFailure} to check for specific failures.
48958
- */
48959
- var NavigationFailureType;
48960
- (function (NavigationFailureType) {
48961
- /**
48962
- * An aborted navigation is a navigation that failed because a navigation
48963
- * guard returned `false` or called `next(false)`
48964
- */
48965
- NavigationFailureType[NavigationFailureType["aborted"] = 4] = "aborted";
48966
- /**
48967
- * A cancelled navigation is a navigation that failed because a more recent
48968
- * navigation finished started (not necessarily finished).
48969
- */
48970
- NavigationFailureType[NavigationFailureType["cancelled"] = 8] = "cancelled";
48971
- /**
48972
- * A duplicated navigation is a navigation that failed because it was
48973
- * initiated while already being at the exact same location.
48974
- */
48975
- NavigationFailureType[NavigationFailureType["duplicated"] = 16] = "duplicated";
48976
- })(NavigationFailureType || (NavigationFailureType = {}));
48977
- // DEV only debug messages
48978
- const ErrorTypeMessages = {
48979
- [1 /* ErrorTypes.MATCHER_NOT_FOUND */]({ location, currentLocation }) {
48980
- return `No match for\n ${JSON.stringify(location)}${currentLocation
48981
- ? '\nwhile being at\n' + JSON.stringify(currentLocation)
48982
- : ''}`;
48983
- },
48984
- [2 /* ErrorTypes.NAVIGATION_GUARD_REDIRECT */]({ from, to, }) {
48985
- return `Redirected from "${from.fullPath}" to "${stringifyRoute(to)}" via a navigation guard.`;
48986
- },
48987
- [4 /* ErrorTypes.NAVIGATION_ABORTED */]({ from, to }) {
48988
- return `Navigation aborted from "${from.fullPath}" to "${to.fullPath}" via a navigation guard.`;
48989
- },
48990
- [8 /* ErrorTypes.NAVIGATION_CANCELLED */]({ from, to }) {
48991
- return `Navigation cancelled from "${from.fullPath}" to "${to.fullPath}" with a new navigation.`;
48992
- },
48993
- [16 /* ErrorTypes.NAVIGATION_DUPLICATED */]({ from, to }) {
48994
- return `Avoided redundant navigation to current location: "${from.fullPath}".`;
48995
- },
48996
- };
48997
- function createRouterError(type, params) {
48998
- // keep full error messages in cjs versions
48999
- if (false) {}
49000
- else {
49001
- return vue_router_assign(new Error(), {
49002
- type,
49003
- [NavigationFailureSymbol]: true,
49004
- }, params);
49005
- }
49006
- }
49007
- function isNavigationFailure(error, type) {
49008
- return (error instanceof Error &&
49009
- NavigationFailureSymbol in error &&
49010
- (type == null || !!(error.type & type)));
49011
- }
49012
- const propertiesToLog = ['params', 'query', 'hash'];
49013
- function stringifyRoute(to) {
49014
- if (typeof to === 'string')
49015
- return to;
49016
- if ('path' in to)
49017
- return to.path;
49018
- const location = {};
49019
- for (const key of propertiesToLog) {
49020
- if (key in to)
49021
- location[key] = to[key];
49022
- }
49023
- return JSON.stringify(location, null, 2);
49024
- }
49025
-
49026
- // default pattern for a param: non greedy everything but /
49027
- const BASE_PARAM_PATTERN = '[^/]+?';
49028
- const BASE_PATH_PARSER_OPTIONS = {
49029
- sensitive: false,
49030
- strict: false,
49031
- start: true,
49032
- end: true,
49033
- };
49034
- // Special Regex characters that must be escaped in static tokens
49035
- const REGEX_CHARS_RE = /[.+*?^${}()[\]/\\]/g;
49036
- /**
49037
- * Creates a path parser from an array of Segments (a segment is an array of Tokens)
49038
- *
49039
- * @param segments - array of segments returned by tokenizePath
49040
- * @param extraOptions - optional options for the regexp
49041
- * @returns a PathParser
49042
- */
49043
- function tokensToParser(segments, extraOptions) {
49044
- const options = vue_router_assign({}, BASE_PATH_PARSER_OPTIONS, extraOptions);
49045
- // the amount of scores is the same as the length of segments except for the root segment "/"
49046
- const score = [];
49047
- // the regexp as a string
49048
- let pattern = options.start ? '^' : '';
49049
- // extracted keys
49050
- const keys = [];
49051
- for (const segment of segments) {
49052
- // the root segment needs special treatment
49053
- const segmentScores = segment.length ? [] : [90 /* PathScore.Root */];
49054
- // allow trailing slash
49055
- if (options.strict && !segment.length)
49056
- pattern += '/';
49057
- for (let tokenIndex = 0; tokenIndex < segment.length; tokenIndex++) {
49058
- const token = segment[tokenIndex];
49059
- // resets the score if we are inside a sub segment /:a-other-:b
49060
- let subSegmentScore = 40 /* PathScore.Segment */ +
49061
- (options.sensitive ? 0.25 /* PathScore.BonusCaseSensitive */ : 0);
49062
- if (token.type === 0 /* TokenType.Static */) {
49063
- // prepend the slash if we are starting a new segment
49064
- if (!tokenIndex)
49065
- pattern += '/';
49066
- pattern += token.value.replace(REGEX_CHARS_RE, '\\$&');
49067
- subSegmentScore += 40 /* PathScore.Static */;
49068
- }
49069
- else if (token.type === 1 /* TokenType.Param */) {
49070
- const { value, repeatable, optional, regexp } = token;
49071
- keys.push({
49072
- name: value,
49073
- repeatable,
49074
- optional,
49075
- });
49076
- const re = regexp ? regexp : BASE_PARAM_PATTERN;
49077
- // the user provided a custom regexp /:id(\\d+)
49078
- if (re !== BASE_PARAM_PATTERN) {
49079
- subSegmentScore += 10 /* PathScore.BonusCustomRegExp */;
49080
- // make sure the regexp is valid before using it
49081
- try {
49082
- new RegExp(`(${re})`);
49083
- }
49084
- catch (err) {
49085
- throw new Error(`Invalid custom RegExp for param "${value}" (${re}): ` +
49086
- err.message);
49087
- }
49088
- }
49089
- // when we repeat we must take care of the repeating leading slash
49090
- let subPattern = repeatable ? `((?:${re})(?:/(?:${re}))*)` : `(${re})`;
49091
- // prepend the slash if we are starting a new segment
49092
- if (!tokenIndex)
49093
- subPattern =
49094
- // avoid an optional / if there are more segments e.g. /:p?-static
49095
- // or /:p?-:p2
49096
- optional && segment.length < 2
49097
- ? `(?:/${subPattern})`
49098
- : '/' + subPattern;
49099
- if (optional)
49100
- subPattern += '?';
49101
- pattern += subPattern;
49102
- subSegmentScore += 20 /* PathScore.Dynamic */;
49103
- if (optional)
49104
- subSegmentScore += -8 /* PathScore.BonusOptional */;
49105
- if (repeatable)
49106
- subSegmentScore += -20 /* PathScore.BonusRepeatable */;
49107
- if (re === '.*')
49108
- subSegmentScore += -50 /* PathScore.BonusWildcard */;
49109
- }
49110
- segmentScores.push(subSegmentScore);
49111
- }
49112
- // an empty array like /home/ -> [[{home}], []]
49113
- // if (!segment.length) pattern += '/'
49114
- score.push(segmentScores);
49115
- }
49116
- // only apply the strict bonus to the last score
49117
- if (options.strict && options.end) {
49118
- const i = score.length - 1;
49119
- score[i][score[i].length - 1] += 0.7000000000000001 /* PathScore.BonusStrict */;
49120
- }
49121
- // TODO: dev only warn double trailing slash
49122
- if (!options.strict)
49123
- pattern += '/?';
49124
- if (options.end)
49125
- pattern += '$';
49126
- // allow paths like /dynamic to only match dynamic or dynamic/... but not dynamic_something_else
49127
- else if (options.strict)
49128
- pattern += '(?:/|$)';
49129
- const re = new RegExp(pattern, options.sensitive ? '' : 'i');
49130
- function parse(path) {
49131
- const match = path.match(re);
49132
- const params = {};
49133
- if (!match)
49134
- return null;
49135
- for (let i = 1; i < match.length; i++) {
49136
- const value = match[i] || '';
49137
- const key = keys[i - 1];
49138
- params[key.name] = value && key.repeatable ? value.split('/') : value;
49139
- }
49140
- return params;
49141
- }
49142
- function stringify(params) {
49143
- let path = '';
49144
- // for optional parameters to allow to be empty
49145
- let avoidDuplicatedSlash = false;
49146
- for (const segment of segments) {
49147
- if (!avoidDuplicatedSlash || !path.endsWith('/'))
49148
- path += '/';
49149
- avoidDuplicatedSlash = false;
49150
- for (const token of segment) {
49151
- if (token.type === 0 /* TokenType.Static */) {
49152
- path += token.value;
49153
- }
49154
- else if (token.type === 1 /* TokenType.Param */) {
49155
- const { value, repeatable, optional } = token;
49156
- const param = value in params ? params[value] : '';
49157
- if (vue_router_isArray(param) && !repeatable) {
49158
- throw new Error(`Provided param "${value}" is an array but it is not repeatable (* or + modifiers)`);
49159
- }
49160
- const text = vue_router_isArray(param)
49161
- ? param.join('/')
49162
- : param;
49163
- if (!text) {
49164
- if (optional) {
49165
- // if we have more than one optional param like /:a?-static and there are more segments, we don't need to
49166
- // care about the optional param
49167
- if (segment.length < 2 && segments.length > 1) {
49168
- // remove the last slash as we could be at the end
49169
- if (path.endsWith('/'))
49170
- path = path.slice(0, -1);
49171
- // do not append a slash on the next iteration
49172
- else
49173
- avoidDuplicatedSlash = true;
49174
- }
49175
- }
49176
- else
49177
- throw new Error(`Missing required param "${value}"`);
49178
- }
49179
- path += text;
49180
- }
49181
- }
49182
- }
49183
- return path;
49184
- }
49185
- return {
49186
- re,
49187
- score,
49188
- keys,
49189
- parse,
49190
- stringify,
49191
- };
49192
- }
49193
- /**
49194
- * Compares an array of numbers as used in PathParser.score and returns a
49195
- * number. This function can be used to `sort` an array
49196
- *
49197
- * @param a - first array of numbers
49198
- * @param b - second array of numbers
49199
- * @returns 0 if both are equal, < 0 if a should be sorted first, > 0 if b
49200
- * should be sorted first
49201
- */
49202
- function compareScoreArray(a, b) {
49203
- let i = 0;
49204
- while (i < a.length && i < b.length) {
49205
- const diff = b[i] - a[i];
49206
- // only keep going if diff === 0
49207
- if (diff)
49208
- return diff;
49209
- i++;
49210
- }
49211
- // if the last subsegment was Static, the shorter segments should be sorted first
49212
- // otherwise sort the longest segment first
49213
- if (a.length < b.length) {
49214
- return a.length === 1 && a[0] === 40 /* PathScore.Static */ + 40 /* PathScore.Segment */
49215
- ? -1
49216
- : 1;
49217
- }
49218
- else if (a.length > b.length) {
49219
- return b.length === 1 && b[0] === 40 /* PathScore.Static */ + 40 /* PathScore.Segment */
49220
- ? 1
49221
- : -1;
49222
- }
49223
- return 0;
49224
- }
49225
- /**
49226
- * Compare function that can be used with `sort` to sort an array of PathParser
49227
- *
49228
- * @param a - first PathParser
49229
- * @param b - second PathParser
49230
- * @returns 0 if both are equal, < 0 if a should be sorted first, > 0 if b
49231
- */
49232
- function comparePathParserScore(a, b) {
49233
- let i = 0;
49234
- const aScore = a.score;
49235
- const bScore = b.score;
49236
- while (i < aScore.length && i < bScore.length) {
49237
- const comp = compareScoreArray(aScore[i], bScore[i]);
49238
- // do not return if both are equal
49239
- if (comp)
49240
- return comp;
49241
- i++;
49242
- }
49243
- if (Math.abs(bScore.length - aScore.length) === 1) {
49244
- if (isLastScoreNegative(aScore))
49245
- return 1;
49246
- if (isLastScoreNegative(bScore))
49247
- return -1;
49248
- }
49249
- // if a and b share the same score entries but b has more, sort b first
49250
- return bScore.length - aScore.length;
49251
- // this is the ternary version
49252
- // return aScore.length < bScore.length
49253
- // ? 1
49254
- // : aScore.length > bScore.length
49255
- // ? -1
49256
- // : 0
49257
- }
49258
- /**
49259
- * This allows detecting splats at the end of a path: /home/:id(.*)*
49260
- *
49261
- * @param score - score to check
49262
- * @returns true if the last entry is negative
49263
- */
49264
- function isLastScoreNegative(score) {
49265
- const last = score[score.length - 1];
49266
- return score.length > 0 && last[last.length - 1] < 0;
49267
- }
49268
-
49269
- const ROOT_TOKEN = {
49270
- type: 0 /* TokenType.Static */,
49271
- value: '',
49272
- };
49273
- const VALID_PARAM_RE = /[a-zA-Z0-9_]/;
49274
- // After some profiling, the cache seems to be unnecessary because tokenizePath
49275
- // (the slowest part of adding a route) is very fast
49276
- // const tokenCache = new Map<string, Token[][]>()
49277
- function tokenizePath(path) {
49278
- if (!path)
49279
- return [[]];
49280
- if (path === '/')
49281
- return [[ROOT_TOKEN]];
49282
- if (!path.startsWith('/')) {
49283
- throw new Error(( false)
49284
- ? 0
49285
- : `Invalid path "${path}"`);
49286
- }
49287
- // if (tokenCache.has(path)) return tokenCache.get(path)!
49288
- function crash(message) {
49289
- throw new Error(`ERR (${state})/"${buffer}": ${message}`);
49290
- }
49291
- let state = 0 /* TokenizerState.Static */;
49292
- let previousState = state;
49293
- const tokens = [];
49294
- // the segment will always be valid because we get into the initial state
49295
- // with the leading /
49296
- let segment;
49297
- function finalizeSegment() {
49298
- if (segment)
49299
- tokens.push(segment);
49300
- segment = [];
49301
- }
49302
- // index on the path
49303
- let i = 0;
49304
- // char at index
49305
- let char;
49306
- // buffer of the value read
49307
- let buffer = '';
49308
- // custom regexp for a param
49309
- let customRe = '';
49310
- function consumeBuffer() {
49311
- if (!buffer)
49312
- return;
49313
- if (state === 0 /* TokenizerState.Static */) {
49314
- segment.push({
49315
- type: 0 /* TokenType.Static */,
49316
- value: buffer,
49317
- });
49318
- }
49319
- else if (state === 1 /* TokenizerState.Param */ ||
49320
- state === 2 /* TokenizerState.ParamRegExp */ ||
49321
- state === 3 /* TokenizerState.ParamRegExpEnd */) {
49322
- if (segment.length > 1 && (char === '*' || char === '+'))
49323
- crash(`A repeatable param (${buffer}) must be alone in its segment. eg: '/:ids+.`);
49324
- segment.push({
49325
- type: 1 /* TokenType.Param */,
49326
- value: buffer,
49327
- regexp: customRe,
49328
- repeatable: char === '*' || char === '+',
49329
- optional: char === '*' || char === '?',
49330
- });
49331
- }
49332
- else {
49333
- crash('Invalid state to consume buffer');
49334
- }
49335
- buffer = '';
49336
- }
49337
- function addCharToBuffer() {
49338
- buffer += char;
49339
- }
49340
- while (i < path.length) {
49341
- char = path[i++];
49342
- if (char === '\\' && state !== 2 /* TokenizerState.ParamRegExp */) {
49343
- previousState = state;
49344
- state = 4 /* TokenizerState.EscapeNext */;
49345
- continue;
49346
- }
49347
- switch (state) {
49348
- case 0 /* TokenizerState.Static */:
49349
- if (char === '/') {
49350
- if (buffer) {
49351
- consumeBuffer();
49352
- }
49353
- finalizeSegment();
49354
- }
49355
- else if (char === ':') {
49356
- consumeBuffer();
49357
- state = 1 /* TokenizerState.Param */;
49358
- }
49359
- else {
49360
- addCharToBuffer();
49361
- }
49362
- break;
49363
- case 4 /* TokenizerState.EscapeNext */:
49364
- addCharToBuffer();
49365
- state = previousState;
49366
- break;
49367
- case 1 /* TokenizerState.Param */:
49368
- if (char === '(') {
49369
- state = 2 /* TokenizerState.ParamRegExp */;
49370
- }
49371
- else if (VALID_PARAM_RE.test(char)) {
49372
- addCharToBuffer();
49373
- }
49374
- else {
49375
- consumeBuffer();
49376
- state = 0 /* TokenizerState.Static */;
49377
- // go back one character if we were not modifying
49378
- if (char !== '*' && char !== '?' && char !== '+')
49379
- i--;
49380
- }
49381
- break;
49382
- case 2 /* TokenizerState.ParamRegExp */:
49383
- // TODO: is it worth handling nested regexp? like :p(?:prefix_([^/]+)_suffix)
49384
- // it already works by escaping the closing )
49385
- // https://paths.esm.dev/?p=AAMeJbiAwQEcDKbAoAAkP60PG2R6QAvgNaA6AFACM2ABuQBB#
49386
- // is this really something people need since you can also write
49387
- // /prefix_:p()_suffix
49388
- if (char === ')') {
49389
- // handle the escaped )
49390
- if (customRe[customRe.length - 1] == '\\')
49391
- customRe = customRe.slice(0, -1) + char;
49392
- else
49393
- state = 3 /* TokenizerState.ParamRegExpEnd */;
49394
- }
49395
- else {
49396
- customRe += char;
49397
- }
49398
- break;
49399
- case 3 /* TokenizerState.ParamRegExpEnd */:
49400
- // same as finalizing a param
49401
- consumeBuffer();
49402
- state = 0 /* TokenizerState.Static */;
49403
- // go back one character if we were not modifying
49404
- if (char !== '*' && char !== '?' && char !== '+')
49405
- i--;
49406
- customRe = '';
49407
- break;
49408
- default:
49409
- crash('Unknown state');
49410
- break;
49411
- }
49412
- }
49413
- if (state === 2 /* TokenizerState.ParamRegExp */)
49414
- crash(`Unfinished custom RegExp for param "${buffer}"`);
49415
- consumeBuffer();
49416
- finalizeSegment();
49417
- // tokenCache.set(path, tokens)
49418
- return tokens;
49419
- }
49420
-
49421
- function createRouteRecordMatcher(record, parent, options) {
49422
- const parser = tokensToParser(tokenizePath(record.path), options);
49423
- // warn against params with the same name
49424
- if ((false)) {}
49425
- const matcher = vue_router_assign(parser, {
49426
- record,
49427
- parent,
49428
- // these needs to be populated by the parent
49429
- children: [],
49430
- alias: [],
49431
- });
49432
- if (parent) {
49433
- // both are aliases or both are not aliases
49434
- // we don't want to mix them because the order is used when
49435
- // passing originalRecord in Matcher.addRoute
49436
- if (!matcher.record.aliasOf === !parent.record.aliasOf)
49437
- parent.children.push(matcher);
49438
- }
49439
- return matcher;
49440
- }
49441
-
49442
- /**
49443
- * Creates a Router Matcher.
49444
- *
49445
- * @internal
49446
- * @param routes - array of initial routes
49447
- * @param globalOptions - global route options
49448
- */
49449
- function createRouterMatcher(routes, globalOptions) {
49450
- // normalized ordered array of matchers
49451
- const matchers = [];
49452
- const matcherMap = new Map();
49453
- globalOptions = mergeOptions({ strict: false, end: true, sensitive: false }, globalOptions);
49454
- function getRecordMatcher(name) {
49455
- return matcherMap.get(name);
49456
- }
49457
- function addRoute(record, parent, originalRecord) {
49458
- // used later on to remove by name
49459
- const isRootAdd = !originalRecord;
49460
- const mainNormalizedRecord = normalizeRouteRecord(record);
49461
- if ((false)) {}
49462
- // we might be the child of an alias
49463
- mainNormalizedRecord.aliasOf = originalRecord && originalRecord.record;
49464
- const options = mergeOptions(globalOptions, record);
49465
- // generate an array of records to correctly handle aliases
49466
- const normalizedRecords = [
49467
- mainNormalizedRecord,
49468
- ];
49469
- if ('alias' in record) {
49470
- const aliases = typeof record.alias === 'string' ? [record.alias] : record.alias;
49471
- for (const alias of aliases) {
49472
- normalizedRecords.push(vue_router_assign({}, mainNormalizedRecord, {
49473
- // this allows us to hold a copy of the `components` option
49474
- // so that async components cache is hold on the original record
49475
- components: originalRecord
49476
- ? originalRecord.record.components
49477
- : mainNormalizedRecord.components,
49478
- path: alias,
49479
- // we might be the child of an alias
49480
- aliasOf: originalRecord
49481
- ? originalRecord.record
49482
- : mainNormalizedRecord,
49483
- // the aliases are always of the same kind as the original since they
49484
- // are defined on the same record
49485
- }));
49486
- }
49487
- }
49488
- let matcher;
49489
- let originalMatcher;
49490
- for (const normalizedRecord of normalizedRecords) {
49491
- const { path } = normalizedRecord;
49492
- // Build up the path for nested routes if the child isn't an absolute
49493
- // route. Only add the / delimiter if the child path isn't empty and if the
49494
- // parent path doesn't have a trailing slash
49495
- if (parent && path[0] !== '/') {
49496
- const parentPath = parent.record.path;
49497
- const connectingSlash = parentPath[parentPath.length - 1] === '/' ? '' : '/';
49498
- normalizedRecord.path =
49499
- parent.record.path + (path && connectingSlash + path);
49500
- }
49501
- if (false) {}
49502
- // create the object before hand so it can be passed to children
49503
- matcher = createRouteRecordMatcher(normalizedRecord, parent, options);
49504
- if (false)
49505
- {}
49506
- // if we are an alias we must tell the original record that we exist
49507
- // so we can be removed
49508
- if (originalRecord) {
49509
- originalRecord.alias.push(matcher);
49510
- if ((false)) {}
49511
- }
49512
- else {
49513
- // otherwise, the first record is the original and others are aliases
49514
- originalMatcher = originalMatcher || matcher;
49515
- if (originalMatcher !== matcher)
49516
- originalMatcher.alias.push(matcher);
49517
- // remove the route if named and only for the top record (avoid in nested calls)
49518
- // this works because the original record is the first one
49519
- if (isRootAdd && record.name && !isAliasRecord(matcher))
49520
- removeRoute(record.name);
49521
- }
49522
- if (mainNormalizedRecord.children) {
49523
- const children = mainNormalizedRecord.children;
49524
- for (let i = 0; i < children.length; i++) {
49525
- addRoute(children[i], matcher, originalRecord && originalRecord.children[i]);
49526
- }
49527
- }
49528
- // if there was no original record, then the first one was not an alias and all
49529
- // other alias (if any) need to reference this record when adding children
49530
- originalRecord = originalRecord || matcher;
49531
- // TODO: add normalized records for more flexibility
49532
- // if (parent && isAliasRecord(originalRecord)) {
49533
- // parent.children.push(originalRecord)
49534
- // }
49535
- insertMatcher(matcher);
49536
- }
49537
- return originalMatcher
49538
- ? () => {
49539
- // since other matchers are aliases, they should be removed by the original matcher
49540
- removeRoute(originalMatcher);
49541
- }
49542
- : noop;
49543
- }
49544
- function removeRoute(matcherRef) {
49545
- if (isRouteName(matcherRef)) {
49546
- const matcher = matcherMap.get(matcherRef);
49547
- if (matcher) {
49548
- matcherMap.delete(matcherRef);
49549
- matchers.splice(matchers.indexOf(matcher), 1);
49550
- matcher.children.forEach(removeRoute);
49551
- matcher.alias.forEach(removeRoute);
49552
- }
49553
- }
49554
- else {
49555
- const index = matchers.indexOf(matcherRef);
49556
- if (index > -1) {
49557
- matchers.splice(index, 1);
49558
- if (matcherRef.record.name)
49559
- matcherMap.delete(matcherRef.record.name);
49560
- matcherRef.children.forEach(removeRoute);
49561
- matcherRef.alias.forEach(removeRoute);
49562
- }
49563
- }
49564
- }
49565
- function getRoutes() {
49566
- return matchers;
49567
- }
49568
- function insertMatcher(matcher) {
49569
- let i = 0;
49570
- while (i < matchers.length &&
49571
- comparePathParserScore(matcher, matchers[i]) >= 0 &&
49572
- // Adding children with empty path should still appear before the parent
49573
- // https://github.com/vuejs/router/issues/1124
49574
- (matcher.record.path !== matchers[i].record.path ||
49575
- !isRecordChildOf(matcher, matchers[i])))
49576
- i++;
49577
- matchers.splice(i, 0, matcher);
49578
- // only add the original record to the name map
49579
- if (matcher.record.name && !isAliasRecord(matcher))
49580
- matcherMap.set(matcher.record.name, matcher);
49581
- }
49582
- function resolve(location, currentLocation) {
49583
- let matcher;
49584
- let params = {};
49585
- let path;
49586
- let name;
49587
- if ('name' in location && location.name) {
49588
- matcher = matcherMap.get(location.name);
49589
- if (!matcher)
49590
- throw createRouterError(1 /* ErrorTypes.MATCHER_NOT_FOUND */, {
49591
- location,
49592
- });
49593
- name = matcher.record.name;
49594
- params = vue_router_assign(
49595
- // paramsFromLocation is a new object
49596
- paramsFromLocation(currentLocation.params,
49597
- // only keep params that exist in the resolved location
49598
- // TODO: only keep optional params coming from a parent record
49599
- matcher.keys.filter(k => !k.optional).map(k => k.name)), location.params);
49600
- // throws if cannot be stringified
49601
- path = matcher.stringify(params);
49602
- }
49603
- else if ('path' in location) {
49604
- // no need to resolve the path with the matcher as it was provided
49605
- // this also allows the user to control the encoding
49606
- path = location.path;
49607
- if (false) {}
49608
- matcher = matchers.find(m => m.re.test(path));
49609
- // matcher should have a value after the loop
49610
- if (matcher) {
49611
- // TODO: dev warning of unused params if provided
49612
- // we know the matcher works because we tested the regexp
49613
- params = matcher.parse(path);
49614
- name = matcher.record.name;
49615
- }
49616
- // location is a relative path
49617
- }
49618
- else {
49619
- // match by name or path of current route
49620
- matcher = currentLocation.name
49621
- ? matcherMap.get(currentLocation.name)
49622
- : matchers.find(m => m.re.test(currentLocation.path));
49623
- if (!matcher)
49624
- throw createRouterError(1 /* ErrorTypes.MATCHER_NOT_FOUND */, {
49625
- location,
49626
- currentLocation,
49627
- });
49628
- name = matcher.record.name;
49629
- // since we are navigating to the same location, we don't need to pick the
49630
- // params like when `name` is provided
49631
- params = vue_router_assign({}, currentLocation.params, location.params);
49632
- path = matcher.stringify(params);
49633
- }
49634
- const matched = [];
49635
- let parentMatcher = matcher;
49636
- while (parentMatcher) {
49637
- // reversed order so parents are at the beginning
49638
- matched.unshift(parentMatcher.record);
49639
- parentMatcher = parentMatcher.parent;
49640
- }
49641
- return {
49642
- name,
49643
- path,
49644
- params,
49645
- matched,
49646
- meta: mergeMetaFields(matched),
49647
- };
49648
- }
49649
- // add initial routes
49650
- routes.forEach(route => addRoute(route));
49651
- return { addRoute, resolve, removeRoute, getRoutes, getRecordMatcher };
49652
- }
49653
- function paramsFromLocation(params, keys) {
49654
- const newParams = {};
49655
- for (const key of keys) {
49656
- if (key in params)
49657
- newParams[key] = params[key];
49658
- }
49659
- return newParams;
49660
- }
49661
- /**
49662
- * Normalizes a RouteRecordRaw. Creates a copy
49663
- *
49664
- * @param record
49665
- * @returns the normalized version
49666
- */
49667
- function normalizeRouteRecord(record) {
49668
- return {
49669
- path: record.path,
49670
- redirect: record.redirect,
49671
- name: record.name,
49672
- meta: record.meta || {},
49673
- aliasOf: undefined,
49674
- beforeEnter: record.beforeEnter,
49675
- props: normalizeRecordProps(record),
49676
- children: record.children || [],
49677
- instances: {},
49678
- leaveGuards: new Set(),
49679
- updateGuards: new Set(),
49680
- enterCallbacks: {},
49681
- components: 'components' in record
49682
- ? record.components || null
49683
- : record.component && { default: record.component },
49684
- };
49685
- }
49686
- /**
49687
- * Normalize the optional `props` in a record to always be an object similar to
49688
- * components. Also accept a boolean for components.
49689
- * @param record
49690
- */
49691
- function normalizeRecordProps(record) {
49692
- const propsObject = {};
49693
- // props does not exist on redirect records but we can set false directly
49694
- const props = record.props || false;
49695
- if ('component' in record) {
49696
- propsObject.default = props;
49697
- }
49698
- else {
49699
- // NOTE: we could also allow a function to be applied to every component.
49700
- // Would need user feedback for use cases
49701
- for (const name in record.components)
49702
- propsObject[name] = typeof props === 'boolean' ? props : props[name];
49703
- }
49704
- return propsObject;
49705
- }
49706
- /**
49707
- * Checks if a record or any of its parent is an alias
49708
- * @param record
49709
- */
49710
- function isAliasRecord(record) {
49711
- while (record) {
49712
- if (record.record.aliasOf)
49713
- return true;
49714
- record = record.parent;
49715
- }
49716
- return false;
49717
- }
49718
- /**
49719
- * Merge meta fields of an array of records
49720
- *
49721
- * @param matched - array of matched records
49722
- */
49723
- function mergeMetaFields(matched) {
49724
- return matched.reduce((meta, record) => vue_router_assign(meta, record.meta), {});
49725
- }
49726
- function mergeOptions(defaults, partialOptions) {
49727
- const options = {};
49728
- for (const key in defaults) {
49729
- options[key] = key in partialOptions ? partialOptions[key] : defaults[key];
49730
- }
49731
- return options;
49732
- }
49733
- function isSameParam(a, b) {
49734
- return (a.name === b.name &&
49735
- a.optional === b.optional &&
49736
- a.repeatable === b.repeatable);
49737
- }
49738
- /**
49739
- * Check if a path and its alias have the same required params
49740
- *
49741
- * @param a - original record
49742
- * @param b - alias record
49743
- */
49744
- function checkSameParams(a, b) {
49745
- for (const key of a.keys) {
49746
- if (!key.optional && !b.keys.find(isSameParam.bind(null, key)))
49747
- return warn(`Alias "${b.record.path}" and the original record: "${a.record.path}" should have the exact same param named "${key.name}"`);
49748
- }
49749
- for (const key of b.keys) {
49750
- if (!key.optional && !a.keys.find(isSameParam.bind(null, key)))
49751
- return warn(`Alias "${b.record.path}" and the original record: "${a.record.path}" should have the exact same param named "${key.name}"`);
49752
- }
49753
- }
49754
- /**
49755
- * A route with a name and a child with an empty path without a name should warn when adding the route
49756
- *
49757
- * @param mainNormalizedRecord - RouteRecordNormalized
49758
- * @param parent - RouteRecordMatcher
49759
- */
49760
- function checkChildMissingNameWithEmptyPath(mainNormalizedRecord, parent) {
49761
- if (parent &&
49762
- parent.record.name &&
49763
- !mainNormalizedRecord.name &&
49764
- !mainNormalizedRecord.path) {
49765
- warn(`The route named "${String(parent.record.name)}" has a child without a name and an empty path. Using that name won't render the empty path child so you probably want to move the name to the child instead. If this is intentional, add a name to the child route to remove the warning.`);
49766
- }
49767
- }
49768
- function checkMissingParamsInAbsolutePath(record, parent) {
49769
- for (const key of parent.keys) {
49770
- if (!record.keys.find(isSameParam.bind(null, key)))
49771
- return warn(`Absolute path "${record.record.path}" should have the exact same param named "${key.name}" as its parent "${parent.record.path}".`);
49772
- }
49773
- }
49774
- function isRecordChildOf(record, parent) {
49775
- return parent.children.some(child => child === record || isRecordChildOf(record, child));
49776
- }
49777
-
49778
- /**
49779
- * Encoding Rules ␣ = Space Path: ␣ " < > # ? { } Query: ␣ " < > # & = Hash: ␣ "
49780
- * < > `
49781
- *
49782
- * On top of that, the RFC3986 (https://tools.ietf.org/html/rfc3986#section-2.2)
49783
- * defines some extra characters to be encoded. Most browsers do not encode them
49784
- * in encodeURI https://github.com/whatwg/url/issues/369, so it may be safer to
49785
- * also encode `!'()*`. Leaving unencoded only ASCII alphanumeric(`a-zA-Z0-9`)
49786
- * plus `-._~`. This extra safety should be applied to query by patching the
49787
- * string returned by encodeURIComponent encodeURI also encodes `[\]^`. `\`
49788
- * should be encoded to avoid ambiguity. Browsers (IE, FF, C) transform a `\`
49789
- * into a `/` if directly typed in. The _backtick_ (`````) should also be
49790
- * encoded everywhere because some browsers like FF encode it when directly
49791
- * written while others don't. Safari and IE don't encode ``"<>{}``` in hash.
49792
- */
49793
- // const EXTRA_RESERVED_RE = /[!'()*]/g
49794
- // const encodeReservedReplacer = (c: string) => '%' + c.charCodeAt(0).toString(16)
49795
- const HASH_RE = /#/g; // %23
49796
- const AMPERSAND_RE = /&/g; // %26
49797
- const SLASH_RE = /\//g; // %2F
49798
- const EQUAL_RE = /=/g; // %3D
49799
- const IM_RE = /\?/g; // %3F
49800
- const PLUS_RE = /\+/g; // %2B
49801
- /**
49802
- * NOTE: It's not clear to me if we should encode the + symbol in queries, it
49803
- * seems to be less flexible than not doing so and I can't find out the legacy
49804
- * systems requiring this for regular requests like text/html. In the standard,
49805
- * the encoding of the plus character is only mentioned for
49806
- * application/x-www-form-urlencoded
49807
- * (https://url.spec.whatwg.org/#urlencoded-parsing) and most browsers seems lo
49808
- * leave the plus character as is in queries. To be more flexible, we allow the
49809
- * plus character on the query but it can also be manually encoded by the user.
49810
- *
49811
- * Resources:
49812
- * - https://url.spec.whatwg.org/#urlencoded-parsing
49813
- * - https://stackoverflow.com/questions/1634271/url-encoding-the-space-character-or-20
49814
- */
49815
- const ENC_BRACKET_OPEN_RE = /%5B/g; // [
49816
- const ENC_BRACKET_CLOSE_RE = /%5D/g; // ]
49817
- const ENC_CARET_RE = /%5E/g; // ^
49818
- const ENC_BACKTICK_RE = /%60/g; // `
49819
- const ENC_CURLY_OPEN_RE = /%7B/g; // {
49820
- const ENC_PIPE_RE = /%7C/g; // |
49821
- const ENC_CURLY_CLOSE_RE = /%7D/g; // }
49822
- const ENC_SPACE_RE = /%20/g; // }
49823
- /**
49824
- * Encode characters that need to be encoded on the path, search and hash
49825
- * sections of the URL.
49826
- *
49827
- * @internal
49828
- * @param text - string to encode
49829
- * @returns encoded string
49830
- */
49831
- function commonEncode(text) {
49832
- return encodeURI('' + text)
49833
- .replace(ENC_PIPE_RE, '|')
49834
- .replace(ENC_BRACKET_OPEN_RE, '[')
49835
- .replace(ENC_BRACKET_CLOSE_RE, ']');
49836
- }
49837
- /**
49838
- * Encode characters that need to be encoded on the hash section of the URL.
49839
- *
49840
- * @param text - string to encode
49841
- * @returns encoded string
49842
- */
49843
- function encodeHash(text) {
49844
- return commonEncode(text)
49845
- .replace(ENC_CURLY_OPEN_RE, '{')
49846
- .replace(ENC_CURLY_CLOSE_RE, '}')
49847
- .replace(ENC_CARET_RE, '^');
49848
- }
49849
- /**
49850
- * Encode characters that need to be encoded query values on the query
49851
- * section of the URL.
49852
- *
49853
- * @param text - string to encode
49854
- * @returns encoded string
49855
- */
49856
- function encodeQueryValue(text) {
49857
- return (commonEncode(text)
49858
- // Encode the space as +, encode the + to differentiate it from the space
49859
- .replace(PLUS_RE, '%2B')
49860
- .replace(ENC_SPACE_RE, '+')
49861
- .replace(HASH_RE, '%23')
49862
- .replace(AMPERSAND_RE, '%26')
49863
- .replace(ENC_BACKTICK_RE, '`')
49864
- .replace(ENC_CURLY_OPEN_RE, '{')
49865
- .replace(ENC_CURLY_CLOSE_RE, '}')
49866
- .replace(ENC_CARET_RE, '^'));
49867
- }
49868
- /**
49869
- * Like `encodeQueryValue` but also encodes the `=` character.
49870
- *
49871
- * @param text - string to encode
49872
- */
49873
- function encodeQueryKey(text) {
49874
- return encodeQueryValue(text).replace(EQUAL_RE, '%3D');
49875
- }
49876
- /**
49877
- * Encode characters that need to be encoded on the path section of the URL.
49878
- *
49879
- * @param text - string to encode
49880
- * @returns encoded string
49881
- */
49882
- function encodePath(text) {
49883
- return commonEncode(text).replace(HASH_RE, '%23').replace(IM_RE, '%3F');
49884
- }
49885
- /**
49886
- * Encode characters that need to be encoded on the path section of the URL as a
49887
- * param. This function encodes everything {@link encodePath} does plus the
49888
- * slash (`/`) character. If `text` is `null` or `undefined`, returns an empty
49889
- * string instead.
49890
- *
49891
- * @param text - string to encode
49892
- * @returns encoded string
49893
- */
49894
- function encodeParam(text) {
49895
- return text == null ? '' : encodePath(text).replace(SLASH_RE, '%2F');
49896
- }
49897
- /**
49898
- * Decode text using `decodeURIComponent`. Returns the original text if it
49899
- * fails.
49900
- *
49901
- * @param text - string to decode
49902
- * @returns decoded string
49903
- */
49904
- function decode(text) {
49905
- try {
49906
- return decodeURIComponent('' + text);
49907
- }
49908
- catch (err) {
49909
- ( false) && 0;
49910
- }
49911
- return '' + text;
49912
- }
49913
-
49914
- /**
49915
- * Transforms a queryString into a {@link LocationQuery} object. Accept both, a
49916
- * version with the leading `?` and without Should work as URLSearchParams
49917
-
49918
- * @internal
49919
- *
49920
- * @param search - search string to parse
49921
- * @returns a query object
49922
- */
49923
- function parseQuery(search) {
49924
- const query = {};
49925
- // avoid creating an object with an empty key and empty value
49926
- // because of split('&')
49927
- if (search === '' || search === '?')
49928
- return query;
49929
- const hasLeadingIM = search[0] === '?';
49930
- const searchParams = (hasLeadingIM ? search.slice(1) : search).split('&');
49931
- for (let i = 0; i < searchParams.length; ++i) {
49932
- // pre decode the + into space
49933
- const searchParam = searchParams[i].replace(PLUS_RE, ' ');
49934
- // allow the = character
49935
- const eqPos = searchParam.indexOf('=');
49936
- const key = decode(eqPos < 0 ? searchParam : searchParam.slice(0, eqPos));
49937
- const value = eqPos < 0 ? null : decode(searchParam.slice(eqPos + 1));
49938
- if (key in query) {
49939
- // an extra variable for ts types
49940
- let currentValue = query[key];
49941
- if (!vue_router_isArray(currentValue)) {
49942
- currentValue = query[key] = [currentValue];
49943
- }
49944
- currentValue.push(value);
49945
- }
49946
- else {
49947
- query[key] = value;
49948
- }
49949
- }
49950
- return query;
49951
- }
49952
- /**
49953
- * Stringifies a {@link LocationQueryRaw} object. Like `URLSearchParams`, it
49954
- * doesn't prepend a `?`
49955
- *
49956
- * @internal
49957
- *
49958
- * @param query - query object to stringify
49959
- * @returns string version of the query without the leading `?`
49960
- */
49961
- function stringifyQuery(query) {
49962
- let search = '';
49963
- for (let key in query) {
49964
- const value = query[key];
49965
- key = encodeQueryKey(key);
49966
- if (value == null) {
49967
- // only null adds the value
49968
- if (value !== undefined) {
49969
- search += (search.length ? '&' : '') + key;
49970
- }
49971
- continue;
49972
- }
49973
- // keep null values
49974
- const values = vue_router_isArray(value)
49975
- ? value.map(v => v && encodeQueryValue(v))
49976
- : [value && encodeQueryValue(value)];
49977
- values.forEach(value => {
49978
- // skip undefined values in arrays as if they were not present
49979
- // smaller code than using filter
49980
- if (value !== undefined) {
49981
- // only append & with non-empty search
49982
- search += (search.length ? '&' : '') + key;
49983
- if (value != null)
49984
- search += '=' + value;
49985
- }
49986
- });
49987
- }
49988
- return search;
49989
- }
49990
- /**
49991
- * Transforms a {@link LocationQueryRaw} into a {@link LocationQuery} by casting
49992
- * numbers into strings, removing keys with an undefined value and replacing
49993
- * undefined with null in arrays
49994
- *
49995
- * @param query - query object to normalize
49996
- * @returns a normalized query object
49997
- */
49998
- function normalizeQuery(query) {
49999
- const normalizedQuery = {};
50000
- for (const key in query) {
50001
- const value = query[key];
50002
- if (value !== undefined) {
50003
- normalizedQuery[key] = vue_router_isArray(value)
50004
- ? value.map(v => (v == null ? null : '' + v))
50005
- : value == null
50006
- ? value
50007
- : '' + value;
50008
- }
50009
- }
50010
- return normalizedQuery;
50011
- }
50012
-
50013
- /**
50014
- * RouteRecord being rendered by the closest ancestor Router View. Used for
50015
- * `onBeforeRouteUpdate` and `onBeforeRouteLeave`. rvlm stands for Router View
50016
- * Location Matched
50017
- *
50018
- * @internal
50019
- */
50020
- const matchedRouteKey = Symbol(( false) ? 0 : '');
50021
- /**
50022
- * Allows overriding the router view depth to control which component in
50023
- * `matched` is rendered. rvd stands for Router View Depth
50024
- *
50025
- * @internal
50026
- */
50027
- const viewDepthKey = Symbol(( false) ? 0 : '');
50028
- /**
50029
- * Allows overriding the router instance returned by `useRouter` in tests. r
50030
- * stands for router
50031
- *
50032
- * @internal
50033
- */
50034
- const routerKey = Symbol(( false) ? 0 : '');
50035
- /**
50036
- * Allows overriding the current route returned by `useRoute` in tests. rl
50037
- * stands for route location
50038
- *
50039
- * @internal
50040
- */
50041
- const routeLocationKey = Symbol(( false) ? 0 : '');
50042
- /**
50043
- * Allows overriding the current route used by router-view. Internally this is
50044
- * used when the `route` prop is passed.
50045
- *
50046
- * @internal
50047
- */
50048
- const routerViewLocationKey = Symbol(( false) ? 0 : '');
50049
-
50050
- /**
50051
- * Create a list of callbacks that can be reset. Used to create before and after navigation guards list
50052
- */
50053
- function useCallbacks() {
50054
- let handlers = [];
50055
- function add(handler) {
50056
- handlers.push(handler);
50057
- return () => {
50058
- const i = handlers.indexOf(handler);
50059
- if (i > -1)
50060
- handlers.splice(i, 1);
50061
- };
50062
- }
50063
- function reset() {
50064
- handlers = [];
50065
- }
50066
- return {
50067
- add,
50068
- list: () => handlers,
50069
- reset,
50070
- };
50071
- }
50072
-
50073
- function registerGuard(record, name, guard) {
50074
- const removeFromList = () => {
50075
- record[name].delete(guard);
50076
- };
50077
- onUnmounted(removeFromList);
50078
- onDeactivated(removeFromList);
50079
- onActivated(() => {
50080
- record[name].add(guard);
50081
- });
50082
- record[name].add(guard);
50083
- }
50084
- /**
50085
- * Add a navigation guard that triggers whenever the component for the current
50086
- * location is about to be left. Similar to {@link beforeRouteLeave} but can be
50087
- * used in any component. The guard is removed when the component is unmounted.
50088
- *
50089
- * @param leaveGuard - {@link NavigationGuard}
50090
- */
50091
- function onBeforeRouteLeave(leaveGuard) {
50092
- if (false) {}
50093
- const activeRecord = inject(matchedRouteKey,
50094
- // to avoid warning
50095
- {}).value;
50096
- if (!activeRecord) {
50097
- ( false) &&
50098
- 0;
50099
- return;
50100
- }
50101
- registerGuard(activeRecord, 'leaveGuards', leaveGuard);
50102
- }
50103
- /**
50104
- * Add a navigation guard that triggers whenever the current location is about
50105
- * to be updated. Similar to {@link beforeRouteUpdate} but can be used in any
50106
- * component. The guard is removed when the component is unmounted.
50107
- *
50108
- * @param updateGuard - {@link NavigationGuard}
50109
- */
50110
- function onBeforeRouteUpdate(updateGuard) {
50111
- if (false) {}
50112
- const activeRecord = inject(matchedRouteKey,
50113
- // to avoid warning
50114
- {}).value;
50115
- if (!activeRecord) {
50116
- ( false) &&
50117
- 0;
50118
- return;
50119
- }
50120
- registerGuard(activeRecord, 'updateGuards', updateGuard);
50121
- }
50122
- function guardToPromiseFn(guard, to, from, record, name) {
50123
- // keep a reference to the enterCallbackArray to prevent pushing callbacks if a new navigation took place
50124
- const enterCallbackArray = record &&
50125
- // name is defined if record is because of the function overload
50126
- (record.enterCallbacks[name] = record.enterCallbacks[name] || []);
50127
- return () => new Promise((resolve, reject) => {
50128
- const next = (valid) => {
50129
- if (valid === false)
50130
- reject(createRouterError(4 /* ErrorTypes.NAVIGATION_ABORTED */, {
50131
- from,
50132
- to,
50133
- }));
50134
- else if (valid instanceof Error) {
50135
- reject(valid);
50136
- }
50137
- else if (isRouteLocation(valid)) {
50138
- reject(createRouterError(2 /* ErrorTypes.NAVIGATION_GUARD_REDIRECT */, {
50139
- from: to,
50140
- to: valid,
50141
- }));
50142
- }
50143
- else {
50144
- if (enterCallbackArray &&
50145
- // since enterCallbackArray is truthy, both record and name also are
50146
- record.enterCallbacks[name] === enterCallbackArray &&
50147
- typeof valid === 'function')
50148
- enterCallbackArray.push(valid);
50149
- resolve();
50150
- }
50151
- };
50152
- // wrapping with Promise.resolve allows it to work with both async and sync guards
50153
- const guardReturn = guard.call(record && record.instances[name], to, from, ( false) ? 0 : next);
50154
- let guardCall = Promise.resolve(guardReturn);
50155
- if (guard.length < 3)
50156
- guardCall = guardCall.then(next);
50157
- if (false) {}
50158
- guardCall.catch(err => reject(err));
50159
- });
50160
- }
50161
- function canOnlyBeCalledOnce(next, to, from) {
50162
- let called = 0;
50163
- return function () {
50164
- if (called++ === 1)
50165
- warn(`The "next" callback was called more than once in one navigation guard when going from "${from.fullPath}" to "${to.fullPath}". It should be called exactly one time in each navigation guard. This will fail in production.`);
50166
- // @ts-expect-error: we put it in the original one because it's easier to check
50167
- next._called = true;
50168
- if (called === 1)
50169
- next.apply(null, arguments);
50170
- };
50171
- }
50172
- function extractComponentsGuards(matched, guardType, to, from) {
50173
- const guards = [];
50174
- for (const record of matched) {
50175
- if (false) {}
50176
- for (const name in record.components) {
50177
- let rawComponent = record.components[name];
50178
- if ((false)) {}
50179
- // skip update and leave guards if the route component is not mounted
50180
- if (guardType !== 'beforeRouteEnter' && !record.instances[name])
50181
- continue;
50182
- if (isRouteComponent(rawComponent)) {
50183
- // __vccOpts is added by vue-class-component and contain the regular options
50184
- const options = rawComponent.__vccOpts || rawComponent;
50185
- const guard = options[guardType];
50186
- guard && guards.push(guardToPromiseFn(guard, to, from, record, name));
50187
- }
50188
- else {
50189
- // start requesting the chunk already
50190
- let componentPromise = rawComponent();
50191
- if (false) {}
50192
- guards.push(() => componentPromise.then(resolved => {
50193
- if (!resolved)
50194
- return Promise.reject(new Error(`Couldn't resolve component "${name}" at "${record.path}"`));
50195
- const resolvedComponent = isESModule(resolved)
50196
- ? resolved.default
50197
- : resolved;
50198
- // replace the function with the resolved component
50199
- // cannot be null or undefined because we went into the for loop
50200
- record.components[name] = resolvedComponent;
50201
- // __vccOpts is added by vue-class-component and contain the regular options
50202
- const options = resolvedComponent.__vccOpts || resolvedComponent;
50203
- const guard = options[guardType];
50204
- return guard && guardToPromiseFn(guard, to, from, record, name)();
50205
- }));
50206
- }
50207
- }
50208
- }
50209
- return guards;
50210
- }
50211
- /**
50212
- * Allows differentiating lazy components from functional components and vue-class-component
50213
- * @internal
50214
- *
50215
- * @param component
50216
- */
50217
- function isRouteComponent(component) {
50218
- return (typeof component === 'object' ||
50219
- 'displayName' in component ||
50220
- 'props' in component ||
50221
- '__vccOpts' in component);
50222
- }
50223
- /**
50224
- * Ensures a route is loaded so it can be passed as o prop to `<RouterView>`.
50225
- *
50226
- * @param route - resolved route to load
50227
- */
50228
- function loadRouteLocation(route) {
50229
- return route.matched.every(record => record.redirect)
50230
- ? Promise.reject(new Error('Cannot load a route that redirects.'))
50231
- : Promise.all(route.matched.map(record => record.components &&
50232
- Promise.all(Object.keys(record.components).reduce((promises, name) => {
50233
- const rawComponent = record.components[name];
50234
- if (typeof rawComponent === 'function' &&
50235
- !('displayName' in rawComponent)) {
50236
- promises.push(rawComponent().then(resolved => {
50237
- if (!resolved)
50238
- return Promise.reject(new Error(`Couldn't resolve component "${name}" at "${record.path}". Ensure you passed a function that returns a promise.`));
50239
- const resolvedComponent = isESModule(resolved)
50240
- ? resolved.default
50241
- : resolved;
50242
- // replace the function with the resolved component
50243
- // cannot be null or undefined because we went into the for loop
50244
- record.components[name] = resolvedComponent;
50245
- return;
50246
- }));
50247
- }
50248
- return promises;
50249
- }, [])))).then(() => route);
50250
- }
50251
-
50252
- // TODO: we could allow currentRoute as a prop to expose `isActive` and
50253
- // `isExactActive` behavior should go through an RFC
50254
- function useLink(props) {
50255
- const router = (0,external_commonjs_vue_commonjs2_vue_root_Vue_.inject)(routerKey);
50256
- const currentRoute = (0,external_commonjs_vue_commonjs2_vue_root_Vue_.inject)(routeLocationKey);
50257
- const route = (0,external_commonjs_vue_commonjs2_vue_root_Vue_.computed)(() => router.resolve((0,external_commonjs_vue_commonjs2_vue_root_Vue_.unref)(props.to)));
50258
- const activeRecordIndex = (0,external_commonjs_vue_commonjs2_vue_root_Vue_.computed)(() => {
50259
- const { matched } = route.value;
50260
- const { length } = matched;
50261
- const routeMatched = matched[length - 1];
50262
- const currentMatched = currentRoute.matched;
50263
- if (!routeMatched || !currentMatched.length)
50264
- return -1;
50265
- const index = currentMatched.findIndex(isSameRouteRecord.bind(null, routeMatched));
50266
- if (index > -1)
50267
- return index;
50268
- // possible parent record
50269
- const parentRecordPath = getOriginalPath(matched[length - 2]);
50270
- return (
50271
- // we are dealing with nested routes
50272
- length > 1 &&
50273
- // if the parent and matched route have the same path, this link is
50274
- // referring to the empty child. Or we currently are on a different
50275
- // child of the same parent
50276
- getOriginalPath(routeMatched) === parentRecordPath &&
50277
- // avoid comparing the child with its parent
50278
- currentMatched[currentMatched.length - 1].path !== parentRecordPath
50279
- ? currentMatched.findIndex(isSameRouteRecord.bind(null, matched[length - 2]))
50280
- : index);
50281
- });
50282
- const isActive = (0,external_commonjs_vue_commonjs2_vue_root_Vue_.computed)(() => activeRecordIndex.value > -1 &&
50283
- includesParams(currentRoute.params, route.value.params));
50284
- const isExactActive = (0,external_commonjs_vue_commonjs2_vue_root_Vue_.computed)(() => activeRecordIndex.value > -1 &&
50285
- activeRecordIndex.value === currentRoute.matched.length - 1 &&
50286
- isSameRouteLocationParams(currentRoute.params, route.value.params));
50287
- function navigate(e = {}) {
50288
- if (guardEvent(e)) {
50289
- return router[(0,external_commonjs_vue_commonjs2_vue_root_Vue_.unref)(props.replace) ? 'replace' : 'push']((0,external_commonjs_vue_commonjs2_vue_root_Vue_.unref)(props.to)
50290
- // avoid uncaught errors are they are logged anyway
50291
- ).catch(noop);
50292
- }
50293
- return Promise.resolve();
50294
- }
50295
- // devtools only
50296
- if (false) {}
50297
- return {
50298
- route,
50299
- href: (0,external_commonjs_vue_commonjs2_vue_root_Vue_.computed)(() => route.value.href),
50300
- isActive,
50301
- isExactActive,
50302
- navigate,
50303
- };
50304
- }
50305
- const RouterLinkImpl = /*#__PURE__*/ (0,external_commonjs_vue_commonjs2_vue_root_Vue_.defineComponent)({
50306
- name: 'RouterLink',
50307
- compatConfig: { MODE: 3 },
50308
- props: {
50309
- to: {
50310
- type: [String, Object],
50311
- required: true,
50312
- },
50313
- replace: Boolean,
50314
- activeClass: String,
50315
- // inactiveClass: String,
50316
- exactActiveClass: String,
50317
- custom: Boolean,
50318
- ariaCurrentValue: {
50319
- type: String,
50320
- default: 'page',
50321
- },
50322
- },
50323
- useLink,
50324
- setup(props, { slots }) {
50325
- const link = (0,external_commonjs_vue_commonjs2_vue_root_Vue_.reactive)(useLink(props));
50326
- const { options } = (0,external_commonjs_vue_commonjs2_vue_root_Vue_.inject)(routerKey);
50327
- const elClass = (0,external_commonjs_vue_commonjs2_vue_root_Vue_.computed)(() => ({
50328
- [getLinkClass(props.activeClass, options.linkActiveClass, 'router-link-active')]: link.isActive,
50329
- // [getLinkClass(
50330
- // props.inactiveClass,
50331
- // options.linkInactiveClass,
50332
- // 'router-link-inactive'
50333
- // )]: !link.isExactActive,
50334
- [getLinkClass(props.exactActiveClass, options.linkExactActiveClass, 'router-link-exact-active')]: link.isExactActive,
50335
- }));
50336
- return () => {
50337
- const children = slots.default && slots.default(link);
50338
- return props.custom
50339
- ? children
50340
- : (0,external_commonjs_vue_commonjs2_vue_root_Vue_.h)('a', {
50341
- 'aria-current': link.isExactActive
50342
- ? props.ariaCurrentValue
50343
- : null,
50344
- href: link.href,
50345
- // this would override user added attrs but Vue will still add
50346
- // the listener so we end up triggering both
50347
- onClick: link.navigate,
50348
- class: elClass.value,
50349
- }, children);
50350
- };
50351
- },
50352
- });
50353
- // export the public type for h/tsx inference
50354
- // also to avoid inline import() in generated d.ts files
50355
- /**
50356
- * Component to render a link that triggers a navigation on click.
50357
- */
50358
- const RouterLink = (/* unused pure expression or super */ null && (RouterLinkImpl));
50359
- function guardEvent(e) {
50360
- // don't redirect with control keys
50361
- if (e.metaKey || e.altKey || e.ctrlKey || e.shiftKey)
50362
- return;
50363
- // don't redirect when preventDefault called
50364
- if (e.defaultPrevented)
50365
- return;
50366
- // don't redirect on right click
50367
- if (e.button !== undefined && e.button !== 0)
50368
- return;
50369
- // don't redirect if `target="_blank"`
50370
- // @ts-expect-error getAttribute does exist
50371
- if (e.currentTarget && e.currentTarget.getAttribute) {
50372
- // @ts-expect-error getAttribute exists
50373
- const target = e.currentTarget.getAttribute('target');
50374
- if (/\b_blank\b/i.test(target))
50375
- return;
50376
- }
50377
- // this may be a Weex event which doesn't have this method
50378
- if (e.preventDefault)
50379
- e.preventDefault();
50380
- return true;
50381
- }
50382
- function includesParams(outer, inner) {
50383
- for (const key in inner) {
50384
- const innerValue = inner[key];
50385
- const outerValue = outer[key];
50386
- if (typeof innerValue === 'string') {
50387
- if (innerValue !== outerValue)
50388
- return false;
50389
- }
50390
- else {
50391
- if (!vue_router_isArray(outerValue) ||
50392
- outerValue.length !== innerValue.length ||
50393
- innerValue.some((value, i) => value !== outerValue[i]))
50394
- return false;
50395
- }
50396
- }
50397
- return true;
50398
- }
50399
- /**
50400
- * Get the original path value of a record by following its aliasOf
50401
- * @param record
50402
- */
50403
- function getOriginalPath(record) {
50404
- return record ? (record.aliasOf ? record.aliasOf.path : record.path) : '';
50405
- }
50406
- /**
50407
- * Utility class to get the active class based on defaults.
50408
- * @param propClass
50409
- * @param globalClass
50410
- * @param defaultClass
50411
- */
50412
- const getLinkClass = (propClass, globalClass, defaultClass) => propClass != null
50413
- ? propClass
50414
- : globalClass != null
50415
- ? globalClass
50416
- : defaultClass;
50417
-
50418
- const RouterViewImpl = /*#__PURE__*/ (0,external_commonjs_vue_commonjs2_vue_root_Vue_.defineComponent)({
50419
- name: 'RouterView',
50420
- // #674 we manually inherit them
50421
- inheritAttrs: false,
50422
- props: {
50423
- name: {
50424
- type: String,
50425
- default: 'default',
50426
- },
50427
- route: Object,
50428
- },
50429
- // Better compat for @vue/compat users
50430
- // https://github.com/vuejs/router/issues/1315
50431
- compatConfig: { MODE: 3 },
50432
- setup(props, { attrs, slots }) {
50433
- ( false) && 0;
50434
- const injectedRoute = (0,external_commonjs_vue_commonjs2_vue_root_Vue_.inject)(routerViewLocationKey);
50435
- const routeToDisplay = (0,external_commonjs_vue_commonjs2_vue_root_Vue_.computed)(() => props.route || injectedRoute.value);
50436
- const injectedDepth = (0,external_commonjs_vue_commonjs2_vue_root_Vue_.inject)(viewDepthKey, 0);
50437
- // The depth changes based on empty components option, which allows passthrough routes e.g. routes with children
50438
- // that are used to reuse the `path` property
50439
- const depth = (0,external_commonjs_vue_commonjs2_vue_root_Vue_.computed)(() => {
50440
- let initialDepth = (0,external_commonjs_vue_commonjs2_vue_root_Vue_.unref)(injectedDepth);
50441
- const { matched } = routeToDisplay.value;
50442
- let matchedRoute;
50443
- while ((matchedRoute = matched[initialDepth]) &&
50444
- !matchedRoute.components) {
50445
- initialDepth++;
50446
- }
50447
- return initialDepth;
50448
- });
50449
- const matchedRouteRef = (0,external_commonjs_vue_commonjs2_vue_root_Vue_.computed)(() => routeToDisplay.value.matched[depth.value]);
50450
- (0,external_commonjs_vue_commonjs2_vue_root_Vue_.provide)(viewDepthKey, (0,external_commonjs_vue_commonjs2_vue_root_Vue_.computed)(() => depth.value + 1));
50451
- (0,external_commonjs_vue_commonjs2_vue_root_Vue_.provide)(matchedRouteKey, matchedRouteRef);
50452
- (0,external_commonjs_vue_commonjs2_vue_root_Vue_.provide)(routerViewLocationKey, routeToDisplay);
50453
- const viewRef = (0,external_commonjs_vue_commonjs2_vue_root_Vue_.ref)();
50454
- // watch at the same time the component instance, the route record we are
50455
- // rendering, and the name
50456
- (0,external_commonjs_vue_commonjs2_vue_root_Vue_.watch)(() => [viewRef.value, matchedRouteRef.value, props.name], ([instance, to, name], [oldInstance, from, oldName]) => {
50457
- // copy reused instances
50458
- if (to) {
50459
- // this will update the instance for new instances as well as reused
50460
- // instances when navigating to a new route
50461
- to.instances[name] = instance;
50462
- // the component instance is reused for a different route or name so
50463
- // we copy any saved update or leave guards. With async setup, the
50464
- // mounting component will mount before the matchedRoute changes,
50465
- // making instance === oldInstance, so we check if guards have been
50466
- // added before. This works because we remove guards when
50467
- // unmounting/deactivating components
50468
- if (from && from !== to && instance && instance === oldInstance) {
50469
- if (!to.leaveGuards.size) {
50470
- to.leaveGuards = from.leaveGuards;
50471
- }
50472
- if (!to.updateGuards.size) {
50473
- to.updateGuards = from.updateGuards;
50474
- }
50475
- }
50476
- }
50477
- // trigger beforeRouteEnter next callbacks
50478
- if (instance &&
50479
- to &&
50480
- // if there is no instance but to and from are the same this might be
50481
- // the first visit
50482
- (!from || !isSameRouteRecord(to, from) || !oldInstance)) {
50483
- (to.enterCallbacks[name] || []).forEach(callback => callback(instance));
50484
- }
50485
- }, { flush: 'post' });
50486
- return () => {
50487
- const route = routeToDisplay.value;
50488
- const matchedRoute = matchedRouteRef.value;
50489
- const ViewComponent = matchedRoute && matchedRoute.components[props.name];
50490
- // we need the value at the time we render because when we unmount, we
50491
- // navigated to a different location so the value is different
50492
- const currentName = props.name;
50493
- if (!ViewComponent) {
50494
- return normalizeSlot(slots.default, { Component: ViewComponent, route });
50495
- }
50496
- // props from route configuration
50497
- const routePropsOption = matchedRoute.props[props.name];
50498
- const routeProps = routePropsOption
50499
- ? routePropsOption === true
50500
- ? route.params
50501
- : typeof routePropsOption === 'function'
50502
- ? routePropsOption(route)
50503
- : routePropsOption
50504
- : null;
50505
- const onVnodeUnmounted = vnode => {
50506
- // remove the instance reference to prevent leak
50507
- if (vnode.component.isUnmounted) {
50508
- matchedRoute.instances[currentName] = null;
50509
- }
50510
- };
50511
- const component = (0,external_commonjs_vue_commonjs2_vue_root_Vue_.h)(ViewComponent, vue_router_assign({}, routeProps, attrs, {
50512
- onVnodeUnmounted,
50513
- ref: viewRef,
50514
- }));
50515
- if (false) {}
50516
- return (
50517
- // pass the vnode to the slot as a prop.
50518
- // h and <component :is="..."> both accept vnodes
50519
- normalizeSlot(slots.default, { Component: component, route }) ||
50520
- component);
50521
- };
50522
- },
50523
- });
50524
- function normalizeSlot(slot, data) {
50525
- if (!slot)
50526
- return null;
50527
- const slotContent = slot(data);
50528
- return slotContent.length === 1 ? slotContent[0] : slotContent;
50529
- }
50530
- // export the public type for h/tsx inference
50531
- // also to avoid inline import() in generated d.ts files
50532
- /**
50533
- * Component to display the current route the user is at.
50534
- */
50535
- const RouterView = (/* unused pure expression or super */ null && (RouterViewImpl));
50536
- // warn against deprecated usage with <transition> & <keep-alive>
50537
- // due to functional component being no longer eager in Vue 3
50538
- function warnDeprecatedUsage() {
50539
- const instance = getCurrentInstance();
50540
- const parentName = instance.parent && instance.parent.type.name;
50541
- if (parentName &&
50542
- (parentName === 'KeepAlive' || parentName.includes('Transition'))) {
50543
- const comp = parentName === 'KeepAlive' ? 'keep-alive' : 'transition';
50544
- warn(`<router-view> can no longer be used directly inside <transition> or <keep-alive>.\n` +
50545
- `Use slot props instead:\n\n` +
50546
- `<router-view v-slot="{ Component }">\n` +
50547
- ` <${comp}>\n` +
50548
- ` <component :is="Component" />\n` +
50549
- ` </${comp}>\n` +
50550
- `</router-view>`);
50551
- }
50552
- }
50553
-
50554
- /**
50555
- * Copies a route location and removes any problematic properties that cannot be shown in devtools (e.g. Vue instances).
50556
- *
50557
- * @param routeLocation - routeLocation to format
50558
- * @param tooltip - optional tooltip
50559
- * @returns a copy of the routeLocation
50560
- */
50561
- function formatRouteLocation(routeLocation, tooltip) {
50562
- const copy = vue_router_assign({}, routeLocation, {
50563
- // remove variables that can contain vue instances
50564
- matched: routeLocation.matched.map(matched => omit(matched, ['instances', 'children', 'aliasOf'])),
50565
- });
50566
- return {
50567
- _custom: {
50568
- type: null,
50569
- readOnly: true,
50570
- display: routeLocation.fullPath,
50571
- tooltip,
50572
- value: copy,
50573
- },
50574
- };
50575
- }
50576
- function formatDisplay(display) {
50577
- return {
50578
- _custom: {
50579
- display,
50580
- },
50581
- };
50582
- }
50583
- // to support multiple router instances
50584
- let routerId = 0;
50585
- function addDevtools(app, router, matcher) {
50586
- // Take over router.beforeEach and afterEach
50587
- // make sure we are not registering the devtool twice
50588
- if (router.__hasDevtools)
50589
- return;
50590
- router.__hasDevtools = true;
50591
- // increment to support multiple router instances
50592
- const id = routerId++;
50593
- setupDevtoolsPlugin({
50594
- id: 'org.vuejs.router' + (id ? '.' + id : ''),
50595
- label: 'Vue Router',
50596
- packageName: 'vue-router',
50597
- homepage: 'https://router.vuejs.org',
50598
- logo: 'https://router.vuejs.org/logo.png',
50599
- componentStateTypes: ['Routing'],
50600
- app,
50601
- }, api => {
50602
- if (typeof api.now !== 'function') {
50603
- console.warn('[Vue Router]: You seem to be using an outdated version of Vue Devtools. Are you still using the Beta release instead of the stable one? You can find the links at https://devtools.vuejs.org/guide/installation.html.');
50604
- }
50605
- // display state added by the router
50606
- api.on.inspectComponent((payload, ctx) => {
50607
- if (payload.instanceData) {
50608
- payload.instanceData.state.push({
50609
- type: 'Routing',
50610
- key: '$route',
50611
- editable: false,
50612
- value: formatRouteLocation(router.currentRoute.value, 'Current Route'),
50613
- });
50614
- }
50615
- });
50616
- // mark router-link as active and display tags on router views
50617
- api.on.visitComponentTree(({ treeNode: node, componentInstance }) => {
50618
- if (componentInstance.__vrv_devtools) {
50619
- const info = componentInstance.__vrv_devtools;
50620
- node.tags.push({
50621
- label: (info.name ? `${info.name.toString()}: ` : '') + info.path,
50622
- textColor: 0,
50623
- tooltip: 'This component is rendered by &lt;router-view&gt;',
50624
- backgroundColor: PINK_500,
50625
- });
50626
- }
50627
- // if multiple useLink are used
50628
- if (vue_router_isArray(componentInstance.__vrl_devtools)) {
50629
- componentInstance.__devtoolsApi = api;
50630
- componentInstance.__vrl_devtools.forEach(devtoolsData => {
50631
- let backgroundColor = ORANGE_400;
50632
- let tooltip = '';
50633
- if (devtoolsData.isExactActive) {
50634
- backgroundColor = LIME_500;
50635
- tooltip = 'This is exactly active';
50636
- }
50637
- else if (devtoolsData.isActive) {
50638
- backgroundColor = BLUE_600;
50639
- tooltip = 'This link is active';
50640
- }
50641
- node.tags.push({
50642
- label: devtoolsData.route.path,
50643
- textColor: 0,
50644
- tooltip,
50645
- backgroundColor,
50646
- });
50647
- });
50648
- }
50649
- });
50650
- watch(router.currentRoute, () => {
50651
- // refresh active state
50652
- refreshRoutesView();
50653
- api.notifyComponentUpdate();
50654
- api.sendInspectorTree(routerInspectorId);
50655
- api.sendInspectorState(routerInspectorId);
50656
- });
50657
- const navigationsLayerId = 'router:navigations:' + id;
50658
- api.addTimelineLayer({
50659
- id: navigationsLayerId,
50660
- label: `Router${id ? ' ' + id : ''} Navigations`,
50661
- color: 0x40a8c4,
50662
- });
50663
- // const errorsLayerId = 'router:errors'
50664
- // api.addTimelineLayer({
50665
- // id: errorsLayerId,
50666
- // label: 'Router Errors',
50667
- // color: 0xea5455,
50668
- // })
50669
- router.onError((error, to) => {
50670
- api.addTimelineEvent({
50671
- layerId: navigationsLayerId,
50672
- event: {
50673
- title: 'Error during Navigation',
50674
- subtitle: to.fullPath,
50675
- logType: 'error',
50676
- time: api.now(),
50677
- data: { error },
50678
- groupId: to.meta.__navigationId,
50679
- },
50680
- });
50681
- });
50682
- // attached to `meta` and used to group events
50683
- let navigationId = 0;
50684
- router.beforeEach((to, from) => {
50685
- const data = {
50686
- guard: formatDisplay('beforeEach'),
50687
- from: formatRouteLocation(from, 'Current Location during this navigation'),
50688
- to: formatRouteLocation(to, 'Target location'),
50689
- };
50690
- // Used to group navigations together, hide from devtools
50691
- Object.defineProperty(to.meta, '__navigationId', {
50692
- value: navigationId++,
50693
- });
50694
- api.addTimelineEvent({
50695
- layerId: navigationsLayerId,
50696
- event: {
50697
- time: api.now(),
50698
- title: 'Start of navigation',
50699
- subtitle: to.fullPath,
50700
- data,
50701
- groupId: to.meta.__navigationId,
50702
- },
50703
- });
50704
- });
50705
- router.afterEach((to, from, failure) => {
50706
- const data = {
50707
- guard: formatDisplay('afterEach'),
50708
- };
50709
- if (failure) {
50710
- data.failure = {
50711
- _custom: {
50712
- type: Error,
50713
- readOnly: true,
50714
- display: failure ? failure.message : '',
50715
- tooltip: 'Navigation Failure',
50716
- value: failure,
50717
- },
50718
- };
50719
- data.status = formatDisplay('❌');
50720
- }
50721
- else {
50722
- data.status = formatDisplay('✅');
50723
- }
50724
- // we set here to have the right order
50725
- data.from = formatRouteLocation(from, 'Current Location during this navigation');
50726
- data.to = formatRouteLocation(to, 'Target location');
50727
- api.addTimelineEvent({
50728
- layerId: navigationsLayerId,
50729
- event: {
50730
- title: 'End of navigation',
50731
- subtitle: to.fullPath,
50732
- time: api.now(),
50733
- data,
50734
- logType: failure ? 'warning' : 'default',
50735
- groupId: to.meta.__navigationId,
50736
- },
50737
- });
50738
- });
50739
- /**
50740
- * Inspector of Existing routes
50741
- */
50742
- const routerInspectorId = 'router-inspector:' + id;
50743
- api.addInspector({
50744
- id: routerInspectorId,
50745
- label: 'Routes' + (id ? ' ' + id : ''),
50746
- icon: 'book',
50747
- treeFilterPlaceholder: 'Search routes',
50748
- });
50749
- function refreshRoutesView() {
50750
- // the routes view isn't active
50751
- if (!activeRoutesPayload)
50752
- return;
50753
- const payload = activeRoutesPayload;
50754
- // children routes will appear as nested
50755
- let routes = matcher.getRoutes().filter(route => !route.parent);
50756
- // reset match state to false
50757
- routes.forEach(resetMatchStateOnRouteRecord);
50758
- // apply a match state if there is a payload
50759
- if (payload.filter) {
50760
- routes = routes.filter(route =>
50761
- // save matches state based on the payload
50762
- isRouteMatching(route, payload.filter.toLowerCase()));
50763
- }
50764
- // mark active routes
50765
- routes.forEach(route => markRouteRecordActive(route, router.currentRoute.value));
50766
- payload.rootNodes = routes.map(formatRouteRecordForInspector);
50767
- }
50768
- let activeRoutesPayload;
50769
- api.on.getInspectorTree(payload => {
50770
- activeRoutesPayload = payload;
50771
- if (payload.app === app && payload.inspectorId === routerInspectorId) {
50772
- refreshRoutesView();
50773
- }
50774
- });
50775
- /**
50776
- * Display information about the currently selected route record
50777
- */
50778
- api.on.getInspectorState(payload => {
50779
- if (payload.app === app && payload.inspectorId === routerInspectorId) {
50780
- const routes = matcher.getRoutes();
50781
- const route = routes.find(route => route.record.__vd_id === payload.nodeId);
50782
- if (route) {
50783
- payload.state = {
50784
- options: formatRouteRecordMatcherForStateInspector(route),
50785
- };
50786
- }
50787
- }
50788
- });
50789
- api.sendInspectorTree(routerInspectorId);
50790
- api.sendInspectorState(routerInspectorId);
50791
- });
50792
- }
50793
- function modifierForKey(key) {
50794
- if (key.optional) {
50795
- return key.repeatable ? '*' : '?';
50796
- }
50797
- else {
50798
- return key.repeatable ? '+' : '';
50799
- }
50800
- }
50801
- function formatRouteRecordMatcherForStateInspector(route) {
50802
- const { record } = route;
50803
- const fields = [
50804
- { editable: false, key: 'path', value: record.path },
50805
- ];
50806
- if (record.name != null) {
50807
- fields.push({
50808
- editable: false,
50809
- key: 'name',
50810
- value: record.name,
50811
- });
50812
- }
50813
- fields.push({ editable: false, key: 'regexp', value: route.re });
50814
- if (route.keys.length) {
50815
- fields.push({
50816
- editable: false,
50817
- key: 'keys',
50818
- value: {
50819
- _custom: {
50820
- type: null,
50821
- readOnly: true,
50822
- display: route.keys
50823
- .map(key => `${key.name}${modifierForKey(key)}`)
50824
- .join(' '),
50825
- tooltip: 'Param keys',
50826
- value: route.keys,
50827
- },
50828
- },
50829
- });
50830
- }
50831
- if (record.redirect != null) {
50832
- fields.push({
50833
- editable: false,
50834
- key: 'redirect',
50835
- value: record.redirect,
50836
- });
50837
- }
50838
- if (route.alias.length) {
50839
- fields.push({
50840
- editable: false,
50841
- key: 'aliases',
50842
- value: route.alias.map(alias => alias.record.path),
50843
- });
50844
- }
50845
- if (Object.keys(route.record.meta).length) {
50846
- fields.push({
50847
- editable: false,
50848
- key: 'meta',
50849
- value: route.record.meta,
50850
- });
50851
- }
50852
- fields.push({
50853
- key: 'score',
50854
- editable: false,
50855
- value: {
50856
- _custom: {
50857
- type: null,
50858
- readOnly: true,
50859
- display: route.score.map(score => score.join(', ')).join(' | '),
50860
- tooltip: 'Score used to sort routes',
50861
- value: route.score,
50862
- },
50863
- },
50864
- });
50865
- return fields;
50866
- }
50867
- /**
50868
- * Extracted from tailwind palette
50869
- */
50870
- const PINK_500 = 0xec4899;
50871
- const BLUE_600 = 0x2563eb;
50872
- const LIME_500 = 0x84cc16;
50873
- const CYAN_400 = 0x22d3ee;
50874
- const ORANGE_400 = 0xfb923c;
50875
- // const GRAY_100 = 0xf4f4f5
50876
- const DARK = 0x666666;
50877
- function formatRouteRecordForInspector(route) {
50878
- const tags = [];
50879
- const { record } = route;
50880
- if (record.name != null) {
50881
- tags.push({
50882
- label: String(record.name),
50883
- textColor: 0,
50884
- backgroundColor: CYAN_400,
50885
- });
50886
- }
50887
- if (record.aliasOf) {
50888
- tags.push({
50889
- label: 'alias',
50890
- textColor: 0,
50891
- backgroundColor: ORANGE_400,
50892
- });
50893
- }
50894
- if (route.__vd_match) {
50895
- tags.push({
50896
- label: 'matches',
50897
- textColor: 0,
50898
- backgroundColor: PINK_500,
50899
- });
50900
- }
50901
- if (route.__vd_exactActive) {
50902
- tags.push({
50903
- label: 'exact',
50904
- textColor: 0,
50905
- backgroundColor: LIME_500,
50906
- });
50907
- }
50908
- if (route.__vd_active) {
50909
- tags.push({
50910
- label: 'active',
50911
- textColor: 0,
50912
- backgroundColor: BLUE_600,
50913
- });
50914
- }
50915
- if (record.redirect) {
50916
- tags.push({
50917
- label: typeof record.redirect === 'string'
50918
- ? `redirect: ${record.redirect}`
50919
- : 'redirects',
50920
- textColor: 0xffffff,
50921
- backgroundColor: DARK,
50922
- });
50923
- }
50924
- // add an id to be able to select it. Using the `path` is not possible because
50925
- // empty path children would collide with their parents
50926
- let id = record.__vd_id;
50927
- if (id == null) {
50928
- id = String(routeRecordId++);
50929
- record.__vd_id = id;
50930
- }
50931
- return {
50932
- id,
50933
- label: record.path,
50934
- tags,
50935
- children: route.children.map(formatRouteRecordForInspector),
50936
- };
50937
- }
50938
- // incremental id for route records and inspector state
50939
- let routeRecordId = 0;
50940
- const EXTRACT_REGEXP_RE = /^\/(.*)\/([a-z]*)$/;
50941
- function markRouteRecordActive(route, currentRoute) {
50942
- // no route will be active if matched is empty
50943
- // reset the matching state
50944
- const isExactActive = currentRoute.matched.length &&
50945
- isSameRouteRecord(currentRoute.matched[currentRoute.matched.length - 1], route.record);
50946
- route.__vd_exactActive = route.__vd_active = isExactActive;
50947
- if (!isExactActive) {
50948
- route.__vd_active = currentRoute.matched.some(match => isSameRouteRecord(match, route.record));
50949
- }
50950
- route.children.forEach(childRoute => markRouteRecordActive(childRoute, currentRoute));
50951
- }
50952
- function resetMatchStateOnRouteRecord(route) {
50953
- route.__vd_match = false;
50954
- route.children.forEach(resetMatchStateOnRouteRecord);
50955
- }
50956
- function isRouteMatching(route, filter) {
50957
- const found = String(route.re).match(EXTRACT_REGEXP_RE);
50958
- route.__vd_match = false;
50959
- if (!found || found.length < 3) {
50960
- return false;
50961
- }
50962
- // use a regexp without $ at the end to match nested routes better
50963
- const nonEndingRE = new RegExp(found[1].replace(/\$$/, ''), found[2]);
50964
- if (nonEndingRE.test(filter)) {
50965
- // mark children as matches
50966
- route.children.forEach(child => isRouteMatching(child, filter));
50967
- // exception case: `/`
50968
- if (route.record.path !== '/' || filter === '/') {
50969
- route.__vd_match = route.re.test(filter);
50970
- return true;
50971
- }
50972
- // hide the / route
50973
- return false;
50974
- }
50975
- const path = route.record.path.toLowerCase();
50976
- const decodedPath = decode(path);
50977
- // also allow partial matching on the path
50978
- if (!filter.startsWith('/') &&
50979
- (decodedPath.includes(filter) || path.includes(filter)))
50980
- return true;
50981
- if (decodedPath.startsWith(filter) || path.startsWith(filter))
50982
- return true;
50983
- if (route.record.name && String(route.record.name).includes(filter))
50984
- return true;
50985
- return route.children.some(child => isRouteMatching(child, filter));
50986
- }
50987
- function omit(obj, keys) {
50988
- const ret = {};
50989
- for (const key in obj) {
50990
- if (!keys.includes(key)) {
50991
- // @ts-expect-error
50992
- ret[key] = obj[key];
50993
- }
50994
- }
50995
- return ret;
50996
- }
50997
-
50998
- /**
50999
- * Creates a Router instance that can be used by a Vue app.
51000
- *
51001
- * @param options - {@link RouterOptions}
51002
- */
51003
- function createRouter(options) {
51004
- const matcher = createRouterMatcher(options.routes, options);
51005
- const parseQuery$1 = options.parseQuery || parseQuery;
51006
- const stringifyQuery$1 = options.stringifyQuery || stringifyQuery;
51007
- const routerHistory = options.history;
51008
- if (false)
51009
- {}
51010
- const beforeGuards = useCallbacks();
51011
- const beforeResolveGuards = useCallbacks();
51012
- const afterGuards = useCallbacks();
51013
- const currentRoute = shallowRef(START_LOCATION_NORMALIZED);
51014
- let pendingLocation = START_LOCATION_NORMALIZED;
51015
- // leave the scrollRestoration if no scrollBehavior is provided
51016
- if (isBrowser && options.scrollBehavior && 'scrollRestoration' in history) {
51017
- history.scrollRestoration = 'manual';
51018
- }
51019
- const normalizeParams = applyToParams.bind(null, paramValue => '' + paramValue);
51020
- const encodeParams = applyToParams.bind(null, encodeParam);
51021
- const decodeParams =
51022
- // @ts-expect-error: intentionally avoid the type check
51023
- applyToParams.bind(null, decode);
51024
- function addRoute(parentOrRoute, route) {
51025
- let parent;
51026
- let record;
51027
- if (isRouteName(parentOrRoute)) {
51028
- parent = matcher.getRecordMatcher(parentOrRoute);
51029
- record = route;
51030
- }
51031
- else {
51032
- record = parentOrRoute;
51033
- }
51034
- return matcher.addRoute(record, parent);
51035
- }
51036
- function removeRoute(name) {
51037
- const recordMatcher = matcher.getRecordMatcher(name);
51038
- if (recordMatcher) {
51039
- matcher.removeRoute(recordMatcher);
51040
- }
51041
- else if ((false)) {}
51042
- }
51043
- function getRoutes() {
51044
- return matcher.getRoutes().map(routeMatcher => routeMatcher.record);
51045
- }
51046
- function hasRoute(name) {
51047
- return !!matcher.getRecordMatcher(name);
51048
- }
51049
- function resolve(rawLocation, currentLocation) {
51050
- // const objectLocation = routerLocationAsObject(rawLocation)
51051
- // we create a copy to modify it later
51052
- currentLocation = vue_router_assign({}, currentLocation || currentRoute.value);
51053
- if (typeof rawLocation === 'string') {
51054
- const locationNormalized = parseURL(parseQuery$1, rawLocation, currentLocation.path);
51055
- const matchedRoute = matcher.resolve({ path: locationNormalized.path }, currentLocation);
51056
- const href = routerHistory.createHref(locationNormalized.fullPath);
51057
- if ((false)) {}
51058
- // locationNormalized is always a new object
51059
- return vue_router_assign(locationNormalized, matchedRoute, {
51060
- params: decodeParams(matchedRoute.params),
51061
- hash: decode(locationNormalized.hash),
51062
- redirectedFrom: undefined,
51063
- href,
51064
- });
51065
- }
51066
- let matcherLocation;
51067
- // path could be relative in object as well
51068
- if ('path' in rawLocation) {
51069
- if (false) {}
51070
- matcherLocation = vue_router_assign({}, rawLocation, {
51071
- path: parseURL(parseQuery$1, rawLocation.path, currentLocation.path).path,
51072
- });
51073
- }
51074
- else {
51075
- // remove any nullish param
51076
- const targetParams = vue_router_assign({}, rawLocation.params);
51077
- for (const key in targetParams) {
51078
- if (targetParams[key] == null) {
51079
- delete targetParams[key];
51080
- }
51081
- }
51082
- // pass encoded values to the matcher so it can produce encoded path and fullPath
51083
- matcherLocation = vue_router_assign({}, rawLocation, {
51084
- params: encodeParams(rawLocation.params),
51085
- });
51086
- // current location params are decoded, we need to encode them in case the
51087
- // matcher merges the params
51088
- currentLocation.params = encodeParams(currentLocation.params);
51089
- }
51090
- const matchedRoute = matcher.resolve(matcherLocation, currentLocation);
51091
- const hash = rawLocation.hash || '';
51092
- if (false) {}
51093
- // decoding them) the matcher might have merged current location params so
51094
- // we need to run the decoding again
51095
- matchedRoute.params = normalizeParams(decodeParams(matchedRoute.params));
51096
- const fullPath = stringifyURL(stringifyQuery$1, vue_router_assign({}, rawLocation, {
51097
- hash: encodeHash(hash),
51098
- path: matchedRoute.path,
51099
- }));
51100
- const href = routerHistory.createHref(fullPath);
51101
- if ((false)) {}
51102
- return vue_router_assign({
51103
- fullPath,
51104
- // keep the hash encoded so fullPath is effectively path + encodedQuery +
51105
- // hash
51106
- hash,
51107
- query:
51108
- // if the user is using a custom query lib like qs, we might have
51109
- // nested objects, so we keep the query as is, meaning it can contain
51110
- // numbers at `$route.query`, but at the point, the user will have to
51111
- // use their own type anyway.
51112
- // https://github.com/vuejs/router/issues/328#issuecomment-649481567
51113
- stringifyQuery$1 === stringifyQuery
51114
- ? normalizeQuery(rawLocation.query)
51115
- : (rawLocation.query || {}),
51116
- }, matchedRoute, {
51117
- redirectedFrom: undefined,
51118
- href,
51119
- });
51120
- }
51121
- function locationAsObject(to) {
51122
- return typeof to === 'string'
51123
- ? parseURL(parseQuery$1, to, currentRoute.value.path)
51124
- : vue_router_assign({}, to);
51125
- }
51126
- function checkCanceledNavigation(to, from) {
51127
- if (pendingLocation !== to) {
51128
- return createRouterError(8 /* ErrorTypes.NAVIGATION_CANCELLED */, {
51129
- from,
51130
- to,
51131
- });
51132
- }
51133
- }
51134
- function push(to) {
51135
- return pushWithRedirect(to);
51136
- }
51137
- function replace(to) {
51138
- return push(vue_router_assign(locationAsObject(to), { replace: true }));
51139
- }
51140
- function handleRedirectRecord(to) {
51141
- const lastMatched = to.matched[to.matched.length - 1];
51142
- if (lastMatched && lastMatched.redirect) {
51143
- const { redirect } = lastMatched;
51144
- let newTargetLocation = typeof redirect === 'function' ? redirect(to) : redirect;
51145
- if (typeof newTargetLocation === 'string') {
51146
- newTargetLocation =
51147
- newTargetLocation.includes('?') || newTargetLocation.includes('#')
51148
- ? (newTargetLocation = locationAsObject(newTargetLocation))
51149
- : // force empty params
51150
- { path: newTargetLocation };
51151
- // @ts-expect-error: force empty params when a string is passed to let
51152
- // the router parse them again
51153
- newTargetLocation.params = {};
51154
- }
51155
- if (false) {}
51156
- return vue_router_assign({
51157
- query: to.query,
51158
- hash: to.hash,
51159
- // avoid transferring params if the redirect has a path
51160
- params: 'path' in newTargetLocation ? {} : to.params,
51161
- }, newTargetLocation);
51162
- }
51163
- }
51164
- function pushWithRedirect(to, redirectedFrom) {
51165
- const targetLocation = (pendingLocation = resolve(to));
51166
- const from = currentRoute.value;
51167
- const data = to.state;
51168
- const force = to.force;
51169
- // to could be a string where `replace` is a function
51170
- const replace = to.replace === true;
51171
- const shouldRedirect = handleRedirectRecord(targetLocation);
51172
- if (shouldRedirect)
51173
- return pushWithRedirect(vue_router_assign(locationAsObject(shouldRedirect), {
51174
- state: data,
51175
- force,
51176
- replace,
51177
- }),
51178
- // keep original redirectedFrom if it exists
51179
- redirectedFrom || targetLocation);
51180
- // if it was a redirect we already called `pushWithRedirect` above
51181
- const toLocation = targetLocation;
51182
- toLocation.redirectedFrom = redirectedFrom;
51183
- let failure;
51184
- if (!force && isSameRouteLocation(stringifyQuery$1, from, targetLocation)) {
51185
- failure = createRouterError(16 /* ErrorTypes.NAVIGATION_DUPLICATED */, { to: toLocation, from });
51186
- // trigger scroll to allow scrolling to the same anchor
51187
- handleScroll(from, from,
51188
- // this is a push, the only way for it to be triggered from a
51189
- // history.listen is with a redirect, which makes it become a push
51190
- true,
51191
- // This cannot be the first navigation because the initial location
51192
- // cannot be manually navigated to
51193
- false);
51194
- }
51195
- return (failure ? Promise.resolve(failure) : navigate(toLocation, from))
51196
- .catch((error) => isNavigationFailure(error)
51197
- ? // navigation redirects still mark the router as ready
51198
- isNavigationFailure(error, 2 /* ErrorTypes.NAVIGATION_GUARD_REDIRECT */)
51199
- ? error
51200
- : markAsReady(error) // also returns the error
51201
- : // reject any unknown error
51202
- triggerError(error, toLocation, from))
51203
- .then((failure) => {
51204
- if (failure) {
51205
- if (isNavigationFailure(failure, 2 /* ErrorTypes.NAVIGATION_GUARD_REDIRECT */)) {
51206
- if (false) {}
51207
- return pushWithRedirect(
51208
- // keep options
51209
- vue_router_assign(locationAsObject(failure.to), {
51210
- state: data,
51211
- force,
51212
- replace,
51213
- }),
51214
- // preserve the original redirectedFrom if any
51215
- redirectedFrom || toLocation);
51216
- }
51217
- }
51218
- else {
51219
- // if we fail we don't finalize the navigation
51220
- failure = finalizeNavigation(toLocation, from, true, replace, data);
51221
- }
51222
- triggerAfterEach(toLocation, from, failure);
51223
- return failure;
51224
- });
51225
- }
51226
- /**
51227
- * Helper to reject and skip all navigation guards if a new navigation happened
51228
- * @param to
51229
- * @param from
51230
- */
51231
- function checkCanceledNavigationAndReject(to, from) {
51232
- const error = checkCanceledNavigation(to, from);
51233
- return error ? Promise.reject(error) : Promise.resolve();
51234
- }
51235
- // TODO: refactor the whole before guards by internally using router.beforeEach
51236
- function navigate(to, from) {
51237
- let guards;
51238
- const [leavingRecords, updatingRecords, enteringRecords] = extractChangingRecords(to, from);
51239
- // all components here have been resolved once because we are leaving
51240
- guards = extractComponentsGuards(leavingRecords.reverse(), 'beforeRouteLeave', to, from);
51241
- // leavingRecords is already reversed
51242
- for (const record of leavingRecords) {
51243
- record.leaveGuards.forEach(guard => {
51244
- guards.push(guardToPromiseFn(guard, to, from));
51245
- });
51246
- }
51247
- const canceledNavigationCheck = checkCanceledNavigationAndReject.bind(null, to, from);
51248
- guards.push(canceledNavigationCheck);
51249
- // run the queue of per route beforeRouteLeave guards
51250
- return (runGuardQueue(guards)
51251
- .then(() => {
51252
- // check global guards beforeEach
51253
- guards = [];
51254
- for (const guard of beforeGuards.list()) {
51255
- guards.push(guardToPromiseFn(guard, to, from));
51256
- }
51257
- guards.push(canceledNavigationCheck);
51258
- return runGuardQueue(guards);
51259
- })
51260
- .then(() => {
51261
- // check in components beforeRouteUpdate
51262
- guards = extractComponentsGuards(updatingRecords, 'beforeRouteUpdate', to, from);
51263
- for (const record of updatingRecords) {
51264
- record.updateGuards.forEach(guard => {
51265
- guards.push(guardToPromiseFn(guard, to, from));
51266
- });
51267
- }
51268
- guards.push(canceledNavigationCheck);
51269
- // run the queue of per route beforeEnter guards
51270
- return runGuardQueue(guards);
51271
- })
51272
- .then(() => {
51273
- // check the route beforeEnter
51274
- guards = [];
51275
- for (const record of to.matched) {
51276
- // do not trigger beforeEnter on reused views
51277
- if (record.beforeEnter && !from.matched.includes(record)) {
51278
- if (vue_router_isArray(record.beforeEnter)) {
51279
- for (const beforeEnter of record.beforeEnter)
51280
- guards.push(guardToPromiseFn(beforeEnter, to, from));
51281
- }
51282
- else {
51283
- guards.push(guardToPromiseFn(record.beforeEnter, to, from));
51284
- }
51285
- }
51286
- }
51287
- guards.push(canceledNavigationCheck);
51288
- // run the queue of per route beforeEnter guards
51289
- return runGuardQueue(guards);
51290
- })
51291
- .then(() => {
51292
- // NOTE: at this point to.matched is normalized and does not contain any () => Promise<Component>
51293
- // clear existing enterCallbacks, these are added by extractComponentsGuards
51294
- to.matched.forEach(record => (record.enterCallbacks = {}));
51295
- // check in-component beforeRouteEnter
51296
- guards = extractComponentsGuards(enteringRecords, 'beforeRouteEnter', to, from);
51297
- guards.push(canceledNavigationCheck);
51298
- // run the queue of per route beforeEnter guards
51299
- return runGuardQueue(guards);
51300
- })
51301
- .then(() => {
51302
- // check global guards beforeResolve
51303
- guards = [];
51304
- for (const guard of beforeResolveGuards.list()) {
51305
- guards.push(guardToPromiseFn(guard, to, from));
51306
- }
51307
- guards.push(canceledNavigationCheck);
51308
- return runGuardQueue(guards);
51309
- })
51310
- // catch any navigation canceled
51311
- .catch(err => isNavigationFailure(err, 8 /* ErrorTypes.NAVIGATION_CANCELLED */)
51312
- ? err
51313
- : Promise.reject(err)));
51314
- }
51315
- function triggerAfterEach(to, from, failure) {
51316
- // navigation is confirmed, call afterGuards
51317
- // TODO: wrap with error handlers
51318
- for (const guard of afterGuards.list())
51319
- guard(to, from, failure);
51320
- }
51321
- /**
51322
- * - Cleans up any navigation guards
51323
- * - Changes the url if necessary
51324
- * - Calls the scrollBehavior
51325
- */
51326
- function finalizeNavigation(toLocation, from, isPush, replace, data) {
51327
- // a more recent navigation took place
51328
- const error = checkCanceledNavigation(toLocation, from);
51329
- if (error)
51330
- return error;
51331
- // only consider as push if it's not the first navigation
51332
- const isFirstNavigation = from === START_LOCATION_NORMALIZED;
51333
- const state = !isBrowser ? {} : history.state;
51334
- // change URL only if the user did a push/replace and if it's not the initial navigation because
51335
- // it's just reflecting the url
51336
- if (isPush) {
51337
- // on the initial navigation, we want to reuse the scroll position from
51338
- // history state if it exists
51339
- if (replace || isFirstNavigation)
51340
- routerHistory.replace(toLocation.fullPath, vue_router_assign({
51341
- scroll: isFirstNavigation && state && state.scroll,
51342
- }, data));
51343
- else
51344
- routerHistory.push(toLocation.fullPath, data);
51345
- }
51346
- // accept current navigation
51347
- currentRoute.value = toLocation;
51348
- handleScroll(toLocation, from, isPush, isFirstNavigation);
51349
- markAsReady();
51350
- }
51351
- let removeHistoryListener;
51352
- // attach listener to history to trigger navigations
51353
- function setupListeners() {
51354
- // avoid setting up listeners twice due to an invalid first navigation
51355
- if (removeHistoryListener)
51356
- return;
51357
- removeHistoryListener = routerHistory.listen((to, _from, info) => {
51358
- if (!router.listening)
51359
- return;
51360
- // cannot be a redirect route because it was in history
51361
- const toLocation = resolve(to);
51362
- // due to dynamic routing, and to hash history with manual navigation
51363
- // (manually changing the url or calling history.hash = '#/somewhere'),
51364
- // there could be a redirect record in history
51365
- const shouldRedirect = handleRedirectRecord(toLocation);
51366
- if (shouldRedirect) {
51367
- pushWithRedirect(vue_router_assign(shouldRedirect, { replace: true }), toLocation).catch(noop);
51368
- return;
51369
- }
51370
- pendingLocation = toLocation;
51371
- const from = currentRoute.value;
51372
- // TODO: should be moved to web history?
51373
- if (isBrowser) {
51374
- saveScrollPosition(getScrollKey(from.fullPath, info.delta), computeScrollPosition());
51375
- }
51376
- navigate(toLocation, from)
51377
- .catch((error) => {
51378
- if (isNavigationFailure(error, 4 /* ErrorTypes.NAVIGATION_ABORTED */ | 8 /* ErrorTypes.NAVIGATION_CANCELLED */)) {
51379
- return error;
51380
- }
51381
- if (isNavigationFailure(error, 2 /* ErrorTypes.NAVIGATION_GUARD_REDIRECT */)) {
51382
- // Here we could call if (info.delta) routerHistory.go(-info.delta,
51383
- // false) but this is bug prone as we have no way to wait the
51384
- // navigation to be finished before calling pushWithRedirect. Using
51385
- // a setTimeout of 16ms seems to work but there is not guarantee for
51386
- // it to work on every browser. So Instead we do not restore the
51387
- // history entry and trigger a new navigation as requested by the
51388
- // navigation guard.
51389
- // the error is already handled by router.push we just want to avoid
51390
- // logging the error
51391
- pushWithRedirect(error.to, toLocation
51392
- // avoid an uncaught rejection, let push call triggerError
51393
- )
51394
- .then(failure => {
51395
- // manual change in hash history #916 ending up in the URL not
51396
- // changing but it was changed by the manual url change, so we
51397
- // need to manually change it ourselves
51398
- if (isNavigationFailure(failure, 4 /* ErrorTypes.NAVIGATION_ABORTED */ |
51399
- 16 /* ErrorTypes.NAVIGATION_DUPLICATED */) &&
51400
- !info.delta &&
51401
- info.type === NavigationType.pop) {
51402
- routerHistory.go(-1, false);
51403
- }
51404
- })
51405
- .catch(noop);
51406
- // avoid the then branch
51407
- return Promise.reject();
51408
- }
51409
- // do not restore history on unknown direction
51410
- if (info.delta)
51411
- routerHistory.go(-info.delta, false);
51412
- // unrecognized error, transfer to the global handler
51413
- return triggerError(error, toLocation, from);
51414
- })
51415
- .then((failure) => {
51416
- failure =
51417
- failure ||
51418
- finalizeNavigation(
51419
- // after navigation, all matched components are resolved
51420
- toLocation, from, false);
51421
- // revert the navigation
51422
- if (failure) {
51423
- if (info.delta) {
51424
- routerHistory.go(-info.delta, false);
51425
- }
51426
- else if (info.type === NavigationType.pop &&
51427
- isNavigationFailure(failure, 4 /* ErrorTypes.NAVIGATION_ABORTED */ | 16 /* ErrorTypes.NAVIGATION_DUPLICATED */)) {
51428
- // manual change in hash history #916
51429
- // it's like a push but lacks the information of the direction
51430
- routerHistory.go(-1, false);
51431
- }
51432
- }
51433
- triggerAfterEach(toLocation, from, failure);
51434
- })
51435
- .catch(noop);
51436
- });
51437
- }
51438
- // Initialization and Errors
51439
- let readyHandlers = useCallbacks();
51440
- let errorHandlers = useCallbacks();
51441
- let ready;
51442
- /**
51443
- * Trigger errorHandlers added via onError and throws the error as well
51444
- *
51445
- * @param error - error to throw
51446
- * @param to - location we were navigating to when the error happened
51447
- * @param from - location we were navigating from when the error happened
51448
- * @returns the error as a rejected promise
51449
- */
51450
- function triggerError(error, to, from) {
51451
- markAsReady(error);
51452
- const list = errorHandlers.list();
51453
- if (list.length) {
51454
- list.forEach(handler => handler(error, to, from));
51455
- }
51456
- else {
51457
- if ((false)) {}
51458
- console.error(error);
51459
- }
51460
- return Promise.reject(error);
51461
- }
51462
- function isReady() {
51463
- if (ready && currentRoute.value !== START_LOCATION_NORMALIZED)
51464
- return Promise.resolve();
51465
- return new Promise((resolve, reject) => {
51466
- readyHandlers.add([resolve, reject]);
51467
- });
51468
- }
51469
- function markAsReady(err) {
51470
- if (!ready) {
51471
- // still not ready if an error happened
51472
- ready = !err;
51473
- setupListeners();
51474
- readyHandlers
51475
- .list()
51476
- .forEach(([resolve, reject]) => (err ? reject(err) : resolve()));
51477
- readyHandlers.reset();
51478
- }
51479
- return err;
51480
- }
51481
- // Scroll behavior
51482
- function handleScroll(to, from, isPush, isFirstNavigation) {
51483
- const { scrollBehavior } = options;
51484
- if (!isBrowser || !scrollBehavior)
51485
- return Promise.resolve();
51486
- const scrollPosition = (!isPush && getSavedScrollPosition(getScrollKey(to.fullPath, 0))) ||
51487
- ((isFirstNavigation || !isPush) &&
51488
- history.state &&
51489
- history.state.scroll) ||
51490
- null;
51491
- return nextTick()
51492
- .then(() => scrollBehavior(to, from, scrollPosition))
51493
- .then(position => position && scrollToPosition(position))
51494
- .catch(err => triggerError(err, to, from));
51495
- }
51496
- const go = (delta) => routerHistory.go(delta);
51497
- let started;
51498
- const installedApps = new Set();
51499
- const router = {
51500
- currentRoute,
51501
- listening: true,
51502
- addRoute,
51503
- removeRoute,
51504
- hasRoute,
51505
- getRoutes,
51506
- resolve,
51507
- options,
51508
- push,
51509
- replace,
51510
- go,
51511
- back: () => go(-1),
51512
- forward: () => go(1),
51513
- beforeEach: beforeGuards.add,
51514
- beforeResolve: beforeResolveGuards.add,
51515
- afterEach: afterGuards.add,
51516
- onError: errorHandlers.add,
51517
- isReady,
51518
- install(app) {
51519
- const router = this;
51520
- app.component('RouterLink', RouterLink);
51521
- app.component('RouterView', RouterView);
51522
- app.config.globalProperties.$router = router;
51523
- Object.defineProperty(app.config.globalProperties, '$route', {
51524
- enumerable: true,
51525
- get: () => unref(currentRoute),
51526
- });
51527
- // this initial navigation is only necessary on client, on server it doesn't
51528
- // make sense because it will create an extra unnecessary navigation and could
51529
- // lead to problems
51530
- if (isBrowser &&
51531
- // used for the initial navigation client side to avoid pushing
51532
- // multiple times when the router is used in multiple apps
51533
- !started &&
51534
- currentRoute.value === START_LOCATION_NORMALIZED) {
51535
- // see above
51536
- started = true;
51537
- push(routerHistory.location).catch(err => {
51538
- if ((false))
51539
- {}
51540
- });
51541
- }
51542
- const reactiveRoute = {};
51543
- for (const key in START_LOCATION_NORMALIZED) {
51544
- // @ts-expect-error: the key matches
51545
- reactiveRoute[key] = computed(() => currentRoute.value[key]);
51546
- }
51547
- app.provide(routerKey, router);
51548
- app.provide(routeLocationKey, reactive(reactiveRoute));
51549
- app.provide(routerViewLocationKey, currentRoute);
51550
- const unmountApp = app.unmount;
51551
- installedApps.add(app);
51552
- app.unmount = function () {
51553
- installedApps.delete(app);
51554
- // the router is not attached to an app anymore
51555
- if (installedApps.size < 1) {
51556
- // invalidate the current navigation
51557
- pendingLocation = START_LOCATION_NORMALIZED;
51558
- removeHistoryListener && removeHistoryListener();
51559
- removeHistoryListener = null;
51560
- currentRoute.value = START_LOCATION_NORMALIZED;
51561
- started = false;
51562
- ready = false;
51563
- }
51564
- unmountApp();
51565
- };
51566
- if (false) {}
51567
- },
51568
- };
51569
- return router;
51570
- }
51571
- function runGuardQueue(guards) {
51572
- return guards.reduce((promise, guard) => promise.then(() => guard()), Promise.resolve());
51573
- }
51574
- function extractChangingRecords(to, from) {
51575
- const leavingRecords = [];
51576
- const updatingRecords = [];
51577
- const enteringRecords = [];
51578
- const len = Math.max(from.matched.length, to.matched.length);
51579
- for (let i = 0; i < len; i++) {
51580
- const recordFrom = from.matched[i];
51581
- if (recordFrom) {
51582
- if (to.matched.find(record => isSameRouteRecord(record, recordFrom)))
51583
- updatingRecords.push(recordFrom);
51584
- else
51585
- leavingRecords.push(recordFrom);
51586
- }
51587
- const recordTo = to.matched[i];
51588
- if (recordTo) {
51589
- // the type doesn't matter because we are comparing per reference
51590
- if (!from.matched.find(record => isSameRouteRecord(record, recordTo))) {
51591
- enteringRecords.push(recordTo);
51592
- }
51593
- }
51594
- }
51595
- return [leavingRecords, updatingRecords, enteringRecords];
51596
- }
51597
-
51598
- /**
51599
- * Returns the router instance. Equivalent to using `$router` inside
51600
- * templates.
51601
- */
51602
- function useRouter() {
51603
- return (0,external_commonjs_vue_commonjs2_vue_root_Vue_.inject)(routerKey);
51604
- }
51605
- /**
51606
- * Returns the current route location. Equivalent to using `$route` inside
51607
- * templates.
51608
- */
51609
- function useRoute() {
51610
- return (0,external_commonjs_vue_commonjs2_vue_root_Vue_.inject)(routeLocationKey);
51611
- }
51612
-
51613
-
51614
-
51615
48228
  // EXTERNAL MODULE: ./src/utils/commons.js
51616
48229
  var commons = __webpack_require__(3310);
51617
48230
  // EXTERNAL MODULE: ./node_modules/dayjs/dayjs.min.js
@@ -51622,7 +48235,6 @@ var dayjs_min_default = /*#__PURE__*/__webpack_require__.n(dayjs_min);
51622
48235
 
51623
48236
 
51624
48237
 
51625
-
51626
48238
  // 默认分页数据
51627
48239
 
51628
48240
  const paginationDefault = {
@@ -51665,7 +48277,17 @@ const paginationDefault = {
51665
48277
  userMenusAuth: {
51666
48278
  type: Object,
51667
48279
  default: () => {}
51668
- } // 用户权限
48280
+ },
48281
+ // 用户权限
48282
+ route: {
48283
+ type: Object,
48284
+ default: () => {}
48285
+ },
48286
+ // 路由
48287
+ router: {
48288
+ type: Object,
48289
+ default: () => {}
48290
+ } // 路由
51669
48291
 
51670
48292
  },
51671
48293
  emits: ['selection-change', 'list-change', 'header-action', 'table-action', 'add-handle', 'edit-handle', 'add-success', 'edit-success', 'delete-success', 'table-current-change', 'tablelist-change', 'get-detail-success'],
@@ -51679,7 +48301,10 @@ const paginationDefault = {
51679
48301
  ajaxLoading: false,
51680
48302
  // 请求的loading
51681
48303
  submitLoading: false
51682
- }); // 配置信息 默认初始值
48304
+ });
48305
+ const {
48306
+ proxy
48307
+ } = (0,external_commonjs_vue_commonjs2_vue_root_Vue_.getCurrentInstance)(); // 配置信息 默认初始值
51683
48308
 
51684
48309
  let appConfig = (0,external_commonjs_vue_commonjs2_vue_root_Vue_.reactive)((0,lodash.merge)({
51685
48310
  headerActions: {
@@ -51746,11 +48371,6 @@ const paginationDefault = {
51746
48371
  model: {},
51747
48372
  boxName: 'editBox'
51748
48373
  });
51749
- const route = useRoute();
51750
- const router = useRouter();
51751
- const {
51752
- proxy
51753
- } = (0,external_commonjs_vue_commonjs2_vue_root_Vue_.getCurrentInstance)();
51754
48374
  const selectionRow = (0,external_commonjs_vue_commonjs2_vue_root_Vue_.ref)([]); // 选择的row
51755
48375
 
51756
48376
  const tableSearchModel = (0,external_commonjs_vue_commonjs2_vue_root_Vue_.ref)({}); // 搜索数据
@@ -51760,7 +48380,7 @@ const paginationDefault = {
51760
48380
  const currentPagePath = (0,external_commonjs_vue_commonjs2_vue_root_Vue_.computed)(() => {
51761
48381
  const {
51762
48382
  path: currentPath
51763
- } = route;
48383
+ } = props.route;
51764
48384
  return currentPath || '';
51765
48385
  }); // 用户权限
51766
48386
 
@@ -51809,7 +48429,7 @@ const paginationDefault = {
51809
48429
  const initSearch = () => {
51810
48430
  const {
51811
48431
  query
51812
- } = route;
48432
+ } = props.route;
51813
48433
 
51814
48434
  if (query.fromJump) {
51815
48435
  for (let [k, v] of Object.entries(query)) {
@@ -51819,7 +48439,7 @@ const paginationDefault = {
51819
48439
  }
51820
48440
 
51821
48441
  const result = { ...tableSearchModel.value,
51822
- ...route.query
48442
+ ...props.route.query
51823
48443
  };
51824
48444
  delete result.fromJump;
51825
48445
  tableSearchModel.value = result;
@@ -51986,7 +48606,8 @@ const paginationDefault = {
51986
48606
  emit(`add-handle`, selectionRow.value);
51987
48607
  } else if (rowAction && rowAction.type === 'editRoute') {
51988
48608
  console.log('跳转到新建页面');
51989
- rowAction.jumpUrl && router.push({
48609
+ rowAction.jumpUrl && // eslint-disable-next-line vue/no-mutating-props
48610
+ props?.router?.push({
51990
48611
  path: rowAction.jumpUrl,
51991
48612
  query: rowAction.jumpParams
51992
48613
  });
@@ -52050,7 +48671,8 @@ const paginationDefault = {
52050
48671
  emit(`edit-handle`, row);
52051
48672
  } else if (rowAction && rowAction.type === 'editRoute') {
52052
48673
  console.log('跳转到新建页面');
52053
- rowAction.jumpUrl && router.push({
48674
+ rowAction.jumpUrl && // eslint-disable-next-line vue/no-mutating-props
48675
+ props?.router?.push({
52054
48676
  path: rowAction.jumpUrl,
52055
48677
  query: row
52056
48678
  });
@@ -52084,8 +48706,9 @@ const paginationDefault = {
52084
48706
 
52085
48707
  default:
52086
48708
  if (rowAction && rowAction.type === 'editRoute') {
52087
- console.log('跳转到新建页面');
52088
- router.push({
48709
+ console.log('跳转到新建页面'); // eslint-disable-next-line vue/no-mutating-props
48710
+
48711
+ props.router.push({
52089
48712
  path: rowAction.jumpUrl,
52090
48713
  query: row
52091
48714
  });
@@ -52343,10 +48966,10 @@ const paginationDefault = {
52343
48966
  }));
52344
48967
  ;// CONCATENATED MODULE: ./src/packages/JwtTable/index.vue?vue&type=script&lang=js
52345
48968
 
52346
- ;// CONCATENATED MODULE: ./node_modules/mini-css-extract-plugin/dist/loader.js??clonedRuleSet-22.use[0]!./node_modules/css-loader/dist/cjs.js??clonedRuleSet-22.use[1]!./node_modules/vue-loader/dist/stylePostLoader.js!./node_modules/postcss-loader/dist/cjs.js??clonedRuleSet-22.use[2]!./node_modules/sass-loader/dist/cjs.js??clonedRuleSet-22.use[3]!./node_modules/vue-loader/dist/index.js??ruleSet[0].use[0]!./src/packages/JwtTable/index.vue?vue&type=style&index=0&id=755af22e&lang=scss&scoped=true
48969
+ ;// CONCATENATED MODULE: ./node_modules/mini-css-extract-plugin/dist/loader.js??clonedRuleSet-22.use[0]!./node_modules/css-loader/dist/cjs.js??clonedRuleSet-22.use[1]!./node_modules/vue-loader/dist/stylePostLoader.js!./node_modules/postcss-loader/dist/cjs.js??clonedRuleSet-22.use[2]!./node_modules/sass-loader/dist/cjs.js??clonedRuleSet-22.use[3]!./node_modules/vue-loader/dist/index.js??ruleSet[0].use[0]!./src/packages/JwtTable/index.vue?vue&type=style&index=0&id=9e6b1136&lang=scss&scoped=true
52347
48970
  // extracted by mini-css-extract-plugin
52348
48971
 
52349
- ;// CONCATENATED MODULE: ./src/packages/JwtTable/index.vue?vue&type=style&index=0&id=755af22e&lang=scss&scoped=true
48972
+ ;// CONCATENATED MODULE: ./src/packages/JwtTable/index.vue?vue&type=style&index=0&id=9e6b1136&lang=scss&scoped=true
52350
48973
 
52351
48974
  // EXTERNAL MODULE: ./node_modules/vue-loader/dist/exportHelper.js
52352
48975
  var exportHelper = __webpack_require__(3744);
@@ -52358,7 +48981,7 @@ var exportHelper = __webpack_require__(3744);
52358
48981
  ;
52359
48982
 
52360
48983
 
52361
- const __exports__ = /*#__PURE__*/(0,exportHelper/* default */.Z)(JwtTablevue_type_script_lang_js, [['render',render],['__scopeId',"data-v-755af22e"]])
48984
+ const __exports__ = /*#__PURE__*/(0,exportHelper/* default */.Z)(JwtTablevue_type_script_lang_js, [['render',render],['__scopeId',"data-v-9e6b1136"]])
52362
48985
 
52363
48986
  /* harmony default export */ var JwtTable = (__exports__);
52364
48987
 
@@ -53542,12 +50165,12 @@ var map = {
53542
50165
  "./JwtForm/index.vue": 3818,
53543
50166
  "./JwtHeaderButton/index.vue": 3663,
53544
50167
  "./JwtIcon/index.vue": 8916,
53545
- "./JwtIconSelect/index.vue": 7363,
50168
+ "./JwtIconSelect/index.vue": 7047,
53546
50169
  "./JwtImage/index.vue": 8328,
53547
50170
  "./JwtInput/index.vue": 5859,
53548
50171
  "./JwtRateIcon/index.vue": 5939,
53549
50172
  "./JwtSelectServer/index.vue": 6563,
53550
- "./JwtTable/index.vue": 9566,
50173
+ "./JwtTable/index.vue": 3829,
53551
50174
  "./JwtTableButton/index.vue": 9033,
53552
50175
  "./JwtTableOnly/index.vue": 5070,
53553
50176
  "./JwtTags/index.vue": 6854,