@liveblocks/core 3.15.0-components1 → 3.15.0-feeds2

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.cjs 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 = "3.15.0-components1";
9
+ var PKG_VERSION = "3.15.0-feeds2";
10
10
  var PKG_FORMAT = "cjs";
11
11
 
12
12
  // src/dupe-detection.ts
@@ -3219,6 +3219,15 @@ var ServerMsgCode = Object.freeze({
3219
3219
  COMMENT_REACTION_ADDED: 405,
3220
3220
  COMMENT_REACTION_REMOVED: 406,
3221
3221
  COMMENT_METADATA_UPDATED: 409,
3222
+ // For Feeds
3223
+ FEEDS_LIST: 500,
3224
+ FEEDS_ADDED: 501,
3225
+ FEEDS_UPDATED: 502,
3226
+ FEEDS_DELETED: 503,
3227
+ FEED_MESSAGES_LIST: 504,
3228
+ FEED_MESSAGES_ADDED: 505,
3229
+ FEED_MESSAGES_UPDATED: 506,
3230
+ FEED_MESSAGES_DELETED: 507,
3222
3231
  // Error codes
3223
3232
  REJECT_STORAGE_OP: 299
3224
3233
  // Sent if a mutation was not allowed on the server (i.e. due to permissions, limit exceeded, etc)
@@ -8774,7 +8783,16 @@ var ClientMsgCode = Object.freeze({
8774
8783
  UPDATE_STORAGE: 201,
8775
8784
  // For Yjs support
8776
8785
  FETCH_YDOC: 300,
8777
- UPDATE_YDOC: 301
8786
+ UPDATE_YDOC: 301,
8787
+ // For Feeds
8788
+ FETCH_FEEDS: 510,
8789
+ FETCH_FEED_MESSAGES: 511,
8790
+ ADD_FEED: 512,
8791
+ UPDATE_FEED: 513,
8792
+ DELETE_FEED: 514,
8793
+ ADD_FEED_MESSAGE: 515,
8794
+ UPDATE_FEED_MESSAGE: 516,
8795
+ DELETE_FEED_MESSAGE: 517
8778
8796
  });
8779
8797
 
8780
8798
  // src/refs/ManagedOthers.ts
@@ -9250,6 +9268,7 @@ function createRoom(options, config) {
9250
9268
  storageStatus: makeEventSource(),
9251
9269
  ydoc: makeEventSource(),
9252
9270
  comments: makeEventSource(),
9271
+ feeds: makeEventSource(),
9253
9272
  roomWillDestroy: makeEventSource()
9254
9273
  };
9255
9274
  async function createTextMention(mentionId, mention) {
@@ -9783,6 +9802,64 @@ function createRoom(options, config) {
9783
9802
  eventHub.comments.notify(message);
9784
9803
  break;
9785
9804
  }
9805
+ case ServerMsgCode.FEEDS_LIST: {
9806
+ const feedsListMsg = message;
9807
+ const pending = pendingFeedsRequests.get(feedsListMsg.requestId);
9808
+ if (pending) {
9809
+ pending.resolve({
9810
+ feeds: feedsListMsg.feeds,
9811
+ nextCursor: feedsListMsg.nextCursor
9812
+ });
9813
+ pendingFeedsRequests.delete(feedsListMsg.requestId);
9814
+ }
9815
+ eventHub.feeds.notify(feedsListMsg);
9816
+ break;
9817
+ }
9818
+ case ServerMsgCode.FEEDS_ADDED: {
9819
+ const feedsAddedMsg = message;
9820
+ eventHub.feeds.notify(feedsAddedMsg);
9821
+ break;
9822
+ }
9823
+ case ServerMsgCode.FEEDS_UPDATED: {
9824
+ const feedsUpdatedMsg = message;
9825
+ eventHub.feeds.notify(feedsUpdatedMsg);
9826
+ break;
9827
+ }
9828
+ case ServerMsgCode.FEEDS_DELETED: {
9829
+ const feedsDeletedMsg = message;
9830
+ eventHub.feeds.notify(feedsDeletedMsg);
9831
+ break;
9832
+ }
9833
+ case ServerMsgCode.FEED_MESSAGES_LIST: {
9834
+ const feedMsgsListMsg = message;
9835
+ const pending = pendingFeedMessagesRequests.get(
9836
+ feedMsgsListMsg.requestId
9837
+ );
9838
+ if (pending) {
9839
+ pending.resolve({
9840
+ messages: feedMsgsListMsg.messages,
9841
+ nextCursor: feedMsgsListMsg.nextCursor
9842
+ });
9843
+ pendingFeedMessagesRequests.delete(feedMsgsListMsg.requestId);
9844
+ }
9845
+ eventHub.feeds.notify(feedMsgsListMsg);
9846
+ break;
9847
+ }
9848
+ case ServerMsgCode.FEED_MESSAGES_ADDED: {
9849
+ const feedMsgsAddedMsg = message;
9850
+ eventHub.feeds.notify(feedMsgsAddedMsg);
9851
+ break;
9852
+ }
9853
+ case ServerMsgCode.FEED_MESSAGES_UPDATED: {
9854
+ const feedMsgsUpdatedMsg = message;
9855
+ eventHub.feeds.notify(feedMsgsUpdatedMsg);
9856
+ break;
9857
+ }
9858
+ case ServerMsgCode.FEED_MESSAGES_DELETED: {
9859
+ const feedMsgsDeletedMsg = message;
9860
+ eventHub.feeds.notify(feedMsgsDeletedMsg);
9861
+ break;
9862
+ }
9786
9863
  case ServerMsgCode.STORAGE_STATE_V7:
9787
9864
  // No longer used in V8
9788
9865
  default:
@@ -9886,6 +9963,8 @@ function createRoom(options, config) {
9886
9963
  }
9887
9964
  let _getStorage$ = null;
9888
9965
  let _resolveStoragePromise = null;
9966
+ const pendingFeedsRequests = /* @__PURE__ */ new Map();
9967
+ const pendingFeedMessagesRequests = /* @__PURE__ */ new Map();
9889
9968
  function processInitialStorage(nodes) {
9890
9969
  const unacknowledgedOps = new Map(context.unacknowledgedOps);
9891
9970
  createOrUpdateRootFromMessage(nodes);
@@ -9957,6 +10036,107 @@ function createRoom(options, config) {
9957
10036
  }
9958
10037
  flushNowOrSoon();
9959
10038
  }
10039
+ async function fetchFeeds(options2) {
10040
+ const requestId = nanoid();
10041
+ const { promise, resolve, reject } = Promise_withResolvers();
10042
+ pendingFeedsRequests.set(requestId, { resolve, reject });
10043
+ const message = {
10044
+ type: ClientMsgCode.FETCH_FEEDS,
10045
+ requestId,
10046
+ cursor: _optionalChain([options2, 'optionalAccess', _222 => _222.cursor]),
10047
+ since: _optionalChain([options2, 'optionalAccess', _223 => _223.since]),
10048
+ limit: _optionalChain([options2, 'optionalAccess', _224 => _224.limit]),
10049
+ metadata: _optionalChain([options2, 'optionalAccess', _225 => _225.metadata])
10050
+ };
10051
+ context.buffer.messages.push(message);
10052
+ flushNowOrSoon();
10053
+ setTimeout(() => {
10054
+ if (pendingFeedsRequests.has(requestId)) {
10055
+ pendingFeedsRequests.delete(requestId);
10056
+ reject(new Error("Feeds fetch timeout"));
10057
+ }
10058
+ }, 3e4);
10059
+ return promise;
10060
+ }
10061
+ async function fetchFeedMessages(feedId, options2) {
10062
+ const requestId = nanoid();
10063
+ const { promise, resolve, reject } = Promise_withResolvers();
10064
+ pendingFeedMessagesRequests.set(requestId, { resolve, reject });
10065
+ const message = {
10066
+ type: ClientMsgCode.FETCH_FEED_MESSAGES,
10067
+ requestId,
10068
+ feedId,
10069
+ cursor: _optionalChain([options2, 'optionalAccess', _226 => _226.cursor]),
10070
+ since: _optionalChain([options2, 'optionalAccess', _227 => _227.since]),
10071
+ limit: _optionalChain([options2, 'optionalAccess', _228 => _228.limit])
10072
+ };
10073
+ context.buffer.messages.push(message);
10074
+ flushNowOrSoon();
10075
+ setTimeout(() => {
10076
+ if (pendingFeedMessagesRequests.has(requestId)) {
10077
+ pendingFeedMessagesRequests.delete(requestId);
10078
+ reject(new Error("Feed messages fetch timeout"));
10079
+ }
10080
+ }, 3e4);
10081
+ return promise;
10082
+ }
10083
+ function addFeed(feedId, options2) {
10084
+ const message = {
10085
+ type: ClientMsgCode.ADD_FEED,
10086
+ feedId,
10087
+ metadata: _optionalChain([options2, 'optionalAccess', _229 => _229.metadata]),
10088
+ timestamp: _optionalChain([options2, 'optionalAccess', _230 => _230.timestamp])
10089
+ };
10090
+ context.buffer.messages.push(message);
10091
+ flushNowOrSoon();
10092
+ }
10093
+ function updateFeed(feedId, metadata) {
10094
+ const message = {
10095
+ type: ClientMsgCode.UPDATE_FEED,
10096
+ feedId,
10097
+ metadata
10098
+ };
10099
+ context.buffer.messages.push(message);
10100
+ flushNowOrSoon();
10101
+ }
10102
+ function deleteFeed(feedId) {
10103
+ const message = {
10104
+ type: ClientMsgCode.DELETE_FEED,
10105
+ feedId
10106
+ };
10107
+ context.buffer.messages.push(message);
10108
+ flushNowOrSoon();
10109
+ }
10110
+ function addFeedMessage(feedId, data, options2) {
10111
+ const message = {
10112
+ type: ClientMsgCode.ADD_FEED_MESSAGE,
10113
+ feedId,
10114
+ data,
10115
+ id: _optionalChain([options2, 'optionalAccess', _231 => _231.id]),
10116
+ timestamp: _optionalChain([options2, 'optionalAccess', _232 => _232.timestamp])
10117
+ };
10118
+ context.buffer.messages.push(message);
10119
+ flushNowOrSoon();
10120
+ }
10121
+ function updateFeedMessage(feedId, messageId, data) {
10122
+ const message = {
10123
+ type: ClientMsgCode.UPDATE_FEED_MESSAGE,
10124
+ feedId,
10125
+ messageId,
10126
+ data
10127
+ };
10128
+ context.buffer.messages.push(message);
10129
+ flushNowOrSoon();
10130
+ }
10131
+ function deleteFeedMessage(feedId, messageId) {
10132
+ const message = {
10133
+ type: ClientMsgCode.DELETE_FEED_MESSAGE,
10134
+ feedId,
10135
+ messageId
10136
+ };
10137
+ context.buffer.messages.push(message);
10138
+ flushNowOrSoon();
10139
+ }
9960
10140
  function undo() {
9961
10141
  if (context.activeBatch) {
9962
10142
  throw new Error("undo is not allowed during a batch");
@@ -10099,6 +10279,7 @@ function createRoom(options, config) {
10099
10279
  storageStatus: eventHub.storageStatus.observable,
10100
10280
  ydoc: eventHub.ydoc.observable,
10101
10281
  comments: eventHub.comments.observable,
10282
+ feeds: eventHub.feeds.observable,
10102
10283
  roomWillDestroy: eventHub.roomWillDestroy.observable
10103
10284
  };
10104
10285
  async function getThreadsSince(options2) {
@@ -10111,8 +10292,8 @@ function createRoom(options, config) {
10111
10292
  async function getThreads(options2) {
10112
10293
  return httpClient.getThreads({
10113
10294
  roomId,
10114
- query: _optionalChain([options2, 'optionalAccess', _222 => _222.query]),
10115
- cursor: _optionalChain([options2, 'optionalAccess', _223 => _223.cursor])
10295
+ query: _optionalChain([options2, 'optionalAccess', _233 => _233.query]),
10296
+ cursor: _optionalChain([options2, 'optionalAccess', _234 => _234.cursor])
10116
10297
  });
10117
10298
  }
10118
10299
  async function getThread(threadId) {
@@ -10234,7 +10415,7 @@ function createRoom(options, config) {
10234
10415
  function getSubscriptionSettings(options2) {
10235
10416
  return httpClient.getSubscriptionSettings({
10236
10417
  roomId,
10237
- signal: _optionalChain([options2, 'optionalAccess', _224 => _224.signal])
10418
+ signal: _optionalChain([options2, 'optionalAccess', _235 => _235.signal])
10238
10419
  });
10239
10420
  }
10240
10421
  function updateSubscriptionSettings(settings) {
@@ -10256,7 +10437,7 @@ function createRoom(options, config) {
10256
10437
  {
10257
10438
  [kInternal]: {
10258
10439
  get presenceBuffer() {
10259
- return deepClone(_nullishCoalesce(_optionalChain([context, 'access', _225 => _225.buffer, 'access', _226 => _226.presenceUpdates, 'optionalAccess', _227 => _227.data]), () => ( null)));
10440
+ return deepClone(_nullishCoalesce(_optionalChain([context, 'access', _236 => _236.buffer, 'access', _237 => _237.presenceUpdates, 'optionalAccess', _238 => _238.data]), () => ( null)));
10260
10441
  },
10261
10442
  // prettier-ignore
10262
10443
  get undoStack() {
@@ -10271,9 +10452,9 @@ function createRoom(options, config) {
10271
10452
  return context.yjsProvider;
10272
10453
  },
10273
10454
  setYjsProvider(newProvider) {
10274
- _optionalChain([context, 'access', _228 => _228.yjsProvider, 'optionalAccess', _229 => _229.off, 'call', _230 => _230("status", yjsStatusDidChange)]);
10455
+ _optionalChain([context, 'access', _239 => _239.yjsProvider, 'optionalAccess', _240 => _240.off, 'call', _241 => _241("status", yjsStatusDidChange)]);
10275
10456
  context.yjsProvider = newProvider;
10276
- _optionalChain([newProvider, 'optionalAccess', _231 => _231.on, 'call', _232 => _232("status", yjsStatusDidChange)]);
10457
+ _optionalChain([newProvider, 'optionalAccess', _242 => _242.on, 'call', _243 => _243("status", yjsStatusDidChange)]);
10277
10458
  context.yjsProviderDidChange.notify();
10278
10459
  },
10279
10460
  yjsProviderDidChange: context.yjsProviderDidChange.observable,
@@ -10307,7 +10488,7 @@ function createRoom(options, config) {
10307
10488
  id: roomId,
10308
10489
  subscribe: makeClassicSubscribeFn(
10309
10490
  roomId,
10310
- events,
10491
+ eventHub,
10311
10492
  config.errorEventSource
10312
10493
  ),
10313
10494
  connect: () => managedSocket.connect(),
@@ -10319,7 +10500,7 @@ function createRoom(options, config) {
10319
10500
  source.dispose();
10320
10501
  }
10321
10502
  eventHub.roomWillDestroy.notify();
10322
- _optionalChain([context, 'access', _233 => _233.yjsProvider, 'optionalAccess', _234 => _234.off, 'call', _235 => _235("status", yjsStatusDidChange)]);
10503
+ _optionalChain([context, 'access', _244 => _244.yjsProvider, 'optionalAccess', _245 => _245.off, 'call', _246 => _246("status", yjsStatusDidChange)]);
10323
10504
  syncSourceForStorage.destroy();
10324
10505
  syncSourceForYjs.destroy();
10325
10506
  uninstallBgTabSpy();
@@ -10342,6 +10523,14 @@ function createRoom(options, config) {
10342
10523
  resume: resumeHistory
10343
10524
  },
10344
10525
  fetchYDoc,
10526
+ fetchFeeds,
10527
+ fetchFeedMessages,
10528
+ addFeed,
10529
+ updateFeed,
10530
+ deleteFeed,
10531
+ addFeedMessage,
10532
+ updateFeedMessage,
10533
+ deleteFeedMessage,
10345
10534
  getStorage,
10346
10535
  getStorageSnapshot,
10347
10536
  getStorageStatus,
@@ -10470,7 +10659,7 @@ function makeClassicSubscribeFn(roomId, events, errorEvents) {
10470
10659
  }
10471
10660
  if (isLiveNode(first)) {
10472
10661
  const node = first;
10473
- if (_optionalChain([options, 'optionalAccess', _236 => _236.isDeep])) {
10662
+ if (_optionalChain([options, 'optionalAccess', _247 => _247.isDeep])) {
10474
10663
  const storageCallback = second;
10475
10664
  return subscribeToLiveStructureDeeply(node, storageCallback);
10476
10665
  } else {
@@ -10559,8 +10748,8 @@ function createClient(options) {
10559
10748
  const authManager = createAuthManager(options, (token) => {
10560
10749
  currentUserId.set(() => token.uid);
10561
10750
  });
10562
- const fetchPolyfill = _optionalChain([clientOptions, 'access', _237 => _237.polyfills, 'optionalAccess', _238 => _238.fetch]) || /* istanbul ignore next */
10563
- _optionalChain([globalThis, 'access', _239 => _239.fetch, 'optionalAccess', _240 => _240.bind, 'call', _241 => _241(globalThis)]);
10751
+ const fetchPolyfill = _optionalChain([clientOptions, 'access', _248 => _248.polyfills, 'optionalAccess', _249 => _249.fetch]) || /* istanbul ignore next */
10752
+ _optionalChain([globalThis, 'access', _250 => _250.fetch, 'optionalAccess', _251 => _251.bind, 'call', _252 => _252(globalThis)]);
10564
10753
  const httpClient = createApiClient({
10565
10754
  baseUrl,
10566
10755
  fetchPolyfill,
@@ -10578,7 +10767,7 @@ function createClient(options) {
10578
10767
  delegates: {
10579
10768
  createSocket: makeCreateSocketDelegateForAi(
10580
10769
  baseUrl,
10581
- _optionalChain([clientOptions, 'access', _242 => _242.polyfills, 'optionalAccess', _243 => _243.WebSocket])
10770
+ _optionalChain([clientOptions, 'access', _253 => _253.polyfills, 'optionalAccess', _254 => _254.WebSocket])
10582
10771
  ),
10583
10772
  authenticate: async () => {
10584
10773
  const resp = await authManager.getAuthValue({
@@ -10638,7 +10827,7 @@ function createClient(options) {
10638
10827
  createSocket: makeCreateSocketDelegateForRoom(
10639
10828
  roomId,
10640
10829
  baseUrl,
10641
- _optionalChain([clientOptions, 'access', _244 => _244.polyfills, 'optionalAccess', _245 => _245.WebSocket]),
10830
+ _optionalChain([clientOptions, 'access', _255 => _255.polyfills, 'optionalAccess', _256 => _256.WebSocket]),
10642
10831
  options2.engine
10643
10832
  ),
10644
10833
  authenticate: makeAuthDelegateForRoom(roomId, authManager)
@@ -10662,7 +10851,7 @@ function createClient(options) {
10662
10851
  const shouldConnect = _nullishCoalesce(options2.autoConnect, () => ( true));
10663
10852
  if (shouldConnect) {
10664
10853
  if (typeof atob === "undefined") {
10665
- if (_optionalChain([clientOptions, 'access', _246 => _246.polyfills, 'optionalAccess', _247 => _247.atob]) === void 0) {
10854
+ if (_optionalChain([clientOptions, 'access', _257 => _257.polyfills, 'optionalAccess', _258 => _258.atob]) === void 0) {
10666
10855
  throw new Error(
10667
10856
  "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"
10668
10857
  );
@@ -10674,7 +10863,7 @@ function createClient(options) {
10674
10863
  return leaseRoom(newRoomDetails);
10675
10864
  }
10676
10865
  function getRoom(roomId) {
10677
- const room = _optionalChain([roomsById, 'access', _248 => _248.get, 'call', _249 => _249(roomId), 'optionalAccess', _250 => _250.room]);
10866
+ const room = _optionalChain([roomsById, 'access', _259 => _259.get, 'call', _260 => _260(roomId), 'optionalAccess', _261 => _261.room]);
10678
10867
  return room ? room : null;
10679
10868
  }
10680
10869
  function logout() {
@@ -10690,7 +10879,7 @@ function createClient(options) {
10690
10879
  const batchedResolveUsers = new Batch(
10691
10880
  async (batchedUserIds) => {
10692
10881
  const userIds = batchedUserIds.flat();
10693
- const users = await _optionalChain([resolveUsers, 'optionalCall', _251 => _251({ userIds })]);
10882
+ const users = await _optionalChain([resolveUsers, 'optionalCall', _262 => _262({ userIds })]);
10694
10883
  warnOnceIf(
10695
10884
  !resolveUsers,
10696
10885
  "Set the resolveUsers option in createClient to specify user info."
@@ -10707,7 +10896,7 @@ function createClient(options) {
10707
10896
  const batchedResolveRoomsInfo = new Batch(
10708
10897
  async (batchedRoomIds) => {
10709
10898
  const roomIds = batchedRoomIds.flat();
10710
- const roomsInfo = await _optionalChain([resolveRoomsInfo, 'optionalCall', _252 => _252({ roomIds })]);
10899
+ const roomsInfo = await _optionalChain([resolveRoomsInfo, 'optionalCall', _263 => _263({ roomIds })]);
10711
10900
  warnOnceIf(
10712
10901
  !resolveRoomsInfo,
10713
10902
  "Set the resolveRoomsInfo option in createClient to specify room info."
@@ -10724,7 +10913,7 @@ function createClient(options) {
10724
10913
  const batchedResolveGroupsInfo = new Batch(
10725
10914
  async (batchedGroupIds) => {
10726
10915
  const groupIds = batchedGroupIds.flat();
10727
- const groupsInfo = await _optionalChain([resolveGroupsInfo, 'optionalCall', _253 => _253({ groupIds })]);
10916
+ const groupsInfo = await _optionalChain([resolveGroupsInfo, 'optionalCall', _264 => _264({ groupIds })]);
10728
10917
  warnOnceIf(
10729
10918
  !resolveGroupsInfo,
10730
10919
  "Set the resolveGroupsInfo option in createClient to specify group info."
@@ -10780,7 +10969,7 @@ function createClient(options) {
10780
10969
  }
10781
10970
  };
10782
10971
  const win = typeof window !== "undefined" ? window : void 0;
10783
- _optionalChain([win, 'optionalAccess', _254 => _254.addEventListener, 'call', _255 => _255("beforeunload", maybePreventClose)]);
10972
+ _optionalChain([win, 'optionalAccess', _265 => _265.addEventListener, 'call', _266 => _266("beforeunload", maybePreventClose)]);
10784
10973
  }
10785
10974
  async function getNotificationSettings(options2) {
10786
10975
  const plainSettings = await httpClient.getNotificationSettings(options2);
@@ -10907,7 +11096,7 @@ var commentBodyElementsTypes = {
10907
11096
  mention: "inline"
10908
11097
  };
10909
11098
  function traverseCommentBody(body, elementOrVisitor, possiblyVisitor) {
10910
- if (!body || !_optionalChain([body, 'optionalAccess', _256 => _256.content])) {
11099
+ if (!body || !_optionalChain([body, 'optionalAccess', _267 => _267.content])) {
10911
11100
  return;
10912
11101
  }
10913
11102
  const element = typeof elementOrVisitor === "string" ? elementOrVisitor : void 0;
@@ -10917,13 +11106,13 @@ function traverseCommentBody(body, elementOrVisitor, possiblyVisitor) {
10917
11106
  for (const block of body.content) {
10918
11107
  if (type === "all" || type === "block") {
10919
11108
  if (guard(block)) {
10920
- _optionalChain([visitor, 'optionalCall', _257 => _257(block)]);
11109
+ _optionalChain([visitor, 'optionalCall', _268 => _268(block)]);
10921
11110
  }
10922
11111
  }
10923
11112
  if (type === "all" || type === "inline") {
10924
11113
  for (const inline of block.children) {
10925
11114
  if (guard(inline)) {
10926
- _optionalChain([visitor, 'optionalCall', _258 => _258(inline)]);
11115
+ _optionalChain([visitor, 'optionalCall', _269 => _269(inline)]);
10927
11116
  }
10928
11117
  }
10929
11118
  }
@@ -11093,7 +11282,7 @@ var stringifyCommentBodyPlainElements = {
11093
11282
  text: ({ element }) => element.text,
11094
11283
  link: ({ element }) => _nullishCoalesce(element.text, () => ( element.url)),
11095
11284
  mention: ({ element, user, group }) => {
11096
- return `@${_nullishCoalesce(_nullishCoalesce(_optionalChain([user, 'optionalAccess', _259 => _259.name]), () => ( _optionalChain([group, 'optionalAccess', _260 => _260.name]))), () => ( element.id))}`;
11285
+ return `@${_nullishCoalesce(_nullishCoalesce(_optionalChain([user, 'optionalAccess', _270 => _270.name]), () => ( _optionalChain([group, 'optionalAccess', _271 => _271.name]))), () => ( element.id))}`;
11097
11286
  }
11098
11287
  };
11099
11288
  var stringifyCommentBodyHtmlElements = {
@@ -11123,7 +11312,7 @@ var stringifyCommentBodyHtmlElements = {
11123
11312
  return html`<a href="${href}" target="_blank" rel="noopener noreferrer">${element.text ? html`${element.text}` : element.url}</a>`;
11124
11313
  },
11125
11314
  mention: ({ element, user, group }) => {
11126
- return html`<span data-mention>@${_optionalChain([user, 'optionalAccess', _261 => _261.name]) ? html`${_optionalChain([user, 'optionalAccess', _262 => _262.name])}` : _optionalChain([group, 'optionalAccess', _263 => _263.name]) ? html`${_optionalChain([group, 'optionalAccess', _264 => _264.name])}` : element.id}</span>`;
11315
+ return html`<span data-mention>@${_optionalChain([user, 'optionalAccess', _272 => _272.name]) ? html`${_optionalChain([user, 'optionalAccess', _273 => _273.name])}` : _optionalChain([group, 'optionalAccess', _274 => _274.name]) ? html`${_optionalChain([group, 'optionalAccess', _275 => _275.name])}` : element.id}</span>`;
11127
11316
  }
11128
11317
  };
11129
11318
  var stringifyCommentBodyMarkdownElements = {
@@ -11153,20 +11342,20 @@ var stringifyCommentBodyMarkdownElements = {
11153
11342
  return markdown`[${_nullishCoalesce(element.text, () => ( element.url))}](${href})`;
11154
11343
  },
11155
11344
  mention: ({ element, user, group }) => {
11156
- return markdown`@${_nullishCoalesce(_nullishCoalesce(_optionalChain([user, 'optionalAccess', _265 => _265.name]), () => ( _optionalChain([group, 'optionalAccess', _266 => _266.name]))), () => ( element.id))}`;
11345
+ return markdown`@${_nullishCoalesce(_nullishCoalesce(_optionalChain([user, 'optionalAccess', _276 => _276.name]), () => ( _optionalChain([group, 'optionalAccess', _277 => _277.name]))), () => ( element.id))}`;
11157
11346
  }
11158
11347
  };
11159
11348
  async function stringifyCommentBody(body, options) {
11160
- const format = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _267 => _267.format]), () => ( "plain"));
11161
- const separator = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _268 => _268.separator]), () => ( (format === "markdown" ? "\n\n" : "\n")));
11349
+ const format = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _278 => _278.format]), () => ( "plain"));
11350
+ const separator = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _279 => _279.separator]), () => ( (format === "markdown" ? "\n\n" : "\n")));
11162
11351
  const elements = {
11163
11352
  ...format === "html" ? stringifyCommentBodyHtmlElements : format === "markdown" ? stringifyCommentBodyMarkdownElements : stringifyCommentBodyPlainElements,
11164
- ..._optionalChain([options, 'optionalAccess', _269 => _269.elements])
11353
+ ..._optionalChain([options, 'optionalAccess', _280 => _280.elements])
11165
11354
  };
11166
11355
  const { users: resolvedUsers, groups: resolvedGroupsInfo } = await resolveMentionsInCommentBody(
11167
11356
  body,
11168
- _optionalChain([options, 'optionalAccess', _270 => _270.resolveUsers]),
11169
- _optionalChain([options, 'optionalAccess', _271 => _271.resolveGroupsInfo])
11357
+ _optionalChain([options, 'optionalAccess', _281 => _281.resolveUsers]),
11358
+ _optionalChain([options, 'optionalAccess', _282 => _282.resolveGroupsInfo])
11170
11359
  );
11171
11360
  const blocks = body.content.flatMap((block, blockIndex) => {
11172
11361
  switch (block.type) {
@@ -11453,12 +11642,12 @@ function legacy_patchImmutableNode(state, path, update) {
11453
11642
  }
11454
11643
  const newState = Object.assign({}, state);
11455
11644
  for (const key in update.updates) {
11456
- if (_optionalChain([update, 'access', _272 => _272.updates, 'access', _273 => _273[key], 'optionalAccess', _274 => _274.type]) === "update") {
11645
+ if (_optionalChain([update, 'access', _283 => _283.updates, 'access', _284 => _284[key], 'optionalAccess', _285 => _285.type]) === "update") {
11457
11646
  const val = update.node.get(key);
11458
11647
  if (val !== void 0) {
11459
11648
  newState[key] = lsonToJson(val);
11460
11649
  }
11461
- } else if (_optionalChain([update, 'access', _275 => _275.updates, 'access', _276 => _276[key], 'optionalAccess', _277 => _277.type]) === "delete") {
11650
+ } else if (_optionalChain([update, 'access', _286 => _286.updates, 'access', _287 => _287[key], 'optionalAccess', _288 => _288.type]) === "delete") {
11462
11651
  delete newState[key];
11463
11652
  }
11464
11653
  }
@@ -11519,12 +11708,12 @@ function legacy_patchImmutableNode(state, path, update) {
11519
11708
  }
11520
11709
  const newState = Object.assign({}, state);
11521
11710
  for (const key in update.updates) {
11522
- if (_optionalChain([update, 'access', _278 => _278.updates, 'access', _279 => _279[key], 'optionalAccess', _280 => _280.type]) === "update") {
11711
+ if (_optionalChain([update, 'access', _289 => _289.updates, 'access', _290 => _290[key], 'optionalAccess', _291 => _291.type]) === "update") {
11523
11712
  const value = update.node.get(key);
11524
11713
  if (value !== void 0) {
11525
11714
  newState[key] = lsonToJson(value);
11526
11715
  }
11527
- } else if (_optionalChain([update, 'access', _281 => _281.updates, 'access', _282 => _282[key], 'optionalAccess', _283 => _283.type]) === "delete") {
11716
+ } else if (_optionalChain([update, 'access', _292 => _292.updates, 'access', _293 => _293[key], 'optionalAccess', _294 => _294.type]) === "delete") {
11528
11717
  delete newState[key];
11529
11718
  }
11530
11719
  }
@@ -11604,9 +11793,9 @@ function makePoller(callback, intervalMs, options) {
11604
11793
  const startTime = performance.now();
11605
11794
  const doc = typeof document !== "undefined" ? document : void 0;
11606
11795
  const win = typeof window !== "undefined" ? window : void 0;
11607
- const maxStaleTimeMs = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _284 => _284.maxStaleTimeMs]), () => ( Number.POSITIVE_INFINITY));
11796
+ const maxStaleTimeMs = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _295 => _295.maxStaleTimeMs]), () => ( Number.POSITIVE_INFINITY));
11608
11797
  const context = {
11609
- inForeground: _optionalChain([doc, 'optionalAccess', _285 => _285.visibilityState]) !== "hidden",
11798
+ inForeground: _optionalChain([doc, 'optionalAccess', _296 => _296.visibilityState]) !== "hidden",
11610
11799
  lastSuccessfulPollAt: startTime,
11611
11800
  count: 0,
11612
11801
  backoff: 0
@@ -11687,11 +11876,11 @@ function makePoller(callback, intervalMs, options) {
11687
11876
  pollNowIfStale();
11688
11877
  }
11689
11878
  function onVisibilityChange() {
11690
- setInForeground(_optionalChain([doc, 'optionalAccess', _286 => _286.visibilityState]) !== "hidden");
11879
+ setInForeground(_optionalChain([doc, 'optionalAccess', _297 => _297.visibilityState]) !== "hidden");
11691
11880
  }
11692
- _optionalChain([doc, 'optionalAccess', _287 => _287.addEventListener, 'call', _288 => _288("visibilitychange", onVisibilityChange)]);
11693
- _optionalChain([win, 'optionalAccess', _289 => _289.addEventListener, 'call', _290 => _290("online", onVisibilityChange)]);
11694
- _optionalChain([win, 'optionalAccess', _291 => _291.addEventListener, 'call', _292 => _292("focus", pollNowIfStale)]);
11881
+ _optionalChain([doc, 'optionalAccess', _298 => _298.addEventListener, 'call', _299 => _299("visibilitychange", onVisibilityChange)]);
11882
+ _optionalChain([win, 'optionalAccess', _300 => _300.addEventListener, 'call', _301 => _301("online", onVisibilityChange)]);
11883
+ _optionalChain([win, 'optionalAccess', _302 => _302.addEventListener, 'call', _303 => _303("focus", pollNowIfStale)]);
11695
11884
  fsm.start();
11696
11885
  return {
11697
11886
  inc,