| 37 | } |
| 38 | |
| 39 | decodeInline(text) { |
| 40 | let baseCharsetUri = /^data:application\/json;charset=utf-?8;base64,/ |
| 41 | let baseUri = /^data:application\/json;base64,/ |
| 42 | let charsetUri = /^data:application\/json;charset=utf-?8,/ |
| 43 | let uri = /^data:application\/json,/ |
| 44 | |
| 45 | let uriMatch = text.match(charsetUri) || text.match(uri) |
| 46 | if (uriMatch) { |
| 47 | return decodeURIComponent(text.substr(uriMatch[0].length)) |
| 48 | } |
| 49 | |
| 50 | let baseUriMatch = text.match(baseCharsetUri) || text.match(baseUri) |
| 51 | if (baseUriMatch) { |
| 52 | return fromBase64(text.substr(baseUriMatch[0].length)) |
| 53 | } |
| 54 | |
| 55 | let encoding = text.slice('data:application/json;'.length) |
| 56 | encoding = encoding.slice(0, encoding.indexOf(',')) |
| 57 | throw new Error('Unsupported source map encoding ' + encoding) |
| 58 | } |
| 59 | |
| 60 | getAnnotationURL(sourceMapString) { |
| 61 | return sourceMapString.replace(/^\/\*\s*# sourceMappingURL=/, '').trim() |