write(encoder, offset) {
    const origin = offset > 0 ? createID(this.id.client, this.id.clock + offset - 1) : this.origin;
    const rightOrigin = this.rightOrigin;
    const parentSub = this.parentSub;
    const info = this.content.getRef() & binary.BITS5 | (origin === null ? 0 : binary.BIT8) | ( // origin is defined
    rightOrigin === null ? 0 : binary.BIT7) | ( // right origin is defined
    parentSub === null ? 0 : binary.BIT6); // parentSub is non-null

    encoder.writeInfo(info);

    if (origin !== null) {
      encoder.writeLeftID(origin);
    }

    if (rightOrigin !== null) {
      encoder.writeRightID(rightOrigin);
    }

    if (origin === null && rightOrigin === null) {
      const parent =
      /** @type {AbstractType<any>} */
      this.parent;

      if (parent._item !== undefined) {
        const parentItem = parent._item;

        if (parentItem === null) {
          // parent type on y._map
          // find the correct key
          const ykey = findRootTypeKey(parent);
          encoder.writeParentInfo(true); // write parentYKey

          encoder.writeString(ykey);
        } else {
          encoder.writeParentInfo(false); // write parent id

          encoder.writeLeftID(parentItem.id);
        }
      } else if (parent.constructor === String) {
        // this edge case was added by differential updates
        encoder.writeParentInfo(true); // write parentYKey

        encoder.writeString(parent);
      } else if (parent.constructor === ID) {
        encoder.writeParentInfo(false); // write parent id

        encoder.writeLeftID(parent);
      } else {
        error.unexpectedCase();
      }

      if (parentSub !== null) {
        encoder.writeString(parentSub);
      }
    }

    this.content.write(encoder, offset);
  }
Transform the properties of this type to binary and write it to an
BinaryEncoder.

This is called when this Item is sent to a remote peer.

@param {UpdateEncoderV1 | UpdateEncoderV2} encoder The encoder to write data to.
@param {number} offset