@loaders.gl/pmtiles 4.3.0-alpha.8 → 4.3.0-beta.1
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 +149 -223
- package/dist/dist.min.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/lib/version.js +1 -1
- package/dist/pmtiles-source.d.ts +1 -2
- package/dist/pmtiles-source.d.ts.map +1 -1
- package/package.json +6 -6
- package/src/pmtiles-source.ts +4 -3
package/dist/dist.dev.js
CHANGED
|
@@ -152,7 +152,7 @@ var __exports__ = (() => {
|
|
|
152
152
|
var SHIFT_LEFT_32 = (1 << 16) * (1 << 16);
|
|
153
153
|
var SHIFT_RIGHT_32 = 1 / SHIFT_LEFT_32;
|
|
154
154
|
var TEXT_DECODER_MIN_LENGTH = 12;
|
|
155
|
-
var utf8TextDecoder = typeof TextDecoder === "undefined" ? null : new TextDecoder("
|
|
155
|
+
var utf8TextDecoder = typeof TextDecoder === "undefined" ? null : new TextDecoder("utf-8");
|
|
156
156
|
Pbf.prototype = {
|
|
157
157
|
destroy: function() {
|
|
158
158
|
this.buf = null;
|
|
@@ -824,85 +824,37 @@ var __exports__ = (() => {
|
|
|
824
824
|
var matches = typeof process !== "undefined" && process.version && /v([0-9]*)/.exec(process.version);
|
|
825
825
|
var nodeVersion = matches && parseFloat(matches[1]) || 0;
|
|
826
826
|
|
|
827
|
-
// ../../node_modules/@
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
return obj2 && "function" == typeof Symbol && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2;
|
|
834
|
-
}, _typeof(obj);
|
|
835
|
-
}
|
|
836
|
-
|
|
837
|
-
// ../../node_modules/@babel/runtime/helpers/esm/toPrimitive.js
|
|
838
|
-
function _toPrimitive(input, hint) {
|
|
839
|
-
if (_typeof(input) !== "object" || input === null)
|
|
840
|
-
return input;
|
|
841
|
-
var prim = input[Symbol.toPrimitive];
|
|
842
|
-
if (prim !== void 0) {
|
|
843
|
-
var res = prim.call(input, hint || "default");
|
|
844
|
-
if (_typeof(res) !== "object")
|
|
845
|
-
return res;
|
|
846
|
-
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
847
|
-
}
|
|
848
|
-
return (hint === "string" ? String : Number)(input);
|
|
849
|
-
}
|
|
850
|
-
|
|
851
|
-
// ../../node_modules/@babel/runtime/helpers/esm/toPropertyKey.js
|
|
852
|
-
function _toPropertyKey(arg) {
|
|
853
|
-
var key = _toPrimitive(arg, "string");
|
|
854
|
-
return _typeof(key) === "symbol" ? key : String(key);
|
|
855
|
-
}
|
|
856
|
-
|
|
857
|
-
// ../../node_modules/@babel/runtime/helpers/esm/defineProperty.js
|
|
858
|
-
function _defineProperty(obj, key, value) {
|
|
859
|
-
key = _toPropertyKey(key);
|
|
860
|
-
if (key in obj) {
|
|
861
|
-
Object.defineProperty(obj, key, {
|
|
862
|
-
value,
|
|
863
|
-
enumerable: true,
|
|
864
|
-
configurable: true,
|
|
865
|
-
writable: true
|
|
866
|
-
});
|
|
867
|
-
} else {
|
|
868
|
-
obj[key] = value;
|
|
869
|
-
}
|
|
870
|
-
return obj;
|
|
871
|
-
}
|
|
827
|
+
// ../../node_modules/@probe.gl/log/node_modules/@probe.gl/env/dist/lib/globals.js
|
|
828
|
+
var window_2 = globalThis;
|
|
829
|
+
var document_2 = globalThis.document || {};
|
|
830
|
+
var process_ = globalThis.process || {};
|
|
831
|
+
var console_ = globalThis.console;
|
|
832
|
+
var navigator_ = globalThis.navigator || {};
|
|
872
833
|
|
|
873
834
|
// ../../node_modules/@probe.gl/log/node_modules/@probe.gl/env/dist/lib/is-electron.js
|
|
874
835
|
function isElectron(mockUserAgent) {
|
|
875
|
-
if (typeof window !== "undefined" &&
|
|
836
|
+
if (typeof window !== "undefined" && window.process?.type === "renderer") {
|
|
876
837
|
return true;
|
|
877
838
|
}
|
|
878
|
-
if (typeof process !== "undefined" &&
|
|
839
|
+
if (typeof process !== "undefined" && Boolean(process.versions?.["electron"])) {
|
|
879
840
|
return true;
|
|
880
841
|
}
|
|
881
|
-
const realUserAgent = typeof navigator
|
|
842
|
+
const realUserAgent = typeof navigator !== "undefined" && navigator.userAgent;
|
|
882
843
|
const userAgent = mockUserAgent || realUserAgent;
|
|
883
|
-
|
|
884
|
-
return true;
|
|
885
|
-
}
|
|
886
|
-
return false;
|
|
844
|
+
return Boolean(userAgent && userAgent.indexOf("Electron") >= 0);
|
|
887
845
|
}
|
|
888
846
|
|
|
889
847
|
// ../../node_modules/@probe.gl/log/node_modules/@probe.gl/env/dist/lib/is-browser.js
|
|
890
848
|
function isBrowser2() {
|
|
891
|
-
const isNode =
|
|
849
|
+
const isNode = (
|
|
850
|
+
// @ts-expect-error
|
|
851
|
+
typeof process === "object" && String(process) === "[object process]" && !process?.browser
|
|
852
|
+
);
|
|
892
853
|
return !isNode || isElectron();
|
|
893
854
|
}
|
|
894
855
|
|
|
895
|
-
// ../../node_modules/@probe.gl/log/node_modules/@probe.gl/env/dist/
|
|
896
|
-
var
|
|
897
|
-
var window_2 = globalThis.window || globalThis.self || globalThis.global;
|
|
898
|
-
var document_2 = globalThis.document || {};
|
|
899
|
-
var process_ = globalThis.process || {};
|
|
900
|
-
var console_ = globalThis.console;
|
|
901
|
-
var navigator_ = globalThis.navigator || {};
|
|
902
|
-
|
|
903
|
-
// ../../node_modules/@probe.gl/log/node_modules/@probe.gl/env/dist/utils/globals.js
|
|
904
|
-
var VERSION = typeof __VERSION__ !== "undefined" ? __VERSION__ : "untranspiled source";
|
|
905
|
-
var isBrowser3 = isBrowser2();
|
|
856
|
+
// ../../node_modules/@probe.gl/log/node_modules/@probe.gl/env/dist/index.js
|
|
857
|
+
var VERSION = true ? "4.0.7" : "untranspiled source";
|
|
906
858
|
|
|
907
859
|
// ../../node_modules/@probe.gl/log/dist/utils/local-storage.js
|
|
908
860
|
function getStorage(type) {
|
|
@@ -917,11 +869,7 @@ var __exports__ = (() => {
|
|
|
917
869
|
}
|
|
918
870
|
}
|
|
919
871
|
var LocalStorage = class {
|
|
920
|
-
constructor(id, defaultConfig) {
|
|
921
|
-
let type = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : "sessionStorage";
|
|
922
|
-
_defineProperty(this, "storage", void 0);
|
|
923
|
-
_defineProperty(this, "id", void 0);
|
|
924
|
-
_defineProperty(this, "config", void 0);
|
|
872
|
+
constructor(id, defaultConfig, type = "sessionStorage") {
|
|
925
873
|
this.storage = getStorage(type);
|
|
926
874
|
this.id = id;
|
|
927
875
|
this.config = defaultConfig;
|
|
@@ -937,6 +885,7 @@ var __exports__ = (() => {
|
|
|
937
885
|
this.storage.setItem(this.id, serialized);
|
|
938
886
|
}
|
|
939
887
|
}
|
|
888
|
+
// Get config from persistent store, if available
|
|
940
889
|
_loadConfiguration() {
|
|
941
890
|
let configuration = {};
|
|
942
891
|
if (this.storage) {
|
|
@@ -952,31 +901,19 @@ var __exports__ = (() => {
|
|
|
952
901
|
function formatTime(ms) {
|
|
953
902
|
let formatted;
|
|
954
903
|
if (ms < 10) {
|
|
955
|
-
formatted =
|
|
904
|
+
formatted = `${ms.toFixed(2)}ms`;
|
|
956
905
|
} else if (ms < 100) {
|
|
957
|
-
formatted =
|
|
906
|
+
formatted = `${ms.toFixed(1)}ms`;
|
|
958
907
|
} else if (ms < 1e3) {
|
|
959
|
-
formatted =
|
|
908
|
+
formatted = `${ms.toFixed(0)}ms`;
|
|
960
909
|
} else {
|
|
961
|
-
formatted =
|
|
910
|
+
formatted = `${(ms / 1e3).toFixed(2)}s`;
|
|
962
911
|
}
|
|
963
912
|
return formatted;
|
|
964
913
|
}
|
|
965
|
-
function leftPad(string) {
|
|
966
|
-
let length = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 8;
|
|
914
|
+
function leftPad(string, length = 8) {
|
|
967
915
|
const padLength = Math.max(length - string.length, 0);
|
|
968
|
-
return "
|
|
969
|
-
}
|
|
970
|
-
function formatImage(image, message, scale) {
|
|
971
|
-
let maxWidth = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : 600;
|
|
972
|
-
const imageUrl = image.src.replace(/\(/g, "%28").replace(/\)/g, "%29");
|
|
973
|
-
if (image.width > maxWidth) {
|
|
974
|
-
scale = Math.min(scale, maxWidth / image.width);
|
|
975
|
-
}
|
|
976
|
-
const width = image.width * scale;
|
|
977
|
-
const height = image.height * scale;
|
|
978
|
-
const style = ["font-size:1px;", "padding:".concat(Math.floor(height / 2), "px ").concat(Math.floor(width / 2), "px;"), "line-height:".concat(height, "px;"), "background:url(".concat(imageUrl, ");"), "background-size:".concat(width, "px ").concat(height, "px;"), "color:transparent;"].join("");
|
|
979
|
-
return ["".concat(message, " %c+"), style];
|
|
916
|
+
return `${" ".repeat(padLength)}${string}`;
|
|
980
917
|
}
|
|
981
918
|
|
|
982
919
|
// ../../node_modules/@probe.gl/log/dist/utils/color.js
|
|
@@ -1011,19 +948,18 @@ var __exports__ = (() => {
|
|
|
1011
948
|
if (!isBrowser2 && typeof string === "string") {
|
|
1012
949
|
if (color) {
|
|
1013
950
|
const colorCode = getColor(color);
|
|
1014
|
-
string =
|
|
951
|
+
string = `\x1B[${colorCode}m${string}\x1B[39m`;
|
|
1015
952
|
}
|
|
1016
953
|
if (background) {
|
|
1017
954
|
const colorCode = getColor(background);
|
|
1018
|
-
string =
|
|
955
|
+
string = `\x1B[${colorCode + BACKGROUND_INCREMENT}m${string}\x1B[49m`;
|
|
1019
956
|
}
|
|
1020
957
|
}
|
|
1021
958
|
return string;
|
|
1022
959
|
}
|
|
1023
960
|
|
|
1024
961
|
// ../../node_modules/@probe.gl/log/dist/utils/autobind.js
|
|
1025
|
-
function autobind(obj) {
|
|
1026
|
-
let predefined = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : ["constructor"];
|
|
962
|
+
function autobind(obj, predefined = ["constructor"]) {
|
|
1027
963
|
const proto = Object.getPrototypeOf(obj);
|
|
1028
964
|
const propNames = Object.getOwnPropertyNames(proto);
|
|
1029
965
|
const object = obj;
|
|
@@ -1048,11 +984,9 @@ var __exports__ = (() => {
|
|
|
1048
984
|
function getHiResTimestamp() {
|
|
1049
985
|
let timestamp;
|
|
1050
986
|
if (isBrowser2() && window_2.performance) {
|
|
1051
|
-
|
|
1052
|
-
timestamp = window_2 === null || window_2 === void 0 ? void 0 : (_window$performance = window_2.performance) === null || _window$performance === void 0 ? void 0 : (_window$performance$n = _window$performance.now) === null || _window$performance$n === void 0 ? void 0 : _window$performance$n.call(_window$performance);
|
|
987
|
+
timestamp = window_2?.performance?.now?.();
|
|
1053
988
|
} else if ("hrtime" in process_) {
|
|
1054
|
-
|
|
1055
|
-
const timeParts = process_ === null || process_ === void 0 ? void 0 : (_process$hrtime = process_.hrtime) === null || _process$hrtime === void 0 ? void 0 : _process$hrtime.call(process_);
|
|
989
|
+
const timeParts = process_?.hrtime?.();
|
|
1056
990
|
timestamp = timeParts[0] * 1e3 + timeParts[1] / 1e6;
|
|
1057
991
|
} else {
|
|
1058
992
|
timestamp = Date.now();
|
|
@@ -1075,27 +1009,18 @@ var __exports__ = (() => {
|
|
|
1075
1009
|
function noop() {
|
|
1076
1010
|
}
|
|
1077
1011
|
var cache = {};
|
|
1078
|
-
var ONCE = {
|
|
1079
|
-
once: true
|
|
1080
|
-
};
|
|
1012
|
+
var ONCE = { once: true };
|
|
1081
1013
|
var Log = class {
|
|
1082
|
-
constructor() {
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
_defineProperty(this, "id", void 0);
|
|
1089
|
-
_defineProperty(this, "VERSION", VERSION);
|
|
1090
|
-
_defineProperty(this, "_startTs", getHiResTimestamp());
|
|
1091
|
-
_defineProperty(this, "_deltaTs", getHiResTimestamp());
|
|
1092
|
-
_defineProperty(this, "_storage", void 0);
|
|
1093
|
-
_defineProperty(this, "userData", {});
|
|
1094
|
-
_defineProperty(this, "LOG_THROTTLE_TIMEOUT", 0);
|
|
1014
|
+
constructor({ id } = { id: "" }) {
|
|
1015
|
+
this.VERSION = VERSION;
|
|
1016
|
+
this._startTs = getHiResTimestamp();
|
|
1017
|
+
this._deltaTs = getHiResTimestamp();
|
|
1018
|
+
this.userData = {};
|
|
1019
|
+
this.LOG_THROTTLE_TIMEOUT = 0;
|
|
1095
1020
|
this.id = id;
|
|
1096
1021
|
this.userData = {};
|
|
1097
|
-
this._storage = new LocalStorage(
|
|
1098
|
-
this.timeStamp(
|
|
1022
|
+
this._storage = new LocalStorage(`__probe-${this.id}__`, DEFAULT_LOG_CONFIGURATION);
|
|
1023
|
+
this.timeStamp(`${this.id} started`);
|
|
1099
1024
|
autobind(this);
|
|
1100
1025
|
Object.seal(this);
|
|
1101
1026
|
}
|
|
@@ -1111,42 +1036,44 @@ var __exports__ = (() => {
|
|
|
1111
1036
|
getLevel() {
|
|
1112
1037
|
return this._storage.config.level;
|
|
1113
1038
|
}
|
|
1039
|
+
/** @return milliseconds, with fractions */
|
|
1114
1040
|
getTotal() {
|
|
1115
1041
|
return Number((getHiResTimestamp() - this._startTs).toPrecision(10));
|
|
1116
1042
|
}
|
|
1043
|
+
/** @return milliseconds, with fractions */
|
|
1117
1044
|
getDelta() {
|
|
1118
1045
|
return Number((getHiResTimestamp() - this._deltaTs).toPrecision(10));
|
|
1119
1046
|
}
|
|
1047
|
+
/** @deprecated use logLevel */
|
|
1120
1048
|
set priority(newPriority) {
|
|
1121
1049
|
this.level = newPriority;
|
|
1122
1050
|
}
|
|
1051
|
+
/** @deprecated use logLevel */
|
|
1123
1052
|
get priority() {
|
|
1124
1053
|
return this.level;
|
|
1125
1054
|
}
|
|
1055
|
+
/** @deprecated use logLevel */
|
|
1126
1056
|
getPriority() {
|
|
1127
1057
|
return this.level;
|
|
1128
1058
|
}
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
this._storage.setConfiguration({
|
|
1132
|
-
enabled
|
|
1133
|
-
});
|
|
1059
|
+
// Configure
|
|
1060
|
+
enable(enabled = true) {
|
|
1061
|
+
this._storage.setConfiguration({ enabled });
|
|
1134
1062
|
return this;
|
|
1135
1063
|
}
|
|
1136
1064
|
setLevel(level) {
|
|
1137
|
-
this._storage.setConfiguration({
|
|
1138
|
-
level
|
|
1139
|
-
});
|
|
1065
|
+
this._storage.setConfiguration({ level });
|
|
1140
1066
|
return this;
|
|
1141
1067
|
}
|
|
1068
|
+
/** return the current status of the setting */
|
|
1142
1069
|
get(setting) {
|
|
1143
1070
|
return this._storage.config[setting];
|
|
1144
1071
|
}
|
|
1072
|
+
// update the status of the setting
|
|
1145
1073
|
set(setting, value) {
|
|
1146
|
-
this._storage.setConfiguration({
|
|
1147
|
-
[setting]: value
|
|
1148
|
-
});
|
|
1074
|
+
this._storage.setConfiguration({ [setting]: value });
|
|
1149
1075
|
}
|
|
1076
|
+
/** Logs the current settings as a table */
|
|
1150
1077
|
settings() {
|
|
1151
1078
|
if (console.table) {
|
|
1152
1079
|
console.table(this._storage.config);
|
|
@@ -1154,8 +1081,11 @@ var __exports__ = (() => {
|
|
|
1154
1081
|
console.log(this._storage.config);
|
|
1155
1082
|
}
|
|
1156
1083
|
}
|
|
1084
|
+
// Unconditional logging
|
|
1157
1085
|
assert(condition, message) {
|
|
1158
|
-
|
|
1086
|
+
if (!condition) {
|
|
1087
|
+
throw new Error(message || "Assertion failed");
|
|
1088
|
+
}
|
|
1159
1089
|
}
|
|
1160
1090
|
warn(message) {
|
|
1161
1091
|
return this._getLogFunction(0, message, originalConsole.warn, arguments, ONCE);
|
|
@@ -1163,11 +1093,13 @@ var __exports__ = (() => {
|
|
|
1163
1093
|
error(message) {
|
|
1164
1094
|
return this._getLogFunction(0, message, originalConsole.error, arguments);
|
|
1165
1095
|
}
|
|
1096
|
+
/** Print a deprecation warning */
|
|
1166
1097
|
deprecated(oldUsage, newUsage) {
|
|
1167
|
-
return this.warn(
|
|
1098
|
+
return this.warn(`\`${oldUsage}\` is deprecated and will be removed in a later version. Use \`${newUsage}\` instead`);
|
|
1168
1099
|
}
|
|
1100
|
+
/** Print a removal warning */
|
|
1169
1101
|
removed(oldUsage, newUsage) {
|
|
1170
|
-
return this.error(
|
|
1102
|
+
return this.error(`\`${oldUsage}\` has been removed. Use \`${newUsage}\` instead`);
|
|
1171
1103
|
}
|
|
1172
1104
|
probe(logLevel, message) {
|
|
1173
1105
|
return this._getLogFunction(logLevel, message, originalConsole.log, arguments, {
|
|
@@ -1184,6 +1116,7 @@ var __exports__ = (() => {
|
|
|
1184
1116
|
once(logLevel, message) {
|
|
1185
1117
|
return this._getLogFunction(logLevel, message, originalConsole.debug || originalConsole.info, arguments, ONCE);
|
|
1186
1118
|
}
|
|
1119
|
+
/** Logs an object as a table */
|
|
1187
1120
|
table(logLevel, table, columns) {
|
|
1188
1121
|
if (table) {
|
|
1189
1122
|
return this._getLogFunction(logLevel, table, console.table || noop, columns && [columns], {
|
|
@@ -1192,27 +1125,6 @@ var __exports__ = (() => {
|
|
|
1192
1125
|
}
|
|
1193
1126
|
return noop;
|
|
1194
1127
|
}
|
|
1195
|
-
image(_ref) {
|
|
1196
|
-
let {
|
|
1197
|
-
logLevel,
|
|
1198
|
-
priority,
|
|
1199
|
-
image,
|
|
1200
|
-
message = "",
|
|
1201
|
-
scale = 1
|
|
1202
|
-
} = _ref;
|
|
1203
|
-
if (!this._shouldLog(logLevel || priority)) {
|
|
1204
|
-
return noop;
|
|
1205
|
-
}
|
|
1206
|
-
return isBrowser2() ? logImageInBrowser({
|
|
1207
|
-
image,
|
|
1208
|
-
message,
|
|
1209
|
-
scale
|
|
1210
|
-
}) : logImageInNode({
|
|
1211
|
-
image,
|
|
1212
|
-
message,
|
|
1213
|
-
scale
|
|
1214
|
-
});
|
|
1215
|
-
}
|
|
1216
1128
|
time(logLevel, message) {
|
|
1217
1129
|
return this._getLogFunction(logLevel, message, console.time ? console.time : console.info);
|
|
1218
1130
|
}
|
|
@@ -1222,30 +1134,19 @@ var __exports__ = (() => {
|
|
|
1222
1134
|
timeStamp(logLevel, message) {
|
|
1223
1135
|
return this._getLogFunction(logLevel, message, console.timeStamp || noop);
|
|
1224
1136
|
}
|
|
1225
|
-
group(logLevel, message) {
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
};
|
|
1229
|
-
const options = normalizeArguments({
|
|
1230
|
-
logLevel,
|
|
1231
|
-
message,
|
|
1232
|
-
opts
|
|
1233
|
-
});
|
|
1234
|
-
const {
|
|
1235
|
-
collapsed
|
|
1236
|
-
} = opts;
|
|
1137
|
+
group(logLevel, message, opts = { collapsed: false }) {
|
|
1138
|
+
const options = normalizeArguments({ logLevel, message, opts });
|
|
1139
|
+
const { collapsed } = opts;
|
|
1237
1140
|
options.method = (collapsed ? console.groupCollapsed : console.group) || console.info;
|
|
1238
1141
|
return this._getLogFunction(options);
|
|
1239
1142
|
}
|
|
1240
|
-
groupCollapsed(logLevel, message) {
|
|
1241
|
-
|
|
1242
|
-
return this.group(logLevel, message, Object.assign({}, opts, {
|
|
1243
|
-
collapsed: true
|
|
1244
|
-
}));
|
|
1143
|
+
groupCollapsed(logLevel, message, opts = {}) {
|
|
1144
|
+
return this.group(logLevel, message, Object.assign({}, opts, { collapsed: true }));
|
|
1245
1145
|
}
|
|
1246
1146
|
groupEnd(logLevel) {
|
|
1247
1147
|
return this._getLogFunction(logLevel, "", console.groupEnd || noop);
|
|
1248
1148
|
}
|
|
1149
|
+
// EXPERIMENTAL
|
|
1249
1150
|
withGroup(logLevel, message, func) {
|
|
1250
1151
|
this.group(logLevel, message)();
|
|
1251
1152
|
try {
|
|
@@ -1259,17 +1160,14 @@ var __exports__ = (() => {
|
|
|
1259
1160
|
console.trace();
|
|
1260
1161
|
}
|
|
1261
1162
|
}
|
|
1163
|
+
// PRIVATE METHODS
|
|
1164
|
+
/** Deduces log level from a variety of arguments */
|
|
1262
1165
|
_shouldLog(logLevel) {
|
|
1263
1166
|
return this.isEnabled() && this.getLevel() >= normalizeLogLevel(logLevel);
|
|
1264
1167
|
}
|
|
1265
1168
|
_getLogFunction(logLevel, message, method, args, opts) {
|
|
1266
1169
|
if (this._shouldLog(logLevel)) {
|
|
1267
|
-
opts = normalizeArguments({
|
|
1268
|
-
logLevel,
|
|
1269
|
-
message,
|
|
1270
|
-
args,
|
|
1271
|
-
opts
|
|
1272
|
-
});
|
|
1170
|
+
opts = normalizeArguments({ logLevel, message, args, opts });
|
|
1273
1171
|
method = method || opts.method;
|
|
1274
1172
|
assert2(method);
|
|
1275
1173
|
opts.total = this.getTotal();
|
|
@@ -1289,7 +1187,7 @@ var __exports__ = (() => {
|
|
|
1289
1187
|
return noop;
|
|
1290
1188
|
}
|
|
1291
1189
|
};
|
|
1292
|
-
|
|
1190
|
+
Log.VERSION = VERSION;
|
|
1293
1191
|
function normalizeLogLevel(logLevel) {
|
|
1294
1192
|
if (!logLevel) {
|
|
1295
1193
|
return 0;
|
|
@@ -1309,10 +1207,7 @@ var __exports__ = (() => {
|
|
|
1309
1207
|
return resolvedLevel;
|
|
1310
1208
|
}
|
|
1311
1209
|
function normalizeArguments(opts) {
|
|
1312
|
-
const {
|
|
1313
|
-
logLevel,
|
|
1314
|
-
message
|
|
1315
|
-
} = opts;
|
|
1210
|
+
const { logLevel, message } = opts;
|
|
1316
1211
|
opts.logLevel = normalizeLogLevel(logLevel);
|
|
1317
1212
|
const args = opts.args ? Array.from(opts.args) : [];
|
|
1318
1213
|
while (args.length && args.shift() !== message) {
|
|
@@ -1335,55 +1230,16 @@ var __exports__ = (() => {
|
|
|
1335
1230
|
}
|
|
1336
1231
|
const messageType = typeof opts.message;
|
|
1337
1232
|
assert2(messageType === "string" || messageType === "object");
|
|
1338
|
-
return Object.assign(opts, {
|
|
1339
|
-
args
|
|
1340
|
-
}, opts.opts);
|
|
1233
|
+
return Object.assign(opts, { args }, opts.opts);
|
|
1341
1234
|
}
|
|
1342
1235
|
function decorateMessage(id, message, opts) {
|
|
1343
1236
|
if (typeof message === "string") {
|
|
1344
1237
|
const time = opts.time ? leftPad(formatTime(opts.total)) : "";
|
|
1345
|
-
message = opts.time ?
|
|
1238
|
+
message = opts.time ? `${id}: ${time} ${message}` : `${id}: ${message}`;
|
|
1346
1239
|
message = addColor(message, opts.color, opts.background);
|
|
1347
1240
|
}
|
|
1348
1241
|
return message;
|
|
1349
1242
|
}
|
|
1350
|
-
function logImageInNode(_ref2) {
|
|
1351
|
-
let {
|
|
1352
|
-
image,
|
|
1353
|
-
message = "",
|
|
1354
|
-
scale = 1
|
|
1355
|
-
} = _ref2;
|
|
1356
|
-
console.warn("removed");
|
|
1357
|
-
return noop;
|
|
1358
|
-
}
|
|
1359
|
-
function logImageInBrowser(_ref3) {
|
|
1360
|
-
let {
|
|
1361
|
-
image,
|
|
1362
|
-
message = "",
|
|
1363
|
-
scale = 1
|
|
1364
|
-
} = _ref3;
|
|
1365
|
-
if (typeof image === "string") {
|
|
1366
|
-
const img = new Image();
|
|
1367
|
-
img.onload = () => {
|
|
1368
|
-
const args = formatImage(img, message, scale);
|
|
1369
|
-
console.log(...args);
|
|
1370
|
-
};
|
|
1371
|
-
img.src = image;
|
|
1372
|
-
return noop;
|
|
1373
|
-
}
|
|
1374
|
-
const element = image.nodeName || "";
|
|
1375
|
-
if (element.toLowerCase() === "img") {
|
|
1376
|
-
console.log(...formatImage(image, message, scale));
|
|
1377
|
-
return noop;
|
|
1378
|
-
}
|
|
1379
|
-
if (element.toLowerCase() === "canvas") {
|
|
1380
|
-
const img = new Image();
|
|
1381
|
-
img.onload = () => console.log(...formatImage(img, message, scale));
|
|
1382
|
-
img.src = image.toDataURL();
|
|
1383
|
-
return noop;
|
|
1384
|
-
}
|
|
1385
|
-
return noop;
|
|
1386
|
-
}
|
|
1387
1243
|
function getTableHeader(table) {
|
|
1388
1244
|
for (const key in table) {
|
|
1389
1245
|
for (const title in table[key]) {
|
|
@@ -1393,10 +1249,11 @@ var __exports__ = (() => {
|
|
|
1393
1249
|
return "empty";
|
|
1394
1250
|
}
|
|
1395
1251
|
|
|
1252
|
+
// ../../node_modules/@probe.gl/log/dist/init.js
|
|
1253
|
+
globalThis.probe = {};
|
|
1254
|
+
|
|
1396
1255
|
// ../../node_modules/@probe.gl/log/dist/index.js
|
|
1397
|
-
var dist_default = new Log({
|
|
1398
|
-
id: "@probe.gl/log"
|
|
1399
|
-
});
|
|
1256
|
+
var dist_default = new Log({ id: "@probe.gl/log" });
|
|
1400
1257
|
|
|
1401
1258
|
// ../loader-utils/src/lib/log-utils/log.ts
|
|
1402
1259
|
var VERSION2 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "latest";
|
|
@@ -3700,6 +3557,7 @@ var __exports__ = (() => {
|
|
|
3700
3557
|
leafletRasterLayer: () => leafletRasterLayer,
|
|
3701
3558
|
readVarint: () => readVarint,
|
|
3702
3559
|
tileIdToZxy: () => tileIdToZxy,
|
|
3560
|
+
tileTypeExt: () => tileTypeExt,
|
|
3703
3561
|
zxyToTileId: () => zxyToTileId
|
|
3704
3562
|
});
|
|
3705
3563
|
var __pow = Math.pow;
|
|
@@ -4547,9 +4405,18 @@ var __exports__ = (() => {
|
|
|
4547
4405
|
this.tile = v3compat(this.tilev4);
|
|
4548
4406
|
this.tiles = /* @__PURE__ */ new Map();
|
|
4549
4407
|
}
|
|
4408
|
+
/**
|
|
4409
|
+
* Add a {@link PMTiles} instance to the global protocol instance.
|
|
4410
|
+
*
|
|
4411
|
+
* For remote fetch sources, references in MapLibre styles like pmtiles://http://...
|
|
4412
|
+
* will resolve to the same instance if the URLs match.
|
|
4413
|
+
*/
|
|
4550
4414
|
add(p) {
|
|
4551
4415
|
this.tiles.set(p.source.getKey(), p);
|
|
4552
4416
|
}
|
|
4417
|
+
/**
|
|
4418
|
+
* Fetch a {@link PMTiles} instance by URL, for remote PMTiles instances.
|
|
4419
|
+
*/
|
|
4553
4420
|
get(url) {
|
|
4554
4421
|
return this.tiles.get(url);
|
|
4555
4422
|
}
|
|
@@ -4739,6 +4606,19 @@ var __exports__ = (() => {
|
|
|
4739
4606
|
TileType22[TileType22["Avif"] = 5] = "Avif";
|
|
4740
4607
|
return TileType22;
|
|
4741
4608
|
})(TileType || {});
|
|
4609
|
+
function tileTypeExt(t) {
|
|
4610
|
+
if (t === 1)
|
|
4611
|
+
return ".mvt";
|
|
4612
|
+
if (t === 2)
|
|
4613
|
+
return ".png";
|
|
4614
|
+
if (t === 3)
|
|
4615
|
+
return ".jpg";
|
|
4616
|
+
if (t === 4)
|
|
4617
|
+
return ".webp";
|
|
4618
|
+
if (t === 5)
|
|
4619
|
+
return ".avif";
|
|
4620
|
+
return "";
|
|
4621
|
+
}
|
|
4742
4622
|
var HEADER_SIZE_BYTES = 127;
|
|
4743
4623
|
function findTile(entries, tileId) {
|
|
4744
4624
|
let m = 0;
|
|
@@ -4784,10 +4664,23 @@ var __exports__ = (() => {
|
|
|
4784
4664
|
this.url = url;
|
|
4785
4665
|
this.customHeaders = customHeaders;
|
|
4786
4666
|
this.mustReload = false;
|
|
4667
|
+
let userAgent = "";
|
|
4668
|
+
if ("navigator" in globalThis) {
|
|
4669
|
+
userAgent = globalThis.navigator.userAgent || "";
|
|
4670
|
+
}
|
|
4671
|
+
const isWindows = userAgent.indexOf("Windows") > -1;
|
|
4672
|
+
const isChromiumBased = /Chrome|Chromium|Edg|OPR|Brave/.test(userAgent);
|
|
4673
|
+
this.chromeWindowsNoCache = false;
|
|
4674
|
+
if (isWindows && isChromiumBased) {
|
|
4675
|
+
this.chromeWindowsNoCache = true;
|
|
4676
|
+
}
|
|
4787
4677
|
}
|
|
4788
4678
|
getKey() {
|
|
4789
4679
|
return this.url;
|
|
4790
4680
|
}
|
|
4681
|
+
/**
|
|
4682
|
+
* Mutate the custom [Headers](https://developer.mozilla.org/en-US/docs/Web/API/Headers) set for all requests to the remote archive.
|
|
4683
|
+
*/
|
|
4791
4684
|
setHeaders(customHeaders) {
|
|
4792
4685
|
this.customHeaders = customHeaders;
|
|
4793
4686
|
}
|
|
@@ -4806,6 +4699,8 @@ var __exports__ = (() => {
|
|
|
4806
4699
|
let cache2;
|
|
4807
4700
|
if (this.mustReload) {
|
|
4808
4701
|
cache2 = "reload";
|
|
4702
|
+
} else if (this.chromeWindowsNoCache) {
|
|
4703
|
+
cache2 = "no-store";
|
|
4809
4704
|
}
|
|
4810
4705
|
let resp = yield fetch(this.url, {
|
|
4811
4706
|
signal,
|
|
@@ -4832,7 +4727,9 @@ var __exports__ = (() => {
|
|
|
4832
4727
|
}
|
|
4833
4728
|
if (resp.status === 416 || etag && newEtag && newEtag !== etag) {
|
|
4834
4729
|
this.mustReload = true;
|
|
4835
|
-
throw new EtagMismatch(
|
|
4730
|
+
throw new EtagMismatch(
|
|
4731
|
+
`Server returned non-matching ETag ${etag} after one retry. Check browser extensions and servers for issues that may affect correct ETag headers.`
|
|
4732
|
+
);
|
|
4836
4733
|
}
|
|
4837
4734
|
if (resp.status >= 300) {
|
|
4838
4735
|
throw Error(`Bad response code: ${resp.status}`);
|
|
@@ -5256,7 +5153,7 @@ var __exports__ = (() => {
|
|
|
5256
5153
|
});
|
|
5257
5154
|
}
|
|
5258
5155
|
/**
|
|
5259
|
-
* Primary method to get a single tile bytes from an archive.
|
|
5156
|
+
* Primary method to get a single tile's bytes from an archive.
|
|
5260
5157
|
*
|
|
5261
5158
|
* Returns undefined if the tile does not exist in the archive.
|
|
5262
5159
|
*/
|
|
@@ -5307,6 +5204,35 @@ var __exports__ = (() => {
|
|
|
5307
5204
|
}
|
|
5308
5205
|
});
|
|
5309
5206
|
}
|
|
5207
|
+
/**
|
|
5208
|
+
* Construct a [TileJSON](https://github.com/mapbox/tilejson-spec) object.
|
|
5209
|
+
*
|
|
5210
|
+
* baseTilesUrl is the desired tiles URL, excluding the suffix `/{z}/{x}/{y}.{ext}`.
|
|
5211
|
+
* For example, if the desired URL is `http://example.com/tileset/{z}/{x}/{y}.mvt`,
|
|
5212
|
+
* the baseTilesUrl should be `https://example.com/tileset`.
|
|
5213
|
+
*/
|
|
5214
|
+
getTileJson(baseTilesUrl) {
|
|
5215
|
+
return __async(this, null, function* () {
|
|
5216
|
+
const header = yield this.getHeader();
|
|
5217
|
+
const metadata = yield this.getMetadata();
|
|
5218
|
+
const ext = tileTypeExt(header.tileType);
|
|
5219
|
+
return {
|
|
5220
|
+
tilejson: "3.0.0",
|
|
5221
|
+
scheme: "xyz",
|
|
5222
|
+
tiles: [`${baseTilesUrl}/{z}/{x}/{y}${ext}`],
|
|
5223
|
+
// biome-ignore lint: TileJSON spec
|
|
5224
|
+
vector_layers: metadata.vector_layers,
|
|
5225
|
+
attribution: metadata.attribution,
|
|
5226
|
+
description: metadata.description,
|
|
5227
|
+
name: metadata.name,
|
|
5228
|
+
version: metadata.version,
|
|
5229
|
+
bounds: [header.minLon, header.minLat, header.maxLon, header.maxLat],
|
|
5230
|
+
center: [header.centerLon, header.centerLat, header.centerZoom],
|
|
5231
|
+
minzoom: header.minZoom,
|
|
5232
|
+
maxzoom: header.maxZoom
|
|
5233
|
+
};
|
|
5234
|
+
});
|
|
5235
|
+
}
|
|
5310
5236
|
};
|
|
5311
5237
|
|
|
5312
5238
|
// src/lib/parse-pmtiles.ts
|
package/dist/dist.min.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
else if (typeof define === 'function' && define.amd) define([], factory);
|
|
5
5
|
else if (typeof exports === 'object') exports['loaders'] = factory();
|
|
6
6
|
else root['loaders'] = factory();})(globalThis, function () {
|
|
7
|
-
"use strict";var __exports__=(()=>{var bn=Object.create;var ue=Object.defineProperty;var Sn=Object.getOwnPropertyDescriptor;var En=Object.getOwnPropertyNames;var Bn=Object.getPrototypeOf,_n=Object.prototype.hasOwnProperty;var An=(e,t,r)=>t in e?ue(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var qe=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),jt=(e,t)=>{for(var r in t)ue(e,r,{get:t[r],enumerable:!0})},De=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of En(t))!_n.call(e,o)&&o!==r&&ue(e,o,{get:()=>t[o],enumerable:!(n=Sn(t,o))||n.enumerable});return e},Le=(e,t,r)=>(De(e,t,"default"),r&&De(r,t,"default")),Rt=(e,t,r)=>(r=e!=null?bn(Bn(e)):{},De(t||!e||!e.__esModule?ue(r,"default",{value:e,enumerable:!0}):r,e)),Dn=e=>De(ue({},"__esModule",{value:!0}),e);var Ht=(e,t,r)=>(An(e,typeof t!="symbol"?t+"":t,r),r);var Jt=qe((Ps,Zt)=>{Zt.exports=globalThis.loaders});var _r=qe(wt=>{wt.read=function(e,t,r,n,o){var i,s,a=o*8-n-1,l=(1<<a)-1,c=l>>1,f=-7,u=r?o-1:0,h=r?-1:1,d=e[t+u];for(u+=h,i=d&(1<<-f)-1,d>>=-f,f+=a;f>0;i=i*256+e[t+u],u+=h,f-=8);for(s=i&(1<<-f)-1,i>>=-f,f+=n;f>0;s=s*256+e[t+u],u+=h,f-=8);if(i===0)i=1-c;else{if(i===l)return s?NaN:(d?-1:1)*(1/0);s=s+Math.pow(2,n),i=i-c}return(d?-1:1)*s*Math.pow(2,i-n)};wt.write=function(e,t,r,n,o,i){var s,a,l,c=i*8-o-1,f=(1<<c)-1,u=f>>1,h=o===23?Math.pow(2,-24)-Math.pow(2,-77):0,d=n?0:i-1,p=n?1:-1,y=t<0||t===0&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,s=f):(s=Math.floor(Math.log(t)/Math.LN2),t*(l=Math.pow(2,-s))<1&&(s--,l*=2),s+u>=1?t+=h/l:t+=h*Math.pow(2,1-u),t*l>=2&&(s++,l/=2),s+u>=f?(a=0,s=f):s+u>=1?(a=(t*l-1)*Math.pow(2,o),s=s+u):(a=t*Math.pow(2,u-1)*Math.pow(2,o),s=0));o>=8;e[r+d]=a&255,d+=p,a/=256,o-=8);for(s=s<<o|a,c+=o;c>0;e[r+d]=s&255,d+=p,s/=256,c-=8);e[r+d-p]|=y*128}});var Ur=qe(($l,Vr)=>{"use strict";Vr.exports=x;var Re=_r();function x(e){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(e)?e:new Uint8Array(e||0),this.pos=0,this.type=0,this.length=this.buf.length}x.Varint=0;x.Fixed64=1;x.Bytes=2;x.Fixed32=5;var vt=(1<<16)*(1<<16),Ar=1/vt,ci=12,Mr=typeof TextDecoder>"u"?null:new TextDecoder("utf8");x.prototype={destroy:function(){this.buf=null},readFields:function(e,t,r){for(r=r||this.length;this.pos<r;){var n=this.readVarint(),o=n>>3,i=this.pos;this.type=n&7,e(o,t,this),this.pos===i&&this.skip(n)}return t},readMessage:function(e,t){return this.readFields(e,t,this.readVarint()+this.pos)},readFixed32:function(){var e=He(this.buf,this.pos);return this.pos+=4,e},readSFixed32:function(){var e=Lr(this.buf,this.pos);return this.pos+=4,e},readFixed64:function(){var e=He(this.buf,this.pos)+He(this.buf,this.pos+4)*vt;return this.pos+=8,e},readSFixed64:function(){var e=He(this.buf,this.pos)+Lr(this.buf,this.pos+4)*vt;return this.pos+=8,e},readFloat:function(){var e=Re.read(this.buf,this.pos,!0,23,4);return this.pos+=4,e},readDouble:function(){var e=Re.read(this.buf,this.pos,!0,52,8);return this.pos+=8,e},readVarint:function(e){var t=this.buf,r,n;return n=t[this.pos++],r=n&127,n<128||(n=t[this.pos++],r|=(n&127)<<7,n<128)||(n=t[this.pos++],r|=(n&127)<<14,n<128)||(n=t[this.pos++],r|=(n&127)<<21,n<128)?r:(n=t[this.pos],r|=(n&15)<<28,fi(r,e,this))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var e=this.readVarint();return e%2===1?(e+1)/-2:e/2},readBoolean:function(){return Boolean(this.readVarint())},readString:function(){var e=this.readVarint()+this.pos,t=this.pos;return this.pos=e,e-t>=ci&&Mr?Fi(this.buf,t,e):Pi(this.buf,t,e)},readBytes:function(){var e=this.readVarint()+this.pos,t=this.buf.subarray(this.pos,e);return this.pos=e,t},readPackedVarint:function(e,t){if(this.type!==x.Bytes)return e.push(this.readVarint(t));var r=j(this);for(e=e||[];this.pos<r;)e.push(this.readVarint(t));return e},readPackedSVarint:function(e){if(this.type!==x.Bytes)return e.push(this.readSVarint());var t=j(this);for(e=e||[];this.pos<t;)e.push(this.readSVarint());return e},readPackedBoolean:function(e){if(this.type!==x.Bytes)return e.push(this.readBoolean());var t=j(this);for(e=e||[];this.pos<t;)e.push(this.readBoolean());return e},readPackedFloat:function(e){if(this.type!==x.Bytes)return e.push(this.readFloat());var t=j(this);for(e=e||[];this.pos<t;)e.push(this.readFloat());return e},readPackedDouble:function(e){if(this.type!==x.Bytes)return e.push(this.readDouble());var t=j(this);for(e=e||[];this.pos<t;)e.push(this.readDouble());return e},readPackedFixed32:function(e){if(this.type!==x.Bytes)return e.push(this.readFixed32());var t=j(this);for(e=e||[];this.pos<t;)e.push(this.readFixed32());return e},readPackedSFixed32:function(e){if(this.type!==x.Bytes)return e.push(this.readSFixed32());var t=j(this);for(e=e||[];this.pos<t;)e.push(this.readSFixed32());return e},readPackedFixed64:function(e){if(this.type!==x.Bytes)return e.push(this.readFixed64());var t=j(this);for(e=e||[];this.pos<t;)e.push(this.readFixed64());return e},readPackedSFixed64:function(e){if(this.type!==x.Bytes)return e.push(this.readSFixed64());var t=j(this);for(e=e||[];this.pos<t;)e.push(this.readSFixed64());return e},skip:function(e){var t=e&7;if(t===x.Varint)for(;this.buf[this.pos++]>127;);else if(t===x.Bytes)this.pos=this.readVarint()+this.pos;else if(t===x.Fixed32)this.pos+=4;else if(t===x.Fixed64)this.pos+=8;else throw new Error("Unimplemented type: "+t)},writeTag:function(e,t){this.writeVarint(e<<3|t)},realloc:function(e){for(var t=this.length||16;t<this.pos+e;)t*=2;if(t!==this.length){var r=new Uint8Array(t);r.set(this.buf),this.buf=r,this.length=t}},finish:function(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)},writeFixed32:function(e){this.realloc(4),se(this.buf,e,this.pos),this.pos+=4},writeSFixed32:function(e){this.realloc(4),se(this.buf,e,this.pos),this.pos+=4},writeFixed64:function(e){this.realloc(8),se(this.buf,e&-1,this.pos),se(this.buf,Math.floor(e*Ar),this.pos+4),this.pos+=8},writeSFixed64:function(e){this.realloc(8),se(this.buf,e&-1,this.pos),se(this.buf,Math.floor(e*Ar),this.pos+4),this.pos+=8},writeVarint:function(e){if(e=+e||0,e>268435455||e<0){ui(e,this);return}this.realloc(4),this.buf[this.pos++]=e&127|(e>127?128:0),!(e<=127)&&(this.buf[this.pos++]=(e>>>=7)&127|(e>127?128:0),!(e<=127)&&(this.buf[this.pos++]=(e>>>=7)&127|(e>127?128:0),!(e<=127)&&(this.buf[this.pos++]=e>>>7&127)))},writeSVarint:function(e){this.writeVarint(e<0?-e*2-1:e*2)},writeBoolean:function(e){this.writeVarint(Boolean(e))},writeString:function(e){e=String(e),this.realloc(e.length*4),this.pos++;var t=this.pos;this.pos=bi(this.buf,e,this.pos);var r=this.pos-t;r>=128&&Dr(t,r,this),this.pos=t-1,this.writeVarint(r),this.pos+=r},writeFloat:function(e){this.realloc(4),Re.write(this.buf,e,this.pos,!0,23,4),this.pos+=4},writeDouble:function(e){this.realloc(8),Re.write(this.buf,e,this.pos,!0,52,8),this.pos+=8},writeBytes:function(e){var t=e.length;this.writeVarint(t),this.realloc(t);for(var r=0;r<t;r++)this.buf[this.pos++]=e[r]},writeRawMessage:function(e,t){this.pos++;var r=this.pos;e(t,this);var n=this.pos-r;n>=128&&Dr(r,n,this),this.pos=r-1,this.writeVarint(n),this.pos+=n},writeMessage:function(e,t,r){this.writeTag(e,x.Bytes),this.writeRawMessage(t,r)},writePackedVarint:function(e,t){t.length&&this.writeMessage(e,pi,t)},writePackedSVarint:function(e,t){t.length&&this.writeMessage(e,gi,t)},writePackedBoolean:function(e,t){t.length&&this.writeMessage(e,xi,t)},writePackedFloat:function(e,t){t.length&&this.writeMessage(e,mi,t)},writePackedDouble:function(e,t){t.length&&this.writeMessage(e,yi,t)},writePackedFixed32:function(e,t){t.length&&this.writeMessage(e,wi,t)},writePackedSFixed32:function(e,t){t.length&&this.writeMessage(e,vi,t)},writePackedFixed64:function(e,t){t.length&&this.writeMessage(e,Ti,t)},writePackedSFixed64:function(e,t){t.length&&this.writeMessage(e,Ii,t)},writeBytesField:function(e,t){this.writeTag(e,x.Bytes),this.writeBytes(t)},writeFixed32Field:function(e,t){this.writeTag(e,x.Fixed32),this.writeFixed32(t)},writeSFixed32Field:function(e,t){this.writeTag(e,x.Fixed32),this.writeSFixed32(t)},writeFixed64Field:function(e,t){this.writeTag(e,x.Fixed64),this.writeFixed64(t)},writeSFixed64Field:function(e,t){this.writeTag(e,x.Fixed64),this.writeSFixed64(t)},writeVarintField:function(e,t){this.writeTag(e,x.Varint),this.writeVarint(t)},writeSVarintField:function(e,t){this.writeTag(e,x.Varint),this.writeSVarint(t)},writeStringField:function(e,t){this.writeTag(e,x.Bytes),this.writeString(t)},writeFloatField:function(e,t){this.writeTag(e,x.Fixed32),this.writeFloat(t)},writeDoubleField:function(e,t){this.writeTag(e,x.Fixed64),this.writeDouble(t)},writeBooleanField:function(e,t){this.writeVarintField(e,Boolean(t))}};function fi(e,t,r){var n=r.buf,o,i;if(i=n[r.pos++],o=(i&112)>>4,i<128||(i=n[r.pos++],o|=(i&127)<<3,i<128)||(i=n[r.pos++],o|=(i&127)<<10,i<128)||(i=n[r.pos++],o|=(i&127)<<17,i<128)||(i=n[r.pos++],o|=(i&127)<<24,i<128)||(i=n[r.pos++],o|=(i&1)<<31,i<128))return ie(e,o,t);throw new Error("Expected varint not more than 10 bytes")}function j(e){return e.type===x.Bytes?e.readVarint()+e.pos:e.pos+1}function ie(e,t,r){return r?t*4294967296+(e>>>0):(t>>>0)*4294967296+(e>>>0)}function ui(e,t){var r,n;if(e>=0?(r=e%4294967296|0,n=e/4294967296|0):(r=~(-e%4294967296),n=~(-e/4294967296),r^4294967295?r=r+1|0:(r=0,n=n+1|0)),e>=18446744073709552e3||e<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");t.realloc(10),hi(r,n,t),di(n,t)}function hi(e,t,r){r.buf[r.pos++]=e&127|128,e>>>=7,r.buf[r.pos++]=e&127|128,e>>>=7,r.buf[r.pos++]=e&127|128,e>>>=7,r.buf[r.pos++]=e&127|128,e>>>=7,r.buf[r.pos]=e&127}function di(e,t){var r=(e&7)<<4;t.buf[t.pos++]|=r|((e>>>=3)?128:0),e&&(t.buf[t.pos++]=e&127|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=e&127|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=e&127|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=e&127|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=e&127)))))}function Dr(e,t,r){var n=t<=16383?1:t<=2097151?2:t<=268435455?3:Math.floor(Math.log(t)/(Math.LN2*7));r.realloc(n);for(var o=r.pos-1;o>=e;o--)r.buf[o+n]=r.buf[o]}function pi(e,t){for(var r=0;r<e.length;r++)t.writeVarint(e[r])}function gi(e,t){for(var r=0;r<e.length;r++)t.writeSVarint(e[r])}function mi(e,t){for(var r=0;r<e.length;r++)t.writeFloat(e[r])}function yi(e,t){for(var r=0;r<e.length;r++)t.writeDouble(e[r])}function xi(e,t){for(var r=0;r<e.length;r++)t.writeBoolean(e[r])}function wi(e,t){for(var r=0;r<e.length;r++)t.writeFixed32(e[r])}function vi(e,t){for(var r=0;r<e.length;r++)t.writeSFixed32(e[r])}function Ti(e,t){for(var r=0;r<e.length;r++)t.writeFixed64(e[r])}function Ii(e,t){for(var r=0;r<e.length;r++)t.writeSFixed64(e[r])}function He(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16)+e[t+3]*16777216}function se(e,t,r){e[r]=t,e[r+1]=t>>>8,e[r+2]=t>>>16,e[r+3]=t>>>24}function Lr(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16)+(e[t+3]<<24)}function Pi(e,t,r){for(var n="",o=t;o<r;){var i=e[o],s=null,a=i>239?4:i>223?3:i>191?2:1;if(o+a>r)break;var l,c,f;a===1?i<128&&(s=i):a===2?(l=e[o+1],(l&192)===128&&(s=(i&31)<<6|l&63,s<=127&&(s=null))):a===3?(l=e[o+1],c=e[o+2],(l&192)===128&&(c&192)===128&&(s=(i&15)<<12|(l&63)<<6|c&63,(s<=2047||s>=55296&&s<=57343)&&(s=null))):a===4&&(l=e[o+1],c=e[o+2],f=e[o+3],(l&192)===128&&(c&192)===128&&(f&192)===128&&(s=(i&15)<<18|(l&63)<<12|(c&63)<<6|f&63,(s<=65535||s>=1114112)&&(s=null))),s===null?(s=65533,a=1):s>65535&&(s-=65536,n+=String.fromCharCode(s>>>10&1023|55296),s=56320|s&1023),n+=String.fromCharCode(s),o+=a}return n}function Fi(e,t,r){return Mr.decode(e.subarray(t,r))}function bi(e,t,r){for(var n=0,o,i;n<t.length;n++){if(o=t.charCodeAt(n),o>55295&&o<57344)if(i)if(o<56320){e[r++]=239,e[r++]=191,e[r++]=189,i=o;continue}else o=i-55296<<10|o-56320|65536,i=null;else{o>56319||n+1===t.length?(e[r++]=239,e[r++]=191,e[r++]=189):i=o;continue}else i&&(e[r++]=239,e[r++]=191,e[r++]=189,i=null);o<128?e[r++]=o:(o<2048?e[r++]=o>>6|192:(o<65536?e[r++]=o>>12|224:(e[r++]=o>>18|240,e[r++]=o>>12&63|128),e[r++]=o>>6&63|128),e[r++]=o&63|128)}return r}});var _e={};jt(_e,{PMTilesSource:()=>mn,PMTilesTileSource:()=>Q,_PMTilesLoader:()=>wn});Le(_e,Rt(Jt(),1));function he(e,t){if(!e)throw new Error(t||"loader assertion failed.")}var z={self:typeof self<"u"&&self,window:typeof window<"u"&&window,global:typeof global<"u"&&global,document:typeof document<"u"&&document},Ln=z.self||z.window||z.global||{},Mn=z.window||z.self||z.global||{},Vn=z.global||z.self||z.window||{},Un=z.document||{};var et=Boolean(typeof process!="object"||String(process)!=="[object process]"||process.browser);var Wt=typeof process<"u"&&process.version&&/v([0-9]*)/.exec(process.version),Nn=Wt&&parseFloat(Wt[1])||0;function H(e){return H=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},H(e)}function tt(e,t){if(H(e)!=="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(H(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function rt(e){var t=tt(e,"string");return H(t)==="symbol"?t:String(t)}function F(e,t,r){return t=rt(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function nt(e){if(typeof window<"u"&&typeof window.process=="object"&&window.process.type==="renderer"||typeof process<"u"&&typeof process.versions=="object"&&Boolean(process.versions.electron))return!0;let t=typeof navigator=="object"&&typeof navigator.userAgent=="string"&&navigator.userAgent,r=e||t;return!!(r&&r.indexOf("Electron")>=0)}function k(){return!(typeof process=="object"&&String(process)==="[object process]"&&!process.browser)||nt()}var kn=globalThis.self||globalThis.window||globalThis.global,te=globalThis.window||globalThis.self||globalThis.global,Cn=globalThis.document||{},J=globalThis.process||{},On=globalThis.console,ks=globalThis.navigator||{};var Me=typeof __VERSION__<"u"?__VERSION__:"untranspiled source",zs=k();function zn(e){try{let t=window[e],r="__storage_test__";return t.setItem(r,r),t.removeItem(r),t}catch{return null}}var Ve=class{constructor(t,r){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"sessionStorage";F(this,"storage",void 0),F(this,"id",void 0),F(this,"config",void 0),this.storage=zn(n),this.id=t,this.config=r,this._loadConfiguration()}getConfiguration(){return this.config}setConfiguration(t){if(Object.assign(this.config,t),this.storage){let r=JSON.stringify(this.config);this.storage.setItem(this.id,r)}}_loadConfiguration(){let t={};if(this.storage){let r=this.storage.getItem(this.id);t=r?JSON.parse(r):{}}return Object.assign(this.config,t),this}};function Kt(e){let t;return e<10?t="".concat(e.toFixed(2),"ms"):e<100?t="".concat(e.toFixed(1),"ms"):e<1e3?t="".concat(e.toFixed(0),"ms"):t="".concat((e/1e3).toFixed(2),"s"),t}function $t(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:8,r=Math.max(t-e.length,0);return"".concat(" ".repeat(r)).concat(e)}function Ue(e,t,r){let n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:600,o=e.src.replace(/\(/g,"%28").replace(/\)/g,"%29");e.width>n&&(r=Math.min(r,n/e.width));let i=e.width*r,s=e.height*r,a=["font-size:1px;","padding:".concat(Math.floor(s/2),"px ").concat(Math.floor(i/2),"px;"),"line-height:".concat(s,"px;"),"background:url(".concat(o,");"),"background-size:".concat(i,"px ").concat(s,"px;"),"color:transparent;"].join("");return["".concat(t," %c+"),a]}var Ne;(function(e){e[e.BLACK=30]="BLACK",e[e.RED=31]="RED",e[e.GREEN=32]="GREEN",e[e.YELLOW=33]="YELLOW",e[e.BLUE=34]="BLUE",e[e.MAGENTA=35]="MAGENTA",e[e.CYAN=36]="CYAN",e[e.WHITE=37]="WHITE",e[e.BRIGHT_BLACK=90]="BRIGHT_BLACK",e[e.BRIGHT_RED=91]="BRIGHT_RED",e[e.BRIGHT_GREEN=92]="BRIGHT_GREEN",e[e.BRIGHT_YELLOW=93]="BRIGHT_YELLOW",e[e.BRIGHT_BLUE=94]="BRIGHT_BLUE",e[e.BRIGHT_MAGENTA=95]="BRIGHT_MAGENTA",e[e.BRIGHT_CYAN=96]="BRIGHT_CYAN",e[e.BRIGHT_WHITE=97]="BRIGHT_WHITE"})(Ne||(Ne={}));var Gn=10;function Yt(e){return typeof e!="string"?e:(e=e.toUpperCase(),Ne[e]||Ne.WHITE)}function Xt(e,t,r){if(!k&&typeof e=="string"){if(t){let n=Yt(t);e="\x1B[".concat(n,"m").concat(e,"\x1B[39m")}if(r){let n=Yt(r);e="\x1B[".concat(n+Gn,"m").concat(e,"\x1B[49m")}}return e}function Qt(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:["constructor"],r=Object.getPrototypeOf(e),n=Object.getOwnPropertyNames(r),o=e;for(let i of n){let s=o[i];typeof s=="function"&&(t.find(a=>i===a)||(o[i]=s.bind(e)))}}function re(e,t){if(!e)throw new Error(t||"Assertion failed")}function W(){let e;if(k()&&te.performance){var t,r;e=te===null||te===void 0||(t=te.performance)===null||t===void 0||(r=t.now)===null||r===void 0?void 0:r.call(t)}else if("hrtime"in J){var n;let o=J===null||J===void 0||(n=J.hrtime)===null||n===void 0?void 0:n.call(J);e=o[0]*1e3+o[1]/1e6}else e=Date.now();return e}var ne={debug:k()&&console.debug||console.log,log:console.log,info:console.info,warn:console.warn,error:console.error},jn={enabled:!0,level:0};function D(){}var qt={},er={once:!0},Z=class{constructor(){let{id:t}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{id:""};F(this,"id",void 0),F(this,"VERSION",Me),F(this,"_startTs",W()),F(this,"_deltaTs",W()),F(this,"_storage",void 0),F(this,"userData",{}),F(this,"LOG_THROTTLE_TIMEOUT",0),this.id=t,this.userData={},this._storage=new Ve("__probe-".concat(this.id,"__"),jn),this.timeStamp("".concat(this.id," started")),Qt(this),Object.seal(this)}set level(t){this.setLevel(t)}get level(){return this.getLevel()}isEnabled(){return this._storage.config.enabled}getLevel(){return this._storage.config.level}getTotal(){return Number((W()-this._startTs).toPrecision(10))}getDelta(){return Number((W()-this._deltaTs).toPrecision(10))}set priority(t){this.level=t}get priority(){return this.level}getPriority(){return this.level}enable(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;return this._storage.setConfiguration({enabled:t}),this}setLevel(t){return this._storage.setConfiguration({level:t}),this}get(t){return this._storage.config[t]}set(t,r){this._storage.setConfiguration({[t]:r})}settings(){console.table?console.table(this._storage.config):console.log(this._storage.config)}assert(t,r){re(t,r)}warn(t){return this._getLogFunction(0,t,ne.warn,arguments,er)}error(t){return this._getLogFunction(0,t,ne.error,arguments)}deprecated(t,r){return this.warn("`".concat(t,"` is deprecated and will be removed in a later version. Use `").concat(r,"` instead"))}removed(t,r){return this.error("`".concat(t,"` has been removed. Use `").concat(r,"` instead"))}probe(t,r){return this._getLogFunction(t,r,ne.log,arguments,{time:!0,once:!0})}log(t,r){return this._getLogFunction(t,r,ne.debug,arguments)}info(t,r){return this._getLogFunction(t,r,console.info,arguments)}once(t,r){return this._getLogFunction(t,r,ne.debug||ne.info,arguments,er)}table(t,r,n){return r?this._getLogFunction(t,r,console.table||D,n&&[n],{tag:Jn(r)}):D}image(t){let{logLevel:r,priority:n,image:o,message:i="",scale:s=1}=t;return this._shouldLog(r||n)?k()?Zn({image:o,message:i,scale:s}):Hn({image:o,message:i,scale:s}):D}time(t,r){return this._getLogFunction(t,r,console.time?console.time:console.info)}timeEnd(t,r){return this._getLogFunction(t,r,console.timeEnd?console.timeEnd:console.info)}timeStamp(t,r){return this._getLogFunction(t,r,console.timeStamp||D)}group(t,r){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{collapsed:!1},o=tr({logLevel:t,message:r,opts:n}),{collapsed:i}=n;return o.method=(i?console.groupCollapsed:console.group)||console.info,this._getLogFunction(o)}groupCollapsed(t,r){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return this.group(t,r,Object.assign({},n,{collapsed:!0}))}groupEnd(t){return this._getLogFunction(t,"",console.groupEnd||D)}withGroup(t,r,n){this.group(t,r)();try{n()}finally{this.groupEnd(t)()}}trace(){console.trace&&console.trace()}_shouldLog(t){return this.isEnabled()&&this.getLevel()>=rr(t)}_getLogFunction(t,r,n,o,i){if(this._shouldLog(t)){i=tr({logLevel:t,message:r,args:o,opts:i}),n=n||i.method,re(n),i.total=this.getTotal(),i.delta=this.getDelta(),this._deltaTs=W();let s=i.tag||i.message;if(i.once&&s)if(!qt[s])qt[s]=W();else return D;return r=Rn(this.id,i.message,i),n.bind(console,r,...i.args)}return D}};F(Z,"VERSION",Me);function rr(e){if(!e)return 0;let t;switch(typeof e){case"number":t=e;break;case"object":t=e.logLevel||e.priority||0;break;default:return 0}return re(Number.isFinite(t)&&t>=0),t}function tr(e){let{logLevel:t,message:r}=e;e.logLevel=rr(t);let n=e.args?Array.from(e.args):[];for(;n.length&&n.shift()!==r;);switch(typeof t){case"string":case"function":r!==void 0&&n.unshift(r),e.message=t;break;case"object":Object.assign(e,t);break;default:}typeof e.message=="function"&&(e.message=e.message());let o=typeof e.message;return re(o==="string"||o==="object"),Object.assign(e,{args:n},e.opts)}function Rn(e,t,r){if(typeof t=="string"){let n=r.time?$t(Kt(r.total)):"";t=r.time?"".concat(e,": ").concat(n," ").concat(t):"".concat(e,": ").concat(t),t=Xt(t,r.color,r.background)}return t}function Hn(e){let{image:t,message:r="",scale:n=1}=e;return console.warn("removed"),D}function Zn(e){let{image:t,message:r="",scale:n=1}=e;if(typeof t=="string"){let i=new Image;return i.onload=()=>{let s=Ue(i,r,n);console.log(...s)},i.src=t,D}let o=t.nodeName||"";if(o.toLowerCase()==="img")return console.log(...Ue(t,r,n)),D;if(o.toLowerCase()==="canvas"){let i=new Image;return i.onload=()=>console.log(...Ue(i,r,n)),i.src=t.toDataURL(),D}return D}function Jn(e){for(let t in e)for(let r in e[t])return r||"untitled";return"empty"}var da=new Z({id:"@probe.gl/log"});var ot="4.3.0-alpha.7",Wn=ot[0]>="0"&&ot[0]<="9"?`v${ot}`:"";function Kn(){let e=new Z({id:"loaders.gl"});return globalThis.loaders=globalThis.loaders||{},globalThis.loaders.log=e,globalThis.loaders.version=Wn,globalThis.probe=globalThis.probe||{},globalThis.probe.loaders=e,e}var it=Kn();var $n="",nr={};function st(e){for(let t in nr)if(e.startsWith(t)){let r=nr[t];e=e.replace(t,r)}return!e.startsWith("http://")&&!e.startsWith("https://")&&(e=`${$n}${e}`),e}var de=class{handle;size;bigsize;url;constructor(t){this.handle=t instanceof ArrayBuffer?new Blob([t]):t,this.size=t instanceof ArrayBuffer?t.byteLength:t.size,this.bigsize=BigInt(this.size),this.url=t instanceof File?t.name:""}async close(){}async stat(){return{size:this.handle.size,bigsize:BigInt(this.handle.size),isDirectory:!1}}async read(t,r){return await this.handle.slice(t,t+r).arrayBuffer()}};var pe=class{fetch;loadOptions;_needsRefresh=!0;props;constructor(t){this.props={...t},this.loadOptions={...t.loadOptions},this.fetch=Yn(this.loadOptions)}setProps(t){this.props=Object.assign(this.props,t),this.setNeedsRefresh()}setNeedsRefresh(){this._needsRefresh=!0}getNeedsRefresh(t=!0){let r=this._needsRefresh;return t&&(this._needsRefresh=!1),r}};function Yn(e){let t=e?.fetch;if(t&&typeof t=="function")return(n,o)=>t(n,o);let r=e?.fetch;return r&&typeof r!="function"?n=>fetch(n,r):n=>fetch(n)}var or="4.3.0-alpha.7";var Xn=globalThis.loaders?.parseImageNode,at=typeof Image<"u",lt=typeof ImageBitmap<"u",Qn=Boolean(Xn),ct=et?!0:Qn;function ir(e){switch(e){case"auto":return lt||at||ct;case"imagebitmap":return lt;case"image":return at;case"data":return ct;default:throw new Error(`@loaders.gl/images: image ${e} not supported in this environment`)}}function sr(){if(lt)return"imagebitmap";if(at)return"image";if(ct)return"data";throw new Error("Install '@loaders.gl/polyfills' to parse images under Node.js")}function qn(e){let t=eo(e);if(!t)throw new Error("Not an image");return t}function ar(e){switch(qn(e)){case"data":return e;case"image":case"imagebitmap":let t=document.createElement("canvas"),r=t.getContext("2d");if(!r)throw new Error("getImageData");return t.width=e.width,t.height=e.height,r.drawImage(e,0,0),r.getImageData(0,0,e.width,e.height);default:throw new Error("getImageData")}}function eo(e){return typeof ImageBitmap<"u"&&e instanceof ImageBitmap?"imagebitmap":typeof Image<"u"&&e instanceof Image?"image":e&&typeof e=="object"&&e.data&&e.width&&e.height?"data":null}var to=/^data:image\/svg\+xml/,ro=/\.svg((\?|#).*)?$/;function ke(e){return e&&(to.test(e)||ro.test(e))}function lr(e,t){if(ke(t)){let n=new TextDecoder().decode(e);try{typeof unescape=="function"&&typeof encodeURIComponent=="function"&&(n=unescape(encodeURIComponent(n)))}catch(i){throw new Error(i.message)}return`data:image/svg+xml;base64,${btoa(n)}`}return ft(e,t)}function ft(e,t){if(ke(t))throw new Error("SVG cannot be parsed directly to imagebitmap");return new Blob([new Uint8Array(e)])}async function Ce(e,t,r){let n=lr(e,r),o=self.URL||self.webkitURL,i=typeof n!="string"&&o.createObjectURL(n);try{return await no(i||n,t)}finally{i&&o.revokeObjectURL(i)}}async function no(e,t){let r=new Image;return r.src=e,t.image&&t.image.decode&&r.decode?(await r.decode(),r):await new Promise((n,o)=>{try{r.onload=()=>n(r),r.onerror=i=>{let s=i instanceof Error?i.message:"error";o(new Error(s))}}catch(i){o(i)}})}var oo={},cr=!0;async function fr(e,t,r){let n;ke(r)?n=await Ce(e,t,r):n=ft(e,r);let o=t&&t.imagebitmap;return await io(n,o)}async function io(e,t=null){if((so(t)||!cr)&&(t=null),t)try{return await createImageBitmap(e,t)}catch(r){console.warn(r),cr=!1}return await createImageBitmap(e)}function so(e){for(let t in e||oo)return!1;return!0}function ur(e){return!fo(e,"ftyp",4)||!(e[8]&96)?null:ao(e)}function ao(e){switch(lo(e,8,12).replace("\0"," ").trim()){case"avif":case"avis":return{extension:"avif",mimeType:"image/avif"};default:return null}}function lo(e,t,r){return String.fromCharCode(...e.slice(t,r))}function co(e){return[...e].map(t=>t.charCodeAt(0))}function fo(e,t,r=0){let n=co(t);for(let o=0;o<n.length;++o)if(n[o]!==e[o+r])return!1;return!0}var G=!1,ge=!0;function Oe(e){let t=me(e);return ho(t)||mo(t)||po(t)||go(t)||uo(t)}function uo(e){let t=new Uint8Array(e instanceof DataView?e.buffer:e),r=ur(t);return r?{mimeType:r.mimeType,width:0,height:0}:null}function ho(e){let t=me(e);return t.byteLength>=24&&t.getUint32(0,G)===2303741511?{mimeType:"image/png",width:t.getUint32(16,G),height:t.getUint32(20,G)}:null}function po(e){let t=me(e);return t.byteLength>=10&&t.getUint32(0,G)===1195984440?{mimeType:"image/gif",width:t.getUint16(6,ge),height:t.getUint16(8,ge)}:null}function go(e){let t=me(e);return t.byteLength>=14&&t.getUint16(0,G)===16973&&t.getUint32(2,ge)===t.byteLength?{mimeType:"image/bmp",width:t.getUint32(18,ge),height:t.getUint32(22,ge)}:null}function mo(e){let t=me(e);if(!(t.byteLength>=3&&t.getUint16(0,G)===65496&&t.getUint8(2)===255))return null;let{tableMarkers:n,sofMarkers:o}=yo(),i=2;for(;i+9<t.byteLength;){let s=t.getUint16(i,G);if(o.has(s))return{mimeType:"image/jpeg",height:t.getUint16(i+5,G),width:t.getUint16(i+7,G)};if(!n.has(s))return null;i+=2,i+=t.getUint16(i,G)}return null}function yo(){let e=new Set([65499,65476,65484,65501,65534]);for(let r=65504;r<65520;++r)e.add(r);return{tableMarkers:e,sofMarkers:new Set([65472,65473,65474,65475,65477,65478,65479,65481,65482,65483,65485,65486,65487,65502])}}function me(e){if(e instanceof DataView)return e;if(ArrayBuffer.isView(e))return new DataView(e.buffer);if(e instanceof ArrayBuffer)return new DataView(e);throw new Error("toDataView")}async function hr(e,t){let{mimeType:r}=Oe(e)||{},n=globalThis.loaders?.parseImageNode;return he(n),await n(e,r)}async function dr(e,t,r){t=t||{};let o=(t.image||{}).type||"auto",{url:i}=r||{},s=xo(o),a;switch(s){case"imagebitmap":a=await fr(e,t,i);break;case"image":a=await Ce(e,t,i);break;case"data":a=await hr(e,t);break;default:he(!1)}return o==="data"&&(a=ar(a)),a}function xo(e){switch(e){case"auto":case"data":return sr();default:return ir(e),e}}var wo=["png","jpg","jpeg","gif","webp","bmp","ico","svg","avif"],vo=["image/png","image/jpeg","image/gif","image/webp","image/avif","image/bmp","image/vnd.microsoft.icon","image/svg+xml"],To={image:{type:"auto",decode:!0}},ut={dataType:null,batchType:null,id:"image",module:"images",name:"Images",version:or,mimeTypes:vo,extensions:wo,parse:dr,tests:[e=>Boolean(Oe(new DataView(e)))],options:To};function pr(e){let t=[];if(e.fields)for(let r of e.fields)t.push({name:r.name,type:Po(r),metadata:Fo(r)});return{metadata:Io(e),fields:t}}function Io(e){let t={};for(let[r,n]of Object.entries(e))r!=="fields"&&n&&(t[r]=JSON.stringify(n));return t}function Po(e){switch(e.type.toLowerCase()){case"float32":return"float32";case"number":case"float64":return"float64";case"string":case"utf8":return"utf8";case"boolean":return"bool";default:return"null"}}function Fo(e){let t={};for(let[r,n]of Object.entries(e))r!=="name"&&n&&(t[r]=JSON.stringify(n));return t}var xr=e=>e!==null&&typeof e=="object";function ht(e,t){if(!e||!xr(e))return null;let r={name:e.name||"",description:e.description||""};if(typeof e.generator=="string"&&(r.generator=e.generator),typeof e.generator_options=="string"&&(r.generatorOptions=e.generator_options),r.boundingBox=gr(e.bounds)||gr(e.antimeridian_adjusted_bounds),r.center=Ao(e.center),r.maxZoom=mr(e.maxzoom),r.minZoom=mr(e.minzoom),typeof e?.json=="string")try{r.metaJson=JSON.parse(e.json)}catch(a){console.warn("Failed to parse tilejson.json field",a)}let n=e.tilestats||r.metaJson?.tilestats,o=Eo(n,t),i=bo(e.vector_layers),s=_o(i,o);return r={...r,layers:s},r.maxZoom===null&&s.length>0&&(r.maxZoom=s[0].maxZoom||null),r.minZoom===null&&s.length>0&&(r.minZoom=s[0].minZoom||null),r}function bo(e){return Array.isArray(e)?e.map(t=>So(t)):[]}function So(e){let t=Object.entries(e.fields||[]).map(([n,o])=>({name:n,...Ir(String(o))})),r={...e};return delete r.fields,{name:e.id||"",...r,fields:t}}function Eo(e,t){return xr(e)&&Array.isArray(e.layers)?e.layers.map(r=>Bo(r,t)):[]}function Bo(e,t){let r=[],n={},o=e.attributes||[];for(let i of o){let s=i.attribute;if(typeof s=="string")if(s.split("|").length>1){let a=s.split("|")[0];n[a]=n[a]||[],n[a].push(i),console.warn("ignoring tilestats indexed field",a)}else r[s]||r.push(Lo(i,t))}return{name:e.layer||"",dominantGeometry:e.geometry,fields:r}}function _o(e,t){return e.map(r=>{let n=t.find(s=>s.name===r.name),o=n?.fields||r.fields||[],i={...r,...n,fields:o};return i.schema=pr(i),i})}function gr(e){let t=Tr(e);if(Array.isArray(t)&&t.length===4&&[t[0],t[2]].every(vr)&&[t[1],t[3]].every(wr))return[[t[0],t[1]],[t[2],t[3]]]}function Ao(e){let t=Tr(e);return Array.isArray(t)&&t.length===3&&vr(t[0])&&wr(t[1])&&Do(t[2])?t:null}function mr(e){let t=typeof e=="string"?parseFloat(e):typeof e=="number"?e:null;return t===null||isNaN(t)?null:t}function wr(e){return Number.isFinite(e)&&e<=90&&e>=-90}function vr(e){return Number.isFinite(e)&&e<=180&&e>=-180}function Do(e){return Number.isFinite(e)&&e>=0&&e<=22}function Tr(e){return typeof e=="string"?e.split(",").map(parseFloat):Array.isArray(e)?e:null}var yr={number:{type:"float32"},numeric:{type:"float32"},string:{type:"utf8"},vachar:{type:"utf8"},float:{type:"float32"},int:{type:"int32"},int4:{type:"int32"},boolean:{type:"boolean"},bool:{type:"boolean"}};function Lo(e={},t){let r=Ir(e.type),n={name:e.attribute,...r};return typeof e.min=="number"&&(n.min=e.min),typeof e.max=="number"&&(n.max=e.max),typeof e.count=="number"&&(n.uniqueValueCount=e.count),e.values&&(n.values=e.values),n.values&&typeof t.maxValues=="number"&&(n.values=n.values?.slice(0,t.maxValues)),n}function Ir(e){let t=e.toLowerCase();return!t||yr[t],yr[t]||{type:"string"}}var Mo="4.3.0-alpha.7",ye={dataType:null,batchType:null,name:"TileJSON",id:"tilejson",module:"pmtiles",version:Mo,worker:!0,extensions:["json"],mimeTypes:["application/json"],text:!0,options:{tilejson:{maxValues:void 0}},parse:async(e,t)=>{let r=new TextDecoder().decode(e),n=JSON.parse(r),o={...ye.options.tilejson,...t?.tilejson};return ht(n,o)},parseTextSync:(e,t)=>{let r=JSON.parse(e),n={...ye.options.tilejson,...t?.tilejson};return ht(r,n)}};var xe={x:0,y:1,z:2};function K(e,t={}){let{start:r=0,end:n=e.length,plane:o="xy"}=t,i=t.size||2,s=0,a=xe[o[0]],l=xe[o[1]];for(let c=r,f=n-i;c<n;c+=i)s+=(e[c+a]-e[f+a])*(e[c+l]+e[f+l]),f=c;return s/2}function pt(e,t,r=2,n,o="xy"){let i=t&&t.length,s=i?t[0]*r:e.length,a=Fr(e,0,s,r,!0,n&&n[0],o),l=[];if(!a||a.next===a.prev)return l;let c,f,u,h,d,p,y;if(i&&(a=zo(e,t,a,r,n,o)),e.length>80*r){h=f=e[0],d=u=e[1];for(let I=r;I<s;I+=r)p=e[I],y=e[I+1],p<h&&(h=p),y<d&&(d=y),p>f&&(f=p),y>u&&(u=y);c=Math.max(f-h,u-d),c=c!==0?32767/c:0}return we(a,l,r,h,d,c,0),l}function Fr(e,t,r,n,o,i,s){let a,l;i===void 0&&(i=K(e,{start:t,end:r,size:n,plane:s}));let c=xe[s[0]],f=xe[s[1]];if(o===i<0)for(a=t;a<r;a+=n)l=Pr(a,e[a+c],e[a+f],l);else for(a=r-n;a>=t;a-=n)l=Pr(a,e[a+c],e[a+f],l);return l&&je(l,l.next)&&(Te(l),l=l.next),l}function $(e,t){if(!e)return e;t||(t=e);let r=e,n;do if(n=!1,!r.steiner&&(je(r,r.next)||T(r.prev,r,r.next)===0)){if(Te(r),r=t=r.prev,r===r.next)break;n=!0}else r=r.next;while(n||r!==t);return t}function we(e,t,r,n,o,i,s){if(!e)return;!s&&i&&Zo(e,n,o,i);let a=e,l,c;for(;e.prev!==e.next;){if(l=e.prev,c=e.next,i?ko(e,n,o,i):No(e)){t.push(l.i/r|0),t.push(e.i/r|0),t.push(c.i/r|0),Te(e),e=c.next,a=c.next;continue}if(e=c,e===a){s?s===1?(e=Co($(e),t,r),we(e,t,r,n,o,i,2)):s===2&&Oo(e,t,r,n,o,i):we($(e),t,r,n,o,i,1);break}}}function No(e){let t=e.prev,r=e,n=e.next;if(T(t,r,n)>=0)return!1;let o=t.x,i=r.x,s=n.x,a=t.y,l=r.y,c=n.y,f=o<i?o<s?o:s:i<s?i:s,u=a<l?a<c?a:c:l<c?l:c,h=o>i?o>s?o:s:i>s?i:s,d=a>l?a>c?a:c:l>c?l:c,p=n.next;for(;p!==t;){if(p.x>=f&&p.x<=h&&p.y>=u&&p.y<=d&&oe(o,a,i,l,s,c,p.x,p.y)&&T(p.prev,p,p.next)>=0)return!1;p=p.next}return!0}function ko(e,t,r,n){let o=e.prev,i=e,s=e.next;if(T(o,i,s)>=0)return!1;let a=o.x,l=i.x,c=s.x,f=o.y,u=i.y,h=s.y,d=a<l?a<c?a:c:l<c?l:c,p=f<u?f<h?f:h:u<h?u:h,y=a>l?a>c?a:c:l>c?l:c,I=f>u?f>h?f:h:u>h?u:h,V=dt(d,p,t,r,n),v=dt(y,I,t,r,n),m=e.prevZ,g=e.nextZ;for(;m&&m.z>=V&&g&&g.z<=v;){if(m.x>=d&&m.x<=y&&m.y>=p&&m.y<=I&&m!==o&&m!==s&&oe(a,f,l,u,c,h,m.x,m.y)&&T(m.prev,m,m.next)>=0||(m=m.prevZ,g.x>=d&&g.x<=y&&g.y>=p&&g.y<=I&&g!==o&&g!==s&&oe(a,f,l,u,c,h,g.x,g.y)&&T(g.prev,g,g.next)>=0))return!1;g=g.nextZ}for(;m&&m.z>=V;){if(m.x>=d&&m.x<=y&&m.y>=p&&m.y<=I&&m!==o&&m!==s&&oe(a,f,l,u,c,h,m.x,m.y)&&T(m.prev,m,m.next)>=0)return!1;m=m.prevZ}for(;g&&g.z<=v;){if(g.x>=d&&g.x<=y&&g.y>=p&&g.y<=I&&g!==o&&g!==s&&oe(a,f,l,u,c,h,g.x,g.y)&&T(g.prev,g,g.next)>=0)return!1;g=g.nextZ}return!0}function Co(e,t,r){let n=e;do{let o=n.prev,i=n.next.next;!je(o,i)&&br(o,n,n.next,i)&&ve(o,i)&&ve(i,o)&&(t.push(o.i/r|0),t.push(n.i/r|0),t.push(i.i/r|0),Te(n),Te(n.next),n=e=i),n=n.next}while(n!==e);return $(n)}function Oo(e,t,r,n,o,i){let s=e;do{let a=s.next.next;for(;a!==s.prev;){if(s.i!==a.i&&Ko(s,a)){let l=Sr(s,a);s=$(s,s.next),l=$(l,l.next),we(s,t,r,n,o,i,0),we(l,t,r,n,o,i,0);return}a=a.next}s=s.next}while(s!==e)}function zo(e,t,r,n,o,i){let s=[],a,l,c,f,u;for(a=0,l=t.length;a<l;a++)c=t[a]*n,f=a<l-1?t[a+1]*n:e.length,u=Fr(e,c,f,n,!1,o&&o[a+1],i),u===u.next&&(u.steiner=!0),s.push(Wo(u));for(s.sort(Go),a=0;a<s.length;a++)r=jo(s[a],r);return r}function Go(e,t){return e.x-t.x}function jo(e,t){let r=Ro(e,t);if(!r)return t;let n=Sr(r,e);return $(n,n.next),$(r,r.next)}function Ro(e,t){let r=t,n=e.x,o=e.y,i=-1/0,s;do{if(o<=r.y&&o>=r.next.y&&r.next.y!==r.y){let h=r.x+(o-r.y)*(r.next.x-r.x)/(r.next.y-r.y);if(h<=n&&h>i&&(i=h,s=r.x<r.next.x?r:r.next,h===n))return s}r=r.next}while(r!==t);if(!s)return null;let a=s,l=s.x,c=s.y,f=1/0,u;r=s;do n>=r.x&&r.x>=l&&n!==r.x&&oe(o<c?n:i,o,l,c,o<c?i:n,o,r.x,r.y)&&(u=Math.abs(o-r.y)/(n-r.x),ve(r,e)&&(u<f||u===f&&(r.x>s.x||r.x===s.x&&Ho(s,r)))&&(s=r,f=u)),r=r.next;while(r!==a);return s}function Ho(e,t){return T(e.prev,e,t.prev)<0&&T(t.next,e,e.next)<0}function Zo(e,t,r,n){let o=e;do o.z===0&&(o.z=dt(o.x,o.y,t,r,n)),o.prevZ=o.prev,o.nextZ=o.next,o=o.next;while(o!==e);o.prevZ.nextZ=null,o.prevZ=null,Jo(o)}function Jo(e){let t,r,n=1,o,i,s,a,l,c;do{for(i=e,e=null,c=null,o=0;i;){for(o++,a=i,s=0,r=0;r<n&&(s++,a=a.nextZ,!!a);r++);for(l=n;s>0||l>0&&a;)s!==0&&(l===0||!a||i.z<=a.z)?(t=i,i=i.nextZ,s--):(t=a,a=a.nextZ,l--),c?c.nextZ=t:e=t,t.prevZ=c,c=t;i=a}c.nextZ=null,n*=2}while(o>1);return e}function dt(e,t,r,n,o){return e=(e-r)*o|0,t=(t-n)*o|0,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,e|t<<1}function Wo(e){let t=e,r=e;do(t.x<r.x||t.x===r.x&&t.y<r.y)&&(r=t),t=t.next;while(t!==e);return r}function oe(e,t,r,n,o,i,s,a){return(o-s)*(t-a)>=(e-s)*(i-a)&&(e-s)*(n-a)>=(r-s)*(t-a)&&(r-s)*(i-a)>=(o-s)*(n-a)}function Ko(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!$o(e,t)&&(ve(e,t)&&ve(t,e)&&Yo(e,t)&&(T(e.prev,e,t.prev)||T(e,t.prev,t))||je(e,t)&&T(e.prev,e,e.next)>0&&T(t.prev,t,t.next)>0)}function T(e,t,r){return(t.y-e.y)*(r.x-t.x)-(t.x-e.x)*(r.y-t.y)}function je(e,t){return e.x===t.x&&e.y===t.y}function br(e,t,r,n){let o=Ge(T(e,t,r)),i=Ge(T(e,t,n)),s=Ge(T(r,n,e)),a=Ge(T(r,n,t));return!!(o!==i&&s!==a||o===0&&ze(e,r,t)||i===0&&ze(e,n,t)||s===0&&ze(r,e,n)||a===0&&ze(r,t,n))}function ze(e,t,r){return t.x<=Math.max(e.x,r.x)&&t.x>=Math.min(e.x,r.x)&&t.y<=Math.max(e.y,r.y)&&t.y>=Math.min(e.y,r.y)}function Ge(e){return e>0?1:e<0?-1:0}function $o(e,t){let r=e;do{if(r.i!==e.i&&r.next.i!==e.i&&r.i!==t.i&&r.next.i!==t.i&&br(r,r.next,e,t))return!0;r=r.next}while(r!==e);return!1}function ve(e,t){return T(e.prev,e,e.next)<0?T(e,t,e.next)>=0&&T(e,e.prev,t)>=0:T(e,t,e.prev)<0||T(e,e.next,t)<0}function Yo(e,t){let r=e,n=!1,o=(e.x+t.x)/2,i=(e.y+t.y)/2;do r.y>i!=r.next.y>i&&r.next.y!==r.y&&o<(r.next.x-r.x)*(i-r.y)/(r.next.y-r.y)+r.x&&(n=!n),r=r.next;while(r!==e);return n}function Sr(e,t){let r=new Ie(e.i,e.x,e.y),n=new Ie(t.i,t.x,t.y),o=e.next,i=t.prev;return e.next=t,t.prev=e,r.next=o,o.prev=r,n.next=r,r.prev=n,i.next=n,n.prev=i,n}function Pr(e,t,r,n){let o=new Ie(e,t,r);return n?(o.next=n.next,o.prev=n,n.next.prev=o,n.next=o):(o.prev=o,o.next=o),o}function Te(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ)}var Ie=class{constructor(t,r,n){this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1,this.i=t,this.x=r,this.y=n}};function yt(e,t,r){let n=ti(e),o=Object.keys(n).filter(i=>n[i]!==Array);return ri(e,{propArrayTypes:n,...t},{numericPropKeys:r&&r.numericPropKeys||o,PositionDataType:r?r.PositionDataType:Float32Array,triangulate:r?r.triangulate:!0})}function ti(e){let t={};for(let r of e)if(r.properties)for(let n in r.properties){let o=r.properties[n];t[n]=li(o,t[n])}return t}function ri(e,t,r){let{pointPositionsCount:n,pointFeaturesCount:o,linePositionsCount:i,linePathsCount:s,lineFeaturesCount:a,polygonPositionsCount:l,polygonObjectsCount:c,polygonRingsCount:f,polygonFeaturesCount:u,propArrayTypes:h,coordLength:d}=t,{numericPropKeys:p=[],PositionDataType:y=Float32Array,triangulate:I=!0}=r,V=e[0]&&"id"in e[0],v=e.length>65535?Uint32Array:Uint16Array,m={type:"Point",positions:new y(n*d),globalFeatureIds:new v(n),featureIds:o>65535?new Uint32Array(n):new Uint16Array(n),numericProps:{},properties:[],fields:[]},g={type:"LineString",pathIndices:i>65535?new Uint32Array(s+1):new Uint16Array(s+1),positions:new y(i*d),globalFeatureIds:new v(i),featureIds:a>65535?new Uint32Array(i):new Uint16Array(i),numericProps:{},properties:[],fields:[]},B={type:"Polygon",polygonIndices:l>65535?new Uint32Array(c+1):new Uint16Array(c+1),primitivePolygonIndices:l>65535?new Uint32Array(f+1):new Uint16Array(f+1),positions:new y(l*d),globalFeatureIds:new v(l),featureIds:u>65535?new Uint32Array(l):new Uint16Array(l),numericProps:{},properties:[],fields:[]};I&&(B.triangles=[]);for(let U of[m,g,B])for(let b of p){let _=h[b];U.numericProps[b]=new _(U.positions.length/d)}g.pathIndices[s]=i,B.polygonIndices[c]=l,B.primitivePolygonIndices[f]=l;let O={pointPosition:0,pointFeature:0,linePosition:0,linePath:0,lineFeature:0,polygonPosition:0,polygonObject:0,polygonRing:0,polygonFeature:0,feature:0};for(let U of e){let b=U.geometry,_=U.properties||{};switch(b.type){case"Point":ni(b,m,O,d,_),m.properties.push(mt(_,p)),V&&m.fields.push({id:U.id}),O.pointFeature++;break;case"LineString":oi(b,g,O,d,_),g.properties.push(mt(_,p)),V&&g.fields.push({id:U.id}),O.lineFeature++;break;case"Polygon":ii(b,B,O,d,_),B.properties.push(mt(_,p)),V&&B.fields.push({id:U.id}),O.polygonFeature++;break;default:throw new Error("Invalid geometry type")}O.feature++}return ai(m,g,B,d)}function ni(e,t,r,n,o){t.positions.set(e.data,r.pointPosition*n);let i=e.data.length/n;xt(t,o,r.pointPosition,i),t.globalFeatureIds.fill(r.feature,r.pointPosition,r.pointPosition+i),t.featureIds.fill(r.pointFeature,r.pointPosition,r.pointPosition+i),r.pointPosition+=i}function oi(e,t,r,n,o){t.positions.set(e.data,r.linePosition*n);let i=e.data.length/n;xt(t,o,r.linePosition,i),t.globalFeatureIds.fill(r.feature,r.linePosition,r.linePosition+i),t.featureIds.fill(r.lineFeature,r.linePosition,r.linePosition+i);for(let s=0,a=e.indices.length;s<a;++s){let l=e.indices[s],c=s===a-1?e.data.length:e.indices[s+1];t.pathIndices[r.linePath++]=r.linePosition,r.linePosition+=(c-l)/n}}function ii(e,t,r,n,o){t.positions.set(e.data,r.polygonPosition*n);let i=e.data.length/n;xt(t,o,r.polygonPosition,i),t.globalFeatureIds.fill(r.feature,r.polygonPosition,r.polygonPosition+i),t.featureIds.fill(r.polygonFeature,r.polygonPosition,r.polygonPosition+i);for(let s=0,a=e.indices.length;s<a;++s){let l=r.polygonPosition;t.polygonIndices[r.polygonObject++]=l;let c=e.areas[s],f=e.indices[s],u=e.indices[s+1];for(let d=0,p=f.length;d<p;++d){let y=f[d],I=d===p-1?u===void 0?e.data.length:u[0]:f[d+1];t.primitivePolygonIndices[r.polygonRing++]=r.polygonPosition,r.polygonPosition+=(I-y)/n}let h=r.polygonPosition;si(t,c,f,{startPosition:l,endPosition:h,coordLength:n})}}function si(e,t,r,{startPosition:n,endPosition:o,coordLength:i}){if(!e.triangles)return;let s=n*i,a=o*i,l=e.positions.subarray(s,a),c=r[0],f=r.slice(1).map(h=>(h-c)/i),u=pt(l,f,i,t);for(let h=0,d=u.length;h<d;++h)e.triangles.push(n+u[h])}function gt(e,t){let r={};for(let n in e)r[n]={value:e[n],size:t};return r}function ai(e,t,r,n){let o={shape:"binary-feature-collection",points:{...e,positions:{value:e.positions,size:n},globalFeatureIds:{value:e.globalFeatureIds,size:1},featureIds:{value:e.featureIds,size:1},numericProps:gt(e.numericProps,1)},lines:{...t,positions:{value:t.positions,size:n},pathIndices:{value:t.pathIndices,size:1},globalFeatureIds:{value:t.globalFeatureIds,size:1},featureIds:{value:t.featureIds,size:1},numericProps:gt(t.numericProps,1)},polygons:{...r,positions:{value:r.positions,size:n},polygonIndices:{value:r.polygonIndices,size:1},primitivePolygonIndices:{value:r.primitivePolygonIndices,size:1},globalFeatureIds:{value:r.globalFeatureIds,size:1},featureIds:{value:r.featureIds,size:1},numericProps:gt(r.numericProps,1)}};return o.polygons&&r.triangles&&(o.polygons.triangles={value:new Uint32Array(r.triangles),size:1}),o}function xt(e,t,r,n){for(let o in e.numericProps)if(o in t){let i=t[o];e.numericProps[o].fill(i,r,r+n)}}function mt(e,t){let r={};for(let n in e)t.includes(n)||(r[n]=e[n]);return r}function li(e,t){return t===Array||!Number.isFinite(e)?Array:t===Float64Array||Math.fround(e)!==e?Float64Array:Float32Array}var Ft=Rt(Ur(),1);function Si(e){let t=0;for(let r=0,n=e.length-1,o,i;r<e.length;n=r++)o=e[r],i=e[n],t+=(i[0]-o[0])*(o[1]+i[1]);return t}function Tt(e,t){if(Array.isArray(e[0])){for(let n of e)Tt(n,t);return}let r=e;r[0]/=t,r[1]/=t}function Nr(e,t){for(let r=0;r<e.length;++r)e[r]/=t}function It(e,t,r){if(typeof e[0][0]!="number"){for(let s of e)It(s,t,r);return}let n=r*Math.pow(2,t.z),o=r*t.x,i=r*t.y;for(let s=0;s<e.length;s++){let a=e[s];a[0]=(a[0]+o)*360/n-180;let l=180-(a[1]+i)*360/n;a[1]=360/Math.PI*Math.atan(Math.exp(l*Math.PI/180))-90}}function kr(e,t,r){let{x:n,y:o,z:i}=t,s=r*Math.pow(2,i),a=r*n,l=r*o;for(let c=0,f=e.length;c<f;c+=2){e[c]=(e[c]+a)*360/s-180;let u=180-(e[c+1]+l)*360/s;e[c+1]=360/Math.PI*Math.atan(Math.exp(u*Math.PI/180))-90}}function Cr(e){let t=e.length;if(t<=1)return[e];let r=[],n,o;for(let i=0;i<t;i++){let s=Si(e[i]);s!==0&&(o===void 0&&(o=s<0),o===s<0?(n&&r.push(n),n=[e[i]]):n&&n.push(e[i]))}return n&&r.push(n),r}function Or(e){let t=e.indices.length,r="Polygon";if(t<=1)return{type:r,data:e.data,areas:[[K(e.data)]],indices:[e.indices]};let n=[],o=[],i=[],s=[],a,l=0;for(let c,f=0,u;f<t;f++){u=e.indices[f]-l,c=e.indices[f+1]-l||e.data.length;let h=e.data.slice(u,c),d=K(h);if(d===0){let p=e.data.slice(0,u),y=e.data.slice(c);e.data=p.concat(y),l+=c-u;continue}a===void 0&&(a=d<0),a===d<0?(s.length&&(n.push(i),o.push(s)),s=[u],i=[d]):(i.push(d),s.push(u))}return i&&n.push(i),s.length&&o.push(s),{type:r,areas:n,indices:o,data:e.data}}var Y=class{properties;extent;type;id;_pbf;_geometry;_keys;_values;_geometryInfo;constructor(t,r,n,o,i,s){this.properties={},this.extent=n,this.type=0,this.id=null,this._pbf=t,this._geometry=-1,this._keys=o,this._values=i,this._geometryInfo=s,t.readFields(Ei,this,r)}toGeoJSONFeature(t,r){let n=this.loadGeometry();switch(t){case"wgs84":return zr(this,n,o=>It(o,r,this.extent));default:return zr(this,n,Tt)}}toBinaryFeature(t,r){let n=this.loadFlatGeometry();switch(t){case"wgs84":return this._toBinaryCoordinates(n,o=>kr(o,r,this.extent));default:return this._toBinaryCoordinates(n,Nr)}}bbox(){let t=this._pbf;t.pos=this._geometry;let r=t.readVarint()+t.pos,n=1,o=0,i=0,s=0,a=1/0,l=-1/0,c=1/0,f=-1/0;for(;t.pos<r;){if(o<=0){let u=t.readVarint();n=u&7,o=u>>3}if(o--,n===1||n===2)i+=t.readSVarint(),s+=t.readSVarint(),i<a&&(a=i),i>l&&(l=i),s<c&&(c=s),s>f&&(f=s);else if(n!==7)throw new Error(`unknown command ${n}`)}return[a,c,l,f]}_toBinaryCoordinates(t,r){let n;r(t.data,this.extent);let o=2;switch(this.type){case 1:this._geometryInfo.pointFeaturesCount++,this._geometryInfo.pointPositionsCount+=t.indices.length,n={type:"Point",...t};break;case 2:this._geometryInfo.lineFeaturesCount++,this._geometryInfo.linePathsCount+=t.indices.length,this._geometryInfo.linePositionsCount+=t.data.length/o,n={type:"LineString",...t};break;case 3:n=Or(t),this._geometryInfo.polygonFeaturesCount++,this._geometryInfo.polygonObjectsCount+=n.indices.length;for(let s of n.indices)this._geometryInfo.polygonRingsCount+=s.length;this._geometryInfo.polygonPositionsCount+=n.data.length/o;break;default:throw new Error(`Invalid geometry type: ${this.type}`)}let i={type:"Feature",geometry:n,properties:this.properties};return this.id!==null&&(i.id=this.id),i}loadGeometry(){let t=this._pbf;t.pos=this._geometry;let r=t.readVarint()+t.pos,n=1,o=0,i=0,s=0,a=[],l;for(;t.pos<r;){if(o<=0){let c=t.readVarint();n=c&7,o=c>>3}switch(o--,n){case 1:case 2:i+=t.readSVarint(),s+=t.readSVarint(),n===1&&(l&&a.push(l),l=[]),l&&l.push([i,s]);break;case 7:l&&l.push(l[0].slice());break;default:throw new Error(`unknown command ${n}`)}}return l&&a.push(l),a}loadFlatGeometry(){let t=this._pbf;t.pos=this._geometry;let r=t.readVarint()+t.pos,n=1,o,i=0,s=0,a=0,l=0,c=[],f=[];for(;t.pos<r;)if(i<=0&&(o=t.readVarint(),n=o&7,i=o>>3),i--,n===1||n===2)s+=t.readSVarint(),a+=t.readSVarint(),n===1&&c.push(l),f.push(s,a),l+=2;else if(n===7){if(l>0){let u=c[c.length-1];f.push(f[u],f[u+1]),l+=2}}else throw new Error(`unknown command ${n}`);return{data:f,indices:c}}};Ht(Y,"types",["Unknown","Point","LineString","Polygon"]);function zr(e,t,r){let n=Y.types[e.type],o,i,s;switch(e.type){case 1:let l=[];for(o=0;o<t.length;o++)l[o]=t[o][0];s=l,r(s,e.extent);break;case 2:for(s=t,o=0;o<s.length;o++)r(s[o],e.extent);break;case 3:for(s=Cr(t),o=0;o<s.length;o++)for(i=0;i<s[o].length;i++)r(s[o][i],e.extent);break;default:throw new Error("illegal vector tile type")}s.length===1?s=s[0]:n=`Multi${n}`;let a={type:"Feature",geometry:{type:n,coordinates:s},properties:e.properties};return e.id!==null&&(a.properties||={},a.properties.id=e.id),a}function Ei(e,t,r){t&&r&&(e===1?t.id=r.readVarint():e===2?Bi(r,t):e===3?t.type=r.readVarint():e===4&&(t._geometry=r.pos))}function Bi(e,t){let r=e.readVarint()+e.pos;for(;e.pos<r;){let n=t._keys[e.readVarint()],o=t._values[e.readVarint()];t.properties[n]=o}}var Ze=class{version;name;extent;length;_pbf;_keys;_values;_features;constructor(t,r){this.version=1,this.name="",this.extent=4096,this.length=0,this._pbf=t,this._keys=[],this._values=[],this._features=[],t.readFields(_i,this,r),this.length=this._features.length}getGeoJSONFeature(t){if(t<0||t>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[t];let r=this._pbf.readVarint()+this._pbf.pos;return new Y(this._pbf,r,this.extent,this._keys,this._values)}getBinaryFeature(t,r){if(t<0||t>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[t];let n=this._pbf.readVarint()+this._pbf.pos;return new Y(this._pbf,n,this.extent,this._keys,this._values,r)}};function _i(e,t,r){t&&r&&(e===15?t.version=r.readVarint():e===1?t.name=r.readString():e===5?t.extent=r.readVarint():e===2?t._features.push(r.pos):e===3?t._keys.push(r.readString()):e===4&&t._values.push(Ai(r)))}function Ai(e){let t=null,r=e.readVarint()+e.pos;for(;e.pos<r;){let n=e.readVarint()>>3;t=n===1?e.readString():n===2?e.readFloat():n===3?e.readDouble():n===4?e.readVarint64():n===5?e.readVarint():n===6?e.readSVarint():n===7?e.readBoolean():null}return t}var Pe=class{layers;constructor(t,r){this.layers=t.readFields(Di,{},r)}};function Di(e,t,r){if(e===3&&r){let n=new Ze(r,r.readVarint()+r.pos);n.length&&t&&(t[n.name]=n)}}function bt(e,t){let r=Mi(t),n=t?.gis?.format||t?.mvt?.shape||t?.shape;switch(n){case"columnar-table":return{shape:"columnar-table",data:Pt(e,r)};case"geojson-table":return{shape:"geojson-table",type:"FeatureCollection",features:Gr(e,r)};case"geojson":return Gr(e,r);case"binary-geometry":return Pt(e,r);case"binary":return Pt(e,r);default:throw new Error(n||"undefined shape")}}function Pt(e,t){let[r,n]=Li(e,t),o=yt(r,n);return o.byteLength=e.byteLength,o}function Li(e,t){let r=[],n={coordLength:2,pointPositionsCount:0,pointFeaturesCount:0,linePositionsCount:0,linePathsCount:0,lineFeaturesCount:0,polygonPositionsCount:0,polygonObjectsCount:0,polygonRingsCount:0,polygonFeaturesCount:0};if(e.byteLength<=0)return[r,n];let o=new Pe(new Ft.default(e));return(t&&Array.isArray(t.layers)?t.layers:Object.keys(o.layers)).forEach(s=>{let a=o.layers[s];if(a)for(let l=0;l<a.length;l++){let c=a.getBinaryFeature(l,n),f=Ui(c,t,s);r.push(f)}}),[r,n]}function Gr(e,t){if(e.byteLength<=0)return[];let r=[],n=new Pe(new Ft.default(e));return(Array.isArray(t.layers)?t.layers:Object.keys(n.layers)).forEach(i=>{let s=n.layers[i];if(s)for(let a=0;a<s.length;a++){let l=s.getGeoJSONFeature(a),c=Vi(l,t,i);r.push(c)}}),r}function Mi(e){if(!e?.mvt)throw new Error("mvt options required");if(e.mvt?.coordinates==="wgs84"&&!e.mvt.tileIndex)throw new Error("MVT Loader: WGS84 coordinates need tileIndex property");return e.gis&&it.warn('MVTLoader: "options.gis" is deprecated, use "options.mvt.shape" instead')(),e.mvt}function Vi(e,t,r){let n=e.toGeoJSONFeature(t.coordinates||"local",t.tileIndex);return t.layerProperty&&(n.properties||={},n.properties[t.layerProperty]=r),n}function Ui(e,t,r){let n=e.toBinaryFeature(t.coordinates||"local",t.tileIndex);return t.layerProperty&&n.properties&&(n.properties[t.layerProperty]=r),n}var Ni="4.3.0-alpha.7",jr={dataType:null,batchType:null,name:"Mapbox Vector Tile",id:"mvt",module:"mvt",version:Ni,extensions:["mvt","pbf"],mimeTypes:["application/vnd.mapbox-vector-tile","application/x-protobuf"],worker:!0,category:"geometry",options:{mvt:{shape:"geojson",coordinates:"local",layerProperty:"layerName",layers:void 0,tileIndex:void 0}}},St={...jr,parse:async(e,t)=>bt(e,t),parseSync:bt,binary:!0};var Ee={};jt(Ee,{Compression:()=>sn,EtagMismatch:()=>We,FetchSource:()=>cn,FileSource:()=>ms,PMTiles:()=>Dt,Protocol:()=>fs,ResolvedValueCache:()=>xs,SharedPromiseCache:()=>pn,TileType:()=>an,bytesToHeader:()=>fn,findTile:()=>ln,getUint64:()=>M,leafletRasterLayer:()=>ls,readVarint:()=>le,tileIdToZxy:()=>ps,zxyToTileId:()=>on});var X=Math.pow,P=(e,t,r)=>new Promise((n,o)=>{var i=l=>{try{a(r.next(l))}catch(c){o(c)}},s=l=>{try{a(r.throw(l))}catch(c){o(c)}},a=l=>l.done?n(l.value):Promise.resolve(l.value).then(i,s);a((r=r.apply(e,t)).next())}),E=Uint8Array,ce=Uint16Array,ki=Int32Array,Zr=new E([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),Jr=new E([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),Ci=new E([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Wr=function(e,t){for(var r=new ce(31),n=0;n<31;++n)r[n]=t+=1<<e[n-1];for(var o=new ki(r[30]),n=1;n<30;++n)for(var i=r[n];i<r[n+1];++i)o[i]=i-r[n]<<5|n;return{b:r,r:o}},Kr=Wr(Zr,2),$r=Kr.b,Oi=Kr.r;$r[28]=258,Oi[258]=28;var Yr=Wr(Jr,0),zi=Yr.b,mc=Yr.r,_t=new ce(32768);for(w=0;w<32768;++w)R=(w&43690)>>1|(w&21845)<<1,R=(R&52428)>>2|(R&13107)<<2,R=(R&61680)>>4|(R&3855)<<4,_t[w]=((R&65280)>>8|(R&255)<<8)>>1;var R,w,be=function(e,t,r){for(var n=e.length,o=0,i=new ce(t);o<n;++o)e[o]&&++i[e[o]-1];var s=new ce(t);for(o=1;o<t;++o)s[o]=s[o-1]+i[o-1]<<1;var a;if(r){a=new ce(1<<t);var l=15-t;for(o=0;o<n;++o)if(e[o])for(var c=o<<4|e[o],f=t-e[o],u=s[e[o]-1]++<<f,h=u|(1<<f)-1;u<=h;++u)a[_t[u]>>l]=c}else for(a=new ce(n),o=0;o<n;++o)e[o]&&(a[o]=_t[s[e[o]-1]++]>>15-e[o]);return a},Se=new E(288);for(w=0;w<144;++w)Se[w]=8;var w;for(w=144;w<256;++w)Se[w]=9;var w;for(w=256;w<280;++w)Se[w]=7;var w;for(w=280;w<288;++w)Se[w]=8;var w,Xr=new E(32);for(w=0;w<32;++w)Xr[w]=5;var w,Gi=be(Se,9,1),ji=be(Xr,5,1),Et=function(e){for(var t=e[0],r=1;r<e.length;++r)e[r]>t&&(t=e[r]);return t},C=function(e,t,r){var n=t/8|0;return(e[n]|e[n+1]<<8)>>(t&7)&r},Bt=function(e,t){var r=t/8|0;return(e[r]|e[r+1]<<8|e[r+2]<<16)>>(t&7)},Ri=function(e){return(e+7)/8|0},Hi=function(e,t,r){(t==null||t<0)&&(t=0),(r==null||r>e.length)&&(r=e.length);var n=new E(r-t);return n.set(e.subarray(t,r)),n},Zi=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],S=function(e,t,r){var n=new Error(t||Zi[e]);if(n.code=e,Error.captureStackTrace&&Error.captureStackTrace(n,S),!r)throw n;return n},Lt=function(e,t,r,n){var o=e.length,i=n?n.length:0;if(!o||t.f&&!t.l)return r||new E(0);var s=!r||t.i!=2,a=t.i;r||(r=new E(o*3));var l=function(Ot){var zt=r.length;if(Ot>zt){var Gt=new E(Math.max(zt*2,Ot));Gt.set(r),r=Gt}},c=t.f||0,f=t.p||0,u=t.b||0,h=t.l,d=t.d,p=t.m,y=t.n,I=o*8;do{if(!h){c=C(e,f,1);var V=C(e,f+1,3);if(f+=3,V)if(V==1)h=Gi,d=ji,p=9,y=5;else if(V==2){var B=C(e,f,31)+257,O=C(e,f+10,15)+4,U=B+C(e,f+5,31)+1;f+=14;for(var b=new E(U),_=new E(19),A=0;A<O;++A)_[Ci[A]]=C(e,f+A*3,7);f+=O*3;for(var Vt=Et(_),vn=(1<<Vt)-1,Tn=be(_,Vt,1),A=0;A<U;){var Ut=Tn[C(e,f,vn)];f+=Ut&15;var v=Ut>>4;if(v<16)b[A++]=v;else{var q=0,Ae=0;for(v==16?(Ae=3+C(e,f,3),f+=2,q=b[A-1]):v==17?(Ae=3+C(e,f,7),f+=3):v==18&&(Ae=11+C(e,f,127),f+=7);Ae--;)b[A++]=q}}var Nt=b.subarray(0,B),N=b.subarray(B);p=Et(Nt),y=Et(N),h=be(Nt,p,1),d=be(N,y,1)}else S(1);else{var v=Ri(f)+4,m=e[v-4]|e[v-3]<<8,g=v+m;if(g>o){a&&S(0);break}s&&l(u+m),r.set(e.subarray(v,g),u),t.b=u+=m,t.p=f=g*8,t.f=c;continue}if(f>I){a&&S(0);break}}s&&l(u+131072);for(var In=(1<<p)-1,Pn=(1<<y)-1,$e=f;;$e=f){var q=h[Bt(e,f)&In],ee=q>>4;if(f+=q&15,f>I){a&&S(0);break}if(q||S(2),ee<256)r[u++]=ee;else if(ee==256){$e=f,h=null;break}else{var kt=ee-254;if(ee>264){var A=ee-257,fe=Zr[A];kt=C(e,f,(1<<fe)-1)+$r[A],f+=fe}var Ye=d[Bt(e,f)&Pn],Xe=Ye>>4;Ye||S(3),f+=Ye&15;var N=zi[Xe];if(Xe>3){var fe=Jr[Xe];N+=Bt(e,f)&(1<<fe)-1,f+=fe}if(f>I){a&&S(0);break}s&&l(u+131072);var Qe=u+kt;if(u<N){var Ct=i-N,Fn=Math.min(N,Qe);for(Ct+u<0&&S(3);u<Fn;++u)r[u]=n[Ct+u]}for(;u<Qe;u+=4)r[u]=r[u-N],r[u+1]=r[u+1-N],r[u+2]=r[u+2-N],r[u+3]=r[u+3-N];u=Qe}}t.l=h,t.p=$e,t.b=u,t.f=c,h&&(c=1,t.m=p,t.d=d,t.n=y)}while(!c);return u==r.length?r:Hi(r,0,u)},Ji=new E(0),Wi=function(e){(e[0]!=31||e[1]!=139||e[2]!=8)&&S(6,"invalid gzip data");var t=e[3],r=10;t&4&&(r+=(e[10]|e[11]<<8)+2);for(var n=(t>>3&1)+(t>>4&1);n>0;n-=!e[r++]);return r+(t&2)},Ki=function(e){var t=e.length;return(e[t-4]|e[t-3]<<8|e[t-2]<<16|e[t-1]<<24)>>>0},$i=function(e,t){return((e[0]&15)!=8||e[0]>>4>7||(e[0]<<8|e[1])%31)&&S(6,"invalid zlib data"),(e[1]>>5&1)==+!t&&S(6,"invalid zlib data: "+(e[1]&32?"need":"unexpected")+" dictionary"),(e[1]>>3&4)+2};function Yi(e,t){return Lt(e,{i:2},t&&t.out,t&&t.dictionary)}function Xi(e,t){var r=Wi(e);return r+8>e.length&&S(6,"invalid gzip data"),Lt(e.subarray(r,-8),{i:2},t&&t.out||new E(Ki(e)),t&&t.dictionary)}function Qi(e,t){return Lt(e.subarray($i(e,t&&t.dictionary),-4),{i:2},t&&t.out,t&&t.dictionary)}function At(e,t){return e[0]==31&&e[1]==139&&e[2]==8?Xi(e,t):(e[0]&15)!=8||e[0]>>4>7||(e[0]<<8|e[1])%31?Yi(e,t):Qi(e,t)}var qi=typeof TextDecoder<"u"&&new TextDecoder,es=0;try{qi.decode(Ji,{stream:!0}),es=1}catch{}var Qr=(e,t)=>e*X(2,t),Fe=(e,t)=>Math.floor(e/X(2,t)),Je=(e,t)=>Qr(e.getUint16(t+1,!0),8)+e.getUint8(t),qr=(e,t)=>Qr(e.getUint32(t+2,!0),16)+e.getUint16(t,!0),ts=(e,t,r,n,o)=>{if(e!==n.getUint8(o))return e-n.getUint8(o);let i=Je(n,o+1);if(t!==i)return t-i;let s=Je(n,o+4);return r!==s?r-s:0},rs=(e,t,r,n)=>{let o=en(e,t|128,r,n);return o?{z:t,x:r,y:n,offset:o[0],length:o[1],isDir:!0}:null},Rr=(e,t,r,n)=>{let o=en(e,t,r,n);return o?{z:t,x:r,y:n,offset:o[0],length:o[1],isDir:!1}:null},en=(e,t,r,n)=>{let o=0,i=e.byteLength/17-1;for(;o<=i;){let s=i+o>>1,a=ts(t,r,n,e,s*17);if(a>0)o=s+1;else if(a<0)i=s-1;else return[qr(e,s*17+7),e.getUint32(s*17+13,!0)]}return null},ns=(e,t)=>e.isDir&&!t.isDir?1:!e.isDir&&t.isDir?-1:e.z!==t.z?e.z-t.z:e.x!==t.x?e.x-t.x:e.y-t.y,tn=(e,t)=>{let r=e.getUint8(t*17);return{z:r&127,x:Je(e,t*17+1),y:Je(e,t*17+4),offset:qr(e,t*17+7),length:e.getUint32(t*17+13,!0),isDir:r>>7===1}},Hr=e=>{let t=[],r=new DataView(e);for(let n=0;n<r.byteLength/17;n++)t.push(tn(r,n));return os(t)},os=e=>{e.sort(ns);let t=new ArrayBuffer(17*e.length),r=new Uint8Array(t);for(let n=0;n<e.length;n++){let o=e[n],i=o.z;o.isDir&&(i=i|128),r[n*17]=i,r[n*17+1]=o.x&255,r[n*17+2]=o.x>>8&255,r[n*17+3]=o.x>>16&255,r[n*17+4]=o.y&255,r[n*17+5]=o.y>>8&255,r[n*17+6]=o.y>>16&255,r[n*17+7]=o.offset&255,r[n*17+8]=Fe(o.offset,8)&255,r[n*17+9]=Fe(o.offset,16)&255,r[n*17+10]=Fe(o.offset,24)&255,r[n*17+11]=Fe(o.offset,32)&255,r[n*17+12]=Fe(o.offset,48)&255,r[n*17+13]=o.length&255,r[n*17+14]=o.length>>8&255,r[n*17+15]=o.length>>16&255,r[n*17+16]=o.length>>24&255}return t},is=(e,t)=>{if(e.byteLength<17)return null;let r=e.byteLength/17,n=tn(e,r-1);if(n.isDir){let o=n.z,i=t.z-o,s=Math.trunc(t.x/(1<<i)),a=Math.trunc(t.y/(1<<i));return{z:o,x:s,y:a}}return null};function ss(e){return P(this,null,function*(){let t=yield e.getBytes(0,512e3),r=new DataView(t.data),n=r.getUint32(4,!0),o=r.getUint16(8,!0),i=new TextDecoder("utf-8"),s=JSON.parse(i.decode(new DataView(t.data,10,n))),a=0;s.compression==="gzip"&&(a=2);let l=0;"minzoom"in s&&(l=+s.minzoom);let c=0;"maxzoom"in s&&(c=+s.maxzoom);let f=0,u=0,h=0,d=-180,p=-85,y=180,I=85;if(s.bounds){let v=s.bounds.split(",");d=+v[0],p=+v[1],y=+v[2],I=+v[3]}if(s.center){let v=s.center.split(",");f=+v[0],u=+v[1],h=+v[2]}return{specVersion:r.getUint16(2,!0),rootDirectoryOffset:10+n,rootDirectoryLength:o*17,jsonMetadataOffset:10,jsonMetadataLength:n,leafDirectoryOffset:0,leafDirectoryLength:void 0,tileDataOffset:0,tileDataLength:void 0,numAddressedTiles:0,numTileEntries:0,numTileContents:0,clustered:!1,internalCompression:1,tileCompression:a,tileType:1,minZoom:l,maxZoom:c,minLon:d,minLat:p,maxLon:y,maxLat:I,centerZoom:h,centerLon:f,centerLat:u,etag:t.etag}})}function as(e,t,r,n,o,i,s){return P(this,null,function*(){let a=yield r.getArrayBuffer(t,e.rootDirectoryOffset,e.rootDirectoryLength,e);e.specVersion===1&&(a=Hr(a));let l=Rr(new DataView(a),n,o,i);if(l){let u=(yield t.getBytes(l.offset,l.length,s)).data,h=new DataView(u);return h.getUint8(0)===31&&h.getUint8(1)===139&&(u=At(new Uint8Array(u))),{data:u}}let c=is(new DataView(a),{z:n,x:o,y:i});if(c){let f=rs(new DataView(a),c.z,c.x,c.y);if(f){let u=yield r.getArrayBuffer(t,f.offset,f.length,e);e.specVersion===1&&(u=Hr(u));let h=Rr(new DataView(u),n,o,i);if(h){let p=(yield t.getBytes(h.offset,h.length,s)).data,y=new DataView(p);return y.getUint8(0)===31&&y.getUint8(1)===139&&(p=At(new Uint8Array(p))),{data:p}}}}})}var rn={getHeader:ss,getZxy:as},ls=(e,t)=>{let r=!1,n="",o=L.GridLayer.extend({createTile:(i,s)=>{let a=document.createElement("img"),l=new AbortController,c=l.signal;return a.cancel=()=>{l.abort()},r||(e.getHeader().then(f=>{f.tileType===1?console.error("Error: archive contains MVT vector tiles, but leafletRasterLayer is for displaying raster tiles. See https://github.com/protomaps/PMTiles/tree/main/js for details."):f.tileType===2?n="image/png":f.tileType===3?n="image/jpeg":f.tileType===4?n="image/webp":f.tileType===5&&(n="image/avif")}),r=!0),e.getZxy(i.z,i.x,i.y,c).then(f=>{if(f){let u=new Blob([f.data],{type:n}),h=window.URL.createObjectURL(u);a.src=h,a.cancel=void 0,s(void 0,a)}}).catch(f=>{if(f.name!=="AbortError")throw f}),a},_removeTile:function(i){let s=this._tiles[i];s&&(s.el.cancel&&s.el.cancel(),s.el.width=0,s.el.height=0,s.el.deleted=!0,L.DomUtil.remove(s.el),delete this._tiles[i],this.fire("tileunload",{tile:s.el,coords:this._keyToTileCoords(i)}))}});return new o(t)},cs=e=>(t,r)=>{if(r instanceof AbortController)return e(t,r);let n=new AbortController;return e(t,n).then(o=>r(void 0,o.data,o.cacheControl||"",o.expires||""),o=>r(o)).catch(o=>r(o)),{cancel:()=>n.abort()}},fs=class{constructor(){this.tilev4=(e,t)=>P(this,null,function*(){if(e.type==="json"){let u=e.url.substr(10),h=this.tiles.get(u);h||(h=new Dt(u),this.tiles.set(u,h));let d=yield h.getHeader();return{data:{tiles:[`${e.url}/{z}/{x}/{y}`],minzoom:d.minZoom,maxzoom:d.maxZoom,bounds:[d.minLon,d.minLat,d.maxLon,d.maxLat]}}}let r=new RegExp(/pmtiles:\/\/(.+)\/(\d+)\/(\d+)\/(\d+)/),n=e.url.match(r);if(!n)throw new Error("Invalid PMTiles protocol URL");let o=n[1],i=this.tiles.get(o);i||(i=new Dt(o),this.tiles.set(o,i));let s=n[2],a=n[3],l=n[4],c=yield i.getHeader(),f=yield i?.getZxy(+s,+a,+l,t.signal);return f?{data:new Uint8Array(f.data),cacheControl:f.cacheControl,expires:f.expires}:c.tileType===1?{data:new Uint8Array}:{data:null}}),this.tile=cs(this.tilev4),this.tiles=new Map}add(e){this.tiles.set(e.source.getKey(),e)}get(e){return this.tiles.get(e)}};function ae(e,t){return(t>>>0)*4294967296+(e>>>0)}function us(e,t){let r=t.buf,n=r[t.pos++],o=(n&112)>>4;if(n<128||(n=r[t.pos++],o|=(n&127)<<3,n<128)||(n=r[t.pos++],o|=(n&127)<<10,n<128)||(n=r[t.pos++],o|=(n&127)<<17,n<128)||(n=r[t.pos++],o|=(n&127)<<24,n<128)||(n=r[t.pos++],o|=(n&1)<<31,n<128))return ae(e,o);throw new Error("Expected varint not more than 10 bytes")}function le(e){let t=e.buf,r=t[e.pos++],n=r&127;return r<128||(r=t[e.pos++],n|=(r&127)<<7,r<128)||(r=t[e.pos++],n|=(r&127)<<14,r<128)||(r=t[e.pos++],n|=(r&127)<<21,r<128)?n:(r=t[e.pos],n|=(r&15)<<28,us(n,e))}function nn(e,t,r,n){if(n===0){r===1&&(t[0]=e-1-t[0],t[1]=e-1-t[1]);let o=t[0];t[0]=t[1],t[1]=o}}function hs(e,t){let r=X(2,e),n=t,o=t,i=t,s=[0,0],a=1;for(;a<r;)n=1&i/2,o=1&(i^n),nn(a,s,n,o),s[0]+=a*n,s[1]+=a*o,i=i/4,a*=2;return[e,s[0],s[1]]}var ds=[0,1,5,21,85,341,1365,5461,21845,87381,349525,1398101,5592405,22369621,89478485,357913941,1431655765,5726623061,22906492245,91625968981,366503875925,1466015503701,5864062014805,23456248059221,93824992236885,375299968947541,0x5555555555555];function on(e,t,r){if(e>26)throw Error("Tile zoom level exceeds max safe number limit (26)");if(t>X(2,e)-1||r>X(2,e)-1)throw Error("tile x/y outside zoom level bounds");let n=ds[e],o=X(2,e),i=0,s=0,a=0,l=[t,r],c=o/2;for(;c>0;)i=(l[0]&c)>0?1:0,s=(l[1]&c)>0?1:0,a+=c*c*(3*i^s),nn(c,l,i,s),c=c/2;return n+a}function ps(e){let t=0,r=0;for(let n=0;n<27;n++){let o=(1<<n)*(1<<n);if(t+o>e)return hs(n,e-t);t+=o}throw Error("Tile zoom level exceeds max safe number limit (26)")}var sn=(e=>(e[e.Unknown=0]="Unknown",e[e.None=1]="None",e[e.Gzip=2]="Gzip",e[e.Brotli=3]="Brotli",e[e.Zstd=4]="Zstd",e))(sn||{});function Mt(e,t){return P(this,null,function*(){if(t===1||t===0)return e;if(t===2){if(typeof globalThis.DecompressionStream>"u")return At(new Uint8Array(e));let r=new Response(e).body;if(!r)throw Error("Failed to read response stream");let n=r.pipeThrough(new globalThis.DecompressionStream("gzip"));return new Response(n).arrayBuffer()}throw Error("Compression method not supported")})}var an=(e=>(e[e.Unknown=0]="Unknown",e[e.Mvt=1]="Mvt",e[e.Png=2]="Png",e[e.Jpeg=3]="Jpeg",e[e.Webp=4]="Webp",e[e.Avif=5]="Avif",e))(an||{}),gs=127;function ln(e,t){let r=0,n=e.length-1;for(;r<=n;){let o=n+r>>1,i=t-e[o].tileId;if(i>0)r=o+1;else if(i<0)n=o-1;else return e[o]}return n>=0&&(e[n].runLength===0||t-e[n].tileId<e[n].runLength)?e[n]:null}var ms=class{constructor(e){this.file=e}getKey(){return this.file.name}getBytes(e,t){return P(this,null,function*(){return{data:yield this.file.slice(e,e+t).arrayBuffer()}})}},cn=class{constructor(e,t=new Headers){this.url=e,this.customHeaders=t,this.mustReload=!1}getKey(){return this.url}setHeaders(e){this.customHeaders=e}getBytes(e,t,r,n){return P(this,null,function*(){let o,i;r?i=r:(o=new AbortController,i=o.signal);let s=new Headers(this.customHeaders);s.set("range",`bytes=${e}-${e+t-1}`);let a;this.mustReload&&(a="reload");let l=yield fetch(this.url,{signal:i,cache:a,headers:s});if(e===0&&l.status===416){let h=l.headers.get("Content-Range");if(!h||!h.startsWith("bytes */"))throw Error("Missing content-length on 416 response");let d=+h.substr(8);l=yield fetch(this.url,{signal:i,cache:"reload",headers:{range:`bytes=0-${d-1}`}})}let c=l.headers.get("Etag");if(c?.startsWith("W/")&&(c=null),l.status===416||n&&c&&c!==n)throw this.mustReload=!0,new We(n);if(l.status>=300)throw Error(`Bad response code: ${l.status}`);let f=l.headers.get("Content-Length");if(l.status===200&&(!f||+f>t))throw o&&o.abort(),Error("Server returned no content-length header or content-length exceeding request. Check that your storage backend supports HTTP Byte Serving.");return{data:yield l.arrayBuffer(),etag:c||void 0,cacheControl:l.headers.get("Cache-Control")||void 0,expires:l.headers.get("Expires")||void 0}})}};function M(e,t){let r=e.getUint32(t+4,!0),n=e.getUint32(t+0,!0);return r*X(2,32)+n}function fn(e,t){let r=new DataView(e),n=r.getUint8(7);if(n>3)throw Error(`Archive is spec version ${n} but this library supports up to spec version 3`);return{specVersion:n,rootDirectoryOffset:M(r,8),rootDirectoryLength:M(r,16),jsonMetadataOffset:M(r,24),jsonMetadataLength:M(r,32),leafDirectoryOffset:M(r,40),leafDirectoryLength:M(r,48),tileDataOffset:M(r,56),tileDataLength:M(r,64),numAddressedTiles:M(r,72),numTileEntries:M(r,80),numTileContents:M(r,88),clustered:r.getUint8(96)===1,internalCompression:r.getUint8(97),tileCompression:r.getUint8(98),tileType:r.getUint8(99),minZoom:r.getUint8(100),maxZoom:r.getUint8(101),minLon:r.getInt32(102,!0)/1e7,minLat:r.getInt32(106,!0)/1e7,maxLon:r.getInt32(110,!0)/1e7,maxLat:r.getInt32(114,!0)/1e7,centerZoom:r.getUint8(118),centerLon:r.getInt32(119,!0)/1e7,centerLat:r.getInt32(123,!0)/1e7,etag:t}}function un(e){let t={buf:new Uint8Array(e),pos:0},r=le(t),n=[],o=0;for(let i=0;i<r;i++){let s=le(t);n.push({tileId:o+s,offset:0,length:0,runLength:1}),o+=s}for(let i=0;i<r;i++)n[i].runLength=le(t);for(let i=0;i<r;i++)n[i].length=le(t);for(let i=0;i<r;i++){let s=le(t);s===0&&i>0?n[i].offset=n[i-1].offset+n[i-1].length:n[i].offset=s-1}return n}function ys(e){let t=new DataView(e);return t.getUint16(2,!0)===2?(console.warn("PMTiles spec version 2 has been deprecated; please see github.com/protomaps/PMTiles for tools to upgrade"),2):t.getUint16(2,!0)===1?(console.warn("PMTiles spec version 1 has been deprecated; please see github.com/protomaps/PMTiles for tools to upgrade"),1):3}var We=class extends Error{};function hn(e,t){return P(this,null,function*(){let r=yield e.getBytes(0,16384);if(new DataView(r.data).getUint16(0,!0)!==19792)throw new Error("Wrong magic number for PMTiles archive");if(ys(r.data)<3)return[yield rn.getHeader(e)];let o=r.data.slice(0,gs),i=fn(o,r.etag),s=r.data.slice(i.rootDirectoryOffset,i.rootDirectoryOffset+i.rootDirectoryLength),a=`${e.getKey()}|${i.etag||""}|${i.rootDirectoryOffset}|${i.rootDirectoryLength}`,l=un(yield t(s,i.internalCompression));return[i,[a,l.length,l]]})}function dn(e,t,r,n,o){return P(this,null,function*(){let i=yield e.getBytes(r,n,void 0,o.etag),s=yield t(i.data,o.internalCompression),a=un(s);if(a.length===0)throw new Error("Empty directory is invalid");return a})}var xs=class{constructor(e=100,t=!0,r=Mt){this.cache=new Map,this.maxCacheEntries=e,this.counter=1,this.decompress=r}getHeader(e){return P(this,null,function*(){let t=e.getKey(),r=this.cache.get(t);if(r)return r.lastUsed=this.counter++,r.data;let n=yield hn(e,this.decompress);return n[1]&&this.cache.set(n[1][0],{lastUsed:this.counter++,data:n[1][2]}),this.cache.set(t,{lastUsed:this.counter++,data:n[0]}),this.prune(),n[0]})}getDirectory(e,t,r,n){return P(this,null,function*(){let o=`${e.getKey()}|${n.etag||""}|${t}|${r}`,i=this.cache.get(o);if(i)return i.lastUsed=this.counter++,i.data;let s=yield dn(e,this.decompress,t,r,n);return this.cache.set(o,{lastUsed:this.counter++,data:s}),this.prune(),s})}getArrayBuffer(e,t,r,n){return P(this,null,function*(){let o=`${e.getKey()}|${n.etag||""}|${t}|${r}`,i=this.cache.get(o);if(i)return i.lastUsed=this.counter++,yield i.data;let s=yield e.getBytes(t,r,void 0,n.etag);return this.cache.set(o,{lastUsed:this.counter++,data:s.data}),this.prune(),s.data})}prune(){if(this.cache.size>this.maxCacheEntries){let e=1/0,t;this.cache.forEach((r,n)=>{r.lastUsed<e&&(e=r.lastUsed,t=n)}),t&&this.cache.delete(t)}}invalidate(e){return P(this,null,function*(){this.cache.delete(e.getKey())})}},pn=class{constructor(e=100,t=!0,r=Mt){this.cache=new Map,this.invalidations=new Map,this.maxCacheEntries=e,this.counter=1,this.decompress=r}getHeader(e){return P(this,null,function*(){let t=e.getKey(),r=this.cache.get(t);if(r)return r.lastUsed=this.counter++,yield r.data;let n=new Promise((o,i)=>{hn(e,this.decompress).then(s=>{s[1]&&this.cache.set(s[1][0],{lastUsed:this.counter++,data:Promise.resolve(s[1][2])}),o(s[0]),this.prune()}).catch(s=>{i(s)})});return this.cache.set(t,{lastUsed:this.counter++,data:n}),n})}getDirectory(e,t,r,n){return P(this,null,function*(){let o=`${e.getKey()}|${n.etag||""}|${t}|${r}`,i=this.cache.get(o);if(i)return i.lastUsed=this.counter++,yield i.data;let s=new Promise((a,l)=>{dn(e,this.decompress,t,r,n).then(c=>{a(c),this.prune()}).catch(c=>{l(c)})});return this.cache.set(o,{lastUsed:this.counter++,data:s}),s})}getArrayBuffer(e,t,r,n){return P(this,null,function*(){let o=`${e.getKey()}|${n.etag||""}|${t}|${r}`,i=this.cache.get(o);if(i)return i.lastUsed=this.counter++,yield i.data;let s=new Promise((a,l)=>{e.getBytes(t,r,void 0,n.etag).then(c=>{a(c.data),this.cache.has(o),this.prune()}).catch(c=>{l(c)})});return this.cache.set(o,{lastUsed:this.counter++,data:s}),s})}prune(){if(this.cache.size>=this.maxCacheEntries){let e=1/0,t;this.cache.forEach((r,n)=>{r.lastUsed<e&&(e=r.lastUsed,t=n)}),t&&this.cache.delete(t)}}invalidate(e){return P(this,null,function*(){let t=e.getKey();if(this.invalidations.get(t))return yield this.invalidations.get(t);this.cache.delete(e.getKey());let r=new Promise((n,o)=>{this.getHeader(e).then(i=>{n(),this.invalidations.delete(t)}).catch(i=>{o(i)})});this.invalidations.set(t,r)})}},Dt=class{constructor(e,t,r){typeof e=="string"?this.source=new cn(e):this.source=e,r?this.decompress=r:this.decompress=Mt,t?this.cache=t:this.cache=new pn}getHeader(){return P(this,null,function*(){return yield this.cache.getHeader(this.source)})}getZxyAttempt(e,t,r,n){return P(this,null,function*(){let o=on(e,t,r),i=yield this.cache.getHeader(this.source);if(i.specVersion<3)return rn.getZxy(i,this.source,this.cache,e,t,r,n);if(e<i.minZoom||e>i.maxZoom)return;let s=i.rootDirectoryOffset,a=i.rootDirectoryLength;for(let l=0;l<=3;l++){let c=yield this.cache.getDirectory(this.source,s,a,i),f=ln(c,o);if(f){if(f.runLength>0){let u=yield this.source.getBytes(i.tileDataOffset+f.offset,f.length,n,i.etag);return{data:yield this.decompress(u.data,i.tileCompression),cacheControl:u.cacheControl,expires:u.expires}}s=i.leafDirectoryOffset+f.offset,a=f.length}else return}throw Error("Maximum directory depth exceeded")})}getZxy(e,t,r,n){return P(this,null,function*(){try{return yield this.getZxyAttempt(e,t,r,n)}catch(o){if(o instanceof We)return this.cache.invalidate(this.source),yield this.getZxyAttempt(e,t,r,n);throw o}})}getMetadataAttempt(){return P(this,null,function*(){let e=yield this.cache.getHeader(this.source),t=yield this.source.getBytes(e.jsonMetadataOffset,e.jsonMetadataLength,void 0,e.etag),r=yield this.decompress(t.data,e.internalCompression),n=new TextDecoder("utf-8");return JSON.parse(n.decode(r))})}getMetadata(){return P(this,null,function*(){try{return yield this.getMetadataAttempt()}catch(e){if(e instanceof We)return this.cache.invalidate(this.source),yield this.getMetadataAttempt();throw e}})}};var{TileType:Be}=Ee;function gn(e,t,r,n){let o=null;if(t)try{let a=JSON.stringify(t);o=ye.parseTextSync?.(a,n)||null}catch(a){console.warn("PMTiles metadata could not be interpreted as TileJSON",a)}let i={};typeof o?.name=="string"&&(i.name=o.name),typeof o?.htmlAttribution=="string"&&(i.attributions=[o.htmlAttribution]);let s={...i,format:"pmtiles",formatVersion:e.specVersion,attributions:[],tileMIMEType:ws(e.tileType),minZoom:e.minZoom,maxZoom:e.maxZoom,boundingBox:[[e.minLon,e.minLat],[e.maxLon,e.maxLat]],center:[e.centerLon,e.centerLat],centerZoom:e.centerZoom,etag:e.etag};return o&&(s.tilejson=o),r?.includeFormatHeader&&(s.formatHeader=e,s.formatMetadata=s),s}function ws(e){switch(e){case Be.Mvt:return"application/vnd.mapbox-vector-tile";case Be.Png:return"image/png";case Be.Jpeg:return"image/jpeg";case Be.Webp:return"image/webp";case Be.Avif:return"image/avif";default:return"application/octet-stream"}}var Ke=class{blob;key;constructor(t,r){this.blob=t,this.key=r}getKey(){return this.blob.url||""}async getBytes(t,r,n){return{data:await this.blob.slice(t,t+r).arrayBuffer()}}};var{PMTiles:vs}=Ee,Ts="1.0.0",mn={name:"PMTiles",id:"pmtiles",module:"pmtiles",version:Ts,extensions:["pmtiles"],mimeTypes:["application/octet-stream"],options:{url:void 0,pmtiles:{}},type:"pmtiles",fromUrl:!0,fromBlob:!0,testURL:e=>e.endsWith(".pmtiles"),createDataSource:(e,t)=>new Q(e,t)},Q=class extends pe{data;props;mimeType=null;pmtiles;metadata;constructor(t,r){super(r),this.props=r;let n=typeof t=="string"?st(t):new Ke(t,"pmtiles");this.data=t,this.pmtiles=new vs(n),this.getTileData=this.getTileData.bind(this),this.metadata=this.getMetadata()}async getSchema(){return{fields:[],metadata:{}}}async getMetadata(){let t=await this.pmtiles.getHeader(),r=await this.pmtiles.getMetadata()||{},n=gn(t,r,{includeFormatHeader:!1},this.loadOptions);return this.props.attributions&&(n.attributions=[...this.props.attributions,...n.attributions||[]]),n?.tileMIMEType&&(this.mimeType=n?.tileMIMEType),n}async getTile(t){let{x:r,y:n,z:o}=t,s=(await this.pmtiles.getZxy(o,r,n))?.data;return s||null}async getTileData(t){let{x:r,y:n,z:o}=t.index;switch((await this.metadata).tileMIMEType){case"application/vnd.mapbox-vector-tile":return await this.getVectorTile({x:r,y:n,z:o,layers:[]});default:return await this.getImageTile({x:r,y:n,z:o,layers:[]})}}async getImageTile(t){let r=await this.getTile(t);return r?await ut.parse(r,this.loadOptions):null}async getVectorTile(t){let r=await this.getTile(t),n={shape:"geojson-table",mvt:{coordinates:"wgs84",tileIndex:{x:t.x,y:t.y,z:t.z},...this.loadOptions?.mvt},...this.loadOptions};return r?await St.parse(r,n):null}};var yn="4.3.0-alpha.7";var wn={name:"PMTiles",id:"pmtiles",module:"pmtiles",version:yn,extensions:["pmtiles"],mimeTypes:["application/octet-stream"],tests:["PMTiles"],options:{pmtiles:{}},parse:async(e,t)=>xn(new de(new Blob([e])),t),parseFile:xn};async function xn(e,t){let n=await new Q(e.handle,{pmtiles:t?.pmtiles||{}}).getMetadata(),{tileMIMEType:o,tilejson:i={}}=n,{layers:s=[]}=i;switch(o){case"application/vnd.mapbox-vector-tile":return{shape:"vector-source",layers:s.map(a=>({name:a.name,schema:a.schema})),tables:[],formatSpecificMetadata:n};case"image/png":case"image/jpeg":return{shape:"image-source",formatSpecificMetadata:n};default:throw new Error(`PMTilesLoader: Unsupported tile MIME type ${o}`)}}return Dn(_e);})();
|
|
7
|
+
"use strict";var __exports__=(()=>{var Tn=Object.create;var se=Object.defineProperty;var Fn=Object.getOwnPropertyDescriptor;var Pn=Object.getOwnPropertyNames;var In=Object.getPrototypeOf,bn=Object.prototype.hasOwnProperty;var En=(e,t,r)=>t in e?se(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var Ke=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),kt=(e,t)=>{for(var r in t)se(e,r,{get:t[r],enumerable:!0})},Se=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Pn(t))!bn.call(e,i)&&i!==r&&se(e,i,{get:()=>t[i],enumerable:!(n=Fn(t,i))||n.enumerable});return e},Be=(e,t,r)=>(Se(e,t,"default"),r&&Se(r,t,"default")),Nt=(e,t,r)=>(r=e!=null?Tn(In(e)):{},Se(t||!e||!e.__esModule?se(r,"default",{value:e,enumerable:!0}):r,e)),Sn=e=>Se(se({},"__esModule",{value:!0}),e);var Ct=(e,t,r)=>(En(e,typeof t!="symbol"?t+"":t,r),r);var zt=Ke((ys,Ot)=>{Ot.exports=globalThis.loaders});var Ir=Ke(dt=>{dt.read=function(e,t,r,n,i){var o,s,a=i*8-n-1,l=(1<<a)-1,c=l>>1,f=-7,u=r?i-1:0,h=r?-1:1,d=e[t+u];for(u+=h,o=d&(1<<-f)-1,d>>=-f,f+=a;f>0;o=o*256+e[t+u],u+=h,f-=8);for(s=o&(1<<-f)-1,o>>=-f,f+=n;f>0;s=s*256+e[t+u],u+=h,f-=8);if(o===0)o=1-c;else{if(o===l)return s?NaN:(d?-1:1)*(1/0);s=s+Math.pow(2,n),o=o-c}return(d?-1:1)*s*Math.pow(2,o-n)};dt.write=function(e,t,r,n,i,o){var s,a,l,c=o*8-i-1,f=(1<<c)-1,u=f>>1,h=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,d=n?0:o-1,p=n?1:-1,y=t<0||t===0&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,s=f):(s=Math.floor(Math.log(t)/Math.LN2),t*(l=Math.pow(2,-s))<1&&(s--,l*=2),s+u>=1?t+=h/l:t+=h*Math.pow(2,1-u),t*l>=2&&(s++,l/=2),s+u>=f?(a=0,s=f):s+u>=1?(a=(t*l-1)*Math.pow(2,i),s=s+u):(a=t*Math.pow(2,u-1)*Math.pow(2,i),s=0));i>=8;e[r+d]=a&255,d+=p,a/=256,i-=8);for(s=s<<i|a,c+=i;c>0;e[r+d]=s&255,d+=p,s/=256,c-=8);e[r+d-p]|=y*128}});var _r=Ke((Bl,Ar)=>{"use strict";Ar.exports=x;var Oe=Ir();function x(e){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(e)?e:new Uint8Array(e||0),this.pos=0,this.type=0,this.length=this.buf.length}x.Varint=0;x.Fixed64=1;x.Bytes=2;x.Fixed32=5;var pt=(1<<16)*(1<<16),br=1/pt,ro=12,Br=typeof TextDecoder>"u"?null:new TextDecoder("utf-8");x.prototype={destroy:function(){this.buf=null},readFields:function(e,t,r){for(r=r||this.length;this.pos<r;){var n=this.readVarint(),i=n>>3,o=this.pos;this.type=n&7,e(i,t,this),this.pos===o&&this.skip(n)}return t},readMessage:function(e,t){return this.readFields(e,t,this.readVarint()+this.pos)},readFixed32:function(){var e=ze(this.buf,this.pos);return this.pos+=4,e},readSFixed32:function(){var e=Sr(this.buf,this.pos);return this.pos+=4,e},readFixed64:function(){var e=ze(this.buf,this.pos)+ze(this.buf,this.pos+4)*pt;return this.pos+=8,e},readSFixed64:function(){var e=ze(this.buf,this.pos)+Sr(this.buf,this.pos+4)*pt;return this.pos+=8,e},readFloat:function(){var e=Oe.read(this.buf,this.pos,!0,23,4);return this.pos+=4,e},readDouble:function(){var e=Oe.read(this.buf,this.pos,!0,52,8);return this.pos+=8,e},readVarint:function(e){var t=this.buf,r,n;return n=t[this.pos++],r=n&127,n<128||(n=t[this.pos++],r|=(n&127)<<7,n<128)||(n=t[this.pos++],r|=(n&127)<<14,n<128)||(n=t[this.pos++],r|=(n&127)<<21,n<128)?r:(n=t[this.pos],r|=(n&15)<<28,no(r,e,this))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var e=this.readVarint();return e%2===1?(e+1)/-2:e/2},readBoolean:function(){return Boolean(this.readVarint())},readString:function(){var e=this.readVarint()+this.pos,t=this.pos;return this.pos=e,e-t>=ro&&Br?xo(this.buf,t,e):yo(this.buf,t,e)},readBytes:function(){var e=this.readVarint()+this.pos,t=this.buf.subarray(this.pos,e);return this.pos=e,t},readPackedVarint:function(e,t){if(this.type!==x.Bytes)return e.push(this.readVarint(t));var r=O(this);for(e=e||[];this.pos<r;)e.push(this.readVarint(t));return e},readPackedSVarint:function(e){if(this.type!==x.Bytes)return e.push(this.readSVarint());var t=O(this);for(e=e||[];this.pos<t;)e.push(this.readSVarint());return e},readPackedBoolean:function(e){if(this.type!==x.Bytes)return e.push(this.readBoolean());var t=O(this);for(e=e||[];this.pos<t;)e.push(this.readBoolean());return e},readPackedFloat:function(e){if(this.type!==x.Bytes)return e.push(this.readFloat());var t=O(this);for(e=e||[];this.pos<t;)e.push(this.readFloat());return e},readPackedDouble:function(e){if(this.type!==x.Bytes)return e.push(this.readDouble());var t=O(this);for(e=e||[];this.pos<t;)e.push(this.readDouble());return e},readPackedFixed32:function(e){if(this.type!==x.Bytes)return e.push(this.readFixed32());var t=O(this);for(e=e||[];this.pos<t;)e.push(this.readFixed32());return e},readPackedSFixed32:function(e){if(this.type!==x.Bytes)return e.push(this.readSFixed32());var t=O(this);for(e=e||[];this.pos<t;)e.push(this.readSFixed32());return e},readPackedFixed64:function(e){if(this.type!==x.Bytes)return e.push(this.readFixed64());var t=O(this);for(e=e||[];this.pos<t;)e.push(this.readFixed64());return e},readPackedSFixed64:function(e){if(this.type!==x.Bytes)return e.push(this.readSFixed64());var t=O(this);for(e=e||[];this.pos<t;)e.push(this.readSFixed64());return e},skip:function(e){var t=e&7;if(t===x.Varint)for(;this.buf[this.pos++]>127;);else if(t===x.Bytes)this.pos=this.readVarint()+this.pos;else if(t===x.Fixed32)this.pos+=4;else if(t===x.Fixed64)this.pos+=8;else throw new Error("Unimplemented type: "+t)},writeTag:function(e,t){this.writeVarint(e<<3|t)},realloc:function(e){for(var t=this.length||16;t<this.pos+e;)t*=2;if(t!==this.length){var r=new Uint8Array(t);r.set(this.buf),this.buf=r,this.length=t}},finish:function(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)},writeFixed32:function(e){this.realloc(4),te(this.buf,e,this.pos),this.pos+=4},writeSFixed32:function(e){this.realloc(4),te(this.buf,e,this.pos),this.pos+=4},writeFixed64:function(e){this.realloc(8),te(this.buf,e&-1,this.pos),te(this.buf,Math.floor(e*br),this.pos+4),this.pos+=8},writeSFixed64:function(e){this.realloc(8),te(this.buf,e&-1,this.pos),te(this.buf,Math.floor(e*br),this.pos+4),this.pos+=8},writeVarint:function(e){if(e=+e||0,e>268435455||e<0){io(e,this);return}this.realloc(4),this.buf[this.pos++]=e&127|(e>127?128:0),!(e<=127)&&(this.buf[this.pos++]=(e>>>=7)&127|(e>127?128:0),!(e<=127)&&(this.buf[this.pos++]=(e>>>=7)&127|(e>127?128:0),!(e<=127)&&(this.buf[this.pos++]=e>>>7&127)))},writeSVarint:function(e){this.writeVarint(e<0?-e*2-1:e*2)},writeBoolean:function(e){this.writeVarint(Boolean(e))},writeString:function(e){e=String(e),this.realloc(e.length*4),this.pos++;var t=this.pos;this.pos=wo(this.buf,e,this.pos);var r=this.pos-t;r>=128&&Er(t,r,this),this.pos=t-1,this.writeVarint(r),this.pos+=r},writeFloat:function(e){this.realloc(4),Oe.write(this.buf,e,this.pos,!0,23,4),this.pos+=4},writeDouble:function(e){this.realloc(8),Oe.write(this.buf,e,this.pos,!0,52,8),this.pos+=8},writeBytes:function(e){var t=e.length;this.writeVarint(t),this.realloc(t);for(var r=0;r<t;r++)this.buf[this.pos++]=e[r]},writeRawMessage:function(e,t){this.pos++;var r=this.pos;e(t,this);var n=this.pos-r;n>=128&&Er(r,n,this),this.pos=r-1,this.writeVarint(n),this.pos+=n},writeMessage:function(e,t,r){this.writeTag(e,x.Bytes),this.writeRawMessage(t,r)},writePackedVarint:function(e,t){t.length&&this.writeMessage(e,ao,t)},writePackedSVarint:function(e,t){t.length&&this.writeMessage(e,lo,t)},writePackedBoolean:function(e,t){t.length&&this.writeMessage(e,uo,t)},writePackedFloat:function(e,t){t.length&&this.writeMessage(e,co,t)},writePackedDouble:function(e,t){t.length&&this.writeMessage(e,fo,t)},writePackedFixed32:function(e,t){t.length&&this.writeMessage(e,ho,t)},writePackedSFixed32:function(e,t){t.length&&this.writeMessage(e,po,t)},writePackedFixed64:function(e,t){t.length&&this.writeMessage(e,go,t)},writePackedSFixed64:function(e,t){t.length&&this.writeMessage(e,mo,t)},writeBytesField:function(e,t){this.writeTag(e,x.Bytes),this.writeBytes(t)},writeFixed32Field:function(e,t){this.writeTag(e,x.Fixed32),this.writeFixed32(t)},writeSFixed32Field:function(e,t){this.writeTag(e,x.Fixed32),this.writeSFixed32(t)},writeFixed64Field:function(e,t){this.writeTag(e,x.Fixed64),this.writeFixed64(t)},writeSFixed64Field:function(e,t){this.writeTag(e,x.Fixed64),this.writeSFixed64(t)},writeVarintField:function(e,t){this.writeTag(e,x.Varint),this.writeVarint(t)},writeSVarintField:function(e,t){this.writeTag(e,x.Varint),this.writeSVarint(t)},writeStringField:function(e,t){this.writeTag(e,x.Bytes),this.writeString(t)},writeFloatField:function(e,t){this.writeTag(e,x.Fixed32),this.writeFloat(t)},writeDoubleField:function(e,t){this.writeTag(e,x.Fixed64),this.writeDouble(t)},writeBooleanField:function(e,t){this.writeVarintField(e,Boolean(t))}};function no(e,t,r){var n=r.buf,i,o;if(o=n[r.pos++],i=(o&112)>>4,o<128||(o=n[r.pos++],i|=(o&127)<<3,o<128)||(o=n[r.pos++],i|=(o&127)<<10,o<128)||(o=n[r.pos++],i|=(o&127)<<17,o<128)||(o=n[r.pos++],i|=(o&127)<<24,o<128)||(o=n[r.pos++],i|=(o&1)<<31,o<128))return ee(e,i,t);throw new Error("Expected varint not more than 10 bytes")}function O(e){return e.type===x.Bytes?e.readVarint()+e.pos:e.pos+1}function ee(e,t,r){return r?t*4294967296+(e>>>0):(t>>>0)*4294967296+(e>>>0)}function io(e,t){var r,n;if(e>=0?(r=e%4294967296|0,n=e/4294967296|0):(r=~(-e%4294967296),n=~(-e/4294967296),r^4294967295?r=r+1|0:(r=0,n=n+1|0)),e>=18446744073709552e3||e<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");t.realloc(10),oo(r,n,t),so(n,t)}function oo(e,t,r){r.buf[r.pos++]=e&127|128,e>>>=7,r.buf[r.pos++]=e&127|128,e>>>=7,r.buf[r.pos++]=e&127|128,e>>>=7,r.buf[r.pos++]=e&127|128,e>>>=7,r.buf[r.pos]=e&127}function so(e,t){var r=(e&7)<<4;t.buf[t.pos++]|=r|((e>>>=3)?128:0),e&&(t.buf[t.pos++]=e&127|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=e&127|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=e&127|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=e&127|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=e&127)))))}function Er(e,t,r){var n=t<=16383?1:t<=2097151?2:t<=268435455?3:Math.floor(Math.log(t)/(Math.LN2*7));r.realloc(n);for(var i=r.pos-1;i>=e;i--)r.buf[i+n]=r.buf[i]}function ao(e,t){for(var r=0;r<e.length;r++)t.writeVarint(e[r])}function lo(e,t){for(var r=0;r<e.length;r++)t.writeSVarint(e[r])}function co(e,t){for(var r=0;r<e.length;r++)t.writeFloat(e[r])}function fo(e,t){for(var r=0;r<e.length;r++)t.writeDouble(e[r])}function uo(e,t){for(var r=0;r<e.length;r++)t.writeBoolean(e[r])}function ho(e,t){for(var r=0;r<e.length;r++)t.writeFixed32(e[r])}function po(e,t){for(var r=0;r<e.length;r++)t.writeSFixed32(e[r])}function go(e,t){for(var r=0;r<e.length;r++)t.writeFixed64(e[r])}function mo(e,t){for(var r=0;r<e.length;r++)t.writeSFixed64(e[r])}function ze(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16)+e[t+3]*16777216}function te(e,t,r){e[r]=t,e[r+1]=t>>>8,e[r+2]=t>>>16,e[r+3]=t>>>24}function Sr(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16)+(e[t+3]<<24)}function yo(e,t,r){for(var n="",i=t;i<r;){var o=e[i],s=null,a=o>239?4:o>223?3:o>191?2:1;if(i+a>r)break;var l,c,f;a===1?o<128&&(s=o):a===2?(l=e[i+1],(l&192)===128&&(s=(o&31)<<6|l&63,s<=127&&(s=null))):a===3?(l=e[i+1],c=e[i+2],(l&192)===128&&(c&192)===128&&(s=(o&15)<<12|(l&63)<<6|c&63,(s<=2047||s>=55296&&s<=57343)&&(s=null))):a===4&&(l=e[i+1],c=e[i+2],f=e[i+3],(l&192)===128&&(c&192)===128&&(f&192)===128&&(s=(o&15)<<18|(l&63)<<12|(c&63)<<6|f&63,(s<=65535||s>=1114112)&&(s=null))),s===null?(s=65533,a=1):s>65535&&(s-=65536,n+=String.fromCharCode(s>>>10&1023|55296),s=56320|s&1023),n+=String.fromCharCode(s),i+=a}return n}function xo(e,t,r){return Br.decode(e.subarray(t,r))}function wo(e,t,r){for(var n=0,i,o;n<t.length;n++){if(i=t.charCodeAt(n),i>55295&&i<57344)if(o)if(i<56320){e[r++]=239,e[r++]=191,e[r++]=189,o=i;continue}else i=o-55296<<10|i-56320|65536,o=null;else{i>56319||n+1===t.length?(e[r++]=239,e[r++]=191,e[r++]=189):o=i;continue}else o&&(e[r++]=239,e[r++]=191,e[r++]=189,o=null);i<128?e[r++]=i:(i<2048?e[r++]=i>>6|192:(i<65536?e[r++]=i>>12|224:(e[r++]=i>>18|240,e[r++]=i>>12&63|128),e[r++]=i>>6&63|128),e[r++]=i&63|128)}return r}});var be={};kt(be,{PMTilesSource:()=>hn,PMTilesTileSource:()=>W,_PMTilesLoader:()=>gn});Be(be,Nt(zt(),1));function ae(e,t){if(!e)throw new Error(t||"loader assertion failed.")}var N={self:typeof self<"u"&&self,window:typeof window<"u"&&window,global:typeof global<"u"&&global,document:typeof document<"u"&&document},Bn=N.self||N.window||N.global||{},An=N.window||N.self||N.global||{},_n=N.global||N.self||N.window||{},Dn=N.document||{};var Ye=Boolean(typeof process!="object"||String(process)!=="[object process]"||process.browser);var Gt=typeof process<"u"&&process.version&&/v([0-9]*)/.exec(process.version),Ln=Gt&&parseFloat(Gt[1])||0;var Ae=globalThis,Mn=globalThis.document||{},_e=globalThis.process||{},Vn=globalThis.console,vs=globalThis.navigator||{};function jt(e){if(typeof window<"u"&&window.process?.type==="renderer"||typeof process<"u"&&Boolean(process.versions?.electron))return!0;let t=typeof navigator<"u"&&navigator.userAgent,r=e||t;return Boolean(r&&r.indexOf("Electron")>=0)}function j(){return!(typeof process=="object"&&String(process)==="[object process]"&&!process?.browser)||jt()}var Xe="4.0.7";function kn(e){try{let t=window[e],r="__storage_test__";return t.setItem(r,r),t.removeItem(r),t}catch{return null}}var De=class{constructor(t,r,n="sessionStorage"){this.storage=kn(n),this.id=t,this.config=r,this._loadConfiguration()}getConfiguration(){return this.config}setConfiguration(t){if(Object.assign(this.config,t),this.storage){let r=JSON.stringify(this.config);this.storage.setItem(this.id,r)}}_loadConfiguration(){let t={};if(this.storage){let r=this.storage.getItem(this.id);t=r?JSON.parse(r):{}}return Object.assign(this.config,t),this}};function Rt(e){let t;return e<10?t=`${e.toFixed(2)}ms`:e<100?t=`${e.toFixed(1)}ms`:e<1e3?t=`${e.toFixed(0)}ms`:t=`${(e/1e3).toFixed(2)}s`,t}function Ht(e,t=8){let r=Math.max(t-e.length,0);return`${" ".repeat(r)}${e}`}var Le;(function(e){e[e.BLACK=30]="BLACK",e[e.RED=31]="RED",e[e.GREEN=32]="GREEN",e[e.YELLOW=33]="YELLOW",e[e.BLUE=34]="BLUE",e[e.MAGENTA=35]="MAGENTA",e[e.CYAN=36]="CYAN",e[e.WHITE=37]="WHITE",e[e.BRIGHT_BLACK=90]="BRIGHT_BLACK",e[e.BRIGHT_RED=91]="BRIGHT_RED",e[e.BRIGHT_GREEN=92]="BRIGHT_GREEN",e[e.BRIGHT_YELLOW=93]="BRIGHT_YELLOW",e[e.BRIGHT_BLUE=94]="BRIGHT_BLUE",e[e.BRIGHT_MAGENTA=95]="BRIGHT_MAGENTA",e[e.BRIGHT_CYAN=96]="BRIGHT_CYAN",e[e.BRIGHT_WHITE=97]="BRIGHT_WHITE"})(Le||(Le={}));var Nn=10;function Zt(e){return typeof e!="string"?e:(e=e.toUpperCase(),Le[e]||Le.WHITE)}function $t(e,t,r){return!j&&typeof e=="string"&&(t&&(e=`\x1B[${Zt(t)}m${e}\x1B[39m`),r&&(e=`\x1B[${Zt(r)+Nn}m${e}\x1B[49m`)),e}function Jt(e,t=["constructor"]){let r=Object.getPrototypeOf(e),n=Object.getOwnPropertyNames(r),i=e;for(let o of n){let s=i[o];typeof s=="function"&&(t.find(a=>o===a)||(i[o]=s.bind(e)))}}function le(e,t){if(!e)throw new Error(t||"Assertion failed")}function R(){let e;if(j()&&Ae.performance)e=Ae?.performance?.now?.();else if("hrtime"in _e){let t=_e?.hrtime?.();e=t[0]*1e3+t[1]/1e6}else e=Date.now();return e}var X={debug:j()&&console.debug||console.log,log:console.log,info:console.info,warn:console.warn,error:console.error},Cn={enabled:!0,level:0};function Q(){}var Wt={},Kt={once:!0},G=class{constructor({id:t}={id:""}){this.VERSION=Xe,this._startTs=R(),this._deltaTs=R(),this.userData={},this.LOG_THROTTLE_TIMEOUT=0,this.id=t,this.userData={},this._storage=new De(`__probe-${this.id}__`,Cn),this.timeStamp(`${this.id} started`),Jt(this),Object.seal(this)}set level(t){this.setLevel(t)}get level(){return this.getLevel()}isEnabled(){return this._storage.config.enabled}getLevel(){return this._storage.config.level}getTotal(){return Number((R()-this._startTs).toPrecision(10))}getDelta(){return Number((R()-this._deltaTs).toPrecision(10))}set priority(t){this.level=t}get priority(){return this.level}getPriority(){return this.level}enable(t=!0){return this._storage.setConfiguration({enabled:t}),this}setLevel(t){return this._storage.setConfiguration({level:t}),this}get(t){return this._storage.config[t]}set(t,r){this._storage.setConfiguration({[t]:r})}settings(){console.table?console.table(this._storage.config):console.log(this._storage.config)}assert(t,r){if(!t)throw new Error(r||"Assertion failed")}warn(t){return this._getLogFunction(0,t,X.warn,arguments,Kt)}error(t){return this._getLogFunction(0,t,X.error,arguments)}deprecated(t,r){return this.warn(`\`${t}\` is deprecated and will be removed in a later version. Use \`${r}\` instead`)}removed(t,r){return this.error(`\`${t}\` has been removed. Use \`${r}\` instead`)}probe(t,r){return this._getLogFunction(t,r,X.log,arguments,{time:!0,once:!0})}log(t,r){return this._getLogFunction(t,r,X.debug,arguments)}info(t,r){return this._getLogFunction(t,r,console.info,arguments)}once(t,r){return this._getLogFunction(t,r,X.debug||X.info,arguments,Kt)}table(t,r,n){return r?this._getLogFunction(t,r,console.table||Q,n&&[n],{tag:zn(r)}):Q}time(t,r){return this._getLogFunction(t,r,console.time?console.time:console.info)}timeEnd(t,r){return this._getLogFunction(t,r,console.timeEnd?console.timeEnd:console.info)}timeStamp(t,r){return this._getLogFunction(t,r,console.timeStamp||Q)}group(t,r,n={collapsed:!1}){let i=Yt({logLevel:t,message:r,opts:n}),{collapsed:o}=n;return i.method=(o?console.groupCollapsed:console.group)||console.info,this._getLogFunction(i)}groupCollapsed(t,r,n={}){return this.group(t,r,Object.assign({},n,{collapsed:!0}))}groupEnd(t){return this._getLogFunction(t,"",console.groupEnd||Q)}withGroup(t,r,n){this.group(t,r)();try{n()}finally{this.groupEnd(t)()}}trace(){console.trace&&console.trace()}_shouldLog(t){return this.isEnabled()&&this.getLevel()>=Xt(t)}_getLogFunction(t,r,n,i,o){if(this._shouldLog(t)){o=Yt({logLevel:t,message:r,args:i,opts:o}),n=n||o.method,le(n),o.total=this.getTotal(),o.delta=this.getDelta(),this._deltaTs=R();let s=o.tag||o.message;if(o.once&&s)if(!Wt[s])Wt[s]=R();else return Q;return r=On(this.id,o.message,o),n.bind(console,r,...o.args)}return Q}};G.VERSION=Xe;function Xt(e){if(!e)return 0;let t;switch(typeof e){case"number":t=e;break;case"object":t=e.logLevel||e.priority||0;break;default:return 0}return le(Number.isFinite(t)&&t>=0),t}function Yt(e){let{logLevel:t,message:r}=e;e.logLevel=Xt(t);let n=e.args?Array.from(e.args):[];for(;n.length&&n.shift()!==r;);switch(typeof t){case"string":case"function":r!==void 0&&n.unshift(r),e.message=t;break;case"object":Object.assign(e,t);break;default:}typeof e.message=="function"&&(e.message=e.message());let i=typeof e.message;return le(i==="string"||i==="object"),Object.assign(e,{args:n},e.opts)}function On(e,t,r){if(typeof t=="string"){let n=r.time?Ht(Rt(r.total)):"";t=r.time?`${e}: ${n} ${t}`:`${e}: ${t}`,t=$t(t,r.color,r.background)}return t}function zn(e){for(let t in e)for(let r in e[t])return r||"untitled";return"empty"}globalThis.probe={};var Zs=new G({id:"@probe.gl/log"});var Qe="4.3.0-alpha.8",Gn=Qe[0]>="0"&&Qe[0]<="9"?`v${Qe}`:"";function jn(){let e=new G({id:"loaders.gl"});return globalThis.loaders=globalThis.loaders||{},globalThis.loaders.log=e,globalThis.loaders.version=Gn,globalThis.probe=globalThis.probe||{},globalThis.probe.loaders=e,e}var qe=jn();var Rn="",Qt={};function et(e){for(let t in Qt)if(e.startsWith(t)){let r=Qt[t];e=e.replace(t,r)}return!e.startsWith("http://")&&!e.startsWith("https://")&&(e=`${Rn}${e}`),e}var ce=class{handle;size;bigsize;url;constructor(t){this.handle=t instanceof ArrayBuffer?new Blob([t]):t,this.size=t instanceof ArrayBuffer?t.byteLength:t.size,this.bigsize=BigInt(this.size),this.url=t instanceof File?t.name:""}async close(){}async stat(){return{size:this.handle.size,bigsize:BigInt(this.handle.size),isDirectory:!1}}async read(t,r){return await this.handle.slice(t,t+r).arrayBuffer()}};var fe=class{fetch;loadOptions;_needsRefresh=!0;props;constructor(t){this.props={...t},this.loadOptions={...t.loadOptions},this.fetch=Hn(this.loadOptions)}setProps(t){this.props=Object.assign(this.props,t),this.setNeedsRefresh()}setNeedsRefresh(){this._needsRefresh=!0}getNeedsRefresh(t=!0){let r=this._needsRefresh;return t&&(this._needsRefresh=!1),r}};function Hn(e){let t=e?.fetch;if(t&&typeof t=="function")return(n,i)=>t(n,i);let r=e?.fetch;return r&&typeof r!="function"?n=>fetch(n,r):n=>fetch(n)}var qt="4.3.0-alpha.8";var Zn=globalThis.loaders?.parseImageNode,tt=typeof Image<"u",rt=typeof ImageBitmap<"u",$n=Boolean(Zn),nt=Ye?!0:$n;function er(e){switch(e){case"auto":return rt||tt||nt;case"imagebitmap":return rt;case"image":return tt;case"data":return nt;default:throw new Error(`@loaders.gl/images: image ${e} not supported in this environment`)}}function tr(){if(rt)return"imagebitmap";if(tt)return"image";if(nt)return"data";throw new Error("Install '@loaders.gl/polyfills' to parse images under Node.js")}function Jn(e){let t=Wn(e);if(!t)throw new Error("Not an image");return t}function rr(e){switch(Jn(e)){case"data":return e;case"image":case"imagebitmap":let t=document.createElement("canvas"),r=t.getContext("2d");if(!r)throw new Error("getImageData");return t.width=e.width,t.height=e.height,r.drawImage(e,0,0),r.getImageData(0,0,e.width,e.height);default:throw new Error("getImageData")}}function Wn(e){return typeof ImageBitmap<"u"&&e instanceof ImageBitmap?"imagebitmap":typeof Image<"u"&&e instanceof Image?"image":e&&typeof e=="object"&&e.data&&e.width&&e.height?"data":null}var Kn=/^data:image\/svg\+xml/,Yn=/\.svg((\?|#).*)?$/;function Me(e){return e&&(Kn.test(e)||Yn.test(e))}function nr(e,t){if(Me(t)){let n=new TextDecoder().decode(e);try{typeof unescape=="function"&&typeof encodeURIComponent=="function"&&(n=unescape(encodeURIComponent(n)))}catch(o){throw new Error(o.message)}return`data:image/svg+xml;base64,${btoa(n)}`}return it(e,t)}function it(e,t){if(Me(t))throw new Error("SVG cannot be parsed directly to imagebitmap");return new Blob([new Uint8Array(e)])}async function Ve(e,t,r){let n=nr(e,r),i=self.URL||self.webkitURL,o=typeof n!="string"&&i.createObjectURL(n);try{return await Xn(o||n,t)}finally{o&&i.revokeObjectURL(o)}}async function Xn(e,t){let r=new Image;return r.src=e,t.image&&t.image.decode&&r.decode?(await r.decode(),r):await new Promise((n,i)=>{try{r.onload=()=>n(r),r.onerror=o=>{let s=o instanceof Error?o.message:"error";i(new Error(s))}}catch(o){i(o)}})}var Qn={},ir=!0;async function or(e,t,r){let n;Me(r)?n=await Ve(e,t,r):n=it(e,r);let i=t&&t.imagebitmap;return await qn(n,i)}async function qn(e,t=null){if((ei(t)||!ir)&&(t=null),t)try{return await createImageBitmap(e,t)}catch(r){console.warn(r),ir=!1}return await createImageBitmap(e)}function ei(e){for(let t in e||Qn)return!1;return!0}function sr(e){return!ii(e,"ftyp",4)||!(e[8]&96)?null:ti(e)}function ti(e){switch(ri(e,8,12).replace("\0"," ").trim()){case"avif":case"avis":return{extension:"avif",mimeType:"image/avif"};default:return null}}function ri(e,t,r){return String.fromCharCode(...e.slice(t,r))}function ni(e){return[...e].map(t=>t.charCodeAt(0))}function ii(e,t,r=0){let n=ni(t);for(let i=0;i<n.length;++i)if(n[i]!==e[i+r])return!1;return!0}var C=!1,ue=!0;function Ue(e){let t=he(e);return si(t)||ci(t)||ai(t)||li(t)||oi(t)}function oi(e){let t=new Uint8Array(e instanceof DataView?e.buffer:e),r=sr(t);return r?{mimeType:r.mimeType,width:0,height:0}:null}function si(e){let t=he(e);return t.byteLength>=24&&t.getUint32(0,C)===2303741511?{mimeType:"image/png",width:t.getUint32(16,C),height:t.getUint32(20,C)}:null}function ai(e){let t=he(e);return t.byteLength>=10&&t.getUint32(0,C)===1195984440?{mimeType:"image/gif",width:t.getUint16(6,ue),height:t.getUint16(8,ue)}:null}function li(e){let t=he(e);return t.byteLength>=14&&t.getUint16(0,C)===16973&&t.getUint32(2,ue)===t.byteLength?{mimeType:"image/bmp",width:t.getUint32(18,ue),height:t.getUint32(22,ue)}:null}function ci(e){let t=he(e);if(!(t.byteLength>=3&&t.getUint16(0,C)===65496&&t.getUint8(2)===255))return null;let{tableMarkers:n,sofMarkers:i}=fi(),o=2;for(;o+9<t.byteLength;){let s=t.getUint16(o,C);if(i.has(s))return{mimeType:"image/jpeg",height:t.getUint16(o+5,C),width:t.getUint16(o+7,C)};if(!n.has(s))return null;o+=2,o+=t.getUint16(o,C)}return null}function fi(){let e=new Set([65499,65476,65484,65501,65534]);for(let r=65504;r<65520;++r)e.add(r);return{tableMarkers:e,sofMarkers:new Set([65472,65473,65474,65475,65477,65478,65479,65481,65482,65483,65485,65486,65487,65502])}}function he(e){if(e instanceof DataView)return e;if(ArrayBuffer.isView(e))return new DataView(e.buffer);if(e instanceof ArrayBuffer)return new DataView(e);throw new Error("toDataView")}async function ar(e,t){let{mimeType:r}=Ue(e)||{},n=globalThis.loaders?.parseImageNode;return ae(n),await n(e,r)}async function lr(e,t,r){t=t||{};let i=(t.image||{}).type||"auto",{url:o}=r||{},s=ui(i),a;switch(s){case"imagebitmap":a=await or(e,t,o);break;case"image":a=await Ve(e,t,o);break;case"data":a=await ar(e,t);break;default:ae(!1)}return i==="data"&&(a=rr(a)),a}function ui(e){switch(e){case"auto":case"data":return tr();default:return er(e),e}}var hi=["png","jpg","jpeg","gif","webp","bmp","ico","svg","avif"],di=["image/png","image/jpeg","image/gif","image/webp","image/avif","image/bmp","image/vnd.microsoft.icon","image/svg+xml"],pi={image:{type:"auto",decode:!0}},ot={dataType:null,batchType:null,id:"image",module:"images",name:"Images",version:qt,mimeTypes:di,extensions:hi,parse:lr,tests:[e=>Boolean(Ue(new DataView(e)))],options:pi};function cr(e){let t=[];if(e.fields)for(let r of e.fields)t.push({name:r.name,type:mi(r),metadata:yi(r)});return{metadata:gi(e),fields:t}}function gi(e){let t={};for(let[r,n]of Object.entries(e))r!=="fields"&&n&&(t[r]=JSON.stringify(n));return t}function mi(e){switch(e.type.toLowerCase()){case"float32":return"float32";case"number":case"float64":return"float64";case"string":case"utf8":return"utf8";case"boolean":return"bool";default:return"null"}}function yi(e){let t={};for(let[r,n]of Object.entries(e))r!=="name"&&n&&(t[r]=JSON.stringify(n));return t}var dr=e=>e!==null&&typeof e=="object";function st(e,t){if(!e||!dr(e))return null;let r={name:e.name||"",description:e.description||""};if(typeof e.generator=="string"&&(r.generator=e.generator),typeof e.generator_options=="string"&&(r.generatorOptions=e.generator_options),r.boundingBox=fr(e.bounds)||fr(e.antimeridian_adjusted_bounds),r.center=Pi(e.center),r.maxZoom=ur(e.maxzoom),r.minZoom=ur(e.minzoom),typeof e?.json=="string")try{r.metaJson=JSON.parse(e.json)}catch(a){console.warn("Failed to parse tilejson.json field",a)}let n=e.tilestats||r.metaJson?.tilestats,i=vi(n,t),o=xi(e.vector_layers),s=Fi(o,i);return r={...r,layers:s},r.maxZoom===null&&s.length>0&&(r.maxZoom=s[0].maxZoom||null),r.minZoom===null&&s.length>0&&(r.minZoom=s[0].minZoom||null),r}function xi(e){return Array.isArray(e)?e.map(t=>wi(t)):[]}function wi(e){let t=Object.entries(e.fields||[]).map(([n,i])=>({name:n,...yr(String(i))})),r={...e};return delete r.fields,{name:e.id||"",...r,fields:t}}function vi(e,t){return dr(e)&&Array.isArray(e.layers)?e.layers.map(r=>Ti(r,t)):[]}function Ti(e,t){let r=[],n={},i=e.attributes||[];for(let o of i){let s=o.attribute;if(typeof s=="string")if(s.split("|").length>1){let a=s.split("|")[0];n[a]=n[a]||[],n[a].push(o),console.warn("ignoring tilestats indexed field",a)}else r[s]||r.push(bi(o,t))}return{name:e.layer||"",dominantGeometry:e.geometry,fields:r}}function Fi(e,t){return e.map(r=>{let n=t.find(s=>s.name===r.name),i=n?.fields||r.fields||[],o={...r,...n,fields:i};return o.schema=cr(o),o})}function fr(e){let t=mr(e);if(Array.isArray(t)&&t.length===4&&[t[0],t[2]].every(gr)&&[t[1],t[3]].every(pr))return[[t[0],t[1]],[t[2],t[3]]]}function Pi(e){let t=mr(e);return Array.isArray(t)&&t.length===3&&gr(t[0])&&pr(t[1])&&Ii(t[2])?t:null}function ur(e){let t=typeof e=="string"?parseFloat(e):typeof e=="number"?e:null;return t===null||isNaN(t)?null:t}function pr(e){return Number.isFinite(e)&&e<=90&&e>=-90}function gr(e){return Number.isFinite(e)&&e<=180&&e>=-180}function Ii(e){return Number.isFinite(e)&&e>=0&&e<=22}function mr(e){return typeof e=="string"?e.split(",").map(parseFloat):Array.isArray(e)?e:null}var hr={number:{type:"float32"},numeric:{type:"float32"},string:{type:"utf8"},vachar:{type:"utf8"},float:{type:"float32"},int:{type:"int32"},int4:{type:"int32"},boolean:{type:"boolean"},bool:{type:"boolean"}};function bi(e={},t){let r=yr(e.type),n={name:e.attribute,...r};return typeof e.min=="number"&&(n.min=e.min),typeof e.max=="number"&&(n.max=e.max),typeof e.count=="number"&&(n.uniqueValueCount=e.count),e.values&&(n.values=e.values),n.values&&typeof t.maxValues=="number"&&(n.values=n.values?.slice(0,t.maxValues)),n}function yr(e){let t=e.toLowerCase();return!t||hr[t],hr[t]||{type:"string"}}var Ei="4.3.0-alpha.8",de={dataType:null,batchType:null,name:"TileJSON",id:"tilejson",module:"pmtiles",version:Ei,worker:!0,extensions:["json"],mimeTypes:["application/json"],text:!0,options:{tilejson:{maxValues:void 0}},parse:async(e,t)=>{let r=new TextDecoder().decode(e),n=JSON.parse(r),i={...de.options.tilejson,...t?.tilejson};return st(n,i)},parseTextSync:(e,t)=>{let r=JSON.parse(e),n={...de.options.tilejson,...t?.tilejson};return st(r,n)}};var pe={x:0,y:1,z:2};function H(e,t={}){let{start:r=0,end:n=e.length,plane:i="xy"}=t,o=t.size||2,s=0,a=pe[i[0]],l=pe[i[1]];for(let c=r,f=n-o;c<n;c+=o)s+=(e[c+a]-e[f+a])*(e[c+l]+e[f+l]),f=c;return s/2}function lt(e,t,r=2,n,i="xy"){let o=t&&t.length,s=o?t[0]*r:e.length,a=wr(e,0,s,r,!0,n&&n[0],i),l=[];if(!a||a.next===a.prev)return l;let c,f,u,h,d,p,y;if(o&&(a=Mi(e,t,a,r,n,i)),e.length>80*r){h=f=e[0],d=u=e[1];for(let P=r;P<s;P+=r)p=e[P],y=e[P+1],p<h&&(h=p),y<d&&(d=y),p>f&&(f=p),y>u&&(u=y);c=Math.max(f-h,u-d),c=c!==0?32767/c:0}return ge(a,l,r,h,d,c,0),l}function wr(e,t,r,n,i,o,s){let a,l;o===void 0&&(o=H(e,{start:t,end:r,size:n,plane:s}));let c=pe[s[0]],f=pe[s[1]];if(i===o<0)for(a=t;a<r;a+=n)l=xr(a,e[a+c],e[a+f],l);else for(a=r-n;a>=t;a-=n)l=xr(a,e[a+c],e[a+f],l);return l&&Ce(l,l.next)&&(ye(l),l=l.next),l}function Z(e,t){if(!e)return e;t||(t=e);let r=e,n;do if(n=!1,!r.steiner&&(Ce(r,r.next)||T(r.prev,r,r.next)===0)){if(ye(r),r=t=r.prev,r===r.next)break;n=!0}else r=r.next;while(n||r!==t);return t}function ge(e,t,r,n,i,o,s){if(!e)return;!s&&o&&Ci(e,n,i,o);let a=e,l,c;for(;e.prev!==e.next;){if(l=e.prev,c=e.next,o?_i(e,n,i,o):Ai(e)){t.push(l.i/r|0),t.push(e.i/r|0),t.push(c.i/r|0),ye(e),e=c.next,a=c.next;continue}if(e=c,e===a){s?s===1?(e=Di(Z(e),t,r),ge(e,t,r,n,i,o,2)):s===2&&Li(e,t,r,n,i,o):ge(Z(e),t,r,n,i,o,1);break}}}function Ai(e){let t=e.prev,r=e,n=e.next;if(T(t,r,n)>=0)return!1;let i=t.x,o=r.x,s=n.x,a=t.y,l=r.y,c=n.y,f=i<o?i<s?i:s:o<s?o:s,u=a<l?a<c?a:c:l<c?l:c,h=i>o?i>s?i:s:o>s?o:s,d=a>l?a>c?a:c:l>c?l:c,p=n.next;for(;p!==t;){if(p.x>=f&&p.x<=h&&p.y>=u&&p.y<=d&&q(i,a,o,l,s,c,p.x,p.y)&&T(p.prev,p,p.next)>=0)return!1;p=p.next}return!0}function _i(e,t,r,n){let i=e.prev,o=e,s=e.next;if(T(i,o,s)>=0)return!1;let a=i.x,l=o.x,c=s.x,f=i.y,u=o.y,h=s.y,d=a<l?a<c?a:c:l<c?l:c,p=f<u?f<h?f:h:u<h?u:h,y=a>l?a>c?a:c:l>c?l:c,P=f>u?f>h?f:h:u>h?u:h,D=at(d,p,t,r,n),v=at(y,P,t,r,n),m=e.prevZ,g=e.nextZ;for(;m&&m.z>=D&&g&&g.z<=v;){if(m.x>=d&&m.x<=y&&m.y>=p&&m.y<=P&&m!==i&&m!==s&&q(a,f,l,u,c,h,m.x,m.y)&&T(m.prev,m,m.next)>=0||(m=m.prevZ,g.x>=d&&g.x<=y&&g.y>=p&&g.y<=P&&g!==i&&g!==s&&q(a,f,l,u,c,h,g.x,g.y)&&T(g.prev,g,g.next)>=0))return!1;g=g.nextZ}for(;m&&m.z>=D;){if(m.x>=d&&m.x<=y&&m.y>=p&&m.y<=P&&m!==i&&m!==s&&q(a,f,l,u,c,h,m.x,m.y)&&T(m.prev,m,m.next)>=0)return!1;m=m.prevZ}for(;g&&g.z<=v;){if(g.x>=d&&g.x<=y&&g.y>=p&&g.y<=P&&g!==i&&g!==s&&q(a,f,l,u,c,h,g.x,g.y)&&T(g.prev,g,g.next)>=0)return!1;g=g.nextZ}return!0}function Di(e,t,r){let n=e;do{let i=n.prev,o=n.next.next;!Ce(i,o)&&vr(i,n,n.next,o)&&me(i,o)&&me(o,i)&&(t.push(i.i/r|0),t.push(n.i/r|0),t.push(o.i/r|0),ye(n),ye(n.next),n=e=o),n=n.next}while(n!==e);return Z(n)}function Li(e,t,r,n,i,o){let s=e;do{let a=s.next.next;for(;a!==s.prev;){if(s.i!==a.i&&Gi(s,a)){let l=Tr(s,a);s=Z(s,s.next),l=Z(l,l.next),ge(s,t,r,n,i,o,0),ge(l,t,r,n,i,o,0);return}a=a.next}s=s.next}while(s!==e)}function Mi(e,t,r,n,i,o){let s=[],a,l,c,f,u;for(a=0,l=t.length;a<l;a++)c=t[a]*n,f=a<l-1?t[a+1]*n:e.length,u=wr(e,c,f,n,!1,i&&i[a+1],o),u===u.next&&(u.steiner=!0),s.push(zi(u));for(s.sort(Vi),a=0;a<s.length;a++)r=Ui(s[a],r);return r}function Vi(e,t){return e.x-t.x}function Ui(e,t){let r=ki(e,t);if(!r)return t;let n=Tr(r,e);return Z(n,n.next),Z(r,r.next)}function ki(e,t){let r=t,n=e.x,i=e.y,o=-1/0,s;do{if(i<=r.y&&i>=r.next.y&&r.next.y!==r.y){let h=r.x+(i-r.y)*(r.next.x-r.x)/(r.next.y-r.y);if(h<=n&&h>o&&(o=h,s=r.x<r.next.x?r:r.next,h===n))return s}r=r.next}while(r!==t);if(!s)return null;let a=s,l=s.x,c=s.y,f=1/0,u;r=s;do n>=r.x&&r.x>=l&&n!==r.x&&q(i<c?n:o,i,l,c,i<c?o:n,i,r.x,r.y)&&(u=Math.abs(i-r.y)/(n-r.x),me(r,e)&&(u<f||u===f&&(r.x>s.x||r.x===s.x&&Ni(s,r)))&&(s=r,f=u)),r=r.next;while(r!==a);return s}function Ni(e,t){return T(e.prev,e,t.prev)<0&&T(t.next,e,e.next)<0}function Ci(e,t,r,n){let i=e;do i.z===0&&(i.z=at(i.x,i.y,t,r,n)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next;while(i!==e);i.prevZ.nextZ=null,i.prevZ=null,Oi(i)}function Oi(e){let t,r,n=1,i,o,s,a,l,c;do{for(o=e,e=null,c=null,i=0;o;){for(i++,a=o,s=0,r=0;r<n&&(s++,a=a.nextZ,!!a);r++);for(l=n;s>0||l>0&&a;)s!==0&&(l===0||!a||o.z<=a.z)?(t=o,o=o.nextZ,s--):(t=a,a=a.nextZ,l--),c?c.nextZ=t:e=t,t.prevZ=c,c=t;o=a}c.nextZ=null,n*=2}while(i>1);return e}function at(e,t,r,n,i){return e=(e-r)*i|0,t=(t-n)*i|0,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,e|t<<1}function zi(e){let t=e,r=e;do(t.x<r.x||t.x===r.x&&t.y<r.y)&&(r=t),t=t.next;while(t!==e);return r}function q(e,t,r,n,i,o,s,a){return(i-s)*(t-a)>=(e-s)*(o-a)&&(e-s)*(n-a)>=(r-s)*(t-a)&&(r-s)*(o-a)>=(i-s)*(n-a)}function Gi(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!ji(e,t)&&(me(e,t)&&me(t,e)&&Ri(e,t)&&(T(e.prev,e,t.prev)||T(e,t.prev,t))||Ce(e,t)&&T(e.prev,e,e.next)>0&&T(t.prev,t,t.next)>0)}function T(e,t,r){return(t.y-e.y)*(r.x-t.x)-(t.x-e.x)*(r.y-t.y)}function Ce(e,t){return e.x===t.x&&e.y===t.y}function vr(e,t,r,n){let i=Ne(T(e,t,r)),o=Ne(T(e,t,n)),s=Ne(T(r,n,e)),a=Ne(T(r,n,t));return!!(i!==o&&s!==a||i===0&&ke(e,r,t)||o===0&&ke(e,n,t)||s===0&&ke(r,e,n)||a===0&&ke(r,t,n))}function ke(e,t,r){return t.x<=Math.max(e.x,r.x)&&t.x>=Math.min(e.x,r.x)&&t.y<=Math.max(e.y,r.y)&&t.y>=Math.min(e.y,r.y)}function Ne(e){return e>0?1:e<0?-1:0}function ji(e,t){let r=e;do{if(r.i!==e.i&&r.next.i!==e.i&&r.i!==t.i&&r.next.i!==t.i&&vr(r,r.next,e,t))return!0;r=r.next}while(r!==e);return!1}function me(e,t){return T(e.prev,e,e.next)<0?T(e,t,e.next)>=0&&T(e,e.prev,t)>=0:T(e,t,e.prev)<0||T(e,e.next,t)<0}function Ri(e,t){let r=e,n=!1,i=(e.x+t.x)/2,o=(e.y+t.y)/2;do r.y>o!=r.next.y>o&&r.next.y!==r.y&&i<(r.next.x-r.x)*(o-r.y)/(r.next.y-r.y)+r.x&&(n=!n),r=r.next;while(r!==e);return n}function Tr(e,t){let r=new xe(e.i,e.x,e.y),n=new xe(t.i,t.x,t.y),i=e.next,o=t.prev;return e.next=t,t.prev=e,r.next=i,i.prev=r,n.next=r,r.prev=n,o.next=n,n.prev=o,n}function xr(e,t,r,n){let i=new xe(e,t,r);return n?(i.next=n.next,i.prev=n,n.next.prev=i,n.next=i):(i.prev=i,i.next=i),i}function ye(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ)}var xe=class{constructor(t,r,n){this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1,this.i=t,this.x=r,this.y=n}};function ut(e,t,r){let n=Wi(e),i=Object.keys(n).filter(o=>n[o]!==Array);return Ki(e,{propArrayTypes:n,...t},{numericPropKeys:r&&r.numericPropKeys||i,PositionDataType:r?r.PositionDataType:Float32Array,triangulate:r?r.triangulate:!0})}function Wi(e){let t={};for(let r of e)if(r.properties)for(let n in r.properties){let i=r.properties[n];t[n]=to(i,t[n])}return t}function Ki(e,t,r){let{pointPositionsCount:n,pointFeaturesCount:i,linePositionsCount:o,linePathsCount:s,lineFeaturesCount:a,polygonPositionsCount:l,polygonObjectsCount:c,polygonRingsCount:f,polygonFeaturesCount:u,propArrayTypes:h,coordLength:d}=t,{numericPropKeys:p=[],PositionDataType:y=Float32Array,triangulate:P=!0}=r,D=e[0]&&"id"in e[0],v=e.length>65535?Uint32Array:Uint16Array,m={type:"Point",positions:new y(n*d),globalFeatureIds:new v(n),featureIds:i>65535?new Uint32Array(n):new Uint16Array(n),numericProps:{},properties:[],fields:[]},g={type:"LineString",pathIndices:o>65535?new Uint32Array(s+1):new Uint16Array(s+1),positions:new y(o*d),globalFeatureIds:new v(o),featureIds:a>65535?new Uint32Array(o):new Uint16Array(o),numericProps:{},properties:[],fields:[]},S={type:"Polygon",polygonIndices:l>65535?new Uint32Array(c+1):new Uint16Array(c+1),primitivePolygonIndices:l>65535?new Uint32Array(f+1):new Uint16Array(f+1),positions:new y(l*d),globalFeatureIds:new v(l),featureIds:u>65535?new Uint32Array(l):new Uint16Array(l),numericProps:{},properties:[],fields:[]};P&&(S.triangles=[]);for(let M of[m,g,S])for(let I of p){let B=h[I];M.numericProps[I]=new B(M.positions.length/d)}g.pathIndices[s]=o,S.polygonIndices[c]=l,S.primitivePolygonIndices[f]=l;let k={pointPosition:0,pointFeature:0,linePosition:0,linePath:0,lineFeature:0,polygonPosition:0,polygonObject:0,polygonRing:0,polygonFeature:0,feature:0};for(let M of e){let I=M.geometry,B=M.properties||{};switch(I.type){case"Point":Yi(I,m,k,d,B),m.properties.push(ft(B,p)),D&&m.fields.push({id:M.id}),k.pointFeature++;break;case"LineString":Xi(I,g,k,d,B),g.properties.push(ft(B,p)),D&&g.fields.push({id:M.id}),k.lineFeature++;break;case"Polygon":Qi(I,S,k,d,B),S.properties.push(ft(B,p)),D&&S.fields.push({id:M.id}),k.polygonFeature++;break;default:throw new Error("Invalid geometry type")}k.feature++}return eo(m,g,S,d)}function Yi(e,t,r,n,i){t.positions.set(e.data,r.pointPosition*n);let o=e.data.length/n;ht(t,i,r.pointPosition,o),t.globalFeatureIds.fill(r.feature,r.pointPosition,r.pointPosition+o),t.featureIds.fill(r.pointFeature,r.pointPosition,r.pointPosition+o),r.pointPosition+=o}function Xi(e,t,r,n,i){t.positions.set(e.data,r.linePosition*n);let o=e.data.length/n;ht(t,i,r.linePosition,o),t.globalFeatureIds.fill(r.feature,r.linePosition,r.linePosition+o),t.featureIds.fill(r.lineFeature,r.linePosition,r.linePosition+o);for(let s=0,a=e.indices.length;s<a;++s){let l=e.indices[s],c=s===a-1?e.data.length:e.indices[s+1];t.pathIndices[r.linePath++]=r.linePosition,r.linePosition+=(c-l)/n}}function Qi(e,t,r,n,i){t.positions.set(e.data,r.polygonPosition*n);let o=e.data.length/n;ht(t,i,r.polygonPosition,o),t.globalFeatureIds.fill(r.feature,r.polygonPosition,r.polygonPosition+o),t.featureIds.fill(r.polygonFeature,r.polygonPosition,r.polygonPosition+o);for(let s=0,a=e.indices.length;s<a;++s){let l=r.polygonPosition;t.polygonIndices[r.polygonObject++]=l;let c=e.areas[s],f=e.indices[s],u=e.indices[s+1];for(let d=0,p=f.length;d<p;++d){let y=f[d],P=d===p-1?u===void 0?e.data.length:u[0]:f[d+1];t.primitivePolygonIndices[r.polygonRing++]=r.polygonPosition,r.polygonPosition+=(P-y)/n}let h=r.polygonPosition;qi(t,c,f,{startPosition:l,endPosition:h,coordLength:n})}}function qi(e,t,r,{startPosition:n,endPosition:i,coordLength:o}){if(!e.triangles)return;let s=n*o,a=i*o,l=e.positions.subarray(s,a),c=r[0],f=r.slice(1).map(h=>(h-c)/o),u=lt(l,f,o,t);for(let h=0,d=u.length;h<d;++h)e.triangles.push(n+u[h])}function ct(e,t){let r={};for(let n in e)r[n]={value:e[n],size:t};return r}function eo(e,t,r,n){let i={shape:"binary-feature-collection",points:{...e,positions:{value:e.positions,size:n},globalFeatureIds:{value:e.globalFeatureIds,size:1},featureIds:{value:e.featureIds,size:1},numericProps:ct(e.numericProps,1)},lines:{...t,positions:{value:t.positions,size:n},pathIndices:{value:t.pathIndices,size:1},globalFeatureIds:{value:t.globalFeatureIds,size:1},featureIds:{value:t.featureIds,size:1},numericProps:ct(t.numericProps,1)},polygons:{...r,positions:{value:r.positions,size:n},polygonIndices:{value:r.polygonIndices,size:1},primitivePolygonIndices:{value:r.primitivePolygonIndices,size:1},globalFeatureIds:{value:r.globalFeatureIds,size:1},featureIds:{value:r.featureIds,size:1},numericProps:ct(r.numericProps,1)}};return i.polygons&&r.triangles&&(i.polygons.triangles={value:new Uint32Array(r.triangles),size:1}),i}function ht(e,t,r,n){for(let i in e.numericProps)if(i in t){let o=t[i];e.numericProps[i].fill(o,r,r+n)}}function ft(e,t){let r={};for(let n in e)t.includes(n)||(r[n]=e[n]);return r}function to(e,t){return t===Array||!Number.isFinite(e)?Array:t===Float64Array||Math.fround(e)!==e?Float64Array:Float32Array}var xt=Nt(_r(),1);function vo(e){let t=0;for(let r=0,n=e.length-1,i,o;r<e.length;n=r++)i=e[r],o=e[n],t+=(o[0]-i[0])*(i[1]+o[1]);return t}function gt(e,t){if(Array.isArray(e[0])){for(let n of e)gt(n,t);return}let r=e;r[0]/=t,r[1]/=t}function Dr(e,t){for(let r=0;r<e.length;++r)e[r]/=t}function mt(e,t,r){if(typeof e[0][0]!="number"){for(let s of e)mt(s,t,r);return}let n=r*Math.pow(2,t.z),i=r*t.x,o=r*t.y;for(let s=0;s<e.length;s++){let a=e[s];a[0]=(a[0]+i)*360/n-180;let l=180-(a[1]+o)*360/n;a[1]=360/Math.PI*Math.atan(Math.exp(l*Math.PI/180))-90}}function Lr(e,t,r){let{x:n,y:i,z:o}=t,s=r*Math.pow(2,o),a=r*n,l=r*i;for(let c=0,f=e.length;c<f;c+=2){e[c]=(e[c]+a)*360/s-180;let u=180-(e[c+1]+l)*360/s;e[c+1]=360/Math.PI*Math.atan(Math.exp(u*Math.PI/180))-90}}function Mr(e){let t=e.length;if(t<=1)return[e];let r=[],n,i;for(let o=0;o<t;o++){let s=vo(e[o]);s!==0&&(i===void 0&&(i=s<0),i===s<0?(n&&r.push(n),n=[e[o]]):n&&n.push(e[o]))}return n&&r.push(n),r}function Vr(e){let t=e.indices.length,r="Polygon";if(t<=1)return{type:r,data:e.data,areas:[[H(e.data)]],indices:[e.indices]};let n=[],i=[],o=[],s=[],a,l=0;for(let c,f=0,u;f<t;f++){u=e.indices[f]-l,c=e.indices[f+1]-l||e.data.length;let h=e.data.slice(u,c),d=H(h);if(d===0){let p=e.data.slice(0,u),y=e.data.slice(c);e.data=p.concat(y),l+=c-u;continue}a===void 0&&(a=d<0),a===d<0?(s.length&&(n.push(o),i.push(s)),s=[u],o=[d]):(o.push(d),s.push(u))}return o&&n.push(o),s.length&&i.push(s),{type:r,areas:n,indices:i,data:e.data}}var $=class{properties;extent;type;id;_pbf;_geometry;_keys;_values;_geometryInfo;constructor(t,r,n,i,o,s){this.properties={},this.extent=n,this.type=0,this.id=null,this._pbf=t,this._geometry=-1,this._keys=i,this._values=o,this._geometryInfo=s,t.readFields(To,this,r)}toGeoJSONFeature(t,r){let n=this.loadGeometry();switch(t){case"wgs84":return Ur(this,n,i=>mt(i,r,this.extent));default:return Ur(this,n,gt)}}toBinaryFeature(t,r){let n=this.loadFlatGeometry();switch(t){case"wgs84":return this._toBinaryCoordinates(n,i=>Lr(i,r,this.extent));default:return this._toBinaryCoordinates(n,Dr)}}bbox(){let t=this._pbf;t.pos=this._geometry;let r=t.readVarint()+t.pos,n=1,i=0,o=0,s=0,a=1/0,l=-1/0,c=1/0,f=-1/0;for(;t.pos<r;){if(i<=0){let u=t.readVarint();n=u&7,i=u>>3}if(i--,n===1||n===2)o+=t.readSVarint(),s+=t.readSVarint(),o<a&&(a=o),o>l&&(l=o),s<c&&(c=s),s>f&&(f=s);else if(n!==7)throw new Error(`unknown command ${n}`)}return[a,c,l,f]}_toBinaryCoordinates(t,r){let n;r(t.data,this.extent);let i=2;switch(this.type){case 1:this._geometryInfo.pointFeaturesCount++,this._geometryInfo.pointPositionsCount+=t.indices.length,n={type:"Point",...t};break;case 2:this._geometryInfo.lineFeaturesCount++,this._geometryInfo.linePathsCount+=t.indices.length,this._geometryInfo.linePositionsCount+=t.data.length/i,n={type:"LineString",...t};break;case 3:n=Vr(t),this._geometryInfo.polygonFeaturesCount++,this._geometryInfo.polygonObjectsCount+=n.indices.length;for(let s of n.indices)this._geometryInfo.polygonRingsCount+=s.length;this._geometryInfo.polygonPositionsCount+=n.data.length/i;break;default:throw new Error(`Invalid geometry type: ${this.type}`)}let o={type:"Feature",geometry:n,properties:this.properties};return this.id!==null&&(o.id=this.id),o}loadGeometry(){let t=this._pbf;t.pos=this._geometry;let r=t.readVarint()+t.pos,n=1,i=0,o=0,s=0,a=[],l;for(;t.pos<r;){if(i<=0){let c=t.readVarint();n=c&7,i=c>>3}switch(i--,n){case 1:case 2:o+=t.readSVarint(),s+=t.readSVarint(),n===1&&(l&&a.push(l),l=[]),l&&l.push([o,s]);break;case 7:l&&l.push(l[0].slice());break;default:throw new Error(`unknown command ${n}`)}}return l&&a.push(l),a}loadFlatGeometry(){let t=this._pbf;t.pos=this._geometry;let r=t.readVarint()+t.pos,n=1,i,o=0,s=0,a=0,l=0,c=[],f=[];for(;t.pos<r;)if(o<=0&&(i=t.readVarint(),n=i&7,o=i>>3),o--,n===1||n===2)s+=t.readSVarint(),a+=t.readSVarint(),n===1&&c.push(l),f.push(s,a),l+=2;else if(n===7){if(l>0){let u=c[c.length-1];f.push(f[u],f[u+1]),l+=2}}else throw new Error(`unknown command ${n}`);return{data:f,indices:c}}};Ct($,"types",["Unknown","Point","LineString","Polygon"]);function Ur(e,t,r){let n=$.types[e.type],i,o,s;switch(e.type){case 1:let l=[];for(i=0;i<t.length;i++)l[i]=t[i][0];s=l,r(s,e.extent);break;case 2:for(s=t,i=0;i<s.length;i++)r(s[i],e.extent);break;case 3:for(s=Mr(t),i=0;i<s.length;i++)for(o=0;o<s[i].length;o++)r(s[i][o],e.extent);break;default:throw new Error("illegal vector tile type")}s.length===1?s=s[0]:n=`Multi${n}`;let a={type:"Feature",geometry:{type:n,coordinates:s},properties:e.properties};return e.id!==null&&(a.properties||={},a.properties.id=e.id),a}function To(e,t,r){t&&r&&(e===1?t.id=r.readVarint():e===2?Fo(r,t):e===3?t.type=r.readVarint():e===4&&(t._geometry=r.pos))}function Fo(e,t){let r=e.readVarint()+e.pos;for(;e.pos<r;){let n=t._keys[e.readVarint()],i=t._values[e.readVarint()];t.properties[n]=i}}var Ge=class{version;name;extent;length;_pbf;_keys;_values;_features;constructor(t,r){this.version=1,this.name="",this.extent=4096,this.length=0,this._pbf=t,this._keys=[],this._values=[],this._features=[],t.readFields(Po,this,r),this.length=this._features.length}getGeoJSONFeature(t){if(t<0||t>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[t];let r=this._pbf.readVarint()+this._pbf.pos;return new $(this._pbf,r,this.extent,this._keys,this._values)}getBinaryFeature(t,r){if(t<0||t>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[t];let n=this._pbf.readVarint()+this._pbf.pos;return new $(this._pbf,n,this.extent,this._keys,this._values,r)}};function Po(e,t,r){t&&r&&(e===15?t.version=r.readVarint():e===1?t.name=r.readString():e===5?t.extent=r.readVarint():e===2?t._features.push(r.pos):e===3?t._keys.push(r.readString()):e===4&&t._values.push(Io(r)))}function Io(e){let t=null,r=e.readVarint()+e.pos;for(;e.pos<r;){let n=e.readVarint()>>3;t=n===1?e.readString():n===2?e.readFloat():n===3?e.readDouble():n===4?e.readVarint64():n===5?e.readVarint():n===6?e.readSVarint():n===7?e.readBoolean():null}return t}var we=class{layers;constructor(t,r){this.layers=t.readFields(bo,{},r)}};function bo(e,t,r){if(e===3&&r){let n=new Ge(r,r.readVarint()+r.pos);n.length&&t&&(t[n.name]=n)}}function wt(e,t){let r=So(t),n=t?.gis?.format||t?.mvt?.shape||t?.shape;switch(n){case"columnar-table":return{shape:"columnar-table",data:yt(e,r)};case"geojson-table":return{shape:"geojson-table",type:"FeatureCollection",features:kr(e,r)};case"geojson":return kr(e,r);case"binary-geometry":return yt(e,r);case"binary":return yt(e,r);default:throw new Error(n||"undefined shape")}}function yt(e,t){let[r,n]=Eo(e,t),i=ut(r,n);return i.byteLength=e.byteLength,i}function Eo(e,t){let r=[],n={coordLength:2,pointPositionsCount:0,pointFeaturesCount:0,linePositionsCount:0,linePathsCount:0,lineFeaturesCount:0,polygonPositionsCount:0,polygonObjectsCount:0,polygonRingsCount:0,polygonFeaturesCount:0};if(e.byteLength<=0)return[r,n];let i=new we(new xt.default(e));return(t&&Array.isArray(t.layers)?t.layers:Object.keys(i.layers)).forEach(s=>{let a=i.layers[s];if(a)for(let l=0;l<a.length;l++){let c=a.getBinaryFeature(l,n),f=Ao(c,t,s);r.push(f)}}),[r,n]}function kr(e,t){if(e.byteLength<=0)return[];let r=[],n=new we(new xt.default(e));return(Array.isArray(t.layers)?t.layers:Object.keys(n.layers)).forEach(o=>{let s=n.layers[o];if(s)for(let a=0;a<s.length;a++){let l=s.getGeoJSONFeature(a),c=Bo(l,t,o);r.push(c)}}),r}function So(e){if(!e?.mvt)throw new Error("mvt options required");if(e.mvt?.coordinates==="wgs84"&&!e.mvt.tileIndex)throw new Error("MVT Loader: WGS84 coordinates need tileIndex property");return e.gis&&qe.warn('MVTLoader: "options.gis" is deprecated, use "options.mvt.shape" instead')(),e.mvt}function Bo(e,t,r){let n=e.toGeoJSONFeature(t.coordinates||"local",t.tileIndex);return t.layerProperty&&(n.properties||={},n.properties[t.layerProperty]=r),n}function Ao(e,t,r){let n=e.toBinaryFeature(t.coordinates||"local",t.tileIndex);return t.layerProperty&&n.properties&&(n.properties[t.layerProperty]=r),n}var _o="4.3.0-alpha.8",Nr={dataType:null,batchType:null,name:"Mapbox Vector Tile",id:"mvt",module:"mvt",version:_o,extensions:["mvt","pbf"],mimeTypes:["application/vnd.mapbox-vector-tile","application/x-protobuf"],worker:!0,category:"geometry",options:{mvt:{shape:"geojson",coordinates:"local",layerProperty:"layerName",layers:void 0,tileIndex:void 0}}},vt={...Nr,parse:async(e,t)=>wt(e,t),parseSync:wt,binary:!0};var Pe={};kt(Pe,{Compression:()=>en,EtagMismatch:()=>Re,FetchSource:()=>on,FileSource:()=>fs,PMTiles:()=>bt,Protocol:()=>is,ResolvedValueCache:()=>hs,SharedPromiseCache:()=>fn,TileType:()=>tn,bytesToHeader:()=>sn,findTile:()=>nn,getUint64:()=>_,leafletRasterLayer:()=>rs,readVarint:()=>ne,tileIdToZxy:()=>ls,tileTypeExt:()=>rn,zxyToTileId:()=>qr});var J=Math.pow,F=(e,t,r)=>new Promise((n,i)=>{var o=l=>{try{a(r.next(l))}catch(c){i(c)}},s=l=>{try{a(r.throw(l))}catch(c){i(c)}},a=l=>l.done?n(l.value):Promise.resolve(l.value).then(o,s);a((r=r.apply(e,t)).next())}),E=Uint8Array,ie=Uint16Array,Do=Int32Array,zr=new E([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),Gr=new E([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),Lo=new E([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),jr=function(e,t){for(var r=new ie(31),n=0;n<31;++n)r[n]=t+=1<<e[n-1];for(var i=new Do(r[30]),n=1;n<30;++n)for(var o=r[n];o<r[n+1];++o)i[o]=o-r[n]<<5|n;return{b:r,r:i}},Rr=jr(zr,2),Hr=Rr.b,Mo=Rr.r;Hr[28]=258,Mo[258]=28;var Zr=jr(Gr,0),Vo=Zr.b,Jl=Zr.r,Pt=new ie(32768);for(w=0;w<32768;++w)z=(w&43690)>>1|(w&21845)<<1,z=(z&52428)>>2|(z&13107)<<2,z=(z&61680)>>4|(z&3855)<<4,Pt[w]=((z&65280)>>8|(z&255)<<8)>>1;var z,w,Te=function(e,t,r){for(var n=e.length,i=0,o=new ie(t);i<n;++i)e[i]&&++o[e[i]-1];var s=new ie(t);for(i=1;i<t;++i)s[i]=s[i-1]+o[i-1]<<1;var a;if(r){a=new ie(1<<t);var l=15-t;for(i=0;i<n;++i)if(e[i])for(var c=i<<4|e[i],f=t-e[i],u=s[e[i]-1]++<<f,h=u|(1<<f)-1;u<=h;++u)a[Pt[u]>>l]=c}else for(a=new ie(n),i=0;i<n;++i)e[i]&&(a[i]=Pt[s[e[i]-1]++]>>15-e[i]);return a},Fe=new E(288);for(w=0;w<144;++w)Fe[w]=8;var w;for(w=144;w<256;++w)Fe[w]=9;var w;for(w=256;w<280;++w)Fe[w]=7;var w;for(w=280;w<288;++w)Fe[w]=8;var w,$r=new E(32);for(w=0;w<32;++w)$r[w]=5;var w,Uo=Te(Fe,9,1),ko=Te($r,5,1),Tt=function(e){for(var t=e[0],r=1;r<e.length;++r)e[r]>t&&(t=e[r]);return t},U=function(e,t,r){var n=t/8|0;return(e[n]|e[n+1]<<8)>>(t&7)&r},Ft=function(e,t){var r=t/8|0;return(e[r]|e[r+1]<<8|e[r+2]<<16)>>(t&7)},No=function(e){return(e+7)/8|0},Co=function(e,t,r){(t==null||t<0)&&(t=0),(r==null||r>e.length)&&(r=e.length);var n=new E(r-t);return n.set(e.subarray(t,r)),n},Oo=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],b=function(e,t,r){var n=new Error(t||Oo[e]);if(n.code=e,Error.captureStackTrace&&Error.captureStackTrace(n,b),!r)throw n;return n},Et=function(e,t,r,n){var i=e.length,o=n?n.length:0;if(!i||t.f&&!t.l)return r||new E(0);var s=!r||t.i!=2,a=t.i;r||(r=new E(i*3));var l=function(Mt){var Vt=r.length;if(Mt>Vt){var Ut=new E(Math.max(Vt*2,Mt));Ut.set(r),r=Ut}},c=t.f||0,f=t.p||0,u=t.b||0,h=t.l,d=t.d,p=t.m,y=t.n,P=i*8;do{if(!h){c=U(e,f,1);var D=U(e,f+1,3);if(f+=3,D)if(D==1)h=Uo,d=ko,p=9,y=5;else if(D==2){var S=U(e,f,31)+257,k=U(e,f+10,15)+4,M=S+U(e,f+5,31)+1;f+=14;for(var I=new E(M),B=new E(19),A=0;A<k;++A)B[Lo[A]]=U(e,f+A*3,7);f+=k*3;for(var Bt=Tt(B),mn=(1<<Bt)-1,yn=Te(B,Bt,1),A=0;A<M;){var At=yn[U(e,f,mn)];f+=At&15;var v=At>>4;if(v<16)I[A++]=v;else{var K=0,Ee=0;for(v==16?(Ee=3+U(e,f,3),f+=2,K=I[A-1]):v==17?(Ee=3+U(e,f,7),f+=3):v==18&&(Ee=11+U(e,f,127),f+=7);Ee--;)I[A++]=K}}var _t=I.subarray(0,S),V=I.subarray(S);p=Tt(_t),y=Tt(V),h=Te(_t,p,1),d=Te(V,y,1)}else b(1);else{var v=No(f)+4,m=e[v-4]|e[v-3]<<8,g=v+m;if(g>i){a&&b(0);break}s&&l(u+m),r.set(e.subarray(v,g),u),t.b=u+=m,t.p=f=g*8,t.f=c;continue}if(f>P){a&&b(0);break}}s&&l(u+131072);for(var xn=(1<<p)-1,wn=(1<<y)-1,Ze=f;;Ze=f){var K=h[Ft(e,f)&xn],Y=K>>4;if(f+=K&15,f>P){a&&b(0);break}if(K||b(2),Y<256)r[u++]=Y;else if(Y==256){Ze=f,h=null;break}else{var Dt=Y-254;if(Y>264){var A=Y-257,oe=zr[A];Dt=U(e,f,(1<<oe)-1)+Hr[A],f+=oe}var $e=d[Ft(e,f)&wn],Je=$e>>4;$e||b(3),f+=$e&15;var V=Vo[Je];if(Je>3){var oe=Gr[Je];V+=Ft(e,f)&(1<<oe)-1,f+=oe}if(f>P){a&&b(0);break}s&&l(u+131072);var We=u+Dt;if(u<V){var Lt=o-V,vn=Math.min(V,We);for(Lt+u<0&&b(3);u<vn;++u)r[u]=n[Lt+u]}for(;u<We;u+=4)r[u]=r[u-V],r[u+1]=r[u+1-V],r[u+2]=r[u+2-V],r[u+3]=r[u+3-V];u=We}}t.l=h,t.p=Ze,t.b=u,t.f=c,h&&(c=1,t.m=p,t.d=d,t.n=y)}while(!c);return u==r.length?r:Co(r,0,u)},zo=new E(0),Go=function(e){(e[0]!=31||e[1]!=139||e[2]!=8)&&b(6,"invalid gzip data");var t=e[3],r=10;t&4&&(r+=(e[10]|e[11]<<8)+2);for(var n=(t>>3&1)+(t>>4&1);n>0;n-=!e[r++]);return r+(t&2)},jo=function(e){var t=e.length;return(e[t-4]|e[t-3]<<8|e[t-2]<<16|e[t-1]<<24)>>>0},Ro=function(e,t){return((e[0]&15)!=8||e[0]>>4>7||(e[0]<<8|e[1])%31)&&b(6,"invalid zlib data"),(e[1]>>5&1)==+!t&&b(6,"invalid zlib data: "+(e[1]&32?"need":"unexpected")+" dictionary"),(e[1]>>3&4)+2};function Ho(e,t){return Et(e,{i:2},t&&t.out,t&&t.dictionary)}function Zo(e,t){var r=Go(e);return r+8>e.length&&b(6,"invalid gzip data"),Et(e.subarray(r,-8),{i:2},t&&t.out||new E(jo(e)),t&&t.dictionary)}function $o(e,t){return Et(e.subarray(Ro(e,t&&t.dictionary),-4),{i:2},t&&t.out,t&&t.dictionary)}function It(e,t){return e[0]==31&&e[1]==139&&e[2]==8?Zo(e,t):(e[0]&15)!=8||e[0]>>4>7||(e[0]<<8|e[1])%31?Ho(e,t):$o(e,t)}var Jo=typeof TextDecoder<"u"&&new TextDecoder,Wo=0;try{Jo.decode(zo,{stream:!0}),Wo=1}catch{}var Jr=(e,t)=>e*J(2,t),ve=(e,t)=>Math.floor(e/J(2,t)),je=(e,t)=>Jr(e.getUint16(t+1,!0),8)+e.getUint8(t),Wr=(e,t)=>Jr(e.getUint32(t+2,!0),16)+e.getUint16(t,!0),Ko=(e,t,r,n,i)=>{if(e!==n.getUint8(i))return e-n.getUint8(i);let o=je(n,i+1);if(t!==o)return t-o;let s=je(n,i+4);return r!==s?r-s:0},Yo=(e,t,r,n)=>{let i=Kr(e,t|128,r,n);return i?{z:t,x:r,y:n,offset:i[0],length:i[1],isDir:!0}:null},Cr=(e,t,r,n)=>{let i=Kr(e,t,r,n);return i?{z:t,x:r,y:n,offset:i[0],length:i[1],isDir:!1}:null},Kr=(e,t,r,n)=>{let i=0,o=e.byteLength/17-1;for(;i<=o;){let s=o+i>>1,a=Ko(t,r,n,e,s*17);if(a>0)i=s+1;else if(a<0)o=s-1;else return[Wr(e,s*17+7),e.getUint32(s*17+13,!0)]}return null},Xo=(e,t)=>e.isDir&&!t.isDir?1:!e.isDir&&t.isDir?-1:e.z!==t.z?e.z-t.z:e.x!==t.x?e.x-t.x:e.y-t.y,Yr=(e,t)=>{let r=e.getUint8(t*17);return{z:r&127,x:je(e,t*17+1),y:je(e,t*17+4),offset:Wr(e,t*17+7),length:e.getUint32(t*17+13,!0),isDir:r>>7===1}},Or=e=>{let t=[],r=new DataView(e);for(let n=0;n<r.byteLength/17;n++)t.push(Yr(r,n));return Qo(t)},Qo=e=>{e.sort(Xo);let t=new ArrayBuffer(17*e.length),r=new Uint8Array(t);for(let n=0;n<e.length;n++){let i=e[n],o=i.z;i.isDir&&(o=o|128),r[n*17]=o,r[n*17+1]=i.x&255,r[n*17+2]=i.x>>8&255,r[n*17+3]=i.x>>16&255,r[n*17+4]=i.y&255,r[n*17+5]=i.y>>8&255,r[n*17+6]=i.y>>16&255,r[n*17+7]=i.offset&255,r[n*17+8]=ve(i.offset,8)&255,r[n*17+9]=ve(i.offset,16)&255,r[n*17+10]=ve(i.offset,24)&255,r[n*17+11]=ve(i.offset,32)&255,r[n*17+12]=ve(i.offset,48)&255,r[n*17+13]=i.length&255,r[n*17+14]=i.length>>8&255,r[n*17+15]=i.length>>16&255,r[n*17+16]=i.length>>24&255}return t},qo=(e,t)=>{if(e.byteLength<17)return null;let r=e.byteLength/17,n=Yr(e,r-1);if(n.isDir){let i=n.z,o=t.z-i,s=Math.trunc(t.x/(1<<o)),a=Math.trunc(t.y/(1<<o));return{z:i,x:s,y:a}}return null};function es(e){return F(this,null,function*(){let t=yield e.getBytes(0,512e3),r=new DataView(t.data),n=r.getUint32(4,!0),i=r.getUint16(8,!0),o=new TextDecoder("utf-8"),s=JSON.parse(o.decode(new DataView(t.data,10,n))),a=0;s.compression==="gzip"&&(a=2);let l=0;"minzoom"in s&&(l=+s.minzoom);let c=0;"maxzoom"in s&&(c=+s.maxzoom);let f=0,u=0,h=0,d=-180,p=-85,y=180,P=85;if(s.bounds){let v=s.bounds.split(",");d=+v[0],p=+v[1],y=+v[2],P=+v[3]}if(s.center){let v=s.center.split(",");f=+v[0],u=+v[1],h=+v[2]}return{specVersion:r.getUint16(2,!0),rootDirectoryOffset:10+n,rootDirectoryLength:i*17,jsonMetadataOffset:10,jsonMetadataLength:n,leafDirectoryOffset:0,leafDirectoryLength:void 0,tileDataOffset:0,tileDataLength:void 0,numAddressedTiles:0,numTileEntries:0,numTileContents:0,clustered:!1,internalCompression:1,tileCompression:a,tileType:1,minZoom:l,maxZoom:c,minLon:d,minLat:p,maxLon:y,maxLat:P,centerZoom:h,centerLon:f,centerLat:u,etag:t.etag}})}function ts(e,t,r,n,i,o,s){return F(this,null,function*(){let a=yield r.getArrayBuffer(t,e.rootDirectoryOffset,e.rootDirectoryLength,e);e.specVersion===1&&(a=Or(a));let l=Cr(new DataView(a),n,i,o);if(l){let u=(yield t.getBytes(l.offset,l.length,s)).data,h=new DataView(u);return h.getUint8(0)===31&&h.getUint8(1)===139&&(u=It(new Uint8Array(u))),{data:u}}let c=qo(new DataView(a),{z:n,x:i,y:o});if(c){let f=Yo(new DataView(a),c.z,c.x,c.y);if(f){let u=yield r.getArrayBuffer(t,f.offset,f.length,e);e.specVersion===1&&(u=Or(u));let h=Cr(new DataView(u),n,i,o);if(h){let p=(yield t.getBytes(h.offset,h.length,s)).data,y=new DataView(p);return y.getUint8(0)===31&&y.getUint8(1)===139&&(p=It(new Uint8Array(p))),{data:p}}}}})}var Xr={getHeader:es,getZxy:ts},rs=(e,t)=>{let r=!1,n="",i=L.GridLayer.extend({createTile:(o,s)=>{let a=document.createElement("img"),l=new AbortController,c=l.signal;return a.cancel=()=>{l.abort()},r||(e.getHeader().then(f=>{f.tileType===1?console.error("Error: archive contains MVT vector tiles, but leafletRasterLayer is for displaying raster tiles. See https://github.com/protomaps/PMTiles/tree/main/js for details."):f.tileType===2?n="image/png":f.tileType===3?n="image/jpeg":f.tileType===4?n="image/webp":f.tileType===5&&(n="image/avif")}),r=!0),e.getZxy(o.z,o.x,o.y,c).then(f=>{if(f){let u=new Blob([f.data],{type:n}),h=window.URL.createObjectURL(u);a.src=h,a.cancel=void 0,s(void 0,a)}}).catch(f=>{if(f.name!=="AbortError")throw f}),a},_removeTile:function(o){let s=this._tiles[o];s&&(s.el.cancel&&s.el.cancel(),s.el.width=0,s.el.height=0,s.el.deleted=!0,L.DomUtil.remove(s.el),delete this._tiles[o],this.fire("tileunload",{tile:s.el,coords:this._keyToTileCoords(o)}))}});return new i(t)},ns=e=>(t,r)=>{if(r instanceof AbortController)return e(t,r);let n=new AbortController;return e(t,n).then(i=>r(void 0,i.data,i.cacheControl||"",i.expires||""),i=>r(i)).catch(i=>r(i)),{cancel:()=>n.abort()}},is=class{constructor(){this.tilev4=(e,t)=>F(this,null,function*(){if(e.type==="json"){let u=e.url.substr(10),h=this.tiles.get(u);h||(h=new bt(u),this.tiles.set(u,h));let d=yield h.getHeader();return{data:{tiles:[`${e.url}/{z}/{x}/{y}`],minzoom:d.minZoom,maxzoom:d.maxZoom,bounds:[d.minLon,d.minLat,d.maxLon,d.maxLat]}}}let r=new RegExp(/pmtiles:\/\/(.+)\/(\d+)\/(\d+)\/(\d+)/),n=e.url.match(r);if(!n)throw new Error("Invalid PMTiles protocol URL");let i=n[1],o=this.tiles.get(i);o||(o=new bt(i),this.tiles.set(i,o));let s=n[2],a=n[3],l=n[4],c=yield o.getHeader(),f=yield o?.getZxy(+s,+a,+l,t.signal);return f?{data:new Uint8Array(f.data),cacheControl:f.cacheControl,expires:f.expires}:c.tileType===1?{data:new Uint8Array}:{data:null}}),this.tile=ns(this.tilev4),this.tiles=new Map}add(e){this.tiles.set(e.source.getKey(),e)}get(e){return this.tiles.get(e)}};function re(e,t){return(t>>>0)*4294967296+(e>>>0)}function os(e,t){let r=t.buf,n=r[t.pos++],i=(n&112)>>4;if(n<128||(n=r[t.pos++],i|=(n&127)<<3,n<128)||(n=r[t.pos++],i|=(n&127)<<10,n<128)||(n=r[t.pos++],i|=(n&127)<<17,n<128)||(n=r[t.pos++],i|=(n&127)<<24,n<128)||(n=r[t.pos++],i|=(n&1)<<31,n<128))return re(e,i);throw new Error("Expected varint not more than 10 bytes")}function ne(e){let t=e.buf,r=t[e.pos++],n=r&127;return r<128||(r=t[e.pos++],n|=(r&127)<<7,r<128)||(r=t[e.pos++],n|=(r&127)<<14,r<128)||(r=t[e.pos++],n|=(r&127)<<21,r<128)?n:(r=t[e.pos],n|=(r&15)<<28,os(n,e))}function Qr(e,t,r,n){if(n===0){r===1&&(t[0]=e-1-t[0],t[1]=e-1-t[1]);let i=t[0];t[0]=t[1],t[1]=i}}function ss(e,t){let r=J(2,e),n=t,i=t,o=t,s=[0,0],a=1;for(;a<r;)n=1&o/2,i=1&(o^n),Qr(a,s,n,i),s[0]+=a*n,s[1]+=a*i,o=o/4,a*=2;return[e,s[0],s[1]]}var as=[0,1,5,21,85,341,1365,5461,21845,87381,349525,1398101,5592405,22369621,89478485,357913941,1431655765,5726623061,22906492245,91625968981,366503875925,1466015503701,5864062014805,23456248059221,93824992236885,375299968947541,0x5555555555555];function qr(e,t,r){if(e>26)throw Error("Tile zoom level exceeds max safe number limit (26)");if(t>J(2,e)-1||r>J(2,e)-1)throw Error("tile x/y outside zoom level bounds");let n=as[e],i=J(2,e),o=0,s=0,a=0,l=[t,r],c=i/2;for(;c>0;)o=(l[0]&c)>0?1:0,s=(l[1]&c)>0?1:0,a+=c*c*(3*o^s),Qr(c,l,o,s),c=c/2;return n+a}function ls(e){let t=0,r=0;for(let n=0;n<27;n++){let i=(1<<n)*(1<<n);if(t+i>e)return ss(n,e-t);t+=i}throw Error("Tile zoom level exceeds max safe number limit (26)")}var en=(e=>(e[e.Unknown=0]="Unknown",e[e.None=1]="None",e[e.Gzip=2]="Gzip",e[e.Brotli=3]="Brotli",e[e.Zstd=4]="Zstd",e))(en||{});function St(e,t){return F(this,null,function*(){if(t===1||t===0)return e;if(t===2){if(typeof globalThis.DecompressionStream>"u")return It(new Uint8Array(e));let r=new Response(e).body;if(!r)throw Error("Failed to read response stream");let n=r.pipeThrough(new globalThis.DecompressionStream("gzip"));return new Response(n).arrayBuffer()}throw Error("Compression method not supported")})}var tn=(e=>(e[e.Unknown=0]="Unknown",e[e.Mvt=1]="Mvt",e[e.Png=2]="Png",e[e.Jpeg=3]="Jpeg",e[e.Webp=4]="Webp",e[e.Avif=5]="Avif",e))(tn||{});function rn(e){return e===1?".mvt":e===2?".png":e===3?".jpg":e===4?".webp":e===5?".avif":""}var cs=127;function nn(e,t){let r=0,n=e.length-1;for(;r<=n;){let i=n+r>>1,o=t-e[i].tileId;if(o>0)r=i+1;else if(o<0)n=i-1;else return e[i]}return n>=0&&(e[n].runLength===0||t-e[n].tileId<e[n].runLength)?e[n]:null}var fs=class{constructor(e){this.file=e}getKey(){return this.file.name}getBytes(e,t){return F(this,null,function*(){return{data:yield this.file.slice(e,e+t).arrayBuffer()}})}},on=class{constructor(e,t=new Headers){this.url=e,this.customHeaders=t,this.mustReload=!1;let r="";"navigator"in globalThis&&(r=globalThis.navigator.userAgent||"");let n=r.indexOf("Windows")>-1,i=/Chrome|Chromium|Edg|OPR|Brave/.test(r);this.chromeWindowsNoCache=!1,n&&i&&(this.chromeWindowsNoCache=!0)}getKey(){return this.url}setHeaders(e){this.customHeaders=e}getBytes(e,t,r,n){return F(this,null,function*(){let i,o;r?o=r:(i=new AbortController,o=i.signal);let s=new Headers(this.customHeaders);s.set("range",`bytes=${e}-${e+t-1}`);let a;this.mustReload?a="reload":this.chromeWindowsNoCache&&(a="no-store");let l=yield fetch(this.url,{signal:o,cache:a,headers:s});if(e===0&&l.status===416){let h=l.headers.get("Content-Range");if(!h||!h.startsWith("bytes */"))throw Error("Missing content-length on 416 response");let d=+h.substr(8);l=yield fetch(this.url,{signal:o,cache:"reload",headers:{range:`bytes=0-${d-1}`}})}let c=l.headers.get("Etag");if(c?.startsWith("W/")&&(c=null),l.status===416||n&&c&&c!==n)throw this.mustReload=!0,new Re(`Server returned non-matching ETag ${n} after one retry. Check browser extensions and servers for issues that may affect correct ETag headers.`);if(l.status>=300)throw Error(`Bad response code: ${l.status}`);let f=l.headers.get("Content-Length");if(l.status===200&&(!f||+f>t))throw i&&i.abort(),Error("Server returned no content-length header or content-length exceeding request. Check that your storage backend supports HTTP Byte Serving.");return{data:yield l.arrayBuffer(),etag:c||void 0,cacheControl:l.headers.get("Cache-Control")||void 0,expires:l.headers.get("Expires")||void 0}})}};function _(e,t){let r=e.getUint32(t+4,!0),n=e.getUint32(t+0,!0);return r*J(2,32)+n}function sn(e,t){let r=new DataView(e),n=r.getUint8(7);if(n>3)throw Error(`Archive is spec version ${n} but this library supports up to spec version 3`);return{specVersion:n,rootDirectoryOffset:_(r,8),rootDirectoryLength:_(r,16),jsonMetadataOffset:_(r,24),jsonMetadataLength:_(r,32),leafDirectoryOffset:_(r,40),leafDirectoryLength:_(r,48),tileDataOffset:_(r,56),tileDataLength:_(r,64),numAddressedTiles:_(r,72),numTileEntries:_(r,80),numTileContents:_(r,88),clustered:r.getUint8(96)===1,internalCompression:r.getUint8(97),tileCompression:r.getUint8(98),tileType:r.getUint8(99),minZoom:r.getUint8(100),maxZoom:r.getUint8(101),minLon:r.getInt32(102,!0)/1e7,minLat:r.getInt32(106,!0)/1e7,maxLon:r.getInt32(110,!0)/1e7,maxLat:r.getInt32(114,!0)/1e7,centerZoom:r.getUint8(118),centerLon:r.getInt32(119,!0)/1e7,centerLat:r.getInt32(123,!0)/1e7,etag:t}}function an(e){let t={buf:new Uint8Array(e),pos:0},r=ne(t),n=[],i=0;for(let o=0;o<r;o++){let s=ne(t);n.push({tileId:i+s,offset:0,length:0,runLength:1}),i+=s}for(let o=0;o<r;o++)n[o].runLength=ne(t);for(let o=0;o<r;o++)n[o].length=ne(t);for(let o=0;o<r;o++){let s=ne(t);s===0&&o>0?n[o].offset=n[o-1].offset+n[o-1].length:n[o].offset=s-1}return n}function us(e){let t=new DataView(e);return t.getUint16(2,!0)===2?(console.warn("PMTiles spec version 2 has been deprecated; please see github.com/protomaps/PMTiles for tools to upgrade"),2):t.getUint16(2,!0)===1?(console.warn("PMTiles spec version 1 has been deprecated; please see github.com/protomaps/PMTiles for tools to upgrade"),1):3}var Re=class extends Error{};function ln(e,t){return F(this,null,function*(){let r=yield e.getBytes(0,16384);if(new DataView(r.data).getUint16(0,!0)!==19792)throw new Error("Wrong magic number for PMTiles archive");if(us(r.data)<3)return[yield Xr.getHeader(e)];let i=r.data.slice(0,cs),o=sn(i,r.etag),s=r.data.slice(o.rootDirectoryOffset,o.rootDirectoryOffset+o.rootDirectoryLength),a=`${e.getKey()}|${o.etag||""}|${o.rootDirectoryOffset}|${o.rootDirectoryLength}`,l=an(yield t(s,o.internalCompression));return[o,[a,l.length,l]]})}function cn(e,t,r,n,i){return F(this,null,function*(){let o=yield e.getBytes(r,n,void 0,i.etag),s=yield t(o.data,i.internalCompression),a=an(s);if(a.length===0)throw new Error("Empty directory is invalid");return a})}var hs=class{constructor(e=100,t=!0,r=St){this.cache=new Map,this.maxCacheEntries=e,this.counter=1,this.decompress=r}getHeader(e){return F(this,null,function*(){let t=e.getKey(),r=this.cache.get(t);if(r)return r.lastUsed=this.counter++,r.data;let n=yield ln(e,this.decompress);return n[1]&&this.cache.set(n[1][0],{lastUsed:this.counter++,data:n[1][2]}),this.cache.set(t,{lastUsed:this.counter++,data:n[0]}),this.prune(),n[0]})}getDirectory(e,t,r,n){return F(this,null,function*(){let i=`${e.getKey()}|${n.etag||""}|${t}|${r}`,o=this.cache.get(i);if(o)return o.lastUsed=this.counter++,o.data;let s=yield cn(e,this.decompress,t,r,n);return this.cache.set(i,{lastUsed:this.counter++,data:s}),this.prune(),s})}getArrayBuffer(e,t,r,n){return F(this,null,function*(){let i=`${e.getKey()}|${n.etag||""}|${t}|${r}`,o=this.cache.get(i);if(o)return o.lastUsed=this.counter++,yield o.data;let s=yield e.getBytes(t,r,void 0,n.etag);return this.cache.set(i,{lastUsed:this.counter++,data:s.data}),this.prune(),s.data})}prune(){if(this.cache.size>this.maxCacheEntries){let e=1/0,t;this.cache.forEach((r,n)=>{r.lastUsed<e&&(e=r.lastUsed,t=n)}),t&&this.cache.delete(t)}}invalidate(e){return F(this,null,function*(){this.cache.delete(e.getKey())})}},fn=class{constructor(e=100,t=!0,r=St){this.cache=new Map,this.invalidations=new Map,this.maxCacheEntries=e,this.counter=1,this.decompress=r}getHeader(e){return F(this,null,function*(){let t=e.getKey(),r=this.cache.get(t);if(r)return r.lastUsed=this.counter++,yield r.data;let n=new Promise((i,o)=>{ln(e,this.decompress).then(s=>{s[1]&&this.cache.set(s[1][0],{lastUsed:this.counter++,data:Promise.resolve(s[1][2])}),i(s[0]),this.prune()}).catch(s=>{o(s)})});return this.cache.set(t,{lastUsed:this.counter++,data:n}),n})}getDirectory(e,t,r,n){return F(this,null,function*(){let i=`${e.getKey()}|${n.etag||""}|${t}|${r}`,o=this.cache.get(i);if(o)return o.lastUsed=this.counter++,yield o.data;let s=new Promise((a,l)=>{cn(e,this.decompress,t,r,n).then(c=>{a(c),this.prune()}).catch(c=>{l(c)})});return this.cache.set(i,{lastUsed:this.counter++,data:s}),s})}getArrayBuffer(e,t,r,n){return F(this,null,function*(){let i=`${e.getKey()}|${n.etag||""}|${t}|${r}`,o=this.cache.get(i);if(o)return o.lastUsed=this.counter++,yield o.data;let s=new Promise((a,l)=>{e.getBytes(t,r,void 0,n.etag).then(c=>{a(c.data),this.cache.has(i),this.prune()}).catch(c=>{l(c)})});return this.cache.set(i,{lastUsed:this.counter++,data:s}),s})}prune(){if(this.cache.size>=this.maxCacheEntries){let e=1/0,t;this.cache.forEach((r,n)=>{r.lastUsed<e&&(e=r.lastUsed,t=n)}),t&&this.cache.delete(t)}}invalidate(e){return F(this,null,function*(){let t=e.getKey();if(this.invalidations.get(t))return yield this.invalidations.get(t);this.cache.delete(e.getKey());let r=new Promise((n,i)=>{this.getHeader(e).then(o=>{n(),this.invalidations.delete(t)}).catch(o=>{i(o)})});this.invalidations.set(t,r)})}},bt=class{constructor(e,t,r){typeof e=="string"?this.source=new on(e):this.source=e,r?this.decompress=r:this.decompress=St,t?this.cache=t:this.cache=new fn}getHeader(){return F(this,null,function*(){return yield this.cache.getHeader(this.source)})}getZxyAttempt(e,t,r,n){return F(this,null,function*(){let i=qr(e,t,r),o=yield this.cache.getHeader(this.source);if(o.specVersion<3)return Xr.getZxy(o,this.source,this.cache,e,t,r,n);if(e<o.minZoom||e>o.maxZoom)return;let s=o.rootDirectoryOffset,a=o.rootDirectoryLength;for(let l=0;l<=3;l++){let c=yield this.cache.getDirectory(this.source,s,a,o),f=nn(c,i);if(f){if(f.runLength>0){let u=yield this.source.getBytes(o.tileDataOffset+f.offset,f.length,n,o.etag);return{data:yield this.decompress(u.data,o.tileCompression),cacheControl:u.cacheControl,expires:u.expires}}s=o.leafDirectoryOffset+f.offset,a=f.length}else return}throw Error("Maximum directory depth exceeded")})}getZxy(e,t,r,n){return F(this,null,function*(){try{return yield this.getZxyAttempt(e,t,r,n)}catch(i){if(i instanceof Re)return this.cache.invalidate(this.source),yield this.getZxyAttempt(e,t,r,n);throw i}})}getMetadataAttempt(){return F(this,null,function*(){let e=yield this.cache.getHeader(this.source),t=yield this.source.getBytes(e.jsonMetadataOffset,e.jsonMetadataLength,void 0,e.etag),r=yield this.decompress(t.data,e.internalCompression),n=new TextDecoder("utf-8");return JSON.parse(n.decode(r))})}getMetadata(){return F(this,null,function*(){try{return yield this.getMetadataAttempt()}catch(e){if(e instanceof Re)return this.cache.invalidate(this.source),yield this.getMetadataAttempt();throw e}})}getTileJson(e){return F(this,null,function*(){let t=yield this.getHeader(),r=yield this.getMetadata(),n=rn(t.tileType);return{tilejson:"3.0.0",scheme:"xyz",tiles:[`${e}/{z}/{x}/{y}${n}`],vector_layers:r.vector_layers,attribution:r.attribution,description:r.description,name:r.name,version:r.version,bounds:[t.minLon,t.minLat,t.maxLon,t.maxLat],center:[t.centerLon,t.centerLat,t.centerZoom],minzoom:t.minZoom,maxzoom:t.maxZoom}})}};var{TileType:Ie}=Pe;function un(e,t,r,n){let i=null;if(t)try{let a=JSON.stringify(t);i=de.parseTextSync?.(a,n)||null}catch(a){console.warn("PMTiles metadata could not be interpreted as TileJSON",a)}let o={};typeof i?.name=="string"&&(o.name=i.name),typeof i?.htmlAttribution=="string"&&(o.attributions=[i.htmlAttribution]);let s={...o,format:"pmtiles",formatVersion:e.specVersion,attributions:[],tileMIMEType:ds(e.tileType),minZoom:e.minZoom,maxZoom:e.maxZoom,boundingBox:[[e.minLon,e.minLat],[e.maxLon,e.maxLat]],center:[e.centerLon,e.centerLat],centerZoom:e.centerZoom,etag:e.etag};return i&&(s.tilejson=i),r?.includeFormatHeader&&(s.formatHeader=e,s.formatMetadata=s),s}function ds(e){switch(e){case Ie.Mvt:return"application/vnd.mapbox-vector-tile";case Ie.Png:return"image/png";case Ie.Jpeg:return"image/jpeg";case Ie.Webp:return"image/webp";case Ie.Avif:return"image/avif";default:return"application/octet-stream"}}var He=class{blob;key;constructor(t,r){this.blob=t,this.key=r}getKey(){return this.blob.url||""}async getBytes(t,r,n){return{data:await this.blob.slice(t,t+r).arrayBuffer()}}};var{PMTiles:ps}=Pe,gs="1.0.0",hn={name:"PMTiles",id:"pmtiles",module:"pmtiles",version:gs,extensions:["pmtiles"],mimeTypes:["application/octet-stream"],options:{url:void 0,pmtiles:{}},type:"pmtiles",fromUrl:!0,fromBlob:!0,testURL:e=>e.endsWith(".pmtiles"),createDataSource:(e,t)=>new W(e,t)},W=class extends fe{data;props;mimeType=null;pmtiles;metadata;constructor(t,r){super(r),this.props=r;let n=typeof t=="string"?et(t):new He(t,"pmtiles");this.data=t,this.pmtiles=new ps(n),this.getTileData=this.getTileData.bind(this),this.metadata=this.getMetadata()}async getSchema(){return{fields:[],metadata:{}}}async getMetadata(){let t=await this.pmtiles.getHeader(),r=await this.pmtiles.getMetadata()||{},n=un(t,r,{includeFormatHeader:!1},this.loadOptions);return this.props.attributions&&(n.attributions=[...this.props.attributions,...n.attributions||[]]),n?.tileMIMEType&&(this.mimeType=n?.tileMIMEType),n}async getTile(t){let{x:r,y:n,z:i}=t,s=(await this.pmtiles.getZxy(i,r,n))?.data;return s||null}async getTileData(t){let{x:r,y:n,z:i}=t.index;switch((await this.metadata).tileMIMEType){case"application/vnd.mapbox-vector-tile":return await this.getVectorTile({x:r,y:n,z:i,layers:[]});default:return await this.getImageTile({x:r,y:n,z:i,layers:[]})}}async getImageTile(t){let r=await this.getTile(t);return r?await ot.parse(r,this.loadOptions):null}async getVectorTile(t){let r=await this.getTile(t),n={shape:"geojson-table",mvt:{coordinates:"wgs84",tileIndex:{x:t.x,y:t.y,z:t.z},...this.loadOptions?.mvt},...this.loadOptions};return r?await vt.parse(r,n):null}};var dn="4.3.0-alpha.8";var gn={name:"PMTiles",id:"pmtiles",module:"pmtiles",version:dn,extensions:["pmtiles"],mimeTypes:["application/octet-stream"],tests:["PMTiles"],options:{pmtiles:{}},parse:async(e,t)=>pn(new ce(new Blob([e])),t),parseFile:pn};async function pn(e,t){let n=await new W(e.handle,{pmtiles:t?.pmtiles||{}}).getMetadata(),{tileMIMEType:i,tilejson:o={}}=n,{layers:s=[]}=o;switch(i){case"application/vnd.mapbox-vector-tile":return{shape:"vector-source",layers:s.map(a=>({name:a.name,schema:a.schema})),tables:[],formatSpecificMetadata:n};case"image/png":case"image/jpeg":return{shape:"image-source",formatSpecificMetadata:n};default:throw new Error(`PMTilesLoader: Unsupported tile MIME type ${i}`)}}return Sn(be);})();
|
|
8
8
|
/*! Bundled license information:
|
|
9
9
|
|
|
10
10
|
ieee754/index.js:
|
package/dist/index.cjs
CHANGED
|
@@ -224,7 +224,7 @@ var PMTilesTileSource = class extends import_loader_utils.DataSource {
|
|
|
224
224
|
var import_loader_utils2 = require("@loaders.gl/loader-utils");
|
|
225
225
|
|
|
226
226
|
// dist/lib/version.js
|
|
227
|
-
var VERSION2 = true ? "4.3.0-alpha.
|
|
227
|
+
var VERSION2 = true ? "4.3.0-alpha.8" : "latest";
|
|
228
228
|
|
|
229
229
|
// dist/pmtiles-loader.js
|
|
230
230
|
var PMTilesLoader = {
|
package/dist/index.cjs.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["index.js", "pmtiles-source.js", "lib/parse-pmtiles.js", "lib/blob-source.js", "pmtiles-loader.js", "lib/version.js"],
|
|
4
|
-
"sourcesContent": ["// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nexport { PMTilesSource } from \"./pmtiles-source.js\";\nexport { PMTilesTileSource } from \"./pmtiles-source.js\";\nexport { PMTilesLoader as _PMTilesLoader } from \"./pmtiles-loader.js\";\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nimport { DataSource, resolvePath } from '@loaders.gl/loader-utils';\nimport { ImageLoader } from '@loaders.gl/images';\nimport { MVTLoader } from '@loaders.gl/mvt';\nimport * as pmtiles from 'pmtiles';\nconst { PMTiles } = pmtiles;\nimport { parsePMTilesHeader } from \"./lib/parse-pmtiles.js\";\nimport { BlobSource } from \"./lib/blob-source.js\";\nconst VERSION = '1.0.0';\n/**\n * Creates vector tile data sources for PMTiles urls or blobs\n */\nexport const PMTilesSource = {\n name: 'PMTiles',\n id: 'pmtiles',\n module: 'pmtiles',\n version: VERSION,\n extensions: ['pmtiles'],\n mimeTypes: ['application/octet-stream'],\n options: { url: undefined, pmtiles: {} },\n type: 'pmtiles',\n fromUrl: true,\n fromBlob: true,\n testURL: (url) => url.endsWith('.pmtiles'),\n createDataSource: (url, props) => new PMTilesTileSource(url, props)\n};\n/**\n * A PMTiles data source\n * @note Can be either a raster or vector tile source depending on the contents of the PMTiles file.\n */\nexport class PMTilesTileSource extends DataSource {\n data;\n props;\n mimeType = null;\n pmtiles;\n metadata;\n constructor(data, props) {\n super(props);\n this.props = props;\n const url = typeof data === 'string' ? resolvePath(data) : new BlobSource(data, 'pmtiles');\n this.data = data;\n this.pmtiles = new PMTiles(url);\n this.getTileData = this.getTileData.bind(this);\n this.metadata = this.getMetadata();\n }\n async getSchema() {\n return { fields: [], metadata: {} };\n }\n async getMetadata() {\n const pmtilesHeader = await this.pmtiles.getHeader();\n const pmtilesMetadata = (await this.pmtiles.getMetadata()) || {};\n const metadata = parsePMTilesHeader(pmtilesHeader, pmtilesMetadata, { includeFormatHeader: false }, this.loadOptions);\n // Add additional attribution if necessary\n if (this.props.attributions) {\n metadata.attributions = [...this.props.attributions, ...(metadata.attributions || [])];\n }\n if (metadata?.tileMIMEType) {\n this.mimeType = metadata?.tileMIMEType;\n }\n // TODO - do we need to allow tileSize to be overridden? Some PMTiles examples seem to suggest it.\n return metadata;\n }\n async getTile(tileParams) {\n const { x, y, z } = tileParams;\n const rangeResponse = await this.pmtiles.getZxy(z, x, y);\n const arrayBuffer = rangeResponse?.data;\n if (!arrayBuffer) {\n // console.error('No arrayBuffer', tileParams);\n return null;\n }\n return arrayBuffer;\n }\n // Tile Source interface implementation: deck.gl compatible API\n // TODO - currently only handles image tiles, not vector tiles\n async getTileData(tileParams) {\n const { x, y, z } = tileParams.index;\n const metadata = await this.metadata;\n switch (metadata.tileMIMEType) {\n case 'application/vnd.mapbox-vector-tile':\n return await this.getVectorTile({ x, y, z, layers: [] });\n default:\n return await this.getImageTile({ x, y, z, layers: [] });\n }\n }\n // ImageTileSource interface implementation\n async getImageTile(tileParams) {\n const arrayBuffer = await this.getTile(tileParams);\n return arrayBuffer ? await ImageLoader.parse(arrayBuffer, this.loadOptions) : null;\n }\n // VectorTileSource interface implementation\n async getVectorTile(tileParams) {\n const arrayBuffer = await this.getTile(tileParams);\n const loadOptions = {\n shape: 'geojson-table',\n mvt: {\n coordinates: 'wgs84',\n tileIndex: { x: tileParams.x, y: tileParams.y, z: tileParams.z },\n ...this.loadOptions?.mvt\n },\n ...this.loadOptions\n };\n return arrayBuffer ? await MVTLoader.parse(arrayBuffer, loadOptions) : null;\n }\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nimport { TileJSONLoader } from '@loaders.gl/mvt';\n// import {Source, PMTiles, Header, TileType} from 'pmtiles';\nimport * as pmtiles from 'pmtiles';\nconst { TileType } = pmtiles;\n/**\n * Parse PMTiles metdata from a PMTiles file\n * @param header\n * @param tilejsonMetadata\n * @param options\n * @param loadOptions\n * @returns\n */\nexport function parsePMTilesHeader(header, pmtilesMetadata, options, loadOptions) {\n // Ironically, to use the TileJSON loader we need to stringify the metadata again.\n // This is the price of integrating with the existing pmtiles library.\n // TODO - provide a non-standard TileJSONLoader parsers that accepts a JSON object?\n let tilejson = null;\n if (pmtilesMetadata) {\n try {\n const string = JSON.stringify(pmtilesMetadata);\n tilejson = TileJSONLoader.parseTextSync?.(string, loadOptions) || null;\n }\n catch (error) {\n // eslint-disable-next-line no-console\n console.warn('PMTiles metadata could not be interpreted as TileJSON', error);\n }\n }\n const partialMetadata = {};\n if (typeof tilejson?.name === 'string') {\n partialMetadata.name = tilejson.name;\n }\n if (typeof tilejson?.htmlAttribution === 'string') {\n partialMetadata.attributions = [tilejson.htmlAttribution];\n }\n const metadata = {\n ...partialMetadata,\n format: 'pmtiles',\n formatVersion: header.specVersion,\n attributions: [],\n tileMIMEType: decodeTileType(header.tileType),\n minZoom: header.minZoom,\n maxZoom: header.maxZoom,\n boundingBox: [\n [header.minLon, header.minLat],\n [header.maxLon, header.maxLat]\n ],\n center: [header.centerLon, header.centerLat],\n centerZoom: header.centerZoom,\n etag: header.etag\n };\n if (tilejson) {\n metadata.tilejson = tilejson;\n }\n // Application can optionally include the raw header and metadata.\n if (options?.includeFormatHeader) {\n metadata.formatHeader = header;\n metadata.formatMetadata = metadata;\n }\n return metadata;\n}\n/** Extract a MIME type for tiles from vector tile header */\nfunction decodeTileType(tileType) {\n switch (tileType) {\n case TileType.Mvt:\n return 'application/vnd.mapbox-vector-tile';\n case TileType.Png:\n return 'image/png';\n case TileType.Jpeg:\n return 'image/jpeg';\n case TileType.Webp:\n return 'image/webp';\n case TileType.Avif:\n return 'image/avif';\n default:\n return 'application/octet-stream';\n }\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n/**\n * A PMTiles library compatible source that reads from blobs\n * @deprecated TODO - reimplement as ReadableFileSource\n * Use loaders.gl HTTP range requests instead\n */\nexport class BlobSource {\n blob;\n key;\n constructor(blob, key) {\n this.blob = blob;\n this.key = key;\n }\n // TODO - how is this used?\n getKey() {\n // @ts-expect-error url is only defined on File subclass\n return this.blob.url || '';\n }\n async getBytes(offset, length, signal) {\n const slice = this.blob.slice(offset, offset + length);\n const data = await slice.arrayBuffer();\n return {\n data\n // etag: response.headers.get('ETag') || undefined,\n // cacheControl: response.headers.get('Cache-Control') || undefined,\n // expires: response.headers.get('Expires') || undefined\n };\n }\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nimport { BlobFile } from '@loaders.gl/loader-utils';\nimport { VERSION } from \"./lib/version.js\";\nimport { PMTilesTileSource } from \"./pmtiles-source.js\";\n/**\n * Loader for PMTiles metadata\n * @note This loader is intended to allow PMTiles to be treated like other file types in top-level loading logic.\n * @note For actual access to the tile data, use the PMTilesSource class.\n */\nexport const PMTilesLoader = {\n name: 'PMTiles',\n id: 'pmtiles',\n module: 'pmtiles',\n version: VERSION,\n extensions: ['pmtiles'],\n mimeTypes: ['application/octet-stream'],\n tests: ['PMTiles'],\n options: {\n pmtiles: {}\n },\n parse: async (arrayBuffer, options) => parseFileAsPMTiles(new BlobFile(new Blob([arrayBuffer])), options),\n parseFile: parseFileAsPMTiles\n};\nasync function parseFileAsPMTiles(file, options) {\n const source = new PMTilesTileSource(file.handle, {\n pmtiles: options?.pmtiles || {}\n });\n const formatSpecificMetadata = await source.getMetadata();\n const { tileMIMEType, tilejson = {} } = formatSpecificMetadata;\n const { layers = [] } = tilejson;\n switch (tileMIMEType) {\n case 'application/vnd.mapbox-vector-tile':\n return {\n shape: 'vector-source',\n layers: layers.map((layer) => ({ name: layer.name, schema: layer.schema })),\n tables: [],\n formatSpecificMetadata\n };\n case 'image/png':\n case 'image/jpeg':\n return { shape: 'image-source', formatSpecificMetadata };\n default:\n throw new Error(`PMTilesLoader: Unsupported tile MIME type ${tileMIMEType}`);\n }\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n// Version constant cannot be imported, it needs to correspond to the build version of **this** module.\n// __VERSION__ is injected by babel-plugin-version-inline\n// @ts-ignore TS2304: Cannot find name '__VERSION__'.\nexport const VERSION = typeof \"4.3.0-alpha.7\" !== 'undefined' ? \"4.3.0-alpha.7\" : 'latest';\n"],
|
|
4
|
+
"sourcesContent": ["// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nexport { PMTilesSource } from \"./pmtiles-source.js\";\nexport { PMTilesTileSource } from \"./pmtiles-source.js\";\nexport { PMTilesLoader as _PMTilesLoader } from \"./pmtiles-loader.js\";\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nimport { DataSource, resolvePath } from '@loaders.gl/loader-utils';\nimport { ImageLoader } from '@loaders.gl/images';\nimport { MVTLoader } from '@loaders.gl/mvt';\nimport * as pmtiles from 'pmtiles';\nconst { PMTiles } = pmtiles;\nimport { parsePMTilesHeader } from \"./lib/parse-pmtiles.js\";\nimport { BlobSource } from \"./lib/blob-source.js\";\nconst VERSION = '1.0.0';\n/**\n * Creates vector tile data sources for PMTiles urls or blobs\n */\nexport const PMTilesSource = {\n name: 'PMTiles',\n id: 'pmtiles',\n module: 'pmtiles',\n version: VERSION,\n extensions: ['pmtiles'],\n mimeTypes: ['application/octet-stream'],\n options: { url: undefined, pmtiles: {} },\n type: 'pmtiles',\n fromUrl: true,\n fromBlob: true,\n testURL: (url) => url.endsWith('.pmtiles'),\n createDataSource: (url, props) => new PMTilesTileSource(url, props)\n};\n/**\n * A PMTiles data source\n * @note Can be either a raster or vector tile source depending on the contents of the PMTiles file.\n */\nexport class PMTilesTileSource extends DataSource {\n data;\n props;\n mimeType = null;\n pmtiles;\n metadata;\n constructor(data, props) {\n super(props);\n this.props = props;\n const url = typeof data === 'string' ? resolvePath(data) : new BlobSource(data, 'pmtiles');\n this.data = data;\n this.pmtiles = new PMTiles(url);\n this.getTileData = this.getTileData.bind(this);\n this.metadata = this.getMetadata();\n }\n async getSchema() {\n return { fields: [], metadata: {} };\n }\n async getMetadata() {\n const pmtilesHeader = await this.pmtiles.getHeader();\n const pmtilesMetadata = (await this.pmtiles.getMetadata()) || {};\n const metadata = parsePMTilesHeader(pmtilesHeader, pmtilesMetadata, { includeFormatHeader: false }, this.loadOptions);\n // Add additional attribution if necessary\n if (this.props.attributions) {\n metadata.attributions = [...this.props.attributions, ...(metadata.attributions || [])];\n }\n if (metadata?.tileMIMEType) {\n this.mimeType = metadata?.tileMIMEType;\n }\n // TODO - do we need to allow tileSize to be overridden? Some PMTiles examples seem to suggest it.\n return metadata;\n }\n async getTile(tileParams) {\n const { x, y, z } = tileParams;\n const rangeResponse = await this.pmtiles.getZxy(z, x, y);\n const arrayBuffer = rangeResponse?.data;\n if (!arrayBuffer) {\n // console.error('No arrayBuffer', tileParams);\n return null;\n }\n return arrayBuffer;\n }\n // Tile Source interface implementation: deck.gl compatible API\n // TODO - currently only handles image tiles, not vector tiles\n async getTileData(tileParams) {\n const { x, y, z } = tileParams.index;\n const metadata = await this.metadata;\n switch (metadata.tileMIMEType) {\n case 'application/vnd.mapbox-vector-tile':\n return await this.getVectorTile({ x, y, z, layers: [] });\n default:\n return await this.getImageTile({ x, y, z, layers: [] });\n }\n }\n // ImageTileSource interface implementation\n async getImageTile(tileParams) {\n const arrayBuffer = await this.getTile(tileParams);\n return arrayBuffer ? await ImageLoader.parse(arrayBuffer, this.loadOptions) : null;\n }\n // VectorTileSource interface implementation\n async getVectorTile(tileParams) {\n const arrayBuffer = await this.getTile(tileParams);\n const loadOptions = {\n shape: 'geojson-table',\n mvt: {\n coordinates: 'wgs84',\n tileIndex: { x: tileParams.x, y: tileParams.y, z: tileParams.z },\n ...this.loadOptions?.mvt\n },\n ...this.loadOptions\n };\n return arrayBuffer ? await MVTLoader.parse(arrayBuffer, loadOptions) : null;\n }\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nimport { TileJSONLoader } from '@loaders.gl/mvt';\n// import {Source, PMTiles, Header, TileType} from 'pmtiles';\nimport * as pmtiles from 'pmtiles';\nconst { TileType } = pmtiles;\n/**\n * Parse PMTiles metdata from a PMTiles file\n * @param header\n * @param tilejsonMetadata\n * @param options\n * @param loadOptions\n * @returns\n */\nexport function parsePMTilesHeader(header, pmtilesMetadata, options, loadOptions) {\n // Ironically, to use the TileJSON loader we need to stringify the metadata again.\n // This is the price of integrating with the existing pmtiles library.\n // TODO - provide a non-standard TileJSONLoader parsers that accepts a JSON object?\n let tilejson = null;\n if (pmtilesMetadata) {\n try {\n const string = JSON.stringify(pmtilesMetadata);\n tilejson = TileJSONLoader.parseTextSync?.(string, loadOptions) || null;\n }\n catch (error) {\n // eslint-disable-next-line no-console\n console.warn('PMTiles metadata could not be interpreted as TileJSON', error);\n }\n }\n const partialMetadata = {};\n if (typeof tilejson?.name === 'string') {\n partialMetadata.name = tilejson.name;\n }\n if (typeof tilejson?.htmlAttribution === 'string') {\n partialMetadata.attributions = [tilejson.htmlAttribution];\n }\n const metadata = {\n ...partialMetadata,\n format: 'pmtiles',\n formatVersion: header.specVersion,\n attributions: [],\n tileMIMEType: decodeTileType(header.tileType),\n minZoom: header.minZoom,\n maxZoom: header.maxZoom,\n boundingBox: [\n [header.minLon, header.minLat],\n [header.maxLon, header.maxLat]\n ],\n center: [header.centerLon, header.centerLat],\n centerZoom: header.centerZoom,\n etag: header.etag\n };\n if (tilejson) {\n metadata.tilejson = tilejson;\n }\n // Application can optionally include the raw header and metadata.\n if (options?.includeFormatHeader) {\n metadata.formatHeader = header;\n metadata.formatMetadata = metadata;\n }\n return metadata;\n}\n/** Extract a MIME type for tiles from vector tile header */\nfunction decodeTileType(tileType) {\n switch (tileType) {\n case TileType.Mvt:\n return 'application/vnd.mapbox-vector-tile';\n case TileType.Png:\n return 'image/png';\n case TileType.Jpeg:\n return 'image/jpeg';\n case TileType.Webp:\n return 'image/webp';\n case TileType.Avif:\n return 'image/avif';\n default:\n return 'application/octet-stream';\n }\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n/**\n * A PMTiles library compatible source that reads from blobs\n * @deprecated TODO - reimplement as ReadableFileSource\n * Use loaders.gl HTTP range requests instead\n */\nexport class BlobSource {\n blob;\n key;\n constructor(blob, key) {\n this.blob = blob;\n this.key = key;\n }\n // TODO - how is this used?\n getKey() {\n // @ts-expect-error url is only defined on File subclass\n return this.blob.url || '';\n }\n async getBytes(offset, length, signal) {\n const slice = this.blob.slice(offset, offset + length);\n const data = await slice.arrayBuffer();\n return {\n data\n // etag: response.headers.get('ETag') || undefined,\n // cacheControl: response.headers.get('Cache-Control') || undefined,\n // expires: response.headers.get('Expires') || undefined\n };\n }\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nimport { BlobFile } from '@loaders.gl/loader-utils';\nimport { VERSION } from \"./lib/version.js\";\nimport { PMTilesTileSource } from \"./pmtiles-source.js\";\n/**\n * Loader for PMTiles metadata\n * @note This loader is intended to allow PMTiles to be treated like other file types in top-level loading logic.\n * @note For actual access to the tile data, use the PMTilesSource class.\n */\nexport const PMTilesLoader = {\n name: 'PMTiles',\n id: 'pmtiles',\n module: 'pmtiles',\n version: VERSION,\n extensions: ['pmtiles'],\n mimeTypes: ['application/octet-stream'],\n tests: ['PMTiles'],\n options: {\n pmtiles: {}\n },\n parse: async (arrayBuffer, options) => parseFileAsPMTiles(new BlobFile(new Blob([arrayBuffer])), options),\n parseFile: parseFileAsPMTiles\n};\nasync function parseFileAsPMTiles(file, options) {\n const source = new PMTilesTileSource(file.handle, {\n pmtiles: options?.pmtiles || {}\n });\n const formatSpecificMetadata = await source.getMetadata();\n const { tileMIMEType, tilejson = {} } = formatSpecificMetadata;\n const { layers = [] } = tilejson;\n switch (tileMIMEType) {\n case 'application/vnd.mapbox-vector-tile':\n return {\n shape: 'vector-source',\n layers: layers.map((layer) => ({ name: layer.name, schema: layer.schema })),\n tables: [],\n formatSpecificMetadata\n };\n case 'image/png':\n case 'image/jpeg':\n return { shape: 'image-source', formatSpecificMetadata };\n default:\n throw new Error(`PMTilesLoader: Unsupported tile MIME type ${tileMIMEType}`);\n }\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n// Version constant cannot be imported, it needs to correspond to the build version of **this** module.\n// __VERSION__ is injected by babel-plugin-version-inline\n// @ts-ignore TS2304: Cannot find name '__VERSION__'.\nexport const VERSION = typeof \"4.3.0-alpha.8\" !== 'undefined' ? \"4.3.0-alpha.8\" : 'latest';\n"],
|
|
5
5
|
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACGA,0BAAwC;AACxC,oBAA4B;AAC5B,IAAAA,cAA0B;AAC1B,IAAAC,WAAyB;;;ACHzB,iBAA+B;AAE/B,cAAyB;AACzB,IAAM,EAAE,SAAS,IAAI;AASd,SAAS,mBAAmB,QAAQ,iBAAiB,SAAS,aAAa;AAflF;AAmBI,MAAI,WAAW;AACf,MAAI,iBAAiB;AACjB,QAAI;AACA,YAAM,SAAS,KAAK,UAAU,eAAe;AAC7C,mBAAW,sCAAe,kBAAf,4BAA+B,QAAQ,iBAAgB;AAAA,IACtE,SACO,OAAP;AAEI,cAAQ,KAAK,yDAAyD,KAAK;AAAA,IAC/E;AAAA,EACJ;AACA,QAAM,kBAAkB,CAAC;AACzB,MAAI,QAAO,qCAAU,UAAS,UAAU;AACpC,oBAAgB,OAAO,SAAS;AAAA,EACpC;AACA,MAAI,QAAO,qCAAU,qBAAoB,UAAU;AAC/C,oBAAgB,eAAe,CAAC,SAAS,eAAe;AAAA,EAC5D;AACA,QAAM,WAAW;AAAA,IACb,GAAG;AAAA,IACH,QAAQ;AAAA,IACR,eAAe,OAAO;AAAA,IACtB,cAAc,CAAC;AAAA,IACf,cAAc,eAAe,OAAO,QAAQ;AAAA,IAC5C,SAAS,OAAO;AAAA,IAChB,SAAS,OAAO;AAAA,IAChB,aAAa;AAAA,MACT,CAAC,OAAO,QAAQ,OAAO,MAAM;AAAA,MAC7B,CAAC,OAAO,QAAQ,OAAO,MAAM;AAAA,IACjC;AAAA,IACA,QAAQ,CAAC,OAAO,WAAW,OAAO,SAAS;AAAA,IAC3C,YAAY,OAAO;AAAA,IACnB,MAAM,OAAO;AAAA,EACjB;AACA,MAAI,UAAU;AACV,aAAS,WAAW;AAAA,EACxB;AAEA,MAAI,mCAAS,qBAAqB;AAC9B,aAAS,eAAe;AACxB,aAAS,iBAAiB;AAAA,EAC9B;AACA,SAAO;AACX;AAEA,SAAS,eAAe,UAAU;AAC9B,UAAQ,UAAU;AAAA,IACd,KAAK,SAAS;AACV,aAAO;AAAA,IACX,KAAK,SAAS;AACV,aAAO;AAAA,IACX,KAAK,SAAS;AACV,aAAO;AAAA,IACX,KAAK,SAAS;AACV,aAAO;AAAA,IACX,KAAK,SAAS;AACV,aAAO;AAAA,IACX;AACI,aAAO;AAAA,EACf;AACJ;;;ACvEO,IAAM,aAAN,MAAiB;AAAA,EACpB;AAAA,EACA;AAAA,EACA,YAAY,MAAM,KAAK;AACnB,SAAK,OAAO;AACZ,SAAK,MAAM;AAAA,EACf;AAAA;AAAA,EAEA,SAAS;AAEL,WAAO,KAAK,KAAK,OAAO;AAAA,EAC5B;AAAA,EACA,MAAM,SAAS,QAAQ,QAAQ,QAAQ;AACnC,UAAM,QAAQ,KAAK,KAAK,MAAM,QAAQ,SAAS,MAAM;AACrD,UAAM,OAAO,MAAM,MAAM,YAAY;AACrC,WAAO;AAAA,MACH;AAAA;AAAA;AAAA;AAAA,IAIJ;AAAA,EACJ;AACJ;;;AFvBA,IAAM,EAAE,QAAQ,IAAIC;AAGpB,IAAM,UAAU;AAIT,IAAM,gBAAgB;AAAA,EACzB,MAAM;AAAA,EACN,IAAI;AAAA,EACJ,QAAQ;AAAA,EACR,SAAS;AAAA,EACT,YAAY,CAAC,SAAS;AAAA,EACtB,WAAW,CAAC,0BAA0B;AAAA,EACtC,SAAS,EAAE,KAAK,QAAW,SAAS,CAAC,EAAE;AAAA,EACvC,MAAM;AAAA,EACN,SAAS;AAAA,EACT,UAAU;AAAA,EACV,SAAS,CAAC,QAAQ,IAAI,SAAS,UAAU;AAAA,EACzC,kBAAkB,CAAC,KAAK,UAAU,IAAI,kBAAkB,KAAK,KAAK;AACtE;AAKO,IAAM,oBAAN,cAAgC,+BAAW;AAAA,EAC9C;AAAA,EACA;AAAA,EACA,WAAW;AAAA,EACX;AAAA,EACA;AAAA,EACA,YAAY,MAAM,OAAO;AACrB,UAAM,KAAK;AACX,SAAK,QAAQ;AACb,UAAM,MAAM,OAAO,SAAS,eAAW,iCAAY,IAAI,IAAI,IAAI,WAAW,MAAM,SAAS;AACzF,SAAK,OAAO;AACZ,SAAK,UAAU,IAAI,QAAQ,GAAG;AAC9B,SAAK,cAAc,KAAK,YAAY,KAAK,IAAI;AAC7C,SAAK,WAAW,KAAK,YAAY;AAAA,EACrC;AAAA,EACA,MAAM,YAAY;AACd,WAAO,EAAE,QAAQ,CAAC,GAAG,UAAU,CAAC,EAAE;AAAA,EACtC;AAAA,EACA,MAAM,cAAc;AAChB,UAAM,gBAAgB,MAAM,KAAK,QAAQ,UAAU;AACnD,UAAM,kBAAmB,MAAM,KAAK,QAAQ,YAAY,KAAM,CAAC;AAC/D,UAAM,WAAW,mBAAmB,eAAe,iBAAiB,EAAE,qBAAqB,MAAM,GAAG,KAAK,WAAW;AAEpH,QAAI,KAAK,MAAM,cAAc;AACzB,eAAS,eAAe,CAAC,GAAG,KAAK,MAAM,cAAc,GAAI,SAAS,gBAAgB,CAAC,CAAE;AAAA,IACzF;AACA,QAAI,qCAAU,cAAc;AACxB,WAAK,WAAW,qCAAU;AAAA,IAC9B;AAEA,WAAO;AAAA,EACX;AAAA,EACA,MAAM,QAAQ,YAAY;AACtB,UAAM,EAAE,GAAG,GAAG,EAAE,IAAI;AACpB,UAAM,gBAAgB,MAAM,KAAK,QAAQ,OAAO,GAAG,GAAG,CAAC;AACvD,UAAM,cAAc,+CAAe;AACnC,QAAI,CAAC,aAAa;AAEd,aAAO;AAAA,IACX;AACA,WAAO;AAAA,EACX;AAAA;AAAA;AAAA,EAGA,MAAM,YAAY,YAAY;AAC1B,UAAM,EAAE,GAAG,GAAG,EAAE,IAAI,WAAW;AAC/B,UAAM,WAAW,MAAM,KAAK;AAC5B,YAAQ,SAAS,cAAc;AAAA,MAC3B,KAAK;AACD,eAAO,MAAM,KAAK,cAAc,EAAE,GAAG,GAAG,GAAG,QAAQ,CAAC,EAAE,CAAC;AAAA,MAC3D;AACI,eAAO,MAAM,KAAK,aAAa,EAAE,GAAG,GAAG,GAAG,QAAQ,CAAC,EAAE,CAAC;AAAA,IAC9D;AAAA,EACJ;AAAA;AAAA,EAEA,MAAM,aAAa,YAAY;AAC3B,UAAM,cAAc,MAAM,KAAK,QAAQ,UAAU;AACjD,WAAO,cAAc,MAAM,0BAAY,MAAM,aAAa,KAAK,WAAW,IAAI;AAAA,EAClF;AAAA;AAAA,EAEA,MAAM,cAAc,YAAY;AA5FpC;AA6FQ,UAAM,cAAc,MAAM,KAAK,QAAQ,UAAU;AACjD,UAAM,cAAc;AAAA,MAChB,OAAO;AAAA,MACP,KAAK;AAAA,QACD,aAAa;AAAA,QACb,WAAW,EAAE,GAAG,WAAW,GAAG,GAAG,WAAW,GAAG,GAAG,WAAW,EAAE;AAAA,QAC/D,IAAG,UAAK,gBAAL,mBAAkB;AAAA,MACzB;AAAA,MACA,GAAG,KAAK;AAAA,IACZ;AACA,WAAO,cAAc,MAAM,sBAAU,MAAM,aAAa,WAAW,IAAI;AAAA,EAC3E;AACJ;;;AGtGA,IAAAC,uBAAyB;;;ACGlB,IAAMC,WAAU,OAAyC,kBAAkB;;;ADK3E,IAAM,gBAAgB;AAAA,EACzB,MAAM;AAAA,EACN,IAAI;AAAA,EACJ,QAAQ;AAAA,EACR,SAASC;AAAA,EACT,YAAY,CAAC,SAAS;AAAA,EACtB,WAAW,CAAC,0BAA0B;AAAA,EACtC,OAAO,CAAC,SAAS;AAAA,EACjB,SAAS;AAAA,IACL,SAAS,CAAC;AAAA,EACd;AAAA,EACA,OAAO,OAAO,aAAa,YAAY,mBAAmB,IAAI,8BAAS,IAAI,KAAK,CAAC,WAAW,CAAC,CAAC,GAAG,OAAO;AAAA,EACxG,WAAW;AACf;AACA,eAAe,mBAAmB,MAAM,SAAS;AAC7C,QAAM,SAAS,IAAI,kBAAkB,KAAK,QAAQ;AAAA,IAC9C,UAAS,mCAAS,YAAW,CAAC;AAAA,EAClC,CAAC;AACD,QAAM,yBAAyB,MAAM,OAAO,YAAY;AACxD,QAAM,EAAE,cAAc,WAAW,CAAC,EAAE,IAAI;AACxC,QAAM,EAAE,SAAS,CAAC,EAAE,IAAI;AACxB,UAAQ,cAAc;AAAA,IAClB,KAAK;AACD,aAAO;AAAA,QACH,OAAO;AAAA,QACP,QAAQ,OAAO,IAAI,CAAC,WAAW,EAAE,MAAM,MAAM,MAAM,QAAQ,MAAM,OAAO,EAAE;AAAA,QAC1E,QAAQ,CAAC;AAAA,QACT;AAAA,MACJ;AAAA,IACJ,KAAK;AAAA,IACL,KAAK;AACD,aAAO,EAAE,OAAO,gBAAgB,uBAAuB;AAAA,IAC3D;AACI,YAAM,IAAI,MAAM,6CAA6C,cAAc;AAAA,EACnF;AACJ;",
|
|
6
6
|
"names": ["import_mvt", "pmtiles", "pmtiles", "import_loader_utils", "VERSION", "VERSION"]
|
|
7
7
|
}
|
package/dist/lib/version.js
CHANGED
|
@@ -4,4 +4,4 @@
|
|
|
4
4
|
// Version constant cannot be imported, it needs to correspond to the build version of **this** module.
|
|
5
5
|
// __VERSION__ is injected by babel-plugin-version-inline
|
|
6
6
|
// @ts-ignore TS2304: Cannot find name '__VERSION__'.
|
|
7
|
-
export const VERSION = typeof "4.3.0-alpha.
|
|
7
|
+
export const VERSION = typeof "4.3.0-alpha.8" !== 'undefined' ? "4.3.0-alpha.8" : 'latest';
|
package/dist/pmtiles-source.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type { Schema } from '@loaders.gl/schema';
|
|
2
|
-
import type { VectorTileSource, GetTileParameters, GetTileDataParameters } from '@loaders.gl/loader-utils';
|
|
3
|
-
import type { ImageTileSource, ImageType } from '@loaders.gl/loader-utils';
|
|
2
|
+
import type { VectorTileSource, GetTileParameters, GetTileDataParameters, ImageTileSource, ImageType } from '@loaders.gl/loader-utils';
|
|
4
3
|
import { DataSource, DataSourceProps } from '@loaders.gl/loader-utils';
|
|
5
4
|
import { ImageLoaderOptions } from '@loaders.gl/images';
|
|
6
5
|
import { MVTLoaderOptions, TileJSONLoaderOptions } from '@loaders.gl/mvt';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pmtiles-source.d.ts","sourceRoot":"","sources":["../src/pmtiles-source.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"pmtiles-source.d.ts","sourceRoot":"","sources":["../src/pmtiles-source.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,oBAAoB,CAAC;AAC/C,OAAO,KAAK,EAEV,gBAAgB,EAChB,iBAAiB,EACjB,qBAAqB,EACrB,eAAe,EACf,SAAS,EACV,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAC,UAAU,EAAE,eAAe,EAAc,MAAM,0BAA0B,CAAC;AAClF,OAAO,EAAc,kBAAkB,EAAC,MAAM,oBAAoB,CAAC;AACnE,OAAO,EAAY,gBAAgB,EAAE,qBAAqB,EAAC,MAAM,iBAAiB,CAAC;AAEnF,OAAO,KAAK,OAAO,MAAM,SAAS,CAAC;AAGnC,OAAO,KAAK,EAAC,eAAe,EAAC,+BAA4B;AAMzD;;GAEG;AACH,eAAO,MAAM,aAAa;;;;;;;;;;;;;;4BAYT,MAAM;qCACG,MAAM,GAAG,IAAI,SAAS,sBAAsB;CAEA,CAAC;AAEvE,MAAM,MAAM,sBAAsB,GAAG,eAAe,GAAG;IACrD,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IACxB,OAAO,CAAC,EAAE;QACR,WAAW,CAAC,EAAE,qBAAqB,GAAG,gBAAgB,GAAG,kBAAkB,CAAC;KAE7E,CAAC;CACH,CAAC;AAEF;;;GAGG;AACH,qBAAa,iBAAkB,SAAQ,UAAW,YAAW,eAAe,EAAE,gBAAgB;IAC5F,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,KAAK,EAAE,sBAAsB,CAAC;IAC9B,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAQ;IAC/B,OAAO,EAAE,OAAO,CAAC,OAAO,CAAC;IACzB,QAAQ,EAAE,OAAO,CAAC,eAAe,CAAC,CAAC;gBAEvB,IAAI,EAAE,MAAM,GAAG,IAAI,EAAE,KAAK,EAAE,sBAAsB;IAUxD,SAAS,IAAI,OAAO,CAAC,MAAM,CAAC;IAI5B,WAAW,IAAI,OAAO,CAAC,eAAe,CAAC;IAoBvC,OAAO,CAAC,UAAU,EAAE,iBAAiB,GAAG,OAAO,CAAC,WAAW,GAAG,IAAI,CAAC;IAcnE,WAAW,CAAC,UAAU,EAAE,qBAAqB,GAAG,OAAO,CAAC,GAAG,CAAC;IAa5D,YAAY,CAAC,UAAU,EAAE,iBAAiB,GAAG,OAAO,CAAC,SAAS,GAAG,IAAI,CAAC;IAOtE,aAAa,CAAC,UAAU,EAAE,iBAAiB,GAAG,OAAO,CAAC,OAAO,GAAG,IAAI,CAAC;CAc5E"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@loaders.gl/pmtiles",
|
|
3
|
-
"version": "4.3.0-
|
|
3
|
+
"version": "4.3.0-beta.1",
|
|
4
4
|
"description": "Framework-independent loader for the pmtiles format",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -46,14 +46,14 @@
|
|
|
46
46
|
"build-bundle-dev": "ocular-bundle ./bundle.ts --env=dev --output=dist/dist.dev.js"
|
|
47
47
|
},
|
|
48
48
|
"dependencies": {
|
|
49
|
-
"@loaders.gl/images": "4.3.0-
|
|
50
|
-
"@loaders.gl/loader-utils": "4.3.0-
|
|
51
|
-
"@loaders.gl/mvt": "4.3.0-
|
|
52
|
-
"@loaders.gl/schema": "4.3.0-
|
|
49
|
+
"@loaders.gl/images": "4.3.0-beta.1",
|
|
50
|
+
"@loaders.gl/loader-utils": "4.3.0-beta.1",
|
|
51
|
+
"@loaders.gl/mvt": "4.3.0-beta.1",
|
|
52
|
+
"@loaders.gl/schema": "4.3.0-beta.1",
|
|
53
53
|
"pmtiles": "^3.0.4"
|
|
54
54
|
},
|
|
55
55
|
"peerDependencies": {
|
|
56
56
|
"@loaders.gl/core": "^4.0.0"
|
|
57
57
|
},
|
|
58
|
-
"gitHead": "
|
|
58
|
+
"gitHead": "992d24e7d4e3015a91fa1cbfe87ee7dc1b333322"
|
|
59
59
|
}
|
package/src/pmtiles-source.ts
CHANGED
|
@@ -3,13 +3,14 @@
|
|
|
3
3
|
// Copyright (c) vis.gl contributors
|
|
4
4
|
|
|
5
5
|
import type {Schema} from '@loaders.gl/schema';
|
|
6
|
-
import type {Source} from '@loaders.gl/loader-utils';
|
|
7
6
|
import type {
|
|
7
|
+
Source,
|
|
8
8
|
VectorTileSource,
|
|
9
9
|
GetTileParameters,
|
|
10
|
-
GetTileDataParameters
|
|
10
|
+
GetTileDataParameters,
|
|
11
|
+
ImageTileSource,
|
|
12
|
+
ImageType
|
|
11
13
|
} from '@loaders.gl/loader-utils';
|
|
12
|
-
import type {ImageTileSource, ImageType} from '@loaders.gl/loader-utils';
|
|
13
14
|
import {DataSource, DataSourceProps, resolvePath} from '@loaders.gl/loader-utils';
|
|
14
15
|
import {ImageLoader, ImageLoaderOptions} from '@loaders.gl/images';
|
|
15
16
|
import {MVTLoader, MVTLoaderOptions, TileJSONLoaderOptions} from '@loaders.gl/mvt';
|