@loaders.gl/mvt 4.3.0-alpha.7 → 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 +284 -436
- package/dist/dist.min.js +1 -1
- package/dist/index.cjs +2 -2
- package/dist/index.cjs.map +2 -2
- package/dist/lib/parse-mvt.d.ts +1 -2
- package/dist/lib/parse-mvt.d.ts.map +1 -1
- package/dist/lib/vector-tile/vector-tile-feature.d.ts +1 -2
- package/dist/lib/vector-tile/vector-tile-feature.d.ts.map +1 -1
- package/dist/lib/vector-tile/vector-tile-feature.js +1 -3
- package/dist/lib/vector-tiler/tile-to-geojson.d.ts.map +1 -1
- package/dist/lib/vector-tiler/tile-to-geojson.js +1 -2
- package/dist/mvt-loader.d.ts.map +1 -1
- package/dist/mvt-loader.js +1 -1
- package/dist/mvt-source.d.ts +1 -3
- package/dist/mvt-source.d.ts.map +1 -1
- package/dist/mvt-worker.js +93 -245
- package/dist/table-tile-source.d.ts +1 -1
- package/dist/table-tile-source.d.ts.map +1 -1
- package/dist/tilejson-loader.js +1 -1
- package/package.json +7 -7
- package/src/lib/parse-mvt.ts +7 -2
- package/src/lib/vector-tile/vector-tile-feature.ts +15 -5
- package/src/lib/vector-tile/vector-tile-layer.ts +12 -12
- package/src/lib/vector-tiler/tile-to-geojson.ts +1 -2
- package/src/mvt-source.ts +9 -4
- package/src/table-tile-source.ts +8 -4
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;
|
|
@@ -1216,52 +1216,6 @@ var __exports__ = (() => {
|
|
|
1216
1216
|
};
|
|
1217
1217
|
}
|
|
1218
1218
|
|
|
1219
|
-
// ../../node_modules/@babel/runtime/helpers/esm/typeof.js
|
|
1220
|
-
function _typeof(obj) {
|
|
1221
|
-
"@babel/helpers - typeof";
|
|
1222
|
-
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(obj2) {
|
|
1223
|
-
return typeof obj2;
|
|
1224
|
-
} : function(obj2) {
|
|
1225
|
-
return obj2 && "function" == typeof Symbol && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2;
|
|
1226
|
-
}, _typeof(obj);
|
|
1227
|
-
}
|
|
1228
|
-
|
|
1229
|
-
// ../../node_modules/@babel/runtime/helpers/esm/toPrimitive.js
|
|
1230
|
-
function _toPrimitive(input, hint) {
|
|
1231
|
-
if (_typeof(input) !== "object" || input === null)
|
|
1232
|
-
return input;
|
|
1233
|
-
var prim = input[Symbol.toPrimitive];
|
|
1234
|
-
if (prim !== void 0) {
|
|
1235
|
-
var res = prim.call(input, hint || "default");
|
|
1236
|
-
if (_typeof(res) !== "object")
|
|
1237
|
-
return res;
|
|
1238
|
-
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
1239
|
-
}
|
|
1240
|
-
return (hint === "string" ? String : Number)(input);
|
|
1241
|
-
}
|
|
1242
|
-
|
|
1243
|
-
// ../../node_modules/@babel/runtime/helpers/esm/toPropertyKey.js
|
|
1244
|
-
function _toPropertyKey(arg) {
|
|
1245
|
-
var key = _toPrimitive(arg, "string");
|
|
1246
|
-
return _typeof(key) === "symbol" ? key : String(key);
|
|
1247
|
-
}
|
|
1248
|
-
|
|
1249
|
-
// ../../node_modules/@babel/runtime/helpers/esm/defineProperty.js
|
|
1250
|
-
function _defineProperty(obj, key, value) {
|
|
1251
|
-
key = _toPropertyKey(key);
|
|
1252
|
-
if (key in obj) {
|
|
1253
|
-
Object.defineProperty(obj, key, {
|
|
1254
|
-
value,
|
|
1255
|
-
enumerable: true,
|
|
1256
|
-
configurable: true,
|
|
1257
|
-
writable: true
|
|
1258
|
-
});
|
|
1259
|
-
} else {
|
|
1260
|
-
obj[key] = value;
|
|
1261
|
-
}
|
|
1262
|
-
return obj;
|
|
1263
|
-
}
|
|
1264
|
-
|
|
1265
1219
|
// ../../node_modules/@math.gl/polygon/dist/polygon-utils.js
|
|
1266
1220
|
var DimIndex = {
|
|
1267
1221
|
x: 0,
|
|
@@ -1269,11 +1223,7 @@ var __exports__ = (() => {
|
|
|
1269
1223
|
z: 2
|
|
1270
1224
|
};
|
|
1271
1225
|
function getPolygonSignedArea(points, options = {}) {
|
|
1272
|
-
const {
|
|
1273
|
-
start = 0,
|
|
1274
|
-
end = points.length,
|
|
1275
|
-
plane = "xy"
|
|
1276
|
-
} = options;
|
|
1226
|
+
const { start = 0, end = points.length, plane = "xy" } = options;
|
|
1277
1227
|
const dim = options.size || 2;
|
|
1278
1228
|
let area2 = 0;
|
|
1279
1229
|
const i0 = DimIndex[plane[0]];
|
|
@@ -1327,12 +1277,7 @@ var __exports__ = (() => {
|
|
|
1327
1277
|
let i;
|
|
1328
1278
|
let last;
|
|
1329
1279
|
if (area2 === void 0) {
|
|
1330
|
-
area2 = getPolygonSignedArea(data, {
|
|
1331
|
-
start,
|
|
1332
|
-
end,
|
|
1333
|
-
size: dim,
|
|
1334
|
-
plane
|
|
1335
|
-
});
|
|
1280
|
+
area2 = getPolygonSignedArea(data, { start, end, size: dim, plane });
|
|
1336
1281
|
}
|
|
1337
1282
|
let i0 = DimIndex[plane[0]];
|
|
1338
1283
|
let i1 = DimIndex[plane[1]];
|
|
@@ -1667,7 +1612,10 @@ var __exports__ = (() => {
|
|
|
1667
1612
|
return (cx - px) * (ay - py) >= (ax - px) * (cy - py) && (ax - px) * (by - py) >= (bx - px) * (ay - py) && (bx - px) * (cy - py) >= (cx - px) * (by - py);
|
|
1668
1613
|
}
|
|
1669
1614
|
function isValidDiagonal(a, b) {
|
|
1670
|
-
return a.next.i !== b.i && a.prev.i !== b.i && !intersectsPolygon(a, b) &&
|
|
1615
|
+
return a.next.i !== b.i && a.prev.i !== b.i && !intersectsPolygon(a, b) && // dones't intersect other edges
|
|
1616
|
+
(locallyInside(a, b) && locallyInside(b, a) && middleInside(a, b) && // locally visible
|
|
1617
|
+
(area(a.prev, a, b.prev) || area(a, b.prev, b)) || // does not create opposite-facing sectors
|
|
1618
|
+
equals(a, b) && area(a.prev, a, a.next) > 0 && area(b.prev, b, b.next) > 0);
|
|
1671
1619
|
}
|
|
1672
1620
|
function area(p, q, r) {
|
|
1673
1621
|
return (q.y - p.y) * (r.x - q.x) - (q.x - p.x) * (r.y - q.y);
|
|
@@ -1760,15 +1708,12 @@ var __exports__ = (() => {
|
|
|
1760
1708
|
}
|
|
1761
1709
|
var Vertex = class {
|
|
1762
1710
|
constructor(i, x, y) {
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
_defineProperty(this, "prevZ", null);
|
|
1770
|
-
_defineProperty(this, "nextZ", null);
|
|
1771
|
-
_defineProperty(this, "steiner", false);
|
|
1711
|
+
this.prev = null;
|
|
1712
|
+
this.next = null;
|
|
1713
|
+
this.z = 0;
|
|
1714
|
+
this.prevZ = null;
|
|
1715
|
+
this.nextZ = null;
|
|
1716
|
+
this.steiner = false;
|
|
1772
1717
|
this.i = i;
|
|
1773
1718
|
this.x = x;
|
|
1774
1719
|
this.y = y;
|
|
@@ -2088,39 +2033,37 @@ var __exports__ = (() => {
|
|
|
2088
2033
|
var matches = typeof process !== "undefined" && process.version && /v([0-9]*)/.exec(process.version);
|
|
2089
2034
|
var nodeVersion = matches && parseFloat(matches[1]) || 0;
|
|
2090
2035
|
|
|
2036
|
+
// ../../node_modules/@probe.gl/log/node_modules/@probe.gl/env/dist/lib/globals.js
|
|
2037
|
+
var window_2 = globalThis;
|
|
2038
|
+
var document_2 = globalThis.document || {};
|
|
2039
|
+
var process_ = globalThis.process || {};
|
|
2040
|
+
var console_ = globalThis.console;
|
|
2041
|
+
var navigator_ = globalThis.navigator || {};
|
|
2042
|
+
|
|
2091
2043
|
// ../../node_modules/@probe.gl/log/node_modules/@probe.gl/env/dist/lib/is-electron.js
|
|
2092
2044
|
function isElectron(mockUserAgent) {
|
|
2093
|
-
if (typeof window !== "undefined" &&
|
|
2045
|
+
if (typeof window !== "undefined" && window.process?.type === "renderer") {
|
|
2094
2046
|
return true;
|
|
2095
2047
|
}
|
|
2096
|
-
if (typeof process !== "undefined" &&
|
|
2048
|
+
if (typeof process !== "undefined" && Boolean(process.versions?.["electron"])) {
|
|
2097
2049
|
return true;
|
|
2098
2050
|
}
|
|
2099
|
-
const realUserAgent = typeof navigator
|
|
2051
|
+
const realUserAgent = typeof navigator !== "undefined" && navigator.userAgent;
|
|
2100
2052
|
const userAgent = mockUserAgent || realUserAgent;
|
|
2101
|
-
|
|
2102
|
-
return true;
|
|
2103
|
-
}
|
|
2104
|
-
return false;
|
|
2053
|
+
return Boolean(userAgent && userAgent.indexOf("Electron") >= 0);
|
|
2105
2054
|
}
|
|
2106
2055
|
|
|
2107
2056
|
// ../../node_modules/@probe.gl/log/node_modules/@probe.gl/env/dist/lib/is-browser.js
|
|
2108
2057
|
function isBrowser2() {
|
|
2109
|
-
const isNode =
|
|
2058
|
+
const isNode = (
|
|
2059
|
+
// @ts-expect-error
|
|
2060
|
+
typeof process === "object" && String(process) === "[object process]" && !process?.browser
|
|
2061
|
+
);
|
|
2110
2062
|
return !isNode || isElectron();
|
|
2111
2063
|
}
|
|
2112
2064
|
|
|
2113
|
-
// ../../node_modules/@probe.gl/log/node_modules/@probe.gl/env/dist/
|
|
2114
|
-
var
|
|
2115
|
-
var window_2 = globalThis.window || globalThis.self || globalThis.global;
|
|
2116
|
-
var document_2 = globalThis.document || {};
|
|
2117
|
-
var process_ = globalThis.process || {};
|
|
2118
|
-
var console_ = globalThis.console;
|
|
2119
|
-
var navigator_ = globalThis.navigator || {};
|
|
2120
|
-
|
|
2121
|
-
// ../../node_modules/@probe.gl/log/node_modules/@probe.gl/env/dist/utils/globals.js
|
|
2122
|
-
var VERSION2 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "untranspiled source";
|
|
2123
|
-
var isBrowser3 = isBrowser2();
|
|
2065
|
+
// ../../node_modules/@probe.gl/log/node_modules/@probe.gl/env/dist/index.js
|
|
2066
|
+
var VERSION2 = true ? "4.0.7" : "untranspiled source";
|
|
2124
2067
|
|
|
2125
2068
|
// ../../node_modules/@probe.gl/log/dist/utils/local-storage.js
|
|
2126
2069
|
function getStorage(type) {
|
|
@@ -2135,11 +2078,7 @@ var __exports__ = (() => {
|
|
|
2135
2078
|
}
|
|
2136
2079
|
}
|
|
2137
2080
|
var LocalStorage = class {
|
|
2138
|
-
constructor(id, defaultConfig) {
|
|
2139
|
-
let type = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : "sessionStorage";
|
|
2140
|
-
_defineProperty(this, "storage", void 0);
|
|
2141
|
-
_defineProperty(this, "id", void 0);
|
|
2142
|
-
_defineProperty(this, "config", void 0);
|
|
2081
|
+
constructor(id, defaultConfig, type = "sessionStorage") {
|
|
2143
2082
|
this.storage = getStorage(type);
|
|
2144
2083
|
this.id = id;
|
|
2145
2084
|
this.config = defaultConfig;
|
|
@@ -2155,6 +2094,7 @@ var __exports__ = (() => {
|
|
|
2155
2094
|
this.storage.setItem(this.id, serialized);
|
|
2156
2095
|
}
|
|
2157
2096
|
}
|
|
2097
|
+
// Get config from persistent store, if available
|
|
2158
2098
|
_loadConfiguration() {
|
|
2159
2099
|
let configuration = {};
|
|
2160
2100
|
if (this.storage) {
|
|
@@ -2170,31 +2110,19 @@ var __exports__ = (() => {
|
|
|
2170
2110
|
function formatTime(ms) {
|
|
2171
2111
|
let formatted;
|
|
2172
2112
|
if (ms < 10) {
|
|
2173
|
-
formatted =
|
|
2113
|
+
formatted = `${ms.toFixed(2)}ms`;
|
|
2174
2114
|
} else if (ms < 100) {
|
|
2175
|
-
formatted =
|
|
2115
|
+
formatted = `${ms.toFixed(1)}ms`;
|
|
2176
2116
|
} else if (ms < 1e3) {
|
|
2177
|
-
formatted =
|
|
2117
|
+
formatted = `${ms.toFixed(0)}ms`;
|
|
2178
2118
|
} else {
|
|
2179
|
-
formatted =
|
|
2119
|
+
formatted = `${(ms / 1e3).toFixed(2)}s`;
|
|
2180
2120
|
}
|
|
2181
2121
|
return formatted;
|
|
2182
2122
|
}
|
|
2183
|
-
function leftPad(string) {
|
|
2184
|
-
let length = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 8;
|
|
2123
|
+
function leftPad(string, length = 8) {
|
|
2185
2124
|
const padLength = Math.max(length - string.length, 0);
|
|
2186
|
-
return "
|
|
2187
|
-
}
|
|
2188
|
-
function formatImage(image, message, scale) {
|
|
2189
|
-
let maxWidth = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : 600;
|
|
2190
|
-
const imageUrl = image.src.replace(/\(/g, "%28").replace(/\)/g, "%29");
|
|
2191
|
-
if (image.width > maxWidth) {
|
|
2192
|
-
scale = Math.min(scale, maxWidth / image.width);
|
|
2193
|
-
}
|
|
2194
|
-
const width = image.width * scale;
|
|
2195
|
-
const height = image.height * scale;
|
|
2196
|
-
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("");
|
|
2197
|
-
return ["".concat(message, " %c+"), style];
|
|
2125
|
+
return `${" ".repeat(padLength)}${string}`;
|
|
2198
2126
|
}
|
|
2199
2127
|
|
|
2200
2128
|
// ../../node_modules/@probe.gl/log/dist/utils/color.js
|
|
@@ -2229,19 +2157,18 @@ var __exports__ = (() => {
|
|
|
2229
2157
|
if (!isBrowser2 && typeof string === "string") {
|
|
2230
2158
|
if (color) {
|
|
2231
2159
|
const colorCode = getColor(color);
|
|
2232
|
-
string =
|
|
2160
|
+
string = `\x1B[${colorCode}m${string}\x1B[39m`;
|
|
2233
2161
|
}
|
|
2234
2162
|
if (background) {
|
|
2235
2163
|
const colorCode = getColor(background);
|
|
2236
|
-
string =
|
|
2164
|
+
string = `\x1B[${colorCode + BACKGROUND_INCREMENT}m${string}\x1B[49m`;
|
|
2237
2165
|
}
|
|
2238
2166
|
}
|
|
2239
2167
|
return string;
|
|
2240
2168
|
}
|
|
2241
2169
|
|
|
2242
2170
|
// ../../node_modules/@probe.gl/log/dist/utils/autobind.js
|
|
2243
|
-
function autobind(obj) {
|
|
2244
|
-
let predefined = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : ["constructor"];
|
|
2171
|
+
function autobind(obj, predefined = ["constructor"]) {
|
|
2245
2172
|
const proto = Object.getPrototypeOf(obj);
|
|
2246
2173
|
const propNames = Object.getOwnPropertyNames(proto);
|
|
2247
2174
|
const object = obj;
|
|
@@ -2266,11 +2193,9 @@ var __exports__ = (() => {
|
|
|
2266
2193
|
function getHiResTimestamp() {
|
|
2267
2194
|
let timestamp;
|
|
2268
2195
|
if (isBrowser2() && window_2.performance) {
|
|
2269
|
-
|
|
2270
|
-
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);
|
|
2196
|
+
timestamp = window_2?.performance?.now?.();
|
|
2271
2197
|
} else if ("hrtime" in process_) {
|
|
2272
|
-
|
|
2273
|
-
const timeParts = process_ === null || process_ === void 0 ? void 0 : (_process$hrtime = process_.hrtime) === null || _process$hrtime === void 0 ? void 0 : _process$hrtime.call(process_);
|
|
2198
|
+
const timeParts = process_?.hrtime?.();
|
|
2274
2199
|
timestamp = timeParts[0] * 1e3 + timeParts[1] / 1e6;
|
|
2275
2200
|
} else {
|
|
2276
2201
|
timestamp = Date.now();
|
|
@@ -2293,27 +2218,18 @@ var __exports__ = (() => {
|
|
|
2293
2218
|
function noop() {
|
|
2294
2219
|
}
|
|
2295
2220
|
var cache = {};
|
|
2296
|
-
var ONCE = {
|
|
2297
|
-
once: true
|
|
2298
|
-
};
|
|
2221
|
+
var ONCE = { once: true };
|
|
2299
2222
|
var Log = class {
|
|
2300
|
-
constructor() {
|
|
2301
|
-
|
|
2302
|
-
|
|
2303
|
-
|
|
2304
|
-
|
|
2305
|
-
|
|
2306
|
-
_defineProperty(this, "id", void 0);
|
|
2307
|
-
_defineProperty(this, "VERSION", VERSION2);
|
|
2308
|
-
_defineProperty(this, "_startTs", getHiResTimestamp());
|
|
2309
|
-
_defineProperty(this, "_deltaTs", getHiResTimestamp());
|
|
2310
|
-
_defineProperty(this, "_storage", void 0);
|
|
2311
|
-
_defineProperty(this, "userData", {});
|
|
2312
|
-
_defineProperty(this, "LOG_THROTTLE_TIMEOUT", 0);
|
|
2223
|
+
constructor({ id } = { id: "" }) {
|
|
2224
|
+
this.VERSION = VERSION2;
|
|
2225
|
+
this._startTs = getHiResTimestamp();
|
|
2226
|
+
this._deltaTs = getHiResTimestamp();
|
|
2227
|
+
this.userData = {};
|
|
2228
|
+
this.LOG_THROTTLE_TIMEOUT = 0;
|
|
2313
2229
|
this.id = id;
|
|
2314
2230
|
this.userData = {};
|
|
2315
|
-
this._storage = new LocalStorage(
|
|
2316
|
-
this.timeStamp(
|
|
2231
|
+
this._storage = new LocalStorage(`__probe-${this.id}__`, DEFAULT_LOG_CONFIGURATION);
|
|
2232
|
+
this.timeStamp(`${this.id} started`);
|
|
2317
2233
|
autobind(this);
|
|
2318
2234
|
Object.seal(this);
|
|
2319
2235
|
}
|
|
@@ -2329,42 +2245,44 @@ var __exports__ = (() => {
|
|
|
2329
2245
|
getLevel() {
|
|
2330
2246
|
return this._storage.config.level;
|
|
2331
2247
|
}
|
|
2248
|
+
/** @return milliseconds, with fractions */
|
|
2332
2249
|
getTotal() {
|
|
2333
2250
|
return Number((getHiResTimestamp() - this._startTs).toPrecision(10));
|
|
2334
2251
|
}
|
|
2252
|
+
/** @return milliseconds, with fractions */
|
|
2335
2253
|
getDelta() {
|
|
2336
2254
|
return Number((getHiResTimestamp() - this._deltaTs).toPrecision(10));
|
|
2337
2255
|
}
|
|
2256
|
+
/** @deprecated use logLevel */
|
|
2338
2257
|
set priority(newPriority) {
|
|
2339
2258
|
this.level = newPriority;
|
|
2340
2259
|
}
|
|
2260
|
+
/** @deprecated use logLevel */
|
|
2341
2261
|
get priority() {
|
|
2342
2262
|
return this.level;
|
|
2343
2263
|
}
|
|
2264
|
+
/** @deprecated use logLevel */
|
|
2344
2265
|
getPriority() {
|
|
2345
2266
|
return this.level;
|
|
2346
2267
|
}
|
|
2347
|
-
|
|
2348
|
-
|
|
2349
|
-
this._storage.setConfiguration({
|
|
2350
|
-
enabled
|
|
2351
|
-
});
|
|
2268
|
+
// Configure
|
|
2269
|
+
enable(enabled = true) {
|
|
2270
|
+
this._storage.setConfiguration({ enabled });
|
|
2352
2271
|
return this;
|
|
2353
2272
|
}
|
|
2354
2273
|
setLevel(level) {
|
|
2355
|
-
this._storage.setConfiguration({
|
|
2356
|
-
level
|
|
2357
|
-
});
|
|
2274
|
+
this._storage.setConfiguration({ level });
|
|
2358
2275
|
return this;
|
|
2359
2276
|
}
|
|
2277
|
+
/** return the current status of the setting */
|
|
2360
2278
|
get(setting) {
|
|
2361
2279
|
return this._storage.config[setting];
|
|
2362
2280
|
}
|
|
2281
|
+
// update the status of the setting
|
|
2363
2282
|
set(setting, value) {
|
|
2364
|
-
this._storage.setConfiguration({
|
|
2365
|
-
[setting]: value
|
|
2366
|
-
});
|
|
2283
|
+
this._storage.setConfiguration({ [setting]: value });
|
|
2367
2284
|
}
|
|
2285
|
+
/** Logs the current settings as a table */
|
|
2368
2286
|
settings() {
|
|
2369
2287
|
if (console.table) {
|
|
2370
2288
|
console.table(this._storage.config);
|
|
@@ -2372,8 +2290,11 @@ var __exports__ = (() => {
|
|
|
2372
2290
|
console.log(this._storage.config);
|
|
2373
2291
|
}
|
|
2374
2292
|
}
|
|
2293
|
+
// Unconditional logging
|
|
2375
2294
|
assert(condition, message) {
|
|
2376
|
-
|
|
2295
|
+
if (!condition) {
|
|
2296
|
+
throw new Error(message || "Assertion failed");
|
|
2297
|
+
}
|
|
2377
2298
|
}
|
|
2378
2299
|
warn(message) {
|
|
2379
2300
|
return this._getLogFunction(0, message, originalConsole.warn, arguments, ONCE);
|
|
@@ -2381,11 +2302,13 @@ var __exports__ = (() => {
|
|
|
2381
2302
|
error(message) {
|
|
2382
2303
|
return this._getLogFunction(0, message, originalConsole.error, arguments);
|
|
2383
2304
|
}
|
|
2305
|
+
/** Print a deprecation warning */
|
|
2384
2306
|
deprecated(oldUsage, newUsage) {
|
|
2385
|
-
return this.warn(
|
|
2307
|
+
return this.warn(`\`${oldUsage}\` is deprecated and will be removed in a later version. Use \`${newUsage}\` instead`);
|
|
2386
2308
|
}
|
|
2309
|
+
/** Print a removal warning */
|
|
2387
2310
|
removed(oldUsage, newUsage) {
|
|
2388
|
-
return this.error(
|
|
2311
|
+
return this.error(`\`${oldUsage}\` has been removed. Use \`${newUsage}\` instead`);
|
|
2389
2312
|
}
|
|
2390
2313
|
probe(logLevel, message) {
|
|
2391
2314
|
return this._getLogFunction(logLevel, message, originalConsole.log, arguments, {
|
|
@@ -2402,6 +2325,7 @@ var __exports__ = (() => {
|
|
|
2402
2325
|
once(logLevel, message) {
|
|
2403
2326
|
return this._getLogFunction(logLevel, message, originalConsole.debug || originalConsole.info, arguments, ONCE);
|
|
2404
2327
|
}
|
|
2328
|
+
/** Logs an object as a table */
|
|
2405
2329
|
table(logLevel, table, columns) {
|
|
2406
2330
|
if (table) {
|
|
2407
2331
|
return this._getLogFunction(logLevel, table, console.table || noop, columns && [columns], {
|
|
@@ -2410,27 +2334,6 @@ var __exports__ = (() => {
|
|
|
2410
2334
|
}
|
|
2411
2335
|
return noop;
|
|
2412
2336
|
}
|
|
2413
|
-
image(_ref) {
|
|
2414
|
-
let {
|
|
2415
|
-
logLevel,
|
|
2416
|
-
priority,
|
|
2417
|
-
image,
|
|
2418
|
-
message = "",
|
|
2419
|
-
scale = 1
|
|
2420
|
-
} = _ref;
|
|
2421
|
-
if (!this._shouldLog(logLevel || priority)) {
|
|
2422
|
-
return noop;
|
|
2423
|
-
}
|
|
2424
|
-
return isBrowser2() ? logImageInBrowser({
|
|
2425
|
-
image,
|
|
2426
|
-
message,
|
|
2427
|
-
scale
|
|
2428
|
-
}) : logImageInNode({
|
|
2429
|
-
image,
|
|
2430
|
-
message,
|
|
2431
|
-
scale
|
|
2432
|
-
});
|
|
2433
|
-
}
|
|
2434
2337
|
time(logLevel, message) {
|
|
2435
2338
|
return this._getLogFunction(logLevel, message, console.time ? console.time : console.info);
|
|
2436
2339
|
}
|
|
@@ -2440,30 +2343,19 @@ var __exports__ = (() => {
|
|
|
2440
2343
|
timeStamp(logLevel, message) {
|
|
2441
2344
|
return this._getLogFunction(logLevel, message, console.timeStamp || noop);
|
|
2442
2345
|
}
|
|
2443
|
-
group(logLevel, message) {
|
|
2444
|
-
|
|
2445
|
-
|
|
2446
|
-
};
|
|
2447
|
-
const options = normalizeArguments({
|
|
2448
|
-
logLevel,
|
|
2449
|
-
message,
|
|
2450
|
-
opts
|
|
2451
|
-
});
|
|
2452
|
-
const {
|
|
2453
|
-
collapsed
|
|
2454
|
-
} = opts;
|
|
2346
|
+
group(logLevel, message, opts = { collapsed: false }) {
|
|
2347
|
+
const options = normalizeArguments({ logLevel, message, opts });
|
|
2348
|
+
const { collapsed } = opts;
|
|
2455
2349
|
options.method = (collapsed ? console.groupCollapsed : console.group) || console.info;
|
|
2456
2350
|
return this._getLogFunction(options);
|
|
2457
2351
|
}
|
|
2458
|
-
groupCollapsed(logLevel, message) {
|
|
2459
|
-
|
|
2460
|
-
return this.group(logLevel, message, Object.assign({}, opts, {
|
|
2461
|
-
collapsed: true
|
|
2462
|
-
}));
|
|
2352
|
+
groupCollapsed(logLevel, message, opts = {}) {
|
|
2353
|
+
return this.group(logLevel, message, Object.assign({}, opts, { collapsed: true }));
|
|
2463
2354
|
}
|
|
2464
2355
|
groupEnd(logLevel) {
|
|
2465
2356
|
return this._getLogFunction(logLevel, "", console.groupEnd || noop);
|
|
2466
2357
|
}
|
|
2358
|
+
// EXPERIMENTAL
|
|
2467
2359
|
withGroup(logLevel, message, func) {
|
|
2468
2360
|
this.group(logLevel, message)();
|
|
2469
2361
|
try {
|
|
@@ -2477,17 +2369,14 @@ var __exports__ = (() => {
|
|
|
2477
2369
|
console.trace();
|
|
2478
2370
|
}
|
|
2479
2371
|
}
|
|
2372
|
+
// PRIVATE METHODS
|
|
2373
|
+
/** Deduces log level from a variety of arguments */
|
|
2480
2374
|
_shouldLog(logLevel) {
|
|
2481
2375
|
return this.isEnabled() && this.getLevel() >= normalizeLogLevel(logLevel);
|
|
2482
2376
|
}
|
|
2483
2377
|
_getLogFunction(logLevel, message, method, args, opts) {
|
|
2484
2378
|
if (this._shouldLog(logLevel)) {
|
|
2485
|
-
opts = normalizeArguments({
|
|
2486
|
-
logLevel,
|
|
2487
|
-
message,
|
|
2488
|
-
args,
|
|
2489
|
-
opts
|
|
2490
|
-
});
|
|
2379
|
+
opts = normalizeArguments({ logLevel, message, args, opts });
|
|
2491
2380
|
method = method || opts.method;
|
|
2492
2381
|
assert2(method);
|
|
2493
2382
|
opts.total = this.getTotal();
|
|
@@ -2507,7 +2396,7 @@ var __exports__ = (() => {
|
|
|
2507
2396
|
return noop;
|
|
2508
2397
|
}
|
|
2509
2398
|
};
|
|
2510
|
-
|
|
2399
|
+
Log.VERSION = VERSION2;
|
|
2511
2400
|
function normalizeLogLevel(logLevel) {
|
|
2512
2401
|
if (!logLevel) {
|
|
2513
2402
|
return 0;
|
|
@@ -2527,10 +2416,7 @@ var __exports__ = (() => {
|
|
|
2527
2416
|
return resolvedLevel;
|
|
2528
2417
|
}
|
|
2529
2418
|
function normalizeArguments(opts) {
|
|
2530
|
-
const {
|
|
2531
|
-
logLevel,
|
|
2532
|
-
message
|
|
2533
|
-
} = opts;
|
|
2419
|
+
const { logLevel, message } = opts;
|
|
2534
2420
|
opts.logLevel = normalizeLogLevel(logLevel);
|
|
2535
2421
|
const args = opts.args ? Array.from(opts.args) : [];
|
|
2536
2422
|
while (args.length && args.shift() !== message) {
|
|
@@ -2553,55 +2439,16 @@ var __exports__ = (() => {
|
|
|
2553
2439
|
}
|
|
2554
2440
|
const messageType = typeof opts.message;
|
|
2555
2441
|
assert2(messageType === "string" || messageType === "object");
|
|
2556
|
-
return Object.assign(opts, {
|
|
2557
|
-
args
|
|
2558
|
-
}, opts.opts);
|
|
2442
|
+
return Object.assign(opts, { args }, opts.opts);
|
|
2559
2443
|
}
|
|
2560
2444
|
function decorateMessage(id, message, opts) {
|
|
2561
2445
|
if (typeof message === "string") {
|
|
2562
2446
|
const time = opts.time ? leftPad(formatTime(opts.total)) : "";
|
|
2563
|
-
message = opts.time ?
|
|
2447
|
+
message = opts.time ? `${id}: ${time} ${message}` : `${id}: ${message}`;
|
|
2564
2448
|
message = addColor(message, opts.color, opts.background);
|
|
2565
2449
|
}
|
|
2566
2450
|
return message;
|
|
2567
2451
|
}
|
|
2568
|
-
function logImageInNode(_ref2) {
|
|
2569
|
-
let {
|
|
2570
|
-
image,
|
|
2571
|
-
message = "",
|
|
2572
|
-
scale = 1
|
|
2573
|
-
} = _ref2;
|
|
2574
|
-
console.warn("removed");
|
|
2575
|
-
return noop;
|
|
2576
|
-
}
|
|
2577
|
-
function logImageInBrowser(_ref3) {
|
|
2578
|
-
let {
|
|
2579
|
-
image,
|
|
2580
|
-
message = "",
|
|
2581
|
-
scale = 1
|
|
2582
|
-
} = _ref3;
|
|
2583
|
-
if (typeof image === "string") {
|
|
2584
|
-
const img = new Image();
|
|
2585
|
-
img.onload = () => {
|
|
2586
|
-
const args = formatImage(img, message, scale);
|
|
2587
|
-
console.log(...args);
|
|
2588
|
-
};
|
|
2589
|
-
img.src = image;
|
|
2590
|
-
return noop;
|
|
2591
|
-
}
|
|
2592
|
-
const element = image.nodeName || "";
|
|
2593
|
-
if (element.toLowerCase() === "img") {
|
|
2594
|
-
console.log(...formatImage(image, message, scale));
|
|
2595
|
-
return noop;
|
|
2596
|
-
}
|
|
2597
|
-
if (element.toLowerCase() === "canvas") {
|
|
2598
|
-
const img = new Image();
|
|
2599
|
-
img.onload = () => console.log(...formatImage(img, message, scale));
|
|
2600
|
-
img.src = image.toDataURL();
|
|
2601
|
-
return noop;
|
|
2602
|
-
}
|
|
2603
|
-
return noop;
|
|
2604
|
-
}
|
|
2605
2452
|
function getTableHeader(table) {
|
|
2606
2453
|
for (const key in table) {
|
|
2607
2454
|
for (const title in table[key]) {
|
|
@@ -2611,10 +2458,11 @@ var __exports__ = (() => {
|
|
|
2611
2458
|
return "empty";
|
|
2612
2459
|
}
|
|
2613
2460
|
|
|
2461
|
+
// ../../node_modules/@probe.gl/log/dist/init.js
|
|
2462
|
+
globalThis.probe = {};
|
|
2463
|
+
|
|
2614
2464
|
// ../../node_modules/@probe.gl/log/dist/index.js
|
|
2615
|
-
var dist_default = new Log({
|
|
2616
|
-
id: "@probe.gl/log"
|
|
2617
|
-
});
|
|
2465
|
+
var dist_default = new Log({ id: "@probe.gl/log" });
|
|
2618
2466
|
|
|
2619
2467
|
// ../loader-utils/src/lib/log-utils/log.ts
|
|
2620
2468
|
var VERSION3 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "latest";
|
|
@@ -2630,6 +2478,199 @@ var __exports__ = (() => {
|
|
|
2630
2478
|
}
|
|
2631
2479
|
var log = createLog();
|
|
2632
2480
|
|
|
2481
|
+
// ../../node_modules/@probe.gl/stats/dist/utils/hi-res-timestamp.js
|
|
2482
|
+
function getHiResTimestamp2() {
|
|
2483
|
+
let timestamp;
|
|
2484
|
+
if (typeof window !== "undefined" && window.performance) {
|
|
2485
|
+
timestamp = window.performance.now();
|
|
2486
|
+
} else if (typeof process !== "undefined" && process.hrtime) {
|
|
2487
|
+
const timeParts = process.hrtime();
|
|
2488
|
+
timestamp = timeParts[0] * 1e3 + timeParts[1] / 1e6;
|
|
2489
|
+
} else {
|
|
2490
|
+
timestamp = Date.now();
|
|
2491
|
+
}
|
|
2492
|
+
return timestamp;
|
|
2493
|
+
}
|
|
2494
|
+
|
|
2495
|
+
// ../../node_modules/@probe.gl/stats/dist/lib/stat.js
|
|
2496
|
+
var Stat = class {
|
|
2497
|
+
constructor(name, type) {
|
|
2498
|
+
this.sampleSize = 1;
|
|
2499
|
+
this.time = 0;
|
|
2500
|
+
this.count = 0;
|
|
2501
|
+
this.samples = 0;
|
|
2502
|
+
this.lastTiming = 0;
|
|
2503
|
+
this.lastSampleTime = 0;
|
|
2504
|
+
this.lastSampleCount = 0;
|
|
2505
|
+
this._count = 0;
|
|
2506
|
+
this._time = 0;
|
|
2507
|
+
this._samples = 0;
|
|
2508
|
+
this._startTime = 0;
|
|
2509
|
+
this._timerPending = false;
|
|
2510
|
+
this.name = name;
|
|
2511
|
+
this.type = type;
|
|
2512
|
+
this.reset();
|
|
2513
|
+
}
|
|
2514
|
+
reset() {
|
|
2515
|
+
this.time = 0;
|
|
2516
|
+
this.count = 0;
|
|
2517
|
+
this.samples = 0;
|
|
2518
|
+
this.lastTiming = 0;
|
|
2519
|
+
this.lastSampleTime = 0;
|
|
2520
|
+
this.lastSampleCount = 0;
|
|
2521
|
+
this._count = 0;
|
|
2522
|
+
this._time = 0;
|
|
2523
|
+
this._samples = 0;
|
|
2524
|
+
this._startTime = 0;
|
|
2525
|
+
this._timerPending = false;
|
|
2526
|
+
return this;
|
|
2527
|
+
}
|
|
2528
|
+
setSampleSize(samples) {
|
|
2529
|
+
this.sampleSize = samples;
|
|
2530
|
+
return this;
|
|
2531
|
+
}
|
|
2532
|
+
/** Call to increment count (+1) */
|
|
2533
|
+
incrementCount() {
|
|
2534
|
+
this.addCount(1);
|
|
2535
|
+
return this;
|
|
2536
|
+
}
|
|
2537
|
+
/** Call to decrement count (-1) */
|
|
2538
|
+
decrementCount() {
|
|
2539
|
+
this.subtractCount(1);
|
|
2540
|
+
return this;
|
|
2541
|
+
}
|
|
2542
|
+
/** Increase count */
|
|
2543
|
+
addCount(value) {
|
|
2544
|
+
this._count += value;
|
|
2545
|
+
this._samples++;
|
|
2546
|
+
this._checkSampling();
|
|
2547
|
+
return this;
|
|
2548
|
+
}
|
|
2549
|
+
/** Decrease count */
|
|
2550
|
+
subtractCount(value) {
|
|
2551
|
+
this._count -= value;
|
|
2552
|
+
this._samples++;
|
|
2553
|
+
this._checkSampling();
|
|
2554
|
+
return this;
|
|
2555
|
+
}
|
|
2556
|
+
/** Add an arbitrary timing and bump the count */
|
|
2557
|
+
addTime(time) {
|
|
2558
|
+
this._time += time;
|
|
2559
|
+
this.lastTiming = time;
|
|
2560
|
+
this._samples++;
|
|
2561
|
+
this._checkSampling();
|
|
2562
|
+
return this;
|
|
2563
|
+
}
|
|
2564
|
+
/** Start a timer */
|
|
2565
|
+
timeStart() {
|
|
2566
|
+
this._startTime = getHiResTimestamp2();
|
|
2567
|
+
this._timerPending = true;
|
|
2568
|
+
return this;
|
|
2569
|
+
}
|
|
2570
|
+
/** End a timer. Adds to time and bumps the timing count. */
|
|
2571
|
+
timeEnd() {
|
|
2572
|
+
if (!this._timerPending) {
|
|
2573
|
+
return this;
|
|
2574
|
+
}
|
|
2575
|
+
this.addTime(getHiResTimestamp2() - this._startTime);
|
|
2576
|
+
this._timerPending = false;
|
|
2577
|
+
this._checkSampling();
|
|
2578
|
+
return this;
|
|
2579
|
+
}
|
|
2580
|
+
getSampleAverageCount() {
|
|
2581
|
+
return this.sampleSize > 0 ? this.lastSampleCount / this.sampleSize : 0;
|
|
2582
|
+
}
|
|
2583
|
+
/** Calculate average time / count for the previous window */
|
|
2584
|
+
getSampleAverageTime() {
|
|
2585
|
+
return this.sampleSize > 0 ? this.lastSampleTime / this.sampleSize : 0;
|
|
2586
|
+
}
|
|
2587
|
+
/** Calculate counts per second for the previous window */
|
|
2588
|
+
getSampleHz() {
|
|
2589
|
+
return this.lastSampleTime > 0 ? this.sampleSize / (this.lastSampleTime / 1e3) : 0;
|
|
2590
|
+
}
|
|
2591
|
+
getAverageCount() {
|
|
2592
|
+
return this.samples > 0 ? this.count / this.samples : 0;
|
|
2593
|
+
}
|
|
2594
|
+
/** Calculate average time / count */
|
|
2595
|
+
getAverageTime() {
|
|
2596
|
+
return this.samples > 0 ? this.time / this.samples : 0;
|
|
2597
|
+
}
|
|
2598
|
+
/** Calculate counts per second */
|
|
2599
|
+
getHz() {
|
|
2600
|
+
return this.time > 0 ? this.samples / (this.time / 1e3) : 0;
|
|
2601
|
+
}
|
|
2602
|
+
_checkSampling() {
|
|
2603
|
+
if (this._samples === this.sampleSize) {
|
|
2604
|
+
this.lastSampleTime = this._time;
|
|
2605
|
+
this.lastSampleCount = this._count;
|
|
2606
|
+
this.count += this._count;
|
|
2607
|
+
this.time += this._time;
|
|
2608
|
+
this.samples += this._samples;
|
|
2609
|
+
this._time = 0;
|
|
2610
|
+
this._count = 0;
|
|
2611
|
+
this._samples = 0;
|
|
2612
|
+
}
|
|
2613
|
+
}
|
|
2614
|
+
};
|
|
2615
|
+
|
|
2616
|
+
// ../../node_modules/@probe.gl/stats/dist/lib/stats.js
|
|
2617
|
+
var Stats = class {
|
|
2618
|
+
constructor(options) {
|
|
2619
|
+
this.stats = {};
|
|
2620
|
+
this.id = options.id;
|
|
2621
|
+
this.stats = {};
|
|
2622
|
+
this._initializeStats(options.stats);
|
|
2623
|
+
Object.seal(this);
|
|
2624
|
+
}
|
|
2625
|
+
/** Acquire a stat. Create if it doesn't exist. */
|
|
2626
|
+
get(name, type = "count") {
|
|
2627
|
+
return this._getOrCreate({ name, type });
|
|
2628
|
+
}
|
|
2629
|
+
get size() {
|
|
2630
|
+
return Object.keys(this.stats).length;
|
|
2631
|
+
}
|
|
2632
|
+
/** Reset all stats */
|
|
2633
|
+
reset() {
|
|
2634
|
+
for (const stat of Object.values(this.stats)) {
|
|
2635
|
+
stat.reset();
|
|
2636
|
+
}
|
|
2637
|
+
return this;
|
|
2638
|
+
}
|
|
2639
|
+
forEach(fn) {
|
|
2640
|
+
for (const stat of Object.values(this.stats)) {
|
|
2641
|
+
fn(stat);
|
|
2642
|
+
}
|
|
2643
|
+
}
|
|
2644
|
+
getTable() {
|
|
2645
|
+
const table = {};
|
|
2646
|
+
this.forEach((stat) => {
|
|
2647
|
+
table[stat.name] = {
|
|
2648
|
+
time: stat.time || 0,
|
|
2649
|
+
count: stat.count || 0,
|
|
2650
|
+
average: stat.getAverageTime() || 0,
|
|
2651
|
+
hz: stat.getHz() || 0
|
|
2652
|
+
};
|
|
2653
|
+
});
|
|
2654
|
+
return table;
|
|
2655
|
+
}
|
|
2656
|
+
_initializeStats(stats = []) {
|
|
2657
|
+
stats.forEach((stat) => this._getOrCreate(stat));
|
|
2658
|
+
}
|
|
2659
|
+
_getOrCreate(stat) {
|
|
2660
|
+
const { name, type } = stat;
|
|
2661
|
+
let result = this.stats[name];
|
|
2662
|
+
if (!result) {
|
|
2663
|
+
if (stat instanceof Stat) {
|
|
2664
|
+
result = stat;
|
|
2665
|
+
} else {
|
|
2666
|
+
result = new Stat(name, type);
|
|
2667
|
+
}
|
|
2668
|
+
this.stats[name] = result;
|
|
2669
|
+
}
|
|
2670
|
+
return result;
|
|
2671
|
+
}
|
|
2672
|
+
};
|
|
2673
|
+
|
|
2633
2674
|
// ../loader-utils/src/lib/path-utils/file-aliases.ts
|
|
2634
2675
|
var pathPrefix = "";
|
|
2635
2676
|
var fileAliases = {};
|
|
@@ -3952,199 +3993,6 @@ var __exports__ = (() => {
|
|
|
3952
3993
|
return Math.abs(s.split("").reduce((a, b) => (a << 5) - a + b.charCodeAt(0) | 0, 0));
|
|
3953
3994
|
}
|
|
3954
3995
|
|
|
3955
|
-
// node_modules/@probe.gl/stats/dist/utils/hi-res-timestamp.js
|
|
3956
|
-
function getHiResTimestamp2() {
|
|
3957
|
-
let timestamp;
|
|
3958
|
-
if (typeof window !== "undefined" && window.performance) {
|
|
3959
|
-
timestamp = window.performance.now();
|
|
3960
|
-
} else if (typeof process !== "undefined" && process.hrtime) {
|
|
3961
|
-
const timeParts = process.hrtime();
|
|
3962
|
-
timestamp = timeParts[0] * 1e3 + timeParts[1] / 1e6;
|
|
3963
|
-
} else {
|
|
3964
|
-
timestamp = Date.now();
|
|
3965
|
-
}
|
|
3966
|
-
return timestamp;
|
|
3967
|
-
}
|
|
3968
|
-
|
|
3969
|
-
// node_modules/@probe.gl/stats/dist/lib/stat.js
|
|
3970
|
-
var Stat = class {
|
|
3971
|
-
constructor(name, type) {
|
|
3972
|
-
this.sampleSize = 1;
|
|
3973
|
-
this.time = 0;
|
|
3974
|
-
this.count = 0;
|
|
3975
|
-
this.samples = 0;
|
|
3976
|
-
this.lastTiming = 0;
|
|
3977
|
-
this.lastSampleTime = 0;
|
|
3978
|
-
this.lastSampleCount = 0;
|
|
3979
|
-
this._count = 0;
|
|
3980
|
-
this._time = 0;
|
|
3981
|
-
this._samples = 0;
|
|
3982
|
-
this._startTime = 0;
|
|
3983
|
-
this._timerPending = false;
|
|
3984
|
-
this.name = name;
|
|
3985
|
-
this.type = type;
|
|
3986
|
-
this.reset();
|
|
3987
|
-
}
|
|
3988
|
-
reset() {
|
|
3989
|
-
this.time = 0;
|
|
3990
|
-
this.count = 0;
|
|
3991
|
-
this.samples = 0;
|
|
3992
|
-
this.lastTiming = 0;
|
|
3993
|
-
this.lastSampleTime = 0;
|
|
3994
|
-
this.lastSampleCount = 0;
|
|
3995
|
-
this._count = 0;
|
|
3996
|
-
this._time = 0;
|
|
3997
|
-
this._samples = 0;
|
|
3998
|
-
this._startTime = 0;
|
|
3999
|
-
this._timerPending = false;
|
|
4000
|
-
return this;
|
|
4001
|
-
}
|
|
4002
|
-
setSampleSize(samples) {
|
|
4003
|
-
this.sampleSize = samples;
|
|
4004
|
-
return this;
|
|
4005
|
-
}
|
|
4006
|
-
/** Call to increment count (+1) */
|
|
4007
|
-
incrementCount() {
|
|
4008
|
-
this.addCount(1);
|
|
4009
|
-
return this;
|
|
4010
|
-
}
|
|
4011
|
-
/** Call to decrement count (-1) */
|
|
4012
|
-
decrementCount() {
|
|
4013
|
-
this.subtractCount(1);
|
|
4014
|
-
return this;
|
|
4015
|
-
}
|
|
4016
|
-
/** Increase count */
|
|
4017
|
-
addCount(value) {
|
|
4018
|
-
this._count += value;
|
|
4019
|
-
this._samples++;
|
|
4020
|
-
this._checkSampling();
|
|
4021
|
-
return this;
|
|
4022
|
-
}
|
|
4023
|
-
/** Decrease count */
|
|
4024
|
-
subtractCount(value) {
|
|
4025
|
-
this._count -= value;
|
|
4026
|
-
this._samples++;
|
|
4027
|
-
this._checkSampling();
|
|
4028
|
-
return this;
|
|
4029
|
-
}
|
|
4030
|
-
/** Add an arbitrary timing and bump the count */
|
|
4031
|
-
addTime(time) {
|
|
4032
|
-
this._time += time;
|
|
4033
|
-
this.lastTiming = time;
|
|
4034
|
-
this._samples++;
|
|
4035
|
-
this._checkSampling();
|
|
4036
|
-
return this;
|
|
4037
|
-
}
|
|
4038
|
-
/** Start a timer */
|
|
4039
|
-
timeStart() {
|
|
4040
|
-
this._startTime = getHiResTimestamp2();
|
|
4041
|
-
this._timerPending = true;
|
|
4042
|
-
return this;
|
|
4043
|
-
}
|
|
4044
|
-
/** End a timer. Adds to time and bumps the timing count. */
|
|
4045
|
-
timeEnd() {
|
|
4046
|
-
if (!this._timerPending) {
|
|
4047
|
-
return this;
|
|
4048
|
-
}
|
|
4049
|
-
this.addTime(getHiResTimestamp2() - this._startTime);
|
|
4050
|
-
this._timerPending = false;
|
|
4051
|
-
this._checkSampling();
|
|
4052
|
-
return this;
|
|
4053
|
-
}
|
|
4054
|
-
getSampleAverageCount() {
|
|
4055
|
-
return this.sampleSize > 0 ? this.lastSampleCount / this.sampleSize : 0;
|
|
4056
|
-
}
|
|
4057
|
-
/** Calculate average time / count for the previous window */
|
|
4058
|
-
getSampleAverageTime() {
|
|
4059
|
-
return this.sampleSize > 0 ? this.lastSampleTime / this.sampleSize : 0;
|
|
4060
|
-
}
|
|
4061
|
-
/** Calculate counts per second for the previous window */
|
|
4062
|
-
getSampleHz() {
|
|
4063
|
-
return this.lastSampleTime > 0 ? this.sampleSize / (this.lastSampleTime / 1e3) : 0;
|
|
4064
|
-
}
|
|
4065
|
-
getAverageCount() {
|
|
4066
|
-
return this.samples > 0 ? this.count / this.samples : 0;
|
|
4067
|
-
}
|
|
4068
|
-
/** Calculate average time / count */
|
|
4069
|
-
getAverageTime() {
|
|
4070
|
-
return this.samples > 0 ? this.time / this.samples : 0;
|
|
4071
|
-
}
|
|
4072
|
-
/** Calculate counts per second */
|
|
4073
|
-
getHz() {
|
|
4074
|
-
return this.time > 0 ? this.samples / (this.time / 1e3) : 0;
|
|
4075
|
-
}
|
|
4076
|
-
_checkSampling() {
|
|
4077
|
-
if (this._samples === this.sampleSize) {
|
|
4078
|
-
this.lastSampleTime = this._time;
|
|
4079
|
-
this.lastSampleCount = this._count;
|
|
4080
|
-
this.count += this._count;
|
|
4081
|
-
this.time += this._time;
|
|
4082
|
-
this.samples += this._samples;
|
|
4083
|
-
this._time = 0;
|
|
4084
|
-
this._count = 0;
|
|
4085
|
-
this._samples = 0;
|
|
4086
|
-
}
|
|
4087
|
-
}
|
|
4088
|
-
};
|
|
4089
|
-
|
|
4090
|
-
// node_modules/@probe.gl/stats/dist/lib/stats.js
|
|
4091
|
-
var Stats = class {
|
|
4092
|
-
constructor(options) {
|
|
4093
|
-
this.stats = {};
|
|
4094
|
-
this.id = options.id;
|
|
4095
|
-
this.stats = {};
|
|
4096
|
-
this._initializeStats(options.stats);
|
|
4097
|
-
Object.seal(this);
|
|
4098
|
-
}
|
|
4099
|
-
/** Acquire a stat. Create if it doesn't exist. */
|
|
4100
|
-
get(name, type = "count") {
|
|
4101
|
-
return this._getOrCreate({ name, type });
|
|
4102
|
-
}
|
|
4103
|
-
get size() {
|
|
4104
|
-
return Object.keys(this.stats).length;
|
|
4105
|
-
}
|
|
4106
|
-
/** Reset all stats */
|
|
4107
|
-
reset() {
|
|
4108
|
-
for (const stat of Object.values(this.stats)) {
|
|
4109
|
-
stat.reset();
|
|
4110
|
-
}
|
|
4111
|
-
return this;
|
|
4112
|
-
}
|
|
4113
|
-
forEach(fn) {
|
|
4114
|
-
for (const stat of Object.values(this.stats)) {
|
|
4115
|
-
fn(stat);
|
|
4116
|
-
}
|
|
4117
|
-
}
|
|
4118
|
-
getTable() {
|
|
4119
|
-
const table = {};
|
|
4120
|
-
this.forEach((stat) => {
|
|
4121
|
-
table[stat.name] = {
|
|
4122
|
-
time: stat.time || 0,
|
|
4123
|
-
count: stat.count || 0,
|
|
4124
|
-
average: stat.getAverageTime() || 0,
|
|
4125
|
-
hz: stat.getHz() || 0
|
|
4126
|
-
};
|
|
4127
|
-
});
|
|
4128
|
-
return table;
|
|
4129
|
-
}
|
|
4130
|
-
_initializeStats(stats = []) {
|
|
4131
|
-
stats.forEach((stat) => this._getOrCreate(stat));
|
|
4132
|
-
}
|
|
4133
|
-
_getOrCreate(stat) {
|
|
4134
|
-
const { name, type } = stat;
|
|
4135
|
-
let result = this.stats[name];
|
|
4136
|
-
if (!result) {
|
|
4137
|
-
if (stat instanceof Stat) {
|
|
4138
|
-
result = stat;
|
|
4139
|
-
} else {
|
|
4140
|
-
result = new Stat(name, type);
|
|
4141
|
-
}
|
|
4142
|
-
this.stats[name] = result;
|
|
4143
|
-
}
|
|
4144
|
-
return result;
|
|
4145
|
-
}
|
|
4146
|
-
};
|
|
4147
|
-
|
|
4148
3996
|
// src/lib/vector-tiler/proto-tile.ts
|
|
4149
3997
|
function createProtoTile(features2, z, tx, ty, options) {
|
|
4150
3998
|
const tolerance = z === options.maxZoom ? 0 : options.tolerance / ((1 << z) * options.extent);
|