@liveblocks/core 3.1.0 → 3.1.1

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
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; } var _class;var __defProp = Object.defineProperty;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; } var _class; var _class2;var __defProp = Object.defineProperty;
2
2
  var __export = (target, all) => {
3
3
  for (var name in all)
4
4
  __defProp(target, name, { get: all[name], enumerable: true });
@@ -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.1.0";
9
+ var PKG_VERSION = "3.1.1";
10
10
  var PKG_FORMAT = "cjs";
11
11
 
12
12
  // src/dupe-detection.ts
@@ -3794,8 +3794,8 @@ function createStore_forTools() {
3794
3794
  return DerivedSignal.from(() => {
3795
3795
  return (
3796
3796
  // A tool that's registered and scoped to a specific chat ID...
3797
- _nullishCoalesce(_optionalChain([(chatId !== void 0 ? _optionalChain([toolsByChatId\u03A3, 'access', _57 => _57.get, 'call', _58 => _58(chatId), 'optionalAccess', _59 => _59.get, 'call', _60 => _60(name)]) : void 0), 'optionalAccess', _61 => _61.get, 'call', _62 => _62()]), () => ( // ...or a globally registered tool
3798
- _optionalChain([toolsByChatId\u03A3, 'access', _63 => _63.getOrCreate, 'call', _64 => _64(kWILDCARD), 'access', _65 => _65.get, 'call', _66 => _66(name), 'optionalAccess', _67 => _67.get, 'call', _68 => _68()])))
3797
+ _nullishCoalesce(_optionalChain([(chatId !== void 0 ? toolsByChatId\u03A3.getOrCreate(chatId).getOrCreate(name) : void 0), 'optionalAccess', _57 => _57.get, 'call', _58 => _58()]), () => ( // ...or a globally registered tool
3798
+ toolsByChatId\u03A3.getOrCreate(kWILDCARD).getOrCreate(name).get()))
3799
3799
  );
3800
3800
  });
3801
3801
  });
@@ -3824,8 +3824,8 @@ function createStore_forTools() {
3824
3824
  const globalTools\u03A3 = toolsByChatId\u03A3.get(kWILDCARD);
3825
3825
  const scopedTools\u03A3 = toolsByChatId\u03A3.get(chatId);
3826
3826
  return Array.from([
3827
- ..._nullishCoalesce(_optionalChain([globalTools\u03A3, 'optionalAccess', _69 => _69.entries, 'call', _70 => _70()]), () => ( [])),
3828
- ..._nullishCoalesce(_optionalChain([scopedTools\u03A3, 'optionalAccess', _71 => _71.entries, 'call', _72 => _72()]), () => ( []))
3827
+ ..._nullishCoalesce(_optionalChain([globalTools\u03A3, 'optionalAccess', _59 => _59.entries, 'call', _60 => _60()]), () => ( [])),
3828
+ ..._nullishCoalesce(_optionalChain([scopedTools\u03A3, 'optionalAccess', _61 => _61.entries, 'call', _62 => _62()]), () => ( []))
3829
3829
  ]).flatMap(([name, tool\u03A3]) => {
3830
3830
  const tool = tool\u03A3.get();
3831
3831
  return tool && (_nullishCoalesce(tool.enabled, () => ( true))) ? [{ name, description: tool.description, parameters: tool.parameters }] : [];
@@ -3926,7 +3926,7 @@ function createStore_forChatMessages(toolsStore, setToolResultFn) {
3926
3926
  } else {
3927
3927
  continue;
3928
3928
  }
3929
- 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]);
3929
+ const executeFn = _optionalChain([toolsStore, 'access', _63 => _63.getTool\u03A3, 'call', _64 => _64(toolInvocation.name, message.chatId), 'access', _65 => _65.get, 'call', _66 => _66(), 'optionalAccess', _67 => _67.execute]);
3930
3930
  if (executeFn) {
3931
3931
  (async () => {
3932
3932
  const result = await executeFn(toolInvocation.args, {
@@ -4021,8 +4021,8 @@ function createStore_forChatMessages(toolsStore, setToolResultFn) {
4021
4021
  const spine = [];
4022
4022
  let lastVisitedMessage = null;
4023
4023
  for (const message2 of pool.walkUp(leaf.id)) {
4024
- const prev = _nullishCoalesce(_optionalChain([first, 'call', _78 => _78(pool.walkLeft(message2.id, isAlive)), 'optionalAccess', _79 => _79.id]), () => ( null));
4025
- const next = _nullishCoalesce(_optionalChain([first, 'call', _80 => _80(pool.walkRight(message2.id, isAlive)), 'optionalAccess', _81 => _81.id]), () => ( null));
4024
+ const prev = _nullishCoalesce(_optionalChain([first, 'call', _68 => _68(pool.walkLeft(message2.id, isAlive)), 'optionalAccess', _69 => _69.id]), () => ( null));
4025
+ const next = _nullishCoalesce(_optionalChain([first, 'call', _70 => _70(pool.walkRight(message2.id, isAlive)), 'optionalAccess', _71 => _71.id]), () => ( null));
4026
4026
  if (!message2.deletedAt || prev || next) {
4027
4027
  const node = {
4028
4028
  ...message2,
@@ -4215,7 +4215,7 @@ function createAi(config) {
4215
4215
  if ("event" in msg) {
4216
4216
  switch (msg.event) {
4217
4217
  case "cmd-failed":
4218
- _optionalChain([pendingCmd, 'optionalAccess', _82 => _82.reject, 'call', _83 => _83(new Error(msg.error))]);
4218
+ _optionalChain([pendingCmd, 'optionalAccess', _72 => _72.reject, 'call', _73 => _73(new Error(msg.error))]);
4219
4219
  break;
4220
4220
  case "delta": {
4221
4221
  const { id, delta } = msg;
@@ -4297,7 +4297,7 @@ function createAi(config) {
4297
4297
  return assertNever(msg, "Unhandled case");
4298
4298
  }
4299
4299
  }
4300
- _optionalChain([pendingCmd, 'optionalAccess', _84 => _84.resolve, 'call', _85 => _85(msg)]);
4300
+ _optionalChain([pendingCmd, 'optionalAccess', _74 => _74.resolve, 'call', _75 => _75(msg)]);
4301
4301
  }
4302
4302
  managedSocket.events.onMessage.subscribe(handleServerMessage);
4303
4303
  managedSocket.events.statusDidChange.subscribe(onStatusDidChange);
@@ -4381,9 +4381,9 @@ function createAi(config) {
4381
4381
  invocationId,
4382
4382
  result,
4383
4383
  generationOptions: {
4384
- copilotId: _optionalChain([options, 'optionalAccess', _86 => _86.copilotId]),
4385
- stream: _optionalChain([options, 'optionalAccess', _87 => _87.stream]),
4386
- timeout: _optionalChain([options, 'optionalAccess', _88 => _88.timeout]),
4384
+ copilotId: _optionalChain([options, 'optionalAccess', _76 => _76.copilotId]),
4385
+ stream: _optionalChain([options, 'optionalAccess', _77 => _77.stream]),
4386
+ timeout: _optionalChain([options, 'optionalAccess', _78 => _78.timeout]),
4387
4387
  // Knowledge and tools aren't coming from the options, but retrieved
4388
4388
  // from the global context
4389
4389
  knowledge: knowledge.length > 0 ? knowledge : void 0,
@@ -4419,9 +4419,9 @@ function createAi(config) {
4419
4419
  sourceMessage: userMessage,
4420
4420
  targetMessageId,
4421
4421
  generationOptions: {
4422
- copilotId: _optionalChain([options, 'optionalAccess', _89 => _89.copilotId]),
4423
- stream: _optionalChain([options, 'optionalAccess', _90 => _90.stream]),
4424
- timeout: _optionalChain([options, 'optionalAccess', _91 => _91.timeout]),
4422
+ copilotId: _optionalChain([options, 'optionalAccess', _79 => _79.copilotId]),
4423
+ stream: _optionalChain([options, 'optionalAccess', _80 => _80.stream]),
4424
+ timeout: _optionalChain([options, 'optionalAccess', _81 => _81.timeout]),
4425
4425
  // Knowledge and tools aren't coming from the options, but retrieved
4426
4426
  // from the global context
4427
4427
  knowledge: knowledge.length > 0 ? knowledge : void 0,
@@ -4523,7 +4523,7 @@ function createAuthManager(authOptions, onAuthenticate) {
4523
4523
  return void 0;
4524
4524
  }
4525
4525
  async function makeAuthRequest(options) {
4526
- const fetcher = _nullishCoalesce(_optionalChain([authOptions, 'access', _92 => _92.polyfills, 'optionalAccess', _93 => _93.fetch]), () => ( (typeof window === "undefined" ? void 0 : window.fetch)));
4526
+ const fetcher = _nullishCoalesce(_optionalChain([authOptions, 'access', _82 => _82.polyfills, 'optionalAccess', _83 => _83.fetch]), () => ( (typeof window === "undefined" ? void 0 : window.fetch)));
4527
4527
  if (authentication.type === "private") {
4528
4528
  if (fetcher === void 0) {
4529
4529
  throw new StopRetrying(
@@ -4539,7 +4539,7 @@ function createAuthManager(authOptions, onAuthenticate) {
4539
4539
  "The same Liveblocks auth token was issued from the backend before. Caching Liveblocks tokens is not supported."
4540
4540
  );
4541
4541
  }
4542
- _optionalChain([onAuthenticate, 'optionalCall', _94 => _94(parsed.parsed)]);
4542
+ _optionalChain([onAuthenticate, 'optionalCall', _84 => _84(parsed.parsed)]);
4543
4543
  return parsed;
4544
4544
  }
4545
4545
  if (authentication.type === "custom") {
@@ -4547,7 +4547,7 @@ function createAuthManager(authOptions, onAuthenticate) {
4547
4547
  if (response && typeof response === "object") {
4548
4548
  if (typeof response.token === "string") {
4549
4549
  const parsed = parseAuthToken(response.token);
4550
- _optionalChain([onAuthenticate, 'optionalCall', _95 => _95(parsed.parsed)]);
4550
+ _optionalChain([onAuthenticate, 'optionalCall', _85 => _85(parsed.parsed)]);
4551
4551
  return parsed;
4552
4552
  } else if (typeof response.error === "string") {
4553
4553
  const reason = `Authentication failed: ${"reason" in response && typeof response.reason === "string" ? response.reason : "Forbidden"}`;
@@ -4705,7 +4705,7 @@ function sendToPanel(message, options) {
4705
4705
  ...message,
4706
4706
  source: "liveblocks-devtools-client"
4707
4707
  };
4708
- if (!(_optionalChain([options, 'optionalAccess', _96 => _96.force]) || _bridgeActive)) {
4708
+ if (!(_optionalChain([options, 'optionalAccess', _86 => _86.force]) || _bridgeActive)) {
4709
4709
  return;
4710
4710
  }
4711
4711
  window.postMessage(fullMsg, "*");
@@ -4713,7 +4713,7 @@ function sendToPanel(message, options) {
4713
4713
  var eventSource = makeEventSource();
4714
4714
  if (process.env.NODE_ENV !== "production" && typeof window !== "undefined") {
4715
4715
  window.addEventListener("message", (event) => {
4716
- if (event.source === window && _optionalChain([event, 'access', _97 => _97.data, 'optionalAccess', _98 => _98.source]) === "liveblocks-devtools-panel") {
4716
+ if (event.source === window && _optionalChain([event, 'access', _87 => _87.data, 'optionalAccess', _88 => _88.source]) === "liveblocks-devtools-panel") {
4717
4717
  eventSource.notify(event.data);
4718
4718
  } else {
4719
4719
  }
@@ -4855,7 +4855,7 @@ function fullSync(room) {
4855
4855
  msg: "room::sync::full",
4856
4856
  roomId: room.id,
4857
4857
  status: room.getStatus(),
4858
- storage: _nullishCoalesce(_optionalChain([root, 'optionalAccess', _99 => _99.toTreeNode, 'call', _100 => _100("root"), 'access', _101 => _101.payload]), () => ( null)),
4858
+ storage: _nullishCoalesce(_optionalChain([root, 'optionalAccess', _89 => _89.toTreeNode, 'call', _90 => _90("root"), 'access', _91 => _91.payload]), () => ( null)),
4859
4859
  me,
4860
4860
  others
4861
4861
  });
@@ -5146,7 +5146,7 @@ function createManagedPool(roomId, options) {
5146
5146
  generateId: () => `${getCurrentConnectionId()}:${clock++}`,
5147
5147
  generateOpId: () => `${getCurrentConnectionId()}:${opClock++}`,
5148
5148
  dispatch(ops, reverse, storageUpdates) {
5149
- _optionalChain([onDispatch, 'optionalCall', _102 => _102(ops, reverse, storageUpdates)]);
5149
+ _optionalChain([onDispatch, 'optionalCall', _92 => _92(ops, reverse, storageUpdates)]);
5150
5150
  },
5151
5151
  assertStorageIsWritable: () => {
5152
5152
  if (!isStorageWritable()) {
@@ -5373,7 +5373,7 @@ var LiveRegister = class _LiveRegister extends AbstractCrdt {
5373
5373
  return [
5374
5374
  {
5375
5375
  type: 8 /* CREATE_REGISTER */,
5376
- opId: _optionalChain([pool, 'optionalAccess', _103 => _103.generateOpId, 'call', _104 => _104()]),
5376
+ opId: _optionalChain([pool, 'optionalAccess', _93 => _93.generateOpId, 'call', _94 => _94()]),
5377
5377
  id: this._id,
5378
5378
  parentId,
5379
5379
  parentKey,
@@ -5479,7 +5479,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
5479
5479
  const ops = [];
5480
5480
  const op = {
5481
5481
  id: this._id,
5482
- opId: _optionalChain([pool, 'optionalAccess', _105 => _105.generateOpId, 'call', _106 => _106()]),
5482
+ opId: _optionalChain([pool, 'optionalAccess', _95 => _95.generateOpId, 'call', _96 => _96()]),
5483
5483
  type: 2 /* CREATE_LIST */,
5484
5484
  parentId,
5485
5485
  parentKey
@@ -5750,7 +5750,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
5750
5750
  #applyInsertUndoRedo(op) {
5751
5751
  const { id, parentKey: key } = op;
5752
5752
  const child = creationOpToLiveNode(op);
5753
- if (_optionalChain([this, 'access', _107 => _107._pool, 'optionalAccess', _108 => _108.getNode, 'call', _109 => _109(id)]) !== void 0) {
5753
+ if (_optionalChain([this, 'access', _97 => _97._pool, 'optionalAccess', _98 => _98.getNode, 'call', _99 => _99(id)]) !== void 0) {
5754
5754
  return { modified: false };
5755
5755
  }
5756
5756
  child._attach(id, nn(this._pool));
@@ -5758,8 +5758,8 @@ var LiveList = class _LiveList extends AbstractCrdt {
5758
5758
  const existingItemIndex = this._indexOfPosition(key);
5759
5759
  let newKey = key;
5760
5760
  if (existingItemIndex !== -1) {
5761
- const before2 = _optionalChain([this, 'access', _110 => _110.#items, 'access', _111 => _111[existingItemIndex], 'optionalAccess', _112 => _112._parentPos]);
5762
- const after2 = _optionalChain([this, 'access', _113 => _113.#items, 'access', _114 => _114[existingItemIndex + 1], 'optionalAccess', _115 => _115._parentPos]);
5761
+ const before2 = _optionalChain([this, 'access', _100 => _100.#items, 'access', _101 => _101[existingItemIndex], 'optionalAccess', _102 => _102._parentPos]);
5762
+ const after2 = _optionalChain([this, 'access', _103 => _103.#items, 'access', _104 => _104[existingItemIndex + 1], 'optionalAccess', _105 => _105._parentPos]);
5763
5763
  newKey = makePosition(before2, after2);
5764
5764
  child._setParentLink(this, newKey);
5765
5765
  }
@@ -5773,7 +5773,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
5773
5773
  #applySetUndoRedo(op) {
5774
5774
  const { id, parentKey: key } = op;
5775
5775
  const child = creationOpToLiveNode(op);
5776
- if (_optionalChain([this, 'access', _116 => _116._pool, 'optionalAccess', _117 => _117.getNode, 'call', _118 => _118(id)]) !== void 0) {
5776
+ if (_optionalChain([this, 'access', _106 => _106._pool, 'optionalAccess', _107 => _107.getNode, 'call', _108 => _108(id)]) !== void 0) {
5777
5777
  return { modified: false };
5778
5778
  }
5779
5779
  this.#unacknowledgedSets.set(key, nn(op.opId));
@@ -5894,7 +5894,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
5894
5894
  } else {
5895
5895
  this.#items[existingItemIndex]._setParentLink(
5896
5896
  this,
5897
- makePosition(newKey, _optionalChain([this, 'access', _119 => _119.#items, 'access', _120 => _120[existingItemIndex + 1], 'optionalAccess', _121 => _121._parentPos]))
5897
+ makePosition(newKey, _optionalChain([this, 'access', _109 => _109.#items, 'access', _110 => _110[existingItemIndex + 1], 'optionalAccess', _111 => _111._parentPos]))
5898
5898
  );
5899
5899
  const previousIndex = this.#items.indexOf(child);
5900
5900
  child._setParentLink(this, newKey);
@@ -5919,7 +5919,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
5919
5919
  if (existingItemIndex !== -1) {
5920
5920
  this.#items[existingItemIndex]._setParentLink(
5921
5921
  this,
5922
- makePosition(newKey, _optionalChain([this, 'access', _122 => _122.#items, 'access', _123 => _123[existingItemIndex + 1], 'optionalAccess', _124 => _124._parentPos]))
5922
+ makePosition(newKey, _optionalChain([this, 'access', _112 => _112.#items, 'access', _113 => _113[existingItemIndex + 1], 'optionalAccess', _114 => _114._parentPos]))
5923
5923
  );
5924
5924
  }
5925
5925
  child._setParentLink(this, newKey);
@@ -5938,7 +5938,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
5938
5938
  if (existingItemIndex !== -1) {
5939
5939
  this.#items[existingItemIndex]._setParentLink(
5940
5940
  this,
5941
- makePosition(newKey, _optionalChain([this, 'access', _125 => _125.#items, 'access', _126 => _126[existingItemIndex + 1], 'optionalAccess', _127 => _127._parentPos]))
5941
+ makePosition(newKey, _optionalChain([this, 'access', _115 => _115.#items, 'access', _116 => _116[existingItemIndex + 1], 'optionalAccess', _117 => _117._parentPos]))
5942
5942
  );
5943
5943
  }
5944
5944
  child._setParentLink(this, newKey);
@@ -5965,7 +5965,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
5965
5965
  if (existingItemIndex !== -1) {
5966
5966
  this.#items[existingItemIndex]._setParentLink(
5967
5967
  this,
5968
- makePosition(newKey, _optionalChain([this, 'access', _128 => _128.#items, 'access', _129 => _129[existingItemIndex + 1], 'optionalAccess', _130 => _130._parentPos]))
5968
+ makePosition(newKey, _optionalChain([this, 'access', _118 => _118.#items, 'access', _119 => _119[existingItemIndex + 1], 'optionalAccess', _120 => _120._parentPos]))
5969
5969
  );
5970
5970
  }
5971
5971
  child._setParentLink(this, newKey);
@@ -6023,7 +6023,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
6023
6023
  * @param element The element to add to the end of the LiveList.
6024
6024
  */
6025
6025
  push(element) {
6026
- _optionalChain([this, 'access', _131 => _131._pool, 'optionalAccess', _132 => _132.assertStorageIsWritable, 'call', _133 => _133()]);
6026
+ _optionalChain([this, 'access', _121 => _121._pool, 'optionalAccess', _122 => _122.assertStorageIsWritable, 'call', _123 => _123()]);
6027
6027
  return this.insert(element, this.length);
6028
6028
  }
6029
6029
  /**
@@ -6032,7 +6032,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
6032
6032
  * @param index The index at which you want to insert the element.
6033
6033
  */
6034
6034
  insert(element, index) {
6035
- _optionalChain([this, 'access', _134 => _134._pool, 'optionalAccess', _135 => _135.assertStorageIsWritable, 'call', _136 => _136()]);
6035
+ _optionalChain([this, 'access', _124 => _124._pool, 'optionalAccess', _125 => _125.assertStorageIsWritable, 'call', _126 => _126()]);
6036
6036
  if (index < 0 || index > this.#items.length) {
6037
6037
  throw new Error(
6038
6038
  `Cannot insert list item at index "${index}". index should be between 0 and ${this.#items.length}`
@@ -6062,7 +6062,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
6062
6062
  * @param targetIndex The index where the element should be after moving.
6063
6063
  */
6064
6064
  move(index, targetIndex) {
6065
- _optionalChain([this, 'access', _137 => _137._pool, 'optionalAccess', _138 => _138.assertStorageIsWritable, 'call', _139 => _139()]);
6065
+ _optionalChain([this, 'access', _127 => _127._pool, 'optionalAccess', _128 => _128.assertStorageIsWritable, 'call', _129 => _129()]);
6066
6066
  if (targetIndex < 0) {
6067
6067
  throw new Error("targetIndex cannot be less than 0");
6068
6068
  }
@@ -6120,7 +6120,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
6120
6120
  * @param index The index of the element to delete
6121
6121
  */
6122
6122
  delete(index) {
6123
- _optionalChain([this, 'access', _140 => _140._pool, 'optionalAccess', _141 => _141.assertStorageIsWritable, 'call', _142 => _142()]);
6123
+ _optionalChain([this, 'access', _130 => _130._pool, 'optionalAccess', _131 => _131.assertStorageIsWritable, 'call', _132 => _132()]);
6124
6124
  if (index < 0 || index >= this.#items.length) {
6125
6125
  throw new Error(
6126
6126
  `Cannot delete list item at index "${index}". index should be between 0 and ${this.#items.length - 1}`
@@ -6153,7 +6153,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
6153
6153
  }
6154
6154
  }
6155
6155
  clear() {
6156
- _optionalChain([this, 'access', _143 => _143._pool, 'optionalAccess', _144 => _144.assertStorageIsWritable, 'call', _145 => _145()]);
6156
+ _optionalChain([this, 'access', _133 => _133._pool, 'optionalAccess', _134 => _134.assertStorageIsWritable, 'call', _135 => _135()]);
6157
6157
  if (this._pool) {
6158
6158
  const ops = [];
6159
6159
  const reverseOps = [];
@@ -6187,7 +6187,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
6187
6187
  }
6188
6188
  }
6189
6189
  set(index, item) {
6190
- _optionalChain([this, 'access', _146 => _146._pool, 'optionalAccess', _147 => _147.assertStorageIsWritable, 'call', _148 => _148()]);
6190
+ _optionalChain([this, 'access', _136 => _136._pool, 'optionalAccess', _137 => _137.assertStorageIsWritable, 'call', _138 => _138()]);
6191
6191
  if (index < 0 || index >= this.#items.length) {
6192
6192
  throw new Error(
6193
6193
  `Cannot set list item at index "${index}". index should be between 0 and ${this.#items.length - 1}`
@@ -6333,7 +6333,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
6333
6333
  #shiftItemPosition(index, key) {
6334
6334
  const shiftedPosition = makePosition(
6335
6335
  key,
6336
- this.#items.length > index + 1 ? _optionalChain([this, 'access', _149 => _149.#items, 'access', _150 => _150[index + 1], 'optionalAccess', _151 => _151._parentPos]) : void 0
6336
+ this.#items.length > index + 1 ? _optionalChain([this, 'access', _139 => _139.#items, 'access', _140 => _140[index + 1], 'optionalAccess', _141 => _141._parentPos]) : void 0
6337
6337
  );
6338
6338
  this.#items[index]._setParentLink(this, shiftedPosition);
6339
6339
  }
@@ -6458,7 +6458,7 @@ var LiveMap = class _LiveMap extends AbstractCrdt {
6458
6458
  const ops = [];
6459
6459
  const op = {
6460
6460
  id: this._id,
6461
- opId: _optionalChain([pool, 'optionalAccess', _152 => _152.generateOpId, 'call', _153 => _153()]),
6461
+ opId: _optionalChain([pool, 'optionalAccess', _142 => _142.generateOpId, 'call', _143 => _143()]),
6462
6462
  type: 7 /* CREATE_MAP */,
6463
6463
  parentId,
6464
6464
  parentKey
@@ -6593,7 +6593,7 @@ var LiveMap = class _LiveMap extends AbstractCrdt {
6593
6593
  * @param value The value of the element to add. Should be serializable to JSON.
6594
6594
  */
6595
6595
  set(key, value) {
6596
- _optionalChain([this, 'access', _154 => _154._pool, 'optionalAccess', _155 => _155.assertStorageIsWritable, 'call', _156 => _156()]);
6596
+ _optionalChain([this, 'access', _144 => _144._pool, 'optionalAccess', _145 => _145.assertStorageIsWritable, 'call', _146 => _146()]);
6597
6597
  const oldValue = this.#map.get(key);
6598
6598
  if (oldValue) {
6599
6599
  oldValue._detach();
@@ -6639,7 +6639,7 @@ var LiveMap = class _LiveMap extends AbstractCrdt {
6639
6639
  * @returns true if an element existed and has been removed, or false if the element does not exist.
6640
6640
  */
6641
6641
  delete(key) {
6642
- _optionalChain([this, 'access', _157 => _157._pool, 'optionalAccess', _158 => _158.assertStorageIsWritable, 'call', _159 => _159()]);
6642
+ _optionalChain([this, 'access', _147 => _147._pool, 'optionalAccess', _148 => _148.assertStorageIsWritable, 'call', _149 => _149()]);
6643
6643
  const item = this.#map.get(key);
6644
6644
  if (item === void 0) {
6645
6645
  return false;
@@ -6768,9 +6768,20 @@ var LiveMap = class _LiveMap extends AbstractCrdt {
6768
6768
  };
6769
6769
 
6770
6770
  // src/crdts/LiveObject.ts
6771
- var LiveObject = class _LiveObject extends AbstractCrdt {
6771
+ var MAX_LIVE_OBJECT_SIZE = 128 * 1024;
6772
+ var LiveObject = (_class2 = class _LiveObject extends AbstractCrdt {
6772
6773
  #map;
6773
6774
  #propToLastUpdate;
6775
+ /**
6776
+ * Enable or disable detection of too large LiveObjects.
6777
+ * When enabled, throws an error if LiveObject static data exceeds 128KB, which
6778
+ * is the maximum value the server will be able to accept.
6779
+ * By default, this behavior is disabled to avoid the runtime performance
6780
+ * overhead on every LiveObject.set() or LiveObject.update() call.
6781
+ *
6782
+ * @experimental
6783
+ */
6784
+ static __initStatic() {this.detectLargeObjects = false}
6774
6785
  static #buildRootAndParentToChildren(items) {
6775
6786
  const parentToChildren = /* @__PURE__ */ new Map();
6776
6787
  let root = null;
@@ -6818,7 +6829,7 @@ var LiveObject = class _LiveObject extends AbstractCrdt {
6818
6829
  if (this._id === void 0) {
6819
6830
  throw new Error("Cannot serialize item is not attached");
6820
6831
  }
6821
- const opId = _optionalChain([pool, 'optionalAccess', _160 => _160.generateOpId, 'call', _161 => _161()]);
6832
+ const opId = _optionalChain([pool, 'optionalAccess', _150 => _150.generateOpId, 'call', _151 => _151()]);
6822
6833
  const ops = [];
6823
6834
  const op = {
6824
6835
  type: 4 /* CREATE_OBJECT */,
@@ -7090,7 +7101,7 @@ var LiveObject = class _LiveObject extends AbstractCrdt {
7090
7101
  * @param value The value of the property to add
7091
7102
  */
7092
7103
  set(key, value) {
7093
- _optionalChain([this, 'access', _162 => _162._pool, 'optionalAccess', _163 => _163.assertStorageIsWritable, 'call', _164 => _164()]);
7104
+ _optionalChain([this, 'access', _152 => _152._pool, 'optionalAccess', _153 => _153.assertStorageIsWritable, 'call', _154 => _154()]);
7094
7105
  this.update({ [key]: value });
7095
7106
  }
7096
7107
  /**
@@ -7105,7 +7116,7 @@ var LiveObject = class _LiveObject extends AbstractCrdt {
7105
7116
  * @param key The key of the property to delete
7106
7117
  */
7107
7118
  delete(key) {
7108
- _optionalChain([this, 'access', _165 => _165._pool, 'optionalAccess', _166 => _166.assertStorageIsWritable, 'call', _167 => _167()]);
7119
+ _optionalChain([this, 'access', _155 => _155._pool, 'optionalAccess', _156 => _156.assertStorageIsWritable, 'call', _157 => _157()]);
7109
7120
  const keyAsString = key;
7110
7121
  const oldValue = this.#map.get(keyAsString);
7111
7122
  if (oldValue === void 0) {
@@ -7158,7 +7169,32 @@ var LiveObject = class _LiveObject extends AbstractCrdt {
7158
7169
  * @param patch The object used to overrides properties
7159
7170
  */
7160
7171
  update(patch) {
7161
- _optionalChain([this, 'access', _168 => _168._pool, 'optionalAccess', _169 => _169.assertStorageIsWritable, 'call', _170 => _170()]);
7172
+ _optionalChain([this, 'access', _158 => _158._pool, 'optionalAccess', _159 => _159.assertStorageIsWritable, 'call', _160 => _160()]);
7173
+ if (_LiveObject.detectLargeObjects) {
7174
+ const data = {};
7175
+ for (const [key, value] of this.#map) {
7176
+ if (!isLiveNode(value)) {
7177
+ data[key] = value;
7178
+ }
7179
+ }
7180
+ for (const key of Object.keys(patch)) {
7181
+ const value = patch[key];
7182
+ if (value === void 0) continue;
7183
+ if (!isLiveNode(value)) {
7184
+ data[key] = value;
7185
+ }
7186
+ }
7187
+ const jsonString = JSON.stringify(data);
7188
+ const upperBoundSize = jsonString.length * 4;
7189
+ if (upperBoundSize > MAX_LIVE_OBJECT_SIZE) {
7190
+ const preciseSize = new TextEncoder().encode(jsonString).length;
7191
+ if (preciseSize > MAX_LIVE_OBJECT_SIZE) {
7192
+ throw new Error(
7193
+ `LiveObject size exceeded limit: ${preciseSize} bytes > ${MAX_LIVE_OBJECT_SIZE} bytes. See https://liveblocks.io/docs/platform/limits#Liveblocks-Storage-limits`
7194
+ );
7195
+ }
7196
+ }
7197
+ }
7162
7198
  if (this._pool === void 0 || this._id === void 0) {
7163
7199
  for (const key in patch) {
7164
7200
  const newValue = patch[key];
@@ -7276,7 +7312,7 @@ var LiveObject = class _LiveObject extends AbstractCrdt {
7276
7312
  )
7277
7313
  );
7278
7314
  }
7279
- };
7315
+ }, _class2.__initStatic(), _class2);
7280
7316
 
7281
7317
  // src/crdts/liveblocks-helpers.ts
7282
7318
  function creationOpToLiveNode(op) {
@@ -7879,15 +7915,15 @@ function installBackgroundTabSpy() {
7879
7915
  const doc = typeof document !== "undefined" ? document : void 0;
7880
7916
  const inBackgroundSince = { current: null };
7881
7917
  function onVisibilityChange() {
7882
- if (_optionalChain([doc, 'optionalAccess', _171 => _171.visibilityState]) === "hidden") {
7918
+ if (_optionalChain([doc, 'optionalAccess', _161 => _161.visibilityState]) === "hidden") {
7883
7919
  inBackgroundSince.current = _nullishCoalesce(inBackgroundSince.current, () => ( Date.now()));
7884
7920
  } else {
7885
7921
  inBackgroundSince.current = null;
7886
7922
  }
7887
7923
  }
7888
- _optionalChain([doc, 'optionalAccess', _172 => _172.addEventListener, 'call', _173 => _173("visibilitychange", onVisibilityChange)]);
7924
+ _optionalChain([doc, 'optionalAccess', _162 => _162.addEventListener, 'call', _163 => _163("visibilitychange", onVisibilityChange)]);
7889
7925
  const unsub = () => {
7890
- _optionalChain([doc, 'optionalAccess', _174 => _174.removeEventListener, 'call', _175 => _175("visibilitychange", onVisibilityChange)]);
7926
+ _optionalChain([doc, 'optionalAccess', _164 => _164.removeEventListener, 'call', _165 => _165("visibilitychange", onVisibilityChange)]);
7891
7927
  };
7892
7928
  return [inBackgroundSince, unsub];
7893
7929
  }
@@ -8067,7 +8103,7 @@ function createRoom(options, config) {
8067
8103
  }
8068
8104
  }
8069
8105
  function isStorageWritable() {
8070
- const scopes = _optionalChain([context, 'access', _176 => _176.dynamicSessionInfoSig, 'access', _177 => _177.get, 'call', _178 => _178(), 'optionalAccess', _179 => _179.scopes]);
8106
+ const scopes = _optionalChain([context, 'access', _166 => _166.dynamicSessionInfoSig, 'access', _167 => _167.get, 'call', _168 => _168(), 'optionalAccess', _169 => _169.scopes]);
8071
8107
  return scopes !== void 0 ? canWriteStorage(scopes) : true;
8072
8108
  }
8073
8109
  const eventHub = {
@@ -8184,7 +8220,7 @@ function createRoom(options, config) {
8184
8220
  }
8185
8221
  case "experimental-fallback-to-http": {
8186
8222
  warn("Message is too large for websockets, so sending over HTTP instead");
8187
- const nonce = _nullishCoalesce(_optionalChain([context, 'access', _180 => _180.dynamicSessionInfoSig, 'access', _181 => _181.get, 'call', _182 => _182(), 'optionalAccess', _183 => _183.nonce]), () => ( raise("Session is not authorized to send message over HTTP")));
8223
+ const nonce = _nullishCoalesce(_optionalChain([context, 'access', _170 => _170.dynamicSessionInfoSig, 'access', _171 => _171.get, 'call', _172 => _172(), 'optionalAccess', _173 => _173.nonce]), () => ( raise("Session is not authorized to send message over HTTP")));
8188
8224
  void httpClient.sendMessages({ roomId, nonce, messages }).then((resp) => {
8189
8225
  if (!resp.ok && resp.status === 403) {
8190
8226
  managedSocket.reconnect();
@@ -8235,7 +8271,7 @@ function createRoom(options, config) {
8235
8271
  } else {
8236
8272
  context.root = LiveObject._fromItems(message.items, context.pool);
8237
8273
  }
8238
- const canWrite = _nullishCoalesce(_optionalChain([self, 'access', _184 => _184.get, 'call', _185 => _185(), 'optionalAccess', _186 => _186.canWrite]), () => ( true));
8274
+ const canWrite = _nullishCoalesce(_optionalChain([self, 'access', _174 => _174.get, 'call', _175 => _175(), 'optionalAccess', _176 => _176.canWrite]), () => ( true));
8239
8275
  const stackSizeBefore = context.undoStack.length;
8240
8276
  for (const key in context.initialStorage) {
8241
8277
  if (context.root.get(key) === void 0) {
@@ -8438,7 +8474,7 @@ function createRoom(options, config) {
8438
8474
  }
8439
8475
  context.myPresence.patch(patch);
8440
8476
  if (context.activeBatch) {
8441
- if (_optionalChain([options2, 'optionalAccess', _187 => _187.addToHistory])) {
8477
+ if (_optionalChain([options2, 'optionalAccess', _177 => _177.addToHistory])) {
8442
8478
  context.activeBatch.reverseOps.pushLeft({
8443
8479
  type: "presence",
8444
8480
  data: oldValues
@@ -8447,7 +8483,7 @@ function createRoom(options, config) {
8447
8483
  context.activeBatch.updates.presence = true;
8448
8484
  } else {
8449
8485
  flushNowOrSoon();
8450
- if (_optionalChain([options2, 'optionalAccess', _188 => _188.addToHistory])) {
8486
+ if (_optionalChain([options2, 'optionalAccess', _178 => _178.addToHistory])) {
8451
8487
  addToUndoStack([{ type: "presence", data: oldValues }]);
8452
8488
  }
8453
8489
  notify({ presence: true });
@@ -8644,7 +8680,7 @@ function createRoom(options, config) {
8644
8680
  if (process.env.NODE_ENV !== "production") {
8645
8681
  const traces = /* @__PURE__ */ new Set();
8646
8682
  for (const opId of message.opIds) {
8647
- const trace = _optionalChain([context, 'access', _189 => _189.opStackTraces, 'optionalAccess', _190 => _190.get, 'call', _191 => _191(opId)]);
8683
+ const trace = _optionalChain([context, 'access', _179 => _179.opStackTraces, 'optionalAccess', _180 => _180.get, 'call', _181 => _181(opId)]);
8648
8684
  if (trace) {
8649
8685
  traces.add(trace);
8650
8686
  }
@@ -8778,7 +8814,7 @@ ${Array.from(traces).join("\n\n")}`
8778
8814
  const unacknowledgedOps = new Map(context.unacknowledgedOps);
8779
8815
  createOrUpdateRootFromMessage(message);
8780
8816
  applyAndSendOps(unacknowledgedOps);
8781
- _optionalChain([_resolveStoragePromise, 'optionalCall', _192 => _192()]);
8817
+ _optionalChain([_resolveStoragePromise, 'optionalCall', _182 => _182()]);
8782
8818
  notifyStorageStatus();
8783
8819
  eventHub.storageDidLoad.notify();
8784
8820
  }
@@ -8999,8 +9035,8 @@ ${Array.from(traces).join("\n\n")}`
8999
9035
  async function getThreads(options2) {
9000
9036
  return httpClient.getThreads({
9001
9037
  roomId,
9002
- query: _optionalChain([options2, 'optionalAccess', _193 => _193.query]),
9003
- cursor: _optionalChain([options2, 'optionalAccess', _194 => _194.cursor])
9038
+ query: _optionalChain([options2, 'optionalAccess', _183 => _183.query]),
9039
+ cursor: _optionalChain([options2, 'optionalAccess', _184 => _184.cursor])
9004
9040
  });
9005
9041
  }
9006
9042
  async function getThread(threadId) {
@@ -9107,7 +9143,7 @@ ${Array.from(traces).join("\n\n")}`
9107
9143
  function getSubscriptionSettings(options2) {
9108
9144
  return httpClient.getSubscriptionSettings({
9109
9145
  roomId,
9110
- signal: _optionalChain([options2, 'optionalAccess', _195 => _195.signal])
9146
+ signal: _optionalChain([options2, 'optionalAccess', _185 => _185.signal])
9111
9147
  });
9112
9148
  }
9113
9149
  function updateSubscriptionSettings(settings) {
@@ -9129,7 +9165,7 @@ ${Array.from(traces).join("\n\n")}`
9129
9165
  {
9130
9166
  [kInternal]: {
9131
9167
  get presenceBuffer() {
9132
- return deepClone(_nullishCoalesce(_optionalChain([context, 'access', _196 => _196.buffer, 'access', _197 => _197.presenceUpdates, 'optionalAccess', _198 => _198.data]), () => ( null)));
9168
+ return deepClone(_nullishCoalesce(_optionalChain([context, 'access', _186 => _186.buffer, 'access', _187 => _187.presenceUpdates, 'optionalAccess', _188 => _188.data]), () => ( null)));
9133
9169
  },
9134
9170
  // prettier-ignore
9135
9171
  get undoStack() {
@@ -9144,9 +9180,9 @@ ${Array.from(traces).join("\n\n")}`
9144
9180
  return context.yjsProvider;
9145
9181
  },
9146
9182
  setYjsProvider(newProvider) {
9147
- _optionalChain([context, 'access', _199 => _199.yjsProvider, 'optionalAccess', _200 => _200.off, 'call', _201 => _201("status", yjsStatusDidChange)]);
9183
+ _optionalChain([context, 'access', _189 => _189.yjsProvider, 'optionalAccess', _190 => _190.off, 'call', _191 => _191("status", yjsStatusDidChange)]);
9148
9184
  context.yjsProvider = newProvider;
9149
- _optionalChain([newProvider, 'optionalAccess', _202 => _202.on, 'call', _203 => _203("status", yjsStatusDidChange)]);
9185
+ _optionalChain([newProvider, 'optionalAccess', _192 => _192.on, 'call', _193 => _193("status", yjsStatusDidChange)]);
9150
9186
  context.yjsProviderDidChange.notify();
9151
9187
  },
9152
9188
  yjsProviderDidChange: context.yjsProviderDidChange.observable,
@@ -9192,7 +9228,7 @@ ${Array.from(traces).join("\n\n")}`
9192
9228
  source.dispose();
9193
9229
  }
9194
9230
  eventHub.roomWillDestroy.notify();
9195
- _optionalChain([context, 'access', _204 => _204.yjsProvider, 'optionalAccess', _205 => _205.off, 'call', _206 => _206("status", yjsStatusDidChange)]);
9231
+ _optionalChain([context, 'access', _194 => _194.yjsProvider, 'optionalAccess', _195 => _195.off, 'call', _196 => _196("status", yjsStatusDidChange)]);
9196
9232
  syncSourceForStorage.destroy();
9197
9233
  syncSourceForYjs.destroy();
9198
9234
  uninstallBgTabSpy();
@@ -9342,7 +9378,7 @@ function makeClassicSubscribeFn(roomId, events, errorEvents) {
9342
9378
  }
9343
9379
  if (isLiveNode(first)) {
9344
9380
  const node = first;
9345
- if (_optionalChain([options, 'optionalAccess', _207 => _207.isDeep])) {
9381
+ if (_optionalChain([options, 'optionalAccess', _197 => _197.isDeep])) {
9346
9382
  const storageCallback = second;
9347
9383
  return subscribeToLiveStructureDeeply(node, storageCallback);
9348
9384
  } else {
@@ -9421,8 +9457,8 @@ function createClient(options) {
9421
9457
  const userId = token.k === "sec-legacy" /* SECRET_LEGACY */ ? token.id : token.uid;
9422
9458
  currentUserId.set(() => userId);
9423
9459
  });
9424
- const fetchPolyfill = _optionalChain([clientOptions, 'access', _208 => _208.polyfills, 'optionalAccess', _209 => _209.fetch]) || /* istanbul ignore next */
9425
- _optionalChain([globalThis, 'access', _210 => _210.fetch, 'optionalAccess', _211 => _211.bind, 'call', _212 => _212(globalThis)]);
9460
+ const fetchPolyfill = _optionalChain([clientOptions, 'access', _198 => _198.polyfills, 'optionalAccess', _199 => _199.fetch]) || /* istanbul ignore next */
9461
+ _optionalChain([globalThis, 'access', _200 => _200.fetch, 'optionalAccess', _201 => _201.bind, 'call', _202 => _202(globalThis)]);
9426
9462
  const httpClient = createApiClient({
9427
9463
  baseUrl,
9428
9464
  fetchPolyfill,
@@ -9440,7 +9476,7 @@ function createClient(options) {
9440
9476
  delegates: {
9441
9477
  createSocket: makeCreateSocketDelegateForAi(
9442
9478
  baseUrl,
9443
- _optionalChain([clientOptions, 'access', _213 => _213.polyfills, 'optionalAccess', _214 => _214.WebSocket])
9479
+ _optionalChain([clientOptions, 'access', _203 => _203.polyfills, 'optionalAccess', _204 => _204.WebSocket])
9444
9480
  ),
9445
9481
  authenticate: async () => {
9446
9482
  const resp = await authManager.getAuthValue({
@@ -9508,7 +9544,7 @@ function createClient(options) {
9508
9544
  createSocket: makeCreateSocketDelegateForRoom(
9509
9545
  roomId,
9510
9546
  baseUrl,
9511
- _optionalChain([clientOptions, 'access', _215 => _215.polyfills, 'optionalAccess', _216 => _216.WebSocket])
9547
+ _optionalChain([clientOptions, 'access', _205 => _205.polyfills, 'optionalAccess', _206 => _206.WebSocket])
9512
9548
  ),
9513
9549
  authenticate: makeAuthDelegateForRoom(roomId, authManager)
9514
9550
  })),
@@ -9531,7 +9567,7 @@ function createClient(options) {
9531
9567
  const shouldConnect = _nullishCoalesce(options2.autoConnect, () => ( true));
9532
9568
  if (shouldConnect) {
9533
9569
  if (typeof atob === "undefined") {
9534
- if (_optionalChain([clientOptions, 'access', _217 => _217.polyfills, 'optionalAccess', _218 => _218.atob]) === void 0) {
9570
+ if (_optionalChain([clientOptions, 'access', _207 => _207.polyfills, 'optionalAccess', _208 => _208.atob]) === void 0) {
9535
9571
  throw new Error(
9536
9572
  "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"
9537
9573
  );
@@ -9543,7 +9579,7 @@ function createClient(options) {
9543
9579
  return leaseRoom(newRoomDetails);
9544
9580
  }
9545
9581
  function getRoom(roomId) {
9546
- const room = _optionalChain([roomsById, 'access', _219 => _219.get, 'call', _220 => _220(roomId), 'optionalAccess', _221 => _221.room]);
9582
+ const room = _optionalChain([roomsById, 'access', _209 => _209.get, 'call', _210 => _210(roomId), 'optionalAccess', _211 => _211.room]);
9547
9583
  return room ? room : null;
9548
9584
  }
9549
9585
  function logout() {
@@ -9563,7 +9599,7 @@ function createClient(options) {
9563
9599
  const batchedResolveUsers = new Batch(
9564
9600
  async (batchedUserIds) => {
9565
9601
  const userIds = batchedUserIds.flat();
9566
- const users = await _optionalChain([resolveUsers, 'optionalCall', _222 => _222({ userIds })]);
9602
+ const users = await _optionalChain([resolveUsers, 'optionalCall', _212 => _212({ userIds })]);
9567
9603
  warnIfNoResolveUsers();
9568
9604
  return _nullishCoalesce(users, () => ( userIds.map(() => void 0)));
9569
9605
  },
@@ -9581,7 +9617,7 @@ function createClient(options) {
9581
9617
  const batchedResolveRoomsInfo = new Batch(
9582
9618
  async (batchedRoomIds) => {
9583
9619
  const roomIds = batchedRoomIds.flat();
9584
- const roomsInfo = await _optionalChain([resolveRoomsInfo, 'optionalCall', _223 => _223({ roomIds })]);
9620
+ const roomsInfo = await _optionalChain([resolveRoomsInfo, 'optionalCall', _213 => _213({ roomIds })]);
9585
9621
  warnIfNoResolveRoomsInfo();
9586
9622
  return _nullishCoalesce(roomsInfo, () => ( roomIds.map(() => void 0)));
9587
9623
  },
@@ -9634,7 +9670,7 @@ function createClient(options) {
9634
9670
  }
9635
9671
  };
9636
9672
  const win = typeof window !== "undefined" ? window : void 0;
9637
- _optionalChain([win, 'optionalAccess', _224 => _224.addEventListener, 'call', _225 => _225("beforeunload", maybePreventClose)]);
9673
+ _optionalChain([win, 'optionalAccess', _214 => _214.addEventListener, 'call', _215 => _215("beforeunload", maybePreventClose)]);
9638
9674
  }
9639
9675
  async function getNotificationSettings(options2) {
9640
9676
  const plainSettings = await httpClient.getNotificationSettings(options2);
@@ -9773,7 +9809,7 @@ var commentBodyElementsTypes = {
9773
9809
  mention: "inline"
9774
9810
  };
9775
9811
  function traverseCommentBody(body, elementOrVisitor, possiblyVisitor) {
9776
- if (!body || !_optionalChain([body, 'optionalAccess', _226 => _226.content])) {
9812
+ if (!body || !_optionalChain([body, 'optionalAccess', _216 => _216.content])) {
9777
9813
  return;
9778
9814
  }
9779
9815
  const element = typeof elementOrVisitor === "string" ? elementOrVisitor : void 0;
@@ -9783,13 +9819,13 @@ function traverseCommentBody(body, elementOrVisitor, possiblyVisitor) {
9783
9819
  for (const block of body.content) {
9784
9820
  if (type === "all" || type === "block") {
9785
9821
  if (guard(block)) {
9786
- _optionalChain([visitor, 'optionalCall', _227 => _227(block)]);
9822
+ _optionalChain([visitor, 'optionalCall', _217 => _217(block)]);
9787
9823
  }
9788
9824
  }
9789
9825
  if (type === "all" || type === "inline") {
9790
9826
  for (const inline of block.children) {
9791
9827
  if (guard(inline)) {
9792
- _optionalChain([visitor, 'optionalCall', _228 => _228(inline)]);
9828
+ _optionalChain([visitor, 'optionalCall', _218 => _218(inline)]);
9793
9829
  }
9794
9830
  }
9795
9831
  }
@@ -9823,7 +9859,7 @@ async function resolveUsersInCommentBody(body, resolveUsers) {
9823
9859
  userIds
9824
9860
  });
9825
9861
  for (const [index, userId] of userIds.entries()) {
9826
- const user = _optionalChain([users, 'optionalAccess', _229 => _229[index]]);
9862
+ const user = _optionalChain([users, 'optionalAccess', _219 => _219[index]]);
9827
9863
  if (user) {
9828
9864
  resolvedUsers.set(userId, user);
9829
9865
  }
@@ -9950,7 +9986,7 @@ var stringifyCommentBodyPlainElements = {
9950
9986
  text: ({ element }) => element.text,
9951
9987
  link: ({ element }) => _nullishCoalesce(element.text, () => ( element.url)),
9952
9988
  mention: ({ element, user }) => {
9953
- return `@${_nullishCoalesce(_optionalChain([user, 'optionalAccess', _230 => _230.name]), () => ( element.id))}`;
9989
+ return `@${_nullishCoalesce(_optionalChain([user, 'optionalAccess', _220 => _220.name]), () => ( element.id))}`;
9954
9990
  }
9955
9991
  };
9956
9992
  var stringifyCommentBodyHtmlElements = {
@@ -9980,7 +10016,7 @@ var stringifyCommentBodyHtmlElements = {
9980
10016
  return html`<a href="${href}" target="_blank" rel="noopener noreferrer">${element.text ? html`${element.text}` : element.url}</a>`;
9981
10017
  },
9982
10018
  mention: ({ element, user }) => {
9983
- return html`<span data-mention>@${_optionalChain([user, 'optionalAccess', _231 => _231.name]) ? html`${_optionalChain([user, 'optionalAccess', _232 => _232.name])}` : element.id}</span>`;
10019
+ return html`<span data-mention>@${_optionalChain([user, 'optionalAccess', _221 => _221.name]) ? html`${_optionalChain([user, 'optionalAccess', _222 => _222.name])}` : element.id}</span>`;
9984
10020
  }
9985
10021
  };
9986
10022
  var stringifyCommentBodyMarkdownElements = {
@@ -10010,19 +10046,19 @@ var stringifyCommentBodyMarkdownElements = {
10010
10046
  return markdown`[${_nullishCoalesce(element.text, () => ( element.url))}](${href})`;
10011
10047
  },
10012
10048
  mention: ({ element, user }) => {
10013
- return markdown`@${_nullishCoalesce(_optionalChain([user, 'optionalAccess', _233 => _233.name]), () => ( element.id))}`;
10049
+ return markdown`@${_nullishCoalesce(_optionalChain([user, 'optionalAccess', _223 => _223.name]), () => ( element.id))}`;
10014
10050
  }
10015
10051
  };
10016
10052
  async function stringifyCommentBody(body, options) {
10017
- const format = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _234 => _234.format]), () => ( "plain"));
10018
- const separator = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _235 => _235.separator]), () => ( (format === "markdown" ? "\n\n" : "\n")));
10053
+ const format = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _224 => _224.format]), () => ( "plain"));
10054
+ const separator = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _225 => _225.separator]), () => ( (format === "markdown" ? "\n\n" : "\n")));
10019
10055
  const elements = {
10020
10056
  ...format === "html" ? stringifyCommentBodyHtmlElements : format === "markdown" ? stringifyCommentBodyMarkdownElements : stringifyCommentBodyPlainElements,
10021
- ..._optionalChain([options, 'optionalAccess', _236 => _236.elements])
10057
+ ..._optionalChain([options, 'optionalAccess', _226 => _226.elements])
10022
10058
  };
10023
10059
  const resolvedUsers = await resolveUsersInCommentBody(
10024
10060
  body,
10025
- _optionalChain([options, 'optionalAccess', _237 => _237.resolveUsers])
10061
+ _optionalChain([options, 'optionalAccess', _227 => _227.resolveUsers])
10026
10062
  );
10027
10063
  const blocks = body.content.flatMap((block, blockIndex) => {
10028
10064
  switch (block.type) {
@@ -10313,12 +10349,12 @@ function legacy_patchImmutableNode(state, path, update) {
10313
10349
  }
10314
10350
  const newState = Object.assign({}, state);
10315
10351
  for (const key in update.updates) {
10316
- if (_optionalChain([update, 'access', _238 => _238.updates, 'access', _239 => _239[key], 'optionalAccess', _240 => _240.type]) === "update") {
10352
+ if (_optionalChain([update, 'access', _228 => _228.updates, 'access', _229 => _229[key], 'optionalAccess', _230 => _230.type]) === "update") {
10317
10353
  const val = update.node.get(key);
10318
10354
  if (val !== void 0) {
10319
10355
  newState[key] = lsonToJson(val);
10320
10356
  }
10321
- } else if (_optionalChain([update, 'access', _241 => _241.updates, 'access', _242 => _242[key], 'optionalAccess', _243 => _243.type]) === "delete") {
10357
+ } else if (_optionalChain([update, 'access', _231 => _231.updates, 'access', _232 => _232[key], 'optionalAccess', _233 => _233.type]) === "delete") {
10322
10358
  delete newState[key];
10323
10359
  }
10324
10360
  }
@@ -10379,12 +10415,12 @@ function legacy_patchImmutableNode(state, path, update) {
10379
10415
  }
10380
10416
  const newState = Object.assign({}, state);
10381
10417
  for (const key in update.updates) {
10382
- if (_optionalChain([update, 'access', _244 => _244.updates, 'access', _245 => _245[key], 'optionalAccess', _246 => _246.type]) === "update") {
10418
+ if (_optionalChain([update, 'access', _234 => _234.updates, 'access', _235 => _235[key], 'optionalAccess', _236 => _236.type]) === "update") {
10383
10419
  const value = update.node.get(key);
10384
10420
  if (value !== void 0) {
10385
10421
  newState[key] = lsonToJson(value);
10386
10422
  }
10387
- } else if (_optionalChain([update, 'access', _247 => _247.updates, 'access', _248 => _248[key], 'optionalAccess', _249 => _249.type]) === "delete") {
10423
+ } else if (_optionalChain([update, 'access', _237 => _237.updates, 'access', _238 => _238[key], 'optionalAccess', _239 => _239.type]) === "delete") {
10388
10424
  delete newState[key];
10389
10425
  }
10390
10426
  }
@@ -10464,9 +10500,9 @@ function makePoller(callback, intervalMs, options) {
10464
10500
  const startTime = performance.now();
10465
10501
  const doc = typeof document !== "undefined" ? document : void 0;
10466
10502
  const win = typeof window !== "undefined" ? window : void 0;
10467
- const maxStaleTimeMs = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _250 => _250.maxStaleTimeMs]), () => ( Number.POSITIVE_INFINITY));
10503
+ const maxStaleTimeMs = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _240 => _240.maxStaleTimeMs]), () => ( Number.POSITIVE_INFINITY));
10468
10504
  const context = {
10469
- inForeground: _optionalChain([doc, 'optionalAccess', _251 => _251.visibilityState]) !== "hidden",
10505
+ inForeground: _optionalChain([doc, 'optionalAccess', _241 => _241.visibilityState]) !== "hidden",
10470
10506
  lastSuccessfulPollAt: startTime,
10471
10507
  count: 0,
10472
10508
  backoff: 0
@@ -10547,11 +10583,11 @@ function makePoller(callback, intervalMs, options) {
10547
10583
  pollNowIfStale();
10548
10584
  }
10549
10585
  function onVisibilityChange() {
10550
- setInForeground(_optionalChain([doc, 'optionalAccess', _252 => _252.visibilityState]) !== "hidden");
10586
+ setInForeground(_optionalChain([doc, 'optionalAccess', _242 => _242.visibilityState]) !== "hidden");
10551
10587
  }
10552
- _optionalChain([doc, 'optionalAccess', _253 => _253.addEventListener, 'call', _254 => _254("visibilitychange", onVisibilityChange)]);
10553
- _optionalChain([win, 'optionalAccess', _255 => _255.addEventListener, 'call', _256 => _256("online", onVisibilityChange)]);
10554
- _optionalChain([win, 'optionalAccess', _257 => _257.addEventListener, 'call', _258 => _258("focus", pollNowIfStale)]);
10588
+ _optionalChain([doc, 'optionalAccess', _243 => _243.addEventListener, 'call', _244 => _244("visibilitychange", onVisibilityChange)]);
10589
+ _optionalChain([win, 'optionalAccess', _245 => _245.addEventListener, 'call', _246 => _246("online", onVisibilityChange)]);
10590
+ _optionalChain([win, 'optionalAccess', _247 => _247.addEventListener, 'call', _248 => _248("focus", pollNowIfStale)]);
10555
10591
  fsm.start();
10556
10592
  return {
10557
10593
  inc,