@qaecy/cue-sdk 0.0.39 → 0.0.41

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.
@@ -1,14 +1,14 @@
1
- import { getApps as Me, initializeApp as qe } from "firebase/app";
2
- import { ref as k, getDownloadURL as tt, getMetadata as z, getBlob as Ee, updateMetadata as ze, uploadBytesResumable as Tt, uploadBytes as ht, StringFormat as Fe, uploadString as Be, listAll as F, getStorage as S, connectStorageEmulator as B } from "firebase/storage";
3
- import { Writer as Ge, DataFactory as M } from "n3";
4
- import { getFirestore as He, connectFirestoreEmulator as We, doc as Ve, setDoc as Xe, serverTimestamp as Qe, increment as Ke } from "firebase/firestore";
5
- import { getAuth as Ye, connectAuthEmulator as Je, onIdTokenChanged as Ze, getIdTokenResult as K, signInWithEmailAndPassword as to, GoogleAuthProvider as dt, OAuthProvider as ut, signInWithPopup as eo, signInWithRedirect as oo, getRedirectResult as ro, signInWithCustomToken as kt, signOut as so, onAuthStateChanged as ao, fetchSignInMethodsForEmail as io, linkWithPopup as no, unlink as po, reauthenticateWithCredential as St, EmailAuthProvider as et, updatePassword as co, linkWithCredential as lo, verifyBeforeUpdateEmail as ho, sendEmailVerification as uo } from "firebase/auth";
6
- import { Client as go } from "@modelcontextprotocol/sdk/client/index.js";
7
- import { StreamableHTTPClientTransport as mo } from "@modelcontextprotocol/sdk/client/streamableHttp.js";
8
- import { getFunctions as wo, connectFunctionsEmulator as fo, httpsCallable as yo } from "firebase/functions";
9
- import { v5 as bo } from "uuid";
1
+ import { getApps as He, initializeApp as We } from "firebase/app";
2
+ import { ref as k, getDownloadURL as tt, getMetadata as z, getBlob as xe, updateMetadata as Ve, uploadBytesResumable as Ct, uploadBytes as dt, StringFormat as Xe, uploadString as Ke, listAll as B, getStorage as S, connectStorageEmulator as G } from "firebase/storage";
3
+ import { Writer as Qe, DataFactory as q } from "n3";
4
+ import { getFirestore as Ye, connectFirestoreEmulator as Je, doc as Ze, setDoc as to, serverTimestamp as eo, increment as oo } from "firebase/firestore";
5
+ import { getAuth as ro, connectAuthEmulator as so, onIdTokenChanged as ao, getIdTokenResult as Q, signInWithEmailAndPassword as io, GoogleAuthProvider as ut, OAuthProvider as gt, signInWithPopup as no, signInWithRedirect as po, getRedirectResult as co, signInWithCustomToken as xt, signOut as lo, onAuthStateChanged as ho, fetchSignInMethodsForEmail as uo, linkWithPopup as go, unlink as mo, reauthenticateWithCredential as Rt, EmailAuthProvider as et, updatePassword as wo, linkWithCredential as fo, verifyBeforeUpdateEmail as yo, sendEmailVerification as bo } from "firebase/auth";
6
+ import { Client as vo } from "@modelcontextprotocol/sdk/client/index.js";
7
+ import { StreamableHTTPClientTransport as _o } from "@modelcontextprotocol/sdk/client/streamableHttp.js";
8
+ import { getFunctions as Eo, connectFunctionsEmulator as To, httpsCallable as ko } from "firebase/functions";
9
+ import { v5 as So } from "uuid";
10
10
  import "spark-md5";
11
- class yt {
11
+ class bt {
12
12
  queryEndpoint;
13
13
  updateEndpoint;
14
14
  baseHeaders;
@@ -20,7 +20,7 @@ class yt {
20
20
  constructor(t) {
21
21
  this.queryEndpoint = t.queryEndpoint, this.updateEndpoint = t.updateEndpoint, this.baseHeaders = Object.fromEntries(
22
22
  Object.entries(t.originalHeaders || {}).filter(
23
- ([e]) => yt.RELEVANT_HEADER_KEYS.includes(e)
23
+ ([e]) => bt.RELEVANT_HEADER_KEYS.includes(e)
24
24
  )
25
25
  ), t.authHeader !== void 0 && (this.baseHeaders.Authorization = t.authHeader);
26
26
  }
@@ -83,29 +83,29 @@ class yt {
83
83
  };
84
84
  }
85
85
  }
86
- const vo = [423, 429, 503];
87
- class Te extends Error {
86
+ const Io = [423, 429, 503];
87
+ class Re extends Error {
88
88
  constructor(t, e, o) {
89
89
  super(`QLever throttled the request (HTTP ${e}): ${t}`), this.status = e, this.retryAfterSeconds = o, this.name = "QLeverThrottledError";
90
90
  }
91
91
  status;
92
92
  retryAfterSeconds;
93
93
  }
94
- function _o(s) {
95
- const t = s.headers.get("retry-after");
94
+ function Co(a) {
95
+ const t = a.headers.get("retry-after");
96
96
  if (!t) return;
97
97
  const e = Number(t);
98
98
  if (Number.isFinite(e)) return Math.max(0, e);
99
99
  const o = Date.parse(t);
100
100
  if (!Number.isNaN(o)) return Math.max(0, (o - Date.now()) / 1e3);
101
101
  }
102
- async function G(s) {
103
- const t = await s.text();
104
- if (vo.includes(s.status))
105
- throw new Te(t, s.status, _o(s));
102
+ async function H(a) {
103
+ const t = await a.text();
104
+ if (Io.includes(a.status))
105
+ throw new Re(t, a.status, Co(a));
106
106
  return t;
107
107
  }
108
- class R {
108
+ class A {
109
109
  queryEndpoint;
110
110
  updateEndpoint;
111
111
  dataEndpoint;
@@ -148,16 +148,16 @@ class R {
148
148
  * the exact second the server nominated.
149
149
  */
150
150
  static async _retryOnLocked(t) {
151
- const e = R.LOCKED_MAX_RETRIES, o = R.LOCKED_BASE_DELAY_MS;
151
+ const e = A.LOCKED_MAX_RETRIES, o = A.LOCKED_BASE_DELAY_MS;
152
152
  let r;
153
- for (let a = 0; a <= e; a++)
153
+ for (let s = 0; s <= e; s++)
154
154
  try {
155
155
  return await t();
156
156
  } catch (i) {
157
- if (r = i, i instanceof Te && a < e) {
157
+ if (r = i, i instanceof Re && s < e) {
158
158
  const n = i.retryAfterSeconds !== void 0 ? i.retryAfterSeconds * 1e3 : void 0, p = Math.min(
159
- n ?? o * Math.pow(2, a),
160
- R.LOCKED_MAX_DELAY_MS
159
+ n ?? o * Math.pow(2, s),
160
+ A.LOCKED_MAX_DELAY_MS
161
161
  );
162
162
  await new Promise((c) => setTimeout(c, Math.random() * p));
163
163
  continue;
@@ -169,7 +169,7 @@ class R {
169
169
  constructor(t) {
170
170
  this.queryEndpoint = t.queryEndpoint, this.updateEndpoint = t.updateEndpoint, this.dataEndpoint = this.updateEndpoint.replace(/\/update$/, "/data"), this.baseHeaders = Object.fromEntries(
171
171
  Object.entries(t.originalHeaders || {}).filter(
172
- ([e]) => R.RELEVANT_HEADER_KEYS.includes(e)
172
+ ([e]) => A.RELEVANT_HEADER_KEYS.includes(e)
173
173
  )
174
174
  ), this.baseHeaders["x-user-roles"] = "admin";
175
175
  }
@@ -177,7 +177,7 @@ class R {
177
177
  return (await this.query("ASK { }")).boolean;
178
178
  }
179
179
  async query(t, e = "application/sparql-results+json") {
180
- return R._retryOnLocked(async () => {
180
+ return A._retryOnLocked(async () => {
181
181
  let o;
182
182
  try {
183
183
  o = await fetch(this.queryEndpoint, {
@@ -195,14 +195,14 @@ class R {
195
195
  );
196
196
  }
197
197
  if (!o.ok) {
198
- const r = await G(o);
198
+ const r = await H(o);
199
199
  throw new Error(`QLever query failed (HTTP ${o.status}): ${r}`);
200
200
  }
201
201
  return await o.json();
202
202
  });
203
203
  }
204
204
  async subset(t, e = "text/turtle") {
205
- return R._retryOnLocked(async () => {
205
+ return A._retryOnLocked(async () => {
206
206
  const o = await fetch(this.queryEndpoint, {
207
207
  headers: {
208
208
  ...this.baseHeaders,
@@ -213,14 +213,14 @@ class R {
213
213
  body: new URLSearchParams({ query: t })
214
214
  });
215
215
  if (!o.ok) {
216
- const r = await G(o);
216
+ const r = await H(o);
217
217
  throw new Error(`QLever subset failed (HTTP ${o.status}): ${r}`);
218
218
  }
219
219
  return await o.text();
220
220
  });
221
221
  }
222
222
  async update(t) {
223
- return R._retryOnLocked(async () => {
223
+ return A._retryOnLocked(async () => {
224
224
  const e = await fetch(this.updateEndpoint, {
225
225
  headers: {
226
226
  ...this.baseHeaders,
@@ -230,7 +230,7 @@ class R {
230
230
  body: new URLSearchParams({ update: t })
231
231
  });
232
232
  if (!e.ok) {
233
- const o = await G(e);
233
+ const o = await H(e);
234
234
  throw new Error(`SPARQL update failed (HTTP ${e.status}): ${o}`);
235
235
  }
236
236
  return await e.json();
@@ -274,15 +274,15 @@ class R {
274
274
  * to prevent.
275
275
  */
276
276
  async _postToDataEndpoint(t, e) {
277
- await R._retryOnLocked(async () => {
277
+ await A._retryOnLocked(async () => {
278
278
  const o = {
279
279
  ...this.baseHeaders,
280
280
  "Content-Type": "application/n-quads",
281
281
  "Content-Encoding": "gzip"
282
- }, r = ko() ? {
282
+ }, r = Ao() ? {
283
283
  method: "POST",
284
284
  headers: o,
285
- body: To(t).pipeThrough(new CompressionStream("gzip")),
285
+ body: Ro(t).pipeThrough(new CompressionStream("gzip")),
286
286
  // Required for a streaming body; also switches the request to
287
287
  // chunked transfer encoding, which the service handles because it
288
288
  // never buffers the body itself.
@@ -290,79 +290,79 @@ class R {
290
290
  } : {
291
291
  method: "POST",
292
292
  headers: o,
293
- body: await So(Buffer.from(await ke(t), "utf-8"))
294
- }, a = await fetch(e, r);
295
- if (!a.ok) {
296
- const i = await G(a);
297
- throw new Error(`QLever data POST failed (HTTP ${a.status}): ${i}`);
293
+ body: await Oo(Buffer.from(await Ae(t), "utf-8"))
294
+ }, s = await fetch(e, r);
295
+ if (!s.ok) {
296
+ const i = await H(s);
297
+ throw new Error(`QLever data POST failed (HTTP ${s.status}): ${i}`);
298
298
  }
299
299
  });
300
300
  }
301
301
  }
302
- function ke(s) {
302
+ function Ae(a) {
303
303
  return new Promise((t, e) => {
304
- const o = new Ge({ format: "application/n-quads" });
305
- o.addQuads(s), o.end((r, a) => r ? e(r) : t(a));
304
+ const o = new Qe({ format: "application/n-quads" });
305
+ o.addQuads(a), o.end((r, s) => r ? e(r) : t(s));
306
306
  });
307
307
  }
308
- const Eo = 5e3;
309
- function To(s) {
308
+ const xo = 5e3;
309
+ function Ro(a) {
310
310
  const t = new TextEncoder();
311
311
  let e = 0;
312
312
  return new ReadableStream({
313
313
  async pull(o) {
314
- if (e >= s.length) {
314
+ if (e >= a.length) {
315
315
  o.close();
316
316
  return;
317
317
  }
318
- const r = s.slice(e, e + Eo);
319
- e += r.length, o.enqueue(t.encode(await ke(r)));
318
+ const r = a.slice(e, e + xo);
319
+ e += r.length, o.enqueue(t.encode(await Ae(r)));
320
320
  }
321
321
  });
322
322
  }
323
- let P;
324
- function ko() {
325
- if (P !== void 0) return P;
323
+ let D;
324
+ function Ao() {
325
+ if (D !== void 0) return D;
326
326
  if (typeof process < "u" && process.env?.QLEVER_DISABLE_REQUEST_STREAMING === "true" || typeof CompressionStream > "u" || typeof ReadableStream > "u")
327
- return P = !1;
327
+ return D = !1;
328
328
  try {
329
- let s = !1;
329
+ let a = !1;
330
330
  const t = new Request("https://a.invalid/", {
331
331
  body: new ReadableStream(),
332
332
  method: "POST",
333
333
  get duplex() {
334
- return s = !0, "half";
334
+ return a = !0, "half";
335
335
  }
336
336
  }).headers.has("Content-Type");
337
- P = s && !t;
337
+ D = a && !t;
338
338
  } catch {
339
- P = !1;
339
+ D = !1;
340
340
  }
341
- return P;
341
+ return D;
342
342
  }
343
- async function So(s) {
343
+ async function Oo(a) {
344
344
  const t = new CompressionStream("gzip"), e = t.writable.getWriter();
345
- e.write(new Uint8Array(s)), e.close();
345
+ e.write(new Uint8Array(a)), e.close();
346
346
  const o = [], r = t.readable.getReader();
347
347
  for (; ; ) {
348
348
  const { done: p, value: c } = await r.read();
349
349
  if (p) break;
350
350
  o.push(c);
351
351
  }
352
- const a = o.reduce((p, c) => p + c.byteLength, 0), i = new Uint8Array(a);
352
+ const s = o.reduce((p, c) => p + c.byteLength, 0), i = new Uint8Array(s);
353
353
  let n = 0;
354
354
  for (const p of o)
355
355
  i.set(p, n), n += p.byteLength;
356
356
  return i.buffer;
357
357
  }
358
- class Io {
358
+ class Do {
359
359
  constructor(t) {
360
360
  switch (this.options = t, this.options.graphType) {
361
361
  case "qlever":
362
- this._db = new R(this.options);
362
+ this._db = new A(this.options);
363
363
  break;
364
364
  case "fuseki":
365
- this._db = new yt(this.options);
365
+ this._db = new bt(this.options);
366
366
  break;
367
367
  default:
368
368
  throw new Error(`Unsupported graph type: ${this.options.graphType}`);
@@ -410,7 +410,7 @@ class Io {
410
410
  return this.options.graphType === "qlever" ? this._db.deleteData(t) : Promise.reject(new Error("deleteData not supported for Fuseki — use update() with SPARQL DELETE DATA"));
411
411
  }
412
412
  }
413
- class It {
413
+ class At {
414
414
  constructor(t) {
415
415
  this.options = t;
416
416
  }
@@ -456,21 +456,21 @@ class It {
456
456
  if (this._knownMissing.has(o)) return;
457
457
  const r = k(this._bucket(t), e);
458
458
  try {
459
- const a = await z(r);
460
- return `${await tt(r)}&t=${encodeURIComponent(a.updated)}`;
461
- } catch (a) {
462
- if (a?.code === "storage/object-not-found" || a?.status === 404) {
459
+ const s = await z(r);
460
+ return `${await tt(r)}&t=${encodeURIComponent(s.updated)}`;
461
+ } catch (s) {
462
+ if (s?.code === "storage/object-not-found" || s?.status === 404) {
463
463
  this._knownMissing.add(o), console.debug(`[CueBlobStorage] ${e} not found (404 OK — optional cache file)`);
464
464
  return;
465
465
  }
466
- throw a;
466
+ throw s;
467
467
  }
468
468
  }
469
469
  /** Download a file as a Blob. Returns undefined if the file does not exist. */
470
470
  async getFile(t, e) {
471
471
  const o = k(this._bucket(t), e);
472
472
  try {
473
- return await Ee(o);
473
+ return await xe(o);
474
474
  } catch (r) {
475
475
  if (r?.code === "storage/object-not-found") return;
476
476
  throw r;
@@ -485,7 +485,7 @@ class It {
485
485
  * Uses a cache-busted URL to ensure the latest version is fetched.
486
486
  */
487
487
  async downloadPublic(t) {
488
- const e = k(this.options.storagePublic, t), o = new AbortController(), r = setTimeout(() => o.abort(), 1e4), a = (i) => Promise.race([
488
+ const e = k(this.options.storagePublic, t), o = new AbortController(), r = setTimeout(() => o.abort(), 1e4), s = (i) => Promise.race([
489
489
  i,
490
490
  new Promise((n, p) => {
491
491
  o.signal.addEventListener(
@@ -496,8 +496,8 @@ class It {
496
496
  ]);
497
497
  try {
498
498
  const [i, n] = await Promise.all([
499
- a(tt(e)),
500
- a(z(e))
499
+ s(tt(e)),
500
+ s(z(e))
501
501
  ]), p = `${i}&t=${encodeURIComponent(n.updated)}`, c = await fetch(p, { signal: o.signal });
502
502
  if (!c.ok) throw new Error(`HTTP ${c.status}`);
503
503
  return c.text();
@@ -528,7 +528,7 @@ class It {
528
528
  /** Update custom metadata on an existing file. */
529
529
  async setMetadata(t, e, o) {
530
530
  const r = k(this._bucket(t), e);
531
- await ze(r, { customMetadata: o });
531
+ await Ve(r, { customMetadata: o });
532
532
  }
533
533
  // ─── Uploads ──────────────────────────────────────────────────────────────
534
534
  /**
@@ -537,7 +537,7 @@ class It {
537
537
  * upload progress needs to be surfaced in the UI.
538
538
  */
539
539
  uploadResumable(t, e, o, r) {
540
- const a = k(this._bucket(t), e), i = Tt(a, o, r ? { customMetadata: r } : void 0);
540
+ const s = k(this._bucket(t), e), i = Ct(s, o, r ? { customMetadata: r } : void 0);
541
541
  return {
542
542
  complete: () => new Promise((n, p) => i.then(() => n(), p)),
543
543
  pause: () => i.pause(),
@@ -556,27 +556,27 @@ class It {
556
556
  * Use for small files where progress feedback is not needed.
557
557
  */
558
558
  async uploadBytes(t, e, o, r) {
559
- const a = k(this._bucket(t), e);
560
- await ht(a, o, r ? { customMetadata: r } : void 0);
559
+ const s = k(this._bucket(t), e);
560
+ await dt(s, o, r ? { customMetadata: r } : void 0);
561
561
  }
562
562
  /** Upload a string or base64-encoded value. */
563
- async uploadString(t, e, o, r = Fe.RAW, a) {
563
+ async uploadString(t, e, o, r = Xe.RAW, s) {
564
564
  const i = k(this._bucket(t), e);
565
- await Be(i, o, r, a ? { customMetadata: a } : void 0);
565
+ await Ke(i, o, r, s ? { customMetadata: s } : void 0);
566
566
  }
567
567
  // ─── Listing ──────────────────────────────────────────────────────────────
568
568
  /** List all item names directly under `prefix` in the given bucket. */
569
569
  async listFiles(t, e) {
570
570
  const o = k(this._bucket(t), e);
571
- return (await F(o)).items.map((a) => a.name);
571
+ return (await B(o)).items.map((s) => s.name);
572
572
  }
573
573
  /**
574
574
  * Recursively list all file full-paths under `prefix` in the given bucket.
575
575
  * Returns full storage paths (not just names).
576
576
  */
577
577
  async listFilesRecursive(t, e) {
578
- const o = this._bucket(t), r = async (a) => {
579
- const i = await F(k(o, a));
578
+ const o = this._bucket(t), r = async (s) => {
579
+ const i = await B(k(o, s));
580
580
  let n = i.items.map((p) => p.fullPath);
581
581
  for (const p of i.prefixes)
582
582
  n = n.concat(await r(p.fullPath));
@@ -590,33 +590,33 @@ class It {
590
590
  */
591
591
  async deleteDirectory(t, e) {
592
592
  const { deleteObject: o } = await import("firebase/storage"), r = this._bucket(t);
593
- let a = 0;
593
+ let s = 0;
594
594
  const i = async (n) => {
595
- const p = await F(k(r, n));
595
+ const p = await B(k(r, n));
596
596
  for (const c of p.items)
597
- await o(c), a++;
597
+ await o(c), s++;
598
598
  for (const c of p.prefixes)
599
599
  await i(c.fullPath);
600
600
  };
601
- return await i(e), a;
601
+ return await i(e), s;
602
602
  }
603
603
  // ─── Legacy helpers kept for CueBlobStorage consumers ────────────────────
604
604
  // (used by loaders / processors that were already depending on CueBlobStorage)
605
605
  /** Upload binary data to the raw bucket with retry logic. */
606
- async uploadRaw(t, e, o, r = 3, a, i) {
606
+ async uploadRaw(t, e, o, r = 3, s, i) {
607
607
  const n = k(this.options.storageRaw, t);
608
608
  let p = 0, c;
609
609
  for (; p < r; )
610
610
  try {
611
611
  await new Promise((h, d) => {
612
- if (a?.aborted) {
612
+ if (s?.aborted) {
613
613
  d(new DOMException("Upload cancelled", "AbortError"));
614
614
  return;
615
615
  }
616
- const u = Tt(n, e, { customMetadata: o }), m = () => {
616
+ const u = Ct(n, e, { customMetadata: o }), m = () => {
617
617
  u.cancel(), d(new DOMException("Upload cancelled", "AbortError"));
618
618
  };
619
- a?.addEventListener("abort", m, { once: !0 }), u.on(
619
+ s?.addEventListener("abort", m, { once: !0 }), u.on(
620
620
  "state_changed",
621
621
  (w) => {
622
622
  if (i) {
@@ -625,16 +625,16 @@ class It {
625
625
  }
626
626
  },
627
627
  (w) => {
628
- a?.removeEventListener("abort", m), d(w);
628
+ s?.removeEventListener("abort", m), d(w);
629
629
  },
630
630
  () => {
631
- a?.removeEventListener("abort", m), h();
631
+ s?.removeEventListener("abort", m), h();
632
632
  }
633
633
  );
634
634
  });
635
635
  return;
636
636
  } catch (h) {
637
- if (a?.aborted || h instanceof DOMException && h.name === "AbortError")
637
+ if (s?.aborted || h instanceof DOMException && h.name === "AbortError")
638
638
  throw h;
639
639
  c = h, p++, p < r && await new Promise((d) => setTimeout(d, 1e3 * p));
640
640
  }
@@ -646,12 +646,12 @@ class It {
646
646
  */
647
647
  async uploadProcessed(t, e, o) {
648
648
  const r = k(this.options.storageProcessed, t);
649
- return await z(r).catch(() => null) ? !1 : (await ht(r, e, { customMetadata: o }), !0);
649
+ return await z(r).catch(() => null) ? !1 : (await dt(r, e, { customMetadata: o }), !0);
650
650
  }
651
651
  /** List all blob names directly under `prefix` in the raw bucket. */
652
652
  async listRaw(t) {
653
653
  const e = k(this.options.storageRaw, t);
654
- return (await F(e)).items.map((r) => r.name);
654
+ return (await B(e)).items.map((r) => r.name);
655
655
  }
656
656
  }
657
657
  class E {
@@ -675,15 +675,15 @@ class E {
675
675
  return this;
676
676
  }
677
677
  }
678
- function bt(s, t) {
678
+ function vt(a, t) {
679
679
  const e = /* @__PURE__ */ new Set();
680
680
  let o = t(), r = !1;
681
- const a = [], i = () => {
681
+ const s = [], i = () => {
682
682
  r = !0;
683
683
  for (const n of e) n();
684
684
  };
685
- for (const n of s)
686
- a.push(n.subscribe(i));
685
+ for (const n of a)
686
+ s.push(n.subscribe(i));
687
687
  return {
688
688
  get() {
689
689
  return r && (o = t(), r = !1), o;
@@ -692,7 +692,7 @@ function bt(s, t) {
692
692
  return e.add(n), () => e.delete(n);
693
693
  },
694
694
  destroy() {
695
- for (const n of a) n();
695
+ for (const n of s) n();
696
696
  e.clear();
697
697
  }
698
698
  };
@@ -701,8 +701,8 @@ const ot = {
701
701
  apiKey: "AIzaSyAiW42QBx9HS4Khu88pCW7MV66IhBAQul0",
702
702
  appId: "1:151132927589:web:d2ffdb377dfadfd23ab88c",
703
703
  measurementId: "G-YT4PK6HGZD"
704
- }, Ct = "qaecy-mvp-406413", Co = "734737865998", xo = "europe-west6", xt = "sessions_eu_west6", Rt = "spaces_chats_eu_west6", At = "spaces_raw_eu_west6", Ot = "spaces_processed_eu_west6", Pt = "logs_eu_west6", Dt = "cue_public_eu_west6", $t = "db_persistence_eu_west6", Ro = "/data-views/admin/consumption", Ao = "/data-views/admin/profile/organizations", Nt = "/data-views/admin/profile/api-keys", jt = "/commands/admin/profile/api-keys", Oo = "/commands/admin/profile/terms", Po = "/commands/admin/profile/analytics-notice", Do = "/commands/admin/usage/view", $o = (s) => `/data-views/admin/organizations/${s}/members`, No = (s) => `/data-views/admin/organizations/${s}/admins`, Lt = (s) => `/data-views/admin/organizations/${s}/credits`, jo = (s) => `/data-views/admin/organizations/${s}/credits/report`, Lo = (s, t) => `/data-views/admin/organizations/${s}/credits/report/${t}/by-file-type`, Uo = (s, t) => `/data-views/admin/organizations/${s}/traffic/report/${t}`, Mo = (s, t) => `/data-views/admin/organizations/${s}/usage/report/${t}`, qo = "/commands/admin/user/signup", zo = "/commands/admin/user/signup/resend", Fo = "/commands/admin/user/settings", Bo = "/data-views/admin/users/settings", Go = "/commands/admin/organization/signup", Ho = (s) => `/commands/admin/organization/${s}/credits`, Wo = (s) => `/commands/admin/organization/${s}/plan`, Vo = (s) => `/commands/admin/organization/${s}/checkout`, Xo = (s) => `/commands/admin/organization/${s}/billing-portal`, Qo = (s) => `/commands/admin/organization/${s}/members`, Ko = (s, t) => `/commands/admin/organization/${s}/members/${t}/role`, Yo = (s, t) => `/commands/admin/organization/${s}/members/${t}`, Ut = "/data-views/admin/projects", Jo = "/data-views/admin/organizations", Zo = "/data-views/admin/organizations/search", tr = (s) => `/data-views/admin/organizations/${s}/projects`, er = "/data-views/admin/projects/search", or = "/data-views/admin/users/search", rr = (s) => `/data-views/admin/users/${s}/detail`, sr = "/data-views/admin/users/superadmins", ar = "/data-views/admin/users/deleted", ir = (s) => `/commands/admin/user/${s}`, nr = (s) => `/commands/admin/user/${s}/restore`, Mt = (s) => `/commands/admin/user/${s}/superadmin`, pr = "/commands/admin/user", cr = "/commands/admin/organization", lr = (s) => `/commands/admin/organization/${s}`, hr = (s) => `/commands/admin/organization/${s}/restore`, dr = (s) => `/commands/admin/organization/${s}/domains`, ur = "/data-views/admin/organizations/deleted", gr = "/data-views/admin/users/without-org", mr = "/data-views/admin/users/without-project", wr = "/data-views/admin/projects/without-users", fr = "/data-views/admin/projects/without-admins", yr = "/data-views/admin/organizations/without-users", br = "/data-views/admin/organizations/without-admins", vr = "/commands/admin/project", _r = (s) => `/commands/admin/project/${s}`, Er = (s) => `/commands/admin/project/${s}/restore`, Tr = (s) => `/commands/admin/project/${s}/members`, kr = (s, t) => `/commands/admin/project/${s}/members/${t}/role`, Sr = (s, t) => `/commands/admin/project/${s}/members/${t}`, Ir = (s) => `/data-views/admin/projects/${s}/metadata`, Cr = (s) => `/commands/admin/project/${s}/metadata`, xr = "/assistant/search", Rr = "/mcp", Ar = "/index/search", Or = "/index/lookup", Pr = "/index/available-filters", Se = "/triplestore/query", Dr = "/triplestore/update", $r = "/triplestore/shacl", Ie = "/qlever-server/qlever/query", Nr = "/qlever-server/qlever/update", jr = "/qlever-server/qlever/shacl", Lr = "/qlever-server/qlever/admin/rebuild", Ur = "/qlever-server/admin/stats/refresh", qt = "/commands/file-system-structure/batch", Mr = "/commands/dms-sync/providers", qr = (s) => `/commands/dms-sync/${s}/preview`, zr = (s) => `/commands/dms-sync/${s}/sync`, Fr = "/storage/sessions", Br = "/storage/raw", Ce = "/storage/processed", Gr = "/data-views/processing-status", Hr = "/data-views/processing-status/mine", zt = "microsoft.com", Ft = "superadmin", vt = "https://cue.qaecy.com/r/";
705
- class Bt {
704
+ }, Ot = "qaecy-mvp-406413", $o = "734737865998", Po = "europe-west6", Dt = "sessions_eu_west6", $t = "spaces_chats_eu_west6", Pt = "spaces_raw_eu_west6", Nt = "spaces_processed_eu_west6", jt = "logs_eu_west6", Lt = "cue_public_eu_west6", Ut = "db_persistence_eu_west6", No = "/data-views/admin/consumption", jo = "/data-views/admin/profile/organizations", Mt = "/data-views/admin/profile/api-keys", qt = "/commands/admin/profile/api-keys", Lo = "/commands/admin/profile/terms", Uo = "/commands/admin/profile/analytics-notice", Mo = "/commands/admin/usage/view", qo = (a) => `/data-views/admin/organizations/${a}/members`, Fo = (a) => `/data-views/admin/organizations/${a}/admins`, Ft = (a) => `/data-views/admin/organizations/${a}/credits`, zo = (a) => `/data-views/admin/organizations/${a}/credits/report`, Bo = (a, t) => `/data-views/admin/organizations/${a}/credits/report/${t}/by-file-type`, Go = (a, t) => `/data-views/admin/organizations/${a}/traffic/report/${t}`, Ho = (a, t) => `/data-views/admin/organizations/${a}/usage/report/${t}`, Wo = "/commands/admin/user/signup", Vo = "/commands/admin/user/signup/resend", Xo = "/commands/admin/user/settings", Ko = "/data-views/admin/users/settings", Qo = "/commands/admin/organization/signup", Yo = (a) => `/commands/admin/organization/${a}/credits`, Jo = (a) => `/commands/admin/organization/${a}/plan`, Zo = (a) => `/commands/admin/organization/${a}/checkout`, tr = (a) => `/commands/admin/organization/${a}/billing-portal`, er = (a) => `/commands/admin/organization/${a}/members`, or = (a, t) => `/commands/admin/organization/${a}/members/${t}/role`, rr = (a, t) => `/commands/admin/organization/${a}/members/${t}`, zt = "/data-views/admin/projects", sr = "/data-views/admin/organizations", ar = "/data-views/admin/organizations/search", ir = (a) => `/data-views/admin/organizations/${a}/projects`, nr = "/data-views/admin/projects/search", pr = "/data-views/admin/users/search", cr = (a) => `/data-views/admin/users/${a}/detail`, lr = "/data-views/admin/users/superadmins", hr = "/data-views/admin/users/deleted", dr = (a) => `/commands/admin/user/${a}`, ur = (a) => `/commands/admin/user/${a}/restore`, Bt = (a) => `/commands/admin/user/${a}/superadmin`, gr = "/commands/admin/user", mr = "/commands/admin/organization", wr = (a) => `/commands/admin/organization/${a}`, fr = (a) => `/commands/admin/organization/${a}/restore`, yr = (a) => `/commands/admin/organization/${a}/domains`, br = "/data-views/admin/organizations/deleted", vr = "/data-views/admin/users/without-org", _r = "/data-views/admin/users/without-project", Er = "/data-views/admin/projects/without-users", Tr = "/data-views/admin/projects/without-admins", kr = "/data-views/admin/organizations/without-users", Sr = "/data-views/admin/organizations/without-admins", Ir = "/commands/admin/project", Cr = (a) => `/commands/admin/project/${a}`, xr = (a) => `/commands/admin/project/${a}/restore`, Rr = (a) => `/commands/admin/project/${a}/members`, Ar = (a, t) => `/commands/admin/project/${a}/members/${t}/role`, Or = (a, t) => `/commands/admin/project/${a}/members/${t}`, Dr = (a) => `/data-views/admin/projects/${a}/metadata`, $r = (a) => `/commands/admin/project/${a}/metadata`, Pr = "/assistant/search", Nr = "/mcp", jr = "/index/search", Lr = "/index/lookup", Ur = "/index/available-filters", Oe = "/triplestore/query", Mr = "/triplestore/update", qr = "/triplestore/shacl", De = "/qlever-server/qlever/query", Fr = "/qlever-server/qlever/update", zr = "/qlever-server/qlever/shacl", Br = "/qlever-server/qlever/admin/rebuild", Gr = "/qlever-server/admin/stats/refresh", Gt = "/commands/file-system-structure/batch", Hr = "/commands/dms-sync/providers", Wr = (a) => `/commands/dms-sync/${a}/preview`, Vr = (a) => `/commands/dms-sync/${a}/sync`, Xr = "/storage/sessions", Kr = "/storage/raw", $e = "/storage/processed", Qr = "/data-views/processing-status", Yr = "/data-views/processing-status/mine", Ht = "microsoft.com", Wt = "superadmin", _t = "https://cue.qaecy.com/r/";
705
+ class Vt {
706
706
  _auth;
707
707
  _endpoints;
708
708
  _userSignal = new E(null);
@@ -719,19 +719,19 @@ class Bt {
719
719
  /** All unique UIDs for the current user (Firebase UID + linked provider UIDs). */
720
720
  userIds;
721
721
  constructor(t, e = !1, o) {
722
- this._auth = Ye(t), this._endpoints = o, e && Je(this._auth, o.authEmulatorUrl, {
722
+ this._auth = ro(t), this._endpoints = o, e && so(this._auth, o.authEmulatorUrl, {
723
723
  disableWarnings: !0
724
- }), this.user = this._userSignal.asReadonly(), this.token = this._tokenSignal.asReadonly(), this.isSuperAdmin = this._isSuperAdminSignal.asReadonly(), this._userIdsSignal = bt([this._userSignal], () => {
724
+ }), this.user = this._userSignal.asReadonly(), this.token = this._tokenSignal.asReadonly(), this.isSuperAdmin = this._isSuperAdminSignal.asReadonly(), this._userIdsSignal = vt([this._userSignal], () => {
725
725
  const r = this._userSignal.get();
726
726
  if (!r) return [];
727
- const a = /* @__PURE__ */ new Set([r.uid]);
728
- return r.providerData.forEach((i) => a.add(i.uid)), Array.from(a);
729
- }), this.userIds = this._userIdsSignal, this._stopTokenListener = Ze(this._auth, async (r) => {
727
+ const s = /* @__PURE__ */ new Set([r.uid]);
728
+ return r.providerData.forEach((i) => s.add(i.uid)), Array.from(s);
729
+ }), this.userIds = this._userIdsSignal, this._stopTokenListener = ao(this._auth, async (r) => {
730
730
  if (this._userSignal.set(r), r) {
731
- const a = await r.getIdToken();
732
- this._tokenSignal.set(a);
733
- const i = await K(r);
734
- this._isSuperAdminSignal.set(i.claims.role === Ft);
731
+ const s = await r.getIdToken();
732
+ this._tokenSignal.set(s);
733
+ const i = await Q(r);
734
+ this._isSuperAdminSignal.set(i.claims.role === Wt);
735
735
  } else
736
736
  this._tokenSignal.set(null), this._isSuperAdminSignal.set(!1);
737
737
  });
@@ -744,14 +744,14 @@ class Bt {
744
744
  if (t === "password") {
745
745
  if (!e)
746
746
  throw new Error("credentials are required for password sign-in");
747
- return (await to(
747
+ return (await io(
748
748
  this._auth,
749
749
  e.email,
750
750
  e.password
751
751
  )).user;
752
752
  }
753
- const o = t === "google" ? new dt() : new ut(zt);
754
- return (await eo(this._auth, o)).user;
753
+ const o = t === "google" ? new ut() : new gt(Ht);
754
+ return (await no(this._auth, o)).user;
755
755
  }
756
756
  /**
757
757
  * Initiate a redirect-based sign-in (mobile / iframe contexts where popups
@@ -759,8 +759,8 @@ class Bt {
759
759
  * retrieve the result.
760
760
  */
761
761
  async signInWithRedirect(t) {
762
- const e = t === "google" ? new dt() : new ut(zt);
763
- await oo(this._auth, e);
762
+ const e = t === "google" ? new ut() : new gt(Ht);
763
+ await po(this._auth, e);
764
764
  }
765
765
  /**
766
766
  * Retrieve the result of a redirect sign-in. Returns the signed-in `User`
@@ -768,7 +768,7 @@ class Bt {
768
768
  * Call this once on app startup before showing a sign-in UI.
769
769
  */
770
770
  async checkRedirectResult() {
771
- return (await ro(this._auth))?.user ?? null;
771
+ return (await co(this._auth))?.user ?? null;
772
772
  }
773
773
  /**
774
774
  * One-shot async check — returns `true` if the current user has the
@@ -777,7 +777,7 @@ class Bt {
777
777
  */
778
778
  async checkSuperAdmin() {
779
779
  const t = this._auth.currentUser;
780
- return t ? (await K(t)).claims.role === Ft : !1;
780
+ return t ? (await Q(t)).claims.role === Wt : !1;
781
781
  }
782
782
  /** Sign in with a Cue API key. `projectId` is optional — omit it when no project context is available (e.g. admin flows). */
783
783
  async signInWithApiKey(t, e) {
@@ -789,12 +789,12 @@ class Bt {
789
789
  });
790
790
  if (!r.ok)
791
791
  throw new Error(`Failed to fetch custom token: ${r.statusText}`);
792
- const { token: a } = await r.json();
793
- return (await kt(this._auth, a)).user;
792
+ const { token: s } = await r.json();
793
+ return (await xt(this._auth, s)).user;
794
794
  }
795
795
  /** Sign in with a Firebase custom token (e.g. minted server-side for MCP/OAuth flows). */
796
796
  async signInWithCustomToken(t) {
797
- return (await kt(this._auth, t)).user;
797
+ return (await xt(this._auth, t)).user;
798
798
  }
799
799
  /**
800
800
  * Mint a short-lived Firebase custom token for the current user, scoped to
@@ -819,7 +819,7 @@ class Bt {
819
819
  }
820
820
  /** Sign out the current user */
821
821
  async signOut() {
822
- await so(this._auth);
822
+ await lo(this._auth);
823
823
  }
824
824
  /** Currently signed-in user, or null if not authenticated */
825
825
  get currentUser() {
@@ -827,7 +827,7 @@ class Bt {
827
827
  }
828
828
  /** Subscribe to authentication state changes. Returns an unsubscribe function. */
829
829
  onAuthStateChanged(t) {
830
- return ao(this._auth, t);
830
+ return ho(this._auth, t);
831
831
  }
832
832
  /** Get the Firebase ID token for the current user, or null if not authenticated */
833
833
  async getToken(t = !1) {
@@ -839,8 +839,8 @@ class Bt {
839
839
  * force-refreshed and the request is retried once before throwing.
840
840
  */
841
841
  async authenticatedFetch(t, e = {}) {
842
- const o = async (a) => {
843
- const i = await this.getToken(a);
842
+ const o = async (s) => {
843
+ const i = await this.getToken(s);
844
844
  if (!i) throw new Error("Not authenticated. Call cue.auth.signIn() first.");
845
845
  const { headers: n, ...p } = e;
846
846
  return fetch(t, {
@@ -859,14 +859,14 @@ class Bt {
859
859
  return this._auth;
860
860
  }
861
861
  }
862
- class Wr extends Error {
862
+ class Jr extends Error {
863
863
  constructor(t, e, o) {
864
864
  super(t), this.status = e, this.code = o;
865
865
  }
866
866
  status;
867
867
  code;
868
868
  }
869
- class Gt {
869
+ class Xt {
870
870
  constructor(t) {
871
871
  this._gatewayUrl = t;
872
872
  }
@@ -882,7 +882,7 @@ class Gt {
882
882
  */
883
883
  async signUp(t, e, o, r) {
884
884
  return this._publicPost(
885
- qo,
885
+ Wo,
886
886
  { name: t, email: e, password: o, termsVersion: r },
887
887
  "Sign-up failed"
888
888
  );
@@ -896,11 +896,11 @@ class Gt {
896
896
  * 'domainBlocked' for the mappable failure modes.
897
897
  */
898
898
  async signUpWithOrganization(t) {
899
- return this._publicPost(Go, t, "Organisation sign-up failed");
899
+ return this._publicPost(Qo, t, "Organisation sign-up failed");
900
900
  }
901
901
  /** Re-send the verification + set-password emails after a sign-up. */
902
902
  async resendSignUpEmails(t) {
903
- return this._publicPost(zo, { email: t }, "Resend failed");
903
+ return this._publicPost(Vo, { email: t }, "Resend failed");
904
904
  }
905
905
  async _publicPost(t, e, o) {
906
906
  const r = await fetch(`${this._gatewayUrl}${t}`, {
@@ -909,21 +909,21 @@ class Gt {
909
909
  body: JSON.stringify(e)
910
910
  });
911
911
  if (!r.ok) {
912
- const a = await r.json().catch(() => ({}));
913
- throw new Wr(
914
- a?.message ?? `${o} (${r.status})`,
912
+ const s = await r.json().catch(() => ({}));
913
+ throw new Jr(
914
+ s?.message ?? `${o} (${r.status})`,
915
915
  r.status,
916
- a?.code
916
+ s?.code
917
917
  );
918
918
  }
919
919
  return r.json();
920
920
  }
921
921
  }
922
- const Vr = {
923
- raw: Br,
924
- processed: Ce
922
+ const Zr = {
923
+ raw: Kr,
924
+ processed: $e
925
925
  };
926
- class Ht {
926
+ class Kt {
927
927
  constructor(t, e) {
928
928
  this._auth = t, this._gatewayUrl = e;
929
929
  }
@@ -941,7 +941,7 @@ class Ht {
941
941
  * @param bucket - `'raw'` (default, original uploads) or `'processed'` (derived artefacts).
942
942
  */
943
943
  getDownloadUrl(t, e, o, r = "raw") {
944
- return `${this._gatewayUrl}${Vr[r]}/${t}/${e}${o}`;
944
+ return `${this._gatewayUrl}${Zr[r]}/${t}/${e}${o}`;
945
945
  }
946
946
  /**
947
947
  * Returns a gateway download URL for an alternative representation using its
@@ -954,14 +954,14 @@ class Ht {
954
954
  * e.g. `{projectId}/fragments/{uuid}.fragments`.
955
955
  */
956
956
  getAltRepDownloadUrl(t) {
957
- return `${this._gatewayUrl}${Ce}/${t}`;
957
+ return `${this._gatewayUrl}${$e}/${t}`;
958
958
  }
959
959
  /**
960
960
  * Fetch a file through the gateway and return it as a Blob.
961
961
  * Convenience wrapper around `getDownloadUrl` + `authenticatedFetch`.
962
962
  */
963
963
  async downloadBlob(t, e, o, r = "raw") {
964
- const a = this.getDownloadUrl(t, e, o, r), i = await this._auth.authenticatedFetch(a, {
964
+ const s = this.getDownloadUrl(t, e, o, r), i = await this._auth.authenticatedFetch(s, {
965
965
  headers: { "cue-project-id": t }
966
966
  });
967
967
  if (!i.ok)
@@ -969,8 +969,8 @@ class Ht {
969
969
  return i.blob();
970
970
  }
971
971
  }
972
- const Xr = "/data-views/tables", Qr = "/commands/tables";
973
- class Kr {
972
+ const ts = "/data-views/tables", es = "/commands/tables";
973
+ class os {
974
974
  constructor(t, e) {
975
975
  this._auth = t, this._gatewayUrl = e;
976
976
  }
@@ -978,7 +978,7 @@ class Kr {
978
978
  _gatewayUrl;
979
979
  async listTables(t) {
980
980
  const e = await this._auth.authenticatedFetch(
981
- `${this._gatewayUrl}${Xr}`,
981
+ `${this._gatewayUrl}${ts}`,
982
982
  {
983
983
  headers: {
984
984
  "Content-Type": "application/json",
@@ -993,7 +993,7 @@ class Kr {
993
993
  }
994
994
  async saveTables(t, e) {
995
995
  const o = await this._auth.authenticatedFetch(
996
- `${this._gatewayUrl}${Qr}`,
996
+ `${this._gatewayUrl}${es}`,
997
997
  {
998
998
  method: "PUT",
999
999
  headers: {
@@ -1008,8 +1008,8 @@ class Kr {
1008
1008
  throw new Error(`Failed to save tables: ${o.status} ${o.statusText}`);
1009
1009
  }
1010
1010
  }
1011
- const Yr = "/semantic-extraction/extract";
1012
- class Jr {
1011
+ const rs = "/semantic-extraction/extract";
1012
+ class ss {
1013
1013
  constructor(t, e) {
1014
1014
  this._auth = t, this._gatewayUrl = e;
1015
1015
  }
@@ -1026,7 +1026,7 @@ class Jr {
1026
1026
  const e = t.rdfFormat ?? "json-ld", o = new FormData();
1027
1027
  o.append("file", t.image, "page.png"), o.append("template", JSON.stringify(t.template)), o.append("space_id", t.projectId), o.append("rdf_format", e), t.category && o.append("category", t.category), t.text && o.append("text", t.text);
1028
1028
  const r = await this._auth.authenticatedFetch(
1029
- `${this._gatewayUrl}${Yr}`,
1029
+ `${this._gatewayUrl}${rs}`,
1030
1030
  {
1031
1031
  method: "POST",
1032
1032
  // Do NOT set Content-Type; browser sets it with the correct boundary.
@@ -1047,7 +1047,7 @@ class Jr {
1047
1047
  return { jsonld: await r.json() };
1048
1048
  }
1049
1049
  }
1050
- class Zr {
1050
+ class as {
1051
1051
  constructor(t, e) {
1052
1052
  this._auth = t, this._gatewayUrl = e;
1053
1053
  }
@@ -1063,7 +1063,7 @@ class Zr {
1063
1063
  * @param contextId - The context document ID (without the `.json.gz` suffix).
1064
1064
  */
1065
1065
  async getContext(t, e) {
1066
- const o = `${this._gatewayUrl}${Fr}/${t}/contexts/${e}.json.gz`, r = await this._auth.authenticatedFetch(o, {
1066
+ const o = `${this._gatewayUrl}${Xr}/${t}/contexts/${e}.json.gz`, r = await this._auth.authenticatedFetch(o, {
1067
1067
  headers: {
1068
1068
  "cue-project-id": t,
1069
1069
  // Prevent the HTTP layer from auto-decompressing so we can handle it explicitly.
@@ -1072,11 +1072,11 @@ class Zr {
1072
1072
  });
1073
1073
  if (!r.ok)
1074
1074
  throw new Error(`Failed to fetch context ${e}: ${r.status} ${r.statusText}`);
1075
- const a = new DecompressionStream("gzip"), i = r.body.pipeThrough(a);
1075
+ const s = new DecompressionStream("gzip"), i = r.body.pipeThrough(s);
1076
1076
  return JSON.parse(await new Response(i).text());
1077
1077
  }
1078
1078
  }
1079
- class ts {
1079
+ class is {
1080
1080
  constructor(t, e) {
1081
1081
  this._auth = t, this._gatewayUrl = e;
1082
1082
  }
@@ -1084,7 +1084,7 @@ class ts {
1084
1084
  _gatewayUrl;
1085
1085
  async search(t, e, o) {
1086
1086
  const r = await this._auth.authenticatedFetch(
1087
- `${this._gatewayUrl}${Ar}`,
1087
+ `${this._gatewayUrl}${jr}`,
1088
1088
  {
1089
1089
  method: "POST",
1090
1090
  headers: { "Content-Type": "application/json", "x-project-id": e },
@@ -1097,7 +1097,7 @@ class ts {
1097
1097
  async lookup(t, e, o) {
1098
1098
  console.log(`CueIndexApi.lookup: input=${t}, projectId=${e}, opts=${JSON.stringify(o)}`);
1099
1099
  const r = await this._auth.authenticatedFetch(
1100
- `${this._gatewayUrl}${Or}`,
1100
+ `${this._gatewayUrl}${Lr}`,
1101
1101
  {
1102
1102
  method: "POST",
1103
1103
  headers: { "Content-Type": "application/json", "x-project-id": e },
@@ -1121,7 +1121,7 @@ class ts {
1121
1121
  async availableFilters(t, e) {
1122
1122
  console.log(`CueIndexApi.availableFilters(projectId=${t}, applied=${JSON.stringify(e)})`);
1123
1123
  const o = await this._auth.authenticatedFetch(
1124
- `${this._gatewayUrl}${Pr}`,
1124
+ `${this._gatewayUrl}${Ur}`,
1125
1125
  {
1126
1126
  method: "POST",
1127
1127
  headers: { "Content-Type": "application/json", "x-project-id": t },
@@ -1143,17 +1143,17 @@ class ts {
1143
1143
  */
1144
1144
  async rebuild(t, e) {
1145
1145
  const o = await this._auth.authenticatedFetch(
1146
- `${this._gatewayUrl}${Lr}`,
1146
+ `${this._gatewayUrl}${Br}`,
1147
1147
  { method: "POST", headers: { "x-project-id": t } }
1148
1148
  );
1149
1149
  if (!o.ok || !o.body)
1150
1150
  throw new Error(`Index rebuild failed: ${o.status} ${o.statusText}`);
1151
- const r = o.body.getReader(), a = new TextDecoder();
1151
+ const r = o.body.getReader(), s = new TextDecoder();
1152
1152
  let i = "", n;
1153
1153
  for (; ; ) {
1154
1154
  const { done: p, value: c } = await r.read();
1155
1155
  if (p) break;
1156
- i += a.decode(c, { stream: !0 });
1156
+ i += s.decode(c, { stream: !0 });
1157
1157
  const h = i.split(`
1158
1158
  `);
1159
1159
  i = h.pop() ?? "";
@@ -1175,7 +1175,7 @@ class ts {
1175
1175
  */
1176
1176
  async refreshStats(t) {
1177
1177
  const e = t ? `?projectId=${encodeURIComponent(t)}` : "", o = await this._auth.authenticatedFetch(
1178
- `${this._gatewayUrl}${Ur}${e}`,
1178
+ `${this._gatewayUrl}${Gr}${e}`,
1179
1179
  { method: "POST" }
1180
1180
  );
1181
1181
  if (!o.ok)
@@ -1184,59 +1184,59 @@ class ts {
1184
1184
  return t ? "Refreshed stats for this project." : `Refreshed stats for ${r.totalDatasets} project(s).`;
1185
1185
  }
1186
1186
  }
1187
- const es = "@qaecy/cue-sdk", os = "0.0.34";
1188
- function rs(s) {
1187
+ const ns = "@qaecy/cue-sdk", ps = "0.0.34";
1188
+ function cs(a) {
1189
1189
  const t = {};
1190
- return new Headers(s).forEach((e, o) => {
1190
+ return new Headers(a).forEach((e, o) => {
1191
1191
  t[o] = e;
1192
1192
  }), t;
1193
1193
  }
1194
- function xe(s) {
1195
- return s.filter((t) => t.type === "text").map((t) => t.text).join(`
1194
+ function Pe(a) {
1195
+ return a.filter((t) => t.type === "text").map((t) => t.text).join(`
1196
1196
  `);
1197
1197
  }
1198
- function ss(s) {
1199
- return typeof s == "object" && s !== null && typeof s.error == "string" && !("id" in s);
1198
+ function ls(a) {
1199
+ return typeof a == "object" && a !== null && typeof a.error == "string" && !("id" in a);
1200
1200
  }
1201
- function as(s) {
1202
- const t = s.structuredContent;
1201
+ function hs(a) {
1202
+ const t = a.structuredContent;
1203
1203
  if (t != null) return t;
1204
- const e = xe(s.content);
1204
+ const e = Pe(a.content);
1205
1205
  try {
1206
1206
  return JSON.parse(e);
1207
1207
  } catch {
1208
1208
  return e;
1209
1209
  }
1210
1210
  }
1211
- class is {
1211
+ class ds {
1212
1212
  constructor(t, e) {
1213
1213
  this._auth = t, this._gatewayUrl = e;
1214
1214
  }
1215
1215
  _auth;
1216
1216
  _gatewayUrl;
1217
1217
  async callTool(t, e, o) {
1218
- const r = new go({ name: es, version: os }), a = new mo(
1219
- new URL(`${this._gatewayUrl}${Rr}`),
1218
+ const r = new vo({ name: ns, version: ps }), s = new _o(
1219
+ new URL(`${this._gatewayUrl}${Nr}`),
1220
1220
  {
1221
1221
  // Route every MCP HTTP request through the SDK's authenticated fetch so
1222
1222
  // the gateway sees a Firebase Bearer token (and 401s trigger a refresh).
1223
1223
  // The transport passes headers as a `Headers` instance; authenticatedFetch
1224
1224
  // merges via object spread, which drops a `Headers` object — so flatten to
1225
1225
  // a plain record first to preserve content-type/accept/session headers.
1226
- fetch: (i, n) => this._auth.authenticatedFetch(i.toString(), { ...n, headers: rs(n?.headers) })
1226
+ fetch: (i, n) => this._auth.authenticatedFetch(i.toString(), { ...n, headers: cs(n?.headers) })
1227
1227
  }
1228
1228
  );
1229
1229
  try {
1230
- await r.connect(a);
1230
+ await r.connect(s);
1231
1231
  const i = await r.callTool(
1232
1232
  { name: t, arguments: e },
1233
1233
  void 0,
1234
1234
  o?.signal ? { signal: o.signal } : void 0
1235
1235
  );
1236
1236
  if (i.isError)
1237
- throw new Error(`MCP tool '${t}' failed: ${xe(i.content) || "unknown error"}`);
1238
- const n = as(i);
1239
- if (ss(n))
1237
+ throw new Error(`MCP tool '${t}' failed: ${Pe(i.content) || "unknown error"}`);
1238
+ const n = hs(i);
1239
+ if (ls(n))
1240
1240
  throw new Error(`MCP tool '${t}' failed: ${n.error}`);
1241
1241
  return n;
1242
1242
  } finally {
@@ -1245,8 +1245,8 @@ class is {
1245
1245
  }
1246
1246
  }
1247
1247
  }
1248
- const ns = "/data-views/app-data", ps = "/commands/app-data";
1249
- class cs {
1248
+ const us = "/data-views/app-data", gs = "/commands/app-data";
1249
+ class ms {
1250
1250
  constructor(t, e) {
1251
1251
  this._auth = t, this._gatewayUrl = e;
1252
1252
  }
@@ -1258,7 +1258,7 @@ class cs {
1258
1258
  */
1259
1259
  async get(t) {
1260
1260
  const e = await this._auth.authenticatedFetch(
1261
- `${this._gatewayUrl}${ns}/${encodeURIComponent(t)}`,
1261
+ `${this._gatewayUrl}${us}/${encodeURIComponent(t)}`,
1262
1262
  { headers: { "Content-Type": "application/json" } }
1263
1263
  );
1264
1264
  if (!e.ok)
@@ -1272,7 +1272,7 @@ class cs {
1272
1272
  */
1273
1273
  async set(t, e) {
1274
1274
  const o = await this._auth.authenticatedFetch(
1275
- `${this._gatewayUrl}${ps}/${encodeURIComponent(t)}`,
1275
+ `${this._gatewayUrl}${gs}/${encodeURIComponent(t)}`,
1276
1276
  {
1277
1277
  method: "PUT",
1278
1278
  headers: { "Content-Type": "application/json" },
@@ -1291,8 +1291,8 @@ class cs {
1291
1291
  }
1292
1292
  }
1293
1293
  }
1294
- const Wt = "/data-views/custom-apps", rt = "/commands/custom-apps";
1295
- class ls {
1294
+ const Qt = "/data-views/custom-apps", rt = "/commands/custom-apps";
1295
+ class ws {
1296
1296
  constructor(t, e) {
1297
1297
  this._auth = t, this._gatewayUrl = e;
1298
1298
  }
@@ -1301,7 +1301,7 @@ class ls {
1301
1301
  /** List every custom app shared within the given organization (metadata only, no HTML). */
1302
1302
  async list(t) {
1303
1303
  const e = await this._auth.authenticatedFetch(
1304
- `${this._gatewayUrl}${Wt}?organizationId=${encodeURIComponent(t)}`
1304
+ `${this._gatewayUrl}${Qt}?organizationId=${encodeURIComponent(t)}`
1305
1305
  );
1306
1306
  if (!e.ok)
1307
1307
  throw new Error(`Failed to list custom apps: ${e.status} ${e.statusText}`);
@@ -1310,7 +1310,7 @@ class ls {
1310
1310
  /** Fetch a single custom app's full record, including its HTML body. */
1311
1311
  async get(t) {
1312
1312
  const e = await this._auth.authenticatedFetch(
1313
- `${this._gatewayUrl}${Wt}/${encodeURIComponent(t)}`
1313
+ `${this._gatewayUrl}${Qt}/${encodeURIComponent(t)}`
1314
1314
  );
1315
1315
  if (!e.ok)
1316
1316
  throw new Error(`Failed to fetch custom app: ${e.status} ${e.statusText}`);
@@ -1351,7 +1351,7 @@ class ls {
1351
1351
  throw new Error(`Failed to delete custom app: ${e.status} ${e.statusText}`);
1352
1352
  }
1353
1353
  }
1354
- class hs {
1354
+ class fs {
1355
1355
  constructor(t, e) {
1356
1356
  this._auth = t, this._gatewayUrl = e;
1357
1357
  }
@@ -1363,7 +1363,7 @@ class hs {
1363
1363
  */
1364
1364
  async get() {
1365
1365
  const t = await this._auth.authenticatedFetch(
1366
- `${this._gatewayUrl}${Bo}`,
1366
+ `${this._gatewayUrl}${Ko}`,
1367
1367
  { headers: { "Content-Type": "application/json" } }
1368
1368
  );
1369
1369
  if (!t.ok)
@@ -1377,7 +1377,7 @@ class hs {
1377
1377
  */
1378
1378
  async set(t) {
1379
1379
  const e = await this._auth.authenticatedFetch(
1380
- `${this._gatewayUrl}${Fo}`,
1380
+ `${this._gatewayUrl}${Xo}`,
1381
1381
  {
1382
1382
  method: "PUT",
1383
1383
  headers: { "Content-Type": "application/json" },
@@ -1397,7 +1397,7 @@ class hs {
1397
1397
  }
1398
1398
  }
1399
1399
  const st = 3e3;
1400
- class ds {
1400
+ class ys {
1401
1401
  constructor(t, e) {
1402
1402
  this._auth = t, this._gatewayUrl = e;
1403
1403
  }
@@ -1410,7 +1410,7 @@ class ds {
1410
1410
  */
1411
1411
  watchStatus(t) {
1412
1412
  const { signal: e, close: o } = this._open(
1413
- Gr,
1413
+ Qr,
1414
1414
  { projectId: t },
1415
1415
  `project "${t}"`
1416
1416
  );
@@ -1430,7 +1430,7 @@ class ds {
1430
1430
  */
1431
1431
  watchMyStatus() {
1432
1432
  const { signal: t, close: e } = this._open(
1433
- Hr,
1433
+ Yr,
1434
1434
  {},
1435
1435
  "current user"
1436
1436
  );
@@ -1444,7 +1444,7 @@ class ds {
1444
1444
  */
1445
1445
  _open(t, e, o) {
1446
1446
  const r = new E(void 0);
1447
- let a = null, i = null, n = !1;
1447
+ let s = null, i = null, n = !1;
1448
1448
  const p = async () => {
1449
1449
  if (n) return;
1450
1450
  const c = await this._auth.getToken();
@@ -1454,29 +1454,29 @@ class ds {
1454
1454
  return;
1455
1455
  }
1456
1456
  const h = `${this._gatewayUrl.replace(/^http/, "ws")}${t}`, d = new URLSearchParams({ ...e, token: c }), u = `${h}?${d.toString()}`;
1457
- a = new WebSocket(u), a.onopen = () => console.info(`[CueProcessingApi] connected for ${o}`), a.onmessage = (m) => {
1457
+ s = new WebSocket(u), s.onopen = () => console.info(`[CueProcessingApi] connected for ${o}`), s.onmessage = (m) => {
1458
1458
  try {
1459
1459
  r.set(JSON.parse(m.data));
1460
1460
  } catch (w) {
1461
1461
  console.warn("[CueProcessingApi] failed to parse status payload", w);
1462
1462
  }
1463
- }, a.onclose = (m) => {
1463
+ }, s.onclose = (m) => {
1464
1464
  n || (console.warn(
1465
1465
  `[CueProcessingApi] connection closed (code=${m.code}${m.reason ? `, reason=${m.reason}` : ""}), reconnecting in ${st}ms`
1466
1466
  ), i = setTimeout(p, st));
1467
- }, a.onerror = () => {
1467
+ }, s.onerror = () => {
1468
1468
  console.warn(`[CueProcessingApi] WebSocket error for ${o} (url=${u})`);
1469
1469
  };
1470
1470
  };
1471
1471
  return p(), {
1472
1472
  signal: r,
1473
1473
  close: () => {
1474
- n = !0, i !== null && clearTimeout(i), a?.close();
1474
+ n = !0, i !== null && clearTimeout(i), s?.close();
1475
1475
  }
1476
1476
  };
1477
1477
  }
1478
1478
  }
1479
- class us {
1479
+ class bs {
1480
1480
  constructor(t, e) {
1481
1481
  this._auth = t, this._gatewayUrl = e;
1482
1482
  }
@@ -1485,7 +1485,7 @@ class us {
1485
1485
  /** Lists the DMS providers this project can sync from. */
1486
1486
  async listSupportedProviders() {
1487
1487
  const t = await this._auth.authenticatedFetch(
1488
- `${this._gatewayUrl}${Mr}`,
1488
+ `${this._gatewayUrl}${Hr}`,
1489
1489
  { headers: { "Content-Type": "application/json" } }
1490
1490
  );
1491
1491
  if (!t.ok)
@@ -1499,7 +1499,7 @@ class us {
1499
1499
  */
1500
1500
  async previewSync(t, e, o) {
1501
1501
  const r = await this._auth.authenticatedFetch(
1502
- `${this._gatewayUrl}${qr(t)}`,
1502
+ `${this._gatewayUrl}${Wr(t)}`,
1503
1503
  {
1504
1504
  method: "POST",
1505
1505
  headers: {
@@ -1520,7 +1520,7 @@ class us {
1520
1520
  */
1521
1521
  async confirmSync(t, e, o) {
1522
1522
  const r = await this._auth.authenticatedFetch(
1523
- `${this._gatewayUrl}${zr(t)}`,
1523
+ `${this._gatewayUrl}${Vr(t)}`,
1524
1524
  {
1525
1525
  method: "POST",
1526
1526
  headers: {
@@ -1536,8 +1536,8 @@ class us {
1536
1536
  return r.json();
1537
1537
  }
1538
1538
  }
1539
- const gs = "/llm-tools/wrangling-schema/generate", ms = "/llm-tools/wrangling-schema/refine";
1540
- class ws {
1539
+ const vs = "/llm-tools/wrangling-schema/generate", _s = "/llm-tools/wrangling-schema/refine";
1540
+ class Es {
1541
1541
  constructor(t, e) {
1542
1542
  this._auth = t, this._gatewayUrl = e;
1543
1543
  }
@@ -1550,7 +1550,7 @@ class ws {
1550
1550
  */
1551
1551
  async generateWranglingSchema(t) {
1552
1552
  const e = await this._auth.authenticatedFetch(
1553
- `${this._gatewayUrl}${gs}`,
1553
+ `${this._gatewayUrl}${vs}`,
1554
1554
  {
1555
1555
  method: "POST",
1556
1556
  headers: {
@@ -1581,7 +1581,7 @@ class ws {
1581
1581
  */
1582
1582
  async refineWranglingSchema(t) {
1583
1583
  const e = await this._auth.authenticatedFetch(
1584
- `${this._gatewayUrl}${ms}`,
1584
+ `${this._gatewayUrl}${_s}`,
1585
1585
  {
1586
1586
  method: "POST",
1587
1587
  headers: {
@@ -1607,15 +1607,15 @@ class ws {
1607
1607
  return e.json();
1608
1608
  }
1609
1609
  }
1610
- const $ = "/commands/data-sources", Vt = "/data-views/data-sources";
1611
- class fs {
1610
+ const N = "/commands/data-sources", Yt = "/data-views/data-sources";
1611
+ class Ts {
1612
1612
  constructor(t, e) {
1613
1613
  this._auth = t, this._gatewayUrl = e;
1614
1614
  }
1615
1615
  _auth;
1616
1616
  _gatewayUrl;
1617
1617
  async createDataSource(t, e, o) {
1618
- const r = await this._auth.authenticatedFetch(`${this._gatewayUrl}${$}`, {
1618
+ const r = await this._auth.authenticatedFetch(`${this._gatewayUrl}${N}`, {
1619
1619
  method: "POST",
1620
1620
  headers: { "Content-Type": "application/json", "x-project-id": t, "cue-project-id": t },
1621
1621
  body: JSON.stringify({ name: e, config: o })
@@ -1625,7 +1625,7 @@ class fs {
1625
1625
  return r.json();
1626
1626
  }
1627
1627
  async updateDataSource(t, e, o) {
1628
- const r = await this._auth.authenticatedFetch(`${this._gatewayUrl}${$}/${e}`, {
1628
+ const r = await this._auth.authenticatedFetch(`${this._gatewayUrl}${N}/${e}`, {
1629
1629
  method: "PATCH",
1630
1630
  headers: { "Content-Type": "application/json", "x-project-id": t, "cue-project-id": t },
1631
1631
  body: JSON.stringify(o)
@@ -1636,7 +1636,7 @@ class fs {
1636
1636
  }
1637
1637
  /** Hard delete — also removes the data source's triples from the graph/ledger. */
1638
1638
  async deleteDataSource(t, e) {
1639
- const o = await this._auth.authenticatedFetch(`${this._gatewayUrl}${$}/${e}`, {
1639
+ const o = await this._auth.authenticatedFetch(`${this._gatewayUrl}${N}/${e}`, {
1640
1640
  method: "DELETE",
1641
1641
  headers: { "x-project-id": t, "cue-project-id": t }
1642
1642
  });
@@ -1658,10 +1658,10 @@ class fs {
1658
1658
  * non-2xx HTTP status, e.g. an auth/guard rejection before the handler even
1659
1659
  * runs, is still thrown from `response.ok` as before).
1660
1660
  */
1661
- async uploadData(t, e, o, r, a) {
1661
+ async uploadData(t, e, o, r, s) {
1662
1662
  const i = new FormData();
1663
1663
  o.forEach((p) => i.append("files", p)), i.append("mode", r);
1664
- const n = await this._auth.authenticatedFetch(`${this._gatewayUrl}${$}/${e}/data`, {
1664
+ const n = await this._auth.authenticatedFetch(`${this._gatewayUrl}${N}/${e}/data`, {
1665
1665
  method: "POST",
1666
1666
  // Do NOT set Content-Type; the runtime sets it with the correct multipart boundary.
1667
1667
  headers: { "x-project-id": t, "cue-project-id": t },
@@ -1669,7 +1669,7 @@ class fs {
1669
1669
  });
1670
1670
  if (!n.ok)
1671
1671
  throw new Error(await this._errorMessage("Data source upload failed", n));
1672
- return this._consumeNdjsonResult(n, a, "Data source upload");
1672
+ return this._consumeNdjsonResult(n, s, "Data source upload");
1673
1673
  }
1674
1674
  /**
1675
1675
  * Dry-run: runs `config` against `files` and returns the resulting Turtle,
@@ -1680,13 +1680,13 @@ class fs {
1680
1680
  * progress the same way — see `uploadData`'s doc comment.
1681
1681
  */
1682
1682
  async previewTransform(t, e, o, r) {
1683
- const a = new FormData();
1684
- o.forEach((n) => a.append("files", n)), a.append("config", JSON.stringify(e));
1685
- const i = await this._auth.authenticatedFetch(`${this._gatewayUrl}${$}/preview`, {
1683
+ const s = new FormData();
1684
+ o.forEach((n) => s.append("files", n)), s.append("config", JSON.stringify(e));
1685
+ const i = await this._auth.authenticatedFetch(`${this._gatewayUrl}${N}/preview`, {
1686
1686
  method: "POST",
1687
1687
  // Do NOT set Content-Type; the runtime sets it with the correct multipart boundary.
1688
1688
  headers: { "x-project-id": t, "cue-project-id": t },
1689
- body: a
1689
+ body: s
1690
1690
  });
1691
1691
  if (!i.ok)
1692
1692
  throw new Error(await this._errorMessage("Data source preview failed", i));
@@ -1697,14 +1697,14 @@ class fs {
1697
1697
  * resolving/rejecting with the terminal event. The HTTP status alone can't signal
1698
1698
  * failure here — the server commits to 200 as soon as the first line is written. */
1699
1699
  async _consumeNdjsonResult(t, e, o) {
1700
- let r, a;
1700
+ let r, s;
1701
1701
  const i = (n) => {
1702
1702
  if (n.type === "progress")
1703
1703
  e?.({ phase: String(n.phase), message: String(n.message), pct: n.pct });
1704
1704
  else if (n.type === "result") {
1705
1705
  const { type: p, ...c } = n;
1706
1706
  r = c;
1707
- } else n.type === "error" && (a = String(n.message));
1707
+ } else n.type === "error" && (s = String(n.message));
1708
1708
  };
1709
1709
  if (!t.body)
1710
1710
  (await t.text()).split(`
@@ -1726,12 +1726,12 @@ class fs {
1726
1726
  const h = c.trim();
1727
1727
  h && i(JSON.parse(h));
1728
1728
  }
1729
- if (a) throw new Error(`${o} failed: ${a}`);
1729
+ if (s) throw new Error(`${o} failed: ${s}`);
1730
1730
  if (r === void 0) throw new Error(`${o} failed: stream ended without a result.`);
1731
1731
  return r;
1732
1732
  }
1733
1733
  async listDataSources(t) {
1734
- const e = await this._auth.authenticatedFetch(`${this._gatewayUrl}${Vt}`, {
1734
+ const e = await this._auth.authenticatedFetch(`${this._gatewayUrl}${Yt}`, {
1735
1735
  headers: { "x-project-id": t, "cue-project-id": t }
1736
1736
  });
1737
1737
  if (!e.ok)
@@ -1739,7 +1739,7 @@ class fs {
1739
1739
  return e.json();
1740
1740
  }
1741
1741
  async getDataSource(t, e) {
1742
- const o = await this._auth.authenticatedFetch(`${this._gatewayUrl}${Vt}/${e}`, {
1742
+ const o = await this._auth.authenticatedFetch(`${this._gatewayUrl}${Yt}/${e}`, {
1743
1743
  headers: { "x-project-id": t, "cue-project-id": t }
1744
1744
  });
1745
1745
  if (!o.ok)
@@ -1751,9 +1751,74 @@ class fs {
1751
1751
  return `${t}: ${e.status} ${e.statusText}${o ? " — " + o.slice(0, 300) : ""}`;
1752
1752
  }
1753
1753
  }
1754
- class Xt {
1754
+ const at = "/commands/gis-sources", Jt = "/data-views/gis-sources";
1755
+ class ks {
1756
+ constructor(t, e) {
1757
+ this._auth = t, this._gatewayUrl = e;
1758
+ }
1759
+ _auth;
1760
+ _gatewayUrl;
1761
+ async listGisSources(t) {
1762
+ const e = await this._auth.authenticatedFetch(`${this._gatewayUrl}${Jt}`, {
1763
+ headers: { "x-project-id": t, "cue-project-id": t }
1764
+ });
1765
+ if (!e.ok)
1766
+ throw new Error(await this._errorMessage("List GIS sources failed", e));
1767
+ return e.json();
1768
+ }
1769
+ async getGisSource(t, e) {
1770
+ const o = await this._auth.authenticatedFetch(`${this._gatewayUrl}${Jt}/${e}`, {
1771
+ headers: { "x-project-id": t, "cue-project-id": t }
1772
+ });
1773
+ if (!o.ok)
1774
+ throw new Error(await this._errorMessage("Get GIS source failed", o));
1775
+ return o.json();
1776
+ }
1777
+ /** `filename`'s extension (`.geojson`/`.json`/`.kml`/`.zip`) tells the server which parser to
1778
+ * use — pass it explicitly since `file` may not carry a usable `name` (e.g. a `Blob`). */
1779
+ async createGisSource(t, e, o, r, s = "auto") {
1780
+ const i = new FormData();
1781
+ i.append("name", e), i.append("crs", s), i.append("file", o, r);
1782
+ const n = await this._auth.authenticatedFetch(`${this._gatewayUrl}${at}`, {
1783
+ method: "POST",
1784
+ // Do NOT set Content-Type; the runtime sets it with the correct multipart boundary.
1785
+ headers: { "x-project-id": t, "cue-project-id": t },
1786
+ body: i
1787
+ });
1788
+ if (!n.ok)
1789
+ throw new Error(await this._errorMessage("Create GIS source failed", n));
1790
+ return n.json();
1791
+ }
1792
+ /** Omitting `file` renames the source without touching its stored features. */
1793
+ async updateGisSource(t, e, o) {
1794
+ const r = new FormData();
1795
+ o.name !== void 0 && r.append("name", o.name), o.crs !== void 0 && r.append("crs", o.crs), o.file !== void 0 && r.append("file", o.file, o.filename ?? "upload");
1796
+ const s = await this._auth.authenticatedFetch(`${this._gatewayUrl}${at}/${e}`, {
1797
+ method: "PATCH",
1798
+ // Do NOT set Content-Type; the runtime sets it with the correct multipart boundary.
1799
+ headers: { "x-project-id": t, "cue-project-id": t },
1800
+ body: r
1801
+ });
1802
+ if (!s.ok)
1803
+ throw new Error(await this._errorMessage("Update GIS source failed", s));
1804
+ return s.json();
1805
+ }
1806
+ async deleteGisSource(t, e) {
1807
+ const o = await this._auth.authenticatedFetch(`${this._gatewayUrl}${at}/${e}`, {
1808
+ method: "DELETE",
1809
+ headers: { "x-project-id": t, "cue-project-id": t }
1810
+ });
1811
+ if (!o.ok)
1812
+ throw new Error(await this._errorMessage("Delete GIS source failed", o));
1813
+ }
1814
+ async _errorMessage(t, e) {
1815
+ const o = await e.text().catch(() => "");
1816
+ return `${t}: ${e.status} ${e.statusText}${o ? " — " + o.slice(0, 300) : ""}`;
1817
+ }
1818
+ }
1819
+ class Zt {
1755
1820
  constructor(t, e, o, r) {
1756
- this._auth = t, this._gatewayUrl = e, this.projects = o, this.sync = r, this.tables = new Kr(t, e), this.extraction = new Jr(t, e), this.contexts = new Zr(t, e), this.index = new ts(t, e), this.mcp = new is(t, e), this.appData = new cs(t, e), this.apps = new ls(t, e), this.userSettings = new hs(t, e), this.processing = new ds(t, e), this.dms = new us(t, e), this.llmTools = new ws(t, e), this.dataSources = new fs(t, e);
1821
+ this._auth = t, this._gatewayUrl = e, this.projects = o, this.sync = r, this.tables = new os(t, e), this.extraction = new ss(t, e), this.contexts = new as(t, e), this.index = new is(t, e), this.mcp = new ds(t, e), this.appData = new ms(t, e), this.apps = new ws(t, e), this.userSettings = new fs(t, e), this.processing = new ys(t, e), this.dms = new bs(t, e), this.llmTools = new Es(t, e), this.dataSources = new Ts(t, e), this.gisSources = new ks(t, e);
1757
1822
  }
1758
1823
  _auth;
1759
1824
  _gatewayUrl;
@@ -1782,6 +1847,9 @@ class Xt {
1782
1847
  llmTools;
1783
1848
  /** Project-scoped data sources — reusable raw-data-to-RDF pipelines writing into their own named graph. */
1784
1849
  dataSources;
1850
+ /** Project-scoped GIS sources — user-uploaded GeoJSON/KML/Shapefile feature sets, returned by
1851
+ * `cue.gis` under the 'custom' category alongside every other GIS category. */
1852
+ gisSources;
1785
1853
  /** Active language used for language-sensitive SPARQL queries across all project classes. */
1786
1854
  language = "en";
1787
1855
  /** Updates the active language. All project classes (`CueProjectSchema`, `CueProjectDocuments`, `CueProjectEntities`) read this at query time. */
@@ -1807,7 +1875,7 @@ class Xt {
1807
1875
  */
1808
1876
  async search(t) {
1809
1877
  const e = await this._auth.authenticatedFetch(
1810
- `${this._gatewayUrl}${xr}`,
1878
+ `${this._gatewayUrl}${Pr}`,
1811
1879
  {
1812
1880
  method: "POST",
1813
1881
  headers: { "Content-Type": "application/json", "cue-project-id": t.projectId },
@@ -1830,10 +1898,10 @@ class Xt {
1830
1898
  */
1831
1899
  async sparql(t, e, o) {
1832
1900
  o || (o = (await this.projects.getProject(e))?.projectSettings?.graph?.type ?? "qlever");
1833
- const r = o === "fuseki" ? Se : Ie;
1901
+ const r = o === "fuseki" ? Oe : De;
1834
1902
  console.log(`Executing SPARQL query against ${r} for project ${e} with graph type ${o}`);
1835
- const a = new URLSearchParams();
1836
- a.append("query", t);
1903
+ const s = new URLSearchParams();
1904
+ s.append("query", t);
1837
1905
  const i = await this._auth.authenticatedFetch(
1838
1906
  `${this._gatewayUrl}${r}`,
1839
1907
  {
@@ -1844,7 +1912,7 @@ class Xt {
1844
1912
  "x-project-id": e,
1845
1913
  "cue-project-id": e
1846
1914
  },
1847
- body: a
1915
+ body: s
1848
1916
  }
1849
1917
  );
1850
1918
  if (!i.ok) {
@@ -1875,15 +1943,15 @@ class Xt {
1875
1943
  * Returns a {@link ShaclValidationReport} for JSON-LD, or a Turtle string.
1876
1944
  */
1877
1945
  async shacl(t, e, o) {
1878
- const r = o?.format ?? "json-ld", a = r === "turtle" ? "text/turtle" : "application/ld+json";
1946
+ const r = o?.format ?? "json-ld", s = r === "turtle" ? "text/turtle" : "application/ld+json";
1879
1947
  if (o?.graphType === "fuseki") {
1880
1948
  const c = await this._auth.authenticatedFetch(
1881
- `${this._gatewayUrl}${$r}`,
1949
+ `${this._gatewayUrl}${qr}`,
1882
1950
  {
1883
1951
  method: "POST",
1884
1952
  headers: {
1885
1953
  "Content-Type": "text/turtle",
1886
- Accept: a,
1954
+ Accept: s,
1887
1955
  "x-project-id": e,
1888
1956
  "cue-project-id": e
1889
1957
  },
@@ -1896,11 +1964,11 @@ class Xt {
1896
1964
  }
1897
1965
  return r === "turtle" ? c.text() : c.json();
1898
1966
  }
1899
- const i = `${this._gatewayUrl}${jr}${o?.verbose ? "?verbose=true" : ""}`, n = new URLSearchParams({ shape: t }), p = await this._auth.authenticatedFetch(i, {
1967
+ const i = `${this._gatewayUrl}${zr}${o?.verbose ? "?verbose=true" : ""}`, n = new URLSearchParams({ shape: t }), p = await this._auth.authenticatedFetch(i, {
1900
1968
  method: "POST",
1901
1969
  headers: {
1902
1970
  "Content-Type": "application/x-www-form-urlencoded",
1903
- Accept: a,
1971
+ Accept: s,
1904
1972
  "x-project-id": e,
1905
1973
  "cue-project-id": e
1906
1974
  },
@@ -1924,7 +1992,7 @@ class Xt {
1924
1992
  }
1925
1993
  async getConsumption(t) {
1926
1994
  const e = await this._auth.authenticatedFetch(
1927
- `${this._gatewayUrl}${Ro}`,
1995
+ `${this._gatewayUrl}${No}`,
1928
1996
  {
1929
1997
  headers: {
1930
1998
  "Content-Type": "application/json",
@@ -1940,7 +2008,7 @@ class Xt {
1940
2008
  return e.json();
1941
2009
  }
1942
2010
  }
1943
- const gt = [
2011
+ const mt = [
1944
2012
  "building",
1945
2013
  "cadastre",
1946
2014
  "zone",
@@ -1950,14 +2018,15 @@ const gt = [
1950
2018
  "paved",
1951
2019
  "railway",
1952
2020
  "natural",
1953
- "manmade"
1954
- ], mt = [
2021
+ "manmade",
2022
+ "custom"
2023
+ ], wt = [
1955
2024
  "address",
1956
2025
  "poi",
1957
2026
  "railway",
1958
2027
  "natural",
1959
2028
  "manmade"
1960
- ], ys = {
2029
+ ], Ss = {
1961
2030
  address: {
1962
2031
  category: "address",
1963
2032
  label: "Address",
@@ -2017,12 +2086,18 @@ const gt = [
2017
2086
  label: "Planning zones",
2018
2087
  description: "Land-use zones, local plans, and public-law planning constraints (Nutzungsplanung / Lokalplan).",
2019
2088
  preferredColor: "#db2777"
2089
+ },
2090
+ custom: {
2091
+ category: "custom",
2092
+ label: "Custom",
2093
+ description: "Features uploaded to this project (GeoJSON, KML, or Shapefile).",
2094
+ preferredColor: "#0d9488"
2020
2095
  }
2021
2096
  };
2022
- function A(s) {
2023
- return ys[s];
2097
+ function R(a) {
2098
+ return Ss[a];
2024
2099
  }
2025
- const bs = {
2100
+ const Is = {
2026
2101
  "land-use-plan": "#f59e0b",
2027
2102
  // amber – primary zoning
2028
2103
  "local-plan": "#ec4899",
@@ -2050,10 +2125,10 @@ const bs = {
2050
2125
  "nature-landscape-plan": "#16a34a"
2051
2126
  // dark-green – Natur- und Landschaftsschutz
2052
2127
  };
2053
- function H(s, t) {
2054
- return s[0] < t[2] && s[2] > t[0] && s[1] < t[3] && s[3] > t[1];
2128
+ function $(a, t) {
2129
+ return a[0] < t[2] && a[2] > t[0] && a[1] < t[3] && a[3] > t[1];
2055
2130
  }
2056
- const vs = "https://nominatim.openstreetmap.org", _s = "cue-gis/0.0.1", Es = {
2131
+ const Cs = "https://nominatim.openstreetmap.org", xs = "cue-gis/0.0.1", Rs = {
2057
2132
  address: "street",
2058
2133
  poi: "shop",
2059
2134
  railway: "station",
@@ -2063,49 +2138,52 @@ const vs = "https://nominatim.openstreetmap.org", _s = "cue-gis/0.0.1", Es = {
2063
2138
  building: "building",
2064
2139
  greenspace: "park",
2065
2140
  paved: "road",
2066
- zone: "boundary"
2067
- }, L = "nominatim";
2068
- function V(s) {
2069
- return `${L}:${s}`;
2141
+ zone: "boundary",
2142
+ // Never actually probed — 'custom' (user-uploaded GIS sources) isn't in
2143
+ // NOMINATIM_FEATURE_CATEGORIES, so this entry only exists to satisfy the Record type.
2144
+ custom: "place"
2145
+ }, U = "nominatim";
2146
+ function V(a) {
2147
+ return `${U}:${a}`;
2070
2148
  }
2071
- function Ts(s) {
2072
- const t = A(s);
2149
+ function As(a) {
2150
+ const t = R(a);
2073
2151
  return {
2074
- id: V(s),
2075
- sourceId: L,
2076
- sourceLayerId: s,
2077
- category: s,
2152
+ id: V(a),
2153
+ sourceId: U,
2154
+ sourceLayerId: a,
2155
+ category: a,
2078
2156
  preferredColor: t.preferredColor,
2079
2157
  tier: "raw",
2080
2158
  label: t.label,
2081
- description: `Nominatim ${s} layer`,
2082
- labelKey: `gis.layer.${L}.${s}.label`,
2083
- descriptionKey: `gis.layer.${L}.${s}.description`
2159
+ description: `Nominatim ${a} layer`,
2160
+ labelKey: `gis.layer.${U}.${a}.label`,
2161
+ descriptionKey: `gis.layer.${U}.${a}.description`
2084
2162
  };
2085
2163
  }
2086
- class ks {
2164
+ class Os {
2087
2165
  baseUrl;
2088
2166
  userAgent;
2089
2167
  email;
2090
2168
  limit;
2091
2169
  constructor(t = {}) {
2092
- this.baseUrl = t.baseUrl ?? vs, this.userAgent = t.userAgent ?? _s, this.email = t.email, this.limit = Math.min(t.limit ?? 40, 40);
2170
+ this.baseUrl = t.baseUrl ?? Cs, this.userAgent = t.userAgent ?? xs, this.email = t.email, this.limit = Math.min(t.limit ?? 40, 40);
2093
2171
  }
2094
2172
  async listFeatureCategoryDescriptors(t) {
2095
2173
  return (await Promise.allSettled(
2096
- mt.map(async (o) => {
2174
+ wt.map(async (o) => {
2097
2175
  const r = await this.search(t, o);
2098
2176
  return { category: o, hasResults: r.length > 0 };
2099
2177
  })
2100
2178
  )).filter(
2101
2179
  (o) => o.status === "fulfilled" && o.value.hasResults
2102
- ).map((o) => A(o.value.category));
2180
+ ).map((o) => R(o.value.category));
2103
2181
  }
2104
2182
  async listAvailableLayers(t) {
2105
- return (await this.listFeatureCategoryDescriptors(t)).map((o) => Ts(o.category));
2183
+ return (await this.listFeatureCategoryDescriptors(t)).map((o) => As(o.category));
2106
2184
  }
2107
2185
  async getFeaturesForLayer(t, e) {
2108
- const o = gt.find((r) => V(r) === e);
2186
+ const o = mt.find((r) => V(r) === e);
2109
2187
  return o ? this.search(t, o) : [];
2110
2188
  }
2111
2189
  async listFeatureCategories(t) {
@@ -2119,17 +2197,17 @@ class ks {
2119
2197
  * so bounded viewbox searches return meaningful results.
2120
2198
  */
2121
2199
  async search(t, e) {
2122
- const [o, r, a, i] = t, n = e ? Es[e] : "place", p = new URLSearchParams({
2200
+ const [o, r, s, i] = t, n = e ? Rs[e] : "place", p = new URLSearchParams({
2123
2201
  q: n,
2124
2202
  format: "jsonv2",
2125
- viewbox: `${o},${i},${a},${r}`,
2203
+ viewbox: `${o},${i},${s},${r}`,
2126
2204
  bounded: "1",
2127
2205
  limit: String(this.limit),
2128
2206
  addressdetails: "1",
2129
2207
  extratags: "1",
2130
2208
  dedupe: "1"
2131
2209
  });
2132
- e && mt.includes(e) && p.set("layer", e), this.email && p.set("email", this.email);
2210
+ e && wt.includes(e) && p.set("layer", e), this.email && p.set("email", this.email);
2133
2211
  const c = `${this.baseUrl}/search?${p.toString()}`, h = await fetch(c, {
2134
2212
  headers: {
2135
2213
  "User-Agent": this.userAgent,
@@ -2143,10 +2221,10 @@ class ks {
2143
2221
  return (await h.json()).map((u) => this.toGisFeature(u, e));
2144
2222
  }
2145
2223
  toGisFeature(t, e) {
2146
- const [o, r, a, i] = t.boundingbox, n = e ?? t.category, p = A(n);
2224
+ const [o, r, s, i] = t.boundingbox, n = e ?? t.category, p = R(n);
2147
2225
  return {
2148
2226
  id: `${t.osm_type}/${t.osm_id}`,
2149
- sourceId: L,
2227
+ sourceId: U,
2150
2228
  sourceFeatureId: `${t.osm_type}/${t.osm_id}`,
2151
2229
  layerId: V(n),
2152
2230
  name: t.name ?? t.display_name.split(",")[0].trim(),
@@ -2156,13 +2234,13 @@ class ks {
2156
2234
  lat: parseFloat(t.lat),
2157
2235
  lon: parseFloat(t.lon),
2158
2236
  displayName: t.display_name,
2159
- bbox: [parseFloat(a), parseFloat(o), parseFloat(i), parseFloat(r)],
2237
+ bbox: [parseFloat(s), parseFloat(o), parseFloat(i), parseFloat(r)],
2160
2238
  tier: "raw",
2161
2239
  originalData: t
2162
2240
  };
2163
2241
  }
2164
2242
  }
2165
- const Qt = {
2243
+ const te = {
2166
2244
  // 100s – Residential
2167
2245
  110: "residential",
2168
2246
  120: "residential",
@@ -2241,7 +2319,7 @@ const Qt = {
2241
2319
  960: "agricultural",
2242
2320
  970: "agricultural",
2243
2321
  990: "other"
2244
- }, Kt = {
2322
+ }, ee = {
2245
2323
  1010: "residential",
2246
2324
  1020: "mixed",
2247
2325
  1030: "residential",
@@ -2271,7 +2349,7 @@ const Qt = {
2271
2349
  1281: "infrastructure",
2272
2350
  1282: "infrastructure",
2273
2351
  9999: "other"
2274
- }, Ss = {
2352
+ }, Ds = {
2275
2353
  // Residential
2276
2354
  1110: "residential",
2277
2355
  // Einfamilienhaus
@@ -2333,7 +2411,7 @@ const Qt = {
2333
2411
  // Empfangsgebäude Bahn/Bus
2334
2412
  1282: "infrastructure"
2335
2413
  // Parkhaus, Garage
2336
- }, Is = [
2414
+ }, $s = [
2337
2415
  // "Gebäude" is the Swiss AV BoFlaeche land-cover label for a building footprint.
2338
2416
  // It does not encode the actual use type, so map it to 'other' as a safe fallback.
2339
2417
  [/^geb[äa]ude$/i, "other"],
@@ -2346,23 +2424,23 @@ const Qt = {
2346
2424
  [/infrastruktur|verkehr|transport|energy|energie|forsyning|teknik|teknisk/i, "infrastructure"],
2347
2425
  [/gemischt|mixed|blandet/i, "mixed"]
2348
2426
  ];
2349
- function j(s) {
2350
- for (const [t, e] of Is)
2351
- if (t.test(s)) return e;
2427
+ function L(a) {
2428
+ for (const [t, e] of $s)
2429
+ if (t.test(a)) return e;
2352
2430
  }
2353
- function Cs(s, t) {
2354
- if (s == null) return;
2355
- const e = String(s).trim();
2356
- return t === "swiss-gwr" ? Ss[e] ?? j(e) : t === "danish-matrikel" ? Qt[e] ?? j(e) : t === "zurich-wfs" || t === "swiss-av-wfs" ? Kt[e] ?? j(e) : Kt[e] ?? Qt[e] ?? j(e);
2431
+ function Ps(a, t) {
2432
+ if (a == null) return;
2433
+ const e = String(a).trim();
2434
+ return t === "swiss-gwr" ? Ds[e] ?? L(e) : t === "danish-matrikel" ? te[e] ?? L(e) : t === "zurich-wfs" || t === "swiss-av-wfs" ? ee[e] ?? L(e) : ee[e] ?? te[e] ?? L(e);
2357
2435
  }
2358
- function xs(s, t) {
2359
- if (s != null)
2360
- return j(String(s).trim());
2436
+ function Ns(a, t) {
2437
+ if (a != null)
2438
+ return L(String(a).trim());
2361
2439
  }
2362
- function Re(s) {
2363
- return s.trim().toLowerCase().replace(/[\s_\-]/g, "");
2440
+ function Ne(a) {
2441
+ return a.trim().toLowerCase().replace(/[\s_\-]/g, "");
2364
2442
  }
2365
- const Rs = {
2443
+ const js = {
2366
2444
  // Swiss ÖREB rechtsstatus
2367
2445
  inkraft: "in-force",
2368
2446
  laufendeanderung: "amendment-pending",
@@ -2381,11 +2459,11 @@ const Rs = {
2381
2459
  forslag: "proposed",
2382
2460
  aflyst: "repealed"
2383
2461
  };
2384
- function Ae(s) {
2385
- if (s)
2386
- return Rs[Re(s)];
2462
+ function je(a) {
2463
+ if (a)
2464
+ return js[Ne(a)];
2387
2465
  }
2388
- const Yt = {
2466
+ const oe = {
2389
2467
  // Swiss Nutzungsplanung (typ_gde_bezeichnung and common variants)
2390
2468
  grundnutzungszonenplan: "land-use-plan",
2391
2469
  nutzungszonenplan: "land-use-plan",
@@ -2439,7 +2517,7 @@ const Yt = {
2439
2517
  // Danish plandata.dk
2440
2518
  lokalplan: "local-plan",
2441
2519
  kommuneplanramme: "municipal-plan-framework"
2442
- }, As = [
2520
+ }, Ls = [
2443
2521
  [/quartiererhalt/i, "neighbourhood-conservation-plan"],
2444
2522
  [/lärmempfindlich|laermempfindlich/i, "noise-sensitivity-plan"],
2445
2523
  [/gewässerschutz|grundwasserschutz/i, "water-protection-plan"],
@@ -2479,27 +2557,27 @@ const Yt = {
2479
2557
  // Catch-all: any remaining Xzone / Xareal designation from the Grundnutzungszonenplan
2480
2558
  [/zone$|areal$/i, "land-use-plan"]
2481
2559
  ];
2482
- function Oe(s) {
2483
- if (!s) return;
2484
- const t = Re(s);
2485
- if (t in Yt) return Yt[t];
2486
- for (const [e, o] of As)
2487
- if (e.test(s)) return o;
2560
+ function Le(a) {
2561
+ if (!a) return;
2562
+ const t = Ne(a);
2563
+ if (t in oe) return oe[t];
2564
+ for (const [e, o] of Ls)
2565
+ if (e.test(a)) return o;
2488
2566
  console.warn(
2489
- `[cue-gis] Unknown zone plan type — add "${s}" to classifyZonePlanType: no ZonePlanType mapping found.`
2567
+ `[cue-gis] Unknown zone plan type — add "${a}" to classifyZonePlanType: no ZonePlanType mapping found.`
2490
2568
  );
2491
2569
  }
2492
- const Os = "https://maps.zh.ch/wfs/OGDZHWFS", Ps = "zurich-wfs", Ds = [8.35, 47.15, 8.95, 47.7], $s = [5.9, 45.7, 10.55, 47.85];
2493
- function at(s) {
2494
- return typeof s == "string" ? s : s.typeName;
2570
+ const Us = "https://maps.zh.ch/wfs/OGDZHWFS", Ms = "zurich-wfs", qs = [8.35, 47.15, 8.95, 47.7], Fs = [5.9, 45.7, 10.55, 47.85];
2571
+ function it(a) {
2572
+ return typeof a == "string" ? a : a.typeName;
2495
2573
  }
2496
- function it(s) {
2497
- return typeof s == "string" ? void 0 : s.cqlFilter;
2574
+ function nt(a) {
2575
+ return typeof a == "string" ? void 0 : a.cqlFilter;
2498
2576
  }
2499
- function Ns(s) {
2500
- if (!s) return [0, 0];
2501
- const t = s.coordinates;
2502
- switch (s.type) {
2577
+ function zs(a) {
2578
+ if (!a) return [0, 0];
2579
+ const t = a.coordinates;
2580
+ switch (a.type) {
2503
2581
  case "Point":
2504
2582
  return t;
2505
2583
  case "MultiPoint":
@@ -2514,82 +2592,82 @@ function Ns(s) {
2514
2592
  return [0, 0];
2515
2593
  }
2516
2594
  }
2517
- function js(s, t) {
2518
- if (!s) return t;
2595
+ function Bs(a, t) {
2596
+ if (!a) return t;
2519
2597
  for (const e of ["plannavn", "bezeichnung", "name", "strassenname", "objektname", "title", "label"])
2520
- if (typeof s[e] == "string" && s[e]) return s[e];
2598
+ if (typeof a[e] == "string" && a[e]) return a[e];
2521
2599
  return t;
2522
2600
  }
2523
- function Ls(s, t, e) {
2524
- return e ? `${s}:${t}[${e}]` : `${s}:${t}`;
2601
+ function Gs(a, t, e) {
2602
+ return e ? `${a}:${t}[${e}]` : `${a}:${t}`;
2525
2603
  }
2526
- const Us = /* @__PURE__ */ new Set(["building", "cadastre", "greenspace", "paved", "zone"]);
2527
- function nt(s, t, e, o) {
2528
- const r = e.replace(/^ms:/, ""), a = A(t), i = Us.has(t) ? "priority" : "raw";
2604
+ const Hs = /* @__PURE__ */ new Set(["building", "cadastre", "greenspace", "paved", "zone"]);
2605
+ function pt(a, t, e, o) {
2606
+ const r = e.replace(/^ms:/, ""), s = R(t), i = Hs.has(t) ? "priority" : "raw";
2529
2607
  return {
2530
- id: Ls(s, e, o),
2531
- sourceId: s,
2608
+ id: Gs(a, e, o),
2609
+ sourceId: a,
2532
2610
  sourceLayerId: e,
2533
2611
  category: t,
2534
- preferredColor: a.preferredColor,
2612
+ preferredColor: s.preferredColor,
2535
2613
  tier: i,
2536
2614
  label: r,
2537
2615
  description: `Zürich WFS layer ${r}`,
2538
- labelKey: `gis.layer.${s}.${r}.label`,
2539
- descriptionKey: `gis.layer.${s}.${r}.description`
2616
+ labelKey: `gis.layer.${a}.${r}.label`,
2617
+ descriptionKey: `gis.layer.${a}.${r}.description`
2540
2618
  };
2541
2619
  }
2542
- function Ms(s, t) {
2543
- if (!s) return { featureType: "building" };
2544
- const e = s.grundflaeche ?? s.gbf ?? s.gebaeudegrundrissflaeche ?? s.flaeche ?? void 0, o = s.vollgeschosse ?? s.geschossanzahl ?? s.anzahl_geschosse ?? void 0, r = s.gebaeudefunktion ?? s.gfkode ?? s.art ?? s.objektart ?? void 0, a = s.baujahr ?? s.bauperiode ?? void 0, i = String(s.egid ?? s.gwr_egid ?? s.egris_egid ?? "").trim() || void 0;
2620
+ function Ws(a, t) {
2621
+ if (!a) return { featureType: "building" };
2622
+ const e = a.grundflaeche ?? a.gbf ?? a.gebaeudegrundrissflaeche ?? a.flaeche ?? void 0, o = a.vollgeschosse ?? a.geschossanzahl ?? a.anzahl_geschosse ?? void 0, r = a.gebaeudefunktion ?? a.gfkode ?? a.art ?? a.objektart ?? void 0, s = a.baujahr ?? a.bauperiode ?? void 0, i = String(a.egid ?? a.gwr_egid ?? a.egris_egid ?? "").trim() || void 0;
2545
2623
  return {
2546
2624
  featureType: "building",
2547
2625
  areaM2: typeof e == "number" ? e : void 0,
2548
2626
  buildingUse: r ? String(r) : void 0,
2549
- buildingUseGeneric: Cs(r, t),
2627
+ buildingUseGeneric: Ps(r, t),
2550
2628
  floors: typeof o == "number" ? o : void 0,
2551
- yearBuilt: typeof a == "number" ? a : void 0,
2629
+ yearBuilt: typeof s == "number" ? s : void 0,
2552
2630
  registryId: i
2553
2631
  };
2554
2632
  }
2555
- function qs(s, t) {
2556
- if (!s) return { featureType: "plot" };
2557
- const e = s.egris_egrid ?? s.egrid ?? void 0, o = s.nummer ?? void 0, r = s.nbident ?? void 0, a = o && r ? `${o}, ${r}` : o ?? void 0, i = s.flaechenmass ?? s.flaeche ?? void 0, n = s.art ?? s.nutzungsart ?? void 0;
2633
+ function Vs(a, t) {
2634
+ if (!a) return { featureType: "plot" };
2635
+ const e = a.egris_egrid ?? a.egrid ?? void 0, o = a.nummer ?? void 0, r = a.nbident ?? void 0, s = o && r ? `${o}, ${r}` : o ?? void 0, i = a.flaechenmass ?? a.flaeche ?? void 0, n = a.art ?? a.nutzungsart ?? void 0;
2558
2636
  return {
2559
2637
  featureType: "plot",
2560
2638
  areaM2: typeof i == "number" ? i : void 0,
2561
2639
  plotUse: n ? String(n) : void 0,
2562
- plotUseGeneric: xs(n),
2563
- plotId: a,
2640
+ plotUseGeneric: Ns(n),
2641
+ plotId: s,
2564
2642
  registryId: e
2565
2643
  };
2566
2644
  }
2567
- function zs(s) {
2568
- if (!s) return { featureType: "greenspace" };
2569
- const t = s.flaeche ?? void 0, e = s.art ?? void 0;
2645
+ function Xs(a) {
2646
+ if (!a) return { featureType: "greenspace" };
2647
+ const t = a.flaeche ?? void 0, e = a.art ?? void 0;
2570
2648
  return {
2571
2649
  featureType: "greenspace",
2572
2650
  areaM2: typeof t == "number" ? t : void 0,
2573
2651
  surfaceType: e ? String(e) : void 0
2574
2652
  };
2575
2653
  }
2576
- function Fs(s) {
2577
- if (!s) return { featureType: "paved" };
2578
- const t = s.flaeche ?? void 0, e = s.art ?? void 0;
2654
+ function Ks(a) {
2655
+ if (!a) return { featureType: "paved" };
2656
+ const t = a.flaeche ?? void 0, e = a.art ?? void 0;
2579
2657
  return {
2580
2658
  featureType: "paved",
2581
2659
  areaM2: typeof t == "number" ? t : void 0,
2582
2660
  surfaceType: e ? String(e) : void 0
2583
2661
  };
2584
2662
  }
2585
- function Bs(s) {
2586
- if (!s) return { featureType: "zone" };
2587
- const t = s.plannavn ?? s.bezeichnung ?? s.typ_bezeichnung ?? s.art ?? void 0, e = s.planid ?? s.plannummer ?? void 0, o = s.artcode ?? s.typ_code ?? s.abkuerzung ?? e ?? void 0, r = s.rechtsstatus ?? s.status ?? void 0, a = Ae(r), i = s.typ_gde_bezeichnung ?? void 0, n = Oe(i), p = s.dagsordenpunkt_url ?? s.dokument_url ?? s.link ?? void 0, c = s.auflagedatum ?? void 0, h = s.festsetzungsdatum ?? void 0, d = s.genehmigungsdatum ?? void 0, u = s.inkraftsetzungsdatum ?? void 0, m = s.flaeche ?? s.flaeche_m2 ?? void 0;
2663
+ function Qs(a) {
2664
+ if (!a) return { featureType: "zone" };
2665
+ const t = a.plannavn ?? a.bezeichnung ?? a.typ_bezeichnung ?? a.art ?? void 0, e = a.planid ?? a.plannummer ?? void 0, o = a.artcode ?? a.typ_code ?? a.abkuerzung ?? e ?? void 0, r = a.rechtsstatus ?? a.status ?? void 0, s = je(r), i = a.typ_gde_bezeichnung ?? void 0, n = Le(i), p = a.dagsordenpunkt_url ?? a.dokument_url ?? a.link ?? void 0, c = a.auflagedatum ?? void 0, h = a.festsetzungsdatum ?? void 0, d = a.genehmigungsdatum ?? void 0, u = a.inkraftsetzungsdatum ?? void 0, m = a.flaeche ?? a.flaeche_m2 ?? void 0;
2588
2666
  return {
2589
2667
  featureType: "zone",
2590
2668
  zoneType: t ? String(t) : void 0,
2591
2669
  zoneCode: o ? String(o) : void 0,
2592
- legalStatus: a,
2670
+ legalStatus: s,
2593
2671
  planType: n,
2594
2672
  planId: e ? String(e) : void 0,
2595
2673
  planDocumentLink: p ? String(p) : void 0,
@@ -2600,53 +2678,53 @@ function Bs(s) {
2600
2678
  areaM2: typeof m == "number" ? m : void 0
2601
2679
  };
2602
2680
  }
2603
- function Gs(s) {
2604
- const t = s.match(/^(\w+)\s*=\s*'([^']+)'$/);
2681
+ function Ys(a) {
2682
+ const t = a.match(/^(\w+)\s*=\s*'([^']+)'$/);
2605
2683
  if (t) {
2606
2684
  const [, o, r] = t;
2607
- return (a) => String(a?.[o] ?? "") === r;
2685
+ return (s) => String(s?.[o] ?? "") === r;
2608
2686
  }
2609
- const e = s.match(/^(\w+)\s+IN\s*\(([^)]+)\)$/i);
2687
+ const e = a.match(/^(\w+)\s+IN\s*\(([^)]+)\)$/i);
2610
2688
  if (e) {
2611
- const [, o, r] = e, a = new Set(
2689
+ const [, o, r] = e, s = new Set(
2612
2690
  r.split(",").map((i) => i.trim().replace(/^'|'$/g, ""))
2613
2691
  );
2614
- return (i) => a.has(String(i?.[o] ?? ""));
2692
+ return (i) => s.has(String(i?.[o] ?? ""));
2615
2693
  }
2616
2694
  return () => !0;
2617
2695
  }
2618
- class pt {
2696
+ class ct {
2619
2697
  categoryMap;
2620
2698
  baseUrl;
2621
2699
  sourceId;
2622
2700
  outputFormat;
2623
2701
  constructor(t) {
2624
- this.categoryMap = t.categoryMap, this.baseUrl = t.baseUrl ?? Os, this.sourceId = t.sourceId ?? Ps, this.outputFormat = t.outputFormat ?? "application/json; subtype=geojson";
2702
+ this.categoryMap = t.categoryMap, this.baseUrl = t.baseUrl ?? Us, this.sourceId = t.sourceId ?? Ms, this.outputFormat = t.outputFormat ?? "application/json; subtype=geojson";
2625
2703
  }
2626
2704
  async listFeatureCategoryDescriptors(t) {
2627
2705
  const e = await this.listAvailableLayers(t);
2628
- return [...new Map(e.map((o) => [o.category, A(o.category)])).values()];
2706
+ return [...new Map(e.map((o) => [o.category, R(o.category)])).values()];
2629
2707
  }
2630
2708
  async listAvailableLayers(t) {
2631
2709
  const e = Object.entries(this.categoryMap);
2632
2710
  return (await Promise.allSettled(
2633
2711
  e.flatMap(
2634
- ([r, a]) => a.map(async (i) => {
2635
- const n = at(i), p = it(i), c = await this._fetchFeatures(t, n, 1, p);
2712
+ ([r, s]) => s.map(async (i) => {
2713
+ const n = it(i), p = nt(i), c = await this._fetchFeatures(t, n, 1, p);
2636
2714
  return { category: r, typeName: n, cqlFilter: p, hasResults: c.features.length > 0 };
2637
2715
  })
2638
2716
  )
2639
2717
  )).filter(
2640
2718
  (r) => r.status === "fulfilled" && r.value.hasResults
2641
- ).map((r) => nt(this.sourceId, r.value.category, r.value.typeName, r.value.cqlFilter));
2719
+ ).map((r) => pt(this.sourceId, r.value.category, r.value.typeName, r.value.cqlFilter));
2642
2720
  }
2643
2721
  async getFeaturesForLayer(t, e) {
2644
2722
  const o = this._findLayerById(e);
2645
2723
  return o ? this._fetchAndConvert(t, o.descriptor, o.cqlFilter) : [];
2646
2724
  }
2647
2725
  async _fetchAndConvert(t, e, o) {
2648
- const r = await this._fetchFeatures(t, e.sourceLayerId, void 0, o), a = o ? Gs(o) : void 0;
2649
- return (a ? r.features.filter((n) => a(n.properties)) : r.features).map((n, p) => this.toGisFeature(n, e, p));
2726
+ const r = await this._fetchFeatures(t, e.sourceLayerId, void 0, o), s = o ? Ys(o) : void 0;
2727
+ return (s ? r.features.filter((n) => s(n.properties)) : r.features).map((n, p) => this.toGisFeature(n, e, p));
2650
2728
  }
2651
2729
  /**
2652
2730
  * Returns the categories that have at least one configured typename AND at
@@ -2659,8 +2737,8 @@ class pt {
2659
2737
  async getFeaturesOfCategory(t, e) {
2660
2738
  const o = this.categoryMap[e] ?? [];
2661
2739
  return (await Promise.all(
2662
- o.map((a) => {
2663
- const i = at(a), n = it(a), p = nt(this.sourceId, e, i);
2740
+ o.map((s) => {
2741
+ const i = it(s), n = nt(s), p = pt(this.sourceId, e, i);
2664
2742
  return this._fetchAndConvert(t, p, n);
2665
2743
  })
2666
2744
  )).flat();
@@ -2669,14 +2747,14 @@ class pt {
2669
2747
  _findLayerById(t) {
2670
2748
  const e = Object.entries(this.categoryMap);
2671
2749
  for (const [o, r] of e)
2672
- for (const a of r) {
2673
- const i = at(a), n = it(a), p = nt(this.sourceId, o, i, n);
2750
+ for (const s of r) {
2751
+ const i = it(s), n = nt(s), p = pt(this.sourceId, o, i, n);
2674
2752
  if (p.id === t)
2675
2753
  return { descriptor: p, cqlFilter: n };
2676
2754
  }
2677
2755
  }
2678
2756
  async _fetchFeatures(t, e, o, r) {
2679
- const [a, i, n, p] = t, c = `${i},${a},${p},${n},urn:ogc:def:crs:EPSG::4326`, h = new URLSearchParams({
2757
+ const [s, i, n, p] = t, c = `${i},${s},${p},${n},urn:ogc:def:crs:EPSG::4326`, h = new URLSearchParams({
2680
2758
  service: "WFS",
2681
2759
  version: "2.0.0",
2682
2760
  request: "GetFeature",
@@ -2694,7 +2772,7 @@ class pt {
2694
2772
  return u.json();
2695
2773
  }
2696
2774
  toGisFeature(t, e, o) {
2697
- const [r, a] = Ns(t.geometry), i = js(t.properties, `${e.sourceLayerId}[${o}]`), n = t.bbox ? [t.bbox[0], t.bbox[1], t.bbox[2], t.bbox[3]] : void 0, p = e.tier, c = p === "priority" ? this._extractNormalisedProperties(t, e) : void 0;
2775
+ const [r, s] = zs(t.geometry), i = Bs(t.properties, `${e.sourceLayerId}[${o}]`), n = t.bbox ? [t.bbox[0], t.bbox[1], t.bbox[2], t.bbox[3]] : void 0, p = e.tier, c = p === "priority" ? this._extractNormalisedProperties(t, e) : void 0;
2698
2776
  return {
2699
2777
  id: t.id ?? `${e.sourceLayerId}/${o}`,
2700
2778
  preferredColor: e.preferredColor,
@@ -2704,7 +2782,7 @@ class pt {
2704
2782
  name: i,
2705
2783
  category: e.category,
2706
2784
  type: e.sourceLayerId.replace(/^ms:/, ""),
2707
- lat: a,
2785
+ lat: s,
2708
2786
  lon: r,
2709
2787
  displayName: i,
2710
2788
  bbox: n,
@@ -2715,12 +2793,12 @@ class pt {
2715
2793
  };
2716
2794
  }
2717
2795
  _extractNormalisedProperties(t, e) {
2718
- return e.category === "building" ? Ms(t.properties, this.sourceId) : e.category === "greenspace" ? zs(t.properties) : e.category === "paved" ? Fs(t.properties) : e.category === "zone" ? Bs(t.properties) : qs(t.properties, this.sourceId);
2796
+ return e.category === "building" ? Ws(t.properties, this.sourceId) : e.category === "greenspace" ? Xs(t.properties) : e.category === "paved" ? Ks(t.properties) : e.category === "zone" ? Qs(t.properties) : Vs(t.properties, this.sourceId);
2719
2797
  }
2720
2798
  }
2721
- const Pe = [8, 54.5, 15.2, 57.8], De = {
2799
+ const Ue = [8, 54.5, 15.2, 57.8], Me = {
2722
2800
  building: [
2723
- { source: "danish-matrikel", typename: "gdk60:Bygning" },
2801
+ { source: "danish-matrikel", typename: "geodkv_v001:bygning_current" },
2724
2802
  // Footprint polygons (GeoDanmark Vektor)
2725
2803
  { source: "danish-matrikel", typename: "bbr_v001:bygning_current" }
2726
2804
  // Centroid + registry attributes (BBR)
@@ -2730,10 +2808,10 @@ const Pe = [8, 54.5, 15.2, 57.8], De = {
2730
2808
  { source: "danish-matrikel", typename: "mat_v001:samletfastejendom_current" }
2731
2809
  ]
2732
2810
  };
2733
- function Hs(s) {
2734
- if (!s) return [0, 0];
2735
- const t = s.coordinates;
2736
- switch (s.type) {
2811
+ function Js(a) {
2812
+ if (!a) return [0, 0];
2813
+ const t = a.coordinates;
2814
+ switch (a.type) {
2737
2815
  case "Point":
2738
2816
  return t;
2739
2817
  case "MultiPoint":
@@ -2748,8 +2826,8 @@ function Hs(s) {
2748
2826
  return [0, 0];
2749
2827
  }
2750
2828
  }
2751
- function Ws(s, t) {
2752
- if (!s) return t;
2829
+ function Zs(a, t) {
2830
+ if (!a) return t;
2753
2831
  for (const e of [
2754
2832
  "mat:matrikelnummer",
2755
2833
  "matrikelnummer",
@@ -2761,31 +2839,31 @@ function Ws(s, t) {
2761
2839
  "title",
2762
2840
  "label"
2763
2841
  ])
2764
- if (typeof s[e] == "string" && s[e]) return s[e];
2842
+ if (typeof a[e] == "string" && a[e]) return a[e];
2765
2843
  return t;
2766
2844
  }
2767
- function Vs(s, t, e) {
2768
- return `${s}:${t}:${e}`;
2845
+ function ta(a, t, e) {
2846
+ return `${a}:${t}:${e}`;
2769
2847
  }
2770
- const Xs = /* @__PURE__ */ new Set(["building", "cadastre", "zone"]);
2771
- function ct(s, t, e) {
2772
- const o = e.typename.replace(/^[^:]+:/, ""), r = A(t), a = Xs.has(t) ? "priority" : "raw";
2848
+ const ea = /* @__PURE__ */ new Set(["building", "cadastre", "zone"]);
2849
+ function lt(a, t, e) {
2850
+ const o = e.typename.replace(/^[^:]+:/, ""), r = R(t), s = ea.has(t) ? "priority" : "raw";
2773
2851
  return {
2774
- id: Vs(s, e.source, e.typename),
2775
- sourceId: s,
2852
+ id: ta(a, e.source, e.typename),
2853
+ sourceId: a,
2776
2854
  sourceLayerId: e.typename,
2777
2855
  category: t,
2778
2856
  preferredColor: r.preferredColor,
2779
- tier: a,
2857
+ tier: s,
2780
2858
  label: e.label ?? o,
2781
2859
  description: `${e.source} / ${e.typename}`,
2782
- labelKey: `gis.layer.${s}.${e.source}.${o}.label`,
2783
- descriptionKey: `gis.layer.${s}.${e.source}.${o}.description`
2860
+ labelKey: `gis.layer.${a}.${e.source}.${o}.label`,
2861
+ descriptionKey: `gis.layer.${a}.${e.source}.${o}.description`
2784
2862
  };
2785
2863
  }
2786
- function Qs(s, t) {
2864
+ function oa(a, t) {
2787
2865
  if (t === "building") {
2788
- const i = s?.byg041BebyggetAreal ?? s?.byg038SamletBygningsareal, n = s?.byg021BygningensAnvendelse, p = s?.id_lokalId, c = s?.byg026Opførelsesår;
2866
+ const i = a?.byg041BebyggetAreal ?? a?.byg038SamletBygningsareal, n = a?.byg021BygningensAnvendelse, p = a?.id_lokalId, c = a?.byg026Opførelsesår;
2789
2867
  return {
2790
2868
  featureType: "building",
2791
2869
  areaM2: typeof i == "number" ? i : void 0,
@@ -2795,43 +2873,43 @@ function Qs(s, t) {
2795
2873
  };
2796
2874
  }
2797
2875
  if (t === "zone") {
2798
- const i = s?.plannavn ?? s?.bezeichnung ?? s?.typ_bezeichnung ?? void 0, n = s?.planid ?? s?.plannummer ?? void 0, p = s?.artcode ?? s?.typ_code ?? n ?? void 0, c = s?.rechtsstatus ?? s?.status ?? void 0, h = s?.dagsordenpunkt_url ?? s?.dokument_url ?? void 0, d = s?.flaeche ?? s?.flaeche_m2 ?? void 0;
2876
+ const i = a?.plannavn ?? a?.bezeichnung ?? a?.typ_bezeichnung ?? void 0, n = a?.planid ?? a?.plannummer ?? void 0, p = a?.artcode ?? a?.typ_code ?? n ?? void 0, c = a?.rechtsstatus ?? a?.status ?? void 0, h = a?.dagsordenpunkt_url ?? a?.dokument_url ?? void 0, d = a?.flaeche ?? a?.flaeche_m2 ?? void 0;
2799
2877
  return {
2800
2878
  featureType: "zone",
2801
2879
  zoneType: i ?? void 0,
2802
2880
  zoneCode: p ?? void 0,
2803
- legalStatus: Ae(c),
2804
- planType: Oe(s?.typ_gde_bezeichnung),
2881
+ legalStatus: je(c),
2882
+ planType: Le(a?.typ_gde_bezeichnung),
2805
2883
  planId: n ?? void 0,
2806
2884
  planDocumentLink: h ?? void 0,
2807
- publicationDate: s?.auflagedatum ?? void 0,
2808
- fixingDate: s?.festsetzungsdatum ?? void 0,
2809
- approvalDate: s?.genehmigungsdatum ?? void 0,
2810
- effectiveFrom: s?.inkraftsetzungsdatum ?? void 0,
2885
+ publicationDate: a?.auflagedatum ?? void 0,
2886
+ fixingDate: a?.festsetzungsdatum ?? void 0,
2887
+ approvalDate: a?.genehmigungsdatum ?? void 0,
2888
+ effectiveFrom: a?.inkraftsetzungsdatum ?? void 0,
2811
2889
  areaM2: typeof d == "number" ? d : void 0
2812
2890
  };
2813
2891
  }
2814
- const e = s?.["mat:matrikelnummer"] ?? s?.matrikelnummer, o = s?.["mat:ejerlavsnavn"] ?? s?.ejerlavsnavn, r = s?.["mat:registreretareal"] ?? s?.registreretareal, a = s?.["mat:bfenummer"] ?? s?.bfenummer;
2892
+ const e = a?.["mat:matrikelnummer"] ?? a?.matrikelnummer, o = a?.["mat:ejerlavsnavn"] ?? a?.ejerlavsnavn, r = a?.["mat:registreretareal"] ?? a?.registreretareal, s = a?.["mat:bfenummer"] ?? a?.bfenummer;
2815
2893
  return {
2816
2894
  featureType: "plot",
2817
2895
  areaM2: typeof r == "number" ? r : void 0,
2818
2896
  plotId: e && o ? `${e}, ${o}` : e ?? void 0,
2819
- registryId: a ?? void 0
2897
+ registryId: s ?? void 0
2820
2898
  };
2821
2899
  }
2822
- class Ks {
2900
+ class ra {
2823
2901
  categoryMap;
2824
2902
  dataViewsBaseUrl;
2825
2903
  getHeaders;
2826
2904
  sourceId;
2827
2905
  constructor(t) {
2828
- this.dataViewsBaseUrl = t.dataViewsBaseUrl.replace(/\/$/, ""), this.getHeaders = t.getHeaders, this.categoryMap = t.categoryMap ?? De, this.sourceId = t.sourceId ?? "cue-sdk-gis";
2906
+ this.dataViewsBaseUrl = t.dataViewsBaseUrl.replace(/\/$/, ""), this.getHeaders = t.getHeaders, this.categoryMap = t.categoryMap ?? Me, this.sourceId = t.sourceId ?? "cue-sdk-gis";
2829
2907
  }
2830
2908
  async listFeatureCategoryDescriptors(t) {
2831
2909
  const e = await this.listAvailableLayers(t);
2832
2910
  return [
2833
2911
  ...new Map(
2834
- e.map((o) => [o.category, A(o.category)])
2912
+ e.map((o) => [o.category, R(o.category)])
2835
2913
  ).values()
2836
2914
  ];
2837
2915
  }
@@ -2839,18 +2917,18 @@ class Ks {
2839
2917
  const e = Object.entries(this.categoryMap);
2840
2918
  return (await Promise.allSettled(
2841
2919
  e.flatMap(
2842
- ([r, a]) => a.map(async (i) => {
2920
+ ([r, s]) => s.map(async (i) => {
2843
2921
  const n = await this._fetchFeatures(t, i, 1);
2844
2922
  return { category: r, entry: i, hasResults: n.features.length > 0 };
2845
2923
  })
2846
2924
  )
2847
2925
  )).filter(
2848
2926
  (r) => r.status === "fulfilled" && r.value.hasResults
2849
- ).map((r) => ct(this.sourceId, r.value.category, r.value.entry));
2927
+ ).map((r) => lt(this.sourceId, r.value.category, r.value.entry));
2850
2928
  }
2851
2929
  async getFeaturesForLayer(t, e) {
2852
2930
  const o = this._findLayerById(e);
2853
- return o ? (await this._fetchFeatures(t, o.entry)).features.map((a, i) => this._toGisFeature(a, o.descriptor, i)) : [];
2931
+ return o ? (await this._fetchFeatures(t, o.entry)).features.map((s, i) => this._toGisFeature(s, o.descriptor, i)) : [];
2854
2932
  }
2855
2933
  async listFeatureCategories(t) {
2856
2934
  const e = await this.listAvailableLayers(t);
@@ -2859,28 +2937,28 @@ class Ks {
2859
2937
  async getFeaturesOfCategory(t, e) {
2860
2938
  const o = this.categoryMap[e] ?? [];
2861
2939
  return (await Promise.allSettled(
2862
- o.map((a) => {
2863
- const i = ct(this.sourceId, e, a);
2940
+ o.map((s) => {
2941
+ const i = lt(this.sourceId, e, s);
2864
2942
  return this.getFeaturesForLayer(t, i.id);
2865
2943
  })
2866
- )).flatMap((a, i) => a.status === "fulfilled" ? a.value : (console.warn(
2944
+ )).flatMap((s, i) => s.status === "fulfilled" ? s.value : (console.warn(
2867
2945
  `[CueSdkGisAdapter] Layer "${o[i].source}/${o[i].typename}" failed:`,
2868
- a.reason
2946
+ s.reason
2869
2947
  ), []));
2870
2948
  }
2871
2949
  // ─── Private helpers ────────────────────────────────────────────────────────
2872
2950
  _findLayerById(t) {
2873
2951
  for (const [e, o] of Object.entries(this.categoryMap))
2874
2952
  for (const r of o) {
2875
- const a = ct(this.sourceId, e, r);
2876
- if (a.id === t) return { entry: r, descriptor: a };
2953
+ const s = lt(this.sourceId, e, r);
2954
+ if (s.id === t) return { entry: r, descriptor: s };
2877
2955
  }
2878
2956
  }
2879
2957
  async _fetchFeatures(t, e, o) {
2880
- const [r, a, i, n] = t, p = await this.getHeaders(), c = new URLSearchParams({
2958
+ const [r, s, i, n] = t, p = await this.getHeaders(), c = new URLSearchParams({
2881
2959
  source: e.source,
2882
2960
  typename: e.typename,
2883
- bbox: `${r},${a},${i},${n}`
2961
+ bbox: `${r},${s},${i},${n}`
2884
2962
  });
2885
2963
  o !== void 0 && c.set("count", String(o));
2886
2964
  const h = `${this.dataViewsBaseUrl}/gis/features?${c.toString()}`, d = await fetch(h, { headers: p });
@@ -2891,7 +2969,7 @@ class Ks {
2891
2969
  return d.json();
2892
2970
  }
2893
2971
  _toGisFeature(t, e, o) {
2894
- const [r, a] = Hs(t.geometry), i = t.id ?? `${e.sourceLayerId}/${o}`, n = Ws(t.properties, i), p = t.bbox ? [t.bbox[0], t.bbox[1], t.bbox[2], t.bbox[3]] : void 0, c = e.tier, h = c === "priority" ? Qs(t.properties, e.category) : void 0;
2972
+ const [r, s] = Js(t.geometry), i = t.id ?? `${e.sourceLayerId}/${o}`, n = Zs(t.properties, i), p = t.bbox ? [t.bbox[0], t.bbox[1], t.bbox[2], t.bbox[3]] : void 0, c = e.tier, h = c === "priority" ? oa(t.properties, e.category) : void 0;
2895
2973
  return {
2896
2974
  id: i,
2897
2975
  sourceId: this.sourceId,
@@ -2901,7 +2979,7 @@ class Ks {
2901
2979
  category: e.category,
2902
2980
  preferredColor: e.preferredColor,
2903
2981
  type: e.sourceLayerId.replace(/^[^:]+:/, ""),
2904
- lat: a,
2982
+ lat: s,
2905
2983
  lon: r,
2906
2984
  displayName: n,
2907
2985
  bbox: p,
@@ -2912,7 +2990,124 @@ class Ks {
2912
2990
  };
2913
2991
  }
2914
2992
  }
2915
- const Ys = {
2993
+ function Et(a, t) {
2994
+ if (Array.isArray(a)) {
2995
+ if (typeof a[0] == "number" && typeof a[1] == "number") {
2996
+ t([a[0], a[1]]);
2997
+ return;
2998
+ }
2999
+ for (const e of a) Et(e, t);
3000
+ }
3001
+ }
3002
+ function Tt(a) {
3003
+ return a ? a.type === "GeometryCollection" ? (a.geometries ?? []).flatMap((t) => Tt(t)) : [a.coordinates] : [];
3004
+ }
3005
+ function sa(a) {
3006
+ let t = 1 / 0, e = 1 / 0, o = -1 / 0, r = -1 / 0;
3007
+ const s = (i) => {
3008
+ i[0] < t && (t = i[0]), i[1] < e && (e = i[1]), i[0] > o && (o = i[0]), i[1] > r && (r = i[1]);
3009
+ };
3010
+ return Tt(a).forEach((i) => Et(i, s)), t === 1 / 0 ? null : [t, e, o, r];
3011
+ }
3012
+ function aa(a) {
3013
+ let t = null;
3014
+ for (const e of Tt(a))
3015
+ if (Et(e, (o) => t ??= o), t) break;
3016
+ return t ?? [0, 0];
3017
+ }
3018
+ function ia(a, t) {
3019
+ if (!a) return t;
3020
+ for (const e of ["name", "Name", "title", "Title", "label", "Label"])
3021
+ if (typeof a[e] == "string" && a[e]) return a[e];
3022
+ return t;
3023
+ }
3024
+ class kt {
3025
+ static _LIST_CACHE_TTL_MS = 5e3;
3026
+ dataViewsBaseUrl;
3027
+ getHeaders;
3028
+ sourceId;
3029
+ _listCache = null;
3030
+ constructor(t) {
3031
+ this.dataViewsBaseUrl = t.dataViewsBaseUrl.replace(/\/$/, ""), this.getHeaders = t.getHeaders, this.sourceId = t.sourceId ?? "cue-gis-sources";
3032
+ }
3033
+ async listFeatureCategoryDescriptors(t) {
3034
+ return (await this.listAvailableLayers(t)).length > 0 ? [R("custom")] : [];
3035
+ }
3036
+ async listFeatureCategories(t) {
3037
+ return (await this.listAvailableLayers(t)).length > 0 ? ["custom"] : [];
3038
+ }
3039
+ async listAvailableLayers(t) {
3040
+ return (await this._listSources()).filter((o) => o.bbox !== null && $(o.bbox, t)).map((o) => this._toLayerDescriptor(o));
3041
+ }
3042
+ async getFeaturesForLayer(t, e) {
3043
+ const o = this._idFromLayerId(e);
3044
+ if (!o) return [];
3045
+ const r = await this._getSource(o);
3046
+ return r ? r.featureCollection.features.map((s, i) => ({ feature: s, index: i, bbox: sa(s.geometry) })).filter((s) => s.bbox !== null && $(s.bbox, t)).map((s) => this._toGisFeature(s.feature, r.id, s.index)) : [];
3047
+ }
3048
+ async getFeaturesOfCategory(t, e) {
3049
+ if (e !== "custom") return [];
3050
+ const o = await this.listAvailableLayers(t);
3051
+ return (await Promise.allSettled(o.map((s) => this.getFeaturesForLayer(t, s.id)))).flatMap((s, i) => s.status === "fulfilled" ? s.value : (console.warn(`[GisSourcesAdapter] Source "${o[i].label}" failed:`, s.reason), []));
3052
+ }
3053
+ // ─── Private helpers ────────────────────────────────────────────────────────
3054
+ _toLayerDescriptor(t) {
3055
+ const e = R("custom");
3056
+ return {
3057
+ id: `${this.sourceId}:${t.id}`,
3058
+ sourceId: this.sourceId,
3059
+ sourceLayerId: t.id,
3060
+ category: "custom",
3061
+ preferredColor: e.preferredColor,
3062
+ tier: "raw",
3063
+ label: t.name,
3064
+ description: `${t.featureCount} uploaded feature${t.featureCount === 1 ? "" : "s"}`
3065
+ };
3066
+ }
3067
+ _idFromLayerId(t) {
3068
+ const e = `${this.sourceId}:`;
3069
+ return t.startsWith(e) ? t.slice(e.length) : null;
3070
+ }
3071
+ _toGisFeature(t, e, o) {
3072
+ const [r, s] = aa(t.geometry), i = t.id !== void 0 ? String(t.id) : `${e}/${o}`, n = t.properties ?? {}, p = ia(n, i);
3073
+ return {
3074
+ id: `${this.sourceId}:${e}:${i}`,
3075
+ sourceId: this.sourceId,
3076
+ sourceFeatureId: i,
3077
+ layerId: `${this.sourceId}:${e}`,
3078
+ name: p,
3079
+ category: "custom",
3080
+ preferredColor: R("custom").preferredColor,
3081
+ type: "custom",
3082
+ lat: s,
3083
+ lon: r,
3084
+ displayName: p,
3085
+ geometry: t.geometry ?? void 0,
3086
+ tier: "raw",
3087
+ originalData: n
3088
+ };
3089
+ }
3090
+ async _listSources() {
3091
+ const t = Date.now();
3092
+ if (this._listCache && t - this._listCache.at < kt._LIST_CACHE_TTL_MS)
3093
+ return this._listCache.sources;
3094
+ const e = await this.getHeaders(), o = await fetch(`${this.dataViewsBaseUrl}/gis-sources`, { headers: e });
3095
+ if (!o.ok)
3096
+ throw new Error(`GisSourcesAdapter: list request failed: ${o.status} ${o.statusText}`);
3097
+ const r = await o.json();
3098
+ return this._listCache = { at: t, sources: r }, r;
3099
+ }
3100
+ async _getSource(t) {
3101
+ const e = this._listCache?.sources.find((s) => s.id === t);
3102
+ if (e) return e;
3103
+ const o = await this.getHeaders(), r = await fetch(`${this.dataViewsBaseUrl}/gis-sources/${t}`, { headers: o });
3104
+ if (r.status === 404) return null;
3105
+ if (!r.ok)
3106
+ throw new Error(`GisSourcesAdapter: get request failed for "${t}": ${r.status} ${r.statusText}`);
3107
+ return await r.json();
3108
+ }
3109
+ }
3110
+ const na = {
2916
3111
  address: [
2917
3112
  "ms:ogd-0406_arv_basis_avzh_hausnummer_pos_p",
2918
3113
  "ms:ogd-0571_afv_gv_strat_strassennetz_l"
@@ -2960,23 +3155,23 @@ const Ys = {
2960
3155
  // ÖREB Überlagernde Festlegungen (Flächen) – overlaying planning constraints
2961
3156
  "ms:ogd-0155_arv_basis_np_ul_flaeche_f"
2962
3157
  ]
2963
- }, $e = [
3158
+ }, qe = [
2964
3159
  {
2965
3160
  name: "Canton of Zürich",
2966
- coverageBBox: Ds,
3161
+ coverageBBox: qs,
2967
3162
  supportedCategories: ["address", "poi", "railway", "natural", "manmade", "building", "cadastre", "greenspace", "paved", "zone"],
2968
3163
  priority: 10,
2969
- adapter: new pt({
2970
- categoryMap: Ys
3164
+ adapter: new ct({
3165
+ categoryMap: na
2971
3166
  })
2972
3167
  },
2973
3168
  {
2974
3169
  name: "Switzerland (national AV cadastre)",
2975
- coverageBBox: $s,
3170
+ coverageBBox: Fs,
2976
3171
  supportedCategories: ["cadastre"],
2977
3172
  priority: 5,
2978
3173
  // Lower priority than canton-specific adapters. For ZH, the canton adapter (priority 10) wins.
2979
- adapter: new pt({
3174
+ adapter: new ct({
2980
3175
  sourceId: "swiss-av-wfs",
2981
3176
  baseUrl: "https://wfs.geodienste.ch/av_0/deu",
2982
3177
  categoryMap: {
@@ -3000,10 +3195,10 @@ const Ys = {
3000
3195
  * - `pdk:kommuneplanramme_vedtaget` – adopted municipal plan frameworks
3001
3196
  */
3002
3197
  name: "Denmark (Plandata.dk – planning zones)",
3003
- coverageBBox: Pe,
3198
+ coverageBBox: Ue,
3004
3199
  supportedCategories: ["zone"],
3005
3200
  priority: 10,
3006
- adapter: new pt({
3201
+ adapter: new ct({
3007
3202
  sourceId: "danish-plandata",
3008
3203
  baseUrl: "https://wfs.plandata.dk/geoserver/pdk/wfs",
3009
3204
  outputFormat: "application/json",
@@ -3018,12 +3213,12 @@ const Ys = {
3018
3213
  })
3019
3214
  }
3020
3215
  ];
3021
- function Jt(s) {
3022
- return [...s].sort(
3023
- (t, e) => gt.indexOf(t.category) - gt.indexOf(e.category)
3216
+ function re(a) {
3217
+ return [...a].sort(
3218
+ (t, e) => mt.indexOf(t.category) - mt.indexOf(e.category)
3024
3219
  );
3025
3220
  }
3026
- class Js {
3221
+ class pa {
3027
3222
  nominatim;
3028
3223
  regions;
3029
3224
  /**
@@ -3036,11 +3231,11 @@ class Js {
3036
3231
  regions: e,
3037
3232
  useDefaultRegions: o = !0,
3038
3233
  zonePlanTypeColors: r,
3039
- ...a
3234
+ ...s
3040
3235
  } = t;
3041
- this.nominatim = new ks(a);
3042
- const i = o ? $e : [];
3043
- this.regions = e ?? i, this.zonePlanTypeColors = { ...bs, ...r };
3236
+ this.nominatim = new Os(s);
3237
+ const i = o ? qe : [];
3238
+ this.regions = e ?? i, this.zonePlanTypeColors = { ...Is, ...r };
3044
3239
  }
3045
3240
  /**
3046
3241
  * Return the available feature categories together with UI metadata such as
@@ -3053,18 +3248,18 @@ class Js {
3053
3248
  * @param bbox [west, south, east, north] in WGS-84 decimal degrees
3054
3249
  */
3055
3250
  async listFeatureCategoryDescriptors(t) {
3056
- const e = this.regions.filter((r) => H(r.coverageBBox, t) && r.supportedCategories).sort((r, a) => (a.priority ?? 0) - (r.priority ?? 0));
3251
+ const e = this.regions.filter((r) => $(r.coverageBBox, t) && r.supportedCategories).sort((r, s) => (s.priority ?? 0) - (r.priority ?? 0));
3057
3252
  if (e.length > 0) {
3058
- const r = /* @__PURE__ */ new Set(), a = [];
3253
+ const r = /* @__PURE__ */ new Set(), s = [];
3059
3254
  for (const i of e)
3060
3255
  for (const n of i.supportedCategories ?? [])
3061
- r.has(n) || (r.add(n), a.push(A(n)));
3062
- for (const i of mt)
3063
- r.has(i) || a.push(A(i));
3064
- return Jt(a);
3256
+ r.has(n) || (r.add(n), s.push(R(n)));
3257
+ for (const i of wt)
3258
+ r.has(i) || s.push(R(i));
3259
+ return re(s);
3065
3260
  }
3066
3261
  const o = await this._adapterFor(t).listFeatureCategoryDescriptors(t);
3067
- return Jt(o);
3262
+ return re(o);
3068
3263
  }
3069
3264
  /**
3070
3265
  * Return the feature categories that have at least one result within the
@@ -3114,7 +3309,7 @@ class Js {
3114
3309
  console.log(" • Nominatim (OSM) bbox=[global] priority=-1");
3115
3310
  const r = [
3116
3311
  ...this.regions.filter(
3117
- (n) => H(n.coverageBBox, t) && (!n.supportedCategories || n.supportedCategories.includes(e))
3312
+ (n) => $(n.coverageBBox, t) && (!n.supportedCategories || n.supportedCategories.includes(e))
3118
3313
  ).map((n) => ({
3119
3314
  name: n.name,
3120
3315
  adapter: n.adapter,
@@ -3125,7 +3320,7 @@ class Js {
3125
3320
  r.sort((n, p) => p.priority - n.priority), console.log(`[GisGateway] Matched services for category "${e}":`);
3126
3321
  for (const n of r)
3127
3322
  console.log(` • ${n.name} (priority=${n.priority})`);
3128
- const a = /* @__PURE__ */ new Map(), i = new Map(
3323
+ const s = /* @__PURE__ */ new Map(), i = new Map(
3129
3324
  r.map(
3130
3325
  (n, p) => [
3131
3326
  p,
@@ -3137,8 +3332,8 @@ class Js {
3137
3332
  const { features: n, idx: p } = await Promise.race(i.values());
3138
3333
  i.delete(p);
3139
3334
  for (const c of n) {
3140
- const h = Zt(c), d = Y(c), u = a.get(h);
3141
- (u === void 0 || d > u) && (a.set(h, d), yield c);
3335
+ const h = se(c), d = Y(c), u = s.get(h);
3336
+ (u === void 0 || d > u) && (s.set(h, d), yield c);
3142
3337
  }
3143
3338
  }
3144
3339
  }
@@ -3158,10 +3353,10 @@ class Js {
3158
3353
  async getFeaturesOfCategory(t, e) {
3159
3354
  const r = [
3160
3355
  ...this.regions.filter(
3161
- (d) => H(d.coverageBBox, t) && (!d.supportedCategories || d.supportedCategories.includes(e))
3356
+ (d) => $(d.coverageBBox, t) && (!d.supportedCategories || d.supportedCategories.includes(e))
3162
3357
  ).map((d) => ({ name: d.name, adapter: d.adapter, isNominatim: !1 })),
3163
3358
  { name: "Nominatim (OSM)", adapter: this.nominatim, isNominatim: !0 }
3164
- ], a = await Promise.allSettled(
3359
+ ], s = await Promise.allSettled(
3165
3360
  r.map(
3166
3361
  (d) => d.adapter.getFeaturesOfCategory(t, e).then((u) => ({
3167
3362
  features: u,
@@ -3169,11 +3364,11 @@ class Js {
3169
3364
  })).catch((u) => (console.warn(`[GisGateway] Source "${d.name}" failed:`, u), { features: [], isNominatim: d.isNominatim }))
3170
3365
  )
3171
3366
  ), i = [], n = [];
3172
- for (const d of a)
3367
+ for (const d of s)
3173
3368
  d.status === "fulfilled" && (d.value.isNominatim ? n.push(...d.value.features) : i.push(...d.value.features));
3174
- const p = ea(i, n), c = /* @__PURE__ */ new Map(), h = [];
3369
+ const p = ha(i, n), c = /* @__PURE__ */ new Map(), h = [];
3175
3370
  for (const d of p) {
3176
- const u = Zt(d), m = Y(d), w = c.get(u);
3371
+ const u = se(d), m = Y(d), w = c.get(u);
3177
3372
  (w === void 0 || m > w) && (c.set(u, m), h.push(d));
3178
3373
  }
3179
3374
  return h;
@@ -3184,44 +3379,44 @@ class Js {
3184
3379
  }
3185
3380
  /** Resolve the best adapter for a query bbox (legacy single-adapter routing). */
3186
3381
  _adapterFor(t) {
3187
- return this.regions.filter((o) => H(o.coverageBBox, t)).sort((o, r) => (r.priority ?? 0) - (o.priority ?? 0))[0]?.adapter ?? this.nominatim;
3382
+ return this.regions.filter((o) => $(o.coverageBBox, t)).sort((o, r) => (r.priority ?? 0) - (o.priority ?? 0))[0]?.adapter ?? this.nominatim;
3188
3383
  }
3189
3384
  }
3190
- function Y(s) {
3191
- const t = s.geometry?.type;
3385
+ function Y(a) {
3386
+ const t = a.geometry?.type;
3192
3387
  return t === "Polygon" || t === "MultiPolygon" ? 3 : t === "LineString" || t === "MultiLineString" ? 2 : 1;
3193
3388
  }
3194
- function Zt(s) {
3195
- const t = Math.round(s.lat * 1e3) / 1e3, e = Math.round(s.lon * 1e3) / 1e3;
3196
- return `${(s.name ?? s.id ?? "").toLowerCase().trim()}|${t}|${e}`;
3389
+ function se(a) {
3390
+ const t = Math.round(a.lat * 1e3) / 1e3, e = Math.round(a.lon * 1e3) / 1e3;
3391
+ return `${(a.name ?? a.id ?? "").toLowerCase().trim()}|${t}|${e}`;
3197
3392
  }
3198
- const Zs = 1e-3;
3199
- function ta(s, t) {
3200
- const e = s.lat - t.lat, o = s.lon - t.lon;
3393
+ const ca = 1e-3;
3394
+ function la(a, t) {
3395
+ const e = a.lat - t.lat, o = a.lon - t.lon;
3201
3396
  return Math.sqrt(e * e + o * o);
3202
3397
  }
3203
- function ea(s, t) {
3204
- if (t.length === 0) return s;
3205
- const e = s.filter((i) => Y(i) === 3), o = s.filter((i) => Y(i) !== 3), r = e.map((i) => ({ feature: { ...i, originalData: { ...i.originalData } }, matched: !1 })), a = [];
3398
+ function ha(a, t) {
3399
+ if (t.length === 0) return a;
3400
+ const e = a.filter((i) => Y(i) === 3), o = a.filter((i) => Y(i) !== 3), r = e.map((i) => ({ feature: { ...i, originalData: { ...i.originalData } }, matched: !1 })), s = [];
3206
3401
  for (const i of t) {
3207
- let n = -1, p = Zs;
3402
+ let n = -1, p = ca;
3208
3403
  for (let c = 0; c < r.length; c++) {
3209
- const h = ta(i, r[c].feature);
3404
+ const h = la(i, r[c].feature);
3210
3405
  h < p && (p = h, n = c);
3211
3406
  }
3212
3407
  n >= 0 ? (r[n].feature.originalData = {
3213
3408
  ...i.originalData,
3214
3409
  ...r[n].feature.originalData
3215
- }, r[n].matched = !0) : a.push(i);
3410
+ }, r[n].matched = !0) : s.push(i);
3216
3411
  }
3217
3412
  return [
3218
3413
  ...r.map((i) => i.feature),
3219
3414
  ...o,
3220
- ...a
3415
+ ...s
3221
3416
  ];
3222
3417
  }
3223
- const oa = "/data-views", ra = 1500;
3224
- class sa {
3418
+ const ae = "/data-views", da = 1500, ua = [-180, -90, 180, 90];
3419
+ class ga {
3225
3420
  // undefined = not yet built
3226
3421
  /** @internal — construct via `cue.gis`, not directly. */
3227
3422
  constructor(t, e) {
@@ -3265,13 +3460,13 @@ class sa {
3265
3460
  const e = this._selectedCategories;
3266
3461
  this._selectedCategories = new Set(t);
3267
3462
  let o = !1;
3268
- for (const a of e)
3269
- t.has(a) || (this._features.delete(a), o = !0);
3463
+ for (const s of e)
3464
+ t.has(s) || (this._features.delete(s), o = !0);
3270
3465
  o && this._emitFeatures();
3271
3466
  const r = this._bbox;
3272
3467
  if (r)
3273
- for (const a of t)
3274
- e.has(a) || this._loadCategory(a, r, this._queryToken);
3468
+ for (const s of t)
3469
+ e.has(s) || this._loadCategory(s, r, this._queryToken);
3275
3470
  }
3276
3471
  // ── Subscriptions ─────────────────────────────────────────────────────────
3277
3472
  /**
@@ -3304,25 +3499,41 @@ class sa {
3304
3499
  }
3305
3500
  // ── Private ───────────────────────────────────────────────────────────────
3306
3501
  _scheduleDebouncedQuery() {
3307
- this._debounceTimer !== null && clearTimeout(this._debounceTimer), this._debounceTimer = setTimeout(() => this._queryLayers(), ra);
3502
+ this._debounceTimer !== null && clearTimeout(this._debounceTimer), this._debounceTimer = setTimeout(() => this._queryLayers(), da);
3308
3503
  }
3309
3504
  _getGateway() {
3310
3505
  if (this._gatewayCache !== null && this._gatewayProjectId === this._projectId)
3311
3506
  return this._gatewayCache;
3312
- const t = this._projectId, e = [...$e];
3313
- return t && e.unshift({
3314
- name: "Cue SDK (authenticated)",
3315
- coverageBBox: Pe,
3316
- supportedCategories: Object.keys(De),
3317
- priority: 10,
3318
- adapter: new Ks({
3319
- dataViewsBaseUrl: `${this._gatewayUrl}${oa}`,
3320
- getHeaders: async () => ({
3321
- ...await this._getAuthHeaders(),
3322
- "x-project-id": t
3323
- })
3324
- })
3325
- }), this._gatewayCache = new Js({ regions: e }), this._gatewayProjectId = t, this._gatewayCache;
3507
+ const t = this._projectId, e = [...qe];
3508
+ if (t) {
3509
+ const o = async () => ({
3510
+ ...await this._getAuthHeaders(),
3511
+ "x-project-id": t
3512
+ });
3513
+ e.unshift(
3514
+ {
3515
+ name: "Cue SDK (authenticated)",
3516
+ coverageBBox: Ue,
3517
+ supportedCategories: Object.keys(Me),
3518
+ priority: 10,
3519
+ adapter: new ra({
3520
+ dataViewsBaseUrl: `${this._gatewayUrl}${ae}`,
3521
+ getHeaders: o
3522
+ })
3523
+ },
3524
+ {
3525
+ name: "Cue SDK (GIS sources)",
3526
+ coverageBBox: ua,
3527
+ supportedCategories: ["custom"],
3528
+ priority: 10,
3529
+ adapter: new kt({
3530
+ dataViewsBaseUrl: `${this._gatewayUrl}${ae}`,
3531
+ getHeaders: o
3532
+ })
3533
+ }
3534
+ );
3535
+ }
3536
+ return this._gatewayCache = new pa({ regions: e }), this._gatewayProjectId = t, this._gatewayCache;
3326
3537
  }
3327
3538
  async _queryLayers() {
3328
3539
  const t = this._bbox;
@@ -3335,10 +3546,10 @@ class sa {
3335
3546
  if (e !== this._queryToken) return;
3336
3547
  this._availableCategories = o, this._catListeners.forEach((i) => i([...o]));
3337
3548
  const r = new Set(o.map((i) => i.category));
3338
- let a = !1;
3549
+ let s = !1;
3339
3550
  for (const i of [...this._selectedCategories])
3340
- r.has(i) || (this._selectedCategories.delete(i), this._features.delete(i), a = !0);
3341
- a && this._emitFeatures();
3551
+ r.has(i) || (this._selectedCategories.delete(i), this._features.delete(i), s = !0);
3552
+ s && this._emitFeatures();
3342
3553
  for (const i of this._selectedCategories)
3343
3554
  this._loadCategory(i, t, e);
3344
3555
  } catch (o) {
@@ -3351,11 +3562,11 @@ class sa {
3351
3562
  const r = (this._categoryTokens.get(t) ?? 0) + 1;
3352
3563
  this._categoryTokens.set(t, r);
3353
3564
  try {
3354
- const a = await this._getGateway().getFeaturesOfCategory(e, t);
3565
+ const s = await this._getGateway().getFeaturesOfCategory(e, t);
3355
3566
  if (this._categoryTokens.get(t) !== r || o !== this._queryToken || !this._selectedCategories.has(t)) return;
3356
- this._features.set(t, a), this._emitFeatures();
3357
- } catch (a) {
3358
- console.error(`[CueGis] Failed to load "${t}":`, a);
3567
+ this._features.set(t, s), this._emitFeatures();
3568
+ } catch (s) {
3569
+ console.error(`[CueGis] Failed to load "${t}":`, s);
3359
3570
  }
3360
3571
  }
3361
3572
  _emitFeatures() {
@@ -3366,11 +3577,11 @@ class sa {
3366
3577
  this._loadListeners.forEach((e) => e(t));
3367
3578
  }
3368
3579
  }
3369
- class te {
3580
+ class ie {
3370
3581
  constructor(t, e, o = !1, r) {
3371
- if (this._auth = t, this._db = He(e), this._gatewayUrl = r?.gatewayUrl ?? "", o) {
3372
- const a = r?.firestoreEmulatorHost ?? "localhost", i = r?.firestoreEmulatorPort ?? 8080;
3373
- We(this._db, a, i);
3582
+ if (this._auth = t, this._db = Ye(e), this._gatewayUrl = r?.gatewayUrl ?? "", o) {
3583
+ const s = r?.firestoreEmulatorHost ?? "localhost", i = r?.firestoreEmulatorPort ?? 8080;
3584
+ Je(this._db, s, i);
3374
3585
  }
3375
3586
  }
3376
3587
  _auth;
@@ -3388,7 +3599,7 @@ class te {
3388
3599
  * Throws if a project with the given ID already exists.
3389
3600
  */
3390
3601
  async createProject(t) {
3391
- const e = await this._auth.authenticatedFetch(`${this._gatewayUrl}${vr}`, {
3602
+ const e = await this._auth.authenticatedFetch(`${this._gatewayUrl}${Ir}`, {
3392
3603
  method: "POST",
3393
3604
  headers: { "Content-Type": "application/json" },
3394
3605
  body: JSON.stringify(t)
@@ -3401,7 +3612,7 @@ class te {
3401
3612
  }
3402
3613
  /** List all projects where the authenticated user appears in the members array. */
3403
3614
  async listProjects() {
3404
- const t = await this._auth.authenticatedFetch(`${this._gatewayUrl}${Ut}`);
3615
+ const t = await this._auth.authenticatedFetch(`${this._gatewayUrl}${zt}`);
3405
3616
  if (!t.ok) {
3406
3617
  const o = await t.text().catch(() => "");
3407
3618
  throw new Error(`Failed to list projects: ${t.status} ${t.statusText}${o ? ` — ${o}` : ""}`);
@@ -3412,12 +3623,12 @@ class te {
3412
3623
  /** Fetch a single project by ID. Returns null if not found or user lacks access. */
3413
3624
  async getProject(t) {
3414
3625
  const e = await this._auth.authenticatedFetch(
3415
- `${this._gatewayUrl}${Ut}?projectId=${encodeURIComponent(t)}`
3626
+ `${this._gatewayUrl}${zt}?projectId=${encodeURIComponent(t)}`
3416
3627
  );
3417
3628
  if (!e.ok) {
3418
3629
  if (e.status === 404) return null;
3419
- const a = await e.text().catch(() => "");
3420
- throw new Error(`Failed to fetch project: ${e.status} ${e.statusText}${a ? ` — ${a}` : ""}`);
3630
+ const s = await e.text().catch(() => "");
3631
+ throw new Error(`Failed to fetch project: ${e.status} ${e.statusText}${s ? ` — ${s}` : ""}`);
3421
3632
  }
3422
3633
  const r = (await e.json())[0] ?? null;
3423
3634
  return r && this._patchProject(r), r;
@@ -3438,10 +3649,10 @@ class te {
3438
3649
  */
3439
3650
  async incrementUnitsConsumed(t, e, o) {
3440
3651
  if (e <= 0) return;
3441
- const r = Ve(this._db, "clientSync", t);
3442
- await Xe(r, {
3443
- unitsConsumed: Ke(e),
3444
- lastUpdated: Qe(),
3652
+ const r = Ze(this._db, "clientSync", t);
3653
+ await to(r, {
3654
+ unitsConsumed: oo(e),
3655
+ lastUpdated: eo(),
3445
3656
  lastUserId: o
3446
3657
  }, { merge: !0 });
3447
3658
  }
@@ -3452,7 +3663,7 @@ class te {
3452
3663
  */
3453
3664
  async inviteUserToProject(t, e, o) {
3454
3665
  const r = await this._auth.authenticatedFetch(
3455
- `${this._gatewayUrl}${Tr(e)}`,
3666
+ `${this._gatewayUrl}${Rr(e)}`,
3456
3667
  {
3457
3668
  method: "POST",
3458
3669
  headers: { "Content-Type": "application/json" },
@@ -3463,15 +3674,15 @@ class te {
3463
3674
  const i = await r.text().catch(() => "");
3464
3675
  throw new Error(`Failed to invite user to project: ${r.status} ${r.statusText}${i ? ` — ${i}` : ""}`);
3465
3676
  }
3466
- const a = await r.json();
3467
- if (a.status === "invited")
3677
+ const s = await r.json();
3678
+ if (s.status === "invited")
3468
3679
  throw new Error("A user with that email does not exist. Please ask them to sign up first.");
3469
- return { uid: a.uid };
3680
+ return { uid: s.uid };
3470
3681
  }
3471
3682
  /** Change an existing member's role on a project. */
3472
3683
  async changeUserRoleOnProject(t, e, o) {
3473
3684
  const r = await this._auth.authenticatedFetch(
3474
- `${this._gatewayUrl}${kr(e, t)}`,
3685
+ `${this._gatewayUrl}${Ar(e, t)}`,
3475
3686
  {
3476
3687
  method: "PUT",
3477
3688
  headers: { "Content-Type": "application/json" },
@@ -3479,14 +3690,14 @@ class te {
3479
3690
  }
3480
3691
  );
3481
3692
  if (!r.ok) {
3482
- const a = await r.text().catch(() => "");
3483
- throw new Error(`Failed to change user role on project: ${r.status} ${r.statusText}${a ? ` — ${a}` : ""}`);
3693
+ const s = await r.text().catch(() => "");
3694
+ throw new Error(`Failed to change user role on project: ${r.status} ${r.statusText}${s ? ` — ${s}` : ""}`);
3484
3695
  }
3485
3696
  }
3486
3697
  /** Remove a member from a project. */
3487
3698
  async removeUserFromProject(t, e) {
3488
3699
  const o = await this._auth.authenticatedFetch(
3489
- `${this._gatewayUrl}${Sr(e, t)}`,
3700
+ `${this._gatewayUrl}${Or(e, t)}`,
3490
3701
  { method: "DELETE" }
3491
3702
  );
3492
3703
  if (!o.ok) {
@@ -3502,12 +3713,12 @@ class te {
3502
3713
  */
3503
3714
  async deleteProject(t, e = !1) {
3504
3715
  const o = e ? "?hard=true" : "", r = await this._auth.authenticatedFetch(
3505
- `${this._gatewayUrl}${_r(t)}${o}`,
3716
+ `${this._gatewayUrl}${Cr(t)}${o}`,
3506
3717
  { method: "DELETE" }
3507
3718
  );
3508
3719
  if (!r.ok) {
3509
- const a = await r.text().catch(() => "");
3510
- throw new Error(`Failed to delete project: ${r.status} ${r.statusText}${a ? ` — ${a}` : ""}`);
3720
+ const s = await r.text().catch(() => "");
3721
+ throw new Error(`Failed to delete project: ${r.status} ${r.statusText}${s ? ` — ${s}` : ""}`);
3511
3722
  }
3512
3723
  }
3513
3724
  /**
@@ -3516,7 +3727,7 @@ class te {
3516
3727
  */
3517
3728
  async restoreProject(t) {
3518
3729
  const e = await this._auth.authenticatedFetch(
3519
- `${this._gatewayUrl}${Er(t)}`,
3730
+ `${this._gatewayUrl}${xr(t)}`,
3520
3731
  { method: "POST" }
3521
3732
  );
3522
3733
  if (!e.ok) {
@@ -3533,7 +3744,7 @@ class te {
3533
3744
  */
3534
3745
  async getProjectMetadata(t) {
3535
3746
  const e = await this._auth.authenticatedFetch(
3536
- `${this._gatewayUrl}${Ir(t)}`
3747
+ `${this._gatewayUrl}${Dr(t)}`
3537
3748
  );
3538
3749
  if (!e.ok) {
3539
3750
  const o = await e.text().catch(() => "");
@@ -3544,7 +3755,7 @@ class te {
3544
3755
  /** Sets a project's portal-only metadata. Omit a field to leave it untouched, `null` to clear it. */
3545
3756
  async setProjectMetadata(t, e) {
3546
3757
  const o = await this._auth.authenticatedFetch(
3547
- `${this._gatewayUrl}${Cr(t)}`,
3758
+ `${this._gatewayUrl}${$r(t)}`,
3548
3759
  {
3549
3760
  method: "PUT",
3550
3761
  headers: { "Content-Type": "application/json" },
@@ -3557,9 +3768,9 @@ class te {
3557
3768
  }
3558
3769
  }
3559
3770
  }
3560
- class ee {
3771
+ class ne {
3561
3772
  constructor(t, e, o, r) {
3562
- this._auth = t, this._gatewayUrl = r, this._functions = wo(e, xo), o && fo(this._functions, "localhost", 5001);
3773
+ this._auth = t, this._gatewayUrl = r, this._functions = Eo(e, Po), o && To(this._functions, "localhost", 5001);
3563
3774
  }
3564
3775
  _auth;
3565
3776
  _gatewayUrl;
@@ -3586,13 +3797,13 @@ class ee {
3586
3797
  }
3587
3798
  /** Whether the current user has an active API key. */
3588
3799
  async hasAPIKey() {
3589
- return await this._fetch(Nt) !== null;
3800
+ return await this._fetch(Mt) !== null;
3590
3801
  }
3591
3802
  /** Returns the sign-in methods registered for the current user's email. */
3592
3803
  async getSignInMethods() {
3593
3804
  const t = this._auth.currentUser;
3594
3805
  if (!t?.email) throw new Error("User has no e-mail");
3595
- return io(this._auth.firebaseAuth, t.email);
3806
+ return uo(this._auth.firebaseAuth, t.email);
3596
3807
  }
3597
3808
  /** Builds a human-readable label from a Firebase UserInfo provider entry. */
3598
3809
  buildProviderLabel(t) {
@@ -3605,42 +3816,42 @@ class ee {
3605
3816
  }
3606
3817
  /** Links a Google or Microsoft provider to the current account via popup. Returns the new provider label. */
3607
3818
  async linkProvider(t) {
3608
- const e = this._requireUser(), o = t === "google.com" ? new dt() : new ut(t), a = (await no(e, o)).user.providerData.find(
3819
+ const e = this._requireUser(), o = t === "google.com" ? new ut() : new gt(t), s = (await go(e, o)).user.providerData.find(
3609
3820
  (i) => i.providerId === t
3610
3821
  );
3611
- return a ? this.buildProviderLabel(a) : "-";
3822
+ return s ? this.buildProviderLabel(s) : "-";
3612
3823
  }
3613
3824
  /** Unlinks a provider from the current account. */
3614
3825
  async unlinkProvider(t) {
3615
- await po(this._requireUser(), t);
3826
+ await mo(this._requireUser(), t);
3616
3827
  }
3617
3828
  /** Changes the password. Reauthenticates first. */
3618
3829
  async updatePassword(t, e) {
3619
3830
  const o = this._requireUser();
3620
3831
  if (!o.email) throw new Error("User has no e-mail");
3621
- await St(
3832
+ await Rt(
3622
3833
  o,
3623
3834
  et.credential(o.email, t)
3624
- ), await co(o, e);
3835
+ ), await wo(o, e);
3625
3836
  }
3626
3837
  /** Adds (sets) a password for an account that currently only uses SSO. */
3627
3838
  async addPassword(t) {
3628
3839
  const e = this._requireUser();
3629
3840
  if (!e.email) throw new Error("User has no e-mail");
3630
- await lo(e, et.credential(e.email, t));
3841
+ await fo(e, et.credential(e.email, t));
3631
3842
  }
3632
3843
  /** Requests an e-mail change. Sends a verification e-mail to the new address. */
3633
3844
  async updateEmail(t, e) {
3634
3845
  const o = this._requireUser();
3635
3846
  if (!o.email) throw new Error("User e-mail not available");
3636
- await St(
3847
+ await Rt(
3637
3848
  o,
3638
3849
  et.credential(o.email, e)
3639
- ), await ho(o, t), await uo(o);
3850
+ ), await yo(o, t), await bo(o);
3640
3851
  }
3641
3852
  /** Creates a new API key for the current user. */
3642
3853
  async createAPIKey(t) {
3643
- return this._fetch(jt, {
3854
+ return this._fetch(qt, {
3644
3855
  method: "POST",
3645
3856
  headers: { "Content-Type": "application/json" },
3646
3857
  body: JSON.stringify({ expiration: t })
@@ -3649,7 +3860,7 @@ class ee {
3649
3860
  /** Revokes the current user's API key. */
3650
3861
  async revokeAPIKey() {
3651
3862
  const t = await this._auth.authenticatedFetch(
3652
- this._url(jt),
3863
+ this._url(qt),
3653
3864
  { method: "DELETE" }
3654
3865
  );
3655
3866
  if (!t.ok)
@@ -3657,25 +3868,25 @@ class ee {
3657
3868
  }
3658
3869
  /** Fetches the current user's existing API key. */
3659
3870
  async requestAPIKey() {
3660
- const t = await this._fetch(Nt);
3871
+ const t = await this._fetch(Mt);
3661
3872
  if (!t) throw new Error("No API key found");
3662
3873
  return t;
3663
3874
  }
3664
3875
  /** Returns organizations the current user is a member of. */
3665
3876
  async listOrganizations() {
3666
- return this._fetch(Ao);
3877
+ return this._fetch(jo);
3667
3878
  }
3668
3879
  /** Returns all members of the given organisation. Caller must be an org admin or superadmin. */
3669
3880
  async getOrgMembers(t) {
3670
- return this._fetch($o(t));
3881
+ return this._fetch(qo(t));
3671
3882
  }
3672
3883
  /** Returns just the given organisation's admins. Caller must be a member (or admin/superadmin). */
3673
3884
  async getOrgAdmins(t) {
3674
- return this._fetch(No(t));
3885
+ return this._fetch(Fo(t));
3675
3886
  }
3676
3887
  /** Adds a new member to the organisation. Caller must be an org admin or superadmin. */
3677
3888
  async addOrgMember(t, e) {
3678
- await this._fetch(Qo(t), {
3889
+ await this._fetch(er(t), {
3679
3890
  method: "POST",
3680
3891
  headers: { "Content-Type": "application/json" },
3681
3892
  body: JSON.stringify(e)
@@ -3683,7 +3894,7 @@ class ee {
3683
3894
  }
3684
3895
  /** Changes an existing member's role within the organisation. Caller must be an org admin or superadmin. */
3685
3896
  async setOrgUserRole(t, e, o) {
3686
- await this._fetch(Ko(t, e), {
3897
+ await this._fetch(or(t, e), {
3687
3898
  method: "PUT",
3688
3899
  headers: { "Content-Type": "application/json" },
3689
3900
  body: JSON.stringify({ role: o })
@@ -3691,7 +3902,7 @@ class ee {
3691
3902
  }
3692
3903
  /** Removes a member from the organisation, optionally also removing them from every project they belong to. Caller must be an org admin or superadmin. */
3693
3904
  async removeOrgMember(t, e, o) {
3694
- await this._fetch(Yo(t, e), {
3905
+ await this._fetch(rr(t, e), {
3695
3906
  method: "DELETE",
3696
3907
  headers: { "Content-Type": "application/json" },
3697
3908
  body: JSON.stringify({ removeFromProjects: o })
@@ -3708,7 +3919,7 @@ class ee {
3708
3919
  * and accept that the call then takes as long as the computation does.
3709
3920
  */
3710
3921
  async getOrgCredits(t, e) {
3711
- const o = e?.refresh ? `${Lt(t)}?refresh=true` : Lt(t), r = await this._fetch(o);
3922
+ const o = e?.refresh ? `${Ft(t)}?refresh=true` : Ft(t), r = await this._fetch(o);
3712
3923
  return this._orgCredits.set(r), r;
3713
3924
  }
3714
3925
  /**
@@ -3717,7 +3928,7 @@ class ee {
3717
3928
  * or superadmin.
3718
3929
  */
3719
3930
  async getOrgConsumptionReport(t) {
3720
- return this._fetch(jo(t));
3931
+ return this._fetch(zo(t));
3721
3932
  }
3722
3933
  /**
3723
3934
  * Per-file-extension credit/unit breakdown for one project within `[from, to)` (UTC ISO 8601,
@@ -3728,9 +3939,9 @@ class ee {
3728
3939
  * or superadmin.
3729
3940
  */
3730
3941
  async getProjectFileTypeBreakdown(t, e, o, r) {
3731
- const a = new URLSearchParams({ from: o, to: r });
3942
+ const s = new URLSearchParams({ from: o, to: r });
3732
3943
  return this._fetch(
3733
- `${Lo(t, e)}?${a}`
3944
+ `${Bo(t, e)}?${s}`
3734
3945
  );
3735
3946
  }
3736
3947
  /**
@@ -3743,7 +3954,7 @@ class ee {
3743
3954
  */
3744
3955
  async getProjectTrafficReport(t, e, o, r) {
3745
3956
  return this._fetch(
3746
- `${Uo(t, e)}${this._rangeQuery(o, r)}`
3957
+ `${Go(t, e)}${this._rangeQuery(o, r)}`
3747
3958
  );
3748
3959
  }
3749
3960
  /**
@@ -3753,7 +3964,7 @@ class ee {
3753
3964
  */
3754
3965
  async getProjectUsageReport(t, e, o, r) {
3755
3966
  return this._fetch(
3756
- `${Mo(t, e)}${this._rangeQuery(o, r)}`
3967
+ `${Ho(t, e)}${this._rangeQuery(o, r)}`
3757
3968
  );
3758
3969
  }
3759
3970
  /** `?from=…&to=…`, or `''` when unbounded — the backend treats missing bounds as "everything". */
@@ -3765,7 +3976,7 @@ class ee {
3765
3976
  }
3766
3977
  /** Manual/support credit grant to an organisation's shared pool. Superadmins only — org admins self-serve via `startOrgCheckout`. */
3767
3978
  async topUpOrgCredits(t, e) {
3768
- await this._fetch(Ho(t), {
3979
+ await this._fetch(Yo(t), {
3769
3980
  method: "POST",
3770
3981
  headers: { "Content-Type": "application/json" },
3771
3982
  body: JSON.stringify({ amount: e })
@@ -3781,7 +3992,7 @@ class ee {
3781
3992
  * granted by the backend webhook once payment completes.
3782
3993
  */
3783
3994
  async startOrgCheckout(t, e) {
3784
- return this._fetch(Vo(t), {
3995
+ return this._fetch(Zo(t), {
3785
3996
  method: "POST",
3786
3997
  headers: { "Content-Type": "application/json" },
3787
3998
  body: JSON.stringify({ credits: e })
@@ -3793,7 +4004,7 @@ class ee {
3793
4004
  * an org admin; requires the org to have a Stripe customer.
3794
4005
  */
3795
4006
  async startOrgBillingPortal(t) {
3796
- return this._fetch(Xo(t), { method: "POST" });
4007
+ return this._fetch(tr(t), { method: "POST" });
3797
4008
  }
3798
4009
  /**
3799
4010
  * Change an organisation's plan — freemium → custom (first paid plan), or
@@ -3806,7 +4017,7 @@ class ee {
3806
4017
  * {@link startOrgBillingPortal} instead — this throws if called on one.
3807
4018
  */
3808
4019
  async changeOrgPlan(t, e) {
3809
- return this._fetch(Wo(t), {
4020
+ return this._fetch(Jo(t), {
3810
4021
  method: "POST",
3811
4022
  headers: { "Content-Type": "application/json" },
3812
4023
  body: JSON.stringify(e)
@@ -3822,11 +4033,11 @@ class ee {
3822
4033
  * Uses the `getUserInfo` Firebase callable function.
3823
4034
  */
3824
4035
  async getUserInfo(t) {
3825
- return (await yo(this._functions, "getUserInfo")({ uids: t })).data;
4036
+ return (await ko(this._functions, "getUserInfo")({ uids: t })).data;
3826
4037
  }
3827
4038
  /** Record that the current user has accepted the terms of service. Sets a `terms` custom claim on the token. */
3828
4039
  async acceptTerms(t) {
3829
- await this._fetch(Oo, {
4040
+ await this._fetch(Lo, {
3830
4041
  method: "POST",
3831
4042
  headers: { "Content-Type": "application/json" },
3832
4043
  body: JSON.stringify({ version: t })
@@ -3840,7 +4051,7 @@ class ee {
3840
4051
  */
3841
4052
  async latestTermsAccepted() {
3842
4053
  const t = this._auth.currentUser;
3843
- return t ? (await K(t)).claims.terms ?? null : null;
4054
+ return t ? (await Q(t)).claims.terms ?? null : null;
3844
4055
  }
3845
4056
  /**
3846
4057
  * Record that the current user has been shown (and dismissed) the usage-analytics
@@ -3848,7 +4059,7 @@ class ee {
3848
4059
  * `terms`, since this is a lightweight acknowledgement, not a blocking agreement.
3849
4060
  */
3850
4061
  async acceptAnalyticsNotice(t) {
3851
- await this._fetch(Po, {
4062
+ await this._fetch(Uo, {
3852
4063
  method: "POST",
3853
4064
  headers: { "Content-Type": "application/json" },
3854
4065
  body: JSON.stringify({ version: t })
@@ -3863,10 +4074,10 @@ class ee {
3863
4074
  */
3864
4075
  async latestAnalyticsNoticeAccepted() {
3865
4076
  const t = this._auth.currentUser;
3866
- return t ? (await K(t)).claims.analyticsNotice ?? null : null;
4077
+ return t ? (await Q(t)).claims.analyticsNotice ?? null : null;
3867
4078
  }
3868
4079
  }
3869
- class oe {
4080
+ class pe {
3870
4081
  constructor(t, e) {
3871
4082
  this._auth = t, this._gatewayUrl = e;
3872
4083
  }
@@ -3879,14 +4090,14 @@ class oe {
3879
4090
  * break navigation; failures are only logged.
3880
4091
  */
3881
4092
  recordView(t, e) {
3882
- this._auth.authenticatedFetch(`${this._gatewayUrl}${Do}`, {
4093
+ this._auth.authenticatedFetch(`${this._gatewayUrl}${Mo}`, {
3883
4094
  method: "POST",
3884
4095
  headers: { "Content-Type": "application/json" },
3885
4096
  body: JSON.stringify({ view: t, projectId: e })
3886
4097
  }).catch((o) => console.warn("Failed to record usage view", o));
3887
4098
  }
3888
4099
  }
3889
- class re {
4100
+ class ce {
3890
4101
  constructor(t, e) {
3891
4102
  this._auth = t, this._gatewayUrl = e;
3892
4103
  }
@@ -3905,11 +4116,11 @@ class re {
3905
4116
  }
3906
4117
  /** Matches organisations on name, id or any alternative id. */
3907
4118
  searchOrganizations(t) {
3908
- return this._search(Zo, t);
4119
+ return this._search(ar, t);
3909
4120
  }
3910
4121
  /** Matches users on display name, e-mail, or an exact uid. */
3911
4122
  searchUsers(t) {
3912
- return this._search(or, t);
4123
+ return this._search(pr, t);
3913
4124
  }
3914
4125
  /**
3915
4126
  * Matches projects on name, id or any alternative id, across every organisation.
@@ -3917,18 +4128,18 @@ class re {
3917
4128
  */
3918
4129
  searchProjects(t, e = !1) {
3919
4130
  return this._search(
3920
- er,
4131
+ nr,
3921
4132
  t,
3922
4133
  e ? { includeDeleted: "true" } : void 0
3923
4134
  );
3924
4135
  }
3925
4136
  /** Full profile for one user: auth record, orgs and projects they belong to. */
3926
4137
  getUserDetail(t) {
3927
- return this._fetch(rr(t));
4138
+ return this._fetch(cr(t));
3928
4139
  }
3929
4140
  /** Every organisation on the platform. Unpaginated — prefer `searchOrganizations`. */
3930
4141
  listOrganizations() {
3931
- return this._fetch(Jo);
4142
+ return this._fetch(sr);
3932
4143
  }
3933
4144
  /**
3934
4145
  * Every project owned by `orgId`, regardless of the caller's membership.
@@ -3936,11 +4147,11 @@ class re {
3936
4147
  * membership) this is what lets a superadmin open a foreign org's projects.
3937
4148
  */
3938
4149
  listOrgProjects(t) {
3939
- return this._fetch(tr(t));
4150
+ return this._fetch(ir(t));
3940
4151
  }
3941
4152
  /** Every user holding the `superadmin` custom claim. */
3942
4153
  listSuperadmins() {
3943
- return this._fetch(sr);
4154
+ return this._fetch(lr);
3944
4155
  }
3945
4156
  /**
3946
4157
  * Deletes the Auth account and profile doc, and scrubs every org/project
@@ -3949,22 +4160,22 @@ class re {
3949
4160
  * teardown, not normal superadmin use, since a hard delete cannot be undone.
3950
4161
  */
3951
4162
  deleteUser(t, e = !1) {
3952
- return this._fetch(`${ir(t)}${e ? "?hard=true" : ""}`, { method: "DELETE" });
4163
+ return this._fetch(`${dr(t)}${e ? "?hard=true" : ""}`, { method: "DELETE" });
3953
4164
  }
3954
4165
  /**
3955
4166
  * Undoes `deleteUser`: recreates the Auth account (same uid) and profile doc,
3956
4167
  * and re-grants the recorded org/project roles where those still exist.
3957
4168
  */
3958
4169
  restoreUser(t) {
3959
- return this._fetch(nr(t), { method: "POST" });
4170
+ return this._fetch(ur(t), { method: "POST" });
3960
4171
  }
3961
4172
  /** Every archived deletion, restored or not — newest first. */
3962
4173
  listDeletedUsers() {
3963
- return this._fetch(ar);
4174
+ return this._fetch(hr);
3964
4175
  }
3965
4176
  /** Creates a Firebase Auth account with no organisation — for picking as a new org's initial admin. */
3966
4177
  createAdminUser(t) {
3967
- return this._fetch(pr, {
4178
+ return this._fetch(gr, {
3968
4179
  method: "POST",
3969
4180
  headers: { "Content-Type": "application/json" },
3970
4181
  body: JSON.stringify(t)
@@ -3972,15 +4183,15 @@ class re {
3972
4183
  }
3973
4184
  /** Grants the `superadmin` custom claim. The user must sign in again for it to take effect. */
3974
4185
  grantSuperadmin(t) {
3975
- return this._fetch(Mt(t), { method: "PUT" });
4186
+ return this._fetch(Bt(t), { method: "PUT" });
3976
4187
  }
3977
4188
  /** Revokes the `superadmin` custom claim. */
3978
4189
  revokeSuperadmin(t) {
3979
- return this._fetch(Mt(t), { method: "DELETE" });
4190
+ return this._fetch(Bt(t), { method: "DELETE" });
3980
4191
  }
3981
4192
  /** Creates a new organisation with `adminUserId` as its sole admin/member. */
3982
4193
  createOrganization(t) {
3983
- return this._fetch(cr, {
4194
+ return this._fetch(mr, {
3984
4195
  method: "POST",
3985
4196
  headers: { "Content-Type": "application/json" },
3986
4197
  body: JSON.stringify(t)
@@ -3988,7 +4199,7 @@ class re {
3988
4199
  }
3989
4200
  /** Sets an organisation's allowed email domains for auto-join sign-up. */
3990
4201
  setOrgDomains(t, e) {
3991
- return this._fetch(dr(t), {
4202
+ return this._fetch(yr(t), {
3992
4203
  method: "PUT",
3993
4204
  headers: { "Content-Type": "application/json" },
3994
4205
  body: JSON.stringify({ domains: e })
@@ -4002,42 +4213,42 @@ class re {
4002
4213
  * snapshot, same as a direct `deleteUser`).
4003
4214
  */
4004
4215
  deleteOrganization(t) {
4005
- return this._fetch(lr(t), { method: "DELETE" });
4216
+ return this._fetch(wr(t), { method: "DELETE" });
4006
4217
  }
4007
4218
  /** Undoes `deleteOrganization`: restores cascaded projects/users where they still can be, then un-flags the org. */
4008
4219
  restoreOrganization(t) {
4009
- return this._fetch(hr(t), { method: "POST" });
4220
+ return this._fetch(fr(t), { method: "POST" });
4010
4221
  }
4011
4222
  /** Every soft-deleted organisation, restored or not — newest first. */
4012
4223
  listDeletedOrganizations() {
4013
- return this._fetch(ur);
4224
+ return this._fetch(br);
4014
4225
  }
4015
4226
  /** Users belonging to no organisation — a data-health diagnostic, not paginated. */
4016
4227
  listUsersWithoutOrg() {
4017
- return this._fetch(gr);
4228
+ return this._fetch(vr);
4018
4229
  }
4019
4230
  /** Users belonging to no project — a data-health diagnostic, not paginated. */
4020
4231
  listUsersWithoutProject() {
4021
- return this._fetch(mr);
4232
+ return this._fetch(_r);
4022
4233
  }
4023
4234
  /** Projects with no members, syncers, or admins — a data-health diagnostic. */
4024
4235
  listProjectsWithoutUsers() {
4025
- return this._fetch(wr);
4236
+ return this._fetch(Er);
4026
4237
  }
4027
4238
  /** Projects with no admin (may still have members/syncers) — a data-health diagnostic. */
4028
4239
  listProjectsWithoutAdmins() {
4029
- return this._fetch(fr);
4240
+ return this._fetch(Tr);
4030
4241
  }
4031
4242
  /** Organisations with no members — a data-health diagnostic. */
4032
4243
  listOrgsWithoutUsers() {
4033
- return this._fetch(yr);
4244
+ return this._fetch(kr);
4034
4245
  }
4035
4246
  /** Organisations with no admin (may still have members) — a data-health diagnostic. */
4036
4247
  listOrgsWithoutAdmins() {
4037
- return this._fetch(br);
4248
+ return this._fetch(Sr);
4038
4249
  }
4039
4250
  }
4040
- const se = ["superadmin", "admin", "syncer", "member"], ae = {
4251
+ const le = ["superadmin", "admin", "syncer", "member"], he = {
4041
4252
  createEntities: "admin",
4042
4253
  createProvider: "superadmin",
4043
4254
  changeContentCategories: "syncer",
@@ -4061,7 +4272,7 @@ const se = ["superadmin", "admin", "syncer", "member"], ae = {
4061
4272
  viewUsageStats: "superadmin",
4062
4273
  viewEntities: "member"
4063
4274
  };
4064
- function aa() {
4275
+ function ma() {
4065
4276
  return {
4066
4277
  changeContentCategories: !1,
4067
4278
  createEntities: !1,
@@ -4088,9 +4299,9 @@ function aa() {
4088
4299
  viewEntities: !1
4089
4300
  };
4090
4301
  }
4091
- class ie {
4302
+ class de {
4092
4303
  constructor(t) {
4093
- this._isSuperAdmin = t, this._projectRoles = new E([]), this._orgRole = new E(null), this.privileges = bt(
4304
+ this._isSuperAdmin = t, this._projectRoles = new E([]), this._orgRole = new E(null), this.privileges = vt(
4094
4305
  [this._projectRoles, this._orgRole, t],
4095
4306
  () => this._compute()
4096
4307
  );
@@ -4122,22 +4333,22 @@ class ie {
4122
4333
  */
4123
4334
  setProjectRoles(t) {
4124
4335
  const e = this._expand(t), o = this._projectRoles.get();
4125
- o.length === e.length && o.every((a, i) => a === e[i]) || this._projectRoles.set(e);
4336
+ o.length === e.length && o.every((s, i) => s === e[i]) || this._projectRoles.set(e);
4126
4337
  }
4127
4338
  _expand(t) {
4128
4339
  if (this._isSuperAdmin.get())
4129
4340
  return ["superadmin", "admin", "syncer", "member"];
4130
- const e = se.findIndex((o) => t.includes(o));
4131
- return e === -1 ? [] : Array.from(se.slice(e));
4341
+ const e = le.findIndex((o) => t.includes(o));
4342
+ return e === -1 ? [] : Array.from(le.slice(e));
4132
4343
  }
4133
4344
  _compute() {
4134
- const t = this._projectRoles.get(), e = this._isSuperAdmin.get(), o = aa();
4135
- for (const r of Object.keys(ae))
4136
- o[r] = t.includes(ae[r]);
4345
+ const t = this._projectRoles.get(), e = this._isSuperAdmin.get(), o = ma();
4346
+ for (const r of Object.keys(he))
4347
+ o[r] = t.includes(he[r]);
4137
4348
  return o.createProject = e || this._orgRole.get() === "admin", o;
4138
4349
  }
4139
4350
  }
4140
- class ne {
4351
+ class ue {
4141
4352
  constructor(t) {
4142
4353
  this._storage = t;
4143
4354
  }
@@ -4170,7 +4381,7 @@ class ne {
4170
4381
  // ── Internal helpers ───────────────────────────────────────────────────────
4171
4382
  async _get(t, e) {
4172
4383
  try {
4173
- const r = await (await Ee(k(this._storage, `${t}/${e}.json.gz`))).arrayBuffer(), a = new DecompressionStream("gzip"), i = a.writable.getWriter(), n = a.readable.getReader();
4384
+ const r = await (await xe(k(this._storage, `${t}/${e}.json.gz`))).arrayBuffer(), s = new DecompressionStream("gzip"), i = s.writable.getWriter(), n = s.readable.getReader();
4174
4385
  i.write(new Uint8Array(r)), i.close();
4175
4386
  const p = [];
4176
4387
  let c = await n.read();
@@ -4182,12 +4393,12 @@ class ne {
4182
4393
  d.set(m, u), u += m.length;
4183
4394
  return JSON.parse(new TextDecoder().decode(d));
4184
4395
  } catch (o) {
4185
- if (ia(o)) return;
4396
+ if (wa(o)) return;
4186
4397
  throw o;
4187
4398
  }
4188
4399
  }
4189
4400
  async _set(t, e, o) {
4190
- const r = new TextEncoder().encode(JSON.stringify(o)), a = new CompressionStream("gzip"), i = a.writable.getWriter(), n = a.readable.getReader();
4401
+ const r = new TextEncoder().encode(JSON.stringify(o)), s = new CompressionStream("gzip"), i = s.writable.getWriter(), n = s.readable.getReader();
4191
4402
  i.write(new Uint8Array(r)), i.close();
4192
4403
  const p = [];
4193
4404
  let c = await n.read();
@@ -4197,18 +4408,18 @@ class ne {
4197
4408
  let u = 0;
4198
4409
  for (const m of p)
4199
4410
  d.set(m, u), u += m.length;
4200
- await ht(
4411
+ await dt(
4201
4412
  k(this._storage, `${t}/${e}.json.gz`),
4202
4413
  d,
4203
4414
  { contentType: "application/gzip" }
4204
4415
  );
4205
4416
  }
4206
4417
  }
4207
- function ia(s) {
4208
- return typeof s == "object" && s !== null && "code" in s && s.code === "storage/object-not-found";
4418
+ function wa(a) {
4419
+ return typeof a == "object" && a !== null && "code" in a && a.code === "storage/object-not-found";
4209
4420
  }
4210
- const qa = ["CHF", "DKK", "EUR"], za = "CHF", na = 3600 * 1e3, pa = "https://api.frankfurter.dev/v1/latest?from=CHF&to=DKK,EUR";
4211
- class pe {
4421
+ const Qa = ["CHF", "DKK", "EUR"], Ya = "CHF", fa = 3600 * 1e3, ya = "https://api.frankfurter.dev/v1/latest?from=CHF&to=DKK,EUR";
4422
+ class ge {
4212
4423
  _cached = null;
4213
4424
  _pending = null;
4214
4425
  /**
@@ -4218,7 +4429,7 @@ class pe {
4218
4429
  * throwing — a transient network blip shouldn't break the pricing UI.
4219
4430
  */
4220
4431
  async getRates(t = !1) {
4221
- return !t && this._cached && Date.now() - this._cached.fetchedAt < na ? this._cached : this._pending ? this._pending : (this._pending = this._fetchRates().then((e) => (this._cached = e, e)).catch((e) => {
4432
+ return !t && this._cached && Date.now() - this._cached.fetchedAt < fa ? this._cached : this._pending ? this._pending : (this._pending = this._fetchRates().then((e) => (this._cached = e, e)).catch((e) => {
4222
4433
  if (this._cached) return this._cached;
4223
4434
  throw e;
4224
4435
  }).finally(() => {
@@ -4226,7 +4437,7 @@ class pe {
4226
4437
  }), this._pending);
4227
4438
  }
4228
4439
  async _fetchRates() {
4229
- const t = await fetch(pa);
4440
+ const t = await fetch(ya);
4230
4441
  if (!t.ok)
4231
4442
  throw new Error(`Failed to fetch exchange rates: ${t.status} ${t.statusText}`);
4232
4443
  const e = await t.json();
@@ -7506,8 +7717,8 @@ class J {
7506
7717
  let o = t;
7507
7718
  if (t.includes("#")) o = `${t.split("#")[0]}#`;
7508
7719
  else {
7509
- const a = t.split("/");
7510
- a.pop(), o = a.join("/") + "/";
7720
+ const s = t.split("/");
7721
+ s.pop(), o = s.join("/") + "/";
7511
7722
  }
7512
7723
  if (o === void 0) return t;
7513
7724
  const r = e[o];
@@ -7524,7 +7735,7 @@ class J {
7524
7735
  ), this._nsMap = t, t;
7525
7736
  }
7526
7737
  }
7527
- const ca = `${y.qcy}ContentCategory`, la = `${y.qcy}EntityCategory`, ha = `${y.qcy}relatedEntity`, da = `PREFIX view: <https://qlever.cs.uni-freiburg.de/materializedView/>
7738
+ const ba = `${y.qcy}ContentCategory`, va = `${y.qcy}EntityCategory`, _a = `${y.qcy}relatedEntity`, Ea = `PREFIX view: <https://qlever.cs.uni-freiburg.de/materializedView/>
7528
7739
  SELECT ?iri ?type ?parent ?deprecated ?label ?definition
7529
7740
  WHERE {
7530
7741
  SERVICE view:schemas {
@@ -7536,9 +7747,9 @@ WHERE {
7536
7747
  view:column-definition ?definition .
7537
7748
  }
7538
7749
  }`;
7539
- class ua {
7540
- constructor(t, e, o, r, a) {
7541
- this._api = t, this._projectId = e, this._graphType = r, this._verbose = a ?? !1, this._currentLang = o, this._api.setLanguage(o), this._contentCategories = new E([]), this._entityCategories = new E([]), this._relationships = new E([]), this.availableContentCategories = this._contentCategories.asReadonly(), this.availableEntityCategories = this._entityCategories.asReadonly(), this.availableEntityRelationships = this._relationships.asReadonly(), this.ready = this._load().catch(
7750
+ class Ta {
7751
+ constructor(t, e, o, r, s) {
7752
+ this._api = t, this._projectId = e, this._graphType = r, this._verbose = s ?? !1, this._currentLang = o, this._api.setLanguage(o), this._contentCategories = new E([]), this._entityCategories = new E([]), this._relationships = new E([]), this.availableContentCategories = this._contentCategories.asReadonly(), this.availableEntityCategories = this._entityCategories.asReadonly(), this.availableEntityRelationships = this._relationships.asReadonly(), this.ready = this._load().catch(
7542
7753
  (i) => console.error("[CueProjectSchema] Initial load failed:", i)
7543
7754
  );
7544
7755
  }
@@ -7616,7 +7827,7 @@ class ua {
7616
7827
  */
7617
7828
  async _fetchSnapshot() {
7618
7829
  if (this._graphType !== "fuseki") {
7619
- const e = await this._runSchemaQuery(da);
7830
+ const e = await this._runSchemaQuery(Ea);
7620
7831
  if (e.contentCategories.length + e.entityCategories.length + e.relationships.length > 0) return e;
7621
7832
  console.warn(
7622
7833
  `[CueProjectSchema] Materialized view "schemas" returned no rows for project ${this._projectId} — falling back to the live schema query.`
@@ -7636,13 +7847,13 @@ class ua {
7636
7847
  }
7637
7848
  /** Projects a language-independent {@link SchemaNode} into a {@link CategoryDef}. */
7638
7849
  _toDef(t, e) {
7639
- const o = he(t.labels, e) ?? t.iri.split("#").at(-1) ?? t.iri, r = he(t.definitions, e), a = Object.keys(t.definitions).length > 0;
7850
+ const o = fe(t.labels, e) ?? t.iri.split("#").at(-1) ?? t.iri, r = fe(t.definitions, e), s = Object.keys(t.definitions).length > 0;
7640
7851
  return {
7641
7852
  iri: t.iri,
7642
7853
  label: o,
7643
7854
  labels: t.labels,
7644
7855
  ...r !== void 0 ? { definition: r } : {},
7645
- ...a ? { definitions: t.definitions } : {},
7856
+ ...s ? { definitions: t.definitions } : {},
7646
7857
  ...t.parent !== void 0 ? { parent: t.parent } : {},
7647
7858
  ...t.deprecated !== void 0 ? { deprecated: t.deprecated } : {}
7648
7859
  };
@@ -7685,45 +7896,45 @@ WHERE {
7685
7896
  this._projectId,
7686
7897
  this._graphType
7687
7898
  ), o = /* @__PURE__ */ new Map();
7688
- for (const a of e.results.bindings) {
7689
- const i = a.iri?.value, n = a.type?.value;
7899
+ for (const s of e.results.bindings) {
7900
+ const i = s.iri?.value, n = s.type?.value;
7690
7901
  if (!i || !n) continue;
7691
7902
  let p = o.get(i);
7692
- p || (p = { iri: i, type: n, labels: {}, definitions: {} }, o.set(i, p)), p.parent === void 0 && a.parent?.value && (p.parent = a.parent.value);
7693
- const c = a.deprecated?.value;
7694
- c !== void 0 && (p.deprecated = c === "true" || c === "1"), ce(p.labels, a.label), ce(p.definitions, a.definition);
7903
+ p || (p = { iri: i, type: n, labels: {}, definitions: {} }, o.set(i, p)), p.parent === void 0 && s.parent?.value && (p.parent = s.parent.value);
7904
+ const c = s.deprecated?.value;
7905
+ c !== void 0 && (p.deprecated = c === "true" || c === "1"), me(p.labels, s.label), me(p.definitions, s.definition);
7695
7906
  }
7696
7907
  const r = {
7697
7908
  contentCategories: [],
7698
7909
  entityCategories: [],
7699
7910
  relationships: []
7700
7911
  };
7701
- for (const a of o.values())
7702
- le(a.labels), le(a.definitions), a.type === ca ? r.contentCategories.push(a) : a.type === la ? r.entityCategories.push(a) : a.type === ha && r.relationships.push(a);
7912
+ for (const s of o.values())
7913
+ we(s.labels), we(s.definitions), s.type === ba ? r.contentCategories.push(s) : s.type === va ? r.entityCategories.push(s) : s.type === _a && r.relationships.push(s);
7703
7914
  return r;
7704
7915
  }
7705
7916
  }
7706
- function ce(s, t) {
7917
+ function me(a, t) {
7707
7918
  if (!t || t.value === void 0) return;
7708
7919
  const e = t["xml:lang"], o = e && e.length > 0 ? e : "default";
7709
- s[o] === void 0 && (s[o] = t.value);
7920
+ a[o] === void 0 && (a[o] = t.value);
7710
7921
  }
7711
- function le(s) {
7712
- if (s.en !== void 0) {
7713
- s.default = s.en;
7922
+ function we(a) {
7923
+ if (a.en !== void 0) {
7924
+ a.default = a.en;
7714
7925
  return;
7715
7926
  }
7716
- if (s.default !== void 0) return;
7717
- const t = Object.values(s)[0];
7718
- t !== void 0 && (s.default = t);
7927
+ if (a.default !== void 0) return;
7928
+ const t = Object.values(a)[0];
7929
+ t !== void 0 && (a.default = t);
7719
7930
  }
7720
- function he(s, t) {
7721
- return s[t] ?? s.default;
7931
+ function fe(a, t) {
7932
+ return a[t] ?? a.default;
7722
7933
  }
7723
- const ga = "https://qlever.dev/api/osm-planet";
7724
- class Ne {
7725
- constructor(t, e, o = vt, r, a = !1) {
7726
- this._api = t, this._projectId = e, this._graphType = r, this._verbose = a, this.baseURL = `${o}${e}/`, this.entityInfoMap = this._entityInfoMapComputed, this.entityGraph = this._entityGraph.asReadonly(), this._entityOSMMap.subscribe(() => this._checkPendingOSMFetches()), this._fetchEntityGraph().catch(
7934
+ const ka = "https://qlever.dev/api/osm-planet";
7935
+ class Fe {
7936
+ constructor(t, e, o = _t, r, s = !1) {
7937
+ this._api = t, this._projectId = e, this._graphType = r, this._verbose = s, this.baseURL = `${o}${e}/`, this.entityInfoMap = this._entityInfoMapComputed, this.entityGraph = this._entityGraph.asReadonly(), this._entityOSMMap.subscribe(() => this._checkPendingOSMFetches()), this._fetchEntityGraph().catch(
7727
7938
  (i) => console.error("[CueProjectEntities] Entity graph fetch failed:", i)
7728
7939
  );
7729
7940
  }
@@ -7760,7 +7971,7 @@ class Ne {
7760
7971
  */
7761
7972
  _categoryCountsCache;
7762
7973
  // ── Derived signals ────────────────────────────────────────────────────────
7763
- _entityInfoMapComputed = bt(
7974
+ _entityInfoMapComputed = vt(
7764
7975
  [
7765
7976
  this._entityDetails,
7766
7977
  this._entityDocuments,
@@ -7815,7 +8026,7 @@ class Ne {
7815
8026
  );
7816
8027
  if (o.length === 0) return;
7817
8028
  this._log(`requestEntityData: ${o.length} new / ${t.length} requested | cumulative: ${this._seenIds.size} seen`);
7818
- const r = o.map((i) => `r:${i}`).join(" "), a = `PREFIX qcy: <${y.qcy}>
8029
+ const r = o.map((i) => `r:${i}`).join(" "), s = `PREFIX qcy: <${y.qcy}>
7819
8030
  PREFIX r: <${this.baseURL}>
7820
8031
  SELECT ?id (SAMPLE(?val) AS ?value) (GROUP_CONCAT(DISTINCT STR(?cat); SEPARATOR=";") AS ?categories) ?mentionCount
7821
8032
  WHERE {
@@ -7827,7 +8038,7 @@ WHERE {
7827
8038
  WHERE { ?mention qcy:resolvesTo ?iri } GROUP BY ?iri}` : ""}
7828
8039
  }
7829
8040
  GROUP BY ?id ?mentionCount`;
7830
- this._api.sparql(a, this._projectId, this._graphType).then((i) => {
8041
+ this._api.sparql(s, this._projectId, this._graphType).then((i) => {
7831
8042
  const n = i, p = {
7832
8043
  ...this._entityDetails.get()
7833
8044
  };
@@ -7861,7 +8072,7 @@ GROUP BY ?id ?mentionCount`;
7861
8072
  const o = { ...this._entityOSMMap.get() };
7862
8073
  for (const p of e) o[p] = { direct: [], indirect: [] };
7863
8074
  this._entityOSMMap.set(o);
7864
- const r = e.map((p) => `r:${p}`).join(" "), a = `PREFIX qcy: <${y.qcy}>
8075
+ const r = e.map((p) => `r:${p}`).join(" "), s = `PREFIX qcy: <${y.qcy}>
7865
8076
  PREFIX r: <${this.baseURL}>
7866
8077
  SELECT ?id ?osm ?direct ?rels ?entityUUID
7867
8078
  WHERE {
@@ -7889,7 +8100,7 @@ WHERE {
7889
8100
  }
7890
8101
  BIND(REPLACE(STR(?iri), "^.*/([^/]*)$", "$1") AS ?id)
7891
8102
  }`, i = await this._api.sparql(
7892
- a,
8103
+ s,
7893
8104
  this._projectId,
7894
8105
  this._graphType
7895
8106
  ), n = { ...this._entityOSMMap.get() };
@@ -7916,11 +8127,11 @@ WHERE {
7916
8127
  const [o, r] = await Promise.all([
7917
8128
  this._fetchOutgoingRelationships(t),
7918
8129
  this._fetchIncomingRelationships(t)
7919
- ]), a = { outgoing: o, incoming: r };
8130
+ ]), s = { outgoing: o, incoming: r };
7920
8131
  return this._entityRelationships.set({
7921
8132
  ...this._entityRelationships.get(),
7922
- [e]: a
7923
- }), a;
8133
+ [e]: s
8134
+ }), s;
7924
8135
  }
7925
8136
  /**
7926
8137
  * Fetches UUIDs of documents that reference the given entity IRI.
@@ -7939,12 +8150,12 @@ WHERE {
7939
8150
  ?doc a qcy:FileContent ;
7940
8151
  qcy:about ?iri .
7941
8152
  BIND(REPLACE(STR(?doc), "^.*/([^/]*)$", "$1") AS ?id)
7942
- }`, a = (await this._api.sparql(
8153
+ }`, s = (await this._api.sparql(
7943
8154
  o,
7944
8155
  this._projectId,
7945
8156
  this._graphType
7946
8157
  )).results.bindings.filter((i) => i.id !== void 0).map((i) => i.id.value);
7947
- return this._entityDocuments.set({ ...this._entityDocuments.get(), [e]: a }), a;
8158
+ return this._entityDocuments.set({ ...this._entityDocuments.get(), [e]: s }), s;
7948
8159
  }
7949
8160
  /**
7950
8161
  * Fetches all `qcy:EntityCategory` IRIs and their preferred labels for this
@@ -7968,20 +8179,20 @@ ORDER BY ${t ? "DESC(?count)" : "ASC(?label)"}`;
7968
8179
  o,
7969
8180
  this._projectId,
7970
8181
  this._graphType
7971
- )).results.bindings.filter((a) => a.iri !== void 0).map((a) => {
7972
- const i = a.count ? parseInt(a.count.value, 10) : 0, n = a.label?.value ?? a.iri.value.split("#").at(-1), p = i > 0 ? `${n} (${i})` : n ?? "";
8182
+ )).results.bindings.filter((s) => s.iri !== void 0).map((s) => {
8183
+ const i = s.count ? parseInt(s.count.value, 10) : 0, n = s.label?.value ?? s.iri.value.split("#").at(-1), p = i > 0 ? `${n} (${i})` : n ?? "";
7973
8184
  return {
7974
- iri: a.iri.value,
8185
+ iri: s.iri.value,
7975
8186
  label: p
7976
8187
  };
7977
8188
  });
7978
8189
  }
7979
8190
  async entitiesByCategory(t, e = !1) {
7980
8191
  if (t.length === 0) return [];
7981
- const o = J.getInstance(), r = (p) => p.startsWith("http://") || p.startsWith("https://") ? p : o.expandIRI(p), a = t.map((p) => `<${r(p)}>`).join(" "), i = e ? `PREFIX qcy: <${y.qcy}>
8192
+ const o = J.getInstance(), r = (p) => p.startsWith("http://") || p.startsWith("https://") ? p : o.expandIRI(p), s = t.map((p) => `<${r(p)}>`).join(" "), i = e ? `PREFIX qcy: <${y.qcy}>
7982
8193
  SELECT ?id (SAMPLE(?val) AS ?value) (GROUP_CONCAT(DISTINCT STR(?allCat); SEPARATOR=";") AS ?categories)
7983
8194
  WHERE {
7984
- VALUES ?filterCat { ${a} }
8195
+ VALUES ?filterCat { ${s} }
7985
8196
  ?iri a qcy:CanonicalEntity ;
7986
8197
  qcy:hasEntityCategory ?filterCat ;
7987
8198
  qcy:value ?val ;
@@ -7991,7 +8202,7 @@ WHERE {
7991
8202
  GROUP BY ?id` : `PREFIX qcy: <${y.qcy}>
7992
8203
  SELECT DISTINCT ?id
7993
8204
  WHERE {
7994
- VALUES ?filterCat { ${a} }
8205
+ VALUES ?filterCat { ${s} }
7995
8206
  ?iri a qcy:CanonicalEntity ;
7996
8207
  qcy:hasEntityCategory ?filterCat .
7997
8208
  BIND(REPLACE(STR(?iri), "^.*/", "") AS ?id)
@@ -8010,7 +8221,7 @@ WHERE {
8010
8221
  });
8011
8222
  }
8012
8223
  async buildSummaryGraph(t, e) {
8013
- const o = J.getInstance(), r = e ? e.includes("://") ? e : o.expandIRI(e) : void 0, a = r ? ` FILTER(?sourceCat = <${r}> || ?targetCat = <${r}>)` : "", i = `PREFIX qcy: <${y.qcy}>
8224
+ const o = J.getInstance(), r = e ? e.includes("://") ? e : o.expandIRI(e) : void 0, s = r ? ` FILTER(?sourceCat = <${r}> || ?targetCat = <${r}>)` : "", i = `PREFIX qcy: <${y.qcy}>
8014
8225
  SELECT
8015
8226
  ?sourceCat
8016
8227
  ?predicate
@@ -8024,12 +8235,12 @@ WHERE {
8024
8235
  ?s ?predicate ?o .
8025
8236
  FILTER(isIRI(?s) && isIRI(?o))
8026
8237
  FILTER(?predicate != qcy:relatedEntity)
8027
- ${a}
8238
+ ${s}
8028
8239
  }
8029
8240
  GROUP BY ?sourceCat ?predicate ?targetCat
8030
8241
  ORDER BY DESC(?weight)`, n = r ?? "";
8031
8242
  let p = this._summaryGraphCache.get(n);
8032
- p || (p = this._fetchSummaryData(i, a), this._summaryGraphCache.set(n, p), p.catch(() => this._summaryGraphCache.delete(n)));
8243
+ p || (p = this._fetchSummaryData(i, s), this._summaryGraphCache.set(n, p), p.catch(() => this._summaryGraphCache.delete(n)));
8033
8244
  const c = await p, h = c.results.bindings.filter(
8034
8245
  (d) => d.sourceCat && d.predicate && d.targetCat
8035
8246
  );
@@ -8119,8 +8330,8 @@ ORDER BY DESC(?weight)`;
8119
8330
  "entity-category-counts"
8120
8331
  ).then((o) => {
8121
8332
  const r = /* @__PURE__ */ new Map();
8122
- for (const a of o.results.bindings) {
8123
- const i = a.cat?.value, n = a.weight?.value;
8333
+ for (const s of o.results.bindings) {
8334
+ const i = s.cat?.value, n = s.weight?.value;
8124
8335
  i && n !== void 0 && r.set(i, parseInt(n, 10));
8125
8336
  }
8126
8337
  return r;
@@ -8136,12 +8347,12 @@ ORDER BY DESC(?weight)`;
8136
8347
  */
8137
8348
  async _fetchViewBacked(t, e, o) {
8138
8349
  if (this._graphType !== "fuseki") {
8139
- const a = await this._api.sparql(
8350
+ const s = await this._api.sparql(
8140
8351
  e,
8141
8352
  this._projectId,
8142
8353
  this._graphType
8143
8354
  );
8144
- if (a?.results?.bindings?.length) return a;
8355
+ if (s?.results?.bindings?.length) return s;
8145
8356
  console.warn(
8146
8357
  `[CueProjectEntities] Materialized view "${o}" returned no rows — falling back to the live query.`
8147
8358
  );
@@ -8153,7 +8364,7 @@ ORDER BY DESC(?weight)`;
8153
8364
  );
8154
8365
  }
8155
8366
  _computeEntityInfoMap() {
8156
- const t = this._entityDetails.get(), e = this._entityDocuments.get(), o = this._entityRelationships.get(), r = this._entityOSMMap.get(), a = this._osmWKTMap.get(), i = /* @__PURE__ */ new Set([
8367
+ const t = this._entityDetails.get(), e = this._entityDocuments.get(), o = this._entityRelationships.get(), r = this._entityOSMMap.get(), s = this._osmWKTMap.get(), i = /* @__PURE__ */ new Set([
8157
8368
  ...Object.keys(t),
8158
8369
  ...Object.keys(r).filter((p) => {
8159
8370
  const c = r[p];
@@ -8166,11 +8377,11 @@ ORDER BY DESC(?weight)`;
8166
8377
  if (h) {
8167
8378
  const m = /* @__PURE__ */ new Set();
8168
8379
  d = h.direct.filter(
8169
- (g) => a[g] !== void 0 && !m.has(g) && !!m.add(g)
8170
- ).map((g) => ({ osmIRI: g, wkt: a[g] }));
8380
+ (g) => s[g] !== void 0 && !m.has(g) && !!m.add(g)
8381
+ ).map((g) => ({ osmIRI: g, wkt: s[g] }));
8171
8382
  const w = /* @__PURE__ */ new Map();
8172
8383
  for (const { osm: g, viaRels: _, entityUUID: f } of h.indirect) {
8173
- const T = a[g];
8384
+ const T = s[g];
8174
8385
  if (T)
8175
8386
  for (const C of _) {
8176
8387
  const b = `${C}:${f}`, x = w.get(b) ?? { geometries: [], entityUUID: f };
@@ -8212,7 +8423,7 @@ GROUP BY ?rel ?related`, o = await this._api.sparql(
8212
8423
  e,
8213
8424
  this._projectId,
8214
8425
  this._graphType
8215
- ), r = [], a = { ...this._entityDetails.get() };
8426
+ ), r = [], s = { ...this._entityDetails.get() };
8216
8427
  return o.results.bindings.forEach((i) => {
8217
8428
  if (!i.rel || !i.related) return;
8218
8429
  const n = i.categories?.value?.split(";").filter(Boolean) ?? [];
@@ -8223,11 +8434,11 @@ GROUP BY ?rel ?related`, o = await this._api.sparql(
8223
8434
  nodeCategories: n
8224
8435
  });
8225
8436
  const p = i.related.value.replace(/^.*\/([^/]*)$/, "$1");
8226
- a[p] = {
8437
+ s[p] = {
8227
8438
  value: i.nodeValue?.value ?? "",
8228
8439
  categories: n
8229
8440
  };
8230
- }), this._entityDetails.set(a), r;
8441
+ }), this._entityDetails.set(s), r;
8231
8442
  }
8232
8443
  async _fetchIncomingRelationships(t) {
8233
8444
  const e = `PREFIX qcy: <${y.qcy}>
@@ -8244,7 +8455,7 @@ GROUP BY ?rel ?relating`, o = await this._api.sparql(
8244
8455
  e,
8245
8456
  this._projectId,
8246
8457
  this._graphType
8247
- ), r = [], a = { ...this._entityDetails.get() };
8458
+ ), r = [], s = { ...this._entityDetails.get() };
8248
8459
  return o.results.bindings.forEach((i) => {
8249
8460
  if (!i.rel || !i.relating) return;
8250
8461
  const n = i.categories?.value?.split(";").filter(Boolean) ?? [];
@@ -8255,11 +8466,11 @@ GROUP BY ?rel ?relating`, o = await this._api.sparql(
8255
8466
  nodeCategories: n
8256
8467
  });
8257
8468
  const p = i.relating.value.replace(/^.*\/([^/]*)$/, "$1");
8258
- a[p] = {
8469
+ s[p] = {
8259
8470
  value: i.nodeValue?.value ?? "",
8260
8471
  categories: n
8261
8472
  };
8262
- }), this._entityDetails.set(a), r;
8473
+ }), this._entityDetails.set(s), r;
8263
8474
  }
8264
8475
  async _fetchEntityGraph() {
8265
8476
  const t = `PREFIX qcy: <${y.qcy}>
@@ -8275,9 +8486,9 @@ GROUP BY ?e1Cat ?e2Cat`, e = await this._api.sparql(
8275
8486
  this._projectId,
8276
8487
  this._graphType
8277
8488
  ), o = [], r = [];
8278
- e.results.bindings.forEach((a) => {
8279
- if (!a.e1Cat || !a.e2Cat) return;
8280
- const i = a.e1Cat.value, n = a.e2Cat.value, p = a.e1Count && parseInt(a.e1Count.value, 10) || 20, c = a.e2Count && parseInt(a.e2Count.value, 10) || 20;
8489
+ e.results.bindings.forEach((s) => {
8490
+ if (!s.e1Cat || !s.e2Cat) return;
8491
+ const i = s.e1Cat.value, n = s.e2Cat.value, p = s.e1Count && parseInt(s.e1Count.value, 10) || 20, c = s.e2Count && parseInt(s.e2Count.value, 10) || 20;
8281
8492
  o.some((h) => h.iri === i) || o.push({ iri: i, size: p }), o.some((h) => h.iri === n) || o.push({ iri: n, size: c }), r.push({ sourceID: i, targetID: n });
8282
8493
  }), this._entityGraph.set({ entities: o, relations: r });
8283
8494
  }
@@ -8285,10 +8496,10 @@ GROUP BY ?e1Cat ?e2Cat`, e = await this._api.sparql(
8285
8496
  _checkPendingOSMFetches() {
8286
8497
  const t = this._entityOSMMap.get(), e = this._osmWKTMap.get(), o = [];
8287
8498
  for (const r of Object.values(t)) {
8288
- for (const a of r.direct)
8289
- !e[a] && !this._fetchingOSMIds.has(a) && o.push(a);
8290
- for (const { osm: a } of r.indirect)
8291
- !e[a] && !this._fetchingOSMIds.has(a) && o.push(a);
8499
+ for (const s of r.direct)
8500
+ !e[s] && !this._fetchingOSMIds.has(s) && o.push(s);
8501
+ for (const { osm: s } of r.indirect)
8502
+ !e[s] && !this._fetchingOSMIds.has(s) && o.push(s);
8292
8503
  }
8293
8504
  if (o.length !== 0) {
8294
8505
  for (const r of o) this._fetchingOSMIds.add(r);
@@ -8303,21 +8514,21 @@ GROUP BY ?e1Cat ?e2Cat`, e = await this._api.sparql(
8303
8514
  const o = e.map((n) => `<${n}>`).join(" "), r = `PREFIX geo: <${O.geo}>
8304
8515
  SELECT * WHERE {
8305
8516
  VALUES ?s { ${o} }
8306
- SERVICE <${ga}> {
8517
+ SERVICE <${ka}> {
8307
8518
  ?s geo:hasGeometry/geo:asWKT ?wkt
8308
8519
  }
8309
- }`, a = await this._api.sparql(
8520
+ }`, s = await this._api.sparql(
8310
8521
  r,
8311
8522
  this._projectId,
8312
8523
  this._graphType
8313
8524
  ), i = { ...this._osmWKTMap.get() };
8314
- a.results.bindings.forEach((n) => {
8525
+ s.results.bindings.forEach((n) => {
8315
8526
  !n.s || !n.wkt || (i[n.s.value] = n.wkt.value, this._fetchingOSMIds.delete(n.s.value));
8316
8527
  }), this._osmWKTMap.set(i);
8317
8528
  }
8318
8529
  }
8319
- var l = /* @__PURE__ */ ((s) => (s.AUTOMATION = "automation", s.ARCHIVE = "archive", s.AUDIO = "audio", s.BACKUP = "backup", s.BINARY = "binary", s.BIM = "bim", s.CAD = "cad", s.DATA = "data", s.EMAIL = "email", s.FONT = "font", s.GEOSPATIAL = "geospatial", s.IMAGE = "image", s.INSTALLER = "installer", s.MARKUP = "markup", s.MULTIMEDIA = "multimedia", s.PLANNING = "planning", s.PRESENTATION = "presentation", s.SCRIPT = "script", s.SPREADSHEET = "spreadsheet", s.TEXT = "text", s.THREE_D = "3d", s.UNKNOWN = "unknown", s.VIDEO = "video", s))(l || {});
8320
- const wt = {
8530
+ var l = /* @__PURE__ */ ((a) => (a.AUTOMATION = "automation", a.ARCHIVE = "archive", a.AUDIO = "audio", a.BACKUP = "backup", a.BINARY = "binary", a.BIM = "bim", a.CAD = "cad", a.DATA = "data", a.EMAIL = "email", a.FONT = "font", a.GEOSPATIAL = "geospatial", a.IMAGE = "image", a.INSTALLER = "installer", a.MARKUP = "markup", a.MULTIMEDIA = "multimedia", a.PLANNING = "planning", a.PRESENTATION = "presentation", a.SCRIPT = "script", a.SPREADSHEET = "spreadsheet", a.TEXT = "text", a.THREE_D = "3d", a.UNKNOWN = "unknown", a.VIDEO = "video", a))(l || {});
8531
+ const ft = {
8321
8532
  ".aac": {
8322
8533
  type: l.AUDIO,
8323
8534
  open: !0,
@@ -9178,7 +9389,7 @@ const wt = {
9178
9389
  }
9179
9390
  };
9180
9391
  l.AUDIO + "", l.VIDEO + "", l.IMAGE + "", l.TEXT + "", l.MARKUP + "", l.SCRIPT + "", l.DATA + "", l.ARCHIVE + "", l.INSTALLER + "", l.BINARY + "", l.BACKUP + "", l.AUTOMATION + "", l.PRESENTATION + "", l.SPREADSHEET + "", l.FONT + "", l.GEOSPATIAL + "", l.THREE_D + "", l.CAD + "", l.BIM + "", l.PLANNING + "", l.EMAIL + "", l.MULTIMEDIA + "", l.UNKNOWN + "";
9181
- const ma = `PREFIX view: <https://qlever.cs.uni-freiburg.de/materializedView/>
9392
+ const Sa = `PREFIX view: <https://qlever.cs.uni-freiburg.de/materializedView/>
9182
9393
  SELECT ?ext ?totalSize ?docCount
9183
9394
  WHERE {
9184
9395
  SERVICE view:docs-by-suffix {
@@ -9186,7 +9397,7 @@ WHERE {
9186
9397
  view:column-totalSize ?totalSize ;
9187
9398
  view:column-docCount ?docCount .
9188
9399
  }
9189
- }`, wa = `PREFIX view: <https://qlever.cs.uni-freiburg.de/materializedView/>
9400
+ }`, Ia = `PREFIX view: <https://qlever.cs.uni-freiburg.de/materializedView/>
9190
9401
  SELECT ?cat ?totalSize ?docCount
9191
9402
  WHERE {
9192
9403
  SERVICE view:docs-by-category {
@@ -9194,16 +9405,16 @@ WHERE {
9194
9405
  view:column-totalSize ?totalSize ;
9195
9406
  view:column-docCount ?docCount .
9196
9407
  }
9197
- }`, fa = `PREFIX view: <https://qlever.cs.uni-freiburg.de/materializedView/>
9408
+ }`, Ca = `PREFIX view: <https://qlever.cs.uni-freiburg.de/materializedView/>
9198
9409
  SELECT ?count
9199
9410
  WHERE {
9200
9411
  SERVICE view:doc-duplicates {
9201
9412
  _:cfg view:column-count ?count .
9202
9413
  }
9203
9414
  }`;
9204
- class ft {
9205
- constructor(t, e, o, r = vt, a, i = !1) {
9206
- this._api = t, this._projectId = e, this._graphType = a, this._verbose = i, this.baseURL = `${r}${e}/`, this._currentLang = o ?? this._api.language, this.documentInfoMap = this._documentInfoMap.asReadonly(), this.projectDocumentsData = this._projectDocumentsData.asReadonly();
9415
+ class yt {
9416
+ constructor(t, e, o, r = _t, s, i = !1) {
9417
+ this._api = t, this._projectId = e, this._graphType = s, this._verbose = i, this.baseURL = `${r}${e}/`, this._currentLang = o ?? this._api.language, this.documentInfoMap = this._documentInfoMap.asReadonly(), this.projectDocumentsData = this._projectDocumentsData.asReadonly();
9207
9418
  }
9208
9419
  _api;
9209
9420
  _projectId;
@@ -9297,12 +9508,12 @@ class ft {
9297
9508
  * ```
9298
9509
  */
9299
9510
  async fetchDocumentData(t) {
9300
- const e = this._documentInfoMap.get(), o = t.filter((a) => e[a] === void 0);
9301
- for (const a of t) this._seenIds.add(a);
9511
+ const e = this._documentInfoMap.get(), o = t.filter((s) => e[s] === void 0);
9512
+ for (const s of t) this._seenIds.add(s);
9302
9513
  o.length > 0 && await this._fetchDocumentInfoBatch(o);
9303
9514
  const r = this._documentInfoMap.get();
9304
9515
  return Object.fromEntries(
9305
- t.filter((a) => r[a] !== void 0).map((a) => [a, r[a]])
9516
+ t.filter((s) => r[s] !== void 0).map((s) => [s, r[s]])
9306
9517
  );
9307
9518
  }
9308
9519
  /**
@@ -9315,12 +9526,12 @@ class ft {
9315
9526
  * UUIDs already present in `documentInfoMap` are skipped.
9316
9527
  */
9317
9528
  async fetchDocumentDataSimple(t) {
9318
- const e = this._documentInfoMap.get(), o = t.filter((a) => e[a] === void 0);
9319
- for (const a of t) this._seenIds.add(a);
9529
+ const e = this._documentInfoMap.get(), o = t.filter((s) => e[s] === void 0);
9530
+ for (const s of t) this._seenIds.add(s);
9320
9531
  o.length > 0 && await this._fetchSimpleDocumentInfoBatch(o);
9321
9532
  const r = this._documentInfoMap.get();
9322
9533
  return Object.fromEntries(
9323
- t.filter((a) => r[a] !== void 0).map((a) => [a, r[a]])
9534
+ t.filter((s) => r[s] !== void 0).map((s) => [s, r[s]])
9324
9535
  );
9325
9536
  }
9326
9537
  /**
@@ -9349,7 +9560,7 @@ WHERE {
9349
9560
  ?contentIRI qcy:hasFileLocation ?loc .
9350
9561
  ?loc qcy:suffix ?suffix .
9351
9562
  OPTIONAL { ?loc qcy:remoteRelativePath ?rrp }
9352
- }`, o = await this._api.sparql(e, this._projectId, this._graphType), r = { ...this._documentInfoMap.get() }, a = [];
9563
+ }`, o = await this._api.sparql(e, this._projectId, this._graphType), r = { ...this._documentInfoMap.get() }, s = [];
9353
9564
  return o.results.bindings.forEach((i) => {
9354
9565
  if (!i.altId || !i.contentIRI) return;
9355
9566
  const n = i.altId.value, p = {
@@ -9362,8 +9573,8 @@ WHERE {
9362
9573
  categories: [],
9363
9574
  remoteRelativePath: i.rrp?.value
9364
9575
  };
9365
- r[n] = p, a.push(p);
9366
- }), this._documentInfoMap.set(r), a;
9576
+ r[n] = p, s.push(p);
9577
+ }), this._documentInfoMap.set(r), s;
9367
9578
  }
9368
9579
  /**
9369
9580
  * Returns a single arbitrary file path from the project's triplestore.
@@ -9383,7 +9594,7 @@ LIMIT 1`;
9383
9594
  if (t.length === 0) return [];
9384
9595
  const r = t.map(
9385
9596
  (n) => (n.startsWith(".") ? n : `.${n}`).toLowerCase()
9386
- ).map((n) => `"${n}"`).join(" "), a = e ? `PREFIX qcy: <${y.qcy}>
9597
+ ).map((n) => `"${n}"`).join(" "), s = e ? `PREFIX qcy: <${y.qcy}>
9387
9598
  SELECT ?id (SAMPLE(?fp) AS ?path) ?suffix (MAX(?sz) AS ?size)
9388
9599
  WHERE {
9389
9600
  VALUES ?suffix { ${r} }
@@ -9404,7 +9615,7 @@ WHERE {
9404
9615
  FILTER NOT EXISTS { ?x qcy:alternativeRepresentation ?iri }
9405
9616
  BIND(REPLACE(STR(?iri), "^.*/", "") AS ?id)
9406
9617
  }`;
9407
- return (await this._api.sparql(a, this._projectId, this._graphType)).results.bindings.filter((n) => n.id).map((n) => {
9618
+ return (await this._api.sparql(s, this._projectId, this._graphType)).results.bindings.filter((n) => n.id).map((n) => {
9408
9619
  const p = n.id.value, c = { iri: this._resourceIri(p), uuid: p };
9409
9620
  return e ? {
9410
9621
  ...c,
@@ -9415,7 +9626,7 @@ WHERE {
9415
9626
  });
9416
9627
  }
9417
9628
  documentsByFileType(t, e = !1) {
9418
- const o = new Set(t), r = Object.values(wt).filter((a) => o.has(a.type)).map((a) => a.suffix);
9629
+ const o = new Set(t), r = Object.values(ft).filter((s) => o.has(s.type)).map((s) => s.suffix);
9419
9630
  return this.documentsBySuffix(r, e);
9420
9631
  }
9421
9632
  async documentsByContentCategory(t, e = !1) {
@@ -9453,7 +9664,7 @@ WHERE {
9453
9664
  });
9454
9665
  }
9455
9666
  documentsByMime(t, e = !1) {
9456
- const o = new Set(t), r = Object.values(wt).filter((a) => o.has(a.mime)).map((a) => a.suffix);
9667
+ const o = new Set(t), r = Object.values(ft).filter((s) => o.has(s.mime)).map((s) => s.suffix);
9457
9668
  return this.documentsBySuffix(r, e);
9458
9669
  }
9459
9670
  // ── Private helpers ────────────────────────────────────────────────────────
@@ -9493,8 +9704,8 @@ WHERE {
9493
9704
 
9494
9705
  BIND(REPLACE(STR(?contentIRI), "^.*/", "") AS ?id)
9495
9706
  }
9496
- GROUP BY ?id ?suffix ?size ?subject ?summary`, a = await this._api.sparql(r, this._projectId), i = { ...this._documentInfoMap.get() }, n = {};
9497
- return a.results.bindings.forEach((p) => {
9707
+ GROUP BY ?id ?suffix ?size ?subject ?summary`, s = await this._api.sparql(r, this._projectId), i = { ...this._documentInfoMap.get() }, n = {};
9708
+ return s.results.bindings.forEach((p) => {
9498
9709
  if (!p.id) return;
9499
9710
  const c = p.id.value, h = {
9500
9711
  id: c,
@@ -9525,10 +9736,10 @@ WHERE {
9525
9736
  qcy:suffix ?suffix .
9526
9737
  BIND(REPLACE(STR(?contentIRI), "^.*/", "") AS ?id)
9527
9738
  }
9528
- GROUP BY ?id ?suffix ?size`, r = await this._api.sparql(o, this._projectId, this._graphType), a = { ...this._documentInfoMap.get() }, i = {};
9739
+ GROUP BY ?id ?suffix ?size`, r = await this._api.sparql(o, this._projectId, this._graphType), s = { ...this._documentInfoMap.get() }, i = {};
9529
9740
  return r.results.bindings.forEach((n) => {
9530
9741
  if (!n.id) return;
9531
- const p = n.id.value, c = a[p], h = {
9742
+ const p = n.id.value, c = s[p], h = {
9532
9743
  id: p,
9533
9744
  contentIRI: this._resourceIri(p),
9534
9745
  path: n.path?.value ?? c?.path ?? p,
@@ -9540,12 +9751,12 @@ GROUP BY ?id ?suffix ?size`, r = await this._api.sparql(o, this._projectId, this
9540
9751
  summary: c?.summary,
9541
9752
  providerId: c?.providerId
9542
9753
  };
9543
- a[p] = h, i[p] = h;
9544
- }), this._documentInfoMap.set(a), this._log(`fetchSimpleDocumentInfoBatch: ${Object.keys(i).length} fetched | cumulative: ${Object.keys(a).length} with metadata / ${this._seenIds.size} seen`), i;
9754
+ s[p] = h, i[p] = h;
9755
+ }), this._documentInfoMap.set(s), this._log(`fetchSimpleDocumentInfoBatch: ${Object.keys(i).length} fetched | cumulative: ${Object.keys(s).length} with metadata / ${this._seenIds.size} seen`), i;
9545
9756
  }
9546
9757
  async _fetchDocumentsBySuffix() {
9547
9758
  if (this._graphType !== "fuseki") {
9548
- const e = await this._runDocumentsBySuffixQuery(ma);
9759
+ const e = await this._runDocumentsBySuffixQuery(Sa);
9549
9760
  if (Object.keys(e).length > 0) return e;
9550
9761
  console.warn(`[CueProjectDocuments] Materialized view "docs-by-suffix" returned no rows for project ${this._projectId} — falling back to live query.`);
9551
9762
  }
@@ -9579,7 +9790,7 @@ ORDER BY DESC(?docCount)`;
9579
9790
  }
9580
9791
  async _fetchDocumentsByContentCategory() {
9581
9792
  if (this._graphType !== "fuseki") {
9582
- const e = await this._runDocumentsByContentCategoryQuery(wa);
9793
+ const e = await this._runDocumentsByContentCategoryQuery(Ia);
9583
9794
  if (Object.keys(e).length > 0) return e;
9584
9795
  console.warn(`[CueProjectDocuments] Materialized view "docs-by-category" returned no rows for project ${this._projectId} — falling back to live query.`);
9585
9796
  }
@@ -9613,7 +9824,7 @@ ORDER BY DESC(?docCount)`;
9613
9824
  }
9614
9825
  async _fetchDuplicateCount() {
9615
9826
  if (this._graphType !== "fuseki") {
9616
- const e = await this._api.sparql(fa, this._projectId, this._graphType);
9827
+ const e = await this._api.sparql(Ca, this._projectId, this._graphType);
9617
9828
  if (e.results.bindings.length > 0) {
9618
9829
  const o = e.results.bindings[0];
9619
9830
  return o?.count ? parseInt(o.count.value, 10) : 0;
@@ -9641,9 +9852,9 @@ WHERE {
9641
9852
  return o?.count ? parseInt(o.count.value, 10) : 0;
9642
9853
  }
9643
9854
  }
9644
- class ya {
9645
- constructor(t, e, { language: o, rdfBase: r = vt, graphType: a, verbose: i }) {
9646
- this._api = t, this._projectId = e, this.schema = new ua(t, e, o, a, i), this.entities = new Ne(t, e, r, a, i), this.documents = new ft(t, e, o, r, a, i), this.availableContentCategories = this.schema.availableContentCategories, this.availableEntityCategories = this.schema.availableEntityCategories, this.availableEntityRelationships = this.schema.availableEntityRelationships, this.schemaReady = this.schema.ready, this.entityInfoMap = this.entities.entityInfoMap, this.entityGraph = this.entities.entityGraph, this.documentInfoMap = this.documents.documentInfoMap, this.projectDocumentsData = this.documents.projectDocumentsData, this.searchResults = this._searchResults.asReadonly(), this.documents.fetchOverview().catch((n) => console.error("[CueProjectView] fetchOverview failed:", n));
9855
+ class xa {
9856
+ constructor(t, e, { language: o, rdfBase: r = _t, graphType: s, verbose: i }) {
9857
+ this._api = t, this._projectId = e, this.schema = new Ta(t, e, o, s, i), this.entities = new Fe(t, e, r, s, i), this.documents = new yt(t, e, o, r, s, i), this.availableContentCategories = this.schema.availableContentCategories, this.availableEntityCategories = this.schema.availableEntityCategories, this.availableEntityRelationships = this.schema.availableEntityRelationships, this.schemaReady = this.schema.ready, this.entityInfoMap = this.entities.entityInfoMap, this.entityGraph = this.entities.entityGraph, this.documentInfoMap = this.documents.documentInfoMap, this.projectDocumentsData = this.documents.projectDocumentsData, this.searchResults = this._searchResults.asReadonly(), this.documents.fetchOverview().catch((n) => console.error("[CueProjectView] fetchOverview failed:", n));
9647
9858
  }
9648
9859
  _api;
9649
9860
  _projectId;
@@ -9761,26 +9972,26 @@ class ya {
9761
9972
  this._destroyed = !0, this._searchResults.set(void 0);
9762
9973
  }
9763
9974
  }
9764
- function de(s, t) {
9975
+ function ye(a, t) {
9765
9976
  return new Promise((e) => {
9766
9977
  const o = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Map();
9767
- for (const f of s)
9978
+ for (const f of a)
9768
9979
  o.has(f.contentUUID) || o.set(f.contentUUID, []), o.get(f.contentUUID)?.push(f), r.set(f.locationUUID, f);
9769
- const a = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map();
9980
+ const s = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map();
9770
9981
  for (const f of t)
9771
- a.has(f.contentUUID) || a.set(f.contentUUID, []), a.get(f.contentUUID)?.push(f), f.locationUUID && i.set(f.locationUUID, f);
9982
+ s.has(f.contentUUID) || s.set(f.contentUUID, []), s.get(f.contentUUID)?.push(f), f.locationUUID && i.set(f.locationUUID, f);
9772
9983
  const n = [], p = [];
9773
- for (const f of s)
9774
- a.has(f.contentUUID) ? (a.get(f.contentUUID) || []).some((b) => b.locationUUID === f.locationUUID) || p.push(f) : n.push(f);
9984
+ for (const f of a)
9985
+ s.has(f.contentUUID) ? (s.get(f.contentUUID) || []).some((b) => b.locationUUID === f.locationUUID) || p.push(f) : n.push(f);
9775
9986
  const c = [], h = [];
9776
9987
  for (const f of t) {
9777
9988
  const T = o.get(f.contentUUID);
9778
9989
  T ? T.some((b) => b.locationUUID === f.locationUUID) || h.push(f) : c.push(f);
9779
9990
  }
9780
- const d = s.length - n.length - p.length, u = s.length, m = u > 0 ? d / u : 1;
9991
+ const d = a.length - n.length - p.length, u = a.length, m = u > 0 ? d / u : 1;
9781
9992
  let w = 0, g = 0;
9782
- for (const f of s)
9783
- g += f.size || 0, (a.get(f.contentUUID) || []).some((b) => b.locationUUID === f.locationUUID) && (w += f.size || 0);
9993
+ for (const f of a)
9994
+ g += f.size || 0, (s.get(f.contentUUID) || []).some((b) => b.locationUUID === f.locationUUID) && (w += f.size || 0);
9784
9995
  const _ = g > 0 ? w / g : 1;
9785
9996
  e({
9786
9997
  localNotOnRemote: n,
@@ -9796,7 +10007,7 @@ function de(s, t) {
9796
10007
  });
9797
10008
  });
9798
10009
  }
9799
- const ue = {
10010
+ const be = {
9800
10011
  ä: "ae",
9801
10012
  ä: "ae",
9802
10013
  Ä: "AE",
@@ -9830,37 +10041,37 @@ const ue = {
9830
10041
  þ: "th",
9831
10042
  Þ: "Th"
9832
10043
  };
9833
- function je(s, t = !1) {
10044
+ function ze(a, t = !1) {
9834
10045
  const e = "daca0510-72b5-48ba-9091-b918ca18136b";
9835
- return s = ba(s, t), bo(s, e);
9836
- }
9837
- function ba(s, t = !1) {
9838
- let e = s;
9839
- for (const o in ue)
9840
- e = e.replace(new RegExp(o, "g"), ue[o]);
9841
- return t && e !== s && console.info(`${s} -> ${e}`), e;
9842
- }
9843
- function va(s, t = "") {
9844
- return je(`${t}${s}`);
9845
- }
9846
- const { namedNode: _a, literal: Fa } = M;
9847
- _a("http://www.w3.org/1999/02/22-rdf-syntax-ns#type");
9848
- const { namedNode: Ba } = M, { namedNode: Ea, literal: Ga } = M;
9849
- Ea("http://www.w3.org/1999/02/22-rdf-syntax-ns#type");
9850
- function Ta(s) {
9851
- const t = s.split(".");
10046
+ return a = Ra(a, t), So(a, e);
10047
+ }
10048
+ function Ra(a, t = !1) {
10049
+ let e = a;
10050
+ for (const o in be)
10051
+ e = e.replace(new RegExp(o, "g"), be[o]);
10052
+ return t && e !== a && console.info(`${a} -> ${e}`), e;
10053
+ }
10054
+ function Aa(a, t = "") {
10055
+ return ze(`${t}${a}`);
10056
+ }
10057
+ const { namedNode: Oa, literal: Ja } = q;
10058
+ Oa("http://www.w3.org/1999/02/22-rdf-syntax-ns#type");
10059
+ const { namedNode: Za } = q, { namedNode: Da, literal: ti } = q;
10060
+ Da("http://www.w3.org/1999/02/22-rdf-syntax-ns#type");
10061
+ function $a(a) {
10062
+ const t = a.split(".");
9852
10063
  return t.length > 1 ? "." + t.pop()?.toLowerCase() : "";
9853
10064
  }
9854
- const { namedNode: ka, literal: Ha } = M;
9855
- ka("http://www.w3.org/1999/02/22-rdf-syntax-ns#type");
9856
- const { namedNode: Sa, literal: Wa } = M;
9857
- Sa("http://www.w3.org/1999/02/22-rdf-syntax-ns#type");
9858
- function ge(s, t, e, o, r, a, i, n = !1, p = !1) {
9859
- const c = Ta(s), h = je(o), d = `${t}/${h}${c}`;
9860
- i === void 0 && (i = wt[c]?.mime ?? "application/octet-stream");
9861
- const u = va(s, r);
10065
+ const { namedNode: Pa, literal: ei } = q;
10066
+ Pa("http://www.w3.org/1999/02/22-rdf-syntax-ns#type");
10067
+ const { namedNode: Na, literal: oi } = q;
10068
+ Na("http://www.w3.org/1999/02/22-rdf-syntax-ns#type");
10069
+ function ve(a, t, e, o, r, s, i, n = !1, p = !1) {
10070
+ const c = $a(a), h = ze(o), d = `${t}/${h}${c}`;
10071
+ i === void 0 && (i = ft[c]?.mime ?? "application/octet-stream");
10072
+ const u = Aa(a, r);
9862
10073
  return {
9863
- name: s,
10074
+ name: a,
9864
10075
  blob_name: d,
9865
10076
  uploaded_by: e,
9866
10077
  suffix: c,
@@ -9878,48 +10089,48 @@ function ge(s, t, e, o, r, a, i, n = !1, p = !1) {
9878
10089
  })
9879
10090
  };
9880
10091
  }
9881
- async function q() {
10092
+ async function F() {
9882
10093
  return import(
9883
10094
  /* webpackIgnore: true */
9884
10095
  "fs/promises"
9885
10096
  );
9886
10097
  }
9887
- async function me(s) {
10098
+ async function _e(a) {
9888
10099
  if (typeof window < "u")
9889
10100
  throw new Error(
9890
- `Cannot read file from path "${s}" in a browser environment. Provide file.data (Uint8Array) instead.`
10101
+ `Cannot read file from path "${a}" in a browser environment. Provide file.data (Uint8Array) instead.`
9891
10102
  );
9892
- const { readFile: t } = await q();
9893
- return t(s);
10103
+ const { readFile: t } = await F();
10104
+ return t(a);
9894
10105
  }
9895
- let U = null, X = null, Q = null;
9896
- function Va(s) {
9897
- Q = s, X = null, U = null;
10106
+ let M = null, X = null, K = null;
10107
+ function ri(a) {
10108
+ K = a, X = null, M = null;
9898
10109
  }
9899
- async function Ia() {
10110
+ async function ja() {
9900
10111
  if (typeof window < "u") {
9901
- if (!Q)
10112
+ if (!K)
9902
10113
  throw new Error(
9903
10114
  "WASM scanner is not configured for browser use. Call configureScanWasm(baseUrl) during app initialisation."
9904
10115
  );
9905
- const s = await fetch(`${Q}/dir_scanner_wasm_bg.wasm`);
9906
- if (!s.ok)
9907
- throw new Error(`Failed to fetch WASM binary: ${s.status} ${s.statusText}`);
9908
- const t = new Uint8Array(await s.arrayBuffer()), o = await import(`${Q}/dir_scanner_wasm.mjs`);
9909
- await o.default({ module_or_path: t }), U = o.scan;
10116
+ const a = await fetch(`${K}/dir_scanner_wasm_bg.wasm`);
10117
+ if (!a.ok)
10118
+ throw new Error(`Failed to fetch WASM binary: ${a.status} ${a.statusText}`);
10119
+ const t = new Uint8Array(await a.arrayBuffer()), o = await import(`${K}/dir_scanner_wasm.mjs`);
10120
+ await o.default({ module_or_path: t }), M = o.scan;
9910
10121
  } else {
9911
- const { readFile: s } = await q(), { join: t } = await import(
10122
+ const { readFile: a } = await F(), { join: t } = await import(
9912
10123
  /* webpackIgnore: true */
9913
10124
  "path"
9914
10125
  ), { pathToFileURL: e } = await import(
9915
10126
  /* webpackIgnore: true */
9916
10127
  "url"
9917
- ), o = t(__dirname, "assets", "wasm"), r = await s(t(o, "dir_scanner_wasm_bg.wasm")), i = await import(e(t(o, "dir_scanner_wasm.mjs")).href);
9918
- await i.default({ module_or_path: r }), U = i.scan;
10128
+ ), o = t(__dirname, "assets", "wasm"), r = await a(t(o, "dir_scanner_wasm_bg.wasm")), i = await import(e(t(o, "dir_scanner_wasm.mjs")).href);
10129
+ await i.default({ module_or_path: r }), M = i.scan;
9919
10130
  }
9920
10131
  }
9921
- const Ca = "qlever", W = 1e3, _t = "cue:pending:";
9922
- async function Et(s) {
10132
+ const La = "qlever", W = 1e3, St = "cue:pending:";
10133
+ async function It(a) {
9923
10134
  const { tmpdir: t } = await import(
9924
10135
  /* webpackIgnore: true */
9925
10136
  "os"
@@ -9927,39 +10138,39 @@ async function Et(s) {
9927
10138
  /* webpackIgnore: true */
9928
10139
  "path"
9929
10140
  );
9930
- return e(t(), `cue-sync-pending-${s}.json`);
10141
+ return e(t(), `cue-sync-pending-${a}.json`);
9931
10142
  }
9932
- async function we(s) {
10143
+ async function Ee(a) {
9933
10144
  if (typeof window < "u") {
9934
- const t = window.localStorage.getItem(`${_t}${s}`);
10145
+ const t = window.localStorage.getItem(`${St}${a}`);
9935
10146
  return t ? JSON.parse(t) : null;
9936
10147
  }
9937
10148
  try {
9938
- const t = await (await q()).readFile(await Et(s), "utf-8");
10149
+ const t = await (await F()).readFile(await It(a), "utf-8");
9939
10150
  return JSON.parse(t);
9940
10151
  } catch {
9941
10152
  return null;
9942
10153
  }
9943
10154
  }
9944
- async function fe(s) {
9945
- const t = JSON.stringify(s);
10155
+ async function Te(a) {
10156
+ const t = JSON.stringify(a);
9946
10157
  if (typeof window < "u") {
9947
- window.localStorage.setItem(`${_t}${s.spaceId}`, t);
10158
+ window.localStorage.setItem(`${St}${a.spaceId}`, t);
9948
10159
  return;
9949
10160
  }
9950
- await (await q()).writeFile(await Et(s.spaceId), t, "utf-8");
10161
+ await (await F()).writeFile(await It(a.spaceId), t, "utf-8");
9951
10162
  }
9952
- async function xa(s) {
10163
+ async function Ua(a) {
9953
10164
  if (typeof window < "u") {
9954
- window.localStorage.removeItem(`${_t}${s}`);
10165
+ window.localStorage.removeItem(`${St}${a}`);
9955
10166
  return;
9956
10167
  }
9957
10168
  try {
9958
- await (await q()).unlink(await Et(s));
10169
+ await (await F()).unlink(await It(a));
9959
10170
  } catch {
9960
10171
  }
9961
10172
  }
9962
- class ye {
10173
+ class ke {
9963
10174
  constructor(t, e, o, r) {
9964
10175
  this._auth = t, this._projects = e, this._blob = o, this._gatewayUrl = r;
9965
10176
  }
@@ -10037,13 +10248,13 @@ class ye {
10037
10248
  */
10038
10249
  async flushPendingMetadata(t, e, o) {
10039
10250
  this._legacy = o ?? !1;
10040
- const r = await we(t);
10251
+ const r = await Ee(t);
10041
10252
  if (!(!r || r.items.length === 0)) {
10042
10253
  console.info(`Trying to upload metadata (${r.items.length} item(s))...`), e && console.info(`Flushing ${r.items.length} pending file location(s) from previous sync ⏳`);
10043
10254
  try {
10044
10255
  this._pendingSpaceId = t, this._pendingItems = [], await this._flushBatch(r.items, t, e), console.info("Metadata uploaded ✅");
10045
- } catch (a) {
10046
- throw new Error(`METADATA_SYNC_FAILED: ${a instanceof Error ? a.message : String(a)}`);
10256
+ } catch (s) {
10257
+ throw new Error(`METADATA_SYNC_FAILED: ${s instanceof Error ? s.message : String(s)}`);
10047
10258
  }
10048
10259
  }
10049
10260
  }
@@ -10053,19 +10264,19 @@ class ye {
10053
10264
  * to show the user an accurate cost estimate.
10054
10265
  */
10055
10266
  async previewSync(t, e) {
10056
- const { spaceId: o, providerId: r, verbose: a } = e, i = await this._auth.getToken();
10267
+ const { spaceId: o, providerId: r, verbose: s } = e, i = await this._auth.getToken();
10057
10268
  if (!i) throw new Error("Not authenticated. Call cue.auth.signIn() first.");
10058
10269
  const n = await this._getOrCreateGraph(o, i), p = await this._projects.getProject(o), c = p?.projectSettings?.tier ?? "l", [h, d, u, m] = await Promise.all([
10059
- this._listRemoteFiles(n, o, r, a),
10270
+ this._listRemoteFiles(n, o, r, s),
10060
10271
  this._getAvailableCredits(p?.organizationID),
10061
- this._fetchUnitCreditMap(a),
10272
+ this._fetchUnitCreditMap(s),
10062
10273
  this._fetchTierNames()
10063
- ]), w = await de(t, h), g = w.localNotOnRemote ?? [], _ = g.length > 0 ? await this.scanCost(g) : [];
10274
+ ]), w = await ye(t, h), g = w.localNotOnRemote ?? [], _ = g.length > 0 ? await this.scanCost(g) : [];
10064
10275
  let f = 0, T = 0;
10065
10276
  for (const b of _) {
10066
10277
  f += b.units;
10067
10278
  const x = u[c], v = x?.[b.ext] ?? 1;
10068
- a && x && !(b.ext in x) && console.info(` Unknown format: .${b.ext} (using default rate of 1 credit/unit)`);
10279
+ s && x && !(b.ext in x) && console.info(` Unknown format: .${b.ext} (using default rate of 1 credit/unit)`);
10069
10280
  const I = b.units * v;
10070
10281
  T += I, b.credits = Math.round(I);
10071
10282
  }
@@ -10084,7 +10295,7 @@ class ye {
10084
10295
  };
10085
10296
  }
10086
10297
  async sync(t, e) {
10087
- const { spaceId: o, providerId: r, userId: a, verbose: i, onProgress: n, legacy: p } = e;
10298
+ const { spaceId: o, providerId: r, userId: s, verbose: i, onProgress: n, legacy: p } = e;
10088
10299
  this._legacy = p ?? !1;
10089
10300
  const c = await this._auth.getToken();
10090
10301
  if (!c) throw new Error("Not authenticated. Call cue.auth.signIn() first.");
@@ -10093,14 +10304,14 @@ class ye {
10093
10304
  const [u, m] = await Promise.all([
10094
10305
  this._listRemoteFiles(h, o, r, i),
10095
10306
  this._getAvailableCredits(d?.organizationID)
10096
- ]), { unitsAvailable: w } = m, g = await de(t, u);
10307
+ ]), { unitsAvailable: w } = m, g = await ye(t, u);
10097
10308
  i && (console.info(`Total local files: ${t.length}`), console.info(`Total remote files: ${u.length}`), console.info(
10098
10309
  `Total files to sync: ${(g.localNotOnRemote?.length ?? 0) + g.localNotOnRemotePathOnly.length}`
10099
10310
  ));
10100
10311
  let _ = g.syncCount, f = g.syncSize, T = 0, C = !1;
10101
10312
  const b = g.localNotOnRemote ?? [];
10102
10313
  if (b.length > 0) {
10103
- const I = (await this.scanCost(b)).reduce((D, Z) => D + Z.units, 0);
10314
+ const I = (await this.scanCost(b)).reduce((P, Z) => P + Z.units, 0);
10104
10315
  if (I > w)
10105
10316
  throw new Error(
10106
10317
  `Insufficient units: ${I} units required but only ${w} available.`
@@ -10109,18 +10320,18 @@ class ye {
10109
10320
  await this._initPendingBatch(o, i), i && b.length && console.info("Syncing missing files ⏳");
10110
10321
  for (const v of b)
10111
10322
  try {
10112
- const I = ge(
10323
+ const I = ve(
10113
10324
  v.relativePath,
10114
10325
  o,
10115
- a,
10326
+ s,
10116
10327
  v.md5,
10117
10328
  r
10118
10329
  );
10119
10330
  if (!I.blob_name) throw new Error(`blob_name missing for ${v.relativePath}`);
10120
- const D = v.data ?? new Uint8Array(await me(v.fullPath));
10331
+ const P = v.data ?? new Uint8Array(await _e(v.fullPath));
10121
10332
  await this._blob.uploadRaw(
10122
10333
  I.blob_name,
10123
- D,
10334
+ P,
10124
10335
  I
10125
10336
  ), await this._queueFileLocation({
10126
10337
  relativePath: v.relativePath,
@@ -10156,8 +10367,8 @@ class ye {
10156
10367
  async _getOrCreateGraph(t, e) {
10157
10368
  const o = this._graphMap.get(t);
10158
10369
  if (o) return o;
10159
- const a = (await this._projects.getProject(t))?.projectSettings?.graph?.type ?? Ca, i = a === "qlever" ? `${this._gatewayUrl}${Ie}` : `${this._gatewayUrl}${Se}`, n = a === "qlever" ? `${this._gatewayUrl}${Nr}` : `${this._gatewayUrl}${Dr}`, p = new Io({
10160
- graphType: a,
10370
+ const s = (await this._projects.getProject(t))?.projectSettings?.graph?.type ?? La, i = s === "qlever" ? `${this._gatewayUrl}${De}` : `${this._gatewayUrl}${Oe}`, n = s === "qlever" ? `${this._gatewayUrl}${Fr}` : `${this._gatewayUrl}${Mr}`, p = new Do({
10371
+ graphType: s,
10161
10372
  queryEndpoint: i,
10162
10373
  updateEndpoint: n,
10163
10374
  originalHeaders: {
@@ -10169,14 +10380,14 @@ class ye {
10169
10380
  }
10170
10381
  async _listRemoteFiles(t, e, o, r) {
10171
10382
  r && console.info(`Listing files in raw space: ${e}`);
10172
- const a = Promise.race([
10383
+ const s = Promise.race([
10173
10384
  this._getGraphFiles(t, o),
10174
10385
  new Promise(
10175
10386
  (c, h) => setTimeout(() => h(new Error("GRAPH_TIMEOUT: Knowledge graph query timed out")), 15e3)
10176
10387
  )
10177
10388
  ]), [i, n] = await Promise.all([
10178
10389
  this._blob.listRaw(e),
10179
- a
10390
+ s
10180
10391
  ]);
10181
10392
  r && console.info(`Found ${i.length} files in raw store for space: ${e}`);
10182
10393
  const p = [];
@@ -10212,28 +10423,28 @@ WHERE {
10212
10423
  } catch (i) {
10213
10424
  throw (i instanceof Error ? i.message : String(i)).includes("HTTP 500") ? new Error("GRAPH_UNAVAILABLE: The knowledge graph for this project has no database configured. Contact your administrator or check the project setup.") : i;
10214
10425
  }
10215
- const a = {};
10216
- if (typeof r == "string") return a;
10426
+ const s = {};
10427
+ if (typeof r == "string") return s;
10217
10428
  for (const i of r.results.bindings) {
10218
10429
  const n = i.loc.value.split("/").at(-1) ?? "", p = i.fc.value.split("/").at(-1) ?? "", c = i.created.value, h = i.size.value;
10219
- a[p] || (a[p] = []), a[p].push({ locationUUID: n, created: c, size: h });
10430
+ s[p] || (s[p] = []), s[p].push({ locationUUID: n, created: c, size: h });
10220
10431
  }
10221
- return a;
10432
+ return s;
10222
10433
  }
10223
10434
  async _initPendingBatch(t, e) {
10224
10435
  this._flushTimer !== null && (clearInterval(this._flushTimer), this._flushTimer = null), this._pendingSpaceId = t, this._pendingItems = [];
10225
- const o = await we(t);
10436
+ const o = await Ee(t);
10226
10437
  if (o && o.items.length > 0) {
10227
10438
  console.info(`Trying to upload metadata from interrupted sync (${o.items.length} item(s))...`), e && console.info(`Flushing ${o.items.length} pending file location(s) from previous sync ⏳`);
10228
10439
  try {
10229
10440
  await this._flushBatch(o.items, t, e), console.info("Metadata uploaded ✅");
10230
- } catch (a) {
10231
- throw new Error(`METADATA_SYNC_FAILED: ${a instanceof Error ? a.message : String(a)}`);
10441
+ } catch (s) {
10442
+ throw new Error(`METADATA_SYNC_FAILED: ${s instanceof Error ? s.message : String(s)}`);
10232
10443
  }
10233
10444
  }
10234
10445
  const r = setInterval(() => {
10235
- this._drainPending(e).catch((a) => {
10236
- const i = a instanceof Error ? a.message : String(a);
10446
+ this._drainPending(e).catch((s) => {
10447
+ const i = s instanceof Error ? s.message : String(s);
10237
10448
  console.warn(
10238
10449
  `⚠️ Metadata flush failed (will retry on next tick): ${i}
10239
10450
  Pending items are saved locally and will be re-sent automatically.`
@@ -10243,7 +10454,7 @@ WHERE {
10243
10454
  typeof r == "object" && typeof r.unref == "function" && r.unref(), this._flushTimer = r;
10244
10455
  }
10245
10456
  async _queueFileLocation(t) {
10246
- this._pendingItems.push(t), this._pendingSpaceId && await fe({ spaceId: this._pendingSpaceId, items: this._pendingItems });
10457
+ this._pendingItems.push(t), this._pendingSpaceId && await Te({ spaceId: this._pendingSpaceId, items: this._pendingItems });
10247
10458
  }
10248
10459
  /**
10249
10460
  * Flush all queued file-location items to the commands API in a single batch.
@@ -10268,18 +10479,18 @@ WHERE {
10268
10479
  }
10269
10480
  async _flushBatch(t, e, o) {
10270
10481
  const r = [...t];
10271
- this._pendingSpaceId === e && (this._pendingItems = []), await xa(e);
10482
+ this._pendingSpaceId === e && (this._pendingItems = []), await Ua(e);
10272
10483
  try {
10273
- for (let a = 0; a < r.length; a += W)
10274
- await this._postFssBatch(r.slice(a, a + W), e);
10484
+ for (let s = 0; s < r.length; s += W)
10485
+ await this._postFssBatch(r.slice(s, s + W), e);
10275
10486
  o && console.info(`Wrote ${r.length} file location(s) to commands API ✅`);
10276
- } catch (a) {
10487
+ } catch (s) {
10277
10488
  const i = [...r, ...this._pendingItems];
10278
- throw this._pendingItems = i, await fe({ spaceId: e, items: i }), a;
10489
+ throw this._pendingItems = i, await Te({ spaceId: e, items: i }), s;
10279
10490
  }
10280
10491
  }
10281
10492
  async _postFssBatch(t, e) {
10282
- const o = this._legacy ? `${this._gatewayUrl}${qt}?blob=true` : `${this._gatewayUrl}${qt}`;
10493
+ const o = this._legacy ? `${this._gatewayUrl}${Gt}?blob=true` : `${this._gatewayUrl}${Gt}`;
10283
10494
  let r;
10284
10495
  try {
10285
10496
  r = await this._auth.authenticatedFetch(o, {
@@ -10290,12 +10501,12 @@ WHERE {
10290
10501
  },
10291
10502
  body: JSON.stringify({ items: t })
10292
10503
  });
10293
- } catch (a) {
10294
- throw new Error(`File structure batch POST failed: ${a instanceof Error ? a.message : String(a)}`);
10504
+ } catch (s) {
10505
+ throw new Error(`File structure batch POST failed: ${s instanceof Error ? s.message : String(s)}`);
10295
10506
  }
10296
10507
  if (!r.ok) {
10297
- const a = await r.text().catch(() => "");
10298
- throw new Error(`File structure batch POST failed: ${r.status} ${r.statusText}${a ? ` — ${a}` : ""}`);
10508
+ const s = await r.text().catch(() => "");
10509
+ throw new Error(`File structure batch POST failed: ${r.status} ${r.statusText}${s ? ` — ${s}` : ""}`);
10299
10510
  }
10300
10511
  }
10301
10512
  _stopFlushTimer() {
@@ -10309,16 +10520,16 @@ WHERE {
10309
10520
  * shown to the user before or after calling {@link sync}.
10310
10521
  */
10311
10522
  async scanCost(t) {
10312
- if (X || (X = Ia()), await X, !U) throw new Error("WASM scan function not initialised");
10523
+ if (X || (X = ja()), await X, !M) throw new Error("WASM scan function not initialised");
10313
10524
  const e = 200, o = /* @__PURE__ */ new Map();
10314
10525
  for (let r = 0; r < t.length; r += e) {
10315
- const a = t.slice(r, r + e), i = await Promise.all(
10316
- a.map(async (p) => ({
10526
+ const s = t.slice(r, r + e), i = await Promise.all(
10527
+ s.map(async (p) => ({
10317
10528
  originalPath: p.relativePath,
10318
10529
  // Use pre-loaded data if available (browser), otherwise read from disk (Node.js).
10319
- data: p.data ?? new Uint8Array(await me(p.fullPath))
10530
+ data: p.data ?? new Uint8Array(await _e(p.fullPath))
10320
10531
  }))
10321
- ), n = U(i);
10532
+ ), n = M(i);
10322
10533
  for (const p of n) {
10323
10534
  const c = o.get(p.ext);
10324
10535
  c ? (c.count += p.count, c.units += p.units, c.sizeMb += p.sizeMb) : o.set(p.ext, { ...p });
@@ -10340,10 +10551,10 @@ WHERE {
10340
10551
  async computeCredits(t, e) {
10341
10552
  const o = await this._projects.getProject(e), r = o?.projectSettings?.tier ?? "l";
10342
10553
  console.info(`Computing credit cost for ${t.length} file(s) using tier "${r}"...`);
10343
- const a = this._getAvailableCredits(o?.organizationID).then((u) => (console.info("[computeCredits] getOrgCredits resolved:", u), u)).catch((u) => (console.warn("[computeCredits] getOrgCredits failed, defaulting to 0:", u?.message ?? u), { creditsAvailable: 0, unitsAvailable: 0 })), i = this._fetchUnitCreditMap().then((u) => (console.info("[computeCredits] creditMap resolved, keys:", Object.keys(u)), u)).catch((u) => (console.warn("[computeCredits] fetchUnitCreditMap failed, using default rates:", u?.message ?? u), {})), n = t.length > 0 ? (console.info(`[computeCredits] starting WASM scan of ${t.length} file(s)...`), this.scanCost(t).then((u) => (console.info(`[computeCredits] WASM scan done: ${u.length} ext(s)`), u))) : Promise.resolve([]), [p, c, h] = await Promise.all([
10554
+ const s = this._getAvailableCredits(o?.organizationID).then((u) => (console.info("[computeCredits] getOrgCredits resolved:", u), u)).catch((u) => (console.warn("[computeCredits] getOrgCredits failed, defaulting to 0:", u?.message ?? u), { creditsAvailable: 0, unitsAvailable: 0 })), i = this._fetchUnitCreditMap().then((u) => (console.info("[computeCredits] creditMap resolved, keys:", Object.keys(u)), u)).catch((u) => (console.warn("[computeCredits] fetchUnitCreditMap failed, using default rates:", u?.message ?? u), {})), n = t.length > 0 ? (console.info(`[computeCredits] starting WASM scan of ${t.length} file(s)...`), this.scanCost(t).then((u) => (console.info(`[computeCredits] WASM scan done: ${u.length} ext(s)`), u))) : Promise.resolve([]), [p, c, h] = await Promise.all([
10344
10555
  n,
10345
10556
  i,
10346
- a
10557
+ s
10347
10558
  ]);
10348
10559
  console.info(`[computeCredits] all resolved — ${p.length} ext(s), creditsAvailable: ${h.creditsAvailable}`);
10349
10560
  let d = 0;
@@ -10373,10 +10584,10 @@ WHERE {
10373
10584
  * optional `AbortSignal` for cancellation and `onProgress` for tracking.
10374
10585
  */
10375
10586
  async syncBrowserFile(t, e) {
10376
- const { spaceId: o, providerId: r, userId: a, signal: i, onProgress: n } = e;
10587
+ const { spaceId: o, providerId: r, userId: s, signal: i, onProgress: n } = e;
10377
10588
  if (!t.data)
10378
10589
  throw new Error("syncBrowserFile requires file.data (Uint8Array). Read the file with File.arrayBuffer() first.");
10379
- const p = ge(t.relativePath, o, a, t.md5, r);
10590
+ const p = ve(t.relativePath, o, s, t.md5, r);
10380
10591
  if (!p.blob_name) throw new Error(`blob_name missing for ${t.relativePath}`);
10381
10592
  await this._blob.uploadRaw(
10382
10593
  p.blob_name,
@@ -10423,13 +10634,13 @@ WHERE {
10423
10634
  throw new Error(`Credits table is not valid JSON (${e.length} bytes)`);
10424
10635
  }
10425
10636
  }
10426
- _logProgress(t, e, o, r, a) {
10427
- if (!a || e === 0) return;
10637
+ _logProgress(t, e, o, r, s) {
10638
+ if (!s || e === 0) return;
10428
10639
  const i = Math.floor(t / e * 100);
10429
- a({ percent: i, syncCount: t, totalCount: e, syncSize: o, totalSize: r });
10640
+ s({ percent: i, syncCount: t, totalCount: e, syncSize: o, totalSize: r });
10430
10641
  }
10431
10642
  }
10432
- const be = {
10643
+ const Se = {
10433
10644
  production: {
10434
10645
  gatewayUrl: "https://accessors-api-gateway-ueyeemwf2a-oa.a.run.app",
10435
10646
  tokenUrl: "https://accessors-api-gateway-ueyeemwf2a-oa.a.run.app/token",
@@ -10449,7 +10660,7 @@ const be = {
10449
10660
  firestoreEmulatorPort: 8080
10450
10661
  }
10451
10662
  };
10452
- class Le {
10663
+ class Be {
10453
10664
  auth;
10454
10665
  signup;
10455
10666
  api;
@@ -10461,7 +10672,7 @@ class Le {
10461
10672
  privileges;
10462
10673
  cache;
10463
10674
  storage;
10464
- currency = new pe();
10675
+ currency = new ge();
10465
10676
  _app;
10466
10677
  _endpoints;
10467
10678
  _isEmulator;
@@ -10482,7 +10693,7 @@ class Le {
10482
10693
  * ```
10483
10694
  */
10484
10695
  get gis() {
10485
- return this._gis || (this._gis = new sa(
10696
+ return this._gis || (this._gis = new ga(
10486
10697
  () => this.api.getAuthHeaders(),
10487
10698
  this._endpoints.gatewayUrl
10488
10699
  )), this._gis;
@@ -10491,18 +10702,18 @@ class Le {
10491
10702
  !t.apiKey && !t.appId && !t.measurementId && console.warn(
10492
10703
  "Using default SDK app settings. Contact QAECY for your own configuration for any production code."
10493
10704
  );
10494
- const o = t.apiKey ?? ot.apiKey, r = t.appId ?? ot.appId, a = t.measurementId ?? ot.measurementId, i = t.environment ?? "production";
10495
- this._endpoints = { ...be[i], ...t.endpoints }, this._isEmulator = i === "emulator", this._verbose = t.verbose ?? !1, this._app = Me().find((m) => m.name === "[DEFAULT]") ?? qe({
10705
+ const o = t.apiKey ?? ot.apiKey, r = t.appId ?? ot.appId, s = t.measurementId ?? ot.measurementId, i = t.environment ?? "production";
10706
+ this._endpoints = { ...Se[i], ...t.endpoints }, this._isEmulator = i === "emulator", this._verbose = t.verbose ?? !1, this._app = He().find((m) => m.name === "[DEFAULT]") ?? We({
10496
10707
  apiKey: o,
10497
10708
  appId: r,
10498
- measurementId: a,
10499
- authDomain: `${Ct}.firebaseapp.com`,
10500
- projectId: Ct,
10501
- messagingSenderId: Co
10502
- }), this.auth = new Bt(this._app, this._isEmulator, this._endpoints), this.signup = new Gt(this._endpoints.gatewayUrl), this.projects = new te(this.auth, this._app, this._isEmulator, this._endpoints), this._storageRaw = S(this._app, At), this._storageProcessed = S(this._app, Ot);
10503
- const n = S(this._app, Dt), p = S(this._app, Pt), c = S(this._app, Rt), h = S(this._app, $t), d = S(this._app, xt);
10504
- this._isEmulator && (B(this._storageRaw, this._endpoints.storageEmulatorHost, this._endpoints.storageEmulatorPort), B(this._storageProcessed, this._endpoints.storageEmulatorHost, this._endpoints.storageEmulatorPort), B(n, this._endpoints.storageEmulatorHost, this._endpoints.storageEmulatorPort));
10505
- const u = new It({
10709
+ measurementId: s,
10710
+ authDomain: `${Ot}.firebaseapp.com`,
10711
+ projectId: Ot,
10712
+ messagingSenderId: $o
10713
+ }), this.auth = new Vt(this._app, this._isEmulator, this._endpoints), this.signup = new Xt(this._endpoints.gatewayUrl), this.projects = new ie(this.auth, this._app, this._isEmulator, this._endpoints), this._storageRaw = S(this._app, Pt), this._storageProcessed = S(this._app, Nt);
10714
+ const n = S(this._app, Lt), p = S(this._app, jt), c = S(this._app, $t), h = S(this._app, Ut), d = S(this._app, Dt);
10715
+ this._isEmulator && (G(this._storageRaw, this._endpoints.storageEmulatorHost, this._endpoints.storageEmulatorPort), G(this._storageProcessed, this._endpoints.storageEmulatorHost, this._endpoints.storageEmulatorPort), G(n, this._endpoints.storageEmulatorHost, this._endpoints.storageEmulatorPort));
10716
+ const u = new At({
10506
10717
  storageRaw: this._storageRaw,
10507
10718
  storageProcessed: this._storageProcessed,
10508
10719
  storagePublic: n,
@@ -10511,12 +10722,12 @@ class Le {
10511
10722
  storagePersistence: h,
10512
10723
  storageSessions: d
10513
10724
  });
10514
- this.api = this._buildApi(this.projects, u), this.storage = new Ht(this.auth, this._endpoints.gatewayUrl), this.profile = new ee(
10725
+ this.api = this._buildApi(this.projects, u), this.storage = new Kt(this.auth, this._endpoints.gatewayUrl), this.profile = new ne(
10515
10726
  this.auth,
10516
10727
  this._app,
10517
10728
  this._isEmulator,
10518
10729
  this._endpoints.gatewayUrl
10519
- ), this.usageStats = new oe(this.auth, this._endpoints.gatewayUrl), this.api.sync?._bindProfile(this.profile), this.admin = new re(this.auth, this._endpoints.gatewayUrl), this.privileges = new ie(this.auth.isSuperAdmin), this._isEmulator && B(h, this._endpoints.storageEmulatorHost, this._endpoints.storageEmulatorPort), this.cache = new ne(h);
10730
+ ), this.usageStats = new pe(this.auth, this._endpoints.gatewayUrl), this.api.sync?._bindProfile(this.profile), this.admin = new ce(this.auth, this._endpoints.gatewayUrl), this.privileges = new de(this.auth.isSuperAdmin), this._isEmulator && G(h, this._endpoints.storageEmulatorHost, this._endpoints.storageEmulatorPort), this.cache = new ue(h);
10520
10731
  }
10521
10732
  /**
10522
10733
  * Create a `Cue` instance from an already-initialized Firebase app.
@@ -10535,7 +10746,7 @@ class Le {
10535
10746
  * });
10536
10747
  */
10537
10748
  static fromApp(t, e = {}) {
10538
- const o = e.environment ?? "production", r = { ...be[o], ...e.endpoints }, a = new Bt(t, !1, r), i = new Gt(r.gatewayUrl), n = new te(a, t, !1, r), p = S(t, At), c = S(t, Ot), h = S(t, Dt), d = S(t, Pt), u = S(t, Rt), m = S(t, $t), w = S(t, xt), g = new It({
10749
+ const o = e.environment ?? "production", r = { ...Se[o], ...e.endpoints }, s = new Vt(t, !1, r), i = new Xt(r.gatewayUrl), n = new ie(s, t, !1, r), p = S(t, Pt), c = S(t, Nt), h = S(t, Lt), d = S(t, jt), u = S(t, $t), m = S(t, Ut), w = S(t, Dt), g = new At({
10539
10750
  storageRaw: p,
10540
10751
  storageProcessed: c,
10541
10752
  storagePublic: h,
@@ -10543,18 +10754,18 @@ class Le {
10543
10754
  storageChatSessions: u,
10544
10755
  storagePersistence: m,
10545
10756
  storageSessions: w
10546
- }), _ = new ye(a, n, g, r.gatewayUrl), f = new Xt(a, r.gatewayUrl, n, _);
10757
+ }), _ = new ke(s, n, g, r.gatewayUrl), f = new Zt(s, r.gatewayUrl, n, _);
10547
10758
  _._bindApi(f);
10548
- const T = new ee(a, t, !1, r.gatewayUrl);
10759
+ const T = new ne(s, t, !1, r.gatewayUrl);
10549
10760
  _._bindProfile(T);
10550
- const C = new oe(a, r.gatewayUrl), b = new re(a, r.gatewayUrl), x = Object.create(Le.prototype), v = new ie(a.isSuperAdmin), I = new ne(m), D = new Ht(a, r.gatewayUrl), Z = new pe();
10761
+ const C = new pe(s, r.gatewayUrl), b = new ce(s, r.gatewayUrl), x = Object.create(Be.prototype), v = new de(s.isSuperAdmin), I = new ue(m), P = new Kt(s, r.gatewayUrl), Z = new ge();
10551
10762
  return Object.assign(x, {
10552
10763
  _app: t,
10553
10764
  _endpoints: r,
10554
10765
  _isEmulator: o === "emulator",
10555
10766
  _storageRaw: p,
10556
10767
  _storageProcessed: c,
10557
- auth: a,
10768
+ auth: s,
10558
10769
  signup: i,
10559
10770
  api: f,
10560
10771
  projects: n,
@@ -10563,12 +10774,12 @@ class Le {
10563
10774
  admin: b,
10564
10775
  privileges: v,
10565
10776
  cache: I,
10566
- storage: D,
10777
+ storage: P,
10567
10778
  currency: Z
10568
10779
  }), x;
10569
10780
  }
10570
10781
  _buildApi(t, e) {
10571
- const o = new ye(this.auth, t, e, this._endpoints.gatewayUrl), r = new Xt(this.auth, this._endpoints.gatewayUrl, t, o);
10782
+ const o = new ke(this.auth, t, e, this._endpoints.gatewayUrl), r = new Zt(this.auth, this._endpoints.gatewayUrl, t, o);
10572
10783
  return o._bindApi(r), r;
10573
10784
  }
10574
10785
  /** Convenience: get the current user's Firebase ID token */
@@ -10590,7 +10801,7 @@ class Le {
10590
10801
  * ```
10591
10802
  */
10592
10803
  createProjectView(t, e) {
10593
- return new ya(this.api, t, { verbose: this._verbose, ...e });
10804
+ return new xa(this.api, t, { verbose: this._verbose, ...e });
10594
10805
  }
10595
10806
  /**
10596
10807
  * Creates a `CueProjectEntities` instance for the given project, bound to the
@@ -10607,7 +10818,7 @@ class Le {
10607
10818
  * ```
10608
10819
  */
10609
10820
  createProjectEntities(t, e) {
10610
- return new Ne(
10821
+ return new Fe(
10611
10822
  this.api,
10612
10823
  t,
10613
10824
  e?.rdfBase,
@@ -10631,7 +10842,7 @@ class Le {
10631
10842
  const r = this._projectDocuments.get(t);
10632
10843
  if (r)
10633
10844
  return r.setLanguage(this.api.language), r;
10634
- const a = new ft(
10845
+ const s = new yt(
10635
10846
  this.api,
10636
10847
  t,
10637
10848
  this.api.language,
@@ -10639,9 +10850,9 @@ class Le {
10639
10850
  void 0,
10640
10851
  e?.verbose ?? this._verbose
10641
10852
  );
10642
- return this._projectDocuments.set(t, a), a;
10853
+ return this._projectDocuments.set(t, s), s;
10643
10854
  }
10644
- return new ft(
10855
+ return new yt(
10645
10856
  this.api,
10646
10857
  t,
10647
10858
  e?.language ?? this.api.language,
@@ -10651,8 +10862,8 @@ class Le {
10651
10862
  );
10652
10863
  }
10653
10864
  }
10654
- const lt = "https://qlever.cs.uni-freiburg.de/materializedView/", N = y.qcy;
10655
- class Xa {
10865
+ const ht = "https://qlever.cs.uni-freiburg.de/materializedView/", j = y.qcy;
10866
+ class si {
10656
10867
  constructor(t, e, o) {
10657
10868
  this._api = t, this._projectId = e, this._graphType = o;
10658
10869
  }
@@ -10676,7 +10887,7 @@ class Xa {
10676
10887
  this._api.sparql(this._buildViewDimQuery("mime", e), this._projectId, this._graphType),
10677
10888
  this._api.sparql(this._buildViewDimQuery("content", e), this._projectId, this._graphType),
10678
10889
  this._api.sparql(this._buildViewDimQuery("entity", e), this._projectId, this._graphType)
10679
- ]), h = _e(n, p, c);
10890
+ ]), h = Ce(n, p, c);
10680
10891
  if (h.mimes.length + h.contents.length + h.entityCategories.length > 0)
10681
10892
  return h;
10682
10893
  console.warn(
@@ -10684,12 +10895,12 @@ class Xa {
10684
10895
  );
10685
10896
  } catch {
10686
10897
  }
10687
- const [r, a, i] = await Promise.all([
10898
+ const [r, s, i] = await Promise.all([
10688
10899
  this._api.sparql(this._buildLiveDimQuery("mime", e), this._projectId, this._graphType),
10689
10900
  this._api.sparql(this._buildLiveDimQuery("content", e), this._projectId, this._graphType),
10690
10901
  this._api.sparql(this._buildLiveDimQuery("entity", e), this._projectId, this._graphType)
10691
10902
  ]);
10692
- return _e(r, a, i);
10903
+ return Ce(r, s, i);
10693
10904
  }
10694
10905
  /**
10695
10906
  * Lists the *specific* entities (e.g. "John Doe") of a given entity category
@@ -10701,8 +10912,8 @@ class Xa {
10701
10912
  * list shrinks as other filters are added.
10702
10913
  */
10703
10914
  async availableEntities(t, e) {
10704
- const r = ve(e ?? {}).join(`
10705
- `), a = `PREFIX qcy: <${N}>
10915
+ const r = Ie(e ?? {}).join(`
10916
+ `), s = `PREFIX qcy: <${j}>
10706
10917
  SELECT DISTINCT ?entity ?val
10707
10918
  WHERE {
10708
10919
  {
@@ -10716,10 +10927,10 @@ WHERE {
10716
10927
  ?entity qcy:hasEntityCategory <${t}> ;
10717
10928
  qcy:value ?val .
10718
10929
  }
10719
- ORDER BY ?val`, i = await this._api.sparql(a, this._projectId, this._graphType), n = /* @__PURE__ */ new Set(), p = [];
10930
+ ORDER BY ?val`, i = await this._api.sparql(s, this._projectId, this._graphType), n = /* @__PURE__ */ new Set(), p = [];
10720
10931
  for (const c of i.results.bindings) {
10721
10932
  const h = c.entity?.value;
10722
- !h || n.has(h) || (n.add(h), p.push({ iri: h, label: c.val?.value ?? Ue(h) }));
10933
+ !h || n.has(h) || (n.add(h), p.push({ iri: h, label: c.val?.value ?? Ge(h) }));
10723
10934
  }
10724
10935
  return p;
10725
10936
  }
@@ -10735,31 +10946,31 @@ ORDER BY ?val`, i = await this._api.sparql(a, this._projectId, this._graphType),
10735
10946
  if (t.length === 0) return [];
10736
10947
  if (this._graphType !== "fuseki")
10737
10948
  try {
10738
- const a = this._buildViewFilterQuery(t), n = (await this._api.sparql(a, this._projectId, this._graphType)).results.bindings.map((p) => p.id?.value).filter(Boolean);
10949
+ const s = this._buildViewFilterQuery(t), n = (await this._api.sparql(s, this._projectId, this._graphType)).results.bindings.map((p) => p.id?.value).filter(Boolean);
10739
10950
  if (n.length > 0) return n;
10740
10951
  } catch {
10741
10952
  }
10742
10953
  const o = this._buildFilterQuery(t);
10743
- return (await this._api.sparql(o, this._projectId, this._graphType)).results.bindings.map((a) => a.id?.value).filter(Boolean);
10954
+ return (await this._api.sparql(o, this._projectId, this._graphType)).results.bindings.map((s) => s.id?.value).filter(Boolean);
10744
10955
  }
10745
10956
  // ── Private query builders ──────────────────────────────────────────────────
10746
10957
  /** Single-dimension available-filters query using the dimension-specific views. */
10747
10958
  _buildViewDimQuery(t, e) {
10748
- const o = t === "mime" ? "doc-mime-cats" : t === "content" ? "doc-content-cats" : "doc-entity-cats", r = t === "mime" ? "?mimeCat" : t === "content" ? "?contentCat" : "?entityCat", a = Ra(e);
10749
- return a.length === 0 ? `PREFIX view: <${lt}>
10959
+ const o = t === "mime" ? "doc-mime-cats" : t === "content" ? "doc-content-cats" : "doc-entity-cats", r = t === "mime" ? "?mimeCat" : t === "content" ? "?contentCat" : "?entityCat", s = Ma(e);
10960
+ return s.length === 0 ? `PREFIX view: <${ht}>
10750
10961
  SELECT DISTINCT ${r}
10751
10962
  WHERE {
10752
10963
  SERVICE view:${o} {
10753
10964
  _:cfg view:column-doc ?doc ;
10754
10965
  view:column-cat ${r} .
10755
10966
  }
10756
- }` : `PREFIX view: <${lt}>
10757
- PREFIX qcy: <${N}>
10967
+ }` : `PREFIX view: <${ht}>
10968
+ PREFIX qcy: <${j}>
10758
10969
  SELECT DISTINCT ${r}
10759
10970
  WHERE {
10760
10971
  {
10761
10972
  SELECT DISTINCT ?doc WHERE {
10762
- ${a.join(`
10973
+ ${s.join(`
10763
10974
  `)}
10764
10975
  }
10765
10976
  }
@@ -10771,9 +10982,9 @@ WHERE {
10771
10982
  }
10772
10983
  /** Single-dimension available-filters query using live triple patterns. */
10773
10984
  _buildLiveDimQuery(t, e) {
10774
- const r = ve(e).join(`
10985
+ const r = Ie(e).join(`
10775
10986
  `);
10776
- return `PREFIX qcy: <${N}>
10987
+ return `PREFIX qcy: <${j}>
10777
10988
  SELECT DISTINCT ${t === "mime" ? "?mimeCat" : t === "content" ? "?contentCat" : "?entityCat"}
10778
10989
  WHERE {
10779
10990
  {
@@ -10800,17 +11011,17 @@ WHERE {
10800
11011
  e.push(`FILTER NOT EXISTS { ?doc qcy:about <${i}> }`);
10801
11012
  continue;
10802
11013
  }
10803
- const r = o.type === "entity" ? "doc-entity-cats" : o.type === "mime" ? "doc-mime-cats" : "doc-content-cats", a = `?${o.type}IncCat`;
11014
+ const r = o.type === "entity" ? "doc-entity-cats" : o.type === "mime" ? "doc-mime-cats" : "doc-content-cats", s = `?${o.type}IncCat`;
10804
11015
  if (o.included.length > 0) {
10805
- const i = o.included.map((p) => `<${p}>`).join(", "), n = o.included.length === 1 ? `${a} = ${i}` : `${a} IN (${i})`;
10806
- e.push(`SERVICE view:${r} { _:cfgI${o.type} view:column-doc ?doc ; view:column-cat ${a} . }`), e.push(`FILTER(${n})`);
11016
+ const i = o.included.map((p) => `<${p}>`).join(", "), n = o.included.length === 1 ? `${s} = ${i}` : `${s} IN (${i})`;
11017
+ e.push(`SERVICE view:${r} { _:cfgI${o.type} view:column-doc ?doc ; view:column-cat ${s} . }`), e.push(`FILTER(${n})`);
10807
11018
  }
10808
11019
  for (const i of o.excluded)
10809
11020
  o.type === "entity" ? e.push(`FILTER NOT EXISTS { ?doc qcy:about ?excE . ?excE qcy:hasEntityCategory <${i}> }`) : o.type === "mime" ? e.push(`FILTER NOT EXISTS { ?doc qcy:hasMimeCategory <${i}> }`) : e.push(`FILTER NOT EXISTS { ?doc qcy:hasContentCategory <${i}> }`);
10810
11021
  }
10811
11022
  if (e.length === 0) throw new Error("no view filter clauses");
10812
- return `PREFIX view: <${lt}>
10813
- PREFIX qcy: <${N}>
11023
+ return `PREFIX view: <${ht}>
11024
+ PREFIX qcy: <${j}>
10814
11025
  SELECT DISTINCT ?id
10815
11026
  WHERE {
10816
11027
  ${e.join(`
@@ -10825,7 +11036,7 @@ WHERE {
10825
11036
  if (o.included.length === 1)
10826
11037
  e.push(`?doc qcy:about ?e_inc . ?e_inc qcy:hasEntityCategory <${o.included[0]}> .`);
10827
11038
  else if (o.included.length > 1) {
10828
- const r = o.included.map((a) => `<${a}>`).join(", ");
11039
+ const r = o.included.map((s) => `<${s}>`).join(", ");
10829
11040
  e.push(`?doc qcy:about ?e_inc . ?e_inc qcy:hasEntityCategory ?ec_inc . FILTER(?ec_inc IN (${r}))`);
10830
11041
  }
10831
11042
  for (const r of o.excluded)
@@ -10835,7 +11046,7 @@ WHERE {
10835
11046
  if (o.included.length === 1)
10836
11047
  e.push(`?doc qcy:about <${o.included[0]}> .`);
10837
11048
  else if (o.included.length > 1) {
10838
- const r = o.included.map((a) => `<${a}>`).join(", ");
11049
+ const r = o.included.map((s) => `<${s}>`).join(", ");
10839
11050
  e.push(`?doc qcy:about ?ei_inc . FILTER(?ei_inc IN (${r}))`);
10840
11051
  }
10841
11052
  for (const r of o.excluded)
@@ -10845,7 +11056,7 @@ WHERE {
10845
11056
  if (o.included.length === 1)
10846
11057
  e.push(`?doc qcy:hasMimeCategory <${o.included[0]}> .`);
10847
11058
  else if (o.included.length > 1) {
10848
- const r = o.included.map((a) => `<${a}>`).join(", ");
11059
+ const r = o.included.map((s) => `<${s}>`).join(", ");
10849
11060
  e.push(`?doc qcy:hasMimeCategory ?mc_inc . FILTER(?mc_inc IN (${r}))`);
10850
11061
  }
10851
11062
  for (const r of o.excluded)
@@ -10855,14 +11066,14 @@ WHERE {
10855
11066
  if (o.included.length === 1)
10856
11067
  e.push(`?doc qcy:hasContentCategory <${o.included[0]}> .`);
10857
11068
  else if (o.included.length > 1) {
10858
- const r = o.included.map((a) => `<${a}>`).join(", ");
11069
+ const r = o.included.map((s) => `<${s}>`).join(", ");
10859
11070
  e.push(`?doc qcy:hasContentCategory ?cc_inc . FILTER(?cc_inc IN (${r}))`);
10860
11071
  }
10861
11072
  for (const r of o.excluded)
10862
11073
  e.push(`FILTER NOT EXISTS { ?doc qcy:hasContentCategory <${r}> }`);
10863
11074
  }
10864
11075
  }
10865
- return `PREFIX qcy: <${N}>
11076
+ return `PREFIX qcy: <${j}>
10866
11077
  SELECT DISTINCT ?id
10867
11078
  WHERE {
10868
11079
  ?doc a qcy:FileContent .
@@ -10873,105 +11084,106 @@ WHERE {
10873
11084
  }`;
10874
11085
  }
10875
11086
  }
10876
- function Ra(s) {
11087
+ function Ma(a) {
10877
11088
  const t = [];
10878
- for (const e of s.entities ?? [])
11089
+ for (const e of a.entities ?? [])
10879
11090
  t.push(`?doc qcy:about <${e}> .`);
10880
- if (s.mimes?.length) {
10881
- const e = s.mimes.map((r) => `<${r}>`).join(", "), o = s.mimes.length === 1 ? `?aMimeCat = ${e}` : `?aMimeCat IN (${e})`;
11091
+ if (a.mimes?.length) {
11092
+ const e = a.mimes.map((r) => `<${r}>`).join(", "), o = a.mimes.length === 1 ? `?aMimeCat = ${e}` : `?aMimeCat IN (${e})`;
10882
11093
  t.push("SERVICE view:doc-mime-cats { _:cfgM view:column-doc ?doc ; view:column-cat ?aMimeCat . }"), t.push(`FILTER(${o})`);
10883
11094
  }
10884
- if (s.contents?.length) {
10885
- const e = s.contents.map((r) => `<${r}>`).join(", "), o = s.contents.length === 1 ? `?aContentCat = ${e}` : `?aContentCat IN (${e})`;
11095
+ if (a.contents?.length) {
11096
+ const e = a.contents.map((r) => `<${r}>`).join(", "), o = a.contents.length === 1 ? `?aContentCat = ${e}` : `?aContentCat IN (${e})`;
10886
11097
  t.push("SERVICE view:doc-content-cats { _:cfgC view:column-doc ?doc ; view:column-cat ?aContentCat . }"), t.push(`FILTER(${o})`);
10887
11098
  }
10888
- if (s.entityCategories?.length) {
10889
- const e = s.entityCategories.map((r) => `<${r}>`).join(", "), o = s.entityCategories.length === 1 ? `?aEntityCat = ${e}` : `?aEntityCat IN (${e})`;
11099
+ if (a.entityCategories?.length) {
11100
+ const e = a.entityCategories.map((r) => `<${r}>`).join(", "), o = a.entityCategories.length === 1 ? `?aEntityCat = ${e}` : `?aEntityCat IN (${e})`;
10890
11101
  t.push("SERVICE view:doc-entity-cats { _:cfgE view:column-doc ?doc ; view:column-cat ?aEntityCat . }"), t.push(`FILTER(${o})`);
10891
11102
  }
10892
11103
  return t;
10893
11104
  }
10894
- function ve(s) {
11105
+ function Ie(a) {
10895
11106
  const t = [];
10896
- for (const e of s.entities ?? [])
11107
+ for (const e of a.entities ?? [])
10897
11108
  t.push(`?doc qcy:about <${e}> .`);
10898
- if (s.entityCategories?.length)
10899
- if (s.entityCategories.length === 1)
10900
- t.push(`?doc qcy:about ?e_a . ?e_a qcy:hasEntityCategory <${s.entityCategories[0]}> .`);
11109
+ if (a.entityCategories?.length)
11110
+ if (a.entityCategories.length === 1)
11111
+ t.push(`?doc qcy:about ?e_a . ?e_a qcy:hasEntityCategory <${a.entityCategories[0]}> .`);
10901
11112
  else {
10902
- const e = s.entityCategories.map((o) => `<${o}>`).join(", ");
11113
+ const e = a.entityCategories.map((o) => `<${o}>`).join(", ");
10903
11114
  t.push(`?doc qcy:about ?e_a . ?e_a qcy:hasEntityCategory ?ec_a . FILTER(?ec_a IN (${e}))`);
10904
11115
  }
10905
- if (s.mimes?.length)
10906
- if (s.mimes.length === 1)
10907
- t.push(`?doc qcy:hasMimeCategory <${s.mimes[0]}> .`);
11116
+ if (a.mimes?.length)
11117
+ if (a.mimes.length === 1)
11118
+ t.push(`?doc qcy:hasMimeCategory <${a.mimes[0]}> .`);
10908
11119
  else {
10909
- const e = s.mimes.map((o) => `<${o}>`).join(", ");
11120
+ const e = a.mimes.map((o) => `<${o}>`).join(", ");
10910
11121
  t.push(`?doc qcy:hasMimeCategory ?mc_a . FILTER(?mc_a IN (${e}))`);
10911
11122
  }
10912
- if (s.contents?.length)
10913
- if (s.contents.length === 1)
10914
- t.push(`?doc qcy:hasContentCategory <${s.contents[0]}> .`);
11123
+ if (a.contents?.length)
11124
+ if (a.contents.length === 1)
11125
+ t.push(`?doc qcy:hasContentCategory <${a.contents[0]}> .`);
10915
11126
  else {
10916
- const e = s.contents.map((o) => `<${o}>`).join(", ");
11127
+ const e = a.contents.map((o) => `<${o}>`).join(", ");
10917
11128
  t.push(`?doc qcy:hasContentCategory ?cc_a . FILTER(?cc_a IN (${e}))`);
10918
11129
  }
10919
11130
  return t;
10920
11131
  }
10921
- function Ue(s) {
10922
- return s.split("#").pop()?.split("/").pop() ?? s;
11132
+ function Ge(a) {
11133
+ return a.split("#").pop()?.split("/").pop() ?? a;
10923
11134
  }
10924
- function _e(s, t, e) {
10925
- const o = (r, a) => {
11135
+ function Ce(a, t, e) {
11136
+ const o = (r, s) => {
10926
11137
  const i = /* @__PURE__ */ new Set(), n = [];
10927
11138
  for (const p of r) {
10928
- const c = p[a]?.value;
10929
- c && !i.has(c) && (i.add(c), n.push({ iri: c, label: Ue(c) }));
11139
+ const c = p[s]?.value;
11140
+ c && !i.has(c) && (i.add(c), n.push({ iri: c, label: Ge(c) }));
10930
11141
  }
10931
11142
  return n;
10932
11143
  };
10933
11144
  return {
10934
- mimes: o(s.results.bindings, "mimeCat"),
11145
+ mimes: o(a.results.bindings, "mimeCat"),
10935
11146
  contents: o(t.results.bindings, "contentCat"),
10936
11147
  entityCategories: o(e.results.bindings, "entityCat")
10937
11148
  };
10938
11149
  }
10939
11150
  export {
10940
- E as A,
10941
- za as B,
10942
- Le as C,
10943
- Ht as D,
10944
- ye as E,
10945
- Kr as F,
10946
- hs as G,
10947
- Va as H,
10948
- bt as I,
10949
- ae as R,
10950
- qa as S,
10951
- re as a,
10952
- Xt as b,
10953
- cs as c,
10954
- ls as d,
10955
- Bt as e,
10956
- ne as f,
10957
- Zr as g,
10958
- pe as h,
10959
- fs as i,
10960
- us as j,
10961
- Xa as k,
10962
- Jr as l,
10963
- sa as m,
10964
- ts as n,
10965
- ws as o,
10966
- is as p,
10967
- ie as q,
10968
- ds as r,
10969
- ee as s,
10970
- ft as t,
10971
- Ne as u,
10972
- ua as v,
10973
- ya as w,
10974
- te as x,
10975
- Wr as y,
10976
- Gt as z
11151
+ Xt as A,
11152
+ Ya as B,
11153
+ Be as C,
11154
+ E as D,
11155
+ Kt as E,
11156
+ ke as F,
11157
+ os as G,
11158
+ fs as H,
11159
+ ri as I,
11160
+ vt as J,
11161
+ he as R,
11162
+ Qa as S,
11163
+ ce as a,
11164
+ Zt as b,
11165
+ ms as c,
11166
+ ws as d,
11167
+ Vt as e,
11168
+ ue as f,
11169
+ as as g,
11170
+ ge as h,
11171
+ Ts as i,
11172
+ bs as j,
11173
+ si as k,
11174
+ ss as l,
11175
+ ga as m,
11176
+ ks as n,
11177
+ is as o,
11178
+ Es as p,
11179
+ ds as q,
11180
+ de as r,
11181
+ ys as s,
11182
+ ne as t,
11183
+ yt as u,
11184
+ Fe as v,
11185
+ Ta as w,
11186
+ xa as x,
11187
+ ie as y,
11188
+ Jr as z
10977
11189
  };