@liveblocks/core 1.9.0-example1 → 1.9.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.js CHANGED
@@ -6,7 +6,7 @@ var __export = (target, all) => {
6
6
 
7
7
  // src/version.ts
8
8
  var PKG_NAME = "@liveblocks/core";
9
- var PKG_VERSION = "1.9.0-example1";
9
+ var PKG_VERSION = "1.9.1";
10
10
  var PKG_FORMAT = "cjs";
11
11
 
12
12
  // src/dupe-detection.ts
@@ -2145,8 +2145,8 @@ function createCommentsApi(roomId, getAuthValue, config) {
2145
2145
  const url = new URL(
2146
2146
  `/v2/c/rooms/${encodeURIComponent(roomId2)}${endpoint}`,
2147
2147
  config.baseUrl
2148
- ).toString();
2149
- return await fetch(url, {
2148
+ );
2149
+ return await fetch(url.toString(), {
2150
2150
  ...options,
2151
2151
  headers: {
2152
2152
  ..._optionalChain([options, 'optionalAccess', _55 => _55.headers]),
@@ -2154,8 +2154,16 @@ function createCommentsApi(roomId, getAuthValue, config) {
2154
2154
  }
2155
2155
  });
2156
2156
  }
2157
- async function getThreads() {
2158
- const response = await fetchApi(roomId, "/threads");
2157
+ async function getThreads(options) {
2158
+ const response = await fetchApi(roomId, "/threads/search", {
2159
+ body: JSON.stringify({
2160
+ ..._optionalChain([options, 'optionalAccess', _56 => _56.query, 'optionalAccess', _57 => _57.metadata]) && { metadata: options.query.metadata }
2161
+ }),
2162
+ headers: {
2163
+ "Content-Type": "application/json"
2164
+ },
2165
+ method: "POST"
2166
+ });
2159
2167
  if (response.ok) {
2160
2168
  const json = await response.json();
2161
2169
  return json.data.map((thread) => convertToThreadData(thread));
@@ -2444,6 +2452,14 @@ var OpCode = /* @__PURE__ */ ((OpCode2) => {
2444
2452
  OpCode2[OpCode2["CREATE_REGISTER"] = 8] = "CREATE_REGISTER";
2445
2453
  return OpCode2;
2446
2454
  })(OpCode || {});
2455
+ function ackOp(opId) {
2456
+ return {
2457
+ type: 5 /* DELETE_CRDT */,
2458
+ id: "ACK",
2459
+ // (H)ACK
2460
+ opId
2461
+ };
2462
+ }
2447
2463
  function isAckOp(op) {
2448
2464
  return op.type === 5 /* DELETE_CRDT */ && op.id === "ACK";
2449
2465
  }
@@ -2669,7 +2685,7 @@ var LiveRegister = class _LiveRegister extends AbstractCrdt {
2669
2685
  return [
2670
2686
  {
2671
2687
  type: 8 /* CREATE_REGISTER */,
2672
- opId: _optionalChain([pool, 'optionalAccess', _56 => _56.generateOpId, 'call', _57 => _57()]),
2688
+ opId: _optionalChain([pool, 'optionalAccess', _58 => _58.generateOpId, 'call', _59 => _59()]),
2673
2689
  id: this._id,
2674
2690
  parentId,
2675
2691
  parentKey,
@@ -2771,7 +2787,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
2771
2787
  const ops = [];
2772
2788
  const op = {
2773
2789
  id: this._id,
2774
- opId: _optionalChain([pool, 'optionalAccess', _58 => _58.generateOpId, 'call', _59 => _59()]),
2790
+ opId: _optionalChain([pool, 'optionalAccess', _60 => _60.generateOpId, 'call', _61 => _61()]),
2775
2791
  type: 2 /* CREATE_LIST */,
2776
2792
  parentId,
2777
2793
  parentKey
@@ -3048,7 +3064,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
3048
3064
  _applyInsertUndoRedo(op) {
3049
3065
  const { id, parentKey: key } = op;
3050
3066
  const child = creationOpToLiveNode(op);
3051
- if (_optionalChain([this, 'access', _60 => _60._pool, 'optionalAccess', _61 => _61.getNode, 'call', _62 => _62(id)]) !== void 0) {
3067
+ if (_optionalChain([this, 'access', _62 => _62._pool, 'optionalAccess', _63 => _63.getNode, 'call', _64 => _64(id)]) !== void 0) {
3052
3068
  return { modified: false };
3053
3069
  }
3054
3070
  child._attach(id, nn(this._pool));
@@ -3056,8 +3072,8 @@ var LiveList = class _LiveList extends AbstractCrdt {
3056
3072
  const existingItemIndex = this._indexOfPosition(key);
3057
3073
  let newKey = key;
3058
3074
  if (existingItemIndex !== -1) {
3059
- const before2 = _optionalChain([this, 'access', _63 => _63._items, 'access', _64 => _64[existingItemIndex], 'optionalAccess', _65 => _65._parentPos]);
3060
- const after2 = _optionalChain([this, 'access', _66 => _66._items, 'access', _67 => _67[existingItemIndex + 1], 'optionalAccess', _68 => _68._parentPos]);
3075
+ const before2 = _optionalChain([this, 'access', _65 => _65._items, 'access', _66 => _66[existingItemIndex], 'optionalAccess', _67 => _67._parentPos]);
3076
+ const after2 = _optionalChain([this, 'access', _68 => _68._items, 'access', _69 => _69[existingItemIndex + 1], 'optionalAccess', _70 => _70._parentPos]);
3061
3077
  newKey = makePosition(before2, after2);
3062
3078
  child._setParentLink(this, newKey);
3063
3079
  }
@@ -3072,7 +3088,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
3072
3088
  _applySetUndoRedo(op) {
3073
3089
  const { id, parentKey: key } = op;
3074
3090
  const child = creationOpToLiveNode(op);
3075
- if (_optionalChain([this, 'access', _69 => _69._pool, 'optionalAccess', _70 => _70.getNode, 'call', _71 => _71(id)]) !== void 0) {
3091
+ if (_optionalChain([this, 'access', _71 => _71._pool, 'optionalAccess', _72 => _72.getNode, 'call', _73 => _73(id)]) !== void 0) {
3076
3092
  return { modified: false };
3077
3093
  }
3078
3094
  this._unacknowledgedSets.set(key, nn(op.opId));
@@ -3194,7 +3210,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
3194
3210
  } else {
3195
3211
  this._items[existingItemIndex]._setParentLink(
3196
3212
  this,
3197
- makePosition(newKey, _optionalChain([this, 'access', _72 => _72._items, 'access', _73 => _73[existingItemIndex + 1], 'optionalAccess', _74 => _74._parentPos]))
3213
+ makePosition(newKey, _optionalChain([this, 'access', _74 => _74._items, 'access', _75 => _75[existingItemIndex + 1], 'optionalAccess', _76 => _76._parentPos]))
3198
3214
  );
3199
3215
  const previousIndex = this._items.indexOf(child);
3200
3216
  child._setParentLink(this, newKey);
@@ -3220,7 +3236,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
3220
3236
  if (existingItemIndex !== -1) {
3221
3237
  this._items[existingItemIndex]._setParentLink(
3222
3238
  this,
3223
- makePosition(newKey, _optionalChain([this, 'access', _75 => _75._items, 'access', _76 => _76[existingItemIndex + 1], 'optionalAccess', _77 => _77._parentPos]))
3239
+ makePosition(newKey, _optionalChain([this, 'access', _77 => _77._items, 'access', _78 => _78[existingItemIndex + 1], 'optionalAccess', _79 => _79._parentPos]))
3224
3240
  );
3225
3241
  }
3226
3242
  child._setParentLink(this, newKey);
@@ -3239,7 +3255,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
3239
3255
  if (existingItemIndex !== -1) {
3240
3256
  this._items[existingItemIndex]._setParentLink(
3241
3257
  this,
3242
- makePosition(newKey, _optionalChain([this, 'access', _78 => _78._items, 'access', _79 => _79[existingItemIndex + 1], 'optionalAccess', _80 => _80._parentPos]))
3258
+ makePosition(newKey, _optionalChain([this, 'access', _80 => _80._items, 'access', _81 => _81[existingItemIndex + 1], 'optionalAccess', _82 => _82._parentPos]))
3243
3259
  );
3244
3260
  }
3245
3261
  child._setParentLink(this, newKey);
@@ -3267,7 +3283,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
3267
3283
  if (existingItemIndex !== -1) {
3268
3284
  this._items[existingItemIndex]._setParentLink(
3269
3285
  this,
3270
- makePosition(newKey, _optionalChain([this, 'access', _81 => _81._items, 'access', _82 => _82[existingItemIndex + 1], 'optionalAccess', _83 => _83._parentPos]))
3286
+ makePosition(newKey, _optionalChain([this, 'access', _83 => _83._items, 'access', _84 => _84[existingItemIndex + 1], 'optionalAccess', _85 => _85._parentPos]))
3271
3287
  );
3272
3288
  }
3273
3289
  child._setParentLink(this, newKey);
@@ -3325,7 +3341,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
3325
3341
  * @param element The element to add to the end of the LiveList.
3326
3342
  */
3327
3343
  push(element) {
3328
- _optionalChain([this, 'access', _84 => _84._pool, 'optionalAccess', _85 => _85.assertStorageIsWritable, 'call', _86 => _86()]);
3344
+ _optionalChain([this, 'access', _86 => _86._pool, 'optionalAccess', _87 => _87.assertStorageIsWritable, 'call', _88 => _88()]);
3329
3345
  return this.insert(element, this.length);
3330
3346
  }
3331
3347
  /**
@@ -3334,7 +3350,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
3334
3350
  * @param index The index at which you want to insert the element.
3335
3351
  */
3336
3352
  insert(element, index) {
3337
- _optionalChain([this, 'access', _87 => _87._pool, 'optionalAccess', _88 => _88.assertStorageIsWritable, 'call', _89 => _89()]);
3353
+ _optionalChain([this, 'access', _89 => _89._pool, 'optionalAccess', _90 => _90.assertStorageIsWritable, 'call', _91 => _91()]);
3338
3354
  if (index < 0 || index > this._items.length) {
3339
3355
  throw new Error(
3340
3356
  `Cannot insert list item at index "${index}". index should be between 0 and ${this._items.length}`
@@ -3364,7 +3380,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
3364
3380
  * @param targetIndex The index where the element should be after moving.
3365
3381
  */
3366
3382
  move(index, targetIndex) {
3367
- _optionalChain([this, 'access', _90 => _90._pool, 'optionalAccess', _91 => _91.assertStorageIsWritable, 'call', _92 => _92()]);
3383
+ _optionalChain([this, 'access', _92 => _92._pool, 'optionalAccess', _93 => _93.assertStorageIsWritable, 'call', _94 => _94()]);
3368
3384
  if (targetIndex < 0) {
3369
3385
  throw new Error("targetIndex cannot be less than 0");
3370
3386
  }
@@ -3422,7 +3438,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
3422
3438
  * @param index The index of the element to delete
3423
3439
  */
3424
3440
  delete(index) {
3425
- _optionalChain([this, 'access', _93 => _93._pool, 'optionalAccess', _94 => _94.assertStorageIsWritable, 'call', _95 => _95()]);
3441
+ _optionalChain([this, 'access', _95 => _95._pool, 'optionalAccess', _96 => _96.assertStorageIsWritable, 'call', _97 => _97()]);
3426
3442
  if (index < 0 || index >= this._items.length) {
3427
3443
  throw new Error(
3428
3444
  `Cannot delete list item at index "${index}". index should be between 0 and ${this._items.length - 1}`
@@ -3455,7 +3471,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
3455
3471
  }
3456
3472
  }
3457
3473
  clear() {
3458
- _optionalChain([this, 'access', _96 => _96._pool, 'optionalAccess', _97 => _97.assertStorageIsWritable, 'call', _98 => _98()]);
3474
+ _optionalChain([this, 'access', _98 => _98._pool, 'optionalAccess', _99 => _99.assertStorageIsWritable, 'call', _100 => _100()]);
3459
3475
  if (this._pool) {
3460
3476
  const ops = [];
3461
3477
  const reverseOps = [];
@@ -3489,7 +3505,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
3489
3505
  }
3490
3506
  }
3491
3507
  set(index, item) {
3492
- _optionalChain([this, 'access', _99 => _99._pool, 'optionalAccess', _100 => _100.assertStorageIsWritable, 'call', _101 => _101()]);
3508
+ _optionalChain([this, 'access', _101 => _101._pool, 'optionalAccess', _102 => _102.assertStorageIsWritable, 'call', _103 => _103()]);
3493
3509
  if (index < 0 || index >= this._items.length) {
3494
3510
  throw new Error(
3495
3511
  `Cannot set list item at index "${index}". index should be between 0 and ${this._items.length - 1}`
@@ -3637,7 +3653,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
3637
3653
  _shiftItemPosition(index, key) {
3638
3654
  const shiftedPosition = makePosition(
3639
3655
  key,
3640
- this._items.length > index + 1 ? _optionalChain([this, 'access', _102 => _102._items, 'access', _103 => _103[index + 1], 'optionalAccess', _104 => _104._parentPos]) : void 0
3656
+ this._items.length > index + 1 ? _optionalChain([this, 'access', _104 => _104._items, 'access', _105 => _105[index + 1], 'optionalAccess', _106 => _106._parentPos]) : void 0
3641
3657
  );
3642
3658
  this._items[index]._setParentLink(this, shiftedPosition);
3643
3659
  }
@@ -3766,7 +3782,7 @@ var LiveMap = class _LiveMap extends AbstractCrdt {
3766
3782
  const ops = [];
3767
3783
  const op = {
3768
3784
  id: this._id,
3769
- opId: _optionalChain([pool, 'optionalAccess', _105 => _105.generateOpId, 'call', _106 => _106()]),
3785
+ opId: _optionalChain([pool, 'optionalAccess', _107 => _107.generateOpId, 'call', _108 => _108()]),
3770
3786
  type: 7 /* CREATE_MAP */,
3771
3787
  parentId,
3772
3788
  parentKey
@@ -3913,7 +3929,7 @@ var LiveMap = class _LiveMap extends AbstractCrdt {
3913
3929
  * @param value The value of the element to add. Should be serializable to JSON.
3914
3930
  */
3915
3931
  set(key, value) {
3916
- _optionalChain([this, 'access', _107 => _107._pool, 'optionalAccess', _108 => _108.assertStorageIsWritable, 'call', _109 => _109()]);
3932
+ _optionalChain([this, 'access', _109 => _109._pool, 'optionalAccess', _110 => _110.assertStorageIsWritable, 'call', _111 => _111()]);
3917
3933
  const oldValue = this._map.get(key);
3918
3934
  if (oldValue) {
3919
3935
  oldValue._detach();
@@ -3959,7 +3975,7 @@ var LiveMap = class _LiveMap extends AbstractCrdt {
3959
3975
  * @returns true if an element existed and has been removed, or false if the element does not exist.
3960
3976
  */
3961
3977
  delete(key) {
3962
- _optionalChain([this, 'access', _110 => _110._pool, 'optionalAccess', _111 => _111.assertStorageIsWritable, 'call', _112 => _112()]);
3978
+ _optionalChain([this, 'access', _112 => _112._pool, 'optionalAccess', _113 => _113.assertStorageIsWritable, 'call', _114 => _114()]);
3963
3979
  const item = this._map.get(key);
3964
3980
  if (item === void 0) {
3965
3981
  return false;
@@ -4138,7 +4154,7 @@ var LiveObject = class _LiveObject extends AbstractCrdt {
4138
4154
  if (this._id === void 0) {
4139
4155
  throw new Error("Cannot serialize item is not attached");
4140
4156
  }
4141
- const opId = _optionalChain([pool, 'optionalAccess', _113 => _113.generateOpId, 'call', _114 => _114()]);
4157
+ const opId = _optionalChain([pool, 'optionalAccess', _115 => _115.generateOpId, 'call', _116 => _116()]);
4142
4158
  const ops = [];
4143
4159
  const op = {
4144
4160
  type: 4 /* CREATE_OBJECT */,
@@ -4416,7 +4432,7 @@ var LiveObject = class _LiveObject extends AbstractCrdt {
4416
4432
  * @param value The value of the property to add
4417
4433
  */
4418
4434
  set(key, value) {
4419
- _optionalChain([this, 'access', _115 => _115._pool, 'optionalAccess', _116 => _116.assertStorageIsWritable, 'call', _117 => _117()]);
4435
+ _optionalChain([this, 'access', _117 => _117._pool, 'optionalAccess', _118 => _118.assertStorageIsWritable, 'call', _119 => _119()]);
4420
4436
  this.update({ [key]: value });
4421
4437
  }
4422
4438
  /**
@@ -4431,7 +4447,7 @@ var LiveObject = class _LiveObject extends AbstractCrdt {
4431
4447
  * @param key The key of the property to delete
4432
4448
  */
4433
4449
  delete(key) {
4434
- _optionalChain([this, 'access', _118 => _118._pool, 'optionalAccess', _119 => _119.assertStorageIsWritable, 'call', _120 => _120()]);
4450
+ _optionalChain([this, 'access', _120 => _120._pool, 'optionalAccess', _121 => _121.assertStorageIsWritable, 'call', _122 => _122()]);
4435
4451
  const keyAsString = key;
4436
4452
  const oldValue = this._map.get(keyAsString);
4437
4453
  if (oldValue === void 0) {
@@ -4484,7 +4500,7 @@ var LiveObject = class _LiveObject extends AbstractCrdt {
4484
4500
  * @param patch The object used to overrides properties
4485
4501
  */
4486
4502
  update(patch) {
4487
- _optionalChain([this, 'access', _121 => _121._pool, 'optionalAccess', _122 => _122.assertStorageIsWritable, 'call', _123 => _123()]);
4503
+ _optionalChain([this, 'access', _123 => _123._pool, 'optionalAccess', _124 => _124.assertStorageIsWritable, 'call', _125 => _125()]);
4488
4504
  if (this._pool === void 0 || this._id === void 0) {
4489
4505
  for (const key in patch) {
4490
4506
  const newValue = patch[key];
@@ -5128,15 +5144,15 @@ function installBackgroundTabSpy() {
5128
5144
  const doc = typeof document !== "undefined" ? document : void 0;
5129
5145
  const inBackgroundSince = { current: null };
5130
5146
  function onVisibilityChange() {
5131
- if (_optionalChain([doc, 'optionalAccess', _124 => _124.visibilityState]) === "hidden") {
5147
+ if (_optionalChain([doc, 'optionalAccess', _126 => _126.visibilityState]) === "hidden") {
5132
5148
  inBackgroundSince.current = _nullishCoalesce(inBackgroundSince.current, () => ( Date.now()));
5133
5149
  } else {
5134
5150
  inBackgroundSince.current = null;
5135
5151
  }
5136
5152
  }
5137
- _optionalChain([doc, 'optionalAccess', _125 => _125.addEventListener, 'call', _126 => _126("visibilitychange", onVisibilityChange)]);
5153
+ _optionalChain([doc, 'optionalAccess', _127 => _127.addEventListener, 'call', _128 => _128("visibilitychange", onVisibilityChange)]);
5138
5154
  const unsub = () => {
5139
- _optionalChain([doc, 'optionalAccess', _127 => _127.removeEventListener, 'call', _128 => _128("visibilitychange", onVisibilityChange)]);
5155
+ _optionalChain([doc, 'optionalAccess', _129 => _129.removeEventListener, 'call', _130 => _130("visibilitychange", onVisibilityChange)]);
5140
5156
  };
5141
5157
  return [inBackgroundSince, unsub];
5142
5158
  }
@@ -5325,7 +5341,7 @@ function createRoom(options, config) {
5325
5341
  }
5326
5342
  },
5327
5343
  assertStorageIsWritable: () => {
5328
- const scopes = _optionalChain([context, 'access', _129 => _129.dynamicSessionInfo, 'access', _130 => _130.current, 'optionalAccess', _131 => _131.scopes]);
5344
+ const scopes = _optionalChain([context, 'access', _131 => _131.dynamicSessionInfo, 'access', _132 => _132.current, 'optionalAccess', _133 => _133.scopes]);
5329
5345
  if (scopes === void 0) {
5330
5346
  return;
5331
5347
  }
@@ -5364,7 +5380,7 @@ function createRoom(options, config) {
5364
5380
  `/v2/c/rooms/${encodeURIComponent(config.roomId)}${endpoint}`,
5365
5381
  config.baseUrl
5366
5382
  ).toString();
5367
- const fetcher = _optionalChain([config, 'access', _132 => _132.polyfills, 'optionalAccess', _133 => _133.fetch]) || /* istanbul ignore next */
5383
+ const fetcher = _optionalChain([config, 'access', _134 => _134.polyfills, 'optionalAccess', _135 => _135.fetch]) || /* istanbul ignore next */
5368
5384
  fetch;
5369
5385
  return fetcher(url, {
5370
5386
  method: "POST",
@@ -5377,7 +5393,7 @@ function createRoom(options, config) {
5377
5393
  }
5378
5394
  function sendMessages(messages) {
5379
5395
  const serializedPayload = JSON.stringify(messages);
5380
- const nonce = _optionalChain([context, 'access', _134 => _134.dynamicSessionInfo, 'access', _135 => _135.current, 'optionalAccess', _136 => _136.nonce]);
5396
+ const nonce = _optionalChain([context, 'access', _136 => _136.dynamicSessionInfo, 'access', _137 => _137.current, 'optionalAccess', _138 => _138.nonce]);
5381
5397
  if (config.unstable_fallbackToHTTP && nonce) {
5382
5398
  const size = new TextEncoder().encode(serializedPayload).length;
5383
5399
  if (size > MAX_SOCKET_MESSAGE_SIZE) {
@@ -5639,7 +5655,7 @@ function createRoom(options, config) {
5639
5655
  }
5640
5656
  context.myPresence.patch(patch);
5641
5657
  if (context.activeBatch) {
5642
- if (_optionalChain([options2, 'optionalAccess', _137 => _137.addToHistory])) {
5658
+ if (_optionalChain([options2, 'optionalAccess', _139 => _139.addToHistory])) {
5643
5659
  context.activeBatch.reverseOps.unshift({
5644
5660
  type: "presence",
5645
5661
  data: oldValues
@@ -5649,7 +5665,7 @@ function createRoom(options, config) {
5649
5665
  } else {
5650
5666
  flushNowOrSoon();
5651
5667
  batchUpdates(() => {
5652
- if (_optionalChain([options2, 'optionalAccess', _138 => _138.addToHistory])) {
5668
+ if (_optionalChain([options2, 'optionalAccess', _140 => _140.addToHistory])) {
5653
5669
  addToUndoStack(
5654
5670
  [{ type: "presence", data: oldValues }],
5655
5671
  doNotBatchUpdates
@@ -5829,7 +5845,7 @@ function createRoom(options, config) {
5829
5845
  const unacknowledgedOps = new Map(context.unacknowledgedOps);
5830
5846
  createOrUpdateRootFromMessage(message, doNotBatchUpdates);
5831
5847
  applyAndSendOps(unacknowledgedOps, doNotBatchUpdates);
5832
- _optionalChain([_resolveStoragePromise, 'optionalCall', _139 => _139()]);
5848
+ _optionalChain([_resolveStoragePromise, 'optionalCall', _141 => _141()]);
5833
5849
  notifyStorageStatus();
5834
5850
  eventHub.storageDidLoad.notify();
5835
5851
  break;
@@ -5852,7 +5868,7 @@ function createRoom(options, config) {
5852
5868
  if (process.env.NODE_ENV !== "production") {
5853
5869
  const traces = /* @__PURE__ */ new Set();
5854
5870
  for (const opId of message.opIds) {
5855
- const trace = _optionalChain([context, 'access', _140 => _140.opStackTraces, 'optionalAccess', _141 => _141.get, 'call', _142 => _142(opId)]);
5871
+ const trace = _optionalChain([context, 'access', _142 => _142.opStackTraces, 'optionalAccess', _143 => _143.get, 'call', _144 => _144(opId)]);
5856
5872
  if (trace) {
5857
5873
  traces.add(trace);
5858
5874
  }
@@ -6165,7 +6181,7 @@ ${Array.from(traces).join("\n\n")}`
6165
6181
  /* NOTE: Exposing __internal here only to allow testing implementation details in unit tests */
6166
6182
  __internal: {
6167
6183
  get presenceBuffer() {
6168
- return deepClone(_nullishCoalesce(_optionalChain([context, 'access', _143 => _143.buffer, 'access', _144 => _144.presenceUpdates, 'optionalAccess', _145 => _145.data]), () => ( null)));
6184
+ return deepClone(_nullishCoalesce(_optionalChain([context, 'access', _145 => _145.buffer, 'access', _146 => _146.presenceUpdates, 'optionalAccess', _147 => _147.data]), () => ( null)));
6169
6185
  },
6170
6186
  // prettier-ignore
6171
6187
  get undoStack() {
@@ -6307,7 +6323,7 @@ function makeClassicSubscribeFn(events) {
6307
6323
  }
6308
6324
  if (isLiveNode(first)) {
6309
6325
  const node = first;
6310
- if (_optionalChain([options, 'optionalAccess', _146 => _146.isDeep])) {
6326
+ if (_optionalChain([options, 'optionalAccess', _148 => _148.isDeep])) {
6311
6327
  const storageCallback = second;
6312
6328
  return subscribeToLiveStructureDeeply(node, storageCallback);
6313
6329
  } else {
@@ -6432,12 +6448,12 @@ function createClient(options) {
6432
6448
  createSocket: makeCreateSocketDelegateForRoom(
6433
6449
  roomId,
6434
6450
  baseUrl,
6435
- _optionalChain([clientOptions, 'access', _147 => _147.polyfills, 'optionalAccess', _148 => _148.WebSocket])
6451
+ _optionalChain([clientOptions, 'access', _149 => _149.polyfills, 'optionalAccess', _150 => _150.WebSocket])
6436
6452
  ),
6437
6453
  authenticate: makeAuthDelegateForRoom(roomId, authManager)
6438
6454
  })),
6439
6455
  enableDebugLogging: clientOptions.enableDebugLogging,
6440
- unstable_batchedUpdates: _optionalChain([options2, 'optionalAccess', _149 => _149.unstable_batchedUpdates]),
6456
+ unstable_batchedUpdates: _optionalChain([options2, 'optionalAccess', _151 => _151.unstable_batchedUpdates]),
6441
6457
  baseUrl,
6442
6458
  unstable_fallbackToHTTP: !!clientOptions.unstable_fallbackToHTTP
6443
6459
  }
@@ -6452,7 +6468,7 @@ function createClient(options) {
6452
6468
  const shouldConnect = _nullishCoalesce(_nullishCoalesce(options2.autoConnect, () => ( options2.shouldInitiallyConnect)), () => ( true));
6453
6469
  if (shouldConnect) {
6454
6470
  if (typeof atob === "undefined") {
6455
- if (_optionalChain([clientOptions, 'access', _150 => _150.polyfills, 'optionalAccess', _151 => _151.atob]) === void 0) {
6471
+ if (_optionalChain([clientOptions, 'access', _152 => _152.polyfills, 'optionalAccess', _153 => _153.atob]) === void 0) {
6456
6472
  throw new Error(
6457
6473
  "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"
6458
6474
  );
@@ -6468,11 +6484,11 @@ function createClient(options) {
6468
6484
  return room;
6469
6485
  }
6470
6486
  function getRoom(roomId) {
6471
- const room = _optionalChain([roomsById, 'access', _152 => _152.get, 'call', _153 => _153(roomId), 'optionalAccess', _154 => _154.room]);
6487
+ const room = _optionalChain([roomsById, 'access', _154 => _154.get, 'call', _155 => _155(roomId), 'optionalAccess', _156 => _156.room]);
6472
6488
  return room ? room : null;
6473
6489
  }
6474
6490
  function forceLeave(roomId) {
6475
- const unsubs = _nullishCoalesce(_optionalChain([roomsById, 'access', _155 => _155.get, 'call', _156 => _156(roomId), 'optionalAccess', _157 => _157.unsubs]), () => ( /* @__PURE__ */ new Set()));
6491
+ const unsubs = _nullishCoalesce(_optionalChain([roomsById, 'access', _157 => _157.get, 'call', _158 => _158(roomId), 'optionalAccess', _159 => _159.unsubs]), () => ( /* @__PURE__ */ new Set()));
6476
6492
  for (const unsub of unsubs) {
6477
6493
  unsub();
6478
6494
  }
@@ -6753,12 +6769,12 @@ function legacy_patchImmutableNode(state, path, update) {
6753
6769
  }
6754
6770
  const newState = Object.assign({}, state);
6755
6771
  for (const key in update.updates) {
6756
- if (_optionalChain([update, 'access', _158 => _158.updates, 'access', _159 => _159[key], 'optionalAccess', _160 => _160.type]) === "update") {
6772
+ if (_optionalChain([update, 'access', _160 => _160.updates, 'access', _161 => _161[key], 'optionalAccess', _162 => _162.type]) === "update") {
6757
6773
  const val = update.node.get(key);
6758
6774
  if (val !== void 0) {
6759
6775
  newState[key] = lsonToJson(val);
6760
6776
  }
6761
- } else if (_optionalChain([update, 'access', _161 => _161.updates, 'access', _162 => _162[key], 'optionalAccess', _163 => _163.type]) === "delete") {
6777
+ } else if (_optionalChain([update, 'access', _163 => _163.updates, 'access', _164 => _164[key], 'optionalAccess', _165 => _165.type]) === "delete") {
6762
6778
  delete newState[key];
6763
6779
  }
6764
6780
  }
@@ -6819,12 +6835,12 @@ function legacy_patchImmutableNode(state, path, update) {
6819
6835
  }
6820
6836
  const newState = Object.assign({}, state);
6821
6837
  for (const key in update.updates) {
6822
- if (_optionalChain([update, 'access', _164 => _164.updates, 'access', _165 => _165[key], 'optionalAccess', _166 => _166.type]) === "update") {
6838
+ if (_optionalChain([update, 'access', _166 => _166.updates, 'access', _167 => _167[key], 'optionalAccess', _168 => _168.type]) === "update") {
6823
6839
  const value = update.node.get(key);
6824
6840
  if (value !== void 0) {
6825
6841
  newState[key] = lsonToJson(value);
6826
6842
  }
6827
- } else if (_optionalChain([update, 'access', _167 => _167.updates, 'access', _168 => _168[key], 'optionalAccess', _169 => _169.type]) === "delete") {
6843
+ } else if (_optionalChain([update, 'access', _169 => _169.updates, 'access', _170 => _170[key], 'optionalAccess', _171 => _171.type]) === "delete") {
6828
6844
  delete newState[key];
6829
6845
  }
6830
6846
  }
@@ -6914,7 +6930,7 @@ function createCacheItem(key, asyncFunction, options) {
6914
6930
  let previousState = { isLoading: false };
6915
6931
  const eventSource2 = makeEventSource();
6916
6932
  function notify() {
6917
- const isEqual = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _170 => _170.isStateEqual]), () => ( isShallowEqual));
6933
+ const isEqual = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _172 => _172.isStateEqual]), () => ( isShallowEqual));
6918
6934
  if (!isEqual(previousState, state)) {
6919
6935
  previousState = state;
6920
6936
  eventSource2.notify(state);
@@ -6982,7 +6998,7 @@ function createAsyncCache(asyncFunction, options) {
6982
6998
  return create(key).get();
6983
6999
  }
6984
7000
  function getState(key) {
6985
- return _optionalChain([cache, 'access', _171 => _171.get, 'call', _172 => _172(key), 'optionalAccess', _173 => _173.getState, 'call', _174 => _174()]);
7001
+ return _optionalChain([cache, 'access', _173 => _173.get, 'call', _174 => _174(key), 'optionalAccess', _175 => _175.getState, 'call', _176 => _176()]);
6986
7002
  }
6987
7003
  function revalidate(key) {
6988
7004
  return create(key).revalidate();
@@ -7167,5 +7183,6 @@ detectDupes(PKG_NAME, PKG_VERSION, PKG_FORMAT);
7167
7183
 
7168
7184
 
7169
7185
 
7170
- exports.ClientMsgCode = ClientMsgCode; exports.CommentsApiError = CommentsApiError; exports.CrdtType = CrdtType; exports.LiveList = LiveList; exports.LiveMap = LiveMap; exports.LiveObject = LiveObject; exports.OpCode = OpCode; exports.ServerMsgCode = ServerMsgCode; exports.WebsocketCloseCodes = WebsocketCloseCodes; exports.asPos = asPos; exports.assert = assert; exports.assertNever = assertNever; exports.b64decode = b64decode; exports.cloneLson = cloneLson; exports.console = fancy_console_exports; exports.convertToCommentData = convertToCommentData; exports.convertToCommentUserReaction = convertToCommentUserReaction; exports.convertToThreadData = convertToThreadData; exports.createAsyncCache = createAsyncCache; exports.createClient = createClient; exports.createCommentsApi = createCommentsApi; exports.deprecate = deprecate; exports.deprecateIf = deprecateIf; exports.detectDupes = detectDupes; exports.errorIf = errorIf; exports.freeze = freeze; exports.getMentionedIdsFromCommentBody = getMentionedIdsFromCommentBody; exports.isChildCrdt = isChildCrdt; exports.isJsonArray = isJsonArray; exports.isJsonObject = isJsonObject; exports.isJsonScalar = isJsonScalar; exports.isLiveNode = isLiveNode; exports.isPlainObject = isPlainObject; exports.isRootCrdt = isRootCrdt; exports.legacy_patchImmutableObject = legacy_patchImmutableObject; exports.lsonToJson = lsonToJson; exports.makeEventSource = makeEventSource; exports.makePoller = makePoller; exports.makePosition = makePosition; exports.nn = nn; exports.patchLiveObjectKey = patchLiveObjectKey; exports.raise = raise; exports.shallow = shallow; exports.stringify = stringify; exports.stringifyCommentBody = stringifyCommentBody; exports.throwUsageError = throwUsageError; exports.toPlainLson = toPlainLson; exports.tryParseJson = tryParseJson; exports.withTimeout = withTimeout;
7186
+
7187
+ exports.ClientMsgCode = ClientMsgCode; exports.CommentsApiError = CommentsApiError; exports.CrdtType = CrdtType; exports.LiveList = LiveList; exports.LiveMap = LiveMap; exports.LiveObject = LiveObject; exports.OpCode = OpCode; exports.ServerMsgCode = ServerMsgCode; exports.WebsocketCloseCodes = WebsocketCloseCodes; exports.ackOp = ackOp; exports.asPos = asPos; exports.assert = assert; exports.assertNever = assertNever; exports.b64decode = b64decode; exports.cloneLson = cloneLson; exports.console = fancy_console_exports; exports.convertToCommentData = convertToCommentData; exports.convertToCommentUserReaction = convertToCommentUserReaction; exports.convertToThreadData = convertToThreadData; exports.createAsyncCache = createAsyncCache; exports.createClient = createClient; exports.createCommentsApi = createCommentsApi; exports.deprecate = deprecate; exports.deprecateIf = deprecateIf; exports.detectDupes = detectDupes; exports.errorIf = errorIf; exports.freeze = freeze; exports.getMentionedIdsFromCommentBody = getMentionedIdsFromCommentBody; exports.isChildCrdt = isChildCrdt; exports.isJsonArray = isJsonArray; exports.isJsonObject = isJsonObject; exports.isJsonScalar = isJsonScalar; exports.isLiveNode = isLiveNode; exports.isPlainObject = isPlainObject; exports.isRootCrdt = isRootCrdt; exports.legacy_patchImmutableObject = legacy_patchImmutableObject; exports.lsonToJson = lsonToJson; exports.makeEventSource = makeEventSource; exports.makePoller = makePoller; exports.makePosition = makePosition; exports.nn = nn; exports.patchLiveObjectKey = patchLiveObjectKey; exports.raise = raise; exports.shallow = shallow; exports.stringify = stringify; exports.stringifyCommentBody = stringifyCommentBody; exports.throwUsageError = throwUsageError; exports.toPlainLson = toPlainLson; exports.tryParseJson = tryParseJson; exports.withTimeout = withTimeout;
7171
7188
  //# sourceMappingURL=index.js.map