@liveblocks/core 3.19.5-pre1 → 3.20.0-exp1

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.19.5-pre1";
9
+ var PKG_VERSION = "3.20.0-exp1";
10
10
  var PKG_FORMAT = "cjs";
11
11
 
12
12
  // src/dupe-detection.ts
@@ -5511,7 +5511,9 @@ var OpCode = Object.freeze({
5511
5511
  DELETE_CRDT: 5,
5512
5512
  DELETE_OBJECT_KEY: 6,
5513
5513
  CREATE_MAP: 7,
5514
- CREATE_REGISTER: 8
5514
+ CREATE_REGISTER: 8,
5515
+ CREATE_TEXT: 9,
5516
+ UPDATE_TEXT: 10
5515
5517
  });
5516
5518
  function isIgnoredOp(op) {
5517
5519
  return op.type === OpCode.DELETE_CRDT && op.id === "ACK";
@@ -5525,7 +5527,8 @@ var CrdtType = Object.freeze({
5525
5527
  OBJECT: 0,
5526
5528
  LIST: 1,
5527
5529
  MAP: 2,
5528
- REGISTER: 3
5530
+ REGISTER: 3,
5531
+ TEXT: 4
5529
5532
  });
5530
5533
  function isRootStorageNode(node) {
5531
5534
  return node[0] === "root";
@@ -5542,6 +5545,9 @@ function isMapStorageNode(node) {
5542
5545
  function isRegisterStorageNode(node) {
5543
5546
  return node[1].type === CrdtType.REGISTER;
5544
5547
  }
5548
+ function isTextStorageNode(node) {
5549
+ return node[1].type === CrdtType.TEXT;
5550
+ }
5545
5551
  function isCompactRootNode(node) {
5546
5552
  return node[0] === "root";
5547
5553
  }
@@ -5564,6 +5570,9 @@ function* compactNodesToNodeStream(compactNodes) {
5564
5570
  case CrdtType.REGISTER:
5565
5571
  yield [cnode[0], { type: CrdtType.REGISTER, parentId: cnode[2], parentKey: cnode[3], data: cnode[4] }];
5566
5572
  break;
5573
+ case CrdtType.TEXT:
5574
+ yield [cnode[0], { type: CrdtType.TEXT, parentId: cnode[2], parentKey: cnode[3], data: cnode[4], version: cnode[5] }];
5575
+ break;
5567
5576
  default:
5568
5577
  }
5569
5578
  }
@@ -5592,6 +5601,17 @@ function* nodeStreamToCompactNodes(nodes) {
5592
5601
  const id = node[0];
5593
5602
  const crdt = node[1];
5594
5603
  yield [id, CrdtType.REGISTER, crdt.parentId, crdt.parentKey, crdt.data];
5604
+ } else if (isTextStorageNode(node)) {
5605
+ const id = node[0];
5606
+ const crdt = node[1];
5607
+ yield [
5608
+ id,
5609
+ CrdtType.TEXT,
5610
+ crdt.parentId,
5611
+ crdt.parentKey,
5612
+ crdt.data,
5613
+ crdt.version
5614
+ ];
5595
5615
  } else {
5596
5616
  }
5597
5617
  }
@@ -8427,6 +8447,581 @@ var LiveObject = (_class2 = class _LiveObject extends AbstractCrdt {
8427
8447
  }
8428
8448
  }, _class2.__initStatic(), _class2);
8429
8449
 
8450
+ // src/crdts/liveTextOps.ts
8451
+ function attributesEqual(left, right) {
8452
+ if (left === right) {
8453
+ return true;
8454
+ }
8455
+ if (left === void 0 || right === void 0) {
8456
+ return false;
8457
+ }
8458
+ const leftKeys = Object.keys(left);
8459
+ const rightKeys = Object.keys(right);
8460
+ if (leftKeys.length !== rightKeys.length) {
8461
+ return false;
8462
+ }
8463
+ for (const key of leftKeys) {
8464
+ if (left[key] !== right[key]) {
8465
+ return false;
8466
+ }
8467
+ }
8468
+ return true;
8469
+ }
8470
+ function cloneAttributes(attributes) {
8471
+ return attributes === void 0 ? void 0 : freeze({ ...attributes });
8472
+ }
8473
+ function normalizeSegments(segments) {
8474
+ const normalized = [];
8475
+ for (const segment of segments) {
8476
+ if (segment.text.length === 0) {
8477
+ continue;
8478
+ }
8479
+ const last = normalized.at(-1);
8480
+ const attributes = cloneAttributes(segment.attributes);
8481
+ if (last !== void 0 && attributesEqual(last.attributes, attributes)) {
8482
+ last.text += segment.text;
8483
+ } else {
8484
+ normalized.push({ text: segment.text, attributes });
8485
+ }
8486
+ }
8487
+ return normalized;
8488
+ }
8489
+ function deltaToSegments(delta) {
8490
+ return normalizeSegments(
8491
+ delta.map((item) => ({
8492
+ text: item.text,
8493
+ attributes: item.attributes
8494
+ }))
8495
+ );
8496
+ }
8497
+ function segmentsToDelta(segments) {
8498
+ return segments.map(
8499
+ (segment) => segment.attributes === void 0 ? { text: segment.text } : { text: segment.text, attributes: { ...segment.attributes } }
8500
+ );
8501
+ }
8502
+ function textLength(segments) {
8503
+ return segments.reduce((sum, segment) => sum + segment.text.length, 0);
8504
+ }
8505
+ function splitSegmentsAt(segments, index) {
8506
+ const result = [];
8507
+ let offset = 0;
8508
+ for (const segment of segments) {
8509
+ const end = offset + segment.text.length;
8510
+ if (index > offset && index < end) {
8511
+ const before2 = segment.text.slice(0, index - offset);
8512
+ const after2 = segment.text.slice(index - offset);
8513
+ result.push({ text: before2, attributes: segment.attributes });
8514
+ result.push({ text: after2, attributes: segment.attributes });
8515
+ } else {
8516
+ result.push({ text: segment.text, attributes: segment.attributes });
8517
+ }
8518
+ offset = end;
8519
+ }
8520
+ return result;
8521
+ }
8522
+ function clipRange(index, length, contentLength) {
8523
+ const clippedIndex = Math.max(0, Math.min(index, contentLength));
8524
+ const clippedEnd = Math.max(
8525
+ clippedIndex,
8526
+ Math.min(index + length, contentLength)
8527
+ );
8528
+ return { index: clippedIndex, length: clippedEnd - clippedIndex };
8529
+ }
8530
+ function applyInsert(segments, index, text, attributes) {
8531
+ if (text.length === 0) {
8532
+ return normalizeSegments(segments);
8533
+ }
8534
+ const split = splitSegmentsAt(segments, index);
8535
+ const result = [];
8536
+ let offset = 0;
8537
+ let inserted = false;
8538
+ for (const segment of split) {
8539
+ if (!inserted && offset === index) {
8540
+ result.push({ text, attributes });
8541
+ inserted = true;
8542
+ }
8543
+ result.push(segment);
8544
+ offset += segment.text.length;
8545
+ }
8546
+ if (!inserted) {
8547
+ result.push({ text, attributes });
8548
+ }
8549
+ return normalizeSegments(result);
8550
+ }
8551
+ function extractDeletedSegments(segments, index, length) {
8552
+ const split = splitSegmentsAt(
8553
+ splitSegmentsAt(segments, index),
8554
+ index + length
8555
+ );
8556
+ const deleted = [];
8557
+ let offset = 0;
8558
+ for (const segment of split) {
8559
+ const end = offset + segment.text.length;
8560
+ if (offset >= index && end <= index + length) {
8561
+ deleted.push({
8562
+ text: segment.text,
8563
+ attributes: segment.attributes
8564
+ });
8565
+ }
8566
+ offset = end;
8567
+ }
8568
+ return normalizeSegments(deleted);
8569
+ }
8570
+ function applyDelete(segments, index, length) {
8571
+ const deletedSegments = extractDeletedSegments(segments, index, length);
8572
+ const split = splitSegmentsAt(
8573
+ splitSegmentsAt(segments, index),
8574
+ index + length
8575
+ );
8576
+ const result = [];
8577
+ let offset = 0;
8578
+ let deletedText = "";
8579
+ for (const segment of split) {
8580
+ const end = offset + segment.text.length;
8581
+ if (offset >= index && end <= index + length) {
8582
+ deletedText += segment.text;
8583
+ } else {
8584
+ result.push(segment);
8585
+ }
8586
+ offset = end;
8587
+ }
8588
+ return {
8589
+ segments: normalizeSegments(result),
8590
+ deletedText,
8591
+ deletedSegments
8592
+ };
8593
+ }
8594
+ function applyFormat(segments, index, length, attributes) {
8595
+ const split = splitSegmentsAt(
8596
+ splitSegmentsAt(segments, index),
8597
+ index + length
8598
+ );
8599
+ const result = [];
8600
+ let offset = 0;
8601
+ for (const segment of split) {
8602
+ const end = offset + segment.text.length;
8603
+ if (offset >= index && end <= index + length) {
8604
+ const nextAttributes = {
8605
+ ..._nullishCoalesce(segment.attributes, () => ( {}))
8606
+ };
8607
+ for (const [key, value] of Object.entries(attributes)) {
8608
+ if (value === null) {
8609
+ delete nextAttributes[key];
8610
+ } else {
8611
+ nextAttributes[key] = value;
8612
+ }
8613
+ }
8614
+ result.push({
8615
+ text: segment.text,
8616
+ attributes: Object.keys(nextAttributes).length === 0 ? void 0 : freeze(nextAttributes)
8617
+ });
8618
+ } else {
8619
+ result.push(segment);
8620
+ }
8621
+ offset = end;
8622
+ }
8623
+ return normalizeSegments(result);
8624
+ }
8625
+ function formatReverseOperations(segments, index, length, patch) {
8626
+ const split = splitSegmentsAt(
8627
+ splitSegmentsAt(segments, index),
8628
+ index + length
8629
+ );
8630
+ const result = [];
8631
+ let offset = 0;
8632
+ for (const segment of split) {
8633
+ const end = offset + segment.text.length;
8634
+ if (offset >= index && end <= index + length) {
8635
+ const attributes = {};
8636
+ for (const key of Object.keys(patch)) {
8637
+ attributes[key] = _nullishCoalesce(_optionalChain([segment, 'access', _213 => _213.attributes, 'optionalAccess', _214 => _214[key]]), () => ( null));
8638
+ }
8639
+ result.push({
8640
+ type: "format",
8641
+ index: offset,
8642
+ length: segment.text.length,
8643
+ attributes
8644
+ });
8645
+ }
8646
+ offset = end;
8647
+ }
8648
+ return result;
8649
+ }
8650
+ function mapIndexThroughOperation(index, op) {
8651
+ if (op.type === "insert") {
8652
+ return op.index <= index ? index + op.text.length : index;
8653
+ } else if (op.type === "delete") {
8654
+ if (op.index >= index) {
8655
+ return index;
8656
+ }
8657
+ return Math.max(op.index, index - op.length);
8658
+ } else {
8659
+ return index;
8660
+ }
8661
+ }
8662
+ function mapTextIndexThroughOperations(index, ops) {
8663
+ let mapped = index;
8664
+ for (const op of ops) {
8665
+ mapped = mapIndexThroughOperation(mapped, op);
8666
+ }
8667
+ return mapped;
8668
+ }
8669
+ function rebaseTextOperations(ops, acceptedOps) {
8670
+ return ops.map((op) => {
8671
+ if (op.type === "insert") {
8672
+ return {
8673
+ ...op,
8674
+ index: mapTextIndexThroughOperations(op.index, acceptedOps)
8675
+ };
8676
+ } else if (op.type === "delete" || op.type === "format") {
8677
+ const start = mapTextIndexThroughOperations(op.index, acceptedOps);
8678
+ const end = mapTextIndexThroughOperations(
8679
+ op.index + op.length,
8680
+ acceptedOps
8681
+ );
8682
+ return { ...op, index: start, length: Math.max(0, end - start) };
8683
+ } else {
8684
+ return op;
8685
+ }
8686
+ });
8687
+ }
8688
+ function applyTextOperationsToSegments(segments, ops) {
8689
+ let next = [...segments];
8690
+ for (const op of ops) {
8691
+ if (op.type === "insert") {
8692
+ const index = Math.max(0, Math.min(op.index, textLength(next)));
8693
+ next = applyInsert(next, index, op.text, op.attributes);
8694
+ } else if (op.type === "delete") {
8695
+ const index = Math.max(0, Math.min(op.index, textLength(next)));
8696
+ const clipped = clipRange(index, op.length, textLength(next));
8697
+ next = applyDelete(next, clipped.index, clipped.length).segments;
8698
+ } else {
8699
+ const index = Math.max(0, Math.min(op.index, textLength(next)));
8700
+ const clipped = clipRange(index, op.length, textLength(next));
8701
+ next = applyFormat(next, clipped.index, clipped.length, op.attributes);
8702
+ }
8703
+ }
8704
+ return next;
8705
+ }
8706
+ function applyLiveTextOperations(delta, ops) {
8707
+ return segmentsToDelta(applyTextOperationsToSegments(deltaToSegments(delta), ops));
8708
+ }
8709
+ function invertTextOperations(segments, ops) {
8710
+ let shadow = [...segments];
8711
+ const reverse = [];
8712
+ for (const op of ops) {
8713
+ if (op.type === "insert") {
8714
+ shadow = applyInsert(shadow, op.index, op.text, op.attributes);
8715
+ reverse.unshift({
8716
+ type: "delete",
8717
+ index: op.index,
8718
+ length: op.text.length
8719
+ });
8720
+ } else if (op.type === "delete") {
8721
+ const deletedSegments = extractDeletedSegments(
8722
+ shadow,
8723
+ op.index,
8724
+ op.length
8725
+ );
8726
+ shadow = applyDelete(shadow, op.index, op.length).segments;
8727
+ const inserts = [];
8728
+ let insertIndex = op.index;
8729
+ for (const segment of deletedSegments) {
8730
+ inserts.push({
8731
+ type: "insert",
8732
+ index: insertIndex,
8733
+ text: segment.text,
8734
+ attributes: segment.attributes
8735
+ });
8736
+ insertIndex += segment.text.length;
8737
+ }
8738
+ for (let index = inserts.length - 1; index >= 0; index--) {
8739
+ reverse.unshift(inserts[index]);
8740
+ }
8741
+ } else {
8742
+ const inverse = formatReverseOperations(
8743
+ shadow,
8744
+ op.index,
8745
+ op.length,
8746
+ op.attributes
8747
+ );
8748
+ shadow = applyFormat(shadow, op.index, op.length, op.attributes);
8749
+ reverse.unshift(...inverse.reverse());
8750
+ }
8751
+ }
8752
+ return reverse;
8753
+ }
8754
+
8755
+ // src/crdts/LiveText.ts
8756
+ var LiveText = class _LiveText extends AbstractCrdt {
8757
+ #segments;
8758
+ #version;
8759
+ #pendingOps;
8760
+ constructor(textOrDelta = "", version = 0) {
8761
+ super();
8762
+ this.#segments = typeof textOrDelta === "string" ? textOrDelta.length === 0 ? [] : [{ text: textOrDelta }] : deltaToSegments(textOrDelta);
8763
+ this.#version = version;
8764
+ this.#pendingOps = /* @__PURE__ */ new Map();
8765
+ }
8766
+ get version() {
8767
+ return this.#version;
8768
+ }
8769
+ get length() {
8770
+ return this.toString().length;
8771
+ }
8772
+ /** @internal */
8773
+ static _deserialize([id, item], _parentToChildren, pool) {
8774
+ const text = new _LiveText(item.data, item.version);
8775
+ text._attach(id, pool);
8776
+ return text;
8777
+ }
8778
+ /** @internal */
8779
+ _toOps(parentId, parentKey) {
8780
+ if (this._id === void 0) {
8781
+ throw new Error("Cannot serialize LiveText if it is not attached");
8782
+ }
8783
+ return [
8784
+ {
8785
+ type: OpCode.CREATE_TEXT,
8786
+ id: this._id,
8787
+ parentId,
8788
+ parentKey,
8789
+ data: this.toDelta(),
8790
+ version: this.#version
8791
+ }
8792
+ ];
8793
+ }
8794
+ /** @internal */
8795
+ _serialize() {
8796
+ if (this.parent.type !== "HasParent") {
8797
+ throw new Error("Cannot serialize LiveText if parent is missing");
8798
+ }
8799
+ return {
8800
+ type: CrdtType.TEXT,
8801
+ parentId: nn(this.parent.node._id, "Parent node expected to have ID"),
8802
+ parentKey: this.parent.key,
8803
+ data: this.toDelta(),
8804
+ version: this.#version
8805
+ };
8806
+ }
8807
+ /** @internal */
8808
+ _attachChild(_op) {
8809
+ throw new Error("LiveText cannot contain child nodes");
8810
+ }
8811
+ /** @internal */
8812
+ _detachChild(_crdt) {
8813
+ throw new Error("LiveText cannot contain child nodes");
8814
+ }
8815
+ /** @internal */
8816
+ _apply(op, isLocal) {
8817
+ if (op.type !== OpCode.UPDATE_TEXT) {
8818
+ return super._apply(op, isLocal);
8819
+ }
8820
+ if (isLocal) {
8821
+ this.#pendingOps.set(nn(op.opId), op.ops);
8822
+ return this.#applyOperations(op.ops, _nullishCoalesce(op.version, () => ( this.#version)));
8823
+ }
8824
+ if (op.opId !== void 0) {
8825
+ const pending2 = this.#pendingOps.get(op.opId);
8826
+ this.#pendingOps.delete(op.opId);
8827
+ const otherPending = Array.from(this.#pendingOps.values()).flat();
8828
+ if (pending2 !== void 0 && otherPending.length > 0) {
8829
+ this.#segments = applyTextOperationsToSegments(
8830
+ this.#segments,
8831
+ invertTextOperations(this.#segments, pending2)
8832
+ );
8833
+ const ops2 = rebaseTextOperations(op.ops, otherPending);
8834
+ return this.#applyOperations(
8835
+ ops2,
8836
+ _nullishCoalesce(op.version, () => ( Math.max(this.#version, op.baseVersion + 1)))
8837
+ );
8838
+ }
8839
+ this.#version = _nullishCoalesce(op.version, () => ( Math.max(this.#version, op.baseVersion + 1)));
8840
+ return { modified: false };
8841
+ }
8842
+ const pending = Array.from(this.#pendingOps.values()).flat();
8843
+ const ops = pending.length > 0 ? rebaseTextOperations(op.ops, pending) : op.ops;
8844
+ return this.#applyOperations(ops, _nullishCoalesce(op.version, () => ( this.#version + 1)));
8845
+ }
8846
+ insert(index, text, attributes) {
8847
+ const clippedIndex = Math.max(0, Math.min(index, this.length));
8848
+ this.#dispatch([{ type: "insert", index: clippedIndex, text, attributes }]);
8849
+ }
8850
+ delete(index, length) {
8851
+ const clipped = clipRange(index, length, this.length);
8852
+ if (clipped.length === 0) {
8853
+ return;
8854
+ }
8855
+ this.#dispatch([
8856
+ { type: "delete", index: clipped.index, length: clipped.length }
8857
+ ]);
8858
+ }
8859
+ replace(index, length, text, attributes) {
8860
+ const clipped = clipRange(index, length, this.length);
8861
+ const ops = [];
8862
+ if (clipped.length > 0) {
8863
+ ops.push({
8864
+ type: "delete",
8865
+ index: clipped.index,
8866
+ length: clipped.length
8867
+ });
8868
+ }
8869
+ if (text.length > 0) {
8870
+ ops.push({ type: "insert", index: clipped.index, text, attributes });
8871
+ }
8872
+ this.#dispatch(ops);
8873
+ }
8874
+ format(index, length, attributes) {
8875
+ const clipped = clipRange(index, length, this.length);
8876
+ if (clipped.length === 0) {
8877
+ return;
8878
+ }
8879
+ this.#dispatch([
8880
+ {
8881
+ type: "format",
8882
+ index: clipped.index,
8883
+ length: clipped.length,
8884
+ attributes
8885
+ }
8886
+ ]);
8887
+ }
8888
+ #dispatch(ops) {
8889
+ if (ops.length === 0) {
8890
+ return;
8891
+ }
8892
+ _optionalChain([this, 'access', _215 => _215._pool, 'optionalAccess', _216 => _216.assertStorageIsWritable, 'call', _217 => _217()]);
8893
+ const baseVersion = this.#version;
8894
+ const reverse = this._pool !== void 0 && this._id !== void 0 ? this.#invertOperations(ops) : [];
8895
+ const changes = this.#applyOperationsLocally(ops);
8896
+ if (this._pool !== void 0 && this._id !== void 0) {
8897
+ const opId = this._pool.generateOpId();
8898
+ this.#pendingOps.set(opId, ops);
8899
+ this._pool.dispatch(
8900
+ [
8901
+ {
8902
+ type: OpCode.UPDATE_TEXT,
8903
+ id: this._id,
8904
+ opId,
8905
+ baseVersion,
8906
+ ops: [...ops]
8907
+ }
8908
+ ],
8909
+ reverse,
8910
+ /* @__PURE__ */ new Map([
8911
+ [
8912
+ this._id,
8913
+ {
8914
+ type: "LiveText",
8915
+ node: this,
8916
+ version: this.#version,
8917
+ updates: changes
8918
+ }
8919
+ ]
8920
+ ])
8921
+ );
8922
+ }
8923
+ }
8924
+ #applyOperations(ops, version) {
8925
+ const reverse = this.#invertOperations(ops);
8926
+ const changes = this.#applyOperationsLocally(ops);
8927
+ this.#version = Math.max(this.#version, version);
8928
+ return {
8929
+ reverse,
8930
+ modified: {
8931
+ type: "LiveText",
8932
+ node: this,
8933
+ version: this.#version,
8934
+ updates: changes
8935
+ }
8936
+ };
8937
+ }
8938
+ #applyOperationsLocally(ops) {
8939
+ const changes = [];
8940
+ for (const op of ops) {
8941
+ if (op.type === "insert") {
8942
+ this.#segments = applyInsert(
8943
+ this.#segments,
8944
+ op.index,
8945
+ op.text,
8946
+ op.attributes
8947
+ );
8948
+ changes.push({
8949
+ type: "insert",
8950
+ index: op.index,
8951
+ text: op.text,
8952
+ attributes: op.attributes
8953
+ });
8954
+ } else if (op.type === "delete") {
8955
+ const result = applyDelete(this.#segments, op.index, op.length);
8956
+ this.#segments = result.segments;
8957
+ changes.push({
8958
+ type: "delete",
8959
+ index: op.index,
8960
+ length: op.length,
8961
+ deletedText: result.deletedText
8962
+ });
8963
+ } else {
8964
+ this.#segments = applyFormat(
8965
+ this.#segments,
8966
+ op.index,
8967
+ op.length,
8968
+ op.attributes
8969
+ );
8970
+ changes.push({
8971
+ type: "format",
8972
+ index: op.index,
8973
+ length: op.length,
8974
+ attributes: op.attributes
8975
+ });
8976
+ }
8977
+ }
8978
+ this.invalidate();
8979
+ return changes;
8980
+ }
8981
+ #invertOperations(ops) {
8982
+ return [
8983
+ {
8984
+ type: OpCode.UPDATE_TEXT,
8985
+ id: nn(this._id),
8986
+ baseVersion: this.#version,
8987
+ ops: invertTextOperations(this.#segments, ops)
8988
+ }
8989
+ ];
8990
+ }
8991
+ toString() {
8992
+ return this.#segments.map((segment) => segment.text).join("");
8993
+ }
8994
+ toDelta() {
8995
+ return segmentsToDelta(this.#segments);
8996
+ }
8997
+ toJSON() {
8998
+ return super.toJSON();
8999
+ }
9000
+ /** @internal */
9001
+ _toJSON() {
9002
+ return this.toDelta();
9003
+ }
9004
+ /** @internal */
9005
+ _toTreeNode(key) {
9006
+ return {
9007
+ type: "LiveText",
9008
+ id: _nullishCoalesce(this._id, () => ( nanoid())),
9009
+ key,
9010
+ payload: [
9011
+ {
9012
+ type: "Json",
9013
+ id: `${_nullishCoalesce(this._id, () => ( nanoid()))}:text`,
9014
+ key: "text",
9015
+ payload: this.toString()
9016
+ }
9017
+ ]
9018
+ };
9019
+ }
9020
+ clone() {
9021
+ return new _LiveText(this.toDelta(), this.#version);
9022
+ }
9023
+ };
9024
+
8430
9025
  // src/crdts/liveblocks-helpers.ts
8431
9026
  function creationOpToLiveNode(op) {
8432
9027
  return lsonToLiveNode(creationOpToLson(op));
@@ -8441,6 +9036,8 @@ function creationOpToLson(op) {
8441
9036
  return new LiveMap();
8442
9037
  case OpCode.CREATE_LIST:
8443
9038
  return new LiveList([]);
9039
+ case OpCode.CREATE_TEXT:
9040
+ return new LiveText(op.data, op.version);
8444
9041
  default:
8445
9042
  return assertNever(op, "Unknown creation Op");
8446
9043
  }
@@ -8463,6 +9060,8 @@ function deserialize(node, parentToChildren, pool) {
8463
9060
  return LiveMap._deserialize(node, parentToChildren, pool);
8464
9061
  } else if (isRegisterStorageNode(node)) {
8465
9062
  return LiveRegister._deserialize(node, parentToChildren, pool);
9063
+ } else if (isTextStorageNode(node)) {
9064
+ return LiveText._deserialize(node, parentToChildren, pool);
8466
9065
  } else {
8467
9066
  throw new Error("Unexpected CRDT type");
8468
9067
  }
@@ -8476,12 +9075,14 @@ function deserializeToLson(node, parentToChildren, pool) {
8476
9075
  return LiveMap._deserialize(node, parentToChildren, pool);
8477
9076
  } else if (isRegisterStorageNode(node)) {
8478
9077
  return node[1].data;
9078
+ } else if (isTextStorageNode(node)) {
9079
+ return LiveText._deserialize(node, parentToChildren, pool);
8479
9080
  } else {
8480
9081
  throw new Error("Unexpected CRDT type");
8481
9082
  }
8482
9083
  }
8483
9084
  function isLiveStructure(value) {
8484
- return isLiveList(value) || isLiveMap(value) || isLiveObject(value);
9085
+ return isLiveList(value) || isLiveMap(value) || isLiveObject(value) || isLiveText(value);
8485
9086
  }
8486
9087
  function isLiveNode(value) {
8487
9088
  return isLiveStructure(value) || isLiveRegister(value);
@@ -8495,6 +9096,9 @@ function isLiveMap(value) {
8495
9096
  function isLiveObject(value) {
8496
9097
  return value instanceof LiveObject;
8497
9098
  }
9099
+ function isLiveText(value) {
9100
+ return value instanceof LiveText;
9101
+ }
8498
9102
  function isLiveRegister(value) {
8499
9103
  return value instanceof LiveRegister;
8500
9104
  }
@@ -8504,14 +9108,14 @@ function cloneLson(value) {
8504
9108
  function liveNodeToLson(obj) {
8505
9109
  if (obj instanceof LiveRegister) {
8506
9110
  return obj.data;
8507
- } else if (obj instanceof LiveList || obj instanceof LiveMap || obj instanceof LiveObject) {
9111
+ } else if (obj instanceof LiveList || obj instanceof LiveMap || obj instanceof LiveObject || obj instanceof LiveText) {
8508
9112
  return obj;
8509
9113
  } else {
8510
9114
  return assertNever(obj, "Unknown AbstractCrdt");
8511
9115
  }
8512
9116
  }
8513
9117
  function lsonToLiveNode(value) {
8514
- if (value instanceof LiveObject || value instanceof LiveMap || value instanceof LiveList) {
9118
+ if (value instanceof LiveObject || value instanceof LiveMap || value instanceof LiveList || value instanceof LiveText) {
8515
9119
  return value;
8516
9120
  } else {
8517
9121
  return new LiveRegister(value);
@@ -8606,6 +9210,38 @@ function getTreesDiffOperations(currentItems, newItems) {
8606
9210
  }
8607
9211
  }
8608
9212
  }
9213
+ if (crdt.type === CrdtType.TEXT) {
9214
+ if (currentCrdt.type !== CrdtType.TEXT || stringifyOrLog(crdt.data) !== stringifyOrLog(currentCrdt.data) || crdt.version !== currentCrdt.version) {
9215
+ ops.push({
9216
+ type: OpCode.UPDATE_TEXT,
9217
+ id,
9218
+ baseVersion: currentCrdt.type === CrdtType.TEXT ? currentCrdt.version : 0,
9219
+ version: crdt.version,
9220
+ ops: [
9221
+ {
9222
+ type: "delete",
9223
+ index: 0,
9224
+ length: currentCrdt.type === CrdtType.TEXT ? currentCrdt.data.reduce(
9225
+ (sum, item) => sum + item.text.length,
9226
+ 0
9227
+ ) : 0
9228
+ },
9229
+ ...crdt.data.map(
9230
+ (item, index, items) => item.attributes === void 0 ? {
9231
+ type: "insert",
9232
+ index: items.slice(0, index).reduce((sum, item2) => sum + item2.text.length, 0),
9233
+ text: item.text
9234
+ } : {
9235
+ type: "insert",
9236
+ index: items.slice(0, index).reduce((sum, item2) => sum + item2.text.length, 0),
9237
+ text: item.text,
9238
+ attributes: item.attributes
9239
+ }
9240
+ )
9241
+ ]
9242
+ });
9243
+ }
9244
+ }
8609
9245
  if (crdt.parentKey !== currentCrdt.parentKey) {
8610
9246
  ops.push({
8611
9247
  type: OpCode.SET_PARENT_KEY,
@@ -8654,6 +9290,16 @@ function getTreesDiffOperations(currentItems, newItems) {
8654
9290
  parentKey: crdt.parentKey
8655
9291
  });
8656
9292
  break;
9293
+ case CrdtType.TEXT:
9294
+ ops.push({
9295
+ type: OpCode.CREATE_TEXT,
9296
+ id,
9297
+ parentId: crdt.parentId,
9298
+ parentKey: crdt.parentKey,
9299
+ data: crdt.data,
9300
+ version: crdt.version
9301
+ });
9302
+ break;
8657
9303
  }
8658
9304
  }
8659
9305
  });
@@ -8686,6 +9332,12 @@ function mergeListStorageUpdates(first, second) {
8686
9332
  updates: updates.concat(second.updates)
8687
9333
  };
8688
9334
  }
9335
+ function mergeTextStorageUpdates(first, second) {
9336
+ return {
9337
+ ...second,
9338
+ updates: first.updates.concat(second.updates)
9339
+ };
9340
+ }
8689
9341
  function mergeStorageUpdates(first, second) {
8690
9342
  if (first === void 0) {
8691
9343
  return second;
@@ -8696,6 +9348,8 @@ function mergeStorageUpdates(first, second) {
8696
9348
  return mergeMapStorageUpdates(first, second);
8697
9349
  } else if (first.type === "LiveList" && second.type === "LiveList") {
8698
9350
  return mergeListStorageUpdates(first, second);
9351
+ } else if (first.type === "LiveText" && second.type === "LiveText") {
9352
+ return mergeTextStorageUpdates(first, second);
8699
9353
  } else {
8700
9354
  }
8701
9355
  return second;
@@ -8714,7 +9368,7 @@ function sendToPanel(message, options) {
8714
9368
  ...message,
8715
9369
  source: "liveblocks-devtools-client"
8716
9370
  };
8717
- if (!(_optionalChain([options, 'optionalAccess', _213 => _213.force]) || _bridgeActive)) {
9371
+ if (!(_optionalChain([options, 'optionalAccess', _218 => _218.force]) || _bridgeActive)) {
8718
9372
  return;
8719
9373
  }
8720
9374
  window.postMessage(fullMsg, "*");
@@ -8722,7 +9376,7 @@ function sendToPanel(message, options) {
8722
9376
  var eventSource = makeEventSource();
8723
9377
  if (process.env.NODE_ENV !== "production" && typeof window !== "undefined") {
8724
9378
  window.addEventListener("message", (event) => {
8725
- if (event.source === window && _optionalChain([event, 'access', _214 => _214.data, 'optionalAccess', _215 => _215.source]) === "liveblocks-devtools-panel") {
9379
+ if (event.source === window && _optionalChain([event, 'access', _219 => _219.data, 'optionalAccess', _220 => _220.source]) === "liveblocks-devtools-panel") {
8726
9380
  eventSource.notify(event.data);
8727
9381
  } else {
8728
9382
  }
@@ -8864,7 +9518,7 @@ function fullSync(room) {
8864
9518
  msg: "room::sync::full",
8865
9519
  roomId: room.id,
8866
9520
  status: room.getStatus(),
8867
- storage: _nullishCoalesce(_optionalChain([root, 'optionalAccess', _216 => _216.toTreeNode, 'call', _217 => _217("root"), 'access', _218 => _218.payload]), () => ( null)),
9521
+ storage: _nullishCoalesce(_optionalChain([root, 'optionalAccess', _221 => _221.toTreeNode, 'call', _222 => _222("root"), 'access', _223 => _223.payload]), () => ( null)),
8868
9522
  me,
8869
9523
  others
8870
9524
  });
@@ -9543,15 +10197,15 @@ function installBackgroundTabSpy() {
9543
10197
  const doc = typeof document !== "undefined" ? document : void 0;
9544
10198
  const inBackgroundSince = { current: null };
9545
10199
  function onVisibilityChange() {
9546
- if (_optionalChain([doc, 'optionalAccess', _219 => _219.visibilityState]) === "hidden") {
10200
+ if (_optionalChain([doc, 'optionalAccess', _224 => _224.visibilityState]) === "hidden") {
9547
10201
  inBackgroundSince.current = _nullishCoalesce(inBackgroundSince.current, () => ( Date.now()));
9548
10202
  } else {
9549
10203
  inBackgroundSince.current = null;
9550
10204
  }
9551
10205
  }
9552
- _optionalChain([doc, 'optionalAccess', _220 => _220.addEventListener, 'call', _221 => _221("visibilitychange", onVisibilityChange)]);
10206
+ _optionalChain([doc, 'optionalAccess', _225 => _225.addEventListener, 'call', _226 => _226("visibilitychange", onVisibilityChange)]);
9553
10207
  const unsub = () => {
9554
- _optionalChain([doc, 'optionalAccess', _222 => _222.removeEventListener, 'call', _223 => _223("visibilitychange", onVisibilityChange)]);
10208
+ _optionalChain([doc, 'optionalAccess', _227 => _227.removeEventListener, 'call', _228 => _228("visibilitychange", onVisibilityChange)]);
9555
10209
  };
9556
10210
  return [inBackgroundSince, unsub];
9557
10211
  }
@@ -9744,7 +10398,7 @@ function createRoom(options, config) {
9744
10398
  }
9745
10399
  }
9746
10400
  function isStorageWritable() {
9747
- const scopes = _optionalChain([context, 'access', _224 => _224.dynamicSessionInfoSig, 'access', _225 => _225.get, 'call', _226 => _226(), 'optionalAccess', _227 => _227.scopes]);
10401
+ const scopes = _optionalChain([context, 'access', _229 => _229.dynamicSessionInfoSig, 'access', _230 => _230.get, 'call', _231 => _231(), 'optionalAccess', _232 => _232.scopes]);
9748
10402
  return scopes !== void 0 ? canWriteStorage(scopes) : true;
9749
10403
  }
9750
10404
  const eventHub = {
@@ -9852,7 +10506,7 @@ function createRoom(options, config) {
9852
10506
  context.pool
9853
10507
  );
9854
10508
  }
9855
- const canWrite = _nullishCoalesce(_optionalChain([self, 'access', _228 => _228.get, 'call', _229 => _229(), 'optionalAccess', _230 => _230.canWrite]), () => ( true));
10509
+ const canWrite = _nullishCoalesce(_optionalChain([self, 'access', _233 => _233.get, 'call', _234 => _234(), 'optionalAccess', _235 => _235.canWrite]), () => ( true));
9856
10510
  const root = context.root;
9857
10511
  disableHistory(() => {
9858
10512
  for (const key in context.initialStorage) {
@@ -9984,7 +10638,7 @@ function createRoom(options, config) {
9984
10638
  );
9985
10639
  output.reverse.pushLeft(applyOpResult.reverse);
9986
10640
  }
9987
- if (op.type === OpCode.CREATE_LIST || op.type === OpCode.CREATE_MAP || op.type === OpCode.CREATE_OBJECT) {
10641
+ if (op.type === OpCode.CREATE_LIST || op.type === OpCode.CREATE_MAP || op.type === OpCode.CREATE_OBJECT || op.type === OpCode.CREATE_TEXT) {
9988
10642
  createdNodeIds.add(op.id);
9989
10643
  }
9990
10644
  }
@@ -10004,6 +10658,7 @@ function createRoom(options, config) {
10004
10658
  switch (op.type) {
10005
10659
  case OpCode.DELETE_OBJECT_KEY:
10006
10660
  case OpCode.UPDATE_OBJECT:
10661
+ case OpCode.UPDATE_TEXT:
10007
10662
  case OpCode.DELETE_CRDT: {
10008
10663
  const node = context.pool.nodes.get(op.id);
10009
10664
  if (node === void 0) {
@@ -10028,6 +10683,7 @@ function createRoom(options, config) {
10028
10683
  case OpCode.CREATE_OBJECT:
10029
10684
  case OpCode.CREATE_LIST:
10030
10685
  case OpCode.CREATE_MAP:
10686
+ case OpCode.CREATE_TEXT:
10031
10687
  case OpCode.CREATE_REGISTER: {
10032
10688
  if (op.parentId === void 0) {
10033
10689
  return { modified: false };
@@ -10058,7 +10714,7 @@ function createRoom(options, config) {
10058
10714
  }
10059
10715
  context.myPresence.patch(patch);
10060
10716
  if (context.activeBatch) {
10061
- if (_optionalChain([options2, 'optionalAccess', _231 => _231.addToHistory])) {
10717
+ if (_optionalChain([options2, 'optionalAccess', _236 => _236.addToHistory])) {
10062
10718
  context.activeBatch.reverseOps.pushLeft({
10063
10719
  type: "presence",
10064
10720
  data: oldValues
@@ -10067,7 +10723,7 @@ function createRoom(options, config) {
10067
10723
  context.activeBatch.updates.presence = true;
10068
10724
  } else {
10069
10725
  flushNowOrSoon();
10070
- if (_optionalChain([options2, 'optionalAccess', _232 => _232.addToHistory])) {
10726
+ if (_optionalChain([options2, 'optionalAccess', _237 => _237.addToHistory])) {
10071
10727
  addToUndoStack([{ type: "presence", data: oldValues }]);
10072
10728
  }
10073
10729
  notify({ presence: true });
@@ -10244,11 +10900,11 @@ function createRoom(options, config) {
10244
10900
  break;
10245
10901
  }
10246
10902
  case ServerMsgCode.STORAGE_CHUNK:
10247
- _optionalChain([stopwatch, 'optionalAccess', _233 => _233.lap, 'call', _234 => _234()]);
10903
+ _optionalChain([stopwatch, 'optionalAccess', _238 => _238.lap, 'call', _239 => _239()]);
10248
10904
  nodeMapBuffer.append(compactNodesToNodeStream(message.nodes));
10249
10905
  break;
10250
10906
  case ServerMsgCode.STORAGE_STREAM_END: {
10251
- const timing = _optionalChain([stopwatch, 'optionalAccess', _235 => _235.stop, 'call', _236 => _236()]);
10907
+ const timing = _optionalChain([stopwatch, 'optionalAccess', _240 => _240.stop, 'call', _241 => _241()]);
10252
10908
  if (timing) {
10253
10909
  const ms = (v) => `${v.toFixed(1)}ms`;
10254
10910
  const rest = timing.laps.slice(1);
@@ -10383,11 +11039,11 @@ function createRoom(options, config) {
10383
11039
  } else if (pendingFeedsRequests.has(requestId)) {
10384
11040
  const pending = pendingFeedsRequests.get(requestId);
10385
11041
  pendingFeedsRequests.delete(requestId);
10386
- _optionalChain([pending, 'optionalAccess', _237 => _237.reject, 'call', _238 => _238(err)]);
11042
+ _optionalChain([pending, 'optionalAccess', _242 => _242.reject, 'call', _243 => _243(err)]);
10387
11043
  } else if (pendingFeedMessagesRequests.has(requestId)) {
10388
11044
  const pending = pendingFeedMessagesRequests.get(requestId);
10389
11045
  pendingFeedMessagesRequests.delete(requestId);
10390
- _optionalChain([pending, 'optionalAccess', _239 => _239.reject, 'call', _240 => _240(err)]);
11046
+ _optionalChain([pending, 'optionalAccess', _244 => _244.reject, 'call', _245 => _245(err)]);
10391
11047
  }
10392
11048
  eventHub.feeds.notify(message);
10393
11049
  break;
@@ -10541,10 +11197,10 @@ function createRoom(options, config) {
10541
11197
  timeoutId,
10542
11198
  kind,
10543
11199
  feedId,
10544
- messageId: _optionalChain([options2, 'optionalAccess', _241 => _241.messageId]),
10545
- expectedClientMessageId: _optionalChain([options2, 'optionalAccess', _242 => _242.expectedClientMessageId])
11200
+ messageId: _optionalChain([options2, 'optionalAccess', _246 => _246.messageId]),
11201
+ expectedClientMessageId: _optionalChain([options2, 'optionalAccess', _247 => _247.expectedClientMessageId])
10546
11202
  });
10547
- if (kind === "add-message" && _optionalChain([options2, 'optionalAccess', _243 => _243.expectedClientMessageId]) === void 0) {
11203
+ if (kind === "add-message" && _optionalChain([options2, 'optionalAccess', _248 => _248.expectedClientMessageId]) === void 0) {
10548
11204
  const q = _nullishCoalesce(pendingAddMessageFifoByFeed.get(feedId), () => ( []));
10549
11205
  q.push(requestId);
10550
11206
  pendingAddMessageFifoByFeed.set(feedId, q);
@@ -10595,10 +11251,10 @@ function createRoom(options, config) {
10595
11251
  }
10596
11252
  if (!matched) {
10597
11253
  const q = pendingAddMessageFifoByFeed.get(message.feedId);
10598
- const headId = _optionalChain([q, 'optionalAccess', _244 => _244[0]]);
11254
+ const headId = _optionalChain([q, 'optionalAccess', _249 => _249[0]]);
10599
11255
  if (headId !== void 0) {
10600
11256
  const pending = pendingFeedMutations.get(headId);
10601
- if (_optionalChain([pending, 'optionalAccess', _245 => _245.kind]) === "add-message" && pending.expectedClientMessageId === void 0) {
11257
+ if (_optionalChain([pending, 'optionalAccess', _250 => _250.kind]) === "add-message" && pending.expectedClientMessageId === void 0) {
10602
11258
  settleFeedMutation(headId, "ok");
10603
11259
  }
10604
11260
  }
@@ -10634,7 +11290,7 @@ function createRoom(options, config) {
10634
11290
  const unacknowledgedOps2 = [...context.unacknowledgedOps.values()];
10635
11291
  createOrUpdateRootFromMessage(nodes);
10636
11292
  applyAndSendOfflineOps(unacknowledgedOps2);
10637
- _optionalChain([_resolveStoragePromise, 'optionalCall', _246 => _246()]);
11293
+ _optionalChain([_resolveStoragePromise, 'optionalCall', _251 => _251()]);
10638
11294
  notifyStorageStatus();
10639
11295
  eventHub.storageDidLoad.notify();
10640
11296
  }
@@ -10652,7 +11308,7 @@ function createRoom(options, config) {
10652
11308
  } else if (!messages.some((msg) => msg.type === ClientMsgCode.FETCH_STORAGE)) {
10653
11309
  messages.push({ type: ClientMsgCode.FETCH_STORAGE });
10654
11310
  nodeMapBuffer.take();
10655
- _optionalChain([stopwatch, 'optionalAccess', _247 => _247.start, 'call', _248 => _248()]);
11311
+ _optionalChain([stopwatch, 'optionalAccess', _252 => _252.start, 'call', _253 => _253()]);
10656
11312
  }
10657
11313
  if (options2.flush) {
10658
11314
  flushNowOrSoon();
@@ -10708,10 +11364,10 @@ function createRoom(options, config) {
10708
11364
  const message = {
10709
11365
  type: ClientMsgCode.FETCH_FEEDS,
10710
11366
  requestId,
10711
- cursor: _optionalChain([options2, 'optionalAccess', _249 => _249.cursor]),
10712
- since: _optionalChain([options2, 'optionalAccess', _250 => _250.since]),
10713
- limit: _optionalChain([options2, 'optionalAccess', _251 => _251.limit]),
10714
- metadata: _optionalChain([options2, 'optionalAccess', _252 => _252.metadata])
11367
+ cursor: _optionalChain([options2, 'optionalAccess', _254 => _254.cursor]),
11368
+ since: _optionalChain([options2, 'optionalAccess', _255 => _255.since]),
11369
+ limit: _optionalChain([options2, 'optionalAccess', _256 => _256.limit]),
11370
+ metadata: _optionalChain([options2, 'optionalAccess', _257 => _257.metadata])
10715
11371
  };
10716
11372
  context.buffer.messages.push(message);
10717
11373
  flushNowOrSoon();
@@ -10731,9 +11387,9 @@ function createRoom(options, config) {
10731
11387
  type: ClientMsgCode.FETCH_FEED_MESSAGES,
10732
11388
  requestId,
10733
11389
  feedId,
10734
- cursor: _optionalChain([options2, 'optionalAccess', _253 => _253.cursor]),
10735
- since: _optionalChain([options2, 'optionalAccess', _254 => _254.since]),
10736
- limit: _optionalChain([options2, 'optionalAccess', _255 => _255.limit])
11390
+ cursor: _optionalChain([options2, 'optionalAccess', _258 => _258.cursor]),
11391
+ since: _optionalChain([options2, 'optionalAccess', _259 => _259.since]),
11392
+ limit: _optionalChain([options2, 'optionalAccess', _260 => _260.limit])
10737
11393
  };
10738
11394
  context.buffer.messages.push(message);
10739
11395
  flushNowOrSoon();
@@ -10752,8 +11408,8 @@ function createRoom(options, config) {
10752
11408
  type: ClientMsgCode.ADD_FEED,
10753
11409
  requestId,
10754
11410
  feedId,
10755
- metadata: _optionalChain([options2, 'optionalAccess', _256 => _256.metadata]),
10756
- createdAt: _optionalChain([options2, 'optionalAccess', _257 => _257.createdAt])
11411
+ metadata: _optionalChain([options2, 'optionalAccess', _261 => _261.metadata]),
11412
+ createdAt: _optionalChain([options2, 'optionalAccess', _262 => _262.createdAt])
10757
11413
  };
10758
11414
  context.buffer.messages.push(message);
10759
11415
  flushNowOrSoon();
@@ -10787,15 +11443,15 @@ function createRoom(options, config) {
10787
11443
  function addFeedMessage(feedId, data, options2) {
10788
11444
  const requestId = nanoid();
10789
11445
  const promise = registerFeedMutation(requestId, "add-message", feedId, {
10790
- expectedClientMessageId: _optionalChain([options2, 'optionalAccess', _258 => _258.id])
11446
+ expectedClientMessageId: _optionalChain([options2, 'optionalAccess', _263 => _263.id])
10791
11447
  });
10792
11448
  const message = {
10793
11449
  type: ClientMsgCode.ADD_FEED_MESSAGE,
10794
11450
  requestId,
10795
11451
  feedId,
10796
11452
  data,
10797
- id: _optionalChain([options2, 'optionalAccess', _259 => _259.id]),
10798
- createdAt: _optionalChain([options2, 'optionalAccess', _260 => _260.createdAt])
11453
+ id: _optionalChain([options2, 'optionalAccess', _264 => _264.id]),
11454
+ createdAt: _optionalChain([options2, 'optionalAccess', _265 => _265.createdAt])
10799
11455
  };
10800
11456
  context.buffer.messages.push(message);
10801
11457
  flushNowOrSoon();
@@ -10812,7 +11468,7 @@ function createRoom(options, config) {
10812
11468
  feedId,
10813
11469
  messageId,
10814
11470
  data,
10815
- updatedAt: _optionalChain([options2, 'optionalAccess', _261 => _261.updatedAt])
11471
+ updatedAt: _optionalChain([options2, 'optionalAccess', _266 => _266.updatedAt])
10816
11472
  };
10817
11473
  context.buffer.messages.push(message);
10818
11474
  flushNowOrSoon();
@@ -11019,8 +11675,8 @@ function createRoom(options, config) {
11019
11675
  async function getThreads(options2) {
11020
11676
  return httpClient.getThreads({
11021
11677
  roomId,
11022
- query: _optionalChain([options2, 'optionalAccess', _262 => _262.query]),
11023
- cursor: _optionalChain([options2, 'optionalAccess', _263 => _263.cursor])
11678
+ query: _optionalChain([options2, 'optionalAccess', _267 => _267.query]),
11679
+ cursor: _optionalChain([options2, 'optionalAccess', _268 => _268.cursor])
11024
11680
  });
11025
11681
  }
11026
11682
  async function getThread(threadId) {
@@ -11142,7 +11798,7 @@ function createRoom(options, config) {
11142
11798
  function getSubscriptionSettings(options2) {
11143
11799
  return httpClient.getSubscriptionSettings({
11144
11800
  roomId,
11145
- signal: _optionalChain([options2, 'optionalAccess', _264 => _264.signal])
11801
+ signal: _optionalChain([options2, 'optionalAccess', _269 => _269.signal])
11146
11802
  });
11147
11803
  }
11148
11804
  function updateSubscriptionSettings(settings) {
@@ -11164,7 +11820,7 @@ function createRoom(options, config) {
11164
11820
  {
11165
11821
  [kInternal]: {
11166
11822
  get presenceBuffer() {
11167
- return deepClone(_nullishCoalesce(_optionalChain([context, 'access', _265 => _265.buffer, 'access', _266 => _266.presenceUpdates, 'optionalAccess', _267 => _267.data]), () => ( null)));
11823
+ return deepClone(_nullishCoalesce(_optionalChain([context, 'access', _270 => _270.buffer, 'access', _271 => _271.presenceUpdates, 'optionalAccess', _272 => _272.data]), () => ( null)));
11168
11824
  },
11169
11825
  // prettier-ignore
11170
11826
  get undoStack() {
@@ -11179,9 +11835,9 @@ function createRoom(options, config) {
11179
11835
  return context.yjsProvider;
11180
11836
  },
11181
11837
  setYjsProvider(newProvider) {
11182
- _optionalChain([context, 'access', _268 => _268.yjsProvider, 'optionalAccess', _269 => _269.off, 'call', _270 => _270("status", yjsStatusDidChange)]);
11838
+ _optionalChain([context, 'access', _273 => _273.yjsProvider, 'optionalAccess', _274 => _274.off, 'call', _275 => _275("status", yjsStatusDidChange)]);
11183
11839
  context.yjsProvider = newProvider;
11184
- _optionalChain([newProvider, 'optionalAccess', _271 => _271.on, 'call', _272 => _272("status", yjsStatusDidChange)]);
11840
+ _optionalChain([newProvider, 'optionalAccess', _276 => _276.on, 'call', _277 => _277("status", yjsStatusDidChange)]);
11185
11841
  context.yjsProviderDidChange.notify();
11186
11842
  },
11187
11843
  yjsProviderDidChange: context.yjsProviderDidChange.observable,
@@ -11239,7 +11895,7 @@ ${dumpPool(context.pool)}`;
11239
11895
  source.dispose();
11240
11896
  }
11241
11897
  eventHub.roomWillDestroy.notify();
11242
- _optionalChain([context, 'access', _273 => _273.yjsProvider, 'optionalAccess', _274 => _274.off, 'call', _275 => _275("status", yjsStatusDidChange)]);
11898
+ _optionalChain([context, 'access', _278 => _278.yjsProvider, 'optionalAccess', _279 => _279.off, 'call', _280 => _280("status", yjsStatusDidChange)]);
11243
11899
  syncSourceForStorage.destroy();
11244
11900
  syncSourceForYjs.destroy();
11245
11901
  uninstallBgTabSpy();
@@ -11399,7 +12055,7 @@ function makeClassicSubscribeFn(roomId, events, errorEvents) {
11399
12055
  }
11400
12056
  if (isLiveNode(first)) {
11401
12057
  const node = first;
11402
- if (_optionalChain([options, 'optionalAccess', _276 => _276.isDeep])) {
12058
+ if (_optionalChain([options, 'optionalAccess', _281 => _281.isDeep])) {
11403
12059
  const storageCallback = second;
11404
12060
  return subscribeToLiveStructureDeeply(node, storageCallback);
11405
12061
  } else {
@@ -11485,8 +12141,8 @@ function createClient(options) {
11485
12141
  const authManager = createAuthManager(options, (token) => {
11486
12142
  currentUserId.set(() => token.uid);
11487
12143
  });
11488
- const fetchPolyfill = _optionalChain([clientOptions, 'access', _277 => _277.polyfills, 'optionalAccess', _278 => _278.fetch]) || /* istanbul ignore next */
11489
- _optionalChain([globalThis, 'access', _279 => _279.fetch, 'optionalAccess', _280 => _280.bind, 'call', _281 => _281(globalThis)]);
12144
+ const fetchPolyfill = _optionalChain([clientOptions, 'access', _282 => _282.polyfills, 'optionalAccess', _283 => _283.fetch]) || /* istanbul ignore next */
12145
+ _optionalChain([globalThis, 'access', _284 => _284.fetch, 'optionalAccess', _285 => _285.bind, 'call', _286 => _286(globalThis)]);
11490
12146
  const httpClient = createApiClient({
11491
12147
  baseUrl,
11492
12148
  fetchPolyfill,
@@ -11504,7 +12160,7 @@ function createClient(options) {
11504
12160
  delegates: {
11505
12161
  createSocket: makeCreateSocketDelegateForAi(
11506
12162
  baseUrl,
11507
- _optionalChain([clientOptions, 'access', _282 => _282.polyfills, 'optionalAccess', _283 => _283.WebSocket])
12163
+ _optionalChain([clientOptions, 'access', _287 => _287.polyfills, 'optionalAccess', _288 => _288.WebSocket])
11508
12164
  ),
11509
12165
  authenticate: async () => {
11510
12166
  const resp = await authManager.getAuthValue({
@@ -11574,7 +12230,7 @@ function createClient(options) {
11574
12230
  createSocket: makeCreateSocketDelegateForRoom(
11575
12231
  roomId,
11576
12232
  baseUrl,
11577
- _optionalChain([clientOptions, 'access', _284 => _284.polyfills, 'optionalAccess', _285 => _285.WebSocket])
12233
+ _optionalChain([clientOptions, 'access', _289 => _289.polyfills, 'optionalAccess', _290 => _290.WebSocket])
11578
12234
  ),
11579
12235
  authenticate: makeAuthDelegateForRoom(roomId, authManager)
11580
12236
  })),
@@ -11597,7 +12253,7 @@ function createClient(options) {
11597
12253
  const shouldConnect = _nullishCoalesce(options2.autoConnect, () => ( true));
11598
12254
  if (shouldConnect) {
11599
12255
  if (typeof atob === "undefined") {
11600
- if (_optionalChain([clientOptions, 'access', _286 => _286.polyfills, 'optionalAccess', _287 => _287.atob]) === void 0) {
12256
+ if (_optionalChain([clientOptions, 'access', _291 => _291.polyfills, 'optionalAccess', _292 => _292.atob]) === void 0) {
11601
12257
  throw new Error(
11602
12258
  "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"
11603
12259
  );
@@ -11609,7 +12265,7 @@ function createClient(options) {
11609
12265
  return leaseRoom(newRoomDetails);
11610
12266
  }
11611
12267
  function getRoom(roomId) {
11612
- const room = _optionalChain([roomsById, 'access', _288 => _288.get, 'call', _289 => _289(roomId), 'optionalAccess', _290 => _290.room]);
12268
+ const room = _optionalChain([roomsById, 'access', _293 => _293.get, 'call', _294 => _294(roomId), 'optionalAccess', _295 => _295.room]);
11613
12269
  return room ? room : null;
11614
12270
  }
11615
12271
  function logout() {
@@ -11625,7 +12281,7 @@ function createClient(options) {
11625
12281
  const batchedResolveUsers = new Batch(
11626
12282
  async (batchedUserIds) => {
11627
12283
  const userIds = batchedUserIds.flat();
11628
- const users = await _optionalChain([resolveUsers, 'optionalCall', _291 => _291({ userIds })]);
12284
+ const users = await _optionalChain([resolveUsers, 'optionalCall', _296 => _296({ userIds })]);
11629
12285
  warnOnceIf(
11630
12286
  !resolveUsers,
11631
12287
  "Set the resolveUsers option in createClient to specify user info."
@@ -11642,7 +12298,7 @@ function createClient(options) {
11642
12298
  const batchedResolveRoomsInfo = new Batch(
11643
12299
  async (batchedRoomIds) => {
11644
12300
  const roomIds = batchedRoomIds.flat();
11645
- const roomsInfo = await _optionalChain([resolveRoomsInfo, 'optionalCall', _292 => _292({ roomIds })]);
12301
+ const roomsInfo = await _optionalChain([resolveRoomsInfo, 'optionalCall', _297 => _297({ roomIds })]);
11646
12302
  warnOnceIf(
11647
12303
  !resolveRoomsInfo,
11648
12304
  "Set the resolveRoomsInfo option in createClient to specify room info."
@@ -11659,7 +12315,7 @@ function createClient(options) {
11659
12315
  const batchedResolveGroupsInfo = new Batch(
11660
12316
  async (batchedGroupIds) => {
11661
12317
  const groupIds = batchedGroupIds.flat();
11662
- const groupsInfo = await _optionalChain([resolveGroupsInfo, 'optionalCall', _293 => _293({ groupIds })]);
12318
+ const groupsInfo = await _optionalChain([resolveGroupsInfo, 'optionalCall', _298 => _298({ groupIds })]);
11663
12319
  warnOnceIf(
11664
12320
  !resolveGroupsInfo,
11665
12321
  "Set the resolveGroupsInfo option in createClient to specify group info."
@@ -11718,7 +12374,7 @@ function createClient(options) {
11718
12374
  }
11719
12375
  };
11720
12376
  const win = typeof window !== "undefined" ? window : void 0;
11721
- _optionalChain([win, 'optionalAccess', _294 => _294.addEventListener, 'call', _295 => _295("beforeunload", maybePreventClose)]);
12377
+ _optionalChain([win, 'optionalAccess', _299 => _299.addEventListener, 'call', _300 => _300("beforeunload", maybePreventClose)]);
11722
12378
  }
11723
12379
  async function getNotificationSettings(options2) {
11724
12380
  const plainSettings = await httpClient.getNotificationSettings(options2);
@@ -11846,7 +12502,7 @@ var commentBodyElementsTypes = {
11846
12502
  mention: "inline"
11847
12503
  };
11848
12504
  function traverseCommentBody(body, elementOrVisitor, possiblyVisitor) {
11849
- if (!body || !_optionalChain([body, 'optionalAccess', _296 => _296.content])) {
12505
+ if (!body || !_optionalChain([body, 'optionalAccess', _301 => _301.content])) {
11850
12506
  return;
11851
12507
  }
11852
12508
  const element = typeof elementOrVisitor === "string" ? elementOrVisitor : void 0;
@@ -11856,13 +12512,13 @@ function traverseCommentBody(body, elementOrVisitor, possiblyVisitor) {
11856
12512
  for (const block of body.content) {
11857
12513
  if (type === "all" || type === "block") {
11858
12514
  if (guard(block)) {
11859
- _optionalChain([visitor, 'optionalCall', _297 => _297(block)]);
12515
+ _optionalChain([visitor, 'optionalCall', _302 => _302(block)]);
11860
12516
  }
11861
12517
  }
11862
12518
  if (type === "all" || type === "inline") {
11863
12519
  for (const inline of block.children) {
11864
12520
  if (guard(inline)) {
11865
- _optionalChain([visitor, 'optionalCall', _298 => _298(inline)]);
12521
+ _optionalChain([visitor, 'optionalCall', _303 => _303(inline)]);
11866
12522
  }
11867
12523
  }
11868
12524
  }
@@ -12032,7 +12688,7 @@ var stringifyCommentBodyPlainElements = {
12032
12688
  text: ({ element }) => element.text,
12033
12689
  link: ({ element }) => _nullishCoalesce(element.text, () => ( element.url)),
12034
12690
  mention: ({ element, user, group }) => {
12035
- return `@${_nullishCoalesce(_nullishCoalesce(_optionalChain([user, 'optionalAccess', _299 => _299.name]), () => ( _optionalChain([group, 'optionalAccess', _300 => _300.name]))), () => ( element.id))}`;
12691
+ return `@${_nullishCoalesce(_nullishCoalesce(_optionalChain([user, 'optionalAccess', _304 => _304.name]), () => ( _optionalChain([group, 'optionalAccess', _305 => _305.name]))), () => ( element.id))}`;
12036
12692
  }
12037
12693
  };
12038
12694
  var stringifyCommentBodyHtmlElements = {
@@ -12062,7 +12718,7 @@ var stringifyCommentBodyHtmlElements = {
12062
12718
  return html`<a href="${href}" target="_blank" rel="noopener noreferrer">${element.text ? html`${element.text}` : element.url}</a>`;
12063
12719
  },
12064
12720
  mention: ({ element, user, group }) => {
12065
- return html`<span data-mention>@${_optionalChain([user, 'optionalAccess', _301 => _301.name]) ? html`${_optionalChain([user, 'optionalAccess', _302 => _302.name])}` : _optionalChain([group, 'optionalAccess', _303 => _303.name]) ? html`${_optionalChain([group, 'optionalAccess', _304 => _304.name])}` : element.id}</span>`;
12721
+ return html`<span data-mention>@${_optionalChain([user, 'optionalAccess', _306 => _306.name]) ? html`${_optionalChain([user, 'optionalAccess', _307 => _307.name])}` : _optionalChain([group, 'optionalAccess', _308 => _308.name]) ? html`${_optionalChain([group, 'optionalAccess', _309 => _309.name])}` : element.id}</span>`;
12066
12722
  }
12067
12723
  };
12068
12724
  var stringifyCommentBodyMarkdownElements = {
@@ -12092,20 +12748,20 @@ var stringifyCommentBodyMarkdownElements = {
12092
12748
  return markdown`[${_nullishCoalesce(element.text, () => ( element.url))}](${href})`;
12093
12749
  },
12094
12750
  mention: ({ element, user, group }) => {
12095
- return markdown`@${_nullishCoalesce(_nullishCoalesce(_optionalChain([user, 'optionalAccess', _305 => _305.name]), () => ( _optionalChain([group, 'optionalAccess', _306 => _306.name]))), () => ( element.id))}`;
12751
+ return markdown`@${_nullishCoalesce(_nullishCoalesce(_optionalChain([user, 'optionalAccess', _310 => _310.name]), () => ( _optionalChain([group, 'optionalAccess', _311 => _311.name]))), () => ( element.id))}`;
12096
12752
  }
12097
12753
  };
12098
12754
  async function stringifyCommentBody(body, options) {
12099
- const format = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _307 => _307.format]), () => ( "plain"));
12100
- const separator = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _308 => _308.separator]), () => ( (format === "markdown" ? "\n\n" : "\n")));
12755
+ const format = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _312 => _312.format]), () => ( "plain"));
12756
+ const separator = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _313 => _313.separator]), () => ( (format === "markdown" ? "\n\n" : "\n")));
12101
12757
  const elements = {
12102
12758
  ...format === "html" ? stringifyCommentBodyHtmlElements : format === "markdown" ? stringifyCommentBodyMarkdownElements : stringifyCommentBodyPlainElements,
12103
- ..._optionalChain([options, 'optionalAccess', _309 => _309.elements])
12759
+ ..._optionalChain([options, 'optionalAccess', _314 => _314.elements])
12104
12760
  };
12105
12761
  const { users: resolvedUsers, groups: resolvedGroupsInfo } = await resolveMentionsInCommentBody(
12106
12762
  body,
12107
- _optionalChain([options, 'optionalAccess', _310 => _310.resolveUsers]),
12108
- _optionalChain([options, 'optionalAccess', _311 => _311.resolveGroupsInfo])
12763
+ _optionalChain([options, 'optionalAccess', _315 => _315.resolveUsers]),
12764
+ _optionalChain([options, 'optionalAccess', _316 => _316.resolveGroupsInfo])
12109
12765
  );
12110
12766
  const blocks = body.content.flatMap((block, blockIndex) => {
12111
12767
  switch (block.type) {
@@ -12187,6 +12843,12 @@ function toPlainLson(lson) {
12187
12843
  liveblocksType: "LiveList",
12188
12844
  data: [...lson].map((item) => toPlainLson(item))
12189
12845
  };
12846
+ } else if (lson instanceof LiveText) {
12847
+ return {
12848
+ liveblocksType: "LiveText",
12849
+ data: lson.toDelta(),
12850
+ version: lson.version
12851
+ };
12190
12852
  } else {
12191
12853
  return lson;
12192
12854
  }
@@ -12240,9 +12902,9 @@ function makePoller(callback, intervalMs, options) {
12240
12902
  const startTime = performance.now();
12241
12903
  const doc = typeof document !== "undefined" ? document : void 0;
12242
12904
  const win = typeof window !== "undefined" ? window : void 0;
12243
- const maxStaleTimeMs = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _312 => _312.maxStaleTimeMs]), () => ( Number.POSITIVE_INFINITY));
12905
+ const maxStaleTimeMs = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _317 => _317.maxStaleTimeMs]), () => ( Number.POSITIVE_INFINITY));
12244
12906
  const context = {
12245
- inForeground: _optionalChain([doc, 'optionalAccess', _313 => _313.visibilityState]) !== "hidden",
12907
+ inForeground: _optionalChain([doc, 'optionalAccess', _318 => _318.visibilityState]) !== "hidden",
12246
12908
  lastSuccessfulPollAt: startTime,
12247
12909
  count: 0,
12248
12910
  backoff: 0
@@ -12323,11 +12985,11 @@ function makePoller(callback, intervalMs, options) {
12323
12985
  pollNowIfStale();
12324
12986
  }
12325
12987
  function onVisibilityChange() {
12326
- setInForeground(_optionalChain([doc, 'optionalAccess', _314 => _314.visibilityState]) !== "hidden");
12988
+ setInForeground(_optionalChain([doc, 'optionalAccess', _319 => _319.visibilityState]) !== "hidden");
12327
12989
  }
12328
- _optionalChain([doc, 'optionalAccess', _315 => _315.addEventListener, 'call', _316 => _316("visibilitychange", onVisibilityChange)]);
12329
- _optionalChain([win, 'optionalAccess', _317 => _317.addEventListener, 'call', _318 => _318("online", onVisibilityChange)]);
12330
- _optionalChain([win, 'optionalAccess', _319 => _319.addEventListener, 'call', _320 => _320("focus", pollNowIfStale)]);
12990
+ _optionalChain([doc, 'optionalAccess', _320 => _320.addEventListener, 'call', _321 => _321("visibilitychange", onVisibilityChange)]);
12991
+ _optionalChain([win, 'optionalAccess', _322 => _322.addEventListener, 'call', _323 => _323("online", onVisibilityChange)]);
12992
+ _optionalChain([win, 'optionalAccess', _324 => _324.addEventListener, 'call', _325 => _325("focus", pollNowIfStale)]);
12331
12993
  fsm.start();
12332
12994
  return {
12333
12995
  inc,
@@ -12465,5 +13127,7 @@ detectDupes(PKG_NAME, PKG_VERSION, PKG_FORMAT);
12465
13127
 
12466
13128
 
12467
13129
 
12468
- exports.ClientMsgCode = ClientMsgCode; exports.CrdtType = CrdtType; exports.DefaultMap = DefaultMap; exports.Deque = Deque; exports.DerivedSignal = DerivedSignal; exports.FeedRequestErrorCode = FeedRequestErrorCode; exports.HttpError = HttpError; exports.LiveList = LiveList; exports.LiveMap = LiveMap; exports.LiveObject = LiveObject; exports.LiveblocksError = LiveblocksError; exports.MENTION_CHARACTER = MENTION_CHARACTER; exports.MutableSignal = MutableSignal; exports.OpCode = OpCode; exports.Permission = Permission; exports.Promise_withResolvers = Promise_withResolvers; exports.ServerMsgCode = ServerMsgCode; exports.Signal = Signal; exports.SortedList = SortedList; exports.TextEditorType = TextEditorType; exports.WebsocketCloseCodes = WebsocketCloseCodes; exports.asPos = asPos; exports.assert = assert; exports.assertNever = assertNever; exports.autoRetry = autoRetry; exports.b64decode = b64decode; exports.batch = batch; exports.checkBounds = checkBounds; exports.chunk = chunk; exports.cloneLson = cloneLson; exports.compactNodesToNodeStream = compactNodesToNodeStream; exports.compactObject = compactObject; exports.console = fancy_console_exports; exports.convertToCommentData = convertToCommentData; exports.convertToCommentUserReaction = convertToCommentUserReaction; exports.convertToGroupData = convertToGroupData; exports.convertToInboxNotificationData = convertToInboxNotificationData; exports.convertToSubscriptionData = convertToSubscriptionData; exports.convertToThreadData = convertToThreadData; exports.convertToUserSubscriptionData = convertToUserSubscriptionData; exports.createClient = createClient; exports.createCommentAttachmentId = createCommentAttachmentId; exports.createCommentId = createCommentId; exports.createInboxNotificationId = createInboxNotificationId; exports.createManagedPool = createManagedPool; exports.createNotificationSettings = createNotificationSettings; exports.createThreadId = createThreadId; exports.deepLiveify = deepLiveify; exports.defineAiTool = defineAiTool; exports.deprecate = deprecate; exports.deprecateIf = deprecateIf; exports.detectDupes = detectDupes; exports.entries = entries; exports.errorIf = errorIf; exports.findLastIndex = findLastIndex; exports.freeze = freeze; exports.generateUrl = generateUrl; exports.getMentionsFromCommentBody = getMentionsFromCommentBody; exports.getSubscriptionKey = getSubscriptionKey; exports.html = html; exports.htmlSafe = htmlSafe; exports.isCommentBodyLink = isCommentBodyLink; exports.isCommentBodyMention = isCommentBodyMention; exports.isCommentBodyText = isCommentBodyText; exports.isJsonArray = isJsonArray; exports.isJsonObject = isJsonObject; exports.isJsonScalar = isJsonScalar; exports.isListStorageNode = isListStorageNode; exports.isLiveNode = isLiveNode; exports.isMapStorageNode = isMapStorageNode; exports.isNotificationChannelEnabled = isNotificationChannelEnabled; exports.isNumberOperator = isNumberOperator; exports.isObjectStorageNode = isObjectStorageNode; exports.isPlainObject = isPlainObject; exports.isRegisterStorageNode = isRegisterStorageNode; exports.isRootStorageNode = isRootStorageNode; exports.isStartsWithOperator = isStartsWithOperator; exports.isUrl = isUrl; exports.kInternal = kInternal; exports.keys = keys; exports.makeAbortController = makeAbortController; exports.makeEventSource = makeEventSource; exports.makePoller = makePoller; exports.makePosition = makePosition; exports.mapValues = mapValues; exports.memoizeOnSuccess = memoizeOnSuccess; exports.nanoid = nanoid; exports.nn = nn; exports.nodeStreamToCompactNodes = nodeStreamToCompactNodes; exports.objectToQuery = objectToQuery; exports.patchNotificationSettings = patchNotificationSettings; exports.raise = raise; exports.resolveMentionsInCommentBody = resolveMentionsInCommentBody; exports.sanitizeUrl = sanitizeUrl; exports.shallow = shallow; exports.shallow2 = shallow2; exports.stableStringify = stableStringify; exports.stringifyCommentBody = stringifyCommentBody; exports.throwUsageError = throwUsageError; exports.toPlainLson = toPlainLson; exports.tryParseJson = tryParseJson; exports.url = url; exports.urljoin = urljoin; exports.wait = wait; exports.warnOnce = warnOnce; exports.warnOnceIf = warnOnceIf; exports.withTimeout = withTimeout;
13130
+
13131
+
13132
+ exports.ClientMsgCode = ClientMsgCode; exports.CrdtType = CrdtType; exports.DefaultMap = DefaultMap; exports.Deque = Deque; exports.DerivedSignal = DerivedSignal; exports.FeedRequestErrorCode = FeedRequestErrorCode; exports.HttpError = HttpError; exports.LiveList = LiveList; exports.LiveMap = LiveMap; exports.LiveObject = LiveObject; exports.LiveText = LiveText; exports.LiveblocksError = LiveblocksError; exports.MENTION_CHARACTER = MENTION_CHARACTER; exports.MutableSignal = MutableSignal; exports.OpCode = OpCode; exports.Permission = Permission; exports.Promise_withResolvers = Promise_withResolvers; exports.ServerMsgCode = ServerMsgCode; exports.Signal = Signal; exports.SortedList = SortedList; exports.TextEditorType = TextEditorType; exports.WebsocketCloseCodes = WebsocketCloseCodes; exports.applyLiveTextOperations = applyLiveTextOperations; exports.asPos = asPos; exports.assert = assert; exports.assertNever = assertNever; exports.autoRetry = autoRetry; exports.b64decode = b64decode; exports.batch = batch; exports.checkBounds = checkBounds; exports.chunk = chunk; exports.cloneLson = cloneLson; exports.compactNodesToNodeStream = compactNodesToNodeStream; exports.compactObject = compactObject; exports.console = fancy_console_exports; exports.convertToCommentData = convertToCommentData; exports.convertToCommentUserReaction = convertToCommentUserReaction; exports.convertToGroupData = convertToGroupData; exports.convertToInboxNotificationData = convertToInboxNotificationData; exports.convertToSubscriptionData = convertToSubscriptionData; exports.convertToThreadData = convertToThreadData; exports.convertToUserSubscriptionData = convertToUserSubscriptionData; exports.createClient = createClient; exports.createCommentAttachmentId = createCommentAttachmentId; exports.createCommentId = createCommentId; exports.createInboxNotificationId = createInboxNotificationId; exports.createManagedPool = createManagedPool; exports.createNotificationSettings = createNotificationSettings; exports.createThreadId = createThreadId; exports.defineAiTool = defineAiTool; exports.deprecate = deprecate; exports.deprecateIf = deprecateIf; exports.detectDupes = detectDupes; exports.entries = entries; exports.errorIf = errorIf; exports.findLastIndex = findLastIndex; exports.freeze = freeze; exports.generateUrl = generateUrl; exports.getMentionsFromCommentBody = getMentionsFromCommentBody; exports.getSubscriptionKey = getSubscriptionKey; exports.html = html; exports.htmlSafe = htmlSafe; exports.isCommentBodyLink = isCommentBodyLink; exports.isCommentBodyMention = isCommentBodyMention; exports.isCommentBodyText = isCommentBodyText; exports.isJsonArray = isJsonArray; exports.isJsonObject = isJsonObject; exports.isJsonScalar = isJsonScalar; exports.isListStorageNode = isListStorageNode; exports.isLiveNode = isLiveNode; exports.isMapStorageNode = isMapStorageNode; exports.isNotificationChannelEnabled = isNotificationChannelEnabled; exports.isNumberOperator = isNumberOperator; exports.isObjectStorageNode = isObjectStorageNode; exports.isPlainObject = isPlainObject; exports.isRegisterStorageNode = isRegisterStorageNode; exports.isRootStorageNode = isRootStorageNode; exports.isStartsWithOperator = isStartsWithOperator; exports.isTextStorageNode = isTextStorageNode; exports.isUrl = isUrl; exports.kInternal = kInternal; exports.keys = keys; exports.makeAbortController = makeAbortController; exports.makeEventSource = makeEventSource; exports.makePoller = makePoller; exports.makePosition = makePosition; exports.mapValues = mapValues; exports.memoizeOnSuccess = memoizeOnSuccess; exports.nanoid = nanoid; exports.nn = nn; exports.nodeStreamToCompactNodes = nodeStreamToCompactNodes; exports.objectToQuery = objectToQuery; exports.patchNotificationSettings = patchNotificationSettings; exports.raise = raise; exports.resolveMentionsInCommentBody = resolveMentionsInCommentBody; exports.sanitizeUrl = sanitizeUrl; exports.shallow = shallow; exports.shallow2 = shallow2; exports.stableStringify = stableStringify; exports.stringifyCommentBody = stringifyCommentBody; exports.throwUsageError = throwUsageError; exports.toPlainLson = toPlainLson; exports.tryParseJson = tryParseJson; exports.url = url; exports.urljoin = urljoin; exports.wait = wait; exports.warnOnce = warnOnce; exports.warnOnceIf = warnOnceIf; exports.withTimeout = withTimeout;
12469
13133
  //# sourceMappingURL=index.cjs.map