@liveblocks/core 2.17.0 → 2.18.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -6,7 +6,7 @@ var __export = (target, all) => {
6
6
 
7
7
  // src/version.ts
8
8
  var PKG_NAME = "@liveblocks/core";
9
- var PKG_VERSION = "2.17.0";
9
+ var PKG_VERSION = "2.18.0";
10
10
  var PKG_FORMAT = "cjs";
11
11
 
12
12
  // src/dupe-detection.ts
@@ -181,6 +181,12 @@ function raise(msg) {
181
181
  function entries(obj) {
182
182
  return Object.entries(obj);
183
183
  }
184
+ function keys(obj) {
185
+ return Object.keys(obj);
186
+ }
187
+ function values(obj) {
188
+ return Object.values(obj);
189
+ }
184
190
  function mapValues(obj, mapFn) {
185
191
  const result = {};
186
192
  for (const pair of Object.entries(obj)) {
@@ -1058,9 +1064,9 @@ function urljoin(baseUrl, path, params) {
1058
1064
  }
1059
1065
  return url2.toString();
1060
1066
  }
1061
- function url(strings, ...values) {
1067
+ function url(strings, ...values2) {
1062
1068
  return strings.reduce(
1063
- (result, str, i) => result + encodeURIComponent(_nullishCoalesce(values[i - 1], () => ( ""))) + str
1069
+ (result, str, i) => result + encodeURIComponent(_nullishCoalesce(values2[i - 1], () => ( ""))) + str
1064
1070
  );
1065
1071
  }
1066
1072
 
@@ -1728,9 +1734,24 @@ function createApiClient({
1728
1734
  await authManager.getAuthValue({ requestedScope: "comments:read" })
1729
1735
  );
1730
1736
  }
1737
+ async function getUserNotificationSettings(options) {
1738
+ return httpClient.get(
1739
+ url`/v2/c/notification-settings`,
1740
+ await authManager.getAuthValue({ requestedScope: "comments:read" }),
1741
+ void 0,
1742
+ { signal: _optionalChain([options, 'optionalAccess', _18 => _18.signal]) }
1743
+ );
1744
+ }
1745
+ async function updateUserNotificationSettings(settings) {
1746
+ return httpClient.post(
1747
+ url`/v2/c/notification-settings`,
1748
+ await authManager.getAuthValue({ requestedScope: "comments:read" }),
1749
+ settings
1750
+ );
1751
+ }
1731
1752
  async function getUserThreads_experimental(options) {
1732
1753
  let query;
1733
- if (_optionalChain([options, 'optionalAccess', _18 => _18.query])) {
1754
+ if (_optionalChain([options, 'optionalAccess', _19 => _19.query])) {
1734
1755
  query = objectToQuery(options.query);
1735
1756
  }
1736
1757
  const PAGE_SIZE = 50;
@@ -1738,7 +1759,7 @@ function createApiClient({
1738
1759
  url`/v2/c/threads`,
1739
1760
  await authManager.getAuthValue({ requestedScope: "comments:read" }),
1740
1761
  {
1741
- cursor: _optionalChain([options, 'optionalAccess', _19 => _19.cursor]),
1762
+ cursor: _optionalChain([options, 'optionalAccess', _20 => _20.cursor]),
1742
1763
  query,
1743
1764
  limit: PAGE_SIZE
1744
1765
  }
@@ -1790,10 +1811,10 @@ function createApiClient({
1790
1811
  removeReaction,
1791
1812
  markThreadAsResolved,
1792
1813
  markThreadAsUnresolved,
1793
- // Room notifications
1794
1814
  markRoomInboxNotificationAsRead,
1795
- updateNotificationSettings,
1815
+ // Room notifications
1796
1816
  getNotificationSettings,
1817
+ updateNotificationSettings,
1797
1818
  // Room text editor
1798
1819
  createTextMention,
1799
1820
  deleteTextMention,
@@ -1817,6 +1838,8 @@ function createApiClient({
1817
1838
  markInboxNotificationAsRead,
1818
1839
  deleteAllInboxNotifications,
1819
1840
  deleteInboxNotification,
1841
+ getUserNotificationSettings,
1842
+ updateUserNotificationSettings,
1820
1843
  // User threads
1821
1844
  getUserThreads_experimental,
1822
1845
  getUserThreadsSince_experimental,
@@ -1865,7 +1888,7 @@ var HttpClient = class {
1865
1888
  // These headers are default, but can be overriden by custom headers
1866
1889
  "Content-Type": "application/json; charset=utf-8",
1867
1890
  // Possible header overrides
1868
- ..._optionalChain([options, 'optionalAccess', _20 => _20.headers]),
1891
+ ..._optionalChain([options, 'optionalAccess', _21 => _21.headers]),
1869
1892
  // Cannot be overriden by custom headers
1870
1893
  Authorization: `Bearer ${getBearerTokenFromAuthValue(authValue)}`,
1871
1894
  "X-LB-Client": PKG_VERSION || "dev"
@@ -2340,7 +2363,7 @@ var FSM = class {
2340
2363
  });
2341
2364
  }
2342
2365
  #getTargetFn(eventName) {
2343
- return _optionalChain([this, 'access', _21 => _21.#allowedTransitions, 'access', _22 => _22.get, 'call', _23 => _23(this.currentState), 'optionalAccess', _24 => _24.get, 'call', _25 => _25(eventName)]);
2366
+ return _optionalChain([this, 'access', _22 => _22.#allowedTransitions, 'access', _23 => _23.get, 'call', _24 => _24(this.currentState), 'optionalAccess', _25 => _25.get, 'call', _26 => _26(eventName)]);
2344
2367
  }
2345
2368
  /**
2346
2369
  * Exits the current state, and executes any necessary cleanup functions.
@@ -2357,7 +2380,7 @@ var FSM = class {
2357
2380
  this.#currentContext.allowPatching((patchableContext) => {
2358
2381
  levels = _nullishCoalesce(levels, () => ( this.#cleanupStack.length));
2359
2382
  for (let i = 0; i < levels; i++) {
2360
- _optionalChain([this, 'access', _26 => _26.#cleanupStack, 'access', _27 => _27.pop, 'call', _28 => _28(), 'optionalCall', _29 => _29(patchableContext)]);
2383
+ _optionalChain([this, 'access', _27 => _27.#cleanupStack, 'access', _28 => _28.pop, 'call', _29 => _29(), 'optionalCall', _30 => _30(patchableContext)]);
2361
2384
  }
2362
2385
  });
2363
2386
  }
@@ -2373,7 +2396,7 @@ var FSM = class {
2373
2396
  this.#currentContext.allowPatching((patchableContext) => {
2374
2397
  for (const pattern of enterPatterns) {
2375
2398
  const enterFn = this.#enterFns.get(pattern);
2376
- const cleanupFn = _optionalChain([enterFn, 'optionalCall', _30 => _30(patchableContext)]);
2399
+ const cleanupFn = _optionalChain([enterFn, 'optionalCall', _31 => _31(patchableContext)]);
2377
2400
  if (typeof cleanupFn === "function") {
2378
2401
  this.#cleanupStack.push(cleanupFn);
2379
2402
  } else {
@@ -2767,7 +2790,7 @@ function createConnectionStateMachine(delegates, options) {
2767
2790
  }
2768
2791
  function waitForActorId(event) {
2769
2792
  const serverMsg = tryParseJson(event.data);
2770
- if (_optionalChain([serverMsg, 'optionalAccess', _31 => _31.type]) === 104 /* ROOM_STATE */) {
2793
+ if (_optionalChain([serverMsg, 'optionalAccess', _32 => _32.type]) === 104 /* ROOM_STATE */) {
2771
2794
  didReceiveActor();
2772
2795
  }
2773
2796
  }
@@ -2876,12 +2899,12 @@ function createConnectionStateMachine(delegates, options) {
2876
2899
  const sendHeartbeat = {
2877
2900
  target: "@ok.awaiting-pong",
2878
2901
  effect: (ctx) => {
2879
- _optionalChain([ctx, 'access', _32 => _32.socket, 'optionalAccess', _33 => _33.send, 'call', _34 => _34("ping")]);
2902
+ _optionalChain([ctx, 'access', _33 => _33.socket, 'optionalAccess', _34 => _34.send, 'call', _35 => _35("ping")]);
2880
2903
  }
2881
2904
  };
2882
2905
  const maybeHeartbeat = () => {
2883
2906
  const doc = typeof document !== "undefined" ? document : void 0;
2884
- const canZombie = _optionalChain([doc, 'optionalAccess', _35 => _35.visibilityState]) === "hidden" && delegates.canZombie();
2907
+ const canZombie = _optionalChain([doc, 'optionalAccess', _36 => _36.visibilityState]) === "hidden" && delegates.canZombie();
2885
2908
  return canZombie ? "@idle.zombie" : sendHeartbeat;
2886
2909
  };
2887
2910
  machine.addTimedTransition("@ok.connected", HEARTBEAT_INTERVAL, maybeHeartbeat).addTransitions("@ok.connected", {
@@ -2920,7 +2943,7 @@ function createConnectionStateMachine(delegates, options) {
2920
2943
  // socket, or not. So always check to see if the socket is still OPEN or
2921
2944
  // not. When still OPEN, don't transition.
2922
2945
  EXPLICIT_SOCKET_ERROR: (_, context) => {
2923
- if (_optionalChain([context, 'access', _36 => _36.socket, 'optionalAccess', _37 => _37.readyState]) === 1) {
2946
+ if (_optionalChain([context, 'access', _37 => _37.socket, 'optionalAccess', _38 => _38.readyState]) === 1) {
2924
2947
  return null;
2925
2948
  }
2926
2949
  return {
@@ -2972,17 +2995,17 @@ function createConnectionStateMachine(delegates, options) {
2972
2995
  machine.send({ type: "NAVIGATOR_ONLINE" });
2973
2996
  }
2974
2997
  function onVisibilityChange() {
2975
- if (_optionalChain([doc, 'optionalAccess', _38 => _38.visibilityState]) === "visible") {
2998
+ if (_optionalChain([doc, 'optionalAccess', _39 => _39.visibilityState]) === "visible") {
2976
2999
  machine.send({ type: "WINDOW_GOT_FOCUS" });
2977
3000
  }
2978
3001
  }
2979
- _optionalChain([win, 'optionalAccess', _39 => _39.addEventListener, 'call', _40 => _40("online", onNetworkBackOnline)]);
2980
- _optionalChain([win, 'optionalAccess', _41 => _41.addEventListener, 'call', _42 => _42("offline", onNetworkOffline)]);
2981
- _optionalChain([root, 'optionalAccess', _43 => _43.addEventListener, 'call', _44 => _44("visibilitychange", onVisibilityChange)]);
3002
+ _optionalChain([win, 'optionalAccess', _40 => _40.addEventListener, 'call', _41 => _41("online", onNetworkBackOnline)]);
3003
+ _optionalChain([win, 'optionalAccess', _42 => _42.addEventListener, 'call', _43 => _43("offline", onNetworkOffline)]);
3004
+ _optionalChain([root, 'optionalAccess', _44 => _44.addEventListener, 'call', _45 => _45("visibilitychange", onVisibilityChange)]);
2982
3005
  return () => {
2983
- _optionalChain([root, 'optionalAccess', _45 => _45.removeEventListener, 'call', _46 => _46("visibilitychange", onVisibilityChange)]);
2984
- _optionalChain([win, 'optionalAccess', _47 => _47.removeEventListener, 'call', _48 => _48("online", onNetworkBackOnline)]);
2985
- _optionalChain([win, 'optionalAccess', _49 => _49.removeEventListener, 'call', _50 => _50("offline", onNetworkOffline)]);
3006
+ _optionalChain([root, 'optionalAccess', _46 => _46.removeEventListener, 'call', _47 => _47("visibilitychange", onVisibilityChange)]);
3007
+ _optionalChain([win, 'optionalAccess', _48 => _48.removeEventListener, 'call', _49 => _49("online", onNetworkBackOnline)]);
3008
+ _optionalChain([win, 'optionalAccess', _50 => _50.removeEventListener, 'call', _51 => _51("offline", onNetworkOffline)]);
2986
3009
  teardownSocket(ctx.socket);
2987
3010
  };
2988
3011
  });
@@ -3071,7 +3094,7 @@ var ManagedSocket = class {
3071
3094
  * message if this is somehow impossible.
3072
3095
  */
3073
3096
  send(data) {
3074
- const socket = _optionalChain([this, 'access', _51 => _51.#machine, 'access', _52 => _52.context, 'optionalAccess', _53 => _53.socket]);
3097
+ const socket = _optionalChain([this, 'access', _52 => _52.#machine, 'access', _53 => _53.context, 'optionalAccess', _54 => _54.socket]);
3075
3098
  if (socket === null) {
3076
3099
  warn("Cannot send: not connected yet", data);
3077
3100
  } else if (socket.readyState !== 1) {
@@ -3175,7 +3198,7 @@ function createAuthManager(authOptions, onAuthenticate) {
3175
3198
  return void 0;
3176
3199
  }
3177
3200
  async function makeAuthRequest(options) {
3178
- const fetcher = _nullishCoalesce(_optionalChain([authOptions, 'access', _54 => _54.polyfills, 'optionalAccess', _55 => _55.fetch]), () => ( (typeof window === "undefined" ? void 0 : window.fetch)));
3201
+ const fetcher = _nullishCoalesce(_optionalChain([authOptions, 'access', _55 => _55.polyfills, 'optionalAccess', _56 => _56.fetch]), () => ( (typeof window === "undefined" ? void 0 : window.fetch)));
3179
3202
  if (authentication.type === "private") {
3180
3203
  if (fetcher === void 0) {
3181
3204
  throw new StopRetrying(
@@ -3191,7 +3214,7 @@ function createAuthManager(authOptions, onAuthenticate) {
3191
3214
  "The same Liveblocks auth token was issued from the backend before. Caching Liveblocks tokens is not supported."
3192
3215
  );
3193
3216
  }
3194
- _optionalChain([onAuthenticate, 'optionalCall', _56 => _56(parsed.parsed)]);
3217
+ _optionalChain([onAuthenticate, 'optionalCall', _57 => _57(parsed.parsed)]);
3195
3218
  return parsed;
3196
3219
  }
3197
3220
  if (authentication.type === "custom") {
@@ -3199,7 +3222,7 @@ function createAuthManager(authOptions, onAuthenticate) {
3199
3222
  if (response && typeof response === "object") {
3200
3223
  if (typeof response.token === "string") {
3201
3224
  const parsed = parseAuthToken(response.token);
3202
- _optionalChain([onAuthenticate, 'optionalCall', _57 => _57(parsed.parsed)]);
3225
+ _optionalChain([onAuthenticate, 'optionalCall', _58 => _58(parsed.parsed)]);
3203
3226
  return parsed;
3204
3227
  } else if (typeof response.error === "string") {
3205
3228
  const reason = `Authentication failed: ${"reason" in response && typeof response.reason === "string" ? response.reason : "Forbidden"}`;
@@ -3360,7 +3383,7 @@ function sendToPanel(message, options) {
3360
3383
  ...message,
3361
3384
  source: "liveblocks-devtools-client"
3362
3385
  };
3363
- if (!(_optionalChain([options, 'optionalAccess', _58 => _58.force]) || _bridgeActive)) {
3386
+ if (!(_optionalChain([options, 'optionalAccess', _59 => _59.force]) || _bridgeActive)) {
3364
3387
  return;
3365
3388
  }
3366
3389
  window.postMessage(fullMsg, "*");
@@ -3368,7 +3391,7 @@ function sendToPanel(message, options) {
3368
3391
  var eventSource = makeEventSource();
3369
3392
  if (process.env.NODE_ENV !== "production" && typeof window !== "undefined") {
3370
3393
  window.addEventListener("message", (event) => {
3371
- if (event.source === window && _optionalChain([event, 'access', _59 => _59.data, 'optionalAccess', _60 => _60.source]) === "liveblocks-devtools-panel") {
3394
+ if (event.source === window && _optionalChain([event, 'access', _60 => _60.data, 'optionalAccess', _61 => _61.source]) === "liveblocks-devtools-panel") {
3372
3395
  eventSource.notify(event.data);
3373
3396
  } else {
3374
3397
  }
@@ -3510,7 +3533,7 @@ function fullSync(room) {
3510
3533
  msg: "room::sync::full",
3511
3534
  roomId: room.id,
3512
3535
  status: room.getStatus(),
3513
- storage: _nullishCoalesce(_optionalChain([root, 'optionalAccess', _61 => _61.toTreeNode, 'call', _62 => _62("root"), 'access', _63 => _63.payload]), () => ( null)),
3536
+ storage: _nullishCoalesce(_optionalChain([root, 'optionalAccess', _62 => _62.toTreeNode, 'call', _63 => _63("root"), 'access', _64 => _64.payload]), () => ( null)),
3514
3537
  me,
3515
3538
  others
3516
3539
  });
@@ -3934,7 +3957,7 @@ var LiveRegister = class _LiveRegister extends AbstractCrdt {
3934
3957
  return [
3935
3958
  {
3936
3959
  type: 8 /* CREATE_REGISTER */,
3937
- opId: _optionalChain([pool, 'optionalAccess', _64 => _64.generateOpId, 'call', _65 => _65()]),
3960
+ opId: _optionalChain([pool, 'optionalAccess', _65 => _65.generateOpId, 'call', _66 => _66()]),
3938
3961
  id: this._id,
3939
3962
  parentId,
3940
3963
  parentKey,
@@ -4040,7 +4063,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
4040
4063
  const ops = [];
4041
4064
  const op = {
4042
4065
  id: this._id,
4043
- opId: _optionalChain([pool, 'optionalAccess', _66 => _66.generateOpId, 'call', _67 => _67()]),
4066
+ opId: _optionalChain([pool, 'optionalAccess', _67 => _67.generateOpId, 'call', _68 => _68()]),
4044
4067
  type: 2 /* CREATE_LIST */,
4045
4068
  parentId,
4046
4069
  parentKey
@@ -4311,7 +4334,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
4311
4334
  #applyInsertUndoRedo(op) {
4312
4335
  const { id, parentKey: key } = op;
4313
4336
  const child = creationOpToLiveNode(op);
4314
- if (_optionalChain([this, 'access', _68 => _68._pool, 'optionalAccess', _69 => _69.getNode, 'call', _70 => _70(id)]) !== void 0) {
4337
+ if (_optionalChain([this, 'access', _69 => _69._pool, 'optionalAccess', _70 => _70.getNode, 'call', _71 => _71(id)]) !== void 0) {
4315
4338
  return { modified: false };
4316
4339
  }
4317
4340
  child._attach(id, nn(this._pool));
@@ -4319,8 +4342,8 @@ var LiveList = class _LiveList extends AbstractCrdt {
4319
4342
  const existingItemIndex = this._indexOfPosition(key);
4320
4343
  let newKey = key;
4321
4344
  if (existingItemIndex !== -1) {
4322
- const before2 = _optionalChain([this, 'access', _71 => _71.#items, 'access', _72 => _72[existingItemIndex], 'optionalAccess', _73 => _73._parentPos]);
4323
- const after2 = _optionalChain([this, 'access', _74 => _74.#items, 'access', _75 => _75[existingItemIndex + 1], 'optionalAccess', _76 => _76._parentPos]);
4345
+ const before2 = _optionalChain([this, 'access', _72 => _72.#items, 'access', _73 => _73[existingItemIndex], 'optionalAccess', _74 => _74._parentPos]);
4346
+ const after2 = _optionalChain([this, 'access', _75 => _75.#items, 'access', _76 => _76[existingItemIndex + 1], 'optionalAccess', _77 => _77._parentPos]);
4324
4347
  newKey = makePosition(before2, after2);
4325
4348
  child._setParentLink(this, newKey);
4326
4349
  }
@@ -4334,7 +4357,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
4334
4357
  #applySetUndoRedo(op) {
4335
4358
  const { id, parentKey: key } = op;
4336
4359
  const child = creationOpToLiveNode(op);
4337
- if (_optionalChain([this, 'access', _77 => _77._pool, 'optionalAccess', _78 => _78.getNode, 'call', _79 => _79(id)]) !== void 0) {
4360
+ if (_optionalChain([this, 'access', _78 => _78._pool, 'optionalAccess', _79 => _79.getNode, 'call', _80 => _80(id)]) !== void 0) {
4338
4361
  return { modified: false };
4339
4362
  }
4340
4363
  this.#unacknowledgedSets.set(key, nn(op.opId));
@@ -4455,7 +4478,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
4455
4478
  } else {
4456
4479
  this.#items[existingItemIndex]._setParentLink(
4457
4480
  this,
4458
- makePosition(newKey, _optionalChain([this, 'access', _80 => _80.#items, 'access', _81 => _81[existingItemIndex + 1], 'optionalAccess', _82 => _82._parentPos]))
4481
+ makePosition(newKey, _optionalChain([this, 'access', _81 => _81.#items, 'access', _82 => _82[existingItemIndex + 1], 'optionalAccess', _83 => _83._parentPos]))
4459
4482
  );
4460
4483
  const previousIndex = this.#items.indexOf(child);
4461
4484
  child._setParentLink(this, newKey);
@@ -4480,7 +4503,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
4480
4503
  if (existingItemIndex !== -1) {
4481
4504
  this.#items[existingItemIndex]._setParentLink(
4482
4505
  this,
4483
- makePosition(newKey, _optionalChain([this, 'access', _83 => _83.#items, 'access', _84 => _84[existingItemIndex + 1], 'optionalAccess', _85 => _85._parentPos]))
4506
+ makePosition(newKey, _optionalChain([this, 'access', _84 => _84.#items, 'access', _85 => _85[existingItemIndex + 1], 'optionalAccess', _86 => _86._parentPos]))
4484
4507
  );
4485
4508
  }
4486
4509
  child._setParentLink(this, newKey);
@@ -4499,7 +4522,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
4499
4522
  if (existingItemIndex !== -1) {
4500
4523
  this.#items[existingItemIndex]._setParentLink(
4501
4524
  this,
4502
- makePosition(newKey, _optionalChain([this, 'access', _86 => _86.#items, 'access', _87 => _87[existingItemIndex + 1], 'optionalAccess', _88 => _88._parentPos]))
4525
+ makePosition(newKey, _optionalChain([this, 'access', _87 => _87.#items, 'access', _88 => _88[existingItemIndex + 1], 'optionalAccess', _89 => _89._parentPos]))
4503
4526
  );
4504
4527
  }
4505
4528
  child._setParentLink(this, newKey);
@@ -4526,7 +4549,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
4526
4549
  if (existingItemIndex !== -1) {
4527
4550
  this.#items[existingItemIndex]._setParentLink(
4528
4551
  this,
4529
- makePosition(newKey, _optionalChain([this, 'access', _89 => _89.#items, 'access', _90 => _90[existingItemIndex + 1], 'optionalAccess', _91 => _91._parentPos]))
4552
+ makePosition(newKey, _optionalChain([this, 'access', _90 => _90.#items, 'access', _91 => _91[existingItemIndex + 1], 'optionalAccess', _92 => _92._parentPos]))
4530
4553
  );
4531
4554
  }
4532
4555
  child._setParentLink(this, newKey);
@@ -4584,7 +4607,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
4584
4607
  * @param element The element to add to the end of the LiveList.
4585
4608
  */
4586
4609
  push(element) {
4587
- _optionalChain([this, 'access', _92 => _92._pool, 'optionalAccess', _93 => _93.assertStorageIsWritable, 'call', _94 => _94()]);
4610
+ _optionalChain([this, 'access', _93 => _93._pool, 'optionalAccess', _94 => _94.assertStorageIsWritable, 'call', _95 => _95()]);
4588
4611
  return this.insert(element, this.length);
4589
4612
  }
4590
4613
  /**
@@ -4593,7 +4616,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
4593
4616
  * @param index The index at which you want to insert the element.
4594
4617
  */
4595
4618
  insert(element, index) {
4596
- _optionalChain([this, 'access', _95 => _95._pool, 'optionalAccess', _96 => _96.assertStorageIsWritable, 'call', _97 => _97()]);
4619
+ _optionalChain([this, 'access', _96 => _96._pool, 'optionalAccess', _97 => _97.assertStorageIsWritable, 'call', _98 => _98()]);
4597
4620
  if (index < 0 || index > this.#items.length) {
4598
4621
  throw new Error(
4599
4622
  `Cannot insert list item at index "${index}". index should be between 0 and ${this.#items.length}`
@@ -4623,7 +4646,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
4623
4646
  * @param targetIndex The index where the element should be after moving.
4624
4647
  */
4625
4648
  move(index, targetIndex) {
4626
- _optionalChain([this, 'access', _98 => _98._pool, 'optionalAccess', _99 => _99.assertStorageIsWritable, 'call', _100 => _100()]);
4649
+ _optionalChain([this, 'access', _99 => _99._pool, 'optionalAccess', _100 => _100.assertStorageIsWritable, 'call', _101 => _101()]);
4627
4650
  if (targetIndex < 0) {
4628
4651
  throw new Error("targetIndex cannot be less than 0");
4629
4652
  }
@@ -4681,7 +4704,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
4681
4704
  * @param index The index of the element to delete
4682
4705
  */
4683
4706
  delete(index) {
4684
- _optionalChain([this, 'access', _101 => _101._pool, 'optionalAccess', _102 => _102.assertStorageIsWritable, 'call', _103 => _103()]);
4707
+ _optionalChain([this, 'access', _102 => _102._pool, 'optionalAccess', _103 => _103.assertStorageIsWritable, 'call', _104 => _104()]);
4685
4708
  if (index < 0 || index >= this.#items.length) {
4686
4709
  throw new Error(
4687
4710
  `Cannot delete list item at index "${index}". index should be between 0 and ${this.#items.length - 1}`
@@ -4714,7 +4737,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
4714
4737
  }
4715
4738
  }
4716
4739
  clear() {
4717
- _optionalChain([this, 'access', _104 => _104._pool, 'optionalAccess', _105 => _105.assertStorageIsWritable, 'call', _106 => _106()]);
4740
+ _optionalChain([this, 'access', _105 => _105._pool, 'optionalAccess', _106 => _106.assertStorageIsWritable, 'call', _107 => _107()]);
4718
4741
  if (this._pool) {
4719
4742
  const ops = [];
4720
4743
  const reverseOps = [];
@@ -4748,7 +4771,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
4748
4771
  }
4749
4772
  }
4750
4773
  set(index, item) {
4751
- _optionalChain([this, 'access', _107 => _107._pool, 'optionalAccess', _108 => _108.assertStorageIsWritable, 'call', _109 => _109()]);
4774
+ _optionalChain([this, 'access', _108 => _108._pool, 'optionalAccess', _109 => _109.assertStorageIsWritable, 'call', _110 => _110()]);
4752
4775
  if (index < 0 || index >= this.#items.length) {
4753
4776
  throw new Error(
4754
4777
  `Cannot set list item at index "${index}". index should be between 0 and ${this.#items.length - 1}`
@@ -4894,7 +4917,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
4894
4917
  #shiftItemPosition(index, key) {
4895
4918
  const shiftedPosition = makePosition(
4896
4919
  key,
4897
- this.#items.length > index + 1 ? _optionalChain([this, 'access', _110 => _110.#items, 'access', _111 => _111[index + 1], 'optionalAccess', _112 => _112._parentPos]) : void 0
4920
+ this.#items.length > index + 1 ? _optionalChain([this, 'access', _111 => _111.#items, 'access', _112 => _112[index + 1], 'optionalAccess', _113 => _113._parentPos]) : void 0
4898
4921
  );
4899
4922
  this.#items[index]._setParentLink(this, shiftedPosition);
4900
4923
  }
@@ -5019,7 +5042,7 @@ var LiveMap = class _LiveMap extends AbstractCrdt {
5019
5042
  const ops = [];
5020
5043
  const op = {
5021
5044
  id: this._id,
5022
- opId: _optionalChain([pool, 'optionalAccess', _113 => _113.generateOpId, 'call', _114 => _114()]),
5045
+ opId: _optionalChain([pool, 'optionalAccess', _114 => _114.generateOpId, 'call', _115 => _115()]),
5023
5046
  type: 7 /* CREATE_MAP */,
5024
5047
  parentId,
5025
5048
  parentKey
@@ -5154,7 +5177,7 @@ var LiveMap = class _LiveMap extends AbstractCrdt {
5154
5177
  * @param value The value of the element to add. Should be serializable to JSON.
5155
5178
  */
5156
5179
  set(key, value) {
5157
- _optionalChain([this, 'access', _115 => _115._pool, 'optionalAccess', _116 => _116.assertStorageIsWritable, 'call', _117 => _117()]);
5180
+ _optionalChain([this, 'access', _116 => _116._pool, 'optionalAccess', _117 => _117.assertStorageIsWritable, 'call', _118 => _118()]);
5158
5181
  const oldValue = this.#map.get(key);
5159
5182
  if (oldValue) {
5160
5183
  oldValue._detach();
@@ -5200,7 +5223,7 @@ var LiveMap = class _LiveMap extends AbstractCrdt {
5200
5223
  * @returns true if an element existed and has been removed, or false if the element does not exist.
5201
5224
  */
5202
5225
  delete(key) {
5203
- _optionalChain([this, 'access', _118 => _118._pool, 'optionalAccess', _119 => _119.assertStorageIsWritable, 'call', _120 => _120()]);
5226
+ _optionalChain([this, 'access', _119 => _119._pool, 'optionalAccess', _120 => _120.assertStorageIsWritable, 'call', _121 => _121()]);
5204
5227
  const item = this.#map.get(key);
5205
5228
  if (item === void 0) {
5206
5229
  return false;
@@ -5379,7 +5402,7 @@ var LiveObject = class _LiveObject extends AbstractCrdt {
5379
5402
  if (this._id === void 0) {
5380
5403
  throw new Error("Cannot serialize item is not attached");
5381
5404
  }
5382
- const opId = _optionalChain([pool, 'optionalAccess', _121 => _121.generateOpId, 'call', _122 => _122()]);
5405
+ const opId = _optionalChain([pool, 'optionalAccess', _122 => _122.generateOpId, 'call', _123 => _123()]);
5383
5406
  const ops = [];
5384
5407
  const op = {
5385
5408
  type: 4 /* CREATE_OBJECT */,
@@ -5651,7 +5674,7 @@ var LiveObject = class _LiveObject extends AbstractCrdt {
5651
5674
  * @param value The value of the property to add
5652
5675
  */
5653
5676
  set(key, value) {
5654
- _optionalChain([this, 'access', _123 => _123._pool, 'optionalAccess', _124 => _124.assertStorageIsWritable, 'call', _125 => _125()]);
5677
+ _optionalChain([this, 'access', _124 => _124._pool, 'optionalAccess', _125 => _125.assertStorageIsWritable, 'call', _126 => _126()]);
5655
5678
  this.update({ [key]: value });
5656
5679
  }
5657
5680
  /**
@@ -5666,7 +5689,7 @@ var LiveObject = class _LiveObject extends AbstractCrdt {
5666
5689
  * @param key The key of the property to delete
5667
5690
  */
5668
5691
  delete(key) {
5669
- _optionalChain([this, 'access', _126 => _126._pool, 'optionalAccess', _127 => _127.assertStorageIsWritable, 'call', _128 => _128()]);
5692
+ _optionalChain([this, 'access', _127 => _127._pool, 'optionalAccess', _128 => _128.assertStorageIsWritable, 'call', _129 => _129()]);
5670
5693
  const keyAsString = key;
5671
5694
  const oldValue = this.#map.get(keyAsString);
5672
5695
  if (oldValue === void 0) {
@@ -5719,7 +5742,7 @@ var LiveObject = class _LiveObject extends AbstractCrdt {
5719
5742
  * @param patch The object used to overrides properties
5720
5743
  */
5721
5744
  update(patch) {
5722
- _optionalChain([this, 'access', _129 => _129._pool, 'optionalAccess', _130 => _130.assertStorageIsWritable, 'call', _131 => _131()]);
5745
+ _optionalChain([this, 'access', _130 => _130._pool, 'optionalAccess', _131 => _131.assertStorageIsWritable, 'call', _132 => _132()]);
5723
5746
  if (this._pool === void 0 || this._id === void 0) {
5724
5747
  for (const key in patch) {
5725
5748
  const newValue = patch[key];
@@ -6339,6 +6362,8 @@ function defaultMessageFromContext(context) {
6339
6362
  return "Could not delete all inbox notifications";
6340
6363
  case "UPDATE_NOTIFICATION_SETTINGS_ERROR":
6341
6364
  return "Could not update notification settings";
6365
+ case "UPDATE_USER_NOTIFICATION_SETTINGS_ERROR":
6366
+ return "Could not update user notification settings";
6342
6367
  default:
6343
6368
  return assertNever(context, "Unhandled case");
6344
6369
  }
@@ -6368,15 +6393,15 @@ function installBackgroundTabSpy() {
6368
6393
  const doc = typeof document !== "undefined" ? document : void 0;
6369
6394
  const inBackgroundSince = { current: null };
6370
6395
  function onVisibilityChange() {
6371
- if (_optionalChain([doc, 'optionalAccess', _132 => _132.visibilityState]) === "hidden") {
6396
+ if (_optionalChain([doc, 'optionalAccess', _133 => _133.visibilityState]) === "hidden") {
6372
6397
  inBackgroundSince.current = _nullishCoalesce(inBackgroundSince.current, () => ( Date.now()));
6373
6398
  } else {
6374
6399
  inBackgroundSince.current = null;
6375
6400
  }
6376
6401
  }
6377
- _optionalChain([doc, 'optionalAccess', _133 => _133.addEventListener, 'call', _134 => _134("visibilitychange", onVisibilityChange)]);
6402
+ _optionalChain([doc, 'optionalAccess', _134 => _134.addEventListener, 'call', _135 => _135("visibilitychange", onVisibilityChange)]);
6378
6403
  const unsub = () => {
6379
- _optionalChain([doc, 'optionalAccess', _135 => _135.removeEventListener, 'call', _136 => _136("visibilitychange", onVisibilityChange)]);
6404
+ _optionalChain([doc, 'optionalAccess', _136 => _136.removeEventListener, 'call', _137 => _137("visibilitychange", onVisibilityChange)]);
6380
6405
  };
6381
6406
  return [inBackgroundSince, unsub];
6382
6407
  }
@@ -6561,7 +6586,7 @@ function createRoom(options, config) {
6561
6586
  }
6562
6587
  },
6563
6588
  assertStorageIsWritable: () => {
6564
- const scopes = _optionalChain([context, 'access', _137 => _137.dynamicSessionInfoSig, 'access', _138 => _138.get, 'call', _139 => _139(), 'optionalAccess', _140 => _140.scopes]);
6589
+ const scopes = _optionalChain([context, 'access', _138 => _138.dynamicSessionInfoSig, 'access', _139 => _139.get, 'call', _140 => _140(), 'optionalAccess', _141 => _141.scopes]);
6565
6590
  if (scopes === void 0) {
6566
6591
  return;
6567
6592
  }
@@ -6687,7 +6712,7 @@ function createRoom(options, config) {
6687
6712
  }
6688
6713
  case "experimental-fallback-to-http": {
6689
6714
  warn("Message is too large for websockets, so sending over HTTP instead");
6690
- const nonce = _nullishCoalesce(_optionalChain([context, 'access', _141 => _141.dynamicSessionInfoSig, 'access', _142 => _142.get, 'call', _143 => _143(), 'optionalAccess', _144 => _144.nonce]), () => ( raise("Session is not authorized to send message over HTTP")));
6715
+ const nonce = _nullishCoalesce(_optionalChain([context, 'access', _142 => _142.dynamicSessionInfoSig, 'access', _143 => _143.get, 'call', _144 => _144(), 'optionalAccess', _145 => _145.nonce]), () => ( raise("Session is not authorized to send message over HTTP")));
6691
6716
  void httpClient.sendMessages({ roomId, nonce, messages }).then((resp) => {
6692
6717
  if (!resp.ok && resp.status === 403) {
6693
6718
  managedSocket.reconnect();
@@ -6738,7 +6763,7 @@ function createRoom(options, config) {
6738
6763
  } else {
6739
6764
  context.root = LiveObject._fromItems(message.items, pool);
6740
6765
  }
6741
- const canWrite = _nullishCoalesce(_optionalChain([self, 'access', _145 => _145.get, 'call', _146 => _146(), 'optionalAccess', _147 => _147.canWrite]), () => ( true));
6766
+ const canWrite = _nullishCoalesce(_optionalChain([self, 'access', _146 => _146.get, 'call', _147 => _147(), 'optionalAccess', _148 => _148.canWrite]), () => ( true));
6742
6767
  const stackSizeBefore = context.undoStack.length;
6743
6768
  for (const key in context.initialStorage) {
6744
6769
  if (context.root.get(key) === void 0) {
@@ -6941,7 +6966,7 @@ function createRoom(options, config) {
6941
6966
  }
6942
6967
  context.myPresence.patch(patch);
6943
6968
  if (context.activeBatch) {
6944
- if (_optionalChain([options2, 'optionalAccess', _148 => _148.addToHistory])) {
6969
+ if (_optionalChain([options2, 'optionalAccess', _149 => _149.addToHistory])) {
6945
6970
  context.activeBatch.reverseOps.unshift({
6946
6971
  type: "presence",
6947
6972
  data: oldValues
@@ -6950,7 +6975,7 @@ function createRoom(options, config) {
6950
6975
  context.activeBatch.updates.presence = true;
6951
6976
  } else {
6952
6977
  flushNowOrSoon();
6953
- if (_optionalChain([options2, 'optionalAccess', _149 => _149.addToHistory])) {
6978
+ if (_optionalChain([options2, 'optionalAccess', _150 => _150.addToHistory])) {
6954
6979
  addToUndoStack([{ type: "presence", data: oldValues }]);
6955
6980
  }
6956
6981
  notify({ presence: true });
@@ -7147,7 +7172,7 @@ function createRoom(options, config) {
7147
7172
  if (process.env.NODE_ENV !== "production") {
7148
7173
  const traces = /* @__PURE__ */ new Set();
7149
7174
  for (const opId of message.opIds) {
7150
- const trace = _optionalChain([context, 'access', _150 => _150.opStackTraces, 'optionalAccess', _151 => _151.get, 'call', _152 => _152(opId)]);
7175
+ const trace = _optionalChain([context, 'access', _151 => _151.opStackTraces, 'optionalAccess', _152 => _152.get, 'call', _153 => _153(opId)]);
7151
7176
  if (trace) {
7152
7177
  traces.add(trace);
7153
7178
  }
@@ -7281,7 +7306,7 @@ ${Array.from(traces).join("\n\n")}`
7281
7306
  const unacknowledgedOps = new Map(context.unacknowledgedOps);
7282
7307
  createOrUpdateRootFromMessage(message);
7283
7308
  applyAndSendOps(unacknowledgedOps);
7284
- _optionalChain([_resolveStoragePromise, 'optionalCall', _153 => _153()]);
7309
+ _optionalChain([_resolveStoragePromise, 'optionalCall', _154 => _154()]);
7285
7310
  notifyStorageStatus();
7286
7311
  eventHub.storageDidLoad.notify();
7287
7312
  }
@@ -7503,8 +7528,8 @@ ${Array.from(traces).join("\n\n")}`
7503
7528
  async function getThreads(options2) {
7504
7529
  return httpClient.getThreads({
7505
7530
  roomId,
7506
- query: _optionalChain([options2, 'optionalAccess', _154 => _154.query]),
7507
- cursor: _optionalChain([options2, 'optionalAccess', _155 => _155.cursor])
7531
+ query: _optionalChain([options2, 'optionalAccess', _155 => _155.query]),
7532
+ cursor: _optionalChain([options2, 'optionalAccess', _156 => _156.cursor])
7508
7533
  });
7509
7534
  }
7510
7535
  async function getThread(threadId) {
@@ -7605,7 +7630,7 @@ ${Array.from(traces).join("\n\n")}`
7605
7630
  function getNotificationSettings(options2) {
7606
7631
  return httpClient.getNotificationSettings({
7607
7632
  roomId,
7608
- signal: _optionalChain([options2, 'optionalAccess', _156 => _156.signal])
7633
+ signal: _optionalChain([options2, 'optionalAccess', _157 => _157.signal])
7609
7634
  });
7610
7635
  }
7611
7636
  function updateNotificationSettings(settings) {
@@ -7627,7 +7652,7 @@ ${Array.from(traces).join("\n\n")}`
7627
7652
  {
7628
7653
  [kInternal]: {
7629
7654
  get presenceBuffer() {
7630
- return deepClone(_nullishCoalesce(_optionalChain([context, 'access', _157 => _157.buffer, 'access', _158 => _158.presenceUpdates, 'optionalAccess', _159 => _159.data]), () => ( null)));
7655
+ return deepClone(_nullishCoalesce(_optionalChain([context, 'access', _158 => _158.buffer, 'access', _159 => _159.presenceUpdates, 'optionalAccess', _160 => _160.data]), () => ( null)));
7631
7656
  },
7632
7657
  // prettier-ignore
7633
7658
  get undoStack() {
@@ -7642,9 +7667,9 @@ ${Array.from(traces).join("\n\n")}`
7642
7667
  return context.yjsProvider;
7643
7668
  },
7644
7669
  setYjsProvider(newProvider) {
7645
- _optionalChain([context, 'access', _160 => _160.yjsProvider, 'optionalAccess', _161 => _161.off, 'call', _162 => _162("status", yjsStatusDidChange)]);
7670
+ _optionalChain([context, 'access', _161 => _161.yjsProvider, 'optionalAccess', _162 => _162.off, 'call', _163 => _163("status", yjsStatusDidChange)]);
7646
7671
  context.yjsProvider = newProvider;
7647
- _optionalChain([newProvider, 'optionalAccess', _163 => _163.on, 'call', _164 => _164("status", yjsStatusDidChange)]);
7672
+ _optionalChain([newProvider, 'optionalAccess', _164 => _164.on, 'call', _165 => _165("status", yjsStatusDidChange)]);
7648
7673
  context.yjsProviderDidChange.notify();
7649
7674
  },
7650
7675
  yjsProviderDidChange: context.yjsProviderDidChange.observable,
@@ -7686,7 +7711,7 @@ ${Array.from(traces).join("\n\n")}`
7686
7711
  disconnect: () => managedSocket.disconnect(),
7687
7712
  destroy: () => {
7688
7713
  syncSourceForStorage.destroy();
7689
- _optionalChain([context, 'access', _165 => _165.yjsProvider, 'optionalAccess', _166 => _166.off, 'call', _167 => _167("status", yjsStatusDidChange)]);
7714
+ _optionalChain([context, 'access', _166 => _166.yjsProvider, 'optionalAccess', _167 => _167.off, 'call', _168 => _168("status", yjsStatusDidChange)]);
7690
7715
  syncSourceForYjs.destroy();
7691
7716
  uninstallBgTabSpy();
7692
7717
  managedSocket.destroy();
@@ -7830,7 +7855,7 @@ function makeClassicSubscribeFn(roomId, events, errorEvents) {
7830
7855
  }
7831
7856
  if (isLiveNode(first)) {
7832
7857
  const node = first;
7833
- if (_optionalChain([options, 'optionalAccess', _168 => _168.isDeep])) {
7858
+ if (_optionalChain([options, 'optionalAccess', _169 => _169.isDeep])) {
7834
7859
  const storageCallback = second;
7835
7860
  return subscribeToLiveStructureDeeply(node, storageCallback);
7836
7861
  } else {
@@ -7909,8 +7934,8 @@ function createClient(options) {
7909
7934
  const userId = token.k === "sec-legacy" /* SECRET_LEGACY */ ? token.id : token.uid;
7910
7935
  currentUserId.set(() => userId);
7911
7936
  });
7912
- const fetchPolyfill = _optionalChain([clientOptions, 'access', _169 => _169.polyfills, 'optionalAccess', _170 => _170.fetch]) || /* istanbul ignore next */
7913
- _optionalChain([globalThis, 'access', _171 => _171.fetch, 'optionalAccess', _172 => _172.bind, 'call', _173 => _173(globalThis)]);
7937
+ const fetchPolyfill = _optionalChain([clientOptions, 'access', _170 => _170.polyfills, 'optionalAccess', _171 => _171.fetch]) || /* istanbul ignore next */
7938
+ _optionalChain([globalThis, 'access', _172 => _172.fetch, 'optionalAccess', _173 => _173.bind, 'call', _174 => _174(globalThis)]);
7914
7939
  const httpClient = createApiClient({
7915
7940
  baseUrl,
7916
7941
  fetchPolyfill,
@@ -7961,7 +7986,7 @@ function createClient(options) {
7961
7986
  createSocket: makeCreateSocketDelegateForRoom(
7962
7987
  roomId,
7963
7988
  baseUrl,
7964
- _optionalChain([clientOptions, 'access', _174 => _174.polyfills, 'optionalAccess', _175 => _175.WebSocket])
7989
+ _optionalChain([clientOptions, 'access', _175 => _175.polyfills, 'optionalAccess', _176 => _176.WebSocket])
7965
7990
  ),
7966
7991
  authenticate: makeAuthDelegateForRoom(roomId, authManager)
7967
7992
  })),
@@ -7984,7 +8009,7 @@ function createClient(options) {
7984
8009
  const shouldConnect = _nullishCoalesce(options2.autoConnect, () => ( true));
7985
8010
  if (shouldConnect) {
7986
8011
  if (typeof atob === "undefined") {
7987
- if (_optionalChain([clientOptions, 'access', _176 => _176.polyfills, 'optionalAccess', _177 => _177.atob]) === void 0) {
8012
+ if (_optionalChain([clientOptions, 'access', _177 => _177.polyfills, 'optionalAccess', _178 => _178.atob]) === void 0) {
7988
8013
  throw new Error(
7989
8014
  "You need to polyfill atob to use the client in your environment. Please follow the instructions at https://liveblocks.io/docs/errors/liveblocks-client/atob-polyfill"
7990
8015
  );
@@ -7996,7 +8021,7 @@ function createClient(options) {
7996
8021
  return leaseRoom(newRoomDetails);
7997
8022
  }
7998
8023
  function getRoom(roomId) {
7999
- const room = _optionalChain([roomsById, 'access', _178 => _178.get, 'call', _179 => _179(roomId), 'optionalAccess', _180 => _180.room]);
8024
+ const room = _optionalChain([roomsById, 'access', _179 => _179.get, 'call', _180 => _180(roomId), 'optionalAccess', _181 => _181.room]);
8000
8025
  return room ? room : null;
8001
8026
  }
8002
8027
  function logout() {
@@ -8016,7 +8041,7 @@ function createClient(options) {
8016
8041
  const batchedResolveUsers = new Batch(
8017
8042
  async (batchedUserIds) => {
8018
8043
  const userIds = batchedUserIds.flat();
8019
- const users = await _optionalChain([resolveUsers, 'optionalCall', _181 => _181({ userIds })]);
8044
+ const users = await _optionalChain([resolveUsers, 'optionalCall', _182 => _182({ userIds })]);
8020
8045
  warnIfNoResolveUsers();
8021
8046
  return _nullishCoalesce(users, () => ( userIds.map(() => void 0)));
8022
8047
  },
@@ -8034,7 +8059,7 @@ function createClient(options) {
8034
8059
  const batchedResolveRoomsInfo = new Batch(
8035
8060
  async (batchedRoomIds) => {
8036
8061
  const roomIds = batchedRoomIds.flat();
8037
- const roomsInfo = await _optionalChain([resolveRoomsInfo, 'optionalCall', _182 => _182({ roomIds })]);
8062
+ const roomsInfo = await _optionalChain([resolveRoomsInfo, 'optionalCall', _183 => _183({ roomIds })]);
8038
8063
  warnIfNoResolveRoomsInfo();
8039
8064
  return _nullishCoalesce(roomsInfo, () => ( roomIds.map(() => void 0)));
8040
8065
  },
@@ -8087,7 +8112,7 @@ function createClient(options) {
8087
8112
  }
8088
8113
  };
8089
8114
  const win = typeof window !== "undefined" ? window : void 0;
8090
- _optionalChain([win, 'optionalAccess', _183 => _183.addEventListener, 'call', _184 => _184("beforeunload", maybePreventClose)]);
8115
+ _optionalChain([win, 'optionalAccess', _184 => _184.addEventListener, 'call', _185 => _185("beforeunload", maybePreventClose)]);
8091
8116
  }
8092
8117
  const client = Object.defineProperty(
8093
8118
  {
@@ -8102,6 +8127,9 @@ function createClient(options) {
8102
8127
  markInboxNotificationAsRead: httpClient.markInboxNotificationAsRead,
8103
8128
  deleteAllInboxNotifications: httpClient.deleteAllInboxNotifications,
8104
8129
  deleteInboxNotification: httpClient.deleteInboxNotification,
8130
+ // Public channel notification settings API
8131
+ getNotificationSettings: httpClient.getUserNotificationSettings,
8132
+ updateNotificationSettings: httpClient.updateUserNotificationSettings,
8105
8133
  // Advanced resolvers APIs
8106
8134
  resolvers: {
8107
8135
  invalidateUsers: invalidateResolvedUsers,
@@ -8212,7 +8240,7 @@ var commentBodyElementsTypes = {
8212
8240
  mention: "inline"
8213
8241
  };
8214
8242
  function traverseCommentBody(body, elementOrVisitor, possiblyVisitor) {
8215
- if (!body || !_optionalChain([body, 'optionalAccess', _185 => _185.content])) {
8243
+ if (!body || !_optionalChain([body, 'optionalAccess', _186 => _186.content])) {
8216
8244
  return;
8217
8245
  }
8218
8246
  const element = typeof elementOrVisitor === "string" ? elementOrVisitor : void 0;
@@ -8222,13 +8250,13 @@ function traverseCommentBody(body, elementOrVisitor, possiblyVisitor) {
8222
8250
  for (const block of body.content) {
8223
8251
  if (type === "all" || type === "block") {
8224
8252
  if (guard(block)) {
8225
- _optionalChain([visitor, 'optionalCall', _186 => _186(block)]);
8253
+ _optionalChain([visitor, 'optionalCall', _187 => _187(block)]);
8226
8254
  }
8227
8255
  }
8228
8256
  if (type === "all" || type === "inline") {
8229
8257
  for (const inline of block.children) {
8230
8258
  if (guard(inline)) {
8231
- _optionalChain([visitor, 'optionalCall', _187 => _187(inline)]);
8259
+ _optionalChain([visitor, 'optionalCall', _188 => _188(inline)]);
8232
8260
  }
8233
8261
  }
8234
8262
  }
@@ -8253,7 +8281,7 @@ async function resolveUsersInCommentBody(body, resolveUsers) {
8253
8281
  userIds
8254
8282
  });
8255
8283
  for (const [index, userId] of userIds.entries()) {
8256
- const user = _optionalChain([users, 'optionalAccess', _188 => _188[index]]);
8284
+ const user = _optionalChain([users, 'optionalAccess', _189 => _189[index]]);
8257
8285
  if (user) {
8258
8286
  resolvedUsers.set(userId, user);
8259
8287
  }
@@ -8298,9 +8326,9 @@ function escapeHtml(value) {
8298
8326
  var HtmlSafeString = class {
8299
8327
  #strings;
8300
8328
  #values;
8301
- constructor(strings, values) {
8329
+ constructor(strings, values2) {
8302
8330
  this.#strings = strings;
8303
- this.#values = values;
8331
+ this.#values = values2;
8304
8332
  }
8305
8333
  toString() {
8306
8334
  return this.#strings.reduce((result, str, i) => {
@@ -8308,8 +8336,8 @@ var HtmlSafeString = class {
8308
8336
  });
8309
8337
  }
8310
8338
  };
8311
- function html(strings, ...values) {
8312
- return new HtmlSafeString(strings, values);
8339
+ function html(strings, ...values2) {
8340
+ return new HtmlSafeString(strings, values2);
8313
8341
  }
8314
8342
  var markdownEscapables = {
8315
8343
  _: "\\_",
@@ -8354,9 +8382,9 @@ function escapeMarkdown(value) {
8354
8382
  var MarkdownSafeString = class {
8355
8383
  #strings;
8356
8384
  #values;
8357
- constructor(strings, values) {
8385
+ constructor(strings, values2) {
8358
8386
  this.#strings = strings;
8359
- this.#values = values;
8387
+ this.#values = values2;
8360
8388
  }
8361
8389
  toString() {
8362
8390
  return this.#strings.reduce((result, str, i) => {
@@ -8364,8 +8392,8 @@ var MarkdownSafeString = class {
8364
8392
  });
8365
8393
  }
8366
8394
  };
8367
- function markdown(strings, ...values) {
8368
- return new MarkdownSafeString(strings, values);
8395
+ function markdown(strings, ...values2) {
8396
+ return new MarkdownSafeString(strings, values2);
8369
8397
  }
8370
8398
  function toAbsoluteUrl(url2) {
8371
8399
  if (url2.startsWith("http://") || url2.startsWith("https://")) {
@@ -8380,7 +8408,7 @@ var stringifyCommentBodyPlainElements = {
8380
8408
  text: ({ element }) => element.text,
8381
8409
  link: ({ element }) => _nullishCoalesce(element.text, () => ( element.url)),
8382
8410
  mention: ({ element, user }) => {
8383
- return `@${_nullishCoalesce(_optionalChain([user, 'optionalAccess', _189 => _189.name]), () => ( element.id))}`;
8411
+ return `@${_nullishCoalesce(_optionalChain([user, 'optionalAccess', _190 => _190.name]), () => ( element.id))}`;
8384
8412
  }
8385
8413
  };
8386
8414
  var stringifyCommentBodyHtmlElements = {
@@ -8410,7 +8438,7 @@ var stringifyCommentBodyHtmlElements = {
8410
8438
  return html`<a href="${href}" target="_blank" rel="noopener noreferrer">${_nullishCoalesce(element.text, () => ( element.url))}</a>`;
8411
8439
  },
8412
8440
  mention: ({ element, user }) => {
8413
- return html`<span data-mention>@${_nullishCoalesce(_optionalChain([user, 'optionalAccess', _190 => _190.name]), () => ( element.id))}</span>`;
8441
+ return html`<span data-mention>@${_nullishCoalesce(_optionalChain([user, 'optionalAccess', _191 => _191.name]), () => ( element.id))}</span>`;
8414
8442
  }
8415
8443
  };
8416
8444
  var stringifyCommentBodyMarkdownElements = {
@@ -8440,19 +8468,19 @@ var stringifyCommentBodyMarkdownElements = {
8440
8468
  return markdown`[${_nullishCoalesce(element.text, () => ( element.url))}](${href})`;
8441
8469
  },
8442
8470
  mention: ({ element, user }) => {
8443
- return markdown`@${_nullishCoalesce(_optionalChain([user, 'optionalAccess', _191 => _191.name]), () => ( element.id))}`;
8471
+ return markdown`@${_nullishCoalesce(_optionalChain([user, 'optionalAccess', _192 => _192.name]), () => ( element.id))}`;
8444
8472
  }
8445
8473
  };
8446
8474
  async function stringifyCommentBody(body, options) {
8447
- const format = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _192 => _192.format]), () => ( "plain"));
8448
- const separator = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _193 => _193.separator]), () => ( (format === "markdown" ? "\n\n" : "\n")));
8475
+ const format = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _193 => _193.format]), () => ( "plain"));
8476
+ const separator = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _194 => _194.separator]), () => ( (format === "markdown" ? "\n\n" : "\n")));
8449
8477
  const elements = {
8450
8478
  ...format === "html" ? stringifyCommentBodyHtmlElements : format === "markdown" ? stringifyCommentBodyMarkdownElements : stringifyCommentBodyPlainElements,
8451
- ..._optionalChain([options, 'optionalAccess', _194 => _194.elements])
8479
+ ..._optionalChain([options, 'optionalAccess', _195 => _195.elements])
8452
8480
  };
8453
8481
  const resolvedUsers = await resolveUsersInCommentBody(
8454
8482
  body,
8455
- _optionalChain([options, 'optionalAccess', _195 => _195.resolveUsers])
8483
+ _optionalChain([options, 'optionalAccess', _196 => _196.resolveUsers])
8456
8484
  );
8457
8485
  const blocks = body.content.flatMap((block, blockIndex) => {
8458
8486
  switch (block.type) {
@@ -8743,12 +8771,12 @@ function legacy_patchImmutableNode(state, path, update) {
8743
8771
  }
8744
8772
  const newState = Object.assign({}, state);
8745
8773
  for (const key in update.updates) {
8746
- if (_optionalChain([update, 'access', _196 => _196.updates, 'access', _197 => _197[key], 'optionalAccess', _198 => _198.type]) === "update") {
8774
+ if (_optionalChain([update, 'access', _197 => _197.updates, 'access', _198 => _198[key], 'optionalAccess', _199 => _199.type]) === "update") {
8747
8775
  const val = update.node.get(key);
8748
8776
  if (val !== void 0) {
8749
8777
  newState[key] = lsonToJson(val);
8750
8778
  }
8751
- } else if (_optionalChain([update, 'access', _199 => _199.updates, 'access', _200 => _200[key], 'optionalAccess', _201 => _201.type]) === "delete") {
8779
+ } else if (_optionalChain([update, 'access', _200 => _200.updates, 'access', _201 => _201[key], 'optionalAccess', _202 => _202.type]) === "delete") {
8752
8780
  delete newState[key];
8753
8781
  }
8754
8782
  }
@@ -8809,12 +8837,12 @@ function legacy_patchImmutableNode(state, path, update) {
8809
8837
  }
8810
8838
  const newState = Object.assign({}, state);
8811
8839
  for (const key in update.updates) {
8812
- if (_optionalChain([update, 'access', _202 => _202.updates, 'access', _203 => _203[key], 'optionalAccess', _204 => _204.type]) === "update") {
8840
+ if (_optionalChain([update, 'access', _203 => _203.updates, 'access', _204 => _204[key], 'optionalAccess', _205 => _205.type]) === "update") {
8813
8841
  const value = update.node.get(key);
8814
8842
  if (value !== void 0) {
8815
8843
  newState[key] = lsonToJson(value);
8816
8844
  }
8817
- } else if (_optionalChain([update, 'access', _205 => _205.updates, 'access', _206 => _206[key], 'optionalAccess', _207 => _207.type]) === "delete") {
8845
+ } else if (_optionalChain([update, 'access', _206 => _206.updates, 'access', _207 => _207[key], 'optionalAccess', _208 => _208.type]) === "delete") {
8818
8846
  delete newState[key];
8819
8847
  }
8820
8848
  }
@@ -8885,9 +8913,9 @@ function makePoller(callback, intervalMs, options) {
8885
8913
  const startTime = performance.now();
8886
8914
  const doc = typeof document !== "undefined" ? document : void 0;
8887
8915
  const win = typeof window !== "undefined" ? window : void 0;
8888
- const maxStaleTimeMs = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _208 => _208.maxStaleTimeMs]), () => ( Number.POSITIVE_INFINITY));
8916
+ const maxStaleTimeMs = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _209 => _209.maxStaleTimeMs]), () => ( Number.POSITIVE_INFINITY));
8889
8917
  const context = {
8890
- inForeground: _optionalChain([doc, 'optionalAccess', _209 => _209.visibilityState]) !== "hidden",
8918
+ inForeground: _optionalChain([doc, 'optionalAccess', _210 => _210.visibilityState]) !== "hidden",
8891
8919
  lastSuccessfulPollAt: startTime,
8892
8920
  count: 0,
8893
8921
  backoff: 0
@@ -8965,11 +8993,11 @@ function makePoller(callback, intervalMs, options) {
8965
8993
  pollNowIfStale();
8966
8994
  }
8967
8995
  function onVisibilityChange() {
8968
- setInForeground(_optionalChain([doc, 'optionalAccess', _210 => _210.visibilityState]) !== "hidden");
8996
+ setInForeground(_optionalChain([doc, 'optionalAccess', _211 => _211.visibilityState]) !== "hidden");
8969
8997
  }
8970
- _optionalChain([doc, 'optionalAccess', _211 => _211.addEventListener, 'call', _212 => _212("visibilitychange", onVisibilityChange)]);
8971
- _optionalChain([win, 'optionalAccess', _213 => _213.addEventListener, 'call', _214 => _214("online", onVisibilityChange)]);
8972
- _optionalChain([win, 'optionalAccess', _215 => _215.addEventListener, 'call', _216 => _216("focus", pollNowIfStale)]);
8998
+ _optionalChain([doc, 'optionalAccess', _212 => _212.addEventListener, 'call', _213 => _213("visibilitychange", onVisibilityChange)]);
8999
+ _optionalChain([win, 'optionalAccess', _214 => _214.addEventListener, 'call', _215 => _215("online", onVisibilityChange)]);
9000
+ _optionalChain([win, 'optionalAccess', _216 => _216.addEventListener, 'call', _217 => _217("focus", pollNowIfStale)]);
8973
9001
  fsm.start();
8974
9002
  return {
8975
9003
  inc,
@@ -9091,6 +9119,11 @@ var SortedList = class _SortedList {
9091
9119
  }
9092
9120
  };
9093
9121
 
9122
+ // src/protocol/UserNotificationSettings.ts
9123
+ function isNotificationChannelEnabled(settings) {
9124
+ return values(settings).every((enabled) => enabled === true);
9125
+ }
9126
+
9094
9127
  // src/types/Others.ts
9095
9128
  var TextEditorType = /* @__PURE__ */ ((TextEditorType2) => {
9096
9129
  TextEditorType2["Lexical"] = "lexical";
@@ -9188,5 +9221,8 @@ var NotificationsApiError = HttpError;
9188
9221
 
9189
9222
 
9190
9223
 
9191
- exports.ClientMsgCode = ClientMsgCode; exports.CommentsApiError = CommentsApiError; exports.CrdtType = CrdtType; exports.DefaultMap = DefaultMap; exports.DerivedSignal = DerivedSignal; exports.HttpError = HttpError; exports.LiveList = LiveList; exports.LiveMap = LiveMap; exports.LiveObject = LiveObject; exports.LiveblocksError = LiveblocksError; exports.MutableSignal = MutableSignal; exports.NotificationsApiError = NotificationsApiError; exports.OpCode = OpCode; exports.Permission = Permission; exports.Promise_withResolvers = Promise_withResolvers; exports.ServerMsgCode = ServerMsgCode; exports.Signal = Signal; exports.SortedList = SortedList; exports.TextEditorType = TextEditorType; exports.WebsocketCloseCodes = WebsocketCloseCodes; exports.ackOp = ackOp; exports.asPos = asPos; exports.assert = assert; exports.assertNever = assertNever; exports.autoRetry = autoRetry; exports.b64decode = b64decode; exports.batch = batch; exports.chunk = chunk; exports.cloneLson = cloneLson; exports.compactObject = compactObject; exports.console = fancy_console_exports; exports.convertToCommentData = convertToCommentData; exports.convertToCommentUserReaction = convertToCommentUserReaction; exports.convertToInboxNotificationData = convertToInboxNotificationData; exports.convertToThreadData = convertToThreadData; exports.createClient = createClient; exports.createCommentAttachmentId = createCommentAttachmentId; exports.createCommentId = createCommentId; exports.createInboxNotificationId = createInboxNotificationId; exports.createThreadId = createThreadId; exports.deprecate = deprecate; exports.deprecateIf = deprecateIf; exports.detectDupes = detectDupes; exports.errorIf = errorIf; exports.freeze = freeze; exports.generateCommentUrl = generateCommentUrl; exports.getMentionedIdsFromCommentBody = getMentionedIdsFromCommentBody; exports.html = html; exports.htmlSafe = htmlSafe; exports.isChildCrdt = isChildCrdt; exports.isCommentBodyLink = isCommentBodyLink; exports.isCommentBodyMention = isCommentBodyMention; exports.isCommentBodyText = isCommentBodyText; exports.isJsonArray = isJsonArray; exports.isJsonObject = isJsonObject; exports.isJsonScalar = isJsonScalar; exports.isLiveNode = isLiveNode; exports.isPlainObject = isPlainObject; exports.isRootCrdt = isRootCrdt; exports.isStartsWithOperator = isStartsWithOperator; exports.kInternal = kInternal; exports.legacy_patchImmutableObject = legacy_patchImmutableObject; exports.lsonToJson = lsonToJson; exports.makeEventSource = makeEventSource; exports.makePoller = makePoller; exports.makePosition = makePosition; exports.mapValues = mapValues; exports.memoizeOnSuccess = memoizeOnSuccess; exports.nanoid = nanoid; exports.nn = nn; exports.objectToQuery = objectToQuery; exports.patchLiveObjectKey = patchLiveObjectKey; exports.raise = raise; exports.resolveUsersInCommentBody = resolveUsersInCommentBody; exports.shallow = shallow; exports.stringify = stringify; exports.stringifyCommentBody = stringifyCommentBody; exports.throwUsageError = throwUsageError; exports.toAbsoluteUrl = toAbsoluteUrl; exports.toPlainLson = toPlainLson; exports.tryParseJson = tryParseJson; exports.url = url; exports.urljoin = urljoin; exports.wait = wait; exports.withTimeout = withTimeout;
9224
+
9225
+
9226
+
9227
+ exports.ClientMsgCode = ClientMsgCode; exports.CommentsApiError = CommentsApiError; exports.CrdtType = CrdtType; exports.DefaultMap = DefaultMap; exports.DerivedSignal = DerivedSignal; exports.HttpError = HttpError; exports.LiveList = LiveList; exports.LiveMap = LiveMap; exports.LiveObject = LiveObject; exports.LiveblocksError = LiveblocksError; exports.MutableSignal = MutableSignal; exports.NotificationsApiError = NotificationsApiError; exports.OpCode = OpCode; exports.Permission = Permission; exports.Promise_withResolvers = Promise_withResolvers; exports.ServerMsgCode = ServerMsgCode; exports.Signal = Signal; exports.SortedList = SortedList; exports.TextEditorType = TextEditorType; exports.WebsocketCloseCodes = WebsocketCloseCodes; exports.ackOp = ackOp; exports.asPos = asPos; exports.assert = assert; exports.assertNever = assertNever; exports.autoRetry = autoRetry; exports.b64decode = b64decode; exports.batch = batch; exports.chunk = chunk; exports.cloneLson = cloneLson; exports.compactObject = compactObject; exports.console = fancy_console_exports; exports.convertToCommentData = convertToCommentData; exports.convertToCommentUserReaction = convertToCommentUserReaction; exports.convertToInboxNotificationData = convertToInboxNotificationData; exports.convertToThreadData = convertToThreadData; exports.createClient = createClient; exports.createCommentAttachmentId = createCommentAttachmentId; exports.createCommentId = createCommentId; exports.createInboxNotificationId = createInboxNotificationId; exports.createThreadId = createThreadId; exports.deprecate = deprecate; exports.deprecateIf = deprecateIf; exports.detectDupes = detectDupes; exports.entries = entries; exports.errorIf = errorIf; exports.freeze = freeze; exports.generateCommentUrl = generateCommentUrl; exports.getMentionedIdsFromCommentBody = getMentionedIdsFromCommentBody; exports.html = html; exports.htmlSafe = htmlSafe; exports.isChildCrdt = isChildCrdt; exports.isCommentBodyLink = isCommentBodyLink; exports.isCommentBodyMention = isCommentBodyMention; exports.isCommentBodyText = isCommentBodyText; exports.isJsonArray = isJsonArray; exports.isJsonObject = isJsonObject; exports.isJsonScalar = isJsonScalar; exports.isLiveNode = isLiveNode; exports.isNotificationChannelEnabled = isNotificationChannelEnabled; exports.isPlainObject = isPlainObject; exports.isRootCrdt = isRootCrdt; exports.isStartsWithOperator = isStartsWithOperator; exports.kInternal = kInternal; exports.keys = keys; exports.legacy_patchImmutableObject = legacy_patchImmutableObject; exports.lsonToJson = lsonToJson; exports.makeEventSource = makeEventSource; exports.makePoller = makePoller; exports.makePosition = makePosition; exports.mapValues = mapValues; exports.memoizeOnSuccess = memoizeOnSuccess; exports.nanoid = nanoid; exports.nn = nn; exports.objectToQuery = objectToQuery; exports.patchLiveObjectKey = patchLiveObjectKey; exports.raise = raise; exports.resolveUsersInCommentBody = resolveUsersInCommentBody; exports.shallow = shallow; exports.stringify = stringify; exports.stringifyCommentBody = stringifyCommentBody; exports.throwUsageError = throwUsageError; exports.toAbsoluteUrl = toAbsoluteUrl; exports.toPlainLson = toPlainLson; exports.tryParseJson = tryParseJson; exports.url = url; exports.urljoin = urljoin; exports.wait = wait; exports.withTimeout = withTimeout;
9192
9228
  //# sourceMappingURL=index.js.map