@qaecy/cue-sdk 0.0.18 → 0.0.25

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,11 +1,11 @@
1
- import { getApps as ge, initializeApp as ue } from "firebase/app";
2
- import { ref as _, getDownloadURL as F, getMetadata as U, getBlob as Yt, updateMetadata as me, uploadBytesResumable as wt, uploadBytes as rt, StringFormat as we, uploadString as fe, listAll as z, getStorage as T, connectStorageEmulator as K } from "firebase/storage";
3
- import { Writer as ye, DataFactory as j } from "n3";
4
- import { getFirestore as be, connectFirestoreEmulator as ve, collection as ft, getDocs as _e, query as ke, where as Ee, limit as xe, doc as yt, getDoc as Ie, setDoc as Ce, serverTimestamp as Te, increment as Se } from "firebase/firestore";
5
- import { getAuth as Ae, connectAuthEmulator as Re, onIdTokenChanged as Oe, getIdTokenResult as st, signInWithEmailAndPassword as Pe, GoogleAuthProvider as at, OAuthProvider as it, signInWithPopup as De, signInWithRedirect as Le, getRedirectResult as qe, signInWithCustomToken as je, signOut as Me, onAuthStateChanged as Ue, fetchSignInMethodsForEmail as ze, linkWithPopup as Ne, unlink as $e, reauthenticateWithCredential as bt, EmailAuthProvider as Q, updatePassword as Fe, linkWithCredential as Be, verifyBeforeUpdateEmail as Ge, sendEmailVerification as He } from "firebase/auth";
6
- import { v5 as We } from "uuid";
1
+ import { getApps as fe, initializeApp as ye } from "firebase/app";
2
+ import { ref as _, getDownloadURL as V, getMetadata as M, getBlob as ee, updateMetadata as be, uploadBytesResumable as wt, uploadBytes as rt, StringFormat as ve, uploadString as _e, listAll as z, getStorage as T, connectStorageEmulator as K } from "firebase/storage";
3
+ import { Writer as ke, DataFactory as j } from "n3";
4
+ import { getFirestore as Ee, connectFirestoreEmulator as xe, collection as ft, getDocs as Ie, query as Ce, where as Te, limit as Se, doc as yt, getDoc as Re, setDoc as Ae, serverTimestamp as Pe, increment as Oe } from "firebase/firestore";
5
+ import { getAuth as De, connectAuthEmulator as Le, onIdTokenChanged as qe, getIdTokenResult as st, signInWithEmailAndPassword as je, GoogleAuthProvider as at, OAuthProvider as it, signInWithPopup as Ue, signInWithRedirect as Me, getRedirectResult as ze, signInWithCustomToken as Ne, signOut as $e, onAuthStateChanged as Fe, fetchSignInMethodsForEmail as Be, linkWithPopup as Ge, unlink as He, reauthenticateWithCredential as bt, EmailAuthProvider as Q, updatePassword as We, linkWithCredential as Ve, verifyBeforeUpdateEmail as Ke, sendEmailVerification as Qe } from "firebase/auth";
6
+ import { v5 as Xe } from "uuid";
7
7
  import "spark-md5";
8
- import { getFunctions as Zt, connectFunctionsEmulator as Jt, httpsCallable as B } from "firebase/functions";
8
+ import { getFunctions as oe, connectFunctionsEmulator as re, httpsCallable as F } from "firebase/functions";
9
9
  class lt {
10
10
  queryEndpoint;
11
11
  updateEndpoint;
@@ -86,7 +86,7 @@ class X extends Error {
86
86
  super(`QLever is locked (rebuild in progress): ${t}`), this.name = "QLeverLockedError";
87
87
  }
88
88
  }
89
- class A {
89
+ class R {
90
90
  queryEndpoint;
91
91
  updateEndpoint;
92
92
  dataEndpoint;
@@ -113,7 +113,7 @@ class A {
113
113
  * 423 means qlever accessor has an ongoing rebuild; we should wait and retry.
114
114
  */
115
115
  static async _retryOnLocked(t) {
116
- const e = A.LOCKED_MAX_RETRIES, o = A.LOCKED_BASE_DELAY_MS;
116
+ const e = R.LOCKED_MAX_RETRIES, o = R.LOCKED_BASE_DELAY_MS;
117
117
  let r;
118
118
  for (let s = 0; s <= e; s++)
119
119
  try {
@@ -131,7 +131,7 @@ class A {
131
131
  constructor(t) {
132
132
  this.queryEndpoint = t.queryEndpoint, this.updateEndpoint = t.updateEndpoint, this.dataEndpoint = this.updateEndpoint.replace(/\/update$/, "/data"), this.baseHeaders = Object.fromEntries(
133
133
  Object.entries(t.originalHeaders || {}).filter(
134
- ([e]) => A.RELEVANT_HEADER_KEYS.includes(e)
134
+ ([e]) => R.RELEVANT_HEADER_KEYS.includes(e)
135
135
  )
136
136
  ), this.baseHeaders["x-user-roles"] = "admin";
137
137
  }
@@ -173,7 +173,7 @@ class A {
173
173
  })).text();
174
174
  }
175
175
  async update(t) {
176
- return A._retryOnLocked(async () => {
176
+ return R._retryOnLocked(async () => {
177
177
  const e = await fetch(this.updateEndpoint, {
178
178
  headers: {
179
179
  ...this.baseHeaders,
@@ -204,8 +204,8 @@ class A {
204
204
  await this._postToDataEndpoint(t, `${this.dataEndpoint}/delete`);
205
205
  }
206
206
  async _postToDataEndpoint(t, e) {
207
- const o = await this._quadsToNQuads(t), r = await Ve(Buffer.from(o, "utf-8"));
208
- await A._retryOnLocked(async () => {
207
+ const o = await this._quadsToNQuads(t), r = await Ye(Buffer.from(o, "utf-8"));
208
+ await R._retryOnLocked(async () => {
209
209
  const s = await fetch(e, {
210
210
  method: "POST",
211
211
  headers: {
@@ -223,12 +223,12 @@ class A {
223
223
  }
224
224
  _quadsToNQuads(t) {
225
225
  return new Promise((e, o) => {
226
- const r = new ye({ format: "application/n-quads" });
226
+ const r = new ke({ format: "application/n-quads" });
227
227
  r.addQuads(t), r.end((s, a) => s ? o(s) : e(a));
228
228
  });
229
229
  }
230
230
  }
231
- async function Ve(i) {
231
+ async function Ye(i) {
232
232
  const t = new CompressionStream("gzip"), e = t.writable.getWriter();
233
233
  e.write(new Uint8Array(i)), e.close();
234
234
  const o = [], r = t.readable.getReader();
@@ -243,11 +243,11 @@ async function Ve(i) {
243
243
  a.set(p, n), n += p.byteLength;
244
244
  return a.buffer;
245
245
  }
246
- class Ke {
246
+ class Ze {
247
247
  constructor(t) {
248
248
  switch (this.options = t, this.options.graphType) {
249
249
  case "qlever":
250
- this._db = new A(this.options);
250
+ this._db = new R(this.options);
251
251
  break;
252
252
  case "fuseki":
253
253
  this._db = new lt(this.options);
@@ -298,7 +298,7 @@ class Ke {
298
298
  return this.options.graphType === "qlever" ? this._db.deleteData(t) : Promise.reject(new Error("deleteData not supported for Fuseki — use update() with SPARQL DELETE DATA"));
299
299
  }
300
300
  }
301
- class Qe {
301
+ class vt {
302
302
  constructor(t) {
303
303
  this.options = t;
304
304
  }
@@ -327,7 +327,7 @@ class Qe {
327
327
  async getDownloadURL(t, e) {
328
328
  const o = _(this._bucket(t), e);
329
329
  try {
330
- return await F(o);
330
+ return await V(o);
331
331
  } catch (r) {
332
332
  if (r?.code === "storage/object-not-found") return;
333
333
  throw r;
@@ -342,8 +342,8 @@ class Qe {
342
342
  if (this._knownMissing.has(o)) return;
343
343
  const r = _(this._bucket(t), e);
344
344
  try {
345
- const s = await U(r);
346
- return `${await F(r)}&t=${encodeURIComponent(s.updated)}`;
345
+ const s = await M(r);
346
+ return `${await V(r)}&t=${encodeURIComponent(s.updated)}`;
347
347
  } catch (s) {
348
348
  if (s?.code === "storage/object-not-found" || s?.status === 404) {
349
349
  this._knownMissing.add(o), console.debug(`[CueBlobStorage] ${e} not found (404 OK — optional cache file)`);
@@ -356,7 +356,7 @@ class Qe {
356
356
  async getFile(t, e) {
357
357
  const o = _(this._bucket(t), e);
358
358
  try {
359
- return await Yt(o);
359
+ return await ee(o);
360
360
  } catch (r) {
361
361
  if (r?.code === "storage/object-not-found") return;
362
362
  throw r;
@@ -382,8 +382,8 @@ class Qe {
382
382
  ]);
383
383
  try {
384
384
  const [a, n] = await Promise.all([
385
- s(F(e)),
386
- s(U(e))
385
+ s(V(e)),
386
+ s(M(e))
387
387
  ]), p = `${a}&t=${encodeURIComponent(n.updated)}`, c = await fetch(p, { signal: o.signal });
388
388
  if (!c.ok) throw new Error(`HTTP ${c.status}`);
389
389
  return c.text();
@@ -399,7 +399,7 @@ class Qe {
399
399
  async getMetadata(t, e) {
400
400
  const o = _(this._bucket(t), e);
401
401
  try {
402
- const r = await U(o);
402
+ const r = await M(o);
403
403
  return {
404
404
  updated: r.updated,
405
405
  contentType: r.contentType,
@@ -414,7 +414,7 @@ class Qe {
414
414
  /** Update custom metadata on an existing file. */
415
415
  async setMetadata(t, e, o) {
416
416
  const r = _(this._bucket(t), e);
417
- await me(r, { customMetadata: o });
417
+ await be(r, { customMetadata: o });
418
418
  }
419
419
  // ─── Uploads ──────────────────────────────────────────────────────────────
420
420
  /**
@@ -446,9 +446,9 @@ class Qe {
446
446
  await rt(s, o, r ? { customMetadata: r } : void 0);
447
447
  }
448
448
  /** Upload a string or base64-encoded value. */
449
- async uploadString(t, e, o, r = we.RAW, s) {
449
+ async uploadString(t, e, o, r = ve.RAW, s) {
450
450
  const a = _(this._bucket(t), e);
451
- await fe(a, o, r, s ? { customMetadata: s } : void 0);
451
+ await _e(a, o, r, s ? { customMetadata: s } : void 0);
452
452
  }
453
453
  // ─── Listing ──────────────────────────────────────────────────────────────
454
454
  /** List all item names directly under `prefix` in the given bucket. */
@@ -532,7 +532,7 @@ class Qe {
532
532
  */
533
533
  async uploadProcessed(t, e, o) {
534
534
  const r = _(this.options.storageProcessed, t);
535
- return await U(r).catch(() => null) ? !1 : (await rt(r, e, { customMetadata: o }), !0);
535
+ return await M(r).catch(() => null) ? !1 : (await rt(r, e, { customMetadata: o }), !0);
536
536
  }
537
537
  /** List all blob names directly under `prefix` in the raw bucket. */
538
538
  async listRaw(t) {
@@ -540,7 +540,7 @@ class Qe {
540
540
  return (await z(e)).items.map((r) => r.name);
541
541
  }
542
542
  }
543
- const vt = {
543
+ const _t = {
544
544
  ä: "ae",
545
545
  ä: "ae",
546
546
  Ä: "AE",
@@ -576,15 +576,15 @@ const vt = {
576
576
  };
577
577
  function D(i, t = !1) {
578
578
  const e = "daca0510-72b5-48ba-9091-b918ca18136b";
579
- return i = Xe(i, t), We(i, e);
579
+ return i = Je(i, t), Xe(i, e);
580
580
  }
581
- function Xe(i, t = !1) {
581
+ function Je(i, t = !1) {
582
582
  let e = i;
583
- for (const o in vt)
584
- e = e.replace(new RegExp(o, "g"), vt[o]);
583
+ for (const o in _t)
584
+ e = e.replace(new RegExp(o, "g"), _t[o]);
585
585
  return t && e !== i && console.info(`${i} -> ${e}`), e;
586
586
  }
587
- function Ye(i, t = "") {
587
+ function to(i, t = "") {
588
588
  return D(`${t}${i}`);
589
589
  }
590
590
  class x {
@@ -646,8 +646,8 @@ const Y = {
646
646
  apiKey: "AIzaSyAiW42QBx9HS4Khu88pCW7MV66IhBAQul0",
647
647
  appId: "1:151132927589:web:d2ffdb377dfadfd23ab88c",
648
648
  measurementId: "G-YT4PK6HGZD"
649
- }, _t = "qaecy-mvp-406413", Ze = "734737865998", te = "europe-west6", kt = "projects", Je = "spaces_chats_eu_west6", Et = "spaces_raw_eu_west6", xt = "spaces_processed_eu_west6", to = "spaces_logs_eu_west6", eo = "cue_public_eu_west6", It = "db_persistence_eu_west6", oo = "/data-views/admin/consumption", ro = "/data-views/admin/profile/organizations", Ct = "/data-views/admin/profile/api-keys", Tt = "/commands/admin/profile/api-keys", so = "/commands/admin/profile/terms", ao = (i) => `/data-views/admin/organizations/${i}/members`, io = "/commands/admin/project", no = "/assistant/search", ee = "/triplestore/query", po = "/triplestore/update", lo = "/triplestore/shacl", oe = "/qlever-server/qlever/query", co = "/qlever-server/qlever/update", ho = "/qlever-server/qlever/shacl", St = "/commands/file-system-structure/batch", At = "microsoft.com", Rt = "superadmin", dt = "https://cue.qaecy.com/r/";
650
- class Ot {
649
+ }, kt = "qaecy-mvp-406413", eo = "734737865998", se = "europe-west6", Et = "projects", xt = "spaces_chats_eu_west6", It = "spaces_raw_eu_west6", Ct = "spaces_processed_eu_west6", Tt = "spaces_logs_eu_west6", St = "cue_public_eu_west6", Rt = "db_persistence_eu_west6", oo = "/data-views/admin/consumption", ro = "/data-views/admin/profile/organizations", At = "/data-views/admin/profile/api-keys", Pt = "/commands/admin/profile/api-keys", so = "/commands/admin/profile/terms", ao = (i) => `/data-views/admin/organizations/${i}/members`, io = "/commands/admin/project", no = "/assistant/search", ae = "/triplestore/query", po = "/triplestore/update", lo = "/triplestore/shacl", ie = "/qlever-server/qlever/query", co = "/qlever-server/qlever/update", ho = "/qlever-server/qlever/shacl", Ot = "/commands/file-system-structure/batch", Dt = "microsoft.com", Lt = "superadmin", dt = "https://cue.qaecy.com/r/";
650
+ class qt {
651
651
  _auth;
652
652
  _endpoints;
653
653
  _userSignal = new x(null);
@@ -664,19 +664,19 @@ class Ot {
664
664
  /** All unique UIDs for the current user (Firebase UID + linked provider UIDs). */
665
665
  userIds;
666
666
  constructor(t, e = !1, o) {
667
- this._auth = Ae(t), this._endpoints = o, e && Re(this._auth, o.authEmulatorUrl, {
667
+ this._auth = De(t), this._endpoints = o, e && Le(this._auth, o.authEmulatorUrl, {
668
668
  disableWarnings: !0
669
669
  }), this.user = this._userSignal.asReadonly(), this.token = this._tokenSignal.asReadonly(), this.isSuperAdmin = this._isSuperAdminSignal.asReadonly(), this._userIdsSignal = ct([this._userSignal], () => {
670
670
  const r = this._userSignal.get();
671
671
  if (!r) return [];
672
672
  const s = /* @__PURE__ */ new Set([r.uid]);
673
673
  return r.providerData.forEach((a) => s.add(a.uid)), Array.from(s);
674
- }), this.userIds = this._userIdsSignal, this._stopTokenListener = Oe(this._auth, async (r) => {
674
+ }), this.userIds = this._userIdsSignal, this._stopTokenListener = qe(this._auth, async (r) => {
675
675
  if (this._userSignal.set(r), r) {
676
676
  const s = await r.getIdToken();
677
677
  this._tokenSignal.set(s);
678
678
  const a = await st(r);
679
- this._isSuperAdminSignal.set(a.claims.role === Rt);
679
+ this._isSuperAdminSignal.set(a.claims.role === Lt);
680
680
  } else
681
681
  this._tokenSignal.set(null), this._isSuperAdminSignal.set(!1);
682
682
  });
@@ -689,14 +689,14 @@ class Ot {
689
689
  if (t === "password") {
690
690
  if (!e)
691
691
  throw new Error("credentials are required for password sign-in");
692
- return (await Pe(
692
+ return (await je(
693
693
  this._auth,
694
694
  e.email,
695
695
  e.password
696
696
  )).user;
697
697
  }
698
- const o = t === "google" ? new at() : new it(At);
699
- return (await De(this._auth, o)).user;
698
+ const o = t === "google" ? new at() : new it(Dt);
699
+ return (await Ue(this._auth, o)).user;
700
700
  }
701
701
  /**
702
702
  * Initiate a redirect-based sign-in (mobile / iframe contexts where popups
@@ -704,8 +704,8 @@ class Ot {
704
704
  * retrieve the result.
705
705
  */
706
706
  async signInWithRedirect(t) {
707
- const e = t === "google" ? new at() : new it(At);
708
- await Le(this._auth, e);
707
+ const e = t === "google" ? new at() : new it(Dt);
708
+ await Me(this._auth, e);
709
709
  }
710
710
  /**
711
711
  * Retrieve the result of a redirect sign-in. Returns the signed-in `User`
@@ -713,7 +713,7 @@ class Ot {
713
713
  * Call this once on app startup before showing a sign-in UI.
714
714
  */
715
715
  async checkRedirectResult() {
716
- return (await qe(this._auth))?.user ?? null;
716
+ return (await ze(this._auth))?.user ?? null;
717
717
  }
718
718
  /**
719
719
  * One-shot async check — returns `true` if the current user has the
@@ -722,7 +722,7 @@ class Ot {
722
722
  */
723
723
  async checkSuperAdmin() {
724
724
  const t = this._auth.currentUser;
725
- return t ? (await st(t)).claims.role === Rt : !1;
725
+ return t ? (await st(t)).claims.role === Lt : !1;
726
726
  }
727
727
  /** Sign in with a Cue API key. `projectId` is optional — omit it when no project context is available (e.g. admin flows). */
728
728
  async signInWithApiKey(t, e) {
@@ -735,11 +735,11 @@ class Ot {
735
735
  if (!r.ok)
736
736
  throw new Error(`Failed to fetch custom token: ${r.statusText}`);
737
737
  const { token: s } = await r.json();
738
- return (await je(this._auth, s)).user;
738
+ return (await Ne(this._auth, s)).user;
739
739
  }
740
740
  /** Sign out the current user */
741
741
  async signOut() {
742
- await Me(this._auth);
742
+ await $e(this._auth);
743
743
  }
744
744
  /**
745
745
  * Register a new user by name and email.
@@ -769,7 +769,7 @@ class Ot {
769
769
  }
770
770
  /** Subscribe to authentication state changes. Returns an unsubscribe function. */
771
771
  onAuthStateChanged(t) {
772
- return Ue(this._auth, t);
772
+ return Fe(this._auth, t);
773
773
  }
774
774
  /** Get the Firebase ID token for the current user, or null if not authenticated */
775
775
  async getToken(t = !1) {
@@ -801,12 +801,11 @@ class Ot {
801
801
  return this._auth;
802
802
  }
803
803
  }
804
- class Pt {
805
- constructor(t, e) {
806
- this._storageRaw = t, this._storageProcessed = e;
804
+ class jt {
805
+ constructor(t) {
806
+ this._blob = t;
807
807
  }
808
- _storageRaw;
809
- _storageProcessed;
808
+ _blob;
810
809
  /**
811
810
  * Returns a Firebase authenticated download URL for a document stored in Cue.
812
811
  *
@@ -818,8 +817,24 @@ class Pt {
818
817
  * @param bucket - `'raw'` (default, original uploads) or `'processed'` (derived artefacts).
819
818
  */
820
819
  async getDownloadUrl(t, e, o, r = "raw") {
821
- const s = r === "processed" ? this._storageProcessed : this._storageRaw, a = _(s, `${t}/${e}${o}`);
822
- return F(a);
820
+ const s = `${t}/${e}${o}`, a = await this._blob.getDownloadURL(r, s);
821
+ if (!a) throw new Error(`File not found in storage: ${s} (bucket: ${r})`);
822
+ return a;
823
+ }
824
+ /**
825
+ * Returns a Firebase authenticated download URL for an alternative representation
826
+ * using its full `qcy:remoteRelativePath` stored in the processed bucket.
827
+ *
828
+ * Use this instead of `getDownloadUrl` when the document info was obtained via
829
+ * `fetchAlternativeRepresentations` and carries a `remoteRelativePath`.
830
+ *
831
+ * @param remoteRelativePath - The full path in the processed bucket,
832
+ * e.g. `{projectId}/fragments/{uuid}.fragments`.
833
+ */
834
+ async getAltRepDownloadUrl(t) {
835
+ const e = await this._blob.getDownloadURL("processed", t);
836
+ if (!e) throw new Error(`Alternative representation not found in storage: ${t}`);
837
+ return e;
823
838
  }
824
839
  }
825
840
  const go = "/data-views/tables", uo = "/commands/tables";
@@ -861,7 +876,7 @@ class mo {
861
876
  throw new Error(`Failed to save tables: ${o.status} ${o.statusText}`);
862
877
  }
863
878
  }
864
- class Dt {
879
+ class Ut {
865
880
  constructor(t, e, o, r) {
866
881
  this._auth = t, this._gatewayUrl = e, this.projects = o, this.sync = r, this.tables = new mo(t, e);
867
882
  }
@@ -918,7 +933,7 @@ class Dt {
918
933
  */
919
934
  async sparql(t, e, o) {
920
935
  o || (o = (await this.projects.getProject(e))?.projectSettings?.graph?.type ?? "qlever");
921
- const r = o === "fuseki" ? ee : oe;
936
+ const r = o === "fuseki" ? ae : ie;
922
937
  console.log(`Executing SPARQL query against ${r} for project ${e} with graph type ${o}`);
923
938
  const s = new URLSearchParams();
924
939
  s.append("query", t);
@@ -1018,7 +1033,7 @@ const nt = [
1018
1033
  "railway",
1019
1034
  "natural",
1020
1035
  "manmade"
1021
- ], re = [
1036
+ ], ne = [
1022
1037
  "address",
1023
1038
  "poi",
1024
1039
  "railway",
@@ -1132,13 +1147,13 @@ const yo = "https://nominatim.openstreetmap.org", bo = "cue-gis/0.0.1", vo = {
1132
1147
  paved: "road",
1133
1148
  zone: "boundary"
1134
1149
  }, L = "nominatim";
1135
- function G(i) {
1150
+ function B(i) {
1136
1151
  return `${L}:${i}`;
1137
1152
  }
1138
1153
  function _o(i) {
1139
1154
  const t = S(i);
1140
1155
  return {
1141
- id: G(i),
1156
+ id: B(i),
1142
1157
  sourceId: L,
1143
1158
  sourceLayerId: i,
1144
1159
  category: i,
@@ -1160,7 +1175,7 @@ class ko {
1160
1175
  }
1161
1176
  async listFeatureCategoryDescriptors(t) {
1162
1177
  return (await Promise.allSettled(
1163
- re.map(async (o) => {
1178
+ ne.map(async (o) => {
1164
1179
  const r = await this.search(t, o);
1165
1180
  return { category: o, hasResults: r.length > 0 };
1166
1181
  })
@@ -1172,14 +1187,14 @@ class ko {
1172
1187
  return (await this.listFeatureCategoryDescriptors(t)).map((o) => _o(o.category));
1173
1188
  }
1174
1189
  async getFeaturesForLayer(t, e) {
1175
- const o = nt.find((r) => G(r) === e);
1190
+ const o = nt.find((r) => B(r) === e);
1176
1191
  return o ? this.search(t, o) : [];
1177
1192
  }
1178
1193
  async listFeatureCategories(t) {
1179
1194
  return (await this.listFeatureCategoryDescriptors(t)).map((o) => o.category);
1180
1195
  }
1181
1196
  async getFeaturesOfCategory(t, e) {
1182
- return this.getFeaturesForLayer(t, G(e));
1197
+ return this.getFeaturesForLayer(t, B(e));
1183
1198
  }
1184
1199
  /**
1185
1200
  * Low-level search against the Nominatim API. Uses a per-layer probe query
@@ -1215,7 +1230,7 @@ class ko {
1215
1230
  id: `${t.osm_type}/${t.osm_id}`,
1216
1231
  sourceId: L,
1217
1232
  sourceFeatureId: `${t.osm_type}/${t.osm_id}`,
1218
- layerId: G(n),
1233
+ layerId: B(n),
1219
1234
  name: t.name ?? t.display_name.split(",")[0].trim(),
1220
1235
  category: n,
1221
1236
  preferredColor: p.preferredColor,
@@ -1229,7 +1244,7 @@ class ko {
1229
1244
  };
1230
1245
  }
1231
1246
  }
1232
- const Lt = {
1247
+ const Mt = {
1233
1248
  // 100s – Residential
1234
1249
  110: "residential",
1235
1250
  120: "residential",
@@ -1308,7 +1323,7 @@ const Lt = {
1308
1323
  960: "agricultural",
1309
1324
  970: "agricultural",
1310
1325
  990: "other"
1311
- }, qt = {
1326
+ }, zt = {
1312
1327
  1010: "residential",
1313
1328
  1020: "mixed",
1314
1329
  1030: "residential",
@@ -1413,20 +1428,20 @@ const Lt = {
1413
1428
  [/infrastruktur|verkehr|transport|energy|energie|forsyning|teknik|teknisk/i, "infrastructure"],
1414
1429
  [/gemischt|mixed|blandet/i, "mixed"]
1415
1430
  ];
1416
- function P(i) {
1431
+ function O(i) {
1417
1432
  for (const [t, e] of xo)
1418
1433
  if (t.test(i)) return e;
1419
1434
  }
1420
1435
  function Io(i, t) {
1421
1436
  if (i == null) return;
1422
1437
  const e = String(i).trim();
1423
- return t === "swiss-gwr" ? Eo[e] ?? P(e) : t === "danish-matrikel" ? Lt[e] ?? P(e) : t === "zurich-wfs" || t === "swiss-av-wfs" ? qt[e] ?? P(e) : qt[e] ?? Lt[e] ?? P(e);
1438
+ return t === "swiss-gwr" ? Eo[e] ?? O(e) : t === "danish-matrikel" ? Mt[e] ?? O(e) : t === "zurich-wfs" || t === "swiss-av-wfs" ? zt[e] ?? O(e) : zt[e] ?? Mt[e] ?? O(e);
1424
1439
  }
1425
1440
  function Co(i, t) {
1426
1441
  if (i != null)
1427
- return P(String(i).trim());
1442
+ return O(String(i).trim());
1428
1443
  }
1429
- function se(i) {
1444
+ function pe(i) {
1430
1445
  return i.trim().toLowerCase().replace(/[\s_\-]/g, "");
1431
1446
  }
1432
1447
  const To = {
@@ -1448,11 +1463,11 @@ const To = {
1448
1463
  forslag: "proposed",
1449
1464
  aflyst: "repealed"
1450
1465
  };
1451
- function ae(i) {
1466
+ function le(i) {
1452
1467
  if (i)
1453
- return To[se(i)];
1468
+ return To[pe(i)];
1454
1469
  }
1455
- const jt = {
1470
+ const Nt = {
1456
1471
  // Swiss Nutzungsplanung (typ_gde_bezeichnung and common variants)
1457
1472
  grundnutzungszonenplan: "land-use-plan",
1458
1473
  nutzungszonenplan: "land-use-plan",
@@ -1546,17 +1561,17 @@ const jt = {
1546
1561
  // Catch-all: any remaining Xzone / Xareal designation from the Grundnutzungszonenplan
1547
1562
  [/zone$|areal$/i, "land-use-plan"]
1548
1563
  ];
1549
- function ie(i) {
1564
+ function ce(i) {
1550
1565
  if (!i) return;
1551
- const t = se(i);
1552
- if (t in jt) return jt[t];
1566
+ const t = pe(i);
1567
+ if (t in Nt) return Nt[t];
1553
1568
  for (const [e, o] of So)
1554
1569
  if (e.test(i)) return o;
1555
1570
  console.warn(
1556
1571
  `[cue-gis] Unknown zone plan type — add "${i}" to classifyZonePlanType: no ZonePlanType mapping found.`
1557
1572
  );
1558
1573
  }
1559
- const Ao = "https://maps.zh.ch/wfs/OGDZHWFS", Ro = "zurich-wfs", Oo = [8.35, 47.15, 8.95, 47.7], Po = [5.9, 45.7, 10.55, 47.85];
1574
+ const Ro = "https://maps.zh.ch/wfs/OGDZHWFS", Ao = "zurich-wfs", Po = [8.35, 47.15, 8.95, 47.7], Oo = [5.9, 45.7, 10.55, 47.85];
1560
1575
  function Z(i) {
1561
1576
  return typeof i == "string" ? i : i.typeName;
1562
1577
  }
@@ -1606,7 +1621,7 @@ function tt(i, t, e, o) {
1606
1621
  descriptionKey: `gis.layer.${i}.${r}.description`
1607
1622
  };
1608
1623
  }
1609
- function Mo(i, t) {
1624
+ function Uo(i, t) {
1610
1625
  if (!i) return { featureType: "building" };
1611
1626
  const e = i.grundflaeche ?? i.gbf ?? i.gebaeudegrundrissflaeche ?? i.flaeche ?? void 0, o = i.vollgeschosse ?? i.geschossanzahl ?? i.anzahl_geschosse ?? void 0, r = i.gebaeudefunktion ?? i.gfkode ?? i.art ?? i.objektart ?? void 0, s = i.baujahr ?? i.bauperiode ?? void 0, a = String(i.egid ?? i.gwr_egid ?? i.egris_egid ?? "").trim() || void 0;
1612
1627
  return {
@@ -1619,7 +1634,7 @@ function Mo(i, t) {
1619
1634
  registryId: a
1620
1635
  };
1621
1636
  }
1622
- function Uo(i, t) {
1637
+ function Mo(i, t) {
1623
1638
  if (!i) return { featureType: "plot" };
1624
1639
  const e = i.egris_egrid ?? i.egrid ?? void 0, o = i.nummer ?? void 0, r = i.nbident ?? void 0, s = o && r ? `${o}, ${r}` : o ?? void 0, a = i.flaechenmass ?? i.flaeche ?? void 0, n = i.art ?? i.nutzungsart ?? void 0;
1625
1640
  return {
@@ -1651,7 +1666,7 @@ function No(i) {
1651
1666
  }
1652
1667
  function $o(i) {
1653
1668
  if (!i) return { featureType: "zone" };
1654
- const t = i.plannavn ?? i.bezeichnung ?? i.typ_bezeichnung ?? i.art ?? void 0, e = i.planid ?? i.plannummer ?? void 0, o = i.artcode ?? i.typ_code ?? i.abkuerzung ?? e ?? void 0, r = i.rechtsstatus ?? i.status ?? void 0, s = ae(r), a = i.typ_gde_bezeichnung ?? void 0, n = ie(a), p = i.dagsordenpunkt_url ?? i.dokument_url ?? i.link ?? void 0, c = i.auflagedatum ?? void 0, h = i.festsetzungsdatum ?? void 0, d = i.genehmigungsdatum ?? void 0, g = i.inkraftsetzungsdatum ?? void 0, w = i.flaeche ?? i.flaeche_m2 ?? void 0;
1669
+ const t = i.plannavn ?? i.bezeichnung ?? i.typ_bezeichnung ?? i.art ?? void 0, e = i.planid ?? i.plannummer ?? void 0, o = i.artcode ?? i.typ_code ?? i.abkuerzung ?? e ?? void 0, r = i.rechtsstatus ?? i.status ?? void 0, s = le(r), a = i.typ_gde_bezeichnung ?? void 0, n = ce(a), p = i.dagsordenpunkt_url ?? i.dokument_url ?? i.link ?? void 0, c = i.auflagedatum ?? void 0, h = i.festsetzungsdatum ?? void 0, d = i.genehmigungsdatum ?? void 0, g = i.inkraftsetzungsdatum ?? void 0, w = i.flaeche ?? i.flaeche_m2 ?? void 0;
1655
1670
  return {
1656
1671
  featureType: "zone",
1657
1672
  zoneType: t ? String(t) : void 0,
@@ -1688,7 +1703,7 @@ class et {
1688
1703
  sourceId;
1689
1704
  outputFormat;
1690
1705
  constructor(t) {
1691
- this.categoryMap = t.categoryMap, this.baseUrl = t.baseUrl ?? Ao, this.sourceId = t.sourceId ?? Ro, this.outputFormat = t.outputFormat ?? "application/json; subtype=geojson";
1706
+ this.categoryMap = t.categoryMap, this.baseUrl = t.baseUrl ?? Ro, this.sourceId = t.sourceId ?? Ao, this.outputFormat = t.outputFormat ?? "application/json; subtype=geojson";
1692
1707
  }
1693
1708
  async listFeatureCategoryDescriptors(t) {
1694
1709
  const e = await this.listAvailableLayers(t);
@@ -1782,10 +1797,10 @@ class et {
1782
1797
  };
1783
1798
  }
1784
1799
  _extractNormalisedProperties(t, e) {
1785
- return e.category === "building" ? Mo(t.properties, this.sourceId) : e.category === "greenspace" ? zo(t.properties) : e.category === "paved" ? No(t.properties) : e.category === "zone" ? $o(t.properties) : Uo(t.properties, this.sourceId);
1800
+ return e.category === "building" ? Uo(t.properties, this.sourceId) : e.category === "greenspace" ? zo(t.properties) : e.category === "paved" ? No(t.properties) : e.category === "zone" ? $o(t.properties) : Mo(t.properties, this.sourceId);
1786
1801
  }
1787
1802
  }
1788
- const ne = [8, 54.5, 15.2, 57.8], pe = {
1803
+ const he = [8, 54.5, 15.2, 57.8], de = {
1789
1804
  building: [
1790
1805
  { source: "danish-matrikel", typename: "bbr_v001:bygning_current" }
1791
1806
  ],
@@ -1864,8 +1879,8 @@ function Vo(i, t) {
1864
1879
  featureType: "zone",
1865
1880
  zoneType: a ?? void 0,
1866
1881
  zoneCode: p ?? void 0,
1867
- legalStatus: ae(c),
1868
- planType: ie(i?.typ_gde_bezeichnung),
1882
+ legalStatus: le(c),
1883
+ planType: ce(i?.typ_gde_bezeichnung),
1869
1884
  planId: n ?? void 0,
1870
1885
  planDocumentLink: h ?? void 0,
1871
1886
  publicationDate: i?.auflagedatum ?? void 0,
@@ -1889,7 +1904,7 @@ class Ko {
1889
1904
  getHeaders;
1890
1905
  sourceId;
1891
1906
  constructor(t) {
1892
- this.dataViewsBaseUrl = t.dataViewsBaseUrl.replace(/\/$/, ""), this.getHeaders = t.getHeaders, this.categoryMap = t.categoryMap ?? pe, this.sourceId = t.sourceId ?? "cue-sdk-gis";
1907
+ this.dataViewsBaseUrl = t.dataViewsBaseUrl.replace(/\/$/, ""), this.getHeaders = t.getHeaders, this.categoryMap = t.categoryMap ?? de, this.sourceId = t.sourceId ?? "cue-sdk-gis";
1893
1908
  }
1894
1909
  async listFeatureCategoryDescriptors(t) {
1895
1910
  const e = await this.listAvailableLayers(t);
@@ -2021,10 +2036,10 @@ const Qo = {
2021
2036
  // ÖREB Überlagernde Festlegungen (Flächen) – overlaying planning constraints
2022
2037
  "ms:ogd-0155_arv_basis_np_ul_flaeche_f"
2023
2038
  ]
2024
- }, le = [
2039
+ }, ge = [
2025
2040
  {
2026
2041
  name: "Canton of Zürich",
2027
- coverageBBox: Oo,
2042
+ coverageBBox: Po,
2028
2043
  supportedCategories: ["address", "poi", "railway", "natural", "manmade", "building", "cadastre", "greenspace", "paved", "zone"],
2029
2044
  priority: 10,
2030
2045
  adapter: new et({
@@ -2033,7 +2048,7 @@ const Qo = {
2033
2048
  },
2034
2049
  {
2035
2050
  name: "Switzerland (national AV cadastre)",
2036
- coverageBBox: Po,
2051
+ coverageBBox: Oo,
2037
2052
  supportedCategories: ["cadastre"],
2038
2053
  priority: 5,
2039
2054
  // Lower priority than canton-specific adapters. For ZH, the canton adapter (priority 10) wins.
@@ -2061,7 +2076,7 @@ const Qo = {
2061
2076
  * - `pdk:kommuneplanramme_vedtaget` – adopted municipal plan frameworks
2062
2077
  */
2063
2078
  name: "Denmark (Plandata.dk – planning zones)",
2064
- coverageBBox: ne,
2079
+ coverageBBox: he,
2065
2080
  supportedCategories: ["zone"],
2066
2081
  priority: 10,
2067
2082
  adapter: new et({
@@ -2079,7 +2094,7 @@ const Qo = {
2079
2094
  })
2080
2095
  }
2081
2096
  ];
2082
- function Mt(i) {
2097
+ function $t(i) {
2083
2098
  return [...i].sort(
2084
2099
  (t, e) => nt.indexOf(t.category) - nt.indexOf(e.category)
2085
2100
  );
@@ -2100,7 +2115,7 @@ class Xo {
2100
2115
  ...s
2101
2116
  } = t;
2102
2117
  this.nominatim = new ko(s);
2103
- const a = o ? le : [];
2118
+ const a = o ? ge : [];
2104
2119
  this.regions = e ?? a, this.zonePlanTypeColors = { ...fo, ...r };
2105
2120
  }
2106
2121
  /**
@@ -2120,12 +2135,12 @@ class Xo {
2120
2135
  for (const a of e)
2121
2136
  for (const n of a.supportedCategories ?? [])
2122
2137
  r.has(n) || (r.add(n), s.push(S(n)));
2123
- for (const a of re)
2138
+ for (const a of ne)
2124
2139
  r.has(a) || s.push(S(a));
2125
- return Mt(s);
2140
+ return $t(s);
2126
2141
  }
2127
2142
  const o = await this._adapterFor(t).listFeatureCategoryDescriptors(t);
2128
- return Mt(o);
2143
+ return $t(o);
2129
2144
  }
2130
2145
  /**
2131
2146
  * Return the feature categories that have at least one result within the
@@ -2198,7 +2213,7 @@ class Xo {
2198
2213
  const { features: n, idx: p } = await Promise.race(a.values());
2199
2214
  a.delete(p);
2200
2215
  for (const c of n) {
2201
- const h = Ut(c), d = V(c), g = s.get(h);
2216
+ const h = Ft(c), d = W(c), g = s.get(h);
2202
2217
  (g === void 0 || d > g) && (s.set(h, d), yield c);
2203
2218
  }
2204
2219
  }
@@ -2234,7 +2249,7 @@ class Xo {
2234
2249
  d.status === "fulfilled" && (d.value.isNominatim ? n.push(...d.value.features) : a.push(...d.value.features));
2235
2250
  const p = Jo(a, n), c = /* @__PURE__ */ new Map(), h = [];
2236
2251
  for (const d of p) {
2237
- const g = Ut(d), w = V(d), u = c.get(g);
2252
+ const g = Ft(d), w = W(d), u = c.get(g);
2238
2253
  (u === void 0 || w > u) && (c.set(g, w), h.push(d));
2239
2254
  }
2240
2255
  return h;
@@ -2248,11 +2263,11 @@ class Xo {
2248
2263
  return this.regions.filter((o) => N(o.coverageBBox, t)).sort((o, r) => (r.priority ?? 0) - (o.priority ?? 0))[0]?.adapter ?? this.nominatim;
2249
2264
  }
2250
2265
  }
2251
- function V(i) {
2266
+ function W(i) {
2252
2267
  const t = i.geometry?.type;
2253
2268
  return t === "Polygon" || t === "MultiPolygon" ? 3 : t === "LineString" || t === "MultiLineString" ? 2 : 1;
2254
2269
  }
2255
- function Ut(i) {
2270
+ function Ft(i) {
2256
2271
  const t = Math.round(i.lat * 1e3) / 1e3, e = Math.round(i.lon * 1e3) / 1e3;
2257
2272
  return `${(i.name ?? i.id ?? "").toLowerCase().trim()}|${t}|${e}`;
2258
2273
  }
@@ -2263,7 +2278,7 @@ function Zo(i, t) {
2263
2278
  }
2264
2279
  function Jo(i, t) {
2265
2280
  if (t.length === 0) return i;
2266
- const e = i.filter((a) => V(a) === 3), o = i.filter((a) => V(a) !== 3), r = e.map((a) => ({ feature: { ...a, originalData: { ...a.originalData } }, matched: !1 })), s = [];
2281
+ const e = i.filter((a) => W(a) === 3), o = i.filter((a) => W(a) !== 3), r = e.map((a) => ({ feature: { ...a, originalData: { ...a.originalData } }, matched: !1 })), s = [];
2267
2282
  for (const a of t) {
2268
2283
  let n = -1, p = Yo;
2269
2284
  for (let c = 0; c < r.length; c++) {
@@ -2370,11 +2385,11 @@ class or {
2370
2385
  _getGateway() {
2371
2386
  if (this._gatewayCache !== null && this._gatewayProjectId === this._projectId)
2372
2387
  return this._gatewayCache;
2373
- const t = this._projectId, e = [...le];
2388
+ const t = this._projectId, e = [...ge];
2374
2389
  return t && e.unshift({
2375
2390
  name: "Cue SDK (authenticated)",
2376
- coverageBBox: ne,
2377
- supportedCategories: Object.keys(pe),
2391
+ coverageBBox: he,
2392
+ supportedCategories: Object.keys(de),
2378
2393
  priority: 10,
2379
2394
  adapter: new Ko({
2380
2395
  dataViewsBaseUrl: `${this._gatewayUrl}${tr}`,
@@ -2427,11 +2442,11 @@ class or {
2427
2442
  this._loadListeners.forEach((e) => e(t));
2428
2443
  }
2429
2444
  }
2430
- class zt {
2445
+ class Bt {
2431
2446
  constructor(t, e, o = !1, r) {
2432
- if (this._auth = t, this._db = be(e), this._functions = Zt(e, te), this._gatewayUrl = r?.gatewayUrl ?? "", o) {
2447
+ if (this._auth = t, this._db = Ee(e), this._functions = oe(e, se), this._gatewayUrl = r?.gatewayUrl ?? "", o) {
2433
2448
  const s = r?.firestoreEmulatorHost ?? "localhost", a = r?.firestoreEmulatorPort ?? 8080;
2434
- ve(this._db, s, a), Jt(this._functions, "localhost", 5001);
2449
+ xe(this._db, s, a), re(this._functions, "localhost", 5001);
2435
2450
  }
2436
2451
  }
2437
2452
  _auth;
@@ -2464,12 +2479,12 @@ class zt {
2464
2479
  * Access is gated by Firestore rules which check membership.
2465
2480
  */
2466
2481
  async listProjects() {
2467
- const t = this._requireUser(), e = ft(this._db, kt);
2468
- return (await _e(ke(e, Ee("members", "array-contains", t), xe(100)))).docs.map((r) => r.data());
2482
+ const t = this._requireUser(), e = ft(this._db, Et);
2483
+ return (await Ie(Ce(e, Te("members", "array-contains", t), Se(100)))).docs.map((r) => r.data());
2469
2484
  }
2470
2485
  /** Fetch a single project by ID. Returns null if not found. */
2471
2486
  async getProject(t) {
2472
- const e = yt(ft(this._db, kt), t), o = await Ie(e);
2487
+ const e = yt(ft(this._db, Et), t), o = await Re(e);
2473
2488
  return o.exists() ? o.data() : null;
2474
2489
  }
2475
2490
  /**
@@ -2479,9 +2494,9 @@ class zt {
2479
2494
  async incrementUnitsConsumed(t, e, o) {
2480
2495
  if (e <= 0) return;
2481
2496
  const r = yt(this._db, "clientSync", t);
2482
- await Ce(r, {
2483
- unitsConsumed: Se(e),
2484
- lastUpdated: Te(),
2497
+ await Ae(r, {
2498
+ unitsConsumed: Oe(e),
2499
+ lastUpdated: Pe(),
2485
2500
  lastUserId: o
2486
2501
  }, { merge: !0 });
2487
2502
  }
@@ -2489,20 +2504,20 @@ class zt {
2489
2504
  * Invite a user to a project by email. Returns the invited user's uid and display name.
2490
2505
  */
2491
2506
  async inviteUserToProject(t, e, o) {
2492
- return (await B(this._functions, "inviteUserToProject")({ email: t, spaceId: e, role: o })).data;
2507
+ return (await F(this._functions, "inviteUserToProject")({ email: t, spaceId: e, role: o })).data;
2493
2508
  }
2494
2509
  /** Change an existing member's role on a project. */
2495
2510
  async changeUserRoleOnProject(t, e, o) {
2496
- await B(this._functions, "changeUserRoleOnProject")({ uid: t, spaceId: e, role: o });
2511
+ await F(this._functions, "changeUserRoleOnProject")({ uid: t, spaceId: e, role: o });
2497
2512
  }
2498
2513
  /** Remove a member from a project. */
2499
2514
  async removeUserFromProject(t, e) {
2500
- await B(this._functions, "removeUserFromProject")({ uid: t, spaceId: e });
2515
+ await F(this._functions, "removeUserFromProject")({ uid: t, spaceId: e });
2501
2516
  }
2502
2517
  }
2503
- class Nt {
2518
+ class Gt {
2504
2519
  constructor(t, e, o, r) {
2505
- this._auth = t, this._gatewayUrl = r, this._functions = Zt(e, te), o && Jt(this._functions, "localhost", 5001);
2520
+ this._auth = t, this._gatewayUrl = r, this._functions = oe(e, se), o && re(this._functions, "localhost", 5001);
2506
2521
  }
2507
2522
  _auth;
2508
2523
  _gatewayUrl;
@@ -2519,13 +2534,13 @@ class Nt {
2519
2534
  }
2520
2535
  /** Whether the current user has an active API key. */
2521
2536
  async hasAPIKey() {
2522
- return await this._fetch(Ct) !== null;
2537
+ return await this._fetch(At) !== null;
2523
2538
  }
2524
2539
  /** Returns the sign-in methods registered for the current user's email. */
2525
2540
  async getSignInMethods() {
2526
2541
  const t = this._auth.currentUser;
2527
2542
  if (!t?.email) throw new Error("User has no e-mail");
2528
- return ze(this._auth.firebaseAuth, t.email);
2543
+ return Be(this._auth.firebaseAuth, t.email);
2529
2544
  }
2530
2545
  /** Builds a human-readable label from a Firebase UserInfo provider entry. */
2531
2546
  buildProviderLabel(t) {
@@ -2538,14 +2553,14 @@ class Nt {
2538
2553
  }
2539
2554
  /** Links a Google or Microsoft provider to the current account via popup. Returns the new provider label. */
2540
2555
  async linkProvider(t) {
2541
- const e = this._requireUser(), o = t === "google.com" ? new at() : new it(t), s = (await Ne(e, o)).user.providerData.find(
2556
+ const e = this._requireUser(), o = t === "google.com" ? new at() : new it(t), s = (await Ge(e, o)).user.providerData.find(
2542
2557
  (a) => a.providerId === t
2543
2558
  );
2544
2559
  return s ? this.buildProviderLabel(s) : "-";
2545
2560
  }
2546
2561
  /** Unlinks a provider from the current account. */
2547
2562
  async unlinkProvider(t) {
2548
- await $e(this._requireUser(), t);
2563
+ await He(this._requireUser(), t);
2549
2564
  }
2550
2565
  /** Changes the password. Reauthenticates first. */
2551
2566
  async updatePassword(t, e) {
@@ -2554,13 +2569,13 @@ class Nt {
2554
2569
  await bt(
2555
2570
  o,
2556
2571
  Q.credential(o.email, t)
2557
- ), await Fe(o, e);
2572
+ ), await We(o, e);
2558
2573
  }
2559
2574
  /** Adds (sets) a password for an account that currently only uses SSO. */
2560
2575
  async addPassword(t) {
2561
2576
  const e = this._requireUser();
2562
2577
  if (!e.email) throw new Error("User has no e-mail");
2563
- await Be(e, Q.credential(e.email, t));
2578
+ await Ve(e, Q.credential(e.email, t));
2564
2579
  }
2565
2580
  /** Requests an e-mail change. Sends a verification e-mail to the new address. */
2566
2581
  async updateEmail(t, e) {
@@ -2569,11 +2584,11 @@ class Nt {
2569
2584
  await bt(
2570
2585
  o,
2571
2586
  Q.credential(o.email, e)
2572
- ), await Ge(o, t), await He(o);
2587
+ ), await Ke(o, t), await Qe(o);
2573
2588
  }
2574
2589
  /** Creates a new API key for the current user. */
2575
2590
  async createAPIKey(t) {
2576
- return this._fetch(Tt, {
2591
+ return this._fetch(Pt, {
2577
2592
  method: "POST",
2578
2593
  headers: { "Content-Type": "application/json" },
2579
2594
  body: JSON.stringify({ expiration: t })
@@ -2582,7 +2597,7 @@ class Nt {
2582
2597
  /** Revokes the current user's API key. */
2583
2598
  async revokeAPIKey() {
2584
2599
  const t = await this._auth.authenticatedFetch(
2585
- this._url(Tt),
2600
+ this._url(Pt),
2586
2601
  { method: "DELETE" }
2587
2602
  );
2588
2603
  if (!t.ok)
@@ -2590,7 +2605,7 @@ class Nt {
2590
2605
  }
2591
2606
  /** Fetches the current user's existing API key. */
2592
2607
  async requestAPIKey() {
2593
- const t = await this._fetch(Ct);
2608
+ const t = await this._fetch(At);
2594
2609
  if (!t) throw new Error("No API key found");
2595
2610
  return t;
2596
2611
  }
@@ -2612,7 +2627,7 @@ class Nt {
2612
2627
  * Uses the `getUserInfo` Firebase callable function.
2613
2628
  */
2614
2629
  async getUserInfo(t) {
2615
- return (await B(this._functions, "getUserInfo")({ uids: t })).data;
2630
+ return (await F(this._functions, "getUserInfo")({ uids: t })).data;
2616
2631
  }
2617
2632
  /** Record that the current user has accepted the terms of service. Sets a `terms` custom claim on the token. */
2618
2633
  async acceptTerms(t) {
@@ -2633,7 +2648,7 @@ class Nt {
2633
2648
  return t ? (await st(t)).claims.terms ?? null : null;
2634
2649
  }
2635
2650
  }
2636
- const $t = ["superadmin", "admin", "syncer", "member"], Ft = {
2651
+ const Ht = ["superadmin", "admin", "syncer", "member"], Wt = {
2637
2652
  createEntities: "admin",
2638
2653
  createProvider: "superadmin",
2639
2654
  changeContentCategories: "syncer",
@@ -2665,7 +2680,7 @@ function rr() {
2665
2680
  viewEntities: !1
2666
2681
  };
2667
2682
  }
2668
- class Bt {
2683
+ class Vt {
2669
2684
  constructor(t) {
2670
2685
  this._isSuperAdmin = t, this._projectRoles = new x([]), this.privileges = ct(
2671
2686
  [this._projectRoles, t],
@@ -2694,17 +2709,17 @@ class Bt {
2694
2709
  _expand(t) {
2695
2710
  if (this._isSuperAdmin.get())
2696
2711
  return ["superadmin", "admin", "syncer", "member"];
2697
- const e = $t.findIndex((o) => t.includes(o));
2698
- return e === -1 ? [] : Array.from($t.slice(e));
2712
+ const e = Ht.findIndex((o) => t.includes(o));
2713
+ return e === -1 ? [] : Array.from(Ht.slice(e));
2699
2714
  }
2700
2715
  _compute() {
2701
2716
  const t = this._projectRoles.get(), e = rr();
2702
- for (const o of Object.keys(Ft))
2703
- e[o] = t.includes(Ft[o]);
2717
+ for (const o of Object.keys(Wt))
2718
+ e[o] = t.includes(Wt[o]);
2704
2719
  return e;
2705
2720
  }
2706
2721
  }
2707
- class Gt {
2722
+ class Kt {
2708
2723
  constructor(t) {
2709
2724
  this._storage = t;
2710
2725
  }
@@ -2737,7 +2752,7 @@ class Gt {
2737
2752
  // ── Internal helpers ───────────────────────────────────────────────────────
2738
2753
  async _get(t, e) {
2739
2754
  try {
2740
- const r = await (await Yt(_(this._storage, `${t}/${e}.json.gz`))).arrayBuffer(), s = new DecompressionStream("gzip"), a = s.writable.getWriter(), n = s.readable.getReader();
2755
+ const r = await (await ee(_(this._storage, `${t}/${e}.json.gz`))).arrayBuffer(), s = new DecompressionStream("gzip"), a = s.writable.getWriter(), n = s.readable.getReader();
2741
2756
  a.write(new Uint8Array(r)), a.close();
2742
2757
  const p = [];
2743
2758
  let c = await n.read();
@@ -2794,7 +2809,7 @@ const b = {
2794
2809
  dicu: "https://w3id.org/digitalconstruction/0.5/Units#",
2795
2810
  diclvl: "https://w3id.org/digitalconstruction/0.5/Levels#",
2796
2811
  dicstg: "https://w3id.org/digitalconstruction/0.5/Stages#"
2797
- }, R = {
2812
+ }, A = {
2798
2813
  madsrdf: "http://www.loc.gov/mads/rdf/v1#",
2799
2814
  bflc: "http://id.loc.gov/ontologies/bflc/",
2800
2815
  foaf: "http://xmlns.com/foaf/0.1/",
@@ -6043,12 +6058,12 @@ class gt {
6043
6058
  return r === void 0 ? t : t.replace(o, `${r}:`);
6044
6059
  }
6045
6060
  expandIRI(t) {
6046
- const e = t.split(":")[0], o = R[e] ?? b[e];
6061
+ const e = t.split(":")[0], o = A[e] ?? b[e];
6047
6062
  return t.replace(`${e}:`, o);
6048
6063
  }
6049
6064
  _buildNSMap() {
6050
6065
  const t = {};
6051
- return Object.keys(R).forEach((e) => t[R[e]] = e), Object.keys(b).forEach(
6066
+ return Object.keys(A).forEach((e) => t[A[e]] = e), Object.keys(b).forEach(
6052
6067
  (e) => t[b[e]] = e
6053
6068
  ), this._nsMap = t, t;
6054
6069
  }
@@ -6133,7 +6148,7 @@ class ar {
6133
6148
  }
6134
6149
  _buildCategoriesQuery(t, e) {
6135
6150
  return `PREFIX qcy: <${b.qcy}>
6136
- PREFIX skos: <${R.skos}>
6151
+ PREFIX skos: <${A.skos}>
6137
6152
  SELECT ?iri ?parent (SAMPLE(?l) AS ?label)
6138
6153
  WHERE {
6139
6154
  ?iri a qcy:${e} .
@@ -6159,7 +6174,7 @@ GROUP BY ?iri ?parent`;
6159
6174
  }
6160
6175
  _buildRelationshipsQuery(t) {
6161
6176
  return `PREFIX qcy: <${b.qcy}>
6162
- PREFIX rdfs: <${R.rdfs}>
6177
+ PREFIX rdfs: <${A.rdfs}>
6163
6178
  SELECT ?iri ?parent (SAMPLE(?l) AS ?label)
6164
6179
  WHERE {
6165
6180
  ?x qcy:relatedEntity ?y ;
@@ -6183,7 +6198,7 @@ GROUP BY ?iri ?parent`;
6183
6198
  }
6184
6199
  }
6185
6200
  const ir = "https://qlever.dev/api/osm-planet";
6186
- class ce {
6201
+ class ue {
6187
6202
  constructor(t, e, o = dt, r, s) {
6188
6203
  this._api = t, this._projectId = e, this._queryCache = r, this._graphType = s, this.baseURL = `${o}${e}/`, this.entityInfoMap = this._entityInfoMapComputed, this.entityGraph = this._entityGraph.asReadonly(), this._entityOSMMap.subscribe(() => this._checkPendingOSMFetches()), this._fetchEntityGraph().catch(
6189
6204
  (a) => console.error("[CueProjectEntities] Entity graph fetch failed:", a)
@@ -6388,7 +6403,7 @@ WHERE {
6388
6403
  */
6389
6404
  async contentCategoriesInProject(t = !0) {
6390
6405
  const e = this._api.language, o = `PREFIX qcy: <${b.qcy}>
6391
- PREFIX skos: <${R.skos}>
6406
+ PREFIX skos: <${A.skos}>
6392
6407
  SELECT ?iri (SAMPLE(?l) AS ?label) ?count
6393
6408
  WHERE {
6394
6409
  ?iri a qcy:EntityCategory .
@@ -6619,7 +6634,7 @@ GROUP BY ?e1Cat ?e2Cat`;
6619
6634
  async _fetchOSMLocations(t) {
6620
6635
  const e = t.filter((n) => !n.includes("/relation/"));
6621
6636
  if (e.length === 0) return;
6622
- const o = e.map((n) => `<${n}>`).join(" "), r = `PREFIX geo: <${R.geo}>
6637
+ const o = e.map((n) => `<${n}>`).join(" "), r = `PREFIX geo: <${A.geo}>
6623
6638
  SELECT * WHERE {
6624
6639
  VALUES ?s { ${o} }
6625
6640
  SERVICE <${ir}> {
@@ -6773,44 +6788,30 @@ class pt {
6773
6788
  * ```
6774
6789
  */
6775
6790
  async fetchAlternativeRepresentations(t) {
6776
- const e = this._api.language, o = `PREFIX qcy: <${b.qcy}>
6791
+ const e = `PREFIX qcy: <${b.qcy}>
6777
6792
  PREFIX r: <${this.baseURL}>
6778
- SELECT ?altId ?contentIRI ?suffix ?size ?subject ?summary
6779
- (SAMPLE(?fp) AS ?path)
6780
- (GROUP_CONCAT(DISTINCT ?tag; SEPARATOR=";") AS ?tags)
6781
- (GROUP_CONCAT(DISTINCT STR(?cat); SEPARATOR=";") AS ?categories)
6793
+ SELECT ?altId ?contentIRI ?suffix ?rrp
6782
6794
  WHERE {
6783
6795
  r:${t} qcy:alternativeRepresentation ?contentIRI .
6784
6796
  BIND(REPLACE(STR(?contentIRI), "^.*/([^/]*)$", "$1") AS ?altId)
6785
- ?contentIRI qcy:sizeBytes ?size ;
6786
- qcy:hasFileLocation ?loc .
6787
- ?loc qcy:filePath ?fp ;
6788
- qcy:suffix ?suffix .
6789
- OPTIONAL { ?contentIRI qcy:hasContentCategory ?cat }
6790
- OPTIONAL { ?contentIRI qcy:tag ?tag }
6791
- OPTIONAL { ?contentIRI qcy:subject ?lang_subj FILTER(LANG(?lang_subj) = "${e}") }
6792
- OPTIONAL { ?contentIRI qcy:subject ?no_lang_subj }
6793
- BIND(COALESCE(?lang_subj, ?no_lang_subj) AS ?subject)
6794
- OPTIONAL { ?contentIRI qcy:textSummary ?lang_summary FILTER(LANG(?lang_summary) = "${e}") }
6795
- OPTIONAL { ?contentIRI qcy:textSummary ?no_lang_summary }
6796
- BIND(COALESCE(?lang_summary, ?no_lang_summary) AS ?summary)
6797
- }
6798
- GROUP BY ?altId ?contentIRI ?suffix ?size ?subject ?summary`, r = await this._api.sparql(o, this._projectId, this._graphType), s = { ...this._documentInfoMap.get() }, a = [];
6799
- return r.results.bindings.forEach((n) => {
6800
- if (!n.altId || !n.contentIRI) return;
6801
- const p = n.altId.value, c = {
6802
- id: p,
6803
- contentIRI: n.contentIRI.value,
6804
- path: n.path?.value ?? "",
6805
- suffix: n.suffix?.value ?? "",
6806
- size: n.size ? parseInt(n.size.value, 10) : 0,
6807
- tags: n.tags?.value?.split(";").filter(Boolean) ?? [],
6808
- categories: n.categories?.value?.split(";").filter(Boolean) ?? [],
6809
- subject: n.subject?.value,
6810
- summary: n.summary?.value
6797
+ ?contentIRI qcy:hasFileLocation ?loc .
6798
+ ?loc qcy:suffix ?suffix .
6799
+ OPTIONAL { ?loc qcy:remoteRelativePath ?rrp }
6800
+ }`, o = await this._api.sparql(e, this._projectId, this._graphType), r = { ...this._documentInfoMap.get() }, s = [];
6801
+ return o.results.bindings.forEach((a) => {
6802
+ if (!a.altId || !a.contentIRI) return;
6803
+ const n = a.altId.value, p = {
6804
+ id: n,
6805
+ contentIRI: a.contentIRI.value,
6806
+ path: "",
6807
+ suffix: a.suffix?.value ?? "",
6808
+ size: 0,
6809
+ tags: [],
6810
+ categories: [],
6811
+ remoteRelativePath: a.rrp?.value
6811
6812
  };
6812
- s[p] = c, a.push(c);
6813
- }), this._documentInfoMap.set(s), a;
6813
+ r[n] = p, s.push(p);
6814
+ }), this._documentInfoMap.set(r), s;
6814
6815
  }
6815
6816
  /**
6816
6817
  * Returns a single arbitrary file path from the project's triplestore.
@@ -6988,7 +6989,7 @@ WHERE {
6988
6989
  }
6989
6990
  class nr {
6990
6991
  constructor(t, e, { language: o, queryCache: r, rdfBase: s = dt, graphType: a }) {
6991
- this._api = t, this._projectId = e, this.schema = new ar(t, e, o, r, a), this.entities = new ce(t, e, s, r, a), this.documents = new pt(t, e, o, s, r, a), 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));
6992
+ this._api = t, this._projectId = e, this.schema = new ar(t, e, o, r, a), this.entities = new ue(t, e, s, r, a), this.documents = new pt(t, e, o, s, r, a), 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));
6992
6993
  }
6993
6994
  _api;
6994
6995
  _projectId;
@@ -7106,7 +7107,7 @@ class nr {
7106
7107
  this._destroyed = !0, this._searchResults.set(void 0);
7107
7108
  }
7108
7109
  }
7109
- function Ht(i, t) {
7110
+ function Qt(i, t) {
7110
7111
  return new Promise((e) => {
7111
7112
  const o = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Map();
7112
7113
  for (const m of i)
@@ -8011,14 +8012,14 @@ function hr(i) {
8011
8012
  const t = i.split(".");
8012
8013
  return t.length > 1 ? "." + t.pop()?.toLowerCase() : "";
8013
8014
  }
8014
- const { namedNode: dr, literal: Ar } = j;
8015
+ const { namedNode: dr, literal: Rr } = j;
8015
8016
  dr("http://www.w3.org/1999/02/22-rdf-syntax-ns#type");
8016
- const { namedNode: gr, literal: Rr } = j;
8017
+ const { namedNode: gr, literal: Ar } = j;
8017
8018
  gr("http://www.w3.org/1999/02/22-rdf-syntax-ns#type");
8018
- function Wt(i, t, e, o, r, s, a, n = !1, p = !1) {
8019
+ function Xt(i, t, e, o, r, s, a, n = !1, p = !1) {
8019
8020
  const c = hr(i), h = D(o), d = `${t}/${h}${c}`;
8020
8021
  a === void 0 && (a = pr[c]?.mime ?? "application/octet-stream");
8021
- const g = Ye(i, r);
8022
+ const g = to(i, r);
8022
8023
  return {
8023
8024
  name: i,
8024
8025
  blob_name: d,
@@ -8038,37 +8039,37 @@ function Wt(i, t, e, o, r, s, a, n = !1, p = !1) {
8038
8039
  })
8039
8040
  };
8040
8041
  }
8041
- async function M() {
8042
+ async function U() {
8042
8043
  return import(
8043
8044
  /* webpackIgnore: true */
8044
8045
  "fs/promises"
8045
8046
  );
8046
8047
  }
8047
- async function Vt(i) {
8048
+ async function Yt(i) {
8048
8049
  if (typeof window < "u")
8049
8050
  throw new Error(
8050
8051
  `Cannot read file from path "${i}" in a browser environment. Provide file.data (Uint8Array) instead.`
8051
8052
  );
8052
- const { readFile: t } = await M();
8053
+ const { readFile: t } = await U();
8053
8054
  return t(i);
8054
8055
  }
8055
- let q = null, H = null, W = null;
8056
- function Or(i) {
8057
- W = i, H = null, q = null;
8056
+ let q = null, G = null, H = null;
8057
+ function Pr(i) {
8058
+ H = i, G = null, q = null;
8058
8059
  }
8059
8060
  async function ur() {
8060
8061
  if (typeof window < "u") {
8061
- if (!W)
8062
+ if (!H)
8062
8063
  throw new Error(
8063
8064
  "WASM scanner is not configured for browser use. Call configureScanWasm(baseUrl) during app initialisation."
8064
8065
  );
8065
- const i = await fetch(`${W}/dir_scanner_wasm_bg.wasm`);
8066
+ const i = await fetch(`${H}/dir_scanner_wasm_bg.wasm`);
8066
8067
  if (!i.ok)
8067
8068
  throw new Error(`Failed to fetch WASM binary: ${i.status} ${i.statusText}`);
8068
- const t = new Uint8Array(await i.arrayBuffer()), o = await import(`${W}/dir_scanner_wasm.mjs`);
8069
+ const t = new Uint8Array(await i.arrayBuffer()), o = await import(`${H}/dir_scanner_wasm.mjs`);
8069
8070
  await o.default({ module_or_path: t }), q = o.scan;
8070
8071
  } else {
8071
- const { readFile: i } = await M(), { join: t } = await import(
8072
+ const { readFile: i } = await U(), { join: t } = await import(
8072
8073
  /* webpackIgnore: true */
8073
8074
  "path"
8074
8075
  ), { pathToFileURL: e } = await import(
@@ -8089,25 +8090,25 @@ async function mt(i) {
8089
8090
  );
8090
8091
  return e(t(), `cue-sync-pending-${i}.json`);
8091
8092
  }
8092
- async function Kt(i) {
8093
+ async function Zt(i) {
8093
8094
  if (typeof window < "u") {
8094
8095
  const t = window.localStorage.getItem(`${ut}${i}`);
8095
8096
  return t ? JSON.parse(t) : null;
8096
8097
  }
8097
8098
  try {
8098
- const t = await (await M()).readFile(await mt(i), "utf-8");
8099
+ const t = await (await U()).readFile(await mt(i), "utf-8");
8099
8100
  return JSON.parse(t);
8100
8101
  } catch {
8101
8102
  return null;
8102
8103
  }
8103
8104
  }
8104
- async function Qt(i) {
8105
+ async function Jt(i) {
8105
8106
  const t = JSON.stringify(i);
8106
8107
  if (typeof window < "u") {
8107
8108
  window.localStorage.setItem(`${ut}${i.spaceId}`, t);
8108
8109
  return;
8109
8110
  }
8110
- await (await M()).writeFile(await mt(i.spaceId), t, "utf-8");
8111
+ await (await U()).writeFile(await mt(i.spaceId), t, "utf-8");
8111
8112
  }
8112
8113
  async function wr(i) {
8113
8114
  if (typeof window < "u") {
@@ -8115,7 +8116,7 @@ async function wr(i) {
8115
8116
  return;
8116
8117
  }
8117
8118
  try {
8118
- await (await M()).unlink(await mt(i));
8119
+ await (await U()).unlink(await mt(i));
8119
8120
  } catch {
8120
8121
  }
8121
8122
  }
@@ -8175,7 +8176,7 @@ class fr {
8175
8176
  */
8176
8177
  async flushPendingMetadata(t, e, o) {
8177
8178
  this._legacy = o ?? !1;
8178
- const r = await Kt(t);
8179
+ const r = await Zt(t);
8179
8180
  if (!(!r || r.items.length === 0)) {
8180
8181
  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 ⏳`);
8181
8182
  try {
@@ -8198,14 +8199,14 @@ class fr {
8198
8199
  this._api?.getConsumption(o) ?? Promise.reject(new Error("CueSyncApi is not bound to a CueApi instance")),
8199
8200
  this._fetchUnitCreditMap(s),
8200
8201
  this._fetchTierNames()
8201
- ]), f = (await Ht(t, h)).localNotOnRemote ?? [], k = f.length > 0 ? await this.scanCost(f) : [];
8202
+ ]), f = (await Qt(t, h)).localNotOnRemote ?? [], k = f.length > 0 ? await this.scanCost(f) : [];
8202
8203
  let m = 0, E = 0;
8203
8204
  for (const v of k) {
8204
8205
  m += v.units;
8205
8206
  const y = g[c], C = y?.[v.ext] ?? 1;
8206
8207
  s && y && !(v.ext in y) && console.info(` Unknown format: .${v.ext} (using default rate of 1 credit/unit)`);
8207
- const O = v.units * C;
8208
- E += O, v.credits = Math.round(O);
8208
+ const P = v.units * C;
8209
+ E += P, v.credits = Math.round(P);
8209
8210
  }
8210
8211
  const I = w[c] ?? c;
8211
8212
  return {
@@ -8230,14 +8231,14 @@ class fr {
8230
8231
  const [d, g] = await Promise.all([
8231
8232
  this._listRemoteFiles(h, o, r, a),
8232
8233
  this._api?.getConsumption(o) ?? Promise.reject(new Error("CueSyncApi is not bound to a CueApi instance"))
8233
- ]), { unitsAvailable: w } = g, u = await Ht(t, d);
8234
+ ]), { unitsAvailable: w } = g, u = await Qt(t, d);
8234
8235
  a && (console.info(`Total local files: ${t.length}`), console.info(`Total remote files: ${d.length}`), console.info(
8235
8236
  `Total files to sync: ${(u.localNotOnRemote?.length ?? 0) + u.localNotOnRemotePathOnly.length}`
8236
8237
  ));
8237
8238
  let f = u.syncCount, k = u.syncSize, m = 0, E = !1;
8238
8239
  const I = u.localNotOnRemote ?? [];
8239
8240
  if (I.length > 0) {
8240
- const C = (await this.scanCost(I)).reduce((O, de) => O + de.units, 0);
8241
+ const C = (await this.scanCost(I)).reduce((P, we) => P + we.units, 0);
8241
8242
  if (C > w)
8242
8243
  throw new Error(
8243
8244
  `Insufficient units: ${C} units required but only ${w} available.`
@@ -8246,7 +8247,7 @@ class fr {
8246
8247
  await this._initPendingBatch(o, a), a && I.length && console.info("Syncing missing files ⏳");
8247
8248
  for (const y of I)
8248
8249
  try {
8249
- const C = Wt(
8250
+ const C = Xt(
8250
8251
  y.relativePath,
8251
8252
  o,
8252
8253
  s,
@@ -8254,10 +8255,10 @@ class fr {
8254
8255
  r
8255
8256
  );
8256
8257
  if (!C.blob_name) throw new Error(`blob_name missing for ${y.relativePath}`);
8257
- const O = y.data ?? new Uint8Array(await Vt(y.fullPath));
8258
+ const P = y.data ?? new Uint8Array(await Yt(y.fullPath));
8258
8259
  await this._blob.uploadRaw(
8259
8260
  C.blob_name,
8260
- O,
8261
+ P,
8261
8262
  C
8262
8263
  ), await this._queueFileLocation({
8263
8264
  relativePath: y.relativePath,
@@ -8293,7 +8294,7 @@ class fr {
8293
8294
  async _getOrCreateGraph(t, e) {
8294
8295
  const o = this._graphMap.get(t);
8295
8296
  if (o) return o;
8296
- const s = (await this._projects.getProject(t))?.projectSettings?.graph?.type ?? mr, a = s === "qlever" ? `${this._gatewayUrl}${oe}` : `${this._gatewayUrl}${ee}`, n = s === "qlever" ? `${this._gatewayUrl}${co}` : `${this._gatewayUrl}${po}`, p = new Ke({
8297
+ const s = (await this._projects.getProject(t))?.projectSettings?.graph?.type ?? mr, a = s === "qlever" ? `${this._gatewayUrl}${ie}` : `${this._gatewayUrl}${ae}`, n = s === "qlever" ? `${this._gatewayUrl}${co}` : `${this._gatewayUrl}${po}`, p = new Ze({
8297
8298
  graphType: s,
8298
8299
  queryEndpoint: a,
8299
8300
  updateEndpoint: n,
@@ -8359,7 +8360,7 @@ WHERE {
8359
8360
  }
8360
8361
  async _initPendingBatch(t, e) {
8361
8362
  this._flushTimer !== null && (clearInterval(this._flushTimer), this._flushTimer = null), this._pendingSpaceId = t, this._pendingItems = [];
8362
- const o = await Kt(t);
8363
+ const o = await Zt(t);
8363
8364
  if (o && o.items.length > 0) {
8364
8365
  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 ⏳`);
8365
8366
  try {
@@ -8380,7 +8381,7 @@ WHERE {
8380
8381
  typeof r == "object" && typeof r.unref == "function" && r.unref(), this._flushTimer = r;
8381
8382
  }
8382
8383
  async _queueFileLocation(t) {
8383
- this._pendingItems.push(t), this._pendingSpaceId && await Qt({ spaceId: this._pendingSpaceId, items: this._pendingItems });
8384
+ this._pendingItems.push(t), this._pendingSpaceId && await Jt({ spaceId: this._pendingSpaceId, items: this._pendingItems });
8384
8385
  }
8385
8386
  /**
8386
8387
  * Flush all queued file-location items to the commands API in a single batch.
@@ -8402,11 +8403,11 @@ WHERE {
8402
8403
  o && console.info(`Wrote ${r.length} file location(s) to commands API ✅`);
8403
8404
  } catch (s) {
8404
8405
  const a = [...r, ...this._pendingItems];
8405
- throw this._pendingItems = a, await Qt({ spaceId: e, items: a }), s;
8406
+ throw this._pendingItems = a, await Jt({ spaceId: e, items: a }), s;
8406
8407
  }
8407
8408
  }
8408
8409
  async _postFssBatch(t, e) {
8409
- const o = this._legacy ? `${this._gatewayUrl}${St}?blob=true` : `${this._gatewayUrl}${St}`;
8410
+ const o = this._legacy ? `${this._gatewayUrl}${Ot}?blob=true` : `${this._gatewayUrl}${Ot}`;
8410
8411
  let r;
8411
8412
  try {
8412
8413
  r = await this._auth.authenticatedFetch(o, {
@@ -8436,14 +8437,14 @@ WHERE {
8436
8437
  * shown to the user before or after calling {@link sync}.
8437
8438
  */
8438
8439
  async scanCost(t) {
8439
- if (H || (H = ur()), await H, !q) throw new Error("WASM scan function not initialised");
8440
+ if (G || (G = ur()), await G, !q) throw new Error("WASM scan function not initialised");
8440
8441
  const e = 200, o = /* @__PURE__ */ new Map();
8441
8442
  for (let r = 0; r < t.length; r += e) {
8442
8443
  const s = t.slice(r, r + e), a = await Promise.all(
8443
8444
  s.map(async (p) => ({
8444
8445
  originalPath: p.relativePath,
8445
8446
  // Use pre-loaded data if available (browser), otherwise read from disk (Node.js).
8446
- data: p.data ?? new Uint8Array(await Vt(p.fullPath))
8447
+ data: p.data ?? new Uint8Array(await Yt(p.fullPath))
8447
8448
  }))
8448
8449
  ), n = q(a);
8449
8450
  for (const p of n) {
@@ -8503,7 +8504,7 @@ WHERE {
8503
8504
  const { spaceId: o, providerId: r, userId: s, signal: a, onProgress: n } = e;
8504
8505
  if (!t.data)
8505
8506
  throw new Error("syncBrowserFile requires file.data (Uint8Array). Read the file with File.arrayBuffer() first.");
8506
- const p = Wt(t.relativePath, o, s, t.md5, r);
8507
+ const p = Xt(t.relativePath, o, s, t.md5, r);
8507
8508
  if (!p.blob_name) throw new Error(`blob_name missing for ${t.relativePath}`);
8508
8509
  await this._blob.uploadRaw(
8509
8510
  p.blob_name,
@@ -8547,7 +8548,7 @@ WHERE {
8547
8548
  s({ percent: a, syncCount: t, totalCount: e, syncSize: o, totalSize: r });
8548
8549
  }
8549
8550
  }
8550
- const Xt = {
8551
+ const te = {
8551
8552
  production: {
8552
8553
  gatewayUrl: "https://accessors-api-gateway-ueyeemwf2a-oa.a.run.app",
8553
8554
  tokenUrl: "https://accessors-api-gateway-ueyeemwf2a-oa.a.run.app/token",
@@ -8567,7 +8568,7 @@ const Xt = {
8567
8568
  firestoreEmulatorPort: 8080
8568
8569
  }
8569
8570
  };
8570
- class he {
8571
+ class me {
8571
8572
  auth;
8572
8573
  api;
8573
8574
  projects;
@@ -8604,21 +8605,30 @@ class he {
8604
8605
  "Using default SDK app settings. Contact QAECY for your own configuration for any production code."
8605
8606
  );
8606
8607
  const o = t.apiKey ?? Y.apiKey, r = t.appId ?? Y.appId, s = t.measurementId ?? Y.measurementId, a = t.environment ?? "production";
8607
- this._endpoints = { ...Xt[a], ...t.endpoints }, this._isEmulator = a === "emulator", this._app = ge().find((p) => p.name === "[DEFAULT]") ?? ue({
8608
+ this._endpoints = { ...te[a], ...t.endpoints }, this._isEmulator = a === "emulator", this._app = fe().find((g) => g.name === "[DEFAULT]") ?? ye({
8608
8609
  apiKey: o,
8609
8610
  appId: r,
8610
8611
  measurementId: s,
8611
- authDomain: `${_t}.firebaseapp.com`,
8612
- projectId: _t,
8613
- messagingSenderId: Ze
8614
- }), this.auth = new Ot(this._app, this._isEmulator, this._endpoints), this.projects = new zt(this.auth, this._app, this._isEmulator, this._endpoints), this._storageRaw = T(this._app, Et), this._storageProcessed = T(this._app, xt), this._isEmulator && (K(this._storageRaw, this._endpoints.storageEmulatorHost, this._endpoints.storageEmulatorPort), K(this._storageProcessed, this._endpoints.storageEmulatorHost, this._endpoints.storageEmulatorPort)), this.api = this._buildApi(this.projects), this.storage = new Pt(this._storageRaw, this._storageProcessed), this.profile = new Nt(
8612
+ authDomain: `${kt}.firebaseapp.com`,
8613
+ projectId: kt,
8614
+ messagingSenderId: eo
8615
+ }), this.auth = new qt(this._app, this._isEmulator, this._endpoints), this.projects = new Bt(this.auth, this._app, this._isEmulator, this._endpoints), this._storageRaw = T(this._app, It), this._storageProcessed = T(this._app, Ct);
8616
+ const n = T(this._app, St), p = T(this._app, Tt), c = T(this._app, xt), h = T(this._app, Rt);
8617
+ this._isEmulator && (K(this._storageRaw, this._endpoints.storageEmulatorHost, this._endpoints.storageEmulatorPort), K(this._storageProcessed, this._endpoints.storageEmulatorHost, this._endpoints.storageEmulatorPort)), this.api = this._buildApi(this.projects);
8618
+ const d = new vt({
8619
+ storageRaw: this._storageRaw,
8620
+ storageProcessed: this._storageProcessed,
8621
+ storagePublic: n,
8622
+ storageLogs: p,
8623
+ storageChatSessions: c,
8624
+ storagePersistence: h
8625
+ });
8626
+ this.storage = new jt(d), this.profile = new Gt(
8615
8627
  this.auth,
8616
8628
  this._app,
8617
8629
  this._isEmulator,
8618
8630
  this._endpoints.gatewayUrl
8619
- ), this.privileges = new Bt(this.auth.isSuperAdmin);
8620
- const n = T(this._app, It);
8621
- this._isEmulator && K(n, this._endpoints.storageEmulatorHost, this._endpoints.storageEmulatorPort), this.cache = new Gt(n);
8631
+ ), this.privileges = new Vt(this.auth.isSuperAdmin), this._isEmulator && K(h, this._endpoints.storageEmulatorHost, this._endpoints.storageEmulatorPort), this.cache = new Kt(h);
8622
8632
  }
8623
8633
  /**
8624
8634
  * Create a `Cue` instance from an already-initialized Firebase app.
@@ -8637,16 +8647,16 @@ class he {
8637
8647
  * });
8638
8648
  */
8639
8649
  static fromApp(t, e = {}) {
8640
- const o = e.environment ?? "production", r = { ...Xt[o], ...e.endpoints }, s = new Ot(t, !1, r), a = new zt(s, t, !1, r), n = T(t, Et), p = T(t, xt), c = T(t, eo), h = T(t, to), d = T(t, Je), g = T(t, It), w = new Qe({
8650
+ const o = e.environment ?? "production", r = { ...te[o], ...e.endpoints }, s = new qt(t, !1, r), a = new Bt(s, t, !1, r), n = T(t, It), p = T(t, Ct), c = T(t, St), h = T(t, Tt), d = T(t, xt), g = T(t, Rt), w = new vt({
8641
8651
  storageRaw: n,
8642
8652
  storageProcessed: p,
8643
8653
  storagePublic: c,
8644
8654
  storageLogs: h,
8645
8655
  storageChatSessions: d,
8646
8656
  storagePersistence: g
8647
- }), u = new fr(s, a, w, r.gatewayUrl), f = new Dt(s, r.gatewayUrl, a, u);
8657
+ }), u = new fr(s, a, w, r.gatewayUrl), f = new Ut(s, r.gatewayUrl, a, u);
8648
8658
  u._bindApi(f);
8649
- const k = new Nt(s, t, !1, r.gatewayUrl), m = Object.create(he.prototype), E = new Bt(s.isSuperAdmin), I = new Gt(g), v = new Pt(n, p);
8659
+ const k = new Gt(s, t, !1, r.gatewayUrl), m = Object.create(me.prototype), E = new Vt(s.isSuperAdmin), I = new Kt(g), v = new jt(w);
8650
8660
  return Object.assign(m, {
8651
8661
  _app: t,
8652
8662
  _endpoints: r,
@@ -8664,7 +8674,7 @@ class he {
8664
8674
  }
8665
8675
  /** Override in subclasses to provide a custom CueApi (e.g. with sync). */
8666
8676
  _buildApi(t) {
8667
- return new Dt(this.auth, this._endpoints.gatewayUrl, t);
8677
+ return new Ut(this.auth, this._endpoints.gatewayUrl, t);
8668
8678
  }
8669
8679
  /** Convenience: get the current user's Firebase ID token */
8670
8680
  getToken(t = !1) {
@@ -8713,7 +8723,7 @@ class he {
8713
8723
  get: (r) => this.cache.getQueryCache(t, r).then((s) => s?.results),
8714
8724
  set: (r, s) => this.cache.setQueryCache(t, r, { query: r, results: s })
8715
8725
  };
8716
- return new ce(
8726
+ return new ue(
8717
8727
  this.api,
8718
8728
  t,
8719
8729
  e?.rdfBase,
@@ -8768,29 +8778,29 @@ class he {
8768
8778
  }
8769
8779
  }
8770
8780
  export {
8771
- Je as B,
8772
- he as C,
8773
- Ft as R,
8774
- Dt as a,
8775
- Ot as b,
8776
- Gt as c,
8781
+ xt as B,
8782
+ me as C,
8783
+ Wt as R,
8784
+ Ut as a,
8785
+ qt as b,
8786
+ Kt as c,
8777
8787
  or as d,
8778
- Bt as e,
8779
- Nt as f,
8788
+ Vt as e,
8789
+ Gt as f,
8780
8790
  pt as g,
8781
- ce as h,
8791
+ ue as h,
8782
8792
  ar as i,
8783
8793
  nr as j,
8784
- zt as k,
8794
+ Bt as k,
8785
8795
  x as l,
8786
- Pt as m,
8796
+ jt as m,
8787
8797
  fr as n,
8788
8798
  mo as o,
8789
- Or as p,
8799
+ Pr as p,
8790
8800
  ct as q,
8791
- to as r,
8801
+ Tt as r,
8792
8802
  ht as s,
8793
- It as t,
8794
- eo as u,
8795
- Qe as v
8803
+ Rt as t,
8804
+ St as u,
8805
+ vt as v
8796
8806
  };