@liveblocks/core 3.10.1 → 3.11.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.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.10.1";
9
+ var PKG_VERSION = "3.11.0";
10
10
  var PKG_FORMAT = "cjs";
11
11
 
12
12
  // src/dupe-detection.ts
@@ -1572,6 +1572,26 @@ function createApiClient({
1572
1572
  throw err;
1573
1573
  }
1574
1574
  }
1575
+ async function searchComments(options, requestOptions) {
1576
+ const result = await httpClient.get(
1577
+ url`/v2/c/rooms/${options.roomId}/threads/comments/search`,
1578
+ await authManager.getAuthValue({
1579
+ requestedScope: "comments:read",
1580
+ roomId: options.roomId
1581
+ }),
1582
+ {
1583
+ text: options.query.text,
1584
+ query: objectToQuery({
1585
+ threadMetadata: options.query.threadMetadata,
1586
+ threadResolved: options.query.threadResolved,
1587
+ hasAttachments: options.query.hasAttachments,
1588
+ hasMentions: options.query.hasMentions
1589
+ })
1590
+ },
1591
+ { signal: _optionalChain([requestOptions, 'optionalAccess', _15 => _15.signal]) }
1592
+ );
1593
+ return result;
1594
+ }
1575
1595
  async function createThread(options) {
1576
1596
  const commentId = _nullishCoalesce(options.commentId, () => ( createCommentId()));
1577
1597
  const threadId = _nullishCoalesce(options.threadId, () => ( createThreadId()));
@@ -1743,11 +1763,11 @@ function createApiClient({
1743
1763
  `Upload of attachment ${options.attachment.id} was aborted.`,
1744
1764
  "AbortError"
1745
1765
  ) : void 0;
1746
- if (_optionalChain([abortSignal, 'optionalAccess', _15 => _15.aborted])) {
1766
+ if (_optionalChain([abortSignal, 'optionalAccess', _16 => _16.aborted])) {
1747
1767
  throw abortError;
1748
1768
  }
1749
1769
  const handleRetryError = (err) => {
1750
- if (_optionalChain([abortSignal, 'optionalAccess', _16 => _16.aborted])) {
1770
+ if (_optionalChain([abortSignal, 'optionalAccess', _17 => _17.aborted])) {
1751
1771
  throw abortError;
1752
1772
  }
1753
1773
  if (err instanceof HttpError && err.status === 413) {
@@ -1819,7 +1839,7 @@ function createApiClient({
1819
1839
  try {
1820
1840
  uploadId = createMultiPartUpload.uploadId;
1821
1841
  const parts = splitFileIntoParts(attachment.file);
1822
- if (_optionalChain([abortSignal, 'optionalAccess', _17 => _17.aborted])) {
1842
+ if (_optionalChain([abortSignal, 'optionalAccess', _18 => _18.aborted])) {
1823
1843
  throw abortError;
1824
1844
  }
1825
1845
  const batches = chunk(parts, 5);
@@ -1846,7 +1866,7 @@ function createApiClient({
1846
1866
  }
1847
1867
  uploadedParts.push(...await Promise.all(uploadedPartsPromises));
1848
1868
  }
1849
- if (_optionalChain([abortSignal, 'optionalAccess', _18 => _18.aborted])) {
1869
+ if (_optionalChain([abortSignal, 'optionalAccess', _19 => _19.aborted])) {
1850
1870
  throw abortError;
1851
1871
  }
1852
1872
  const sortedUploadedParts = uploadedParts.sort(
@@ -1862,7 +1882,7 @@ function createApiClient({
1862
1882
  { signal: abortSignal }
1863
1883
  );
1864
1884
  } catch (error3) {
1865
- if (uploadId && _optionalChain([error3, 'optionalAccess', _19 => _19.name]) && (error3.name === "AbortError" || error3.name === "TimeoutError")) {
1885
+ if (uploadId && _optionalChain([error3, 'optionalAccess', _20 => _20.name]) && (error3.name === "AbortError" || error3.name === "TimeoutError")) {
1866
1886
  try {
1867
1887
  await httpClient.rawDelete(
1868
1888
  url`/v2/c/rooms/${roomId}/attachments/${attachment.id}/multipart/${uploadId}`,
@@ -2191,14 +2211,14 @@ function createApiClient({
2191
2211
  async function getInboxNotifications(options) {
2192
2212
  const PAGE_SIZE = 50;
2193
2213
  let query;
2194
- if (_optionalChain([options, 'optionalAccess', _20 => _20.query])) {
2214
+ if (_optionalChain([options, 'optionalAccess', _21 => _21.query])) {
2195
2215
  query = objectToQuery(options.query);
2196
2216
  }
2197
2217
  const json = await httpClient.get(
2198
2218
  url`/v2/c/inbox-notifications`,
2199
2219
  await authManager.getAuthValue({ requestedScope: "comments:read" }),
2200
2220
  {
2201
- cursor: _optionalChain([options, 'optionalAccess', _21 => _21.cursor]),
2221
+ cursor: _optionalChain([options, 'optionalAccess', _22 => _22.cursor]),
2202
2222
  limit: PAGE_SIZE,
2203
2223
  query
2204
2224
  }
@@ -2217,7 +2237,7 @@ function createApiClient({
2217
2237
  }
2218
2238
  async function getInboxNotificationsSince(options) {
2219
2239
  let query;
2220
- if (_optionalChain([options, 'optionalAccess', _22 => _22.query])) {
2240
+ if (_optionalChain([options, 'optionalAccess', _23 => _23.query])) {
2221
2241
  query = objectToQuery(options.query);
2222
2242
  }
2223
2243
  const json = await httpClient.get(
@@ -2246,14 +2266,14 @@ function createApiClient({
2246
2266
  }
2247
2267
  async function getUnreadInboxNotificationsCount(options) {
2248
2268
  let query;
2249
- if (_optionalChain([options, 'optionalAccess', _23 => _23.query])) {
2269
+ if (_optionalChain([options, 'optionalAccess', _24 => _24.query])) {
2250
2270
  query = objectToQuery(options.query);
2251
2271
  }
2252
2272
  const { count } = await httpClient.get(
2253
2273
  url`/v2/c/inbox-notifications/count`,
2254
2274
  await authManager.getAuthValue({ requestedScope: "comments:read" }),
2255
2275
  { query },
2256
- { signal: _optionalChain([options, 'optionalAccess', _24 => _24.signal]) }
2276
+ { signal: _optionalChain([options, 'optionalAccess', _25 => _25.signal]) }
2257
2277
  );
2258
2278
  return count;
2259
2279
  }
@@ -2303,7 +2323,7 @@ function createApiClient({
2303
2323
  url`/v2/c/notification-settings`,
2304
2324
  await authManager.getAuthValue({ requestedScope: "comments:read" }),
2305
2325
  void 0,
2306
- { signal: _optionalChain([options, 'optionalAccess', _25 => _25.signal]) }
2326
+ { signal: _optionalChain([options, 'optionalAccess', _26 => _26.signal]) }
2307
2327
  );
2308
2328
  }
2309
2329
  async function updateNotificationSettings(settings) {
@@ -2315,7 +2335,7 @@ function createApiClient({
2315
2335
  }
2316
2336
  async function getUserThreads_experimental(options) {
2317
2337
  let query;
2318
- if (_optionalChain([options, 'optionalAccess', _26 => _26.query])) {
2338
+ if (_optionalChain([options, 'optionalAccess', _27 => _27.query])) {
2319
2339
  query = objectToQuery(options.query);
2320
2340
  }
2321
2341
  const PAGE_SIZE = 50;
@@ -2323,7 +2343,7 @@ function createApiClient({
2323
2343
  url`/v2/c/threads`,
2324
2344
  await authManager.getAuthValue({ requestedScope: "comments:read" }),
2325
2345
  {
2326
- cursor: _optionalChain([options, 'optionalAccess', _27 => _27.cursor]),
2346
+ cursor: _optionalChain([options, 'optionalAccess', _28 => _28.cursor]),
2327
2347
  query,
2328
2348
  limit: PAGE_SIZE
2329
2349
  }
@@ -2399,6 +2419,7 @@ function createApiClient({
2399
2419
  // Room threads
2400
2420
  getThreads,
2401
2421
  getThreadsSince,
2422
+ searchComments,
2402
2423
  createThread,
2403
2424
  getThread,
2404
2425
  deleteThread,
@@ -2498,7 +2519,7 @@ var HttpClient = class {
2498
2519
  // These headers are default, but can be overriden by custom headers
2499
2520
  "Content-Type": "application/json; charset=utf-8",
2500
2521
  // Possible header overrides
2501
- ..._optionalChain([options, 'optionalAccess', _28 => _28.headers]),
2522
+ ..._optionalChain([options, 'optionalAccess', _29 => _29.headers]),
2502
2523
  // Cannot be overriden by custom headers
2503
2524
  Authorization: `Bearer ${getBearerTokenFromAuthValue(authValue)}`,
2504
2525
  "X-LB-Client": PKG_VERSION || "dev"
@@ -2955,7 +2976,7 @@ var FSM = class {
2955
2976
  });
2956
2977
  }
2957
2978
  #getTargetFn(eventName) {
2958
- return _optionalChain([this, 'access', _29 => _29.#allowedTransitions, 'access', _30 => _30.get, 'call', _31 => _31(this.currentState), 'optionalAccess', _32 => _32.get, 'call', _33 => _33(eventName)]);
2979
+ return _optionalChain([this, 'access', _30 => _30.#allowedTransitions, 'access', _31 => _31.get, 'call', _32 => _32(this.currentState), 'optionalAccess', _33 => _33.get, 'call', _34 => _34(eventName)]);
2959
2980
  }
2960
2981
  /**
2961
2982
  * Exits the current state, and executes any necessary cleanup functions.
@@ -2972,7 +2993,7 @@ var FSM = class {
2972
2993
  this.#currentContext.allowPatching((patchableContext) => {
2973
2994
  levels = _nullishCoalesce(levels, () => ( this.#cleanupStack.length));
2974
2995
  for (let i = 0; i < levels; i++) {
2975
- _optionalChain([this, 'access', _34 => _34.#cleanupStack, 'access', _35 => _35.pop, 'call', _36 => _36(), 'optionalCall', _37 => _37(patchableContext)]);
2996
+ _optionalChain([this, 'access', _35 => _35.#cleanupStack, 'access', _36 => _36.pop, 'call', _37 => _37(), 'optionalCall', _38 => _38(patchableContext)]);
2976
2997
  }
2977
2998
  });
2978
2999
  }
@@ -2988,7 +3009,7 @@ var FSM = class {
2988
3009
  this.#currentContext.allowPatching((patchableContext) => {
2989
3010
  for (const pattern of enterPatterns) {
2990
3011
  const enterFn = this.#enterFns.get(pattern);
2991
- const cleanupFn = _optionalChain([enterFn, 'optionalCall', _38 => _38(patchableContext)]);
3012
+ const cleanupFn = _optionalChain([enterFn, 'optionalCall', _39 => _39(patchableContext)]);
2992
3013
  if (typeof cleanupFn === "function") {
2993
3014
  this.#cleanupStack.push(cleanupFn);
2994
3015
  } else {
@@ -3382,7 +3403,7 @@ function createConnectionStateMachine(delegates, options) {
3382
3403
  }
3383
3404
  function waitForActorId(event) {
3384
3405
  const serverMsg = tryParseJson(event.data);
3385
- if (_optionalChain([serverMsg, 'optionalAccess', _39 => _39.type]) === 104 /* ROOM_STATE */) {
3406
+ if (_optionalChain([serverMsg, 'optionalAccess', _40 => _40.type]) === 104 /* ROOM_STATE */) {
3386
3407
  didReceiveActor();
3387
3408
  }
3388
3409
  }
@@ -3491,12 +3512,12 @@ function createConnectionStateMachine(delegates, options) {
3491
3512
  const sendHeartbeat = {
3492
3513
  target: "@ok.awaiting-pong",
3493
3514
  effect: (ctx) => {
3494
- _optionalChain([ctx, 'access', _40 => _40.socket, 'optionalAccess', _41 => _41.send, 'call', _42 => _42("ping")]);
3515
+ _optionalChain([ctx, 'access', _41 => _41.socket, 'optionalAccess', _42 => _42.send, 'call', _43 => _43("ping")]);
3495
3516
  }
3496
3517
  };
3497
3518
  const maybeHeartbeat = () => {
3498
3519
  const doc = typeof document !== "undefined" ? document : void 0;
3499
- const canZombie = _optionalChain([doc, 'optionalAccess', _43 => _43.visibilityState]) === "hidden" && delegates.canZombie();
3520
+ const canZombie = _optionalChain([doc, 'optionalAccess', _44 => _44.visibilityState]) === "hidden" && delegates.canZombie();
3500
3521
  return canZombie ? "@idle.zombie" : sendHeartbeat;
3501
3522
  };
3502
3523
  machine.addTimedTransition("@ok.connected", HEARTBEAT_INTERVAL, maybeHeartbeat).addTransitions("@ok.connected", {
@@ -3535,7 +3556,7 @@ function createConnectionStateMachine(delegates, options) {
3535
3556
  // socket, or not. So always check to see if the socket is still OPEN or
3536
3557
  // not. When still OPEN, don't transition.
3537
3558
  EXPLICIT_SOCKET_ERROR: (_, context) => {
3538
- if (_optionalChain([context, 'access', _44 => _44.socket, 'optionalAccess', _45 => _45.readyState]) === 1) {
3559
+ if (_optionalChain([context, 'access', _45 => _45.socket, 'optionalAccess', _46 => _46.readyState]) === 1) {
3539
3560
  return null;
3540
3561
  }
3541
3562
  return {
@@ -3587,17 +3608,17 @@ function createConnectionStateMachine(delegates, options) {
3587
3608
  machine.send({ type: "NAVIGATOR_ONLINE" });
3588
3609
  }
3589
3610
  function onVisibilityChange() {
3590
- if (_optionalChain([doc, 'optionalAccess', _46 => _46.visibilityState]) === "visible") {
3611
+ if (_optionalChain([doc, 'optionalAccess', _47 => _47.visibilityState]) === "visible") {
3591
3612
  machine.send({ type: "WINDOW_GOT_FOCUS" });
3592
3613
  }
3593
3614
  }
3594
- _optionalChain([win, 'optionalAccess', _47 => _47.addEventListener, 'call', _48 => _48("online", onNetworkBackOnline)]);
3595
- _optionalChain([win, 'optionalAccess', _49 => _49.addEventListener, 'call', _50 => _50("offline", onNetworkOffline)]);
3596
- _optionalChain([root, 'optionalAccess', _51 => _51.addEventListener, 'call', _52 => _52("visibilitychange", onVisibilityChange)]);
3615
+ _optionalChain([win, 'optionalAccess', _48 => _48.addEventListener, 'call', _49 => _49("online", onNetworkBackOnline)]);
3616
+ _optionalChain([win, 'optionalAccess', _50 => _50.addEventListener, 'call', _51 => _51("offline", onNetworkOffline)]);
3617
+ _optionalChain([root, 'optionalAccess', _52 => _52.addEventListener, 'call', _53 => _53("visibilitychange", onVisibilityChange)]);
3597
3618
  return () => {
3598
- _optionalChain([root, 'optionalAccess', _53 => _53.removeEventListener, 'call', _54 => _54("visibilitychange", onVisibilityChange)]);
3599
- _optionalChain([win, 'optionalAccess', _55 => _55.removeEventListener, 'call', _56 => _56("online", onNetworkBackOnline)]);
3600
- _optionalChain([win, 'optionalAccess', _57 => _57.removeEventListener, 'call', _58 => _58("offline", onNetworkOffline)]);
3619
+ _optionalChain([root, 'optionalAccess', _54 => _54.removeEventListener, 'call', _55 => _55("visibilitychange", onVisibilityChange)]);
3620
+ _optionalChain([win, 'optionalAccess', _56 => _56.removeEventListener, 'call', _57 => _57("online", onNetworkBackOnline)]);
3621
+ _optionalChain([win, 'optionalAccess', _58 => _58.removeEventListener, 'call', _59 => _59("offline", onNetworkOffline)]);
3601
3622
  teardownSocket(ctx.socket);
3602
3623
  };
3603
3624
  });
@@ -3686,7 +3707,7 @@ var ManagedSocket = class {
3686
3707
  * message if this is somehow impossible.
3687
3708
  */
3688
3709
  send(data) {
3689
- const socket = _optionalChain([this, 'access', _59 => _59.#machine, 'access', _60 => _60.context, 'optionalAccess', _61 => _61.socket]);
3710
+ const socket = _optionalChain([this, 'access', _60 => _60.#machine, 'access', _61 => _61.context, 'optionalAccess', _62 => _62.socket]);
3690
3711
  if (socket === null) {
3691
3712
  warn("Cannot send: not connected yet", data);
3692
3713
  } else if (socket.readyState !== 1) {
@@ -4183,7 +4204,7 @@ function createStore_forKnowledge() {
4183
4204
  }
4184
4205
  function getKnowledgeForChat(chatId) {
4185
4206
  const globalKnowledge = knowledgeByChatId.getOrCreate(kWILDCARD).get();
4186
- const scopedKnowledge = _nullishCoalesce(_optionalChain([knowledgeByChatId, 'access', _62 => _62.get, 'call', _63 => _63(chatId), 'optionalAccess', _64 => _64.get, 'call', _65 => _65()]), () => ( []));
4207
+ const scopedKnowledge = _nullishCoalesce(_optionalChain([knowledgeByChatId, 'access', _63 => _63.get, 'call', _64 => _64(chatId), 'optionalAccess', _65 => _65.get, 'call', _66 => _66()]), () => ( []));
4187
4208
  return [...globalKnowledge, ...scopedKnowledge];
4188
4209
  }
4189
4210
  return {
@@ -4208,7 +4229,7 @@ function createStore_forTools() {
4208
4229
  return DerivedSignal.from(() => {
4209
4230
  return (
4210
4231
  // A tool that's registered and scoped to a specific chat ID...
4211
- _nullishCoalesce(_optionalChain([(chatId !== void 0 ? toolsByChatId\u03A3.getOrCreate(chatId).getOrCreate(name) : void 0), 'optionalAccess', _66 => _66.get, 'call', _67 => _67()]), () => ( // ...or a globally registered tool
4232
+ _nullishCoalesce(_optionalChain([(chatId !== void 0 ? toolsByChatId\u03A3.getOrCreate(chatId).getOrCreate(name) : void 0), 'optionalAccess', _67 => _67.get, 'call', _68 => _68()]), () => ( // ...or a globally registered tool
4212
4233
  toolsByChatId\u03A3.getOrCreate(kWILDCARD).getOrCreate(name).get()))
4213
4234
  );
4214
4235
  });
@@ -4238,8 +4259,8 @@ function createStore_forTools() {
4238
4259
  const globalTools\u03A3 = toolsByChatId\u03A3.get(kWILDCARD);
4239
4260
  const scopedTools\u03A3 = toolsByChatId\u03A3.get(chatId);
4240
4261
  return Array.from([
4241
- ..._nullishCoalesce(_optionalChain([globalTools\u03A3, 'optionalAccess', _68 => _68.entries, 'call', _69 => _69()]), () => ( [])),
4242
- ..._nullishCoalesce(_optionalChain([scopedTools\u03A3, 'optionalAccess', _70 => _70.entries, 'call', _71 => _71()]), () => ( []))
4262
+ ..._nullishCoalesce(_optionalChain([globalTools\u03A3, 'optionalAccess', _69 => _69.entries, 'call', _70 => _70()]), () => ( [])),
4263
+ ..._nullishCoalesce(_optionalChain([scopedTools\u03A3, 'optionalAccess', _71 => _71.entries, 'call', _72 => _72()]), () => ( []))
4243
4264
  ]).flatMap(([name, tool\u03A3]) => {
4244
4265
  const tool = tool\u03A3.get();
4245
4266
  return tool && (_nullishCoalesce(tool.enabled, () => ( true))) ? [{ name, description: tool.description, parameters: tool.parameters }] : [];
@@ -4342,7 +4363,7 @@ function createStore_forChatMessages(toolsStore, setToolResultFn) {
4342
4363
  } else {
4343
4364
  continue;
4344
4365
  }
4345
- const executeFn = _optionalChain([toolsStore, 'access', _72 => _72.getTool\u03A3, 'call', _73 => _73(toolInvocation.name, message.chatId), 'access', _74 => _74.get, 'call', _75 => _75(), 'optionalAccess', _76 => _76.execute]);
4366
+ const executeFn = _optionalChain([toolsStore, 'access', _73 => _73.getTool\u03A3, 'call', _74 => _74(toolInvocation.name, message.chatId), 'access', _75 => _75.get, 'call', _76 => _76(), 'optionalAccess', _77 => _77.execute]);
4346
4367
  if (executeFn) {
4347
4368
  (async () => {
4348
4369
  const result = await executeFn(toolInvocation.args, {
@@ -4441,8 +4462,8 @@ function createStore_forChatMessages(toolsStore, setToolResultFn) {
4441
4462
  const spine = [];
4442
4463
  let lastVisitedMessage = null;
4443
4464
  for (const message2 of pool.walkUp(leaf.id)) {
4444
- const prev = _nullishCoalesce(_optionalChain([first, 'call', _77 => _77(pool.walkLeft(message2.id, isAlive)), 'optionalAccess', _78 => _78.id]), () => ( null));
4445
- const next = _nullishCoalesce(_optionalChain([first, 'call', _79 => _79(pool.walkRight(message2.id, isAlive)), 'optionalAccess', _80 => _80.id]), () => ( null));
4465
+ const prev = _nullishCoalesce(_optionalChain([first, 'call', _78 => _78(pool.walkLeft(message2.id, isAlive)), 'optionalAccess', _79 => _79.id]), () => ( null));
4466
+ const next = _nullishCoalesce(_optionalChain([first, 'call', _80 => _80(pool.walkRight(message2.id, isAlive)), 'optionalAccess', _81 => _81.id]), () => ( null));
4446
4467
  if (!message2.deletedAt || prev || next) {
4447
4468
  const node = {
4448
4469
  ...message2,
@@ -4508,7 +4529,7 @@ function createStore_forChatMessages(toolsStore, setToolResultFn) {
4508
4529
  const latest = pool.sorted.findRight(
4509
4530
  (m) => m.role === "assistant" && !m.deletedAt
4510
4531
  );
4511
- return _optionalChain([latest, 'optionalAccess', _81 => _81.copilotId]);
4532
+ return _optionalChain([latest, 'optionalAccess', _82 => _82.copilotId]);
4512
4533
  }
4513
4534
  return {
4514
4535
  // Readers
@@ -4539,11 +4560,11 @@ function createStore_forChatMessages(toolsStore, setToolResultFn) {
4539
4560
  *getAutoExecutingMessageIds() {
4540
4561
  for (const messageId of myMessages) {
4541
4562
  const message = getMessageById(messageId);
4542
- if (_optionalChain([message, 'optionalAccess', _82 => _82.role]) === "assistant" && message.status === "awaiting-tool") {
4563
+ if (_optionalChain([message, 'optionalAccess', _83 => _83.role]) === "assistant" && message.status === "awaiting-tool") {
4543
4564
  const isAutoExecuting = message.contentSoFar.some((part) => {
4544
4565
  if (part.type === "tool-invocation" && part.stage === "executing") {
4545
4566
  const tool = toolsStore.getTool\u03A3(part.name, message.chatId).get();
4546
- return typeof _optionalChain([tool, 'optionalAccess', _83 => _83.execute]) === "function";
4567
+ return typeof _optionalChain([tool, 'optionalAccess', _84 => _84.execute]) === "function";
4547
4568
  }
4548
4569
  return false;
4549
4570
  });
@@ -4691,7 +4712,7 @@ function createAi(config) {
4691
4712
  flushPendingDeltas();
4692
4713
  switch (msg.event) {
4693
4714
  case "cmd-failed":
4694
- _optionalChain([pendingCmd, 'optionalAccess', _84 => _84.reject, 'call', _85 => _85(new Error(msg.error))]);
4715
+ _optionalChain([pendingCmd, 'optionalAccess', _85 => _85.reject, 'call', _86 => _86(new Error(msg.error))]);
4695
4716
  break;
4696
4717
  case "settle": {
4697
4718
  context.messagesStore.upsert(msg.message);
@@ -4768,7 +4789,7 @@ function createAi(config) {
4768
4789
  return assertNever(msg, "Unhandled case");
4769
4790
  }
4770
4791
  }
4771
- _optionalChain([pendingCmd, 'optionalAccess', _86 => _86.resolve, 'call', _87 => _87(msg)]);
4792
+ _optionalChain([pendingCmd, 'optionalAccess', _87 => _87.resolve, 'call', _88 => _88(msg)]);
4772
4793
  }
4773
4794
  managedSocket.events.onMessage.subscribe(handleServerMessage);
4774
4795
  managedSocket.events.statusDidChange.subscribe(onStatusDidChange);
@@ -4844,9 +4865,9 @@ function createAi(config) {
4844
4865
  invocationId,
4845
4866
  result,
4846
4867
  generationOptions: {
4847
- copilotId: _optionalChain([options, 'optionalAccess', _88 => _88.copilotId]),
4848
- stream: _optionalChain([options, 'optionalAccess', _89 => _89.stream]),
4849
- timeout: _optionalChain([options, 'optionalAccess', _90 => _90.timeout]),
4868
+ copilotId: _optionalChain([options, 'optionalAccess', _89 => _89.copilotId]),
4869
+ stream: _optionalChain([options, 'optionalAccess', _90 => _90.stream]),
4870
+ timeout: _optionalChain([options, 'optionalAccess', _91 => _91.timeout]),
4850
4871
  // Knowledge and tools aren't coming from the options, but retrieved
4851
4872
  // from the global context
4852
4873
  knowledge: knowledge.length > 0 ? knowledge : void 0,
@@ -4864,7 +4885,7 @@ function createAi(config) {
4864
4885
  }
4865
4886
  }
4866
4887
  const win = typeof window !== "undefined" ? window : void 0;
4867
- _optionalChain([win, 'optionalAccess', _91 => _91.addEventListener, 'call', _92 => _92("beforeunload", handleBeforeUnload, { once: true })]);
4888
+ _optionalChain([win, 'optionalAccess', _92 => _92.addEventListener, 'call', _93 => _93("beforeunload", handleBeforeUnload, { once: true })]);
4868
4889
  return Object.defineProperty(
4869
4890
  {
4870
4891
  [kInternal]: {
@@ -4883,7 +4904,7 @@ function createAi(config) {
4883
4904
  clearChat: (chatId) => sendClientMsgWithResponse({ cmd: "clear-chat", chatId }),
4884
4905
  askUserMessageInChat: async (chatId, userMessage, targetMessageId, options) => {
4885
4906
  const knowledge = context.knowledgeStore.getKnowledgeForChat(chatId);
4886
- const requestKnowledge = _optionalChain([options, 'optionalAccess', _93 => _93.knowledge]) || [];
4907
+ const requestKnowledge = _optionalChain([options, 'optionalAccess', _94 => _94.knowledge]) || [];
4887
4908
  const combinedKnowledge = [...knowledge, ...requestKnowledge];
4888
4909
  const tools = context.toolsStore.getToolDescriptions(chatId);
4889
4910
  messagesStore.markMine(targetMessageId);
@@ -4893,9 +4914,9 @@ function createAi(config) {
4893
4914
  sourceMessage: userMessage,
4894
4915
  targetMessageId,
4895
4916
  generationOptions: {
4896
- copilotId: _optionalChain([options, 'optionalAccess', _94 => _94.copilotId]),
4897
- stream: _optionalChain([options, 'optionalAccess', _95 => _95.stream]),
4898
- timeout: _optionalChain([options, 'optionalAccess', _96 => _96.timeout]),
4917
+ copilotId: _optionalChain([options, 'optionalAccess', _95 => _95.copilotId]),
4918
+ stream: _optionalChain([options, 'optionalAccess', _96 => _96.stream]),
4919
+ timeout: _optionalChain([options, 'optionalAccess', _97 => _97.timeout]),
4899
4920
  // Combine global knowledge with request-specific knowledge
4900
4921
  knowledge: combinedKnowledge.length > 0 ? combinedKnowledge : void 0,
4901
4922
  tools: tools.length > 0 ? tools : void 0
@@ -4967,7 +4988,7 @@ function replaceOrAppend(content, newItem, keyFn, now2) {
4967
4988
  }
4968
4989
  }
4969
4990
  function closePart(prevPart, endedAt) {
4970
- if (_optionalChain([prevPart, 'optionalAccess', _97 => _97.type]) === "reasoning") {
4991
+ if (_optionalChain([prevPart, 'optionalAccess', _98 => _98.type]) === "reasoning") {
4971
4992
  prevPart.endedAt ??= endedAt;
4972
4993
  }
4973
4994
  }
@@ -4982,7 +5003,7 @@ function patchContentWithDelta(content, delta) {
4982
5003
  const lastPart = parts[parts.length - 1];
4983
5004
  switch (delta.type) {
4984
5005
  case "text-delta":
4985
- if (_optionalChain([lastPart, 'optionalAccess', _98 => _98.type]) === "text") {
5006
+ if (_optionalChain([lastPart, 'optionalAccess', _99 => _99.type]) === "text") {
4986
5007
  lastPart.text += delta.textDelta;
4987
5008
  } else {
4988
5009
  closePart(lastPart, now2);
@@ -4990,7 +5011,7 @@ function patchContentWithDelta(content, delta) {
4990
5011
  }
4991
5012
  break;
4992
5013
  case "reasoning-delta":
4993
- if (_optionalChain([lastPart, 'optionalAccess', _99 => _99.type]) === "reasoning") {
5014
+ if (_optionalChain([lastPart, 'optionalAccess', _100 => _100.type]) === "reasoning") {
4994
5015
  lastPart.text += delta.textDelta;
4995
5016
  } else {
4996
5017
  closePart(lastPart, now2);
@@ -5010,8 +5031,8 @@ function patchContentWithDelta(content, delta) {
5010
5031
  break;
5011
5032
  }
5012
5033
  case "tool-delta": {
5013
- if (_optionalChain([lastPart, 'optionalAccess', _100 => _100.type]) === "tool-invocation" && lastPart.stage === "receiving") {
5014
- _optionalChain([lastPart, 'access', _101 => _101.__appendDelta, 'optionalCall', _102 => _102(delta.delta)]);
5034
+ if (_optionalChain([lastPart, 'optionalAccess', _101 => _101.type]) === "tool-invocation" && lastPart.stage === "receiving") {
5035
+ _optionalChain([lastPart, 'access', _102 => _102.__appendDelta, 'optionalCall', _103 => _103(delta.delta)]);
5015
5036
  }
5016
5037
  break;
5017
5038
  }
@@ -5125,7 +5146,7 @@ function createAuthManager(authOptions, onAuthenticate) {
5125
5146
  return void 0;
5126
5147
  }
5127
5148
  async function makeAuthRequest(options) {
5128
- const fetcher = _nullishCoalesce(_optionalChain([authOptions, 'access', _103 => _103.polyfills, 'optionalAccess', _104 => _104.fetch]), () => ( (typeof window === "undefined" ? void 0 : window.fetch)));
5149
+ const fetcher = _nullishCoalesce(_optionalChain([authOptions, 'access', _104 => _104.polyfills, 'optionalAccess', _105 => _105.fetch]), () => ( (typeof window === "undefined" ? void 0 : window.fetch)));
5129
5150
  if (authentication.type === "private") {
5130
5151
  if (fetcher === void 0) {
5131
5152
  throw new StopRetrying(
@@ -5141,7 +5162,7 @@ function createAuthManager(authOptions, onAuthenticate) {
5141
5162
  "The same Liveblocks auth token was issued from the backend before. Caching Liveblocks tokens is not supported."
5142
5163
  );
5143
5164
  }
5144
- _optionalChain([onAuthenticate, 'optionalCall', _105 => _105(parsed.parsed)]);
5165
+ _optionalChain([onAuthenticate, 'optionalCall', _106 => _106(parsed.parsed)]);
5145
5166
  return parsed;
5146
5167
  }
5147
5168
  if (authentication.type === "custom") {
@@ -5149,7 +5170,7 @@ function createAuthManager(authOptions, onAuthenticate) {
5149
5170
  if (response && typeof response === "object") {
5150
5171
  if (typeof response.token === "string") {
5151
5172
  const parsed = parseAuthToken(response.token);
5152
- _optionalChain([onAuthenticate, 'optionalCall', _106 => _106(parsed.parsed)]);
5173
+ _optionalChain([onAuthenticate, 'optionalCall', _107 => _107(parsed.parsed)]);
5153
5174
  return parsed;
5154
5175
  } else if (typeof response.error === "string") {
5155
5176
  const reason = `Authentication failed: ${"reason" in response && typeof response.reason === "string" ? response.reason : "Forbidden"}`;
@@ -5308,7 +5329,7 @@ function sendToPanel(message, options) {
5308
5329
  ...message,
5309
5330
  source: "liveblocks-devtools-client"
5310
5331
  };
5311
- if (!(_optionalChain([options, 'optionalAccess', _107 => _107.force]) || _bridgeActive)) {
5332
+ if (!(_optionalChain([options, 'optionalAccess', _108 => _108.force]) || _bridgeActive)) {
5312
5333
  return;
5313
5334
  }
5314
5335
  window.postMessage(fullMsg, "*");
@@ -5316,7 +5337,7 @@ function sendToPanel(message, options) {
5316
5337
  var eventSource = makeEventSource();
5317
5338
  if (process.env.NODE_ENV !== "production" && typeof window !== "undefined") {
5318
5339
  window.addEventListener("message", (event) => {
5319
- if (event.source === window && _optionalChain([event, 'access', _108 => _108.data, 'optionalAccess', _109 => _109.source]) === "liveblocks-devtools-panel") {
5340
+ if (event.source === window && _optionalChain([event, 'access', _109 => _109.data, 'optionalAccess', _110 => _110.source]) === "liveblocks-devtools-panel") {
5320
5341
  eventSource.notify(event.data);
5321
5342
  } else {
5322
5343
  }
@@ -5458,7 +5479,7 @@ function fullSync(room) {
5458
5479
  msg: "room::sync::full",
5459
5480
  roomId: room.id,
5460
5481
  status: room.getStatus(),
5461
- storage: _nullishCoalesce(_optionalChain([root, 'optionalAccess', _110 => _110.toTreeNode, 'call', _111 => _111("root"), 'access', _112 => _112.payload]), () => ( null)),
5482
+ storage: _nullishCoalesce(_optionalChain([root, 'optionalAccess', _111 => _111.toTreeNode, 'call', _112 => _112("root"), 'access', _113 => _113.payload]), () => ( null)),
5462
5483
  me,
5463
5484
  others
5464
5485
  });
@@ -5765,7 +5786,7 @@ function createManagedPool(roomId, options) {
5765
5786
  generateId: () => `${getCurrentConnectionId()}:${clock++}`,
5766
5787
  generateOpId: () => `${getCurrentConnectionId()}:${opClock++}`,
5767
5788
  dispatch(ops, reverse, storageUpdates) {
5768
- _optionalChain([onDispatch, 'optionalCall', _113 => _113(ops, reverse, storageUpdates)]);
5789
+ _optionalChain([onDispatch, 'optionalCall', _114 => _114(ops, reverse, storageUpdates)]);
5769
5790
  },
5770
5791
  assertStorageIsWritable: () => {
5771
5792
  if (!isStorageWritable()) {
@@ -5992,7 +6013,7 @@ var LiveRegister = class _LiveRegister extends AbstractCrdt {
5992
6013
  return [
5993
6014
  {
5994
6015
  type: 8 /* CREATE_REGISTER */,
5995
- opId: _optionalChain([pool, 'optionalAccess', _114 => _114.generateOpId, 'call', _115 => _115()]),
6016
+ opId: _optionalChain([pool, 'optionalAccess', _115 => _115.generateOpId, 'call', _116 => _116()]),
5996
6017
  id: this._id,
5997
6018
  parentId,
5998
6019
  parentKey,
@@ -6098,7 +6119,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
6098
6119
  const ops = [];
6099
6120
  const op = {
6100
6121
  id: this._id,
6101
- opId: _optionalChain([pool, 'optionalAccess', _116 => _116.generateOpId, 'call', _117 => _117()]),
6122
+ opId: _optionalChain([pool, 'optionalAccess', _117 => _117.generateOpId, 'call', _118 => _118()]),
6102
6123
  type: 2 /* CREATE_LIST */,
6103
6124
  parentId,
6104
6125
  parentKey
@@ -6369,7 +6390,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
6369
6390
  #applyInsertUndoRedo(op) {
6370
6391
  const { id, parentKey: key } = op;
6371
6392
  const child = creationOpToLiveNode(op);
6372
- if (_optionalChain([this, 'access', _118 => _118._pool, 'optionalAccess', _119 => _119.getNode, 'call', _120 => _120(id)]) !== void 0) {
6393
+ if (_optionalChain([this, 'access', _119 => _119._pool, 'optionalAccess', _120 => _120.getNode, 'call', _121 => _121(id)]) !== void 0) {
6373
6394
  return { modified: false };
6374
6395
  }
6375
6396
  child._attach(id, nn(this._pool));
@@ -6377,8 +6398,8 @@ var LiveList = class _LiveList extends AbstractCrdt {
6377
6398
  const existingItemIndex = this._indexOfPosition(key);
6378
6399
  let newKey = key;
6379
6400
  if (existingItemIndex !== -1) {
6380
- const before2 = _optionalChain([this, 'access', _121 => _121.#items, 'access', _122 => _122[existingItemIndex], 'optionalAccess', _123 => _123._parentPos]);
6381
- const after2 = _optionalChain([this, 'access', _124 => _124.#items, 'access', _125 => _125[existingItemIndex + 1], 'optionalAccess', _126 => _126._parentPos]);
6401
+ const before2 = _optionalChain([this, 'access', _122 => _122.#items, 'access', _123 => _123[existingItemIndex], 'optionalAccess', _124 => _124._parentPos]);
6402
+ const after2 = _optionalChain([this, 'access', _125 => _125.#items, 'access', _126 => _126[existingItemIndex + 1], 'optionalAccess', _127 => _127._parentPos]);
6382
6403
  newKey = makePosition(before2, after2);
6383
6404
  child._setParentLink(this, newKey);
6384
6405
  }
@@ -6392,7 +6413,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
6392
6413
  #applySetUndoRedo(op) {
6393
6414
  const { id, parentKey: key } = op;
6394
6415
  const child = creationOpToLiveNode(op);
6395
- if (_optionalChain([this, 'access', _127 => _127._pool, 'optionalAccess', _128 => _128.getNode, 'call', _129 => _129(id)]) !== void 0) {
6416
+ if (_optionalChain([this, 'access', _128 => _128._pool, 'optionalAccess', _129 => _129.getNode, 'call', _130 => _130(id)]) !== void 0) {
6396
6417
  return { modified: false };
6397
6418
  }
6398
6419
  this.#unacknowledgedSets.set(key, nn(op.opId));
@@ -6513,7 +6534,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
6513
6534
  } else {
6514
6535
  this.#items[existingItemIndex]._setParentLink(
6515
6536
  this,
6516
- makePosition(newKey, _optionalChain([this, 'access', _130 => _130.#items, 'access', _131 => _131[existingItemIndex + 1], 'optionalAccess', _132 => _132._parentPos]))
6537
+ makePosition(newKey, _optionalChain([this, 'access', _131 => _131.#items, 'access', _132 => _132[existingItemIndex + 1], 'optionalAccess', _133 => _133._parentPos]))
6517
6538
  );
6518
6539
  const previousIndex = this.#items.indexOf(child);
6519
6540
  child._setParentLink(this, newKey);
@@ -6538,7 +6559,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
6538
6559
  if (existingItemIndex !== -1) {
6539
6560
  this.#items[existingItemIndex]._setParentLink(
6540
6561
  this,
6541
- makePosition(newKey, _optionalChain([this, 'access', _133 => _133.#items, 'access', _134 => _134[existingItemIndex + 1], 'optionalAccess', _135 => _135._parentPos]))
6562
+ makePosition(newKey, _optionalChain([this, 'access', _134 => _134.#items, 'access', _135 => _135[existingItemIndex + 1], 'optionalAccess', _136 => _136._parentPos]))
6542
6563
  );
6543
6564
  }
6544
6565
  child._setParentLink(this, newKey);
@@ -6557,7 +6578,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
6557
6578
  if (existingItemIndex !== -1) {
6558
6579
  this.#items[existingItemIndex]._setParentLink(
6559
6580
  this,
6560
- makePosition(newKey, _optionalChain([this, 'access', _136 => _136.#items, 'access', _137 => _137[existingItemIndex + 1], 'optionalAccess', _138 => _138._parentPos]))
6581
+ makePosition(newKey, _optionalChain([this, 'access', _137 => _137.#items, 'access', _138 => _138[existingItemIndex + 1], 'optionalAccess', _139 => _139._parentPos]))
6561
6582
  );
6562
6583
  }
6563
6584
  child._setParentLink(this, newKey);
@@ -6585,7 +6606,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
6585
6606
  if (existingItemIndex !== -1) {
6586
6607
  actualNewKey = makePosition(
6587
6608
  newKey,
6588
- _optionalChain([this, 'access', _139 => _139.#items, 'access', _140 => _140[existingItemIndex + 1], 'optionalAccess', _141 => _141._parentPos])
6609
+ _optionalChain([this, 'access', _140 => _140.#items, 'access', _141 => _141[existingItemIndex + 1], 'optionalAccess', _142 => _142._parentPos])
6589
6610
  );
6590
6611
  }
6591
6612
  child._setParentLink(this, actualNewKey);
@@ -6643,7 +6664,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
6643
6664
  * @param element The element to add to the end of the LiveList.
6644
6665
  */
6645
6666
  push(element) {
6646
- _optionalChain([this, 'access', _142 => _142._pool, 'optionalAccess', _143 => _143.assertStorageIsWritable, 'call', _144 => _144()]);
6667
+ _optionalChain([this, 'access', _143 => _143._pool, 'optionalAccess', _144 => _144.assertStorageIsWritable, 'call', _145 => _145()]);
6647
6668
  return this.insert(element, this.length);
6648
6669
  }
6649
6670
  /**
@@ -6652,7 +6673,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
6652
6673
  * @param index The index at which you want to insert the element.
6653
6674
  */
6654
6675
  insert(element, index) {
6655
- _optionalChain([this, 'access', _145 => _145._pool, 'optionalAccess', _146 => _146.assertStorageIsWritable, 'call', _147 => _147()]);
6676
+ _optionalChain([this, 'access', _146 => _146._pool, 'optionalAccess', _147 => _147.assertStorageIsWritable, 'call', _148 => _148()]);
6656
6677
  if (index < 0 || index > this.#items.length) {
6657
6678
  throw new Error(
6658
6679
  `Cannot insert list item at index "${index}". index should be between 0 and ${this.#items.length}`
@@ -6682,7 +6703,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
6682
6703
  * @param targetIndex The index where the element should be after moving.
6683
6704
  */
6684
6705
  move(index, targetIndex) {
6685
- _optionalChain([this, 'access', _148 => _148._pool, 'optionalAccess', _149 => _149.assertStorageIsWritable, 'call', _150 => _150()]);
6706
+ _optionalChain([this, 'access', _149 => _149._pool, 'optionalAccess', _150 => _150.assertStorageIsWritable, 'call', _151 => _151()]);
6686
6707
  if (targetIndex < 0) {
6687
6708
  throw new Error("targetIndex cannot be less than 0");
6688
6709
  }
@@ -6740,7 +6761,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
6740
6761
  * @param index The index of the element to delete
6741
6762
  */
6742
6763
  delete(index) {
6743
- _optionalChain([this, 'access', _151 => _151._pool, 'optionalAccess', _152 => _152.assertStorageIsWritable, 'call', _153 => _153()]);
6764
+ _optionalChain([this, 'access', _152 => _152._pool, 'optionalAccess', _153 => _153.assertStorageIsWritable, 'call', _154 => _154()]);
6744
6765
  if (index < 0 || index >= this.#items.length) {
6745
6766
  throw new Error(
6746
6767
  `Cannot delete list item at index "${index}". index should be between 0 and ${this.#items.length - 1}`
@@ -6773,7 +6794,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
6773
6794
  }
6774
6795
  }
6775
6796
  clear() {
6776
- _optionalChain([this, 'access', _154 => _154._pool, 'optionalAccess', _155 => _155.assertStorageIsWritable, 'call', _156 => _156()]);
6797
+ _optionalChain([this, 'access', _155 => _155._pool, 'optionalAccess', _156 => _156.assertStorageIsWritable, 'call', _157 => _157()]);
6777
6798
  if (this._pool) {
6778
6799
  const ops = [];
6779
6800
  const reverseOps = [];
@@ -6807,7 +6828,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
6807
6828
  }
6808
6829
  }
6809
6830
  set(index, item) {
6810
- _optionalChain([this, 'access', _157 => _157._pool, 'optionalAccess', _158 => _158.assertStorageIsWritable, 'call', _159 => _159()]);
6831
+ _optionalChain([this, 'access', _158 => _158._pool, 'optionalAccess', _159 => _159.assertStorageIsWritable, 'call', _160 => _160()]);
6811
6832
  if (index < 0 || index >= this.#items.length) {
6812
6833
  throw new Error(
6813
6834
  `Cannot set list item at index "${index}". index should be between 0 and ${this.#items.length - 1}`
@@ -6953,7 +6974,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
6953
6974
  #shiftItemPosition(index, key) {
6954
6975
  const shiftedPosition = makePosition(
6955
6976
  key,
6956
- this.#items.length > index + 1 ? _optionalChain([this, 'access', _160 => _160.#items, 'access', _161 => _161[index + 1], 'optionalAccess', _162 => _162._parentPos]) : void 0
6977
+ this.#items.length > index + 1 ? _optionalChain([this, 'access', _161 => _161.#items, 'access', _162 => _162[index + 1], 'optionalAccess', _163 => _163._parentPos]) : void 0
6957
6978
  );
6958
6979
  this.#items[index]._setParentLink(this, shiftedPosition);
6959
6980
  }
@@ -7078,7 +7099,7 @@ var LiveMap = class _LiveMap extends AbstractCrdt {
7078
7099
  const ops = [];
7079
7100
  const op = {
7080
7101
  id: this._id,
7081
- opId: _optionalChain([pool, 'optionalAccess', _163 => _163.generateOpId, 'call', _164 => _164()]),
7102
+ opId: _optionalChain([pool, 'optionalAccess', _164 => _164.generateOpId, 'call', _165 => _165()]),
7082
7103
  type: 7 /* CREATE_MAP */,
7083
7104
  parentId,
7084
7105
  parentKey
@@ -7218,7 +7239,7 @@ var LiveMap = class _LiveMap extends AbstractCrdt {
7218
7239
  * @param value The value of the element to add. Should be serializable to JSON.
7219
7240
  */
7220
7241
  set(key, value) {
7221
- _optionalChain([this, 'access', _165 => _165._pool, 'optionalAccess', _166 => _166.assertStorageIsWritable, 'call', _167 => _167()]);
7242
+ _optionalChain([this, 'access', _166 => _166._pool, 'optionalAccess', _167 => _167.assertStorageIsWritable, 'call', _168 => _168()]);
7222
7243
  const oldValue = this.#map.get(key);
7223
7244
  if (oldValue) {
7224
7245
  oldValue._detach();
@@ -7264,7 +7285,7 @@ var LiveMap = class _LiveMap extends AbstractCrdt {
7264
7285
  * @returns true if an element existed and has been removed, or false if the element does not exist.
7265
7286
  */
7266
7287
  delete(key) {
7267
- _optionalChain([this, 'access', _168 => _168._pool, 'optionalAccess', _169 => _169.assertStorageIsWritable, 'call', _170 => _170()]);
7288
+ _optionalChain([this, 'access', _169 => _169._pool, 'optionalAccess', _170 => _170.assertStorageIsWritable, 'call', _171 => _171()]);
7268
7289
  const item = this.#map.get(key);
7269
7290
  if (item === void 0) {
7270
7291
  return false;
@@ -7459,7 +7480,7 @@ var LiveObject = (_class2 = class _LiveObject extends AbstractCrdt {
7459
7480
  if (this._id === void 0) {
7460
7481
  throw new Error("Cannot serialize item is not attached");
7461
7482
  }
7462
- const opId = _optionalChain([pool, 'optionalAccess', _171 => _171.generateOpId, 'call', _172 => _172()]);
7483
+ const opId = _optionalChain([pool, 'optionalAccess', _172 => _172.generateOpId, 'call', _173 => _173()]);
7463
7484
  const ops = [];
7464
7485
  const op = {
7465
7486
  type: 4 /* CREATE_OBJECT */,
@@ -7733,7 +7754,7 @@ var LiveObject = (_class2 = class _LiveObject extends AbstractCrdt {
7733
7754
  * @param value The value of the property to add
7734
7755
  */
7735
7756
  set(key, value) {
7736
- _optionalChain([this, 'access', _173 => _173._pool, 'optionalAccess', _174 => _174.assertStorageIsWritable, 'call', _175 => _175()]);
7757
+ _optionalChain([this, 'access', _174 => _174._pool, 'optionalAccess', _175 => _175.assertStorageIsWritable, 'call', _176 => _176()]);
7737
7758
  this.update({ [key]: value });
7738
7759
  }
7739
7760
  /**
@@ -7748,7 +7769,7 @@ var LiveObject = (_class2 = class _LiveObject extends AbstractCrdt {
7748
7769
  * @param key The key of the property to delete
7749
7770
  */
7750
7771
  delete(key) {
7751
- _optionalChain([this, 'access', _176 => _176._pool, 'optionalAccess', _177 => _177.assertStorageIsWritable, 'call', _178 => _178()]);
7772
+ _optionalChain([this, 'access', _177 => _177._pool, 'optionalAccess', _178 => _178.assertStorageIsWritable, 'call', _179 => _179()]);
7752
7773
  const keyAsString = key;
7753
7774
  const oldValue = this.#map.get(keyAsString);
7754
7775
  if (oldValue === void 0) {
@@ -7803,7 +7824,7 @@ var LiveObject = (_class2 = class _LiveObject extends AbstractCrdt {
7803
7824
  * @param patch The object used to overrides properties
7804
7825
  */
7805
7826
  update(patch) {
7806
- _optionalChain([this, 'access', _179 => _179._pool, 'optionalAccess', _180 => _180.assertStorageIsWritable, 'call', _181 => _181()]);
7827
+ _optionalChain([this, 'access', _180 => _180._pool, 'optionalAccess', _181 => _181.assertStorageIsWritable, 'call', _182 => _182()]);
7807
7828
  if (_LiveObject.detectLargeObjects) {
7808
7829
  const data = {};
7809
7830
  for (const [key, value] of this.#map) {
@@ -8541,15 +8562,15 @@ function installBackgroundTabSpy() {
8541
8562
  const doc = typeof document !== "undefined" ? document : void 0;
8542
8563
  const inBackgroundSince = { current: null };
8543
8564
  function onVisibilityChange() {
8544
- if (_optionalChain([doc, 'optionalAccess', _182 => _182.visibilityState]) === "hidden") {
8565
+ if (_optionalChain([doc, 'optionalAccess', _183 => _183.visibilityState]) === "hidden") {
8545
8566
  inBackgroundSince.current = _nullishCoalesce(inBackgroundSince.current, () => ( Date.now()));
8546
8567
  } else {
8547
8568
  inBackgroundSince.current = null;
8548
8569
  }
8549
8570
  }
8550
- _optionalChain([doc, 'optionalAccess', _183 => _183.addEventListener, 'call', _184 => _184("visibilitychange", onVisibilityChange)]);
8571
+ _optionalChain([doc, 'optionalAccess', _184 => _184.addEventListener, 'call', _185 => _185("visibilitychange", onVisibilityChange)]);
8551
8572
  const unsub = () => {
8552
- _optionalChain([doc, 'optionalAccess', _185 => _185.removeEventListener, 'call', _186 => _186("visibilitychange", onVisibilityChange)]);
8573
+ _optionalChain([doc, 'optionalAccess', _186 => _186.removeEventListener, 'call', _187 => _187("visibilitychange", onVisibilityChange)]);
8553
8574
  };
8554
8575
  return [inBackgroundSince, unsub];
8555
8576
  }
@@ -8717,7 +8738,7 @@ function createRoom(options, config) {
8717
8738
  }
8718
8739
  }
8719
8740
  function isStorageWritable() {
8720
- const scopes = _optionalChain([context, 'access', _187 => _187.dynamicSessionInfoSig, 'access', _188 => _188.get, 'call', _189 => _189(), 'optionalAccess', _190 => _190.scopes]);
8741
+ const scopes = _optionalChain([context, 'access', _188 => _188.dynamicSessionInfoSig, 'access', _189 => _189.get, 'call', _190 => _190(), 'optionalAccess', _191 => _191.scopes]);
8721
8742
  return scopes !== void 0 ? canWriteStorage(scopes) : true;
8722
8743
  }
8723
8744
  const eventHub = {
@@ -8848,7 +8869,7 @@ function createRoom(options, config) {
8848
8869
  // be stuck in "synchronizing" forever).
8849
8870
  case "experimental-fallback-to-http": {
8850
8871
  warn("Message is too large for websockets, so sending over HTTP instead");
8851
- const nonce = _nullishCoalesce(_optionalChain([context, 'access', _191 => _191.dynamicSessionInfoSig, 'access', _192 => _192.get, 'call', _193 => _193(), 'optionalAccess', _194 => _194.nonce]), () => ( raise("Session is not authorized to send message over HTTP")));
8872
+ const nonce = _nullishCoalesce(_optionalChain([context, 'access', _192 => _192.dynamicSessionInfoSig, 'access', _193 => _193.get, 'call', _194 => _194(), 'optionalAccess', _195 => _195.nonce]), () => ( raise("Session is not authorized to send message over HTTP")));
8852
8873
  void httpClient.sendMessagesOverHTTP({ roomId, nonce, messages }).then((resp) => {
8853
8874
  if (!resp.ok && resp.status === 403) {
8854
8875
  managedSocket.reconnect();
@@ -8903,7 +8924,7 @@ function createRoom(options, config) {
8903
8924
  } else {
8904
8925
  context.root = LiveObject._fromItems(message.items, context.pool);
8905
8926
  }
8906
- const canWrite = _nullishCoalesce(_optionalChain([self, 'access', _195 => _195.get, 'call', _196 => _196(), 'optionalAccess', _197 => _197.canWrite]), () => ( true));
8927
+ const canWrite = _nullishCoalesce(_optionalChain([self, 'access', _196 => _196.get, 'call', _197 => _197(), 'optionalAccess', _198 => _198.canWrite]), () => ( true));
8907
8928
  const stackSizeBefore = context.undoStack.length;
8908
8929
  for (const key in context.initialStorage) {
8909
8930
  if (context.root.get(key) === void 0) {
@@ -9103,7 +9124,7 @@ function createRoom(options, config) {
9103
9124
  }
9104
9125
  context.myPresence.patch(patch);
9105
9126
  if (context.activeBatch) {
9106
- if (_optionalChain([options2, 'optionalAccess', _198 => _198.addToHistory])) {
9127
+ if (_optionalChain([options2, 'optionalAccess', _199 => _199.addToHistory])) {
9107
9128
  context.activeBatch.reverseOps.pushLeft({
9108
9129
  type: "presence",
9109
9130
  data: oldValues
@@ -9112,7 +9133,7 @@ function createRoom(options, config) {
9112
9133
  context.activeBatch.updates.presence = true;
9113
9134
  } else {
9114
9135
  flushNowOrSoon();
9115
- if (_optionalChain([options2, 'optionalAccess', _199 => _199.addToHistory])) {
9136
+ if (_optionalChain([options2, 'optionalAccess', _200 => _200.addToHistory])) {
9116
9137
  addToUndoStack([{ type: "presence", data: oldValues }]);
9117
9138
  }
9118
9139
  notify({ presence: true });
@@ -9296,6 +9317,22 @@ function createRoom(options, config) {
9296
9317
  }
9297
9318
  break;
9298
9319
  }
9320
+ // Receiving a RejectedOps message in the client means that the server is no
9321
+ // longer in sync with the client. Trying to synchronize the client again by
9322
+ // rolling back particular Ops may be hard/impossible. It's fine to not try and
9323
+ // accept the out-of-sync reality and throw an error.
9324
+ case 299 /* REJECT_STORAGE_OP */: {
9325
+ errorWithTitle(
9326
+ "Storage mutation rejection error",
9327
+ message.reason
9328
+ );
9329
+ if (process.env.NODE_ENV !== "production") {
9330
+ throw new Error(
9331
+ `Storage mutations rejected by server: ${message.reason}`
9332
+ );
9333
+ }
9334
+ break;
9335
+ }
9299
9336
  case 400 /* THREAD_CREATED */:
9300
9337
  case 407 /* THREAD_DELETED */:
9301
9338
  case 401 /* THREAD_METADATA_UPDATED */:
@@ -9413,7 +9450,7 @@ function createRoom(options, config) {
9413
9450
  const unacknowledgedOps = new Map(context.unacknowledgedOps);
9414
9451
  createOrUpdateRootFromMessage(message);
9415
9452
  applyAndSendOps(unacknowledgedOps);
9416
- _optionalChain([_resolveStoragePromise, 'optionalCall', _200 => _200()]);
9453
+ _optionalChain([_resolveStoragePromise, 'optionalCall', _201 => _201()]);
9417
9454
  notifyStorageStatus();
9418
9455
  eventHub.storageDidLoad.notify();
9419
9456
  }
@@ -9634,8 +9671,8 @@ function createRoom(options, config) {
9634
9671
  async function getThreads(options2) {
9635
9672
  return httpClient.getThreads({
9636
9673
  roomId,
9637
- query: _optionalChain([options2, 'optionalAccess', _201 => _201.query]),
9638
- cursor: _optionalChain([options2, 'optionalAccess', _202 => _202.cursor])
9674
+ query: _optionalChain([options2, 'optionalAccess', _202 => _202.query]),
9675
+ cursor: _optionalChain([options2, 'optionalAccess', _203 => _203.cursor])
9639
9676
  });
9640
9677
  }
9641
9678
  async function getThread(threadId) {
@@ -9742,7 +9779,7 @@ function createRoom(options, config) {
9742
9779
  function getSubscriptionSettings(options2) {
9743
9780
  return httpClient.getSubscriptionSettings({
9744
9781
  roomId,
9745
- signal: _optionalChain([options2, 'optionalAccess', _203 => _203.signal])
9782
+ signal: _optionalChain([options2, 'optionalAccess', _204 => _204.signal])
9746
9783
  });
9747
9784
  }
9748
9785
  function updateSubscriptionSettings(settings) {
@@ -9764,7 +9801,7 @@ function createRoom(options, config) {
9764
9801
  {
9765
9802
  [kInternal]: {
9766
9803
  get presenceBuffer() {
9767
- return deepClone(_nullishCoalesce(_optionalChain([context, 'access', _204 => _204.buffer, 'access', _205 => _205.presenceUpdates, 'optionalAccess', _206 => _206.data]), () => ( null)));
9804
+ return deepClone(_nullishCoalesce(_optionalChain([context, 'access', _205 => _205.buffer, 'access', _206 => _206.presenceUpdates, 'optionalAccess', _207 => _207.data]), () => ( null)));
9768
9805
  },
9769
9806
  // prettier-ignore
9770
9807
  get undoStack() {
@@ -9779,9 +9816,9 @@ function createRoom(options, config) {
9779
9816
  return context.yjsProvider;
9780
9817
  },
9781
9818
  setYjsProvider(newProvider) {
9782
- _optionalChain([context, 'access', _207 => _207.yjsProvider, 'optionalAccess', _208 => _208.off, 'call', _209 => _209("status", yjsStatusDidChange)]);
9819
+ _optionalChain([context, 'access', _208 => _208.yjsProvider, 'optionalAccess', _209 => _209.off, 'call', _210 => _210("status", yjsStatusDidChange)]);
9783
9820
  context.yjsProvider = newProvider;
9784
- _optionalChain([newProvider, 'optionalAccess', _210 => _210.on, 'call', _211 => _211("status", yjsStatusDidChange)]);
9821
+ _optionalChain([newProvider, 'optionalAccess', _211 => _211.on, 'call', _212 => _212("status", yjsStatusDidChange)]);
9785
9822
  context.yjsProviderDidChange.notify();
9786
9823
  },
9787
9824
  yjsProviderDidChange: context.yjsProviderDidChange.observable,
@@ -9827,7 +9864,7 @@ function createRoom(options, config) {
9827
9864
  source.dispose();
9828
9865
  }
9829
9866
  eventHub.roomWillDestroy.notify();
9830
- _optionalChain([context, 'access', _212 => _212.yjsProvider, 'optionalAccess', _213 => _213.off, 'call', _214 => _214("status", yjsStatusDidChange)]);
9867
+ _optionalChain([context, 'access', _213 => _213.yjsProvider, 'optionalAccess', _214 => _214.off, 'call', _215 => _215("status", yjsStatusDidChange)]);
9831
9868
  syncSourceForStorage.destroy();
9832
9869
  syncSourceForYjs.destroy();
9833
9870
  uninstallBgTabSpy();
@@ -9977,7 +10014,7 @@ function makeClassicSubscribeFn(roomId, events, errorEvents) {
9977
10014
  }
9978
10015
  if (isLiveNode(first)) {
9979
10016
  const node = first;
9980
- if (_optionalChain([options, 'optionalAccess', _215 => _215.isDeep])) {
10017
+ if (_optionalChain([options, 'optionalAccess', _216 => _216.isDeep])) {
9981
10018
  const storageCallback = second;
9982
10019
  return subscribeToLiveStructureDeeply(node, storageCallback);
9983
10020
  } else {
@@ -10057,8 +10094,8 @@ function createClient(options) {
10057
10094
  const userId = token.k === "sec-legacy" /* SECRET_LEGACY */ ? token.id : token.uid;
10058
10095
  currentUserId.set(() => userId);
10059
10096
  });
10060
- const fetchPolyfill = _optionalChain([clientOptions, 'access', _216 => _216.polyfills, 'optionalAccess', _217 => _217.fetch]) || /* istanbul ignore next */
10061
- _optionalChain([globalThis, 'access', _218 => _218.fetch, 'optionalAccess', _219 => _219.bind, 'call', _220 => _220(globalThis)]);
10097
+ const fetchPolyfill = _optionalChain([clientOptions, 'access', _217 => _217.polyfills, 'optionalAccess', _218 => _218.fetch]) || /* istanbul ignore next */
10098
+ _optionalChain([globalThis, 'access', _219 => _219.fetch, 'optionalAccess', _220 => _220.bind, 'call', _221 => _221(globalThis)]);
10062
10099
  const httpClient = createApiClient({
10063
10100
  baseUrl,
10064
10101
  fetchPolyfill,
@@ -10076,7 +10113,7 @@ function createClient(options) {
10076
10113
  delegates: {
10077
10114
  createSocket: makeCreateSocketDelegateForAi(
10078
10115
  baseUrl,
10079
- _optionalChain([clientOptions, 'access', _221 => _221.polyfills, 'optionalAccess', _222 => _222.WebSocket])
10116
+ _optionalChain([clientOptions, 'access', _222 => _222.polyfills, 'optionalAccess', _223 => _223.WebSocket])
10080
10117
  ),
10081
10118
  authenticate: async () => {
10082
10119
  const resp = await authManager.getAuthValue({
@@ -10138,7 +10175,7 @@ function createClient(options) {
10138
10175
  createSocket: makeCreateSocketDelegateForRoom(
10139
10176
  roomId,
10140
10177
  baseUrl,
10141
- _optionalChain([clientOptions, 'access', _223 => _223.polyfills, 'optionalAccess', _224 => _224.WebSocket])
10178
+ _optionalChain([clientOptions, 'access', _224 => _224.polyfills, 'optionalAccess', _225 => _225.WebSocket])
10142
10179
  ),
10143
10180
  authenticate: makeAuthDelegateForRoom(roomId, authManager)
10144
10181
  })),
@@ -10161,7 +10198,7 @@ function createClient(options) {
10161
10198
  const shouldConnect = _nullishCoalesce(options2.autoConnect, () => ( true));
10162
10199
  if (shouldConnect) {
10163
10200
  if (typeof atob === "undefined") {
10164
- if (_optionalChain([clientOptions, 'access', _225 => _225.polyfills, 'optionalAccess', _226 => _226.atob]) === void 0) {
10201
+ if (_optionalChain([clientOptions, 'access', _226 => _226.polyfills, 'optionalAccess', _227 => _227.atob]) === void 0) {
10165
10202
  throw new Error(
10166
10203
  "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"
10167
10204
  );
@@ -10173,7 +10210,7 @@ function createClient(options) {
10173
10210
  return leaseRoom(newRoomDetails);
10174
10211
  }
10175
10212
  function getRoom(roomId) {
10176
- const room = _optionalChain([roomsById, 'access', _227 => _227.get, 'call', _228 => _228(roomId), 'optionalAccess', _229 => _229.room]);
10213
+ const room = _optionalChain([roomsById, 'access', _228 => _228.get, 'call', _229 => _229(roomId), 'optionalAccess', _230 => _230.room]);
10177
10214
  return room ? room : null;
10178
10215
  }
10179
10216
  function logout() {
@@ -10189,7 +10226,7 @@ function createClient(options) {
10189
10226
  const batchedResolveUsers = new Batch(
10190
10227
  async (batchedUserIds) => {
10191
10228
  const userIds = batchedUserIds.flat();
10192
- const users = await _optionalChain([resolveUsers, 'optionalCall', _230 => _230({ userIds })]);
10229
+ const users = await _optionalChain([resolveUsers, 'optionalCall', _231 => _231({ userIds })]);
10193
10230
  warnOnceIf(
10194
10231
  !resolveUsers,
10195
10232
  "Set the resolveUsers option in createClient to specify user info."
@@ -10206,7 +10243,7 @@ function createClient(options) {
10206
10243
  const batchedResolveRoomsInfo = new Batch(
10207
10244
  async (batchedRoomIds) => {
10208
10245
  const roomIds = batchedRoomIds.flat();
10209
- const roomsInfo = await _optionalChain([resolveRoomsInfo, 'optionalCall', _231 => _231({ roomIds })]);
10246
+ const roomsInfo = await _optionalChain([resolveRoomsInfo, 'optionalCall', _232 => _232({ roomIds })]);
10210
10247
  warnOnceIf(
10211
10248
  !resolveRoomsInfo,
10212
10249
  "Set the resolveRoomsInfo option in createClient to specify room info."
@@ -10223,7 +10260,7 @@ function createClient(options) {
10223
10260
  const batchedResolveGroupsInfo = new Batch(
10224
10261
  async (batchedGroupIds) => {
10225
10262
  const groupIds = batchedGroupIds.flat();
10226
- const groupsInfo = await _optionalChain([resolveGroupsInfo, 'optionalCall', _232 => _232({ groupIds })]);
10263
+ const groupsInfo = await _optionalChain([resolveGroupsInfo, 'optionalCall', _233 => _233({ groupIds })]);
10227
10264
  warnOnceIf(
10228
10265
  !resolveGroupsInfo,
10229
10266
  "Set the resolveGroupsInfo option in createClient to specify group info."
@@ -10279,7 +10316,7 @@ function createClient(options) {
10279
10316
  }
10280
10317
  };
10281
10318
  const win = typeof window !== "undefined" ? window : void 0;
10282
- _optionalChain([win, 'optionalAccess', _233 => _233.addEventListener, 'call', _234 => _234("beforeunload", maybePreventClose)]);
10319
+ _optionalChain([win, 'optionalAccess', _234 => _234.addEventListener, 'call', _235 => _235("beforeunload", maybePreventClose)]);
10283
10320
  }
10284
10321
  async function getNotificationSettings(options2) {
10285
10322
  const plainSettings = await httpClient.getNotificationSettings(options2);
@@ -10406,7 +10443,7 @@ var commentBodyElementsTypes = {
10406
10443
  mention: "inline"
10407
10444
  };
10408
10445
  function traverseCommentBody(body, elementOrVisitor, possiblyVisitor) {
10409
- if (!body || !_optionalChain([body, 'optionalAccess', _235 => _235.content])) {
10446
+ if (!body || !_optionalChain([body, 'optionalAccess', _236 => _236.content])) {
10410
10447
  return;
10411
10448
  }
10412
10449
  const element = typeof elementOrVisitor === "string" ? elementOrVisitor : void 0;
@@ -10416,13 +10453,13 @@ function traverseCommentBody(body, elementOrVisitor, possiblyVisitor) {
10416
10453
  for (const block of body.content) {
10417
10454
  if (type === "all" || type === "block") {
10418
10455
  if (guard(block)) {
10419
- _optionalChain([visitor, 'optionalCall', _236 => _236(block)]);
10456
+ _optionalChain([visitor, 'optionalCall', _237 => _237(block)]);
10420
10457
  }
10421
10458
  }
10422
10459
  if (type === "all" || type === "inline") {
10423
10460
  for (const inline of block.children) {
10424
10461
  if (guard(inline)) {
10425
- _optionalChain([visitor, 'optionalCall', _237 => _237(inline)]);
10462
+ _optionalChain([visitor, 'optionalCall', _238 => _238(inline)]);
10426
10463
  }
10427
10464
  }
10428
10465
  }
@@ -10592,7 +10629,7 @@ var stringifyCommentBodyPlainElements = {
10592
10629
  text: ({ element }) => element.text,
10593
10630
  link: ({ element }) => _nullishCoalesce(element.text, () => ( element.url)),
10594
10631
  mention: ({ element, user, group }) => {
10595
- return `@${_nullishCoalesce(_nullishCoalesce(_optionalChain([user, 'optionalAccess', _238 => _238.name]), () => ( _optionalChain([group, 'optionalAccess', _239 => _239.name]))), () => ( element.id))}`;
10632
+ return `@${_nullishCoalesce(_nullishCoalesce(_optionalChain([user, 'optionalAccess', _239 => _239.name]), () => ( _optionalChain([group, 'optionalAccess', _240 => _240.name]))), () => ( element.id))}`;
10596
10633
  }
10597
10634
  };
10598
10635
  var stringifyCommentBodyHtmlElements = {
@@ -10622,7 +10659,7 @@ var stringifyCommentBodyHtmlElements = {
10622
10659
  return html`<a href="${href}" target="_blank" rel="noopener noreferrer">${element.text ? html`${element.text}` : element.url}</a>`;
10623
10660
  },
10624
10661
  mention: ({ element, user, group }) => {
10625
- return html`<span data-mention>@${_optionalChain([user, 'optionalAccess', _240 => _240.name]) ? html`${_optionalChain([user, 'optionalAccess', _241 => _241.name])}` : _optionalChain([group, 'optionalAccess', _242 => _242.name]) ? html`${_optionalChain([group, 'optionalAccess', _243 => _243.name])}` : element.id}</span>`;
10662
+ return html`<span data-mention>@${_optionalChain([user, 'optionalAccess', _241 => _241.name]) ? html`${_optionalChain([user, 'optionalAccess', _242 => _242.name])}` : _optionalChain([group, 'optionalAccess', _243 => _243.name]) ? html`${_optionalChain([group, 'optionalAccess', _244 => _244.name])}` : element.id}</span>`;
10626
10663
  }
10627
10664
  };
10628
10665
  var stringifyCommentBodyMarkdownElements = {
@@ -10652,20 +10689,20 @@ var stringifyCommentBodyMarkdownElements = {
10652
10689
  return markdown`[${_nullishCoalesce(element.text, () => ( element.url))}](${href})`;
10653
10690
  },
10654
10691
  mention: ({ element, user, group }) => {
10655
- return markdown`@${_nullishCoalesce(_nullishCoalesce(_optionalChain([user, 'optionalAccess', _244 => _244.name]), () => ( _optionalChain([group, 'optionalAccess', _245 => _245.name]))), () => ( element.id))}`;
10692
+ return markdown`@${_nullishCoalesce(_nullishCoalesce(_optionalChain([user, 'optionalAccess', _245 => _245.name]), () => ( _optionalChain([group, 'optionalAccess', _246 => _246.name]))), () => ( element.id))}`;
10656
10693
  }
10657
10694
  };
10658
10695
  async function stringifyCommentBody(body, options) {
10659
- const format = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _246 => _246.format]), () => ( "plain"));
10660
- const separator = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _247 => _247.separator]), () => ( (format === "markdown" ? "\n\n" : "\n")));
10696
+ const format = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _247 => _247.format]), () => ( "plain"));
10697
+ const separator = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _248 => _248.separator]), () => ( (format === "markdown" ? "\n\n" : "\n")));
10661
10698
  const elements = {
10662
10699
  ...format === "html" ? stringifyCommentBodyHtmlElements : format === "markdown" ? stringifyCommentBodyMarkdownElements : stringifyCommentBodyPlainElements,
10663
- ..._optionalChain([options, 'optionalAccess', _248 => _248.elements])
10700
+ ..._optionalChain([options, 'optionalAccess', _249 => _249.elements])
10664
10701
  };
10665
10702
  const { users: resolvedUsers, groups: resolvedGroupsInfo } = await resolveMentionsInCommentBody(
10666
10703
  body,
10667
- _optionalChain([options, 'optionalAccess', _249 => _249.resolveUsers]),
10668
- _optionalChain([options, 'optionalAccess', _250 => _250.resolveGroupsInfo])
10704
+ _optionalChain([options, 'optionalAccess', _250 => _250.resolveUsers]),
10705
+ _optionalChain([options, 'optionalAccess', _251 => _251.resolveGroupsInfo])
10669
10706
  );
10670
10707
  const blocks = body.content.flatMap((block, blockIndex) => {
10671
10708
  switch (block.type) {
@@ -10952,12 +10989,12 @@ function legacy_patchImmutableNode(state, path, update) {
10952
10989
  }
10953
10990
  const newState = Object.assign({}, state);
10954
10991
  for (const key in update.updates) {
10955
- if (_optionalChain([update, 'access', _251 => _251.updates, 'access', _252 => _252[key], 'optionalAccess', _253 => _253.type]) === "update") {
10992
+ if (_optionalChain([update, 'access', _252 => _252.updates, 'access', _253 => _253[key], 'optionalAccess', _254 => _254.type]) === "update") {
10956
10993
  const val = update.node.get(key);
10957
10994
  if (val !== void 0) {
10958
10995
  newState[key] = lsonToJson(val);
10959
10996
  }
10960
- } else if (_optionalChain([update, 'access', _254 => _254.updates, 'access', _255 => _255[key], 'optionalAccess', _256 => _256.type]) === "delete") {
10997
+ } else if (_optionalChain([update, 'access', _255 => _255.updates, 'access', _256 => _256[key], 'optionalAccess', _257 => _257.type]) === "delete") {
10961
10998
  delete newState[key];
10962
10999
  }
10963
11000
  }
@@ -11018,12 +11055,12 @@ function legacy_patchImmutableNode(state, path, update) {
11018
11055
  }
11019
11056
  const newState = Object.assign({}, state);
11020
11057
  for (const key in update.updates) {
11021
- if (_optionalChain([update, 'access', _257 => _257.updates, 'access', _258 => _258[key], 'optionalAccess', _259 => _259.type]) === "update") {
11058
+ if (_optionalChain([update, 'access', _258 => _258.updates, 'access', _259 => _259[key], 'optionalAccess', _260 => _260.type]) === "update") {
11022
11059
  const value = update.node.get(key);
11023
11060
  if (value !== void 0) {
11024
11061
  newState[key] = lsonToJson(value);
11025
11062
  }
11026
- } else if (_optionalChain([update, 'access', _260 => _260.updates, 'access', _261 => _261[key], 'optionalAccess', _262 => _262.type]) === "delete") {
11063
+ } else if (_optionalChain([update, 'access', _261 => _261.updates, 'access', _262 => _262[key], 'optionalAccess', _263 => _263.type]) === "delete") {
11027
11064
  delete newState[key];
11028
11065
  }
11029
11066
  }
@@ -11103,9 +11140,9 @@ function makePoller(callback, intervalMs, options) {
11103
11140
  const startTime = performance.now();
11104
11141
  const doc = typeof document !== "undefined" ? document : void 0;
11105
11142
  const win = typeof window !== "undefined" ? window : void 0;
11106
- const maxStaleTimeMs = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _263 => _263.maxStaleTimeMs]), () => ( Number.POSITIVE_INFINITY));
11143
+ const maxStaleTimeMs = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _264 => _264.maxStaleTimeMs]), () => ( Number.POSITIVE_INFINITY));
11107
11144
  const context = {
11108
- inForeground: _optionalChain([doc, 'optionalAccess', _264 => _264.visibilityState]) !== "hidden",
11145
+ inForeground: _optionalChain([doc, 'optionalAccess', _265 => _265.visibilityState]) !== "hidden",
11109
11146
  lastSuccessfulPollAt: startTime,
11110
11147
  count: 0,
11111
11148
  backoff: 0
@@ -11186,11 +11223,11 @@ function makePoller(callback, intervalMs, options) {
11186
11223
  pollNowIfStale();
11187
11224
  }
11188
11225
  function onVisibilityChange() {
11189
- setInForeground(_optionalChain([doc, 'optionalAccess', _265 => _265.visibilityState]) !== "hidden");
11226
+ setInForeground(_optionalChain([doc, 'optionalAccess', _266 => _266.visibilityState]) !== "hidden");
11190
11227
  }
11191
- _optionalChain([doc, 'optionalAccess', _266 => _266.addEventListener, 'call', _267 => _267("visibilitychange", onVisibilityChange)]);
11192
- _optionalChain([win, 'optionalAccess', _268 => _268.addEventListener, 'call', _269 => _269("online", onVisibilityChange)]);
11193
- _optionalChain([win, 'optionalAccess', _270 => _270.addEventListener, 'call', _271 => _271("focus", pollNowIfStale)]);
11228
+ _optionalChain([doc, 'optionalAccess', _267 => _267.addEventListener, 'call', _268 => _268("visibilitychange", onVisibilityChange)]);
11229
+ _optionalChain([win, 'optionalAccess', _269 => _269.addEventListener, 'call', _270 => _270("online", onVisibilityChange)]);
11230
+ _optionalChain([win, 'optionalAccess', _271 => _271.addEventListener, 'call', _272 => _272("focus", pollNowIfStale)]);
11194
11231
  fsm.start();
11195
11232
  return {
11196
11233
  inc,