solid-ui 2.4.22-b82de984 → 2.4.22-ba72be9b

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/dist/main.js CHANGED
@@ -2745,8 +2745,7 @@ function updatePromise(del, ins) {
2745
2745
  }); // callback
2746
2746
 
2747
2747
  }); // promise
2748
- } // export findBookmarkDocument,
2749
-
2748
+ }
2750
2749
  /* Bookmarking
2751
2750
  */
2752
2751
 
@@ -7105,8 +7104,9 @@ var _debug = __webpack_require__(/*! ./debug */ "./lib/debug.js");
7105
7104
  */
7106
7105
 
7107
7106
  /* eslint-disable multiline-ternary */
7108
- // Do not export. lways us this module to find the icons, as it varies
7109
- var iconsOnGithub = 'https://solidos.github.io/solid-ui/src';
7107
+ // Do not export. Always us this module to find the icons, as they vary
7108
+ var iconsOnGithub = 'https://solidos.github.io/solid-ui/src'; // changed org 2022-05
7109
+
7110
7110
  var icons = module.scriptURI // Firefox extension
7111
7111
  ? {
7112
7112
  iconBase: module.scriptURI.slice(0, module.scriptURI.lastIndexOf('/')) + '/icons/',
@@ -7754,7 +7754,9 @@ exports.loginStatusBox = loginStatusBox;
7754
7754
  exports.newAppInstance = newAppInstance;
7755
7755
  exports.registrationControl = registrationControl;
7756
7756
  exports.registrationList = registrationList;
7757
+ exports.renderScopeHeadingRow = renderScopeHeadingRow;
7757
7758
  exports.renderSignInPopup = renderSignInPopup;
7759
+ exports.scopeLabel = scopeLabel;
7758
7760
  exports.selectWorkspace = selectWorkspace;
7759
7761
 
7760
7762
  var _regenerator = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/regenerator */ "./node_modules/@babel/runtime/regenerator/index.js"));
@@ -7775,7 +7777,7 @@ var _signup = __webpack_require__(/*! ../signup/signup.js */ "./lib/signup/signu
7775
7777
 
7776
7778
  var _style = __webpack_require__(/*! ../style */ "./lib/style.js");
7777
7779
 
7778
- var _index = __webpack_require__(/*! ../utils/index */ "./lib/utils/index.js");
7780
+ var utils = _interopRequireWildcard(__webpack_require__(/*! ../utils */ "./lib/utils/index.js"));
7779
7781
 
7780
7782
  var widgets = _interopRequireWildcard(__webpack_require__(/*! ../widgets */ "./lib/widgets/index.js"));
7781
7783
 
@@ -7783,39 +7785,20 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
7783
7785
 
7784
7786
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
7785
7787
 
7786
- /* eslint-disable camelcase */
7788
+ function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
7787
7789
 
7788
- /**
7789
- * Signing in, signing up, profile and preferences reloading
7790
- * Type index management
7791
- *
7792
- * Many functions in this module take a context object which
7793
- * holds various RDF symbols, add to it, and return a promise of it.
7794
- *
7795
- * * `me` RDF symbol for the user's WebID
7796
- * * `publicProfile` The user's public profile, iff loaded
7797
- * * `preferencesFile` The user's personal preference file, iff loaded
7798
- * * `index.public` The user's public type index file
7799
- * * `index.private` The user's private type index file
7800
- *
7801
- * Not RDF symbols:
7802
- * * `noun` A string in english for the type of thing -- like "address book"
7803
- * * `instance` An array of nodes which are existing instances
7804
- * * `containers` An array of nodes of containers of instances
7805
- * * `div` A DOM element where UI can be displayed
7806
- * * `statusArea` A DOM element (opt) progress stuff can be displayed, or error messages
7807
- * *
7808
- * * Vocabulary: "load" loads a file if it exists;
7809
- * * 'Ensure" CREATES the file if it does not exist (if it can) and then loads it.
7810
- * @packageDocumentation
7811
- */
7790
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
7791
+
7792
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
7812
7793
 
7794
+ var store = _solidLogic.solidLogicSingleton.store;
7813
7795
  /**
7814
7796
  * Resolves with the logged in user's WebID
7815
7797
  *
7816
7798
  * @param context
7817
7799
  */
7818
7800
  // used to be logIn
7801
+
7819
7802
  function ensureLoggedIn(context) {
7820
7803
  var me = _solidLogic.authn.currentUser();
7821
7804
 
@@ -7857,7 +7840,7 @@ function ensureLoggedIn(context) {
7857
7840
  // used to be logInLoadPreferences
7858
7841
 
7859
7842
 
7860
- function ensureLoadedPreferences(_x2) {
7843
+ function ensureLoadedPreferences(_x) {
7861
7844
  return _ensureLoadedPreferences.apply(this, arguments);
7862
7845
  }
7863
7846
  /**
@@ -8004,15 +7987,17 @@ function _ensureLoadedPreferences() {
8004
7987
  return _ensureLoadedPreferences.apply(this, arguments);
8005
7988
  }
8006
7989
 
8007
- function ensureLoadedProfile(_x3) {
7990
+ function ensureLoadedProfile(_x2) {
8008
7991
  return _ensureLoadedProfile.apply(this, arguments);
8009
7992
  }
8010
7993
  /**
8011
- * Returns promise of context with arrays of symbols
8012
- *
8013
- * 2016-12-11 change to include forClass arc a la
8014
- * https://github.com/solid/solid/blob/main/proposals/data-discovery.md
8015
- */
7994
+ * Returns promise of context with arrays of symbols
7995
+ *
7996
+ * 2016-12-11 change to include forClass arc a la
7997
+ * https://github.com/solid/solid/blob/main/proposals/data-discovery.md
7998
+ * This is now legacy; should instead use solid-logic getAppInstances
7999
+ * leaving the `isPublic` param undefined will bring in community index things, too
8000
+ */
8016
8001
 
8017
8002
 
8018
8003
  function _ensureLoadedProfile() {
@@ -8076,210 +8061,139 @@ function _ensureLoadedProfile() {
8076
8061
  return _ensureLoadedProfile.apply(this, arguments);
8077
8062
  }
8078
8063
 
8079
- function findAppInstances(_x4, _x5, _x6) {
8064
+ function findAppInstances(_x3, _x4, _x5) {
8080
8065
  return _findAppInstances.apply(this, arguments);
8081
8066
  }
8082
- /**
8083
- * UI to control registration of instance
8084
- */
8085
-
8086
8067
 
8087
8068
  function _findAppInstances() {
8088
8069
  _findAppInstances = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee6(context, theClass, isPublic) {
8089
- var visibility, index, thisIndex, registrations, instances, containers, unique, e, i, cont;
8070
+ var items;
8090
8071
  return _regenerator["default"].wrap(function _callee6$(_context6) {
8091
8072
  while (1) {
8092
8073
  switch (_context6.prev = _context6.next) {
8093
8074
  case 0:
8094
- unique = function _unique(arr) {
8095
- return Array.from(new Set(arr));
8096
- };
8097
-
8098
- if (!(isPublic === undefined)) {
8099
- _context6.next = 7;
8075
+ if (!context.me) {
8076
+ _context6.next = 6;
8100
8077
  break;
8101
8078
  }
8102
8079
 
8103
- _context6.next = 4;
8104
- return findAppInstances(context, theClass, true);
8080
+ _context6.next = 3;
8081
+ return (0, _solidLogic.getScopedAppInstances)(store, theClass, context.me);
8105
8082
 
8106
- case 4:
8107
- _context6.next = 6;
8108
- return findAppInstances(context, theClass, false);
8083
+ case 3:
8084
+ _context6.t0 = _context6.sent;
8085
+ _context6.next = 7;
8086
+ break;
8109
8087
 
8110
8088
  case 6:
8111
- return _context6.abrupt("return", context);
8089
+ _context6.t0 = [];
8112
8090
 
8113
8091
  case 7:
8114
- _context6.prev = 7;
8115
- _context6.next = 10;
8116
- return isPublic ? ensureLoadedProfile(context) : ensureLoadedPreferences(context);
8117
-
8118
- case 10:
8119
- _context6.next = 15;
8120
- break;
8092
+ items = _context6.t0;
8121
8093
 
8122
- case 12:
8123
- _context6.prev = 12;
8124
- _context6.t0 = _context6["catch"](7);
8125
- widgets.complain(context, "loadIndex: login and load problem ".concat(_context6.t0));
8126
-
8127
- case 15:
8128
- // console.log('awaited LogInLoad!', context)
8129
- visibility = isPublic ? 'public' : 'private';
8130
- _context6.prev = 16;
8131
- _context6.next = 19;
8132
- return (0, _solidLogic.loadIndex)(context, isPublic);
8133
-
8134
- case 19:
8135
- _context6.next = 24;
8136
- break;
8137
-
8138
- case 21:
8139
- _context6.prev = 21;
8140
- _context6.t1 = _context6["catch"](16);
8141
- debug.error(_context6.t1);
8142
-
8143
- case 24:
8144
- index = context.index;
8145
- thisIndex = index[visibility];
8146
- registrations = thisIndex.map(function (ix) {
8147
- return _solidLogic.solidLogicSingleton.store.each(undefined, ns.solid('forClass'), theClass, ix);
8148
- }).reduce(function (acc, curr) {
8149
- return acc.concat(curr);
8150
- }, []);
8151
- instances = registrations.map(function (reg) {
8152
- return _solidLogic.solidLogicSingleton.store.each(reg, ns.solid('instance'));
8153
- }).reduce(function (acc, curr) {
8154
- return acc.concat(curr);
8155
- }, []);
8156
- containers = registrations.map(function (reg) {
8157
- return _solidLogic.solidLogicSingleton.store.each(reg, ns.solid('instanceContainer'));
8158
- }).reduce(function (acc, curr) {
8159
- return acc.concat(curr);
8160
- }, []);
8161
- context.instances = context.instances || [];
8162
- context.instances = unique(context.instances.concat(instances));
8163
- context.containers = context.containers || [];
8164
- context.containers = unique(context.containers.concat(containers));
8165
-
8166
- if (containers.length) {
8167
- _context6.next = 35;
8168
- break;
8169
- }
8170
-
8171
- return _context6.abrupt("return", context);
8172
-
8173
- case 35:
8174
- _context6.prev = 35;
8175
- _context6.next = 38;
8176
- return _solidLogic.solidLogicSingleton.load(containers);
8177
-
8178
- case 38:
8179
- _context6.next = 45;
8180
- break;
8181
-
8182
- case 40:
8183
- _context6.prev = 40;
8184
- _context6.t2 = _context6["catch"](35);
8185
- e = new Error("[FAI] Unable to load containers".concat(_context6.t2));
8186
- debug.log(e); // complain
8187
-
8188
- widgets.complain(context, "Error looking for ".concat(_index.utils.label(theClass), ": ").concat(_context6.t2)); // but then ignore it
8189
- // throw new Error(e)
8190
-
8191
- case 45:
8192
- i = 0;
8193
-
8194
- case 46:
8195
- if (!(i < containers.length)) {
8196
- _context6.next = 56;
8197
- break;
8094
+ if (isPublic === true) {
8095
+ // old API - not recommended!
8096
+ items = items.filter(function (item) {
8097
+ return item.scope.label === 'public';
8098
+ });
8099
+ } else if (isPublic === false) {
8100
+ items = items.filter(function (item) {
8101
+ return item.scope.label === 'private';
8102
+ });
8198
8103
  }
8199
8104
 
8200
- cont = containers[i];
8201
- _context6.t3 = context.instances;
8202
- _context6.next = 51;
8203
- return _solidLogic.solidLogicSingleton.getContainerMembers(cont.value);
8204
-
8205
- case 51:
8206
- _context6.t4 = _context6.sent.map(function (uri) {
8207
- return _solidLogic.solidLogicSingleton.store.sym(uri);
8105
+ context.instances = items.map(function (item) {
8106
+ return item.instance;
8208
8107
  });
8209
- context.instances = _context6.t3.concat.call(_context6.t3, _context6.t4);
8210
-
8211
- case 53:
8212
- i++;
8213
- _context6.next = 46;
8214
- break;
8215
-
8216
- case 56:
8217
8108
  return _context6.abrupt("return", context);
8218
8109
 
8219
- case 57:
8110
+ case 11:
8220
8111
  case "end":
8221
8112
  return _context6.stop();
8222
8113
  }
8223
8114
  }
8224
- }, _callee6, null, [[7, 12], [16, 21], [35, 40]]);
8115
+ }, _callee6);
8225
8116
  }));
8226
8117
  return _findAppInstances.apply(this, arguments);
8227
8118
  }
8228
8119
 
8229
- function registrationControl(_x7, _x8, _x9) {
8230
- return _registrationControl.apply(this, arguments);
8120
+ function scopeLabel(context, scope) {
8121
+ var mine = context.me && context.me.sameTerm(scope.agent);
8122
+ var name = mine ? '' : utils.label(scope.agent) + ' ';
8123
+ return "".concat(name).concat(scope.label);
8231
8124
  }
8232
8125
  /**
8233
- * UI to List at all registered things
8126
+ * UI to control registration of instance
8234
8127
  */
8235
8128
 
8236
8129
 
8130
+ function registrationControl(_x6, _x7, _x8) {
8131
+ return _registrationControl.apply(this, arguments);
8132
+ }
8133
+
8237
8134
  function _registrationControl() {
8238
8135
  _registrationControl = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee7(context, instance, theClass) {
8239
- var dom, box, context2, msg, tbody, form, registrationStatements, index, statements, _msg;
8136
+ var registrationStatements, renderScopeCheckbox, dom, box, me, scopes, msg, tbody, form, _iterator, _step, scope, row;
8240
8137
 
8241
8138
  return _regenerator["default"].wrap(function _callee7$(_context7) {
8242
8139
  while (1) {
8243
8140
  switch (_context7.prev = _context7.next) {
8244
8141
  case 0:
8142
+ renderScopeCheckbox = function _renderScopeCheckbox(scope) {
8143
+ var statements = registrationStatements(scope.index);
8144
+ var name = scopeLabel(context, scope);
8145
+ var label = "".concat(name, " link to this ").concat(context.noun);
8146
+ return widgets.buildCheckboxForm(context.dom, _solidLogic.solidLogicSingleton.store, label, null, statements, form, scope.index);
8147
+ };
8148
+
8149
+ registrationStatements = function _registrationStatemen(index) {
8150
+ var registrations = _solidLogic.solidLogicSingleton.getRegistrations(instance, theClass);
8151
+
8152
+ var reg = registrations.length ? registrations[0] : widgets.newThing(index);
8153
+ return [(0, _rdflib.st)(reg, ns.solid('instance'), instance, index), (0, _rdflib.st)(reg, ns.solid('forClass'), theClass, index)];
8154
+ };
8155
+
8156
+ /// / body of registrationControl
8245
8157
  dom = context.dom;
8246
8158
 
8247
8159
  if (!(!dom || !context.div)) {
8248
- _context7.next = 3;
8160
+ _context7.next = 5;
8249
8161
  break;
8250
8162
  }
8251
8163
 
8252
- return _context7.abrupt("return", context);
8164
+ throw new Error('registrationControl: need dom and div');
8253
8165
 
8254
- case 3:
8166
+ case 5:
8255
8167
  box = dom.createElement('div');
8256
8168
  context.div.appendChild(box);
8257
8169
  context.me = _solidLogic.authn.currentUser(); // @@
8258
8170
 
8259
- if (context.me) {
8260
- _context7.next = 9;
8171
+ me = context.me;
8172
+
8173
+ if (me) {
8174
+ _context7.next = 12;
8261
8175
  break;
8262
8176
  }
8263
8177
 
8264
8178
  box.innerHTML = '<p style="margin:2em;">(Log in to save a link to this)</p>';
8265
8179
  return _context7.abrupt("return", context);
8266
8180
 
8267
- case 9:
8268
- _context7.prev = 9;
8269
- _context7.next = 12;
8270
- return (0, _solidLogic.ensureTypeIndexes)(context);
8271
-
8272
8181
  case 12:
8273
- context2 = _context7.sent;
8274
- _context7.next = 19;
8275
- break;
8182
+ _context7.prev = 12;
8183
+ _context7.next = 15;
8184
+ return (0, _solidLogic.loadAllTypeIndexes)(store, me);
8276
8185
 
8277
8186
  case 15:
8278
- _context7.prev = 15;
8279
- _context7.t0 = _context7["catch"](9);
8187
+ scopes = _context7.sent;
8188
+ _context7.next = 23;
8189
+ break;
8190
+
8191
+ case 18:
8192
+ _context7.prev = 18;
8193
+ _context7.t0 = _context7["catch"](12);
8280
8194
 
8281
8195
  if (context.div && context.preferencesFileError) {
8282
- msg = '(Preferences not available)';
8196
+ msg = '(Lists of stuff not available)';
8283
8197
  context.div.appendChild(dom.createElement('p')).textContent = msg;
8284
8198
  } else if (context.div) {
8285
8199
  msg = "registrationControl: Type indexes not available: ".concat(_context7.t0);
@@ -8287,168 +8201,201 @@ function _registrationControl() {
8287
8201
  }
8288
8202
 
8289
8203
  debug.log(msg);
8204
+ return _context7.abrupt("return", context);
8290
8205
 
8291
- case 19:
8292
- box.innerHTML = '<table><tbody><tr></tr><tr></tr></tbody></table>'; // tbody will be inserted anyway
8206
+ case 23:
8207
+ box.innerHTML = '<table><tbody></tbody></table>'; // tbody will be inserted anyway
8293
8208
 
8294
8209
  box.setAttribute('style', 'font-size: 120%; text-align: right; padding: 1em; border: solid gray 0.05em;');
8295
8210
  tbody = box.children[0].children[0];
8296
8211
  form = new _rdflib.BlankNode(); // @@ say for now
8297
8212
 
8298
- registrationStatements = function registrationStatements(index) {
8299
- var registrations = _solidLogic.solidLogicSingleton.getRegistrations(instance, theClass);
8300
-
8301
- var reg = registrations.length ? registrations[0] : widgets.newThing(index);
8302
- return [(0, _rdflib.st)(reg, ns.solid('instance'), instance, index), (0, _rdflib.st)(reg, ns.solid('forClass'), theClass, index)];
8303
- };
8213
+ _iterator = _createForOfIteratorHelper(scopes);
8304
8214
 
8305
8215
  try {
8306
- if (context2.index && context2.index["public"] && context2.index["public"].length > 0) {
8307
- index = context2.index["public"][0];
8308
- statements = registrationStatements(index);
8309
- tbody.children[0].appendChild(widgets.buildCheckboxForm(context2.dom, _solidLogic.solidLogicSingleton.store, "Public link to this ".concat(context2.noun), null, statements, form, index));
8310
- }
8311
-
8312
- if (context2.index && context2.index["private"] && context2.index["private"].length > 0) {
8313
- index = context2.index["private"][0];
8314
- statements = registrationStatements(index);
8315
- tbody.children[1].appendChild(widgets.buildCheckboxForm(context2.dom, _solidLogic.solidLogicSingleton.store, "Personal note of this ".concat(context2.noun), null, statements, form, index));
8216
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
8217
+ scope = _step.value;
8218
+ row = tbody.appendChild(dom.createElement('tr'));
8219
+ row.appendChild(renderScopeCheckbox(scope)); // @@ index
8316
8220
  }
8317
- } catch (e) {
8318
- _msg = "registrationControl: Error making panel: ".concat(e);
8319
-
8320
- if (context.div) {
8321
- context.div.appendChild(widgets.errorMessageBlock(context.dom, e));
8322
- }
8323
-
8324
- debug.log(_msg);
8221
+ } catch (err) {
8222
+ _iterator.e(err);
8223
+ } finally {
8224
+ _iterator.f();
8325
8225
  }
8326
8226
 
8327
- return _context7.abrupt("return", context2);
8227
+ return _context7.abrupt("return", context);
8328
8228
 
8329
- case 26:
8229
+ case 30:
8330
8230
  case "end":
8331
8231
  return _context7.stop();
8332
8232
  }
8333
8233
  }
8334
- }, _callee7, null, [[9, 15]]);
8234
+ }, _callee7, null, [[12, 18]]);
8335
8235
  }));
8336
8236
  return _registrationControl.apply(this, arguments);
8337
8237
  }
8338
8238
 
8339
- function registrationList(_x10, _x11) {
8239
+ function renderScopeHeadingRow(context, store, scope) {
8240
+ var backgroundColor = {
8241
+ "private": '#fee',
8242
+ "public": '#efe'
8243
+ };
8244
+ var dom = context.dom;
8245
+ var name = scopeLabel(context, scope);
8246
+ var row = dom.createElement('tr');
8247
+ var cell = row.appendChild(dom.createElement('td'));
8248
+ cell.setAttribute('colspan', '3');
8249
+ cell.style.backgoundColor = backgroundColor[scope.label] || 'white';
8250
+ var header = cell.appendChild(dom.createElement('h3'));
8251
+ header.textContent = name + ' links';
8252
+ header.style.textAlign = 'left';
8253
+ return row;
8254
+ }
8255
+ /**
8256
+ * UI to List at all registered things
8257
+ */
8258
+
8259
+
8260
+ function registrationList(_x9, _x10) {
8340
8261
  return _registrationList.apply(this, arguments);
8341
- }
8262
+ } // registrationList
8263
+
8342
8264
 
8343
8265
  function _registrationList() {
8344
- _registrationList = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee8(context0, options) {
8345
- var dom, div, box;
8346
- return _regenerator["default"].wrap(function _callee8$(_context8) {
8266
+ _registrationList = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee9(context, options) {
8267
+ var dom, div, box, scopes, table, tbody, _iterator2, _step2, scope, headingRow, items, _iterator3, _step3, _loop;
8268
+
8269
+ return _regenerator["default"].wrap(function _callee9$(_context9) {
8347
8270
  while (1) {
8348
- switch (_context8.prev = _context8.next) {
8271
+ switch (_context9.prev = _context9.next) {
8349
8272
  case 0:
8350
- dom = context0.dom;
8351
- div = context0.div;
8273
+ dom = context.dom;
8274
+ div = context.div;
8352
8275
  box = dom.createElement('div');
8353
8276
  div.appendChild(box);
8354
- context0.me = _solidLogic.authn.currentUser(); // @@
8277
+ context.me = _solidLogic.authn.currentUser(); // @@
8355
8278
 
8356
- if (context0.me) {
8357
- _context8.next = 8;
8279
+ if (context.me) {
8280
+ _context9.next = 8;
8358
8281
  break;
8359
8282
  }
8360
8283
 
8361
8284
  box.innerHTML = '<p style="margin:2em;">(Log in list your stuff)</p>';
8362
- return _context8.abrupt("return", context0);
8285
+ return _context9.abrupt("return", context);
8363
8286
 
8364
8287
  case 8:
8365
- return _context8.abrupt("return", (0, _solidLogic.ensureTypeIndexes)(context0).then(function (context) {
8366
- box.innerHTML = '<table><tbody></tbody></table>'; // tbody will be inserted anyway
8367
-
8368
- // tbody will be inserted anyway
8369
- box.setAttribute('style', 'font-size: 120%; text-align: right; padding: 1em; border: solid #eee 0.5em;');
8370
- var table = box.firstChild;
8371
- var ix = [];
8372
- var sts = [];
8373
- var vs = ['private', 'public'];
8374
- vs.forEach(function (visibility) {
8375
- if (context.index && context.index[visibility].length > 0 && options[visibility]) {
8376
- ix = ix.concat(context.index[visibility][0]);
8377
- sts = sts.concat(_solidLogic.solidLogicSingleton.store.statementsMatching(undefined, ns.solid('instance'), undefined, context.index[visibility][0]));
8378
- }
8379
- });
8288
+ _context9.next = 10;
8289
+ return (0, _solidLogic.loadAllTypeIndexes)(store, context.me);
8380
8290
 
8381
- var _loop = function _loop(i) {
8382
- var statement = sts[i];
8291
+ case 10:
8292
+ scopes = _context9.sent;
8293
+ // includes community indexes
8294
+ // console.log('@@ registrationList ', scopes)
8295
+ box.innerHTML = '<table><tbody></tbody></table>'; // tbody will be inserted anyway
8383
8296
 
8384
- if (options.type) {
8385
- // now check terms:forClass
8386
- if (!_solidLogic.solidLogicSingleton.store.holds(statement.subject, ns.solid('forClass'), options.type, statement.why)) {
8387
- return "continue"; // skip irrelevant ones
8388
- }
8389
- } // const cla = statement.subject
8297
+ box.setAttribute('style', 'font-size: 120%; text-align: right; padding: 1em; border: solid #eee 0.5em;');
8298
+ table = box.firstChild;
8299
+ tbody = table.firstChild;
8300
+ _iterator2 = _createForOfIteratorHelper(scopes);
8301
+ _context9.prev = 16;
8390
8302
 
8303
+ _iterator2.s();
8304
+
8305
+ case 18:
8306
+ if ((_step2 = _iterator2.n()).done) {
8307
+ _context9.next = 30;
8308
+ break;
8309
+ }
8391
8310
 
8392
- // const cla = statement.subject
8393
- var inst = statement.object;
8394
- table.appendChild(widgets.personTR(dom, ns.solid('instance'), inst, {
8395
- deleteFunction: function deleteFunction(_x) {
8396
- if (!_solidLogic.solidLogicSingleton.store.updater) {
8397
- throw new Error('Cannot delete this, store has no updater');
8311
+ scope = _step2.value;
8312
+ // need some predicate for listing/adding agents
8313
+ headingRow = renderScopeHeadingRow(context, store, scope);
8314
+ tbody.appendChild(headingRow);
8315
+ _context9.next = 24;
8316
+ return (0, _solidLogic.getScopedAppsFromIndex)(store, scope, options.type || null);
8317
+
8318
+ case 24:
8319
+ items = _context9.sent;
8320
+ // any class
8321
+ if (items.length === 0) headingRow.style.display = 'none'; // console.log(`registrationList: @@ instance items for class ${options.type || 'undefined' }:`, items)
8322
+
8323
+ _iterator3 = _createForOfIteratorHelper(items);
8324
+
8325
+ try {
8326
+ _loop = function _loop() {
8327
+ var item = _step3.value;
8328
+ var row = widgets.personTR(dom, ns.solid('instance'), item.instance, {
8329
+ deleteFunction: function () {
8330
+ var _deleteFunction = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee8() {
8331
+ return _regenerator["default"].wrap(function _callee8$(_context8) {
8332
+ while (1) {
8333
+ switch (_context8.prev = _context8.next) {
8334
+ case 0:
8335
+ _context8.next = 2;
8336
+ return (0, _solidLogic.deleteTypeIndexRegistration)(store, item);
8337
+
8338
+ case 2:
8339
+ tbody.removeChild(row);
8340
+
8341
+ case 3:
8342
+ case "end":
8343
+ return _context8.stop();
8344
+ }
8345
+ }
8346
+ }, _callee8);
8347
+ }));
8348
+
8349
+ function deleteFunction() {
8350
+ return _deleteFunction.apply(this, arguments);
8398
8351
  }
8399
8352
 
8400
- _solidLogic.solidLogicSingleton.store.updater.update([statement], [], function (uri, ok, errorBody) {
8401
- if (ok) {
8402
- debug.log("Removed from index: ".concat(statement.subject));
8403
- } else {
8404
- debug.log("Error: Cannot delete ".concat(statement, ": ").concat(errorBody));
8405
- }
8406
- });
8407
- }
8408
- }));
8353
+ return deleteFunction;
8354
+ }()
8355
+ });
8356
+ row.children[0].style.paddingLeft = '3em';
8357
+ tbody.appendChild(row);
8409
8358
  };
8410
8359
 
8411
- for (var i = 0; i < sts.length; i++) {
8412
- var _ret = _loop(i);
8360
+ for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
8361
+ _loop();
8362
+ }
8363
+ } catch (err) {
8364
+ _iterator3.e(err);
8365
+ } finally {
8366
+ _iterator3.f();
8367
+ }
8413
8368
 
8414
- if (_ret === "continue") continue;
8415
- } // registrationList
8369
+ case 28:
8370
+ _context9.next = 18;
8371
+ break;
8416
8372
 
8417
- /*
8418
- //const containers = solidLogicSingleton.store.each(theClass, ns.solid('instanceContainer'));
8419
- if (containers.length) {
8420
- fetcher.load(containers).then(function(xhrs){
8421
- for (const i=0; i<containers.length; i++) {
8422
- const cont = containers[i];
8423
- instances = instances.concat(solidLogicSingleton.store.each(cont, ns.ldp('contains')));
8424
- }
8425
- });
8426
- }
8427
- */
8373
+ case 30:
8374
+ _context9.next = 35;
8375
+ break;
8428
8376
 
8377
+ case 32:
8378
+ _context9.prev = 32;
8379
+ _context9.t0 = _context9["catch"](16);
8429
8380
 
8430
- // registrationList
8381
+ _iterator2.e(_context9.t0);
8431
8382
 
8432
- /*
8433
- //const containers = solidLogicSingleton.store.each(theClass, ns.solid('instanceContainer'));
8434
- if (containers.length) {
8435
- fetcher.load(containers).then(function(xhrs){
8436
- for (const i=0; i<containers.length; i++) {
8437
- const cont = containers[i];
8438
- instances = instances.concat(solidLogicSingleton.store.each(cont, ns.ldp('contains')));
8439
- }
8440
- });
8441
- }
8442
- */
8443
- return context;
8444
- }));
8383
+ case 35:
8384
+ _context9.prev = 35;
8445
8385
 
8446
- case 9:
8386
+ _iterator2.f();
8387
+
8388
+ return _context9.finish(35);
8389
+
8390
+ case 38:
8391
+ return _context9.abrupt("return", context);
8392
+
8393
+ case 39:
8447
8394
  case "end":
8448
- return _context8.stop();
8395
+ return _context9.stop();
8449
8396
  }
8450
8397
  }
8451
- }, _callee8);
8398
+ }, _callee9, null, [[16, 32, 35, 38]]);
8452
8399
  }));
8453
8400
  return _registrationList.apply(this, arguments);
8454
8401
  }
@@ -8605,7 +8552,7 @@ function renderSignInPopup(dom) {
8605
8552
  }, _callee, null, [[0, 8]]);
8606
8553
  }));
8607
8554
 
8608
- return function loginToIssuer(_x12) {
8555
+ return function loginToIssuer(_x11) {
8609
8556
  return _ref.apply(this, arguments);
8610
8557
  };
8611
8558
  }();
@@ -8892,7 +8839,7 @@ function selectWorkspace(dom, appDetails, callbackWS) {
8892
8839
 
8893
8840
  function displayOptions(context) {
8894
8841
  // console.log('displayOptions!', context)
8895
- function makeNewWorkspace(_x13) {
8842
+ function makeNewWorkspace(_x12) {
8896
8843
  return _makeNewWorkspace.apply(this, arguments);
8897
8844
  } // const status = ''
8898
8845
 
@@ -9161,77 +9108,77 @@ function getUserRoles() {
9161
9108
 
9162
9109
 
9163
9110
  function _getUserRoles() {
9164
- _getUserRoles = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee9() {
9111
+ _getUserRoles = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee10() {
9165
9112
  var _yield$ensureLoadedPr, me, preferencesFile, preferencesFileError;
9166
9113
 
9167
- return _regenerator["default"].wrap(function _callee9$(_context9) {
9114
+ return _regenerator["default"].wrap(function _callee10$(_context10) {
9168
9115
  while (1) {
9169
- switch (_context9.prev = _context9.next) {
9116
+ switch (_context10.prev = _context10.next) {
9170
9117
  case 0:
9171
- _context9.prev = 0;
9172
- _context9.next = 3;
9118
+ _context10.prev = 0;
9119
+ _context10.next = 3;
9173
9120
  return ensureLoadedPreferences({});
9174
9121
 
9175
9122
  case 3:
9176
- _yield$ensureLoadedPr = _context9.sent;
9123
+ _yield$ensureLoadedPr = _context10.sent;
9177
9124
  me = _yield$ensureLoadedPr.me;
9178
9125
  preferencesFile = _yield$ensureLoadedPr.preferencesFile;
9179
9126
  preferencesFileError = _yield$ensureLoadedPr.preferencesFileError;
9180
9127
 
9181
9128
  if (!(!preferencesFile || preferencesFileError)) {
9182
- _context9.next = 9;
9129
+ _context10.next = 9;
9183
9130
  break;
9184
9131
  }
9185
9132
 
9186
9133
  throw new Error(preferencesFileError);
9187
9134
 
9188
9135
  case 9:
9189
- return _context9.abrupt("return", _solidLogic.solidLogicSingleton.store.each(me, ns.rdf('type'), null, preferencesFile.doc()));
9136
+ return _context10.abrupt("return", _solidLogic.solidLogicSingleton.store.each(me, ns.rdf('type'), null, preferencesFile.doc()));
9190
9137
 
9191
9138
  case 12:
9192
- _context9.prev = 12;
9193
- _context9.t0 = _context9["catch"](0);
9194
- debug.warn('Unable to fetch your preferences - this was the error: ', _context9.t0);
9139
+ _context10.prev = 12;
9140
+ _context10.t0 = _context10["catch"](0);
9141
+ debug.warn('Unable to fetch your preferences - this was the error: ', _context10.t0);
9195
9142
 
9196
9143
  case 15:
9197
- return _context9.abrupt("return", []);
9144
+ return _context10.abrupt("return", []);
9198
9145
 
9199
9146
  case 16:
9200
9147
  case "end":
9201
- return _context9.stop();
9148
+ return _context10.stop();
9202
9149
  }
9203
9150
  }
9204
- }, _callee9, null, [[0, 12]]);
9151
+ }, _callee10, null, [[0, 12]]);
9205
9152
  }));
9206
9153
  return _getUserRoles.apply(this, arguments);
9207
9154
  }
9208
9155
 
9209
- function filterAvailablePanes(_x14) {
9156
+ function filterAvailablePanes(_x13) {
9210
9157
  return _filterAvailablePanes.apply(this, arguments);
9211
9158
  }
9212
9159
 
9213
9160
  function _filterAvailablePanes() {
9214
- _filterAvailablePanes = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee10(panes) {
9161
+ _filterAvailablePanes = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee11(panes) {
9215
9162
  var userRoles;
9216
- return _regenerator["default"].wrap(function _callee10$(_context10) {
9163
+ return _regenerator["default"].wrap(function _callee11$(_context11) {
9217
9164
  while (1) {
9218
- switch (_context10.prev = _context10.next) {
9165
+ switch (_context11.prev = _context11.next) {
9219
9166
  case 0:
9220
- _context10.next = 2;
9167
+ _context11.next = 2;
9221
9168
  return getUserRoles();
9222
9169
 
9223
9170
  case 2:
9224
- userRoles = _context10.sent;
9225
- return _context10.abrupt("return", panes.filter(function (pane) {
9171
+ userRoles = _context11.sent;
9172
+ return _context11.abrupt("return", panes.filter(function (pane) {
9226
9173
  return isMatchingAudience(pane, userRoles);
9227
9174
  }));
9228
9175
 
9229
9176
  case 4:
9230
9177
  case "end":
9231
- return _context10.stop();
9178
+ return _context11.stop();
9232
9179
  }
9233
9180
  }
9234
- }, _callee10);
9181
+ }, _callee11);
9235
9182
  }));
9236
9183
  return _filterAvailablePanes.apply(this, arguments);
9237
9184
  }
@@ -12026,6 +11973,83 @@ module.exports = style; // @@ No way to do this in ESM
12026
11973
 
12027
11974
  /***/ }),
12028
11975
 
11976
+ /***/ "./lib/style_multiSelect.js":
11977
+ /*!**********************************!*\
11978
+ !*** ./lib/style_multiSelect.js ***!
11979
+ \**********************************/
11980
+ /***/ ((module, exports) => {
11981
+
11982
+ "use strict";
11983
+
11984
+
11985
+ Object.defineProperty(exports, "__esModule", ({
11986
+ value: true
11987
+ }));
11988
+ exports.style = void 0;
11989
+
11990
+ /*
11991
+ * BASED ON:
11992
+ * IconicMultiSelect v0.7.0
11993
+ * Licence: MIT
11994
+ * (c) 2021 Sidney Wimart.
11995
+ * repo & configuration: https://github.com/sidneywm/iconic-multiselect
11996
+ */
11997
+
11998
+ /**
11999
+ * @version IconicMultiSelect v0.7.0
12000
+ * @licence MIT
12001
+ */
12002
+ var style = {
12003
+ multiselect__container: "\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n background-color: #fff;\n border-radius: 2px;\n -webkit-box-shadow: 0 1px 3px 0 #d1d1d2, 0 0 0 1px #d1d1d2;\n box-shadow: 0 1px 3px 0 #d1d1d2, 0 0 0 1px #d1d1d2;\n -webkit-box-sizing: border-box;\n box-sizing: border-box;\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n min-height: 36px;\n padding: 4px 8px 0 8px;\n position: relative;\n width: 354px;\n margin-bottom: 5px;\n font-size: 100%\n ",
12004
+
12005
+ /*
12006
+ multiselect__container:after: `
12007
+ content: '';
12008
+ min-height:inherit;
12009
+ font-size:0;
12010
+ `,
12011
+ multiselect__container > *: `
12012
+ color: #656565;
12013
+ font-size: 14px;
12014
+ `,
12015
+ */
12016
+ multiselect__wrapper: "\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n -ms-flex-wrap: wrap;\n flex-wrap: wrap;\n height: 100%;\n width: 100%;\n ",
12017
+ multiselect__clear_btn: "\n cursor: pointer;\n align-items: center;\n margin-bottom: 4px;\n margin-left: 4px;\n ",
12018
+ multiselect__options: "\n background-color: #f6f6f6;\n border-radius: 2px;\n left: 0;\n max-height: 0;\n overflow: hidden;\n position: absolute;\n top: calc(100% + 3px);\n z-index: 9999;\n width: 100%;\n opacity: 0;\n transition: max-height 0.1s ease;\n ",
12019
+ multiselect__options_visible: "\n background-color: #f6f6f6;\n border-radius: 2px;\n left: 0;\n max-height: 0;\n overflow: hidden;\n position: absolute;\n top: calc(100% + 3px);\n z-index: 9999;\n width: 100%;\n opacity: 0;\n transition: max-height 0.1s ease;\n max-height: 200px;\n -webkit-box-shadow: 0 1px 3px 0 #d1d1d2, 0 0 0 1px #d1d1d2;\n box-shadow: 0 1px 3px 0 #d1d1d2, 0 0 0 1px #d1d1d2;\n opacity: 1;\n transition: max-height 0.2s ease;\n ",
12020
+ multiselect__options_ul: "\n list-style: none;\n margin: 0;\n padding: 2px 0;\n max-height: 200px;\n overflow: auto;\n ",
12021
+ multiselect__options_ul_li: "\n cursor: pointer;\n padding: 4px 8px;\n ",
12022
+ // multiselect__options ul li:hover: `
12023
+ multiselect__options_ul_li_hover: "\n background-color: #dedede;\n ",
12024
+
12025
+ /*
12026
+ multiselect__options ul li *: `
12027
+ pointer-events: none;
12028
+ `,
12029
+ */
12030
+ multiselect__options_ul_p_multiselect__options_no_results: "\n margin: 0;\n padding: 8px;\n text-align: center;\n ",
12031
+ multiselect__options_ul_p_multiselect__options_no_data: "\n margin: 0;\n padding: 8px;\n text-align: center;\n ",
12032
+ // multiselect__options ul li.multiselect__options--selected: `
12033
+ multiselect__options_ul_li_multiselect__options_selected: "\n background-color: #656565;\n color: #fff;\n ",
12034
+ // multiselect__options ul li.multiselect__options--selected:hover: `
12035
+ multiselect__options_ul_li_multiselect__options_selected_hover: "\n background-color: #656565;\n ",
12036
+ // multiselect__options ul li.arrow-selected: `
12037
+ multiselect__options_ul_li_arrow_selected: "\n border: 2px solid rgba(101, 101, 101, 0.5);\n ",
12038
+ multiselect__selected: "\n background-color: #656565;\n border-radius: 2px;\n color: #fff;\n margin-bottom: 4px;\n margin-right: 4px;\n padding: 4px 8px;\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n ",
12039
+ multiselect__selected_multiselect__remove_btn: "\n cursor: pointer;\n display: flex;\n margin-left: 6px;\n ",
12040
+ multiselect__input: "\n border: none;\n -ms-flex-preferred-size: 40%;\n flex-basis: 40%;\n -webkit-box-flex: 1;\n -ms-flex-positive: 1;\n flex-grow: 1;\n height: 5px; \n margin-bottom: 4px;\n min-width: 40%;\n outline: none; \n "
12041
+ };
12042
+ exports.style = style;
12043
+
12044
+ style.setStyle = function setStyle(ele, styleName) {
12045
+ ele.style = style[styleName];
12046
+ };
12047
+
12048
+ module.exports = style;
12049
+ //# sourceMappingURL=style_multiSelect.js.map
12050
+
12051
+ /***/ }),
12052
+
12029
12053
  /***/ "./lib/table.js":
12030
12054
  /*!**********************!*\
12031
12055
  !*** ./lib/table.js ***!
@@ -13914,9 +13938,9 @@ function tabWidget(options) {
13914
13938
  var marginsPrepped = margins.concat(margins).slice(orientation, orientation + 4);
13915
13939
  var marginsStyle = "margin: ".concat(marginsPrepped.join(' '), ";");
13916
13940
  var paddingStyle = "padding: ".concat(marginsPrepped.join(' '), ";");
13917
- var tabStyle = cornersStyle + "padding: 0.7em; max-width: 20em; color: ".concat(color, ";");
13918
- var unselectedStyle = "".concat(tabStyle + marginsStyle, "opacity: 50%; background-color: ").concat(backgroundColor, ";");
13919
- var selectedStyle = "".concat(tabStyle + marginsStyle, "background-color: ").concat(selectedColor, ";");
13941
+ var tabStyle = cornersStyle + "position: relative; padding: 0.7em; max-width: 20em; color: ".concat(color, ";");
13942
+ var unselectedStyle = "".concat(tabStyle + marginsStyle, " opacity: 50%; background-color: ").concat(backgroundColor, ";");
13943
+ var selectedStyle = "".concat(tabStyle + marginsStyle, " background-color: ").concat(selectedColor, ";");
13920
13944
  var shownStyle = 'height: 100%; width: 100%;';
13921
13945
  var hiddenStyle = shownStyle + 'display: none;';
13922
13946
  rootElement.refresh = orderedSync;
@@ -13976,35 +14000,50 @@ function tabWidget(options) {
13976
14000
 
13977
14001
  function makeNewSlot(item) {
13978
14002
  var ele = dom.createElement(tabElement);
14003
+ ele.setAttribute('style', unselectedStyle);
13979
14004
  ele.subject = item;
13980
- var div = ele.appendChild(dom.createElement('div'));
13981
- div.setAttribute('style', unselectedStyle);
13982
- div.addEventListener('click', function (e) {
13983
- if (!e.metaKey) {
13984
- resetTabStyle();
13985
- resetBodyStyle();
14005
+ var div = ele.appendChild(dom.createElement('button'));
14006
+ div.setAttribute('style', 'background: none; border: none; font: inherit; cursor: pointer');
14007
+ var ellipsis = dom.createElement('button');
14008
+ ellipsis.textContent = '...';
14009
+ ellipsis.setAttribute('style', 'position: absolute; right: 0; bottom: 0; width: 20%; background: none; color: inherit; border: none; padding: 0; font: inherit; cursor: pointer; outline: inherit;');
14010
+
14011
+ div.onclick = function () {
14012
+ resetTabStyle();
14013
+ resetBodyStyle();
14014
+ ele.setAttribute('style', selectedStyle);
14015
+ if (!ele.bodyTR) return;
14016
+ ele.bodyTR.setAttribute('style', shownStyle);
14017
+ var bodyMain = getOrCreateContainerElement(ele);
14018
+
14019
+ if (options.renderMain && ele.subject && bodyMain.asSettings !== false) {
14020
+ bodyMain.innerHTML = 'loading item ...' + item;
14021
+ options.renderMain(bodyMain, ele.subject);
14022
+ bodyMain.asSettings = false;
13986
14023
  }
14024
+ };
13987
14025
 
13988
- div.setAttribute('style', selectedStyle);
14026
+ ellipsis.onclick = function () {
14027
+ resetTabStyle();
14028
+ resetBodyStyle();
14029
+ ele.setAttribute('style', selectedStyle);
13989
14030
  if (!ele.bodyTR) return;
13990
14031
  ele.bodyTR.setAttribute('style', shownStyle);
13991
14032
  var bodyMain = getOrCreateContainerElement(ele);
13992
14033
 
13993
- if (options.renderTabSettings && e.altKey && ele.subject && bodyMain.asSettings !== true) {
14034
+ if (options.renderTabSettings && ele.subject && bodyMain.asSettings !== true) {
13994
14035
  bodyMain.innerHTML = 'loading settings ...' + item;
13995
14036
  options.renderTabSettings(bodyMain, ele.subject);
13996
14037
  bodyMain.asSettings = true;
13997
- } else if (options.renderMain && ele.subject && bodyMain.asSettings !== false) {
13998
- bodyMain.innerHTML = 'loading item ...' + item;
13999
- options.renderMain(bodyMain, ele.subject);
14000
- bodyMain.asSettings = false;
14001
14038
  }
14002
- });
14039
+ };
14003
14040
 
14004
14041
  if (options.renderTab) {
14005
14042
  options.renderTab(div, item);
14043
+ ele.appendChild(ellipsis);
14006
14044
  } else {
14007
- div.textContent = (0, _utils.label)(item);
14045
+ div.innerHTML = (0, _utils.label)(item);
14046
+ ele.appendChild(ellipsis);
14008
14047
  }
14009
14048
 
14010
14049
  return ele;
@@ -14084,10 +14123,8 @@ function tabWidget(options) {
14084
14123
 
14085
14124
  if (_tab.classList.contains('unstyled')) {
14086
14125
  continue;
14087
- }
14088
-
14089
- if (_tab.children[0]) {
14090
- _tab.children[0].setAttribute('style', unselectedStyle);
14126
+ } else {
14127
+ _tab.setAttribute('style', unselectedStyle);
14091
14128
  }
14092
14129
  }
14093
14130
  }
@@ -15172,7 +15209,7 @@ function slice(s, suffix) {
15172
15209
 
15173
15210
  function getWellKnownLabel(thing) {
15174
15211
  return _solidLogic.store.any(thing, UI.ns.ui('label')) || // Prioritize ui:label
15175
- _solidLogic.store.any(thing, UI.ns.link('message')) || _solidLogic.store.any(thing, UI.ns.vcard('fn')) || _solidLogic.store.any(thing, UI.ns.foaf('name')) || _solidLogic.store.any(thing, UI.ns.dct('title')) || _solidLogic.store.any(thing, UI.ns.dc('title')) || _solidLogic.store.any(thing, UI.ns.rss('title')) || _solidLogic.store.any(thing, UI.ns.contact('fullName')) || _solidLogic.store.any(thing, _solidLogic.store.sym('http://www.w3.org/2001/04/roadmap/org#name')) || _solidLogic.store.any(thing, UI.ns.cal('summary')) || _solidLogic.store.any(thing, UI.ns.foaf('nick')) || _solidLogic.store.any(thing, UI.ns.as('name')) || _solidLogic.store.any(thing, UI.ns.schema('name')) || _solidLogic.store.any(thing, UI.ns.rdfs('label'));
15212
+ _solidLogic.store.any(thing, UI.ns.link('message')) || _solidLogic.store.any(thing, UI.ns.vcard('fn')) || _solidLogic.store.any(thing, UI.ns.foaf('name')) || _solidLogic.store.any(thing, UI.ns.dct('title')) || _solidLogic.store.any(thing, UI.ns.dc('title')) || _solidLogic.store.any(thing, UI.ns.rss('title')) || _solidLogic.store.any(thing, UI.ns.contact('fullName')) || _solidLogic.store.any(thing, _solidLogic.store.sym('http://www.w3.org/2001/04/roadmap/org#name')) || _solidLogic.store.any(thing, UI.ns.cal('summary')) || _solidLogic.store.any(thing, UI.ns.foaf('nick')) || _solidLogic.store.any(thing, UI.ns.as('name')) || _solidLogic.store.any(thing, UI.ns.schema('name')) || _solidLogic.store.any(thing, UI.ns.rdfs('label')) || _solidLogic.store.any(thing, _solidLogic.store.sym('http://www.w3.org/2004/02/skos/core#prefLabel'));
15176
15213
  }
15177
15214
  //# sourceMappingURL=label.js.map
15178
15215
 
@@ -15192,11 +15229,11 @@ Object.defineProperty(exports, "__esModule", ({
15192
15229
  }));
15193
15230
  exports.versionInfo = void 0;
15194
15231
  var versionInfo = {
15195
- buildTime: '2022-05-10T08:32:21Z',
15196
- commit: 'b82de9840c3fb6ddbe51c92da3546f27520525ce',
15232
+ buildTime: '2022-06-14T09:30:26Z',
15233
+ commit: 'ba72be9b6236de2115e4793ad07dec8ff2506a7b',
15197
15234
  npmInfo: {
15198
15235
  'solid-ui': '2.4.22',
15199
- npm: '6.14.16',
15236
+ npm: '6.14.17',
15200
15237
  ares: '1.18.1',
15201
15238
  brotli: '1.0.9',
15202
15239
  cldr: '40.0',
@@ -15205,12 +15242,12 @@ var versionInfo = {
15205
15242
  modules: '83',
15206
15243
  napi: '8',
15207
15244
  nghttp2: '1.42.0',
15208
- node: '14.19.1',
15209
- openssl: '1.1.1n',
15245
+ node: '14.19.3',
15246
+ openssl: '1.1.1o',
15210
15247
  tz: '2021a3',
15211
15248
  unicode: '14.0',
15212
15249
  uv: '1.42.0',
15213
- v8: '8.4.371.23-node.85',
15250
+ v8: '8.4.371.23-node.87',
15214
15251
  zlib: '1.2.11'
15215
15252
  }
15216
15253
  };
@@ -16280,6 +16317,7 @@ function openHrefInOutlineMode(e) {
16280
16317
 
16281
16318
  if (dom.outlineManager) {
16282
16319
  // @@ TODO Remove the use of document as a global object
16320
+ // TODO fix dependency cycle to solid-panes by calling outlineManager
16283
16321
  ;
16284
16322
  dom.outlineManager.GotoSubject(_solidLogic.store.sym(uri), true, undefined, true, undefined);
16285
16323
  } else if (window && window.panes && window.panes.getOutliner) {
@@ -16407,6 +16445,7 @@ function linkButton(dom, object) {
16407
16445
  b.textContent = 'Goto ' + utils.label(object);
16408
16446
  b.addEventListener('click', function (_event) {
16409
16447
  // b.parentNode.removeChild(b)
16448
+ // TODO fix dependency cycle to solid-panes by calling outlineManager
16410
16449
  ;
16411
16450
  dom.outlineManager.GotoSubject(object, true, undefined, true, undefined);
16412
16451
  }, true);
@@ -17047,7 +17086,7 @@ function uploadFiles(fetcher, files, fileBase, imageBase, successHandler) {
17047
17086
  /*!******************************!*\
17048
17087
  !*** ./lib/widgets/error.js ***!
17049
17088
  \******************************/
17050
- /***/ ((__unused_webpack_module, exports) => {
17089
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
17051
17090
 
17052
17091
  "use strict";
17053
17092
 
@@ -17057,6 +17096,8 @@ Object.defineProperty(exports, "__esModule", ({
17057
17096
  }));
17058
17097
  exports.errorMessageBlock = errorMessageBlock;
17059
17098
 
17099
+ var _widgets = __webpack_require__(/*! ../widgets */ "./lib/widgets/index.js");
17100
+
17060
17101
  /**
17061
17102
  * Create an error message block
17062
17103
  * @param dom The DOM on which dom.createElement will be called
@@ -17087,6 +17128,9 @@ function errorMessageBlock(dom, err, backgroundColor, err2) {
17087
17128
  div.textContent = err;
17088
17129
  }
17089
17130
 
17131
+ div.appendChild((0, _widgets.cancelButton)(dom, function () {
17132
+ if (div.parentNode) div.parentNode.removeChild(div);
17133
+ })).style = 'width: 2em; height: 2em; align: right;';
17090
17134
  div.setAttribute('style', 'margin: 0.1em; padding: 0.5em; border: 0.05em solid gray; background-color: ' + (backgroundColor || '#fee') + '; color:black;');
17091
17135
  return div;
17092
17136
  }
@@ -17125,6 +17169,12 @@ Object.defineProperty(exports, "field", ({
17125
17169
  return _fieldFunction.field;
17126
17170
  }
17127
17171
  }));
17172
+ Object.defineProperty(exports, "fieldFunction", ({
17173
+ enumerable: true,
17174
+ get: function get() {
17175
+ return _fieldFunction.fieldFunction;
17176
+ }
17177
+ }));
17128
17178
  Object.defineProperty(exports, "fieldLabel", ({
17129
17179
  enumerable: true,
17130
17180
  get: function get() {
@@ -17147,8 +17197,15 @@ exports.findClosest = findClosest;
17147
17197
  exports.formsFor = formsFor;
17148
17198
  exports.makeDescription = makeDescription;
17149
17199
  exports.makeSelectForCategory = makeSelectForCategory;
17200
+ exports.makeSelectForChoice = makeSelectForChoice;
17150
17201
  exports.makeSelectForNestedCategory = makeSelectForNestedCategory;
17151
17202
  exports.makeSelectForOptions = makeSelectForOptions;
17203
+ Object.defineProperty(exports, "mostSpecificClassURI", ({
17204
+ enumerable: true,
17205
+ get: function get() {
17206
+ return _fieldFunction.mostSpecificClassURI;
17207
+ }
17208
+ }));
17152
17209
  exports.newButton = newButton;
17153
17210
  exports.newThing = newThing;
17154
17211
  exports.promptForNew = promptForNew;
@@ -17196,6 +17253,8 @@ var _solidLogic = __webpack_require__(/*! solid-logic */ "./node_modules/solid-l
17196
17253
 
17197
17254
  var utils = _interopRequireWildcard(__webpack_require__(/*! ../utils */ "./lib/utils/index.js"));
17198
17255
 
17256
+ var _multiSelect = __webpack_require__(/*! ./multiSelect */ "./lib/widgets/multiSelect.js");
17257
+
17199
17258
  var widgets = _interopRequireWildcard(__webpack_require__(/*! ../widgets */ "./lib/widgets/index.js"));
17200
17259
 
17201
17260
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
@@ -17258,14 +17317,16 @@ _fieldFunction.field[ns.ui('Form').uri] = _fieldFunction.field[ns.ui('Group').ur
17258
17317
  var ui = ns.ui;
17259
17318
  if (container) container.appendChild(box); // Prevent loops
17260
17319
 
17320
+ if (!form) return;
17261
17321
  var key = subject.toNT() + '|' + form.toNT();
17262
17322
 
17263
17323
  if (already[key]) {
17264
17324
  // been there done that
17265
- box.appendChild(dom.createTextNode('Group: see above ' + key));
17266
- var plist = [$rdf.st(subject, ns.owl('sameAs'), subject)]; // @@ need prev subject
17325
+ box.appendChild(dom.createTextNode('Group: see above ' + key)); // TODO fix dependency cycle to solid-panes by calling outlineManager
17326
+ // const plist = [$rdf.st(subject, ns.owl('sameAs'), subject)] // @@ need prev subject
17327
+ // dom.outlineManager.appendPropertyTRs(box, plist)
17328
+ // dom.appendChild(plist)
17267
17329
 
17268
- dom.outlineManager.appendPropertyTRs(box, plist);
17269
17330
  return box;
17270
17331
  }
17271
17332
 
@@ -17366,47 +17427,43 @@ _fieldFunction.field[ns.ui('Options').uri] = function (dom, container, already,
17366
17427
  values = kb.each(subject, dependingOn);
17367
17428
  }
17368
17429
 
17369
- if (values.length === 0) {
17370
- box.appendChild((0, _error.errorMessageBlock)(dom, "Can't select subform as no value of: " + dependingOn));
17371
- } else {
17372
- for (var i = 0; i < cases.length; i++) {
17373
- var c = cases[i];
17374
- var tests = kb.each(c, ui('for'), null, formDoc); // There can be multiple 'for'
17430
+ for (var i = 0; i < cases.length; i++) {
17431
+ var c = cases[i];
17432
+ var tests = kb.each(c, ui('for'), null, formDoc); // There can be multiple 'for'
17375
17433
 
17376
- var match = false;
17434
+ var match = false;
17377
17435
 
17378
- for (var j = 0; j < tests.length; j++) {
17379
- var _iterator = _createForOfIteratorHelper(values),
17380
- _step;
17436
+ for (var j = 0; j < tests.length; j++) {
17437
+ var _iterator = _createForOfIteratorHelper(values),
17438
+ _step;
17381
17439
 
17382
- try {
17383
- for (_iterator.s(); !(_step = _iterator.n()).done;) {
17384
- var value = _step.value;
17385
- var test = tests[j];
17440
+ try {
17441
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
17442
+ var value = _step.value;
17443
+ var test = tests[j];
17386
17444
 
17387
- if (value.sameTerm(tests) || value.termType === test.termType && value.value === test.value) {
17388
- match = true;
17389
- }
17445
+ if (value.sameTerm(tests) || value.termType === test.termType && value.value === test.value) {
17446
+ match = true;
17390
17447
  }
17391
- } catch (err) {
17392
- _iterator.e(err);
17393
- } finally {
17394
- _iterator.f();
17395
17448
  }
17449
+ } catch (err) {
17450
+ _iterator.e(err);
17451
+ } finally {
17452
+ _iterator.f();
17396
17453
  }
17454
+ }
17397
17455
 
17398
- if (match) {
17399
- var _field3 = kb.the(c, ui('use'));
17400
-
17401
- if (!_field3) {
17402
- box.appendChild((0, _error.errorMessageBlock)(dom, 'No "use" part for case in form ' + form));
17403
- return box;
17404
- } else {
17405
- appendForm(dom, box, already, subject, _field3, dataDoc, callbackFunction);
17406
- }
17456
+ if (match) {
17457
+ var _field3 = kb.the(c, ui('use'));
17407
17458
 
17408
- break;
17459
+ if (!_field3) {
17460
+ box.appendChild((0, _error.errorMessageBlock)(dom, 'No "use" part for case in form ' + form));
17461
+ return box;
17462
+ } else {
17463
+ appendForm(dom, box, already, subject, _field3, dataDoc, callbackFunction);
17409
17464
  }
17465
+
17466
+ break;
17410
17467
  }
17411
17468
  } // @@ Add box.refresh() to sync fields with values
17412
17469
 
@@ -17694,7 +17751,7 @@ _fieldFunction.field[ns.ui('Multiple').uri] = function (dom, container, already,
17694
17751
  // delete button and move buttons
17695
17752
 
17696
17753
  if (kb.updater.editable(dataDoc.uri)) {
17697
- buttons.deleteButtonWithCheck(dom, subField, utils.label(property), deleteThisItem);
17754
+ buttons.deleteButtonWithCheck(dom, subField, multipleUIlabel, deleteThisItem);
17698
17755
 
17699
17756
  if (ordered) {
17700
17757
  // Add controsl in a frame
@@ -17745,7 +17802,7 @@ _fieldFunction.field[ns.ui('Multiple').uri] = function (dom, container, already,
17745
17802
 
17746
17803
  var _shim = dom.createElement('div');
17747
17804
 
17748
- _shim.appendChild(subField); // Subfield has its own laytout
17805
+ _shim.appendChild(subField); // Subfield has its own layout
17749
17806
 
17750
17807
 
17751
17808
  frame.appendChild(_shim);
@@ -17794,6 +17851,8 @@ _fieldFunction.field[ns.ui('Multiple').uri] = function (dom, container, already,
17794
17851
  return shim;
17795
17852
  }
17796
17853
 
17854
+ var multipleUIlabel = kb.any(form, ui('label'));
17855
+ if (!multipleUIlabel) multipleUIlabel = utils.label(property);
17797
17856
  var min = kb.any(form, ui('min')); // This is the minimum number -- default 0
17798
17857
 
17799
17858
  min = min ? 0 + min.value : 0;
@@ -17834,10 +17893,9 @@ _fieldFunction.field[ns.ui('Multiple').uri] = function (dom, container, already,
17834
17893
  img.setAttribute('src', plusIconURI); // plus sign
17835
17894
 
17836
17895
  img.setAttribute('style', 'margin: 0.2em; width: 1.5em; height:1.5em');
17837
- img.title = 'Click to add one or more ' + utils.predicateLabel(property, reverse);
17838
- var prompt = tail.appendChild(dom.createElement('span'));
17839
- prompt.textContent = (values.length === 0 ? 'Add one or more ' : 'Add more ') + utils.predicateLabel(property, reverse); // utils.label(property)
17840
-
17896
+ img.title = 'Click to add another ' + multipleUIlabel;
17897
+ var prompt = dom.createElement('span');
17898
+ prompt.textContent = (values.length === 0 ? 'Add another ' : 'Add ') + multipleUIlabel;
17841
17899
  tail.addEventListener('click', /*#__PURE__*/function () {
17842
17900
  var _ref3 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee5(_eventNotUsed) {
17843
17901
  return _regenerator["default"].wrap(function _callee5$(_context5) {
@@ -17859,6 +17917,7 @@ _fieldFunction.field[ns.ui('Multiple').uri] = function (dom, container, already,
17859
17917
  return _ref3.apply(this, arguments);
17860
17918
  };
17861
17919
  }(), true);
17920
+ tail.appendChild(prompt);
17862
17921
  }
17863
17922
 
17864
17923
  function createListIfNecessary() {
@@ -18133,14 +18192,13 @@ _fieldFunction.field[ns.ui('Classifier').uri] = function (dom, container, alread
18133
18192
  ** -- radio buttons
18134
18193
  ** -- auto-complete typing
18135
18194
  **
18136
- ** Todo: Deal with multiple. Maybe merge with multiple code.
18195
+ ** TODO: according to ontology ui:choice can also have ns.ui('default') - this is not implemented yet
18137
18196
  */
18138
18197
 
18139
18198
 
18140
18199
  _fieldFunction.field[ns.ui('Choice').uri] = function (dom, container, already, subject, form, dataDoc, callbackFunction) {
18141
18200
  var ui = ns.ui;
18142
18201
  var kb = _solidLogic.store;
18143
- var multiple = false;
18144
18202
  var formDoc = form.doc ? form.doc() : null; // @@ if blank no way to know
18145
18203
 
18146
18204
  var p;
@@ -18168,96 +18226,117 @@ _fieldFunction.field[ns.ui('Choice').uri] = function (dom, container, already, s
18168
18226
  }
18169
18227
 
18170
18228
  var subForm = kb.any(form, ui('use')); // Optional
18229
+ // const follow = kb.anyJS(form, ui('follow'), null, formDoc) // data doc moves to new subject?
18171
18230
 
18172
- var follow = kb.anyJS(form, ui('follow'), null, formDoc); // data doc moves to new subject?
18173
-
18174
- var possible = [];
18175
- var possibleProperties;
18176
- var firstSelectOptionText = '* Select from ' + utils.label(subject, true) + ' *';
18177
18231
  var opts = {
18178
18232
  form: form,
18179
18233
  subForm: subForm,
18180
- multiple: multiple,
18181
- firstSelectOptionText: firstSelectOptionText,
18182
18234
  disambiguate: false
18183
18235
  };
18184
- possible = kb.each(undefined, ns.rdf('type'), uiFrom, formDoc);
18185
18236
 
18186
- for (var x in kb.findMembersNT(uiFrom)) {
18187
- possible.push(kb.fromNT(x));
18188
- } // Use rdfs
18237
+ function getSelectorOptions() {
18238
+ var possible = [];
18239
+ var possibleProperties;
18240
+ possible = kb.each(undefined, ns.rdf('type'), uiFrom, formDoc);
18189
18241
 
18242
+ for (var x in kb.findMembersNT(uiFrom)) {
18243
+ possible.push(kb.fromNT(x));
18244
+ } // Use rdfs
18190
18245
 
18191
- if (uiFrom.sameTerm(ns.rdfs('Class'))) {
18192
- for (p in buttons.allClassURIs()) {
18193
- possible.push(kb.sym(p));
18194
- } // log.debug("%%% Choice field: possible.length 2 = "+possible.length)
18195
18246
 
18196
- } else if (uiFrom.sameTerm(ns.rdf('Property'))) {
18197
- possibleProperties = buttons.propertyTriage(kb);
18247
+ if (uiFrom.sameTerm(ns.rdfs('Class'))) {
18248
+ for (p in buttons.allClassURIs()) {
18249
+ possible.push(kb.sym(p));
18250
+ } // log.debug("%%% Choice field: possible.length 2 = "+possible.length)
18198
18251
 
18199
- for (p in possibleProperties.op) {
18200
- possible.push(kb.fromNT(p));
18201
- }
18252
+ } else if (uiFrom.sameTerm(ns.rdf('Property'))) {
18253
+ possibleProperties = buttons.propertyTriage(kb);
18202
18254
 
18203
- for (p in possibleProperties.dp) {
18204
- possible.push(kb.fromNT(p));
18205
- }
18255
+ for (p in possibleProperties.op) {
18256
+ possible.push(kb.fromNT(p));
18257
+ }
18206
18258
 
18207
- opts.disambiguate = true; // This is a big class, and the labels won't be enough.
18208
- } else if (uiFrom.sameTerm(ns.owl('ObjectProperty'))) {
18209
- possibleProperties = buttons.propertyTriage(kb);
18259
+ for (p in possibleProperties.dp) {
18260
+ possible.push(kb.fromNT(p));
18261
+ }
18210
18262
 
18211
- for (p in possibleProperties.op) {
18212
- possible.push(kb.fromNT(p));
18213
- }
18263
+ opts.disambiguate = true; // This is a big class, and the labels won't be enough.
18264
+ } else if (uiFrom.sameTerm(ns.owl('ObjectProperty'))) {
18265
+ possibleProperties = buttons.propertyTriage(kb);
18266
+
18267
+ for (p in possibleProperties.op) {
18268
+ possible.push(kb.fromNT(p));
18269
+ }
18214
18270
 
18215
- opts.disambiguate = true;
18216
- } else if (uiFrom.sameTerm(ns.owl('DatatypeProperty'))) {
18217
- possibleProperties = buttons.propertyTriage(kb);
18271
+ opts.disambiguate = true;
18272
+ } else if (uiFrom.sameTerm(ns.owl('DatatypeProperty'))) {
18273
+ possibleProperties = buttons.propertyTriage(kb);
18218
18274
 
18219
- for (p in possibleProperties.dp) {
18220
- possible.push(kb.fromNT(p));
18275
+ for (p in possibleProperties.dp) {
18276
+ possible.push(kb.fromNT(p));
18277
+ }
18278
+
18279
+ opts.disambiguate = true;
18221
18280
  }
18222
18281
 
18223
- opts.disambiguate = true;
18224
- }
18282
+ return possible; // return sortByLabel(possible)
18283
+ } // TODO: this checks for any occurrence, regardless of true or false setting
18225
18284
 
18226
- var sortedPossible = sortByLabel(possible); // TODO: this checks for any occurrence, regardless of true or false setting
18227
18285
 
18228
18286
  if (kb.any(form, ui('canMintNew'))) {
18229
18287
  opts.mint = '* Create new *'; // @@ could be better
18230
18288
  }
18231
18289
 
18232
- var selector = makeSelectForOptions(dom, kb, subject, property, sortedPossible, uiFrom, opts, dataDoc, callbackFunction);
18233
- rhs.appendChild(selector);
18234
- var object;
18290
+ var multiSelect = kb.any(form, ui('multiselect')); // Optional
18235
18291
 
18236
- if (selector.currentURI) {
18237
- object = $rdf.sym(selector.currentURI);
18238
- } else {
18239
- object = kb.any(subject, property);
18240
- }
18292
+ var selector;
18241
18293
 
18242
- if (object && subForm) {
18243
- removeNextSiblingsAfterElement(selector);
18244
- addSubFormChoice(dom, rhs, already, object, subForm, follow ? object.doc() : dataDoc, callbackFunction);
18245
- }
18294
+ rhs.refresh = function () {
18295
+ // from ui:property
18296
+ var selectedOptions = kb.each(subject, property, null, dataDoc).map(function (object) {
18297
+ return object.value;
18298
+ }); // from ui:from + ui:property
18246
18299
 
18247
- return box;
18248
- };
18249
- /**
18250
- * Removes all sibling elements after specified
18251
- * @param {HTMLElement} currentElement
18252
- * @private
18253
- */
18300
+ var possibleOptions = getSelectorOptions();
18301
+ possibleOptions.push(selectedOptions);
18302
+ possibleOptions = sortByLabel(possibleOptions);
18303
+ selector = makeSelectForChoice(dom, rhs, kb, subject, property, possibleOptions, selectedOptions, uiFrom, opts, dataDoc, callbackFunction);
18304
+ rhs.innerHTML = '';
18305
+ rhs.appendChild(selector);
18306
+
18307
+ if (multiSelect) {
18308
+ var multiSelectDiv = new _multiSelect.IconicMultiSelect({
18309
+ placeholder: selector.selected,
18310
+ select: selector,
18311
+ container: rhs,
18312
+ textField: 'textField',
18313
+ valueField: 'valueField'
18314
+ });
18315
+ multiSelectDiv.init();
18316
+ multiSelectDiv.subscribe(function (event) {
18317
+ if (event.action === 'REMOVE_OPTION') {
18318
+ selectedOptions = selectedOptions.filter(function (value) {
18319
+ return value !== event.value;
18320
+ });
18321
+ }
18322
+
18323
+ if (event.action === 'CLEAR_ALL_OPTIONS') {
18324
+ selectedOptions = [];
18325
+ }
18254
18326
 
18327
+ if (event.action === 'ADD_OPTION') {
18328
+ selectedOptions.push(event.value);
18329
+ }
18255
18330
 
18256
- function removeNextSiblingsAfterElement(currentElement) {
18257
- while (currentElement.nextElementSibling) {
18258
- currentElement.nextElementSibling.remove();
18259
- }
18260
- }
18331
+ selector.update(selectedOptions);
18332
+ });
18333
+ }
18334
+ };
18335
+
18336
+ rhs.refresh();
18337
+ if (selector && selector.refresh) selector.refresh();
18338
+ return box;
18339
+ };
18261
18340
 
18262
18341
  function addSubFormChoice(dom, selectDiv, already, subject, subForm, dataDoc, callbackFunction) {
18263
18342
  (0, _fieldFunction.fieldFunction)(dom, subForm)(dom, selectDiv, already, subject, subForm, dataDoc, callbackFunction);
@@ -18464,7 +18543,8 @@ function promptForNew(dom, kb, subject, predicate, theClass, form, dataDoc, call
18464
18543
  b.setAttribute('type', 'button');
18465
18544
  b.setAttribute('style', 'float: right;');
18466
18545
  b.innerHTML = 'Goto ' + utils.label(theClass);
18467
- b.addEventListener('click', function (_e) {
18546
+ b.addEventListener('click', // TODO fix dependency cycle to solid-panes by calling outlineManager
18547
+ function (_e) {
18468
18548
  dom.outlineManager.GotoSubject(theClass, true, undefined, true, undefined);
18469
18549
  }, false);
18470
18550
  return box;
@@ -18599,17 +18679,15 @@ function makeDescription(dom, kb, subject, predicate, dataDoc, callbackFunction)
18599
18679
  // @param subject - a term, the subject of the statement(s) being edited.
18600
18680
  // @param predicate - a term, the predicate of the statement(s) being edited
18601
18681
  // @param possible - a list of terms, the possible value the object can take
18602
- // @param options.multiple - Boolean - Whether more than one at a time is allowed
18603
- // @param options.firstSelectOptionText - a string to be displayed as the
18682
+ // @param options.nullLabel - a string to be displayed as the
18604
18683
  // option for none selected (for non multiple)
18605
- // @param options.mint - User may create thing if this sent to the prompt string eg "New foo"
18606
18684
  // @param options.subForm - If mint, then the form to be used for minting the new thing
18607
18685
  // @param dataDoc - The web document being edited
18608
18686
  // @param callbackFunction - takes (boolean ok, string errorBody)
18609
18687
  */
18610
18688
 
18611
18689
 
18612
- function makeSelectForOptions(dom, kb, subject, predicate, possible, uiFrom, options, dataDoc, callbackFunction) {
18690
+ function makeSelectForOptions(dom, kb, subject, predicate, possible, options, dataDoc, callbackFunction) {
18613
18691
  log.debug('Select list length now ' + possible.length);
18614
18692
  var n = 0;
18615
18693
  var uris = {}; // Count them
@@ -18626,7 +18704,7 @@ function makeSelectForOptions(dom, kb, subject, predicate, possible, uiFrom, opt
18626
18704
  } // uris is now the set of possible options
18627
18705
 
18628
18706
 
18629
- if (n === 0 && !options.mint) {
18707
+ if (n === 0) {
18630
18708
  return (0, _error.errorMessageBlock)(dom, "Can't do selector with no options, subject= " + subject + ' property = ' + predicate + '.');
18631
18709
  }
18632
18710
 
@@ -18652,6 +18730,8 @@ function makeSelectForOptions(dom, kb, subject, predicate, possible, uiFrom, opt
18652
18730
  actual = getActual();
18653
18731
 
18654
18732
  var onChange = function onChange(_e) {
18733
+ select.disabled = true; // until data written back - gives user feedback too
18734
+
18655
18735
  var ds = [];
18656
18736
  var is = [];
18657
18737
 
@@ -18661,43 +18741,18 @@ function makeSelectForOptions(dom, kb, subject, predicate, possible, uiFrom, opt
18661
18741
  }
18662
18742
  };
18663
18743
 
18664
- var newObject;
18665
-
18666
18744
  for (var _i = 0; _i < select.options.length; _i++) {
18667
18745
  var opt = select.options[_i];
18668
-
18669
- if (opt.selected && opt.AJAR_mint) {
18670
- // not sure if this 'if' is used because I cannot find mintClass
18671
- if (options.mintClass) {
18672
- var thisForm = promptForNew(dom, kb, subject, predicate, options.mintClass, null, dataDoc, function (ok, body) {
18673
- if (!ok) {
18674
- callbackFunction(ok, body, {
18675
- change: 'new'
18676
- }); // @@ if ok, need some form of refresh of the select for the new thing
18677
- }
18678
- });
18679
- select.parentNode.appendChild(thisForm);
18680
- newObject = thisForm.AJAR_subject;
18681
- } else {
18682
- newObject = newThing(dataDoc);
18683
- }
18684
-
18685
- is.push($rdf.st(subject, predicate, kb.sym(newObject), dataDoc));
18686
- if (uiFrom) is.push($rdf.st(newObject, ns.rdf('type'), kb.sym(uiFrom), dataDoc)); // not sure if this 'if' is used because I cannot find mintStatementsFun
18687
-
18688
- if (options.mintStatementsFun) {
18689
- is = is.concat(options.mintStatementsFun(newObject));
18690
- }
18691
-
18692
- select.currentURI = newObject;
18693
- }
18694
-
18695
18746
  if (!opt.AJAR_uri) continue; // a prompt or mint
18696
18747
 
18697
18748
  if (opt.selected && !(opt.AJAR_uri in actual)) {
18698
18749
  // new class
18699
18750
  is.push($rdf.st(subject, predicate, kb.sym(opt.AJAR_uri), dataDoc));
18700
- select.currentURI = opt.AJAR_uri;
18751
+ }
18752
+
18753
+ if (!opt.selected && opt.AJAR_uri in actual) {
18754
+ // old class
18755
+ removeValue(kb.sym(opt.AJAR_uri));
18701
18756
  }
18702
18757
 
18703
18758
  if (opt.selected) select.currentURI = opt.AJAR_uri;
@@ -18717,29 +18772,25 @@ function makeSelectForOptions(dom, kb, subject, predicate, possible, uiFrom, opt
18717
18772
  sel = sel.superSelect;
18718
18773
  }
18719
18774
 
18720
- log.info('selectForOptions: data doc = ' + dataDoc); // refresh subForm
18775
+ log.info('selectForOptions: data doc = ' + dataDoc);
18776
+ kb.updater.update(ds, is, function (uri, ok, body) {
18777
+ actual = getActual(); // refresh
18721
18778
 
18722
- removeNextSiblingsAfterElement(select);
18723
- addSubFormChoice(dom, select.parentNode, {}, $rdf.sym(select.currentURI), options.subForm, dataDoc, function (ok, body) {
18724
18779
  if (ok) {
18725
- kb.updater.update(ds, is, function (uri, success, errorBody) {
18726
- actual = getActual(); // refresh
18727
-
18728
- if (!success) select.parentNode.appendChild((0, _error.errorMessageBlock)(dom, 'Error updating select: ' + errorBody));
18729
- });
18730
- if (callbackFunction) callbackFunction(ok, {
18731
- widget: 'select',
18732
- event: 'new'
18733
- });
18780
+ select.disabled = false; // data written back
18734
18781
  } else {
18735
- select.parentNode.appendChild((0, _error.errorMessageBlock)(dom, 'Error updating data in field of select: ' + body));
18782
+ return select.parentNode.appendChild((0, _error.errorMessageBlock)(dom, 'Error updating data in select: ' + body));
18736
18783
  }
18784
+
18785
+ if (callbackFunction) callbackFunction(ok, {
18786
+ widget: 'select',
18787
+ event: 'change'
18788
+ });
18737
18789
  });
18738
18790
  };
18739
18791
 
18740
18792
  var select = dom.createElement('select');
18741
18793
  select.setAttribute('style', style.formSelectSTyle);
18742
- if (options.multiple) select.setAttribute('multiple', 'true');
18743
18794
  select.currentURI = null;
18744
18795
 
18745
18796
  select.refresh = function () {
@@ -18782,22 +18833,11 @@ function makeSelectForOptions(dom, kb, subject, predicate, possible, uiFrom, opt
18782
18833
  select.appendChild(option);
18783
18834
  }
18784
18835
 
18785
- if (editable && options.mint) {
18786
- var mint = dom.createElement('option');
18787
- mint.appendChild(dom.createTextNode(options.mint));
18788
- mint.AJAR_mint = true; // Flag it
18789
-
18790
- select.insertBefore(mint, select.firstChild);
18791
- }
18792
-
18793
- if (!select.currentURI && !options.multiple) {
18836
+ if (!select.currentURI) {
18794
18837
  var prompt = dom.createElement('option');
18795
- prompt.appendChild(dom.createTextNode(options.firstSelectOptionText));
18796
- prompt.disabled = true;
18797
- prompt.value = true;
18798
- prompt.hidden = true;
18799
- prompt.selected = true;
18838
+ prompt.appendChild(dom.createTextNode(options.nullLabel));
18800
18839
  select.insertBefore(prompt, select.firstChild);
18840
+ prompt.selected = true;
18801
18841
  }
18802
18842
 
18803
18843
  if (editable) {
@@ -18816,27 +18856,16 @@ function makeSelectForOptions(dom, kb, subject, predicate, possible, uiFrom, opt
18816
18856
  function makeSelectForCategory(dom, kb, subject, category, dataDoc, callbackFunction) {
18817
18857
  var du = kb.any(category, ns.owl('disjointUnionOf'));
18818
18858
  var subs;
18819
- var multiple = false;
18820
18859
 
18821
18860
  if (!du) {
18822
18861
  subs = kb.each(undefined, ns.rdfs('subClassOf'), category);
18823
- multiple = true;
18824
18862
  } else {
18825
18863
  subs = du.elements;
18826
18864
  }
18827
18865
 
18828
18866
  log.debug('Select list length ' + subs.length);
18829
-
18830
- if (subs.length === 0) {
18831
- return (0, _error.errorMessageBlock)(dom, "Can't do " + (multiple ? 'multiple ' : '') + 'selector with no subclasses of category: ' + category);
18832
- }
18833
-
18834
- if (subs.length === 1) {
18835
- return (0, _error.errorMessageBlock)(dom, "Can't do " + (multiple ? 'multiple ' : '') + 'selector with only 1 subclass of category: ' + category + ':' + subs[1]);
18836
- }
18837
-
18838
- return makeSelectForOptions(dom, kb, subject, ns.rdf('type'), subs, null, {
18839
- multiple: multiple
18867
+ return makeSelectForOptions(dom, kb, subject, ns.rdf('type'), subs, {
18868
+ nullLabel: '* Select type *'
18840
18869
  }, dataDoc, callbackFunction);
18841
18870
  }
18842
18871
  /** Make SELECT element to select subclasses recurively
@@ -18870,8 +18899,7 @@ function makeSelectForNestedCategory(dom, kb, subject, category, dataDoc, callba
18870
18899
  function onChange(ok, body) {
18871
18900
  if (ok) update();
18872
18901
  callbackFunction(ok, body);
18873
- } // eslint-disable-next-line prefer-const
18874
-
18902
+ }
18875
18903
 
18876
18904
  var select = makeSelectForCategory(dom, kb, subject, category, dataDoc, onChange);
18877
18905
  container.appendChild(select);
@@ -19026,6 +19054,264 @@ function newThing(doc) {
19026
19054
  var now = new Date();
19027
19055
  return $rdf.sym(doc.uri + '#' + 'id' + ('' + now.getTime()));
19028
19056
  }
19057
+ /** Make SELECT element to select options
19058
+ //
19059
+ // @param subject - a term, the subject of the statement(s) being edited.
19060
+ // @param predicate - a term, the predicate of the statement(s) being edited
19061
+ // @param possible - a list of terms, the possible value the object can take
19062
+ // @param options.mint - User may create thing if this sent to the prompt string eg "New foo"
19063
+ // @param options.subForm - If mint, then the form to be used for minting the new thing
19064
+ // @param dataDoc - The web document being edited
19065
+ // @param callbackFunction - takes (boolean ok, string errorBody)
19066
+ */
19067
+
19068
+
19069
+ function makeSelectForChoice(dom, container, kb, subject, predicate, inputPossibleOptions, selectedOptions, uiFrom, options, dataDoc, callbackFunction) {
19070
+ var optionsFromClassUIfrom = {}; // Count them
19071
+
19072
+ var editable = kb.updater.editable(dataDoc.uri);
19073
+
19074
+ for (var i = 0; i < inputPossibleOptions.length; i++) {
19075
+ var sub = inputPossibleOptions[i]; // @@ Maybe; make this so it works with blank nodes too
19076
+ // if (!sub.uri) debug.warn(`makeSelectForChoice: option does not have an uri: ${sub}, with predicate: ${predicate}`)
19077
+
19078
+ if (!sub.uri || sub.uri in optionsFromClassUIfrom) continue;
19079
+ optionsFromClassUIfrom[sub.uri] = true;
19080
+ }
19081
+
19082
+ var isEmpty = Object.keys(optionsFromClassUIfrom).length === 0;
19083
+
19084
+ if (isEmpty && !options.mint) {
19085
+ return (0, _error.errorMessageBlock)(dom, "Can't do selector with no options, subject= " + subject + ' property = ' + predicate + '.');
19086
+ }
19087
+
19088
+ log.debug('makeSelectForChoice: dataDoc=' + dataDoc);
19089
+
19090
+ function createDefaultSelectOptionText() {
19091
+ var firstSelectOptionText = '--- choice ---';
19092
+
19093
+ if (predicate && !(predicate.termType === 'BlankNode')) {
19094
+ firstSelectOptionText = '* Select for property: ' + utils.label(predicate) + ' *';
19095
+ }
19096
+
19097
+ if (subject && !(subject.termType === 'BlankNode')) {
19098
+ firstSelectOptionText = '* Select for ' + utils.label(subject, true) + ' *';
19099
+ }
19100
+
19101
+ return firstSelectOptionText;
19102
+ }
19103
+
19104
+ function createDefaultSelectOption() {
19105
+ var option = dom.createElement('option');
19106
+ option.appendChild(dom.createTextNode(createDefaultSelectOptionText()));
19107
+ option.disabled = true;
19108
+ option.value = true;
19109
+ option.hidden = true;
19110
+ option.selected = true;
19111
+ return option;
19112
+ }
19113
+
19114
+ var onChange = function onChange(_e) {
19115
+ container.removeChild(container.lastChild);
19116
+ select.refresh();
19117
+ };
19118
+
19119
+ var select = dom.createElement('select');
19120
+ select.setAttribute('style', style.formSelectSTyle);
19121
+ select.setAttribute('id', 'formSelect');
19122
+ select.currentURI = null;
19123
+
19124
+ for (var uri in optionsFromClassUIfrom) {
19125
+ select.appendChild(createOption(uri));
19126
+ }
19127
+
19128
+ if (editable && options.mint) {
19129
+ var mint = dom.createElement('option');
19130
+ mint.appendChild(dom.createTextNode(options.mint));
19131
+ mint.AJAR_mint = true; // Flag it
19132
+
19133
+ select.insertBefore(mint, select.firstChild);
19134
+ }
19135
+
19136
+ if (select.children.length === 0) select.insertBefore(createDefaultSelectOption(), select.firstChild);
19137
+
19138
+ select.update = function (newSelectedOptions) {
19139
+ selectedOptions = newSelectedOptions;
19140
+ var ds = [];
19141
+ var is = [];
19142
+
19143
+ var removeValue = function removeValue(t) {
19144
+ if (kb.holds(subject, predicate, t, dataDoc)) {
19145
+ ds.push($rdf.st(subject, predicate, t, dataDoc));
19146
+ }
19147
+ };
19148
+
19149
+ var addValue = function addValue(t) {
19150
+ if (!kb.holds(subject, predicate, t, dataDoc)) {
19151
+ is.push($rdf.st(subject, predicate, t, dataDoc)); // console.log("----value added " + t)
19152
+ }
19153
+
19154
+ if (uiFrom && !kb.holds(t, ns.rdf('type'), kb.sym(uiFrom), dataDoc)) {
19155
+ is.push($rdf.st(t, ns.rdf('type'), kb.sym(uiFrom), dataDoc)); // console.log("----added type to value " + uiFrom)
19156
+ }
19157
+ };
19158
+
19159
+ var existingValues = kb.each(subject, predicate, null, dataDoc).map(function (object) {
19160
+ return object.value;
19161
+ });
19162
+
19163
+ var _iterator2 = _createForOfIteratorHelper(existingValues),
19164
+ _step2;
19165
+
19166
+ try {
19167
+ for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
19168
+ var value = _step2.value;
19169
+ if (!containsObject(value, selectedOptions)) removeValue($rdf.sym(value));
19170
+ }
19171
+ } catch (err) {
19172
+ _iterator2.e(err);
19173
+ } finally {
19174
+ _iterator2.f();
19175
+ }
19176
+
19177
+ var _iterator3 = _createForOfIteratorHelper(selectedOptions),
19178
+ _step3;
19179
+
19180
+ try {
19181
+ for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
19182
+ var _value = _step3.value;
19183
+ if (!(_value in existingValues)) addValue($rdf.sym(_value));
19184
+ }
19185
+ } catch (err) {
19186
+ _iterator3.e(err);
19187
+ } finally {
19188
+ _iterator3.f();
19189
+ }
19190
+
19191
+ kb.updater.update(ds, is, function (uri, ok, body) {
19192
+ if (!ok) return select.parentNode.appendChild((0, _error.errorMessageBlock)(dom, 'Error updating data in select: ' + body));
19193
+ select.refresh();
19194
+ if (callbackFunction) callbackFunction(ok, {
19195
+ widget: 'select',
19196
+ event: 'change'
19197
+ });
19198
+ });
19199
+ };
19200
+
19201
+ select.refresh = function () {
19202
+ select.disabled = true; // unlocked any conflict we had got into
19203
+
19204
+ var is = [];
19205
+ var newObject;
19206
+
19207
+ for (var _i3 = 0; _i3 < select.options.length; _i3++) {
19208
+ var opt = select.options[_i3];
19209
+
19210
+ if (opt.selected && opt.AJAR_mint) {
19211
+ // not sure if this 'if' is used because I cannot find mintClass
19212
+ if (options.mintClass) {
19213
+ var thisForm = promptForNew(dom, kb, subject, predicate, options.mintClass, null, dataDoc, function (ok, body) {
19214
+ if (!ok) {
19215
+ callbackFunction(ok, body, {
19216
+ change: 'new'
19217
+ }); // @@ if ok, need some form of refresh of the select for the new thing
19218
+ }
19219
+ });
19220
+ select.parentNode.appendChild(thisForm);
19221
+ newObject = thisForm.AJAR_subject;
19222
+ } else {
19223
+ newObject = newThing(dataDoc);
19224
+ }
19225
+
19226
+ is.push($rdf.st(subject, predicate, kb.sym(newObject), dataDoc));
19227
+ if (uiFrom) is.push($rdf.st(newObject, ns.rdf('type'), kb.sym(uiFrom), dataDoc)); // not sure if this 'if' is used because I cannot find mintStatementsFun
19228
+
19229
+ if (options.mintStatementsFun) {
19230
+ is = is.concat(options.mintStatementsFun(newObject));
19231
+ }
19232
+
19233
+ select.currentURI = newObject;
19234
+ }
19235
+
19236
+ if (!opt.AJAR_uri) continue; // a prompt or mint
19237
+
19238
+ if (opt.selected && containsObject(opt.AJAR_uri, selectedOptions)) {
19239
+ select.currentURI = opt.AJAR_uri;
19240
+ }
19241
+
19242
+ if (!containsObject(opt.AJAR_uri, selectedOptions)) opt.removeAttribute('selected');
19243
+ if (containsObject(opt.AJAR_uri, selectedOptions)) opt.setAttribute('selected', 'true');
19244
+ }
19245
+
19246
+ log.info('selectForOptions: data doc = ' + dataDoc);
19247
+
19248
+ if (select.currentURI && options.subForm) {
19249
+ addSubFormChoice(dom, container, {}, $rdf.sym(select.currentURI), options.subForm, dataDoc, function (ok, body) {
19250
+ if (ok) {
19251
+ kb.updater.update([], is, function (uri, success, errorBody) {
19252
+ if (!success) container.appendChild((0, _error.errorMessageBlock)(dom, 'Error updating select: ' + errorBody));
19253
+ });
19254
+ if (callbackFunction) callbackFunction(ok, {
19255
+ widget: 'select',
19256
+ event: 'new'
19257
+ });
19258
+ } else {
19259
+ container.appendChild((0, _error.errorMessageBlock)(dom, 'Error updating data in field of select: ' + body));
19260
+ }
19261
+ });
19262
+ }
19263
+
19264
+ select.disabled = false;
19265
+ };
19266
+
19267
+ function createOption(uri) {
19268
+ var option = dom.createElement('option');
19269
+ var c = kb.sym(uri);
19270
+ var label;
19271
+
19272
+ if (options.disambiguate) {
19273
+ label = utils.labelWithOntology(c, true); // Init. cap
19274
+ } else {
19275
+ label = utils.label(c, true);
19276
+ }
19277
+
19278
+ option.appendChild(dom.createTextNode(label)); // Init.
19279
+
19280
+ option.setAttribute('value', uri);
19281
+ var backgroundColor = kb.any(c, kb.sym('http://www.w3.org/ns/ui#backgroundColor'));
19282
+
19283
+ if (backgroundColor) {
19284
+ option.setAttribute('style', 'background-color: ' + backgroundColor.value + '; ');
19285
+ }
19286
+
19287
+ option.AJAR_uri = uri;
19288
+
19289
+ if (containsObject(c.value, selectedOptions)) {
19290
+ option.setAttribute('selected', 'true');
19291
+ }
19292
+
19293
+ return option;
19294
+ }
19295
+
19296
+ if (editable) {
19297
+ select.addEventListener('change', onChange, false);
19298
+ }
19299
+
19300
+ return select;
19301
+ } // makeSelectForChoice
19302
+
19303
+
19304
+ function containsObject(obj, list) {
19305
+ var i;
19306
+
19307
+ for (i = 0; i < list.length; i++) {
19308
+ if (list[i] === obj) {
19309
+ return true;
19310
+ }
19311
+ }
19312
+
19313
+ return false;
19314
+ }
19029
19315
  //# sourceMappingURL=forms.js.map
19030
19316
 
19031
19317
  /***/ }),
@@ -22000,6 +22286,800 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
22000
22286
 
22001
22287
  /***/ }),
22002
22288
 
22289
+ /***/ "./lib/widgets/multiSelect.js":
22290
+ /*!************************************!*\
22291
+ !*** ./lib/widgets/multiSelect.js ***!
22292
+ \************************************/
22293
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
22294
+
22295
+ "use strict";
22296
+
22297
+
22298
+ var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ "./node_modules/@babel/runtime/helpers/interopRequireDefault.js");
22299
+
22300
+ var _typeof = __webpack_require__(/*! @babel/runtime/helpers/typeof */ "./node_modules/@babel/runtime/helpers/typeof.js");
22301
+
22302
+ Object.defineProperty(exports, "__esModule", ({
22303
+ value: true
22304
+ }));
22305
+ exports.IconicMultiSelect = void 0;
22306
+
22307
+ var _toConsumableArray2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/toConsumableArray */ "./node_modules/@babel/runtime/helpers/toConsumableArray.js"));
22308
+
22309
+ var _classCallCheck2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "./node_modules/@babel/runtime/helpers/classCallCheck.js"));
22310
+
22311
+ var _createClass2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/createClass */ "./node_modules/@babel/runtime/helpers/createClass.js"));
22312
+
22313
+ var _defineProperty2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/defineProperty */ "./node_modules/@babel/runtime/helpers/defineProperty.js"));
22314
+
22315
+ var style = _interopRequireWildcard(__webpack_require__(/*! ../style_multiSelect */ "./lib/style_multiSelect.js"));
22316
+
22317
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
22318
+
22319
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
22320
+
22321
+ /*
22322
+ * IconicMultiSelect v0.7.0
22323
+ * Licence: MIT
22324
+ * (c) 2021 Sidney Wimart.
22325
+ * repo & configuration: https://github.com/sidneywm/iconic-multiselect
22326
+ */
22327
+
22328
+ /**
22329
+ * @version IconicMultiSelect v0.7.0
22330
+ * @licence MIT
22331
+ */
22332
+ var IconicMultiSelect = /*#__PURE__*/function () {
22333
+ /**
22334
+ * Iconic Multiselect constructor.
22335
+ * @param { Object[] } data - Array of objects.
22336
+ * @param { string } noData - Defines the message when there is no data input.
22337
+ * @param { string } noResults - Defines the message when there is no result if options are filtered.
22338
+ * @param { string } placeholder - Defines the placeholder's text.
22339
+ * @param { string } select - DOM element to be selected. It must be a HTML Select tag - https://developer.mozilla.org/en-US/docs/Web/HTML/Element/select
22340
+ * @param { string } textField - Field to select in the object for the text.
22341
+ * @param { string } valueField - Field to select in the object for the value.
22342
+ */
22343
+ function IconicMultiSelect(_ref) {
22344
+ var data = _ref.data,
22345
+ itemTemplate = _ref.itemTemplate,
22346
+ noData = _ref.noData,
22347
+ noResults = _ref.noResults,
22348
+ placeholder = _ref.placeholder,
22349
+ select = _ref.select,
22350
+ container = _ref.container,
22351
+ tagTemplate = _ref.tagTemplate,
22352
+ textField = _ref.textField,
22353
+ valueField = _ref.valueField;
22354
+ (0, _classCallCheck2["default"])(this, IconicMultiSelect);
22355
+ (0, _defineProperty2["default"])(this, "_data", void 0);
22356
+ (0, _defineProperty2["default"])(this, "_domElements", void 0);
22357
+ (0, _defineProperty2["default"])(this, "_event", function () {});
22358
+ (0, _defineProperty2["default"])(this, "_itemTemplate", void 0);
22359
+ (0, _defineProperty2["default"])(this, "_multiselect", void 0);
22360
+ (0, _defineProperty2["default"])(this, "_noData", void 0);
22361
+ (0, _defineProperty2["default"])(this, "_noResults", void 0);
22362
+ (0, _defineProperty2["default"])(this, "_options", []);
22363
+ (0, _defineProperty2["default"])(this, "_placeholder", void 0);
22364
+ (0, _defineProperty2["default"])(this, "_select", void 0);
22365
+ (0, _defineProperty2["default"])(this, "_selectContainer", void 0);
22366
+ (0, _defineProperty2["default"])(this, "_selectedOptions", []);
22367
+ (0, _defineProperty2["default"])(this, "_tagTemplate", void 0);
22368
+ (0, _defineProperty2["default"])(this, "_textField", void 0);
22369
+ (0, _defineProperty2["default"])(this, "_valueField", void 0);
22370
+ (0, _defineProperty2["default"])(this, "_cross", "\n <svg\n width=\"24\"\n height=\"24\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path\n d=\"M6.2253 4.81108C5.83477 4.42056 5.20161 4.42056 4.81108 4.81108C4.42056 5.20161 4.42056 5.83477 4.81108 6.2253L10.5858 12L4.81114 17.7747C4.42062 18.1652 4.42062 18.7984 4.81114 19.1889C5.20167 19.5794 5.83483 19.5794 6.22535 19.1889L12 13.4142L17.7747 19.1889C18.1652 19.5794 18.7984 19.5794 19.1889 19.1889C19.5794 18.7984 19.5794 18.1652 19.1889 17.7747L13.4142 12L19.189 6.2253C19.5795 5.83477 19.5795 5.20161 19.189 4.81108C18.7985 4.42056 18.1653 4.42056 17.7748 4.81108L12 10.5858L6.2253 4.81108Z\"\n fill=\"currentColor\"\n />\n </svg>\n ");
22371
+ this._data = data !== null && data !== void 0 ? data : [];
22372
+ this._itemTemplate = itemTemplate !== null && itemTemplate !== void 0 ? itemTemplate : null;
22373
+ this._noData = noData !== null && noData !== void 0 ? noData : 'No data found.';
22374
+ this._noResults = noResults !== null && noResults !== void 0 ? noResults : 'No results found.';
22375
+ this._placeholder = placeholder !== null && placeholder !== void 0 ? placeholder : 'Select...';
22376
+ this._select = select; // Timea added a container here
22377
+
22378
+ this._selectContainer = container;
22379
+ this._tagTemplate = tagTemplate !== null && tagTemplate !== void 0 ? tagTemplate : null;
22380
+ this._textField = textField !== null && textField !== void 0 ? textField : null;
22381
+ this._valueField = valueField !== null && valueField !== void 0 ? valueField : null;
22382
+ }
22383
+ /**
22384
+ * Initialize the Iconic Multiselect component.
22385
+ * @public
22386
+ */
22387
+
22388
+
22389
+ (0, _createClass2["default"])(IconicMultiSelect, [{
22390
+ key: "init",
22391
+ value: function init() {
22392
+ // Timea change to use this._select instead of this._selectContainer
22393
+ if (this._select && this._select.nodeName === 'SELECT') {
22394
+ if (this._itemTemplate && this._data.length === 0) {
22395
+ throw new Error('itemTemplate must be initialized with data from the component settings');
22396
+ }
22397
+
22398
+ if (this._tagTemplate && this._data.length === 0) {
22399
+ throw new Error('tagTemplate must be initialized with data from the component settings');
22400
+ }
22401
+
22402
+ this._options = this._data.length > 0 ? this._getDataFromSettings() : this._getDataFromSelectTag();
22403
+
22404
+ this._renderMultiselect();
22405
+
22406
+ this._renderOptionsList();
22407
+
22408
+ this._domElements = {
22409
+ clear: this._multiselect.querySelector('.multiselect__clear-btn'),
22410
+ input: this._multiselect.querySelector('.multiselect__input'),
22411
+ optionsContainer: this._multiselect.querySelector('.multiselect__options'),
22412
+ optionsContainerList: this._multiselect.querySelector('.multiselect__options > ul'),
22413
+ options: {
22414
+ list: this._multiselect.querySelectorAll('.multiselect__options > ul > li'),
22415
+ find: function find(callbackFn) {
22416
+ for (var i = 0; i < this.list.length; i++) {
22417
+ var node = this.list[i];
22418
+ if (callbackFn(node)) return node;
22419
+ }
22420
+
22421
+ return undefined;
22422
+ },
22423
+ some: function some(callbackFn) {
22424
+ for (var i = 0; i < this.list.length; i++) {
22425
+ var node = this.list[i];
22426
+ if (callbackFn(node, i)) return true;
22427
+ }
22428
+
22429
+ return false;
22430
+ }
22431
+ }
22432
+ };
22433
+
22434
+ this._enableEventListenners();
22435
+
22436
+ this._initSelectedList();
22437
+ } else {
22438
+ throw new Error("The selector '".concat(this._select, "' did not select any valid select tag."));
22439
+ }
22440
+ }
22441
+ /**
22442
+ * Subscribes to the emitted events.
22443
+ * @param { Function } callback - Callback function which emits a custom event object.
22444
+ * @public
22445
+ */
22446
+
22447
+ }, {
22448
+ key: "subscribe",
22449
+ value: function subscribe(callback) {
22450
+ if (typeof callback === 'function') {
22451
+ this._event = callback;
22452
+ } else {
22453
+ throw new Error('parameter in the subscribe method is not a function');
22454
+ }
22455
+ }
22456
+ /**
22457
+ * Add an option to the selection list.
22458
+ * @param { Object: { text: string; value: string; }} option
22459
+ * @private
22460
+ */
22461
+
22462
+ }, {
22463
+ key: "_addOptionToList",
22464
+ value: function _addOptionToList(option, index) {
22465
+ var _this = this;
22466
+
22467
+ var html = "<span class=\"multiselect__selected\" style=\"".concat(style.multiselect__selected, "\" data-value=\"").concat(option.value, "\">").concat(this._tagTemplate ? this._processTemplate(this._tagTemplate, index) : option.text, "<span class=\"multiselect__remove-btn\" style=\"").concat(style.multiselect__remove_btn, "\">").concat(this._cross, "</span></span>");
22468
+
22469
+ this._domElements.input.insertAdjacentHTML('beforebegin', html);
22470
+
22471
+ var _this$_multiselect$qu = this._multiselect.querySelector("span[data-value=\"".concat(option.value, "\"]")),
22472
+ removeBtn = _this$_multiselect$qu.lastElementChild;
22473
+
22474
+ removeBtn.addEventListener('click', function () {
22475
+ var target = _this._domElements.options.find(function (el) {
22476
+ return el.dataset.value === option.value;
22477
+ });
22478
+
22479
+ _this._handleOption(target);
22480
+ });
22481
+ }
22482
+ /**
22483
+ * Clears all selected options.
22484
+ * @private
22485
+ */
22486
+
22487
+ }, {
22488
+ key: "_clearSelection",
22489
+ value: function _clearSelection() {
22490
+ var _this2 = this;
22491
+
22492
+ var _loop = function _loop(i) {
22493
+ var option = _this2._selectedOptions[i];
22494
+
22495
+ var target = _this2._domElements.options.find(function (el) {
22496
+ return el.dataset.value === option.value;
22497
+ });
22498
+
22499
+ target.classList.remove('multiselect__options--selected');
22500
+ target.setAttribute('style', style.multiselect__options);
22501
+
22502
+ _this2._removeOptionFromList(target.dataset.value);
22503
+ };
22504
+
22505
+ for (var i = 0; i < this._selectedOptions.length; i++) {
22506
+ _loop(i);
22507
+ }
22508
+
22509
+ this._selectedOptions = [];
22510
+
22511
+ this._handleClearSelectionBtn();
22512
+
22513
+ this._handlePlaceholder();
22514
+
22515
+ this._dispatchEvent({
22516
+ action: 'CLEAR_ALL_OPTIONS',
22517
+ selection: this._selectedOptions
22518
+ });
22519
+ }
22520
+ /**
22521
+ * Close the options container.
22522
+ * @private
22523
+ */
22524
+
22525
+ }, {
22526
+ key: "_closeList",
22527
+ value: function _closeList() {
22528
+ this._domElements.input.value = '';
22529
+
22530
+ this._domElements.optionsContainer.classList.remove('visible');
22531
+
22532
+ this._domElements.optionsContainer.setAttribute('style', style.multiselect__options);
22533
+
22534
+ this._filterOptions('');
22535
+
22536
+ this._removeAllArrowSelected();
22537
+ }
22538
+ /**
22539
+ * Dispatches new events.
22540
+ * @param { object : { action: string; selection: { option: string; text: string; }[]; value?: string; } } event
22541
+ * @private
22542
+ */
22543
+
22544
+ }, {
22545
+ key: "_dispatchEvent",
22546
+ value: function _dispatchEvent(event) {
22547
+ this._event(event);
22548
+ }
22549
+ /**
22550
+ * Enables all main event listenners.
22551
+ * @private
22552
+ */
22553
+
22554
+ }, {
22555
+ key: "_enableEventListenners",
22556
+ value: function _enableEventListenners() {
22557
+ var _this3 = this;
22558
+
22559
+ document.addEventListener('mouseup', function (_ref2) {
22560
+ var target = _ref2.target;
22561
+
22562
+ if (!_this3._multiselect.contains(target)) {
22563
+ _this3._filterOptions('');
22564
+
22565
+ _this3._closeList();
22566
+
22567
+ _this3._handlePlaceholder();
22568
+ }
22569
+ });
22570
+
22571
+ this._domElements.clear.addEventListener('click', function () {
22572
+ _this3._clearSelection();
22573
+ });
22574
+
22575
+ for (var i = 0; i < this._domElements.options.list.length; i++) {
22576
+ var option = this._domElements.options.list[i];
22577
+ option.addEventListener('click', function (_ref3) {
22578
+ var target = _ref3.target;
22579
+
22580
+ _this3._handleOption(target);
22581
+
22582
+ _this3._closeList();
22583
+ });
22584
+ }
22585
+
22586
+ this._domElements.input.addEventListener('focus', function () {
22587
+ _this3._domElements.optionsContainer.classList.add('visible');
22588
+
22589
+ _this3._domElements.optionsContainer.setAttribute('style', style.multiselect__options_visible);
22590
+ });
22591
+
22592
+ this._domElements.input.addEventListener('input', function (_ref4) {
22593
+ var value = _ref4.target.value;
22594
+
22595
+ if (_this3._domElements.options.list.length > 0) {
22596
+ _this3._filterOptions(value);
22597
+ }
22598
+ });
22599
+
22600
+ this._domElements.input.addEventListener('keydown', function (e) {
22601
+ _this3._handleArrows(e);
22602
+
22603
+ _this3._handleBackspace(e);
22604
+
22605
+ _this3._handleEnter(e);
22606
+ });
22607
+ }
22608
+ /**
22609
+ * Filters user input.
22610
+ * @param { string } value
22611
+ * @private
22612
+ */
22613
+
22614
+ }, {
22615
+ key: "_filterOptions",
22616
+ value: function _filterOptions(value) {
22617
+ var _this4 = this;
22618
+
22619
+ var isOpen = this._domElements.optionsContainer.classList.contains('visible');
22620
+
22621
+ var valueLowerCase = value.toLowerCase();
22622
+
22623
+ if (!isOpen && value.length > 0) {
22624
+ this._domElements.optionsContainer.classList.add('visible');
22625
+
22626
+ this._domElements.optionsContainer.setAttribute('style', style.multiselect__options_visible);
22627
+ }
22628
+
22629
+ if (this._domElements.options.list.length > 0) {
22630
+ for (var i = 0; i < this._domElements.options.list.length; i++) {
22631
+ var el = this._domElements.options.list[i];
22632
+ var text = this._itemTemplate ? this._data[i][this._textField] : el.textContent;
22633
+
22634
+ if (text.toLowerCase().substring(0, valueLowerCase.length) === valueLowerCase) {
22635
+ this._domElements.optionsContainerList.appendChild(el);
22636
+ } else {
22637
+ el.parentNode && el.parentNode.removeChild(el);
22638
+ }
22639
+ }
22640
+
22641
+ var hasResults = this._domElements.options.some(function (el, index) {
22642
+ return (_this4._itemTemplate ? _this4._data[index][_this4._textField] : el.textContent).toLowerCase().substring(0, valueLowerCase.length) === valueLowerCase;
22643
+ });
22644
+
22645
+ this._showNoResults(!hasResults);
22646
+ }
22647
+ }
22648
+ }, {
22649
+ key: "_generateId",
22650
+ value: function _generateId(length) {
22651
+ var result = '';
22652
+ var characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
22653
+ var charactersLength = characters.length;
22654
+
22655
+ for (var i = 0; i < length; i++) {
22656
+ result += characters.charAt(Math.floor(Math.random() * charactersLength));
22657
+ }
22658
+
22659
+ return result;
22660
+ }
22661
+ /**
22662
+ * Gets data from select tag.
22663
+ * @private
22664
+ */
22665
+
22666
+ }, {
22667
+ key: "_getDataFromSelectTag",
22668
+ value: function _getDataFromSelectTag() {
22669
+ var arr = [];
22670
+ var options = this._select.options;
22671
+
22672
+ for (var i = 0; i < options.length; i++) {
22673
+ var item = options[i];
22674
+ arr.push({
22675
+ text: item.text,
22676
+ value: item.value,
22677
+ selected: item.hasAttribute('selected')
22678
+ });
22679
+ }
22680
+
22681
+ return arr;
22682
+ }
22683
+ /**
22684
+ * Gets data from settings.
22685
+ * @private
22686
+ */
22687
+
22688
+ }, {
22689
+ key: "_getDataFromSettings",
22690
+ value: function _getDataFromSettings() {
22691
+ if (this._data.length > 0 && this._valueField && this._textField) {
22692
+ var isValueFieldValid = typeof this._valueField === 'string';
22693
+ var isTextFieldValid = typeof this._textField === 'string';
22694
+ var arr = [];
22695
+
22696
+ if (!isValueFieldValid || !isTextFieldValid) {
22697
+ throw new Error('textField and valueField must be of type string');
22698
+ }
22699
+
22700
+ for (var i = 0; i < this._data.length; i++) {
22701
+ var item = this._data[i];
22702
+ arr.push({
22703
+ value: item[this._valueField],
22704
+ text: item[this._textField],
22705
+ selected: typeof item.selected === 'boolean' ? item.selected : false
22706
+ });
22707
+ }
22708
+
22709
+ return arr;
22710
+ } else {
22711
+ return null;
22712
+ }
22713
+ }
22714
+ /**
22715
+ * Handles Arrow up & Down. Selection of an option is also possible with these keys.
22716
+ * @param { Event } event
22717
+ * @private
22718
+ */
22719
+
22720
+ }, {
22721
+ key: "_handleArrows",
22722
+ value: function _handleArrows(event) {
22723
+ if (event.keyCode === 40 || event.keyCode === 38) {
22724
+ event.preventDefault();
22725
+
22726
+ var isOpen = this._domElements.optionsContainer.classList.contains('visible'); // An updated view of the container is needed because of the filtering option
22727
+
22728
+
22729
+ var optionsContainerList = this._multiselect.querySelector('.multiselect__options > ul');
22730
+
22731
+ if (!isOpen) {
22732
+ this._domElements.optionsContainer.classList.add('visible');
22733
+
22734
+ this._domElements.optionsContainer.setAttribute('style', style.multiselect__options_visible);
22735
+
22736
+ optionsContainerList.firstElementChild.classList.add('arrow-selected');
22737
+ optionsContainerList.firstElementChild.setAttribute('style', style.multiselect__options_ul_li_arrow_selected);
22738
+ optionsContainerList.firstElementChild.scrollIntoView(false);
22739
+ } else {
22740
+ var selected = this._multiselect.querySelector('.multiselect__options ul li.arrow-selected');
22741
+
22742
+ var action = {
22743
+ ArrowUp: 'previous',
22744
+ Up: 'previous',
22745
+ ArrowDown: 'next',
22746
+ Down: 'next'
22747
+ };
22748
+
22749
+ if (!selected) {
22750
+ optionsContainerList.firstElementChild.classList.add('arrow-selected');
22751
+ optionsContainerList.firstElementChild.setAttribute('style', style.multiselect__options_ul_li_arrow_selected);
22752
+ optionsContainerList.firstElementChild.scrollIntoView(false);
22753
+ return;
22754
+ }
22755
+
22756
+ selected.classList.remove('arrow-selected');
22757
+ selected.setAttribute('style', style.multiselect__options_ul_li);
22758
+ selected = selected[action[event.key] + 'ElementSibling']; // Go to start or end of the popup list
22759
+
22760
+ if (!selected) {
22761
+ selected = optionsContainerList.children[action[event.key] === 'next' ? 0 : optionsContainerList.children.length - 1];
22762
+ selected.classList.add('arrow-selected');
22763
+ selected.setAttribute('style', style.multiselect__options_ul_li_arrow_selected);
22764
+
22765
+ this._scrollIntoView(optionsContainerList, selected);
22766
+
22767
+ return;
22768
+ }
22769
+
22770
+ selected.classList.add('arrow-selected');
22771
+ selected.setAttribute('style', style.multiselect__options_ul_li_arrow_selected);
22772
+
22773
+ this._scrollIntoView(optionsContainerList, selected);
22774
+ }
22775
+ }
22776
+ }
22777
+ /**
22778
+ * Handles the backspace key event - Deletes the preceding option in the selection list.
22779
+ * @param { Event } e
22780
+ * @private
22781
+ */
22782
+
22783
+ }, {
22784
+ key: "_handleBackspace",
22785
+ value: function _handleBackspace(e) {
22786
+ if (e.keyCode === 8 && e.target.value === '') {
22787
+ var lastSelectedOption = this._selectedOptions.length > 0 ? this._selectedOptions[this._selectedOptions.length - 1] : null;
22788
+
22789
+ if (lastSelectedOption) {
22790
+ var targetLastSelectedOption = this._multiselect.querySelector("li[data-value=\"".concat(lastSelectedOption.value, "\"]"));
22791
+
22792
+ this._handleOption(targetLastSelectedOption);
22793
+
22794
+ if (this._selectedOptions.length === 0) {
22795
+ this._domElements.optionsContainer.classList.remove('visible');
22796
+
22797
+ this._domElements.optionsContainer.setAttribute('style', style.multiselect__options);
22798
+ }
22799
+ }
22800
+ }
22801
+ }
22802
+ /**
22803
+ * Shows clear selection button if some options are selected.
22804
+ * @private
22805
+ */
22806
+
22807
+ }, {
22808
+ key: "_handleClearSelectionBtn",
22809
+ value: function _handleClearSelectionBtn() {
22810
+ if (this._selectedOptions.length > 0) {
22811
+ this._domElements.clear.style.display = 'flex';
22812
+ } else {
22813
+ this._domElements.clear.style.display = 'none';
22814
+ }
22815
+ }
22816
+ /**
22817
+ * Handles the enter key event.
22818
+ * @param { Event } event
22819
+ * @private
22820
+ */
22821
+
22822
+ }, {
22823
+ key: "_handleEnter",
22824
+ value: function _handleEnter(event) {
22825
+ if (event.keyCode === 13) {
22826
+ var selected = this._multiselect.querySelector('.multiselect__options ul li.arrow-selected');
22827
+
22828
+ if (selected) {
22829
+ this._handleOption(selected);
22830
+
22831
+ this._closeList();
22832
+ }
22833
+ }
22834
+ }
22835
+ }, {
22836
+ key: "_handleOption",
22837
+ value: function _handleOption(target) {
22838
+ var dispatchEvent = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
22839
+
22840
+ // Remove
22841
+ for (var i = 0; i < this._selectedOptions.length; i++) {
22842
+ var el = this._selectedOptions[i];
22843
+
22844
+ if (el.value === target.dataset.value) {
22845
+ target.classList.remove('multiselect__options--selected');
22846
+ target.setAttribute('style', style.multiselect__options);
22847
+
22848
+ this._selectedOptions.splice(i, 1);
22849
+
22850
+ this._removeOptionFromList(target.dataset.value);
22851
+
22852
+ this._handleClearSelectionBtn();
22853
+
22854
+ this._handlePlaceholder();
22855
+
22856
+ return dispatchEvent && this._dispatchEvent({
22857
+ action: 'REMOVE_OPTION',
22858
+ value: target.dataset.value,
22859
+ selection: this._selectedOptions
22860
+ });
22861
+ }
22862
+ } // Add
22863
+
22864
+
22865
+ for (var _i = 0; _i < this._options.length; _i++) {
22866
+ var option = this._options[_i];
22867
+
22868
+ if (option.value === target.dataset.value) {
22869
+ target.classList.add('multiselect__options--selected');
22870
+ target.setAttribute('style', style.multiselect__options_selected);
22871
+ this._selectedOptions = [].concat((0, _toConsumableArray2["default"])(this._selectedOptions), [option]);
22872
+
22873
+ this._addOptionToList(option, _i);
22874
+
22875
+ this._handleClearSelectionBtn();
22876
+
22877
+ this._handlePlaceholder();
22878
+
22879
+ return dispatchEvent && this._dispatchEvent({
22880
+ action: 'ADD_OPTION',
22881
+ value: target.dataset.value,
22882
+ selection: this._selectedOptions
22883
+ });
22884
+ }
22885
+ }
22886
+ }
22887
+ /**
22888
+ * Shows the placeholder if no options are selected.
22889
+ * @private
22890
+ */
22891
+
22892
+ }, {
22893
+ key: "_handlePlaceholder",
22894
+ value: function _handlePlaceholder() {
22895
+ this._domElements.input.placeholder = this._placeholder;
22896
+ }
22897
+ }, {
22898
+ key: "_initSelectedList",
22899
+ value: function _initSelectedList() {
22900
+ var _this5 = this;
22901
+
22902
+ var hasItemsSelected = false;
22903
+
22904
+ var _loop2 = function _loop2(i) {
22905
+ var option = _this5._options[i];
22906
+
22907
+ if (option.selected) {
22908
+ hasItemsSelected = true;
22909
+
22910
+ var target = _this5._domElements.options.find(function (el) {
22911
+ return el.dataset.value === option.value;
22912
+ });
22913
+
22914
+ target.classList.add('multiselect__options--selected');
22915
+ target.setAttribute('style', style.multiselect__options_selected);
22916
+ _this5._selectedOptions = [].concat((0, _toConsumableArray2["default"])(_this5._selectedOptions), [option]);
22917
+
22918
+ _this5._addOptionToList(option, i);
22919
+ }
22920
+ };
22921
+
22922
+ for (var i = 0; i < this._options.length; i++) {
22923
+ _loop2(i);
22924
+ }
22925
+
22926
+ if (hasItemsSelected) {
22927
+ this._handleClearSelectionBtn();
22928
+ }
22929
+
22930
+ this._handlePlaceholder();
22931
+ }
22932
+ /**
22933
+ * Process the custom template.
22934
+ * @param { string } template
22935
+ * @private
22936
+ */
22937
+
22938
+ }, {
22939
+ key: "_processTemplate",
22940
+ value: function _processTemplate(template, index) {
22941
+ var processedTemplate = template;
22942
+ var objAttr = template.match(/\$\{(\w+)\}/g).map(function (e) {
22943
+ return e.replace(/\$\{|\}/g, '');
22944
+ });
22945
+
22946
+ for (var i = 0; i < objAttr.length; i++) {
22947
+ var _this$_data$index$att;
22948
+
22949
+ var attr = objAttr[i]; // eslint-disable-next-line no-useless-escape
22950
+
22951
+ processedTemplate = processedTemplate.replace("${".concat(attr, "}"), (_this$_data$index$att = this._data[index][attr]) !== null && _this$_data$index$att !== void 0 ? _this$_data$index$att : '');
22952
+ }
22953
+
22954
+ return processedTemplate;
22955
+ }
22956
+ }, {
22957
+ key: "_removeAllArrowSelected",
22958
+ value: function _removeAllArrowSelected() {
22959
+ var className = 'arrow-selected';
22960
+
22961
+ var target = this._domElements.options.find(function (el) {
22962
+ return el.classList.contains(className);
22963
+ });
22964
+
22965
+ target && target.classList.remove(className) && target.setAttribute('style', style.multiselect__options_ul_li);
22966
+ }
22967
+ /**
22968
+ * Removes an option from the list.
22969
+ * @param { string } value
22970
+ * @private
22971
+ */
22972
+
22973
+ }, {
22974
+ key: "_removeOptionFromList",
22975
+ value: function _removeOptionFromList(value) {
22976
+ var optionDom = this._multiselect.querySelector("span[data-value=\"".concat(value, "\"]"));
22977
+
22978
+ optionDom && optionDom.parentNode && optionDom.parentNode.removeChild(optionDom);
22979
+ }
22980
+ /**
22981
+ * Renders the multiselect options list view.
22982
+ * @private
22983
+ */
22984
+
22985
+ }, {
22986
+ key: "_renderOptionsList",
22987
+ value: function _renderOptionsList() {
22988
+ var _this6 = this;
22989
+
22990
+ var html = "\n <div class=\"multiselect__options\" style=\"".concat(style.multiselect__options, "\">\n <ul style=\"").concat(style.multiselect__options_ul, "\">\n ").concat(this._options.length > 0 && !this._itemTemplate ? this._options.map(function (option) {
22991
+ return "\n <li data-value=\"".concat(option.value, "\" style=\"").concat(style.multiselect__options_ul_li, "\">").concat(option.text, "</li>\n ");
22992
+ }).join('') : '', "\n\n ").concat(this._options.length > 0 && this._itemTemplate ? this._options.map(function (option, index) {
22993
+ return "\n <li data-value=\"".concat(option.value, "\" style=\"").concat(style.multiselect__options_ul_li, "\">").concat(_this6._processTemplate(_this6._itemTemplate, index), "</li>\n ");
22994
+ }).join('') : '', "\n ").concat(this._showNoData(this._options.length === 0), "\n </ul>\n </div>\n ");
22995
+
22996
+ this._multiselect.insertAdjacentHTML('beforeend', html);
22997
+ }
22998
+ /**
22999
+ * Renders the multiselect view.
23000
+ * @private
23001
+ */
23002
+
23003
+ }, {
23004
+ key: "_renderMultiselect",
23005
+ value: function _renderMultiselect() {
23006
+ this._select.style.display = 'none';
23007
+
23008
+ var id = 'iconic-' + this._generateId(20); // Timea created dedicated div element because previous code was not rendering
23009
+
23010
+
23011
+ this._multiselect = document.createElement('div');
23012
+
23013
+ this._multiselect.setAttribute('id', id);
23014
+
23015
+ this._multiselect.setAttribute('class', 'multiselect__container');
23016
+
23017
+ this._multiselect.setAttribute('style', style.multiselect__container);
23018
+
23019
+ var html = "\n <div class=\"multiselect__wrapper\" style=\"".concat(style.multiselect__wrapper, "\">\n <input class=\"multiselect__input\" style=\"").concat(style.multiselect__input, "\" placeholder=\"").concat(this._placeholder, "\" />\n </div>\n <span style=\"display: none;\" class=\"multiselect__clear-btn\" style=\"").concat(style.multiselect__clear_btn, "\">").concat(this._cross, "</span>\n ");
23020
+ this._multiselect.innerHTML = html;
23021
+
23022
+ this._selectContainer.appendChild(this._multiselect);
23023
+ }
23024
+ /**
23025
+ * ScrollIntoView - This small utility reproduces the behavior of .scrollIntoView({ block: "nearest", inline: "nearest" })
23026
+ * This is for IE compatibility without a need of a polyfill
23027
+ * @private
23028
+ */
23029
+
23030
+ }, {
23031
+ key: "_scrollIntoView",
23032
+ value: function _scrollIntoView(parent, child) {
23033
+ var rectParent = parent.getBoundingClientRect();
23034
+ var rectChild = child.getBoundingClientRect(); // Detect if not visible at top and then scroll to the top
23035
+
23036
+ if (!(rectParent.top < rectChild.bottom - child.offsetHeight)) {
23037
+ parent.scrollTop = child.clientHeight + (child.offsetTop - child.offsetHeight);
23038
+ } // Detect if not visible at bottom and then scroll to the bottom
23039
+
23040
+
23041
+ if (!(rectParent.bottom > rectChild.top + child.offsetHeight)) {
23042
+ parent.scrollTop = child.clientHeight + (child.offsetTop - child.offsetHeight) - (parent.offsetHeight - (child.offsetHeight + (child.offsetHeight - child.clientHeight)));
23043
+ }
23044
+ }
23045
+ /**
23046
+ * Shows a no data message.
23047
+ * @param { boolean } condition
23048
+ * @private
23049
+ */
23050
+
23051
+ }, {
23052
+ key: "_showNoData",
23053
+ value: function _showNoData(condition) {
23054
+ return condition ? "<p class=\"multiselect__options--no-data\" style=\"".concat(style.multiselect__options_ul_p_multiselect__options_no_data, "\">").concat(this._noData, "</p>") : '';
23055
+ }
23056
+ /**
23057
+ * Shows a no results message.
23058
+ * @param { boolean } condition
23059
+ * @private
23060
+ */
23061
+
23062
+ }, {
23063
+ key: "_showNoResults",
23064
+ value: function _showNoResults(condition) {
23065
+ var dom = this._multiselect.querySelector('.multiselect__options--no-results');
23066
+
23067
+ if (condition) {
23068
+ var html = "<p class=\"multiselect__options--no-results\" style=\"".concat(style.multiselect__options_ul_p_multiselect__options_no_results, "\">").concat(this._noResults, "</p>");
23069
+ !dom && this._domElements.optionsContainerList.insertAdjacentHTML('beforeend', html);
23070
+ } else {
23071
+ dom && dom.parentNode && dom.parentNode.removeChild(dom);
23072
+ }
23073
+ }
23074
+ }]);
23075
+ return IconicMultiSelect;
23076
+ }();
23077
+
23078
+ exports.IconicMultiSelect = IconicMultiSelect;
23079
+ //# sourceMappingURL=multiSelect.js.map
23080
+
23081
+ /***/ }),
23082
+
22003
23083
  /***/ "./lib/widgets/peoplePicker.js":
22004
23084
  /*!*************************************!*\
22005
23085
  !*** ./lib/widgets/peoplePicker.js ***!
@@ -22671,6 +23751,22 @@ module.exports = _arrayWithHoles, module.exports.__esModule = true, module.expor
22671
23751
 
22672
23752
  /***/ }),
22673
23753
 
23754
+ /***/ "./node_modules/@babel/runtime/helpers/arrayWithoutHoles.js":
23755
+ /*!******************************************************************!*\
23756
+ !*** ./node_modules/@babel/runtime/helpers/arrayWithoutHoles.js ***!
23757
+ \******************************************************************/
23758
+ /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
23759
+
23760
+ var arrayLikeToArray = __webpack_require__(/*! ./arrayLikeToArray.js */ "./node_modules/@babel/runtime/helpers/arrayLikeToArray.js");
23761
+
23762
+ function _arrayWithoutHoles(arr) {
23763
+ if (Array.isArray(arr)) return arrayLikeToArray(arr);
23764
+ }
23765
+
23766
+ module.exports = _arrayWithoutHoles, module.exports.__esModule = true, module.exports["default"] = module.exports;
23767
+
23768
+ /***/ }),
23769
+
22674
23770
  /***/ "./node_modules/@babel/runtime/helpers/assertThisInitialized.js":
22675
23771
  /*!**********************************************************************!*\
22676
23772
  !*** ./node_modules/@babel/runtime/helpers/assertThisInitialized.js ***!
@@ -22936,6 +24032,20 @@ module.exports = _isNativeReflectConstruct, module.exports.__esModule = true, mo
22936
24032
 
22937
24033
  /***/ }),
22938
24034
 
24035
+ /***/ "./node_modules/@babel/runtime/helpers/iterableToArray.js":
24036
+ /*!****************************************************************!*\
24037
+ !*** ./node_modules/@babel/runtime/helpers/iterableToArray.js ***!
24038
+ \****************************************************************/
24039
+ /***/ ((module) => {
24040
+
24041
+ function _iterableToArray(iter) {
24042
+ if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
24043
+ }
24044
+
24045
+ module.exports = _iterableToArray, module.exports.__esModule = true, module.exports["default"] = module.exports;
24046
+
24047
+ /***/ }),
24048
+
22939
24049
  /***/ "./node_modules/@babel/runtime/helpers/iterableToArrayLimit.js":
22940
24050
  /*!*********************************************************************!*\
22941
24051
  !*** ./node_modules/@babel/runtime/helpers/iterableToArrayLimit.js ***!
@@ -22990,6 +24100,20 @@ module.exports = _nonIterableRest, module.exports.__esModule = true, module.expo
22990
24100
 
22991
24101
  /***/ }),
22992
24102
 
24103
+ /***/ "./node_modules/@babel/runtime/helpers/nonIterableSpread.js":
24104
+ /*!******************************************************************!*\
24105
+ !*** ./node_modules/@babel/runtime/helpers/nonIterableSpread.js ***!
24106
+ \******************************************************************/
24107
+ /***/ ((module) => {
24108
+
24109
+ function _nonIterableSpread() {
24110
+ throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
24111
+ }
24112
+
24113
+ module.exports = _nonIterableSpread, module.exports.__esModule = true, module.exports["default"] = module.exports;
24114
+
24115
+ /***/ }),
24116
+
22993
24117
  /***/ "./node_modules/@babel/runtime/helpers/possibleConstructorReturn.js":
22994
24118
  /*!**************************************************************************!*\
22995
24119
  !*** ./node_modules/@babel/runtime/helpers/possibleConstructorReturn.js ***!
@@ -23076,6 +24200,28 @@ module.exports = _taggedTemplateLiteral, module.exports.__esModule = true, modul
23076
24200
 
23077
24201
  /***/ }),
23078
24202
 
24203
+ /***/ "./node_modules/@babel/runtime/helpers/toConsumableArray.js":
24204
+ /*!******************************************************************!*\
24205
+ !*** ./node_modules/@babel/runtime/helpers/toConsumableArray.js ***!
24206
+ \******************************************************************/
24207
+ /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
24208
+
24209
+ var arrayWithoutHoles = __webpack_require__(/*! ./arrayWithoutHoles.js */ "./node_modules/@babel/runtime/helpers/arrayWithoutHoles.js");
24210
+
24211
+ var iterableToArray = __webpack_require__(/*! ./iterableToArray.js */ "./node_modules/@babel/runtime/helpers/iterableToArray.js");
24212
+
24213
+ var unsupportedIterableToArray = __webpack_require__(/*! ./unsupportedIterableToArray.js */ "./node_modules/@babel/runtime/helpers/unsupportedIterableToArray.js");
24214
+
24215
+ var nonIterableSpread = __webpack_require__(/*! ./nonIterableSpread.js */ "./node_modules/@babel/runtime/helpers/nonIterableSpread.js");
24216
+
24217
+ function _toConsumableArray(arr) {
24218
+ return arrayWithoutHoles(arr) || iterableToArray(arr) || unsupportedIterableToArray(arr) || nonIterableSpread();
24219
+ }
24220
+
24221
+ module.exports = _toConsumableArray, module.exports.__esModule = true, module.exports["default"] = module.exports;
24222
+
24223
+ /***/ }),
24224
+
23079
24225
  /***/ "./node_modules/@babel/runtime/helpers/typeof.js":
23080
24226
  /*!*******************************************************!*\
23081
24227
  !*** ./node_modules/@babel/runtime/helpers/typeof.js ***!
@@ -25773,31 +26919,6 @@ function freeze(object, oc) {
25773
26919
  return oc && typeof oc.freeze === 'function' ? oc.freeze(object) : object
25774
26920
  }
25775
26921
 
25776
- /**
25777
- * Since we can not rely on `Object.assign` we provide a simplified version
25778
- * that is sufficient for our needs.
25779
- *
25780
- * @param {Object} target
25781
- * @param {Object | null | undefined} source
25782
- *
25783
- * @returns {Object} target
25784
- * @throws TypeError if target is not an object
25785
- *
25786
- * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assign
25787
- * @see https://tc39.es/ecma262/multipage/fundamental-objects.html#sec-object.assign
25788
- */
25789
- function assign(target, source) {
25790
- if (target === null || typeof target !== 'object') {
25791
- throw new TypeError('target is not an object')
25792
- }
25793
- for (var key in source) {
25794
- if (Object.prototype.hasOwnProperty.call(source, key)) {
25795
- target[key] = source[key]
25796
- }
25797
- }
25798
- return target
25799
- }
25800
-
25801
26922
  /**
25802
26923
  * All mime types that are allowed as input to `DOMParser.parseFromString`
25803
26924
  *
@@ -25915,7 +27036,6 @@ var NAMESPACE = freeze({
25915
27036
  XMLNS: 'http://www.w3.org/2000/xmlns/',
25916
27037
  })
25917
27038
 
25918
- exports.assign = assign;
25919
27039
  exports.freeze = freeze;
25920
27040
  exports.MIME_TYPE = MIME_TYPE;
25921
27041
  exports.NAMESPACE = NAMESPACE;
@@ -27450,10 +28570,9 @@ function needNamespaceDefine(node, isHTML, visibleNamespaces) {
27450
28570
  * are serialized as their entity references, so they will be preserved.
27451
28571
  * (In contrast to whitespace literals in the input which are normalized to spaces)
27452
28572
  * @see https://www.w3.org/TR/xml11/#AVNormalize
27453
- * @see https://w3c.github.io/DOM-Parsing/#serializing-an-element-s-attributes
27454
28573
  */
27455
28574
  function addSerializedAttribute(buf, qualifiedName, value) {
27456
- buf.push(' ', qualifiedName, '="', value.replace(/[<>&"\t\n\r]/g, _xmlEncoder), '"')
28575
+ buf.push(' ', qualifiedName, '="', value.replace(/[<&"\t\n\r]/g, _xmlEncoder), '"')
27457
28576
  }
27458
28577
 
27459
28578
  function serializeToString(node,buf,isHTML,nodeFilter,visibleNamespaces){
@@ -27598,10 +28717,10 @@ function serializeToString(node,buf,isHTML,nodeFilter,visibleNamespaces){
27598
28717
  * and does not include the CDATA-section-close delimiter, `]]>`.
27599
28718
  *
27600
28719
  * @see https://www.w3.org/TR/xml/#NT-CharData
27601
- * @see https://w3c.github.io/DOM-Parsing/#xml-serializing-a-text-node
27602
28720
  */
27603
28721
  return buf.push(node.data
27604
- .replace(/[<&>]/g,_xmlEncoder)
28722
+ .replace(/[<&]/g,_xmlEncoder)
28723
+ .replace(/]]>/g, ']]&gt;')
27605
28724
  );
27606
28725
  case CDATA_SECTION_NODE:
27607
28726
  return buf.push( '<![CDATA[',node.data,']]>');
@@ -44630,8 +45749,8 @@ class N3Parser {
44630
45749
  _saveContext(type, graph, subject, predicate, object) {
44631
45750
  const n3Mode = this._n3Mode;
44632
45751
  this._contextStack.push({
44633
- subject: subject, predicate: predicate, object: object,
44634
- graph: graph, type: type,
45752
+ type,
45753
+ subject, predicate, object, graph,
44635
45754
  inverse: n3Mode ? this._inversePredicate : false,
44636
45755
  blankPrefix: n3Mode ? this._prefixes._ : '',
44637
45756
  quantified: n3Mode ? this._quantified : null,
@@ -44650,14 +45769,20 @@ class N3Parser {
44650
45769
 
44651
45770
  // ### `_restoreContext` restores the parent context
44652
45771
  // when leaving a scope (list, blank node, formula)
44653
- _restoreContext() {
44654
- const context = this._contextStack.pop(), n3Mode = this._n3Mode;
45772
+ _restoreContext(type, token) {
45773
+ // Obtain the previous context
45774
+ const context = this._contextStack.pop();
45775
+ if (!context || context.type !== type)
45776
+ return this._error(`Unexpected ${token.type}`, token);
45777
+
45778
+ // Restore the quad of the previous context
44655
45779
  this._subject = context.subject;
44656
45780
  this._predicate = context.predicate;
44657
45781
  this._object = context.object;
44658
45782
  this._graph = context.graph;
44659
- // The settings below only apply to N3 streams
44660
- if (n3Mode) {
45783
+
45784
+ // Restore N3 context settings
45785
+ if (this._n3Mode) {
44661
45786
  this._inversePredicate = context.inverse;
44662
45787
  this._prefixes._ = context.blankPrefix;
44663
45788
  this._quantified = context.quantified;
@@ -44930,7 +46055,7 @@ class N3Parser {
44930
46055
 
44931
46056
  // Restore the parent context containing this blank node
44932
46057
  const empty = this._predicate === null;
44933
- this._restoreContext();
46058
+ this._restoreContext('blank', token);
44934
46059
  // If the blank node was the object, restore previous context and read punctuation
44935
46060
  if (this._object !== null)
44936
46061
  return this._getContextEndReader();
@@ -44981,7 +46106,7 @@ class N3Parser {
44981
46106
  break;
44982
46107
  case ')':
44983
46108
  // Closing the list; restore the parent context
44984
- this._restoreContext();
46109
+ this._restoreContext('list', token);
44985
46110
  // If this list is contained within a parent list, return the membership quad here.
44986
46111
  // This will be `<parent list element> rdf:first <this list>.`.
44987
46112
  if (stack.length !== 0 && stack[stack.length - 1].type === 'list')
@@ -45132,7 +46257,7 @@ class N3Parser {
45132
46257
  this._emit(this._subject, this._predicate, this._object, this._graph);
45133
46258
 
45134
46259
  // Restore the parent context containing this formula
45135
- this._restoreContext();
46260
+ this._restoreContext('formula', token);
45136
46261
  // If the formula was the subject, continue reading the predicate.
45137
46262
  // If the formula was the object, read punctuation.
45138
46263
  return this._object === null ? this._readPredicate : this._getContextEndReader();
@@ -45341,7 +46466,7 @@ class N3Parser {
45341
46466
  // The list item is the remaining subejct after reading the path
45342
46467
  const item = this._subject;
45343
46468
  // Switch back to the context of the list
45344
- this._restoreContext();
46469
+ this._restoreContext('item', token);
45345
46470
  // Output the list item
45346
46471
  this._emit(this._subject, this.RDF_FIRST, item, this._graph);
45347
46472
  }
@@ -45403,7 +46528,7 @@ class N3Parser {
45403
46528
  // Read the quad and restore the previous context
45404
46529
  const quad = this._quad(this._subject, this._predicate, this._object,
45405
46530
  this._graph || this.DEFAULTGRAPH);
45406
- this._restoreContext();
46531
+ this._restoreContext('<<', token);
45407
46532
  // If the triple was the subject, continue by reading the predicate.
45408
46533
  if (this._subject === null) {
45409
46534
  this._subject = quad;
@@ -65667,7 +66792,7 @@ var SolidAuthnLogic = /** @class */ (function () {
65667
66792
  if (app.viewingNoAuthPage) {
65668
66793
  return (0, rdflib_1.sym)(app.webId);
65669
66794
  }
65670
- if (this.session.info.webId && this.session.info.isLoggedIn) {
66795
+ if (this && this.session && this.session.info && this.session.info.webId && this.session.info.isLoggedIn) {
65671
66796
  return (0, rdflib_1.sym)(this.session.info.webId);
65672
66797
  }
65673
66798
  return (0, authUtil_1.offlineTestID)(); // null unless testing
@@ -66194,6 +67319,29 @@ exports.determineChatContainer = determineChatContainer;
66194
67319
 
66195
67320
  "use strict";
66196
67321
 
67322
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
67323
+ if (k2 === undefined) k2 = k;
67324
+ var desc = Object.getOwnPropertyDescriptor(m, k);
67325
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
67326
+ desc = { enumerable: true, get: function() { return m[k]; } };
67327
+ }
67328
+ Object.defineProperty(o, k2, desc);
67329
+ }) : (function(o, m, k, k2) {
67330
+ if (k2 === undefined) k2 = k;
67331
+ o[k2] = m[k];
67332
+ }));
67333
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
67334
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
67335
+ }) : function(o, v) {
67336
+ o["default"] = v;
67337
+ });
67338
+ var __importStar = (this && this.__importStar) || function (mod) {
67339
+ if (mod && mod.__esModule) return mod;
67340
+ var result = {};
67341
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
67342
+ __setModuleDefault(result, mod);
67343
+ return result;
67344
+ };
66197
67345
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
66198
67346
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
66199
67347
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -66230,16 +67378,128 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
66230
67378
  if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
66231
67379
  }
66232
67380
  };
67381
+ var __importDefault = (this && this.__importDefault) || function (mod) {
67382
+ return (mod && mod.__esModule) ? mod : { "default": mod };
67383
+ };
66233
67384
  Object.defineProperty(exports, "__esModule", ({ value: true }));
66234
- exports.loadAllTypeIndexes = exports.loadCommunityTypeIndexes = exports.loadTypeIndexesFor = exports.loadPreferences = exports.loadProfile = void 0;
67385
+ exports.deleteTypeIndexRegistration = exports.registerInstanceInTypeIndex = exports.getAppInstances = exports.getScopedAppInstances = exports.getScopedAppsFromIndex = exports.uniqueNodes = exports.loadAllTypeIndexes = exports.loadCommunityTypeIndexes = exports.loadTypeIndexesFor = exports.loadPreferences = exports.loadProfile = exports.followOrCreateLink = exports.suggestPrivateTypeIndex = exports.suggestPublicTypeIndex = exports.suggestPreferencesFile = exports.loadOrCreateIfNotExists = void 0;
66235
67386
  var rdflib_1 = __webpack_require__(/*! rdflib */ "./node_modules/rdflib/esm/index.js");
66236
- var ns = {
66237
- solid: (0, rdflib_1.Namespace)('http://www.w3.org/ns/solid/terms#'),
66238
- space: (0, rdflib_1.Namespace)('http://www.w3.org/ns/pim/space#')
66239
- };
67387
+ var $rdf = __importStar(__webpack_require__(/*! rdflib */ "./node_modules/rdflib/esm/index.js"));
67388
+ var solidLogicSingleton_1 = __webpack_require__(/*! ../logic/solidLogicSingleton */ "./node_modules/solid-logic/lib/logic/solidLogicSingleton.js");
67389
+ var uri_1 = __webpack_require__(/*! ../util/uri */ "./node_modules/solid-logic/lib/util/uri.js");
67390
+ var solid_namespace_1 = __importDefault(__webpack_require__(/*! solid-namespace */ "./node_modules/solid-namespace/index.js"));
67391
+ var authn = solidLogicSingleton_1.solidLogicSingleton.authn;
67392
+ var currentUser = authn.currentUser;
67393
+ var ns = (0, solid_namespace_1.default)($rdf);
67394
+ /**
67395
+ * Create a resource if it really does not exist
67396
+ * Be absolutely sure something does not exist before creating a new empty file
67397
+ * as otherwise existing could be deleted.
67398
+ * @param doc {NamedNode} - The resource
67399
+ */
67400
+ function loadOrCreateIfNotExists(store, doc) {
67401
+ return __awaiter(this, void 0, void 0, function () {
67402
+ var response, err_1, msg, msg;
67403
+ return __generator(this, function (_a) {
67404
+ switch (_a.label) {
67405
+ case 0:
67406
+ _a.trys.push([0, 2, , 3]);
67407
+ return [4 /*yield*/, store.fetcher.load(doc)];
67408
+ case 1:
67409
+ response = _a.sent();
67410
+ return [3 /*break*/, 3];
67411
+ case 2:
67412
+ err_1 = _a.sent();
67413
+ if (err_1.response.status === 404) {
67414
+ try {
67415
+ store.fetcher.webOperation('PUT', doc, { data: '', contentType: 'text/turtle' });
67416
+ }
67417
+ catch (err) {
67418
+ msg = 'createIfNotExists: PUT FAILED: ' + doc + ': ' + err;
67419
+ throw new Error(msg);
67420
+ }
67421
+ delete store.fetcher.requested[doc.uri]; // delete cached 404 error
67422
+ }
67423
+ else {
67424
+ msg = 'createIfNotExists doc load error NOT 404: ' + doc + ': ' + err_1;
67425
+ throw new Error(msg); // @@ add nested errors
67426
+ }
67427
+ return [3 /*break*/, 3];
67428
+ case 3: return [2 /*return*/, response];
67429
+ }
67430
+ });
67431
+ });
67432
+ }
67433
+ exports.loadOrCreateIfNotExists = loadOrCreateIfNotExists;
67434
+ function suggestPreferencesFile(me) {
67435
+ var stripped = me.uri.replace('/profile/', '/').replace('/public/', '/');
67436
+ // const stripped = me.uri.replace(\/[p|P]rofile/\g, '/').replace(\/[p|P]ublic/\g, '/')
67437
+ var folderURI = stripped.split('/').slice(0, -1).join('/') + '/Settings/';
67438
+ var fileURI = folderURI + 'Preferences.ttl';
67439
+ return (0, rdflib_1.sym)(fileURI);
67440
+ }
67441
+ exports.suggestPreferencesFile = suggestPreferencesFile;
67442
+ function suggestPublicTypeIndex(me) {
67443
+ var _a;
67444
+ return (0, rdflib_1.sym)(((_a = me.doc().dir()) === null || _a === void 0 ? void 0 : _a.uri) + 'publicTypeIndex.ttl');
67445
+ }
67446
+ exports.suggestPublicTypeIndex = suggestPublicTypeIndex;
67447
+ // Note this one is based off the pref file not the profile
67448
+ function suggestPrivateTypeIndex(preferencesFile) {
67449
+ var _a;
67450
+ return (0, rdflib_1.sym)(((_a = preferencesFile.doc().dir()) === null || _a === void 0 ? void 0 : _a.uri) + 'privateTypeIndex.ttl');
67451
+ }
67452
+ exports.suggestPrivateTypeIndex = suggestPrivateTypeIndex;
67453
+ /* Follow link from this doc to another thing, or else make a new link
67454
+ **
67455
+ ** return: null no ld one and failed to make a new one
67456
+ */
67457
+ function followOrCreateLink(store, subject, predicate, object, doc) {
67458
+ return __awaiter(this, void 0, void 0, function () {
67459
+ var result, err_2, err_3;
67460
+ return __generator(this, function (_a) {
67461
+ switch (_a.label) {
67462
+ case 0: return [4 /*yield*/, store.fetcher.load(doc)];
67463
+ case 1:
67464
+ _a.sent();
67465
+ result = store.any(subject, predicate, null, doc);
67466
+ if (result)
67467
+ return [2 /*return*/, result];
67468
+ if (!store.updater.editable(doc)) {
67469
+ return [2 /*return*/, null];
67470
+ }
67471
+ _a.label = 2;
67472
+ case 2:
67473
+ _a.trys.push([2, 4, , 5]);
67474
+ return [4 /*yield*/, store.updater.update([], [(0, rdflib_1.st)(subject, predicate, object, doc)])];
67475
+ case 3:
67476
+ _a.sent();
67477
+ return [3 /*break*/, 5];
67478
+ case 4:
67479
+ err_2 = _a.sent();
67480
+ console.warn("followOrCreateLink: Error making link in ".concat(doc, " to ").concat(object, ": ").concat(err_2));
67481
+ return [2 /*return*/, null];
67482
+ case 5:
67483
+ _a.trys.push([5, 7, , 8]);
67484
+ return [4 /*yield*/, loadOrCreateIfNotExists(store, object)
67485
+ // store.fetcher.webOperation('PUT', object, { data: '', contentType: 'text/turtle'})
67486
+ ];
67487
+ case 6:
67488
+ _a.sent();
67489
+ return [3 /*break*/, 8];
67490
+ case 7:
67491
+ err_3 = _a.sent();
67492
+ console.warn("followOrCreateLink: Error loading or saving new linked document: ".concat(object, ": ").concat(err_3));
67493
+ return [3 /*break*/, 8];
67494
+ case 8: return [2 /*return*/, object];
67495
+ }
67496
+ });
67497
+ });
67498
+ }
67499
+ exports.followOrCreateLink = followOrCreateLink;
66240
67500
  function loadProfile(store, user) {
66241
67501
  return __awaiter(this, void 0, void 0, function () {
66242
- var err_1;
67502
+ var err_4;
66243
67503
  return __generator(this, function (_a) {
66244
67504
  switch (_a.label) {
66245
67505
  case 0:
@@ -66254,8 +67514,8 @@ function loadProfile(store, user) {
66254
67514
  _a.sent();
66255
67515
  return [3 /*break*/, 4];
66256
67516
  case 3:
66257
- err_1 = _a.sent();
66258
- throw new Error("Unable to load profile of user <".concat(user, ">: ").concat(err_1));
67517
+ err_4 = _a.sent();
67518
+ throw new Error("Unable to load profile of user ".concat(user, ": ").concat(err_4));
66259
67519
  case 4: return [2 /*return*/, user.doc()];
66260
67520
  }
66261
67521
  });
@@ -66264,27 +67524,32 @@ function loadProfile(store, user) {
66264
67524
  exports.loadProfile = loadProfile;
66265
67525
  function loadPreferences(store, user) {
66266
67526
  return __awaiter(this, void 0, void 0, function () {
66267
- var profile, preferencesFile;
67527
+ var possiblePreferencesFile, preferencesFile, message, err_5;
66268
67528
  return __generator(this, function (_a) {
66269
67529
  switch (_a.label) {
66270
67530
  case 0: return [4 /*yield*/, loadProfile(store, user)];
66271
67531
  case 1:
66272
- profile = _a.sent();
66273
- preferencesFile = store.any(user, ns.space('preferencesFile'), undefined, profile);
67532
+ _a.sent();
67533
+ possiblePreferencesFile = suggestPreferencesFile(user);
67534
+ return [4 /*yield*/, followOrCreateLink(store, user, ns.space('preferencesFile'), possiblePreferencesFile, user.doc())];
67535
+ case 2:
67536
+ preferencesFile = _a.sent();
66274
67537
  if (!preferencesFile) {
66275
- // throw new Error(`USer ${user} has no pointer in profile to preferences file.`)
67538
+ message = "User ".concat(user, " has no pointer in profile to preferences file.");
67539
+ console.warn(message);
66276
67540
  return [2 /*return*/, undefined];
66277
67541
  }
66278
- try {
66279
- store.fetcher.load(preferencesFile);
66280
- }
66281
- catch (err) { // Mabeb a permission propblem or origin problem
66282
- return [2 /*return*/, undefined
66283
- // throw new Error(`Unable to load preferences file ${preferencesFile} of user <${user}>: ${err}`)
66284
- ];
66285
- // throw new Error(`Unable to load preferences file ${preferencesFile} of user <${user}>: ${err}`)
66286
- }
66287
- return [2 /*return*/, preferencesFile];
67542
+ _a.label = 3;
67543
+ case 3:
67544
+ _a.trys.push([3, 5, , 6]);
67545
+ return [4 /*yield*/, store.fetcher.load(preferencesFile)];
67546
+ case 4:
67547
+ _a.sent();
67548
+ return [3 /*break*/, 6];
67549
+ case 5:
67550
+ err_5 = _a.sent();
67551
+ return [2 /*return*/, undefined];
67552
+ case 6: return [2 /*return*/, preferencesFile];
66288
67553
  }
66289
67554
  });
66290
67555
  });
@@ -66292,7 +67557,7 @@ function loadPreferences(store, user) {
66292
67557
  exports.loadPreferences = loadPreferences;
66293
67558
  function loadTypeIndexesFor(store, user) {
66294
67559
  return __awaiter(this, void 0, void 0, function () {
66295
- var profile, publicTypeIndex, _a, pub, preferencesFile, privateTypeIndexes, priv;
67560
+ var profile, suggestion, publicTypeIndex, publicScopes, preferencesFile, err_6, privateScopes, suggestedPrivateTypeIndex, privateTypeIndex, _a, scopes, files, err_7;
66296
67561
  return __generator(this, function (_b) {
66297
67562
  switch (_b.label) {
66298
67563
  case 0:
@@ -66301,30 +67566,55 @@ function loadTypeIndexesFor(store, user) {
66301
67566
  return [4 /*yield*/, loadProfile(store, user)];
66302
67567
  case 1:
66303
67568
  profile = _b.sent();
66304
- publicTypeIndex = store.any(user, ns.solid('publicTypeIndex'), undefined, profile);
66305
- if (!publicTypeIndex) return [3 /*break*/, 5];
66306
- _b.label = 2;
67569
+ suggestion = suggestPublicTypeIndex(user);
67570
+ return [4 /*yield*/, followOrCreateLink(store, user, ns.solid('publicTypeIndex'), suggestion, profile)];
66307
67571
  case 2:
66308
- _b.trys.push([2, 4, , 5]);
66309
- return [4 /*yield*/, store.fetcher.load(publicTypeIndex)];
67572
+ publicTypeIndex = _b.sent();
67573
+ publicScopes = publicTypeIndex ? [{ label: 'public', index: publicTypeIndex, agent: user }] : [];
67574
+ _b.label = 3;
66310
67575
  case 3:
66311
- _b.sent();
66312
- return [3 /*break*/, 5];
67576
+ _b.trys.push([3, 5, , 6]);
67577
+ return [4 /*yield*/, loadPreferences(store, user)];
66313
67578
  case 4:
66314
- _a = _b.sent();
66315
- return [3 /*break*/, 5];
67579
+ preferencesFile = _b.sent();
67580
+ return [3 /*break*/, 6];
66316
67581
  case 5:
66317
- pub = publicTypeIndex ? [{ label: 'public', index: publicTypeIndex, agent: user }] : [];
66318
- return [4 /*yield*/, loadPreferences(store, user)];
67582
+ err_6 = _b.sent();
67583
+ preferencesFile = null;
67584
+ return [3 /*break*/, 6];
66319
67585
  case 6:
66320
- preferencesFile = _b.sent();
66321
- if (preferencesFile) { // watch out - can be in either as spec was not clear
66322
- privateTypeIndexes = store.each(user, ns.solid('privateTypeIndex'), undefined, preferencesFile)
66323
- .concat(store.each(user, ns.solid('privateTypeIndex'), undefined, profile));
66324
- priv = privateTypeIndexes.length > 0 ? [{ label: 'priSo @@@@@vate', index: privateTypeIndexes[0], agent: user }] : [];
66325
- return [2 /*return*/, pub.concat(priv)];
66326
- }
66327
- return [2 /*return*/, pub];
67586
+ if (!preferencesFile) return [3 /*break*/, 9];
67587
+ suggestedPrivateTypeIndex = suggestPrivateTypeIndex(preferencesFile);
67588
+ _a = store.any(user, ns.solid('privateTypeIndex'), undefined, profile);
67589
+ if (_a) return [3 /*break*/, 8];
67590
+ return [4 /*yield*/, followOrCreateLink(store, user, ns.solid('privateTypeIndex'), suggestedPrivateTypeIndex, preferencesFile)];
67591
+ case 7:
67592
+ _a = (_b.sent());
67593
+ _b.label = 8;
67594
+ case 8:
67595
+ privateTypeIndex = _a;
67596
+ privateScopes = privateTypeIndex ? [{ label: 'private', index: privateTypeIndex, agent: user }] : [];
67597
+ return [3 /*break*/, 10];
67598
+ case 9:
67599
+ privateScopes = [];
67600
+ _b.label = 10;
67601
+ case 10:
67602
+ scopes = publicScopes.concat(privateScopes);
67603
+ if (scopes.length === 0)
67604
+ return [2 /*return*/, scopes];
67605
+ files = scopes.map(function (scope) { return scope.index; });
67606
+ _b.label = 11;
67607
+ case 11:
67608
+ _b.trys.push([11, 13, , 14]);
67609
+ return [4 /*yield*/, store.fetcher.load(files)];
67610
+ case 12:
67611
+ _b.sent();
67612
+ return [3 /*break*/, 14];
67613
+ case 13:
67614
+ err_7 = _b.sent();
67615
+ console.warn('Problems loading type index: ', err_7);
67616
+ return [3 /*break*/, 14];
67617
+ case 14: return [2 /*return*/, scopes];
66328
67618
  }
66329
67619
  });
66330
67620
  });
@@ -66332,44 +67622,30 @@ function loadTypeIndexesFor(store, user) {
66332
67622
  exports.loadTypeIndexesFor = loadTypeIndexesFor;
66333
67623
  function loadCommunityTypeIndexes(store, user) {
66334
67624
  return __awaiter(this, void 0, void 0, function () {
66335
- var preferencesFile, communities, communityTypeIndexesPromise, result1;
66336
- var _this = this;
66337
- return __generator(this, function (_a) {
66338
- switch (_a.label) {
67625
+ var preferencesFile, communities, result, _i, communities_1, org, _a, _b;
67626
+ return __generator(this, function (_c) {
67627
+ switch (_c.label) {
66339
67628
  case 0: return [4 /*yield*/, loadPreferences(store, user)];
66340
67629
  case 1:
66341
- preferencesFile = _a.sent();
66342
- if (preferencesFile) {
66343
- communities = store.each(user, ns.solid('community'), undefined, preferencesFile);
66344
- communityTypeIndexesPromise = communities.map(function (community) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
66345
- switch (_a.label) {
66346
- case 0: return [4 /*yield*/, loadTypeIndexesFor(store, community)];
66347
- case 1: return [2 /*return*/, _a.sent()];
66348
- }
66349
- }); }); });
66350
- result1 = Promise.all(communityTypeIndexesPromise);
66351
- // const result2 = Promise.all(result1)
66352
- // const flat = result2.flat()
66353
- return [2 /*return*/, result1
66354
- // const communityTypeIndexes = await Promise.all(communityTypeIndexesPromise)
66355
- /*
66356
- let result = [] as TypeIndex[]
66357
- for(const community of communities) {
66358
- result = result.concat(await loadTypeIndexesFor(store, community as NamedNode)) as TypeIndex[] // @@ how oto make functional with async?
66359
- }
66360
- */
66361
- // return communityTypeIndexesPromise.resolve()
66362
- ];
66363
- // const communityTypeIndexes = await Promise.all(communityTypeIndexesPromise)
66364
- /*
66365
- let result = [] as TypeIndex[]
66366
- for(const community of communities) {
66367
- result = result.concat(await loadTypeIndexesFor(store, community as NamedNode)) as TypeIndex[] // @@ how oto make functional with async?
66368
- }
66369
- */
66370
- // return communityTypeIndexesPromise.resolve()
66371
- }
66372
- return [2 /*return*/, []];
67630
+ preferencesFile = _c.sent();
67631
+ if (!preferencesFile) return [3 /*break*/, 6];
67632
+ communities = store.each(user, ns.solid('community'), undefined, preferencesFile).concat(store.each(user, ns.solid('community'), undefined, user.doc()));
67633
+ result = [];
67634
+ _i = 0, communities_1 = communities;
67635
+ _c.label = 2;
67636
+ case 2:
67637
+ if (!(_i < communities_1.length)) return [3 /*break*/, 5];
67638
+ org = communities_1[_i];
67639
+ _b = (_a = result).concat;
67640
+ return [4 /*yield*/, loadTypeIndexesFor(store, org)];
67641
+ case 3:
67642
+ result = _b.apply(_a, [_c.sent()]);
67643
+ _c.label = 4;
67644
+ case 4:
67645
+ _i++;
67646
+ return [3 /*break*/, 2];
67647
+ case 5: return [2 /*return*/, result];
67648
+ case 6: return [2 /*return*/, []]; // No communities
66373
67649
  }
66374
67650
  });
66375
67651
  });
@@ -66390,11 +67666,159 @@ function loadAllTypeIndexes(store, user) {
66390
67666
  });
66391
67667
  }
66392
67668
  exports.loadAllTypeIndexes = loadAllTypeIndexes;
67669
+ // Utility: remove duplicates from Array of NamedNodes
67670
+ function uniqueNodes(arr) {
67671
+ var uris = arr.map(function (x) { return x.uri; });
67672
+ var set = new Set(uris);
67673
+ var uris2 = Array.from(set);
67674
+ var arr2 = uris2.map(function (u) { return new rdflib_1.NamedNode(u); });
67675
+ return arr2; // Array.from(new Set(arr.map(x => x.uri))).map(u => sym(u))
67676
+ }
67677
+ exports.uniqueNodes = uniqueNodes;
67678
+ function getScopedAppsFromIndex(store, scope, theClass) {
67679
+ return __awaiter(this, void 0, void 0, function () {
67680
+ var index, registrations, relevant, directInstances, instances, instanceContainers, containers, i, cont, contents;
67681
+ return __generator(this, function (_a) {
67682
+ switch (_a.label) {
67683
+ case 0:
67684
+ index = scope.index;
67685
+ registrations = store.statementsMatching(null, ns.solid('instance'), null, index)
67686
+ .concat(store.statementsMatching(null, ns.solid('instanceContainer'), null, index))
67687
+ .map(function (st) { return st.subject; });
67688
+ relevant = theClass ? registrations.filter(function (reg) { return store.any(reg, ns.solid('forClass'), null, index).sameTerm(theClass); })
67689
+ : registrations;
67690
+ directInstances = relevant.map(function (reg) { return store.each(reg, ns.solid('instance'), null, index); }).flat();
67691
+ instances = uniqueNodes(directInstances);
67692
+ instanceContainers = relevant.map(function (reg) { return store.each(reg, ns.solid('instanceContainer'), null, index); }).flat();
67693
+ containers = uniqueNodes(instanceContainers);
67694
+ if (containers.length > 0) {
67695
+ console.log('@@ getScopedAppsFromIndex containers ', containers);
67696
+ }
67697
+ i = 0;
67698
+ _a.label = 1;
67699
+ case 1:
67700
+ if (!(i < containers.length)) return [3 /*break*/, 4];
67701
+ cont = containers[i];
67702
+ return [4 /*yield*/, store.fetcher.load(cont)];
67703
+ case 2:
67704
+ _a.sent();
67705
+ contents = store.each(cont, ns.ldp('contains'), null, cont);
67706
+ instances = instances.concat(contents);
67707
+ _a.label = 3;
67708
+ case 3:
67709
+ i++;
67710
+ return [3 /*break*/, 1];
67711
+ case 4: return [2 /*return*/, instances.map(function (instance) { return { instance: instance, scope: scope }; })];
67712
+ }
67713
+ });
67714
+ });
67715
+ }
67716
+ exports.getScopedAppsFromIndex = getScopedAppsFromIndex;
67717
+ function getScopedAppInstances(store, klass, user) {
67718
+ return __awaiter(this, void 0, void 0, function () {
67719
+ var scopes, scopedApps, _i, scopes_1, scope, scopedApps0;
67720
+ return __generator(this, function (_a) {
67721
+ switch (_a.label) {
67722
+ case 0: return [4 /*yield*/, loadAllTypeIndexes(store, user)];
67723
+ case 1:
67724
+ scopes = _a.sent();
67725
+ scopedApps = [];
67726
+ _i = 0, scopes_1 = scopes;
67727
+ _a.label = 2;
67728
+ case 2:
67729
+ if (!(_i < scopes_1.length)) return [3 /*break*/, 5];
67730
+ scope = scopes_1[_i];
67731
+ return [4 /*yield*/, getScopedAppsFromIndex(store, scope, klass)];
67732
+ case 3:
67733
+ scopedApps0 = _a.sent();
67734
+ scopedApps = scopedApps.concat(scopedApps0);
67735
+ _a.label = 4;
67736
+ case 4:
67737
+ _i++;
67738
+ return [3 /*break*/, 2];
67739
+ case 5: return [2 /*return*/, scopedApps];
67740
+ }
67741
+ });
67742
+ });
67743
+ }
67744
+ exports.getScopedAppInstances = getScopedAppInstances;
67745
+ // This is the function signature which used to be in solid-ui/logic
67746
+ // Recommended to use getScopedAppInstances instead as it provides more information.
67747
+ //
67748
+ function getAppInstances(store, klass) {
67749
+ return __awaiter(this, void 0, void 0, function () {
67750
+ var user, scopedAppInstances;
67751
+ return __generator(this, function (_a) {
67752
+ switch (_a.label) {
67753
+ case 0:
67754
+ user = currentUser();
67755
+ if (!user)
67756
+ throw new Error('getAppInstances: Must be logged in to find apps.');
67757
+ return [4 /*yield*/, getScopedAppInstances(store, klass, user)];
67758
+ case 1:
67759
+ scopedAppInstances = _a.sent();
67760
+ return [2 /*return*/, scopedAppInstances.map(function (scoped) { return scoped.instance; })];
67761
+ }
67762
+ });
67763
+ });
67764
+ }
67765
+ exports.getAppInstances = getAppInstances;
66393
67766
  /*
66394
- export async function getAppInstances (store:LiveStore, klass: NamedNode) {
66395
-
67767
+ * Register a new app in a type index
67768
+ * used in chat in bookmark.js (solid-ui)
67769
+ * Returns the registration object if successful else null
67770
+ */
67771
+ function registerInstanceInTypeIndex(store, instance, index, theClass) {
67772
+ return __awaiter(this, void 0, void 0, function () {
67773
+ var registration, ins, err_8, msg;
67774
+ return __generator(this, function (_a) {
67775
+ switch (_a.label) {
67776
+ case 0:
67777
+ registration = (0, uri_1.newThing)(index);
67778
+ ins = [
67779
+ // See https://github.com/solid/solid/blob/main/proposals/data-discovery.md
67780
+ (0, rdflib_1.st)(registration, ns.rdf('type'), ns.solid('TypeRegistration'), index),
67781
+ (0, rdflib_1.st)(registration, ns.solid('forClass'), theClass, index),
67782
+ (0, rdflib_1.st)(registration, ns.solid('instance'), instance, index)
67783
+ ];
67784
+ _a.label = 1;
67785
+ case 1:
67786
+ _a.trys.push([1, 3, , 4]);
67787
+ return [4 /*yield*/, store.updater.update([], ins)];
67788
+ case 2:
67789
+ _a.sent();
67790
+ return [3 /*break*/, 4];
67791
+ case 3:
67792
+ err_8 = _a.sent();
67793
+ msg = "Unable to register ".concat(instance, " in index ").concat(index, ": ").concat(err_8);
67794
+ console.warn(msg);
67795
+ return [2 /*return*/, null];
67796
+ case 4: return [2 /*return*/, registration];
67797
+ }
67798
+ });
67799
+ });
66396
67800
  }
66397
- */
67801
+ exports.registerInstanceInTypeIndex = registerInstanceInTypeIndex;
67802
+ function deleteTypeIndexRegistration(store, item) {
67803
+ return __awaiter(this, void 0, void 0, function () {
67804
+ var reg, statements;
67805
+ return __generator(this, function (_a) {
67806
+ switch (_a.label) {
67807
+ case 0:
67808
+ reg = store.the(null, ns.solid('instance'), item.instance, item.scope.index);
67809
+ if (!reg)
67810
+ throw new Error("deleteTypeIndexRegistration: No registration found for ".concat(item.instance));
67811
+ statements = store.statementsMatching(reg, null, null, item.scope.index);
67812
+ return [4 /*yield*/, store.updater.update(statements, [])];
67813
+ case 1:
67814
+ _a.sent();
67815
+ return [2 /*return*/];
67816
+ }
67817
+ });
67818
+ });
67819
+ }
67820
+ exports.deleteTypeIndexRegistration = deleteTypeIndexRegistration;
67821
+ // ENDS
66398
67822
  //# sourceMappingURL=discoveryLogic.js.map
66399
67823
 
66400
67824
  /***/ }),
@@ -66408,7 +67832,7 @@ export async function getAppInstances (store:LiveStore, klass: NamedNode) {
66408
67832
  "use strict";
66409
67833
 
66410
67834
  Object.defineProperty(exports, "__esModule", ({ value: true }));
66411
- exports.profile = exports.chat = exports.store = exports.authSession = exports.authn = exports.FetchError = exports.NotFoundError = exports.SameOriginForbiddenError = exports.CrossOriginForbiddenError = exports.UnauthorizedError = exports.solidLogicSingleton = exports.getSuggestedIssuers = exports.ACL_LINK = exports.appContext = exports.offlineTestID = exports.SolidLogic = exports.loadAllTypeIndexes = exports.loadCommunityTypeIndexes = exports.loadTypeIndexesFor = exports.loadPreferences = exports.loadProfile = exports.loadIndex = exports.registerInTypeIndex = exports.loadTypeIndexes = exports.ensureTypeIndexes = exports.genACLText = exports.setACLUserPublic = void 0;
67835
+ exports.profile = exports.chat = exports.store = exports.authSession = exports.authn = exports.FetchError = exports.NotFoundError = exports.SameOriginForbiddenError = exports.CrossOriginForbiddenError = exports.UnauthorizedError = exports.solidLogicSingleton = exports.getSuggestedIssuers = exports.ACL_LINK = exports.appContext = exports.offlineTestID = exports.SolidLogic = exports.uniqueNodes = exports.suggestPublicTypeIndex = exports.suggestPrivateTypeIndex = exports.suggestPreferencesFile = exports.registerInstanceInTypeIndex = exports.loadTypeIndexesFor = exports.loadProfile = exports.loadPreferences = exports.loadOrCreateIfNotExists = exports.loadCommunityTypeIndexes = exports.loadAllTypeIndexes = exports.getScopedAppsFromIndex = exports.getScopedAppInstances = exports.getAppInstances = exports.followOrCreateLink = exports.deleteTypeIndexRegistration = exports.loadIndex = exports.registerInTypeIndex = exports.loadTypeIndexes = exports.ensureTypeIndexes = exports.genACLText = exports.setACLUserPublic = void 0;
66412
67836
  // Make these variables directly accessible as it is what you need most of the time
66413
67837
  // This also makes these variable globaly accesible in mashlib
66414
67838
  var solidLogicSingleton_1 = __webpack_require__(/*! ./logic/solidLogicSingleton */ "./node_modules/solid-logic/lib/logic/solidLogicSingleton.js");
@@ -66430,12 +67854,25 @@ Object.defineProperty(exports, "ensureTypeIndexes", ({ enumerable: true, get: fu
66430
67854
  Object.defineProperty(exports, "loadTypeIndexes", ({ enumerable: true, get: function () { return typeIndexLogic_1.loadTypeIndexes; } }));
66431
67855
  Object.defineProperty(exports, "registerInTypeIndex", ({ enumerable: true, get: function () { return typeIndexLogic_1.registerInTypeIndex; } }));
66432
67856
  Object.defineProperty(exports, "loadIndex", ({ enumerable: true, get: function () { return typeIndexLogic_1.loadIndex; } }));
67857
+ // Generate by
67858
+ // grep export src/discovery/discoveryLogic.ts | sed -e 's/export //g' | sed -e 's/async //g'| sed -e 's/function //g' | sed -e 's/ .*/,/g' | sort
66433
67859
  var discoveryLogic_1 = __webpack_require__(/*! ./discovery/discoveryLogic */ "./node_modules/solid-logic/lib/discovery/discoveryLogic.js");
66434
- Object.defineProperty(exports, "loadProfile", ({ enumerable: true, get: function () { return discoveryLogic_1.loadProfile; } }));
67860
+ Object.defineProperty(exports, "deleteTypeIndexRegistration", ({ enumerable: true, get: function () { return discoveryLogic_1.deleteTypeIndexRegistration; } }));
67861
+ Object.defineProperty(exports, "followOrCreateLink", ({ enumerable: true, get: function () { return discoveryLogic_1.followOrCreateLink; } }));
67862
+ Object.defineProperty(exports, "getAppInstances", ({ enumerable: true, get: function () { return discoveryLogic_1.getAppInstances; } }));
67863
+ Object.defineProperty(exports, "getScopedAppInstances", ({ enumerable: true, get: function () { return discoveryLogic_1.getScopedAppInstances; } }));
67864
+ Object.defineProperty(exports, "getScopedAppsFromIndex", ({ enumerable: true, get: function () { return discoveryLogic_1.getScopedAppsFromIndex; } }));
67865
+ Object.defineProperty(exports, "loadAllTypeIndexes", ({ enumerable: true, get: function () { return discoveryLogic_1.loadAllTypeIndexes; } }));
67866
+ Object.defineProperty(exports, "loadCommunityTypeIndexes", ({ enumerable: true, get: function () { return discoveryLogic_1.loadCommunityTypeIndexes; } }));
67867
+ Object.defineProperty(exports, "loadOrCreateIfNotExists", ({ enumerable: true, get: function () { return discoveryLogic_1.loadOrCreateIfNotExists; } }));
66435
67868
  Object.defineProperty(exports, "loadPreferences", ({ enumerable: true, get: function () { return discoveryLogic_1.loadPreferences; } }));
67869
+ Object.defineProperty(exports, "loadProfile", ({ enumerable: true, get: function () { return discoveryLogic_1.loadProfile; } }));
66436
67870
  Object.defineProperty(exports, "loadTypeIndexesFor", ({ enumerable: true, get: function () { return discoveryLogic_1.loadTypeIndexesFor; } }));
66437
- Object.defineProperty(exports, "loadCommunityTypeIndexes", ({ enumerable: true, get: function () { return discoveryLogic_1.loadCommunityTypeIndexes; } }));
66438
- Object.defineProperty(exports, "loadAllTypeIndexes", ({ enumerable: true, get: function () { return discoveryLogic_1.loadAllTypeIndexes; } }));
67871
+ Object.defineProperty(exports, "registerInstanceInTypeIndex", ({ enumerable: true, get: function () { return discoveryLogic_1.registerInstanceInTypeIndex; } }));
67872
+ Object.defineProperty(exports, "suggestPreferencesFile", ({ enumerable: true, get: function () { return discoveryLogic_1.suggestPreferencesFile; } }));
67873
+ Object.defineProperty(exports, "suggestPrivateTypeIndex", ({ enumerable: true, get: function () { return discoveryLogic_1.suggestPrivateTypeIndex; } }));
67874
+ Object.defineProperty(exports, "suggestPublicTypeIndex", ({ enumerable: true, get: function () { return discoveryLogic_1.suggestPublicTypeIndex; } }));
67875
+ Object.defineProperty(exports, "uniqueNodes", ({ enumerable: true, get: function () { return discoveryLogic_1.uniqueNodes; } }));
66439
67876
  var SolidLogic_1 = __webpack_require__(/*! ./logic/SolidLogic */ "./node_modules/solid-logic/lib/logic/SolidLogic.js");
66440
67877
  Object.defineProperty(exports, "SolidLogic", ({ enumerable: true, get: function () { return SolidLogic_1.SolidLogic; } }));
66441
67878
  var authUtil_1 = __webpack_require__(/*! ./authn/authUtil */ "./node_modules/solid-logic/lib/authn/authUtil.js");
@@ -76924,9 +78361,8 @@ class LocalJWKSet {
76924
78361
  }
76925
78362
  async getKey(protectedHeader, token) {
76926
78363
  const { alg, kid } = { ...protectedHeader, ...token.header };
76927
- const kty = getKtyFromAlg(alg);
76928
78364
  const candidates = this._jwks.keys.filter((jwk) => {
76929
- let candidate = kty === jwk.kty;
78365
+ let candidate = jwk.kty === getKtyFromAlg(alg);
76930
78366
  if (candidate && typeof kid === 'string') {
76931
78367
  candidate = kid === jwk.kid;
76932
78368
  }
@@ -78143,15 +79579,21 @@ function lengthAndInput(input) {
78143
79579
  }
78144
79580
  async function concatKdf(secret, bits, value) {
78145
79581
  const iterations = Math.ceil((bits >> 3) / 32);
78146
- const res = new Uint8Array(iterations * 32);
78147
- for (let iter = 0; iter < iterations; iter++) {
79582
+ let res;
79583
+ for (let iter = 1; iter <= iterations; iter++) {
78148
79584
  const buf = new Uint8Array(4 + secret.length + value.length);
78149
- buf.set(uint32be(iter + 1));
79585
+ buf.set(uint32be(iter));
78150
79586
  buf.set(secret, 4);
78151
79587
  buf.set(value, 4 + secret.length);
78152
- res.set(await (0,_runtime_digest_js__WEBPACK_IMPORTED_MODULE_0__["default"])('sha256', buf), iter * 32);
79588
+ if (!res) {
79589
+ res = await (0,_runtime_digest_js__WEBPACK_IMPORTED_MODULE_0__["default"])('sha256', buf);
79590
+ }
79591
+ else {
79592
+ res = concat(res, await (0,_runtime_digest_js__WEBPACK_IMPORTED_MODULE_0__["default"])('sha256', buf));
79593
+ }
78153
79594
  }
78154
- return res.slice(0, bits >> 3);
79595
+ res = res.slice(0, bits >> 3);
79596
+ return res;
78155
79597
  }
78156
79598
 
78157
79599
 
@@ -79366,12 +80808,9 @@ const encode = (input) => {
79366
80808
  return encodeBase64(input).replace(/=/g, '').replace(/\+/g, '-').replace(/\//g, '_');
79367
80809
  };
79368
80810
  const decodeBase64 = (encoded) => {
79369
- const binary = atob(encoded);
79370
- const bytes = new Uint8Array(binary.length);
79371
- for (let i = 0; i < binary.length; i++) {
79372
- bytes[i] = binary.charCodeAt(i);
79373
- }
79374
- return bytes;
80811
+ return new Uint8Array(atob(encoded)
80812
+ .split('')
80813
+ .map((c) => c.charCodeAt(0)));
79375
80814
  };
79376
80815
  const decode = (input) => {
79377
80816
  let encoded = input;