@qaecy/cue-sdk 0.0.25 → 0.0.27

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 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";
1
+ import { getApps as ye, initializeApp as be } from "firebase/app";
2
+ import { ref as _, getDownloadURL as V, getMetadata as M, getBlob as oe, updateMetadata as ve, uploadBytesResumable as wt, uploadBytes as rt, StringFormat as _e, uploadString as ke, listAll as z, getStorage as T, connectStorageEmulator as K } from "firebase/storage";
3
+ import { Writer as Ee, DataFactory as j } from "n3";
4
+ import { getFirestore as xe, connectFirestoreEmulator as Ie, collection as ft, getDocs as Ce, query as Te, where as Se, limit as Re, doc as yt, getDoc as Ae, setDoc as Pe, serverTimestamp as Oe, increment as De } from "firebase/firestore";
5
+ import { getAuth as Le, connectAuthEmulator as qe, onIdTokenChanged as je, getIdTokenResult as st, signInWithEmailAndPassword as Ue, GoogleAuthProvider as at, OAuthProvider as it, signInWithPopup as Me, signInWithRedirect as ze, getRedirectResult as Ne, signInWithCustomToken as bt, signOut as $e, onAuthStateChanged as Fe, fetchSignInMethodsForEmail as Be, linkWithPopup as Ge, unlink as He, reauthenticateWithCredential as vt, EmailAuthProvider as Q, updatePassword as We, linkWithCredential as Ve, verifyBeforeUpdateEmail as Ke, sendEmailVerification as Qe } from "firebase/auth";
6
6
  import { v5 as Xe } from "uuid";
7
7
  import "spark-md5";
8
- import { getFunctions as oe, connectFunctionsEmulator as re, httpsCallable as F } from "firebase/functions";
8
+ import { getFunctions as re, connectFunctionsEmulator as se, httpsCallable as F } from "firebase/functions";
9
9
  class lt {
10
10
  queryEndpoint;
11
11
  updateEndpoint;
@@ -223,7 +223,7 @@ class R {
223
223
  }
224
224
  _quadsToNQuads(t) {
225
225
  return new Promise((e, o) => {
226
- const r = new ke({ format: "application/n-quads" });
226
+ const r = new Ee({ format: "application/n-quads" });
227
227
  r.addQuads(t), r.end((s, a) => s ? o(s) : e(a));
228
228
  });
229
229
  }
@@ -298,7 +298,7 @@ class Ze {
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 vt {
301
+ class _t {
302
302
  constructor(t) {
303
303
  this.options = t;
304
304
  }
@@ -356,7 +356,7 @@ class vt {
356
356
  async getFile(t, e) {
357
357
  const o = _(this._bucket(t), e);
358
358
  try {
359
- return await ee(o);
359
+ return await oe(o);
360
360
  } catch (r) {
361
361
  if (r?.code === "storage/object-not-found") return;
362
362
  throw r;
@@ -414,7 +414,7 @@ class vt {
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 be(r, { customMetadata: o });
417
+ await ve(r, { customMetadata: o });
418
418
  }
419
419
  // ─── Uploads ──────────────────────────────────────────────────────────────
420
420
  /**
@@ -446,9 +446,9 @@ class vt {
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 = ve.RAW, s) {
449
+ async uploadString(t, e, o, r = _e.RAW, s) {
450
450
  const a = _(this._bucket(t), e);
451
- await _e(a, o, r, s ? { customMetadata: s } : void 0);
451
+ await ke(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. */
@@ -540,7 +540,7 @@ class vt {
540
540
  return (await z(e)).items.map((r) => r.name);
541
541
  }
542
542
  }
543
- const _t = {
543
+ const kt = {
544
544
  ä: "ae",
545
545
  ä: "ae",
546
546
  Ä: "AE",
@@ -580,14 +580,14 @@ function D(i, t = !1) {
580
580
  }
581
581
  function Je(i, t = !1) {
582
582
  let e = i;
583
- for (const o in _t)
584
- e = e.replace(new RegExp(o, "g"), _t[o]);
583
+ for (const o in kt)
584
+ e = e.replace(new RegExp(o, "g"), kt[o]);
585
585
  return t && e !== i && console.info(`${i} -> ${e}`), e;
586
586
  }
587
587
  function to(i, t = "") {
588
588
  return D(`${t}${i}`);
589
589
  }
590
- class x {
590
+ class k {
591
591
  _value;
592
592
  _listeners = /* @__PURE__ */ new Set();
593
593
  constructor(t) {
@@ -646,13 +646,13 @@ const Y = {
646
646
  apiKey: "AIzaSyAiW42QBx9HS4Khu88pCW7MV66IhBAQul0",
647
647
  appId: "1:151132927589:web:d2ffdb377dfadfd23ab88c",
648
648
  measurementId: "G-YT4PK6HGZD"
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 {
649
+ }, Et = "qaecy-mvp-406413", eo = "734737865998", ae = "europe-west6", xt = "projects", It = "spaces_chats_eu_west6", Ct = "spaces_raw_eu_west6", Tt = "spaces_processed_eu_west6", St = "spaces_logs_eu_west6", Rt = "cue_public_eu_west6", At = "db_persistence_eu_west6", oo = "/data-views/admin/consumption", ro = "/data-views/admin/profile/organizations", Pt = "/data-views/admin/profile/api-keys", Ot = "/commands/admin/profile/api-keys", so = "/commands/admin/profile/terms", ao = (i) => `/data-views/admin/organizations/${i}/members`, io = "/commands/admin/project", no = (i) => `/commands/admin/project/${i}`, po = "/assistant/search", ie = "/triplestore/query", lo = "/triplestore/update", co = "/triplestore/shacl", ne = "/qlever-server/qlever/query", ho = "/qlever-server/qlever/update", go = "/qlever-server/qlever/shacl", Dt = "/commands/file-system-structure/batch", Lt = "microsoft.com", qt = "superadmin", dt = "https://cue.qaecy.com/r/";
650
+ class jt {
651
651
  _auth;
652
652
  _endpoints;
653
- _userSignal = new x(null);
654
- _tokenSignal = new x(null);
655
- _isSuperAdminSignal = new x(!1);
653
+ _userSignal = new k(null);
654
+ _tokenSignal = new k(null);
655
+ _isSuperAdminSignal = new k(!1);
656
656
  _userIdsSignal;
657
657
  _stopTokenListener;
658
658
  /** Reactive auth state — emits the signed-in `User`, or `null` when signed out. */
@@ -664,19 +664,19 @@ class qt {
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 = De(t), this._endpoints = o, e && Le(this._auth, o.authEmulatorUrl, {
667
+ this._auth = Le(t), this._endpoints = o, e && qe(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 = qe(this._auth, async (r) => {
674
+ }), this.userIds = this._userIdsSignal, this._stopTokenListener = je(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 === Lt);
679
+ this._isSuperAdminSignal.set(a.claims.role === qt);
680
680
  } else
681
681
  this._tokenSignal.set(null), this._isSuperAdminSignal.set(!1);
682
682
  });
@@ -689,14 +689,14 @@ class qt {
689
689
  if (t === "password") {
690
690
  if (!e)
691
691
  throw new Error("credentials are required for password sign-in");
692
- return (await je(
692
+ return (await Ue(
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(Dt);
699
- return (await Ue(this._auth, o)).user;
698
+ const o = t === "google" ? new at() : new it(Lt);
699
+ return (await Me(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 qt {
704
704
  * retrieve the result.
705
705
  */
706
706
  async signInWithRedirect(t) {
707
- const e = t === "google" ? new at() : new it(Dt);
708
- await Me(this._auth, e);
707
+ const e = t === "google" ? new at() : new it(Lt);
708
+ await ze(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 qt {
713
713
  * Call this once on app startup before showing a sign-in UI.
714
714
  */
715
715
  async checkRedirectResult() {
716
- return (await ze(this._auth))?.user ?? null;
716
+ return (await Ne(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 qt {
722
722
  */
723
723
  async checkSuperAdmin() {
724
724
  const t = this._auth.currentUser;
725
- return t ? (await st(t)).claims.role === Lt : !1;
725
+ return t ? (await st(t)).claims.role === qt : !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,7 +735,11 @@ class qt {
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 Ne(this._auth, s)).user;
738
+ return (await bt(this._auth, s)).user;
739
+ }
740
+ /** Sign in with a Firebase custom token (e.g. minted server-side for MCP/OAuth flows). */
741
+ async signInWithCustomToken(t) {
742
+ return (await bt(this._auth, t)).user;
739
743
  }
740
744
  /** Sign out the current user */
741
745
  async signOut() {
@@ -801,7 +805,7 @@ class qt {
801
805
  return this._auth;
802
806
  }
803
807
  }
804
- class jt {
808
+ class Ut {
805
809
  constructor(t) {
806
810
  this._blob = t;
807
811
  }
@@ -837,8 +841,8 @@ class jt {
837
841
  return e;
838
842
  }
839
843
  }
840
- const go = "/data-views/tables", uo = "/commands/tables";
841
- class mo {
844
+ const uo = "/data-views/tables", mo = "/commands/tables";
845
+ class wo {
842
846
  constructor(t, e) {
843
847
  this._auth = t, this._gatewayUrl = e;
844
848
  }
@@ -846,7 +850,7 @@ class mo {
846
850
  _gatewayUrl;
847
851
  async listTables(t) {
848
852
  const e = await this._auth.authenticatedFetch(
849
- `${this._gatewayUrl}${go}`,
853
+ `${this._gatewayUrl}${uo}`,
850
854
  {
851
855
  headers: {
852
856
  "Content-Type": "application/json",
@@ -861,7 +865,7 @@ class mo {
861
865
  }
862
866
  async saveTables(t, e) {
863
867
  const o = await this._auth.authenticatedFetch(
864
- `${this._gatewayUrl}${uo}`,
868
+ `${this._gatewayUrl}${mo}`,
865
869
  {
866
870
  method: "PUT",
867
871
  headers: {
@@ -876,15 +880,56 @@ class mo {
876
880
  throw new Error(`Failed to save tables: ${o.status} ${o.statusText}`);
877
881
  }
878
882
  }
879
- class Ut {
883
+ const fo = "/semantic-extraction/extract";
884
+ class yo {
885
+ constructor(t, e) {
886
+ this._auth = t, this._gatewayUrl = e;
887
+ }
888
+ _auth;
889
+ _gatewayUrl;
890
+ /**
891
+ * Run semantic extraction on a document page image.
892
+ *
893
+ * Sends a multipart/form-data POST to `/semantic-extraction/extract`.
894
+ * Always requests JSON-LD so the result can be displayed directly in
895
+ * `cue-rdf-graph` without any further parsing.
896
+ */
897
+ async extract(t) {
898
+ const e = t.rdfFormat ?? "json-ld", o = new FormData();
899
+ 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);
900
+ const r = await this._auth.authenticatedFetch(
901
+ `${this._gatewayUrl}${fo}`,
902
+ {
903
+ method: "POST",
904
+ // Do NOT set Content-Type; browser sets it with the correct boundary.
905
+ headers: {
906
+ Accept: "application/ld+json",
907
+ "x-project-id": t.projectId,
908
+ "cue-project-id": t.projectId
909
+ },
910
+ body: o
911
+ }
912
+ );
913
+ if (!r.ok) {
914
+ const a = await r.text().catch(() => "");
915
+ throw new Error(
916
+ `Extraction failed: ${r.status} ${r.statusText}${a ? " — " + a.slice(0, 300) : ""}`
917
+ );
918
+ }
919
+ return { jsonld: await r.json() };
920
+ }
921
+ }
922
+ class Mt {
880
923
  constructor(t, e, o, r) {
881
- this._auth = t, this._gatewayUrl = e, this.projects = o, this.sync = r, this.tables = new mo(t, e);
924
+ this._auth = t, this._gatewayUrl = e, this.projects = o, this.sync = r, this.tables = new wo(t, e), this.extraction = new yo(t, e);
882
925
  }
883
926
  _auth;
884
927
  _gatewayUrl;
885
928
  projects;
886
929
  sync;
887
930
  tables;
931
+ /** Semantic extraction client — call document pages against a SemanticTemplate. */
932
+ extraction;
888
933
  /** Active language used for language-sensitive SPARQL queries across all project classes. */
889
934
  language = "en";
890
935
  /** Updates the active language. All project classes (`CueProjectSchema`, `CueProjectDocuments`, `CueProjectEntities`) read this at query time. */
@@ -910,7 +955,7 @@ class Ut {
910
955
  */
911
956
  async search(t) {
912
957
  const e = await this._auth.authenticatedFetch(
913
- `${this._gatewayUrl}${no}`,
958
+ `${this._gatewayUrl}${po}`,
914
959
  {
915
960
  method: "POST",
916
961
  headers: { "Content-Type": "application/json", "cue-project-id": t.projectId },
@@ -933,7 +978,7 @@ class Ut {
933
978
  */
934
979
  async sparql(t, e, o) {
935
980
  o || (o = (await this.projects.getProject(e))?.projectSettings?.graph?.type ?? "qlever");
936
- const r = o === "fuseki" ? ae : ie;
981
+ const r = o === "fuseki" ? ie : ne;
937
982
  console.log(`Executing SPARQL query against ${r} for project ${e} with graph type ${o}`);
938
983
  const s = new URLSearchParams();
939
984
  s.append("query", t);
@@ -970,7 +1015,7 @@ class Ut {
970
1015
  const r = o?.format ?? "json-ld", s = r === "turtle" ? "text/turtle" : "application/ld+json";
971
1016
  if (o?.graphType === "fuseki") {
972
1017
  const c = await this._auth.authenticatedFetch(
973
- `${this._gatewayUrl}${lo}`,
1018
+ `${this._gatewayUrl}${co}`,
974
1019
  {
975
1020
  method: "POST",
976
1021
  headers: {
@@ -988,7 +1033,7 @@ class Ut {
988
1033
  }
989
1034
  return r === "turtle" ? c.text() : c.json();
990
1035
  }
991
- const a = `${this._gatewayUrl}${ho}${o?.verbose ? "?verbose=true" : ""}`, n = new URLSearchParams({ shape: t }), p = await this._auth.authenticatedFetch(a, {
1036
+ const a = `${this._gatewayUrl}${go}${o?.verbose ? "?verbose=true" : ""}`, n = new URLSearchParams({ shape: t }), p = await this._auth.authenticatedFetch(a, {
992
1037
  method: "POST",
993
1038
  headers: {
994
1039
  "Content-Type": "application/x-www-form-urlencoded",
@@ -1033,13 +1078,13 @@ const nt = [
1033
1078
  "railway",
1034
1079
  "natural",
1035
1080
  "manmade"
1036
- ], ne = [
1081
+ ], pe = [
1037
1082
  "address",
1038
1083
  "poi",
1039
1084
  "railway",
1040
1085
  "natural",
1041
1086
  "manmade"
1042
- ], wo = {
1087
+ ], bo = {
1043
1088
  address: {
1044
1089
  category: "address",
1045
1090
  label: "Address",
@@ -1102,9 +1147,9 @@ const nt = [
1102
1147
  }
1103
1148
  };
1104
1149
  function S(i) {
1105
- return wo[i];
1150
+ return bo[i];
1106
1151
  }
1107
- const fo = {
1152
+ const vo = {
1108
1153
  "land-use-plan": "#f59e0b",
1109
1154
  // amber – primary zoning
1110
1155
  "local-plan": "#ec4899",
@@ -1135,7 +1180,7 @@ const fo = {
1135
1180
  function N(i, t) {
1136
1181
  return i[0] < t[2] && i[2] > t[0] && i[1] < t[3] && i[3] > t[1];
1137
1182
  }
1138
- const yo = "https://nominatim.openstreetmap.org", bo = "cue-gis/0.0.1", vo = {
1183
+ const _o = "https://nominatim.openstreetmap.org", ko = "cue-gis/0.0.1", Eo = {
1139
1184
  address: "street",
1140
1185
  poi: "shop",
1141
1186
  railway: "station",
@@ -1150,7 +1195,7 @@ const yo = "https://nominatim.openstreetmap.org", bo = "cue-gis/0.0.1", vo = {
1150
1195
  function B(i) {
1151
1196
  return `${L}:${i}`;
1152
1197
  }
1153
- function _o(i) {
1198
+ function xo(i) {
1154
1199
  const t = S(i);
1155
1200
  return {
1156
1201
  id: B(i),
@@ -1165,17 +1210,17 @@ function _o(i) {
1165
1210
  descriptionKey: `gis.layer.${L}.${i}.description`
1166
1211
  };
1167
1212
  }
1168
- class ko {
1213
+ class Io {
1169
1214
  baseUrl;
1170
1215
  userAgent;
1171
1216
  email;
1172
1217
  limit;
1173
1218
  constructor(t = {}) {
1174
- this.baseUrl = t.baseUrl ?? yo, this.userAgent = t.userAgent ?? bo, this.email = t.email, this.limit = Math.min(t.limit ?? 40, 40);
1219
+ this.baseUrl = t.baseUrl ?? _o, this.userAgent = t.userAgent ?? ko, this.email = t.email, this.limit = Math.min(t.limit ?? 40, 40);
1175
1220
  }
1176
1221
  async listFeatureCategoryDescriptors(t) {
1177
1222
  return (await Promise.allSettled(
1178
- ne.map(async (o) => {
1223
+ pe.map(async (o) => {
1179
1224
  const r = await this.search(t, o);
1180
1225
  return { category: o, hasResults: r.length > 0 };
1181
1226
  })
@@ -1184,7 +1229,7 @@ class ko {
1184
1229
  ).map((o) => S(o.value.category));
1185
1230
  }
1186
1231
  async listAvailableLayers(t) {
1187
- return (await this.listFeatureCategoryDescriptors(t)).map((o) => _o(o.category));
1232
+ return (await this.listFeatureCategoryDescriptors(t)).map((o) => xo(o.category));
1188
1233
  }
1189
1234
  async getFeaturesForLayer(t, e) {
1190
1235
  const o = nt.find((r) => B(r) === e);
@@ -1201,7 +1246,7 @@ class ko {
1201
1246
  * so bounded viewbox searches return meaningful results.
1202
1247
  */
1203
1248
  async search(t, e) {
1204
- const [o, r, s, a] = t, n = e ? vo[e] : "place", p = new URLSearchParams({
1249
+ const [o, r, s, a] = t, n = e ? Eo[e] : "place", p = new URLSearchParams({
1205
1250
  q: n,
1206
1251
  format: "jsonv2",
1207
1252
  viewbox: `${o},${a},${s},${r}`,
@@ -1244,7 +1289,7 @@ class ko {
1244
1289
  };
1245
1290
  }
1246
1291
  }
1247
- const Mt = {
1292
+ const zt = {
1248
1293
  // 100s – Residential
1249
1294
  110: "residential",
1250
1295
  120: "residential",
@@ -1323,7 +1368,7 @@ const Mt = {
1323
1368
  960: "agricultural",
1324
1369
  970: "agricultural",
1325
1370
  990: "other"
1326
- }, zt = {
1371
+ }, Nt = {
1327
1372
  1010: "residential",
1328
1373
  1020: "mixed",
1329
1374
  1030: "residential",
@@ -1353,7 +1398,7 @@ const Mt = {
1353
1398
  1281: "infrastructure",
1354
1399
  1282: "infrastructure",
1355
1400
  9999: "other"
1356
- }, Eo = {
1401
+ }, Co = {
1357
1402
  // Residential
1358
1403
  1110: "residential",
1359
1404
  // Einfamilienhaus
@@ -1415,7 +1460,7 @@ const Mt = {
1415
1460
  // Empfangsgebäude Bahn/Bus
1416
1461
  1282: "infrastructure"
1417
1462
  // Parkhaus, Garage
1418
- }, xo = [
1463
+ }, To = [
1419
1464
  // "Gebäude" is the Swiss AV BoFlaeche land-cover label for a building footprint.
1420
1465
  // It does not encode the actual use type, so map it to 'other' as a safe fallback.
1421
1466
  [/^geb[äa]ude$/i, "other"],
@@ -1429,22 +1474,22 @@ const Mt = {
1429
1474
  [/gemischt|mixed|blandet/i, "mixed"]
1430
1475
  ];
1431
1476
  function O(i) {
1432
- for (const [t, e] of xo)
1477
+ for (const [t, e] of To)
1433
1478
  if (t.test(i)) return e;
1434
1479
  }
1435
- function Io(i, t) {
1480
+ function So(i, t) {
1436
1481
  if (i == null) return;
1437
1482
  const e = String(i).trim();
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);
1483
+ return t === "swiss-gwr" ? Co[e] ?? O(e) : t === "danish-matrikel" ? zt[e] ?? O(e) : t === "zurich-wfs" || t === "swiss-av-wfs" ? Nt[e] ?? O(e) : Nt[e] ?? zt[e] ?? O(e);
1439
1484
  }
1440
- function Co(i, t) {
1485
+ function Ro(i, t) {
1441
1486
  if (i != null)
1442
1487
  return O(String(i).trim());
1443
1488
  }
1444
- function pe(i) {
1489
+ function le(i) {
1445
1490
  return i.trim().toLowerCase().replace(/[\s_\-]/g, "");
1446
1491
  }
1447
- const To = {
1492
+ const Ao = {
1448
1493
  // Swiss ÖREB rechtsstatus
1449
1494
  inkraft: "in-force",
1450
1495
  laufendeanderung: "amendment-pending",
@@ -1463,11 +1508,11 @@ const To = {
1463
1508
  forslag: "proposed",
1464
1509
  aflyst: "repealed"
1465
1510
  };
1466
- function le(i) {
1511
+ function ce(i) {
1467
1512
  if (i)
1468
- return To[pe(i)];
1513
+ return Ao[le(i)];
1469
1514
  }
1470
- const Nt = {
1515
+ const $t = {
1471
1516
  // Swiss Nutzungsplanung (typ_gde_bezeichnung and common variants)
1472
1517
  grundnutzungszonenplan: "land-use-plan",
1473
1518
  nutzungszonenplan: "land-use-plan",
@@ -1521,7 +1566,7 @@ const Nt = {
1521
1566
  // Danish plandata.dk
1522
1567
  lokalplan: "local-plan",
1523
1568
  kommuneplanramme: "municipal-plan-framework"
1524
- }, So = [
1569
+ }, Po = [
1525
1570
  [/quartiererhalt/i, "neighbourhood-conservation-plan"],
1526
1571
  [/lärmempfindlich|laermempfindlich/i, "noise-sensitivity-plan"],
1527
1572
  [/gewässerschutz|grundwasserschutz/i, "water-protection-plan"],
@@ -1561,24 +1606,24 @@ const Nt = {
1561
1606
  // Catch-all: any remaining Xzone / Xareal designation from the Grundnutzungszonenplan
1562
1607
  [/zone$|areal$/i, "land-use-plan"]
1563
1608
  ];
1564
- function ce(i) {
1609
+ function he(i) {
1565
1610
  if (!i) return;
1566
- const t = pe(i);
1567
- if (t in Nt) return Nt[t];
1568
- for (const [e, o] of So)
1611
+ const t = le(i);
1612
+ if (t in $t) return $t[t];
1613
+ for (const [e, o] of Po)
1569
1614
  if (e.test(i)) return o;
1570
1615
  console.warn(
1571
1616
  `[cue-gis] Unknown zone plan type — add "${i}" to classifyZonePlanType: no ZonePlanType mapping found.`
1572
1617
  );
1573
1618
  }
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];
1619
+ const Oo = "https://maps.zh.ch/wfs/OGDZHWFS", Do = "zurich-wfs", Lo = [8.35, 47.15, 8.95, 47.7], qo = [5.9, 45.7, 10.55, 47.85];
1575
1620
  function Z(i) {
1576
1621
  return typeof i == "string" ? i : i.typeName;
1577
1622
  }
1578
1623
  function J(i) {
1579
1624
  return typeof i == "string" ? void 0 : i.cqlFilter;
1580
1625
  }
1581
- function Do(i) {
1626
+ function jo(i) {
1582
1627
  if (!i) return [0, 0];
1583
1628
  const t = i.coordinates;
1584
1629
  switch (i.type) {
@@ -1596,20 +1641,20 @@ function Do(i) {
1596
1641
  return [0, 0];
1597
1642
  }
1598
1643
  }
1599
- function Lo(i, t) {
1644
+ function Uo(i, t) {
1600
1645
  if (!i) return t;
1601
1646
  for (const e of ["plannavn", "bezeichnung", "name", "strassenname", "objektname", "title", "label"])
1602
1647
  if (typeof i[e] == "string" && i[e]) return i[e];
1603
1648
  return t;
1604
1649
  }
1605
- function qo(i, t, e) {
1650
+ function Mo(i, t, e) {
1606
1651
  return e ? `${i}:${t}[${e}]` : `${i}:${t}`;
1607
1652
  }
1608
- const jo = /* @__PURE__ */ new Set(["building", "cadastre", "greenspace", "paved", "zone"]);
1653
+ const zo = /* @__PURE__ */ new Set(["building", "cadastre", "greenspace", "paved", "zone"]);
1609
1654
  function tt(i, t, e, o) {
1610
- const r = e.replace(/^ms:/, ""), s = S(t), a = jo.has(t) ? "priority" : "raw";
1655
+ const r = e.replace(/^ms:/, ""), s = S(t), a = zo.has(t) ? "priority" : "raw";
1611
1656
  return {
1612
- id: qo(i, e, o),
1657
+ id: Mo(i, e, o),
1613
1658
  sourceId: i,
1614
1659
  sourceLayerId: e,
1615
1660
  category: t,
@@ -1621,32 +1666,32 @@ function tt(i, t, e, o) {
1621
1666
  descriptionKey: `gis.layer.${i}.${r}.description`
1622
1667
  };
1623
1668
  }
1624
- function Uo(i, t) {
1669
+ function No(i, t) {
1625
1670
  if (!i) return { featureType: "building" };
1626
1671
  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;
1627
1672
  return {
1628
1673
  featureType: "building",
1629
1674
  areaM2: typeof e == "number" ? e : void 0,
1630
1675
  buildingUse: r ? String(r) : void 0,
1631
- buildingUseGeneric: Io(r, t),
1676
+ buildingUseGeneric: So(r, t),
1632
1677
  floors: typeof o == "number" ? o : void 0,
1633
1678
  yearBuilt: typeof s == "number" ? s : void 0,
1634
1679
  registryId: a
1635
1680
  };
1636
1681
  }
1637
- function Mo(i, t) {
1682
+ function $o(i, t) {
1638
1683
  if (!i) return { featureType: "plot" };
1639
1684
  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;
1640
1685
  return {
1641
1686
  featureType: "plot",
1642
1687
  areaM2: typeof a == "number" ? a : void 0,
1643
1688
  plotUse: n ? String(n) : void 0,
1644
- plotUseGeneric: Co(n),
1689
+ plotUseGeneric: Ro(n),
1645
1690
  plotId: s,
1646
1691
  registryId: e
1647
1692
  };
1648
1693
  }
1649
- function zo(i) {
1694
+ function Fo(i) {
1650
1695
  if (!i) return { featureType: "greenspace" };
1651
1696
  const t = i.flaeche ?? void 0, e = i.art ?? void 0;
1652
1697
  return {
@@ -1655,7 +1700,7 @@ function zo(i) {
1655
1700
  surfaceType: e ? String(e) : void 0
1656
1701
  };
1657
1702
  }
1658
- function No(i) {
1703
+ function Bo(i) {
1659
1704
  if (!i) return { featureType: "paved" };
1660
1705
  const t = i.flaeche ?? void 0, e = i.art ?? void 0;
1661
1706
  return {
@@ -1664,9 +1709,9 @@ function No(i) {
1664
1709
  surfaceType: e ? String(e) : void 0
1665
1710
  };
1666
1711
  }
1667
- function $o(i) {
1712
+ function Go(i) {
1668
1713
  if (!i) return { featureType: "zone" };
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;
1714
+ 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 = ce(r), a = i.typ_gde_bezeichnung ?? void 0, n = he(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;
1670
1715
  return {
1671
1716
  featureType: "zone",
1672
1717
  zoneType: t ? String(t) : void 0,
@@ -1682,7 +1727,7 @@ function $o(i) {
1682
1727
  areaM2: typeof w == "number" ? w : void 0
1683
1728
  };
1684
1729
  }
1685
- function Fo(i) {
1730
+ function Ho(i) {
1686
1731
  const t = i.match(/^(\w+)\s*=\s*'([^']+)'$/);
1687
1732
  if (t) {
1688
1733
  const [, o, r] = t;
@@ -1703,7 +1748,7 @@ class et {
1703
1748
  sourceId;
1704
1749
  outputFormat;
1705
1750
  constructor(t) {
1706
- this.categoryMap = t.categoryMap, this.baseUrl = t.baseUrl ?? Ro, this.sourceId = t.sourceId ?? Ao, this.outputFormat = t.outputFormat ?? "application/json; subtype=geojson";
1751
+ this.categoryMap = t.categoryMap, this.baseUrl = t.baseUrl ?? Oo, this.sourceId = t.sourceId ?? Do, this.outputFormat = t.outputFormat ?? "application/json; subtype=geojson";
1707
1752
  }
1708
1753
  async listFeatureCategoryDescriptors(t) {
1709
1754
  const e = await this.listAvailableLayers(t);
@@ -1727,7 +1772,7 @@ class et {
1727
1772
  return o ? this._fetchAndConvert(t, o.descriptor, o.cqlFilter) : [];
1728
1773
  }
1729
1774
  async _fetchAndConvert(t, e, o) {
1730
- const r = await this._fetchFeatures(t, e.sourceLayerId, void 0, o), s = o ? Fo(o) : void 0;
1775
+ const r = await this._fetchFeatures(t, e.sourceLayerId, void 0, o), s = o ? Ho(o) : void 0;
1731
1776
  return (s ? r.features.filter((n) => s(n.properties)) : r.features).map((n, p) => this.toGisFeature(n, e, p));
1732
1777
  }
1733
1778
  /**
@@ -1776,7 +1821,7 @@ class et {
1776
1821
  return g.json();
1777
1822
  }
1778
1823
  toGisFeature(t, e, o) {
1779
- const [r, s] = Do(t.geometry), a = Lo(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;
1824
+ const [r, s] = jo(t.geometry), a = Uo(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;
1780
1825
  return {
1781
1826
  id: t.id ?? `${e.sourceLayerId}/${o}`,
1782
1827
  preferredColor: e.preferredColor,
@@ -1797,10 +1842,10 @@ class et {
1797
1842
  };
1798
1843
  }
1799
1844
  _extractNormalisedProperties(t, e) {
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);
1845
+ return e.category === "building" ? No(t.properties, this.sourceId) : e.category === "greenspace" ? Fo(t.properties) : e.category === "paved" ? Bo(t.properties) : e.category === "zone" ? Go(t.properties) : $o(t.properties, this.sourceId);
1801
1846
  }
1802
1847
  }
1803
- const he = [8, 54.5, 15.2, 57.8], de = {
1848
+ const de = [8, 54.5, 15.2, 57.8], ge = {
1804
1849
  building: [
1805
1850
  { source: "danish-matrikel", typename: "bbr_v001:bygning_current" }
1806
1851
  ],
@@ -1809,7 +1854,7 @@ const he = [8, 54.5, 15.2, 57.8], de = {
1809
1854
  { source: "danish-matrikel", typename: "mat_v001:samletfastejendom_current" }
1810
1855
  ]
1811
1856
  };
1812
- function Bo(i) {
1857
+ function Wo(i) {
1813
1858
  if (!i) return [0, 0];
1814
1859
  const t = i.coordinates;
1815
1860
  switch (i.type) {
@@ -1827,7 +1872,7 @@ function Bo(i) {
1827
1872
  return [0, 0];
1828
1873
  }
1829
1874
  }
1830
- function Go(i, t) {
1875
+ function Vo(i, t) {
1831
1876
  if (!i) return t;
1832
1877
  for (const e of [
1833
1878
  "mat:matrikelnummer",
@@ -1843,14 +1888,14 @@ function Go(i, t) {
1843
1888
  if (typeof i[e] == "string" && i[e]) return i[e];
1844
1889
  return t;
1845
1890
  }
1846
- function Ho(i, t, e) {
1891
+ function Ko(i, t, e) {
1847
1892
  return `${i}:${t}:${e}`;
1848
1893
  }
1849
- const Wo = /* @__PURE__ */ new Set(["building", "cadastre", "zone"]);
1894
+ const Qo = /* @__PURE__ */ new Set(["building", "cadastre", "zone"]);
1850
1895
  function ot(i, t, e) {
1851
- const o = e.typename.replace(/^[^:]+:/, ""), r = S(t), s = Wo.has(t) ? "priority" : "raw";
1896
+ const o = e.typename.replace(/^[^:]+:/, ""), r = S(t), s = Qo.has(t) ? "priority" : "raw";
1852
1897
  return {
1853
- id: Ho(i, e.source, e.typename),
1898
+ id: Ko(i, e.source, e.typename),
1854
1899
  sourceId: i,
1855
1900
  sourceLayerId: e.typename,
1856
1901
  category: t,
@@ -1862,7 +1907,7 @@ function ot(i, t, e) {
1862
1907
  descriptionKey: `gis.layer.${i}.${e.source}.${o}.description`
1863
1908
  };
1864
1909
  }
1865
- function Vo(i, t) {
1910
+ function Xo(i, t) {
1866
1911
  if (t === "building") {
1867
1912
  const a = i?.byg041BebyggetAreal ?? i?.byg038SamletBygningsareal, n = i?.byg021BygningensAnvendelse, p = i?.id_lokalId, c = i?.byg026Opførelsesår;
1868
1913
  return {
@@ -1879,8 +1924,8 @@ function Vo(i, t) {
1879
1924
  featureType: "zone",
1880
1925
  zoneType: a ?? void 0,
1881
1926
  zoneCode: p ?? void 0,
1882
- legalStatus: le(c),
1883
- planType: ce(i?.typ_gde_bezeichnung),
1927
+ legalStatus: ce(c),
1928
+ planType: he(i?.typ_gde_bezeichnung),
1884
1929
  planId: n ?? void 0,
1885
1930
  planDocumentLink: h ?? void 0,
1886
1931
  publicationDate: i?.auflagedatum ?? void 0,
@@ -1898,13 +1943,13 @@ function Vo(i, t) {
1898
1943
  registryId: s ?? void 0
1899
1944
  };
1900
1945
  }
1901
- class Ko {
1946
+ class Yo {
1902
1947
  categoryMap;
1903
1948
  dataViewsBaseUrl;
1904
1949
  getHeaders;
1905
1950
  sourceId;
1906
1951
  constructor(t) {
1907
- this.dataViewsBaseUrl = t.dataViewsBaseUrl.replace(/\/$/, ""), this.getHeaders = t.getHeaders, this.categoryMap = t.categoryMap ?? de, this.sourceId = t.sourceId ?? "cue-sdk-gis";
1952
+ this.dataViewsBaseUrl = t.dataViewsBaseUrl.replace(/\/$/, ""), this.getHeaders = t.getHeaders, this.categoryMap = t.categoryMap ?? ge, this.sourceId = t.sourceId ?? "cue-sdk-gis";
1908
1953
  }
1909
1954
  async listFeatureCategoryDescriptors(t) {
1910
1955
  const e = await this.listAvailableLayers(t);
@@ -1967,7 +2012,7 @@ class Ko {
1967
2012
  return d.json();
1968
2013
  }
1969
2014
  _toGisFeature(t, e, o) {
1970
- const [r, s] = Bo(t.geometry), a = t.id ?? `${e.sourceLayerId}/${o}`, n = Go(t.properties, a), p = t.bbox ? [t.bbox[0], t.bbox[1], t.bbox[2], t.bbox[3]] : void 0, c = e.tier, h = c === "priority" ? Vo(t.properties, e.category) : void 0;
2015
+ const [r, s] = Wo(t.geometry), a = t.id ?? `${e.sourceLayerId}/${o}`, n = Vo(t.properties, a), p = t.bbox ? [t.bbox[0], t.bbox[1], t.bbox[2], t.bbox[3]] : void 0, c = e.tier, h = c === "priority" ? Xo(t.properties, e.category) : void 0;
1971
2016
  return {
1972
2017
  id: a,
1973
2018
  sourceId: this.sourceId,
@@ -1988,7 +2033,7 @@ class Ko {
1988
2033
  };
1989
2034
  }
1990
2035
  }
1991
- const Qo = {
2036
+ const Zo = {
1992
2037
  address: [
1993
2038
  "ms:ogd-0406_arv_basis_avzh_hausnummer_pos_p",
1994
2039
  "ms:ogd-0571_afv_gv_strat_strassennetz_l"
@@ -2036,19 +2081,19 @@ const Qo = {
2036
2081
  // ÖREB Überlagernde Festlegungen (Flächen) – overlaying planning constraints
2037
2082
  "ms:ogd-0155_arv_basis_np_ul_flaeche_f"
2038
2083
  ]
2039
- }, ge = [
2084
+ }, ue = [
2040
2085
  {
2041
2086
  name: "Canton of Zürich",
2042
- coverageBBox: Po,
2087
+ coverageBBox: Lo,
2043
2088
  supportedCategories: ["address", "poi", "railway", "natural", "manmade", "building", "cadastre", "greenspace", "paved", "zone"],
2044
2089
  priority: 10,
2045
2090
  adapter: new et({
2046
- categoryMap: Qo
2091
+ categoryMap: Zo
2047
2092
  })
2048
2093
  },
2049
2094
  {
2050
2095
  name: "Switzerland (national AV cadastre)",
2051
- coverageBBox: Oo,
2096
+ coverageBBox: qo,
2052
2097
  supportedCategories: ["cadastre"],
2053
2098
  priority: 5,
2054
2099
  // Lower priority than canton-specific adapters. For ZH, the canton adapter (priority 10) wins.
@@ -2076,7 +2121,7 @@ const Qo = {
2076
2121
  * - `pdk:kommuneplanramme_vedtaget` – adopted municipal plan frameworks
2077
2122
  */
2078
2123
  name: "Denmark (Plandata.dk – planning zones)",
2079
- coverageBBox: he,
2124
+ coverageBBox: de,
2080
2125
  supportedCategories: ["zone"],
2081
2126
  priority: 10,
2082
2127
  adapter: new et({
@@ -2094,12 +2139,12 @@ const Qo = {
2094
2139
  })
2095
2140
  }
2096
2141
  ];
2097
- function $t(i) {
2142
+ function Ft(i) {
2098
2143
  return [...i].sort(
2099
2144
  (t, e) => nt.indexOf(t.category) - nt.indexOf(e.category)
2100
2145
  );
2101
2146
  }
2102
- class Xo {
2147
+ class Jo {
2103
2148
  nominatim;
2104
2149
  regions;
2105
2150
  /**
@@ -2114,9 +2159,9 @@ class Xo {
2114
2159
  zonePlanTypeColors: r,
2115
2160
  ...s
2116
2161
  } = t;
2117
- this.nominatim = new ko(s);
2118
- const a = o ? ge : [];
2119
- this.regions = e ?? a, this.zonePlanTypeColors = { ...fo, ...r };
2162
+ this.nominatim = new Io(s);
2163
+ const a = o ? ue : [];
2164
+ this.regions = e ?? a, this.zonePlanTypeColors = { ...vo, ...r };
2120
2165
  }
2121
2166
  /**
2122
2167
  * Return the available feature categories together with UI metadata such as
@@ -2135,12 +2180,12 @@ class Xo {
2135
2180
  for (const a of e)
2136
2181
  for (const n of a.supportedCategories ?? [])
2137
2182
  r.has(n) || (r.add(n), s.push(S(n)));
2138
- for (const a of ne)
2183
+ for (const a of pe)
2139
2184
  r.has(a) || s.push(S(a));
2140
- return $t(s);
2185
+ return Ft(s);
2141
2186
  }
2142
2187
  const o = await this._adapterFor(t).listFeatureCategoryDescriptors(t);
2143
- return $t(o);
2188
+ return Ft(o);
2144
2189
  }
2145
2190
  /**
2146
2191
  * Return the feature categories that have at least one result within the
@@ -2213,7 +2258,7 @@ class Xo {
2213
2258
  const { features: n, idx: p } = await Promise.race(a.values());
2214
2259
  a.delete(p);
2215
2260
  for (const c of n) {
2216
- const h = Ft(c), d = W(c), g = s.get(h);
2261
+ const h = Bt(c), d = W(c), g = s.get(h);
2217
2262
  (g === void 0 || d > g) && (s.set(h, d), yield c);
2218
2263
  }
2219
2264
  }
@@ -2247,9 +2292,9 @@ class Xo {
2247
2292
  ), a = [], n = [];
2248
2293
  for (const d of s)
2249
2294
  d.status === "fulfilled" && (d.value.isNominatim ? n.push(...d.value.features) : a.push(...d.value.features));
2250
- const p = Jo(a, n), c = /* @__PURE__ */ new Map(), h = [];
2295
+ const p = or(a, n), c = /* @__PURE__ */ new Map(), h = [];
2251
2296
  for (const d of p) {
2252
- const g = Ft(d), w = W(d), u = c.get(g);
2297
+ const g = Bt(d), w = W(d), u = c.get(g);
2253
2298
  (u === void 0 || w > u) && (c.set(g, w), h.push(d));
2254
2299
  }
2255
2300
  return h;
@@ -2267,22 +2312,22 @@ function W(i) {
2267
2312
  const t = i.geometry?.type;
2268
2313
  return t === "Polygon" || t === "MultiPolygon" ? 3 : t === "LineString" || t === "MultiLineString" ? 2 : 1;
2269
2314
  }
2270
- function Ft(i) {
2315
+ function Bt(i) {
2271
2316
  const t = Math.round(i.lat * 1e3) / 1e3, e = Math.round(i.lon * 1e3) / 1e3;
2272
2317
  return `${(i.name ?? i.id ?? "").toLowerCase().trim()}|${t}|${e}`;
2273
2318
  }
2274
- const Yo = 1e-3;
2275
- function Zo(i, t) {
2319
+ const tr = 1e-3;
2320
+ function er(i, t) {
2276
2321
  const e = i.lat - t.lat, o = i.lon - t.lon;
2277
2322
  return Math.sqrt(e * e + o * o);
2278
2323
  }
2279
- function Jo(i, t) {
2324
+ function or(i, t) {
2280
2325
  if (t.length === 0) return i;
2281
2326
  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 = [];
2282
2327
  for (const a of t) {
2283
- let n = -1, p = Yo;
2328
+ let n = -1, p = tr;
2284
2329
  for (let c = 0; c < r.length; c++) {
2285
- const h = Zo(a, r[c].feature);
2330
+ const h = er(a, r[c].feature);
2286
2331
  h < p && (p = h, n = c);
2287
2332
  }
2288
2333
  n >= 0 ? (r[n].feature.originalData = {
@@ -2296,8 +2341,8 @@ function Jo(i, t) {
2296
2341
  ...s
2297
2342
  ];
2298
2343
  }
2299
- const tr = "/data-views", er = 1500;
2300
- class or {
2344
+ const rr = "/data-views", sr = 1500;
2345
+ class ar {
2301
2346
  // undefined = not yet built
2302
2347
  /** @internal — construct via `cue.gis`, not directly. */
2303
2348
  constructor(t, e) {
@@ -2380,25 +2425,25 @@ class or {
2380
2425
  }
2381
2426
  // ── Private ───────────────────────────────────────────────────────────────
2382
2427
  _scheduleDebouncedQuery() {
2383
- this._debounceTimer !== null && clearTimeout(this._debounceTimer), this._debounceTimer = setTimeout(() => this._queryLayers(), er);
2428
+ this._debounceTimer !== null && clearTimeout(this._debounceTimer), this._debounceTimer = setTimeout(() => this._queryLayers(), sr);
2384
2429
  }
2385
2430
  _getGateway() {
2386
2431
  if (this._gatewayCache !== null && this._gatewayProjectId === this._projectId)
2387
2432
  return this._gatewayCache;
2388
- const t = this._projectId, e = [...ge];
2433
+ const t = this._projectId, e = [...ue];
2389
2434
  return t && e.unshift({
2390
2435
  name: "Cue SDK (authenticated)",
2391
- coverageBBox: he,
2392
- supportedCategories: Object.keys(de),
2436
+ coverageBBox: de,
2437
+ supportedCategories: Object.keys(ge),
2393
2438
  priority: 10,
2394
- adapter: new Ko({
2395
- dataViewsBaseUrl: `${this._gatewayUrl}${tr}`,
2439
+ adapter: new Yo({
2440
+ dataViewsBaseUrl: `${this._gatewayUrl}${rr}`,
2396
2441
  getHeaders: async () => ({
2397
2442
  ...await this._getAuthHeaders(),
2398
2443
  "x-project-id": t
2399
2444
  })
2400
2445
  })
2401
- }), this._gatewayCache = new Xo({ regions: e }), this._gatewayProjectId = t, this._gatewayCache;
2446
+ }), this._gatewayCache = new Jo({ regions: e }), this._gatewayProjectId = t, this._gatewayCache;
2402
2447
  }
2403
2448
  async _queryLayers() {
2404
2449
  const t = this._bbox;
@@ -2442,11 +2487,11 @@ class or {
2442
2487
  this._loadListeners.forEach((e) => e(t));
2443
2488
  }
2444
2489
  }
2445
- class Bt {
2490
+ class Gt {
2446
2491
  constructor(t, e, o = !1, r) {
2447
- if (this._auth = t, this._db = Ee(e), this._functions = oe(e, se), this._gatewayUrl = r?.gatewayUrl ?? "", o) {
2492
+ if (this._auth = t, this._db = xe(e), this._functions = re(e, ae), this._gatewayUrl = r?.gatewayUrl ?? "", o) {
2448
2493
  const s = r?.firestoreEmulatorHost ?? "localhost", a = r?.firestoreEmulatorPort ?? 8080;
2449
- xe(this._db, s, a), re(this._functions, "localhost", 5001);
2494
+ Ie(this._db, s, a), se(this._functions, "localhost", 5001);
2450
2495
  }
2451
2496
  }
2452
2497
  _auth;
@@ -2479,12 +2524,12 @@ class Bt {
2479
2524
  * Access is gated by Firestore rules which check membership.
2480
2525
  */
2481
2526
  async listProjects() {
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());
2527
+ const t = this._requireUser(), e = ft(this._db, xt);
2528
+ return (await Ce(Te(e, Se("members", "array-contains", t), Re(100)))).docs.map((r) => r.data());
2484
2529
  }
2485
2530
  /** Fetch a single project by ID. Returns null if not found. */
2486
2531
  async getProject(t) {
2487
- const e = yt(ft(this._db, Et), t), o = await Re(e);
2532
+ const e = yt(ft(this._db, xt), t), o = await Ae(e);
2488
2533
  return o.exists() ? o.data() : null;
2489
2534
  }
2490
2535
  /**
@@ -2494,9 +2539,9 @@ class Bt {
2494
2539
  async incrementUnitsConsumed(t, e, o) {
2495
2540
  if (e <= 0) return;
2496
2541
  const r = yt(this._db, "clientSync", t);
2497
- await Ae(r, {
2498
- unitsConsumed: Oe(e),
2499
- lastUpdated: Pe(),
2542
+ await Pe(r, {
2543
+ unitsConsumed: De(e),
2544
+ lastUpdated: Oe(),
2500
2545
  lastUserId: o
2501
2546
  }, { merge: !0 });
2502
2547
  }
@@ -2514,10 +2559,23 @@ class Bt {
2514
2559
  async removeUserFromProject(t, e) {
2515
2560
  await F(this._functions, "removeUserFromProject")({ uid: t, spaceId: e });
2516
2561
  }
2562
+ /**
2563
+ * Delete a project by ID. Requires superadmin privileges on the server.
2564
+ */
2565
+ async deleteProject(t) {
2566
+ const e = await this._auth.authenticatedFetch(
2567
+ `${this._gatewayUrl}${no(t)}`,
2568
+ { method: "DELETE" }
2569
+ );
2570
+ if (!e.ok) {
2571
+ const o = await e.text().catch(() => "");
2572
+ throw new Error(`Failed to delete project: ${e.status} ${e.statusText}${o ? ` — ${o}` : ""}`);
2573
+ }
2574
+ }
2517
2575
  }
2518
- class Gt {
2576
+ class Ht {
2519
2577
  constructor(t, e, o, r) {
2520
- this._auth = t, this._gatewayUrl = r, this._functions = oe(e, se), o && re(this._functions, "localhost", 5001);
2578
+ this._auth = t, this._gatewayUrl = r, this._functions = re(e, ae), o && se(this._functions, "localhost", 5001);
2521
2579
  }
2522
2580
  _auth;
2523
2581
  _gatewayUrl;
@@ -2534,7 +2592,7 @@ class Gt {
2534
2592
  }
2535
2593
  /** Whether the current user has an active API key. */
2536
2594
  async hasAPIKey() {
2537
- return await this._fetch(At) !== null;
2595
+ return await this._fetch(Pt) !== null;
2538
2596
  }
2539
2597
  /** Returns the sign-in methods registered for the current user's email. */
2540
2598
  async getSignInMethods() {
@@ -2566,7 +2624,7 @@ class Gt {
2566
2624
  async updatePassword(t, e) {
2567
2625
  const o = this._requireUser();
2568
2626
  if (!o.email) throw new Error("User has no e-mail");
2569
- await bt(
2627
+ await vt(
2570
2628
  o,
2571
2629
  Q.credential(o.email, t)
2572
2630
  ), await We(o, e);
@@ -2581,14 +2639,14 @@ class Gt {
2581
2639
  async updateEmail(t, e) {
2582
2640
  const o = this._requireUser();
2583
2641
  if (!o.email) throw new Error("User e-mail not available");
2584
- await bt(
2642
+ await vt(
2585
2643
  o,
2586
2644
  Q.credential(o.email, e)
2587
2645
  ), await Ke(o, t), await Qe(o);
2588
2646
  }
2589
2647
  /** Creates a new API key for the current user. */
2590
2648
  async createAPIKey(t) {
2591
- return this._fetch(Pt, {
2649
+ return this._fetch(Ot, {
2592
2650
  method: "POST",
2593
2651
  headers: { "Content-Type": "application/json" },
2594
2652
  body: JSON.stringify({ expiration: t })
@@ -2597,7 +2655,7 @@ class Gt {
2597
2655
  /** Revokes the current user's API key. */
2598
2656
  async revokeAPIKey() {
2599
2657
  const t = await this._auth.authenticatedFetch(
2600
- this._url(Pt),
2658
+ this._url(Ot),
2601
2659
  { method: "DELETE" }
2602
2660
  );
2603
2661
  if (!t.ok)
@@ -2605,7 +2663,7 @@ class Gt {
2605
2663
  }
2606
2664
  /** Fetches the current user's existing API key. */
2607
2665
  async requestAPIKey() {
2608
- const t = await this._fetch(At);
2666
+ const t = await this._fetch(Pt);
2609
2667
  if (!t) throw new Error("No API key found");
2610
2668
  return t;
2611
2669
  }
@@ -2648,11 +2706,12 @@ class Gt {
2648
2706
  return t ? (await st(t)).claims.terms ?? null : null;
2649
2707
  }
2650
2708
  }
2651
- const Ht = ["superadmin", "admin", "syncer", "member"], Wt = {
2709
+ const Wt = ["superadmin", "admin", "syncer", "member"], Vt = {
2652
2710
  createEntities: "admin",
2653
2711
  createProvider: "superadmin",
2654
2712
  changeContentCategories: "syncer",
2655
2713
  deleteDocuments: "superadmin",
2714
+ deleteProject: "admin",
2656
2715
  deleteUserFromProject: "admin",
2657
2716
  downloadDocuments: "member",
2658
2717
  editContentCategories: "syncer",
@@ -2663,12 +2722,14 @@ const Ht = ["superadmin", "admin", "syncer", "member"], Wt = {
2663
2722
  uploadDocuments: "syncer",
2664
2723
  viewEntities: "member"
2665
2724
  };
2666
- function rr() {
2725
+ function ir() {
2667
2726
  return {
2668
2727
  changeContentCategories: !1,
2669
2728
  createEntities: !1,
2729
+ createProject: !1,
2670
2730
  createProvider: !1,
2671
2731
  deleteDocuments: !1,
2732
+ deleteProject: !1,
2672
2733
  deleteUserFromProject: !1,
2673
2734
  downloadDocuments: !1,
2674
2735
  editContentCategories: !1,
@@ -2680,21 +2741,31 @@ function rr() {
2680
2741
  viewEntities: !1
2681
2742
  };
2682
2743
  }
2683
- class Vt {
2744
+ class Kt {
2684
2745
  constructor(t) {
2685
- this._isSuperAdmin = t, this._projectRoles = new x([]), this.privileges = ct(
2686
- [this._projectRoles, t],
2746
+ this._isSuperAdmin = t, this._projectRoles = new k([]), this._orgRole = new k(null), this.privileges = ct(
2747
+ [this._projectRoles, this._orgRole, t],
2687
2748
  () => this._compute()
2688
2749
  );
2689
2750
  }
2690
2751
  _isSuperAdmin;
2691
2752
  _projectRoles;
2753
+ _orgRole;
2692
2754
  /**
2693
2755
  * Reactive signal — current user's privileges for the selected project.
2694
2756
  * Recomputes automatically when `setProjectRoles()` is called or when
2695
2757
  * the `isSuperAdmin` signal changes.
2696
2758
  */
2697
2759
  privileges;
2760
+ /**
2761
+ * Set the user's role within the organisation that owns the selected project.
2762
+ * Pass `null` to clear the organisation role (e.g. when deselecting a project).
2763
+ *
2764
+ * Only organisation admins (and superadmins) may create projects.
2765
+ */
2766
+ setOrgRole(t) {
2767
+ this._orgRole.get() !== t && this._orgRole.set(t);
2768
+ }
2698
2769
  /**
2699
2770
  * Set the user's roles for the currently selected project.
2700
2771
  *
@@ -2709,17 +2780,17 @@ class Vt {
2709
2780
  _expand(t) {
2710
2781
  if (this._isSuperAdmin.get())
2711
2782
  return ["superadmin", "admin", "syncer", "member"];
2712
- const e = Ht.findIndex((o) => t.includes(o));
2713
- return e === -1 ? [] : Array.from(Ht.slice(e));
2783
+ const e = Wt.findIndex((o) => t.includes(o));
2784
+ return e === -1 ? [] : Array.from(Wt.slice(e));
2714
2785
  }
2715
2786
  _compute() {
2716
- const t = this._projectRoles.get(), e = rr();
2717
- for (const o of Object.keys(Wt))
2718
- e[o] = t.includes(Wt[o]);
2719
- return e;
2787
+ const t = this._projectRoles.get(), e = this._isSuperAdmin.get(), o = ir();
2788
+ for (const r of Object.keys(Vt))
2789
+ o[r] = t.includes(Vt[r]);
2790
+ return o.createProject = e || this._orgRole.get() === "admin", o;
2720
2791
  }
2721
2792
  }
2722
- class Kt {
2793
+ class Qt {
2723
2794
  constructor(t) {
2724
2795
  this._storage = t;
2725
2796
  }
@@ -2752,7 +2823,7 @@ class Kt {
2752
2823
  // ── Internal helpers ───────────────────────────────────────────────────────
2753
2824
  async _get(t, e) {
2754
2825
  try {
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();
2826
+ const r = await (await oe(_(this._storage, `${t}/${e}.json.gz`))).arrayBuffer(), s = new DecompressionStream("gzip"), a = s.writable.getWriter(), n = s.readable.getReader();
2756
2827
  a.write(new Uint8Array(r)), a.close();
2757
2828
  const p = [];
2758
2829
  let c = await n.read();
@@ -2764,7 +2835,7 @@ class Kt {
2764
2835
  d.set(w, g), g += w.length;
2765
2836
  return JSON.parse(new TextDecoder().decode(d));
2766
2837
  } catch (o) {
2767
- if (sr(o)) return;
2838
+ if (nr(o)) return;
2768
2839
  throw o;
2769
2840
  }
2770
2841
  }
@@ -2786,7 +2857,7 @@ class Kt {
2786
2857
  );
2787
2858
  }
2788
2859
  }
2789
- function sr(i) {
2860
+ function nr(i) {
2790
2861
  return typeof i == "object" && i !== null && "code" in i && i.code === "storage/object-not-found";
2791
2862
  }
2792
2863
  const b = {
@@ -6068,9 +6139,9 @@ class gt {
6068
6139
  ), this._nsMap = t, t;
6069
6140
  }
6070
6141
  }
6071
- class ar {
6142
+ class pr {
6072
6143
  constructor(t, e, o, r, s) {
6073
- this._api = t, this._projectId = e, this._queryCache = r, this._graphType = s, this._currentLang = o, this._api.setLanguage(o), this._contentCategories = new x([]), this._entityCategories = new x([]), this._relationships = new x([]), this.availableContentCategories = this._contentCategories.asReadonly(), this.availableEntityCategories = this._entityCategories.asReadonly(), this.availableEntityRelationships = this._relationships.asReadonly(), this.ready = this._load(o).catch(
6144
+ this._api = t, this._projectId = e, this._queryCache = r, this._graphType = s, this._currentLang = o, this._api.setLanguage(o), this._contentCategories = new k([]), this._entityCategories = new k([]), this._relationships = new k([]), this.availableContentCategories = this._contentCategories.asReadonly(), this.availableEntityCategories = this._entityCategories.asReadonly(), this.availableEntityRelationships = this._relationships.asReadonly(), this.ready = this._load(o).catch(
6074
6145
  (a) => console.error("[CueProjectSchema] Initial load failed:", a)
6075
6146
  );
6076
6147
  }
@@ -6197,8 +6268,8 @@ GROUP BY ?iri ?parent`;
6197
6268
  });
6198
6269
  }
6199
6270
  }
6200
- const ir = "https://qlever.dev/api/osm-planet";
6201
- class ue {
6271
+ const lr = "https://qlever.dev/api/osm-planet";
6272
+ class me {
6202
6273
  constructor(t, e, o = dt, r, s) {
6203
6274
  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(
6204
6275
  (a) => console.error("[CueProjectEntities] Entity graph fetch failed:", a)
@@ -6211,15 +6282,15 @@ class ue {
6211
6282
  /** Full RDF base URL for this project, e.g. `https://cue.qaecy.com/r/{pid}/` */
6212
6283
  baseURL;
6213
6284
  // ── Internal writable slices ───────────────────────────────────────────────
6214
- _entityDetails = new x({});
6215
- _entityDocuments = new x(
6285
+ _entityDetails = new k({});
6286
+ _entityDocuments = new k(
6216
6287
  {}
6217
6288
  );
6218
- _entityRelationships = new x({});
6219
- _entityOSMMap = new x({});
6220
- _osmWKTMap = new x({});
6289
+ _entityRelationships = new k({});
6290
+ _entityOSMMap = new k({});
6291
+ _osmWKTMap = new k({});
6221
6292
  _fetchingOSMIds = /* @__PURE__ */ new Set();
6222
- _entityGraph = new x(void 0);
6293
+ _entityGraph = new k(void 0);
6223
6294
  // ── Derived signals ────────────────────────────────────────────────────────
6224
6295
  _entityInfoMapComputed = ct(
6225
6296
  [
@@ -6495,18 +6566,18 @@ ORDER BY DESC(?weight)`, o = await this._api.sparql(
6495
6566
  (f) => s[f] !== void 0 && !w.has(f) && !!w.add(f)
6496
6567
  ).map((f) => ({ osmIRI: f, wkt: s[f] }));
6497
6568
  const u = /* @__PURE__ */ new Map();
6498
- for (const { osm: f, viaRels: k, entityUUID: m } of h.indirect) {
6499
- const E = s[f];
6500
- if (E)
6501
- for (const I of k) {
6569
+ for (const { osm: f, viaRels: E, entityUUID: m } of h.indirect) {
6570
+ const x = s[f];
6571
+ if (x)
6572
+ for (const I of E) {
6502
6573
  const v = `${I}:${m}`, y = u.get(v) ?? { geometries: [], entityUUID: m };
6503
- y.geometries.some((C) => C.osmIRI === f) || (y.geometries.push({ osmIRI: f, wkt: E }), u.set(v, y));
6574
+ y.geometries.some((C) => C.osmIRI === f) || (y.geometries.push({ osmIRI: f, wkt: x }), u.set(v, y));
6504
6575
  }
6505
6576
  }
6506
6577
  u.size > 0 && (g = Array.from(u.entries()).map(
6507
- ([f, { geometries: k, entityUUID: m }]) => ({
6578
+ ([f, { geometries: E, entityUUID: m }]) => ({
6508
6579
  rel: f.split(":")[0],
6509
- geometries: k,
6580
+ geometries: E,
6510
6581
  entityUUID: m
6511
6582
  })
6512
6583
  ));
@@ -6637,7 +6708,7 @@ GROUP BY ?e1Cat ?e2Cat`;
6637
6708
  const o = e.map((n) => `<${n}>`).join(" "), r = `PREFIX geo: <${A.geo}>
6638
6709
  SELECT * WHERE {
6639
6710
  VALUES ?s { ${o} }
6640
- SERVICE <${ir}> {
6711
+ SERVICE <${lr}> {
6641
6712
  ?s geo:hasGeometry/geo:asWKT ?wkt
6642
6713
  }
6643
6714
  }`, s = await this._api.sparql(
@@ -6662,8 +6733,8 @@ class pt {
6662
6733
  baseURL;
6663
6734
  /** Tracks the language for which `_documentInfoMap` is currently populated. */
6664
6735
  _currentLang;
6665
- _documentInfoMap = new x({});
6666
- _projectDocumentsData = new x({
6736
+ _documentInfoMap = new k({});
6737
+ _projectDocumentsData = new k({
6667
6738
  duplicateCount: 0,
6668
6739
  documentsBySuffix: {},
6669
6740
  documentsByContentCategory: {}
@@ -6987,9 +7058,9 @@ WHERE {
6987
7058
  return o?.count ? parseInt(o.count.value, 10) : 0;
6988
7059
  }
6989
7060
  }
6990
- class nr {
7061
+ class cr {
6991
7062
  constructor(t, e, { language: o, queryCache: r, rdfBase: s = dt, graphType: a }) {
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));
7063
+ this._api = t, this._projectId = e, this.schema = new pr(t, e, o, r, a), this.entities = new me(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));
6993
7064
  }
6994
7065
  _api;
6995
7066
  _projectId;
@@ -7020,7 +7091,7 @@ class nr {
7020
7091
  /** Project document overview (counts by suffix and category). Fetched on init. */
7021
7092
  projectDocumentsData;
7022
7093
  // ── Search state ───────────────────────────────────────────────────────────
7023
- _searchResults = new x(void 0);
7094
+ _searchResults = new k(void 0);
7024
7095
  /** The result of the most recent `search()` call. `undefined` before first search. */
7025
7096
  searchResults;
7026
7097
  _destroyed = !1;
@@ -7107,7 +7178,7 @@ class nr {
7107
7178
  this._destroyed = !0, this._searchResults.set(void 0);
7108
7179
  }
7109
7180
  }
7110
- function Qt(i, t) {
7181
+ function Xt(i, t) {
7111
7182
  return new Promise((e) => {
7112
7183
  const o = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Map();
7113
7184
  for (const m of i)
@@ -7120,14 +7191,14 @@ function Qt(i, t) {
7120
7191
  s.has(m.contentUUID) ? (s.get(m.contentUUID) || []).some((v) => v.locationUUID === m.locationUUID) || p.push(m) : n.push(m);
7121
7192
  const c = [], h = [];
7122
7193
  for (const m of t) {
7123
- const E = o.get(m.contentUUID);
7124
- E ? E.some((v) => v.locationUUID === m.locationUUID) || h.push(m) : c.push(m);
7194
+ const x = o.get(m.contentUUID);
7195
+ x ? x.some((v) => v.locationUUID === m.locationUUID) || h.push(m) : c.push(m);
7125
7196
  }
7126
7197
  const d = i.length - n.length - p.length, g = i.length, w = g > 0 ? d / g : 1;
7127
7198
  let u = 0, f = 0;
7128
7199
  for (const m of i)
7129
7200
  f += m.size || 0, (s.get(m.contentUUID) || []).some((v) => v.locationUUID === m.locationUUID) && (u += m.size || 0);
7130
- const k = f > 0 ? u / f : 1;
7201
+ const E = f > 0 ? u / f : 1;
7131
7202
  e({
7132
7203
  localNotOnRemote: n,
7133
7204
  localNotOnRemotePathOnly: p,
@@ -7137,13 +7208,13 @@ function Qt(i, t) {
7137
7208
  totalCount: g,
7138
7209
  syncSize: u,
7139
7210
  totalSize: f,
7140
- synctPctSize: k,
7211
+ synctPctSize: E,
7141
7212
  synctPctCount: w
7142
7213
  });
7143
7214
  });
7144
7215
  }
7145
7216
  var l = /* @__PURE__ */ ((i) => (i.AUTOMATION = "automation", i.ARCHIVE = "archive", i.AUDIO = "audio", i.BACKUP = "backup", i.BINARY = "binary", i.BIM = "bim", i.CAD = "cad", i.DATA = "data", i.EMAIL = "email", i.FONT = "font", i.GEOSPATIAL = "geospatial", i.IMAGE = "image", i.INSTALLER = "installer", i.MARKUP = "markup", i.MULTIMEDIA = "multimedia", i.PLANNING = "planning", i.PRESENTATION = "presentation", i.SCRIPT = "script", i.SPREADSHEET = "spreadsheet", i.TEXT = "text", i.THREE_D = "3d", i.UNKNOWN = "unknown", i.VIDEO = "video", i))(l || {});
7146
- const pr = {
7217
+ const hr = {
7147
7218
  ".aac": {
7148
7219
  type: l.AUDIO,
7149
7220
  open: !0,
@@ -8004,21 +8075,21 @@ const pr = {
8004
8075
  }
8005
8076
  };
8006
8077
  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 + "";
8007
- const { namedNode: lr, literal: Cr } = j;
8008
- lr("http://www.w3.org/1999/02/22-rdf-syntax-ns#type");
8009
- const { namedNode: Tr } = j, { namedNode: cr, literal: Sr } = j;
8010
- cr("http://www.w3.org/1999/02/22-rdf-syntax-ns#type");
8011
- function hr(i) {
8012
- const t = i.split(".");
8013
- return t.length > 1 ? "." + t.pop()?.toLowerCase() : "";
8014
- }
8015
8078
  const { namedNode: dr, literal: Rr } = j;
8016
8079
  dr("http://www.w3.org/1999/02/22-rdf-syntax-ns#type");
8017
- const { namedNode: gr, literal: Ar } = j;
8080
+ const { namedNode: Ar } = j, { namedNode: gr, literal: Pr } = j;
8018
8081
  gr("http://www.w3.org/1999/02/22-rdf-syntax-ns#type");
8019
- function Xt(i, t, e, o, r, s, a, n = !1, p = !1) {
8020
- const c = hr(i), h = D(o), d = `${t}/${h}${c}`;
8021
- a === void 0 && (a = pr[c]?.mime ?? "application/octet-stream");
8082
+ function ur(i) {
8083
+ const t = i.split(".");
8084
+ return t.length > 1 ? "." + t.pop()?.toLowerCase() : "";
8085
+ }
8086
+ const { namedNode: mr, literal: Or } = j;
8087
+ mr("http://www.w3.org/1999/02/22-rdf-syntax-ns#type");
8088
+ const { namedNode: wr, literal: Dr } = j;
8089
+ wr("http://www.w3.org/1999/02/22-rdf-syntax-ns#type");
8090
+ function Yt(i, t, e, o, r, s, a, n = !1, p = !1) {
8091
+ const c = ur(i), h = D(o), d = `${t}/${h}${c}`;
8092
+ a === void 0 && (a = hr[c]?.mime ?? "application/octet-stream");
8022
8093
  const g = to(i, r);
8023
8094
  return {
8024
8095
  name: i,
@@ -8045,7 +8116,7 @@ async function U() {
8045
8116
  "fs/promises"
8046
8117
  );
8047
8118
  }
8048
- async function Yt(i) {
8119
+ async function Zt(i) {
8049
8120
  if (typeof window < "u")
8050
8121
  throw new Error(
8051
8122
  `Cannot read file from path "${i}" in a browser environment. Provide file.data (Uint8Array) instead.`
@@ -8054,10 +8125,10 @@ async function Yt(i) {
8054
8125
  return t(i);
8055
8126
  }
8056
8127
  let q = null, G = null, H = null;
8057
- function Pr(i) {
8128
+ function Lr(i) {
8058
8129
  H = i, G = null, q = null;
8059
8130
  }
8060
- async function ur() {
8131
+ async function fr() {
8061
8132
  if (typeof window < "u") {
8062
8133
  if (!H)
8063
8134
  throw new Error(
@@ -8079,7 +8150,7 @@ async function ur() {
8079
8150
  await a.default({ module_or_path: r }), q = a.scan;
8080
8151
  }
8081
8152
  }
8082
- const mr = "qlever", $ = 1e3, ut = "cue:pending:";
8153
+ const yr = "qlever", $ = 1e3, ut = "cue:pending:";
8083
8154
  async function mt(i) {
8084
8155
  const { tmpdir: t } = await import(
8085
8156
  /* webpackIgnore: true */
@@ -8090,7 +8161,7 @@ async function mt(i) {
8090
8161
  );
8091
8162
  return e(t(), `cue-sync-pending-${i}.json`);
8092
8163
  }
8093
- async function Zt(i) {
8164
+ async function Jt(i) {
8094
8165
  if (typeof window < "u") {
8095
8166
  const t = window.localStorage.getItem(`${ut}${i}`);
8096
8167
  return t ? JSON.parse(t) : null;
@@ -8102,7 +8173,7 @@ async function Zt(i) {
8102
8173
  return null;
8103
8174
  }
8104
8175
  }
8105
- async function Jt(i) {
8176
+ async function te(i) {
8106
8177
  const t = JSON.stringify(i);
8107
8178
  if (typeof window < "u") {
8108
8179
  window.localStorage.setItem(`${ut}${i.spaceId}`, t);
@@ -8110,7 +8181,7 @@ async function Jt(i) {
8110
8181
  }
8111
8182
  await (await U()).writeFile(await mt(i.spaceId), t, "utf-8");
8112
8183
  }
8113
- async function wr(i) {
8184
+ async function br(i) {
8114
8185
  if (typeof window < "u") {
8115
8186
  window.localStorage.removeItem(`${ut}${i}`);
8116
8187
  return;
@@ -8120,7 +8191,7 @@ async function wr(i) {
8120
8191
  } catch {
8121
8192
  }
8122
8193
  }
8123
- class fr {
8194
+ class vr {
8124
8195
  constructor(t, e, o, r) {
8125
8196
  this._auth = t, this._projects = e, this._blob = o, this._gatewayUrl = r;
8126
8197
  }
@@ -8176,7 +8247,7 @@ class fr {
8176
8247
  */
8177
8248
  async flushPendingMetadata(t, e, o) {
8178
8249
  this._legacy = o ?? !1;
8179
- const r = await Zt(t);
8250
+ const r = await Jt(t);
8180
8251
  if (!(!r || r.items.length === 0)) {
8181
8252
  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 ⏳`);
8182
8253
  try {
@@ -8199,22 +8270,22 @@ class fr {
8199
8270
  this._api?.getConsumption(o) ?? Promise.reject(new Error("CueSyncApi is not bound to a CueApi instance")),
8200
8271
  this._fetchUnitCreditMap(s),
8201
8272
  this._fetchTierNames()
8202
- ]), f = (await Qt(t, h)).localNotOnRemote ?? [], k = f.length > 0 ? await this.scanCost(f) : [];
8203
- let m = 0, E = 0;
8204
- for (const v of k) {
8273
+ ]), f = (await Xt(t, h)).localNotOnRemote ?? [], E = f.length > 0 ? await this.scanCost(f) : [];
8274
+ let m = 0, x = 0;
8275
+ for (const v of E) {
8205
8276
  m += v.units;
8206
8277
  const y = g[c], C = y?.[v.ext] ?? 1;
8207
8278
  s && y && !(v.ext in y) && console.info(` Unknown format: .${v.ext} (using default rate of 1 credit/unit)`);
8208
8279
  const P = v.units * C;
8209
- E += P, v.credits = Math.round(P);
8280
+ x += P, v.credits = Math.round(P);
8210
8281
  }
8211
8282
  const I = w[c] ?? c;
8212
8283
  return {
8213
- costRecords: k,
8284
+ costRecords: E,
8214
8285
  tier: c,
8215
8286
  tierName: I,
8216
8287
  unitsToConsume: m,
8217
- creditsToConsume: Math.round(E),
8288
+ creditsToConsume: Math.round(x),
8218
8289
  creditsAvailable: d.creditsAvailable,
8219
8290
  unitsAvailable: d.unitsAvailable,
8220
8291
  filesToUpload: f.length,
@@ -8231,14 +8302,14 @@ class fr {
8231
8302
  const [d, g] = await Promise.all([
8232
8303
  this._listRemoteFiles(h, o, r, a),
8233
8304
  this._api?.getConsumption(o) ?? Promise.reject(new Error("CueSyncApi is not bound to a CueApi instance"))
8234
- ]), { unitsAvailable: w } = g, u = await Qt(t, d);
8305
+ ]), { unitsAvailable: w } = g, u = await Xt(t, d);
8235
8306
  a && (console.info(`Total local files: ${t.length}`), console.info(`Total remote files: ${d.length}`), console.info(
8236
8307
  `Total files to sync: ${(u.localNotOnRemote?.length ?? 0) + u.localNotOnRemotePathOnly.length}`
8237
8308
  ));
8238
- let f = u.syncCount, k = u.syncSize, m = 0, E = !1;
8309
+ let f = u.syncCount, E = u.syncSize, m = 0, x = !1;
8239
8310
  const I = u.localNotOnRemote ?? [];
8240
8311
  if (I.length > 0) {
8241
- const C = (await this.scanCost(I)).reduce((P, we) => P + we.units, 0);
8312
+ const C = (await this.scanCost(I)).reduce((P, fe) => P + fe.units, 0);
8242
8313
  if (C > w)
8243
8314
  throw new Error(
8244
8315
  `Insufficient units: ${C} units required but only ${w} available.`
@@ -8247,7 +8318,7 @@ class fr {
8247
8318
  await this._initPendingBatch(o, a), a && I.length && console.info("Syncing missing files ⏳");
8248
8319
  for (const y of I)
8249
8320
  try {
8250
- const C = Xt(
8321
+ const C = Yt(
8251
8322
  y.relativePath,
8252
8323
  o,
8253
8324
  s,
@@ -8255,7 +8326,7 @@ class fr {
8255
8326
  r
8256
8327
  );
8257
8328
  if (!C.blob_name) throw new Error(`blob_name missing for ${y.relativePath}`);
8258
- const P = y.data ?? new Uint8Array(await Yt(y.fullPath));
8329
+ const P = y.data ?? new Uint8Array(await Zt(y.fullPath));
8259
8330
  await this._blob.uploadRaw(
8260
8331
  C.blob_name,
8261
8332
  P,
@@ -8266,7 +8337,7 @@ class fr {
8266
8337
  size: y.size,
8267
8338
  providerId: r,
8268
8339
  fileContentExists: !1
8269
- }), E = !0, f += 1, k += y.size || 0, this._logProgress(f, u.totalCount, k, u.totalSize, n);
8340
+ }), x = !0, f += 1, E += y.size || 0, this._logProgress(f, u.totalCount, E, u.totalSize, n);
8270
8341
  } catch (C) {
8271
8342
  m += 1, console.error(`[CueSyncApi] Failed to upload file: ${y.fullPath}`), a && console.error("[CueSyncApi] Upload error details:", C);
8272
8343
  }
@@ -8278,23 +8349,23 @@ class fr {
8278
8349
  size: y.size,
8279
8350
  providerId: r,
8280
8351
  fileContentExists: !0
8281
- }), E = !0, f += 1, k += y.size || 0, this._logProgress(f, u.totalCount, k, u.totalSize, n);
8352
+ }), x = !0, f += 1, E += y.size || 0, this._logProgress(f, u.totalCount, E, u.totalSize, n);
8282
8353
  await this._drainPending(a), this._stopFlushTimer();
8283
8354
  const v = await (this._api?.getConsumption(o) ?? Promise.resolve({ creditsAvailable: 0 }));
8284
8355
  return {
8285
8356
  syncCount: f,
8286
- syncSize: k,
8357
+ syncSize: E,
8287
8358
  failedUploads: m,
8288
8359
  totalCount: u.totalCount,
8289
8360
  totalSize: u.totalSize,
8290
- rdfWritten: E,
8361
+ rdfWritten: x,
8291
8362
  creditsAvailable: v.creditsAvailable
8292
8363
  };
8293
8364
  }
8294
8365
  async _getOrCreateGraph(t, e) {
8295
8366
  const o = this._graphMap.get(t);
8296
8367
  if (o) return o;
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({
8368
+ const s = (await this._projects.getProject(t))?.projectSettings?.graph?.type ?? yr, a = s === "qlever" ? `${this._gatewayUrl}${ne}` : `${this._gatewayUrl}${ie}`, n = s === "qlever" ? `${this._gatewayUrl}${ho}` : `${this._gatewayUrl}${lo}`, p = new Ze({
8298
8369
  graphType: s,
8299
8370
  queryEndpoint: a,
8300
8371
  updateEndpoint: n,
@@ -8360,7 +8431,7 @@ WHERE {
8360
8431
  }
8361
8432
  async _initPendingBatch(t, e) {
8362
8433
  this._flushTimer !== null && (clearInterval(this._flushTimer), this._flushTimer = null), this._pendingSpaceId = t, this._pendingItems = [];
8363
- const o = await Zt(t);
8434
+ const o = await Jt(t);
8364
8435
  if (o && o.items.length > 0) {
8365
8436
  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 ⏳`);
8366
8437
  try {
@@ -8381,7 +8452,7 @@ WHERE {
8381
8452
  typeof r == "object" && typeof r.unref == "function" && r.unref(), this._flushTimer = r;
8382
8453
  }
8383
8454
  async _queueFileLocation(t) {
8384
- this._pendingItems.push(t), this._pendingSpaceId && await Jt({ spaceId: this._pendingSpaceId, items: this._pendingItems });
8455
+ this._pendingItems.push(t), this._pendingSpaceId && await te({ spaceId: this._pendingSpaceId, items: this._pendingItems });
8385
8456
  }
8386
8457
  /**
8387
8458
  * Flush all queued file-location items to the commands API in a single batch.
@@ -8396,18 +8467,18 @@ WHERE {
8396
8467
  }
8397
8468
  async _flushBatch(t, e, o) {
8398
8469
  const r = [...t];
8399
- this._pendingSpaceId === e && (this._pendingItems = []), await wr(e);
8470
+ this._pendingSpaceId === e && (this._pendingItems = []), await br(e);
8400
8471
  try {
8401
8472
  for (let s = 0; s < r.length; s += $)
8402
8473
  await this._postFssBatch(r.slice(s, s + $), e);
8403
8474
  o && console.info(`Wrote ${r.length} file location(s) to commands API ✅`);
8404
8475
  } catch (s) {
8405
8476
  const a = [...r, ...this._pendingItems];
8406
- throw this._pendingItems = a, await Jt({ spaceId: e, items: a }), s;
8477
+ throw this._pendingItems = a, await te({ spaceId: e, items: a }), s;
8407
8478
  }
8408
8479
  }
8409
8480
  async _postFssBatch(t, e) {
8410
- const o = this._legacy ? `${this._gatewayUrl}${Ot}?blob=true` : `${this._gatewayUrl}${Ot}`;
8481
+ const o = this._legacy ? `${this._gatewayUrl}${Dt}?blob=true` : `${this._gatewayUrl}${Dt}`;
8411
8482
  let r;
8412
8483
  try {
8413
8484
  r = await this._auth.authenticatedFetch(o, {
@@ -8437,14 +8508,14 @@ WHERE {
8437
8508
  * shown to the user before or after calling {@link sync}.
8438
8509
  */
8439
8510
  async scanCost(t) {
8440
- if (G || (G = ur()), await G, !q) throw new Error("WASM scan function not initialised");
8511
+ if (G || (G = fr()), await G, !q) throw new Error("WASM scan function not initialised");
8441
8512
  const e = 200, o = /* @__PURE__ */ new Map();
8442
8513
  for (let r = 0; r < t.length; r += e) {
8443
8514
  const s = t.slice(r, r + e), a = await Promise.all(
8444
8515
  s.map(async (p) => ({
8445
8516
  originalPath: p.relativePath,
8446
8517
  // Use pre-loaded data if available (browser), otherwise read from disk (Node.js).
8447
- data: p.data ?? new Uint8Array(await Yt(p.fullPath))
8518
+ data: p.data ?? new Uint8Array(await Zt(p.fullPath))
8448
8519
  }))
8449
8520
  ), n = q(a);
8450
8521
  for (const p of n) {
@@ -8504,7 +8575,7 @@ WHERE {
8504
8575
  const { spaceId: o, providerId: r, userId: s, signal: a, onProgress: n } = e;
8505
8576
  if (!t.data)
8506
8577
  throw new Error("syncBrowserFile requires file.data (Uint8Array). Read the file with File.arrayBuffer() first.");
8507
- const p = Xt(t.relativePath, o, s, t.md5, r);
8578
+ const p = Yt(t.relativePath, o, s, t.md5, r);
8508
8579
  if (!p.blob_name) throw new Error(`blob_name missing for ${t.relativePath}`);
8509
8580
  await this._blob.uploadRaw(
8510
8581
  p.blob_name,
@@ -8548,7 +8619,7 @@ WHERE {
8548
8619
  s({ percent: a, syncCount: t, totalCount: e, syncSize: o, totalSize: r });
8549
8620
  }
8550
8621
  }
8551
- const te = {
8622
+ const ee = {
8552
8623
  production: {
8553
8624
  gatewayUrl: "https://accessors-api-gateway-ueyeemwf2a-oa.a.run.app",
8554
8625
  tokenUrl: "https://accessors-api-gateway-ueyeemwf2a-oa.a.run.app/token",
@@ -8568,7 +8639,7 @@ const te = {
8568
8639
  firestoreEmulatorPort: 8080
8569
8640
  }
8570
8641
  };
8571
- class me {
8642
+ class we {
8572
8643
  auth;
8573
8644
  api;
8574
8645
  projects;
@@ -8595,7 +8666,7 @@ class me {
8595
8666
  * ```
8596
8667
  */
8597
8668
  get gis() {
8598
- return this._gis || (this._gis = new or(
8669
+ return this._gis || (this._gis = new ar(
8599
8670
  () => this.api.getAuthHeaders(),
8600
8671
  this._endpoints.gatewayUrl
8601
8672
  )), this._gis;
@@ -8605,17 +8676,17 @@ class me {
8605
8676
  "Using default SDK app settings. Contact QAECY for your own configuration for any production code."
8606
8677
  );
8607
8678
  const o = t.apiKey ?? Y.apiKey, r = t.appId ?? Y.appId, s = t.measurementId ?? Y.measurementId, a = t.environment ?? "production";
8608
- this._endpoints = { ...te[a], ...t.endpoints }, this._isEmulator = a === "emulator", this._app = fe().find((g) => g.name === "[DEFAULT]") ?? ye({
8679
+ this._endpoints = { ...ee[a], ...t.endpoints }, this._isEmulator = a === "emulator", this._app = ye().find((g) => g.name === "[DEFAULT]") ?? be({
8609
8680
  apiKey: o,
8610
8681
  appId: r,
8611
8682
  measurementId: s,
8612
- authDomain: `${kt}.firebaseapp.com`,
8613
- projectId: kt,
8683
+ authDomain: `${Et}.firebaseapp.com`,
8684
+ projectId: Et,
8614
8685
  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);
8686
+ }), this.auth = new jt(this._app, this._isEmulator, this._endpoints), this.projects = new Gt(this.auth, this._app, this._isEmulator, this._endpoints), this._storageRaw = T(this._app, Ct), this._storageProcessed = T(this._app, Tt);
8687
+ const n = T(this._app, Rt), p = T(this._app, St), c = T(this._app, It), h = T(this._app, At);
8617
8688
  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({
8689
+ const d = new _t({
8619
8690
  storageRaw: this._storageRaw,
8620
8691
  storageProcessed: this._storageProcessed,
8621
8692
  storagePublic: n,
@@ -8623,12 +8694,12 @@ class me {
8623
8694
  storageChatSessions: c,
8624
8695
  storagePersistence: h
8625
8696
  });
8626
- this.storage = new jt(d), this.profile = new Gt(
8697
+ this.storage = new Ut(d), this.profile = new Ht(
8627
8698
  this.auth,
8628
8699
  this._app,
8629
8700
  this._isEmulator,
8630
8701
  this._endpoints.gatewayUrl
8631
- ), this.privileges = new Vt(this.auth.isSuperAdmin), this._isEmulator && K(h, this._endpoints.storageEmulatorHost, this._endpoints.storageEmulatorPort), this.cache = new Kt(h);
8702
+ ), this.privileges = new Kt(this.auth.isSuperAdmin), this._isEmulator && K(h, this._endpoints.storageEmulatorHost, this._endpoints.storageEmulatorPort), this.cache = new Qt(h);
8632
8703
  }
8633
8704
  /**
8634
8705
  * Create a `Cue` instance from an already-initialized Firebase app.
@@ -8647,16 +8718,16 @@ class me {
8647
8718
  * });
8648
8719
  */
8649
8720
  static fromApp(t, e = {}) {
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({
8721
+ const o = e.environment ?? "production", r = { ...ee[o], ...e.endpoints }, s = new jt(t, !1, r), a = new Gt(s, t, !1, r), n = T(t, Ct), p = T(t, Tt), c = T(t, Rt), h = T(t, St), d = T(t, It), g = T(t, At), w = new _t({
8651
8722
  storageRaw: n,
8652
8723
  storageProcessed: p,
8653
8724
  storagePublic: c,
8654
8725
  storageLogs: h,
8655
8726
  storageChatSessions: d,
8656
8727
  storagePersistence: g
8657
- }), u = new fr(s, a, w, r.gatewayUrl), f = new Ut(s, r.gatewayUrl, a, u);
8728
+ }), u = new vr(s, a, w, r.gatewayUrl), f = new Mt(s, r.gatewayUrl, a, u);
8658
8729
  u._bindApi(f);
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);
8730
+ const E = new Ht(s, t, !1, r.gatewayUrl), m = Object.create(we.prototype), x = new Kt(s.isSuperAdmin), I = new Qt(g), v = new Ut(w);
8660
8731
  return Object.assign(m, {
8661
8732
  _app: t,
8662
8733
  _endpoints: r,
@@ -8666,15 +8737,15 @@ class me {
8666
8737
  auth: s,
8667
8738
  api: f,
8668
8739
  projects: a,
8669
- profile: k,
8670
- privileges: E,
8740
+ profile: E,
8741
+ privileges: x,
8671
8742
  cache: I,
8672
8743
  storage: v
8673
8744
  }), m;
8674
8745
  }
8675
8746
  /** Override in subclasses to provide a custom CueApi (e.g. with sync). */
8676
8747
  _buildApi(t) {
8677
- return new Ut(this.auth, this._endpoints.gatewayUrl, t);
8748
+ return new Mt(this.auth, this._endpoints.gatewayUrl, t);
8678
8749
  }
8679
8750
  /** Convenience: get the current user's Firebase ID token */
8680
8751
  getToken(t = !1) {
@@ -8699,7 +8770,7 @@ class me {
8699
8770
  get: (r) => this.cache.getQueryCache(t, r).then((s) => s?.results),
8700
8771
  set: (r, s) => this.cache.setQueryCache(t, r, { query: r, results: s })
8701
8772
  };
8702
- return new nr(this.api, t, { ...e, queryCache: o });
8773
+ return new cr(this.api, t, { ...e, queryCache: o });
8703
8774
  }
8704
8775
  /**
8705
8776
  * Creates a `CueProjectEntities` instance for the given project, with the
@@ -8723,7 +8794,7 @@ class me {
8723
8794
  get: (r) => this.cache.getQueryCache(t, r).then((s) => s?.results),
8724
8795
  set: (r, s) => this.cache.setQueryCache(t, r, { query: r, results: s })
8725
8796
  };
8726
- return new ue(
8797
+ return new me(
8727
8798
  this.api,
8728
8799
  t,
8729
8800
  e?.rdfBase,
@@ -8778,29 +8849,30 @@ class me {
8778
8849
  }
8779
8850
  }
8780
8851
  export {
8781
- xt as B,
8782
- me as C,
8783
- Wt as R,
8784
- Ut as a,
8785
- qt as b,
8786
- Kt as c,
8787
- or as d,
8788
- Vt as e,
8789
- Gt as f,
8790
- pt as g,
8791
- ue as h,
8792
- ar as i,
8793
- nr as j,
8794
- Bt as k,
8795
- x as l,
8796
- jt as m,
8797
- fr as n,
8798
- mo as o,
8799
- Pr as p,
8800
- ct as q,
8801
- Tt as r,
8852
+ It as B,
8853
+ we as C,
8854
+ Vt as R,
8855
+ Mt as a,
8856
+ jt as b,
8857
+ Qt as c,
8858
+ yo as d,
8859
+ ar as e,
8860
+ Kt as f,
8861
+ Ht as g,
8862
+ pt as h,
8863
+ me as i,
8864
+ pr as j,
8865
+ cr as k,
8866
+ Gt as l,
8867
+ k as m,
8868
+ Ut as n,
8869
+ vr as o,
8870
+ wo as p,
8871
+ Lr as q,
8872
+ ct as r,
8802
8873
  ht as s,
8803
- Rt as t,
8804
- St as u,
8805
- vt as v
8874
+ St as t,
8875
+ At as u,
8876
+ Rt as v,
8877
+ _t as w
8806
8878
  };