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,OAAO,CAAC,QAAQ,IAAI,CAAC,GAAG,EAAE;YAC7B,OAAO,GAAG,CAAC;SACZ;QAED,IAAM,KAAK,GAAG,CAAC,OAAO,IAAI,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;QACzC,IAAM,OAAO,GAAG,GAAG,CAAC,IAAI,EAAE,CAAC;QAC3B,IAAM,IAAI,GAAQ,CAAC,OAAO,KAAK,EAAE,IAAI,OAAO,KAAK,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,GAAG,OAAO,CAAC,CAAC;QAE3E,OAAO,CAAC,GAAG,CAAC,QAAQ,EAAE,EAAE,KAAK,EAAE,GAAG,CAAC,IAAI,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACxE,CAAC;IAUD,sBAAW,wCAAiB;QAD5B,sDAAsD;aACtD;YACE,OAAO,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,iBAAiB,CAAC;QAClD,CAAC;;;OAAA;IAyBH,gBAAC;AAAD,CAAC,AAnHD,IAmHC;AAnHY,8BAAS",
|
10 | "sourcesContent": [
|
11 | "import { stripLastPathElement } from '../common';\nimport { UrlMatcher } from './urlMatcher';\nimport { RawParams } from '../params';\nimport { UIRouter } from '../router';\nimport { UrlRuleFactory } from './urlRule';\nimport { MatchResult, UrlParts, UrlRule, UrlRuleHandlerFn } from './interface';\nimport { TargetState, TargetStateDef } from '../state';\n\nfunction appendBasePath(url: string, isHtml5: boolean, absolute: boolean, baseHref: string): string {\n if (baseHref === '/') return url;\n if (isHtml5) return stripLastPathElement(baseHref) + url;\n if (absolute) return baseHref.slice(1) + url;\n return url;\n}\n\n/**\n * Updates URL and responds to URL changes\n *\n * ### Deprecation warning:\n * This class is now considered to be an internal API\n * Use the [[UrlService]] instead.\n * For configuring URL rules, use the [[UrlRules]] which can be found as [[UrlService.rules]].\n */\nexport class UrlRouter {\n /** used to create [[UrlRule]] objects for common cases */\n public urlRuleFactory: UrlRuleFactory;\n /** @internal */ private location: string;\n\n /** @internal */\n constructor(/** @internal */ private router: UIRouter) {\n this.urlRuleFactory = new UrlRuleFactory(router);\n }\n\n /** Internal API. */\n update(read?: boolean) {\n const $url = this.router.locationService;\n if (read) {\n this.location = $url.url();\n return;\n }\n if ($url.url() === this.location) return;\n\n $url.url(this.location, true);\n }\n\n /**\n * Internal API.\n *\n * Pushes a new location to the browser history.\n *\n * @internal\n * @param urlMatcher\n * @param params\n * @param options\n */\n push(urlMatcher: UrlMatcher, params?: RawParams, options?: { replace?: string | boolean }) {\n const replace = options && !!options.replace;\n this.router.urlService.url(urlMatcher.format(params || {}), replace);\n }\n\n /**\n * Builds and returns a URL with interpolated parameters\n *\n * #### Example:\n * ```js\n * matcher = $umf.compile(\"/about/:person\");\n * params = { person: \"bob\" };\n * $bob = $urlRouter.href(matcher, params);\n * // $bob == \"/about/bob\";\n * ```\n *\n * @param urlMatcher The [[UrlMatcher]] object which is used as the template of the URL to generate.\n * @param params An object of parameter values to fill the matcher's required parameters.\n * @param options Options object. The options are:\n *\n * - **`absolute`** - {boolean=false}, If true will generate an absolute url, e.g. \"http://www.example.com/fullurl\".\n *\n * @returns Returns the fully compiled URL, or `null` if `params` fail validation against `urlMatcher`\n */\n href(urlMatcher: UrlMatcher, params?: any, options?: { absolute: boolean }): string {\n let url = urlMatcher.format(params);\n if (url == null) return null;\n\n options = options || { absolute: false };\n\n const cfg = this.router.urlService.config;\n const isHtml5 = cfg.html5Mode();\n if (!isHtml5 && url !== null) {\n url = '#' + cfg.hashPrefix() + url;\n }\n url = appendBasePath(url, isHtml5, options.absolute, cfg.baseHref());\n\n if (!options.absolute || !url) {\n return url;\n }\n\n const slash = !isHtml5 && url ? '/' : '';\n const cfgPort = cfg.port();\n const port = <any>(cfgPort === 80 || cfgPort === 443 ? '' : ':' + cfgPort);\n\n return [cfg.protocol(), '://', cfg.host(), port, slash, url].join('');\n }\n\n // Delegate these calls to [[UrlService]]\n /** @deprecated use [[UrlService.sync]]*/\n public sync = (evt?) => this.router.urlService.sync(evt);\n /** @deprecated use [[UrlService.listen]]*/\n public listen = (enabled?: boolean): Function => this.router.urlService.listen(enabled);\n /** @deprecated use [[UrlService.deferIntercept]]*/\n public deferIntercept = (defer?: boolean) => this.router.urlService.deferIntercept(defer);\n /** @deprecated use [[UrlService.interceptDeferred]]*/\n public get interceptDeferred() {\n return this.router.urlService.interceptDeferred;\n }\n /** @deprecated use [[UrlService.match]]*/\n public match = (urlParts: UrlParts): MatchResult => this.router.urlService.match(urlParts);\n\n // Delegate these calls to [[UrlRules]]\n /** @deprecated use [[UrlRules.initial]]*/\n public initial = (handler: string | UrlRuleHandlerFn | TargetState | TargetStateDef): void =>\n this.router.urlService.rules.initial(handler);\n /** @deprecated use [[UrlRules.otherwise]]*/\n public otherwise = (handler: string | UrlRuleHandlerFn | TargetState | TargetStateDef): void =>\n this.router.urlService.rules.otherwise(handler);\n /** @deprecated use [[UrlRules.removeRule]]*/\n public removeRule = (rule: UrlRule): void => this.router.urlService.rules.removeRule(rule);\n /** @deprecated use [[UrlRules.rule]]*/\n public rule = (rule: UrlRule): Function => this.router.urlService.rules.rule(rule);\n /** @deprecated use [[UrlRules.rules]]*/\n public rules = (): UrlRule[] => this.router.urlService.rules.rules();\n /** @deprecated use [[UrlRules.sort]]*/\n public sort = (compareFn?: (a: UrlRule, b: UrlRule) => number) => this.router.urlService.rules.sort(compareFn);\n /** @deprecated use [[UrlRules.when]]*/\n public when = (\n matcher: RegExp | UrlMatcher | string,\n handler: string | UrlRuleHandlerFn,\n options?: { priority: number }\n ): UrlRule => this.router.urlService.rules.when(matcher, handler, options);\n}\n"
|
12 | ]
|
13 | } |
\ | No newline at end of file |