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B,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,UAAC,EAAE,IAAK,OAAA,EAAE,CAAC,EAAE,GAAG,KAAA,EAAE,CAAC,EAAX,CAAW,CAAC,CAAC;aAC9C;SACF;QAED,OAAO,gBAAQ,CAAC,IAAI,CAAC,CAAC;IACxB,CAAC;IAED,uCAAQ,GAAR,UAAS,EAAiB;QAA1B,iBAGC;QAFC,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QACzB,OAAO,cAAM,OAAA,mBAAU,CAAC,KAAI,CAAC,UAAU,EAAE,EAAE,CAAC,EAA/B,CAA+B,CAAC;IAC/C,CAAC;IAED,sCAAO,GAAP,UAAQ,MAAgB;QACtB,iBAAQ,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IAC5B,CAAC;IACH,2BAAC;AAAD,CAAC,AA/DD,IA+DC;AA/DqB,oDAAoB",
10 "sourcesContent": [
11 "import { deregAll, isDefined, LocationServices, removeFrom, root } from '../common';\nimport { Disposable } from '../interface';\nimport { UIRouter } from '../router';\nimport { HistoryLike, LocationLike } from './interface';\nimport { buildUrl, getParams, parseUrl } from './utils';\n\n/** A base `LocationServices` */\nexport abstract class BaseLocationServices implements LocationServices, Disposable {\n private _listeners: Function[] = [];\n _location: LocationLike;\n _history: HistoryLike;\n\n _listener = (evt) => this._listeners.forEach((cb) => cb(evt));\n\n constructor(router: UIRouter, public fireAfterUpdate: boolean) {\n this._location = root.location;\n this._history = root.history;\n }\n\n /**\n * This should return the current internal URL representation.\n *\n * The internal URL includes only the portion that UI-Router matches.\n * It does not include:\n * - protocol\n * - server\n * - port\n * - base href or hash\n */\n protected abstract _get(): string;\n\n /**\n * This should set the current URL.\n *\n * The `url` param should include only the portion that UI-Router matches on.\n * It should not include:\n * - protocol\n * - server\n * - port\n * - base href or hash\n *\n * However, after this function completes, the browser URL should reflect the entire (fully qualified)\n * HREF including those data.\n */\n protected abstract _set(state: any, title: string, url: string, replace: boolean);\n\n hash = () => parseUrl(this._get()).hash;\n path = () => parseUrl(this._get()).path;\n search = () => getParams(parseUrl(this._get()).search);\n\n url(url?: string, replace = true): string {\n if (isDefined(url) && url !== this._get()) {\n this._set(null, null, url, replace);\n\n if (this.fireAfterUpdate) {\n this._listeners.forEach((cb) => cb({ url }));\n }\n }\n\n return buildUrl(this);\n }\n\n onChange(cb: EventListener) {\n this._listeners.push(cb);\n return () => removeFrom(this._listeners, cb);\n }\n\n dispose(router: UIRouter) {\n deregAll(this._listeners);\n }\n}\n"
12 ]
13}
\No newline at end of file