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CAAA,YAAW,EAAI,CAAA,aAAY,OAAO,AAAC,CAAC,mDAAkD,CAAC,CAAC;AAC5F,AAAI,EAAA,CAAA,QAAO,EAAI,CAAA,aAAY,OAAO,AAAC,CAAC,OAAM,CAAC,CAAC;AAC5C","file":"angular2/src/render/dom/shadow_dom/style_url_resolver.js","sourcesContent":["// Some of the code comes from WebComponents.JS\n// https://github.com/webcomponents/webcomponentsjs/blob/master/src/HTMLImports/path.js\n\nimport {Injectable} from 'angular2/src/di/annotations_impl';\nimport {RegExp, RegExpWrapper, StringWrapper} from 'angular2/src/facade/lang';\nimport {UrlResolver} from 'angular2/src/services/url_resolver';\n\n/**\n * Rewrites URLs by resolving '@import' and 'url()' URLs from the given base URL.\n */\n@Injectable()\nexport class StyleUrlResolver {\n  _resolver: UrlResolver;\n\n  constructor(resolver: UrlResolver) {\n    this._resolver = resolver;\n  }\n\n  resolveUrls(cssText: string, baseUrl: string) {\n    cssText = this._replaceUrls(cssText, _cssUrlRe, baseUrl);\n    cssText = this._replaceUrls(cssText, _cssImportRe, baseUrl);\n    return cssText;\n  }\n\n  _replaceUrls(cssText: string, re: RegExp, baseUrl: string) {\n    return StringWrapper.replaceAllMapped(cssText, re, (m) => {\n      var pre = m[1];\n      var url = StringWrapper.replaceAll(m[2], _quoteRe, '');\n      var post = m[3];\n\n      var resolvedUrl = this._resolver.resolve(baseUrl, url);\n\n      return pre + \"'\" + resolvedUrl + \"'\" + post;\n    });\n  }\n}\n\nvar _cssUrlRe = RegExpWrapper.create('(url\\\\()([^)]*)(\\\\))');\nvar _cssImportRe = RegExpWrapper.create('(@import[\\\\s]+(?!url\\\\())[\\'\"]([^\\'\"]*)[\\'\"](.*;)');\nvar _quoteRe = RegExpWrapper.create('[\\'\"]');\n"]}