1 | /**
|
---|
2 | * @license
|
---|
3 | * Copyright Google LLC All Rights Reserved.
|
---|
4 | *
|
---|
5 | * Use of this source code is governed by an MIT-style license that can be
|
---|
6 | * found in the LICENSE file at https://angular.io/license
|
---|
7 | */
|
---|
8 | import { Location } from '@angular/common';
|
---|
9 | import { Compiler, Injectable, Injector, NgModuleFactoryLoader, NgModuleRef, NgZone, Type, ɵConsole as Console } from '@angular/core';
|
---|
10 | import { BehaviorSubject, EMPTY, of, Subject } from 'rxjs';
|
---|
11 | import { catchError, filter, finalize, map, switchMap, tap } from 'rxjs/operators';
|
---|
12 | import { createRouterState } from './create_router_state';
|
---|
13 | import { createUrlTree } from './create_url_tree';
|
---|
14 | import { GuardsCheckEnd, GuardsCheckStart, NavigationCancel, NavigationEnd, NavigationError, NavigationStart, ResolveEnd, ResolveStart, RouteConfigLoadEnd, RouteConfigLoadStart, RoutesRecognized } from './events';
|
---|
15 | import { activateRoutes } from './operators/activate_routes';
|
---|
16 | import { applyRedirects } from './operators/apply_redirects';
|
---|
17 | import { checkGuards } from './operators/check_guards';
|
---|
18 | import { recognize } from './operators/recognize';
|
---|
19 | import { resolveData } from './operators/resolve_data';
|
---|
20 | import { switchTap } from './operators/switch_tap';
|
---|
21 | import { DefaultRouteReuseStrategy } from './route_reuse_strategy';
|
---|
22 | import { RouterConfigLoader } from './router_config_loader';
|
---|
23 | import { ChildrenOutletContexts } from './router_outlet_context';
|
---|
24 | import { createEmptyState } from './router_state';
|
---|
25 | import { isNavigationCancelingError, navigationCancelingError } from './shared';
|
---|
26 | import { DefaultUrlHandlingStrategy } from './url_handling_strategy';
|
---|
27 | import { containsTree, createEmptyUrlTree, UrlSerializer } from './url_tree';
|
---|
28 | import { standardizeConfig, validateConfig } from './utils/config';
|
---|
29 | import { getAllRouteGuards } from './utils/preactivation';
|
---|
30 | import { isUrlTree } from './utils/type_guards';
|
---|
31 | function defaultErrorHandler(error) {
|
---|
32 | throw error;
|
---|
33 | }
|
---|
34 | function defaultMalformedUriErrorHandler(error, urlSerializer, url) {
|
---|
35 | return urlSerializer.parse('/');
|
---|
36 | }
|
---|
37 | /**
|
---|
38 | * @internal
|
---|
39 | */
|
---|
40 | function defaultRouterHook(snapshot, runExtras) {
|
---|
41 | return of(null);
|
---|
42 | }
|
---|
43 | /**
|
---|
44 | * The equivalent `IsActiveMatchOptions` options for `Router.isActive` is called with `true`
|
---|
45 | * (exact = true).
|
---|
46 | */
|
---|
47 | export const exactMatchOptions = {
|
---|
48 | paths: 'exact',
|
---|
49 | fragment: 'ignored',
|
---|
50 | matrixParams: 'ignored',
|
---|
51 | queryParams: 'exact'
|
---|
52 | };
|
---|
53 | /**
|
---|
54 | * The equivalent `IsActiveMatchOptions` options for `Router.isActive` is called with `false`
|
---|
55 | * (exact = false).
|
---|
56 | */
|
---|
57 | export const subsetMatchOptions = {
|
---|
58 | paths: 'subset',
|
---|
59 | fragment: 'ignored',
|
---|
60 | matrixParams: 'ignored',
|
---|
61 | queryParams: 'subset'
|
---|
62 | };
|
---|
63 | /**
|
---|
64 | * @description
|
---|
65 | *
|
---|
66 | * A service that provides navigation among views and URL manipulation capabilities.
|
---|
67 | *
|
---|
68 | * @see `Route`.
|
---|
69 | * @see [Routing and Navigation Guide](guide/router).
|
---|
70 | *
|
---|
71 | * @ngModule RouterModule
|
---|
72 | *
|
---|
73 | * @publicApi
|
---|
74 | */
|
---|
75 | export class Router {
|
---|
76 | /**
|
---|
77 | * Creates the router service.
|
---|
78 | */
|
---|
79 | // TODO: vsavkin make internal after the final is out.
|
---|
80 | constructor(rootComponentType, urlSerializer, rootContexts, location, injector, loader, compiler, config) {
|
---|
81 | this.rootComponentType = rootComponentType;
|
---|
82 | this.urlSerializer = urlSerializer;
|
---|
83 | this.rootContexts = rootContexts;
|
---|
84 | this.location = location;
|
---|
85 | this.config = config;
|
---|
86 | this.lastSuccessfulNavigation = null;
|
---|
87 | this.currentNavigation = null;
|
---|
88 | this.disposed = false;
|
---|
89 | /**
|
---|
90 | * Tracks the previously seen location change from the location subscription so we can compare
|
---|
91 | * the two latest to see if they are duplicates. See setUpLocationChangeListener.
|
---|
92 | */
|
---|
93 | this.lastLocationChangeInfo = null;
|
---|
94 | this.navigationId = 0;
|
---|
95 | /**
|
---|
96 | * The id of the currently active page in the router.
|
---|
97 | * Updated to the transition's target id on a successful navigation.
|
---|
98 | *
|
---|
99 | * This is used to track what page the router last activated. When an attempted navigation fails,
|
---|
100 | * the router can then use this to compute how to restore the state back to the previously active
|
---|
101 | * page.
|
---|
102 | */
|
---|
103 | this.currentPageId = 0;
|
---|
104 | this.isNgZoneEnabled = false;
|
---|
105 | /**
|
---|
106 | * An event stream for routing events in this NgModule.
|
---|
107 | */
|
---|
108 | this.events = new Subject();
|
---|
109 | /**
|
---|
110 | * A handler for navigation errors in this NgModule.
|
---|
111 | */
|
---|
112 | this.errorHandler = defaultErrorHandler;
|
---|
113 | /**
|
---|
114 | * A handler for errors thrown by `Router.parseUrl(url)`
|
---|
115 | * when `url` contains an invalid character.
|
---|
116 | * The most common case is a `%` sign
|
---|
117 | * that's not encoded and is not part of a percent encoded sequence.
|
---|
118 | */
|
---|
119 | this.malformedUriErrorHandler = defaultMalformedUriErrorHandler;
|
---|
120 | /**
|
---|
121 | * True if at least one navigation event has occurred,
|
---|
122 | * false otherwise.
|
---|
123 | */
|
---|
124 | this.navigated = false;
|
---|
125 | this.lastSuccessfulId = -1;
|
---|
126 | /**
|
---|
127 | * Hooks that enable you to pause navigation,
|
---|
128 | * either before or after the preactivation phase.
|
---|
129 | * Used by `RouterModule`.
|
---|
130 | *
|
---|
131 | * @internal
|
---|
132 | */
|
---|
133 | this.hooks = { beforePreactivation: defaultRouterHook, afterPreactivation: defaultRouterHook };
|
---|
134 | /**
|
---|
135 | * A strategy for extracting and merging URLs.
|
---|
136 | * Used for AngularJS to Angular migrations.
|
---|
137 | */
|
---|
138 | this.urlHandlingStrategy = new DefaultUrlHandlingStrategy();
|
---|
139 | /**
|
---|
140 | * A strategy for re-using routes.
|
---|
141 | */
|
---|
142 | this.routeReuseStrategy = new DefaultRouteReuseStrategy();
|
---|
143 | /**
|
---|
144 | * How to handle a navigation request to the current URL. One of:
|
---|
145 | *
|
---|
146 | * - `'ignore'` : The router ignores the request.
|
---|
147 | * - `'reload'` : The router reloads the URL. Use to implement a "refresh" feature.
|
---|
148 | *
|
---|
149 | * Note that this only configures whether the Route reprocesses the URL and triggers related
|
---|
150 | * action and events like redirects, guards, and resolvers. By default, the router re-uses a
|
---|
151 | * component instance when it re-navigates to the same component type without visiting a different
|
---|
152 | * component first. This behavior is configured by the `RouteReuseStrategy`. In order to reload
|
---|
153 | * routed components on same url navigation, you need to set `onSameUrlNavigation` to `'reload'`
|
---|
154 | * _and_ provide a `RouteReuseStrategy` which returns `false` for `shouldReuseRoute`.
|
---|
155 | */
|
---|
156 | this.onSameUrlNavigation = 'ignore';
|
---|
157 | /**
|
---|
158 | * How to merge parameters, data, and resolved data from parent to child
|
---|
159 | * routes. One of:
|
---|
160 | *
|
---|
161 | * - `'emptyOnly'` : Inherit parent parameters, data, and resolved data
|
---|
162 | * for path-less or component-less routes.
|
---|
163 | * - `'always'` : Inherit parent parameters, data, and resolved data
|
---|
164 | * for all child routes.
|
---|
165 | */
|
---|
166 | this.paramsInheritanceStrategy = 'emptyOnly';
|
---|
167 | /**
|
---|
168 | * Determines when the router updates the browser URL.
|
---|
169 | * By default (`"deferred"`), updates the browser URL after navigation has finished.
|
---|
170 | * Set to `'eager'` to update the browser URL at the beginning of navigation.
|
---|
171 | * You can choose to update early so that, if navigation fails,
|
---|
172 | * you can show an error message with the URL that failed.
|
---|
173 | */
|
---|
174 | this.urlUpdateStrategy = 'deferred';
|
---|
175 | /**
|
---|
176 | * Enables a bug fix that corrects relative link resolution in components with empty paths.
|
---|
177 | * @see `RouterModule`
|
---|
178 | */
|
---|
179 | this.relativeLinkResolution = 'corrected';
|
---|
180 | /**
|
---|
181 | * Configures how the Router attempts to restore state when a navigation is cancelled.
|
---|
182 | *
|
---|
183 | * 'replace' - Always uses `location.replaceState` to set the browser state to the state of the
|
---|
184 | * router before the navigation started.
|
---|
185 | *
|
---|
186 | * 'computed' - Will always return to the same state that corresponds to the actual Angular route
|
---|
187 | * when the navigation gets cancelled right after triggering a `popstate` event.
|
---|
188 | *
|
---|
189 | * The default value is `replace`
|
---|
190 | *
|
---|
191 | * @internal
|
---|
192 | */
|
---|
193 | // TODO(atscott): Determine how/when/if to make this public API
|
---|
194 | // This shouldn’t be an option at all but may need to be in order to allow migration without a
|
---|
195 | // breaking change. We need to determine if it should be made into public api (or if we forgo
|
---|
196 | // the option and release as a breaking change bug fix in a major version).
|
---|
197 | this.canceledNavigationResolution = 'replace';
|
---|
198 | const onLoadStart = (r) => this.triggerEvent(new RouteConfigLoadStart(r));
|
---|
199 | const onLoadEnd = (r) => this.triggerEvent(new RouteConfigLoadEnd(r));
|
---|
200 | this.ngModule = injector.get(NgModuleRef);
|
---|
201 | this.console = injector.get(Console);
|
---|
202 | const ngZone = injector.get(NgZone);
|
---|
203 | this.isNgZoneEnabled = ngZone instanceof NgZone && NgZone.isInAngularZone();
|
---|
204 | this.resetConfig(config);
|
---|
205 | this.currentUrlTree = createEmptyUrlTree();
|
---|
206 | this.rawUrlTree = this.currentUrlTree;
|
---|
207 | this.browserUrlTree = this.currentUrlTree;
|
---|
208 | this.configLoader = new RouterConfigLoader(loader, compiler, onLoadStart, onLoadEnd);
|
---|
209 | this.routerState = createEmptyState(this.currentUrlTree, this.rootComponentType);
|
---|
210 | this.transitions = new BehaviorSubject({
|
---|
211 | id: 0,
|
---|
212 | targetPageId: 0,
|
---|
213 | currentUrlTree: this.currentUrlTree,
|
---|
214 | currentRawUrl: this.currentUrlTree,
|
---|
215 | extractedUrl: this.urlHandlingStrategy.extract(this.currentUrlTree),
|
---|
216 | urlAfterRedirects: this.urlHandlingStrategy.extract(this.currentUrlTree),
|
---|
217 | rawUrl: this.currentUrlTree,
|
---|
218 | extras: {},
|
---|
219 | resolve: null,
|
---|
220 | reject: null,
|
---|
221 | promise: Promise.resolve(true),
|
---|
222 | source: 'imperative',
|
---|
223 | restoredState: null,
|
---|
224 | currentSnapshot: this.routerState.snapshot,
|
---|
225 | targetSnapshot: null,
|
---|
226 | currentRouterState: this.routerState,
|
---|
227 | targetRouterState: null,
|
---|
228 | guards: { canActivateChecks: [], canDeactivateChecks: [] },
|
---|
229 | guardsResult: null,
|
---|
230 | });
|
---|
231 | this.navigations = this.setupNavigations(this.transitions);
|
---|
232 | this.processNavigations();
|
---|
233 | }
|
---|
234 | /**
|
---|
235 | * The ɵrouterPageId of whatever page is currently active in the browser history. This is
|
---|
236 | * important for computing the target page id for new navigations because we need to ensure each
|
---|
237 | * page id in the browser history is 1 more than the previous entry.
|
---|
238 | */
|
---|
239 | get browserPageId() {
|
---|
240 | var _a;
|
---|
241 | return (_a = this.location.getState()) === null || _a === void 0 ? void 0 : _a.ɵrouterPageId;
|
---|
242 | }
|
---|
243 | setupNavigations(transitions) {
|
---|
244 | const eventsSubject = this.events;
|
---|
245 | return transitions.pipe(filter(t => t.id !== 0),
|
---|
246 | // Extract URL
|
---|
247 | map(t => (Object.assign(Object.assign({}, t), { extractedUrl: this.urlHandlingStrategy.extract(t.rawUrl) }))),
|
---|
248 | // Using switchMap so we cancel executing navigations when a new one comes in
|
---|
249 | switchMap(t => {
|
---|
250 | let completed = false;
|
---|
251 | let errored = false;
|
---|
252 | return of(t).pipe(
|
---|
253 | // Store the Navigation object
|
---|
254 | tap(t => {
|
---|
255 | this.currentNavigation = {
|
---|
256 | id: t.id,
|
---|
257 | initialUrl: t.currentRawUrl,
|
---|
258 | extractedUrl: t.extractedUrl,
|
---|
259 | trigger: t.source,
|
---|
260 | extras: t.extras,
|
---|
261 | previousNavigation: this.lastSuccessfulNavigation ? Object.assign(Object.assign({}, this.lastSuccessfulNavigation), { previousNavigation: null }) :
|
---|
262 | null
|
---|
263 | };
|
---|
264 | }), switchMap(t => {
|
---|
265 | const browserUrlTree = this.browserUrlTree.toString();
|
---|
266 | const urlTransition = !this.navigated ||
|
---|
267 | t.extractedUrl.toString() !== browserUrlTree ||
|
---|
268 | // Navigations which succeed or ones which fail and are cleaned up
|
---|
269 | // correctly should result in `browserUrlTree` and `currentUrlTree`
|
---|
270 | // matching. If this is not the case, assume something went wrong and try
|
---|
271 | // processing the URL again.
|
---|
272 | browserUrlTree !== this.currentUrlTree.toString();
|
---|
273 | const processCurrentUrl = (this.onSameUrlNavigation === 'reload' ? true : urlTransition) &&
|
---|
274 | this.urlHandlingStrategy.shouldProcessUrl(t.rawUrl);
|
---|
275 | if (processCurrentUrl) {
|
---|
276 | // If the source of the navigation is from a browser event, the URL is
|
---|
277 | // already updated. We already need to sync the internal state.
|
---|
278 | if (isBrowserTriggeredNavigation(t.source)) {
|
---|
279 | this.browserUrlTree = t.extractedUrl;
|
---|
280 | }
|
---|
281 | return of(t).pipe(
|
---|
282 | // Fire NavigationStart event
|
---|
283 | switchMap(t => {
|
---|
284 | const transition = this.transitions.getValue();
|
---|
285 | eventsSubject.next(new NavigationStart(t.id, this.serializeUrl(t.extractedUrl), t.source, t.restoredState));
|
---|
286 | if (transition !== this.transitions.getValue()) {
|
---|
287 | return EMPTY;
|
---|
288 | }
|
---|
289 | // This delay is required to match old behavior that forced
|
---|
290 | // navigation to always be async
|
---|
291 | return Promise.resolve(t);
|
---|
292 | }),
|
---|
293 | // ApplyRedirects
|
---|
294 | applyRedirects(this.ngModule.injector, this.configLoader, this.urlSerializer, this.config),
|
---|
295 | // Update the currentNavigation
|
---|
296 | tap(t => {
|
---|
297 | this.currentNavigation = Object.assign(Object.assign({}, this.currentNavigation), { finalUrl: t.urlAfterRedirects });
|
---|
298 | }),
|
---|
299 | // Recognize
|
---|
300 | recognize(this.rootComponentType, this.config, (url) => this.serializeUrl(url), this.paramsInheritanceStrategy, this.relativeLinkResolution),
|
---|
301 | // Update URL if in `eager` update mode
|
---|
302 | tap(t => {
|
---|
303 | if (this.urlUpdateStrategy === 'eager') {
|
---|
304 | if (!t.extras.skipLocationChange) {
|
---|
305 | this.setBrowserUrl(t.urlAfterRedirects, t);
|
---|
306 | // TODO(atscott): The above line is incorrect. It sets the url to
|
---|
307 | // only the part that is handled by the router. It should merge
|
---|
308 | // that with the rawUrl so the url includes segments not handled
|
---|
309 | // by the router:
|
---|
310 | // const rawUrl = this.urlHandlingStrategy.merge(
|
---|
311 | // t.urlAfterRedirects, t.rawUrl);
|
---|
312 | // this.setBrowserUrl(rawUrl, t);
|
---|
313 | }
|
---|
314 | this.browserUrlTree = t.urlAfterRedirects;
|
---|
315 | }
|
---|
316 | // Fire RoutesRecognized
|
---|
317 | const routesRecognized = new RoutesRecognized(t.id, this.serializeUrl(t.extractedUrl), this.serializeUrl(t.urlAfterRedirects), t.targetSnapshot);
|
---|
318 | eventsSubject.next(routesRecognized);
|
---|
319 | }));
|
---|
320 | }
|
---|
321 | else {
|
---|
322 | const processPreviousUrl = urlTransition && this.rawUrlTree &&
|
---|
323 | this.urlHandlingStrategy.shouldProcessUrl(this.rawUrlTree);
|
---|
324 | /* When the current URL shouldn't be processed, but the previous one was,
|
---|
325 | * we handle this "error condition" by navigating to the previously
|
---|
326 | * successful URL, but leaving the URL intact.*/
|
---|
327 | if (processPreviousUrl) {
|
---|
328 | const { id, extractedUrl, source, restoredState, extras } = t;
|
---|
329 | const navStart = new NavigationStart(id, this.serializeUrl(extractedUrl), source, restoredState);
|
---|
330 | eventsSubject.next(navStart);
|
---|
331 | const targetSnapshot = createEmptyState(extractedUrl, this.rootComponentType).snapshot;
|
---|
332 | return of(Object.assign(Object.assign({}, t), { targetSnapshot, urlAfterRedirects: extractedUrl, extras: Object.assign(Object.assign({}, extras), { skipLocationChange: false, replaceUrl: false }) }));
|
---|
333 | }
|
---|
334 | else {
|
---|
335 | /* When neither the current or previous URL can be processed, do nothing
|
---|
336 | * other than update router's internal reference to the current "settled"
|
---|
337 | * URL. This way the next navigation will be coming from the current URL
|
---|
338 | * in the browser.
|
---|
339 | */
|
---|
340 | this.rawUrlTree = t.rawUrl;
|
---|
341 | this.browserUrlTree = t.urlAfterRedirects;
|
---|
342 | t.resolve(null);
|
---|
343 | return EMPTY;
|
---|
344 | }
|
---|
345 | }
|
---|
346 | }),
|
---|
347 | // Before Preactivation
|
---|
348 | switchTap(t => {
|
---|
349 | const { targetSnapshot, id: navigationId, extractedUrl: appliedUrlTree, rawUrl: rawUrlTree, extras: { skipLocationChange, replaceUrl } } = t;
|
---|
350 | return this.hooks.beforePreactivation(targetSnapshot, {
|
---|
351 | navigationId,
|
---|
352 | appliedUrlTree,
|
---|
353 | rawUrlTree,
|
---|
354 | skipLocationChange: !!skipLocationChange,
|
---|
355 | replaceUrl: !!replaceUrl,
|
---|
356 | });
|
---|
357 | }),
|
---|
358 | // --- GUARDS ---
|
---|
359 | tap(t => {
|
---|
360 | const guardsStart = new GuardsCheckStart(t.id, this.serializeUrl(t.extractedUrl), this.serializeUrl(t.urlAfterRedirects), t.targetSnapshot);
|
---|
361 | this.triggerEvent(guardsStart);
|
---|
362 | }), map(t => (Object.assign(Object.assign({}, t), { guards: getAllRouteGuards(t.targetSnapshot, t.currentSnapshot, this.rootContexts) }))), checkGuards(this.ngModule.injector, (evt) => this.triggerEvent(evt)), tap(t => {
|
---|
363 | if (isUrlTree(t.guardsResult)) {
|
---|
364 | const error = navigationCancelingError(`Redirecting to "${this.serializeUrl(t.guardsResult)}"`);
|
---|
365 | error.url = t.guardsResult;
|
---|
366 | throw error;
|
---|
367 | }
|
---|
368 | const guardsEnd = new GuardsCheckEnd(t.id, this.serializeUrl(t.extractedUrl), this.serializeUrl(t.urlAfterRedirects), t.targetSnapshot, !!t.guardsResult);
|
---|
369 | this.triggerEvent(guardsEnd);
|
---|
370 | }), filter(t => {
|
---|
371 | if (!t.guardsResult) {
|
---|
372 | this.restoreHistory(t);
|
---|
373 | this.cancelNavigationTransition(t, '');
|
---|
374 | return false;
|
---|
375 | }
|
---|
376 | return true;
|
---|
377 | }),
|
---|
378 | // --- RESOLVE ---
|
---|
379 | switchTap(t => {
|
---|
380 | if (t.guards.canActivateChecks.length) {
|
---|
381 | return of(t).pipe(tap(t => {
|
---|
382 | const resolveStart = new ResolveStart(t.id, this.serializeUrl(t.extractedUrl), this.serializeUrl(t.urlAfterRedirects), t.targetSnapshot);
|
---|
383 | this.triggerEvent(resolveStart);
|
---|
384 | }), switchMap(t => {
|
---|
385 | let dataResolved = false;
|
---|
386 | return of(t).pipe(resolveData(this.paramsInheritanceStrategy, this.ngModule.injector), tap({
|
---|
387 | next: () => dataResolved = true,
|
---|
388 | complete: () => {
|
---|
389 | if (!dataResolved) {
|
---|
390 | this.restoreHistory(t);
|
---|
391 | this.cancelNavigationTransition(t, `At least one route resolver didn't emit any value.`);
|
---|
392 | }
|
---|
393 | }
|
---|
394 | }));
|
---|
395 | }), tap(t => {
|
---|
396 | const resolveEnd = new ResolveEnd(t.id, this.serializeUrl(t.extractedUrl), this.serializeUrl(t.urlAfterRedirects), t.targetSnapshot);
|
---|
397 | this.triggerEvent(resolveEnd);
|
---|
398 | }));
|
---|
399 | }
|
---|
400 | return undefined;
|
---|
401 | }),
|
---|
402 | // --- AFTER PREACTIVATION ---
|
---|
403 | switchTap((t) => {
|
---|
404 | const { targetSnapshot, id: navigationId, extractedUrl: appliedUrlTree, rawUrl: rawUrlTree, extras: { skipLocationChange, replaceUrl } } = t;
|
---|
405 | return this.hooks.afterPreactivation(targetSnapshot, {
|
---|
406 | navigationId,
|
---|
407 | appliedUrlTree,
|
---|
408 | rawUrlTree,
|
---|
409 | skipLocationChange: !!skipLocationChange,
|
---|
410 | replaceUrl: !!replaceUrl,
|
---|
411 | });
|
---|
412 | }), map((t) => {
|
---|
413 | const targetRouterState = createRouterState(this.routeReuseStrategy, t.targetSnapshot, t.currentRouterState);
|
---|
414 | return (Object.assign(Object.assign({}, t), { targetRouterState }));
|
---|
415 | }),
|
---|
416 | /* Once here, we are about to activate syncronously. The assumption is this
|
---|
417 | will succeed, and user code may read from the Router service. Therefore
|
---|
418 | before activation, we need to update router properties storing the current
|
---|
419 | URL and the RouterState, as well as updated the browser URL. All this should
|
---|
420 | happen *before* activating. */
|
---|
421 | tap((t) => {
|
---|
422 | this.currentUrlTree = t.urlAfterRedirects;
|
---|
423 | this.rawUrlTree =
|
---|
424 | this.urlHandlingStrategy.merge(t.urlAfterRedirects, t.rawUrl);
|
---|
425 | this.routerState = t.targetRouterState;
|
---|
426 | if (this.urlUpdateStrategy === 'deferred') {
|
---|
427 | if (!t.extras.skipLocationChange) {
|
---|
428 | this.setBrowserUrl(this.rawUrlTree, t);
|
---|
429 | }
|
---|
430 | this.browserUrlTree = t.urlAfterRedirects;
|
---|
431 | }
|
---|
432 | }), activateRoutes(this.rootContexts, this.routeReuseStrategy, (evt) => this.triggerEvent(evt)), tap({
|
---|
433 | next() {
|
---|
434 | completed = true;
|
---|
435 | },
|
---|
436 | complete() {
|
---|
437 | completed = true;
|
---|
438 | }
|
---|
439 | }), finalize(() => {
|
---|
440 | var _a;
|
---|
441 | /* When the navigation stream finishes either through error or success, we
|
---|
442 | * set the `completed` or `errored` flag. However, there are some situations
|
---|
443 | * where we could get here without either of those being set. For instance, a
|
---|
444 | * redirect during NavigationStart. Therefore, this is a catch-all to make
|
---|
445 | * sure the NavigationCancel
|
---|
446 | * event is fired when a navigation gets cancelled but not caught by other
|
---|
447 | * means. */
|
---|
448 | if (!completed && !errored) {
|
---|
449 | const cancelationReason = `Navigation ID ${t.id} is not equal to the current navigation id ${this.navigationId}`;
|
---|
450 | if (this.canceledNavigationResolution === 'replace') {
|
---|
451 | // Must reset to current URL tree here to ensure history.state is set. On
|
---|
452 | // a fresh page load, if a new navigation comes in before a successful
|
---|
453 | // navigation completes, there will be nothing in
|
---|
454 | // history.state.navigationId. This can cause sync problems with
|
---|
455 | // AngularJS sync code which looks for a value here in order to determine
|
---|
456 | // whether or not to handle a given popstate event or to leave it to the
|
---|
457 | // Angular router.
|
---|
458 | this.restoreHistory(t);
|
---|
459 | this.cancelNavigationTransition(t, cancelationReason);
|
---|
460 | }
|
---|
461 | else {
|
---|
462 | // We cannot trigger a `location.historyGo` if the
|
---|
463 | // cancellation was due to a new navigation before the previous could
|
---|
464 | // complete. This is because `location.historyGo` triggers a `popstate`
|
---|
465 | // which would also trigger another navigation. Instead, treat this as a
|
---|
466 | // redirect and do not reset the state.
|
---|
467 | this.cancelNavigationTransition(t, cancelationReason);
|
---|
468 | // TODO(atscott): The same problem happens here with a fresh page load
|
---|
469 | // and a new navigation before that completes where we won't set a page
|
---|
470 | // id.
|
---|
471 | }
|
---|
472 | }
|
---|
473 | // Only clear current navigation if it is still set to the one that
|
---|
474 | // finalized.
|
---|
475 | if (((_a = this.currentNavigation) === null || _a === void 0 ? void 0 : _a.id) === t.id) {
|
---|
476 | this.currentNavigation = null;
|
---|
477 | }
|
---|
478 | }), catchError((e) => {
|
---|
479 | // TODO(atscott): The NavigationTransition `t` used here does not accurately
|
---|
480 | // reflect the current state of the whole transition because some operations
|
---|
481 | // return a new object rather than modifying the one in the outermost
|
---|
482 | // `switchMap`.
|
---|
483 | // The fix can likely be to:
|
---|
484 | // 1. Rename the outer `t` variable so it's not shadowed all the time and
|
---|
485 | // confusing
|
---|
486 | // 2. Keep reassigning to the outer variable after each stage to ensure it
|
---|
487 | // gets updated. Or change the implementations to not return a copy.
|
---|
488 | // Not changed yet because it affects existing code and would need to be
|
---|
489 | // tested more thoroughly.
|
---|
490 | errored = true;
|
---|
491 | /* This error type is issued during Redirect, and is handled as a
|
---|
492 | * cancellation rather than an error. */
|
---|
493 | if (isNavigationCancelingError(e)) {
|
---|
494 | const redirecting = isUrlTree(e.url);
|
---|
495 | if (!redirecting) {
|
---|
496 | // Set property only if we're not redirecting. If we landed on a page and
|
---|
497 | // redirect to `/` route, the new navigation is going to see the `/`
|
---|
498 | // isn't a change from the default currentUrlTree and won't navigate.
|
---|
499 | // This is only applicable with initial navigation, so setting
|
---|
500 | // `navigated` only when not redirecting resolves this scenario.
|
---|
501 | this.navigated = true;
|
---|
502 | this.restoreHistory(t, true);
|
---|
503 | }
|
---|
504 | const navCancel = new NavigationCancel(t.id, this.serializeUrl(t.extractedUrl), e.message);
|
---|
505 | eventsSubject.next(navCancel);
|
---|
506 | // When redirecting, we need to delay resolving the navigation
|
---|
507 | // promise and push it to the redirect navigation
|
---|
508 | if (!redirecting) {
|
---|
509 | t.resolve(false);
|
---|
510 | }
|
---|
511 | else {
|
---|
512 | // setTimeout is required so this navigation finishes with
|
---|
513 | // the return EMPTY below. If it isn't allowed to finish
|
---|
514 | // processing, there can be multiple navigations to the same
|
---|
515 | // URL.
|
---|
516 | setTimeout(() => {
|
---|
517 | const mergedTree = this.urlHandlingStrategy.merge(e.url, this.rawUrlTree);
|
---|
518 | const extras = {
|
---|
519 | skipLocationChange: t.extras.skipLocationChange,
|
---|
520 | // The URL is already updated at this point if we have 'eager' URL
|
---|
521 | // updates or if the navigation was triggered by the browser (back
|
---|
522 | // button, URL bar, etc). We want to replace that item in history if
|
---|
523 | // the navigation is rejected.
|
---|
524 | replaceUrl: this.urlUpdateStrategy === 'eager' ||
|
---|
525 | isBrowserTriggeredNavigation(t.source)
|
---|
526 | };
|
---|
527 | this.scheduleNavigation(mergedTree, 'imperative', null, extras, { resolve: t.resolve, reject: t.reject, promise: t.promise });
|
---|
528 | }, 0);
|
---|
529 | }
|
---|
530 | /* All other errors should reset to the router's internal URL reference to
|
---|
531 | * the pre-error state. */
|
---|
532 | }
|
---|
533 | else {
|
---|
534 | this.restoreHistory(t, true);
|
---|
535 | const navError = new NavigationError(t.id, this.serializeUrl(t.extractedUrl), e);
|
---|
536 | eventsSubject.next(navError);
|
---|
537 | try {
|
---|
538 | t.resolve(this.errorHandler(e));
|
---|
539 | }
|
---|
540 | catch (ee) {
|
---|
541 | t.reject(ee);
|
---|
542 | }
|
---|
543 | }
|
---|
544 | return EMPTY;
|
---|
545 | }));
|
---|
546 | // TODO(jasonaden): remove cast once g3 is on updated TypeScript
|
---|
547 | }));
|
---|
548 | }
|
---|
549 | /**
|
---|
550 | * @internal
|
---|
551 | * TODO: this should be removed once the constructor of the router made internal
|
---|
552 | */
|
---|
553 | resetRootComponentType(rootComponentType) {
|
---|
554 | this.rootComponentType = rootComponentType;
|
---|
555 | // TODO: vsavkin router 4.0 should make the root component set to null
|
---|
556 | // this will simplify the lifecycle of the router.
|
---|
557 | this.routerState.root.component = this.rootComponentType;
|
---|
558 | }
|
---|
559 | getTransition() {
|
---|
560 | const transition = this.transitions.value;
|
---|
561 | // TODO(atscott): This comment doesn't make it clear why this value needs to be set. In the case
|
---|
562 | // described below (where we don't handle previous or current url), the `browserUrlTree` is set
|
---|
563 | // to the `urlAfterRedirects` value. However, these values *are already the same* because of the
|
---|
564 | // line below. So it seems that we should be able to remove the line below and the line where
|
---|
565 | // `browserUrlTree` is updated when we aren't handling any part of the navigation url.
|
---|
566 | // Run TGP to confirm that this can be done.
|
---|
567 | // This value needs to be set. Other values such as extractedUrl are set on initial navigation
|
---|
568 | // but the urlAfterRedirects may not get set if we aren't processing the new URL *and* not
|
---|
569 | // processing the previous URL.
|
---|
570 | transition.urlAfterRedirects = this.browserUrlTree;
|
---|
571 | return transition;
|
---|
572 | }
|
---|
573 | setTransition(t) {
|
---|
574 | this.transitions.next(Object.assign(Object.assign({}, this.getTransition()), t));
|
---|
575 | }
|
---|
576 | /**
|
---|
577 | * Sets up the location change listener and performs the initial navigation.
|
---|
578 | */
|
---|
579 | initialNavigation() {
|
---|
580 | this.setUpLocationChangeListener();
|
---|
581 | if (this.navigationId === 0) {
|
---|
582 | this.navigateByUrl(this.location.path(true), { replaceUrl: true });
|
---|
583 | }
|
---|
584 | }
|
---|
585 | /**
|
---|
586 | * Sets up the location change listener. This listener detects navigations triggered from outside
|
---|
587 | * the Router (the browser back/forward buttons, for example) and schedules a corresponding Router
|
---|
588 | * navigation so that the correct events, guards, etc. are triggered.
|
---|
589 | */
|
---|
590 | setUpLocationChangeListener() {
|
---|
591 | // Don't need to use Zone.wrap any more, because zone.js
|
---|
592 | // already patch onPopState, so location change callback will
|
---|
593 | // run into ngZone
|
---|
594 | if (!this.locationSubscription) {
|
---|
595 | this.locationSubscription = this.location.subscribe(event => {
|
---|
596 | const currentChange = this.extractLocationChangeInfoFromEvent(event);
|
---|
597 | // The `setTimeout` was added in #12160 and is likely to support Angular/AngularJS
|
---|
598 | // hybrid apps.
|
---|
599 | if (this.shouldScheduleNavigation(this.lastLocationChangeInfo, currentChange)) {
|
---|
600 | setTimeout(() => {
|
---|
601 | const { source, state, urlTree } = currentChange;
|
---|
602 | const extras = { replaceUrl: true };
|
---|
603 | if (state) {
|
---|
604 | const stateCopy = Object.assign({}, state);
|
---|
605 | delete stateCopy.navigationId;
|
---|
606 | delete stateCopy.ɵrouterPageId;
|
---|
607 | if (Object.keys(stateCopy).length !== 0) {
|
---|
608 | extras.state = stateCopy;
|
---|
609 | }
|
---|
610 | }
|
---|
611 | this.scheduleNavigation(urlTree, source, state, extras);
|
---|
612 | }, 0);
|
---|
613 | }
|
---|
614 | this.lastLocationChangeInfo = currentChange;
|
---|
615 | });
|
---|
616 | }
|
---|
617 | }
|
---|
618 | /** Extracts router-related information from a `PopStateEvent`. */
|
---|
619 | extractLocationChangeInfoFromEvent(change) {
|
---|
620 | var _a;
|
---|
621 | return {
|
---|
622 | source: change['type'] === 'popstate' ? 'popstate' : 'hashchange',
|
---|
623 | urlTree: this.parseUrl(change['url']),
|
---|
624 | // Navigations coming from Angular router have a navigationId state
|
---|
625 | // property. When this exists, restore the state.
|
---|
626 | state: ((_a = change.state) === null || _a === void 0 ? void 0 : _a.navigationId) ? change.state : null,
|
---|
627 | transitionId: this.getTransition().id
|
---|
628 | };
|
---|
629 | }
|
---|
630 | /**
|
---|
631 | * Determines whether two events triggered by the Location subscription are due to the same
|
---|
632 | * navigation. The location subscription can fire two events (popstate and hashchange) for a
|
---|
633 | * single navigation. The second one should be ignored, that is, we should not schedule another
|
---|
634 | * navigation in the Router.
|
---|
635 | */
|
---|
636 | shouldScheduleNavigation(previous, current) {
|
---|
637 | if (!previous)
|
---|
638 | return true;
|
---|
639 | const sameDestination = current.urlTree.toString() === previous.urlTree.toString();
|
---|
640 | const eventsOccurredAtSameTime = current.transitionId === previous.transitionId;
|
---|
641 | if (!eventsOccurredAtSameTime || !sameDestination) {
|
---|
642 | return true;
|
---|
643 | }
|
---|
644 | if ((current.source === 'hashchange' && previous.source === 'popstate') ||
|
---|
645 | (current.source === 'popstate' && previous.source === 'hashchange')) {
|
---|
646 | return false;
|
---|
647 | }
|
---|
648 | return true;
|
---|
649 | }
|
---|
650 | /** The current URL. */
|
---|
651 | get url() {
|
---|
652 | return this.serializeUrl(this.currentUrlTree);
|
---|
653 | }
|
---|
654 | /**
|
---|
655 | * Returns the current `Navigation` object when the router is navigating,
|
---|
656 | * and `null` when idle.
|
---|
657 | */
|
---|
658 | getCurrentNavigation() {
|
---|
659 | return this.currentNavigation;
|
---|
660 | }
|
---|
661 | /** @internal */
|
---|
662 | triggerEvent(event) {
|
---|
663 | this.events.next(event);
|
---|
664 | }
|
---|
665 | /**
|
---|
666 | * Resets the route configuration used for navigation and generating links.
|
---|
667 | *
|
---|
668 | * @param config The route array for the new configuration.
|
---|
669 | *
|
---|
670 | * @usageNotes
|
---|
671 | *
|
---|
672 | * ```
|
---|
673 | * router.resetConfig([
|
---|
674 | * { path: 'team/:id', component: TeamCmp, children: [
|
---|
675 | * { path: 'simple', component: SimpleCmp },
|
---|
676 | * { path: 'user/:name', component: UserCmp }
|
---|
677 | * ]}
|
---|
678 | * ]);
|
---|
679 | * ```
|
---|
680 | */
|
---|
681 | resetConfig(config) {
|
---|
682 | validateConfig(config);
|
---|
683 | this.config = config.map(standardizeConfig);
|
---|
684 | this.navigated = false;
|
---|
685 | this.lastSuccessfulId = -1;
|
---|
686 | }
|
---|
687 | /** @nodoc */
|
---|
688 | ngOnDestroy() {
|
---|
689 | this.dispose();
|
---|
690 | }
|
---|
691 | /** Disposes of the router. */
|
---|
692 | dispose() {
|
---|
693 | this.transitions.complete();
|
---|
694 | if (this.locationSubscription) {
|
---|
695 | this.locationSubscription.unsubscribe();
|
---|
696 | this.locationSubscription = undefined;
|
---|
697 | }
|
---|
698 | this.disposed = true;
|
---|
699 | }
|
---|
700 | /**
|
---|
701 | * Appends URL segments to the current URL tree to create a new URL tree.
|
---|
702 | *
|
---|
703 | * @param commands An array of URL fragments with which to construct the new URL tree.
|
---|
704 | * If the path is static, can be the literal URL string. For a dynamic path, pass an array of path
|
---|
705 | * segments, followed by the parameters for each segment.
|
---|
706 | * The fragments are applied to the current URL tree or the one provided in the `relativeTo`
|
---|
707 | * property of the options object, if supplied.
|
---|
708 | * @param navigationExtras Options that control the navigation strategy.
|
---|
709 | * @returns The new URL tree.
|
---|
710 | *
|
---|
711 | * @usageNotes
|
---|
712 | *
|
---|
713 | * ```
|
---|
714 | * // create /team/33/user/11
|
---|
715 | * router.createUrlTree(['/team', 33, 'user', 11]);
|
---|
716 | *
|
---|
717 | * // create /team/33;expand=true/user/11
|
---|
718 | * router.createUrlTree(['/team', 33, {expand: true}, 'user', 11]);
|
---|
719 | *
|
---|
720 | * // you can collapse static segments like this (this works only with the first passed-in value):
|
---|
721 | * router.createUrlTree(['/team/33/user', userId]);
|
---|
722 | *
|
---|
723 | * // If the first segment can contain slashes, and you do not want the router to split it,
|
---|
724 | * // you can do the following:
|
---|
725 | * router.createUrlTree([{segmentPath: '/one/two'}]);
|
---|
726 | *
|
---|
727 | * // create /team/33/(user/11//right:chat)
|
---|
728 | * router.createUrlTree(['/team', 33, {outlets: {primary: 'user/11', right: 'chat'}}]);
|
---|
729 | *
|
---|
730 | * // remove the right secondary node
|
---|
731 | * router.createUrlTree(['/team', 33, {outlets: {primary: 'user/11', right: null}}]);
|
---|
732 | *
|
---|
733 | * // assuming the current url is `/team/33/user/11` and the route points to `user/11`
|
---|
734 | *
|
---|
735 | * // navigate to /team/33/user/11/details
|
---|
736 | * router.createUrlTree(['details'], {relativeTo: route});
|
---|
737 | *
|
---|
738 | * // navigate to /team/33/user/22
|
---|
739 | * router.createUrlTree(['../22'], {relativeTo: route});
|
---|
740 | *
|
---|
741 | * // navigate to /team/44/user/22
|
---|
742 | * router.createUrlTree(['../../team/44/user/22'], {relativeTo: route});
|
---|
743 | *
|
---|
744 | * Note that a value of `null` or `undefined` for `relativeTo` indicates that the
|
---|
745 | * tree should be created relative to the root.
|
---|
746 | * ```
|
---|
747 | */
|
---|
748 | createUrlTree(commands, navigationExtras = {}) {
|
---|
749 | const { relativeTo, queryParams, fragment, queryParamsHandling, preserveFragment } = navigationExtras;
|
---|
750 | const a = relativeTo || this.routerState.root;
|
---|
751 | const f = preserveFragment ? this.currentUrlTree.fragment : fragment;
|
---|
752 | let q = null;
|
---|
753 | switch (queryParamsHandling) {
|
---|
754 | case 'merge':
|
---|
755 | q = Object.assign(Object.assign({}, this.currentUrlTree.queryParams), queryParams);
|
---|
756 | break;
|
---|
757 | case 'preserve':
|
---|
758 | q = this.currentUrlTree.queryParams;
|
---|
759 | break;
|
---|
760 | default:
|
---|
761 | q = queryParams || null;
|
---|
762 | }
|
---|
763 | if (q !== null) {
|
---|
764 | q = this.removeEmptyProps(q);
|
---|
765 | }
|
---|
766 | return createUrlTree(a, this.currentUrlTree, commands, q, f !== null && f !== void 0 ? f : null);
|
---|
767 | }
|
---|
768 | /**
|
---|
769 | * Navigates to a view using an absolute route path.
|
---|
770 | *
|
---|
771 | * @param url An absolute path for a defined route. The function does not apply any delta to the
|
---|
772 | * current URL.
|
---|
773 | * @param extras An object containing properties that modify the navigation strategy.
|
---|
774 | *
|
---|
775 | * @returns A Promise that resolves to 'true' when navigation succeeds,
|
---|
776 | * to 'false' when navigation fails, or is rejected on error.
|
---|
777 | *
|
---|
778 | * @usageNotes
|
---|
779 | *
|
---|
780 | * The following calls request navigation to an absolute path.
|
---|
781 | *
|
---|
782 | * ```
|
---|
783 | * router.navigateByUrl("/team/33/user/11");
|
---|
784 | *
|
---|
785 | * // Navigate without updating the URL
|
---|
786 | * router.navigateByUrl("/team/33/user/11", { skipLocationChange: true });
|
---|
787 | * ```
|
---|
788 | *
|
---|
789 | * @see [Routing and Navigation guide](guide/router)
|
---|
790 | *
|
---|
791 | */
|
---|
792 | navigateByUrl(url, extras = {
|
---|
793 | skipLocationChange: false
|
---|
794 | }) {
|
---|
795 | if (typeof ngDevMode === 'undefined' ||
|
---|
796 | ngDevMode && this.isNgZoneEnabled && !NgZone.isInAngularZone()) {
|
---|
797 | this.console.warn(`Navigation triggered outside Angular zone, did you forget to call 'ngZone.run()'?`);
|
---|
798 | }
|
---|
799 | const urlTree = isUrlTree(url) ? url : this.parseUrl(url);
|
---|
800 | const mergedTree = this.urlHandlingStrategy.merge(urlTree, this.rawUrlTree);
|
---|
801 | return this.scheduleNavigation(mergedTree, 'imperative', null, extras);
|
---|
802 | }
|
---|
803 | /**
|
---|
804 | * Navigate based on the provided array of commands and a starting point.
|
---|
805 | * If no starting route is provided, the navigation is absolute.
|
---|
806 | *
|
---|
807 | * @param commands An array of URL fragments with which to construct the target URL.
|
---|
808 | * If the path is static, can be the literal URL string. For a dynamic path, pass an array of path
|
---|
809 | * segments, followed by the parameters for each segment.
|
---|
810 | * The fragments are applied to the current URL or the one provided in the `relativeTo` property
|
---|
811 | * of the options object, if supplied.
|
---|
812 | * @param extras An options object that determines how the URL should be constructed or
|
---|
813 | * interpreted.
|
---|
814 | *
|
---|
815 | * @returns A Promise that resolves to `true` when navigation succeeds, to `false` when navigation
|
---|
816 | * fails,
|
---|
817 | * or is rejected on error.
|
---|
818 | *
|
---|
819 | * @usageNotes
|
---|
820 | *
|
---|
821 | * The following calls request navigation to a dynamic route path relative to the current URL.
|
---|
822 | *
|
---|
823 | * ```
|
---|
824 | * router.navigate(['team', 33, 'user', 11], {relativeTo: route});
|
---|
825 | *
|
---|
826 | * // Navigate without updating the URL, overriding the default behavior
|
---|
827 | * router.navigate(['team', 33, 'user', 11], {relativeTo: route, skipLocationChange: true});
|
---|
828 | * ```
|
---|
829 | *
|
---|
830 | * @see [Routing and Navigation guide](guide/router)
|
---|
831 | *
|
---|
832 | */
|
---|
833 | navigate(commands, extras = { skipLocationChange: false }) {
|
---|
834 | validateCommands(commands);
|
---|
835 | return this.navigateByUrl(this.createUrlTree(commands, extras), extras);
|
---|
836 | }
|
---|
837 | /** Serializes a `UrlTree` into a string */
|
---|
838 | serializeUrl(url) {
|
---|
839 | return this.urlSerializer.serialize(url);
|
---|
840 | }
|
---|
841 | /** Parses a string into a `UrlTree` */
|
---|
842 | parseUrl(url) {
|
---|
843 | let urlTree;
|
---|
844 | try {
|
---|
845 | urlTree = this.urlSerializer.parse(url);
|
---|
846 | }
|
---|
847 | catch (e) {
|
---|
848 | urlTree = this.malformedUriErrorHandler(e, this.urlSerializer, url);
|
---|
849 | }
|
---|
850 | return urlTree;
|
---|
851 | }
|
---|
852 | isActive(url, matchOptions) {
|
---|
853 | let options;
|
---|
854 | if (matchOptions === true) {
|
---|
855 | options = Object.assign({}, exactMatchOptions);
|
---|
856 | }
|
---|
857 | else if (matchOptions === false) {
|
---|
858 | options = Object.assign({}, subsetMatchOptions);
|
---|
859 | }
|
---|
860 | else {
|
---|
861 | options = matchOptions;
|
---|
862 | }
|
---|
863 | if (isUrlTree(url)) {
|
---|
864 | return containsTree(this.currentUrlTree, url, options);
|
---|
865 | }
|
---|
866 | const urlTree = this.parseUrl(url);
|
---|
867 | return containsTree(this.currentUrlTree, urlTree, options);
|
---|
868 | }
|
---|
869 | removeEmptyProps(params) {
|
---|
870 | return Object.keys(params).reduce((result, key) => {
|
---|
871 | const value = params[key];
|
---|
872 | if (value !== null && value !== undefined) {
|
---|
873 | result[key] = value;
|
---|
874 | }
|
---|
875 | return result;
|
---|
876 | }, {});
|
---|
877 | }
|
---|
878 | processNavigations() {
|
---|
879 | this.navigations.subscribe(t => {
|
---|
880 | this.navigated = true;
|
---|
881 | this.lastSuccessfulId = t.id;
|
---|
882 | this.currentPageId = t.targetPageId;
|
---|
883 | this.events
|
---|
884 | .next(new NavigationEnd(t.id, this.serializeUrl(t.extractedUrl), this.serializeUrl(this.currentUrlTree)));
|
---|
885 | this.lastSuccessfulNavigation = this.currentNavigation;
|
---|
886 | t.resolve(true);
|
---|
887 | }, e => {
|
---|
888 | this.console.warn(`Unhandled Navigation Error: ${e}`);
|
---|
889 | });
|
---|
890 | }
|
---|
891 | scheduleNavigation(rawUrl, source, restoredState, extras, priorPromise) {
|
---|
892 | var _a, _b;
|
---|
893 | if (this.disposed) {
|
---|
894 | return Promise.resolve(false);
|
---|
895 | }
|
---|
896 | // * Imperative navigations (router.navigate) might trigger additional navigations to the same
|
---|
897 | // URL via a popstate event and the locationChangeListener. We should skip these duplicate
|
---|
898 | // navs. Duplicates may also be triggered by attempts to sync AngularJS and Angular router
|
---|
899 | // states.
|
---|
900 | // * Imperative navigations can be cancelled by router guards, meaning the URL won't change. If
|
---|
901 | // the user follows that with a navigation using the back/forward button or manual URL change,
|
---|
902 | // the destination may be the same as the previous imperative attempt. We should not skip
|
---|
903 | // these navigations because it's a separate case from the one above -- it's not a duplicate
|
---|
904 | // navigation.
|
---|
905 | const lastNavigation = this.getTransition();
|
---|
906 | // We don't want to skip duplicate successful navs if they're imperative because
|
---|
907 | // onSameUrlNavigation could be 'reload' (so the duplicate is intended).
|
---|
908 | const browserNavPrecededByRouterNav = isBrowserTriggeredNavigation(source) && lastNavigation &&
|
---|
909 | !isBrowserTriggeredNavigation(lastNavigation.source);
|
---|
910 | const lastNavigationSucceeded = this.lastSuccessfulId === lastNavigation.id;
|
---|
911 | // If the last navigation succeeded or is in flight, we can use the rawUrl as the comparison.
|
---|
912 | // However, if it failed, we should compare to the final result (urlAfterRedirects).
|
---|
913 | const lastNavigationUrl = (lastNavigationSucceeded || this.currentNavigation) ?
|
---|
914 | lastNavigation.rawUrl :
|
---|
915 | lastNavigation.urlAfterRedirects;
|
---|
916 | const duplicateNav = lastNavigationUrl.toString() === rawUrl.toString();
|
---|
917 | if (browserNavPrecededByRouterNav && duplicateNav) {
|
---|
918 | return Promise.resolve(true); // return value is not used
|
---|
919 | }
|
---|
920 | let resolve;
|
---|
921 | let reject;
|
---|
922 | let promise;
|
---|
923 | if (priorPromise) {
|
---|
924 | resolve = priorPromise.resolve;
|
---|
925 | reject = priorPromise.reject;
|
---|
926 | promise = priorPromise.promise;
|
---|
927 | }
|
---|
928 | else {
|
---|
929 | promise = new Promise((res, rej) => {
|
---|
930 | resolve = res;
|
---|
931 | reject = rej;
|
---|
932 | });
|
---|
933 | }
|
---|
934 | const id = ++this.navigationId;
|
---|
935 | let targetPageId;
|
---|
936 | if (this.canceledNavigationResolution === 'computed') {
|
---|
937 | const isInitialPage = this.currentPageId === 0;
|
---|
938 | if (isInitialPage) {
|
---|
939 | restoredState = this.location.getState();
|
---|
940 | }
|
---|
941 | // If the `ɵrouterPageId` exist in the state then `targetpageId` should have the value of
|
---|
942 | // `ɵrouterPageId`. This is the case for something like a page refresh where we assign the
|
---|
943 | // target id to the previously set value for that page.
|
---|
944 | if (restoredState && restoredState.ɵrouterPageId) {
|
---|
945 | targetPageId = restoredState.ɵrouterPageId;
|
---|
946 | }
|
---|
947 | else {
|
---|
948 | // If we're replacing the URL or doing a silent navigation, we do not want to increment the
|
---|
949 | // page id because we aren't pushing a new entry to history.
|
---|
950 | if (extras.replaceUrl || extras.skipLocationChange) {
|
---|
951 | targetPageId = (_a = this.browserPageId) !== null && _a !== void 0 ? _a : 0;
|
---|
952 | }
|
---|
953 | else {
|
---|
954 | targetPageId = ((_b = this.browserPageId) !== null && _b !== void 0 ? _b : 0) + 1;
|
---|
955 | }
|
---|
956 | }
|
---|
957 | }
|
---|
958 | else {
|
---|
959 | // This is unused when `canceledNavigationResolution` is not computed.
|
---|
960 | targetPageId = 0;
|
---|
961 | }
|
---|
962 | this.setTransition({
|
---|
963 | id,
|
---|
964 | targetPageId,
|
---|
965 | source,
|
---|
966 | restoredState,
|
---|
967 | currentUrlTree: this.currentUrlTree,
|
---|
968 | currentRawUrl: this.rawUrlTree,
|
---|
969 | rawUrl,
|
---|
970 | extras,
|
---|
971 | resolve,
|
---|
972 | reject,
|
---|
973 | promise,
|
---|
974 | currentSnapshot: this.routerState.snapshot,
|
---|
975 | currentRouterState: this.routerState
|
---|
976 | });
|
---|
977 | // Make sure that the error is propagated even though `processNavigations` catch
|
---|
978 | // handler does not rethrow
|
---|
979 | return promise.catch((e) => {
|
---|
980 | return Promise.reject(e);
|
---|
981 | });
|
---|
982 | }
|
---|
983 | setBrowserUrl(url, t) {
|
---|
984 | const path = this.urlSerializer.serialize(url);
|
---|
985 | const state = Object.assign(Object.assign({}, t.extras.state), this.generateNgRouterState(t.id, t.targetPageId));
|
---|
986 | if (this.location.isCurrentPathEqualTo(path) || !!t.extras.replaceUrl) {
|
---|
987 | this.location.replaceState(path, '', state);
|
---|
988 | }
|
---|
989 | else {
|
---|
990 | this.location.go(path, '', state);
|
---|
991 | }
|
---|
992 | }
|
---|
993 | /**
|
---|
994 | * Performs the necessary rollback action to restore the browser URL to the
|
---|
995 | * state before the transition.
|
---|
996 | */
|
---|
997 | restoreHistory(t, restoringFromCaughtError = false) {
|
---|
998 | var _a, _b;
|
---|
999 | if (this.canceledNavigationResolution === 'computed') {
|
---|
1000 | const targetPagePosition = this.currentPageId - t.targetPageId;
|
---|
1001 | // The navigator change the location before triggered the browser event,
|
---|
1002 | // so we need to go back to the current url if the navigation is canceled.
|
---|
1003 | // Also, when navigation gets cancelled while using url update strategy eager, then we need to
|
---|
1004 | // go back. Because, when `urlUpdateSrategy` is `eager`; `setBrowserUrl` method is called
|
---|
1005 | // before any verification.
|
---|
1006 | const browserUrlUpdateOccurred = (t.source === 'popstate' || this.urlUpdateStrategy === 'eager' ||
|
---|
1007 | this.currentUrlTree === ((_a = this.currentNavigation) === null || _a === void 0 ? void 0 : _a.finalUrl));
|
---|
1008 | if (browserUrlUpdateOccurred && targetPagePosition !== 0) {
|
---|
1009 | this.location.historyGo(targetPagePosition);
|
---|
1010 | }
|
---|
1011 | else if (this.currentUrlTree === ((_b = this.currentNavigation) === null || _b === void 0 ? void 0 : _b.finalUrl) && targetPagePosition === 0) {
|
---|
1012 | // We got to the activation stage (where currentUrlTree is set to the navigation's
|
---|
1013 | // finalUrl), but we weren't moving anywhere in history (skipLocationChange or replaceUrl).
|
---|
1014 | // We still need to reset the router state back to what it was when the navigation started.
|
---|
1015 | this.resetState(t);
|
---|
1016 | // TODO(atscott): resetting the `browserUrlTree` should really be done in `resetState`.
|
---|
1017 | // Investigate if this can be done by running TGP.
|
---|
1018 | this.browserUrlTree = t.currentUrlTree;
|
---|
1019 | this.resetUrlToCurrentUrlTree();
|
---|
1020 | }
|
---|
1021 | else {
|
---|
1022 | // The browser URL and router state was not updated before the navigation cancelled so
|
---|
1023 | // there's no restoration needed.
|
---|
1024 | }
|
---|
1025 | }
|
---|
1026 | else if (this.canceledNavigationResolution === 'replace') {
|
---|
1027 | // TODO(atscott): It seems like we should _always_ reset the state here. It would be a no-op
|
---|
1028 | // for `deferred` navigations that haven't change the internal state yet because guards
|
---|
1029 | // reject. For 'eager' navigations, it seems like we also really should reset the state
|
---|
1030 | // because the navigation was cancelled. Investigate if this can be done by running TGP.
|
---|
1031 | if (restoringFromCaughtError) {
|
---|
1032 | this.resetState(t);
|
---|
1033 | }
|
---|
1034 | this.resetUrlToCurrentUrlTree();
|
---|
1035 | }
|
---|
1036 | }
|
---|
1037 | resetState(t) {
|
---|
1038 | this.routerState = t.currentRouterState;
|
---|
1039 | this.currentUrlTree = t.currentUrlTree;
|
---|
1040 | this.rawUrlTree = this.urlHandlingStrategy.merge(this.currentUrlTree, t.rawUrl);
|
---|
1041 | }
|
---|
1042 | resetUrlToCurrentUrlTree() {
|
---|
1043 | this.location.replaceState(this.urlSerializer.serialize(this.rawUrlTree), '', this.generateNgRouterState(this.lastSuccessfulId, this.currentPageId));
|
---|
1044 | }
|
---|
1045 | cancelNavigationTransition(t, reason) {
|
---|
1046 | const navCancel = new NavigationCancel(t.id, this.serializeUrl(t.extractedUrl), reason);
|
---|
1047 | this.triggerEvent(navCancel);
|
---|
1048 | t.resolve(false);
|
---|
1049 | }
|
---|
1050 | generateNgRouterState(navigationId, routerPageId) {
|
---|
1051 | if (this.canceledNavigationResolution === 'computed') {
|
---|
1052 | return { navigationId, ɵrouterPageId: routerPageId };
|
---|
1053 | }
|
---|
1054 | return { navigationId };
|
---|
1055 | }
|
---|
1056 | }
|
---|
1057 | Router.decorators = [
|
---|
1058 | { type: Injectable }
|
---|
1059 | ];
|
---|
1060 | Router.ctorParameters = () => [
|
---|
1061 | { type: Type },
|
---|
1062 | { type: UrlSerializer },
|
---|
1063 | { type: ChildrenOutletContexts },
|
---|
1064 | { type: Location },
|
---|
1065 | { type: Injector },
|
---|
1066 | { type: NgModuleFactoryLoader },
|
---|
1067 | { type: Compiler },
|
---|
1068 | { type: undefined }
|
---|
1069 | ];
|
---|
1070 | function validateCommands(commands) {
|
---|
1071 | for (let i = 0; i < commands.length; i++) {
|
---|
1072 | const cmd = commands[i];
|
---|
1073 | if (cmd == null) {
|
---|
1074 | throw new Error(`The requested path contains ${cmd} segment at index ${i}`);
|
---|
1075 | }
|
---|
1076 | }
|
---|
1077 | }
|
---|
1078 | function isBrowserTriggeredNavigation(source) {
|
---|
1079 | return source !== 'imperative';
|
---|
1080 | }
|
---|
1081 | //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicm91dGVyLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vLi4vcGFja2FnZXMvcm91dGVyL3NyYy9yb3V0ZXIudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUE7Ozs7OztHQU1HO0FBRUgsT0FBTyxFQUFDLFFBQVEsRUFBZ0IsTUFBTSxpQkFBaUIsQ0FBQztBQUN4RCxPQUFPLEVBQUMsUUFBUSxFQUFFLFVBQVUsRUFBRSxRQUFRLEVBQUUscUJBQXFCLEVBQUUsV0FBVyxFQUFFLE1BQU0sRUFBRS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HNlO1xuICAgICAgICAgICAgICAgICBsZXQgZXJyb3JlZCA9IGZhbHNlO1xuICAgICAgICAgICAgICAgICByZXR1cm4gb2YodCkucGlwZShcbiAgICAgICAgICAgICAgICAgICAgIC8vIFN0b3JlIHRoZSBOYXZpZ2F0aW9uIG9iamVjdFxuICAgICAgICAgICAgICAgICAgICAgdGFwKHQgPT4ge1xuICAgICAgICAgICAgICAgICAgICAgICB0aGlzLmN1cnJlbnROYXZpZ2F0aW9uID0ge1xuICAgICAgICAgICAgICAgICAgICAgICAgIGlkOiB0LmlkLFxuICAgICAgICAgICAgICAgICAgICAgICAgIGluaXRpYWxVcmw6IHQuY3VycmVudFJhd1VybCxcbiAgICAgICAgICAgICAgICAgICAgICAgICBleHRyYWN0ZWRVcmw6IHQuZXh0cmFjdGVkVXJsLFxuICAgICAgICAgICAgICAgICAgICAgICAgIHRyaWdnZXI6IHQuc291cmNlLFxuICAgICAgICAgICAgICAgICAgICAgICAgIGV4dHJhczogdC5leHRyYXMsXG4gICAgICAgICAgICAgICAgICAgICAgICAgcHJldmlvdXNOYXZpZ2F0aW9uOiB0aGlzLmxhc3RTdWNjZXNzZnVsTmF2aWdhdGlvbiA/XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsuLi50aGlzLmxhc3RTdWNjZXNzZnVsTmF2aWdhdGlvbiwgcHJldmlvdXNOYXZpZ2F0aW9uOiBudWxsfSA6XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGxcbiAgICAgICAgICAgICAgICAgICAgICAgfTtcbiAgICAgICAgICAgICAgICAgICAgIH0pLFxuICAgICAgICAgICAgICAgICAgICAgc3dpdGNoTWFwKHQgPT4ge1xuICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBicm93c2VyVXJsVHJlZSA9IHRoaXMuYnJvd3NlclVybFRyZWUudG9TdHJpbmcoKTtcbiAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgdXJsVHJhbnNpdGlvbiA9ICF0aGlzLm5hdmlnYXRlZCB8fFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgdC5leHRyYWN0ZWRVcmwudG9TdHJpbmcoKSAhPT0gYnJvd3NlclVybFRyZWUgfHxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vIE5hdmlnYXRpb25zIHdoaWNoIHN1Y2NlZWQgb3Igb25lcyB3aGljaCBmYWlsIGFuZCBhcmUgY2xlYW5lZCB1cFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8gY29ycmVjdGx5IHNob3VsZCByZXN1bHQgaW4gYGJyb3dzZXJVcmxUcmVlYCBhbmQgYGN1cnJlbnRVcmxUcmVlYFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8gbWF0Y2hpbmcuIElmIHRoaXMgaXMgbm90IHRoZSBjYXNlLCBhc3N1bWUgc29tZXRoaW5nIHdlbnQgd3JvbmcgYW5kIHRyeVxuICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8gcHJvY2Vzc2luZyB0aGUgVVJMIGFnYWluLlxuICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJvd3NlclVybFRyZWUgIT09IHRoaXMuY3VycmVudFVybFRyZWUudG9TdHJpbmcoKTtcbiAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgcHJvY2Vzc0N1cnJlbnRVcmwgPVxuICAgICAgICAgICAgICAgICAgICAgICAgICAgKHRoaXMub25TYW1lVXJsTmF2aWdhdGlvbiA9PT0gJ3JlbG9hZCcgPyB0cnVlIDogdXJsVHJhbnNpdGlvbikgJiZcbiAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMudXJsSGFuZGxpbmdTdHJhdGVneS5zaG91bGRQcm9jZXNzVXJsKHQucmF3VXJsKTtcblxuXG4gICAgICAgICAgICAgICAgICAgICAgIGlmIChwcm9jZXNzQ3VycmVudFVybCkge1xuICAgICAgICAgICAgICAgICAgICAgICAgIC8vIElmIHRoZSBzb3VyY2Ugb2YgdGhlIG5hdmlnYXRpb24gaXMgZnJvbSBhIGJyb3dzZXIgZXZlbnQsIHRoZSBVUkwgaXNcbiAgICAgICAgICAgICAgICAgICAgICAgICAvLyBhbHJlYWR5IHVwZGF0ZWQuIFdlIGFscmVhZHkgbmVlZCB0byBzeW5jIHRoZSBpbnRlcm5hbCBzdGF0ZS5cbiAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoaXNCcm93c2VyVHJpZ2dlcmVkTmF2aWdhdGlvbih0LnNvdXJjZSkpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuYnJvd3NlclVybFRyZWUgPSB0LmV4dHJhY3RlZFVybDtcbiAgICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG9mKHQpLnBpcGUoXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vIEZpcmUgTmF2aWdhdGlvblN0YXJ0IGV2ZW50XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN3aXRjaE1hcCh0ID0+IHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCB0cmFuc2l0aW9uID0gdGhpcy50cmFuc2l0aW9ucy5nZXRWYWx1ZSgpO1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGV2ZW50c1N1YmplY3QubmV4dChuZXcgTmF2aWdhdGlvblN0YXJ0KFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0LmlkLCB0aGlzLnNlcmlhbGl6ZVVybCh0LmV4dHJhY3RlZFVybCksIHQuc291cmNlLFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0LnJlc3RvcmVkU3RhdGUpKTtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAodHJhbnNpdGlvbiAhPT0gdGhpcy50cmFuc2l0aW9ucy5nZXRWYWx1ZSgpKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gRU1QVFk7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8gVGhpcyBkZWxheSBpcyByZXF1aXJlZCB0byBtYXRjaCBvbGQgYmVoYXZpb3IgdGhhdCBmb3JjZWRcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyBuYXZpZ2F0aW9uIHRvIGFsd2F5cyBiZSBhc3luY1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBQcm9taXNlLnJlc29sdmUodCk7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLFxuXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vIEFwcGx5UmVkaXJlY3RzXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFwcGx5UmVkaXJlY3RzKFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5uZ01vZHVsZS5pbmplY3RvciwgdGhpcy5jb25maWdMb2FkZXIsIHRoaXMudXJsU2VyaWFsaXplcixcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuY29uZmlnKSxcblxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyBVcGRhdGUgdGhlIGN1cnJlbnROYXZpZ2F0aW9uXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRhcCh0ID0+IHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLmN1cnJlbnROYXZpZ2F0aW9uID0ge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLi4udGhpcy5jdXJyZW50TmF2aWdhdGlvbiEsXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmaW5hbFVybDogdC51cmxBZnRlclJlZGlyZWN0c1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLFxuXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vIFJlY29nbml6ZVxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZWNvZ25pemUoXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLnJvb3RDb21wb25lbnRUeXBlLCB0aGlzLmNvbmZpZyxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICh1cmwpID0+IHRoaXMuc2VyaWFsaXplVXJsKHVybCksIHRoaXMucGFyYW1zSW5oZXJpdGFuY2VTdHJhdGVneSxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMucmVsYXRpdmVMaW5rUmVzb2x1dGlvbiksXG5cbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8gVXBkYXRlIFVSTCBpZiBpbiBgZWFnZXJgIHVwZGF0ZSBtb2RlXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRhcCh0ID0+IHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAodGhpcy51cmxVcGRhdGVTdHJhdGVneSA9PT0gJ2VhZ2VyJykge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCF0LmV4dHJhcy5za2lwTG9jYXRpb25DaGFuZ2UpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5zZXRCcm93c2VyVXJsKHQudXJsQWZ0ZXJSZWRpcmVjdHMsIHQpO1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyBUT0RPKGF0c2NvdHQpOiBUaGUgYWJvdmUgbGluZSBpcyBpbmNvcnJlY3QuIEl0IHNldHMgdGhlIHVybCB0b1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyBvbmx5IHRoZSBwYXJ0IHRoYXQgaXMgaGFuZGxlZCBieSB0aGUgcm91dGVyLiBJdCBzaG91bGQgbWVyZ2VcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8gdGhhdCB3aXRoIHRoZSByYXdVcmwgc28gdGhlIHVybCBpbmNsdWRlcyBzZWdtZW50cyBub3QgaGFuZGxlZFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyBieSB0aGUgcm91dGVyOlxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyAgY29uc3QgcmF3VXJsID0gdGhpcy51cmxIYW5kbGluZ1N0cmF0ZWd5Lm1lcmdlKFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyAgICAgIHQudXJsQWZ0ZXJSZWRpcmVjdHMsIHQucmF3VXJsKTtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8gIHRoaXMuc2V0QnJvd3NlclVybChyYXdVcmwsIHQpO1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5icm93c2VyVXJsVHJlZSA9IHQudXJsQWZ0ZXJSZWRpcmVjdHM7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8gRmlyZSBSb3V0ZXNSZWNvZ25pemVkXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3Qgcm91dGVzUmVjb2duaXplZCA9IG5ldyBSb3V0ZXNSZWNvZ25pemVkKFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0LmlkLCB0aGlzLnNlcmlhbGl6ZVVybCh0LmV4dHJhY3RlZFVybCksXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuc2VyaWFsaXplVXJsKHQudXJsQWZ0ZXJSZWRpcmVjdHMpLCB0LnRhcmdldFNuYXBzaG90ISk7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZXZlbnRzU3ViamVjdC5uZXh0KHJvdXRlc1JlY29nbml6ZWQpO1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSk7XG4gICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgcHJvY2Vzc1ByZXZpb3VzVXJsID0gdXJsVHJhbnNpdGlvbiAmJiB0aGlzLnJhd1VybFRyZWUgJiZcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy51cmxIYW5kbGluZ1N0cmF0ZWd5LnNob3VsZFByb2Nlc3NVcmwodGhpcy5yYXdVcmxUcmVlKTtcbiAgICAgICAgICAgICAgICAgICAgICAgICAvKiBXaGVuIHRoZSBjdXJyZW50IFVSTCBzaG91bGRuJ3QgYmUgcHJvY2Vzc2VkLCBidXQgdGhlIHByZXZpb3VzIG9uZSB3YXMsXG4gICAgICAgICAgICAgICAgICAgICAgICAgICogd2UgaGFuZGxlIHRoaXMgXCJlcnJvciBjb25kaXRpb25cIiBieSBuYXZpZ2F0aW5nIHRvIHRoZSBwcmV2aW91c2x5XG4gICAgICAgICAgICAgICAgICAgICAgICAgICogc3VjY2Vzc2Z1bCBVUkwsIGJ1dCBsZWF2aW5nIHRoZSBVUkwgaW50YWN0LiovXG4gICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHByb2Nlc3NQcmV2aW91c1VybCkge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3Qge2lkLCBleHRyYWN0ZWRVcmwsIHNvdXJjZSwgcmVzdG9yZWRTdGF0ZSwgZXh0cmFzfSA9IHQ7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBuYXZTdGFydCA9IG5ldyBOYXZpZ2F0aW9uU3RhcnQoXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWQsIHRoaXMuc2VyaWFsaXplVXJsKGV4dHJhY3RlZFVybCksIHNvdXJjZSwgcmVzdG9yZWRTdGF0ZSk7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICBldmVudHNTdWJqZWN0Lm5leHQobmF2U3RhcnQpO1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgdGFyZ2V0U25hcHNob3QgPVxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNyZWF0ZUVtcHR5U3RhdGUoZXh0cmFjdGVkVXJsLCB0aGlzLnJvb3RDb21wb25lbnRUeXBlKS5zbmFwc2hvdDtcblxuICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG9mKHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLi4udCxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGFyZ2V0U25hcHNob3QsXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVybEFmdGVyUmVkaXJlY3RzOiBleHRyYWN0ZWRVcmwsXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgIGV4dHJhczogey4uLmV4dHJhcywgc2tpcExvY2F0aW9uQ2hhbmdlOiBmYWxzZSwgcmVwbGFjZVVybDogZmFsc2V9LFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7XG4gICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgIC8qIFdoZW4gbmVpdGhlciB0aGUgY3VycmVudCBvciBwcmV2aW91cyBVUkwgY2FuIGJlIHByb2Nlc3NlZCwgZG8gbm90aGluZ1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICogb3RoZXIgdGhhbiB1cGRhdGUgcm91dGVyJ3MgaW50ZXJuYWwgcmVmZXJlbmNlIHRvIHRoZSBjdXJyZW50IFwic2V0dGxlZFwiXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgKiBVUkwuIFRoaXMgd2F5IHRoZSBuZXh0IG5hdmlnYXRpb24gd2lsbCBiZSBjb21pbmcgZnJvbSB0aGUgY3VycmVudCBVUkxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAqIGluIHRoZSBicm93c2VyLlxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICovXG4gICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLnJhd1VybFRyZWUgPSB0LnJhd1VybDtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuYnJvd3NlclVybFRyZWUgPSB0LnVybEFmdGVyUmVkaXJlY3RzO1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgdC5yZXNvbHZlKG51bGwpO1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEVNUFRZO1xuICAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICAgfSksXG5cbiAgICAgICAgICAgICAgICAgICAgIC8vIEJlZm9yZSBQcmVhY3RpdmF0aW9uXG4gICAgICAgICAgICAgICAgICAgICBzd2l0Y2hUYXAodCA9PiB7XG4gICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IHtcbiAgICAgICAgICAgICAgICAgICAgICAgICB0YXJnZXRTbmFwc2hvdCxcbiAgICAgICAgICAgICAgICAgICAgICAgICBpZDogbmF2aWdhdGlvbklkLFxuICAgICAgICAgICAgICAgICAgICAgICAgIGV4dHJhY3RlZFVybDogYXBwbGllZFVybFRyZWUsXG4gICAgICAgICAgICAgICAgICAgICAgICAgcmF3VXJsOiByYXdVcmxUcmVlLFxuICAgICAgICAgICAgICAgICAgICAgICAgIGV4dHJhczoge3NraXBMb2NhdGlvbkNoYW5nZSwgcmVwbGFjZVVybH1cbiAgICAgICAgICAgICAgICAgICAgICAgfSA9IHQ7XG4gICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLmhvb2tzLmJlZm9yZVByZWFjdGl2YXRpb24odGFyZ2V0U25hcHNob3QhLCB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgbmF2aWdhdGlvbklkLFxuICAgICAgICAgICAgICAgICAgICAgICAgIGFwcGxpZWRVcmxUcmVlLFxuICAgICAgICAgICAgICAgICAgICAgICAgIHJhd1VybFRyZWUsXG4gICAgICAgICAgICAgICAgICAgICAgICAgc2tpcExvY2F0aW9uQ2hhbmdlOiAhIXNraXBMb2NhdGlvbkNoYW5nZSxcbiAgICAgICAgICAgICAgICAgICAgICAgICByZXBsYWNlVXJsOiAhIXJlcGxhY2VVcmwsXG4gICAgICAgICAgICAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgICAgICAgICAgfSksXG5cbiAgICAgICAgICAgICAgICAgICAgIC8vIC0tLSBHVUFSRFMgLS0tXG4gICAgICAgICAgICAgICAgICAgICB0YXAodCA9PiB7XG4gICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IGd1YXJkc1N0YXJ0ID0gbmV3IEd1YXJkc0NoZWNrU3RhcnQoXG4gICAgICAgICAgICAgICAgICAgICAgICAgICB0LmlkLCB0aGlzLnNlcmlhbGl6ZVVybCh0LmV4dHJhY3RlZFVybCksXG4gICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLnNlcmlhbGl6ZVVybCh0LnVybEFmdGVyUmVkaXJlY3RzKSwgdC50YXJnZXRTbmFwc2hvdCEpO1xuICAgICAgICAgICAgICAgICAgICAgICB0aGlzLnRyaWdnZXJFdmVudChndWFyZHNTdGFydCk7XG4gICAgICAgICAgICAgICAgICAgICB9KSxcblxuICAgICAgICAgICAgICAgICAgICAgbWFwKHQgPT4gKHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgIC4uLnQsXG4gICAgICAgICAgICAgICAgICAgICAgICAgICBndWFyZHM6IGdldEFsbFJvdXRlR3VhcmRzKFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQudGFyZ2V0U25hcHNob3QhLCB0LmN1cnJlbnRTbmFwc2hvdCwgdGhpcy5yb290Q29udGV4dHMpXG4gICAgICAgICAgICAgICAgICAgICAgICAgfSkpLFxuXG4gICAgICAgICAgICAgICAgICAgICBjaGVja0d1YXJkcyh0aGlzLm5nTW9kdWxlLmluamVjdG9yLCAoZXZ0OiBFdmVudCkgPT4gdGhpcy50cmlnZ2VyRXZlbnQoZXZ0KSksXG4gICAgICAgICAgICAgICAgICAgICB0YXAodCA9PiB7XG4gICAgICAgICAgICAgICAgICAgICAgIGlmIChpc1VybFRyZWUodC5ndWFyZHNSZXN1bHQpKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgZXJyb3I6IEVycm9yJnt1cmw/OiBVcmxUcmVlfSA9IG5hdmlnYXRpb25DYW5jZWxpbmdFcnJvcihcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYFJlZGlyZWN0aW5nIHRvIFwiJHt0aGlzLnNlcmlhbGl6ZVVybCh0Lmd1YXJkc1Jlc3VsdCl9XCJgKTtcbiAgICAgICAgICAgICAgICAgICAgICAgICBlcnJvci51cmwgPSB0Lmd1YXJkc1Jlc3VsdDtcbiAgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBlcnJvcjtcbiAgICAgICAgICAgICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IGd1YXJkc0VuZCA9IG5ldyBHdWFyZHNDaGVja0VuZChcbiAgICAgICAgICAgICAgICAgICAgICAgICAgIHQuaWQsIHRoaXMuc2VyaWFsaXplVXJsKHQuZXh0cmFjdGVkVXJsKSxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuc2VyaWFsaXplVXJsKHQudXJsQWZ0ZXJSZWRpcmVjdHMpLCB0LnRhcmdldFNuYXBzaG90ISxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICEhdC5ndWFyZHNSZXN1bHQpO1xuICAgICAgICAgICAgICAgICAgICAgICB0aGlzLnRyaWdnZXJFdmVudChndWFyZHNFbmQpO1xuICAgICAgICAgICAgICAgICAgICAgfSksXG5cbiAgICAgICAgICAgICAgICAgICAgIGZpbHRlcih0ID0+IHtcbiAgICAgICAgICAgICAgICAgICAgICAgaWYgKCF0Lmd1YXJkc1Jlc3VsdCkge1xuICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMucmVzdG9yZUhpc3RvcnkodCk7XG4gICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5jYW5jZWxOYXZpZ2F0aW9uVHJhbnNpdGlvbih0LCAnJyk7XG4gICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZhbHNlO1xuICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0cnVlO1xuICAgICAgICAgICAgICAgICAgICAgfSksXG5cbiAgICAgICAgICAgICAgICAgICAgIC8vIC0tLSBSRVNPTFZFIC0tLVxuICAgICAgICAgICAgICAgICAgICAgc3dpdGNoVGFwKHQgPT4ge1xuICAgICAgICAgICAgICAgICAgICAgICBpZiAodC5ndWFyZHMuY2FuQWN0aXZhdGVDaGVja3MubGVuZ3RoKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG9mKHQpLnBpcGUoXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRhcCh0ID0+IHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCByZXNvbHZlU3RhcnQgPSBuZXcgUmVzb2x2ZVN0YXJ0KFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0LmlkLCB0aGlzLnNlcmlhbGl6ZVVybCh0LmV4dHJhY3RlZFVybCksXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuc2VyaWFsaXplVXJsKHQudXJsQWZ0ZXJSZWRpcmVjdHMpLCB0LnRhcmdldFNuYXBzaG90ISk7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy50cmlnZ2VyRXZlbnQocmVzb2x2ZVN0YXJ0KTtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSksXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN3aXRjaE1hcCh0ID0+IHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsZXQgZGF0YVJlc29sdmVkID0gZmFsc2U7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG9mKHQpLnBpcGUoXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlc29sdmVEYXRhKFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5wYXJhbXNJbmhlcml0YW5jZVN0cmF0ZWd5LCB0aGlzLm5nTW9kdWxlLmluamVjdG9yKSxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGFwKHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuZXh0OiAoKSA9PiBkYXRhUmVzb2x2ZWQgPSB0cnVlLFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbXBsZXRlOiAoKSA9PiB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIWRhdGFSZXNvbHZlZCkge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLnJlc3RvcmVIaXN0b3J5KHQpO1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLmNhbmNlbE5hdmlnYXRpb25UcmFuc2l0aW9uKFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdCxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGBBdCBsZWFzdCBvbmUgcm91dGUgcmVzb2x2ZXIgZGlkbid0IGVtaXQgYW55IHZhbHVlLmApO1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSksXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKTtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSksXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRhcCh0ID0+IHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCByZXNvbHZlRW5kID0gbmV3IFJlc29sdmVFbmQoXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQuaWQsIHRoaXMuc2VyaWFsaXplVXJsKHQuZXh0cmFjdGVkVXJsKSxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5zZXJpYWxpemVVcmwodC51cmxBZnRlclJlZGlyZWN0cyksIHQudGFyZ2V0U25hcHNob3QhKTtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLnRyaWdnZXJFdmVudChyZXNvbHZlRW5kKTtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSkpO1xuICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB1bmRlZmluZWQ7XG4gICAgICAgICAgICAgICAgICAgICB9KSxcblxuICAgICAgICAgICAgICAgICAgICAgLy8gLS0tIEFGVEVSIFBSRUFDVElWQVRJT04gLS0tXG4gICAgICAgICAgICAgICAgICAgICBzd2l0Y2hUYXAoKHQ6IE5hdmlnYXRpb25UcmFuc2l0aW9uKSA9PiB7XG4gICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IHtcbiAgICAgICAgICAgICAgICAgICAgICAgICB0YXJnZXRTbmFwc2hvdCxcbiAgICAgICAgICAgICAgICAgICAgICAgICBpZDogbmF2aWdhdGlvbklkLFxuICAgICAgICAgICAgICAgICAgICAgICAgIGV4dHJhY3RlZFVybDogYXBwbGllZFVybFRyZWUsXG4gICAgICAgICAgICAgICAgICAgICAgICAgcmF3VXJsOiByYXdVcmxUcmVlLFxuICAgICAgICAgICAgICAgICAgICAgICAgIGV4dHJhczoge3NraXBMb2NhdGlvbkNoYW5nZSwgcmVwbGFjZVVybH1cbiAgICAgICAgICAgICAgICAgICAgICAgfSA9IHQ7XG4gICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLmhvb2tzLmFmdGVyUHJlYWN0aXZhdGlvbih0YXJnZXRTbmFwc2hvdCEsIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICBuYXZpZ2F0aW9uSWQsXG4gICAgICAgICAgICAgICAgICAgICAgICAgYXBwbGllZFVybFRyZWUsXG4gICAgICAgICAgICAgICAgICAgICAgICAgcmF3VXJsVHJlZSxcbiAgICAgICAgICAgICAgICAgICAgICAgICBza2lwTG9jYXRpb25DaGFuZ2U6ICEhc2tpcExvY2F0aW9uQ2hhbmdlLFxuICAgICAgICAgICAgICAgICAgICAgICAgIHJlcGxhY2VVcmw6ICEhcmVwbGFjZVVybCxcbiAgICAgICAgICAgICAgICAgICAgICAgfSk7XG4gICAgICAgICAgICAgICAgICAgICB9KSxcblxuICAgICAgICAgICAgICAgICAgICAgbWFwKCh0OiBOYXZpZ2F0aW9uVHJhbnNpdGlvbikgPT4ge1xuICAgICAgICAgICAgICAgICAgICAgICBjb25zdCB0YXJnZXRSb3V0ZXJTdGF0ZSA9IGNyZWF0ZVJvdXRlclN0YXRlKFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5yb3V0ZVJldXNlU3RyYXRlZ3ksIHQudGFyZ2V0U25hcHNob3QhLCB0LmN1cnJlbnRSb3V0ZXJTdGF0ZSk7XG4gICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAoey4uLnQsIHRhcmdldFJvdXRlclN0YXRlfSk7XG4gICAgICAgICAgICAgICAgICAgICB9KSxcblxuICAgICAgICAgICAgICAgICAgICAgLyogT25jZSBoZXJlLCB3ZSBhcmUgYWJvdXQgdG8gYWN0aXZhdGUgc3luY3Jvbm91c2x5LiBUaGUgYXNzdW1wdGlvbiBpcyB0aGlzXG4gICAgICAgICAgICAgICAgICAgICAgICB3aWxsIHN1Y2NlZWQsIGFuZCB1c2VyIGNvZGUgbWF5IHJlYWQgZnJvbSB0aGUgUm91dGVyIHNlcnZpY2UuIFRoZXJlZm9yZVxuICAgICAgICAgICAgICAgICAgICAgICAgYmVmb3JlIGFjdGl2YXRpb24sIHdlIG5lZWQgdG8gdXBkYXRlIHJvdXRlciBwcm9wZXJ0aWVzIHN0b3JpbmcgdGhlIGN1cnJlbnRcbiAgICAgICAgICAgICAgICAgICAgICAgIFVSTCBhbmQgdGhlIFJvdXRlclN0YXRlLCBhcyB3ZWxsIGFzIHVwZGF0ZWQgdGhlIGJyb3dzZXIgVVJMLiBBbGwgdGhpcyBzaG91bGRcbiAgICAgICAgICAgICAgICAgICAgICAgIGhhcHBlbiAqYmVmb3JlKiBhY3RpdmF0aW5nLiAqL1xuICAgICAgICAgICAgICAgICAgICAgdGFwKCh0OiBOYXZpZ2F0aW9uVHJhbnNpdGlvbikgPT4ge1xuICAgICAgICAgICAgICAgICAgICAgICB0aGlzLmN1cnJlbnRVcmxUcmVlID0gdC51cmxBZnRlclJlZGlyZWN0cztcbiAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5yYXdVcmxUcmVlID1cbiAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMudXJsSGFuZGxpbmdTdHJhdGVneS5tZXJnZSh0LnVybEFmdGVyUmVkaXJlY3RzLCB0LnJhd1VybCk7XG5cbiAgICAgICAgICAgICAgICAgICAgICAgKHRoaXMgYXMge3JvdXRlclN0YXRlOiBSb3V0ZXJTdGF0ZX0pLnJvdXRlclN0YXRlID0gdC50YXJnZXRSb3V0ZXJTdGF0ZSE7XG5cbiAgICAgICAgICAgICAgICAgICAgICAgaWYgKHRoaXMudXJsVXBkYXRlU3RyYXRlZ3kgPT09ICdkZWZlcnJlZCcpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIXQuZXh0cmFzLnNraXBMb2NhdGlvbkNoYW5nZSkge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5zZXRCcm93c2VyVXJsKHRoaXMucmF3VXJsVHJlZSwgdCk7XG4gICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuYnJvd3NlclVybFRyZWUgPSB0LnVybEFmdGVyUmVkaXJlY3RzO1xuICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgICB9KSxcblxuICAgICAgICAgICAgICAgICAgICAgYWN0aXZhdGVSb3V0ZXMoXG4gICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5yb290Q29udGV4dHMsIHRoaXMucm91dGVSZXVzZVN0cmF0ZWd5LFxuICAgICAgICAgICAgICAgICAgICAgICAgIChldnQ6IEV2ZW50KSA9PiB0aGlzLnRyaWdnZXJFdmVudChldnQpKSxcblxuICAgICAgICAgICAgICAgICAgICAgdGFwKHtcbiAgICAgICAgICAgICAgICAgICAgICAgbmV4dCgpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICBjb21wbGV0ZWQgPSB0cnVlO1xuICAgICAgICAgICAgICAgICAgICAgICB9LFxuICAgICAgICAgICAgICAgICAgICAgICBjb21wbGV0ZSgpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICBjb21wbGV0ZWQgPSB0cnVlO1xuICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgICB9KSxcbiAgICAgICAgICAgICAgICAgICAgIGZpbmFsaXplKCgpID0+IHtcbiAgICAgICAgICAgICAgICAgICAgICAgLyogV2hlbiB0aGUgbmF2aWdhdGlvbiBzdHJlYW0gZmluaXNoZXMgZWl0aGVyIHRocm91Z2ggZXJyb3Igb3Igc3VjY2Vzcywgd2VcbiAgICAgICAgICAgICAgICAgICAgICAgICogc2V0IHRoZSBgY29tcGxldGVkYCBvciBgZXJyb3JlZGAgZmxhZy4gSG93ZXZlciwgdGhlcmUgYXJlIHNvbWUgc2l0dWF0aW9uc1xuICAgICAgICAgICAgICAgICAgICAgICAgKiB3aGVyZSB3ZSBjb3VsZCBnZXQgaGVyZSB3aXRob3V0IGVpdGhlciBvZiB0aG9zZSBiZWluZyBzZXQuIEZvciBpbnN0YW5jZSwgYVxuICAgICAgICAgICAgICAgICAgICAgICAgKiByZWRpcmVjdCBkdXJpbmcgTmF2aWdhdGlvblN0YXJ0LiBUaGVyZWZvcmUsIHRoaXMgaXMgYSBjYXRjaC1hbGwgdG8gbWFrZVxuICAgICAgICAgICAgICAgICAgICAgICAgKiBzdXJlIHRoZSBOYXZpZ2F0aW9uQ2FuY2VsXG4gICAgICAgICAgICAgICAgICAgICAgICAqIGV2ZW50IGlzIGZpcmVkIHdoZW4gYSBuYXZpZ2F0aW9uIGdldHMgY2FuY2VsbGVkIGJ1dCBub3QgY2F1Z2h0IGJ5IG90aGVyXG4gICAgICAgICAgICAgICAgICAgICAgICAqIG1lYW5zLiAqL1xuICAgICAgICAgICAgICAgICAgICAgICBpZiAoIWNvbXBsZXRlZCAmJiAhZXJyb3JlZCkge1xuICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IGNhbmNlbGF0aW9uUmVhc29uID0gYE5hdmlnYXRpb24gSUQgJHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdC5pZH0gaXMgbm90IGVxdWFsIHRvIHRoZSBjdXJyZW50IG5hdmlnYXRpb24gaWQgJHt0aGlzLm5hdmlnYXRpb25JZH1gO1xuICAgICAgICAgICAgICAgICAgICAgICAgIGlmICh0aGlzLmNhbmNlbGVkTmF2aWdhdGlvblJlc29sdXRpb24gPT09ICdyZXBsYWNlJykge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8gTXVzdCByZXNldCB0byBjdXJyZW50IFVSTCB0cmVlIGhlcmUgdG8gZW5zdXJlIGhpc3Rvcnkuc3RhdGUgaXMgc2V0LiBPblxuICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8gYSBmcmVzaCBwYWdlIGxvYWQsIGlmIGEgbmV3IG5hdmlnYXRpb24gY29tZXMgaW4gYmVmb3JlIGEgc3VjY2Vzc2Z1bFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8gbmF2aWdhdGlvbiBjb21wbGV0ZXMsIHRoZXJlIHdpbGwgYmUgbm90aGluZyBpblxuICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8gaGlzdG9yeS5zdGF0ZS5uYXZpZ2F0aW9uSWQuIFRoaXMgY2FuIGNhdXNlIHN5bmMgcHJvYmxlbXMgd2l0aFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8gQW5ndWxhckpTIHN5bmMgY29kZSB3aGljaCBsb29rcyBmb3IgYSB2YWx1ZSBoZXJlIGluIG9yZGVyIHRvIGRldGVybWluZVxuICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8gd2hldGhlciBvciBub3QgdG8gaGFuZGxlIGEgZ2l2ZW4gcG9wc3RhdGUgZXZlbnQgb3IgdG8gbGVhdmUgaXQgdG8gdGhlXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAvLyBBbmd1bGFyIHJvdXRlci5cbiAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMucmVzdG9yZUhpc3RvcnkodCk7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLmNhbmNlbE5hdmlnYXRpb25UcmFuc2l0aW9uKHQsIGNhbmNlbGF0aW9uUmVhc29uKTtcbiAgICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8gV2UgY2Fubm90IHRyaWdnZXIgYSBgbG9jYXRpb24uaGlzdG9yeUdvYCBpZiB0aGVcbiAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vIGNhbmNlbGxhdGlvbiB3YXMgZHVlIHRvIGEgbmV3IG5hdmlnYXRpb24gYmVmb3JlIHRoZSBwcmV2aW91cyBjb3VsZFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8gY29tcGxldGUuIFRoaXMgaXMgYmVjYXVzZSBgbG9jYXRpb24uaGlzdG9yeUdvYCB0cmlnZ2VycyBhIGBwb3BzdGF0ZWBcbiAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vIHdoaWNoIHdvdWxkIGFsc28gdHJpZ2dlciBhbm90aGVyIG5hdmlnYXRpb24uIEluc3RlYWQsIHRyZWF0IHRoaXMgYXMgYVxuICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8gcmVkaXJlY3QgYW5kIGRvIG5vdCByZXNldCB0aGUgc3RhdGUuXG4gICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLmNhbmNlbE5hdmlnYXRpb25UcmFuc2l0aW9uKHQsIGNhbmNlbGF0aW9uUmVhc29uKTtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vIFRPRE8oYXRzY290dCk6IFRoZSBzYW1lIHByb2JsZW0gaGFwcGVucyBoZXJlIHdpdGggYSBmcmVzaCBwYWdlIGxvYWRcbiAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vIGFuZCBhIG5ldyBuYXZpZ2F0aW9uIGJlZm9yZSB0aGF0IGNvbXBsZXRlcyB3aGVyZSB3ZSB3b24ndCBzZXQgYSBwYWdlXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAvLyBpZC5cbiAgICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgICAgLy8gT25seSBjbGVhciBjdXJyZW50IG5hdmlnYXRpb24gaWYgaXQgaXMgc3RpbGwgc2V0IHRvIHRoZSBvbmUgdGhhdFxuICAgICAgICAgICAgICAgICAgICAgICAvLyBmaW5hbGl6ZWQuXG4gICAgICAgICAgICAgICAgICAgICAgIGlmICh0aGlzLmN1cnJlbnROYXZpZ2F0aW9uPy5pZCA9PT0gdC5pZCkge1xuICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuY3VycmVudE5hdmlnYXRpb24gPSBudWxsO1xuICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgICB9KSxcbiAgICAgICAgICAgICAgICAgICAgIGNhdGNoRXJyb3IoKGUpID0+IHtcbiAgICA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ZWQgbW9yZSB0aG9yb3VnaGx5LlxuICAgICAgICAgICAgICAgICAgICAgICBlcnJvcmVkID0gdHJ1ZTtcbiAgICAgICAgICAgICAgICAgICAgICAgLyogVGhpcyBlcnJvciB0eXBlIGlzIGlzc3VlZCBkdXJpbmcgUmVkaXJlY3QsIGFuZCBpcyBoYW5kbGVkIGFzIGFcbiAgICAgICAgICAgICAgICAgICAgICAgICogY2FuY2VsbGF0aW9uIHJhdGhlciB0aGFuIGFuIGVycm9yLiAqL1xuICAgICAgICAgICAgICAgICAgICAgICBpZiAoaXNOYXZpZ2F0aW9uQ2FuY2VsaW5nRXJyb3IoZSkpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCByZWRpcmVjdGluZyA9IGlzVXJsVHJlZShlLnVybCk7XG4gICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFyZWRpcmVjdGluZykge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8gU2V0IHByb3BlcnR5IG9ubHkgaWYgd2UncmUgbm90IHJlZGlyZWN0aW5nLiBJZiB3ZSBsYW5kZWQgb24gYSBwYWdlIGFuZFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8gcmVkaXJlY3QgdG8gYC9gIHJvdXRlLCB0aGUgbmV3IG5hdmlnYXRpb24gaXMgZ29pbmcgdG8gc2VlIHRoZSBgL2BcbiAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vIGlzbid0IGEgY2hhbmdlIGZyb20gdGhlIGRlZmF1bHQgY3VycmVudFVybFRyZWUgYW5kIHdvbid0IG5hdmlnYXRlLlxuICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8gVGhpcyBpcyBvbmx5IGFwcGxpY2FibGUgd2l0aCBpbml0aWFsIG5hdmlnYXRpb24sIHNvIHNldHRpbmdcbiAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vIGBuYXZpZ2F0ZWRgIG9ubHkgd2hlbiBub3QgcmVkaXJlY3RpbmcgcmVzb2x2ZXMgdGhpcyBzY2VuYXJpby5cbiAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMubmF2aWdhdGVkID0gdHJ1ZTtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMucmVzdG9yZUhpc3RvcnkodCwgdHJ1ZSk7XG4gICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IG5hdkNhbmNlbCA9IG5ldyBOYXZpZ2F0aW9uQ2FuY2VsKFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0LmlkLCB0aGlzLnNlcmlhbGl6ZVVybCh0LmV4dHJhY3RlZFVybCksIGUubWVzc2FnZSk7XG4gICAgICAgICAgICAgICAgICAgICAgICAgZXZlbnRzU3ViamVjdC5uZXh0KG5hdkNhbmNlbCk7XG5cbiAgICAgICAgICAgICAgICAgICAgICAgICAvLyBXaGVuIHJlZGlyZWN0aW5nLCB3ZSBuZWVkIHRvIGRlbGF5IHJlc29sdmluZyB0aGUgbmF2aWdhdGlvblxuICAgICAgICAgICAgICAgICAgICAgICAgIC8vIHByb21pc2UgYW5kIHB1c2ggaXQgdG8gdGhlIHJlZGlyZWN0IG5hdmlnYXRpb25cbiAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIXJlZGlyZWN0aW5nKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICB0LnJlc29sdmUoZmFsc2UpO1xuICAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAvLyBzZXRUaW1lb3V0IGlzIHJlcXVpcmVkIHNvIHRoaXMgbmF2aWdhdGlvbiBmaW5pc2hlcyB3aXRoXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAvLyB0aGUgcmV0dXJuIEVNUFRZIGJlbG93LiBJZiBpdCBpc24ndCBhbGxvd2VkIHRvIGZpbmlzaFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8gcHJvY2Vzc2luZywgdGhlcmUgY2FuIGJlIG11bHRpcGxlIG5hdmlnYXRpb25zIHRvIHRoZSBzYW1lXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAvLyBVUkwuXG4gICAgICAgICAgICAgICAgICAgICAgICAgICBzZXRUaW1lb3V0KCgpID0+IHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgbWVyZ2VkVHJlZSA9XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLnVybEhhbmRsaW5nU3RyYXRlZ3kubWVyZ2UoZS51cmwsIHRoaXMucmF3VXJsVHJlZSk7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IGV4dHJhcyA9IHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBza2lwTG9jYXRpb25DaGFuZ2U6IHQuZXh0cmFzLnNraXBMb2NhdGlvbkNoYW5nZSxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyBUaGUgVVJMIGlzIGFscmVhZHkgdXBkYXRlZCBhdCB0aGlzIHBvaW50IGlmIHdlIGhhdmUgJ2VhZ2VyJyBVUkxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyB1cGRhdGVzIG9yIGlmIHRoZSBuYXZpZ2F0aW9uIHdhcyB0cmlnZ2VyZWQgYnkgdGhlIGJyb3dzZXIgKGJhY2tcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyBidXR0b24sIFVSTCBiYXIsIGV0YykuIFdlIHdhbnQgdG8gcmVwbGFjZSB0aGF0IGl0ZW0gaW4gaGlzdG9yeSBpZlxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vIHRoZSBuYXZpZ2F0aW9uIGlzIHJlamVjdGVkLlxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlcGxhY2VVcmw6IHRoaXMudXJsVXBkYXRlU3RyYXRlZ3kgPT09ICdlYWdlcicgfHxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaXNCcm93c2VyVHJpZ2dlcmVkTmF2aWdhdGlvbih0LnNvdXJjZSlcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTtcblxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLnNjaGVkdWxlTmF2aWdhdGlvbihcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1lcmdlZFRyZWUsICdpbXBlcmF0aXZlJywgbnVsbCwgZXh0cmFzLFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAge3Jlc29sdmU6IHQucmVzb2x2ZSwgcmVqZWN0OiB0LnJlamVjdCwgcHJvbWlzZTogdC5wcm9taXNlfSk7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICB9LCAwKTtcbiAgICAgICAgICAgICAgICAgICAgICAgICB9XG5cbiAgICAgICAgICAgICAgICAgICAgICAgICAvKiBBbGwgb3RoZXIgZXJyb3JzIHNob3VsZCByZXNldCB0byB0aGUgcm91dGVyJ3MgaW50ZXJuYWwgVVJMIHJlZmVyZW5jZSB0b1xuICAgICAgICAgICAgICAgICAgICAgICAgICAqIHRoZSBwcmUtZXJyb3Igc3RhdGUuICovXG4gICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5yZXN0b3JlSGlzdG9yeSh0LCB0cnVlKTtcbiAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBuYXZFcnJvciA9XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5ldyBOYXZpZ2F0aW9uRXJyb3IodC5pZCwgdGhpcy5zZXJpYWxpemVVcmwodC5leHRyYWN0ZWRVcmwpLCBlKTtcbiAgICAgICAgICAgICAgICAgICAgICAgICBldmVudHNTdWJqZWN0Lm5leHQobmF2RXJyb3IpO1xuICAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICB0LnJlc29sdm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