You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

3233 lines
266 KiB

  1. (function webpackUniversalModuleDefinition(root, factory) {
  2. if(typeof exports === 'object' && typeof module === 'object')
  3. module.exports = factory();
  4. else if(typeof define === 'function' && define.amd)
  5. define([], factory);
  6. else if(typeof exports === 'object')
  7. exports["sourceMap"] = factory();
  8. else
  9. root["sourceMap"] = factory();
  10. })(this, function() {
  11. return /******/ (function(modules) { // webpackBootstrap
  12. /******/ // The module cache
  13. /******/ var installedModules = {};
  14. /******/
  15. /******/ // The require function
  16. /******/ function __webpack_require__(moduleId) {
  17. /******/
  18. /******/ // Check if module is in cache
  19. /******/ if(installedModules[moduleId])
  20. /******/ return installedModules[moduleId].exports;
  21. /******/
  22. /******/ // Create a new module (and put it into the cache)
  23. /******/ var module = installedModules[moduleId] = {
  24. /******/ exports: {},
  25. /******/ id: moduleId,
  26. /******/ loaded: false
  27. /******/ };
  28. /******/
  29. /******/ // Execute the module function
  30. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  31. /******/
  32. /******/ // Flag the module as loaded
  33. /******/ module.loaded = true;
  34. /******/
  35. /******/ // Return the exports of the module
  36. /******/ return module.exports;
  37. /******/ }
  38. /******/
  39. /******/
  40. /******/ // expose the modules object (__webpack_modules__)
  41. /******/ __webpack_require__.m = modules;
  42. /******/
  43. /******/ // expose the module cache
  44. /******/ __webpack_require__.c = installedModules;
  45. /******/
  46. /******/ // __webpack_public_path__
  47. /******/ __webpack_require__.p = "";
  48. /******/
  49. /******/ // Load entry module and return exports
  50. /******/ return __webpack_require__(0);
  51. /******/ })
  52. /************************************************************************/
  53. /******/ ([
  54. /* 0 */
  55. /***/ (function(module, exports, __webpack_require__) {
  56. /*
  57. * Copyright 2009-2011 Mozilla Foundation and contributors
  58. * Licensed under the New BSD license. See LICENSE.txt or:
  59. * http://opensource.org/licenses/BSD-3-Clause
  60. */
  61. exports.SourceMapGenerator = __webpack_require__(1).SourceMapGenerator;
  62. exports.SourceMapConsumer = __webpack_require__(7).SourceMapConsumer;
  63. exports.SourceNode = __webpack_require__(10).SourceNode;
  64. /***/ }),
  65. /* 1 */
  66. /***/ (function(module, exports, __webpack_require__) {
  67. /* -*- Mode: js; js-indent-level: 2; -*- */
  68. /*
  69. * Copyright 2011 Mozilla Foundation and contributors
  70. * Licensed under the New BSD license. See LICENSE or:
  71. * http://opensource.org/licenses/BSD-3-Clause
  72. */
  73. var base64VLQ = __webpack_require__(2);
  74. var util = __webpack_require__(4);
  75. var ArraySet = __webpack_require__(5).ArraySet;
  76. var MappingList = __webpack_require__(6).MappingList;
  77. /**
  78. * An instance of the SourceMapGenerator represents a source map which is
  79. * being built incrementally. You may pass an object with the following
  80. * properties:
  81. *
  82. * - file: The filename of the generated source.
  83. * - sourceRoot: A root for all relative URLs in this source map.
  84. */
  85. function SourceMapGenerator(aArgs) {
  86. if (!aArgs) {
  87. aArgs = {};
  88. }
  89. this._file = util.getArg(aArgs, 'file', null);
  90. this._sourceRoot = util.getArg(aArgs, 'sourceRoot', null);
  91. this._skipValidation = util.getArg(aArgs, 'skipValidation', false);
  92. this._sources = new ArraySet();
  93. this._names = new ArraySet();
  94. this._mappings = new MappingList();
  95. this._sourcesContents = null;
  96. }
  97. SourceMapGenerator.prototype._version = 3;
  98. /**
  99. * Creates a new SourceMapGenerator based on a SourceMapConsumer
  100. *
  101. * @param aSourceMapConsumer The SourceMap.
  102. */
  103. SourceMapGenerator.fromSourceMap =
  104. function SourceMapGenerator_fromSourceMap(aSourceMapConsumer) {
  105. var sourceRoot = aSourceMapConsumer.sourceRoot;
  106. var generator = new SourceMapGenerator({
  107. file: aSourceMapConsumer.file,
  108. sourceRoot: sourceRoot
  109. });
  110. aSourceMapConsumer.eachMapping(function (mapping) {
  111. var newMapping = {
  112. generated: {
  113. line: mapping.generatedLine,
  114. column: mapping.generatedColumn
  115. }
  116. };
  117. if (mapping.source != null) {
  118. newMapping.source = mapping.source;
  119. if (sourceRoot != null) {
  120. newMapping.source = util.relative(sourceRoot, newMapping.source);
  121. }
  122. newMapping.original = {
  123. line: mapping.originalLine,
  124. column: mapping.originalColumn
  125. };
  126. if (mapping.name != null) {
  127. newMapping.name = mapping.name;
  128. }
  129. }
  130. generator.addMapping(newMapping);
  131. });
  132. aSourceMapConsumer.sources.forEach(function (sourceFile) {
  133. var sourceRelative = sourceFile;
  134. if (sourceRoot !== null) {
  135. sourceRelative = util.relative(sourceRoot, sourceFile);
  136. }
  137. if (!generator._sources.has(sourceRelative)) {
  138. generator._sources.add(sourceRelative);
  139. }
  140. var content = aSourceMapConsumer.sourceContentFor(sourceFile);
  141. if (content != null) {
  142. generator.setSourceContent(sourceFile, content);
  143. }
  144. });
  145. return generator;
  146. };
  147. /**
  148. * Add a single mapping from original source line and column to the generated
  149. * source's line and column for this source map being created. The mapping
  150. * object should have the following properties:
  151. *
  152. * - generated: An object with the generated line and column positions.
  153. * - original: An object with the original line and column positions.
  154. * - source: The original source file (relative to the sourceRoot).
  155. * - name: An optional original token name for this mapping.
  156. */
  157. SourceMapGenerator.prototype.addMapping =
  158. function SourceMapGenerator_addMapping(aArgs) {
  159. var generated = util.getArg(aArgs, 'generated');
  160. var original = util.getArg(aArgs, 'original', null);
  161. var source = util.getArg(aArgs, 'source', null);
  162. var name = util.getArg(aArgs, 'name', null);
  163. if (!this._skipValidation) {
  164. this._validateMapping(generated, original, source, name);
  165. }
  166. if (source != null) {
  167. source = String(source);
  168. if (!this._sources.has(source)) {
  169. this._sources.add(source);
  170. }
  171. }
  172. if (name != null) {
  173. name = String(name);
  174. if (!this._names.has(name)) {
  175. this._names.add(name);
  176. }
  177. }
  178. this._mappings.add({
  179. generatedLine: generated.line,
  180. generatedColumn: generated.column,
  181. originalLine: original != null && original.line,
  182. originalColumn: original != null && original.column,
  183. source: source,
  184. name: name
  185. });
  186. };
  187. /**
  188. * Set the source content for a source file.
  189. */
  190. SourceMapGenerator.prototype.setSourceContent =
  191. function SourceMapGenerator_setSourceContent(aSourceFile, aSourceContent) {
  192. var source = aSourceFile;
  193. if (this._sourceRoot != null) {
  194. source = util.relative(this._sourceRoot, source);
  195. }
  196. if (aSourceContent != null) {
  197. // Add the source content to the _sourcesContents map.
  198. // Create a new _sourcesContents map if the property is null.
  199. if (!this._sourcesContents) {
  200. this._sourcesContents = Object.create(null);
  201. }
  202. this._sourcesContents[util.toSetString(source)] = aSourceContent;
  203. } else if (this._sourcesContents) {
  204. // Remove the source file from the _sourcesContents map.
  205. // If the _sourcesContents map is empty, set the property to null.
  206. delete this._sourcesContents[util.toSetString(source)];
  207. if (Object.keys(this._sourcesContents).length === 0) {
  208. this._sourcesContents = null;
  209. }
  210. }
  211. };
  212. /**
  213. * Applies the mappings of a sub-source-map for a specific source file to the
  214. * source map being generated. Each mapping to the supplied source file is
  215. * rewritten using the supplied source map. Note: The resolution for the
  216. * resulting mappings is the minimium of this map and the supplied map.
  217. *
  218. * @param aSourceMapConsumer The source map to be applied.
  219. * @param aSourceFile Optional. The filename of the source file.
  220. * If omitted, SourceMapConsumer's file property will be used.
  221. * @param aSourceMapPath Optional. The dirname of the path to the source map
  222. * to be applied. If relative, it is relative to the SourceMapConsumer.
  223. * This parameter is needed when the two source maps aren't in the same
  224. * directory, and the source map to be applied contains relative source
  225. * paths. If so, those relative source paths need to be rewritten
  226. * relative to the SourceMapGenerator.
  227. */
  228. SourceMapGenerator.prototype.applySourceMap =
  229. function SourceMapGenerator_applySourceMap(aSourceMapConsumer, aSourceFile, aSourceMapPath) {
  230. var sourceFile = aSourceFile;
  231. // If aSourceFile is omitted, we will use the file property of the SourceMap
  232. if (aSourceFile == null) {
  233. if (aSourceMapConsumer.file == null) {
  234. throw new Error(
  235. 'SourceMapGenerator.prototype.applySourceMap requires either an explicit source file, ' +
  236. 'or the source map\'s "file" property. Both were omitted.'
  237. );
  238. }
  239. sourceFile = aSourceMapConsumer.file;
  240. }
  241. var sourceRoot = this._sourceRoot;
  242. // Make "sourceFile" relative if an absolute Url is passed.
  243. if (sourceRoot != null) {
  244. sourceFile = util.relative(sourceRoot, sourceFile);
  245. }
  246. // Applying the SourceMap can add and remove items from the sources and
  247. // the names array.
  248. var newSources = new ArraySet();
  249. var newNames = new ArraySet();
  250. // Find mappings for the "sourceFile"
  251. this._mappings.unsortedForEach(function (mapping) {
  252. if (mapping.source === sourceFile && mapping.originalLine != null) {
  253. // Check if it can be mapped by the source map, then update the mapping.
  254. var original = aSourceMapConsumer.originalPositionFor({
  255. line: mapping.originalLine,
  256. column: mapping.originalColumn
  257. });
  258. if (original.source != null) {
  259. // Copy mapping
  260. mapping.source = original.source;
  261. if (aSourceMapPath != null) {
  262. mapping.source = util.join(aSourceMapPath, mapping.source)
  263. }
  264. if (sourceRoot != null) {
  265. mapping.source = util.relative(sourceRoot, mapping.source);
  266. }
  267. mapping.originalLine = original.line;
  268. mapping.originalColumn = original.column;
  269. if (original.name != null) {
  270. mapping.name = original.name;
  271. }
  272. }
  273. }
  274. var source = mapping.source;
  275. if (source != null && !newSources.has(source)) {
  276. newSources.add(source);
  277. }
  278. var name = mapping.name;
  279. if (name != null && !newNames.has(name)) {
  280. newNames.add(name);
  281. }
  282. }, this);
  283. this._sources = newSources;
  284. this._names = newNames;
  285. // Copy sourcesContents of applied map.
  286. aSourceMapConsumer.sources.forEach(function (sourceFile) {
  287. var content = aSourceMapConsumer.sourceContentFor(sourceFile);
  288. if (content != null) {
  289. if (aSourceMapPath != null) {
  290. sourceFile = util.join(aSourceMapPath, sourceFile);
  291. }
  292. if (sourceRoot != null) {
  293. sourceFile = util.relative(sourceRoot, sourceFile);
  294. }
  295. this.setSourceContent(sourceFile, content);
  296. }
  297. }, this);
  298. };
  299. /**
  300. * A mapping can have one of the three levels of data:
  301. *
  302. * 1. Just the generated position.
  303. * 2. The Generated position, original position, and original source.
  304. * 3. Generated and original position, original source, as well as a name
  305. * token.
  306. *
  307. * To maintain consistency, we validate that any new mapping being added falls
  308. * in to one of these categories.
  309. */
  310. SourceMapGenerator.prototype._validateMapping =
  311. function SourceMapGenerator_validateMapping(aGenerated, aOriginal, aSource,
  312. aName) {
  313. // When aOriginal is truthy but has empty values for .line and .column,
  314. // it is most likely a programmer error. In this case we throw a very
  315. // specific error message to try to guide them the right way.
  316. // For example: https://github.com/Polymer/polymer-bundler/pull/519
  317. if (aOriginal && typeof aOriginal.line !== 'number' && typeof aOriginal.column !== 'number') {
  318. throw new Error(
  319. 'original.line and original.column are not numbers -- you probably meant to omit ' +
  320. 'the original mapping entirely and only map the generated position. If so, pass ' +
  321. 'null for the original mapping instead of an object with empty or null values.'
  322. );
  323. }
  324. if (aGenerated && 'line' in aGenerated && 'column' in aGenerated
  325. && aGenerated.line > 0 && aGenerated.column >= 0
  326. && !aOriginal && !aSource && !aName) {
  327. // Case 1.
  328. return;
  329. }
  330. else if (aGenerated && 'line' in aGenerated && 'column' in aGenerated
  331. && aOriginal && 'line' in aOriginal && 'column' in aOriginal
  332. && aGenerated.line > 0 && aGenerated.column >= 0
  333. && aOriginal.line > 0 && aOriginal.column >= 0
  334. && aSource) {
  335. // Cases 2 and 3.
  336. return;
  337. }
  338. else {
  339. throw new Error('Invalid mapping: ' + JSON.stringify({
  340. generated: aGenerated,
  341. source: aSource,
  342. original: aOriginal,
  343. name: aName
  344. }));
  345. }
  346. };
  347. /**
  348. * Serialize the accumulated mappings in to the stream of base 64 VLQs
  349. * specified by the source map format.
  350. */
  351. SourceMapGenerator.prototype._serializeMappings =
  352. function SourceMapGenerator_serializeMappings() {
  353. var previousGeneratedColumn = 0;
  354. var previousGeneratedLine = 1;
  355. var previousOriginalColumn = 0;
  356. var previousOriginalLine = 0;
  357. var previousName = 0;
  358. var previousSource = 0;
  359. var result = '';
  360. var next;
  361. var mapping;
  362. var nameIdx;
  363. var sourceIdx;
  364. var mappings = this._mappings.toArray();
  365. for (var i = 0, len = mappings.length; i < len; i++) {
  366. mapping = mappings[i];
  367. next = ''
  368. if (mapping.generatedLine !== previousGeneratedLine) {
  369. previousGeneratedColumn = 0;
  370. while (mapping.generatedLine !== previousGeneratedLine) {
  371. next += ';';
  372. previousGeneratedLine++;
  373. }
  374. }
  375. else {
  376. if (i > 0) {
  377. if (!util.compareByGeneratedPositionsInflated(mapping, mappings[i - 1])) {
  378. continue;
  379. }
  380. next += ',';
  381. }
  382. }
  383. next += base64VLQ.encode(mapping.generatedColumn
  384. - previousGeneratedColumn);
  385. previousGeneratedColumn = mapping.generatedColumn;
  386. if (mapping.source != null) {
  387. sourceIdx = this._sources.indexOf(mapping.source);
  388. next += base64VLQ.encode(sourceIdx - previousSource);
  389. previousSource = sourceIdx;
  390. // lines are stored 0-based in SourceMap spec version 3
  391. next += base64VLQ.encode(mapping.originalLine - 1
  392. - previousOriginalLine);
  393. previousOriginalLine = mapping.originalLine - 1;
  394. next += base64VLQ.encode(mapping.originalColumn
  395. - previousOriginalColumn);
  396. previousOriginalColumn = mapping.originalColumn;
  397. if (mapping.name != null) {
  398. nameIdx = this._names.indexOf(mapping.name);
  399. next += base64VLQ.encode(nameIdx - previousName);
  400. previousName = nameIdx;
  401. }
  402. }
  403. result += next;
  404. }
  405. return result;
  406. };
  407. SourceMapGenerator.prototype._generateSourcesContent =
  408. function SourceMapGenerator_generateSourcesContent(aSources, aSourceRoot) {
  409. return aSources.map(function (source) {
  410. if (!this._sourcesContents) {
  411. return null;
  412. }
  413. if (aSourceRoot != null) {
  414. source = util.relative(aSourceRoot, source);
  415. }
  416. var key = util.toSetString(source);
  417. return Object.prototype.hasOwnProperty.call(this._sourcesContents, key)
  418. ? this._sourcesContents[key]
  419. : null;
  420. }, this);
  421. };
  422. /**
  423. * Externalize the source map.
  424. */
  425. SourceMapGenerator.prototype.toJSON =
  426. function SourceMapGenerator_toJSON() {
  427. var map = {
  428. version: this._version,
  429. sources: this._sources.toArray(),
  430. names: this._names.toArray(),
  431. mappings: this._serializeMappings()
  432. };
  433. if (this._file != null) {
  434. map.file = this._file;
  435. }
  436. if (this._sourceRoot != null) {
  437. map.sourceRoot = this._sourceRoot;
  438. }
  439. if (this._sourcesContents) {
  440. map.sourcesContent = this._generateSourcesContent(map.sources, map.sourceRoot);
  441. }
  442. return map;
  443. };
  444. /**
  445. * Render the source map being generated to a string.
  446. */
  447. SourceMapGenerator.prototype.toString =
  448. function SourceMapGenerator_toString() {
  449. return JSON.stringify(this.toJSON());
  450. };
  451. exports.SourceMapGenerator = SourceMapGenerator;
  452. /***/ }),
  453. /* 2 */
  454. /***/ (function(module, exports, __webpack_require__) {
  455. /* -*- Mode: js; js-indent-level: 2; -*- */
  456. /*
  457. * Copyright 2011 Mozilla Foundation and contributors
  458. * Licensed under the New BSD license. See LICENSE or:
  459. * http://opensource.org/licenses/BSD-3-Clause
  460. *
  461. * Based on the Base 64 VLQ implementation in Closure Compiler:
  462. * https://code.google.com/p/closure-compiler/source/browse/trunk/src/com/google/debugging/sourcemap/Base64VLQ.java
  463. *
  464. * Copyright 2011 The Closure Compiler Authors. All rights reserved.
  465. * Redistribution and use in source and binary forms, with or without
  466. * modification, are permitted provided that the following conditions are
  467. * met:
  468. *
  469. * * Redistributions of source code must retain the above copyright
  470. * notice, this list of conditions and the following disclaimer.
  471. * * Redistributions in binary form must reproduce the above
  472. * copyright notice, this list of conditions and the following
  473. * disclaimer in the documentation and/or other materials provided
  474. * with the distribution.
  475. * * Neither the name of Google Inc. nor the names of its
  476. * contributors may be used to endorse or promote products derived
  477. * from this software without specific prior written permission.
  478. *
  479. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  480. * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  481. * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  482. * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  483. * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  484. * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  485. * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  486. * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  487. * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  488. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  489. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  490. */
  491. var base64 = __webpack_require__(3);
  492. // A single base 64 digit can contain 6 bits of data. For the base 64 variable
  493. // length quantities we use in the source map spec, the first bit is the sign,
  494. // the next four bits are the actual value, and the 6th bit is the
  495. // continuation bit. The continuation bit tells us whether there are more
  496. // digits in this value following this digit.
  497. //
  498. // Continuation
  499. // | Sign
  500. // | |
  501. // V V
  502. // 101011
  503. var VLQ_BASE_SHIFT = 5;
  504. // binary: 100000
  505. var VLQ_BASE = 1 << VLQ_BASE_SHIFT;
  506. // binary: 011111
  507. var VLQ_BASE_MASK = VLQ_BASE - 1;
  508. // binary: 100000
  509. var VLQ_CONTINUATION_BIT = VLQ_BASE;
  510. /**
  511. * Converts from a two-complement value to a value where the sign bit is
  512. * placed in the least significant bit. For example, as decimals:
  513. * 1 becomes 2 (10 binary), -1 becomes 3 (11 binary)
  514. * 2 becomes 4 (100 binary), -2 becomes 5 (101 binary)
  515. */
  516. function toVLQSigned(aValue) {
  517. return aValue < 0
  518. ? ((-aValue) << 1) + 1
  519. : (aValue << 1) + 0;
  520. }
  521. /**
  522. * Converts to a two-complement value from a value where the sign bit is
  523. * placed in the least significant bit. For example, as decimals:
  524. * 2 (10 binary) becomes 1, 3 (11 binary) becomes -1
  525. * 4 (100 binary) becomes 2, 5 (101 binary) becomes -2
  526. */
  527. function fromVLQSigned(aValue) {
  528. var isNegative = (aValue & 1) === 1;
  529. var shifted = aValue >> 1;
  530. return isNegative
  531. ? -shifted
  532. : shifted;
  533. }
  534. /**
  535. * Returns the base 64 VLQ encoded value.
  536. */
  537. exports.encode = function base64VLQ_encode(aValue) {
  538. var encoded = "";
  539. var digit;
  540. var vlq = toVLQSigned(aValue);
  541. do {
  542. digit = vlq & VLQ_BASE_MASK;
  543. vlq >>>= VLQ_BASE_SHIFT;
  544. if (vlq > 0) {
  545. // There are still more digits in this value, so we must make sure the
  546. // continuation bit is marked.
  547. digit |= VLQ_CONTINUATION_BIT;
  548. }
  549. encoded += base64.encode(digit);
  550. } while (vlq > 0);
  551. return encoded;
  552. };
  553. /**
  554. * Decodes the next base 64 VLQ value from the given string and returns the
  555. * value and the rest of the string via the out parameter.
  556. */
  557. exports.decode = function base64VLQ_decode(aStr, aIndex, aOutParam) {
  558. var strLen = aStr.length;
  559. var result = 0;
  560. var shift = 0;
  561. var continuation, digit;
  562. do {
  563. if (aIndex >= strLen) {
  564. throw new Error("Expected more digits in base 64 VLQ value.");
  565. }
  566. digit = base64.decode(aStr.charCodeAt(aIndex++));
  567. if (digit === -1) {
  568. throw new Error("Invalid base64 digit: " + aStr.charAt(aIndex - 1));
  569. }
  570. continuation = !!(digit & VLQ_CONTINUATION_BIT);
  571. digit &= VLQ_BASE_MASK;
  572. result = result + (digit << shift);
  573. shift += VLQ_BASE_SHIFT;
  574. } while (continuation);
  575. aOutParam.value = fromVLQSigned(result);
  576. aOutParam.rest = aIndex;
  577. };
  578. /***/ }),
  579. /* 3 */
  580. /***/ (function(module, exports) {
  581. /* -*- Mode: js; js-indent-level: 2; -*- */
  582. /*
  583. * Copyright 2011 Mozilla Foundation and contributors
  584. * Licensed under the New BSD license. See LICENSE or:
  585. * http://opensource.org/licenses/BSD-3-Clause
  586. */
  587. var intToCharMap = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'.split('');
  588. /**
  589. * Encode an integer in the range of 0 to 63 to a single base 64 digit.
  590. */
  591. exports.encode = function (number) {
  592. if (0 <= number && number < intToCharMap.length) {
  593. return intToCharMap[number];
  594. }
  595. throw new TypeError("Must be between 0 and 63: " + number);
  596. };
  597. /**
  598. * Decode a single base 64 character code digit to an integer. Returns -1 on
  599. * failure.
  600. */
  601. exports.decode = function (charCode) {
  602. var bigA = 65; // 'A'
  603. var bigZ = 90; // 'Z'
  604. var littleA = 97; // 'a'
  605. var littleZ = 122; // 'z'
  606. var zero = 48; // '0'
  607. var nine = 57; // '9'
  608. var plus = 43; // '+'
  609. var slash = 47; // '/'
  610. var littleOffset = 26;
  611. var numberOffset = 52;
  612. // 0 - 25: ABCDEFGHIJKLMNOPQRSTUVWXYZ
  613. if (bigA <= charCode && charCode <= bigZ) {
  614. return (charCode - bigA);
  615. }
  616. // 26 - 51: abcdefghijklmnopqrstuvwxyz
  617. if (littleA <= charCode && charCode <= littleZ) {
  618. return (charCode - littleA + littleOffset);
  619. }
  620. // 52 - 61: 0123456789
  621. if (zero <= charCode && charCode <= nine) {
  622. return (charCode - zero + numberOffset);
  623. }
  624. // 62: +
  625. if (charCode == plus) {
  626. return 62;
  627. }
  628. // 63: /
  629. if (charCode == slash) {
  630. return 63;
  631. }
  632. // Invalid base64 digit.
  633. return -1;
  634. };
  635. /***/ }),
  636. /* 4 */
  637. /***/ (function(module, exports) {
  638. /* -*- Mode: js; js-indent-level: 2; -*- */
  639. /*
  640. * Copyright 2011 Mozilla Foundation and contributors
  641. * Licensed under the New BSD license. See LICENSE or:
  642. * http://opensource.org/licenses/BSD-3-Clause
  643. */
  644. /**
  645. * This is a helper function for getting values from parameter/options
  646. * objects.
  647. *
  648. * @param args The object we are extracting values from
  649. * @param name The name of the property we are getting.
  650. * @param defaultValue An optional value to return if the property is missing
  651. * from the object. If this is not specified and the property is missing, an
  652. * error will be thrown.
  653. */
  654. function getArg(aArgs, aName, aDefaultValue) {
  655. if (aName in aArgs) {
  656. return aArgs[aName];
  657. } else if (arguments.length === 3) {
  658. return aDefaultValue;
  659. } else {
  660. throw new Error('"' + aName + '" is a required argument.');
  661. }
  662. }
  663. exports.getArg = getArg;
  664. var urlRegexp = /^(?:([\w+\-.]+):)?\/\/(?:(\w+:\w+)@)?([\w.-]*)(?::(\d+))?(.*)$/;
  665. var dataUrlRegexp = /^data:.+\,.+$/;
  666. function urlParse(aUrl) {
  667. var match = aUrl.match(urlRegexp);
  668. if (!match) {
  669. return null;
  670. }
  671. return {
  672. scheme: match[1],
  673. auth: match[2],
  674. host: match[3],
  675. port: match[4],
  676. path: match[5]
  677. };
  678. }
  679. exports.urlParse = urlParse;
  680. function urlGenerate(aParsedUrl) {
  681. var url = '';
  682. if (aParsedUrl.scheme) {
  683. url += aParsedUrl.scheme + ':';
  684. }
  685. url += '//';
  686. if (aParsedUrl.auth) {
  687. url += aParsedUrl.auth + '@';
  688. }
  689. if (aParsedUrl.host) {
  690. url += aParsedUrl.host;
  691. }
  692. if (aParsedUrl.port) {
  693. url += ":" + aParsedUrl.port
  694. }
  695. if (aParsedUrl.path) {
  696. url += aParsedUrl.path;
  697. }
  698. return url;
  699. }
  700. exports.urlGenerate = urlGenerate;
  701. /**
  702. * Normalizes a path, or the path portion of a URL:
  703. *
  704. * - Replaces consecutive slashes with one slash.
  705. * - Removes unnecessary '.' parts.
  706. * - Removes unnecessary '<dir>/..' parts.
  707. *
  708. * Based on code in the Node.js 'path' core module.
  709. *
  710. * @param aPath The path or url to normalize.
  711. */
  712. function normalize(aPath) {
  713. var path = aPath;
  714. var url = urlParse(aPath);
  715. if (url) {
  716. if (!url.path) {
  717. return aPath;
  718. }
  719. path = url.path;
  720. }
  721. var isAbsolute = exports.isAbsolute(path);
  722. var parts = path.split(/\/+/);
  723. for (var part, up = 0, i = parts.length - 1; i >= 0; i--) {
  724. part = parts[i];
  725. if (part === '.') {
  726. parts.splice(i, 1);
  727. } else if (part === '..') {
  728. up++;
  729. } else if (up > 0) {
  730. if (part === '') {
  731. // The first part is blank if the path is absolute. Trying to go
  732. // above the root is a no-op. Therefore we can remove all '..' parts
  733. // directly after the root.
  734. parts.splice(i + 1, up);
  735. up = 0;
  736. } else {
  737. parts.splice(i, 2);
  738. up--;
  739. }
  740. }
  741. }
  742. path = parts.join('/');
  743. if (path === '') {
  744. path = isAbsolute ? '/' : '.';
  745. }
  746. if (url) {
  747. url.path = path;
  748. return urlGenerate(url);
  749. }
  750. return path;
  751. }
  752. exports.normalize = normalize;
  753. /**
  754. * Joins two paths/URLs.
  755. *
  756. * @param aRoot The root path or URL.
  757. * @param aPath The path or URL to be joined with the root.
  758. *
  759. * - If aPath is a URL or a data URI, aPath is returned, unless aPath is a
  760. * scheme-relative URL: Then the scheme of aRoot, if any, is prepended
  761. * first.
  762. * - Otherwise aPath is a path. If aRoot is a URL, then its path portion
  763. * is updated with the result and aRoot is returned. Otherwise the result
  764. * is returned.
  765. * - If aPath is absolute, the result is aPath.
  766. * - Otherwise the two paths are joined with a slash.
  767. * - Joining for example 'http://' and 'www.example.com' is also supported.
  768. */
  769. function join(aRoot, aPath) {
  770. if (aRoot === "") {
  771. aRoot = ".";
  772. }
  773. if (aPath === "") {
  774. aPath = ".";
  775. }
  776. var aPathUrl = urlParse(aPath);
  777. var aRootUrl = urlParse(aRoot);
  778. if (aRootUrl) {
  779. aRoot = aRootUrl.path || '/';
  780. }
  781. // `join(foo, '//www.example.org')`
  782. if (aPathUrl && !aPathUrl.scheme) {
  783. if (aRootUrl) {
  784. aPathUrl.scheme = aRootUrl.scheme;
  785. }
  786. return urlGenerate(aPathUrl);
  787. }
  788. if (aPathUrl || aPath.match(dataUrlRegexp)) {
  789. return aPath;
  790. }
  791. // `join('http://', 'www.example.com')`
  792. if (aRootUrl && !aRootUrl.host && !aRootUrl.path) {
  793. aRootUrl.host = aPath;
  794. return urlGenerate(aRootUrl);
  795. }
  796. var joined = aPath.charAt(0) === '/'
  797. ? aPath
  798. : normalize(aRoot.replace(/\/+$/, '') + '/' + aPath);
  799. if (aRootUrl) {
  800. aRootUrl.path = joined;
  801. return urlGenerate(aRootUrl);
  802. }
  803. return joined;
  804. }
  805. exports.join = join;
  806. exports.isAbsolute = function (aPath) {
  807. return aPath.charAt(0) === '/' || urlRegexp.test(aPath);
  808. };
  809. /**
  810. * Make a path relative to a URL or another path.
  811. *
  812. * @param aRoot The root path or URL.
  813. * @param aPath The path or URL to be made relative to aRoot.
  814. */
  815. function relative(aRoot, aPath) {
  816. if (aRoot === "") {
  817. aRoot = ".";
  818. }
  819. aRoot = aRoot.replace(/\/$/, '');
  820. // It is possible for the path to be above the root. In this case, simply
  821. // checking whether the root is a prefix of the path won't work. Instead, we
  822. // need to remove components from the root one by one, until either we find
  823. // a prefix that fits, or we run out of components to remove.
  824. var level = 0;
  825. while (aPath.indexOf(aRoot + '/') !== 0) {
  826. var index = aRoot.lastIndexOf("/");
  827. if (index < 0) {
  828. return aPath;
  829. }
  830. // If the only part of the root that is left is the scheme (i.e. http://,
  831. // file:///, etc.), one or more slashes (/), or simply nothing at all, we
  832. // have exhausted all components, so the path is not relative to the root.
  833. aRoot = aRoot.slice(0, index);
  834. if (aRoot.match(/^([^\/]+:\/)?\/*$/)) {
  835. return aPath;
  836. }
  837. ++level;
  838. }
  839. // Make sure we add a "../" for each component we removed from the root.
  840. return Array(level + 1).join("../") + aPath.substr(aRoot.length + 1);
  841. }
  842. exports.relative = relative;
  843. var supportsNullProto = (function () {
  844. var obj = Object.create(null);
  845. return !('__proto__' in obj);
  846. }());
  847. function identity (s) {
  848. return s;
  849. }
  850. /**
  851. * Because behavior goes wacky when you set `__proto__` on objects, we
  852. * have to prefix all the strings in our set with an arbitrary character.
  853. *
  854. * See https://github.com/mozilla/source-map/pull/31 and
  855. * https://github.com/mozilla/source-map/issues/30
  856. *
  857. * @param String aStr
  858. */
  859. function toSetString(aStr) {
  860. if (isProtoString(aStr)) {
  861. return '$' + aStr;
  862. }
  863. return aStr;
  864. }
  865. exports.toSetString = supportsNullProto ? identity : toSetString;
  866. function fromSetString(aStr) {
  867. if (isProtoString(aStr)) {
  868. return aStr.slice(1);
  869. }
  870. return aStr;
  871. }
  872. exports.fromSetString = supportsNullProto ? identity : fromSetString;
  873. function isProtoString(s) {
  874. if (!s) {
  875. return false;
  876. }
  877. var length = s.length;
  878. if (length < 9 /* "__proto__".length */) {
  879. return false;
  880. }
  881. if (s.charCodeAt(length - 1) !== 95 /* '_' */ ||
  882. s.charCodeAt(length - 2) !== 95 /* '_' */ ||
  883. s.charCodeAt(length - 3) !== 111 /* 'o' */ ||
  884. s.charCodeAt(length - 4) !== 116 /* 't' */ ||
  885. s.charCodeAt(length - 5) !== 111 /* 'o' */ ||
  886. s.charCodeAt(length - 6) !== 114 /* 'r' */ ||
  887. s.charCodeAt(length - 7) !== 112 /* 'p' */ ||
  888. s.charCodeAt(length - 8) !== 95 /* '_' */ ||
  889. s.charCodeAt(length - 9) !== 95 /* '_' */) {
  890. return false;
  891. }
  892. for (var i = length - 10; i >= 0; i--) {
  893. if (s.charCodeAt(i) !== 36 /* '$' */) {
  894. return false;
  895. }
  896. }
  897. return true;
  898. }
  899. /**
  900. * Comparator between two mappings where the original positions are compared.
  901. *
  902. * Optionally pass in `true` as `onlyCompareGenerated` to consider two
  903. * mappings with the same original source/line/column, but different generated
  904. * line and column the same. Useful when searching for a mapping with a
  905. * stubbed out mapping.
  906. */
  907. function compareByOriginalPositions(mappingA, mappingB, onlyCompareOriginal) {
  908. var cmp = strcmp(mappingA.source, mappingB.source);
  909. if (cmp !== 0) {
  910. return cmp;
  911. }
  912. cmp = mappingA.originalLine - mappingB.originalLine;
  913. if (cmp !== 0) {
  914. return cmp;
  915. }
  916. cmp = mappingA.originalColumn - mappingB.originalColumn;
  917. if (cmp !== 0 || onlyCompareOriginal) {
  918. return cmp;
  919. }
  920. cmp = mappingA.generatedColumn - mappingB.generatedColumn;
  921. if (cmp !== 0) {
  922. return cmp;
  923. }
  924. cmp = mappingA.generatedLine - mappingB.generatedLine;
  925. if (cmp !== 0) {
  926. return cmp;
  927. }
  928. return strcmp(mappingA.name, mappingB.name);
  929. }
  930. exports.compareByOriginalPositions = compareByOriginalPositions;
  931. /**
  932. * Comparator between two mappings with deflated source and name indices where
  933. * the generated positions are compared.
  934. *
  935. * Optionally pass in `true` as `onlyCompareGenerated` to consider two
  936. * mappings with the same generated line and column, but different
  937. * source/name/original line and column the same. Useful when searching for a
  938. * mapping with a stubbed out mapping.
  939. */
  940. function compareByGeneratedPositionsDeflated(mappingA, mappingB, onlyCompareGenerated) {
  941. var cmp = mappingA.generatedLine - mappingB.generatedLine;
  942. if (cmp !== 0) {
  943. return cmp;
  944. }
  945. cmp = mappingA.generatedColumn - mappingB.generatedColumn;
  946. if (cmp !== 0 || onlyCompareGenerated) {
  947. return cmp;
  948. }
  949. cmp = strcmp(mappingA.source, mappingB.source);
  950. if (cmp !== 0) {
  951. return cmp;
  952. }
  953. cmp = mappingA.originalLine - mappingB.originalLine;
  954. if (cmp !== 0) {
  955. return cmp;
  956. }
  957. cmp = mappingA.originalColumn - mappingB.originalColumn;
  958. if (cmp !== 0) {
  959. return cmp;
  960. }
  961. return strcmp(mappingA.name, mappingB.name);
  962. }
  963. exports.compareByGeneratedPositionsDeflated = compareByGeneratedPositionsDeflated;
  964. function strcmp(aStr1, aStr2) {
  965. if (aStr1 === aStr2) {
  966. return 0;
  967. }
  968. if (aStr1 === null) {
  969. return 1; // aStr2 !== null
  970. }
  971. if (aStr2 === null) {
  972. return -1; // aStr1 !== null
  973. }
  974. if (aStr1 > aStr2) {
  975. return 1;
  976. }
  977. return -1;
  978. }
  979. /**
  980. * Comparator between two mappings with inflated source and name strings where
  981. * the generated positions are compared.
  982. */
  983. function compareByGeneratedPositionsInflated(mappingA, mappingB) {
  984. var cmp = mappingA.generatedLine - mappingB.generatedLine;
  985. if (cmp !== 0) {
  986. return cmp;
  987. }
  988. cmp = mappingA.generatedColumn - mappingB.generatedColumn;
  989. if (cmp !== 0) {
  990. return cmp;
  991. }
  992. cmp = strcmp(mappingA.source, mappingB.source);
  993. if (cmp !== 0) {
  994. return cmp;
  995. }
  996. cmp = mappingA.originalLine - mappingB.originalLine;
  997. if (cmp !== 0) {
  998. return cmp;
  999. }
  1000. cmp = mappingA.originalColumn - mappingB.originalColumn;
  1001. if (cmp !== 0) {
  1002. return cmp;
  1003. }
  1004. return strcmp(mappingA.name, mappingB.name);
  1005. }
  1006. exports.compareByGeneratedPositionsInflated = compareByGeneratedPositionsInflated;
  1007. /**
  1008. * Strip any JSON XSSI avoidance prefix from the string (as documented
  1009. * in the source maps specification), and then parse the string as
  1010. * JSON.
  1011. */
  1012. function parseSourceMapInput(str) {
  1013. return JSON.parse(str.replace(/^\)]}'[^\n]*\n/, ''));
  1014. }
  1015. exports.parseSourceMapInput = parseSourceMapInput;
  1016. /**
  1017. * Compute the URL of a source given the the source root, the source's
  1018. * URL, and the source map's URL.
  1019. */
  1020. function computeSourceURL(sourceRoot, sourceURL, sourceMapURL) {
  1021. sourceURL = sourceURL || '';
  1022. if (sourceRoot) {
  1023. // This follows what Chrome does.
  1024. if (sourceRoot[sourceRoot.length - 1] !== '/' && sourceURL[0] !== '/') {
  1025. sourceRoot += '/';
  1026. }
  1027. // The spec says:
  1028. // Line 4: An optional source root, useful for relocating source
  1029. // files on a server or removing repeated values in the
  1030. // “sources” entry. This value is prepended to the individual
  1031. // entries in the “source” field.
  1032. sourceURL = sourceRoot + sourceURL;
  1033. }
  1034. // Historically, SourceMapConsumer did not take the sourceMapURL as
  1035. // a parameter. This mode is still somewhat supported, which is why
  1036. // this code block is conditional. However, it's preferable to pass
  1037. // the source map URL to SourceMapConsumer, so that this function
  1038. // can implement the source URL resolution algorithm as outlined in
  1039. // the spec. This block is basically the equivalent of:
  1040. // new URL(sourceURL, sourceMapURL).toString()
  1041. // ... except it avoids using URL, which wasn't available in the
  1042. // older releases of node still supported by this library.
  1043. //
  1044. // The spec says:
  1045. // If the sources are not absolute URLs after prepending of the
  1046. // “sourceRoot”, the sources are resolved relative to the
  1047. // SourceMap (like resolving script src in a html document).
  1048. if (sourceMapURL) {
  1049. var parsed = urlParse(sourceMapURL);
  1050. if (!parsed) {
  1051. throw new Error("sourceMapURL could not be parsed");
  1052. }
  1053. if (parsed.path) {
  1054. // Strip the last path component, but keep the "/".
  1055. var index = parsed.path.lastIndexOf('/');
  1056. if (index >= 0) {
  1057. parsed.path = parsed.path.substring(0, index + 1);
  1058. }
  1059. }
  1060. sourceURL = join(urlGenerate(parsed), sourceURL);
  1061. }
  1062. return normalize(sourceURL);
  1063. }
  1064. exports.computeSourceURL = computeSourceURL;
  1065. /***/ }),
  1066. /* 5 */
  1067. /***/ (function(module, exports, __webpack_require__) {
  1068. /* -*- Mode: js; js-indent-level: 2; -*- */
  1069. /*
  1070. * Copyright 2011 Mozilla Foundation and contributors
  1071. * Licensed under the New BSD license. See LICENSE or:
  1072. * http://opensource.org/licenses/BSD-3-Clause
  1073. */
  1074. var util = __webpack_require__(4);
  1075. var has = Object.prototype.hasOwnProperty;
  1076. var hasNativeMap = typeof Map !== "undefined";
  1077. /**
  1078. * A data structure which is a combination of an array and a set. Adding a new
  1079. * member is O(1), testing for membership is O(1), and finding the index of an
  1080. * element is O(1). Removing elements from the set is not supported. Only
  1081. * strings are supported for membership.
  1082. */
  1083. function ArraySet() {
  1084. this._array = [];
  1085. this._set = hasNativeMap ? new Map() : Object.create(null);
  1086. }
  1087. /**
  1088. * Static method for creating ArraySet instances from an existing array.
  1089. */
  1090. ArraySet.fromArray = function ArraySet_fromArray(aArray, aAllowDuplicates) {
  1091. var set = new ArraySet();
  1092. for (var i = 0, len = aArray.length; i < len; i++) {
  1093. set.add(aArray[i], aAllowDuplicates);
  1094. }
  1095. return set;
  1096. };
  1097. /**
  1098. * Return how many unique items are in this ArraySet. If duplicates have been
  1099. * added, than those do not count towards the size.
  1100. *
  1101. * @returns Number
  1102. */
  1103. ArraySet.prototype.size = function ArraySet_size() {
  1104. return hasNativeMap ? this._set.size : Object.getOwnPropertyNames(this._set).length;
  1105. };
  1106. /**
  1107. * Add the given string to this set.
  1108. *
  1109. * @param String aStr
  1110. */
  1111. ArraySet.prototype.add = function ArraySet_add(aStr, aAllowDuplicates) {
  1112. var sStr = hasNativeMap ? aStr : util.toSetString(aStr);
  1113. var isDuplicate = hasNativeMap ? this.has(aStr) : has.call(this._set, sStr);
  1114. var idx = this._array.length;
  1115. if (!isDuplicate || aAllowDuplicates) {
  1116. this._array.push(aStr);
  1117. }
  1118. if (!isDuplicate) {
  1119. if (hasNativeMap) {
  1120. this._set.set(aStr, idx);
  1121. } else {
  1122. this._set[sStr] = idx;
  1123. }
  1124. }
  1125. };
  1126. /**
  1127. * Is the given string a member of this set?
  1128. *
  1129. * @param String aStr
  1130. */
  1131. ArraySet.prototype.has = function ArraySet_has(aStr) {
  1132. if (hasNativeMap) {
  1133. return this._set.has(aStr);
  1134. } else {
  1135. var sStr = util.toSetString(aStr);
  1136. return has.call(this._set, sStr);
  1137. }
  1138. };
  1139. /**
  1140. * What is the index of the given string in the array?
  1141. *
  1142. * @param String aStr
  1143. */
  1144. ArraySet.prototype.indexOf = function ArraySet_indexOf(aStr) {
  1145. if (hasNativeMap) {
  1146. var idx = this._set.get(aStr);
  1147. if (idx >= 0) {
  1148. return idx;
  1149. }
  1150. } else {
  1151. var sStr = util.toSetString(aStr);
  1152. if (has.call(this._set, sStr)) {
  1153. return this._set[sStr];
  1154. }
  1155. }
  1156. throw new Error('"' + aStr + '" is not in the set.');
  1157. };
  1158. /**
  1159. * What is the element at the given index?
  1160. *
  1161. * @param Number aIdx
  1162. */
  1163. ArraySet.prototype.at = function ArraySet_at(aIdx) {
  1164. if (aIdx >= 0 && aIdx < this._array.length) {
  1165. return this._array[aIdx];
  1166. }
  1167. throw new Error('No element indexed by ' + aIdx);
  1168. };
  1169. /**
  1170. * Returns the array representation of this set (which has the proper indices
  1171. * indicated by indexOf). Note that this is a copy of the internal array used
  1172. * for storing the members so that no one can mess with internal state.
  1173. */
  1174. ArraySet.prototype.toArray = function ArraySet_toArray() {
  1175. return this._array.slice();
  1176. };
  1177. exports.ArraySet = ArraySet;
  1178. /***/ }),
  1179. /* 6 */
  1180. /***/ (function(module, exports, __webpack_require__) {
  1181. /* -*- Mode: js; js-indent-level: 2; -*- */
  1182. /*
  1183. * Copyright 2014 Mozilla Foundation and contributors
  1184. * Licensed under the New BSD license. See LICENSE or:
  1185. * http://opensource.org/licenses/BSD-3-Clause
  1186. */
  1187. var util = __webpack_require__(4);
  1188. /**
  1189. * Determine whether mappingB is after mappingA with respect to generated
  1190. * position.
  1191. */
  1192. function generatedPositionAfter(mappingA, mappingB) {
  1193. // Optimized for most common case
  1194. var lineA = mappingA.generatedLine;
  1195. var lineB = mappingB.generatedLine;
  1196. var columnA = mappingA.generatedColumn;
  1197. var columnB = mappingB.generatedColumn;
  1198. return lineB > lineA || lineB == lineA && columnB >= columnA ||
  1199. util.compareByGeneratedPositionsInflated(mappingA, mappingB) <= 0;
  1200. }
  1201. /**
  1202. * A data structure to provide a sorted view of accumulated mappings in a
  1203. * performance conscious manner. It trades a neglibable overhead in general
  1204. * case for a large speedup in case of mappings being added in order.
  1205. */
  1206. function MappingList() {
  1207. this._array = [];
  1208. this._sorted = true;
  1209. // Serves as infimum
  1210. this._last = {generatedLine: -1, generatedColumn: 0};
  1211. }
  1212. /**
  1213. * Iterate through internal items. This method takes the same arguments that
  1214. * `Array.prototype.forEach` takes.
  1215. *
  1216. * NOTE: The order of the mappings is NOT guaranteed.
  1217. */
  1218. MappingList.prototype.unsortedForEach =
  1219. function MappingList_forEach(aCallback, aThisArg) {
  1220. this._array.forEach(aCallback, aThisArg);
  1221. };
  1222. /**
  1223. * Add the given source mapping.
  1224. *
  1225. * @param Object aMapping
  1226. */
  1227. MappingList.prototype.add = function MappingList_add(aMapping) {
  1228. if (generatedPositionAfter(this._last, aMapping)) {
  1229. this._last = aMapping;
  1230. this._array.push(aMapping);
  1231. } else {
  1232. this._sorted = false;
  1233. this._array.push(aMapping);
  1234. }
  1235. };
  1236. /**
  1237. * Returns the flat, sorted array of mappings. The mappings are sorted by
  1238. * generated position.
  1239. *
  1240. * WARNING: This method returns internal data without copying, for
  1241. * performance. The return value must NOT be mutated, and should be treated as
  1242. * an immutable borrow. If you want to take ownership, you must make your own
  1243. * copy.
  1244. */
  1245. MappingList.prototype.toArray = function MappingList_toArray() {
  1246. if (!this._sorted) {
  1247. this._array.sort(util.compareByGeneratedPositionsInflated);
  1248. this._sorted = true;
  1249. }
  1250. return this._array;
  1251. };
  1252. exports.MappingList = MappingList;
  1253. /***/ }),
  1254. /* 7 */
  1255. /***/ (function(module, exports, __webpack_require__) {
  1256. /* -*- Mode: js; js-indent-level: 2; -*- */
  1257. /*
  1258. * Copyright 2011 Mozilla Foundation and contributors
  1259. * Licensed under the New BSD license. See LICENSE or:
  1260. * http://opensource.org/licenses/BSD-3-Clause
  1261. */
  1262. var util = __webpack_require__(4);
  1263. var binarySearch = __webpack_require__(8);
  1264. var ArraySet = __webpack_require__(5).ArraySet;
  1265. var base64VLQ = __webpack_require__(2);
  1266. var quickSort = __webpack_require__(9).quickSort;
  1267. function SourceMapConsumer(aSourceMap, aSourceMapURL) {
  1268. var sourceMap = aSourceMap;
  1269. if (typeof aSourceMap === 'string') {
  1270. sourceMap = util.parseSourceMapInput(aSourceMap);
  1271. }
  1272. return sourceMap.sections != null
  1273. ? new IndexedSourceMapConsumer(sourceMap, aSourceMapURL)
  1274. : new BasicSourceMapConsumer(sourceMap, aSourceMapURL);
  1275. }
  1276. SourceMapConsumer.fromSourceMap = function(aSourceMap, aSourceMapURL) {
  1277. return BasicSourceMapConsumer.fromSourceMap(aSourceMap, aSourceMapURL);
  1278. }
  1279. /**
  1280. * The version of the source mapping spec that we are consuming.
  1281. */
  1282. SourceMapConsumer.prototype._version = 3;
  1283. // `__generatedMappings` and `__originalMappings` are arrays that hold the
  1284. // parsed mapping coordinates from the source map's "mappings" attribute. They
  1285. // are lazily instantiated, accessed via the `_generatedMappings` and
  1286. // `_originalMappings` getters respectively, and we only parse the mappings
  1287. // and create these arrays once queried for a source location. We jump through
  1288. // these hoops because there can be many thousands of mappings, and parsing
  1289. // them is expensive, so we only want to do it if we must.
  1290. //
  1291. // Each object in the arrays is of the form:
  1292. //
  1293. // {
  1294. // generatedLine: The line number in the generated code,
  1295. // generatedColumn: The column number in the generated code,
  1296. // source: The path to the original source file that generated this
  1297. // chunk of code,
  1298. // originalLine: The line number in the original source that
  1299. // corresponds to this chunk of generated code,
  1300. // originalColumn: The column number in the original source that
  1301. // corresponds to this chunk of generated code,
  1302. // name: The name of the original symbol which generated this chunk of
  1303. // code.
  1304. // }
  1305. //
  1306. // All properties except for `generatedLine` and `generatedColumn` can be
  1307. // `null`.
  1308. //
  1309. // `_generatedMappings` is ordered by the generated positions.
  1310. //
  1311. // `_originalMappings` is ordered by the original positions.
  1312. SourceMapConsumer.prototype.__generatedMappings = null;
  1313. Object.defineProperty(SourceMapConsumer.prototype, '_generatedMappings', {
  1314. configurable: true,
  1315. enumerable: true,
  1316. get: function () {
  1317. if (!this.__generatedMappings) {
  1318. this._parseMappings(this._mappings, this.sourceRoot);
  1319. }
  1320. return this.__generatedMappings;
  1321. }
  1322. });
  1323. SourceMapConsumer.prototype.__originalMappings = null;
  1324. Object.defineProperty(SourceMapConsumer.prototype, '_originalMappings', {
  1325. configurable: true,
  1326. enumerable: true,
  1327. get: function () {
  1328. if (!this.__originalMappings) {
  1329. this._parseMappings(this._mappings, this.sourceRoot);
  1330. }
  1331. return this.__originalMappings;
  1332. }
  1333. });
  1334. SourceMapConsumer.prototype._charIsMappingSeparator =
  1335. function SourceMapConsumer_charIsMappingSeparator(aStr, index) {
  1336. var c = aStr.charAt(index);
  1337. return c === ";" || c === ",";
  1338. };
  1339. /**
  1340. * Parse the mappings in a string in to a data structure which we can easily
  1341. * query (the ordered arrays in the `this.__generatedMappings` and
  1342. * `this.__originalMappings` properties).
  1343. */
  1344. SourceMapConsumer.prototype._parseMappings =
  1345. function SourceMapConsumer_parseMappings(aStr, aSourceRoot) {
  1346. throw new Error("Subclasses must implement _parseMappings");
  1347. };
  1348. SourceMapConsumer.GENERATED_ORDER = 1;
  1349. SourceMapConsumer.ORIGINAL_ORDER = 2;
  1350. SourceMapConsumer.GREATEST_LOWER_BOUND = 1;
  1351. SourceMapConsumer.LEAST_UPPER_BOUND = 2;
  1352. /**
  1353. * Iterate over each mapping between an original source/line/column and a
  1354. * generated line/column in this source map.
  1355. *
  1356. * @param Function aCallback
  1357. * The function that is called with each mapping.
  1358. * @param Object aContext
  1359. * Optional. If specified, this object will be the value of `this` every
  1360. * time that `aCallback` is called.
  1361. * @param aOrder
  1362. * Either `SourceMapConsumer.GENERATED_ORDER` or
  1363. * `SourceMapConsumer.ORIGINAL_ORDER`. Specifies whether you want to
  1364. * iterate over the mappings sorted by the generated file's line/column
  1365. * order or the original's source/line/column order, respectively. Defaults to
  1366. * `SourceMapConsumer.GENERATED_ORDER`.
  1367. */
  1368. SourceMapConsumer.prototype.eachMapping =
  1369. function SourceMapConsumer_eachMapping(aCallback, aContext, aOrder) {
  1370. var context = aContext || null;
  1371. var order = aOrder || SourceMapConsumer.GENERATED_ORDER;
  1372. var mappings;
  1373. switch (order) {
  1374. case SourceMapConsumer.GENERATED_ORDER:
  1375. mappings = this._generatedMappings;
  1376. break;
  1377. case SourceMapConsumer.ORIGINAL_ORDER:
  1378. mappings = this._originalMappings;
  1379. break;
  1380. default:
  1381. throw new Error("Unknown order of iteration.");
  1382. }
  1383. var sourceRoot = this.sourceRoot;
  1384. mappings.map(function (mapping) {
  1385. var source = mapping.source === null ? null : this._sources.at(mapping.source);
  1386. source = util.computeSourceURL(sourceRoot, source, this._sourceMapURL);
  1387. return {
  1388. source: source,
  1389. generatedLine: mapping.generatedLine,
  1390. generatedColumn: mapping.generatedColumn,
  1391. originalLine: mapping.originalLine,
  1392. originalColumn: mapping.originalColumn,
  1393. name: mapping.name === null ? null : this._names.at(mapping.name)
  1394. };
  1395. }, this).forEach(aCallback, context);
  1396. };
  1397. /**
  1398. * Returns all generated line and column information for the original source,
  1399. * line, and column provided. If no column is provided, returns all mappings
  1400. * corresponding to a either the line we are searching for or the next
  1401. * closest line that has any mappings. Otherwise, returns all mappings
  1402. * corresponding to the given line and either the column we are searching for
  1403. * or the next closest column that has any offsets.
  1404. *
  1405. * The only argument is an object with the following properties:
  1406. *
  1407. * - source: The filename of the original source.
  1408. * - line: The line number in the original source. The line number is 1-based.
  1409. * - column: Optional. the column number in the original source.
  1410. * The column number is 0-based.
  1411. *
  1412. * and an array of objects is returned, each with the following properties:
  1413. *
  1414. * - line: The line number in the generated source, or null. The
  1415. * line number is 1-based.
  1416. * - column: The column number in the generated source, or null.
  1417. * The column number is 0-based.
  1418. */
  1419. SourceMapConsumer.prototype.allGeneratedPositionsFor =
  1420. function SourceMapConsumer_allGeneratedPositionsFor(aArgs) {
  1421. var line = util.getArg(aArgs, 'line');
  1422. // When there is no exact match, BasicSourceMapConsumer.prototype._findMapping
  1423. // returns the index of the closest mapping less than the needle. By
  1424. // setting needle.originalColumn to 0, we thus find the last mapping for
  1425. // the given line, provided such a mapping exists.
  1426. var needle = {
  1427. source: util.getArg(aArgs, 'source'),
  1428. originalLine: line,
  1429. originalColumn: util.getArg(aArgs, 'column', 0)
  1430. };
  1431. needle.source = this._findSourceIndex(needle.source);
  1432. if (needle.source < 0) {
  1433. return [];
  1434. }
  1435. var mappings = [];
  1436. var index = this._findMapping(needle,
  1437. this._originalMappings,
  1438. "originalLine",
  1439. "originalColumn",
  1440. util.compareByOriginalPositions,
  1441. binarySearch.LEAST_UPPER_BOUND);
  1442. if (index >= 0) {
  1443. var mapping = this._originalMappings[index];
  1444. if (aArgs.column === undefined) {
  1445. var originalLine = mapping.originalLine;
  1446. // Iterate until either we run out of mappings, or we run into
  1447. // a mapping for a different line than the one we found. Since
  1448. // mappings are sorted, this is guaranteed to find all mappings for
  1449. // the line we found.
  1450. while (mapping && mapping.originalLine === originalLine) {
  1451. mappings.push({
  1452. line: util.getArg(mapping, 'generatedLine', null),
  1453. column: util.getArg(mapping, 'generatedColumn', null),
  1454. lastColumn: util.getArg(mapping, 'lastGeneratedColumn', null)
  1455. });
  1456. mapping = this._originalMappings[++index];
  1457. }
  1458. } else {
  1459. var originalColumn = mapping.originalColumn;
  1460. // Iterate until either we run out of mappings, or we run into
  1461. // a mapping for a different line than the one we were searching for.
  1462. // Since mappings are sorted, this is guaranteed to find all mappings for
  1463. // the line we are searching for.
  1464. while (mapping &&
  1465. mapping.originalLine === line &&
  1466. mapping.originalColumn == originalColumn) {
  1467. mappings.push({
  1468. line: util.getArg(mapping, 'generatedLine', null),
  1469. column: util.getArg(mapping, 'generatedColumn', null),
  1470. lastColumn: util.getArg(mapping, 'lastGeneratedColumn', null)
  1471. });
  1472. mapping = this._originalMappings[++index];
  1473. }
  1474. }
  1475. }
  1476. return mappings;
  1477. };
  1478. exports.SourceMapConsumer = SourceMapConsumer;
  1479. /**
  1480. * A BasicSourceMapConsumer instance represents a parsed source map which we can
  1481. * query for information about the original file positions by giving it a file
  1482. * position in the generated source.
  1483. *
  1484. * The first parameter is the raw source map (either as a JSON string, or
  1485. * already parsed to an object). According to the spec, source maps have the
  1486. * following attributes:
  1487. *
  1488. * - version: Which version of the source map spec this map is following.
  1489. * - sources: An array of URLs to the original source files.
  1490. * - names: An array of identifiers which can be referrenced by individual mappings.
  1491. * - sourceRoot: Optional. The URL root from which all sources are relative.
  1492. * - sourcesContent: Optional. An array of contents of the original source files.
  1493. * - mappings: A string of base64 VLQs which contain the actual mappings.
  1494. * - file: Optional. The generated file this source map is associated with.
  1495. *
  1496. * Here is an example source map, taken from the source map spec[0]:
  1497. *
  1498. * {
  1499. * version : 3,
  1500. * file: "out.js",
  1501. * sourceRoot : "",
  1502. * sources: ["foo.js", "bar.js"],
  1503. * names: ["src", "maps", "are", "fun"],
  1504. * mappings: "AA,AB;;ABCDE;"
  1505. * }
  1506. *
  1507. * The second parameter, if given, is a string whose value is the URL
  1508. * at which the source map was found. This URL is used to compute the
  1509. * sources array.
  1510. *
  1511. * [0]: https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit?pli=1#
  1512. */
  1513. function BasicSourceMapConsumer(aSourceMap, aSourceMapURL) {
  1514. var sourceMap = aSourceMap;
  1515. if (typeof aSourceMap === 'string') {
  1516. sourceMap = util.parseSourceMapInput(aSourceMap);
  1517. }
  1518. var version = util.getArg(sourceMap, 'version');
  1519. var sources = util.getArg(sourceMap, 'sources');
  1520. // Sass 3.3 leaves out the 'names' array, so we deviate from the spec (which
  1521. // requires the array) to play nice here.
  1522. var names = util.getArg(sourceMap, 'names', []);
  1523. var sourceRoot = util.getArg(sourceMap, 'sourceRoot', null);
  1524. var sourcesContent = util.getArg(sourceMap, 'sourcesContent', null);
  1525. var mappings = util.getArg(sourceMap, 'mappings');
  1526. var file = util.getArg(sourceMap, 'file', null);
  1527. // Once again, Sass deviates from the spec and supplies the version as a
  1528. // string rather than a number, so we use loose equality checking here.
  1529. if (version != this._version) {
  1530. throw new Error('Unsupported version: ' + version);
  1531. }
  1532. if (sourceRoot) {
  1533. sourceRoot = util.normalize(sourceRoot);
  1534. }
  1535. sources = sources
  1536. .map(String)
  1537. // Some source maps produce relative source paths like "./foo.js" instead of
  1538. // "foo.js". Normalize these first so that future comparisons will succeed.
  1539. // See bugzil.la/1090768.
  1540. .map(util.normalize)
  1541. // Always ensure that absolute sources are internally stored relative to
  1542. // the source root, if the source root is absolute. Not doing this would
  1543. // be particularly problematic when the source root is a prefix of the
  1544. // source (valid, but why??). See github issue #199 and bugzil.la/1188982.
  1545. .map(function (source) {
  1546. return sourceRoot && util.isAbsolute(sourceRoot) && util.isAbsolute(source)
  1547. ? util.relative(sourceRoot, source)
  1548. : source;
  1549. });
  1550. // Pass `true` below to allow duplicate names and sources. While source maps
  1551. // are intended to be compressed and deduplicated, the TypeScript compiler
  1552. // sometimes generates source maps with duplicates in them. See Github issue
  1553. // #72 and bugzil.la/889492.
  1554. this._names = ArraySet.fromArray(names.map(String), true);
  1555. this._sources = ArraySet.fromArray(sources, true);
  1556. this._absoluteSources = this._sources.toArray().map(function (s) {
  1557. return util.computeSourceURL(sourceRoot, s, aSourceMapURL);
  1558. });
  1559. this.sourceRoot = sourceRoot;
  1560. this.sourcesContent = sourcesContent;
  1561. this._mappings = mappings;
  1562. this._sourceMapURL = aSourceMapURL;
  1563. this.file = file;
  1564. }
  1565. BasicSourceMapConsumer.prototype = Object.create(SourceMapConsumer.prototype);
  1566. BasicSourceMapConsumer.prototype.consumer = SourceMapConsumer;
  1567. /**
  1568. * Utility function to find the index of a source. Returns -1 if not
  1569. * found.
  1570. */
  1571. BasicSourceMapConsumer.prototype._findSourceIndex = function(aSource) {
  1572. var relativeSource = aSource;
  1573. if (this.sourceRoot != null) {
  1574. relativeSource = util.relative(this.sourceRoot, relativeSource);
  1575. }
  1576. if (this._sources.has(relativeSource)) {
  1577. return this._sources.indexOf(relativeSource);
  1578. }
  1579. // Maybe aSource is an absolute URL as returned by |sources|. In
  1580. // this case we can't simply undo the transform.
  1581. var i;
  1582. for (i = 0; i < this._absoluteSources.length; ++i) {
  1583. if (this._absoluteSources[i] == aSource) {
  1584. return i;
  1585. }
  1586. }
  1587. return -1;
  1588. };
  1589. /**
  1590. * Create a BasicSourceMapConsumer from a SourceMapGenerator.
  1591. *
  1592. * @param SourceMapGenerator aSourceMap
  1593. * The source map that will be consumed.
  1594. * @param String aSourceMapURL
  1595. * The URL at which the source map can be found (optional)
  1596. * @returns BasicSourceMapConsumer
  1597. */
  1598. BasicSourceMapConsumer.fromSourceMap =
  1599. function SourceMapConsumer_fromSourceMap(aSourceMap, aSourceMapURL) {
  1600. var smc = Object.create(BasicSourceMapConsumer.prototype);
  1601. var names = smc._names = ArraySet.fromArray(aSourceMap._names.toArray(), true);
  1602. var sources = smc._sources = ArraySet.fromArray(aSourceMap._sources.toArray(), true);
  1603. smc.sourceRoot = aSourceMap._sourceRoot;
  1604. smc.sourcesContent = aSourceMap._generateSourcesContent(smc._sources.toArray(),
  1605. smc.sourceRoot);
  1606. smc.file = aSourceMap._file;
  1607. smc._sourceMapURL = aSourceMapURL;
  1608. smc._absoluteSources = smc._sources.toArray().map(function (s) {
  1609. return util.computeSourceURL(smc.sourceRoot, s, aSourceMapURL);
  1610. });
  1611. // Because we are modifying the entries (by converting string sources and
  1612. // names to indices into the sources and names ArraySets), we have to make
  1613. // a copy of the entry or else bad things happen. Shared mutable state
  1614. // strikes again! See github issue #191.
  1615. var generatedMappings = aSourceMap._mappings.toArray().slice();
  1616. var destGeneratedMappings = smc.__generatedMappings = [];
  1617. var destOriginalMappings = smc.__originalMappings = [];
  1618. for (var i = 0, length = generatedMappings.length; i < length; i++) {
  1619. var srcMapping = generatedMappings[i];
  1620. var destMapping = new Mapping;
  1621. destMapping.generatedLine = srcMapping.generatedLine;
  1622. destMapping.generatedColumn = srcMapping.generatedColumn;
  1623. if (srcMapping.source) {
  1624. destMapping.source = sources.indexOf(srcMapping.source);
  1625. destMapping.originalLine = srcMapping.originalLine;
  1626. destMapping.originalColumn = srcMapping.originalColumn;
  1627. if (srcMapping.name) {
  1628. destMapping.name = names.indexOf(srcMapping.name);
  1629. }
  1630. destOriginalMappings.push(destMapping);
  1631. }
  1632. destGeneratedMappings.push(destMapping);
  1633. }
  1634. quickSort(smc.__originalMappings, util.compareByOriginalPositions);
  1635. return smc;
  1636. };
  1637. /**
  1638. * The version of the source mapping spec that we are consuming.
  1639. */
  1640. BasicSourceMapConsumer.prototype._version = 3;
  1641. /**
  1642. * The list of original sources.
  1643. */
  1644. Object.defineProperty(BasicSourceMapConsumer.prototype, 'sources', {
  1645. get: function () {
  1646. return this._absoluteSources.slice();
  1647. }
  1648. });
  1649. /**
  1650. * Provide the JIT with a nice shape / hidden class.
  1651. */
  1652. function Mapping() {
  1653. this.generatedLine = 0;
  1654. this.generatedColumn = 0;
  1655. this.source = null;
  1656. this.originalLine = null;
  1657. this.originalColumn = null;
  1658. this.name = null;
  1659. }
  1660. /**
  1661. * Parse the mappings in a string in to a data structure which we can easily
  1662. * query (the ordered arrays in the `this.__generatedMappings` and
  1663. * `this.__originalMappings` properties).
  1664. */
  1665. BasicSourceMapConsumer.prototype._parseMappings =
  1666. function SourceMapConsumer_parseMappings(aStr, aSourceRoot) {
  1667. var generatedLine = 1;
  1668. var previousGeneratedColumn = 0;
  1669. var previousOriginalLine = 0;
  1670. var previousOriginalColumn = 0;
  1671. var previousSource = 0;
  1672. var previousName = 0;
  1673. var length = aStr.length;
  1674. var index = 0;
  1675. var cachedSegments = {};
  1676. var temp = {};
  1677. var originalMappings = [];
  1678. var generatedMappings = [];
  1679. var mapping, str, segment, end, value;
  1680. while (index < length) {
  1681. if (aStr.charAt(index) === ';') {
  1682. generatedLine++;
  1683. index++;
  1684. previousGeneratedColumn = 0;
  1685. }
  1686. else if (aStr.charAt(index) === ',') {
  1687. index++;
  1688. }
  1689. else {
  1690. mapping = new Mapping();
  1691. mapping.generatedLine = generatedLine;
  1692. // Because each offset is encoded relative to the previous one,
  1693. // many segments often have the same encoding. We can exploit this
  1694. // fact by caching the parsed variable length fields of each segment,
  1695. // allowing us to avoid a second parse if we encounter the same
  1696. // segment again.
  1697. for (end = index; end < length; end++) {
  1698. if (this._charIsMappingSeparator(aStr, end)) {
  1699. break;
  1700. }
  1701. }
  1702. str = aStr.slice(index, end);
  1703. segment = cachedSegments[str];
  1704. if (segment) {
  1705. index += str.length;
  1706. } else {
  1707. segment = [];
  1708. while (index < end) {
  1709. base64VLQ.decode(aStr, index, temp);
  1710. value = temp.value;
  1711. index = temp.rest;
  1712. segment.push(value);
  1713. }
  1714. if (segment.length === 2) {
  1715. throw new Error('Found a source, but no line and column');
  1716. }
  1717. if (segment.length === 3) {
  1718. throw new Error('Found a source and line, but no column');
  1719. }
  1720. cachedSegments[str] = segment;
  1721. }
  1722. // Generated column.
  1723. mapping.generatedColumn = previousGeneratedColumn + segment[0];
  1724. previousGeneratedColumn = mapping.generatedColumn;
  1725. if (segment.length > 1) {
  1726. // Original source.
  1727. mapping.source = previousSource + segment[1];
  1728. previousSource += segment[1];
  1729. // Original line.
  1730. mapping.originalLine = previousOriginalLine + segment[2];
  1731. previousOriginalLine = mapping.originalLine;
  1732. // Lines are stored 0-based
  1733. mapping.originalLine += 1;
  1734. // Original column.
  1735. mapping.originalColumn = previousOriginalColumn + segment[3];
  1736. previousOriginalColumn = mapping.originalColumn;
  1737. if (segment.length > 4) {
  1738. // Original name.
  1739. mapping.name = previousName + segment[4];
  1740. previousName += segment[4];
  1741. }
  1742. }
  1743. generatedMappings.push(mapping);
  1744. if (typeof mapping.originalLine === 'number') {
  1745. originalMappings.push(mapping);
  1746. }
  1747. }
  1748. }
  1749. quickSort(generatedMappings, util.compareByGeneratedPositionsDeflated);
  1750. this.__generatedMappings = generatedMappings;
  1751. quickSort(originalMappings, util.compareByOriginalPositions);
  1752. this.__originalMappings = originalMappings;
  1753. };
  1754. /**
  1755. * Find the mapping that best matches the hypothetical "needle" mapping that
  1756. * we are searching for in the given "haystack" of mappings.
  1757. */
  1758. BasicSourceMapConsumer.prototype._findMapping =
  1759. function SourceMapConsumer_findMapping(aNeedle, aMappings, aLineName,
  1760. aColumnName, aComparator, aBias) {
  1761. // To return the position we are searching for, we must first find the
  1762. // mapping for the given position and then return the opposite position it
  1763. // points to. Because the mappings are sorted, we can use binary search to
  1764. // find the best mapping.
  1765. if (aNeedle[aLineName] <= 0) {
  1766. throw new TypeError('Line must be greater than or equal to 1, got '
  1767. + aNeedle[aLineName]);
  1768. }
  1769. if (aNeedle[aColumnName] < 0) {
  1770. throw new TypeError('Column must be greater than or equal to 0, got '
  1771. + aNeedle[aColumnName]);
  1772. }
  1773. return binarySearch.search(aNeedle, aMappings, aComparator, aBias);
  1774. };
  1775. /**
  1776. * Compute the last column for each generated mapping. The last column is
  1777. * inclusive.
  1778. */
  1779. BasicSourceMapConsumer.prototype.computeColumnSpans =
  1780. function SourceMapConsumer_computeColumnSpans() {
  1781. for (var index = 0; index < this._generatedMappings.length; ++index) {
  1782. var mapping = this._generatedMappings[index];
  1783. // Mappings do not contain a field for the last generated columnt. We
  1784. // can come up with an optimistic estimate, however, by assuming that
  1785. // mappings are contiguous (i.e. given two consecutive mappings, the
  1786. // first mapping ends where the second one starts).
  1787. if (index + 1 < this._generatedMappings.length) {
  1788. var nextMapping = this._generatedMappings[index + 1];
  1789. if (mapping.generatedLine === nextMapping.generatedLine) {
  1790. mapping.lastGeneratedColumn = nextMapping.generatedColumn - 1;
  1791. continue;
  1792. }
  1793. }
  1794. // The last mapping for each line spans the entire line.
  1795. mapping.lastGeneratedColumn = Infinity;
  1796. }
  1797. };
  1798. /**
  1799. * Returns the original source, line, and column information for the generated
  1800. * source's line and column positions provided. The only argument is an object
  1801. * with the following properties:
  1802. *
  1803. * - line: The line number in the generated source. The line number
  1804. * is 1-based.
  1805. * - column: The column number in the generated source. The column
  1806. * number is 0-based.
  1807. * - bias: Either 'SourceMapConsumer.GREATEST_LOWER_BOUND' or
  1808. * 'SourceMapConsumer.LEAST_UPPER_BOUND'. Specifies whether to return the
  1809. * closest element that is smaller than or greater than the one we are
  1810. * searching for, respectively, if the exact element cannot be found.
  1811. * Defaults to 'SourceMapConsumer.GREATEST_LOWER_BOUND'.
  1812. *
  1813. * and an object is returned with the following properties:
  1814. *
  1815. * - source: The original source file, or null.
  1816. * - line: The line number in the original source, or null. The
  1817. * line number is 1-based.
  1818. * - column: The column number in the original source, or null. The
  1819. * column number is 0-based.
  1820. * - name: The original identifier, or null.
  1821. */
  1822. BasicSourceMapConsumer.prototype.originalPositionFor =
  1823. function SourceMapConsumer_originalPositionFor(aArgs) {
  1824. var needle = {
  1825. generatedLine: util.getArg(aArgs, 'line'),
  1826. generatedColumn: util.getArg(aArgs, 'column')
  1827. };
  1828. var index = this._findMapping(
  1829. needle,
  1830. this._generatedMappings,
  1831. "generatedLine",
  1832. "generatedColumn",
  1833. util.compareByGeneratedPositionsDeflated,
  1834. util.getArg(aArgs, 'bias', SourceMapConsumer.GREATEST_LOWER_BOUND)
  1835. );
  1836. if (index >= 0) {
  1837. var mapping = this._generatedMappings[index];
  1838. if (mapping.generatedLine === needle.generatedLine) {
  1839. var source = util.getArg(mapping, 'source', null);
  1840. if (source !== null) {
  1841. source = this._sources.at(source);
  1842. source = util.computeSourceURL(this.sourceRoot, source, this._sourceMapURL);
  1843. }
  1844. var name = util.getArg(mapping, 'name', null);
  1845. if (name !== null) {
  1846. name = this._names.at(name);
  1847. }
  1848. return {
  1849. source: source,
  1850. line: util.getArg(mapping, 'originalLine', null),
  1851. column: util.getArg(mapping, 'originalColumn', null),
  1852. name: name
  1853. };
  1854. }
  1855. }
  1856. return {
  1857. source: null,
  1858. line: null,
  1859. column: null,
  1860. name: null
  1861. };
  1862. };
  1863. /**
  1864. * Return true if we have the source content for every source in the source
  1865. * map, false otherwise.
  1866. */
  1867. BasicSourceMapConsumer.prototype.hasContentsOfAllSources =
  1868. function BasicSourceMapConsumer_hasContentsOfAllSources() {
  1869. if (!this.sourcesContent) {
  1870. return false;
  1871. }
  1872. return this.sourcesContent.length >= this._sources.size() &&
  1873. !this.sourcesContent.some(function (sc) { return sc == null; });
  1874. };
  1875. /**
  1876. * Returns the original source content. The only argument is the url of the
  1877. * original source file. Returns null if no original source content is
  1878. * available.
  1879. */
  1880. BasicSourceMapConsumer.prototype.sourceContentFor =
  1881. function SourceMapConsumer_sourceContentFor(aSource, nullOnMissing) {
  1882. if (!this.sourcesContent) {
  1883. return null;
  1884. }
  1885. var index = this._findSourceIndex(aSource);
  1886. if (index >= 0) {
  1887. return this.sourcesContent[index];
  1888. }
  1889. var relativeSource = aSource;
  1890. if (this.sourceRoot != null) {
  1891. relativeSource = util.relative(this.sourceRoot, relativeSource);
  1892. }
  1893. var url;
  1894. if (this.sourceRoot != null
  1895. && (url = util.urlParse(this.sourceRoot))) {
  1896. // XXX: file:// URIs and absolute paths lead to unexpected behavior for
  1897. // many users. We can help them out when they expect file:// URIs to
  1898. // behave like it would if they were running a local HTTP server. See
  1899. // https://bugzilla.mozilla.org/show_bug.cgi?id=885597.
  1900. var fileUriAbsPath = relativeSource.replace(/^file:\/\//, "");
  1901. if (url.scheme == "file"
  1902. && this._sources.has(fileUriAbsPath)) {
  1903. return this.sourcesContent[this._sources.indexOf(fileUriAbsPath)]
  1904. }
  1905. if ((!url.path || url.path == "/")
  1906. && this._sources.has("/" + relativeSource)) {
  1907. return this.sourcesContent[this._sources.indexOf("/" + relativeSource)];
  1908. }
  1909. }
  1910. // This function is used recursively from
  1911. // IndexedSourceMapConsumer.prototype.sourceContentFor. In that case, we
  1912. // don't want to throw if we can't find the source - we just want to
  1913. // return null, so we provide a flag to exit gracefully.
  1914. if (nullOnMissing) {
  1915. return null;
  1916. }
  1917. else {
  1918. throw new Error('"' + relativeSource + '" is not in the SourceMap.');
  1919. }
  1920. };
  1921. /**
  1922. * Returns the generated line and column information for the original source,
  1923. * line, and column positions provided. The only argument is an object with
  1924. * the following properties:
  1925. *
  1926. * - source: The filename of the original source.
  1927. * - line: The line number in the original source. The line number
  1928. * is 1-based.
  1929. * - column: The column number in the original source. The column
  1930. * number is 0-based.
  1931. * - bias: Either 'SourceMapConsumer.GREATEST_LOWER_BOUND' or
  1932. * 'SourceMapConsumer.LEAST_UPPER_BOUND'. Specifies whether to return the
  1933. * closest element that is smaller than or greater than the one we are
  1934. * searching for, respectively, if the exact element cannot be found.
  1935. * Defaults to 'SourceMapConsumer.GREATEST_LOWER_BOUND'.
  1936. *
  1937. * and an object is returned with the following properties:
  1938. *
  1939. * - line: The line number in the generated source, or null. The
  1940. * line number is 1-based.
  1941. * - column: The column number in the generated source, or null.
  1942. * The column number is 0-based.
  1943. */
  1944. BasicSourceMapConsumer.prototype.generatedPositionFor =
  1945. function SourceMapConsumer_generatedPositionFor(aArgs) {
  1946. var source = util.getArg(aArgs, 'source');
  1947. source = this._findSourceIndex(source);
  1948. if (source < 0) {
  1949. return {
  1950. line: null,
  1951. column: null,
  1952. lastColumn: null
  1953. };
  1954. }
  1955. var needle = {
  1956. source: source,
  1957. originalLine: util.getArg(aArgs, 'line'),
  1958. originalColumn: util.getArg(aArgs, 'column')
  1959. };
  1960. var index = this._findMapping(
  1961. needle,
  1962. this._originalMappings,
  1963. "originalLine",
  1964. "originalColumn",
  1965. util.compareByOriginalPositions,
  1966. util.getArg(aArgs, 'bias', SourceMapConsumer.GREATEST_LOWER_BOUND)
  1967. );
  1968. if (index >= 0) {
  1969. var mapping = this._originalMappings[index];
  1970. if (mapping.source === needle.source) {
  1971. return {
  1972. line: util.getArg(mapping, 'generatedLine', null),
  1973. column: util.getArg(mapping, 'generatedColumn', null),
  1974. lastColumn: util.getArg(mapping, 'lastGeneratedColumn', null)
  1975. };
  1976. }
  1977. }
  1978. return {
  1979. line: null,
  1980. column: null,
  1981. lastColumn: null
  1982. };
  1983. };
  1984. exports.BasicSourceMapConsumer = BasicSourceMapConsumer;
  1985. /**
  1986. * An IndexedSourceMapConsumer instance represents a parsed source map which
  1987. * we can query for information. It differs from BasicSourceMapConsumer in
  1988. * that it takes "indexed" source maps (i.e. ones with a "sections" field) as
  1989. * input.
  1990. *
  1991. * The first parameter is a raw source map (either as a JSON string, or already
  1992. * parsed to an object). According to the spec for indexed source maps, they
  1993. * have the following attributes:
  1994. *
  1995. * - version: Which version of the source map spec this map is following.
  1996. * - file: Optional. The generated file this source map is associated with.
  1997. * - sections: A list of section definitions.
  1998. *
  1999. * Each value under the "sections" field has two fields:
  2000. * - offset: The offset into the original specified at which this section
  2001. * begins to apply, defined as an object with a "line" and "column"
  2002. * field.
  2003. * - map: A source map definition. This source map could also be indexed,
  2004. * but doesn't have to be.
  2005. *
  2006. * Instead of the "map" field, it's also possible to have a "url" field
  2007. * specifying a URL to retrieve a source map from, but that's currently
  2008. * unsupported.
  2009. *
  2010. * Here's an example source map, taken from the source map spec[0], but
  2011. * modified to omit a section which uses the "url" field.
  2012. *
  2013. * {
  2014. * version : 3,
  2015. * file: "app.js",
  2016. * sections: [{
  2017. * offset: {line:100, column:10},
  2018. * map: {
  2019. * version : 3,
  2020. * file: "section.js",
  2021. * sources: ["foo.js", "bar.js"],
  2022. * names: ["src", "maps", "are", "fun"],
  2023. * mappings: "AAAA,E;;ABCDE;"
  2024. * }
  2025. * }],
  2026. * }
  2027. *
  2028. * The second parameter, if given, is a string whose value is the URL
  2029. * at which the source map was found. This URL is used to compute the
  2030. * sources array.
  2031. *
  2032. * [0]: https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit#heading=h.535es3xeprgt
  2033. */
  2034. function IndexedSourceMapConsumer(aSourceMap, aSourceMapURL) {
  2035. var sourceMap = aSourceMap;
  2036. if (typeof aSourceMap === 'string') {
  2037. sourceMap = util.parseSourceMapInput(aSourceMap);
  2038. }
  2039. var version = util.getArg(sourceMap, 'version');
  2040. var sections = util.getArg(sourceMap, 'sections');
  2041. if (version != this._version) {
  2042. throw new Error('Unsupported version: ' + version);
  2043. }
  2044. this._sources = new ArraySet();
  2045. this._names = new ArraySet();
  2046. var lastOffset = {
  2047. line: -1,
  2048. column: 0
  2049. };
  2050. this._sections = sections.map(function (s) {
  2051. if (s.url) {
  2052. // The url field will require support for asynchronicity.
  2053. // See https://github.com/mozilla/source-map/issues/16
  2054. throw new Error('Support for url field in sections not implemented.');
  2055. }
  2056. var offset = util.getArg(s, 'offset');
  2057. var offsetLine = util.getArg(offset, 'line');
  2058. var offsetColumn = util.getArg(offset, 'column');
  2059. if (offsetLine < lastOffset.line ||
  2060. (offsetLine === lastOffset.line && offsetColumn < lastOffset.column)) {
  2061. throw new Error('Section offsets must be ordered and non-overlapping.');
  2062. }
  2063. lastOffset = offset;
  2064. return {
  2065. generatedOffset: {
  2066. // The offset fields are 0-based, but we use 1-based indices when
  2067. // encoding/decoding from VLQ.
  2068. generatedLine: offsetLine + 1,
  2069. generatedColumn: offsetColumn + 1
  2070. },
  2071. consumer: new SourceMapConsumer(util.getArg(s, 'map'), aSourceMapURL)
  2072. }
  2073. });
  2074. }
  2075. IndexedSourceMapConsumer.prototype = Object.create(SourceMapConsumer.prototype);
  2076. IndexedSourceMapConsumer.prototype.constructor = SourceMapConsumer;
  2077. /**
  2078. * The version of the source mapping spec that we are consuming.
  2079. */
  2080. IndexedSourceMapConsumer.prototype._version = 3;
  2081. /**
  2082. * The list of original sources.
  2083. */
  2084. Object.defineProperty(IndexedSourceMapConsumer.prototype, 'sources', {
  2085. get: function () {
  2086. var sources = [];
  2087. for (var i = 0; i < this._sections.length; i++) {
  2088. for (var j = 0; j < this._sections[i].consumer.sources.length; j++) {
  2089. sources.push(this._sections[i].consumer.sources[j]);
  2090. }
  2091. }
  2092. return sources;
  2093. }
  2094. });
  2095. /**
  2096. * Returns the original source, line, and column information for the generated
  2097. * source's line and column positions provided. The only argument is an object
  2098. * with the following properties:
  2099. *
  2100. * - line: The line number in the generated source. The line number
  2101. * is 1-based.
  2102. * - column: The column number in the generated source. The column
  2103. * number is 0-based.
  2104. *
  2105. * and an object is returned with the following properties:
  2106. *
  2107. * - source: The original source file, or null.
  2108. * - line: The line number in the original source, or null. The
  2109. * line number is 1-based.
  2110. * - column: The column number in the original source, or null. The
  2111. * column number is 0-based.
  2112. * - name: The original identifier, or null.
  2113. */
  2114. IndexedSourceMapConsumer.prototype.originalPositionFor =
  2115. function IndexedSourceMapConsumer_originalPositionFor(aArgs) {
  2116. var needle = {
  2117. generatedLine: util.getArg(aArgs, 'line'),
  2118. generatedColumn: util.getArg(aArgs, 'column')
  2119. };
  2120. // Find the section containing the generated position we're trying to map
  2121. // to an original position.
  2122. var sectionIndex = binarySearch.search(needle, this._sections,
  2123. function(needle, section) {
  2124. var cmp = needle.generatedLine - section.generatedOffset.generatedLine;
  2125. if (cmp) {
  2126. return cmp;
  2127. }
  2128. return (needle.generatedColumn -
  2129. section.generatedOffset.generatedColumn);
  2130. });
  2131. var section = this._sections[sectionIndex];
  2132. if (!section) {
  2133. return {
  2134. source: null,
  2135. line: null,
  2136. column: null,
  2137. name: null
  2138. };
  2139. }
  2140. return section.consumer.originalPositionFor({
  2141. line: needle.generatedLine -
  2142. (section.generatedOffset.generatedLine - 1),
  2143. column: needle.generatedColumn -
  2144. (section.generatedOffset.generatedLine === needle.generatedLine
  2145. ? section.generatedOffset.generatedColumn - 1
  2146. : 0),
  2147. bias: aArgs.bias
  2148. });
  2149. };
  2150. /**
  2151. * Return true if we have the source content for every source in the source
  2152. * map, false otherwise.
  2153. */
  2154. IndexedSourceMapConsumer.prototype.hasContentsOfAllSources =
  2155. function IndexedSourceMapConsumer_hasContentsOfAllSources() {
  2156. return this._sections.every(function (s) {
  2157. return s.consumer.hasContentsOfAllSources();
  2158. });
  2159. };
  2160. /**
  2161. * Returns the original source content. The only argument is the url of the
  2162. * original source file. Returns null if no original source content is
  2163. * available.
  2164. */
  2165. IndexedSourceMapConsumer.prototype.sourceContentFor =
  2166. function IndexedSourceMapConsumer_sourceContentFor(aSource, nullOnMissing) {
  2167. for (var i = 0; i < this._sections.length; i++) {
  2168. var section = this._sections[i];
  2169. var content = section.consumer.sourceContentFor(aSource, true);
  2170. if (content) {
  2171. return content;
  2172. }
  2173. }
  2174. if (nullOnMissing) {
  2175. return null;
  2176. }
  2177. else {
  2178. throw new Error('"' + aSource + '" is not in the SourceMap.');
  2179. }
  2180. };
  2181. /**
  2182. * Returns the generated line and column information for the original source,
  2183. * line, and column positions provided. The only argument is an object with
  2184. * the following properties:
  2185. *
  2186. * - source: The filename of the original source.
  2187. * - line: The line number in the original source. The line number
  2188. * is 1-based.
  2189. * - column: The column number in the original source. The column
  2190. * number is 0-based.
  2191. *
  2192. * and an object is returned with the following properties:
  2193. *
  2194. * - line: The line number in the generated source, or null. The
  2195. * line number is 1-based.
  2196. * - column: The column number in the generated source, or null.
  2197. * The column number is 0-based.
  2198. */
  2199. IndexedSourceMapConsumer.prototype.generatedPositionFor =
  2200. function IndexedSourceMapConsumer_generatedPositionFor(aArgs) {
  2201. for (var i = 0; i < this._sections.length; i++) {
  2202. var section = this._sections[i];
  2203. // Only consider this section if the requested source is in the list of
  2204. // sources of the consumer.
  2205. if (section.consumer._findSourceIndex(util.getArg(aArgs, 'source')) === -1) {
  2206. continue;
  2207. }
  2208. var generatedPosition = section.consumer.generatedPositionFor(aArgs);
  2209. if (generatedPosition) {
  2210. var ret = {
  2211. line: generatedPosition.line +
  2212. (section.generatedOffset.generatedLine - 1),
  2213. column: generatedPosition.column +
  2214. (section.generatedOffset.generatedLine === generatedPosition.line
  2215. ? section.generatedOffset.generatedColumn - 1
  2216. : 0)
  2217. };
  2218. return ret;
  2219. }
  2220. }
  2221. return {
  2222. line: null,
  2223. column: null
  2224. };
  2225. };
  2226. /**
  2227. * Parse the mappings in a string in to a data structure which we can easily
  2228. * query (the ordered arrays in the `this.__generatedMappings` and
  2229. * `this.__originalMappings` properties).
  2230. */
  2231. IndexedSourceMapConsumer.prototype._parseMappings =
  2232. function IndexedSourceMapConsumer_parseMappings(aStr, aSourceRoot) {
  2233. this.__generatedMappings = [];
  2234. this.__originalMappings = [];
  2235. for (var i = 0; i < this._sections.length; i++) {
  2236. var section = this._sections[i];
  2237. var sectionMappings = section.consumer._generatedMappings;
  2238. for (var j = 0; j < sectionMappings.length; j++) {
  2239. var mapping = sectionMappings[j];
  2240. var source = section.consumer._sources.at(mapping.source);
  2241. source = util.computeSourceURL(section.consumer.sourceRoot, source, this._sourceMapURL);
  2242. this._sources.add(source);
  2243. source = this._sources.indexOf(source);
  2244. var name = null;
  2245. if (mapping.name) {
  2246. name = section.consumer._names.at(mapping.name);
  2247. this._names.add(name);
  2248. name = this._names.indexOf(name);
  2249. }
  2250. // The mappings coming from the consumer for the section have
  2251. // generated positions relative to the start of the section, so we
  2252. // need to offset them to be relative to the start of the concatenated
  2253. // generated file.
  2254. var adjustedMapping = {
  2255. source: source,
  2256. generatedLine: mapping.generatedLine +
  2257. (section.generatedOffset.generatedLine - 1),
  2258. generatedColumn: mapping.generatedColumn +
  2259. (section.generatedOffset.generatedLine === mapping.generatedLine
  2260. ? section.generatedOffset.generatedColumn - 1
  2261. : 0),
  2262. originalLine: mapping.originalLine,
  2263. originalColumn: mapping.originalColumn,
  2264. name: name
  2265. };
  2266. this.__generatedMappings.push(adjustedMapping);
  2267. if (typeof adjustedMapping.originalLine === 'number') {
  2268. this.__originalMappings.push(adjustedMapping);
  2269. }
  2270. }
  2271. }
  2272. quickSort(this.__generatedMappings, util.compareByGeneratedPositionsDeflated);
  2273. quickSort(this.__originalMappings, util.compareByOriginalPositions);
  2274. };
  2275. exports.IndexedSourceMapConsumer = IndexedSourceMapConsumer;
  2276. /***/ }),
  2277. /* 8 */
  2278. /***/ (function(module, exports) {
  2279. /* -*- Mode: js; js-indent-level: 2; -*- */
  2280. /*
  2281. * Copyright 2011 Mozilla Foundation and contributors
  2282. * Licensed under the New BSD license. See LICENSE or:
  2283. * http://opensource.org/licenses/BSD-3-Clause
  2284. */
  2285. exports.GREATEST_LOWER_BOUND = 1;
  2286. exports.LEAST_UPPER_BOUND = 2;
  2287. /**
  2288. * Recursive implementation of binary search.
  2289. *
  2290. * @param aLow Indices here and lower do not contain the needle.
  2291. * @param aHigh Indices here and higher do not contain the needle.
  2292. * @param aNeedle The element being searched for.
  2293. * @param aHaystack The non-empty array being searched.
  2294. * @param aCompare Function which takes two elements and returns -1, 0, or 1.
  2295. * @param aBias Either 'binarySearch.GREATEST_LOWER_BOUND' or
  2296. * 'binarySearch.LEAST_UPPER_BOUND'. Specifies whether to return the
  2297. * closest element that is smaller than or greater than the one we are
  2298. * searching for, respectively, if the exact element cannot be found.
  2299. */
  2300. function recursiveSearch(aLow, aHigh, aNeedle, aHaystack, aCompare, aBias) {
  2301. // This function terminates when one of the following is true:
  2302. //
  2303. // 1. We find the exact element we are looking for.
  2304. //
  2305. // 2. We did not find the exact element, but we can return the index of
  2306. // the next-closest element.
  2307. //
  2308. // 3. We did not find the exact element, and there is no next-closest
  2309. // element than the one we are searching for, so we return -1.
  2310. var mid = Math.floor((aHigh - aLow) / 2) + aLow;
  2311. var cmp = aCompare(aNeedle, aHaystack[mid], true);
  2312. if (cmp === 0) {
  2313. // Found the element we are looking for.
  2314. return mid;
  2315. }
  2316. else if (cmp > 0) {
  2317. // Our needle is greater than aHaystack[mid].
  2318. if (aHigh - mid > 1) {
  2319. // The element is in the upper half.
  2320. return recursiveSearch(mid, aHigh, aNeedle, aHaystack, aCompare, aBias);
  2321. }
  2322. // The exact needle element was not found in this haystack. Determine if
  2323. // we are in termination case (3) or (2) and return the appropriate thing.
  2324. if (aBias == exports.LEAST_UPPER_BOUND) {
  2325. return aHigh < aHaystack.length ? aHigh : -1;
  2326. } else {
  2327. return mid;
  2328. }
  2329. }
  2330. else {
  2331. // Our needle is less than aHaystack[mid].
  2332. if (mid - aLow > 1) {
  2333. // The element is in the lower half.
  2334. return recursiveSearch(aLow, mid, aNeedle, aHaystack, aCompare, aBias);
  2335. }
  2336. // we are in termination case (3) or (2) and return the appropriate thing.
  2337. if (aBias == exports.LEAST_UPPER_BOUND) {
  2338. return mid;
  2339. } else {
  2340. return aLow < 0 ? -1 : aLow;
  2341. }
  2342. }
  2343. }
  2344. /**
  2345. * This is an implementation of binary search which will always try and return
  2346. * the index of the closest element if there is no exact hit. This is because
  2347. * mappings between original and generated line/col pairs are single points,
  2348. * and there is an implicit region between each of them, so a miss just means
  2349. * that you aren't on the very start of a region.
  2350. *
  2351. * @param aNeedle The element you are looking for.
  2352. * @param aHaystack The array that is being searched.
  2353. * @param aCompare A function which takes the needle and an element in the
  2354. * array and returns -1, 0, or 1 depending on whether the needle is less
  2355. * than, equal to, or greater than the element, respectively.
  2356. * @param aBias Either 'binarySearch.GREATEST_LOWER_BOUND' or
  2357. * 'binarySearch.LEAST_UPPER_BOUND'. Specifies whether to return the
  2358. * closest element that is smaller than or greater than the one we are
  2359. * searching for, respectively, if the exact element cannot be found.
  2360. * Defaults to 'binarySearch.GREATEST_LOWER_BOUND'.
  2361. */
  2362. exports.search = function search(aNeedle, aHaystack, aCompare, aBias) {
  2363. if (aHaystack.length === 0) {
  2364. return -1;
  2365. }
  2366. var index = recursiveSearch(-1, aHaystack.length, aNeedle, aHaystack,
  2367. aCompare, aBias || exports.GREATEST_LOWER_BOUND);
  2368. if (index < 0) {
  2369. return -1;
  2370. }
  2371. // We have found either the exact element, or the next-closest element than
  2372. // the one we are searching for. However, there may be more than one such
  2373. // element. Make sure we always return the smallest of these.
  2374. while (index - 1 >= 0) {
  2375. if (aCompare(aHaystack[index], aHaystack[index - 1], true) !== 0) {
  2376. break;
  2377. }
  2378. --index;
  2379. }
  2380. return index;
  2381. };
  2382. /***/ }),
  2383. /* 9 */
  2384. /***/ (function(module, exports) {
  2385. /* -*- Mode: js; js-indent-level: 2; -*- */
  2386. /*
  2387. * Copyright 2011 Mozilla Foundation and contributors
  2388. * Licensed under the New BSD license. See LICENSE or:
  2389. * http://opensource.org/licenses/BSD-3-Clause
  2390. */
  2391. // It turns out that some (most?) JavaScript engines don't self-host
  2392. // `Array.prototype.sort`. This makes sense because C++ will likely remain
  2393. // faster than JS when doing raw CPU-intensive sorting. However, when using a
  2394. // custom comparator function, calling back and forth between the VM's C++ and
  2395. // JIT'd JS is rather slow *and* loses JIT type information, resulting in
  2396. // worse generated code for the comparator function than would be optimal. In
  2397. // fact, when sorting with a comparator, these costs outweigh the benefits of
  2398. // sorting in C++. By using our own JS-implemented Quick Sort (below), we get
  2399. // a ~3500ms mean speed-up in `bench/bench.html`.
  2400. /**
  2401. * Swap the elements indexed by `x` and `y` in the array `ary`.
  2402. *
  2403. * @param {Array} ary
  2404. * The array.
  2405. * @param {Number} x
  2406. * The index of the first item.
  2407. * @param {Number} y
  2408. * The index of the second item.
  2409. */
  2410. function swap(ary, x, y) {
  2411. var temp = ary[x];
  2412. ary[x] = ary[y];
  2413. ary[y] = temp;
  2414. }
  2415. /**
  2416. * Returns a random integer within the range `low .. high` inclusive.
  2417. *
  2418. * @param {Number} low
  2419. * The lower bound on the range.
  2420. * @param {Number} high
  2421. * The upper bound on the range.
  2422. */
  2423. function randomIntInRange(low, high) {
  2424. return Math.round(low + (Math.random() * (high - low)));
  2425. }
  2426. /**
  2427. * The Quick Sort algorithm.
  2428. *
  2429. * @param {Array} ary
  2430. * An array to sort.
  2431. * @param {function} comparator
  2432. * Function to use to compare two items.
  2433. * @param {Number} p
  2434. * Start index of the array
  2435. * @param {Number} r
  2436. * End index of the array
  2437. */
  2438. function doQuickSort(ary, comparator, p, r) {
  2439. // If our lower bound is less than our upper bound, we (1) partition the
  2440. // array into two pieces and (2) recurse on each half. If it is not, this is
  2441. // the empty array and our base case.
  2442. if (p < r) {
  2443. // (1) Partitioning.
  2444. //
  2445. // The partitioning chooses a pivot between `p` and `r` and moves all
  2446. // elements that are less than or equal to the pivot to the before it, and
  2447. // all the elements that are greater than it after it. The effect is that
  2448. // once partition is done, the pivot is in the exact place it will be when
  2449. // the array is put in sorted order, and it will not need to be moved
  2450. // again. This runs in O(n) time.
  2451. // Always choose a random pivot so that an input array which is reverse
  2452. // sorted does not cause O(n^2) running time.
  2453. var pivotIndex = randomIntInRange(p, r);
  2454. var i = p - 1;
  2455. swap(ary, pivotIndex, r);
  2456. var pivot = ary[r];
  2457. // Immediately after `j` is incremented in this loop, the following hold
  2458. // true:
  2459. //
  2460. // * Every element in `ary[p .. i]` is less than or equal to the pivot.
  2461. //
  2462. // * Every element in `ary[i+1 .. j-1]` is greater than the pivot.
  2463. for (var j = p; j < r; j++) {
  2464. if (comparator(ary[j], pivot) <= 0) {
  2465. i += 1;
  2466. swap(ary, i, j);
  2467. }
  2468. }
  2469. swap(ary, i + 1, j);
  2470. var q = i + 1;
  2471. // (2) Recurse on each half.
  2472. doQuickSort(ary, comparator, p, q - 1);
  2473. doQuickSort(ary, comparator, q + 1, r);
  2474. }
  2475. }
  2476. /**
  2477. * Sort the given array in-place with the given comparator function.
  2478. *
  2479. * @param {Array} ary
  2480. * An array to sort.
  2481. * @param {function} comparator
  2482. * Function to use to compare two items.
  2483. */
  2484. exports.quickSort = function (ary, comparator) {
  2485. doQuickSort(ary, comparator, 0, ary.length - 1);
  2486. };
  2487. /***/ }),
  2488. /* 10 */
  2489. /***/ (function(module, exports, __webpack_require__) {
  2490. /* -*- Mode: js; js-indent-level: 2; -*- */
  2491. /*
  2492. * Copyright 2011 Mozilla Foundation and contributors
  2493. * Licensed under the New BSD license. See LICENSE or:
  2494. * http://opensource.org/licenses/BSD-3-Clause
  2495. */
  2496. var SourceMapGenerator = __webpack_require__(1).SourceMapGenerator;
  2497. var util = __webpack_require__(4);
  2498. // Matches a Windows-style `\r\n` newline or a `\n` newline used by all other
  2499. // operating systems these days (capturing the result).
  2500. var REGEX_NEWLINE = /(\r?\n)/;
  2501. // Newline character code for charCodeAt() comparisons
  2502. var NEWLINE_CODE = 10;
  2503. // Private symbol for identifying `SourceNode`s when multiple versions of
  2504. // the source-map library are loaded. This MUST NOT CHANGE across
  2505. // versions!
  2506. var isSourceNode = "$$$isSourceNode$$$";
  2507. /**
  2508. * SourceNodes provide a way to abstract over interpolating/concatenating
  2509. * snippets of generated JavaScript source code while maintaining the line and
  2510. * column information associated with the original source code.
  2511. *
  2512. * @param aLine The original line number.
  2513. * @param aColumn The original column number.
  2514. * @param aSource The original source's filename.
  2515. * @param aChunks Optional. An array of strings which are snippets of
  2516. * generated JS, or other SourceNodes.
  2517. * @param aName The original identifier.
  2518. */
  2519. function SourceNode(aLine, aColumn, aSource, aChunks, aName) {
  2520. this.children = [];
  2521. this.sourceContents = {};
  2522. this.line = aLine == null ? null : aLine;
  2523. this.column = aColumn == null ? null : aColumn;
  2524. this.source = aSource == null ? null : aSource;
  2525. this.name = aName == null ? null : aName;
  2526. this[isSourceNode] = true;
  2527. if (aChunks != null) this.add(aChunks);
  2528. }
  2529. /**
  2530. * Creates a SourceNode from generated code and a SourceMapConsumer.
  2531. *
  2532. * @param aGeneratedCode The generated code
  2533. * @param aSourceMapConsumer The SourceMap for the generated code
  2534. * @param aRelativePath Optional. The path that relative sources in the
  2535. * SourceMapConsumer should be relative to.
  2536. */
  2537. SourceNode.fromStringWithSourceMap =
  2538. function SourceNode_fromStringWithSourceMap(aGeneratedCode, aSourceMapConsumer, aRelativePath) {
  2539. // The SourceNode we want to fill with the generated code
  2540. // and the SourceMap
  2541. var node = new SourceNode();
  2542. // All even indices of this array are one line of the generated code,
  2543. // while all odd indices are the newlines between two adjacent lines
  2544. // (since `REGEX_NEWLINE` captures its match).
  2545. // Processed fragments are accessed by calling `shiftNextLine`.
  2546. var remainingLines = aGeneratedCode.split(REGEX_NEWLINE);
  2547. var remainingLinesIndex = 0;
  2548. var shiftNextLine = function() {
  2549. var lineContents = getNextLine();
  2550. // The last line of a file might not have a newline.
  2551. var newLine = getNextLine() || "";
  2552. return lineContents + newLine;
  2553. function getNextLine() {
  2554. return remainingLinesIndex < remainingLines.length ?
  2555. remainingLines[remainingLinesIndex++] : undefined;
  2556. }
  2557. };
  2558. // We need to remember the position of "remainingLines"
  2559. var lastGeneratedLine = 1, lastGeneratedColumn = 0;
  2560. // The generate SourceNodes we need a code range.
  2561. // To extract it current and last mapping is used.
  2562. // Here we store the last mapping.
  2563. var lastMapping = null;
  2564. aSourceMapConsumer.eachMapping(function (mapping) {
  2565. if (lastMapping !== null) {
  2566. // We add the code from "lastMapping" to "mapping":
  2567. // First check if there is a new line in between.
  2568. if (lastGeneratedLine < mapping.generatedLine) {
  2569. // Associate first line with "lastMapping"
  2570. addMappingWithCode(lastMapping, shiftNextLine());
  2571. lastGeneratedLine++;
  2572. lastGeneratedColumn = 0;
  2573. // The remaining code is added without mapping
  2574. } else {
  2575. // There is no new line in between.
  2576. // Associate the code between "lastGeneratedColumn" and
  2577. // "mapping.generatedColumn" with "lastMapping"
  2578. var nextLine = remainingLines[remainingLinesIndex] || '';
  2579. var code = nextLine.substr(0, mapping.generatedColumn -
  2580. lastGeneratedColumn);
  2581. remainingLines[remainingLinesIndex] = nextLine.substr(mapping.generatedColumn -
  2582. lastGeneratedColumn);
  2583. lastGeneratedColumn = mapping.generatedColumn;
  2584. addMappingWithCode(lastMapping, code);
  2585. // No more remaining code, continue
  2586. lastMapping = mapping;
  2587. return;
  2588. }
  2589. }
  2590. // We add the generated code until the first mapping
  2591. // to the SourceNode without any mapping.
  2592. // Each line is added as separate string.
  2593. while (lastGeneratedLine < mapping.generatedLine) {
  2594. node.add(shiftNextLine());
  2595. lastGeneratedLine++;
  2596. }
  2597. if (lastGeneratedColumn < mapping.generatedColumn) {
  2598. var nextLine = remainingLines[remainingLinesIndex] || '';
  2599. node.add(nextLine.substr(0, mapping.generatedColumn));
  2600. remainingLines[remainingLinesIndex] = nextLine.substr(mapping.generatedColumn);
  2601. lastGeneratedColumn = mapping.generatedColumn;
  2602. }
  2603. lastMapping = mapping;
  2604. }, this);
  2605. // We have processed all mappings.
  2606. if (remainingLinesIndex < remainingLines.length) {
  2607. if (lastMapping) {
  2608. // Associate the remaining code in the current line with "lastMapping"
  2609. addMappingWithCode(lastMapping, shiftNextLine());
  2610. }
  2611. // and add the remaining lines without any mapping
  2612. node.add(remainingLines.splice(remainingLinesIndex).join(""));
  2613. }
  2614. // Copy sourcesContent into SourceNode
  2615. aSourceMapConsumer.sources.forEach(function (sourceFile) {
  2616. var content = aSourceMapConsumer.sourceContentFor(sourceFile);
  2617. if (content != null) {
  2618. if (aRelativePath != null) {
  2619. sourceFile = util.join(aRelativePath, sourceFile);
  2620. }
  2621. node.setSourceContent(sourceFile, content);
  2622. }
  2623. });
  2624. return node;
  2625. function addMappingWithCode(mapping, code) {
  2626. if (mapping === null || mapping.source === undefined) {
  2627. node.add(code);
  2628. } else {
  2629. var source = aRelativePath
  2630. ? util.join(aRelativePath, mapping.source)
  2631. : mapping.source;
  2632. node.add(new SourceNode(mapping.originalLine,
  2633. mapping.originalColumn,
  2634. source,
  2635. code,
  2636. mapping.name));
  2637. }
  2638. }
  2639. };
  2640. /**
  2641. * Add a chunk of generated JS to this source node.
  2642. *
  2643. * @param aChunk A string snippet of generated JS code, another instance of
  2644. * SourceNode, or an array where each member is one of those things.
  2645. */
  2646. SourceNode.prototype.add = function SourceNode_add(aChunk) {
  2647. if (Array.isArray(aChunk)) {
  2648. aChunk.forEach(function (chunk) {
  2649. this.add(chunk);
  2650. }, this);
  2651. }
  2652. else if (aChunk[isSourceNode] || typeof aChunk === "string") {
  2653. if (aChunk) {
  2654. this.children.push(aChunk);
  2655. }
  2656. }
  2657. else {
  2658. throw new TypeError(
  2659. "Expected a SourceNode, string, or an array of SourceNodes and strings. Got " + aChunk
  2660. );
  2661. }
  2662. return this;
  2663. };
  2664. /**
  2665. * Add a chunk of generated JS to the beginning of this source node.
  2666. *
  2667. * @param aChunk A string snippet of generated JS code, another instance of
  2668. * SourceNode, or an array where each member is one of those things.
  2669. */
  2670. SourceNode.prototype.prepend = function SourceNode_prepend(aChunk) {
  2671. if (Array.isArray(aChunk)) {
  2672. for (var i = aChunk.length-1; i >= 0; i--) {
  2673. this.prepend(aChunk[i]);
  2674. }
  2675. }
  2676. else if (aChunk[isSourceNode] || typeof aChunk === "string") {
  2677. this.children.unshift(aChunk);
  2678. }
  2679. else {
  2680. throw new TypeError(
  2681. "Expected a SourceNode, string, or an array of SourceNodes and strings. Got " + aChunk
  2682. );
  2683. }
  2684. return this;
  2685. };
  2686. /**
  2687. * Walk over the tree of JS snippets in this node and its children. The
  2688. * walking function is called once for each snippet of JS and is passed that
  2689. * snippet and the its original associated source's line/column location.
  2690. *
  2691. * @param aFn The traversal function.
  2692. */
  2693. SourceNode.prototype.walk = function SourceNode_walk(aFn) {
  2694. var chunk;
  2695. for (var i = 0, len = this.children.length; i < len; i++) {
  2696. chunk = this.children[i];
  2697. if (chunk[isSourceNode]) {
  2698. chunk.walk(aFn);
  2699. }
  2700. else {
  2701. if (chunk !== '') {
  2702. aFn(chunk, { source: this.source,
  2703. line: this.line,
  2704. column: this.column,
  2705. name: this.name });
  2706. }
  2707. }
  2708. }
  2709. };
  2710. /**
  2711. * Like `String.prototype.join` except for SourceNodes. Inserts `aStr` between
  2712. * each of `this.children`.
  2713. *
  2714. * @param aSep The separator.
  2715. */
  2716. SourceNode.prototype.join = function SourceNode_join(aSep) {
  2717. var newChildren;
  2718. var i;
  2719. var len = this.children.length;
  2720. if (len > 0) {
  2721. newChildren = [];
  2722. for (i = 0; i < len-1; i++) {
  2723. newChildren.push(this.children[i]);
  2724. newChildren.push(aSep);
  2725. }
  2726. newChildren.push(this.children[i]);
  2727. this.children = newChildren;
  2728. }
  2729. return this;
  2730. };
  2731. /**
  2732. * Call String.prototype.replace on the very right-most source snippet. Useful
  2733. * for trimming whitespace from the end of a source node, etc.
  2734. *
  2735. * @param aPattern The pattern to replace.
  2736. * @param aReplacement The thing to replace the pattern with.
  2737. */
  2738. SourceNode.prototype.replaceRight = function SourceNode_replaceRight(aPattern, aReplacement) {
  2739. var lastChild = this.children[this.children.length - 1];
  2740. if (lastChild[isSourceNode]) {
  2741. lastChild.replaceRight(aPattern, aReplacement);
  2742. }
  2743. else if (typeof lastChild === 'string') {
  2744. this.children[this.children.length - 1] = lastChild.replace(aPattern, aReplacement);
  2745. }
  2746. else {
  2747. this.children.push(''.replace(aPattern, aReplacement));
  2748. }
  2749. return this;
  2750. };
  2751. /**
  2752. * Set the source content for a source file. This will be added to the SourceMapGenerator
  2753. * in the sourcesContent field.
  2754. *
  2755. * @param aSourceFile The filename of the source file
  2756. * @param aSourceContent The content of the source file
  2757. */
  2758. SourceNode.prototype.setSourceContent =
  2759. function SourceNode_setSourceContent(aSourceFile, aSourceContent) {
  2760. this.sourceContents[util.toSetString(aSourceFile)] = aSourceContent;
  2761. };
  2762. /**
  2763. * Walk over the tree of SourceNodes. The walking function is called for each
  2764. * source file content and is passed the filename and source content.
  2765. *
  2766. * @param aFn The traversal function.
  2767. */
  2768. SourceNode.prototype.walkSourceContents =
  2769. function SourceNode_walkSourceContents(aFn) {
  2770. for (var i = 0, len = this.children.length; i < len; i++) {
  2771. if (this.children[i][isSourceNode]) {
  2772. this.children[i].walkSourceContents(aFn);
  2773. }
  2774. }
  2775. var sources = Object.keys(this.sourceContents);
  2776. for (var i = 0, len = sources.length; i < len; i++) {
  2777. aFn(util.fromSetString(sources[i]), this.sourceContents[sources[i]]);
  2778. }
  2779. };
  2780. /**
  2781. * Return the string representation of this source node. Walks over the tree
  2782. * and concatenates all the various snippets together to one string.
  2783. */
  2784. SourceNode.prototype.toString = function SourceNode_toString() {
  2785. var str = "";
  2786. this.walk(function (chunk) {
  2787. str += chunk;
  2788. });
  2789. return str;
  2790. };
  2791. /**
  2792. * Returns the string representation of this source node along with a source
  2793. * map.
  2794. */
  2795. SourceNode.prototype.toStringWithSourceMap = function SourceNode_toStringWithSourceMap(aArgs) {
  2796. var generated = {
  2797. code: "",
  2798. line: 1,
  2799. column: 0
  2800. };
  2801. var map = new SourceMapGenerator(aArgs);
  2802. var sourceMappingActive = false;
  2803. var lastOriginalSource = null;
  2804. var lastOriginalLine = null;
  2805. var lastOriginalColumn = null;
  2806. var lastOriginalName = null;
  2807. this.walk(function (chunk, original) {
  2808. generated.code += chunk;
  2809. if (original.source !== null
  2810. && original.line !== null
  2811. && original.column !== null) {
  2812. if(lastOriginalSource !== original.source
  2813. || lastOriginalLine !== original.line
  2814. || lastOriginalColumn !== original.column
  2815. || lastOriginalName !== original.name) {
  2816. map.addMapping({
  2817. source: original.source,
  2818. original: {
  2819. line: original.line,
  2820. column: original.column
  2821. },
  2822. generated: {
  2823. line: generated.line,
  2824. column: generated.column
  2825. },
  2826. name: original.name
  2827. });
  2828. }
  2829. lastOriginalSource = original.source;
  2830. lastOriginalLine = original.line;
  2831. lastOriginalColumn = original.column;
  2832. lastOriginalName = original.name;
  2833. sourceMappingActive = true;
  2834. } else if (sourceMappingActive) {
  2835. map.addMapping({
  2836. generated: {
  2837. line: generated.line,
  2838. column: generated.column
  2839. }
  2840. });
  2841. lastOriginalSource = null;
  2842. sourceMappingActive = false;
  2843. }
  2844. for (var idx = 0, length = chunk.length; idx < length; idx++) {
  2845. if (chunk.charCodeAt(idx) === NEWLINE_CODE) {
  2846. generated.line++;
  2847. generated.column = 0;
  2848. // Mappings end at eol
  2849. if (idx + 1 === length) {
  2850. lastOriginalSource = null;
  2851. sourceMappingActive = false;
  2852. } else if (sourceMappingActive) {
  2853. map.addMapping({
  2854. source: original.source,
  2855. original: {
  2856. line: original.line,
  2857. column: original.column
  2858. },
  2859. generated: {
  2860. line: generated.line,
  2861. column: generated.column
  2862. },
  2863. name: original.name
  2864. });
  2865. }
  2866. } else {
  2867. generated.column++;
  2868. }
  2869. }
  2870. });
  2871. this.walkSourceContents(function (sourceFile, sourceContent) {
  2872. map.setSourceContent(sourceFile, sourceContent);
  2873. });
  2874. return { code: generated.code, map: map };
  2875. };
  2876. exports.SourceNode = SourceNode;
  2877. /***/ })
  2878. /******/ ])
  2879. });
  2880. ;
  2881. //# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vd2VicGFjay91bml2ZXJzYWxNb2R1bGVEZWZpbml0aW9uIiwid2VicGFjazovLy93ZWJwYWNrL2Jvb3RzdHJhcCAxNjI0YzcyOTliODg3ZjdiZGY2NCIsIndlYnBhY2s6Ly8vLi9zb3VyY2UtbWFwLmpzIiwid2VicGFjazovLy8uL2xpYi9zb3VyY2UtbWFwLWdlbmVyYXRvci5qcyIsIndlYnBhY2s6Ly8vLi9saWIvYmFzZTY0LXZscS5qcyIsIndlYnBhY2s6Ly8vLi9saWIvYmFzZTY0LmpzIiwid2VicGFjazovLy8uL2xpYi91dGlsLmpzIiwid2VicGFjazovLy8uL2xpYi9hcnJheS1zZXQuanMiLCJ3ZWJwYWNrOi8vLy4vbGliL21hcHBpbmctbGlzdC5qcyIsIndlYnBhY2s6Ly8vLi9saWIvc291cmNlLW1hcC1jb25zdW1lci5qcyIsIndlYnBhY2s6Ly8vLi9saWIvYmluYXJ5LXNlYXJjaC5qcyIsIndlYnBhY2s6Ly8vLi9saWIvcXVpY2stc29ydC5qcyIsIndlYnBhY2s6Ly8vLi9saWIvc291cmNlLW5vZGUuanMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0EsQ0FBQztBQUNELE87QUNWQTtBQUNBOztBQUVBO0FBQ0E7O0FBRUE7QUFDQTtBQUNBOztBQUVBO0FBQ0E7QUFDQSx1QkFBZTtBQUNmO0FBQ0E7QUFDQTs7QUFFQTtBQUNBOztBQUVBO0FBQ0E7O0FBRUE7QUFDQTtBQUNBOzs7QUFHQTtBQUNBOztBQUVBO0FBQ0E7O0FBRUE7QUFDQTs7QUFFQTtBQUNBOzs7Ozs7O0FDdENBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7Ozs7Ozs7QUNQQSxpQkFBZ0Isb0JBQW9CO0FBQ3BDO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7O0FBRUE7QUFDQTtBQUNBO0FBQ0E7O0FBRUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTs7QUFFQTs7QUFFQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0EsTUFBSztBQUNMO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBOztBQUVBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7O0FBRUE7QUFDQTtBQUNBO0FBQ0E7O0FBRUE7QUFDQTtBQUNBO0FBQ0E7O0FBRUE7QUFDQSxNQUFLO0FBQ0w7QUFDQTtBQUNBO0FBQ0E7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7O0FBRUE7QUFDQTtBQUNBO0FBQ0E7QUFDQSxNQUFLO0FBQ0w7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7O0FBRUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBOztBQUVBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBLE1BQUs7QUFDTDs7QUFFQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7O0FBRUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQSxNQUFLO0FBQ0w7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBOztBQUVBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0EsVUFBUztBQUNUO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBOztBQUVBO0FBQ0E7QUFDQTtBQUNBOztBQUVBO0FBQ0E7QUFDQTtBQUNBOztBQUVBLE1BQUs7QUFDTDtBQUNBOztBQUVBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBLE1BQUs7QUFDTDs7QUFFQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0EsUUFBTztBQUNQO0FBQ0E7O0FBRUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTs7QUFFQTtBQUNBLDJDQUEwQyxTQUFTO0FBQ25EO0FBQ0E7O0FBRUE7QUFDQTtBQUNBO0FBQ0EscUJBQW9CO0FBQ3BCO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7O0FBRUE7QUFDQTtBQUNBOztBQUVBO0FBQ0E7QUFDQTtBQUNBOztBQUVBO0FBQ0E7QUFDQTtBQUNBOztBQUVBO0FBQ0E7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7O0FBRUE7QUFDQTs7QUFFQTtBQUNBOztBQUVBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0EsTUFBSztBQUNMOztBQUVBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7O0FBRUE7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTs7QUFFQTs7Ozs7OztBQ3hhQSxpQkFBZ0Isb0JBQW9CO0FBQ3BDO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQSw0REF