@loaders.gl/pmtiles 4.4.0-alpha.2 → 4.4.0

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.
package/dist/dist.dev.js CHANGED
@@ -854,7 +854,139 @@ var __exports__ = (() => {
854
854
  }
855
855
 
856
856
  // ../../node_modules/@probe.gl/env/dist/index.js
857
- var VERSION = true ? "4.0.7" : "untranspiled source";
857
+ var VERSION = true ? "4.1.1" : "untranspiled source";
858
+
859
+ // ../../node_modules/@probe.gl/log/dist/utils/assert.js
860
+ function assert2(condition, message) {
861
+ if (!condition) {
862
+ throw new Error(message || "Assertion failed");
863
+ }
864
+ }
865
+
866
+ // ../../node_modules/@probe.gl/log/dist/loggers/log-utils.js
867
+ function normalizeLogLevel(logLevel) {
868
+ if (!logLevel) {
869
+ return 0;
870
+ }
871
+ let resolvedLevel;
872
+ switch (typeof logLevel) {
873
+ case "number":
874
+ resolvedLevel = logLevel;
875
+ break;
876
+ case "object":
877
+ resolvedLevel = logLevel.logLevel || logLevel.priority || 0;
878
+ break;
879
+ default:
880
+ return 0;
881
+ }
882
+ assert2(Number.isFinite(resolvedLevel) && resolvedLevel >= 0);
883
+ return resolvedLevel;
884
+ }
885
+ function normalizeArguments(opts) {
886
+ const { logLevel, message } = opts;
887
+ opts.logLevel = normalizeLogLevel(logLevel);
888
+ const args = opts.args ? Array.from(opts.args) : [];
889
+ while (args.length && args.shift() !== message) {
890
+ }
891
+ switch (typeof logLevel) {
892
+ case "string":
893
+ case "function":
894
+ if (message !== void 0) {
895
+ args.unshift(message);
896
+ }
897
+ opts.message = logLevel;
898
+ break;
899
+ case "object":
900
+ Object.assign(opts, logLevel);
901
+ break;
902
+ default:
903
+ }
904
+ if (typeof opts.message === "function") {
905
+ opts.message = opts.message();
906
+ }
907
+ const messageType = typeof opts.message;
908
+ assert2(messageType === "string" || messageType === "object");
909
+ return Object.assign(opts, { args }, opts.opts);
910
+ }
911
+
912
+ // ../../node_modules/@probe.gl/log/dist/loggers/base-log.js
913
+ var noop = () => {
914
+ };
915
+ var BaseLog = class {
916
+ constructor({ level = 0 } = {}) {
917
+ this.userData = {};
918
+ this._onceCache = /* @__PURE__ */ new Set();
919
+ this._level = level;
920
+ }
921
+ set level(newLevel) {
922
+ this.setLevel(newLevel);
923
+ }
924
+ get level() {
925
+ return this.getLevel();
926
+ }
927
+ setLevel(level) {
928
+ this._level = level;
929
+ return this;
930
+ }
931
+ getLevel() {
932
+ return this._level;
933
+ }
934
+ // Unconditional logging
935
+ warn(message, ...args) {
936
+ return this._log("warn", 0, message, args, { once: true });
937
+ }
938
+ error(message, ...args) {
939
+ return this._log("error", 0, message, args);
940
+ }
941
+ // Conditional logging
942
+ log(logLevel, message, ...args) {
943
+ return this._log("log", logLevel, message, args);
944
+ }
945
+ info(logLevel, message, ...args) {
946
+ return this._log("info", logLevel, message, args);
947
+ }
948
+ once(logLevel, message, ...args) {
949
+ return this._log("once", logLevel, message, args, { once: true });
950
+ }
951
+ _log(type, logLevel, message, args, options = {}) {
952
+ const normalized = normalizeArguments({
953
+ logLevel,
954
+ message,
955
+ args: this._buildArgs(logLevel, message, args),
956
+ opts: options
957
+ });
958
+ return this._createLogFunction(type, normalized, options);
959
+ }
960
+ _buildArgs(logLevel, message, args) {
961
+ return [logLevel, message, ...args];
962
+ }
963
+ _createLogFunction(type, normalized, options) {
964
+ if (!this._shouldLog(normalized.logLevel)) {
965
+ return noop;
966
+ }
967
+ const tag = this._getOnceTag(options.tag ?? normalized.tag ?? normalized.message);
968
+ if ((options.once || normalized.once) && tag !== void 0) {
969
+ if (this._onceCache.has(tag)) {
970
+ return noop;
971
+ }
972
+ this._onceCache.add(tag);
973
+ }
974
+ return this._emit(type, normalized);
975
+ }
976
+ _shouldLog(logLevel) {
977
+ return this.getLevel() >= normalizeLogLevel(logLevel);
978
+ }
979
+ _getOnceTag(tag) {
980
+ if (tag === void 0) {
981
+ return void 0;
982
+ }
983
+ try {
984
+ return typeof tag === "string" ? tag : String(tag);
985
+ } catch {
986
+ return void 0;
987
+ }
988
+ }
989
+ };
858
990
 
859
991
  // ../../node_modules/@probe.gl/log/dist/utils/local-storage.js
860
992
  function getStorage(type) {
@@ -973,13 +1105,6 @@ var __exports__ = (() => {
973
1105
  }
974
1106
  }
975
1107
 
976
- // ../../node_modules/@probe.gl/log/dist/utils/assert.js
977
- function assert2(condition, message) {
978
- if (!condition) {
979
- throw new Error(message || "Assertion failed");
980
- }
981
- }
982
-
983
1108
  // ../../node_modules/@probe.gl/log/dist/utils/hi-res-timestamp.js
984
1109
  function getHiResTimestamp() {
985
1110
  let timestamp;
@@ -994,7 +1119,7 @@ var __exports__ = (() => {
994
1119
  return timestamp;
995
1120
  }
996
1121
 
997
- // ../../node_modules/@probe.gl/log/dist/log.js
1122
+ // ../../node_modules/@probe.gl/log/dist/loggers/probe-log.js
998
1123
  var originalConsole = {
999
1124
  debug: isBrowser2() ? console.debug || console.log : console.log,
1000
1125
  log: console.log,
@@ -1006,12 +1131,9 @@ var __exports__ = (() => {
1006
1131
  enabled: true,
1007
1132
  level: 0
1008
1133
  };
1009
- function noop() {
1010
- }
1011
- var cache = {};
1012
- var ONCE = { once: true };
1013
- var Log = class {
1134
+ var ProbeLog = class extends BaseLog {
1014
1135
  constructor({ id } = { id: "" }) {
1136
+ super({ level: 0 });
1015
1137
  this.VERSION = VERSION;
1016
1138
  this._startTs = getHiResTimestamp();
1017
1139
  this._deltaTs = getHiResTimestamp();
@@ -1019,22 +1141,16 @@ var __exports__ = (() => {
1019
1141
  this.LOG_THROTTLE_TIMEOUT = 0;
1020
1142
  this.id = id;
1021
1143
  this.userData = {};
1022
- this._storage = new LocalStorage(`__probe-${this.id}__`, DEFAULT_LOG_CONFIGURATION);
1144
+ this._storage = new LocalStorage(`__probe-${this.id}__`, { [this.id]: DEFAULT_LOG_CONFIGURATION });
1023
1145
  this.timeStamp(`${this.id} started`);
1024
1146
  autobind(this);
1025
1147
  Object.seal(this);
1026
1148
  }
1027
- set level(newLevel) {
1028
- this.setLevel(newLevel);
1029
- }
1030
- get level() {
1031
- return this.getLevel();
1032
- }
1033
1149
  isEnabled() {
1034
- return this._storage.config.enabled;
1150
+ return this._getConfiguration().enabled;
1035
1151
  }
1036
1152
  getLevel() {
1037
- return this._storage.config.level;
1153
+ return this._getConfiguration().level;
1038
1154
  }
1039
1155
  /** @return milliseconds, with fractions */
1040
1156
  getTotal() {
@@ -1058,20 +1174,20 @@ var __exports__ = (() => {
1058
1174
  }
1059
1175
  // Configure
1060
1176
  enable(enabled = true) {
1061
- this._storage.setConfiguration({ enabled });
1177
+ this._updateConfiguration({ enabled });
1062
1178
  return this;
1063
1179
  }
1064
1180
  setLevel(level) {
1065
- this._storage.setConfiguration({ level });
1181
+ this._updateConfiguration({ level });
1066
1182
  return this;
1067
1183
  }
1068
1184
  /** return the current status of the setting */
1069
1185
  get(setting) {
1070
- return this._storage.config[setting];
1186
+ return this._getConfiguration()[setting];
1071
1187
  }
1072
1188
  // update the status of the setting
1073
1189
  set(setting, value) {
1074
- this._storage.setConfiguration({ [setting]: value });
1190
+ this._updateConfiguration({ [setting]: value });
1075
1191
  }
1076
1192
  /** Logs the current settings as a table */
1077
1193
  settings() {
@@ -1087,11 +1203,16 @@ var __exports__ = (() => {
1087
1203
  throw new Error(message || "Assertion failed");
1088
1204
  }
1089
1205
  }
1090
- warn(message) {
1091
- return this._getLogFunction(0, message, originalConsole.warn, arguments, ONCE);
1206
+ warn(message, ...args) {
1207
+ return this._log("warn", 0, message, args, {
1208
+ method: originalConsole.warn,
1209
+ once: true
1210
+ });
1092
1211
  }
1093
- error(message) {
1094
- return this._getLogFunction(0, message, originalConsole.error, arguments);
1212
+ error(message, ...args) {
1213
+ return this._log("error", 0, message, args, {
1214
+ method: originalConsole.error
1215
+ });
1095
1216
  }
1096
1217
  /** Print a deprecation warning */
1097
1218
  deprecated(oldUsage, newUsage) {
@@ -1101,50 +1222,63 @@ var __exports__ = (() => {
1101
1222
  removed(oldUsage, newUsage) {
1102
1223
  return this.error(`\`${oldUsage}\` has been removed. Use \`${newUsage}\` instead`);
1103
1224
  }
1104
- probe(logLevel, message) {
1105
- return this._getLogFunction(logLevel, message, originalConsole.log, arguments, {
1225
+ probe(logLevel, message, ...args) {
1226
+ return this._log("log", logLevel, message, args, {
1227
+ method: originalConsole.log,
1106
1228
  time: true,
1107
1229
  once: true
1108
1230
  });
1109
1231
  }
1110
- log(logLevel, message) {
1111
- return this._getLogFunction(logLevel, message, originalConsole.debug, arguments);
1232
+ log(logLevel, message, ...args) {
1233
+ return this._log("log", logLevel, message, args, {
1234
+ method: originalConsole.debug
1235
+ });
1112
1236
  }
1113
- info(logLevel, message) {
1114
- return this._getLogFunction(logLevel, message, console.info, arguments);
1237
+ info(logLevel, message, ...args) {
1238
+ return this._log("info", logLevel, message, args, { method: console.info });
1115
1239
  }
1116
- once(logLevel, message) {
1117
- return this._getLogFunction(logLevel, message, originalConsole.debug || originalConsole.info, arguments, ONCE);
1240
+ once(logLevel, message, ...args) {
1241
+ return this._log("once", logLevel, message, args, {
1242
+ method: originalConsole.debug || originalConsole.info,
1243
+ once: true
1244
+ });
1118
1245
  }
1119
1246
  /** Logs an object as a table */
1120
1247
  table(logLevel, table, columns) {
1121
1248
  if (table) {
1122
- return this._getLogFunction(logLevel, table, console.table || noop, columns && [columns], {
1249
+ return this._log("table", logLevel, table, columns && [columns] || [], {
1250
+ method: console.table || noop,
1123
1251
  tag: getTableHeader(table)
1124
1252
  });
1125
1253
  }
1126
1254
  return noop;
1127
1255
  }
1128
1256
  time(logLevel, message) {
1129
- return this._getLogFunction(logLevel, message, console.time ? console.time : console.info);
1257
+ return this._log("time", logLevel, message, [], {
1258
+ method: console.time ? console.time : console.info
1259
+ });
1130
1260
  }
1131
1261
  timeEnd(logLevel, message) {
1132
- return this._getLogFunction(logLevel, message, console.timeEnd ? console.timeEnd : console.info);
1262
+ return this._log("time", logLevel, message, [], {
1263
+ method: console.timeEnd ? console.timeEnd : console.info
1264
+ });
1133
1265
  }
1134
1266
  timeStamp(logLevel, message) {
1135
- return this._getLogFunction(logLevel, message, console.timeStamp || noop);
1267
+ return this._log("time", logLevel, message, [], {
1268
+ method: console.timeStamp || noop
1269
+ });
1136
1270
  }
1137
1271
  group(logLevel, message, opts = { collapsed: false }) {
1138
- const options = normalizeArguments({ logLevel, message, opts });
1139
- const { collapsed } = opts;
1140
- options.method = (collapsed ? console.groupCollapsed : console.group) || console.info;
1141
- return this._getLogFunction(options);
1272
+ const method = (opts.collapsed ? console.groupCollapsed : console.group) || console.info;
1273
+ return this._log("group", logLevel, message, [], { method });
1142
1274
  }
1143
1275
  groupCollapsed(logLevel, message, opts = {}) {
1144
1276
  return this.group(logLevel, message, Object.assign({}, opts, { collapsed: true }));
1145
1277
  }
1146
1278
  groupEnd(logLevel) {
1147
- return this._getLogFunction(logLevel, "", console.groupEnd || noop);
1279
+ return this._log("groupEnd", logLevel, "", [], {
1280
+ method: console.groupEnd || noop
1281
+ });
1148
1282
  }
1149
1283
  // EXPERIMENTAL
1150
1284
  withGroup(logLevel, message, func) {
@@ -1160,78 +1294,34 @@ var __exports__ = (() => {
1160
1294
  console.trace();
1161
1295
  }
1162
1296
  }
1163
- // PRIVATE METHODS
1164
- /** Deduces log level from a variety of arguments */
1165
1297
  _shouldLog(logLevel) {
1166
- return this.isEnabled() && this.getLevel() >= normalizeLogLevel(logLevel);
1167
- }
1168
- _getLogFunction(logLevel, message, method, args, opts) {
1169
- if (this._shouldLog(logLevel)) {
1170
- opts = normalizeArguments({ logLevel, message, args, opts });
1171
- method = method || opts.method;
1172
- assert2(method);
1173
- opts.total = this.getTotal();
1174
- opts.delta = this.getDelta();
1175
- this._deltaTs = getHiResTimestamp();
1176
- const tag = opts.tag || opts.message;
1177
- if (opts.once && tag) {
1178
- if (!cache[tag]) {
1179
- cache[tag] = getHiResTimestamp();
1180
- } else {
1181
- return noop;
1182
- }
1183
- }
1184
- message = decorateMessage(this.id, opts.message, opts);
1185
- return method.bind(console, message, ...opts.args);
1186
- }
1187
- return noop;
1188
- }
1189
- };
1190
- Log.VERSION = VERSION;
1191
- function normalizeLogLevel(logLevel) {
1192
- if (!logLevel) {
1193
- return 0;
1194
- }
1195
- let resolvedLevel;
1196
- switch (typeof logLevel) {
1197
- case "number":
1198
- resolvedLevel = logLevel;
1199
- break;
1200
- case "object":
1201
- resolvedLevel = logLevel.logLevel || logLevel.priority || 0;
1202
- break;
1203
- default:
1204
- return 0;
1298
+ return this.isEnabled() && super._shouldLog(logLevel);
1205
1299
  }
1206
- assert2(Number.isFinite(resolvedLevel) && resolvedLevel >= 0);
1207
- return resolvedLevel;
1208
- }
1209
- function normalizeArguments(opts) {
1210
- const { logLevel, message } = opts;
1211
- opts.logLevel = normalizeLogLevel(logLevel);
1212
- const args = opts.args ? Array.from(opts.args) : [];
1213
- while (args.length && args.shift() !== message) {
1300
+ _emit(_type, normalized) {
1301
+ const method = normalized.method;
1302
+ assert2(method);
1303
+ normalized.total = this.getTotal();
1304
+ normalized.delta = this.getDelta();
1305
+ this._deltaTs = getHiResTimestamp();
1306
+ const message = decorateMessage(this.id, normalized.message, normalized);
1307
+ return method.bind(console, message, ...normalized.args);
1214
1308
  }
1215
- switch (typeof logLevel) {
1216
- case "string":
1217
- case "function":
1218
- if (message !== void 0) {
1219
- args.unshift(message);
1220
- }
1221
- opts.message = logLevel;
1222
- break;
1223
- case "object":
1224
- Object.assign(opts, logLevel);
1225
- break;
1226
- default:
1309
+ _getConfiguration() {
1310
+ if (!this._storage.config[this.id]) {
1311
+ this._updateConfiguration(DEFAULT_LOG_CONFIGURATION);
1312
+ }
1313
+ return this._storage.config[this.id];
1227
1314
  }
1228
- if (typeof opts.message === "function") {
1229
- opts.message = opts.message();
1315
+ _updateConfiguration(configuration) {
1316
+ const currentConfiguration = this._storage.config[this.id] || {
1317
+ ...DEFAULT_LOG_CONFIGURATION
1318
+ };
1319
+ this._storage.setConfiguration({
1320
+ [this.id]: { ...currentConfiguration, ...configuration }
1321
+ });
1230
1322
  }
1231
- const messageType = typeof opts.message;
1232
- assert2(messageType === "string" || messageType === "object");
1233
- return Object.assign(opts, { args }, opts.opts);
1234
- }
1323
+ };
1324
+ ProbeLog.VERSION = VERSION;
1235
1325
  function decorateMessage(id, message, opts) {
1236
1326
  if (typeof message === "string") {
1237
1327
  const time = opts.time ? leftPad(formatTime(opts.total)) : "";
@@ -1253,17 +1343,17 @@ var __exports__ = (() => {
1253
1343
  globalThis.probe = {};
1254
1344
 
1255
1345
  // ../../node_modules/@probe.gl/log/dist/index.js
1256
- var dist_default = new Log({ id: "@probe.gl/log" });
1346
+ var dist_default = new ProbeLog({ id: "@probe.gl/log" });
1257
1347
 
1258
1348
  // ../loader-utils/src/lib/log-utils/log.ts
1259
1349
  var VERSION2 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "latest";
1260
1350
  var version = VERSION2[0] >= "0" && VERSION2[0] <= "9" ? `v${VERSION2}` : "";
1261
1351
  function createLog() {
1262
- const log2 = new Log({ id: "loaders.gl" });
1263
- globalThis.loaders = globalThis.loaders || {};
1352
+ const log2 = new ProbeLog({ id: "loaders.gl" });
1353
+ globalThis.loaders ||= {};
1264
1354
  globalThis.loaders.log = log2;
1265
1355
  globalThis.loaders.version = version;
1266
- globalThis.probe = globalThis.probe || {};
1356
+ globalThis.probe ||= {};
1267
1357
  globalThis.probe.loaders = log2;
1268
1358
  return log2;
1269
1359
  }
@@ -1354,7 +1444,7 @@ var __exports__ = (() => {
1354
1444
  }
1355
1445
  this.data = data;
1356
1446
  this.url = typeof data === "string" ? resolvePath(data) : "";
1357
- this.loadOptions = { ...this.options.core?.loadOptions };
1447
+ this.loadOptions = normalizeDirectLoaderOptions(this.options.core?.loadOptions);
1358
1448
  this.fetch = getFetchFunction(this.loadOptions);
1359
1449
  }
1360
1450
  setProps(options) {
@@ -1387,7 +1477,7 @@ var __exports__ = (() => {
1387
1477
  }
1388
1478
  });
1389
1479
  function getFetchFunction(options) {
1390
- const fetchFunction = options?.fetch;
1480
+ const fetchFunction = options?.core?.fetch;
1391
1481
  if (fetchFunction && typeof fetchFunction === "function") {
1392
1482
  return (url, fetchOptions2) => fetchFunction(url, fetchOptions2);
1393
1483
  }
@@ -1397,6 +1487,23 @@ var __exports__ = (() => {
1397
1487
  }
1398
1488
  return (url) => fetch(url);
1399
1489
  }
1490
+ function normalizeDirectLoaderOptions(options) {
1491
+ const loadOptions = { ...options };
1492
+ if (options?.core) {
1493
+ loadOptions.core = { ...options.core };
1494
+ }
1495
+ const topLevelBaseUri = typeof loadOptions.baseUri === "string" ? loadOptions.baseUri : void 0;
1496
+ const topLevelBaseUrl = typeof loadOptions.baseUrl === "string" ? loadOptions.baseUrl : void 0;
1497
+ if (topLevelBaseUri !== void 0 || topLevelBaseUrl !== void 0) {
1498
+ loadOptions.core ||= {};
1499
+ if (loadOptions.core.baseUrl === void 0) {
1500
+ loadOptions.core.baseUrl = topLevelBaseUrl ?? topLevelBaseUri;
1501
+ }
1502
+ delete loadOptions.baseUri;
1503
+ delete loadOptions.baseUrl;
1504
+ }
1505
+ return loadOptions;
1506
+ }
1400
1507
 
1401
1508
  // ../images/src/lib/utils/version.ts
1402
1509
  var VERSION3 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "latest";
@@ -1537,7 +1644,6 @@ var __exports__ = (() => {
1537
1644
  }
1538
1645
 
1539
1646
  // ../images/src/lib/parsers/parse-to-image-bitmap.ts
1540
- var EMPTY_OBJECT = {};
1541
1647
  var imagebitmapOptionsSupported = true;
1542
1648
  async function parseToImageBitmap(arrayBuffer, options, url) {
1543
1649
  let blob;
@@ -1565,8 +1671,13 @@ var __exports__ = (() => {
1565
1671
  return await createImageBitmap(blob);
1566
1672
  }
1567
1673
  function isEmptyObject(object) {
1568
- for (const key in object || EMPTY_OBJECT) {
1569
- return false;
1674
+ if (!object) {
1675
+ return true;
1676
+ }
1677
+ for (const key in object) {
1678
+ if (Object.prototype.hasOwnProperty.call(object, key)) {
1679
+ return false;
1680
+ }
1570
1681
  }
1571
1682
  return true;
1572
1683
  }
@@ -4258,9 +4369,9 @@ var __exports__ = (() => {
4258
4369
  return header;
4259
4370
  });
4260
4371
  }
4261
- function getZxy(header, source, cache2, z, x2, y, signal) {
4372
+ function getZxy(header, source, cache, z, x2, y, signal) {
4262
4373
  return __async(this, null, function* () {
4263
- let rootDir = yield cache2.getArrayBuffer(
4374
+ let rootDir = yield cache.getArrayBuffer(
4264
4375
  source,
4265
4376
  header.rootDirectoryOffset,
4266
4377
  header.rootDirectoryLength,
@@ -4290,7 +4401,7 @@ var __exports__ = (() => {
4290
4401
  leafcoords.y
4291
4402
  );
4292
4403
  if (leafdirEntry) {
4293
- let leafDir = yield cache2.getArrayBuffer(
4404
+ let leafDir = yield cache.getArrayBuffer(
4294
4405
  source,
4295
4406
  leafdirEntry.offset,
4296
4407
  leafdirEntry.length,
@@ -4411,7 +4522,13 @@ var __exports__ = (() => {
4411
4522
  return { cancel: () => abortController.abort() };
4412
4523
  };
4413
4524
  var Protocol = class {
4414
- constructor() {
4525
+ /**
4526
+ * Initialize the MapLibre PMTiles protocol.
4527
+ *
4528
+ * * metadata: also load the metadata section of the PMTiles. required for some "inspect" functionality
4529
+ * and to automatically populate the map attribution. Requires an extra HTTP request.
4530
+ */
4531
+ constructor(options) {
4415
4532
  this.tilev4 = (params, abortController) => __async(this, null, function* () {
4416
4533
  if (params.type === "json") {
4417
4534
  const pmtilesUrl2 = params.url.substr(10);
@@ -4420,6 +4537,11 @@ var __exports__ = (() => {
4420
4537
  instance2 = new PMTiles(pmtilesUrl2);
4421
4538
  this.tiles.set(pmtilesUrl2, instance2);
4422
4539
  }
4540
+ if (this.metadata) {
4541
+ return {
4542
+ data: yield instance2.getTileJson(params.url)
4543
+ };
4544
+ }
4423
4545
  const h = yield instance2.getHeader();
4424
4546
  return {
4425
4547
  data: {
@@ -4460,6 +4582,7 @@ var __exports__ = (() => {
4460
4582
  });
4461
4583
  this.tile = v3compat(this.tilev4);
4462
4584
  this.tiles = /* @__PURE__ */ new Map();
4585
+ this.metadata = (options == null ? void 0 : options.metadata) || false;
4463
4586
  }
4464
4587
  /**
4465
4588
  * Add a {@link PMTiles} instance to the global protocol instance.
@@ -4752,15 +4875,15 @@ var __exports__ = (() => {
4752
4875
  }
4753
4876
  const requestHeaders = new Headers(this.customHeaders);
4754
4877
  requestHeaders.set("range", `bytes=${offset}-${offset + length - 1}`);
4755
- let cache2;
4878
+ let cache;
4756
4879
  if (this.mustReload) {
4757
- cache2 = "reload";
4880
+ cache = "reload";
4758
4881
  } else if (this.chromeWindowsNoCache) {
4759
- cache2 = "no-store";
4882
+ cache = "no-store";
4760
4883
  }
4761
4884
  let resp = yield fetch(this.url, {
4762
4885
  signal,
4763
- cache: cache2,
4886
+ cache,
4764
4887
  headers: requestHeaders
4765
4888
  //biome-ignore lint: "cache" is incompatible between cloudflare workers and browser
4766
4889
  });
@@ -5138,7 +5261,7 @@ var __exports__ = (() => {
5138
5261
  }
5139
5262
  };
5140
5263
  var PMTiles = class {
5141
- constructor(source, cache2, decompress) {
5264
+ constructor(source, cache, decompress) {
5142
5265
  if (typeof source === "string") {
5143
5266
  this.source = new FetchSource(source);
5144
5267
  } else {
@@ -5149,8 +5272,8 @@ var __exports__ = (() => {
5149
5272
  } else {
5150
5273
  this.decompress = defaultDecompress;
5151
5274
  }
5152
- if (cache2) {
5153
- this.cache = cache2;
5275
+ if (cache) {
5276
+ this.cache = cache;
5154
5277
  } else {
5155
5278
  this.cache = new SharedPromiseCache();
5156
5279
  }
@@ -5455,8 +5578,8 @@ var __exports__ = (() => {
5455
5578
  async getVectorTile(tileParams) {
5456
5579
  const arrayBuffer = await this.getTile(tileParams);
5457
5580
  const loadOptions = {
5458
- shape: "geojson-table",
5459
5581
  mvt: {
5582
+ shape: "geojson-table",
5460
5583
  coordinates: "wgs84",
5461
5584
  tileIndex: { x: tileParams.x, y: tileParams.y, z: tileParams.z },
5462
5585
  ...this.loadOptions?.mvt