@loaders.gl/loader-utils 3.4.14 → 3.4.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. package/dist/es5/index.js +50 -51
  2. package/dist/es5/index.js.map +1 -1
  3. package/dist/es5/json-loader.js +5 -24
  4. package/dist/es5/json-loader.js.map +1 -1
  5. package/dist/es5/lib/binary-utils/array-buffer-utils.js +18 -37
  6. package/dist/es5/lib/binary-utils/array-buffer-utils.js.map +1 -1
  7. package/dist/es5/lib/binary-utils/dataview-copy-utils.js +14 -14
  8. package/dist/es5/lib/binary-utils/dataview-copy-utils.js.map +1 -1
  9. package/dist/es5/lib/binary-utils/get-first-characters.js +5 -5
  10. package/dist/es5/lib/binary-utils/get-first-characters.js.map +1 -1
  11. package/dist/es5/lib/binary-utils/memory-conversion-utils.js +6 -9
  12. package/dist/es5/lib/binary-utils/memory-conversion-utils.js.map +1 -1
  13. package/dist/es5/lib/binary-utils/memory-copy-utils.js +6 -6
  14. package/dist/es5/lib/binary-utils/memory-copy-utils.js.map +1 -1
  15. package/dist/es5/lib/env-utils/globals.js +9 -11
  16. package/dist/es5/lib/env-utils/globals.js.map +1 -1
  17. package/dist/es5/lib/filesystems/node-filesystem.js +51 -199
  18. package/dist/es5/lib/filesystems/node-filesystem.js.map +1 -1
  19. package/dist/es5/lib/filesystems/readable-file.js +9 -74
  20. package/dist/es5/lib/filesystems/readable-file.js.map +1 -1
  21. package/dist/es5/lib/filesystems/writable-file.js +11 -65
  22. package/dist/es5/lib/filesystems/writable-file.js.map +1 -1
  23. package/dist/es5/lib/iterators/async-iteration.js +27 -177
  24. package/dist/es5/lib/iterators/async-iteration.js.map +1 -1
  25. package/dist/es5/lib/iterators/text-iterators.js +44 -293
  26. package/dist/es5/lib/iterators/text-iterators.js.map +1 -1
  27. package/dist/es5/lib/node/buffer.js +1 -1
  28. package/dist/es5/lib/node/buffer.js.map +1 -1
  29. package/dist/es5/lib/node/fs.browser.js +13 -13
  30. package/dist/es5/lib/node/fs.browser.js.map +1 -1
  31. package/dist/es5/lib/node/fs.js +21 -49
  32. package/dist/es5/lib/node/fs.js.map +1 -1
  33. package/dist/es5/lib/node/promisify.js +3 -21
  34. package/dist/es5/lib/node/promisify.js.map +1 -1
  35. package/dist/es5/lib/node/stream.browser.js +2 -2
  36. package/dist/es5/lib/node/stream.browser.js.map +1 -1
  37. package/dist/es5/lib/node/stream.js +2 -2
  38. package/dist/es5/lib/node/stream.js.map +1 -1
  39. package/dist/es5/lib/option-utils/merge-loader-options.js +5 -12
  40. package/dist/es5/lib/option-utils/merge-loader-options.js.map +1 -1
  41. package/dist/es5/lib/path-utils/file-aliases.js +4 -4
  42. package/dist/es5/lib/path-utils/file-aliases.js.map +1 -1
  43. package/dist/es5/lib/path-utils/get-cwd.js +1 -1
  44. package/dist/es5/lib/path-utils/get-cwd.js.map +1 -1
  45. package/dist/es5/lib/path-utils/path.js +22 -22
  46. package/dist/es5/lib/path-utils/path.js.map +1 -1
  47. package/dist/es5/lib/request-utils/request-scheduler.js +88 -110
  48. package/dist/es5/lib/request-utils/request-scheduler.js.map +1 -1
  49. package/dist/es5/lib/worker-loader-utils/create-loader-worker.js +64 -105
  50. package/dist/es5/lib/worker-loader-utils/create-loader-worker.js.map +1 -1
  51. package/dist/es5/lib/worker-loader-utils/parse-with-worker.js +48 -94
  52. package/dist/es5/lib/worker-loader-utils/parse-with-worker.js.map +1 -1
  53. package/dist/esm/json-loader.js +1 -1
  54. package/package.json +4 -4
@@ -1 +1 @@
1
- {"version":3,"file":"stream.browser.js","names":["Transform","exports","isSupported"],"sources":["../../../../src/lib/node/stream.browser.ts"],"sourcesContent":["export const Transform = null;\n\nexport const isSupported = false;\n"],"mappings":";;;;;;AAAO,IAAMA,SAAS,GAAG,IAAI;AAACC,OAAA,CAAAD,SAAA,GAAAA,SAAA;AAEvB,IAAME,WAAW,GAAG,KAAK;AAACD,OAAA,CAAAC,WAAA,GAAAA,WAAA"}
1
+ {"version":3,"file":"stream.browser.js","names":["Transform","exports","isSupported"],"sources":["../../../../src/lib/node/stream.browser.ts"],"sourcesContent":["export const Transform = null;\n\nexport const isSupported = false;\n"],"mappings":";;;;;;AAAO,MAAMA,SAAS,GAAG,IAAI;AAACC,OAAA,CAAAD,SAAA,GAAAA,SAAA;AAEvB,MAAME,WAAW,GAAG,KAAK;AAACD,OAAA,CAAAC,WAAA,GAAAA,WAAA"}
@@ -6,8 +6,8 @@ Object.defineProperty(exports, "__esModule", {
6
6
  });
7
7
  exports.isSupported = exports.Transform = void 0;
8
8
  var _stream = _interopRequireDefault(require("stream"));
9
- var Transform = _stream.default.Transform;
9
+ const Transform = _stream.default.Transform;
10
10
  exports.Transform = Transform;
11
- var isSupported = Boolean(_stream.default);
11
+ const isSupported = Boolean(_stream.default);
12
12
  exports.isSupported = isSupported;
13
13
  //# sourceMappingURL=stream.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"stream.js","names":["_stream","_interopRequireDefault","require","Transform","stream","exports","isSupported","Boolean"],"sources":["../../../../src/lib/node/stream.ts"],"sourcesContent":["// loaders.gl, MIT license\n\nimport stream from 'stream';\n\nexport type {Writable} from 'stream';\n\n/** Wrapper for Node.js stream method */\nexport const Transform = stream.Transform;\n\nexport const isSupported = Boolean(stream);\n"],"mappings":";;;;;;;AAEA,IAAAA,OAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKO,IAAMC,SAAS,GAAGC,eAAM,CAACD,SAAS;AAACE,OAAA,CAAAF,SAAA,GAAAA,SAAA;AAEnC,IAAMG,WAAW,GAAGC,OAAO,CAACH,eAAM,CAAC;AAACC,OAAA,CAAAC,WAAA,GAAAA,WAAA"}
1
+ {"version":3,"file":"stream.js","names":["_stream","_interopRequireDefault","require","Transform","stream","exports","isSupported","Boolean"],"sources":["../../../../src/lib/node/stream.ts"],"sourcesContent":["// loaders.gl, MIT license\n\nimport stream from 'stream';\n\nexport type {Writable} from 'stream';\n\n/** Wrapper for Node.js stream method */\nexport const Transform = stream.Transform;\n\nexport const isSupported = Boolean(stream);\n"],"mappings":";;;;;;;AAEA,IAAAA,OAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKO,MAAMC,SAAS,GAAGC,eAAM,CAACD,SAAS;AAACE,OAAA,CAAAF,SAAA,GAAAA,SAAA;AAEnC,MAAMG,WAAW,GAAGC,OAAO,CAACH,eAAM,CAAC;AAACC,OAAA,CAAAC,WAAA,GAAAA,WAAA"}
@@ -1,22 +1,15 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
3
  Object.defineProperty(exports, "__esModule", {
5
4
  value: true
6
5
  });
7
6
  exports.mergeLoaderOptions = mergeLoaderOptions;
8
- var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
9
- var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
10
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
11
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
12
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
13
7
  function mergeLoaderOptions(baseOptions, newOptions) {
14
- var options = _objectSpread({}, baseOptions);
15
- for (var _i = 0, _Object$entries = Object.entries(newOptions); _i < _Object$entries.length; _i++) {
16
- var _Object$entries$_i = (0, _slicedToArray2.default)(_Object$entries[_i], 2),
17
- key = _Object$entries$_i[0],
18
- newValue = _Object$entries$_i[1];
19
- if (newValue && (0, _typeof2.default)(newValue) === 'object') {
8
+ const options = {
9
+ ...baseOptions
10
+ };
11
+ for (const [key, newValue] of Object.entries(newOptions)) {
12
+ if (newValue && typeof newValue === 'object') {
20
13
  options[key] = options[key] || {};
21
14
  Object.assign(options[key], newOptions[key]);
22
15
  } else {
@@ -1 +1 @@
1
- {"version":3,"file":"merge-loader-options.js","names":["mergeLoaderOptions","baseOptions","newOptions","options","_objectSpread","_i","_Object$entries","Object","entries","length","_Object$entries$_i","_slicedToArray2","default","key","newValue","_typeof2","assign"],"sources":["../../../../src/lib/option-utils/merge-loader-options.ts"],"sourcesContent":["// loaders.gl, MIT license\n\nimport {LoaderOptions} from '../../types';\n\n/**\n *\n * @param baseOptions Can be undefined, in which case a fresh options object will be minted\n * @param newOptions\n * @returns\n */\nexport function mergeLoaderOptions<Options extends LoaderOptions>(\n baseOptions: Options | undefined,\n newOptions: Options\n): Options {\n const options = {...baseOptions};\n for (const [key, newValue] of Object.entries(newOptions)) {\n if (newValue && typeof newValue === 'object') {\n options[key] = options[key] || {};\n Object.assign(options[key] as object, newOptions[key]);\n } else {\n options[key] = newOptions[key];\n }\n }\n return options as Options;\n}\n"],"mappings":";;;;;;;;;;;;AAUO,SAASA,kBAAkBA,CAChCC,WAAgC,EAChCC,UAAmB,EACV;EACT,IAAMC,OAAO,GAAAC,aAAA,KAAOH,WAAW,CAAC;EAChC,SAAAI,EAAA,MAAAC,eAAA,GAA8BC,MAAM,CAACC,OAAO,CAACN,UAAU,CAAC,EAAAG,EAAA,GAAAC,eAAA,CAAAG,MAAA,EAAAJ,EAAA,IAAE;IAArD,IAAAK,kBAAA,OAAAC,eAAA,CAAAC,OAAA,EAAAN,eAAA,CAAAD,EAAA;MAAOQ,GAAG,GAAAH,kBAAA;MAAEI,QAAQ,GAAAJ,kBAAA;IACvB,IAAII,QAAQ,IAAI,IAAAC,QAAA,CAAAH,OAAA,EAAOE,QAAQ,MAAK,QAAQ,EAAE;MAC5CX,OAAO,CAACU,GAAG,CAAC,GAAGV,OAAO,CAACU,GAAG,CAAC,IAAI,CAAC,CAAC;MACjCN,MAAM,CAACS,MAAM,CAACb,OAAO,CAACU,GAAG,CAAC,EAAYX,UAAU,CAACW,GAAG,CAAC,CAAC;IACxD,CAAC,MAAM;MACLV,OAAO,CAACU,GAAG,CAAC,GAAGX,UAAU,CAACW,GAAG,CAAC;IAChC;EACF;EACA,OAAOV,OAAO;AAChB"}
1
+ {"version":3,"file":"merge-loader-options.js","names":["mergeLoaderOptions","baseOptions","newOptions","options","key","newValue","Object","entries","assign"],"sources":["../../../../src/lib/option-utils/merge-loader-options.ts"],"sourcesContent":["// loaders.gl, MIT license\n\nimport {LoaderOptions} from '../../types';\n\n/**\n *\n * @param baseOptions Can be undefined, in which case a fresh options object will be minted\n * @param newOptions\n * @returns\n */\nexport function mergeLoaderOptions<Options extends LoaderOptions>(\n baseOptions: Options | undefined,\n newOptions: Options\n): Options {\n const options = {...baseOptions};\n for (const [key, newValue] of Object.entries(newOptions)) {\n if (newValue && typeof newValue === 'object') {\n options[key] = options[key] || {};\n Object.assign(options[key] as object, newOptions[key]);\n } else {\n options[key] = newOptions[key];\n }\n }\n return options as Options;\n}\n"],"mappings":";;;;;;AAUO,SAASA,kBAAkBA,CAChCC,WAAgC,EAChCC,UAAmB,EACV;EACT,MAAMC,OAAO,GAAG;IAAC,GAAGF;EAAW,CAAC;EAChC,KAAK,MAAM,CAACG,GAAG,EAAEC,QAAQ,CAAC,IAAIC,MAAM,CAACC,OAAO,CAACL,UAAU,CAAC,EAAE;IACxD,IAAIG,QAAQ,IAAI,OAAOA,QAAQ,KAAK,QAAQ,EAAE;MAC5CF,OAAO,CAACC,GAAG,CAAC,GAAGD,OAAO,CAACC,GAAG,CAAC,IAAI,CAAC,CAAC;MACjCE,MAAM,CAACE,MAAM,CAACL,OAAO,CAACC,GAAG,CAAC,EAAYF,UAAU,CAACE,GAAG,CAAC,CAAC;IACxD,CAAC,MAAM;MACLD,OAAO,CAACC,GAAG,CAAC,GAAGF,UAAU,CAACE,GAAG,CAAC;IAChC;EACF;EACA,OAAOD,OAAO;AAChB"}
@@ -7,8 +7,8 @@ exports.addAliases = addAliases;
7
7
  exports.getPathPrefix = getPathPrefix;
8
8
  exports.resolvePath = resolvePath;
9
9
  exports.setPathPrefix = setPathPrefix;
10
- var pathPrefix = '';
11
- var fileAliases = {};
10
+ let pathPrefix = '';
11
+ const fileAliases = {};
12
12
  function setPathPrefix(prefix) {
13
13
  pathPrefix = prefix;
14
14
  }
@@ -19,9 +19,9 @@ function addAliases(aliases) {
19
19
  Object.assign(fileAliases, aliases);
20
20
  }
21
21
  function resolvePath(filename) {
22
- for (var alias in fileAliases) {
22
+ for (const alias in fileAliases) {
23
23
  if (filename.startsWith(alias)) {
24
- var replacement = fileAliases[alias];
24
+ const replacement = fileAliases[alias];
25
25
  filename = filename.replace(alias, replacement);
26
26
  }
27
27
  }
@@ -1 +1 @@
1
- {"version":3,"file":"file-aliases.js","names":["pathPrefix","fileAliases","setPathPrefix","prefix","getPathPrefix","addAliases","aliases","Object","assign","resolvePath","filename","alias","startsWith","replacement","replace","concat"],"sources":["../../../../src/lib/path-utils/file-aliases.ts"],"sourcesContent":["// Simple file alias mechanisms for tests.\n\nlet pathPrefix = '';\nconst fileAliases: {[aliasPath: string]: string} = {};\n\n/*\n * Set a relative path prefix\n */\nexport function setPathPrefix(prefix: string): void {\n pathPrefix = prefix;\n}\n\n/*\n * Get the relative path prefix\n */\nexport function getPathPrefix(): string {\n return pathPrefix;\n}\n\n/**\n *\n * @param aliases\n *\n * Note: addAliases are an experimental export, they are only for testing of loaders.gl loaders\n * not intended as a generic aliasing mechanism\n */\nexport function addAliases(aliases: {[aliasPath: string]: string}): void {\n Object.assign(fileAliases, aliases);\n}\n\n/**\n * Resolves aliases and adds path-prefix to paths\n */\nexport function resolvePath(filename: string): string {\n for (const alias in fileAliases) {\n if (filename.startsWith(alias)) {\n const replacement = fileAliases[alias];\n filename = filename.replace(alias, replacement);\n }\n }\n if (!filename.startsWith('http://') && !filename.startsWith('https://')) {\n filename = `${pathPrefix}${filename}`;\n }\n return filename;\n}\n"],"mappings":";;;;;;;;;AAEA,IAAIA,UAAU,GAAG,EAAE;AACnB,IAAMC,WAA0C,GAAG,CAAC,CAAC;AAK9C,SAASC,aAAaA,CAACC,MAAc,EAAQ;EAClDH,UAAU,GAAGG,MAAM;AACrB;AAKO,SAASC,aAAaA,CAAA,EAAW;EACtC,OAAOJ,UAAU;AACnB;AASO,SAASK,UAAUA,CAACC,OAAsC,EAAQ;EACvEC,MAAM,CAACC,MAAM,CAACP,WAAW,EAAEK,OAAO,CAAC;AACrC;AAKO,SAASG,WAAWA,CAACC,QAAgB,EAAU;EACpD,KAAK,IAAMC,KAAK,IAAIV,WAAW,EAAE;IAC/B,IAAIS,QAAQ,CAACE,UAAU,CAACD,KAAK,CAAC,EAAE;MAC9B,IAAME,WAAW,GAAGZ,WAAW,CAACU,KAAK,CAAC;MACtCD,QAAQ,GAAGA,QAAQ,CAACI,OAAO,CAACH,KAAK,EAAEE,WAAW,CAAC;IACjD;EACF;EACA,IAAI,CAACH,QAAQ,CAACE,UAAU,CAAC,SAAS,CAAC,IAAI,CAACF,QAAQ,CAACE,UAAU,CAAC,UAAU,CAAC,EAAE;IACvEF,QAAQ,MAAAK,MAAA,CAAMf,UAAU,EAAAe,MAAA,CAAGL,QAAQ,CAAE;EACvC;EACA,OAAOA,QAAQ;AACjB"}
1
+ {"version":3,"file":"file-aliases.js","names":["pathPrefix","fileAliases","setPathPrefix","prefix","getPathPrefix","addAliases","aliases","Object","assign","resolvePath","filename","alias","startsWith","replacement","replace","concat"],"sources":["../../../../src/lib/path-utils/file-aliases.ts"],"sourcesContent":["// Simple file alias mechanisms for tests.\n\nlet pathPrefix = '';\nconst fileAliases: {[aliasPath: string]: string} = {};\n\n/*\n * Set a relative path prefix\n */\nexport function setPathPrefix(prefix: string): void {\n pathPrefix = prefix;\n}\n\n/*\n * Get the relative path prefix\n */\nexport function getPathPrefix(): string {\n return pathPrefix;\n}\n\n/**\n *\n * @param aliases\n *\n * Note: addAliases are an experimental export, they are only for testing of loaders.gl loaders\n * not intended as a generic aliasing mechanism\n */\nexport function addAliases(aliases: {[aliasPath: string]: string}): void {\n Object.assign(fileAliases, aliases);\n}\n\n/**\n * Resolves aliases and adds path-prefix to paths\n */\nexport function resolvePath(filename: string): string {\n for (const alias in fileAliases) {\n if (filename.startsWith(alias)) {\n const replacement = fileAliases[alias];\n filename = filename.replace(alias, replacement);\n }\n }\n if (!filename.startsWith('http://') && !filename.startsWith('https://')) {\n filename = `${pathPrefix}${filename}`;\n }\n return filename;\n}\n"],"mappings":";;;;;;;;;AAEA,IAAIA,UAAU,GAAG,EAAE;AACnB,MAAMC,WAA0C,GAAG,CAAC,CAAC;AAK9C,SAASC,aAAaA,CAACC,MAAc,EAAQ;EAClDH,UAAU,GAAGG,MAAM;AACrB;AAKO,SAASC,aAAaA,CAAA,EAAW;EACtC,OAAOJ,UAAU;AACnB;AASO,SAASK,UAAUA,CAACC,OAAsC,EAAQ;EACvEC,MAAM,CAACC,MAAM,CAACP,WAAW,EAAEK,OAAO,CAAC;AACrC;AAKO,SAASG,WAAWA,CAACC,QAAgB,EAAU;EACpD,KAAK,MAAMC,KAAK,IAAIV,WAAW,EAAE;IAC/B,IAAIS,QAAQ,CAACE,UAAU,CAACD,KAAK,CAAC,EAAE;MAC9B,MAAME,WAAW,GAAGZ,WAAW,CAACU,KAAK,CAAC;MACtCD,QAAQ,GAAGA,QAAQ,CAACI,OAAO,CAACH,KAAK,EAAEE,WAAW,CAAC;IACjD;EACF;EACA,IAAI,CAACH,QAAQ,CAACE,UAAU,CAAC,SAAS,CAAC,IAAI,CAACF,QAAQ,CAACE,UAAU,CAAC,UAAU,CAAC,EAAE;IACvEF,QAAQ,MAAAK,MAAA,CAAMf,UAAU,EAAAe,MAAA,CAAGL,QAAQ,CAAE;EACvC;EACA,OAAOA,QAAQ;AACjB"}
@@ -9,7 +9,7 @@ function getCWD() {
9
9
  if (typeof process !== 'undefined' && typeof process.cwd !== 'undefined') {
10
10
  return process.cwd();
11
11
  }
12
- var pathname = (_window$location = window.location) === null || _window$location === void 0 ? void 0 : _window$location.pathname;
12
+ const pathname = (_window$location = window.location) === null || _window$location === void 0 ? void 0 : _window$location.pathname;
13
13
  return (pathname === null || pathname === void 0 ? void 0 : pathname.slice(0, pathname.lastIndexOf('/') + 1)) || '';
14
14
  }
15
15
  //# sourceMappingURL=get-cwd.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"get-cwd.js","names":["getCWD","_window$location","process","cwd","pathname","window","location","slice","lastIndexOf"],"sources":["../../../../src/lib/path-utils/get-cwd.ts"],"sourcesContent":["// loaders.gl MIT license\n\nexport function getCWD() {\n if (typeof process !== 'undefined' && typeof process.cwd !== 'undefined') {\n return process.cwd();\n }\n const pathname = window.location?.pathname;\n return pathname?.slice(0, pathname.lastIndexOf('/') + 1) || '';\n}\n"],"mappings":";;;;;;AAEO,SAASA,MAAMA,CAAA,EAAG;EAAA,IAAAC,gBAAA;EACvB,IAAI,OAAOC,OAAO,KAAK,WAAW,IAAI,OAAOA,OAAO,CAACC,GAAG,KAAK,WAAW,EAAE;IACxE,OAAOD,OAAO,CAACC,GAAG,CAAC,CAAC;EACtB;EACA,IAAMC,QAAQ,IAAAH,gBAAA,GAAGI,MAAM,CAACC,QAAQ,cAAAL,gBAAA,uBAAfA,gBAAA,CAAiBG,QAAQ;EAC1C,OAAO,CAAAA,QAAQ,aAARA,QAAQ,uBAARA,QAAQ,CAAEG,KAAK,CAAC,CAAC,EAAEH,QAAQ,CAACI,WAAW,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,KAAI,EAAE;AAChE"}
1
+ {"version":3,"file":"get-cwd.js","names":["getCWD","_window$location","process","cwd","pathname","window","location","slice","lastIndexOf"],"sources":["../../../../src/lib/path-utils/get-cwd.ts"],"sourcesContent":["// loaders.gl MIT license\n\nexport function getCWD() {\n if (typeof process !== 'undefined' && typeof process.cwd !== 'undefined') {\n return process.cwd();\n }\n const pathname = window.location?.pathname;\n return pathname?.slice(0, pathname.lastIndexOf('/') + 1) || '';\n}\n"],"mappings":";;;;;;AAEO,SAASA,MAAMA,CAAA,EAAG;EAAA,IAAAC,gBAAA;EACvB,IAAI,OAAOC,OAAO,KAAK,WAAW,IAAI,OAAOA,OAAO,CAACC,GAAG,KAAK,WAAW,EAAE;IACxE,OAAOD,OAAO,CAACC,GAAG,CAAC,CAAC;EACtB;EACA,MAAMC,QAAQ,IAAAH,gBAAA,GAAGI,MAAM,CAACC,QAAQ,cAAAL,gBAAA,uBAAfA,gBAAA,CAAiBG,QAAQ;EAC1C,OAAO,CAAAA,QAAQ,aAARA,QAAQ,uBAARA,QAAQ,CAAEG,KAAK,CAAC,CAAC,EAAEH,QAAQ,CAACI,WAAW,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,KAAI,EAAE;AAChE"}
@@ -9,19 +9,19 @@ exports.join = join;
9
9
  exports.resolve = resolve;
10
10
  var _getCwd = require("./get-cwd");
11
11
  function filename(url) {
12
- var slashIndex = url ? url.lastIndexOf('/') : -1;
12
+ const slashIndex = url ? url.lastIndexOf('/') : -1;
13
13
  return slashIndex >= 0 ? url.substr(slashIndex + 1) : '';
14
14
  }
15
15
  function dirname(url) {
16
- var slashIndex = url ? url.lastIndexOf('/') : -1;
16
+ const slashIndex = url ? url.lastIndexOf('/') : -1;
17
17
  return slashIndex >= 0 ? url.substr(0, slashIndex) : '';
18
18
  }
19
19
  function join() {
20
20
  for (var _len = arguments.length, parts = new Array(_len), _key = 0; _key < _len; _key++) {
21
21
  parts[_key] = arguments[_key];
22
22
  }
23
- var separator = '/';
24
- parts = parts.map(function (part, index) {
23
+ const separator = '/';
24
+ parts = parts.map((part, index) => {
25
25
  if (index) {
26
26
  part = part.replace(new RegExp("^".concat(separator)), '');
27
27
  }
@@ -33,15 +33,15 @@ function join() {
33
33
  return parts.join(separator);
34
34
  }
35
35
  function resolve() {
36
- var paths = [];
37
- for (var _i = 0; _i < arguments.length; _i++) {
36
+ const paths = [];
37
+ for (let _i = 0; _i < arguments.length; _i++) {
38
38
  paths[_i] = _i < 0 || arguments.length <= _i ? undefined : arguments[_i];
39
39
  }
40
- var resolvedPath = '';
41
- var resolvedAbsolute = false;
42
- var cwd;
43
- for (var i = paths.length - 1; i >= -1 && !resolvedAbsolute; i--) {
44
- var path = void 0;
40
+ let resolvedPath = '';
41
+ let resolvedAbsolute = false;
42
+ let cwd;
43
+ for (let i = paths.length - 1; i >= -1 && !resolvedAbsolute; i--) {
44
+ let path;
45
45
  if (i >= 0) {
46
46
  path = paths[i];
47
47
  } else {
@@ -64,15 +64,15 @@ function resolve() {
64
64
  }
65
65
  return '.';
66
66
  }
67
- var SLASH = 47;
68
- var DOT = 46;
67
+ const SLASH = 47;
68
+ const DOT = 46;
69
69
  function normalizeStringPosix(path, allowAboveRoot) {
70
- var res = '';
71
- var lastSlash = -1;
72
- var dots = 0;
73
- var code;
74
- var isAboveRoot = false;
75
- for (var i = 0; i <= path.length; ++i) {
70
+ let res = '';
71
+ let lastSlash = -1;
72
+ let dots = 0;
73
+ let code;
74
+ let isAboveRoot = false;
75
+ for (let i = 0; i <= path.length; ++i) {
76
76
  if (i < path.length) {
77
77
  code = path.charCodeAt(i);
78
78
  } else if (code === SLASH) {
@@ -84,8 +84,8 @@ function normalizeStringPosix(path, allowAboveRoot) {
84
84
  if (lastSlash === i - 1 || dots === 1) {} else if (lastSlash !== i - 1 && dots === 2) {
85
85
  if (res.length < 2 || !isAboveRoot || res.charCodeAt(res.length - 1) !== DOT || res.charCodeAt(res.length - 2) !== DOT) {
86
86
  if (res.length > 2) {
87
- var start = res.length - 1;
88
- var j = start;
87
+ const start = res.length - 1;
88
+ let j = start;
89
89
  for (; j >= 0; --j) {
90
90
  if (res.charCodeAt(j) === SLASH) {
91
91
  break;
@@ -115,7 +115,7 @@ function normalizeStringPosix(path, allowAboveRoot) {
115
115
  isAboveRoot = true;
116
116
  }
117
117
  } else {
118
- var slice = path.slice(lastSlash + 1, i);
118
+ const slice = path.slice(lastSlash + 1, i);
119
119
  if (res.length > 0) {
120
120
  res += "/".concat(slice);
121
121
  } else {
@@ -1 +1 @@
1
- {"version":3,"file":"path.js","names":["_getCwd","require","filename","url","slashIndex","lastIndexOf","substr","dirname","join","_len","arguments","length","parts","Array","_key","separator","map","part","index","replace","RegExp","concat","resolve","paths","_i","undefined","resolvedPath","resolvedAbsolute","cwd","i","path","getCWD","charCodeAt","SLASH","normalizeStringPosix","DOT","allowAboveRoot","res","lastSlash","dots","code","isAboveRoot","start","j","slice"],"sources":["../../../../src/lib/path-utils/path.ts"],"sourcesContent":["// Beginning of a minimal implementation of the Node.js path API, that doesn't pull in big polyfills.\n\nimport {getCWD} from './get-cwd';\n\n/**\n * Replacement for Node.js path.filename\n * @param url\n */\nexport function filename(url: string): string {\n const slashIndex = url ? url.lastIndexOf('/') : -1;\n return slashIndex >= 0 ? url.substr(slashIndex + 1) : '';\n}\n\n/**\n * Replacement for Node.js path.dirname\n * @param url\n */\nexport function dirname(url: string): string {\n const slashIndex = url ? url.lastIndexOf('/') : -1;\n return slashIndex >= 0 ? url.substr(0, slashIndex) : '';\n}\n\n/**\n * Replacement for Node.js path.join\n * @param parts\n */\nexport function join(...parts: string[]): string {\n const separator = '/';\n parts = parts.map((part, index) => {\n if (index) {\n part = part.replace(new RegExp(`^${separator}`), '');\n }\n if (index !== parts.length - 1) {\n part = part.replace(new RegExp(`${separator}$`), '');\n }\n return part;\n });\n return parts.join(separator);\n}\n\n/* eslint-disable no-continue */\n\n/**\n * https://nodejs.org/api/path.html#path_path_resolve_paths\n * @param paths A sequence of paths or path segments.\n * @return resolved path\n * Forked from BTOdell/path-resolve under MIT license\n * @see https://github.com/BTOdell/path-resolve/blob/master/LICENSE\n */\nexport function resolve(...components: string[]): string {\n const paths: string[] = [];\n for (let _i = 0; _i < components.length; _i++) {\n paths[_i] = components[_i];\n }\n let resolvedPath = '';\n let resolvedAbsolute = false;\n let cwd: string | undefined;\n for (let i = paths.length - 1; i >= -1 && !resolvedAbsolute; i--) {\n let path: string | undefined;\n if (i >= 0) {\n path = paths[i];\n } else {\n if (cwd === undefined) {\n cwd = getCWD();\n }\n path = cwd;\n }\n // Skip empty entries\n if (path.length === 0) {\n continue;\n }\n resolvedPath = `${path}/${resolvedPath}`;\n resolvedAbsolute = path.charCodeAt(0) === SLASH;\n }\n // At this point the path should be resolved to a full absolute path, but\n // handle relative paths to be safe (might happen when process.cwd() fails)\n // Normalize the path (removes leading slash)\n resolvedPath = normalizeStringPosix(resolvedPath, !resolvedAbsolute);\n if (resolvedAbsolute) {\n return `/${resolvedPath}`;\n } else if (resolvedPath.length > 0) {\n return resolvedPath;\n }\n return '.';\n}\n\nconst SLASH = 47;\nconst DOT = 46;\n\n/**\n * Resolves . and .. elements in a path with directory names\n * Forked from BTOdell/path-resolve under MIT license\n * @see https://github.com/BTOdell/path-resolve/blob/master/LICENSE\n */\n/* eslint-disable max-depth */\n// eslint-disable-next-line complexity, max-statements\nfunction normalizeStringPosix(path: string, allowAboveRoot: boolean): string {\n let res = '';\n let lastSlash = -1;\n let dots = 0;\n let code: number | undefined;\n let isAboveRoot = false;\n\n for (let i = 0; i <= path.length; ++i) {\n if (i < path.length) {\n code = path.charCodeAt(i);\n } else if (code === SLASH) {\n break;\n } else {\n code = SLASH;\n }\n if (code === SLASH) {\n if (lastSlash === i - 1 || dots === 1) {\n // NOOP\n } else if (lastSlash !== i - 1 && dots === 2) {\n if (\n res.length < 2 ||\n !isAboveRoot ||\n res.charCodeAt(res.length - 1) !== DOT ||\n res.charCodeAt(res.length - 2) !== DOT\n ) {\n if (res.length > 2) {\n const start = res.length - 1;\n let j = start;\n for (; j >= 0; --j) {\n if (res.charCodeAt(j) === SLASH) {\n break;\n }\n }\n if (j !== start) {\n res = j === -1 ? '' : res.slice(0, j);\n lastSlash = i;\n dots = 0;\n isAboveRoot = false;\n continue;\n }\n } else if (res.length === 2 || res.length === 1) {\n res = '';\n lastSlash = i;\n dots = 0;\n isAboveRoot = false;\n continue;\n }\n }\n if (allowAboveRoot) {\n if (res.length > 0) {\n res += '/..';\n } else {\n res = '..';\n }\n isAboveRoot = true;\n }\n } else {\n const slice = path.slice(lastSlash + 1, i);\n if (res.length > 0) {\n res += `/${slice}`;\n } else {\n res = slice;\n }\n isAboveRoot = false;\n }\n lastSlash = i;\n dots = 0;\n } else if (code === DOT && dots !== -1) {\n ++dots;\n } else {\n dots = -1;\n }\n }\n return res;\n}\n"],"mappings":";;;;;;;;;AAEA,IAAAA,OAAA,GAAAC,OAAA;AAMO,SAASC,QAAQA,CAACC,GAAW,EAAU;EAC5C,IAAMC,UAAU,GAAGD,GAAG,GAAGA,GAAG,CAACE,WAAW,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;EAClD,OAAOD,UAAU,IAAI,CAAC,GAAGD,GAAG,CAACG,MAAM,CAACF,UAAU,GAAG,CAAC,CAAC,GAAG,EAAE;AAC1D;AAMO,SAASG,OAAOA,CAACJ,GAAW,EAAU;EAC3C,IAAMC,UAAU,GAAGD,GAAG,GAAGA,GAAG,CAACE,WAAW,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;EAClD,OAAOD,UAAU,IAAI,CAAC,GAAGD,GAAG,CAACG,MAAM,CAAC,CAAC,EAAEF,UAAU,CAAC,GAAG,EAAE;AACzD;AAMO,SAASI,IAAIA,CAAA,EAA6B;EAAA,SAAAC,IAAA,GAAAC,SAAA,CAAAC,MAAA,EAAzBC,KAAK,OAAAC,KAAA,CAAAJ,IAAA,GAAAK,IAAA,MAAAA,IAAA,GAAAL,IAAA,EAAAK,IAAA;IAALF,KAAK,CAAAE,IAAA,IAAAJ,SAAA,CAAAI,IAAA;EAAA;EAC3B,IAAMC,SAAS,GAAG,GAAG;EACrBH,KAAK,GAAGA,KAAK,CAACI,GAAG,CAAC,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AG,CAAC,EAAET,CAAC,CAAC;QAC1C,IAAIQ,GAAG,CAAC1B,MAAM,GAAG,CAAC,EAAE;UAClB0B,GAAG,QAAAhB,MAAA,CAAQuB,KAAK,CAAE;QACpB,CAAC,MAAM;UACLP,GAAG,GAAGO,KAAK;QACb;QACAH,WAAW,GAAG,KAAK;MACrB;MACAH,SAAS,GAAGT,CAAC;MACbU,IAAI,GAAG,CAAC;IACV,CAAC,MAAM,IAAIC,IAAI,KAAKL,GAAG,IAAII,IAAI,KAAK,CAAC,CAAC,EAAE;MACtC,EAAEA,IAAI;IACR,CAAC,MAAM;MACLA,IAAI,GAAG,CAAC,CAAC;IACX;EACF;EACA,OAAOF,GAAG;AACZ"}
1
+ {"version":3,"file":"path.js","names":["_getCwd","require","filename","url","slashIndex","lastIndexOf","substr","dirname","join","_len","arguments","length","parts","Array","_key","separator","map","part","index","replace","RegExp","concat","resolve","paths","_i","undefined","resolvedPath","resolvedAbsolute","cwd","i","path","getCWD","charCodeAt","SLASH","normalizeStringPosix","DOT","allowAboveRoot","res","lastSlash","dots","code","isAboveRoot","start","j","slice"],"sources":["../../../../src/lib/path-utils/path.ts"],"sourcesContent":["// Beginning of a minimal implementation of the Node.js path API, that doesn't pull in big polyfills.\n\nimport {getCWD} from './get-cwd';\n\n/**\n * Replacement for Node.js path.filename\n * @param url\n */\nexport function filename(url: string): string {\n const slashIndex = url ? url.lastIndexOf('/') : -1;\n return slashIndex >= 0 ? url.substr(slashIndex + 1) : '';\n}\n\n/**\n * Replacement for Node.js path.dirname\n * @param url\n */\nexport function dirname(url: string): string {\n const slashIndex = url ? url.lastIndexOf('/') : -1;\n return slashIndex >= 0 ? url.substr(0, slashIndex) : '';\n}\n\n/**\n * Replacement for Node.js path.join\n * @param parts\n */\nexport function join(...parts: string[]): string {\n const separator = '/';\n parts = parts.map((part, index) => {\n if (index) {\n part = part.replace(new RegExp(`^${separator}`), '');\n }\n if (index !== parts.length - 1) {\n part = part.replace(new RegExp(`${separator}$`), '');\n }\n return part;\n });\n return parts.join(separator);\n}\n\n/* eslint-disable no-continue */\n\n/**\n * https://nodejs.org/api/path.html#path_path_resolve_paths\n * @param paths A sequence of paths or path segments.\n * @return resolved path\n * Forked from BTOdell/path-resolve under MIT license\n * @see https://github.com/BTOdell/path-resolve/blob/master/LICENSE\n */\nexport function resolve(...components: string[]): string {\n const paths: string[] = [];\n for (let _i = 0; _i < components.length; _i++) {\n paths[_i] = components[_i];\n }\n let resolvedPath = '';\n let resolvedAbsolute = false;\n let cwd: string | undefined;\n for (let i = paths.length - 1; i >= -1 && !resolvedAbsolute; i--) {\n let path: string | undefined;\n if (i >= 0) {\n path = paths[i];\n } else {\n if (cwd === undefined) {\n cwd = getCWD();\n }\n path = cwd;\n }\n // Skip empty entries\n if (path.length === 0) {\n continue;\n }\n resolvedPath = `${path}/${resolvedPath}`;\n resolvedAbsolute = path.charCodeAt(0) === SLASH;\n }\n // At this point the path should be resolved to a full absolute path, but\n // handle relative paths to be safe (might happen when process.cwd() fails)\n // Normalize the path (removes leading slash)\n resolvedPath = normalizeStringPosix(resolvedPath, !resolvedAbsolute);\n if (resolvedAbsolute) {\n return `/${resolvedPath}`;\n } else if (resolvedPath.length > 0) {\n return resolvedPath;\n }\n return '.';\n}\n\nconst SLASH = 47;\nconst DOT = 46;\n\n/**\n * Resolves . and .. elements in a path with directory names\n * Forked from BTOdell/path-resolve under MIT license\n * @see https://github.com/BTOdell/path-resolve/blob/master/LICENSE\n */\n/* eslint-disable max-depth */\n// eslint-disable-next-line complexity, max-statements\nfunction normalizeStringPosix(path: string, allowAboveRoot: boolean): string {\n let res = '';\n let lastSlash = -1;\n let dots = 0;\n let code: number | undefined;\n let isAboveRoot = false;\n\n for (let i = 0; i <= path.length; ++i) {\n if (i < path.length) {\n code = path.charCodeAt(i);\n } else if (code === SLASH) {\n break;\n } else {\n code = SLASH;\n }\n if (code === SLASH) {\n if (lastSlash === i - 1 || dots === 1) {\n // NOOP\n } else if (lastSlash !== i - 1 && dots === 2) {\n if (\n res.length < 2 ||\n !isAboveRoot ||\n res.charCodeAt(res.length - 1) !== DOT ||\n res.charCodeAt(res.length - 2) !== DOT\n ) {\n if (res.length > 2) {\n const start = res.length - 1;\n let j = start;\n for (; j >= 0; --j) {\n if (res.charCodeAt(j) === SLASH) {\n break;\n }\n }\n if (j !== start) {\n res = j === -1 ? '' : res.slice(0, j);\n lastSlash = i;\n dots = 0;\n isAboveRoot = false;\n continue;\n }\n } else if (res.length === 2 || res.length === 1) {\n res = '';\n lastSlash = i;\n dots = 0;\n isAboveRoot = false;\n continue;\n }\n }\n if (allowAboveRoot) {\n if (res.length > 0) {\n res += '/..';\n } else {\n res = '..';\n }\n isAboveRoot = true;\n }\n } else {\n const slice = path.slice(lastSlash + 1, i);\n if (res.length > 0) {\n res += `/${slice}`;\n } else {\n res = slice;\n }\n isAboveRoot = false;\n }\n lastSlash = i;\n dots = 0;\n } else if (code === DOT && dots !== -1) {\n ++dots;\n } else {\n dots = -1;\n }\n }\n return res;\n}\n"],"mappings":";;;;;;;;;AAEA,IAAAA,OAAA,GAAAC,OAAA;AAMO,SAASC,QAAQA,CAACC,GAAW,EAAU;EAC5C,MAAMC,UAAU,GAAGD,GAAG,GAAGA,GAAG,CAACE,WAAW,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;EAClD,OAAOD,UAAU,IAAI,CAAC,GAAGD,GAAG,CAACG,MAAM,CAACF,UAAU,GAAG,CAAC,CAAC,GAAG,EAAE;AAC1D;AAMO,SAASG,OAAOA,CAACJ,GAAW,EAAU;EAC3C,MAAMC,UAAU,GAAGD,GAAG,GAAGA,GAAG,CAACE,WAAW,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;EAClD,OAAOD,UAAU,IAAI,CAAC,GAAGD,GAAG,CAACG,MAAM,CAAC,CAAC,EAAEF,UAAU,CAAC,GAAG,EAAE;AACzD;AAMO,SAASI,IAAIA,CAAA,EAA6B;EAAA,SAAAC,IAAA,GAAAC,SAAA,CAAAC,M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EAAE;UAClB,IAAIC,GAAG,CAAC1B,MAAM,GAAG,CAAC,EAAE;YAClB0B,GAAG,IAAI,KAAK;UACd,CAAC,MAAM;YACLA,GAAG,GAAG,IAAI;UACZ;UACAI,WAAW,GAAG,IAAI;QACpB;MACF,CAAC,MAAM;QACL,MAAMG,KAAK,GAAGd,IAAI,CAACc,KAAK,CAACN,SAAS,GAAG,CAAC,EAAET,CAAC,CAAC;QAC1C,IAAIQ,GAAG,CAAC1B,MAAM,GAAG,CAAC,EAAE;UAClB0B,GAAG,QAAAhB,MAAA,CAAQuB,KAAK,CAAE;QACpB,CAAC,MAAM;UACLP,GAAG,GAAGO,KAAK;QACb;QACAH,WAAW,GAAG,KAAK;MACrB;MACAH,SAAS,GAAGT,CAAC;MACbU,IAAI,GAAG,CAAC;IACV,CAAC,MAAM,IAAIC,IAAI,KAAKL,GAAG,IAAII,IAAI,KAAK,CAAC,CAAC,EAAE;MACtC,EAAEA,IAAI;IACR,CAAC,MAAM;MACLA,IAAI,GAAG,CAAC,CAAC;IACX;EACF;EACA,OAAOF,GAAG;AACZ"}
@@ -5,33 +5,31 @@ Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
7
  exports.default = void 0;
8
- var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
9
- var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
10
8
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
11
9
  var _stats = require("@probe.gl/stats");
12
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
13
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
14
- var STAT_QUEUED_REQUESTS = 'Queued Requests';
15
- var STAT_ACTIVE_REQUESTS = 'Active Requests';
16
- var STAT_CANCELLED_REQUESTS = 'Cancelled Requests';
17
- var STAT_QUEUED_REQUESTS_EVER = 'Queued Requests Ever';
18
- var STAT_ACTIVE_REQUESTS_EVER = 'Active Requests Ever';
19
- var DEFAULT_PROPS = {
10
+ const STAT_QUEUED_REQUESTS = 'Queued Requests';
11
+ const STAT_ACTIVE_REQUESTS = 'Active Requests';
12
+ const STAT_CANCELLED_REQUESTS = 'Cancelled Requests';
13
+ const STAT_QUEUED_REQUESTS_EVER = 'Queued Requests Ever';
14
+ const STAT_ACTIVE_REQUESTS_EVER = 'Active Requests Ever';
15
+ const DEFAULT_PROPS = {
20
16
  id: 'request-scheduler',
21
17
  throttleRequests: true,
22
18
  maxRequests: 6
23
19
  };
24
- var RequestScheduler = function () {
25
- function RequestScheduler() {
26
- var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
27
- (0, _classCallCheck2.default)(this, RequestScheduler);
20
+ class RequestScheduler {
21
+ constructor() {
22
+ let props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
28
23
  (0, _defineProperty2.default)(this, "props", void 0);
29
24
  (0, _defineProperty2.default)(this, "stats", void 0);
30
25
  (0, _defineProperty2.default)(this, "activeRequestCount", 0);
31
26
  (0, _defineProperty2.default)(this, "requestQueue", []);
32
27
  (0, _defineProperty2.default)(this, "requestMap", new Map());
33
28
  (0, _defineProperty2.default)(this, "deferredUpdate", null);
34
- this.props = _objectSpread(_objectSpread({}, DEFAULT_PROPS), props);
29
+ this.props = {
30
+ ...DEFAULT_PROPS,
31
+ ...props
32
+ };
35
33
  this.stats = new _stats.Stats({
36
34
  id: this.props.id
37
35
  });
@@ -41,110 +39,90 @@ var RequestScheduler = function () {
41
39
  this.stats.get(STAT_QUEUED_REQUESTS_EVER);
42
40
  this.stats.get(STAT_ACTIVE_REQUESTS_EVER);
43
41
  }
44
- (0, _createClass2.default)(RequestScheduler, [{
45
- key: "scheduleRequest",
46
- value: function scheduleRequest(handle) {
47
- var getPriority = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : function () {
48
- return 0;
49
- };
50
- if (!this.props.throttleRequests) {
51
- return Promise.resolve({
52
- done: function done() {}
53
- });
54
- }
55
- if (this.requestMap.has(handle)) {
56
- return this.requestMap.get(handle);
57
- }
58
- var request = {
59
- handle: handle,
60
- priority: 0,
61
- getPriority: getPriority
62
- };
63
- var promise = new Promise(function (resolve) {
64
- request.resolve = resolve;
65
- return request;
42
+ scheduleRequest(handle) {
43
+ let getPriority = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : () => 0;
44
+ if (!this.props.throttleRequests) {
45
+ return Promise.resolve({
46
+ done: () => {}
66
47
  });
67
- this.requestQueue.push(request);
68
- this.requestMap.set(handle, promise);
69
- this._issueNewRequests();
70
- return promise;
71
48
  }
72
- }, {
73
- key: "_issueRequest",
74
- value: function _issueRequest(request) {
75
- var _this = this;
76
- var handle = request.handle,
77
- resolve = request.resolve;
78
- var isDone = false;
79
- var done = function done() {
80
- if (!isDone) {
81
- isDone = true;
82
- _this.requestMap.delete(handle);
83
- _this.activeRequestCount--;
84
- _this._issueNewRequests();
85
- }
86
- };
87
- this.activeRequestCount++;
88
- return resolve ? resolve({
89
- done: done
90
- }) : Promise.resolve({
91
- done: done
92
- });
49
+ if (this.requestMap.has(handle)) {
50
+ return this.requestMap.get(handle);
93
51
  }
94
- }, {
95
- key: "_issueNewRequests",
96
- value: function _issueNewRequests() {
97
- var _this2 = this;
98
- if (!this.deferredUpdate) {
99
- this.deferredUpdate = setTimeout(function () {
100
- return _this2._issueNewRequestsAsync();
101
- }, 0);
52
+ const request = {
53
+ handle,
54
+ priority: 0,
55
+ getPriority
56
+ };
57
+ const promise = new Promise(resolve => {
58
+ request.resolve = resolve;
59
+ return request;
60
+ });
61
+ this.requestQueue.push(request);
62
+ this.requestMap.set(handle, promise);
63
+ this._issueNewRequests();
64
+ return promise;
65
+ }
66
+ _issueRequest(request) {
67
+ const {
68
+ handle,
69
+ resolve
70
+ } = request;
71
+ let isDone = false;
72
+ const done = () => {
73
+ if (!isDone) {
74
+ isDone = true;
75
+ this.requestMap.delete(handle);
76
+ this.activeRequestCount--;
77
+ this._issueNewRequests();
102
78
  }
79
+ };
80
+ this.activeRequestCount++;
81
+ return resolve ? resolve({
82
+ done
83
+ }) : Promise.resolve({
84
+ done
85
+ });
86
+ }
87
+ _issueNewRequests() {
88
+ if (!this.deferredUpdate) {
89
+ this.deferredUpdate = setTimeout(() => this._issueNewRequestsAsync(), 0);
103
90
  }
104
- }, {
105
- key: "_issueNewRequestsAsync",
106
- value: function _issueNewRequestsAsync() {
107
- this.deferredUpdate = null;
108
- var freeSlots = Math.max(this.props.maxRequests - this.activeRequestCount, 0);
109
- if (freeSlots === 0) {
110
- return;
111
- }
112
- this._updateAllRequests();
113
- for (var i = 0; i < freeSlots; ++i) {
114
- var request = this.requestQueue.shift();
115
- if (request) {
116
- this._issueRequest(request);
117
- }
118
- }
91
+ }
92
+ _issueNewRequestsAsync() {
93
+ this.deferredUpdate = null;
94
+ const freeSlots = Math.max(this.props.maxRequests - this.activeRequestCount, 0);
95
+ if (freeSlots === 0) {
96
+ return;
119
97
  }
120
- }, {
121
- key: "_updateAllRequests",
122
- value: function _updateAllRequests() {
123
- var requestQueue = this.requestQueue;
124
- for (var i = 0; i < requestQueue.length; ++i) {
125
- var request = requestQueue[i];
126
- if (!this._updateRequest(request)) {
127
- requestQueue.splice(i, 1);
128
- this.requestMap.delete(request.handle);
129
- i--;
130
- }
98
+ this._updateAllRequests();
99
+ for (let i = 0; i < freeSlots; ++i) {
100
+ const request = this.requestQueue.shift();
101
+ if (request) {
102
+ this._issueRequest(request);
131
103
  }
132
- requestQueue.sort(function (a, b) {
133
- return a.priority - b.priority;
134
- });
135
104
  }
136
- }, {
137
- key: "_updateRequest",
138
- value: function _updateRequest(request) {
139
- request.priority = request.getPriority(request.handle);
140
- if (request.priority < 0) {
141
- request.resolve(null);
142
- return false;
105
+ }
106
+ _updateAllRequests() {
107
+ const requestQueue = this.requestQueue;
108
+ for (let i = 0; i < requestQueue.length; ++i) {
109
+ const request = requestQueue[i];
110
+ if (!this._updateRequest(request)) {
111
+ requestQueue.splice(i, 1);
112
+ this.requestMap.delete(request.handle);
113
+ i--;
143
114
  }
144
- return true;
145
115
  }
146
- }]);
147
- return RequestScheduler;
148
- }();
116
+ requestQueue.sort((a, b) => a.priority - b.priority);
117
+ }
118
+ _updateRequest(request) {
119
+ request.priority = request.getPriority(request.handle);
120
+ if (request.priority < 0) {
121
+ request.resolve(null);
122
+ return false;
123
+ }
124
+ return true;
125
+ }
126
+ }
149
127
  exports.default = RequestScheduler;
150
128
  //# sourceMappingURL=request-scheduler.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"request-scheduler.js","names":["_stats","require","ownKeys","object","enumerableOnly","keys","Object","getOwnPropertySymbols","symbols","filter","sym","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","target","i","arguments","length","source","forEach","key","_defineProperty2","default","getOwnPropertyDescriptors","defineProperties","defineProperty","STAT_QUEUED_REQUESTS","STAT_ACTIVE_REQUESTS","STAT_CANCELLED_REQUESTS","STAT_QUEUED_REQUESTS_EVER","STAT_ACTIVE_REQUESTS_EVER","DEFAULT_PROPS","id","throttleRequests","maxRequests","RequestScheduler","props","undefined","_classCallCheck2","Map","stats","Stats","get","_createClass2","value","scheduleRequest","handle","getPriority","Promise","resolve","done","requestMap","has","request","priority","promise","requestQueue","set","_issueNewRequests","_issueRequest","_this","isDone","delete","activeRequestCount","_this2","deferredUpdate","setTimeout","_issueNewRequestsAsync","freeSlots","Math","max","_updateAllRequests","shift","_updateRequest","splice","sort","a","b","exports"],"sources":["../../../../src/lib/request-utils/request-scheduler.ts"],"sourcesContent":["import {Stats} from '@probe.gl/stats';\n\ntype Handle = any;\ntype DoneFunction = () => any;\ntype GetPriorityFunction = () => number;\ntype RequestResult = {\n done: DoneFunction;\n} | null;\n\n/** RequestScheduler Options */\nexport type RequestSchedulerProps = {\n id?: string;\n throttleRequests?: boolean;\n maxRequests?: number;\n};\n\nconst STAT_QUEUED_REQUESTS = 'Queued Requests';\nconst STAT_ACTIVE_REQUESTS = 'Active Requests';\nconst STAT_CANCELLED_REQUESTS = 'Cancelled Requests';\nconst STAT_QUEUED_REQUESTS_EVER = 'Queued Requests Ever';\nconst STAT_ACTIVE_REQUESTS_EVER = 'Active Requests Ever';\n\nconst DEFAULT_PROPS: Required<RequestSchedulerProps> = {\n id: 'request-scheduler',\n // Specifies if the request scheduler should throttle incoming requests, mainly for comparative testing\n throttleRequests: true,\n // The maximum number of simultaneous active requests. Un-throttled requests do not observe this limit.\n maxRequests: 6\n};\n\n/** Tracks one request */\ntype Request = {\n handle: Handle;\n priority: number;\n getPriority: GetPriorityFunction;\n resolve?: (value: any) => any;\n};\n\n/**\n * Used to issue a request, without having them \"deeply queued\" by the browser.\n * @todo - Track requests globally, across multiple servers\n */\nexport default class RequestScheduler {\n readonly props: Required<RequestSchedulerProps>;\n readonly stats: Stats;\n activeRequestCount: number = 0;\n\n /** Tracks the number of active requests and prioritizes/cancels queued requests. */\n private requestQueue: Request[] = [];\n private requestMap: Map<Handle, Promise<RequestResult>> = new Map();\n private deferredUpdate: any = null;\n\n constructor(props: RequestSchedulerProps = {}) {\n this.props = {...DEFAULT_PROPS, ...props};\n\n // Returns the statistics used by the request scheduler.\n this.stats = new Stats({id: this.props.id});\n this.stats.get(STAT_QUEUED_REQUESTS);\n this.stats.get(STAT_ACTIVE_REQUESTS);\n this.stats.get(STAT_CANCELLED_REQUESTS);\n this.stats.get(STAT_QUEUED_REQUESTS_EVER);\n this.stats.get(STAT_ACTIVE_REQUESTS_EVER);\n }\n\n /**\n * Called by an application that wants to issue a request, without having it deeply queued by the browser\n *\n * When the returned promise resolved, it is OK for the application to issue a request.\n * The promise resolves to an object that contains a `done` method.\n * When the application's request has completed (or failed), the application must call the `done` function\n *\n * @param handle\n * @param getPriority will be called when request \"slots\" open up,\n * allowing the caller to update priority or cancel the request\n * Highest priority executes first, priority < 0 cancels the request\n * @returns a promise\n * - resolves to a object (with a `done` field) when the request can be issued without queueing,\n * - resolves to `null` if the request has been cancelled (by the callback return < 0).\n * In this case the application should not issue the request\n */\n scheduleRequest(\n handle: Handle,\n getPriority: GetPriorityFunction = () => 0\n ): Promise<RequestResult> {\n // Allows throttling to be disabled\n if (!this.props.throttleRequests) {\n return Promise.resolve({done: () => {}});\n }\n\n // dedupe\n if (this.requestMap.has(handle)) {\n return this.requestMap.get(handle) as Promise<any>;\n }\n\n const request: Request = {handle, priority: 0, getPriority};\n const promise = new Promise<RequestResult>((resolve) => {\n // @ts-ignore\n request.resolve = resolve;\n return request;\n });\n\n this.requestQueue.push(request);\n this.requestMap.set(handle, promise);\n this._issueNewRequests();\n return promise;\n }\n\n // PRIVATE\n\n _issueRequest(request: Request): Promise<any> {\n const {handle, resolve} = request;\n let isDone = false;\n\n const done = () => {\n // can only be called once\n if (!isDone) {\n isDone = true;\n\n // Stop tracking a request - it has completed, failed, cancelled etc\n this.requestMap.delete(handle);\n this.activeRequestCount--;\n // A slot just freed up, see if any queued requests are waiting\n this._issueNewRequests();\n }\n };\n\n // Track this request\n this.activeRequestCount++;\n\n return resolve ? resolve({done}) : Promise.resolve({done});\n }\n\n /** We check requests asynchronously, to prevent multiple updates */\n _issueNewRequests(): void {\n if (!this.deferredUpdate) {\n this.deferredUpdate = setTimeout(() => this._issueNewRequestsAsync(), 0);\n }\n }\n\n /** Refresh all requests */\n _issueNewRequestsAsync() {\n // TODO - shouldn't we clear the timeout?\n this.deferredUpdate = null;\n\n const freeSlots = Math.max(this.props.maxRequests - this.activeRequestCount, 0);\n\n if (freeSlots === 0) {\n return;\n }\n\n this._updateAllRequests();\n\n // Resolve pending promises for the top-priority requests\n for (let i = 0; i < freeSlots; ++i) {\n const request = this.requestQueue.shift();\n if (request) {\n this._issueRequest(request); // eslint-disable-line @typescript-eslint/no-floating-promises\n }\n }\n\n // Uncomment to debug\n // console.log(`${freeSlots} free slots, ${this.requestQueue.length} queued requests`);\n }\n\n /** Ensure all requests have updated priorities, and that no longer valid requests are cancelled */\n _updateAllRequests() {\n const requestQueue = this.requestQueue;\n for (let i = 0; i < requestQueue.length; ++i) {\n const request = requestQueue[i];\n if (!this._updateRequest(request)) {\n // Remove the element and make sure to adjust the counter to account for shortened array\n requestQueue.splice(i, 1);\n this.requestMap.delete(request.handle);\n i--;\n }\n }\n\n // Sort the remaining requests based on priority\n requestQueue.sort((a, b) => a.priority - b.priority);\n }\n\n /** Update a single request by calling the callback */\n _updateRequest(request) {\n request.priority = request.getPriority(request.handle); // eslint-disable-line callback-return\n\n // by returning a negative priority, the callback cancels the request\n if (request.priority < 0) {\n request.resolve(null);\n return false;\n }\n return true;\n }\n}\n"],"mappings":";;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAAsC,SAAAC,QAAAC,MAAA,EAAAC,cAAA,QAAAC,IAAA,GAAAC,MAAA,CAAAD,IAAA,CAAAF,MAAA,OAAAG,MAAA,CAAAC,qBAAA,QAAAC,OAAA,GAAAF,MAAA,CAAAC,qBAAA,CAAAJ,MAAA,GAAAC,cAAA,KAAAI,OAAA,GAAAA,OAAA,CAAAC,MAAA,WAAAC,GAAA,WAAAJ,MAAA,CAAAK,wBAAA,CAAAR,MAAA,EAAAO,GAAA,EAAAE,UAAA,OAAAP,IAAA,CAAAQ,IAAA,CAAAC,KAAA,CAAAT,IAAA,EAAAG,OAAA,YAAAH,IAAA;AAAA,SAAAU,cAAAC,MAAA,aAAAC,CAAA,MAAAA,CAAA,GAAAC,SAAA,CAAAC,MAAA,EAAAF,CAAA,UA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AAepB,OAAO,EAAE;MACtBA,OAAO,CAACC,QAAQ,GAAGD,OAAO,CAACN,WAAW,CAACM,OAAO,CAACP,MAAM,CAAC;MAGtD,IAAIO,OAAO,CAACC,QAAQ,GAAG,CAAC,EAAE;QACxBD,OAAO,CAACJ,OAAO,CAAC,IAAI,CAAC;QACrB,OAAO,KAAK;MACd;MACA,OAAO,IAAI;IACb;EAAC;EAAA,OAAAd,gBAAA;AAAA;AAAA2C,OAAA,CAAAxD,OAAA,GAAAa,gBAAA"}
1
+ {"version":3,"file":"request-scheduler.js","names":["_stats","require","STAT_QUEUED_REQUESTS","STAT_ACTIVE_REQUESTS","STAT_CANCELLED_REQUESTS","STAT_QUEUED_REQUESTS_EVER","STAT_ACTIVE_REQUESTS_EVER","DEFAULT_PROPS","id","throttleRequests","maxRequests","RequestScheduler","constructor","props","arguments","length","undefined","_defineProperty2","default","Map","stats","Stats","get","scheduleRequest","handle","getPriority","Promise","resolve","done","requestMap","has","request","priority","promise","requestQueue","push","set","_issueNewRequests","_issueRequest","isDone","delete","activeRequestCount","deferredUpdate","setTimeout","_issueNewRequestsAsync","freeSlots","Math","max","_updateAllRequests","i","shift","_updateRequest","splice","sort","a","b","exports"],"sources":["../../../../src/lib/request-utils/request-scheduler.ts"],"sourcesContent":["import {Stats} from '@probe.gl/stats';\n\ntype Handle = any;\ntype DoneFunction = () => any;\ntype GetPriorityFunction = () => number;\ntype RequestResult = {\n done: DoneFunction;\n} | null;\n\n/** RequestScheduler Options */\nexport type RequestSchedulerProps = {\n id?: string;\n throttleRequests?: boolean;\n maxRequests?: number;\n};\n\nconst STAT_QUEUED_REQUESTS = 'Queued Requests';\nconst STAT_ACTIVE_REQUESTS = 'Active Requests';\nconst STAT_CANCELLED_REQUESTS = 'Cancelled Requests';\nconst STAT_QUEUED_REQUESTS_EVER = 'Queued Requests Ever';\nconst STAT_ACTIVE_REQUESTS_EVER = 'Active Requests Ever';\n\nconst DEFAULT_PROPS: Required<RequestSchedulerProps> = {\n id: 'request-scheduler',\n // Specifies if the request scheduler should throttle incoming requests, mainly for comparative testing\n throttleRequests: true,\n // The maximum number of simultaneous active requests. Un-throttled requests do not observe this limit.\n maxRequests: 6\n};\n\n/** Tracks one request */\ntype Request = {\n handle: Handle;\n priority: number;\n getPriority: GetPriorityFunction;\n resolve?: (value: any) => any;\n};\n\n/**\n * Used to issue a request, without having them \"deeply queued\" by the browser.\n * @todo - Track requests globally, across multiple servers\n */\nexport default class RequestScheduler {\n readonly props: Required<RequestSchedulerProps>;\n readonly stats: Stats;\n activeRequestCount: number = 0;\n\n /** Tracks the number of active requests and prioritizes/cancels queued requests. */\n private requestQueue: Request[] = [];\n private requestMap: Map<Handle, Promise<RequestResult>> = new Map();\n private deferredUpdate: any = null;\n\n constructor(props: RequestSchedulerProps = {}) {\n this.props = {...DEFAULT_PROPS, ...props};\n\n // Returns the statistics used by the request scheduler.\n this.stats = new Stats({id: this.props.id});\n this.stats.get(STAT_QUEUED_REQUESTS);\n this.stats.get(STAT_ACTIVE_REQUESTS);\n this.stats.get(STAT_CANCELLED_REQUESTS);\n this.stats.get(STAT_QUEUED_REQUESTS_EVER);\n this.stats.get(STAT_ACTIVE_REQUESTS_EVER);\n }\n\n /**\n * Called by an application that wants to issue a request, without having it deeply queued by the browser\n *\n * When the returned promise resolved, it is OK for the application to issue a request.\n * The promise resolves to an object that contains a `done` method.\n * When the application's request has completed (or failed), the application must call the `done` function\n *\n * @param handle\n * @param getPriority will be called when request \"slots\" open up,\n * allowing the caller to update priority or cancel the request\n * Highest priority executes first, priority < 0 cancels the request\n * @returns a promise\n * - resolves to a object (with a `done` field) when the request can be issued without queueing,\n * - resolves to `null` if the request has been cancelled (by the callback return < 0).\n * In this case the application should not issue the request\n */\n scheduleRequest(\n handle: Handle,\n getPriority: GetPriorityFunction = () => 0\n ): Promise<RequestResult> {\n // Allows throttling to be disabled\n if (!this.props.throttleRequests) {\n return Promise.resolve({done: () => {}});\n }\n\n // dedupe\n if (this.requestMap.has(handle)) {\n return this.requestMap.get(handle) as Promise<any>;\n }\n\n const request: Request = {handle, priority: 0, getPriority};\n const promise = new Promise<RequestResult>((resolve) => {\n // @ts-ignore\n request.resolve = resolve;\n return request;\n });\n\n this.requestQueue.push(request);\n this.requestMap.set(handle, promise);\n this._issueNewRequests();\n return promise;\n }\n\n // PRIVATE\n\n _issueRequest(request: Request): Promise<any> {\n const {handle, resolve} = request;\n let isDone = false;\n\n const done = () => {\n // can only be called once\n if (!isDone) {\n isDone = true;\n\n // Stop tracking a request - it has completed, failed, cancelled etc\n this.requestMap.delete(handle);\n this.activeRequestCount--;\n // A slot just freed up, see if any queued requests are waiting\n this._issueNewRequests();\n }\n };\n\n // Track this request\n this.activeRequestCount++;\n\n return resolve ? resolve({done}) : Promise.resolve({done});\n }\n\n /** We check requests asynchronously, to prevent multiple updates */\n _issueNewRequests(): void {\n if (!this.deferredUpdate) {\n this.deferredUpdate = setTimeout(() => this._issueNewRequestsAsync(), 0);\n }\n }\n\n /** Refresh all requests */\n _issueNewRequestsAsync() {\n // TODO - shouldn't we clear the timeout?\n this.deferredUpdate = null;\n\n const freeSlots = Math.max(this.props.maxRequests - this.activeRequestCount, 0);\n\n if (freeSlots === 0) {\n return;\n }\n\n this._updateAllRequests();\n\n // Resolve pending promises for the top-priority requests\n for (let i = 0; i < freeSlots; ++i) {\n const request = this.requestQueue.shift();\n if (request) {\n this._issueRequest(request); // eslint-disable-line @typescript-eslint/no-floating-promises\n }\n }\n\n // Uncomment to debug\n // console.log(`${freeSlots} free slots, ${this.requestQueue.length} queued requests`);\n }\n\n /** Ensure all requests have updated priorities, and that no longer valid requests are cancelled */\n _updateAllRequests() {\n const requestQueue = this.requestQueue;\n for (let i = 0; i < requestQueue.length; ++i) {\n const request = requestQueue[i];\n if (!this._updateRequest(request)) {\n // Remove the element and make sure to adjust the counter to account for shortened array\n requestQueue.splice(i, 1);\n this.requestMap.delete(request.handle);\n i--;\n }\n }\n\n // Sort the remaining requests based on priority\n requestQueue.sort((a, b) => a.priority - b.priority);\n }\n\n /** Update a single request by calling the callback */\n _updateRequest(request) {\n request.priority = request.getPriority(request.handle); // eslint-disable-line callback-return\n\n // by returning a negative priority, the callback cancels the request\n if (request.priority < 0) {\n request.resolve(null);\n return false;\n }\n return true;\n }\n}\n"],"mappings":";;;;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAgBA,MAAMC,oBAAoB,GAAG,iBAAiB;AAC9C,MAAMC,oBAAoB,GAAG,iBAAiB;AAC9C,MAAMC,uBAAuB,GAAG,oBAAoB;AACpD,MAAMC,yBAAyB,GAAG,sBAAsB;AACxD,MAAMC,yBAAyB,GAAG,sBAAsB;AAExD,MAAMC,aAA8C,GAAG;EACrDC,EAAE,EAAE,mBAAmB;EAEvBC,gBAAgB,EAAE,IAAI;EAEtBC,WAAW,EAAE;AACf,CAAC;AAcc,MAAMC,gBAAgB,CAAC;EAUpCC,WAAWA,CAAA,EAAoC;IAAA,IAAnCC,KAA4B,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,CAAC,CAAC;IAAA,IAAAG,gBAAA,CAAAC,OAAA;IAAA,IAAAD,gBAAA,CAAAC,OAAA;IAAA,IAAAD,gBAAA,CAAAC,OAAA,8BAPhB,CAAC;IAAA,IAAAD,gBAAA,CAAAC,OAAA,wBAGI,EAAE;IAAA,IAAAD,gBAAA,CAAAC,OAAA,sBACsB,IAAIC,GAAG,CAAC,CAAC;IAAA,IAAAF,gBAAA,CAAAC,OAAA,0BACrC,IAAI;IAGhC,IAAI,CAACL,KAAK,GAAG;MAAC,GAAGN,aAAa;MAAE,GAAGM;IAAK,CAAC;IAGzC,IAAI,CAACO,KAAK,GAAG,IAAIC,YAAK,CAAC;MAACb,EAAE,EAAE,IAAI,CAACK,KAAK,CAACL;IAAE,CAAC,CAAC;IAC3C,IAAI,CAACY,KAAK,CAACE,GAAG,CAACpB,oBAAoB,CAAC;IACpC,IAAI,CAACkB,KAA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