@pod-os/core 0.12.1-39cd89f.0 → 0.12.1-3c7d98a.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/index.js CHANGED
@@ -300,7 +300,7 @@ var PodOS = (() => {
300
300
  }
301
301
  return this;
302
302
  };
303
- function _listeners(target5, type5, unwrap3) {
303
+ function _listeners(target5, type5, unwrap) {
304
304
  var events3 = target5._events;
305
305
  if (events3 === void 0)
306
306
  return [];
@@ -308,8 +308,8 @@ var PodOS = (() => {
308
308
  if (evlistener === void 0)
309
309
  return [];
310
310
  if (typeof evlistener === "function")
311
- return unwrap3 ? [evlistener.listener || evlistener] : [evlistener];
312
- return unwrap3 ? unwrapListeners(evlistener) : arrayClone(evlistener, evlistener.length);
311
+ return unwrap ? [evlistener.listener || evlistener] : [evlistener];
312
+ return unwrap ? unwrapListeners(evlistener) : arrayClone(evlistener, evlistener.length);
313
313
  }
314
314
  EventEmitter2.prototype.listeners = function listeners(type5) {
315
315
  return _listeners(this, type5, true);
@@ -7770,7 +7770,7 @@ var PodOS = (() => {
7770
7770
  return t3[e2] = r2;
7771
7771
  };
7772
7772
  }
7773
- function wrap3(t2, e2, r2, n3) {
7773
+ function wrap(t2, e2, r2, n3) {
7774
7774
  var i2 = e2 && e2.prototype instanceof Generator ? e2 : Generator, a2 = Object.create(i2.prototype), c2 = new Context(n3 || []);
7775
7775
  return o(a2, "_invoke", {
7776
7776
  value: makeInvokeMethod(t2, r2, c2)
@@ -7789,7 +7789,7 @@ var PodOS = (() => {
7789
7789
  };
7790
7790
  }
7791
7791
  }
7792
- e.wrap = wrap3;
7792
+ e.wrap = wrap;
7793
7793
  var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {};
7794
7794
  function Generator() {
7795
7795
  }
@@ -7935,7 +7935,7 @@ var PodOS = (() => {
7935
7935
  return this;
7936
7936
  }), e.AsyncIterator = AsyncIterator, e.async = function(t2, r2, n3, o2, i2) {
7937
7937
  void 0 === i2 && (i2 = Promise);
7938
- var a2 = new AsyncIterator(wrap3(t2, r2, n3, o2), i2);
7938
+ var a2 = new AsyncIterator(wrap(t2, r2, n3, o2), i2);
7939
7939
  return e.isGeneratorFunction(r2) ? a2 : a2.next().then(function(t3) {
7940
7940
  return t3.done ? t3.value : a2.next();
7941
7941
  });
@@ -10088,6 +10088,8 @@ var PodOS = (() => {
10088
10088
  return buf.push("<?", node2.target, " ", node2.data, "?>");
10089
10089
  case ENTITY_REFERENCE_NODE:
10090
10090
  return buf.push("&", node2.nodeName, ";");
10091
+ //case ENTITY_NODE:
10092
+ //case NOTATION_NODE:
10091
10093
  default:
10092
10094
  buf.push("??", node2.nodeName);
10093
10095
  }
@@ -10098,6 +10100,11 @@ var PodOS = (() => {
10098
10100
  case ELEMENT_NODE:
10099
10101
  node22 = node2.cloneNode(false);
10100
10102
  node22.ownerDocument = doc;
10103
+ //var attrs = node2.attributes;
10104
+ //var len = attrs.length;
10105
+ //for(var i=0;i<len;i++){
10106
+ //node2.setAttributeNodeNS(importNode(doc,attrs.item(i),deep));
10107
+ //}
10101
10108
  case DOCUMENT_FRAGMENT_NODE:
10102
10109
  break;
10103
10110
  case ATTRIBUTE_NODE:
@@ -12500,6 +12507,7 @@ var PodOS = (() => {
12500
12507
  }
12501
12508
  end2++;
12502
12509
  break;
12510
+ // end elment
12503
12511
  case "?":
12504
12512
  locator && position4(tagStart);
12505
12513
  end2 = parseInstruction(source8, tagStart, domBuilder);
@@ -12635,6 +12643,7 @@ var PodOS = (() => {
12635
12643
  case S_ATTR_SPACE:
12636
12644
  el.closed = true;
12637
12645
  break;
12646
+ //case S_EQ:
12638
12647
  default:
12639
12648
  throw new Error("attribute invalid close char('/')");
12640
12649
  }
@@ -12653,7 +12662,9 @@ var PodOS = (() => {
12653
12662
  case S_TAG_SPACE:
12654
12663
  case S_TAG_CLOSE:
12655
12664
  break;
12665
+ //normal
12656
12666
  case S_ATTR_NOQUOT_VALUE:
12667
+ //Compatible state
12657
12668
  case S_ATTR:
12658
12669
  value6 = source8.slice(start2, p);
12659
12670
  if (value6.slice(-1) === "/") {
@@ -12678,6 +12689,7 @@ var PodOS = (() => {
12678
12689
  throw new Error("attribute value missed!!");
12679
12690
  }
12680
12691
  return p;
12692
+ /*xml space '\x20' | #x9 | #xD | #xA; */
12681
12693
  case "\x80":
12682
12694
  c = " ";
12683
12695
  default:
@@ -12701,6 +12713,9 @@ var PodOS = (() => {
12701
12713
  }
12702
12714
  } else {
12703
12715
  switch (s) {
12716
+ //case S_TAG:void();break;
12717
+ //case S_ATTR:void();break;
12718
+ //case S_ATTR_NOQUOT_VALUE:void();break;
12704
12719
  case S_ATTR_SPACE:
12705
12720
  var tagName = el.tagName;
12706
12721
  if (!NAMESPACE.isHTML(currentNSMap[""]) || !attrName.match(/^(?:disabled|checked|selected)$/i)) {
@@ -13562,7 +13577,7 @@ var PodOS = (() => {
13562
13577
  }
13563
13578
  return floor(k + (baseMinusTMin + 1) * delta / (delta + skew));
13564
13579
  }
13565
- function decode4(input2) {
13580
+ function decode3(input2) {
13566
13581
  var output2 = [], inputLength = input2.length, out, i = 0, n2 = initialN, bias = initialBias, basic, j, index2, oldi, w, k, digit, t, baseMinusT;
13567
13582
  basic = input2.lastIndexOf(delimiter);
13568
13583
  if (basic < 0) {
@@ -13666,7 +13681,7 @@ var PodOS = (() => {
13666
13681
  }
13667
13682
  function toUnicode(input2) {
13668
13683
  return mapDomain(input2, function(string2) {
13669
- return regexPunycode.test(string2) ? decode4(string2.slice(4).toLowerCase()) : string2;
13684
+ return regexPunycode.test(string2) ? decode3(string2.slice(4).toLowerCase()) : string2;
13670
13685
  });
13671
13686
  }
13672
13687
  function toASCII(input2) {
@@ -13692,7 +13707,7 @@ var PodOS = (() => {
13692
13707
  "decode": ucs2decode,
13693
13708
  "encode": ucs2encode
13694
13709
  },
13695
- "decode": decode4,
13710
+ "decode": decode3,
13696
13711
  "encode": encode3,
13697
13712
  "toASCII": toASCII,
13698
13713
  "toUnicode": toUnicode
@@ -14716,14 +14731,14 @@ var PodOS = (() => {
14716
14731
  var protoTag = obj instanceof Object ? "" : "null prototype";
14717
14732
  var stringTag = !isPlainObject && toStringTag && Object(obj) === obj && toStringTag in obj ? $slice.call(toStr(obj), 8, -1) : protoTag ? "Object" : "";
14718
14733
  var constructorTag = isPlainObject || typeof obj.constructor !== "function" ? "" : obj.constructor.name ? obj.constructor.name + " " : "";
14719
- var tag3 = constructorTag + (stringTag || protoTag ? "[" + $join.call($concat.call([], stringTag || [], protoTag || []), ": ") + "] " : "");
14734
+ var tag4 = constructorTag + (stringTag || protoTag ? "[" + $join.call($concat.call([], stringTag || [], protoTag || []), ": ") + "] " : "");
14720
14735
  if (ys.length === 0) {
14721
- return tag3 + "{}";
14736
+ return tag4 + "{}";
14722
14737
  }
14723
14738
  if (indent) {
14724
- return tag3 + "{" + indentedJoin(ys, indent) + "}";
14739
+ return tag4 + "{" + indentedJoin(ys, indent) + "}";
14725
14740
  }
14726
- return tag3 + "{ " + $join.call(ys, ", ") + " }";
14741
+ return tag4 + "{ " + $join.call(ys, ", ") + " }";
14727
14742
  }
14728
14743
  return String(obj);
14729
14744
  };
@@ -15236,7 +15251,7 @@ var PodOS = (() => {
15236
15251
  return acc;
15237
15252
  }, target5);
15238
15253
  };
15239
- var decode4 = function(str, decoder2, charset) {
15254
+ var decode3 = function(str, decoder2, charset) {
15240
15255
  var strWithoutPlus = str.replace(/\+/g, " ");
15241
15256
  if (charset === "iso-8859-1") {
15242
15257
  return strWithoutPlus.replace(/%[0-9a-f]{2}/gi, unescape);
@@ -15339,7 +15354,7 @@ var PodOS = (() => {
15339
15354
  assign,
15340
15355
  combine,
15341
15356
  compact,
15342
- decode: decode4,
15357
+ decode: decode3,
15343
15358
  encode: encode3,
15344
15359
  isBuffer,
15345
15360
  isRegExp,
@@ -15655,6 +15670,7 @@ var PodOS = (() => {
15655
15670
  parameterLimit: 1e3,
15656
15671
  parseArrays: true,
15657
15672
  plainObjects: false,
15673
+ strictDepth: false,
15658
15674
  strictNullHandling: false
15659
15675
  };
15660
15676
  var interpretNumericEntities = function(str) {
@@ -15673,6 +15689,7 @@ var PodOS = (() => {
15673
15689
  var parseValues = function parseQueryStringValues(str, options) {
15674
15690
  var obj = { __proto__: null };
15675
15691
  var cleanStr = options.ignoreQueryPrefix ? str.replace(/^\?/, "") : str;
15692
+ cleanStr = cleanStr.replace(/%5B/gi, "[").replace(/%5D/gi, "]");
15676
15693
  var limit3 = options.parameterLimit === Infinity ? void 0 : options.parameterLimit;
15677
15694
  var parts = cleanStr.split(options.delimiter, limit3);
15678
15695
  var skipIndex = -1;
@@ -15732,7 +15749,7 @@ var PodOS = (() => {
15732
15749
  var obj;
15733
15750
  var root = chain2[i];
15734
15751
  if (root === "[]" && options.parseArrays) {
15735
- obj = options.allowEmptyArrays && leaf === "" ? [] : [].concat(leaf);
15752
+ obj = options.allowEmptyArrays && (leaf === "" || options.strictNullHandling && leaf === null) ? [] : [].concat(leaf);
15736
15753
  } else {
15737
15754
  obj = options.plainObjects ? /* @__PURE__ */ Object.create(null) : {};
15738
15755
  var cleanRoot = root.charAt(0) === "[" && root.charAt(root.length - 1) === "]" ? root.slice(1, -1) : root;
@@ -15780,6 +15797,9 @@ var PodOS = (() => {
15780
15797
  keys.push(segment[1]);
15781
15798
  }
15782
15799
  if (segment) {
15800
+ if (options.strictDepth === true) {
15801
+ throw new RangeError("Input depth exceeded depth option of " + options.depth + " and strictDepth is true");
15802
+ }
15783
15803
  keys.push("[" + key3.slice(segment.index) + "]");
15784
15804
  }
15785
15805
  return parseObject(keys, val, options, valuesParsed);
@@ -15826,6 +15846,7 @@ var PodOS = (() => {
15826
15846
  parameterLimit: typeof opts.parameterLimit === "number" ? opts.parameterLimit : defaults.parameterLimit,
15827
15847
  parseArrays: opts.parseArrays !== false,
15828
15848
  plainObjects: typeof opts.plainObjects === "boolean" ? opts.plainObjects : defaults.plainObjects,
15849
+ strictDepth: typeof opts.strictDepth === "boolean" ? !!opts.strictDepth : defaults.strictDepth,
15829
15850
  strictNullHandling: typeof opts.strictNullHandling === "boolean" ? opts.strictNullHandling : defaults.strictNullHandling
15830
15851
  };
15831
15852
  };
@@ -21859,7 +21880,7 @@ var PodOS = (() => {
21859
21880
  throw new Error("Can't serialize object of type " + st3.object.termType + " into XML");
21860
21881
  }
21861
21882
  }
21862
- var tag3 = type5 ? qname(type5) : "rdf:Description";
21883
+ var tag4 = type5 ? qname(type5) : "rdf:Description";
21863
21884
  var attrs = "";
21864
21885
  if (subject5.termType === "BlankNode") {
21865
21886
  if (!stats.incoming[subject5] || stats.incoming[subject5].length !== 1) {
@@ -21868,7 +21889,7 @@ var PodOS = (() => {
21868
21889
  } else {
21869
21890
  attrs = ' rdf:about="' + relURI(subject5) + '"';
21870
21891
  }
21871
- return ["<" + tag3 + attrs + ">"].concat([results]).concat(["</" + tag3 + ">"]);
21892
+ return ["<" + tag4 + attrs + ">"].concat([results]).concat(["</" + tag4 + ">"]);
21872
21893
  }
21873
21894
  var subjectXMLTree = subjectXMLTreeMethod.bind(this);
21874
21895
  function collectionXMLTree(subject5, stats) {
@@ -23777,6 +23798,7 @@ var PodOS = (() => {
23777
23798
  return new BlankNode(term3.value);
23778
23799
  case CollectionTermType:
23779
23800
  return term3;
23801
+ // non-RDF/JS type, should just need to cast
23780
23802
  case DefaultGraphTermType:
23781
23803
  return new DefaultGraph();
23782
23804
  case EmptyTermType:
@@ -23898,6 +23920,7 @@ var PodOS = (() => {
23898
23920
  break;
23899
23921
  case "Literal":
23900
23922
  case "BlankNode":
23923
+ // @ts-ignore Collections can appear here
23901
23924
  case "Collection":
23902
23925
  this.add(target5, st3.predicate, st3.object.copy(this));
23903
23926
  }
@@ -24629,7 +24652,7 @@ var PodOS = (() => {
24629
24652
  return utftext;
24630
24653
  },
24631
24654
  // public method for url decoding
24632
- decode: function decode3(utftext) {
24655
+ decode: function decode2(utftext) {
24633
24656
  var string2 = "";
24634
24657
  var i = 0;
24635
24658
  while (i < utftext.length) {
@@ -28992,15 +29015,15 @@ var PodOS = (() => {
28992
29015
  }
28993
29016
  return resolved;
28994
29017
  }
28995
- _cacheResolvedContext({ key: key3, resolved, tag: tag3 }) {
29018
+ _cacheResolvedContext({ key: key3, resolved, tag: tag4 }) {
28996
29019
  this.perOpCache.set(key3, resolved);
28997
- if (tag3 !== void 0) {
29020
+ if (tag4 !== void 0) {
28998
29021
  let tagMap = this.sharedCache.get(key3);
28999
29022
  if (!tagMap) {
29000
29023
  tagMap = /* @__PURE__ */ new Map();
29001
29024
  this.sharedCache.set(key3, tagMap);
29002
29025
  }
29003
- tagMap.set(tag3, resolved);
29026
+ tagMap.set(tag4, resolved);
29004
29027
  }
29005
29028
  return resolved;
29006
29029
  }
@@ -34734,6 +34757,7 @@ var PodOS = (() => {
34734
34757
  }
34735
34758
  break;
34736
34759
  }
34760
+ // Fall through in case the type is an IRI
34737
34761
  case "<":
34738
34762
  if (match = this._unescapedIri.exec(input2))
34739
34763
  type5 = "IRI", value6 = match[1];
@@ -34799,6 +34823,7 @@ var PodOS = (() => {
34799
34823
  matchLength = 1;
34800
34824
  break;
34801
34825
  }
34826
+ // Fall through to numerical case (could be a decimal dot)
34802
34827
  case "0":
34803
34828
  case "1":
34804
34829
  case "2":
@@ -35346,19 +35371,23 @@ var PodOS = (() => {
35346
35371
  // ### `_readInTopContext` reads a token when in the top context
35347
35372
  _readInTopContext(token) {
35348
35373
  switch (token.type) {
35374
+ // If an EOF token arrives in the top context, signal that we're done
35349
35375
  case "eof":
35350
35376
  if (this._graph !== null)
35351
35377
  return this._error("Unclosed graph", token);
35352
35378
  delete this._prefixes._;
35353
35379
  return this._callback(null, null, this._prefixes);
35380
+ // It could be a prefix declaration
35354
35381
  case "PREFIX":
35355
35382
  this._sparqlStyle = true;
35356
35383
  case "@prefix":
35357
35384
  return this._readPrefix;
35385
+ // It could be a base declaration
35358
35386
  case "BASE":
35359
35387
  this._sparqlStyle = true;
35360
35388
  case "@base":
35361
35389
  return this._readBaseIRI;
35390
+ // It could be a graph
35362
35391
  case "{":
35363
35392
  if (this._supportsNamedGraphs) {
35364
35393
  this._graph = "";
@@ -35368,6 +35397,7 @@ var PodOS = (() => {
35368
35397
  case "GRAPH":
35369
35398
  if (this._supportsNamedGraphs)
35370
35399
  return this._readNamedGraphLabel;
35400
+ // Otherwise, the next token must be a subject
35371
35401
  default:
35372
35402
  return this._readSubject(token);
35373
35403
  }
@@ -35376,6 +35406,7 @@ var PodOS = (() => {
35376
35406
  _readEntity(token, quantifier) {
35377
35407
  let value6;
35378
35408
  switch (token.type) {
35409
+ // Read a relative or absolute IRI
35379
35410
  case "IRI":
35380
35411
  case "typeIRI":
35381
35412
  const iri = this._resolveIRI(token.value);
@@ -35383,6 +35414,7 @@ var PodOS = (() => {
35383
35414
  return this._error("Invalid IRI", token);
35384
35415
  value6 = this._namedNode(iri);
35385
35416
  break;
35417
+ // Read a prefixed name
35386
35418
  case "type":
35387
35419
  case "prefixed":
35388
35420
  const prefix2 = this._prefixes[token.prefix];
@@ -35390,12 +35422,15 @@ var PodOS = (() => {
35390
35422
  return this._error(`Undefined prefix "${token.prefix}:"`, token);
35391
35423
  value6 = this._namedNode(prefix2 + token.value);
35392
35424
  break;
35425
+ // Read a blank node
35393
35426
  case "blank":
35394
35427
  value6 = this._blankNode(this._prefixes[token.prefix] + token.value);
35395
35428
  break;
35429
+ // Read a variable
35396
35430
  case "var":
35397
35431
  value6 = this._variable(token.value.substr(1));
35398
35432
  break;
35433
+ // Everything else is not an entity
35399
35434
  default:
35400
35435
  return this._error(`Expected entity but got ${token.type}`, token);
35401
35436
  }
@@ -35699,6 +35734,7 @@ var PodOS = (() => {
35699
35734
  _completeLiteral(token) {
35700
35735
  let literal5 = this._literal(this._literalValue);
35701
35736
  switch (token.type) {
35737
+ // Create a datatyped literal
35702
35738
  case "type":
35703
35739
  case "typeIRI":
35704
35740
  const datatype = this._readEntity(token);
@@ -35706,6 +35742,7 @@ var PodOS = (() => {
35706
35742
  literal5 = this._literal(this._literalValue, datatype);
35707
35743
  token = null;
35708
35744
  break;
35745
+ // Create a language-tagged string
35709
35746
  case "langcode":
35710
35747
  literal5 = this._literal(this._literalValue, token.value);
35711
35748
  token = null;
@@ -35747,23 +35784,28 @@ var PodOS = (() => {
35747
35784
  let next3, graph4 = this._graph;
35748
35785
  const subject5 = this._subject, inversePredicate = this._inversePredicate;
35749
35786
  switch (token.type) {
35787
+ // A closing brace ends a graph
35750
35788
  case "}":
35751
35789
  if (this._graph === null)
35752
35790
  return this._error("Unexpected graph closing", token);
35753
35791
  if (this._n3Mode)
35754
35792
  return this._readFormulaTail(token);
35755
35793
  this._graph = null;
35794
+ // A dot just ends the statement, without sharing anything with the next
35756
35795
  case ".":
35757
35796
  this._subject = null;
35758
35797
  next3 = this._contextStack.length ? this._readSubject : this._readInTopContext;
35759
35798
  if (inversePredicate) this._inversePredicate = false;
35760
35799
  break;
35800
+ // Semicolon means the subject is shared; predicate and object are different
35761
35801
  case ";":
35762
35802
  next3 = this._readPredicate;
35763
35803
  break;
35804
+ // Comma means both the subject and predicate are shared; the object is different
35764
35805
  case ",":
35765
35806
  next3 = this._readObject;
35766
35807
  break;
35808
+ // {| means that the current triple is annotated with predicate-object pairs.
35767
35809
  case "{|":
35768
35810
  if (!this._supportsRDFStar)
35769
35811
  return this._error("Unexpected RDF* syntax", token);
@@ -35771,6 +35813,7 @@ var PodOS = (() => {
35771
35813
  this._subject = this._quad(subject5, predicate2, object6, this.DEFAULTGRAPH);
35772
35814
  next3 = this._readPredicate;
35773
35815
  break;
35816
+ // |} means that the current quoted triple in annotation syntax is finalized.
35774
35817
  case "|}":
35775
35818
  if (this._subject.termType !== "Quad")
35776
35819
  return this._error("Unexpected asserted triple closing", token);
@@ -35797,9 +35840,11 @@ var PodOS = (() => {
35797
35840
  _readBlankNodePunctuation(token) {
35798
35841
  let next3;
35799
35842
  switch (token.type) {
35843
+ // Semicolon means the subject is shared; predicate and object are different
35800
35844
  case ";":
35801
35845
  next3 = this._readPredicate;
35802
35846
  break;
35847
+ // Comma means both the subject and predicate are shared; the object is different
35803
35848
  case ",":
35804
35849
  next3 = this._readObject;
35805
35850
  break;
@@ -35922,10 +35967,13 @@ var PodOS = (() => {
35922
35967
  // ### `_readPath` reads a potential path
35923
35968
  _readPath(token) {
35924
35969
  switch (token.type) {
35970
+ // Forward path
35925
35971
  case "!":
35926
35972
  return this._readForwardPath;
35973
+ // Backward path
35927
35974
  case "^":
35928
35975
  return this._readBackwardPath;
35976
+ // Not a path; resume reading where we left off
35929
35977
  default:
35930
35978
  const stack = this._contextStack, parent4 = stack.length && stack[stack.length - 1];
35931
35979
  if (parent4 && parent4.type === "item") {
@@ -36031,12 +36079,16 @@ var PodOS = (() => {
36031
36079
  if (!iri.length)
36032
36080
  return this._base;
36033
36081
  switch (iri[0]) {
36082
+ // Resolve relative fragment IRIs against the base IRI
36034
36083
  case "#":
36035
36084
  return this._base + iri;
36085
+ // Resolve relative query string IRIs by replacing the query string
36036
36086
  case "?":
36037
36087
  return this._base.replace(/(?:\?.*)?$/, iri);
36088
+ // Resolve root-relative IRIs at the root of the base IRI
36038
36089
  case "/":
36039
36090
  return (iri[1] === "/" ? this._baseScheme : this._baseRoot) + this._removeDotSegments(iri);
36091
+ // Resolve all other IRIs at the base IRI's path
36040
36092
  default:
36041
36093
  return /^[^/:]*:/.test(iri) ? null : this._removeDotSegments(this._basePath + iri);
36042
36094
  }
@@ -36049,6 +36101,7 @@ var PodOS = (() => {
36049
36101
  let result5 = "", i = -1, pathStart = -1, segmentStart = 0, next3 = "/";
36050
36102
  while (i < length2) {
36051
36103
  switch (next3) {
36104
+ // The path starts with the first slash after the authority
36052
36105
  case ":":
36053
36106
  if (pathStart < 0) {
36054
36107
  if (iri[++i] === "/" && iri[++i] === "/")
@@ -36056,22 +36109,27 @@ var PodOS = (() => {
36056
36109
  i = pathStart;
36057
36110
  }
36058
36111
  break;
36112
+ // Don't modify a query string or fragment
36059
36113
  case "?":
36060
36114
  case "#":
36061
36115
  i = length2;
36062
36116
  break;
36117
+ // Handle '/.' or '/..' path segments
36063
36118
  case "/":
36064
36119
  if (iri[i + 1] === ".") {
36065
36120
  next3 = iri[++i + 1];
36066
36121
  switch (next3) {
36122
+ // Remove a '/.' segment
36067
36123
  case "/":
36068
36124
  result5 += iri.substring(segmentStart, i - 1);
36069
36125
  segmentStart = i + 1;
36070
36126
  break;
36127
+ // Remove a trailing '/.' segment
36071
36128
  case void 0:
36072
36129
  case "?":
36073
36130
  case "#":
36074
36131
  return result5 + iri.substring(segmentStart, i) + iri.substr(i + 1);
36132
+ // Remove a '/..' segment
36075
36133
  case ".":
36076
36134
  next3 = iri[++i + 1];
36077
36135
  if (next3 === void 0 || next3 === "/" || next3 === "?" || next3 === "#") {
@@ -37954,7 +38012,7 @@ var PodOS = (() => {
37954
38012
  };
37955
38013
  if (support2.formData) {
37956
38014
  this.formData = function() {
37957
- return this.text().then(decode4);
38015
+ return this.text().then(decode3);
37958
38016
  };
37959
38017
  }
37960
38018
  this.json = function() {
@@ -38005,7 +38063,7 @@ var PodOS = (() => {
38005
38063
  Request.prototype.clone = function() {
38006
38064
  return new Request(this, { body: this._bodyInit });
38007
38065
  };
38008
- function decode4(body) {
38066
+ function decode3(body) {
38009
38067
  var form2 = new FormData();
38010
38068
  body.trim().split("&").forEach(function(bytes) {
38011
38069
  if (bytes) {
@@ -40959,6 +41017,7 @@ var PodOS = (() => {
40959
41017
  case "text/n3":
40960
41018
  case "text/turtle":
40961
41019
  case "application/x-turtle":
41020
+ // Legacy
40962
41021
  case "application/n3":
40963
41022
  documentString = sz.statementsToN3(data2);
40964
41023
  break;
@@ -41150,14 +41209,11 @@ var PodOS = (() => {
41150
41209
  });
41151
41210
 
41152
41211
  // ../node_modules/@solid-data-modules/contacts-rdflib/dist/rdflib/namespaces.js
41153
- var rdf3, vcard, solid, pim, dc;
41212
+ var vcard, dc;
41154
41213
  var init_namespaces = __esm({
41155
41214
  "../node_modules/@solid-data-modules/contacts-rdflib/dist/rdflib/namespaces.js"() {
41156
41215
  init_esm();
41157
- rdf3 = Namespace("http://www.w3.org/1999/02/22-rdf-syntax-ns#");
41158
41216
  vcard = Namespace("http://www.w3.org/2006/vcard/ns#");
41159
- solid = Namespace("http://www.w3.org/ns/solid/terms#");
41160
- pim = Namespace("http://www.w3.org/ns/pim/space#");
41161
41217
  dc = Namespace("http://purl.org/dc/elements/1.1/");
41162
41218
  }
41163
41219
  });
@@ -41504,25 +41560,32 @@ var PodOS = (() => {
41504
41560
  }
41505
41561
  });
41506
41562
 
41507
- // ../node_modules/@solid-data-modules/contacts-rdflib/dist/rdflib/generate-id.js
41563
+ // ../node_modules/@solid-data-modules/rdflib-utils/dist/identifier/generate-id.js
41508
41564
  function generateId() {
41509
41565
  return uid.rnd(6);
41510
41566
  }
41511
41567
  var import_short_unique_id, uid;
41512
41568
  var init_generate_id = __esm({
41513
- "../node_modules/@solid-data-modules/contacts-rdflib/dist/rdflib/generate-id.js"() {
41569
+ "../node_modules/@solid-data-modules/rdflib-utils/dist/identifier/generate-id.js"() {
41514
41570
  import_short_unique_id = __toESM(require_short_unique_id(), 1);
41515
41571
  uid = new import_short_unique_id.default({ length: 10 });
41516
41572
  }
41517
41573
  });
41518
41574
 
41575
+ // ../node_modules/@solid-data-modules/rdflib-utils/dist/identifier/index.js
41576
+ var init_identifier = __esm({
41577
+ "../node_modules/@solid-data-modules/rdflib-utils/dist/identifier/index.js"() {
41578
+ init_generate_id();
41579
+ }
41580
+ });
41581
+
41519
41582
  // ../node_modules/@solid-data-modules/contacts-rdflib/dist/rdflib/queries/AddressBookQuery.js
41520
41583
  var AddressBookQuery;
41521
41584
  var init_AddressBookQuery = __esm({
41522
41585
  "../node_modules/@solid-data-modules/contacts-rdflib/dist/rdflib/queries/AddressBookQuery.js"() {
41523
41586
  init_esm();
41524
41587
  init_namespaces();
41525
- init_generate_id();
41588
+ init_identifier();
41526
41589
  AddressBookQuery = class {
41527
41590
  constructor(store, addressBookNode) {
41528
41591
  this.store = store;
@@ -41640,11 +41703,37 @@ var PodOS = (() => {
41640
41703
  }
41641
41704
  });
41642
41705
 
41706
+ // ../node_modules/@solid-data-modules/contacts-rdflib/dist/rdflib/queries/GroupQuery.js
41707
+ var GroupQuery;
41708
+ var init_GroupQuery = __esm({
41709
+ "../node_modules/@solid-data-modules/contacts-rdflib/dist/rdflib/queries/GroupQuery.js"() {
41710
+ init_esm();
41711
+ init_namespaces();
41712
+ GroupQuery = class {
41713
+ constructor(store, groupNode) {
41714
+ this.store = store;
41715
+ this.groupNode = groupNode;
41716
+ this.groupDoc = groupNode.doc();
41717
+ }
41718
+ queryName() {
41719
+ return this.store.anyValue(this.groupNode, vcard("fn"), void 0, this.groupDoc) ?? "";
41720
+ }
41721
+ queryMembers() {
41722
+ return this.store.each(this.groupNode, vcard("hasMember"), null, this.groupDoc).filter((it) => isNamedNode(it)).map((node2) => ({
41723
+ uri: node2.value,
41724
+ name: this.store.anyValue(node2, vcard("fn"), null, this.groupDoc) ?? ""
41725
+ }));
41726
+ }
41727
+ };
41728
+ }
41729
+ });
41730
+
41643
41731
  // ../node_modules/@solid-data-modules/contacts-rdflib/dist/rdflib/queries/index.js
41644
41732
  var init_queries = __esm({
41645
41733
  "../node_modules/@solid-data-modules/contacts-rdflib/dist/rdflib/queries/index.js"() {
41646
41734
  init_AddressBookQuery();
41647
41735
  init_ContactQuery();
41736
+ init_GroupQuery();
41648
41737
  }
41649
41738
  });
41650
41739
 
@@ -41664,14 +41753,251 @@ var PodOS = (() => {
41664
41753
  uri: uri6,
41665
41754
  deletions: [],
41666
41755
  insertions,
41667
- filesToCreate: [{ uri: nameEmailIndexUri }, { uri: groupIndexUri }]
41756
+ filesToCreate: [{ url: nameEmailIndexUri }, { url: groupIndexUri }]
41668
41757
  };
41669
41758
  }
41670
41759
  var init_createAddressBook = __esm({
41671
41760
  "../node_modules/@solid-data-modules/contacts-rdflib/dist/rdflib/update-operations/createAddressBook.js"() {
41672
41761
  init_esm();
41673
41762
  init_namespaces();
41674
- init_generate_id();
41763
+ init_identifier();
41764
+ }
41765
+ });
41766
+
41767
+ // ../node_modules/@solid-data-modules/rdflib-utils/dist/web-operations/executeUpdate.js
41768
+ async function executeUpdate(fetcher3, updater, operation3) {
41769
+ await updater.updateMany(operation3.deletions, operation3.insertions);
41770
+ operation3.filesToCreate.map((file2) => {
41771
+ createEmptyTurtleFile(fetcher3, file2.url);
41772
+ });
41773
+ }
41774
+ function createEmptyTurtleFile(fetcher3, url7) {
41775
+ return fetcher3.webOperation("PUT", url7, {
41776
+ contentType: "text/turtle"
41777
+ });
41778
+ }
41779
+ var init_executeUpdate = __esm({
41780
+ "../node_modules/@solid-data-modules/rdflib-utils/dist/web-operations/executeUpdate.js"() {
41781
+ }
41782
+ });
41783
+
41784
+ // ../node_modules/@solid-data-modules/rdflib-utils/dist/web-operations/fetchNode.js
41785
+ async function fetchNode(fetcher3, node2) {
41786
+ if (node2) {
41787
+ await fetcher3.load(node2.value);
41788
+ }
41789
+ }
41790
+ var init_fetchNode = __esm({
41791
+ "../node_modules/@solid-data-modules/rdflib-utils/dist/web-operations/fetchNode.js"() {
41792
+ }
41793
+ });
41794
+
41795
+ // ../node_modules/@solid-data-modules/rdflib-utils/dist/web-operations/index.js
41796
+ var init_web_operations = __esm({
41797
+ "../node_modules/@solid-data-modules/rdflib-utils/dist/web-operations/index.js"() {
41798
+ init_executeUpdate();
41799
+ init_fetchNode();
41800
+ }
41801
+ });
41802
+
41803
+ // ../node_modules/@solid-data-modules/rdflib-utils/dist/namespaces/index.js
41804
+ var rdf3, solid, pim, ldp;
41805
+ var init_namespaces2 = __esm({
41806
+ "../node_modules/@solid-data-modules/rdflib-utils/dist/namespaces/index.js"() {
41807
+ init_esm();
41808
+ rdf3 = Namespace("http://www.w3.org/1999/02/22-rdf-syntax-ns#");
41809
+ solid = Namespace("http://www.w3.org/ns/solid/terms#");
41810
+ pim = Namespace("http://www.w3.org/ns/pim/space#");
41811
+ ldp = Namespace("http://www.w3.org/ns/ldp#");
41812
+ }
41813
+ });
41814
+
41815
+ // ../node_modules/@solid-data-modules/rdflib-utils/dist/queries/PreferencesQuery.js
41816
+ var PreferencesQuery;
41817
+ var init_PreferencesQuery = __esm({
41818
+ "../node_modules/@solid-data-modules/rdflib-utils/dist/queries/PreferencesQuery.js"() {
41819
+ init_esm();
41820
+ init_namespaces2();
41821
+ PreferencesQuery = class {
41822
+ constructor(store, webIdNode, preferencesDoc) {
41823
+ this.store = store;
41824
+ this.webIdNode = webIdNode;
41825
+ this.preferencesDoc = preferencesDoc;
41826
+ }
41827
+ /**
41828
+ * Look up the private type index. Returns null if none is found or if the predicated does not link to a proper named node
41829
+ */
41830
+ queryPrivateTypeIndex() {
41831
+ const node2 = this.store.any(this.webIdNode, solid("privateTypeIndex"), null, this.preferencesDoc);
41832
+ if (isNamedNode(node2)) {
41833
+ return node2;
41834
+ }
41835
+ return null;
41836
+ }
41837
+ };
41838
+ }
41839
+ });
41840
+
41841
+ // ../node_modules/@solid-data-modules/rdflib-utils/dist/queries/ProfileQuery.js
41842
+ var ProfileQuery;
41843
+ var init_ProfileQuery = __esm({
41844
+ "../node_modules/@solid-data-modules/rdflib-utils/dist/queries/ProfileQuery.js"() {
41845
+ init_esm();
41846
+ init_namespaces2();
41847
+ ProfileQuery = class {
41848
+ constructor(webIdNode, store) {
41849
+ this.webIdNode = webIdNode;
41850
+ this.store = store;
41851
+ }
41852
+ /**
41853
+ * Look up the public type index. Returns null if none is found or if the predicated does not link to a proper named node
41854
+ */
41855
+ queryPublicTypeIndex() {
41856
+ const predicate2 = solid("publicTypeIndex");
41857
+ return this.queryNamedNode(predicate2);
41858
+ }
41859
+ /**
41860
+ * Look up the preferences file. Returns null if none is found or if the predicated does not link to a proper named node
41861
+ */
41862
+ queryPreferencesFile() {
41863
+ const predicate2 = pim("preferencesFile");
41864
+ return this.queryNamedNode(predicate2);
41865
+ }
41866
+ queryNamedNode(predicate2) {
41867
+ const node2 = this.store.any(this.webIdNode, predicate2, null, this.webIdNode.doc());
41868
+ if (isNamedNode(node2)) {
41869
+ return node2;
41870
+ }
41871
+ return null;
41872
+ }
41873
+ };
41874
+ }
41875
+ });
41876
+
41877
+ // ../node_modules/@solid-data-modules/rdflib-utils/dist/queries/TypeIndexQuery.js
41878
+ var TypeIndexQuery;
41879
+ var init_TypeIndexQuery = __esm({
41880
+ "../node_modules/@solid-data-modules/rdflib-utils/dist/queries/TypeIndexQuery.js"() {
41881
+ init_esm();
41882
+ init_namespaces2();
41883
+ TypeIndexQuery = class {
41884
+ constructor(store, typeIndexDoc) {
41885
+ this.store = store;
41886
+ this.typeIndexDoc = typeIndexDoc;
41887
+ }
41888
+ /**
41889
+ * Look up the instances in the type registration for the given RDF class
41890
+ * @param type - The RDF class to look up
41891
+ * @returns A list of the URIs of the found instances
41892
+ */
41893
+ queryInstancesForClass(type5) {
41894
+ const registrations = this.store.each(null, solid("forClass"), type5, this.typeIndexDoc);
41895
+ return registrations.flatMap((registration) => {
41896
+ if (!isNamedNode(registration))
41897
+ return [];
41898
+ return this.getInstanceValues(registration);
41899
+ });
41900
+ }
41901
+ getInstanceValues(registration) {
41902
+ return this.store.each(registration, solid("instance"), null, this.typeIndexDoc).map((it) => it.value);
41903
+ }
41904
+ };
41905
+ }
41906
+ });
41907
+
41908
+ // ../node_modules/@solid-data-modules/rdflib-utils/dist/queries/index.js
41909
+ var init_queries2 = __esm({
41910
+ "../node_modules/@solid-data-modules/rdflib-utils/dist/queries/index.js"() {
41911
+ init_PreferencesQuery();
41912
+ init_ProfileQuery();
41913
+ init_TypeIndexQuery();
41914
+ }
41915
+ });
41916
+
41917
+ // ../node_modules/@solid-data-modules/rdflib-utils/dist/module/ModuleSupport.js
41918
+ var ModuleSupport;
41919
+ var init_ModuleSupport = __esm({
41920
+ "../node_modules/@solid-data-modules/rdflib-utils/dist/module/ModuleSupport.js"() {
41921
+ init_esm();
41922
+ init_dist();
41923
+ init_namespaces2();
41924
+ ModuleSupport = class {
41925
+ constructor(config2) {
41926
+ this.store = config2.store;
41927
+ this.fetcher = config2.fetcher;
41928
+ this.updater = config2.updater;
41929
+ }
41930
+ /**
41931
+ * Nullsafe fetching of a node
41932
+ * @param node - A node to fetch, or null to do nothing at all
41933
+ */
41934
+ async fetchNode(node2) {
41935
+ return fetchNode(this.fetcher, node2);
41936
+ }
41937
+ /**
41938
+ * Fetch all the given nodes in parallel
41939
+ * @param nodes
41940
+ */
41941
+ async fetchAll(nodes) {
41942
+ return Promise.all(nodes.map((it) => this.fetchNode(it)));
41943
+ }
41944
+ /**
41945
+ * Checks whether the resource identified by the given URL is a LDP container
41946
+ * @param storageUrl - The URL to check
41947
+ * @returns true if it is a container, false otherwise
41948
+ */
41949
+ async isContainer(storageUrl) {
41950
+ const storageNode = namedNode2(storageUrl);
41951
+ await this.fetcher.load(storageNode.value);
41952
+ return this.store.holds(storageNode, rdf3("type"), ldp("Container"), storageNode.doc());
41953
+ }
41954
+ };
41955
+ }
41956
+ });
41957
+
41958
+ // ../node_modules/@solid-data-modules/rdflib-utils/dist/module/index.js
41959
+ var init_module = __esm({
41960
+ "../node_modules/@solid-data-modules/rdflib-utils/dist/module/index.js"() {
41961
+ init_ModuleSupport();
41962
+ }
41963
+ });
41964
+
41965
+ // ../node_modules/@solid-data-modules/rdflib-utils/dist/update-operations/addInstanceToTypeIndex.js
41966
+ function addInstanceToTypeIndex(typeIndexDoc, instanceUri, type5) {
41967
+ const registrationNode = namedNode2(`${typeIndexDoc.value}#${generateId()}`);
41968
+ return {
41969
+ deletions: [],
41970
+ filesToCreate: [],
41971
+ insertions: [
41972
+ st2(registrationNode, rdf3("type"), solid("TypeRegistration"), typeIndexDoc),
41973
+ st2(registrationNode, solid("forClass"), type5, typeIndexDoc),
41974
+ st2(registrationNode, solid("instance"), namedNode2(instanceUri), typeIndexDoc)
41975
+ ]
41976
+ };
41977
+ }
41978
+ var init_addInstanceToTypeIndex = __esm({
41979
+ "../node_modules/@solid-data-modules/rdflib-utils/dist/update-operations/addInstanceToTypeIndex.js"() {
41980
+ init_esm();
41981
+ init_identifier();
41982
+ init_namespaces2();
41983
+ }
41984
+ });
41985
+
41986
+ // ../node_modules/@solid-data-modules/rdflib-utils/dist/update-operations/index.js
41987
+ var init_update_operations = __esm({
41988
+ "../node_modules/@solid-data-modules/rdflib-utils/dist/update-operations/index.js"() {
41989
+ init_addInstanceToTypeIndex();
41990
+ }
41991
+ });
41992
+
41993
+ // ../node_modules/@solid-data-modules/rdflib-utils/dist/index.js
41994
+ var init_dist = __esm({
41995
+ "../node_modules/@solid-data-modules/rdflib-utils/dist/index.js"() {
41996
+ init_web_operations();
41997
+ init_queries2();
41998
+ init_module();
41999
+ init_update_operations();
42000
+ init_namespaces2();
41675
42001
  }
41676
42002
  });
41677
42003
 
@@ -41707,42 +42033,7 @@ var PodOS = (() => {
41707
42033
  "../node_modules/@solid-data-modules/contacts-rdflib/dist/rdflib/update-operations/createNewContact.js"() {
41708
42034
  init_esm();
41709
42035
  init_namespaces();
41710
- }
41711
- });
41712
-
41713
- // ../node_modules/@solid-data-modules/contacts-rdflib/dist/rdflib/update-operations/index.js
41714
- var init_update_operations = __esm({
41715
- "../node_modules/@solid-data-modules/contacts-rdflib/dist/rdflib/update-operations/index.js"() {
41716
- init_createAddressBook();
41717
- init_createNewContact();
41718
- }
41719
- });
41720
-
41721
- // ../node_modules/@solid-data-modules/contacts-rdflib/dist/rdflib/web-operations/executeUpdate.js
41722
- async function executeUpdate(fetcher3, updater, operation3) {
41723
- await updater.updateMany(operation3.deletions, operation3.insertions);
41724
- operation3.filesToCreate.map((file2) => {
41725
- createEmptyTurtleFile(fetcher3, file2.uri);
41726
- });
41727
- }
41728
- function createEmptyTurtleFile(fetcher3, uri6) {
41729
- return fetcher3.webOperation("PUT", uri6, {
41730
- contentType: "text/turtle"
41731
- });
41732
- }
41733
- var init_executeUpdate = __esm({
41734
- "../node_modules/@solid-data-modules/contacts-rdflib/dist/rdflib/web-operations/executeUpdate.js"() {
41735
- }
41736
- });
41737
-
41738
- // ../node_modules/@solid-data-modules/contacts-rdflib/dist/rdflib/web-operations/fetchNode.js
41739
- async function fetchNode(fetcher3, node2) {
41740
- if (node2) {
41741
- await fetcher3.load(node2.value);
41742
- }
41743
- }
41744
- var init_fetchNode = __esm({
41745
- "../node_modules/@solid-data-modules/contacts-rdflib/dist/rdflib/web-operations/fetchNode.js"() {
42036
+ init_dist();
41746
42037
  }
41747
42038
  });
41748
42039
 
@@ -41770,31 +42061,7 @@ var PodOS = (() => {
41770
42061
  "../node_modules/@solid-data-modules/contacts-rdflib/dist/rdflib/update-operations/createNewGroup.js"() {
41771
42062
  init_esm();
41772
42063
  init_namespaces();
41773
- }
41774
- });
41775
-
41776
- // ../node_modules/@solid-data-modules/contacts-rdflib/dist/rdflib/queries/GroupQuery.js
41777
- var GroupQuery;
41778
- var init_GroupQuery = __esm({
41779
- "../node_modules/@solid-data-modules/contacts-rdflib/dist/rdflib/queries/GroupQuery.js"() {
41780
- init_esm();
41781
- init_namespaces();
41782
- GroupQuery = class {
41783
- constructor(store, groupNode) {
41784
- this.store = store;
41785
- this.groupNode = groupNode;
41786
- this.groupDoc = groupNode.doc();
41787
- }
41788
- queryName() {
41789
- return this.store.anyValue(this.groupNode, vcard("fn"), void 0, this.groupDoc) ?? "";
41790
- }
41791
- queryMembers() {
41792
- return this.store.each(this.groupNode, vcard("hasMember"), null, this.groupDoc).filter((it) => isNamedNode(it)).map((node2) => ({
41793
- uri: node2.value,
41794
- name: this.store.anyValue(node2, vcard("fn"), null, this.groupDoc) ?? ""
41795
- }));
41796
- }
41797
- };
42064
+ init_dist();
41798
42065
  }
41799
42066
  });
41800
42067
 
@@ -41802,7 +42069,6 @@ var PodOS = (() => {
41802
42069
  function addContactToGroup(contactQuery, groupQuery) {
41803
42070
  const name7 = contactQuery.queryName();
41804
42071
  return {
41805
- uri: "",
41806
42072
  insertions: [
41807
42073
  st2(groupQuery.groupNode, vcard("hasMember"), contactQuery.contactNode, groupQuery.groupNode.doc()),
41808
42074
  st2(contactQuery.contactNode, vcard("fn"), lit2(name7), groupQuery.groupNode.doc())
@@ -41818,27 +42084,25 @@ var PodOS = (() => {
41818
42084
  }
41819
42085
  });
41820
42086
 
41821
- // ../node_modules/@solid-data-modules/contacts-rdflib/dist/rdflib/update-operations/removeContactFromGroup.js
41822
- function removeContactFromGroup(contactQuery, groupQuery) {
41823
- const contactUri = contactQuery.contactNode.uri;
41824
- const member9 = groupQuery.queryMembers().find((it) => it.uri === contactUri);
41825
- if (!member9) {
41826
- throw new Error("member not found in group");
41827
- }
42087
+ // ../node_modules/@solid-data-modules/contacts-rdflib/dist/rdflib/update-operations/addNewEmailAddress.js
42088
+ function addNewEmailAddress(contactNode, emailAddress) {
42089
+ const id6 = generateId();
42090
+ const uri6 = `${contactNode.doc().uri}#${id6}`;
41828
42091
  return {
41829
- uri: "",
41830
- insertions: [],
41831
- deletions: [
41832
- st2(groupQuery.groupNode, vcard("hasMember"), contactQuery.contactNode, groupQuery.groupNode.doc()),
41833
- st2(contactQuery.contactNode, vcard("fn"), lit2(member9.name), groupQuery.groupNode.doc())
42092
+ uri: uri6,
42093
+ insertions: [
42094
+ st2(contactNode, vcard("hasEmail"), namedNode2(uri6), contactNode.doc()),
42095
+ st2(namedNode2(uri6), vcard("value"), namedNode2("mailto:" + emailAddress), contactNode.doc())
41834
42096
  ],
42097
+ deletions: [],
41835
42098
  filesToCreate: []
41836
42099
  };
41837
42100
  }
41838
- var init_removeContactFromGroup = __esm({
41839
- "../node_modules/@solid-data-modules/contacts-rdflib/dist/rdflib/update-operations/removeContactFromGroup.js"() {
42101
+ var init_addNewEmailAddress = __esm({
42102
+ "../node_modules/@solid-data-modules/contacts-rdflib/dist/rdflib/update-operations/addNewEmailAddress.js"() {
41840
42103
  init_esm();
41841
42104
  init_namespaces();
42105
+ init_identifier();
41842
42106
  }
41843
42107
  });
41844
42108
 
@@ -41859,48 +42123,29 @@ var PodOS = (() => {
41859
42123
  var init_addNewPhoneNumber = __esm({
41860
42124
  "../node_modules/@solid-data-modules/contacts-rdflib/dist/rdflib/update-operations/addNewPhoneNumber.js"() {
41861
42125
  init_esm();
41862
- init_generate_id();
41863
42126
  init_namespaces();
42127
+ init_identifier();
41864
42128
  }
41865
42129
  });
41866
42130
 
41867
- // ../node_modules/@solid-data-modules/contacts-rdflib/dist/rdflib/update-operations/addNewEmailAddress.js
41868
- function addNewEmailAddress(contactNode, emailAddress) {
41869
- const id6 = generateId();
41870
- const uri6 = `${contactNode.doc().uri}#${id6}`;
41871
- return {
41872
- uri: uri6,
41873
- insertions: [
41874
- st2(contactNode, vcard("hasEmail"), namedNode2(uri6), contactNode.doc()),
41875
- st2(namedNode2(uri6), vcard("value"), namedNode2("mailto:" + emailAddress), contactNode.doc())
41876
- ],
41877
- deletions: [],
41878
- filesToCreate: []
41879
- };
41880
- }
41881
- var init_addNewEmailAddress = __esm({
41882
- "../node_modules/@solid-data-modules/contacts-rdflib/dist/rdflib/update-operations/addNewEmailAddress.js"() {
41883
- init_esm();
41884
- init_generate_id();
41885
- init_namespaces();
42131
+ // ../node_modules/@solid-data-modules/contacts-rdflib/dist/rdflib/update-operations/removeContactFromGroup.js
42132
+ function removeContactFromGroup(contactQuery, groupQuery) {
42133
+ const contactUri = contactQuery.contactNode.uri;
42134
+ const member9 = groupQuery.queryMembers().find((it) => it.uri === contactUri);
42135
+ if (!member9) {
42136
+ throw new Error("member not found in group");
41886
42137
  }
41887
- });
41888
-
41889
- // ../node_modules/@solid-data-modules/contacts-rdflib/dist/rdflib/update-operations/removePhoneNumber.js
41890
- function removePhoneNumber(contactNode, phoneNode, store) {
41891
- const phoneStatements = store.statementsMatching(phoneNode, null, null, phoneNode.doc());
41892
42138
  return {
41893
- uri: "",
41894
42139
  insertions: [],
41895
42140
  deletions: [
41896
- ...phoneStatements,
41897
- st2(contactNode, vcard("hasTelephone"), phoneNode, contactNode.doc())
42141
+ st2(groupQuery.groupNode, vcard("hasMember"), contactQuery.contactNode, groupQuery.groupNode.doc()),
42142
+ st2(contactQuery.contactNode, vcard("fn"), lit2(member9.name), groupQuery.groupNode.doc())
41898
42143
  ],
41899
42144
  filesToCreate: []
41900
42145
  };
41901
42146
  }
41902
- var init_removePhoneNumber = __esm({
41903
- "../node_modules/@solid-data-modules/contacts-rdflib/dist/rdflib/update-operations/removePhoneNumber.js"() {
42147
+ var init_removeContactFromGroup = __esm({
42148
+ "../node_modules/@solid-data-modules/contacts-rdflib/dist/rdflib/update-operations/removeContactFromGroup.js"() {
41904
42149
  init_esm();
41905
42150
  init_namespaces();
41906
42151
  }
@@ -41910,7 +42155,6 @@ var PodOS = (() => {
41910
42155
  function removeEmailAddress(contactNode, emailNode, store) {
41911
42156
  const emailStatements = store.statementsMatching(emailNode, null, null, emailNode.doc());
41912
42157
  return {
41913
- uri: "",
41914
42158
  insertions: [],
41915
42159
  deletions: [
41916
42160
  ...emailStatements,
@@ -41926,82 +42170,22 @@ var PodOS = (() => {
41926
42170
  }
41927
42171
  });
41928
42172
 
41929
- // ../node_modules/@solid-data-modules/contacts-rdflib/dist/rdflib/queries/ProfileQuery.js
41930
- var ProfileQuery;
41931
- var init_ProfileQuery = __esm({
41932
- "../node_modules/@solid-data-modules/contacts-rdflib/dist/rdflib/queries/ProfileQuery.js"() {
41933
- init_esm();
41934
- init_namespaces();
41935
- ProfileQuery = class {
41936
- constructor(webIdNode, store) {
41937
- this.webIdNode = webIdNode;
41938
- this.store = store;
41939
- }
41940
- queryPublicTypeIndex() {
41941
- const predicate2 = solid("publicTypeIndex");
41942
- return this.queryNamedNode(predicate2);
41943
- }
41944
- queryPreferencesFile() {
41945
- const predicate2 = pim("preferencesFile");
41946
- return this.queryNamedNode(predicate2);
41947
- }
41948
- queryNamedNode(predicate2) {
41949
- const node2 = this.store.any(this.webIdNode, predicate2, null, this.webIdNode.doc());
41950
- if (isNamedNode(node2)) {
41951
- return node2;
41952
- }
41953
- return null;
41954
- }
41955
- };
41956
- }
41957
- });
41958
-
41959
- // ../node_modules/@solid-data-modules/contacts-rdflib/dist/rdflib/queries/TypeIndexQuery.js
41960
- var TypeIndexQuery;
41961
- var init_TypeIndexQuery = __esm({
41962
- "../node_modules/@solid-data-modules/contacts-rdflib/dist/rdflib/queries/TypeIndexQuery.js"() {
41963
- init_esm();
41964
- init_namespaces();
41965
- TypeIndexQuery = class {
41966
- constructor(store, typeIndexDoc) {
41967
- this.store = store;
41968
- this.typeIndexDoc = typeIndexDoc;
41969
- }
41970
- queryAddressBookInstances() {
41971
- const addressBookRegistrations = this.store.each(null, solid("forClass"), vcard("AddressBook"), this.typeIndexDoc);
41972
- return addressBookRegistrations.flatMap((registration) => {
41973
- if (!isNamedNode(registration))
41974
- return [];
41975
- return this.getInstanceValues(registration);
41976
- });
41977
- }
41978
- getInstanceValues(registration) {
41979
- return this.store.each(registration, solid("instance"), null, this.typeIndexDoc).map((it) => it.value);
41980
- }
41981
- };
41982
- }
41983
- });
41984
-
41985
- // ../node_modules/@solid-data-modules/contacts-rdflib/dist/rdflib/queries/PreferencesQuery.js
41986
- var PreferencesQuery;
41987
- var init_PreferencesQuery = __esm({
41988
- "../node_modules/@solid-data-modules/contacts-rdflib/dist/rdflib/queries/PreferencesQuery.js"() {
42173
+ // ../node_modules/@solid-data-modules/contacts-rdflib/dist/rdflib/update-operations/removePhoneNumber.js
42174
+ function removePhoneNumber(contactNode, phoneNode, store) {
42175
+ const phoneStatements = store.statementsMatching(phoneNode, null, null, phoneNode.doc());
42176
+ return {
42177
+ insertions: [],
42178
+ deletions: [
42179
+ ...phoneStatements,
42180
+ st2(contactNode, vcard("hasTelephone"), phoneNode, contactNode.doc())
42181
+ ],
42182
+ filesToCreate: []
42183
+ };
42184
+ }
42185
+ var init_removePhoneNumber = __esm({
42186
+ "../node_modules/@solid-data-modules/contacts-rdflib/dist/rdflib/update-operations/removePhoneNumber.js"() {
41989
42187
  init_esm();
41990
42188
  init_namespaces();
41991
- PreferencesQuery = class {
41992
- constructor(store, webIdNode, preferencesDoc) {
41993
- this.store = store;
41994
- this.webIdNode = webIdNode;
41995
- this.preferencesDoc = preferencesDoc;
41996
- }
41997
- queryPrivateTypeIndex() {
41998
- const node2 = this.store.any(this.webIdNode, solid("privateTypeIndex"), null, this.preferencesDoc);
41999
- if (isNamedNode(node2)) {
42000
- return node2;
42001
- }
42002
- return null;
42003
- }
42004
- };
42005
42189
  }
42006
42190
  });
42007
42191
 
@@ -42010,7 +42194,6 @@ var PodOS = (() => {
42010
42194
  const deletions = store.statementsMatching(contactNode, vcard("fn"), null, null);
42011
42195
  const insertions = deletions.map((it) => st2(it.subject, it.predicate, lit2(newName), it.graph));
42012
42196
  return {
42013
- uri: "",
42014
42197
  insertions,
42015
42198
  deletions,
42016
42199
  filesToCreate: []
@@ -42023,25 +42206,23 @@ var PodOS = (() => {
42023
42206
  }
42024
42207
  });
42025
42208
 
42026
- // ../node_modules/@solid-data-modules/contacts-rdflib/dist/rdflib/update-operations/addAddressBookToTypeIndex.js
42027
- function addAddressBookToTypeIndex(typeIndexDoc, addressBookUri) {
42028
- const registrationNode = namedNode2(`${typeIndexDoc.value}#${generateId()}`);
42209
+ // ../node_modules/@solid-data-modules/contacts-rdflib/dist/rdflib/update-operations/updateEmailAddress.js
42210
+ function updateEmailAddress(emailAddressNode, newEmailAddress, store) {
42211
+ const oldValue = store.any(emailAddressNode, vcard("value"));
42212
+ const deletions = oldValue ? [st2(emailAddressNode, vcard("value"), oldValue, emailAddressNode.doc())] : [];
42213
+ const insertions = [
42214
+ st2(emailAddressNode, vcard("value"), namedNode2("mailto:" + newEmailAddress), emailAddressNode.doc())
42215
+ ];
42029
42216
  return {
42030
- deletions: [],
42031
- filesToCreate: [],
42032
- insertions: [
42033
- st2(registrationNode, rdf3("type"), solid("TypeRegistration"), typeIndexDoc),
42034
- st2(registrationNode, solid("forClass"), vcard("AddressBook"), typeIndexDoc),
42035
- st2(registrationNode, solid("instance"), namedNode2(addressBookUri), typeIndexDoc)
42036
- ],
42037
- uri: ""
42217
+ insertions,
42218
+ deletions,
42219
+ filesToCreate: []
42038
42220
  };
42039
42221
  }
42040
- var init_addAddressBookToTypeIndex = __esm({
42041
- "../node_modules/@solid-data-modules/contacts-rdflib/dist/rdflib/update-operations/addAddressBookToTypeIndex.js"() {
42222
+ var init_updateEmailAddress = __esm({
42223
+ "../node_modules/@solid-data-modules/contacts-rdflib/dist/rdflib/update-operations/updateEmailAddress.js"() {
42042
42224
  init_esm();
42043
42225
  init_namespaces();
42044
- init_generate_id();
42045
42226
  }
42046
42227
  });
42047
42228
 
@@ -42053,7 +42234,6 @@ var PodOS = (() => {
42053
42234
  st2(phoneNumberNode, vcard("value"), namedNode2("tel:" + newPhoneNumber), phoneNumberNode.doc())
42054
42235
  ];
42055
42236
  return {
42056
- uri: "",
42057
42237
  insertions,
42058
42238
  deletions,
42059
42239
  filesToCreate: []
@@ -42066,69 +42246,49 @@ var PodOS = (() => {
42066
42246
  }
42067
42247
  });
42068
42248
 
42069
- // ../node_modules/@solid-data-modules/contacts-rdflib/dist/rdflib/update-operations/updateEmailAddress.js
42070
- function updateEmailAddress(emailAddressNode, newEmailAddress, store) {
42071
- const oldValue = store.any(emailAddressNode, vcard("value"));
42072
- const deletions = oldValue ? [st2(emailAddressNode, vcard("value"), oldValue, emailAddressNode.doc())] : [];
42073
- const insertions = [
42074
- st2(emailAddressNode, vcard("value"), namedNode2("mailto:" + newEmailAddress), emailAddressNode.doc())
42075
- ];
42076
- return {
42077
- uri: "",
42078
- insertions,
42079
- deletions,
42080
- filesToCreate: []
42081
- };
42082
- }
42083
- var init_updateEmailAddress = __esm({
42084
- "../node_modules/@solid-data-modules/contacts-rdflib/dist/rdflib/update-operations/updateEmailAddress.js"() {
42085
- init_esm();
42086
- init_namespaces();
42249
+ // ../node_modules/@solid-data-modules/contacts-rdflib/dist/rdflib/update-operations/index.js
42250
+ var init_update_operations2 = __esm({
42251
+ "../node_modules/@solid-data-modules/contacts-rdflib/dist/rdflib/update-operations/index.js"() {
42252
+ init_createAddressBook();
42253
+ init_createNewContact();
42254
+ init_createNewGroup();
42255
+ init_addContactToGroup();
42256
+ init_addNewEmailAddress();
42257
+ init_addNewPhoneNumber();
42258
+ init_removeContactFromGroup();
42259
+ init_removeEmailAddress();
42260
+ init_removePhoneNumber();
42261
+ init_renameContact();
42262
+ init_updateEmailAddress();
42263
+ init_updatePhoneNumber();
42087
42264
  }
42088
42265
  });
42089
42266
 
42090
42267
  // ../node_modules/@solid-data-modules/contacts-rdflib/dist/rdflib/ContactsModuleRdfLib.js
42091
- var ContactsModuleRdfLib;
42268
+ var VCARD_ADDRESS_BOOK, ContactsModuleRdfLib;
42092
42269
  var init_ContactsModuleRdfLib = __esm({
42093
42270
  "../node_modules/@solid-data-modules/contacts-rdflib/dist/rdflib/ContactsModuleRdfLib.js"() {
42094
42271
  init_esm();
42095
42272
  init_queries();
42096
- init_update_operations();
42097
- init_executeUpdate();
42098
- init_fetchNode();
42099
- init_createNewGroup();
42100
- init_GroupQuery();
42101
- init_addContactToGroup();
42102
- init_removeContactFromGroup();
42103
- init_addNewPhoneNumber();
42104
- init_addNewEmailAddress();
42105
- init_removePhoneNumber();
42106
- init_removeEmailAddress();
42107
- init_ProfileQuery();
42108
- init_TypeIndexQuery();
42109
- init_PreferencesQuery();
42110
- init_renameContact();
42111
- init_addAddressBookToTypeIndex();
42112
- init_updatePhoneNumber();
42113
- init_updateEmailAddress();
42273
+ init_update_operations2();
42274
+ init_dist();
42275
+ init_namespaces();
42276
+ VCARD_ADDRESS_BOOK = vcard("AddressBook");
42114
42277
  ContactsModuleRdfLib = class {
42115
42278
  constructor(config2) {
42279
+ this.support = new ModuleSupport(config2);
42116
42280
  this.store = config2.store;
42117
42281
  this.fetcher = config2.fetcher;
42118
42282
  this.updater = config2.updater;
42119
42283
  }
42120
42284
  async readAddressBook(uri6) {
42121
42285
  const addressBookNode = namedNode2(uri6);
42122
- await this.fetchNode(addressBookNode);
42286
+ await this.support.fetchNode(addressBookNode);
42123
42287
  const query4 = new AddressBookQuery(this.store, addressBookNode);
42124
42288
  const title9 = query4.queryTitle();
42125
42289
  const nameEmailIndex = query4.queryNameEmailIndex();
42126
42290
  const groupIndex = query4.queryGroupIndex();
42127
- await Promise.allSettled([
42128
- this.fetchNode(nameEmailIndex),
42129
- this.fetchNode(groupIndex)
42130
- ]);
42131
- await this.fetchAll([nameEmailIndex, groupIndex]);
42291
+ await this.support.fetchAll([nameEmailIndex, groupIndex]);
42132
42292
  const contacts = query4.queryContacts();
42133
42293
  const groups = query4.queryGroups();
42134
42294
  return {
@@ -42138,12 +42298,6 @@ var PodOS = (() => {
42138
42298
  groups
42139
42299
  };
42140
42300
  }
42141
- async fetchNode(node2) {
42142
- return fetchNode(this.fetcher, node2);
42143
- }
42144
- async fetchAll(nodes) {
42145
- return Promise.all(nodes.map((it) => this.fetchNode(it)));
42146
- }
42147
42301
  async createAddressBook({ containerUri, name: name7, ownerWebId }) {
42148
42302
  const operation3 = createAddressBook(containerUri, name7);
42149
42303
  await executeUpdate(this.fetcher, this.updater, operation3);
@@ -42154,14 +42308,14 @@ var PodOS = (() => {
42154
42308
  }
42155
42309
  async updatePrivateTypeIndex(ownerWebId, addressBookUri) {
42156
42310
  const profileNode = namedNode2(ownerWebId);
42157
- await this.fetchNode(profileNode);
42311
+ await this.support.fetchNode(profileNode);
42158
42312
  const profileQuery = new ProfileQuery(profileNode, this.store);
42159
42313
  const preferencesFile2 = profileQuery.queryPreferencesFile();
42160
42314
  const privateTypeIndex2 = await this.fetchPrivateTypeIndex(profileNode, preferencesFile2);
42161
42315
  if (!privateTypeIndex2) {
42162
42316
  throw new Error(`Private type not found for WebID ${ownerWebId}.`);
42163
42317
  }
42164
- const operation3 = addAddressBookToTypeIndex(privateTypeIndex2, addressBookUri);
42318
+ const operation3 = addInstanceToTypeIndex(privateTypeIndex2, addressBookUri, VCARD_ADDRESS_BOOK);
42165
42319
  await executeUpdate(this.fetcher, this.updater, operation3);
42166
42320
  }
42167
42321
  async createNewContact({ addressBookUri, contact: contact4, groupUris }) {
@@ -42171,7 +42325,7 @@ var PodOS = (() => {
42171
42325
  }
42172
42326
  async executeAddContactToGroups(groupUris, contactQuery) {
42173
42327
  const groupNodes = (groupUris ?? []).map((it) => namedNode2(it));
42174
- await this.fetchAll(groupNodes);
42328
+ await this.support.fetchAll(groupNodes);
42175
42329
  const groupUpdates = groupNodes.map((groupNode) => {
42176
42330
  const groupQuery = new GroupQuery(this.store, groupNode);
42177
42331
  const operation3 = addContactToGroup(contactQuery, groupQuery);
@@ -42181,14 +42335,14 @@ var PodOS = (() => {
42181
42335
  }
42182
42336
  async executeCreateNewContact(addressBookUri, contact4) {
42183
42337
  const addressBookNode = namedNode2(addressBookUri);
42184
- await this.fetchNode(addressBookNode);
42338
+ await this.support.fetchNode(addressBookNode);
42185
42339
  const operation3 = createNewContact(new AddressBookQuery(this.store, addressBookNode), contact4);
42186
42340
  await executeUpdate(this.fetcher, this.updater, operation3);
42187
42341
  return new ContactQuery(this.store, namedNode2(operation3.uri));
42188
42342
  }
42189
42343
  async readContact(uri6) {
42190
42344
  const contactNode = namedNode2(uri6);
42191
- await this.fetchNode(contactNode);
42345
+ await this.support.fetchNode(contactNode);
42192
42346
  const query4 = new ContactQuery(this.store, contactNode);
42193
42347
  const name7 = query4.queryName();
42194
42348
  const emails = query4.queryEmails();
@@ -42202,7 +42356,7 @@ var PodOS = (() => {
42202
42356
  }
42203
42357
  async createNewGroup({ addressBookUri, groupName }) {
42204
42358
  const addressBookNode = namedNode2(addressBookUri);
42205
- await this.fetchNode(addressBookNode);
42359
+ await this.support.fetchNode(addressBookNode);
42206
42360
  const query4 = new AddressBookQuery(this.store, addressBookNode);
42207
42361
  const operation3 = createNewGroup(query4, groupName);
42208
42362
  await executeUpdate(this.fetcher, this.updater, operation3);
@@ -42210,7 +42364,7 @@ var PodOS = (() => {
42210
42364
  }
42211
42365
  async readGroup(uri6) {
42212
42366
  const groupNode = namedNode2(uri6);
42213
- await this.fetchNode(groupNode);
42367
+ await this.support.fetchNode(groupNode);
42214
42368
  const query4 = new GroupQuery(this.store, groupNode);
42215
42369
  const name7 = query4.queryName();
42216
42370
  const members4 = query4.queryMembers();
@@ -42223,7 +42377,7 @@ var PodOS = (() => {
42223
42377
  async addContactToGroup({ contactUri, groupUri }) {
42224
42378
  const contactNode = namedNode2(contactUri);
42225
42379
  const groupNode = namedNode2(groupUri);
42226
- await this.fetchNode(contactNode);
42380
+ await this.support.fetchNode(contactNode);
42227
42381
  const contactQuery = new ContactQuery(this.store, contactNode);
42228
42382
  const groupQuery = new GroupQuery(this.store, groupNode);
42229
42383
  const operation3 = addContactToGroup(contactQuery, groupQuery);
@@ -42232,7 +42386,7 @@ var PodOS = (() => {
42232
42386
  async removeContactFromGroup({ contactUri, groupUri }) {
42233
42387
  const contactNode = namedNode2(contactUri);
42234
42388
  const groupNode = namedNode2(groupUri);
42235
- await this.fetchNode(groupNode);
42389
+ await this.support.fetchNode(groupNode);
42236
42390
  const contactQuery = new ContactQuery(this.store, contactNode);
42237
42391
  const groupQuery = new GroupQuery(this.store, groupNode);
42238
42392
  const operation3 = removeContactFromGroup(contactQuery, groupQuery);
@@ -42253,32 +42407,32 @@ var PodOS = (() => {
42253
42407
  async removePhoneNumber({ contactUri, phoneNumberUri }) {
42254
42408
  const contactNode = namedNode2(contactUri);
42255
42409
  const phoneNumberNode = namedNode2(phoneNumberUri);
42256
- await this.fetchNode(phoneNumberNode);
42410
+ await this.support.fetchNode(phoneNumberNode);
42257
42411
  const operation3 = removePhoneNumber(contactNode, phoneNumberNode, this.store);
42258
42412
  await executeUpdate(this.fetcher, this.updater, operation3);
42259
42413
  }
42260
42414
  async removeEmailAddress({ contactUri, emailAddressUri }) {
42261
42415
  const contactNode = namedNode2(contactUri);
42262
42416
  const emailAddressNode = namedNode2(emailAddressUri);
42263
- await this.fetchNode(emailAddressNode);
42417
+ await this.support.fetchNode(emailAddressNode);
42264
42418
  const operation3 = removeEmailAddress(contactNode, emailAddressNode, this.store);
42265
42419
  await executeUpdate(this.fetcher, this.updater, operation3);
42266
42420
  }
42267
42421
  async updatePhoneNumber({ phoneNumberUri, newPhoneNumber }) {
42268
42422
  const phoneNumberNode = namedNode2(phoneNumberUri);
42269
- await this.fetchNode(phoneNumberNode);
42423
+ await this.support.fetchNode(phoneNumberNode);
42270
42424
  const operation3 = updatePhoneNumber(phoneNumberNode, newPhoneNumber, this.store);
42271
42425
  await executeUpdate(this.fetcher, this.updater, operation3);
42272
42426
  }
42273
42427
  async updateEmailAddress({ emailAddressUri, newEmailAddress }) {
42274
42428
  const emailAddressNode = namedNode2(emailAddressUri);
42275
- await this.fetchNode(emailAddressNode);
42429
+ await this.support.fetchNode(emailAddressNode);
42276
42430
  const operation3 = updateEmailAddress(emailAddressNode, newEmailAddress, this.store);
42277
42431
  await executeUpdate(this.fetcher, this.updater, operation3);
42278
42432
  }
42279
42433
  async listAddressBooks(webId) {
42280
42434
  const profileNode = namedNode2(webId);
42281
- await this.fetchNode(profileNode);
42435
+ await this.support.fetchNode(profileNode);
42282
42436
  const profileQuery = new ProfileQuery(profileNode, this.store);
42283
42437
  const publicTypeIndexNode = profileQuery.queryPublicTypeIndex();
42284
42438
  const preferencesFile2 = profileQuery.queryPreferencesFile();
@@ -42298,20 +42452,20 @@ var PodOS = (() => {
42298
42452
  if (!publicTypeIndexNode) {
42299
42453
  return [];
42300
42454
  }
42301
- await this.fetchNode(publicTypeIndexNode);
42302
- return new TypeIndexQuery(this.store, publicTypeIndexNode).queryAddressBookInstances();
42455
+ await this.support.fetchNode(publicTypeIndexNode);
42456
+ return new TypeIndexQuery(this.store, publicTypeIndexNode).queryInstancesForClass(VCARD_ADDRESS_BOOK);
42303
42457
  }
42304
42458
  async fetchPrivateTypeIndex(profileNode, preferencesFile2) {
42305
42459
  if (!preferencesFile2) {
42306
42460
  return null;
42307
42461
  }
42308
- await this.fetchNode(preferencesFile2);
42462
+ await this.support.fetchNode(preferencesFile2);
42309
42463
  const preferencesQuery = new PreferencesQuery(this.store, profileNode, preferencesFile2);
42310
42464
  return preferencesQuery.queryPrivateTypeIndex();
42311
42465
  }
42312
42466
  async renameContact({ contactUri, newName }) {
42313
42467
  const contactNode = namedNode2(contactUri);
42314
- await this.fetchNode(contactNode);
42468
+ await this.support.fetchNode(contactNode);
42315
42469
  const operation3 = renameContact(this.store, contactNode, newName);
42316
42470
  await executeUpdate(this.fetcher, this.updater, operation3);
42317
42471
  }
@@ -42325,7 +42479,7 @@ var PodOS = (() => {
42325
42479
  default: () => dist_default
42326
42480
  });
42327
42481
  var dist_default;
42328
- var init_dist = __esm({
42482
+ var init_dist2 = __esm({
42329
42483
  "../node_modules/@solid-data-modules/contacts-rdflib/dist/index.js"() {
42330
42484
  init_ContactsModuleRdfLib();
42331
42485
  dist_default = ContactsModuleRdfLib;
@@ -45835,22 +45989,24 @@ var PodOS = (() => {
45835
45989
  static get code() {
45836
45990
  return "ERR_JWT_CLAIM_VALIDATION_FAILED";
45837
45991
  }
45838
- constructor(message4, claim2 = "unspecified", reason2 = "unspecified") {
45992
+ constructor(message4, payload4, claim2 = "unspecified", reason2 = "unspecified") {
45839
45993
  super(message4);
45840
45994
  this.code = "ERR_JWT_CLAIM_VALIDATION_FAILED";
45841
45995
  this.claim = claim2;
45842
45996
  this.reason = reason2;
45997
+ this.payload = payload4;
45843
45998
  }
45844
45999
  };
45845
46000
  var JWTExpired = class extends JOSEError {
45846
46001
  static get code() {
45847
46002
  return "ERR_JWT_EXPIRED";
45848
46003
  }
45849
- constructor(message4, claim2 = "unspecified", reason2 = "unspecified") {
46004
+ constructor(message4, payload4, claim2 = "unspecified", reason2 = "unspecified") {
45850
46005
  super(message4);
45851
46006
  this.code = "ERR_JWT_EXPIRED";
45852
46007
  this.claim = claim2;
45853
46008
  this.reason = reason2;
46009
+ this.payload = payload4;
45854
46010
  }
45855
46011
  };
45856
46012
  var JOSEAlgNotAllowed = class extends JOSEError {
@@ -45939,9 +46095,6 @@ var PodOS = (() => {
45939
46095
  }
45940
46096
  };
45941
46097
 
45942
- // ../node_modules/@inrupt/solid-client-authn-core/node_modules/jose/dist/browser/runtime/random.js
45943
- var random_default = webcrypto_default.getRandomValues.bind(webcrypto_default);
45944
-
45945
46098
  // ../node_modules/@inrupt/solid-client-authn-core/node_modules/jose/dist/browser/lib/crypto_key.js
45946
46099
  function unusable(name7, prop = "algorithm.name") {
45947
46100
  return new TypeError(`CryptoKey does not support this operation, its ${prop} must be ${name7}`);
@@ -46038,6 +46191,7 @@ var PodOS = (() => {
46038
46191
 
46039
46192
  // ../node_modules/@inrupt/solid-client-authn-core/node_modules/jose/dist/browser/lib/invalid_key_input.js
46040
46193
  function message(msg2, actual2, ...types2) {
46194
+ types2 = types2.filter(Boolean);
46041
46195
  if (types2.length > 2) {
46042
46196
  const last3 = types2.pop();
46043
46197
  msg2 += `one of type ${types2.join(", ")}, or ${last3}.`;
@@ -46066,7 +46220,10 @@ var PodOS = (() => {
46066
46220
 
46067
46221
  // ../node_modules/@inrupt/solid-client-authn-core/node_modules/jose/dist/browser/runtime/is_key_like.js
46068
46222
  var is_key_like_default = (key3) => {
46069
- return isCryptoKey(key3);
46223
+ if (isCryptoKey(key3)) {
46224
+ return true;
46225
+ }
46226
+ return key3?.[Symbol.toStringTag] === "KeyObject";
46070
46227
  };
46071
46228
  var types = ["CryptoKey"];
46072
46229
 
@@ -46122,6 +46279,20 @@ var PodOS = (() => {
46122
46279
  }
46123
46280
  };
46124
46281
 
46282
+ // ../node_modules/@inrupt/solid-client-authn-core/node_modules/jose/dist/browser/lib/is_jwk.js
46283
+ function isJWK(key3) {
46284
+ return isObject(key3) && typeof key3.kty === "string";
46285
+ }
46286
+ function isPrivateJWK(key3) {
46287
+ return key3.kty !== "oct" && typeof key3.d === "string";
46288
+ }
46289
+ function isPublicJWK(key3) {
46290
+ return key3.kty !== "oct" && typeof key3.d === "undefined";
46291
+ }
46292
+ function isSecretJWK(key3) {
46293
+ return isJWK(key3) && key3.kty === "oct" && typeof key3.k === "string";
46294
+ }
46295
+
46125
46296
  // ../node_modules/@inrupt/solid-client-authn-core/node_modules/jose/dist/browser/runtime/jwk_to_key.js
46126
46297
  function subtleMapping(jwk) {
46127
46298
  let algorithm3;
@@ -46222,6 +46393,72 @@ var PodOS = (() => {
46222
46393
  };
46223
46394
  var jwk_to_key_default = parse;
46224
46395
 
46396
+ // ../node_modules/@inrupt/solid-client-authn-core/node_modules/jose/dist/browser/runtime/normalize_key.js
46397
+ var exportKeyValue = (k) => decode(k);
46398
+ var privCache;
46399
+ var pubCache;
46400
+ var isKeyObject = (key3) => {
46401
+ return key3?.[Symbol.toStringTag] === "KeyObject";
46402
+ };
46403
+ var importAndCache = async (cache, key3, jwk, alg, freeze = false) => {
46404
+ let cached = cache.get(key3);
46405
+ if (cached?.[alg]) {
46406
+ return cached[alg];
46407
+ }
46408
+ const cryptoKey = await jwk_to_key_default({ ...jwk, alg });
46409
+ if (freeze)
46410
+ Object.freeze(key3);
46411
+ if (!cached) {
46412
+ cache.set(key3, { [alg]: cryptoKey });
46413
+ } else {
46414
+ cached[alg] = cryptoKey;
46415
+ }
46416
+ return cryptoKey;
46417
+ };
46418
+ var normalizePublicKey = (key3, alg) => {
46419
+ if (isKeyObject(key3)) {
46420
+ let jwk = key3.export({ format: "jwk" });
46421
+ delete jwk.d;
46422
+ delete jwk.dp;
46423
+ delete jwk.dq;
46424
+ delete jwk.p;
46425
+ delete jwk.q;
46426
+ delete jwk.qi;
46427
+ if (jwk.k) {
46428
+ return exportKeyValue(jwk.k);
46429
+ }
46430
+ pubCache || (pubCache = /* @__PURE__ */ new WeakMap());
46431
+ return importAndCache(pubCache, key3, jwk, alg);
46432
+ }
46433
+ if (isJWK(key3)) {
46434
+ if (key3.k)
46435
+ return decode(key3.k);
46436
+ pubCache || (pubCache = /* @__PURE__ */ new WeakMap());
46437
+ const cryptoKey = importAndCache(pubCache, key3, key3, alg, true);
46438
+ return cryptoKey;
46439
+ }
46440
+ return key3;
46441
+ };
46442
+ var normalizePrivateKey = (key3, alg) => {
46443
+ if (isKeyObject(key3)) {
46444
+ let jwk = key3.export({ format: "jwk" });
46445
+ if (jwk.k) {
46446
+ return exportKeyValue(jwk.k);
46447
+ }
46448
+ privCache || (privCache = /* @__PURE__ */ new WeakMap());
46449
+ return importAndCache(privCache, key3, jwk, alg);
46450
+ }
46451
+ if (isJWK(key3)) {
46452
+ if (key3.k)
46453
+ return decode(key3.k);
46454
+ privCache || (privCache = /* @__PURE__ */ new WeakMap());
46455
+ const cryptoKey = importAndCache(privCache, key3, key3, alg, true);
46456
+ return cryptoKey;
46457
+ }
46458
+ return key3;
46459
+ };
46460
+ var normalize_key_default = { normalizePublicKey, normalizePrivateKey };
46461
+
46225
46462
  // ../node_modules/@inrupt/solid-client-authn-core/node_modules/jose/dist/browser/key/import.js
46226
46463
  async function importJWK(jwk, alg) {
46227
46464
  if (!isObject(jwk)) {
@@ -46247,45 +46484,76 @@ var PodOS = (() => {
46247
46484
  }
46248
46485
 
46249
46486
  // ../node_modules/@inrupt/solid-client-authn-core/node_modules/jose/dist/browser/lib/check_key_type.js
46250
- var symmetricTypeCheck = (alg, key3) => {
46487
+ var tag = (key3) => key3?.[Symbol.toStringTag];
46488
+ var jwkMatchesOp = (alg, key3, usage2) => {
46489
+ if (key3.use !== void 0 && key3.use !== "sig") {
46490
+ throw new TypeError("Invalid key for this operation, when present its use must be sig");
46491
+ }
46492
+ if (key3.key_ops !== void 0 && key3.key_ops.includes?.(usage2) !== true) {
46493
+ throw new TypeError(`Invalid key for this operation, when present its key_ops must include ${usage2}`);
46494
+ }
46495
+ if (key3.alg !== void 0 && key3.alg !== alg) {
46496
+ throw new TypeError(`Invalid key for this operation, when present its alg must be ${alg}`);
46497
+ }
46498
+ return true;
46499
+ };
46500
+ var symmetricTypeCheck = (alg, key3, usage2, allowJwk) => {
46251
46501
  if (key3 instanceof Uint8Array)
46252
46502
  return;
46503
+ if (allowJwk && isJWK(key3)) {
46504
+ if (isSecretJWK(key3) && jwkMatchesOp(alg, key3, usage2))
46505
+ return;
46506
+ throw new TypeError(`JSON Web Key for symmetric algorithms must have JWK "kty" (Key Type) equal to "oct" and the JWK "k" (Key Value) present`);
46507
+ }
46253
46508
  if (!is_key_like_default(key3)) {
46254
- throw new TypeError(withAlg(alg, key3, ...types, "Uint8Array"));
46509
+ throw new TypeError(withAlg(alg, key3, ...types, "Uint8Array", allowJwk ? "JSON Web Key" : null));
46255
46510
  }
46256
46511
  if (key3.type !== "secret") {
46257
- throw new TypeError(`${types.join(" or ")} instances for symmetric algorithms must be of type "secret"`);
46512
+ throw new TypeError(`${tag(key3)} instances for symmetric algorithms must be of type "secret"`);
46258
46513
  }
46259
46514
  };
46260
- var asymmetricTypeCheck = (alg, key3, usage2) => {
46515
+ var asymmetricTypeCheck = (alg, key3, usage2, allowJwk) => {
46516
+ if (allowJwk && isJWK(key3)) {
46517
+ switch (usage2) {
46518
+ case "sign":
46519
+ if (isPrivateJWK(key3) && jwkMatchesOp(alg, key3, usage2))
46520
+ return;
46521
+ throw new TypeError(`JSON Web Key for this operation be a private JWK`);
46522
+ case "verify":
46523
+ if (isPublicJWK(key3) && jwkMatchesOp(alg, key3, usage2))
46524
+ return;
46525
+ throw new TypeError(`JSON Web Key for this operation be a public JWK`);
46526
+ }
46527
+ }
46261
46528
  if (!is_key_like_default(key3)) {
46262
- throw new TypeError(withAlg(alg, key3, ...types));
46529
+ throw new TypeError(withAlg(alg, key3, ...types, allowJwk ? "JSON Web Key" : null));
46263
46530
  }
46264
46531
  if (key3.type === "secret") {
46265
- throw new TypeError(`${types.join(" or ")} instances for asymmetric algorithms must not be of type "secret"`);
46532
+ throw new TypeError(`${tag(key3)} instances for asymmetric algorithms must not be of type "secret"`);
46266
46533
  }
46267
46534
  if (usage2 === "sign" && key3.type === "public") {
46268
- throw new TypeError(`${types.join(" or ")} instances for asymmetric algorithm signing must be of type "private"`);
46535
+ throw new TypeError(`${tag(key3)} instances for asymmetric algorithm signing must be of type "private"`);
46269
46536
  }
46270
46537
  if (usage2 === "decrypt" && key3.type === "public") {
46271
- throw new TypeError(`${types.join(" or ")} instances for asymmetric algorithm decryption must be of type "private"`);
46538
+ throw new TypeError(`${tag(key3)} instances for asymmetric algorithm decryption must be of type "private"`);
46272
46539
  }
46273
46540
  if (key3.algorithm && usage2 === "verify" && key3.type === "private") {
46274
- throw new TypeError(`${types.join(" or ")} instances for asymmetric algorithm verifying must be of type "public"`);
46541
+ throw new TypeError(`${tag(key3)} instances for asymmetric algorithm verifying must be of type "public"`);
46275
46542
  }
46276
46543
  if (key3.algorithm && usage2 === "encrypt" && key3.type === "private") {
46277
- throw new TypeError(`${types.join(" or ")} instances for asymmetric algorithm encryption must be of type "public"`);
46544
+ throw new TypeError(`${tag(key3)} instances for asymmetric algorithm encryption must be of type "public"`);
46278
46545
  }
46279
46546
  };
46280
- var checkKeyType = (alg, key3, usage2) => {
46547
+ function checkKeyType(allowJwk, alg, key3, usage2) {
46281
46548
  const symmetric = alg.startsWith("HS") || alg === "dir" || alg.startsWith("PBES2") || /^A\d{3}(?:GCM)?KW$/.test(alg);
46282
46549
  if (symmetric) {
46283
- symmetricTypeCheck(alg, key3);
46550
+ symmetricTypeCheck(alg, key3, usage2, allowJwk);
46284
46551
  } else {
46285
- asymmetricTypeCheck(alg, key3, usage2);
46552
+ asymmetricTypeCheck(alg, key3, usage2, allowJwk);
46286
46553
  }
46287
- };
46288
- var check_key_type_default = checkKeyType;
46554
+ }
46555
+ var check_key_type_default = checkKeyType.bind(void 0, false);
46556
+ var checkKeyTypeWithJwk = checkKeyType.bind(void 0, true);
46289
46557
 
46290
46558
  // ../node_modules/@inrupt/solid-client-authn-core/node_modules/jose/dist/browser/lib/validate_crit.js
46291
46559
  function validateCrit(Err, recognizedDefault, recognizedOption, protectedHeader, joseHeader) {
@@ -46355,9 +46623,6 @@ var PodOS = (() => {
46355
46623
  return key_to_jwk_default(key3);
46356
46624
  }
46357
46625
 
46358
- // ../node_modules/@inrupt/solid-client-authn-core/node_modules/jose/dist/browser/jwe/flattened/encrypt.js
46359
- var unprotected = Symbol();
46360
-
46361
46626
  // ../node_modules/@inrupt/solid-client-authn-core/node_modules/jose/dist/browser/runtime/subtle_dsa.js
46362
46627
  function subtleDsa(alg, algorithm3) {
46363
46628
  const hash2 = `SHA-${alg.slice(-3)}`;
@@ -46386,7 +46651,13 @@ var PodOS = (() => {
46386
46651
  }
46387
46652
 
46388
46653
  // ../node_modules/@inrupt/solid-client-authn-core/node_modules/jose/dist/browser/runtime/get_sign_verify_key.js
46389
- function getCryptoKey(alg, key3, usage2) {
46654
+ async function getCryptoKey(alg, key3, usage2) {
46655
+ if (usage2 === "sign") {
46656
+ key3 = await normalize_key_default.normalizePrivateKey(key3, alg);
46657
+ }
46658
+ if (usage2 === "verify") {
46659
+ key3 = await normalize_key_default.normalizePublicKey(key3, alg);
46660
+ }
46390
46661
  if (isCryptoKey(key3)) {
46391
46662
  checkSigCryptoKey(key3, alg, usage2);
46392
46663
  return key3;
@@ -46397,7 +46668,7 @@ var PodOS = (() => {
46397
46668
  }
46398
46669
  return webcrypto_default.subtle.importKey("raw", key3, { hash: `SHA-${alg.slice(-3)}`, name: "HMAC" }, false, [usage2]);
46399
46670
  }
46400
- throw new TypeError(invalid_key_input_default(key3, ...types, "Uint8Array"));
46671
+ throw new TypeError(invalid_key_input_default(key3, ...types, "Uint8Array", "JSON Web Key"));
46401
46672
  }
46402
46673
 
46403
46674
  // ../node_modules/@inrupt/solid-client-authn-core/node_modules/jose/dist/browser/runtime/verify.js
@@ -46476,8 +46747,13 @@ var PodOS = (() => {
46476
46747
  if (typeof key3 === "function") {
46477
46748
  key3 = await key3(parsedProt, jws2);
46478
46749
  resolvedKey = true;
46750
+ checkKeyTypeWithJwk(alg, key3, "verify");
46751
+ if (isJWK(key3)) {
46752
+ key3 = await importJWK(key3, alg);
46753
+ }
46754
+ } else {
46755
+ checkKeyTypeWithJwk(alg, key3, "verify");
46479
46756
  }
46480
- check_key_type_default(alg, key3, "verify");
46481
46757
  const data2 = concat(encoder.encode(jws2.protected ?? ""), encoder.encode("."), typeof jws2.payload === "string" ? encoder.encode(jws2.payload) : jws2.payload);
46482
46758
  let signature2;
46483
46759
  try {
@@ -46606,10 +46882,6 @@ var PodOS = (() => {
46606
46882
  return false;
46607
46883
  };
46608
46884
  var jwt_claims_set_default = (protectedHeader, encodedPayload, options = {}) => {
46609
- const { typ } = options;
46610
- if (typ && (typeof protectedHeader.typ !== "string" || normalizeTyp(protectedHeader.typ) !== normalizeTyp(typ))) {
46611
- throw new JWTClaimValidationFailed('unexpected "typ" JWT header value', "typ", "check_failed");
46612
- }
46613
46885
  let payload4;
46614
46886
  try {
46615
46887
  payload4 = JSON.parse(decoder.decode(encodedPayload));
@@ -46618,6 +46890,10 @@ var PodOS = (() => {
46618
46890
  if (!isObject(payload4)) {
46619
46891
  throw new JWTInvalid("JWT Claims Set must be a top-level JSON object");
46620
46892
  }
46893
+ const { typ } = options;
46894
+ if (typ && (typeof protectedHeader.typ !== "string" || normalizeTyp(protectedHeader.typ) !== normalizeTyp(typ))) {
46895
+ throw new JWTClaimValidationFailed('unexpected "typ" JWT header value', payload4, "typ", "check_failed");
46896
+ }
46621
46897
  const { requiredClaims = [], issuer: issuer2, subject: subject5, audience: audience5, maxTokenAge } = options;
46622
46898
  const presenceCheck = [...requiredClaims];
46623
46899
  if (maxTokenAge !== void 0)
@@ -46630,17 +46906,17 @@ var PodOS = (() => {
46630
46906
  presenceCheck.push("iss");
46631
46907
  for (const claim2 of new Set(presenceCheck.reverse())) {
46632
46908
  if (!(claim2 in payload4)) {
46633
- throw new JWTClaimValidationFailed(`missing required "${claim2}" claim`, claim2, "missing");
46909
+ throw new JWTClaimValidationFailed(`missing required "${claim2}" claim`, payload4, claim2, "missing");
46634
46910
  }
46635
46911
  }
46636
46912
  if (issuer2 && !(Array.isArray(issuer2) ? issuer2 : [issuer2]).includes(payload4.iss)) {
46637
- throw new JWTClaimValidationFailed('unexpected "iss" claim value', "iss", "check_failed");
46913
+ throw new JWTClaimValidationFailed('unexpected "iss" claim value', payload4, "iss", "check_failed");
46638
46914
  }
46639
46915
  if (subject5 && payload4.sub !== subject5) {
46640
- throw new JWTClaimValidationFailed('unexpected "sub" claim value', "sub", "check_failed");
46916
+ throw new JWTClaimValidationFailed('unexpected "sub" claim value', payload4, "sub", "check_failed");
46641
46917
  }
46642
46918
  if (audience5 && !checkAudiencePresence(payload4.aud, typeof audience5 === "string" ? [audience5] : audience5)) {
46643
- throw new JWTClaimValidationFailed('unexpected "aud" claim value', "aud", "check_failed");
46919
+ throw new JWTClaimValidationFailed('unexpected "aud" claim value', payload4, "aud", "check_failed");
46644
46920
  }
46645
46921
  let tolerance;
46646
46922
  switch (typeof options.clockTolerance) {
@@ -46659,32 +46935,32 @@ var PodOS = (() => {
46659
46935
  const { currentDate } = options;
46660
46936
  const now = epoch_default(currentDate || /* @__PURE__ */ new Date());
46661
46937
  if ((payload4.iat !== void 0 || maxTokenAge) && typeof payload4.iat !== "number") {
46662
- throw new JWTClaimValidationFailed('"iat" claim must be a number', "iat", "invalid");
46938
+ throw new JWTClaimValidationFailed('"iat" claim must be a number', payload4, "iat", "invalid");
46663
46939
  }
46664
46940
  if (payload4.nbf !== void 0) {
46665
46941
  if (typeof payload4.nbf !== "number") {
46666
- throw new JWTClaimValidationFailed('"nbf" claim must be a number', "nbf", "invalid");
46942
+ throw new JWTClaimValidationFailed('"nbf" claim must be a number', payload4, "nbf", "invalid");
46667
46943
  }
46668
46944
  if (payload4.nbf > now + tolerance) {
46669
- throw new JWTClaimValidationFailed('"nbf" claim timestamp check failed', "nbf", "check_failed");
46945
+ throw new JWTClaimValidationFailed('"nbf" claim timestamp check failed', payload4, "nbf", "check_failed");
46670
46946
  }
46671
46947
  }
46672
46948
  if (payload4.exp !== void 0) {
46673
46949
  if (typeof payload4.exp !== "number") {
46674
- throw new JWTClaimValidationFailed('"exp" claim must be a number', "exp", "invalid");
46950
+ throw new JWTClaimValidationFailed('"exp" claim must be a number', payload4, "exp", "invalid");
46675
46951
  }
46676
46952
  if (payload4.exp <= now - tolerance) {
46677
- throw new JWTExpired('"exp" claim timestamp check failed', "exp", "check_failed");
46953
+ throw new JWTExpired('"exp" claim timestamp check failed', payload4, "exp", "check_failed");
46678
46954
  }
46679
46955
  }
46680
46956
  if (maxTokenAge) {
46681
46957
  const age2 = now - payload4.iat;
46682
46958
  const max2 = typeof maxTokenAge === "number" ? maxTokenAge : secs_default(maxTokenAge);
46683
46959
  if (age2 - tolerance > max2) {
46684
- throw new JWTExpired('"iat" claim timestamp check failed (too far in the past)', "iat", "check_failed");
46960
+ throw new JWTExpired('"iat" claim timestamp check failed (too far in the past)', payload4, "iat", "check_failed");
46685
46961
  }
46686
46962
  if (age2 < 0 - tolerance) {
46687
- throw new JWTClaimValidationFailed('"iat" claim timestamp check failed (it should be in the past)', "iat", "check_failed");
46963
+ throw new JWTClaimValidationFailed('"iat" claim timestamp check failed (it should be in the past)', payload4, "iat", "check_failed");
46688
46964
  }
46689
46965
  }
46690
46966
  return payload4;
@@ -46758,7 +47034,7 @@ var PodOS = (() => {
46758
47034
  if (typeof alg !== "string" || !alg) {
46759
47035
  throw new JWSInvalid('JWS "alg" (Algorithm) Header Parameter missing or invalid');
46760
47036
  }
46761
- check_key_type_default(alg, key3, "sign");
47037
+ checkKeyTypeWithJwk(alg, key3, "sign");
46762
47038
  let payload4 = this._payload;
46763
47039
  if (b64) {
46764
47040
  payload4 = encoder.encode(encode(payload4));
@@ -47047,9 +47323,22 @@ var PodOS = (() => {
47047
47323
  var USER_AGENT;
47048
47324
  if (typeof navigator === "undefined" || !navigator.userAgent?.startsWith?.("Mozilla/5.0 ")) {
47049
47325
  const NAME = "jose";
47050
- const VERSION = "v5.3.0";
47326
+ const VERSION = "v5.9.3";
47051
47327
  USER_AGENT = `${NAME}/${VERSION}`;
47052
47328
  }
47329
+ var jwksCache = Symbol();
47330
+ function isFreshJwksCache(input2, cacheMaxAge) {
47331
+ if (typeof input2 !== "object" || input2 === null) {
47332
+ return false;
47333
+ }
47334
+ if (!("uat" in input2) || typeof input2.uat !== "number" || Date.now() - input2.uat >= cacheMaxAge) {
47335
+ return false;
47336
+ }
47337
+ if (!("jwks" in input2) || !isObject(input2.jwks) || !Array.isArray(input2.jwks.keys) || !Array.prototype.every.call(input2.jwks.keys, isObject)) {
47338
+ return false;
47339
+ }
47340
+ return true;
47341
+ }
47053
47342
  var RemoteJWKSet = class {
47054
47343
  constructor(url7, options) {
47055
47344
  if (!(url7 instanceof URL)) {
@@ -47060,6 +47349,13 @@ var PodOS = (() => {
47060
47349
  this._timeoutDuration = typeof options?.timeoutDuration === "number" ? options?.timeoutDuration : 5e3;
47061
47350
  this._cooldownDuration = typeof options?.cooldownDuration === "number" ? options?.cooldownDuration : 3e4;
47062
47351
  this._cacheMaxAge = typeof options?.cacheMaxAge === "number" ? options?.cacheMaxAge : 6e5;
47352
+ if (options?.[jwksCache] !== void 0) {
47353
+ this._cache = options?.[jwksCache];
47354
+ if (isFreshJwksCache(options?.[jwksCache], this._cacheMaxAge)) {
47355
+ this._jwksTimestamp = this._cache.uat;
47356
+ this._local = createLocalJWKSet(this._cache.jwks);
47357
+ }
47358
+ }
47063
47359
  }
47064
47360
  coolingDown() {
47065
47361
  return typeof this._jwksTimestamp === "number" ? Date.now() < this._jwksTimestamp + this._cooldownDuration : false;
@@ -47094,6 +47390,10 @@ var PodOS = (() => {
47094
47390
  }
47095
47391
  this._pendingFetch || (this._pendingFetch = fetch_jwks_default(this._url, this._timeoutDuration, this._options).then((json) => {
47096
47392
  this._local = createLocalJWKSet(json);
47393
+ if (this._cache) {
47394
+ this._cache.uat = Date.now();
47395
+ this._cache.jwks = json;
47396
+ }
47097
47397
  this._jwksTimestamp = Date.now();
47098
47398
  this._pendingFetch = void 0;
47099
47399
  }).catch((err) => {
@@ -47242,7 +47542,17 @@ var PodOS = (() => {
47242
47542
  return generateKeyPair(alg, options);
47243
47543
  }
47244
47544
 
47245
- // ../node_modules/uuid/dist/esm-browser/rng.js
47545
+ // ../node_modules/@inrupt/solid-client-authn-core/node_modules/uuid/dist/esm-browser/stringify.js
47546
+ var byteToHex = [];
47547
+ for (i = 0; i < 256; ++i) {
47548
+ byteToHex.push((i + 256).toString(16).slice(1));
47549
+ }
47550
+ var i;
47551
+ function unsafeStringify(arr, offset3 = 0) {
47552
+ return (byteToHex[arr[offset3 + 0]] + byteToHex[arr[offset3 + 1]] + byteToHex[arr[offset3 + 2]] + byteToHex[arr[offset3 + 3]] + "-" + byteToHex[arr[offset3 + 4]] + byteToHex[arr[offset3 + 5]] + "-" + byteToHex[arr[offset3 + 6]] + byteToHex[arr[offset3 + 7]] + "-" + byteToHex[arr[offset3 + 8]] + byteToHex[arr[offset3 + 9]] + "-" + byteToHex[arr[offset3 + 10]] + byteToHex[arr[offset3 + 11]] + byteToHex[arr[offset3 + 12]] + byteToHex[arr[offset3 + 13]] + byteToHex[arr[offset3 + 14]] + byteToHex[arr[offset3 + 15]]).toLowerCase();
47553
+ }
47554
+
47555
+ // ../node_modules/@inrupt/solid-client-authn-core/node_modules/uuid/dist/esm-browser/rng.js
47246
47556
  var getRandomValues;
47247
47557
  var rnds8 = new Uint8Array(16);
47248
47558
  function rng() {
@@ -47255,33 +47565,24 @@ var PodOS = (() => {
47255
47565
  return getRandomValues(rnds8);
47256
47566
  }
47257
47567
 
47258
- // ../node_modules/uuid/dist/esm-browser/stringify.js
47259
- var byteToHex = [];
47260
- for (let i = 0; i < 256; ++i) {
47261
- byteToHex.push((i + 256).toString(16).slice(1));
47262
- }
47263
- function unsafeStringify(arr, offset3 = 0) {
47264
- return byteToHex[arr[offset3 + 0]] + byteToHex[arr[offset3 + 1]] + byteToHex[arr[offset3 + 2]] + byteToHex[arr[offset3 + 3]] + "-" + byteToHex[arr[offset3 + 4]] + byteToHex[arr[offset3 + 5]] + "-" + byteToHex[arr[offset3 + 6]] + byteToHex[arr[offset3 + 7]] + "-" + byteToHex[arr[offset3 + 8]] + byteToHex[arr[offset3 + 9]] + "-" + byteToHex[arr[offset3 + 10]] + byteToHex[arr[offset3 + 11]] + byteToHex[arr[offset3 + 12]] + byteToHex[arr[offset3 + 13]] + byteToHex[arr[offset3 + 14]] + byteToHex[arr[offset3 + 15]];
47265
- }
47266
-
47267
- // ../node_modules/uuid/dist/esm-browser/native.js
47568
+ // ../node_modules/@inrupt/solid-client-authn-core/node_modules/uuid/dist/esm-browser/native.js
47268
47569
  var randomUUID = typeof crypto !== "undefined" && crypto.randomUUID && crypto.randomUUID.bind(crypto);
47269
47570
  var native_default = {
47270
47571
  randomUUID
47271
47572
  };
47272
47573
 
47273
- // ../node_modules/uuid/dist/esm-browser/v4.js
47574
+ // ../node_modules/@inrupt/solid-client-authn-core/node_modules/uuid/dist/esm-browser/v4.js
47274
47575
  function v4(options, buf, offset3) {
47275
47576
  if (native_default.randomUUID && !buf && !options) {
47276
47577
  return native_default.randomUUID();
47277
47578
  }
47278
47579
  options = options || {};
47279
- const rnds = options.random || (options.rng || rng)();
47580
+ var rnds = options.random || (options.rng || rng)();
47280
47581
  rnds[6] = rnds[6] & 15 | 64;
47281
47582
  rnds[8] = rnds[8] & 63 | 128;
47282
47583
  if (buf) {
47283
47584
  offset3 = offset3 || 0;
47284
- for (let i = 0; i < 16; ++i) {
47585
+ for (var i = 0; i < 16; ++i) {
47285
47586
  buf[offset3 + i] = rnds[i];
47286
47587
  }
47287
47588
  return buf;
@@ -47347,6 +47648,7 @@ var PodOS = (() => {
47347
47648
  };
47348
47649
  async function getWebidFromTokenPayload(idToken, jwksIri, issuerIri, clientId) {
47349
47650
  let payload4;
47651
+ let clientIdInPayload;
47350
47652
  try {
47351
47653
  const { payload: verifiedPayload } = await jwtVerify(idToken, createRemoteJWKSet(new URL(jwksIri)), {
47352
47654
  issuer: issuerIri,
@@ -47356,15 +47658,24 @@ var PodOS = (() => {
47356
47658
  } catch (e) {
47357
47659
  throw new Error(`Token verification failed: ${e.stack}`);
47358
47660
  }
47661
+ if (typeof payload4.azp === "string") {
47662
+ clientIdInPayload = payload4.azp;
47663
+ }
47359
47664
  if (typeof payload4.webid === "string") {
47360
- return payload4.webid;
47665
+ return {
47666
+ webId: payload4.webid,
47667
+ clientId: clientIdInPayload
47668
+ };
47361
47669
  }
47362
47670
  if (typeof payload4.sub !== "string") {
47363
47671
  throw new Error(`The token ${JSON.stringify(payload4)} is invalid: it has no 'webid' claim and no 'sub' claim.`);
47364
47672
  }
47365
47673
  try {
47366
47674
  new URL(payload4.sub);
47367
- return payload4.sub;
47675
+ return {
47676
+ webId: payload4.sub,
47677
+ clientId: clientIdInPayload
47678
+ };
47368
47679
  } catch (e) {
47369
47680
  throw new Error(`The token has no 'webid' claim, and its 'sub' claim of [${payload4.sub}] is invalid as a URL - error [${e}].`);
47370
47681
  }
@@ -47689,6 +48000,26 @@ var PodOS = (() => {
47689
48000
  throw new Error(`Failed to retrieve OIDC context from storage associated with session [${sessionId}]: ${e}`);
47690
48001
  }
47691
48002
  }
48003
+ async function saveSessionInfoToStorage(storageUtility, sessionId, webId, clientId, isLoggedIn2, refreshToken, secure, dpopKey) {
48004
+ if (refreshToken !== void 0) {
48005
+ await storageUtility.setForUser(sessionId, { refreshToken }, { secure });
48006
+ }
48007
+ if (webId !== void 0) {
48008
+ await storageUtility.setForUser(sessionId, { webId }, { secure });
48009
+ }
48010
+ if (clientId !== void 0) {
48011
+ await storageUtility.setForUser(sessionId, { clientId }, { secure });
48012
+ }
48013
+ if (isLoggedIn2 !== void 0) {
48014
+ await storageUtility.setForUser(sessionId, { isLoggedIn: isLoggedIn2 }, { secure });
48015
+ }
48016
+ if (dpopKey !== void 0) {
48017
+ await storageUtility.setForUser(sessionId, {
48018
+ publicKey: JSON.stringify(dpopKey.publicKey),
48019
+ privateKey: JSON.stringify(await exportJWK(dpopKey.privateKey))
48020
+ }, { secure });
48021
+ }
48022
+ }
47692
48023
  var StorageUtility = class {
47693
48024
  constructor(secureStorage, insecureStorage) {
47694
48025
  this.secureStorage = secureStorage;
@@ -47932,6 +48263,55 @@ var PodOS = (() => {
47932
48263
  };
47933
48264
  }
47934
48265
 
48266
+ // ../node_modules/@inrupt/solid-client-authn-browser/node_modules/uuid/dist/esm-browser/stringify.js
48267
+ var byteToHex2 = [];
48268
+ for (i = 0; i < 256; ++i) {
48269
+ byteToHex2.push((i + 256).toString(16).slice(1));
48270
+ }
48271
+ var i;
48272
+ function unsafeStringify2(arr, offset3 = 0) {
48273
+ return (byteToHex2[arr[offset3 + 0]] + byteToHex2[arr[offset3 + 1]] + byteToHex2[arr[offset3 + 2]] + byteToHex2[arr[offset3 + 3]] + "-" + byteToHex2[arr[offset3 + 4]] + byteToHex2[arr[offset3 + 5]] + "-" + byteToHex2[arr[offset3 + 6]] + byteToHex2[arr[offset3 + 7]] + "-" + byteToHex2[arr[offset3 + 8]] + byteToHex2[arr[offset3 + 9]] + "-" + byteToHex2[arr[offset3 + 10]] + byteToHex2[arr[offset3 + 11]] + byteToHex2[arr[offset3 + 12]] + byteToHex2[arr[offset3 + 13]] + byteToHex2[arr[offset3 + 14]] + byteToHex2[arr[offset3 + 15]]).toLowerCase();
48274
+ }
48275
+
48276
+ // ../node_modules/@inrupt/solid-client-authn-browser/node_modules/uuid/dist/esm-browser/rng.js
48277
+ var getRandomValues2;
48278
+ var rnds82 = new Uint8Array(16);
48279
+ function rng2() {
48280
+ if (!getRandomValues2) {
48281
+ getRandomValues2 = typeof crypto !== "undefined" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto);
48282
+ if (!getRandomValues2) {
48283
+ throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
48284
+ }
48285
+ }
48286
+ return getRandomValues2(rnds82);
48287
+ }
48288
+
48289
+ // ../node_modules/@inrupt/solid-client-authn-browser/node_modules/uuid/dist/esm-browser/native.js
48290
+ var randomUUID2 = typeof crypto !== "undefined" && crypto.randomUUID && crypto.randomUUID.bind(crypto);
48291
+ var native_default2 = {
48292
+ randomUUID: randomUUID2
48293
+ };
48294
+
48295
+ // ../node_modules/@inrupt/solid-client-authn-browser/node_modules/uuid/dist/esm-browser/v4.js
48296
+ function v42(options, buf, offset3) {
48297
+ if (native_default2.randomUUID && !buf && !options) {
48298
+ return native_default2.randomUUID();
48299
+ }
48300
+ options = options || {};
48301
+ var rnds = options.random || (options.rng || rng2)();
48302
+ rnds[6] = rnds[6] & 15 | 64;
48303
+ rnds[8] = rnds[8] & 63 | 128;
48304
+ if (buf) {
48305
+ offset3 = offset3 || 0;
48306
+ for (var i = 0; i < 16; ++i) {
48307
+ buf[offset3 + i] = rnds[i];
48308
+ }
48309
+ return buf;
48310
+ }
48311
+ return unsafeStringify2(rnds);
48312
+ }
48313
+ var v4_default2 = v42;
48314
+
47935
48315
  // ../node_modules/@inrupt/solid-client-authn-browser/dist/index.mjs
47936
48316
  var import_events = __toESM(require_events(), 1);
47937
48317
 
@@ -48084,12 +48464,13 @@ var PodOS = (() => {
48084
48464
  const rawTokenResponse = await fetch(issuer2.tokenEndpoint, tokenRequestInit);
48085
48465
  const jsonTokenResponse = await rawTokenResponse.json();
48086
48466
  const tokenResponse = validateTokenEndpointResponse(jsonTokenResponse, dpop);
48087
- const webId = await getWebidFromTokenPayload(tokenResponse.id_token, issuer2.jwksUri, issuer2.issuer, client.clientId);
48467
+ const { webId, clientId } = await getWebidFromTokenPayload(tokenResponse.id_token, issuer2.jwksUri, issuer2.issuer, client.clientId);
48088
48468
  return {
48089
48469
  accessToken: tokenResponse.access_token,
48090
48470
  idToken: tokenResponse.id_token,
48091
48471
  refreshToken: hasRefreshToken(tokenResponse) ? tokenResponse.refresh_token : void 0,
48092
48472
  webId,
48473
+ clientId,
48093
48474
  dpopKey,
48094
48475
  expiresIn: tokenResponse.expires_in
48095
48476
  };
@@ -48143,7 +48524,7 @@ var PodOS = (() => {
48143
48524
  throw new Error(`The token endpoint of issuer ${issuer2.issuer} returned a malformed response.`);
48144
48525
  }
48145
48526
  const validatedResponse = validateTokenEndpointResponse(response6, dpopKey !== void 0);
48146
- const webId = await getWebidFromTokenPayload(validatedResponse.id_token, issuer2.jwksUri, issuer2.issuer, client.clientId);
48527
+ const { webId } = await getWebidFromTokenPayload(validatedResponse.id_token, issuer2.jwksUri, issuer2.issuer, client.clientId);
48147
48528
  return {
48148
48529
  accessToken: validatedResponse.access_token,
48149
48530
  idToken: validatedResponse.id_token,
@@ -48233,7 +48614,8 @@ var PodOS = (() => {
48233
48614
  isLoggedIn: redirectInfo.isLoggedIn,
48234
48615
  webId: redirectInfo.webId,
48235
48616
  sessionId: redirectInfo.sessionId,
48236
- expirationDate: redirectInfo.expirationDate
48617
+ expirationDate: redirectInfo.expirationDate,
48618
+ clientAppId: redirectInfo.clientAppId
48237
48619
  };
48238
48620
  } catch (err) {
48239
48621
  await this.cleanUrlAfterRedirect(url7);
@@ -48607,10 +48989,7 @@ var PodOS = (() => {
48607
48989
  eventEmitter,
48608
48990
  expiresIn: tokens.expiresIn
48609
48991
  });
48610
- await this.storageUtility.setForUser(storedSessionId, {
48611
- webId: tokens.webId,
48612
- isLoggedIn: "true"
48613
- }, { secure: true });
48992
+ await saveSessionInfoToStorage(this.storageUtility, storedSessionId, tokens.webId, tokens.clientId, "true", void 0, true);
48614
48993
  const sessionInfo = await this.sessionInfoManager.get(storedSessionId);
48615
48994
  if (!sessionInfo) {
48616
48995
  throw new Error(`Could not retrieve session: [${storedSessionId}].`);
@@ -48747,9 +49126,6 @@ var PodOS = (() => {
48747
49126
  const tokenSet = await refresh(refreshToken, oidcContext.issuerConfig, clientInfo, dpopKey);
48748
49127
  if (tokenSet.refreshToken !== void 0) {
48749
49128
  eventEmitter === null || eventEmitter === void 0 ? void 0 : eventEmitter.emit(EVENTS.NEW_REFRESH_TOKEN, tokenSet.refreshToken);
48750
- await this.storageUtility.setForUser(sessionId, {
48751
- refreshToken: tokenSet.refreshToken
48752
- });
48753
49129
  }
48754
49130
  return tokenSet;
48755
49131
  }
@@ -48885,11 +49261,12 @@ var PodOS = (() => {
48885
49261
  this.info = {
48886
49262
  sessionId: sessionOptions.sessionInfo.sessionId,
48887
49263
  isLoggedIn: false,
48888
- webId: sessionOptions.sessionInfo.webId
49264
+ webId: sessionOptions.sessionInfo.webId,
49265
+ clientAppId: sessionOptions.sessionInfo.clientAppId
48889
49266
  };
48890
49267
  } else {
48891
49268
  this.info = {
48892
- sessionId: sessionId !== null && sessionId !== void 0 ? sessionId : v4_default(),
49269
+ sessionId: sessionId !== null && sessionId !== void 0 ? sessionId : v4_default2(),
48893
49270
  isLoggedIn: false
48894
49271
  };
48895
49272
  }
@@ -48901,6 +49278,7 @@ var PodOS = (() => {
48901
49278
  this.info.isLoggedIn = sessionInfo.isLoggedIn;
48902
49279
  this.info.webId = sessionInfo.webId;
48903
49280
  this.info.sessionId = sessionInfo.sessionId;
49281
+ this.info.clientAppId = sessionInfo.clientAppId;
48904
49282
  this.info.expirationDate = sessionInfo.expirationDate;
48905
49283
  this.events.on(EVENTS.SESSION_EXTENDED, (expiresIn) => {
48906
49284
  this.info.expirationDate = Date.now() + expiresIn * 1e3;
@@ -49020,7 +49398,7 @@ var PodOS = (() => {
49020
49398
 
49021
49399
  // src/modules/contacts.ts
49022
49400
  async function loadContactsModule(store) {
49023
- const module3 = await Promise.resolve().then(() => (init_dist(), dist_exports));
49401
+ const module3 = await Promise.resolve().then(() => (init_dist2(), dist_exports));
49024
49402
  return new module3.default({
49025
49403
  store: store.graph,
49026
49404
  fetcher: store.fetcher,
@@ -49069,6 +49447,30 @@ var PodOS = (() => {
49069
49447
  }
49070
49448
  }
49071
49449
 
49450
+ // src/thing/labelFromUri.ts
49451
+ function labelFromUri(uri6) {
49452
+ const url7 = new URL(uri6);
49453
+ if (isTooGeneric(url7.hash)) {
49454
+ return (getFilename(url7) || url7.host + url7.pathname) + url7.hash;
49455
+ }
49456
+ return labelFromFragment(url7.hash) || getFilename(url7) || url7.host;
49457
+ }
49458
+ function labelFromFragment(fragment) {
49459
+ return fragment ? fragment.split("#")[1] : null;
49460
+ }
49461
+ function isTooGeneric(fragment) {
49462
+ const genericFragments = ["#it", "#this", "#me", "#i"];
49463
+ return genericFragments.includes(fragment);
49464
+ }
49465
+ function getFilename(url7) {
49466
+ if (url7.pathname.endsWith("/")) {
49467
+ const containerName = url7.pathname.split("/").at(-2);
49468
+ return containerName ? containerName + "/" : null;
49469
+ } else {
49470
+ return url7.pathname.split("/").pop();
49471
+ }
49472
+ }
49473
+
49072
49474
  // src/thing/Thing.ts
49073
49475
  var Thing = class {
49074
49476
  constructor(uri6, store, editable = false) {
@@ -49090,7 +49492,10 @@ var PodOS = (() => {
49090
49492
  "http://schema.org/caption",
49091
49493
  "https://schema.org/caption"
49092
49494
  );
49093
- return value6 ?? this.uri;
49495
+ if (value6) {
49496
+ return value6;
49497
+ }
49498
+ return labelFromUri(this.uri);
49094
49499
  }
49095
49500
  literals() {
49096
49501
  const statements = this.store.statementsMatching(namedNode2(this.uri));
@@ -49105,6 +49510,7 @@ var PodOS = (() => {
49105
49510
  const values = statements.filter((it) => isNamedNode(it.object) && !isRdfType(it.predicate)).reduce(accumulateValues, {});
49106
49511
  return Object.keys(values).map((predicate2) => ({
49107
49512
  predicate: predicate2,
49513
+ label: labelFromUri(predicate2),
49108
49514
  uris: values[predicate2]
49109
49515
  }));
49110
49516
  }
@@ -49117,6 +49523,7 @@ var PodOS = (() => {
49117
49523
  const values = statements.reduce(accumulateSubjects, {});
49118
49524
  return Object.keys(values).map((predicate2) => ({
49119
49525
  predicate: predicate2,
49526
+ label: labelFromUri(predicate2),
49120
49527
  uris: values[predicate2]
49121
49528
  }));
49122
49529
  }
@@ -49440,7 +49847,7 @@ var PodOS = (() => {
49440
49847
  foaf: () => foaf,
49441
49848
  http: () => http,
49442
49849
  hydra: () => hydra,
49443
- ldp: () => ldp,
49850
+ ldp: () => ldp2,
49444
49851
  link: () => link3,
49445
49852
  log: () => log2,
49446
49853
  meeting: () => meeting,
@@ -49547,7 +49954,7 @@ var PodOS = (() => {
49547
49954
  var replies = "http://www.w3.org/ns/activitystreams#replies";
49548
49955
  var result = "http://www.w3.org/ns/activitystreams#result";
49549
49956
  var audience = "http://www.w3.org/ns/activitystreams#audience";
49550
- var tag = "http://www.w3.org/ns/activitystreams#tag";
49957
+ var tag2 = "http://www.w3.org/ns/activitystreams#tag";
49551
49958
  var tags = "http://www.w3.org/ns/activitystreams#tags";
49552
49959
  var target = "http://www.w3.org/ns/activitystreams#target";
49553
49960
  var origin2 = "http://www.w3.org/ns/activitystreams#origin";
@@ -49665,7 +50072,7 @@ var PodOS = (() => {
49665
50072
  replies,
49666
50073
  result,
49667
50074
  audience,
49668
- tag,
50075
+ tag: tag2,
49669
50076
  tags,
49670
50077
  target,
49671
50078
  origin: origin2,
@@ -54116,7 +54523,7 @@ var PodOS = (() => {
54116
54523
  var _identified = "http://hl7.org/fhir/_identified";
54117
54524
  var ExplanationOfBenefitAdjudication = "http://hl7.org/fhir/ExplanationOfBenefitAdjudication";
54118
54525
  var _Subscription = "http://hl7.org/fhir/_Subscription";
54119
- var tag2 = "http://hl7.org/fhir/tag";
54526
+ var tag3 = "http://hl7.org/fhir/tag";
54120
54527
  var _performed = "http://hl7.org/fhir/_performed";
54121
54528
  var _formOf = "http://hl7.org/fhir/_formOf";
54122
54529
  var DeviceDefinitionPackagingComponentPackagingPackaging = "http://hl7.org/fhir/DeviceDefinitionPackagingComponentPackagingPackaging";
@@ -58349,7 +58756,7 @@ var PodOS = (() => {
58349
58756
  _identified,
58350
58757
  ExplanationOfBenefitAdjudication,
58351
58758
  _Subscription,
58352
- tag: tag2,
58759
+ tag: tag3,
58353
58760
  _performed,
58354
58761
  _formOf,
58355
58762
  DeviceDefinitionPackagingComponentPackagingPackaging,
@@ -69689,7 +70096,7 @@ var PodOS = (() => {
69689
70096
  var foaf = foafImport;
69690
70097
  var http = httpImport;
69691
70098
  var hydra = hydraImport;
69692
- var ldp = ldpImport;
70099
+ var ldp2 = ldpImport;
69693
70100
  var link3 = linkImport;
69694
70101
  var log2 = logImport;
69695
70102
  var meeting = meetingImport;