{"ast":null,"code":"/** @publicapi @module url */\n\n/** */\nimport { BaseUrlRule } from '@uirouter/core';\nimport { services, isString, isFunction, isArray, identity } from '@uirouter/core';\n/**\n * Manages rules for client-side URL\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 [[UrlRulesApi]] which can be found as [[UrlService.rules]].\n *\n * This class manages the router rules for what to do when the URL changes.\n *\n * This provider remains for backwards compatibility.\n *\n * @internalapi\n * @deprecated\n */\n\nvar UrlRouterProvider = function () {\n  /** @hidden */\n  function UrlRouterProvider(\n  /** @hidden */\n  router) {\n    this.router = router;\n  }\n\n  UrlRouterProvider.injectableHandler = function (router, handler) {\n    return function (match) {\n      return services.$injector.invoke(handler, null, {\n        $match: match,\n        $stateParams: router.globals.params\n      });\n    };\n  };\n  /** @hidden */\n\n\n  UrlRouterProvider.prototype.$get = function () {\n    var urlService = this.router.urlService;\n    this.router.urlRouter.update(true);\n    if (!urlService.interceptDeferred) urlService.listen();\n    return this.router.urlRouter;\n  };\n  /**\n   * Registers a url handler function.\n   *\n   * Registers a low level url handler (a `rule`).\n   * A rule detects specific URL patterns and returns a redirect, or performs some action.\n   *\n   * If a rule returns a string, the URL is replaced with the string, and all rules are fired again.\n   *\n   * #### Example:\n   * ```js\n   * var app = angular.module('app', ['ui.router.router']);\n   *\n   * app.config(function ($urlRouterProvider) {\n   *   // Here's an example of how you might allow case insensitive urls\n   *   $urlRouterProvider.rule(function ($injector, $location) {\n   *     var path = $location.path(),\n   *         normalized = path.toLowerCase();\n   *\n   *     if (path !== normalized) {\n   *       return normalized;\n   *     }\n   *   });\n   * });\n   * ```\n   *\n   * @param ruleFn\n   * Handler function that takes `$injector` and `$location` services as arguments.\n   * You can use them to detect a url and return a different url as a string.\n   *\n   * @return [[UrlRouterProvider]] (`this`)\n   */\n\n\n  UrlRouterProvider.prototype.rule = function (ruleFn) {\n    var _this = this;\n\n    if (!isFunction(ruleFn)) throw new Error(\"'rule' must be a function\");\n\n    var match = function () {\n      return ruleFn(services.$injector, _this.router.locationService);\n    };\n\n    var rule = new BaseUrlRule(match, identity);\n    this.router.urlService.rules.rule(rule);\n    return this;\n  };\n  /**\n   * Defines the path or behavior to use when no url can be matched.\n   *\n   * #### Example:\n   * ```js\n   * var app = angular.module('app', ['ui.router.router']);\n   *\n   * app.config(function ($urlRouterProvider) {\n   *   // if the path doesn't match any of the urls you configured\n   *   // otherwise will take care of routing the user to the\n   *   // specified url\n   *   $urlRouterProvider.otherwise('/index');\n   *\n   *   // Example of using function rule as param\n   *   $urlRouterProvider.otherwise(function ($injector, $location) {\n   *     return '/a/valid/url';\n   *   });\n   * });\n   * ```\n   *\n   * @param rule\n   * The url path you want to redirect to or a function rule that returns the url path or performs a `$state.go()`.\n   * The function version is passed two params: `$injector` and `$location` services, and should return a url string.\n   *\n   * @return {object} `$urlRouterProvider` - `$urlRouterProvider` instance\n   */\n\n\n  UrlRouterProvider.prototype.otherwise = function (rule) {\n    var _this = this;\n\n    var urlRules = this.router.urlService.rules;\n\n    if (isString(rule)) {\n      urlRules.otherwise(rule);\n    } else if (isFunction(rule)) {\n      urlRules.otherwise(function () {\n        return rule(services.$injector, _this.router.locationService);\n      });\n    } else {\n      throw new Error(\"'rule' must be a string or function\");\n    }\n\n    return this;\n  };\n  /**\n   * Registers a handler for a given url matching.\n   *\n   * If the handler is a string, it is\n   * treated as a redirect, and is interpolated according to the syntax of match\n   * (i.e. like `String.replace()` for `RegExp`, or like a `UrlMatcher` pattern otherwise).\n   *\n   * If the handler is a function, it is injectable.\n   * It gets invoked if `$location` matches.\n   * You have the option of inject the match object as `$match`.\n   *\n   * The handler can return\n   *\n   * - **falsy** to indicate that the rule didn't match after all, then `$urlRouter`\n   *   will continue trying to find another one that matches.\n   * - **string** which is treated as a redirect and passed to `$location.url()`\n   * - **void** or any **truthy** value tells `$urlRouter` that the url was handled.\n   *\n   * #### Example:\n   * ```js\n   * var app = angular.module('app', ['ui.router.router']);\n   *\n   * app.config(function ($urlRouterProvider) {\n   *   $urlRouterProvider.when($state.url, function ($match, $stateParams) {\n   *     if ($state.$current.navigable !== state ||\n   *         !equalForKeys($match, $stateParams) {\n   *      $state.transitionTo(state, $match, false);\n   *     }\n   *   });\n   * });\n   * ```\n   *\n   * @param what A pattern string to match, compiled as a [[UrlMatcher]].\n   * @param handler The path (or function that returns a path) that you want to redirect your user to.\n   * @param ruleCallback [optional] A callback that receives the `rule` registered with [[UrlMatcher.rule]]\n   *\n   * Note: the handler may also invoke arbitrary code, such as `$state.go()`\n   */\n\n\n  UrlRouterProvider.prototype.when = function (what, handler) {\n    if (isArray(handler) || isFunction(handler)) {\n      handler = UrlRouterProvider.injectableHandler(this.router, handler);\n    }\n\n    this.router.urlService.rules.when(what, handler);\n    return this;\n  };\n  /**\n   * Disables monitoring of the URL.\n   *\n   * Call this method before UI-Router has bootstrapped.\n   * It will stop UI-Router from performing the initial url sync.\n   *\n   * This can be useful to perform some asynchronous initialization before the router starts.\n   * Once the initialization is complete, call [[listen]] to tell UI-Router to start watching and synchronizing the URL.\n   *\n   * #### Example:\n   * ```js\n   * var app = angular.module('app', ['ui.router']);\n   *\n   * app.config(function ($urlRouterProvider) {\n   *   // Prevent $urlRouter from automatically intercepting URL changes;\n   *   $urlRouterProvider.deferIntercept();\n   * })\n   *\n   * app.run(function (MyService, $urlRouter, $http) {\n   *   $http.get(\"/stuff\").then(function(resp) {\n   *     MyService.doStuff(resp.data);\n   *     $urlRouter.listen();\n   *     $urlRouter.sync();\n   *   });\n   * });\n   * ```\n   *\n   * @param defer Indicates whether to defer location change interception.\n   *        Passing no parameter is equivalent to `true`.\n   */\n\n\n  UrlRouterProvider.prototype.deferIntercept = function (defer) {\n    this.router.urlService.deferIntercept(defer);\n  };\n\n  return UrlRouterProvider;\n}();\n\nexport { UrlRouterProvider };","map":{"version":3,"sources":["D:/Development/Work/CENOS/cenos-ui/node_modules/@uirouter/angularjs/lib-esm/urlRouterProvider.js"],"names":["BaseUrlRule","services","isString","isFunction","isArray","identity","UrlRouterProvider","router","injectableHandler","handler","match","$injector","invoke","$match","$stateParams","globals","params","prototype","$get","urlService","urlRouter","update","interceptDeferred","listen","rule","ruleFn","_this","Error","locationService","rules","otherwise","urlRules","when","what","deferIntercept","defer"],"mappings":"AAAA;;AAA8B;AAC9B,SAASA,WAAT,QAA6B,gBAA7B;AACA,SAASC,QAAT,EAAmBC,QAAnB,EAA6BC,UAA7B,EAAyCC,OAAzC,EAAkDC,QAAlD,QAAkE,gBAAlE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,IAAIC,iBAAiB,GAAkB,YAAY;AAC/C;AACA,WAASA,iBAAT;AAA2B;AAAeC,EAAAA,MAA1C,EAAkD;AAC9C,SAAKA,MAAL,GAAcA,MAAd;AACH;;AACDD,EAAAA,iBAAiB,CAACE,iBAAlB,GAAsC,UAAUD,MAAV,EAAkBE,OAAlB,EAA2B;AAC7D,WAAO,UAAUC,KAAV,EAAiB;AAAE,aAAOT,QAAQ,CAACU,SAAT,CAAmBC,MAAnB,CAA0BH,OAA1B,EAAmC,IAAnC,EAAyC;AAAEI,QAAAA,MAAM,EAAEH,KAAV;AAAiBI,QAAAA,YAAY,EAAEP,MAAM,CAACQ,OAAP,CAAeC;AAA9C,OAAzC,CAAP;AAA0G,KAApI;AACH,GAFD;AAGA;;;AACAV,EAAAA,iBAAiB,CAACW,SAAlB,CAA4BC,IAA5B,GAAmC,YAAY;AAC3C,QAAIC,UAAU,GAAG,KAAKZ,MAAL,CAAYY,UAA7B;AACA,SAAKZ,MAAL,CAAYa,SAAZ,CAAsBC,MAAtB,CAA6B,IAA7B;AACA,QAAI,CAACF,UAAU,CAACG,iBAAhB,EACIH,UAAU,CAACI,MAAX;AACJ,WAAO,KAAKhB,MAAL,CAAYa,SAAnB;AACH,GAND;AAOA;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAC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AAjG;AACH,KAFI,MAGA;AACD,YAAM,IAAID,KAAJ,CAAU,qCAAV,CAAN;AACH;;AACD,WAAO,IAAP;AACH,GAbD;AAcA;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACIrB,EAAAA,iBAAiB,CAACW,SAAlB,CAA4Be,IAA5B,GAAmC,UAAUC,IAAV,EAAgBxB,OAAhB,EAAyB;AACxD,QAAIL,OAAO,CAACK,OAAD,CAAP,IAAoBN,UAAU,CAACM,OAAD,CAAlC,EAA6C;AACzCA,MAAAA,OAAO,GAAGH,iBAAiB,CAACE,iBAAlB,CAAoC,KAAKD,MAAzC,EAAiDE,OAAjD,CAAV;AACH;;AACD,SAAKF,MAAL,CAAYY,UAAZ,CAAuBU,KAAvB,CAA6BG,IAA7B,CAAkCC,IAAlC,EAAwCxB,OAAxC;AACA,WAAO,IAAP;AACH,GAND;AAOA;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACIH,EAAAA,iBAAiB,CAACW,SAAlB,CAA4BiB,cAA5B,GAA6C,UAAUC,KAAV,EAAiB;AAC1D,SAAK5B,MAAL,CAAYY,UAAZ,CAAuBe,cAAvB,CAAsCC,KAAtC;AACH,GAFD;;AAGA,SAAO7B,iBAAP;AACH,CA/KsC,EAAvC;;AAgLA,SAASA,iBAAT","sourcesContent":["/** @publicapi @module url */ /** */\nimport { BaseUrlRule, } from '@uirouter/core';\nimport { services, isString, isFunction, isArray, identity } from '@uirouter/core';\n/**\n * Manages rules for client-side URL\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 [[UrlRulesApi]] which can be found as [[UrlService.rules]].\n *\n * This class manages the router rules for what to do when the URL changes.\n *\n * This provider remains for backwards compatibility.\n *\n * @internalapi\n * @deprecated\n */\nvar UrlRouterProvider = /** @class */ (function () {\n    /** @hidden */\n    function UrlRouterProvider(/** @hidden */ router) {\n        this.router = router;\n    }\n    UrlRouterProvider.injectableHandler = function (router, handler) {\n        return function (match) { return services.$injector.invoke(handler, null, { $match: match, $stateParams: router.globals.params }); };\n    };\n    /** @hidden */\n    UrlRouterProvider.prototype.$get = function () {\n        var urlService = this.router.urlService;\n        this.router.urlRouter.update(true);\n        if (!urlService.interceptDeferred)\n            urlService.listen();\n        return this.router.urlRouter;\n    };\n    /**\n     * Registers a url handler function.\n     *\n     * Registers a low level url handler (a `rule`).\n     * A rule detects specific URL patterns and returns a redirect, or performs some action.\n     *\n     * If a rule returns a string, the URL is replaced with the string, and all rules are fired again.\n     *\n     * #### Example:\n     * ```js\n     * var app = angular.module('app', ['ui.router.router']);\n     *\n     * app.config(function ($urlRouterProvider) {\n     *   // Here's an example of how you might allow case insensitive urls\n     *   $urlRouterProvider.rule(function ($injector, $location) {\n     *     var path = $location.path(),\n     *         normalized = path.toLowerCase();\n     *\n     *     if (path !== normalized) {\n     *       return normalized;\n     *     }\n     *   });\n     * });\n     * ```\n     *\n     * @param ruleFn\n     * Handler function that takes `$injector` and `$location` services as arguments.\n     * You can use them to detect a url and return a different url as a string.\n     *\n     * @return [[UrlRouterProvider]] (`this`)\n     */\n    UrlRouterProvider.prototype.rule = function (ruleFn) {\n        var _this = this;\n        if (!isFunction(ruleFn))\n            throw new Error(\"'rule' must be a function\");\n        var match = function () { return ruleFn(services.$injector, _this.router.locationService); };\n        var rule = new BaseUrlRule(match, identity);\n        this.router.urlService.rules.rule(rule);\n        return this;\n    };\n    /**\n     * Defines the path or behavior to use when no url can be matched.\n     *\n     * #### Example:\n     * ```js\n     * var app = angular.module('app', ['ui.router.router']);\n     *\n     * app.config(function ($urlRouterProvider) {\n     *   // if the path doesn't match any of the urls you configured\n     *   // otherwise will take care of routing the user to the\n     *   // specified url\n     *   $urlRouterProvider.otherwise('/index');\n     *\n     *   // Example of using function rule as param\n     *   $urlRouterProvider.otherwise(function ($injector, $location) {\n     *     return '/a/valid/url';\n     *   });\n     * });\n     * ```\n     *\n     * @param rule\n     * The url path you want to redirect to or a function rule that returns the url path or performs a `$state.go()`.\n     * The function version is passed two params: `$injector` and `$location` services, and should return a url string.\n     *\n     * @return {object} `$urlRouterProvider` - `$urlRouterProvider` instance\n     */\n    UrlRouterProvider.prototype.otherwise = function (rule) {\n        var _this = this;\n        var urlRules = this.router.urlService.rules;\n        if (isString(rule)) {\n            urlRules.otherwise(rule);\n        }\n        else if (isFunction(rule)) {\n            urlRules.otherwise(function () { return rule(services.$injector, _this.router.locationService); });\n        }\n        else {\n            throw new Error(\"'rule' must be a string or function\");\n        }\n        return this;\n    };\n    /**\n     * Registers a handler for a given url matching.\n     *\n     * If the handler is a string, it is\n     * treated as a redirect, and is interpolated according to the syntax of match\n     * (i.e. like `String.replace()` for `RegExp`, or like a `UrlMatcher` pattern otherwise).\n     *\n     * If the handler is a function, it is injectable.\n     * It gets invoked if `$location` matches.\n     * You have the option of inject the match object as `$match`.\n     *\n     * The handler can return\n     *\n     * - **falsy** to indicate that the rule didn't match after all, then `$urlRouter`\n     *   will continue trying to find another one that matches.\n     * - **string** which is treated as a redirect and passed to `$location.url()`\n     * - **void** or any **truthy** value tells `$urlRouter` that the url was handled.\n     *\n     * #### Example:\n     * ```js\n     * var app = angular.module('app', ['ui.router.router']);\n     *\n     * app.config(function ($urlRouterProvider) {\n     *   $urlRouterProvider.when($state.url, function ($match, $stateParams) {\n     *     if ($state.$current.navigable !== state ||\n     *         !equalForKeys($match, $stateParams) {\n     *      $state.transitionTo(state, $match, false);\n     *     }\n     *   });\n     * });\n     * ```\n     *\n     * @param what A pattern string to match, compiled as a [[UrlMatcher]].\n     * @param handler The path (or function that returns a path) that you want to redirect your user to.\n     * @param ruleCallback [optional] A callback that receives the `rule` registered with [[UrlMatcher.rule]]\n     *\n     * Note: the handler may also invoke arbitrary code, such as `$state.go()`\n     */\n    UrlRouterProvider.prototype.when = function (what, handler) {\n        if (isArray(handler) || isFunction(handler)) {\n            handler = UrlRouterProvider.injectableHandler(this.router, handler);\n        }\n        this.router.urlService.rules.when(what, handler);\n        return this;\n    };\n    /**\n     * Disables monitoring of the URL.\n     *\n     * Call this method before UI-Router has bootstrapped.\n     * It will stop UI-Router from performing the initial url sync.\n     *\n     * This can be useful to perform some asynchronous initialization before the router starts.\n     * Once the initialization is complete, call [[listen]] to tell UI-Router to start watching and synchronizing the URL.\n     *\n     * #### Example:\n     * ```js\n     * var app = angular.module('app', ['ui.router']);\n     *\n     * app.config(function ($urlRouterProvider) {\n     *   // Prevent $urlRouter from automatically intercepting URL changes;\n     *   $urlRouterProvider.deferIntercept();\n     * })\n     *\n     * app.run(function (MyService, $urlRouter, $http) {\n     *   $http.get(\"/stuff\").then(function(resp) {\n     *     MyService.doStuff(resp.data);\n     *     $urlRouter.listen();\n     *     $urlRouter.sync();\n     *   });\n     * });\n     * ```\n     *\n     * @param defer Indicates whether to defer location change interception.\n     *        Passing no parameter is equivalent to `true`.\n     */\n    UrlRouterProvider.prototype.deferIntercept = function (defer) {\n        this.router.urlService.deferIntercept(defer);\n    };\n    return UrlRouterProvider;\n}());\nexport { UrlRouterProvider };\n"]},"metadata":{},"sourceType":"module"}