@nika-js/onlymap 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.vscode/onlymap.code-snippets +173 -0
- package/LICENSE.md +133 -0
- package/README.md +188 -0
- package/bin/onlymapjs.mjs +182 -0
- package/dist/Arrow.dom-7AXne1TU.js +5233 -0
- package/dist/actions.d.ts +30 -0
- package/dist/attribute-resolution.d.ts +73 -0
- package/dist/basemap-D95W0IIA.js +25203 -0
- package/dist/basemap.d.ts +72 -0
- package/dist/convert-arrow-schema-CvZ3cT5m.js +94 -0
- package/dist/csp-sandbox.d.ts +20 -0
- package/dist/ctx.d.ts +49 -0
- package/dist/d3-bundle.d.ts +218 -0
- package/dist/data-emit.d.ts +10 -0
- package/dist/data-layer.d.ts +150 -0
- package/dist/declarative-filter.d.ts +12 -0
- package/dist/dev-error-panel.d.ts +15 -0
- package/dist/draw-controller.d.ts +51 -0
- package/dist/draw.d.ts +102 -0
- package/dist/effects.d.ts +39 -0
- package/dist/elements/om-behavior.d.ts +13 -0
- package/dist/elements/om-layer.d.ts +11 -0
- package/dist/elements/om-map.d.ts +168 -0
- package/dist/elements/om-overlay.d.ts +82 -0
- package/dist/elements/om-step.d.ts +12 -0
- package/dist/elements/om-story.d.ts +67 -0
- package/dist/elements/om-widget.d.ts +29 -0
- package/dist/env.d.ts +41 -0
- package/dist/expr/cache.d.ts +28 -0
- package/dist/expr/compile.d.ts +27 -0
- package/dist/expr/errors.d.ts +10 -0
- package/dist/expr/full-js-block.d.ts +17 -0
- package/dist/expr/index.d.ts +12 -0
- package/dist/expr/output-type.d.ts +12 -0
- package/dist/expr/scale.d.ts +13 -0
- package/dist/expr/script-block.d.ts +16 -0
- package/dist/expr/whitelist.d.ts +28 -0
- package/dist/field-access.d.ts +24 -0
- package/dist/html-data.d.ts +25 -0
- package/dist/index-2v2NXF_n.js +435 -0
- package/dist/index-BFjXVHly.js +605 -0
- package/dist/index-C9w78NS9.js +4883 -0
- package/dist/index-CU-iOTdr.js +75292 -0
- package/dist/index-D74olQ9w.js +3907 -0
- package/dist/index-Do7hmHwi.js +1457 -0
- package/dist/index.d.ts +76 -0
- package/dist/ir-snapshot.d.ts +54 -0
- package/dist/ir.d.ts +66 -0
- package/dist/layer-registry.d.ts +27 -0
- package/dist/layers/popup-layer.d.ts +65 -0
- package/dist/onlymapjs.css +1 -0
- package/dist/onlymapjs.js +30 -0
- package/dist/onlymapjs.umd.cjs +8618 -0
- package/dist/parse-manifest.d.ts +19 -0
- package/dist/recordbatch-HRu0SMKp.js +4742 -0
- package/dist/runtime-core.d.ts +170 -0
- package/dist/selection.d.ts +31 -0
- package/dist/stats.d.ts +29 -0
- package/dist/table-accessors-DBjWgN0C.js +204 -0
- package/dist/template-interpolation.d.ts +6 -0
- package/dist/testing.d.ts +90 -0
- package/dist/timeline.d.ts +37 -0
- package/dist/validation.d.ts +22 -0
- package/dist/vega-loader.d.ts +22 -0
- package/dist/viewport-filter.d.ts +25 -0
- package/dist/widget-registry.d.ts +23 -0
- package/dist/widget-script.d.ts +1 -0
- package/dist/widgets/built-in.d.ts +1 -0
- package/dist/widgets/dom-utils.d.ts +4 -0
- package/llms.txt +43 -0
- package/onlymapjs.html-data.json +1688 -0
- package/package.json +111 -0
- package/skills/onlymapjs/SKILL.md +61 -0
- package/skills/onlymapjs/agents/openai.yaml +4 -0
- package/skills/onlymapjs/references/patterns.md +213 -0
- package/skills/onlymapjs/references/syntax.md +342 -0
- package/skills/onlymapjs/references/testing.md +126 -0
|
@@ -0,0 +1,605 @@
|
|
|
1
|
+
var R = Object.defineProperty;
|
|
2
|
+
var N = (t, e, r) => e in t ? R(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r;
|
|
3
|
+
var u = (t, e, r) => N(t, typeof e != "symbol" ? e + "" : e, r);
|
|
4
|
+
import { c as W, W as x, d as O, e as _, f as m, h as g, j as P, s as z, n as I, k as B, m as k, o as $, p as C, q as M, r as U, u as F, v as D, w as L, x as j, y as v, z as T, A as J } from "./index-CU-iOTdr.js";
|
|
5
|
+
import { F as Ue, R as De, _ as je, B as ve, C as Je, D as qe, E as Ve, G as Ge, H as He, I as Ke, J as Qe, K as Xe, L as Ye, M as Ze, N as er, O as rr, P as tr, Q as nr, S as ar, T as sr, U as cr, V as or, X as ir, Y as ur, Z as fr } from "./index-CU-iOTdr.js";
|
|
6
|
+
import { g as q, i as V } from "./table-accessors-DBjWgN0C.js";
|
|
7
|
+
async function G(t, e, r = {}, n = {}) {
|
|
8
|
+
const a = W(t), s = x.getWorkerFarm(r), { source: c } = r, o = { name: a, source: c };
|
|
9
|
+
c || (o.url = O(t, r));
|
|
10
|
+
const i = s.getWorkerPool(o), f = r.jobName || t.name, y = await i.startJob(
|
|
11
|
+
f,
|
|
12
|
+
// eslint-disable-next-line
|
|
13
|
+
H.bind(null, n)
|
|
14
|
+
), h = _(r);
|
|
15
|
+
return y.postMessage("process", { input: e, options: h }), (await y.result).result;
|
|
16
|
+
}
|
|
17
|
+
async function H(t, e, r, n) {
|
|
18
|
+
switch (r) {
|
|
19
|
+
case "done":
|
|
20
|
+
e.done(n);
|
|
21
|
+
break;
|
|
22
|
+
case "error":
|
|
23
|
+
e.error(new Error(n.error));
|
|
24
|
+
break;
|
|
25
|
+
case "process":
|
|
26
|
+
const { id: a, input: s, options: c } = n;
|
|
27
|
+
try {
|
|
28
|
+
if (!t.process) {
|
|
29
|
+
e.postMessage("error", { id: a, error: "Worker not set up to process on main thread" });
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
const o = await t.process(s, c);
|
|
33
|
+
e.postMessage("done", { id: a, result: o });
|
|
34
|
+
} catch (o) {
|
|
35
|
+
const i = o instanceof Error ? o.message : "unknown error";
|
|
36
|
+
e.postMessage("error", { id: a, error: i });
|
|
37
|
+
}
|
|
38
|
+
break;
|
|
39
|
+
default:
|
|
40
|
+
console.warn(`process-on-worker: unknown message ${r}`);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
function K(t, e) {
|
|
44
|
+
var a, s;
|
|
45
|
+
if (!x.isSupported())
|
|
46
|
+
return !1;
|
|
47
|
+
const r = (e == null ? void 0 : e._nodeWorkers) ?? ((a = e == null ? void 0 : e.core) == null ? void 0 : a._nodeWorkers), n = (e == null ? void 0 : e.worker) ?? ((s = e == null ? void 0 : e.core) == null ? void 0 : s.worker);
|
|
48
|
+
return !m && !r ? !1 : !!(t.worker && n);
|
|
49
|
+
}
|
|
50
|
+
async function* be(t, e = {}) {
|
|
51
|
+
const r = new TextDecoder(void 0, e);
|
|
52
|
+
for await (const n of t)
|
|
53
|
+
yield typeof n == "string" ? n : r.decode(n, { stream: !0 });
|
|
54
|
+
}
|
|
55
|
+
async function* pe(t) {
|
|
56
|
+
const e = new TextEncoder();
|
|
57
|
+
for await (const r of t)
|
|
58
|
+
yield typeof r == "string" ? e.encode(r).buffer : r;
|
|
59
|
+
}
|
|
60
|
+
async function* Se(t) {
|
|
61
|
+
let e = "";
|
|
62
|
+
for await (const r of t) {
|
|
63
|
+
e += r;
|
|
64
|
+
let n;
|
|
65
|
+
for (; (n = e.indexOf(`
|
|
66
|
+
`)) >= 0; ) {
|
|
67
|
+
const a = e.slice(0, n + 1);
|
|
68
|
+
e = e.slice(n + 1), yield a;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
e.length > 0 && (yield e);
|
|
72
|
+
}
|
|
73
|
+
async function* xe(t) {
|
|
74
|
+
let e = 1;
|
|
75
|
+
for await (const r of t)
|
|
76
|
+
yield { counter: e, line: r }, e++;
|
|
77
|
+
}
|
|
78
|
+
const Q = "4.4.3", Ie = {
|
|
79
|
+
dataType: null,
|
|
80
|
+
batchType: null,
|
|
81
|
+
name: "JSON",
|
|
82
|
+
id: "json",
|
|
83
|
+
module: "json",
|
|
84
|
+
version: Q,
|
|
85
|
+
extensions: ["json", "geojson"],
|
|
86
|
+
mimeTypes: ["application/json"],
|
|
87
|
+
category: "json",
|
|
88
|
+
text: !0,
|
|
89
|
+
parseTextSync: b,
|
|
90
|
+
parse: async (t) => b(new TextDecoder().decode(t)),
|
|
91
|
+
options: {}
|
|
92
|
+
};
|
|
93
|
+
function b(t) {
|
|
94
|
+
return JSON.parse(t);
|
|
95
|
+
}
|
|
96
|
+
class X {
|
|
97
|
+
constructor(e) {
|
|
98
|
+
u(this, "handle");
|
|
99
|
+
u(this, "size");
|
|
100
|
+
u(this, "bigsize");
|
|
101
|
+
u(this, "url");
|
|
102
|
+
this.handle = e instanceof ArrayBuffer ? new Blob([e]) : e, this.size = e instanceof ArrayBuffer ? e.byteLength : e.size, this.bigsize = BigInt(this.size), this.url = e instanceof File ? e.name : "";
|
|
103
|
+
}
|
|
104
|
+
async close() {
|
|
105
|
+
}
|
|
106
|
+
async stat() {
|
|
107
|
+
return {
|
|
108
|
+
size: this.handle.size,
|
|
109
|
+
bigsize: BigInt(this.handle.size),
|
|
110
|
+
isDirectory: !1
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
async read(e, r) {
|
|
114
|
+
return await this.handle.slice(Number(e), Number(e) + Number(r)).arrayBuffer();
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
const l = new Error("Not implemented");
|
|
118
|
+
class Y {
|
|
119
|
+
constructor(e, r, n) {
|
|
120
|
+
u(this, "handle");
|
|
121
|
+
u(this, "size", 0);
|
|
122
|
+
u(this, "bigsize", 0n);
|
|
123
|
+
u(this, "url", "");
|
|
124
|
+
var a;
|
|
125
|
+
if ((a = globalThis.loaders) != null && a.NodeFile)
|
|
126
|
+
return new globalThis.loaders.NodeFile(e, r, n);
|
|
127
|
+
throw m ? new Error("Can't instantiate NodeFile in browser.") : new Error("Can't instantiate NodeFile. Make sure to import @loaders.gl/polyfills first.");
|
|
128
|
+
}
|
|
129
|
+
/** Read data */
|
|
130
|
+
async read(e, r) {
|
|
131
|
+
throw l;
|
|
132
|
+
}
|
|
133
|
+
/** Write to file. The number of bytes written will be returned */
|
|
134
|
+
async write(e, r, n) {
|
|
135
|
+
throw l;
|
|
136
|
+
}
|
|
137
|
+
/** Get information about file */
|
|
138
|
+
async stat() {
|
|
139
|
+
throw l;
|
|
140
|
+
}
|
|
141
|
+
/** Truncates the file descriptor. Only available on NodeFile. */
|
|
142
|
+
async truncate(e) {
|
|
143
|
+
throw l;
|
|
144
|
+
}
|
|
145
|
+
/** Append data to a file. Only available on NodeFile. */
|
|
146
|
+
async append(e) {
|
|
147
|
+
throw l;
|
|
148
|
+
}
|
|
149
|
+
/** Close the file */
|
|
150
|
+
async close() {
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
async function Be(t, e, r) {
|
|
154
|
+
t instanceof Blob || (t = new Blob([t]));
|
|
155
|
+
const n = t.slice(e, e + r);
|
|
156
|
+
return await Z(n);
|
|
157
|
+
}
|
|
158
|
+
async function Z(t) {
|
|
159
|
+
return await new Promise((e, r) => {
|
|
160
|
+
const n = new FileReader();
|
|
161
|
+
n.onload = (a) => {
|
|
162
|
+
var s;
|
|
163
|
+
return e((s = a == null ? void 0 : a.target) == null ? void 0 : s.result);
|
|
164
|
+
}, n.onerror = (a) => r(a), n.readAsArrayBuffer(t);
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
function ke(t, e, r, n) {
|
|
168
|
+
!Array.isArray(e) && !g(e) && (n = void 0, r = e, e = void 0), r = r || {};
|
|
169
|
+
const s = P(e, n), c = z(t, s, r);
|
|
170
|
+
if (!c)
|
|
171
|
+
return null;
|
|
172
|
+
const o = I(r, c, s), i = B(t), f = () => {
|
|
173
|
+
throw new Error("parseSync called parse (which is async");
|
|
174
|
+
};
|
|
175
|
+
return n = k({ url: i, _parseSync: f, _parse: f, loaders: e }, o, n || null), ee(c, t, o, n);
|
|
176
|
+
}
|
|
177
|
+
function ee(t, e, r, n) {
|
|
178
|
+
if (e = $(e, t), t.parseTextSync && typeof e == "string")
|
|
179
|
+
return t.parseTextSync(e, r);
|
|
180
|
+
if (t.parseSync && e instanceof ArrayBuffer)
|
|
181
|
+
return t.parseSync(e, r, n);
|
|
182
|
+
throw new Error(`${t.name} loader: 'parseSync' not supported by this loader, use 'parse' instead. ${n.url || ""}`);
|
|
183
|
+
}
|
|
184
|
+
function re(t) {
|
|
185
|
+
return { ...t, length: q(t), batchType: "data" };
|
|
186
|
+
}
|
|
187
|
+
async function d(t, e, r, n) {
|
|
188
|
+
const a = Array.isArray(e) ? e : void 0;
|
|
189
|
+
!Array.isArray(e) && !g(e) && (n = void 0, r = e, e = void 0), t = await t, r = r || {};
|
|
190
|
+
const s = B(t), c = await C(t, e, r);
|
|
191
|
+
if (!c)
|
|
192
|
+
return [];
|
|
193
|
+
const o = I(r, c, a, s);
|
|
194
|
+
return n = k({ url: s, _parseInBatches: d, _parse: F, loaders: a }, o, n || null), await te(c, t, o, n);
|
|
195
|
+
}
|
|
196
|
+
async function te(t, e, r, n) {
|
|
197
|
+
var o;
|
|
198
|
+
const a = await ne(t, e, r, n);
|
|
199
|
+
if (!((o = r == null ? void 0 : r.core) != null && o.metadata))
|
|
200
|
+
return a;
|
|
201
|
+
const s = {
|
|
202
|
+
shape: "metadata",
|
|
203
|
+
batchType: "metadata",
|
|
204
|
+
metadata: {
|
|
205
|
+
_loader: t,
|
|
206
|
+
_context: n
|
|
207
|
+
},
|
|
208
|
+
// Populate with some default fields to avoid crashing
|
|
209
|
+
data: [],
|
|
210
|
+
bytesUsed: 0
|
|
211
|
+
};
|
|
212
|
+
async function* c(i) {
|
|
213
|
+
yield s, yield* i;
|
|
214
|
+
}
|
|
215
|
+
return c(a);
|
|
216
|
+
}
|
|
217
|
+
async function ne(t, e, r, n) {
|
|
218
|
+
var c;
|
|
219
|
+
const a = await M(e, r), s = await ce(a, ((c = r == null ? void 0 : r.core) == null ? void 0 : c.transforms) || []);
|
|
220
|
+
return t.parseInBatches ? t.parseInBatches(s, r, n) : ae(s, t, r, n);
|
|
221
|
+
}
|
|
222
|
+
async function* ae(t, e, r, n) {
|
|
223
|
+
const a = await U(t), s = await F(
|
|
224
|
+
a,
|
|
225
|
+
e,
|
|
226
|
+
// TODO - Hack: supply loaders MIME type to ensure we match it
|
|
227
|
+
{ ...r, core: { ...r == null ? void 0 : r.core, mimeType: e.mimeTypes[0] } },
|
|
228
|
+
n
|
|
229
|
+
);
|
|
230
|
+
yield se(s, e);
|
|
231
|
+
}
|
|
232
|
+
function se(t, e) {
|
|
233
|
+
const r = V(t) ? re(t) : {
|
|
234
|
+
shape: "unknown",
|
|
235
|
+
batchType: "data",
|
|
236
|
+
data: t,
|
|
237
|
+
length: Array.isArray(t) ? t.length : 1
|
|
238
|
+
};
|
|
239
|
+
return r.mimeType = e.mimeTypes[0], r;
|
|
240
|
+
}
|
|
241
|
+
async function ce(t, e = []) {
|
|
242
|
+
let r = t;
|
|
243
|
+
for await (const n of e)
|
|
244
|
+
r = n(r);
|
|
245
|
+
return r;
|
|
246
|
+
}
|
|
247
|
+
function Fe(t, e, r, n) {
|
|
248
|
+
let a;
|
|
249
|
+
!Array.isArray(e) && !g(e) ? (r = e, a = void 0) : a = e;
|
|
250
|
+
const s = D(r || {});
|
|
251
|
+
return Array.isArray(t) ? t.map((o) => p(o, a, r || {}, s)) : p(t, a, r || {}, s);
|
|
252
|
+
}
|
|
253
|
+
async function p(t, e, r, n) {
|
|
254
|
+
if (typeof t == "string") {
|
|
255
|
+
const s = await n(t);
|
|
256
|
+
return Array.isArray(e) ? await d(s, e, r) : await d(s, e, r);
|
|
257
|
+
}
|
|
258
|
+
return Array.isArray(e) ? await d(t, e, r) : await d(t, e, r);
|
|
259
|
+
}
|
|
260
|
+
async function oe(t, e, r) {
|
|
261
|
+
if (e.encode)
|
|
262
|
+
return await e.encode(t, r);
|
|
263
|
+
if (e.encodeText) {
|
|
264
|
+
const n = await e.encodeText(t, r);
|
|
265
|
+
return L(new TextEncoder().encode(n));
|
|
266
|
+
}
|
|
267
|
+
if (e.encodeInBatches) {
|
|
268
|
+
const n = ie(t, e, r), a = [];
|
|
269
|
+
for await (const s of n)
|
|
270
|
+
a.push(s);
|
|
271
|
+
return j(...a);
|
|
272
|
+
}
|
|
273
|
+
throw new Error("Writer could not encode data");
|
|
274
|
+
}
|
|
275
|
+
async function Le(t, e, r) {
|
|
276
|
+
if (e.text && e.encodeText)
|
|
277
|
+
return await e.encodeText(t, r);
|
|
278
|
+
if (e.text) {
|
|
279
|
+
const n = await oe(t, e, r);
|
|
280
|
+
return new TextDecoder().decode(n);
|
|
281
|
+
}
|
|
282
|
+
throw new Error(`Writer ${e.name} could not encode data as text`);
|
|
283
|
+
}
|
|
284
|
+
function ie(t, e, r) {
|
|
285
|
+
if (e.encodeInBatches) {
|
|
286
|
+
const n = ue(t);
|
|
287
|
+
return e.encodeInBatches(n, r);
|
|
288
|
+
}
|
|
289
|
+
throw new Error("Writer could not encode data in batches");
|
|
290
|
+
}
|
|
291
|
+
function ue(t) {
|
|
292
|
+
return [{ ...t, start: 0, end: t.length }];
|
|
293
|
+
}
|
|
294
|
+
async function Ae(t, e, r) {
|
|
295
|
+
const a = { ...v(), ...r };
|
|
296
|
+
return e.encodeURLtoURL ? de(e, t, a) : K(e, a) ? await G(e, t, a) : await e.encode(t, a);
|
|
297
|
+
}
|
|
298
|
+
function fe(t, e, r) {
|
|
299
|
+
if (e.encodeSync)
|
|
300
|
+
return e.encodeSync(t, r);
|
|
301
|
+
if (e.encodeTextSync)
|
|
302
|
+
return L(new TextEncoder().encode(e.encodeTextSync(t, r)));
|
|
303
|
+
throw new Error(`Writer ${e.name} could not synchronously encode data`);
|
|
304
|
+
}
|
|
305
|
+
async function Ee(t, e, r) {
|
|
306
|
+
if (e.encodeText)
|
|
307
|
+
return await e.encodeText(t, r);
|
|
308
|
+
if (e.encodeTextSync)
|
|
309
|
+
return e.encodeTextSync(t, r);
|
|
310
|
+
if (e.text) {
|
|
311
|
+
const n = await e.encode(t, r);
|
|
312
|
+
return new TextDecoder().decode(n);
|
|
313
|
+
}
|
|
314
|
+
throw new Error(`Writer ${e.name} could not encode data as text`);
|
|
315
|
+
}
|
|
316
|
+
function Re(t, e, r) {
|
|
317
|
+
if (e.encodeTextSync)
|
|
318
|
+
return e.encodeTextSync(t, r);
|
|
319
|
+
if (e.text && e.encodeSync) {
|
|
320
|
+
const n = fe(t, e, r);
|
|
321
|
+
return new TextDecoder().decode(n);
|
|
322
|
+
}
|
|
323
|
+
throw new Error(`Writer ${e.name} could not encode data as text`);
|
|
324
|
+
}
|
|
325
|
+
function Ne(t, e, r) {
|
|
326
|
+
if (e.encodeInBatches) {
|
|
327
|
+
const n = ye(t);
|
|
328
|
+
return e.encodeInBatches(n, r);
|
|
329
|
+
}
|
|
330
|
+
throw new Error(`Writer ${e.name} could not encode in batches`);
|
|
331
|
+
}
|
|
332
|
+
async function le(t, e, r, n) {
|
|
333
|
+
if (t = T(t), e = T(e), m || !r.encodeURLtoURL)
|
|
334
|
+
throw new Error();
|
|
335
|
+
return await r.encodeURLtoURL(t, e, n);
|
|
336
|
+
}
|
|
337
|
+
async function de(t, e, r) {
|
|
338
|
+
if (m)
|
|
339
|
+
throw new Error(`Writer ${t.name} not supported in browser`);
|
|
340
|
+
const n = S("input");
|
|
341
|
+
await new Y(n, "w").write(e);
|
|
342
|
+
const s = S("output"), c = await le(n, s, t, r);
|
|
343
|
+
return (await J(c)).arrayBuffer();
|
|
344
|
+
}
|
|
345
|
+
function ye(t) {
|
|
346
|
+
return [{ ...t, start: 0, end: t.length }];
|
|
347
|
+
}
|
|
348
|
+
function S(t) {
|
|
349
|
+
return `/tmp/${t}`;
|
|
350
|
+
}
|
|
351
|
+
function We(t, e, r) {
|
|
352
|
+
const n = (r == null ? void 0 : r.type) || "auto";
|
|
353
|
+
let a = null;
|
|
354
|
+
if (n === "auto") {
|
|
355
|
+
for (const s of e)
|
|
356
|
+
if (typeof t == "string" && s.testURL && s.testURL(t))
|
|
357
|
+
return s;
|
|
358
|
+
} else
|
|
359
|
+
a = he(n, e);
|
|
360
|
+
if (!a && !(r != null && r.nothrow))
|
|
361
|
+
throw new Error("Not a valid image source type");
|
|
362
|
+
return a;
|
|
363
|
+
}
|
|
364
|
+
function he(t, e) {
|
|
365
|
+
for (const r of e)
|
|
366
|
+
if (r.type === t)
|
|
367
|
+
return r;
|
|
368
|
+
return null;
|
|
369
|
+
}
|
|
370
|
+
function Oe(t, e) {
|
|
371
|
+
if (globalThis.loaders.makeNodeStream)
|
|
372
|
+
return globalThis.loaders.makeNodeStream(t, e);
|
|
373
|
+
const r = t[Symbol.asyncIterator] ? t[Symbol.asyncIterator]() : t[Symbol.iterator]();
|
|
374
|
+
return new ReadableStream(
|
|
375
|
+
{
|
|
376
|
+
// Create a byte stream (enables `Response(stream).arrayBuffer()`)
|
|
377
|
+
// Only supported on Chrome
|
|
378
|
+
// See: https://developer.mozilla.org/en-US/docs/Web/API/ReadableByteStreamController
|
|
379
|
+
// @ts-ignore
|
|
380
|
+
type: "bytes",
|
|
381
|
+
async pull(n) {
|
|
382
|
+
try {
|
|
383
|
+
const { done: a, value: s } = await r.next();
|
|
384
|
+
a ? n.close() : n.enqueue(new Uint8Array(s));
|
|
385
|
+
} catch (a) {
|
|
386
|
+
n.error(a);
|
|
387
|
+
}
|
|
388
|
+
},
|
|
389
|
+
async cancel() {
|
|
390
|
+
var n;
|
|
391
|
+
await ((n = r == null ? void 0 : r.return) == null ? void 0 : n.call(r));
|
|
392
|
+
}
|
|
393
|
+
},
|
|
394
|
+
// options: QueingStrategy<Uint8Array>
|
|
395
|
+
{
|
|
396
|
+
// This is bytes, not chunks
|
|
397
|
+
highWaterMark: 2 ** 24,
|
|
398
|
+
...e
|
|
399
|
+
}
|
|
400
|
+
);
|
|
401
|
+
}
|
|
402
|
+
const A = "4.4.3", _e = {
|
|
403
|
+
dataType: null,
|
|
404
|
+
batchType: null,
|
|
405
|
+
name: "Null loader",
|
|
406
|
+
id: "null",
|
|
407
|
+
module: "core",
|
|
408
|
+
version: A,
|
|
409
|
+
worker: !0,
|
|
410
|
+
mimeTypes: ["application/x.empty"],
|
|
411
|
+
extensions: ["null"],
|
|
412
|
+
tests: [() => !1],
|
|
413
|
+
options: {
|
|
414
|
+
null: {}
|
|
415
|
+
}
|
|
416
|
+
}, Pe = {
|
|
417
|
+
dataType: null,
|
|
418
|
+
batchType: null,
|
|
419
|
+
name: "Null loader",
|
|
420
|
+
id: "null",
|
|
421
|
+
module: "core",
|
|
422
|
+
version: A,
|
|
423
|
+
mimeTypes: ["application/x.empty"],
|
|
424
|
+
extensions: ["null"],
|
|
425
|
+
parse: async (t, e, r) => w(),
|
|
426
|
+
parseSync: w,
|
|
427
|
+
parseInBatches: async function* (e, r, n) {
|
|
428
|
+
for await (const a of e)
|
|
429
|
+
yield w();
|
|
430
|
+
},
|
|
431
|
+
tests: [() => !1],
|
|
432
|
+
options: {
|
|
433
|
+
null: {}
|
|
434
|
+
}
|
|
435
|
+
};
|
|
436
|
+
function w(t, e, r) {
|
|
437
|
+
return null;
|
|
438
|
+
}
|
|
439
|
+
async function ze(t, e, r = () => {
|
|
440
|
+
}, n = () => {
|
|
441
|
+
}) {
|
|
442
|
+
if (t = await t, !t.ok)
|
|
443
|
+
return t;
|
|
444
|
+
const a = t.body;
|
|
445
|
+
if (!a)
|
|
446
|
+
return t;
|
|
447
|
+
const s = t.headers.get("content-length") || 0, c = s ? parseInt(s) : 0;
|
|
448
|
+
if (!(c > 0) || typeof ReadableStream > "u" || !a.getReader)
|
|
449
|
+
return t;
|
|
450
|
+
const o = new ReadableStream({
|
|
451
|
+
async start(i) {
|
|
452
|
+
const f = a.getReader();
|
|
453
|
+
await E(i, f, 0, c, e, r, n);
|
|
454
|
+
}
|
|
455
|
+
});
|
|
456
|
+
return new Response(o);
|
|
457
|
+
}
|
|
458
|
+
async function E(t, e, r, n, a, s, c) {
|
|
459
|
+
try {
|
|
460
|
+
const { done: o, value: i } = await e.read();
|
|
461
|
+
if (o) {
|
|
462
|
+
s(), t.close();
|
|
463
|
+
return;
|
|
464
|
+
}
|
|
465
|
+
r += i.byteLength;
|
|
466
|
+
const f = Math.round(r / n * 100);
|
|
467
|
+
a(f, { loadedBytes: r, totalBytes: n }), t.enqueue(i), await E(t, e, r, n, a, s, c);
|
|
468
|
+
} catch (o) {
|
|
469
|
+
t.error(o), c(o);
|
|
470
|
+
}
|
|
471
|
+
}
|
|
472
|
+
class $e {
|
|
473
|
+
/**
|
|
474
|
+
* A FileSystem API wrapper around a list of browser 'File' objects
|
|
475
|
+
* @param files
|
|
476
|
+
* @param options
|
|
477
|
+
*/
|
|
478
|
+
constructor(e, r) {
|
|
479
|
+
u(this, "_fetch");
|
|
480
|
+
u(this, "files", {});
|
|
481
|
+
u(this, "lowerCaseFiles", {});
|
|
482
|
+
u(this, "usedFiles", {});
|
|
483
|
+
this._fetch = (r == null ? void 0 : r.fetch) || fetch;
|
|
484
|
+
for (let n = 0; n < e.length; ++n) {
|
|
485
|
+
const a = e[n];
|
|
486
|
+
this.files[a.name] = a, this.lowerCaseFiles[a.name.toLowerCase()] = a, this.usedFiles[a.name] = !1;
|
|
487
|
+
}
|
|
488
|
+
this.fetch = this.fetch.bind(this);
|
|
489
|
+
}
|
|
490
|
+
// implements IFileSystem
|
|
491
|
+
/**
|
|
492
|
+
* Implementation of fetch against this file system
|
|
493
|
+
* Delegates to global fetch for http{s}:// or data://
|
|
494
|
+
*/
|
|
495
|
+
async fetch(e, r) {
|
|
496
|
+
if (e.includes("://"))
|
|
497
|
+
return this._fetch(e, r);
|
|
498
|
+
const n = this.files[e];
|
|
499
|
+
if (!n)
|
|
500
|
+
return new Response(e, { status: 400, statusText: "NOT FOUND" });
|
|
501
|
+
const s = new Headers(r == null ? void 0 : r.headers).get("Range"), c = s && /bytes=($1)-($2)/.exec(s);
|
|
502
|
+
if (c) {
|
|
503
|
+
const i = parseInt(c[1]), f = parseInt(c[2]), y = await n.slice(i, f).arrayBuffer(), h = new Response(y);
|
|
504
|
+
return Object.defineProperty(h, "url", { value: e }), h;
|
|
505
|
+
}
|
|
506
|
+
const o = new Response(n);
|
|
507
|
+
return Object.defineProperty(o, "url", { value: e }), o;
|
|
508
|
+
}
|
|
509
|
+
/**
|
|
510
|
+
* List filenames in this filesystem
|
|
511
|
+
* @param dirname
|
|
512
|
+
* @returns
|
|
513
|
+
*/
|
|
514
|
+
async readdir(e) {
|
|
515
|
+
const r = [];
|
|
516
|
+
for (const n in this.files)
|
|
517
|
+
r.push(n);
|
|
518
|
+
return r;
|
|
519
|
+
}
|
|
520
|
+
/**
|
|
521
|
+
* Return information (size) about files in this file system
|
|
522
|
+
*/
|
|
523
|
+
async stat(e, r) {
|
|
524
|
+
const n = this.files[e];
|
|
525
|
+
if (!n)
|
|
526
|
+
throw new Error(e);
|
|
527
|
+
return { size: n.size };
|
|
528
|
+
}
|
|
529
|
+
/**
|
|
530
|
+
* Just removes the file from the list
|
|
531
|
+
*/
|
|
532
|
+
async unlink(e) {
|
|
533
|
+
delete this.files[e], delete this.lowerCaseFiles[e], this.usedFiles[e] = !0;
|
|
534
|
+
}
|
|
535
|
+
// implements IRandomAccessFileSystem
|
|
536
|
+
// RANDOM ACCESS
|
|
537
|
+
async openReadableFile(e, r) {
|
|
538
|
+
return new X(this.files[e]);
|
|
539
|
+
}
|
|
540
|
+
// PRIVATE
|
|
541
|
+
// Supports case independent paths, and file usage tracking
|
|
542
|
+
_getFile(e, r) {
|
|
543
|
+
const n = this.files[e] || this.lowerCaseFiles[e];
|
|
544
|
+
return n && r && (this.usedFiles[e] = !0), n;
|
|
545
|
+
}
|
|
546
|
+
}
|
|
547
|
+
export {
|
|
548
|
+
Ue as FetchError,
|
|
549
|
+
Ie as JSONLoader,
|
|
550
|
+
Pe as NullLoader,
|
|
551
|
+
_e as NullWorkerLoader,
|
|
552
|
+
De as RequestScheduler,
|
|
553
|
+
$e as _BrowserFileSystem,
|
|
554
|
+
ze as _fetchProgress,
|
|
555
|
+
We as _selectSource,
|
|
556
|
+
je as _unregisterLoaders,
|
|
557
|
+
ve as assert,
|
|
558
|
+
U as concatenateArrayBuffersAsync,
|
|
559
|
+
Je as createDataSource,
|
|
560
|
+
qe as document,
|
|
561
|
+
Ae as encode,
|
|
562
|
+
Ne as encodeInBatches,
|
|
563
|
+
fe as encodeSync,
|
|
564
|
+
oe as encodeTable,
|
|
565
|
+
Le as encodeTableAsText,
|
|
566
|
+
ie as encodeTableInBatches,
|
|
567
|
+
Ee as encodeText,
|
|
568
|
+
Re as encodeTextSync,
|
|
569
|
+
le as encodeURLtoURL,
|
|
570
|
+
J as fetchFile,
|
|
571
|
+
Ve as forEach,
|
|
572
|
+
v as getLoaderOptions,
|
|
573
|
+
Ge as getPathPrefix,
|
|
574
|
+
He as global,
|
|
575
|
+
Ke as isAsyncIterable,
|
|
576
|
+
m as isBrowser,
|
|
577
|
+
Qe as isIterable,
|
|
578
|
+
Xe as isIterator,
|
|
579
|
+
Ye as isPromise,
|
|
580
|
+
Ze as isPureObject,
|
|
581
|
+
er as isReadableStream,
|
|
582
|
+
rr as isResponse,
|
|
583
|
+
tr as isWorker,
|
|
584
|
+
nr as isWritableStream,
|
|
585
|
+
ar as load,
|
|
586
|
+
Fe as loadInBatches,
|
|
587
|
+
sr as makeIterator,
|
|
588
|
+
Se as makeLineIterator,
|
|
589
|
+
xe as makeNumberedLineIterator,
|
|
590
|
+
Oe as makeStream,
|
|
591
|
+
be as makeTextDecoderIterator,
|
|
592
|
+
pe as makeTextEncoderIterator,
|
|
593
|
+
F as parse,
|
|
594
|
+
d as parseInBatches,
|
|
595
|
+
ke as parseSync,
|
|
596
|
+
Be as readArrayBuffer,
|
|
597
|
+
cr as registerLoaders,
|
|
598
|
+
T as resolvePath,
|
|
599
|
+
C as selectLoader,
|
|
600
|
+
z as selectLoaderSync,
|
|
601
|
+
or as self,
|
|
602
|
+
ir as setLoaderOptions,
|
|
603
|
+
ur as setPathPrefix,
|
|
604
|
+
fr as window
|
|
605
|
+
};
|