@liveblocks/core 3.11.1 → 3.12.1-enums1

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.11.1";
9
+ var PKG_VERSION = "3.12.1-enums1";
10
10
  var PKG_FORMAT = "cjs";
11
11
 
12
12
  // src/dupe-detection.ts
@@ -3082,27 +3082,32 @@ var FSM = class {
3082
3082
  };
3083
3083
 
3084
3084
  // src/protocol/ServerMsg.ts
3085
- var ServerMsgCode = /* @__PURE__ */ ((ServerMsgCode2) => {
3086
- ServerMsgCode2[ServerMsgCode2["UPDATE_PRESENCE"] = 100] = "UPDATE_PRESENCE";
3087
- ServerMsgCode2[ServerMsgCode2["USER_JOINED"] = 101] = "USER_JOINED";
3088
- ServerMsgCode2[ServerMsgCode2["USER_LEFT"] = 102] = "USER_LEFT";
3089
- ServerMsgCode2[ServerMsgCode2["BROADCASTED_EVENT"] = 103] = "BROADCASTED_EVENT";
3090
- ServerMsgCode2[ServerMsgCode2["ROOM_STATE"] = 104] = "ROOM_STATE";
3091
- ServerMsgCode2[ServerMsgCode2["INITIAL_STORAGE_STATE"] = 200] = "INITIAL_STORAGE_STATE";
3092
- ServerMsgCode2[ServerMsgCode2["UPDATE_STORAGE"] = 201] = "UPDATE_STORAGE";
3093
- ServerMsgCode2[ServerMsgCode2["UPDATE_YDOC"] = 300] = "UPDATE_YDOC";
3094
- ServerMsgCode2[ServerMsgCode2["THREAD_CREATED"] = 400] = "THREAD_CREATED";
3095
- ServerMsgCode2[ServerMsgCode2["THREAD_DELETED"] = 407] = "THREAD_DELETED";
3096
- ServerMsgCode2[ServerMsgCode2["THREAD_METADATA_UPDATED"] = 401] = "THREAD_METADATA_UPDATED";
3097
- ServerMsgCode2[ServerMsgCode2["THREAD_UPDATED"] = 408] = "THREAD_UPDATED";
3098
- ServerMsgCode2[ServerMsgCode2["COMMENT_CREATED"] = 402] = "COMMENT_CREATED";
3099
- ServerMsgCode2[ServerMsgCode2["COMMENT_EDITED"] = 403] = "COMMENT_EDITED";
3100
- ServerMsgCode2[ServerMsgCode2["COMMENT_DELETED"] = 404] = "COMMENT_DELETED";
3101
- ServerMsgCode2[ServerMsgCode2["COMMENT_REACTION_ADDED"] = 405] = "COMMENT_REACTION_ADDED";
3102
- ServerMsgCode2[ServerMsgCode2["COMMENT_REACTION_REMOVED"] = 406] = "COMMENT_REACTION_REMOVED";
3103
- ServerMsgCode2[ServerMsgCode2["REJECT_STORAGE_OP"] = 299] = "REJECT_STORAGE_OP";
3104
- return ServerMsgCode2;
3105
- })(ServerMsgCode || {});
3085
+ var ServerMsgCode = Object.freeze({
3086
+ // For Presence
3087
+ UPDATE_PRESENCE: 100,
3088
+ USER_JOINED: 101,
3089
+ USER_LEFT: 102,
3090
+ BROADCASTED_EVENT: 103,
3091
+ ROOM_STATE: 104,
3092
+ // For Storage
3093
+ INITIAL_STORAGE_STATE: 200,
3094
+ UPDATE_STORAGE: 201,
3095
+ // For Yjs Docs
3096
+ UPDATE_YDOC: 300,
3097
+ // For Comments
3098
+ THREAD_CREATED: 400,
3099
+ THREAD_DELETED: 407,
3100
+ THREAD_METADATA_UPDATED: 401,
3101
+ THREAD_UPDATED: 408,
3102
+ COMMENT_CREATED: 402,
3103
+ COMMENT_EDITED: 403,
3104
+ COMMENT_DELETED: 404,
3105
+ COMMENT_REACTION_ADDED: 405,
3106
+ COMMENT_REACTION_REMOVED: 406,
3107
+ // Error codes
3108
+ REJECT_STORAGE_OP: 299
3109
+ // Sent if a mutation was not allowed on the server (i.e. due to permissions, limit exceeded, etc)
3110
+ });
3106
3111
 
3107
3112
  // src/types/IWebSocket.ts
3108
3113
  var WebsocketCloseCodes = /* @__PURE__ */ ((WebsocketCloseCodes2) => {
@@ -3403,7 +3408,7 @@ function createConnectionStateMachine(delegates, options) {
3403
3408
  }
3404
3409
  function waitForActorId(event) {
3405
3410
  const serverMsg = tryParseJson(event.data);
3406
- if (_optionalChain([serverMsg, 'optionalAccess', _40 => _40.type]) === 104 /* ROOM_STATE */) {
3411
+ if (_optionalChain([serverMsg, 'optionalAccess', _40 => _40.type]) === ServerMsgCode.ROOM_STATE) {
3407
3412
  didReceiveActor();
3408
3413
  }
3409
3414
  }
@@ -5615,6 +5620,171 @@ function isNotificationChannelEnabled(settings) {
5615
5620
  return settings !== null ? values(settings).every((enabled) => enabled === true) : false;
5616
5621
  }
5617
5622
 
5623
+ // src/brand.ts
5624
+ var OFFSET = "12px";
5625
+ var injectBrandBadge = (badgeLocation = "bottom-right") => {
5626
+ if (typeof document === "undefined") {
5627
+ return;
5628
+ }
5629
+ if (document.getElementById("liveblocks-badge")) {
5630
+ return;
5631
+ }
5632
+ const badgeDiv = document.createElement("div");
5633
+ badgeDiv.id = "liveblocks-badge";
5634
+ badgeDiv.style.position = "fixed";
5635
+ badgeDiv.style.opacity = "0";
5636
+ badgeDiv.style.transition = "opacity 300ms";
5637
+ badgeDiv.style.zIndex = "9999";
5638
+ switch (badgeLocation) {
5639
+ case "top-right":
5640
+ badgeDiv.style.top = OFFSET;
5641
+ badgeDiv.style.right = OFFSET;
5642
+ break;
5643
+ case "bottom-right":
5644
+ badgeDiv.style.bottom = OFFSET;
5645
+ badgeDiv.style.right = OFFSET;
5646
+ break;
5647
+ case "bottom-left":
5648
+ badgeDiv.style.bottom = OFFSET;
5649
+ badgeDiv.style.left = OFFSET;
5650
+ break;
5651
+ case "top-left":
5652
+ badgeDiv.style.top = OFFSET;
5653
+ badgeDiv.style.left = OFFSET;
5654
+ break;
5655
+ }
5656
+ badgeDiv.onmouseenter = () => {
5657
+ const hideButton2 = document.getElementById("liveblocks-badge-hide-button");
5658
+ if (hideButton2) {
5659
+ hideButton2.style.opacity = "0.3";
5660
+ }
5661
+ };
5662
+ badgeDiv.onmouseleave = () => {
5663
+ const hideButton2 = document.getElementById("liveblocks-badge-hide-button");
5664
+ if (hideButton2) {
5665
+ hideButton2.style.opacity = "0";
5666
+ }
5667
+ };
5668
+ const link = document.createElement("a");
5669
+ link.href = "https://lblcks.io/badge";
5670
+ link.target = "_blank";
5671
+ link.rel = "noopener noreferrer";
5672
+ link.title = "Liveblocks";
5673
+ const svg = document.createElementNS("http://www.w3.org/2000/svg", "svg");
5674
+ svg.setAttribute("width", "111");
5675
+ svg.setAttribute("height", "38");
5676
+ svg.setAttribute("viewBox", "0 0 111 38");
5677
+ svg.setAttribute("fill", "none");
5678
+ const rect1 = document.createElementNS("http://www.w3.org/2000/svg", "rect");
5679
+ rect1.setAttribute("x", "1");
5680
+ rect1.setAttribute("y", "1");
5681
+ rect1.setAttribute("width", "109");
5682
+ rect1.setAttribute("height", "36");
5683
+ rect1.setAttribute("rx", "8");
5684
+ rect1.setAttribute("fill", "white");
5685
+ svg.appendChild(rect1);
5686
+ const rect2 = document.createElementNS("http://www.w3.org/2000/svg", "rect");
5687
+ rect2.setAttribute("x", "0.5");
5688
+ rect2.setAttribute("y", "0.5");
5689
+ rect2.setAttribute("width", "110");
5690
+ rect2.setAttribute("height", "37");
5691
+ rect2.setAttribute("rx", "8.5");
5692
+ rect2.setAttribute("stroke", "black");
5693
+ rect2.setAttribute("stroke-opacity", "0.1");
5694
+ svg.appendChild(rect2);
5695
+ const path1 = document.createElementNS("http://www.w3.org/2000/svg", "path");
5696
+ path1.setAttribute(
5697
+ "d",
5698
+ "M39.8256 18.0832H38L38.0005 28.9009H39.8256V18.0832ZM43.213 21.1757H41.3879V28.9009H43.213V21.1757ZM43.213 18H41.3879V19.9688H43.213V18ZM45.8916 21.1757H43.9302L46.6915 28.9009H48.7283L51.4896 21.1757H49.5581L48.4039 24.8348C48.3739 24.93 48.2657 25.3024 48.0795 25.9511L47.7099 27.1959C47.4914 26.406 47.2626 25.6189 47.0237 24.8348L45.8916 21.1757ZM58.9659 23.59C58.8147 23.0721 58.5934 22.6317 58.3014 22.2694C57.9743 21.8628 57.5598 21.5482 57.0571 21.3268C56.5589 21.1004 56.0058 20.9877 55.3973 20.9877C54.2407 20.9877 53.3152 21.3495 52.6212 22.0735C52.275 22.4476 52.0103 22.8896 51.844 23.3715C51.6731 23.8691 51.5876 24.4199 51.5876 25.0233C51.5876 26.3157 51.9322 27.3142 52.6217 28.0184C53.3203 28.7323 54.2509 29.0894 55.4125 29.0894C56.4083 29.0894 57.2151 28.8658 57.8342 28.4181C58.453 27.9704 58.8628 27.3068 59.0638 26.4266L57.2834 26.2908C57.198 26.7685 57.0016 27.1257 56.6948 27.3618C56.3879 27.5933 55.9555 27.7093 55.3973 27.7093C54.1201 27.7093 53.4663 26.9899 53.4363 25.5514H59.1844L59.1922 25.295C59.1922 24.6763 59.1165 24.108 58.9659 23.59ZM53.8434 23.0471C54.1654 22.5943 54.6834 22.3679 55.3973 22.3679C55.7443 22.3679 56.0363 22.4155 56.2725 22.5111C56.509 22.6067 56.7128 22.7601 56.8837 22.9713C57.0167 23.1352 57.1189 23.3218 57.1855 23.5221C57.2605 23.731 57.3062 23.9493 57.3213 24.1708H53.451C53.4964 23.7231 53.6271 23.3484 53.8434 23.0471ZM66.2836 21.4779C65.7656 21.1406 65.1673 20.9724 64.4885 20.9724H64.4875C63.995 20.9724 63.5449 21.0727 63.1374 21.2742C62.7364 21.4696 62.3931 21.7659 62.1412 22.1341V18.0832H60.316V28.9009H62.1416V27.8373C62.373 28.2195 62.7008 28.5342 63.0921 28.7499C63.4996 28.9763 63.9497 29.0894 64.4422 29.0894C65.1266 29.0894 65.7324 28.9259 66.2614 28.5992C66.7891 28.2726 67.1989 27.8045 67.4905 27.1959C67.7871 26.5823 67.9359 25.8634 67.9359 25.0386C67.9359 24.2337 67.7895 23.5248 67.4984 22.9113C67.2115 22.2926 66.8066 21.8148 66.2836 21.4779ZM65.5064 27.0828C65.2148 27.5254 64.7172 27.7463 64.0125 27.7463C63.3786 27.7463 62.9013 27.5175 62.5797 27.0601C62.2576 26.6026 62.0968 25.9336 62.0968 25.0534C62.0968 24.2032 62.24 23.5397 62.5265 23.0619C62.8185 22.579 63.3088 22.3378 63.9978 22.3378C64.7019 22.3378 65.2023 22.5592 65.499 23.0013C65.7961 23.4389 65.944 24.1181 65.944 25.0386C65.944 25.9585 65.7985 26.6401 65.5064 27.0828ZM70.901 18.0832H69.0754V28.9009H70.901V18.0832ZM73.8582 28.6066C74.452 28.9286 75.1558 29.0894 75.9708 29.0894C76.7554 29.0894 77.4444 28.9208 78.0377 28.5844C78.6268 28.2569 79.1068 27.7637 79.4183 27.1659C79.745 26.5523 79.9086 25.843 79.9086 25.0386C79.9086 24.2642 79.7478 23.5697 79.4257 22.9565C79.117 22.3516 78.6404 21.8487 78.0529 21.508C77.4592 21.161 76.7652 20.9872 75.9708 20.9872C75.171 20.9872 74.4719 21.161 73.8735 21.508C73.2876 21.8472 72.811 22.3471 72.5002 22.9486C72.1837 23.5572 72.0252 24.254 72.0252 25.0386C72.0252 25.8735 72.181 26.5948 72.4929 27.2033C72.7962 27.798 73.2722 28.2871 73.8582 28.6066ZM77.4869 27.0906C77.18 27.5231 76.6746 27.7393 75.9708 27.7393C75.493 27.7393 75.1082 27.6437 74.8166 27.4524C74.5246 27.2565 74.3134 26.9621 74.1826 26.5699C74.0518 26.1725 73.9867 25.6619 73.9867 25.0381C73.9867 24.1029 74.1401 23.419 74.4469 22.9866C74.7588 22.5541 75.2667 22.3378 75.9708 22.3378C76.6699 22.3378 77.1727 22.5541 77.4795 22.9866C77.7914 23.419 77.9471 24.1029 77.9471 25.0386C77.9471 25.9738 77.7937 26.6576 77.4869 27.0906ZM82.3982 28.6066C82.9869 28.9286 83.6883 29.0894 84.5033 29.0894C85.1369 29.0894 85.7029 28.9791 86.2005 28.7577C86.6989 28.5364 87.1031 28.2272 87.4152 27.8299C87.7279 27.4249 87.9329 26.9471 88.0109 26.4414L86.2534 26.2607C86.1328 26.7431 85.9316 27.1031 85.6497 27.3392C85.3683 27.5757 84.9857 27.694 84.5033 27.694C84.0103 27.694 83.6232 27.5933 83.3413 27.3918C83.0598 27.1858 82.8635 26.8919 82.7531 26.5093C82.6422 26.1221 82.5872 25.6318 82.5872 25.0386C82.5872 24.455 82.6422 23.9722 82.7531 23.59C82.8635 23.2028 83.0571 22.9062 83.3339 22.6997C83.6157 22.4884 84.0053 22.3831 84.5033 22.3831C85.0362 22.3831 85.4312 22.5314 85.6877 22.8281C85.949 23.1196 86.1354 23.5193 86.2456 24.0276L87.9735 23.718C87.8078 22.8932 87.4326 22.232 86.8491 21.7344C86.2708 21.2363 85.489 20.9877 84.5033 20.9877C83.6985 20.9877 83.0021 21.1587 82.4134 21.5006C81.8322 21.8351 81.3625 22.3337 81.0633 22.9339C80.7514 23.5424 80.5952 24.2439 80.5952 25.0386C80.5952 25.8781 80.7486 26.6026 81.0554 27.2112C81.3673 27.8197 81.8151 28.285 82.3982 28.6066ZM90.8104 26.0343L91.6627 25.2192L93.9257 28.9009H96.0308L92.8999 24.0498L95.9328 21.1757H93.5634L90.8104 23.9976V18.0832H88.9845V28.9009H90.8104V26.0343ZM97.6304 28.8103C98.1436 28.9965 98.7142 29.0894 99.3428 29.0894C100.303 29.0894 101.095 28.8981 101.719 28.5165C102.348 28.1339 102.663 27.5101 102.663 26.6451C102.663 26.0818 102.516 25.6392 102.225 25.3176C101.933 24.9905 101.586 24.7566 101.184 24.6157C100.786 24.4702 100.245 24.3219 99.562 24.1707C99.1642 24.0853 98.8502 24.0049 98.6188 23.9295C98.3873 23.8538 98.201 23.7558 98.0604 23.6352C97.925 23.5141 97.8567 23.3584 97.8567 23.1676C97.8567 22.8858 97.9824 22.6723 98.2338 22.5263C98.4853 22.3803 98.7973 22.3073 99.1694 22.3073C99.6619 22.3073 100.047 22.4255 100.324 22.6621C100.605 22.8987 100.756 23.2531 100.776 23.7258L102.466 23.4467C102.385 22.5817 102.046 21.9556 101.447 21.568C100.854 21.1812 100.095 20.9872 99.1694 20.9872C98.6258 20.9872 98.1236 21.0699 97.6607 21.2362C97.2029 21.397 96.8335 21.6511 96.5517 21.9986C96.27 22.3451 96.1294 22.7827 96.1294 23.3109C96.1294 23.7988 96.25 24.1934 96.4911 24.4951C96.7368 24.8001 97.0527 25.0408 97.4118 25.1965C97.7838 25.3578 98.2512 25.5112 98.8147 25.6567L99.2828 25.7699C99.5949 25.844 99.9044 25.9295 100.211 26.0264C100.421 26.092 100.595 26.1826 100.731 26.2981C100.867 26.4136 100.935 26.5647 100.935 26.7509C100.935 27.0776 100.799 27.3294 100.527 27.505C100.261 27.6815 99.8708 27.7693 99.3583 27.7693C98.8347 27.7693 98.4176 27.6385 98.1055 27.377C97.7941 27.1154 97.6355 26.7384 97.6304 26.2454L95.9109 26.4413C95.9302 27.0351 96.094 27.5304 96.4009 27.9278C96.7129 28.3252 97.1223 28.619 97.6304 28.8103Z"
5699
+ );
5700
+ path1.setAttribute("fill", "black");
5701
+ svg.appendChild(path1);
5702
+ const path2 = document.createElementNS("http://www.w3.org/2000/svg", "path");
5703
+ path2.setAttribute(
5704
+ "d",
5705
+ "M37.6392 15V9.18182H39.7131C40.1657 9.18182 40.5407 9.2642 40.8381 9.42898C41.1354 9.59375 41.358 9.81913 41.5057 10.1051C41.6534 10.3892 41.7273 10.7093 41.7273 11.0653C41.7273 11.4233 41.6525 11.7453 41.5028 12.0312C41.3551 12.3153 41.1316 12.5407 40.8324 12.7074C40.535 12.8722 40.161 12.9545 39.7102 12.9545H38.2841V12.2102H39.6307C39.9167 12.2102 40.1487 12.161 40.3267 12.0625C40.5047 11.9621 40.6354 11.8258 40.7188 11.6534C40.8021 11.4811 40.8438 11.285 40.8438 11.0653C40.8438 10.8456 40.8021 10.6506 40.7188 10.4801C40.6354 10.3097 40.5038 10.1761 40.3239 10.0795C40.1458 9.98295 39.911 9.93466 39.6193 9.93466H38.517V15H37.6392ZM44.4716 15.0881C44.0625 15.0881 43.7055 14.9943 43.4006 14.8068C43.0956 14.6193 42.8589 14.357 42.6903 14.0199C42.5218 13.6828 42.4375 13.2888 42.4375 12.8381C42.4375 12.3854 42.5218 11.9896 42.6903 11.6506C42.8589 11.3116 43.0956 11.0483 43.4006 10.8608C43.7055 10.6733 44.0625 10.5795 44.4716 10.5795C44.8807 10.5795 45.2377 10.6733 45.5426 10.8608C45.8475 11.0483 46.0843 11.3116 46.2528 11.6506C46.4214 11.9896 46.5057 12.3854 46.5057 12.8381C46.5057 13.2888 46.4214 13.6828 46.2528 14.0199C46.0843 14.357 45.8475 14.6193 45.5426 14.8068C45.2377 14.9943 44.8807 15.0881 44.4716 15.0881ZM44.4744 14.375C44.7396 14.375 44.9593 14.3049 45.1335 14.1648C45.3078 14.0246 45.4366 13.8381 45.5199 13.6051C45.6051 13.3722 45.6477 13.1155 45.6477 12.8352C45.6477 12.5568 45.6051 12.3011 45.5199 12.0682C45.4366 11.8333 45.3078 11.6449 45.1335 11.5028C44.9593 11.3608 44.7396 11.2898 44.4744 11.2898C44.2074 11.2898 43.9858 11.3608 43.8097 11.5028C43.6354 11.6449 43.5057 11.8333 43.4205 12.0682C43.3371 12.3011 43.2955 12.5568 43.2955 12.8352C43.2955 13.1155 43.3371 13.3722 43.4205 13.6051C43.5057 13.8381 43.6354 14.0246 43.8097 14.1648C43.9858 14.3049 44.2074 14.375 44.4744 14.375ZM48.267 15L46.983 10.6364H47.8608L48.7159 13.8409H48.7585L49.6165 10.6364H50.4943L51.3466 13.8267H51.3892L52.2386 10.6364H53.1165L51.8352 15H50.9688L50.0824 11.8494H50.017L49.1307 15H48.267ZM55.6705 15.0881C55.2405 15.0881 54.8703 14.9962 54.5597 14.8125C54.2509 14.6269 54.0123 14.3665 53.8438 14.0312C53.6771 13.6941 53.5938 13.2992 53.5938 12.8466C53.5938 12.3996 53.6771 12.0057 53.8438 11.6648C54.0123 11.3239 54.2472 11.0578 54.5483 10.8665C54.8513 10.6752 55.2055 10.5795 55.6108 10.5795C55.857 10.5795 56.0956 10.6203 56.3267 10.7017C56.5578 10.7831 56.7652 10.911 56.9489 11.0852C57.1326 11.2595 57.2775 11.4858 57.3835 11.7642C57.4896 12.0407 57.5426 12.3769 57.5426 12.7727V13.0739H54.0739V12.4375H56.7102C56.7102 12.214 56.6648 12.0161 56.5739 11.8438C56.483 11.6695 56.3551 11.5322 56.1903 11.4318C56.0275 11.3314 55.8362 11.2812 55.6165 11.2812C55.3778 11.2812 55.1695 11.34 54.9915 11.4574C54.8153 11.5729 54.679 11.7244 54.5824 11.9119C54.4877 12.0975 54.4403 12.2992 54.4403 12.517V13.0142C54.4403 13.3059 54.4915 13.554 54.5938 13.7585C54.6979 13.9631 54.8428 14.1193 55.0284 14.2273C55.214 14.3333 55.4309 14.3864 55.679 14.3864C55.84 14.3864 55.9867 14.3636 56.1193 14.3182C56.2519 14.2708 56.3665 14.2008 56.4631 14.108C56.5597 14.0152 56.6335 13.9006 56.6847 13.7642L57.4886 13.9091C57.4242 14.1458 57.3087 14.3532 57.142 14.5312C56.9773 14.7074 56.7699 14.8447 56.5199 14.9432C56.2718 15.0398 55.9886 15.0881 55.6705 15.0881ZM58.4851 15V10.6364H59.3061V11.3295H59.3516C59.4311 11.0947 59.5713 10.91 59.772 10.7756C59.9747 10.6392 60.2038 10.571 60.4595 10.571C60.5125 10.571 60.575 10.5729 60.647 10.5767C60.7209 10.5805 60.7786 10.5852 60.8203 10.5909V11.4034C60.7862 11.3939 60.7256 11.3835 60.6385 11.3722C60.5514 11.3589 60.4643 11.3523 60.3771 11.3523C60.1764 11.3523 59.9974 11.3949 59.8402 11.4801C59.6849 11.5634 59.5618 11.6799 59.4709 11.8295C59.38 11.9773 59.3345 12.1458 59.3345 12.3352V15H58.4851ZM63.2798 15.0881C62.8499 15.0881 62.4796 14.9962 62.169 14.8125C61.8603 14.6269 61.6217 14.3665 61.4531 14.0312C61.2865 13.6941 61.2031 13.2992 61.2031 12.8466C61.2031 12.3996 61.2865 12.0057 61.4531 11.6648C61.6217 11.3239 61.8565 11.0578 62.1577 10.8665C62.4607 10.6752 62.8149 10.5795 63.2202 10.5795C63.4664 10.5795 63.705 10.6203 63.9361 10.7017C64.1671 10.7831 64.3745 10.911 64.5582 11.0852C64.742 11.2595 64.8868 11.4858 64.9929 11.7642C65.099 12.0407 65.152 12.3769 65.152 12.7727V13.0739H61.6832V12.4375H64.3196C64.3196 12.214 64.2741 12.0161 64.1832 11.8438C64.0923 11.6695 63.9645 11.5322 63.7997 11.4318C63.6368 11.3314 63.4455 11.2812 63.2259 11.2812C62.9872 11.2812 62.7789 11.34 62.6009 11.4574C62.4247 11.5729 62.2884 11.7244 62.1918 11.9119C62.0971 12.0975 62.0497 12.2992 62.0497 12.517V13.0142C62.0497 13.3059 62.1009 13.554 62.2031 13.7585C62.3073 13.9631 62.4522 14.1193 62.6378 14.2273C62.8234 14.3333 63.0402 14.3864 63.2884 14.3864C63.4493 14.3864 63.5961 14.3636 63.7287 14.3182C63.8613 14.2708 63.9759 14.2008 64.0724 14.108C64.169 14.0152 64.2429 13.9006 64.294 13.7642L65.098 13.9091C65.0336 14.1458 64.9181 14.3532 64.7514 14.5312C64.5866 14.7074 64.3793 14.8447 64.1293 14.9432C63.8812 15.0398 63.598 15.0881 63.2798 15.0881ZM67.728 15.0852C67.3757 15.0852 67.0613 14.9953 66.7848 14.8153C66.5102 14.6335 66.2943 14.375 66.1371 14.0398C65.9818 13.7027 65.9041 13.2983 65.9041 12.8267C65.9041 12.3551 65.9827 11.9517 66.1399 11.6165C66.299 11.2812 66.5168 11.0246 66.7933 10.8466C67.0698 10.6686 67.3833 10.5795 67.7337 10.5795C68.0045 10.5795 68.2223 10.625 68.3871 10.7159C68.5537 10.8049 68.6825 10.9091 68.7734 11.0284C68.8662 11.1477 68.9382 11.2528 68.9893 11.3438H69.0405V9.18182H69.8899V15H69.0604V14.321H68.9893C68.9382 14.4138 68.8643 14.5199 68.7678 14.6392C68.6731 14.7585 68.5424 14.8627 68.3757 14.9517C68.209 15.0407 67.9931 15.0852 67.728 15.0852ZM67.9155 14.3608C68.1598 14.3608 68.3662 14.2964 68.5348 14.1676C68.7053 14.0369 68.834 13.8561 68.9212 13.625C69.0102 13.3939 69.0547 13.125 69.0547 12.8182C69.0547 12.5152 69.0111 12.25 68.924 12.0227C68.8369 11.7955 68.709 11.6184 68.5405 11.4915C68.3719 11.3646 68.1636 11.3011 67.9155 11.3011C67.6598 11.3011 67.4467 11.3674 67.2763 11.5C67.1058 11.6326 66.977 11.8134 66.8899 12.0426C66.8047 12.2718 66.7621 12.5303 66.7621 12.8182C66.7621 13.1098 66.8056 13.3722 66.8928 13.6051C66.9799 13.8381 67.1087 14.0227 67.2791 14.1591C67.4515 14.2936 67.6636 14.3608 67.9155 14.3608ZM73.2876 15V9.18182H74.1371V11.3438H74.1882C74.2375 11.2528 74.3085 11.1477 74.4013 11.0284C74.4941 10.9091 74.6229 10.8049 74.7876 10.7159C74.9524 10.625 75.1702 10.5795 75.4411 10.5795C75.7933 10.5795 76.1077 10.6686 76.3842 10.8466C76.6607 11.0246 76.8776 11.2812 77.0348 11.6165C77.1939 11.9517 77.2734 12.3551 77.2734 12.8267C77.2734 13.2983 77.1948 13.7027 77.0376 14.0398C76.8804 14.375 76.6645 14.6335 76.3899 14.8153C76.1153 14.9953 75.8018 15.0852 75.4496 15.0852C75.1844 15.0852 74.9676 15.0407 74.799 14.9517C74.6323 14.8627 74.5017 14.7585 74.407 14.6392C74.3123 14.5199 74.2393 14.4138 74.1882 14.321H74.1172V15H73.2876ZM74.12 12.8182C74.12 13.125 74.1645 13.3939 74.2536 13.625C74.3426 13.8561 74.4714 14.0369 74.6399 14.1676C74.8085 14.2964 75.0149 14.3608 75.2592 14.3608C75.513 14.3608 75.7251 14.2936 75.8956 14.1591C76.0661 14.0227 76.1948 13.8381 76.282 13.6051C76.371 13.3722 76.4155 13.1098 76.4155 12.8182C76.4155 12.5303 76.3719 12.2718 76.2848 12.0426C76.1996 11.8134 76.0708 11.6326 75.8984 11.5C75.728 11.3674 75.5149 11.3011 75.2592 11.3011C75.013 11.3011 74.8047 11.3646 74.6342 11.4915C74.4657 11.6184 74.3378 11.7955 74.2507 12.0227C74.1636 12.25 74.12 12.5152 74.12 12.8182ZM78.6158 16.6364C78.4889 16.6364 78.3733 16.6259 78.2692 16.6051C78.165 16.5862 78.0874 16.5653 78.0362 16.5426L78.2408 15.8466C78.3961 15.8883 78.5343 15.9063 78.6555 15.9006C78.7768 15.8949 78.8838 15.8494 78.9766 15.7642C79.0713 15.679 79.1546 15.5398 79.2266 15.3466L79.3317 15.0568L77.7351 10.6364H78.6442L79.7493 14.0227H79.7947L80.8999 10.6364H81.8118L80.0135 15.5824C79.9302 15.8097 79.8241 16.0019 79.6953 16.1591C79.5665 16.3182 79.4131 16.4375 79.2351 16.517C79.0571 16.5966 78.8506 16.6364 78.6158 16.6364Z"
5706
+ );
5707
+ path2.setAttribute("fill", "black");
5708
+ path2.setAttribute("fill-opacity", "0.5");
5709
+ svg.appendChild(path2);
5710
+ const rect3 = document.createElementNS("http://www.w3.org/2000/svg", "rect");
5711
+ rect3.setAttribute("x", "7");
5712
+ rect3.setAttribute("y", "7");
5713
+ rect3.setAttribute("width", "24");
5714
+ rect3.setAttribute("height", "24");
5715
+ rect3.setAttribute("rx", "3");
5716
+ rect3.setAttribute("fill", "black");
5717
+ svg.appendChild(rect3);
5718
+ const path3 = document.createElementNS("http://www.w3.org/2000/svg", "path");
5719
+ path3.setAttribute("fill-rule", "evenodd");
5720
+ path3.setAttribute("clip-rule", "evenodd");
5721
+ path3.setAttribute(
5722
+ "d",
5723
+ "M22.0455 15H12.2273L15.1364 17.9091V21.9091L22.0455 15Z"
5724
+ );
5725
+ path3.setAttribute("fill", "white");
5726
+ svg.appendChild(path3);
5727
+ const path4 = document.createElementNS("http://www.w3.org/2000/svg", "path");
5728
+ path4.setAttribute("fill-rule", "evenodd");
5729
+ path4.setAttribute("clip-rule", "evenodd");
5730
+ path4.setAttribute(
5731
+ "d",
5732
+ "M16.9546 22.9999H26.7728L23.8637 20.0908V16.0908L16.9546 22.9999Z"
5733
+ );
5734
+ path4.setAttribute("fill", "white");
5735
+ svg.appendChild(path4);
5736
+ link.appendChild(svg);
5737
+ badgeDiv.appendChild(link);
5738
+ const hideButton = document.createElement("button");
5739
+ hideButton.id = "liveblocks-badge-hide-button";
5740
+ hideButton.style.position = "absolute";
5741
+ hideButton.style.top = "0";
5742
+ hideButton.style.right = "0";
5743
+ hideButton.style.border = "none";
5744
+ hideButton.style.padding = "0";
5745
+ hideButton.style.margin = "0";
5746
+ hideButton.style.background = "none";
5747
+ hideButton.style.font = "inherit";
5748
+ hideButton.style.cursor = "pointer";
5749
+ hideButton.style.outline = "none";
5750
+ hideButton.style.setProperty("-webkit-appearance", "none");
5751
+ hideButton.style.setProperty("-moz-appearance", "none");
5752
+ hideButton.style.setProperty("appearance", "none");
5753
+ hideButton.style.opacity = "0";
5754
+ hideButton.onclick = () => {
5755
+ const badge2 = document.getElementById("liveblocks-badge");
5756
+ if (badge2) {
5757
+ badge2.style.display = "none";
5758
+ }
5759
+ };
5760
+ hideButton.onmouseenter = () => {
5761
+ hideButton.style.opacity = "0.5";
5762
+ };
5763
+ hideButton.onmouseleave = () => {
5764
+ hideButton.style.opacity = "0.3";
5765
+ };
5766
+ const hideSvg = document.createElementNS("http://www.w3.org/2000/svg", "svg");
5767
+ hideSvg.setAttribute("width", "18");
5768
+ hideSvg.setAttribute("height", "18");
5769
+ hideSvg.setAttribute("viewBox", "0 0 18 18");
5770
+ hideSvg.setAttribute("fill", "none");
5771
+ const hidePath = document.createElementNS(
5772
+ "http://www.w3.org/2000/svg",
5773
+ "path"
5774
+ );
5775
+ hidePath.setAttribute("d", "M6 6L9 9M12 12L9 9M9 9L12 6M9 9L6 12");
5776
+ hidePath.setAttribute("stroke", "black");
5777
+ hideSvg.appendChild(hidePath);
5778
+ hideButton.appendChild(hideSvg);
5779
+ badgeDiv.appendChild(hideButton);
5780
+ document.body.appendChild(badgeDiv);
5781
+ requestAnimationFrame(() => {
5782
+ requestAnimationFrame(() => {
5783
+ badgeDiv.style.opacity = "1";
5784
+ });
5785
+ });
5786
+ };
5787
+
5618
5788
  // src/lib/position.ts
5619
5789
  var MIN_CODE = 32;
5620
5790
  var MAX_CODE = 126;
@@ -5743,28 +5913,27 @@ function asPos(str) {
5743
5913
  }
5744
5914
 
5745
5915
  // src/protocol/Op.ts
5746
- var OpCode = /* @__PURE__ */ ((OpCode2) => {
5747
- OpCode2[OpCode2["INIT"] = 0] = "INIT";
5748
- OpCode2[OpCode2["SET_PARENT_KEY"] = 1] = "SET_PARENT_KEY";
5749
- OpCode2[OpCode2["CREATE_LIST"] = 2] = "CREATE_LIST";
5750
- OpCode2[OpCode2["UPDATE_OBJECT"] = 3] = "UPDATE_OBJECT";
5751
- OpCode2[OpCode2["CREATE_OBJECT"] = 4] = "CREATE_OBJECT";
5752
- OpCode2[OpCode2["DELETE_CRDT"] = 5] = "DELETE_CRDT";
5753
- OpCode2[OpCode2["DELETE_OBJECT_KEY"] = 6] = "DELETE_OBJECT_KEY";
5754
- OpCode2[OpCode2["CREATE_MAP"] = 7] = "CREATE_MAP";
5755
- OpCode2[OpCode2["CREATE_REGISTER"] = 8] = "CREATE_REGISTER";
5756
- return OpCode2;
5757
- })(OpCode || {});
5916
+ var OpCode = Object.freeze({
5917
+ INIT: 0,
5918
+ SET_PARENT_KEY: 1,
5919
+ CREATE_LIST: 2,
5920
+ UPDATE_OBJECT: 3,
5921
+ CREATE_OBJECT: 4,
5922
+ DELETE_CRDT: 5,
5923
+ DELETE_OBJECT_KEY: 6,
5924
+ CREATE_MAP: 7,
5925
+ CREATE_REGISTER: 8
5926
+ });
5758
5927
  function ackOp(opId) {
5759
5928
  return {
5760
- type: 5 /* DELETE_CRDT */,
5929
+ type: OpCode.DELETE_CRDT,
5761
5930
  id: "ACK",
5762
5931
  // (H)ACK
5763
5932
  opId
5764
5933
  };
5765
5934
  }
5766
5935
  function isAckOp(op) {
5767
- return op.type === 5 /* DELETE_CRDT */ && op.id === "ACK";
5936
+ return op.type === OpCode.DELETE_CRDT && op.id === "ACK";
5768
5937
  }
5769
5938
 
5770
5939
  // src/crdts/AbstractCrdt.ts
@@ -5869,7 +6038,7 @@ var AbstractCrdt = class {
5869
6038
  /** @internal */
5870
6039
  _apply(op, _isLocal) {
5871
6040
  switch (op.type) {
5872
- case 5 /* DELETE_CRDT */: {
6041
+ case OpCode.DELETE_CRDT: {
5873
6042
  if (this.parent.type === "HasParent") {
5874
6043
  return this.parent.node._detachChild(crdtAsLiveNode(this));
5875
6044
  }
@@ -5973,13 +6142,12 @@ var AbstractCrdt = class {
5973
6142
  };
5974
6143
 
5975
6144
  // src/protocol/SerializedCrdt.ts
5976
- var CrdtType = /* @__PURE__ */ ((CrdtType2) => {
5977
- CrdtType2[CrdtType2["OBJECT"] = 0] = "OBJECT";
5978
- CrdtType2[CrdtType2["LIST"] = 1] = "LIST";
5979
- CrdtType2[CrdtType2["MAP"] = 2] = "MAP";
5980
- CrdtType2[CrdtType2["REGISTER"] = 3] = "REGISTER";
5981
- return CrdtType2;
5982
- })(CrdtType || {});
6145
+ var CrdtType = Object.freeze({
6146
+ OBJECT: 0,
6147
+ LIST: 1,
6148
+ MAP: 2,
6149
+ REGISTER: 3
6150
+ });
5983
6151
 
5984
6152
  // src/crdts/LiveRegister.ts
5985
6153
  var LiveRegister = class _LiveRegister extends AbstractCrdt {
@@ -6006,7 +6174,7 @@ var LiveRegister = class _LiveRegister extends AbstractCrdt {
6006
6174
  }
6007
6175
  return [
6008
6176
  {
6009
- type: 8 /* CREATE_REGISTER */,
6177
+ type: OpCode.CREATE_REGISTER,
6010
6178
  opId: _optionalChain([pool, 'optionalAccess', _115 => _115.generateOpId, 'call', _116 => _116()]),
6011
6179
  id: this._id,
6012
6180
  parentId,
@@ -6021,7 +6189,7 @@ var LiveRegister = class _LiveRegister extends AbstractCrdt {
6021
6189
  throw new Error("Cannot serialize LiveRegister if parent is missing");
6022
6190
  }
6023
6191
  return {
6024
- type: 3 /* REGISTER */,
6192
+ type: CrdtType.REGISTER,
6025
6193
  parentId: nn(this.parent.node._id, "Parent node expected to have ID"),
6026
6194
  parentKey: this.parent.key,
6027
6195
  data: this.data
@@ -6114,7 +6282,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
6114
6282
  const op = {
6115
6283
  id: this._id,
6116
6284
  opId: _optionalChain([pool, 'optionalAccess', _117 => _117.generateOpId, 'call', _118 => _118()]),
6117
- type: 2 /* CREATE_LIST */,
6285
+ type: OpCode.CREATE_LIST,
6118
6286
  parentId,
6119
6287
  parentKey
6120
6288
  };
@@ -6401,7 +6569,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
6401
6569
  const newIndex = this._indexOfPosition(newKey);
6402
6570
  return {
6403
6571
  modified: makeUpdate(this, [insertDelta(newIndex, child)]),
6404
- reverse: [{ type: 5 /* DELETE_CRDT */, id }]
6572
+ reverse: [{ type: OpCode.DELETE_CRDT, id }]
6405
6573
  };
6406
6574
  }
6407
6575
  #applySetUndoRedo(op) {
@@ -6439,7 +6607,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
6439
6607
  this.#detachItemAssociatedToSetOperation(op.deletedId);
6440
6608
  const newIndex = this._indexOfPosition(newKey);
6441
6609
  return {
6442
- reverse: [{ type: 5 /* DELETE_CRDT */, id }],
6610
+ reverse: [{ type: OpCode.DELETE_CRDT, id }],
6443
6611
  modified: makeUpdate(this, [insertDelta(newIndex, child)])
6444
6612
  };
6445
6613
  }
@@ -6615,7 +6783,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
6615
6783
  modified: makeUpdate(this, [moveDelta(previousIndex, newIndex, child)]),
6616
6784
  reverse: [
6617
6785
  {
6618
- type: 1 /* SET_PARENT_KEY */,
6786
+ type: OpCode.SET_PARENT_KEY,
6619
6787
  id: nn(child._id),
6620
6788
  parentKey: previousKey
6621
6789
  }
@@ -6642,7 +6810,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
6642
6810
  throw new Error("Cannot serialize LiveList if parent is missing");
6643
6811
  }
6644
6812
  return {
6645
- type: 1 /* LIST */,
6813
+ type: CrdtType.LIST,
6646
6814
  parentId: nn(this.parent.node._id, "Parent node expected to have ID"),
6647
6815
  parentKey: this.parent.key
6648
6816
  };
@@ -6684,7 +6852,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
6684
6852
  value._attach(id, this._pool);
6685
6853
  this._pool.dispatch(
6686
6854
  value._toOps(this._id, position, this._pool),
6687
- [{ type: 5 /* DELETE_CRDT */, id }],
6855
+ [{ type: OpCode.DELETE_CRDT, id }],
6688
6856
  /* @__PURE__ */ new Map([
6689
6857
  [this._id, makeUpdate(this, [insertDelta(index, value)])]
6690
6858
  ])
@@ -6733,7 +6901,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
6733
6901
  this._pool.dispatch(
6734
6902
  [
6735
6903
  {
6736
- type: 1 /* SET_PARENT_KEY */,
6904
+ type: OpCode.SET_PARENT_KEY,
6737
6905
  id: nn(item._id),
6738
6906
  opId: this._pool.generateOpId(),
6739
6907
  parentKey: position
@@ -6741,7 +6909,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
6741
6909
  ],
6742
6910
  [
6743
6911
  {
6744
- type: 1 /* SET_PARENT_KEY */,
6912
+ type: OpCode.SET_PARENT_KEY,
6745
6913
  id: nn(item._id),
6746
6914
  parentKey: previousPosition
6747
6915
  }
@@ -6778,7 +6946,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
6778
6946
  {
6779
6947
  id: childRecordId,
6780
6948
  opId: this._pool.generateOpId(),
6781
- type: 5 /* DELETE_CRDT */
6949
+ type: OpCode.DELETE_CRDT
6782
6950
  }
6783
6951
  ],
6784
6952
  item._toOps(nn(this._id), item._getParentKeyOrThrow()),
@@ -6798,7 +6966,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
6798
6966
  const childId = item._id;
6799
6967
  if (childId) {
6800
6968
  ops.push({
6801
- type: 5 /* DELETE_CRDT */,
6969
+ type: OpCode.DELETE_CRDT,
6802
6970
  id: childId,
6803
6971
  opId: this._pool.generateOpId()
6804
6972
  });
@@ -7094,7 +7262,7 @@ var LiveMap = class _LiveMap extends AbstractCrdt {
7094
7262
  const op = {
7095
7263
  id: this._id,
7096
7264
  opId: _optionalChain([pool, 'optionalAccess', _164 => _164.generateOpId, 'call', _165 => _165()]),
7097
- type: 7 /* CREATE_MAP */,
7265
+ type: OpCode.CREATE_MAP,
7098
7266
  parentId,
7099
7267
  parentKey
7100
7268
  };
@@ -7158,7 +7326,7 @@ var LiveMap = class _LiveMap extends AbstractCrdt {
7158
7326
  reverse = previousValue._toOps(thisId, key);
7159
7327
  previousValue._detach();
7160
7328
  } else {
7161
- reverse = [{ type: 5 /* DELETE_CRDT */, id }];
7329
+ reverse = [{ type: OpCode.DELETE_CRDT, id }];
7162
7330
  }
7163
7331
  child._setParentLink(this, key);
7164
7332
  child._attach(id, this._pool);
@@ -7210,7 +7378,7 @@ var LiveMap = class _LiveMap extends AbstractCrdt {
7210
7378
  throw new Error("Cannot serialize LiveMap if parent is missing");
7211
7379
  }
7212
7380
  return {
7213
- type: 2 /* MAP */,
7381
+ type: CrdtType.MAP,
7214
7382
  parentId: nn(this.parent.node._id, "Parent node expected to have ID"),
7215
7383
  parentKey: this.parent.key
7216
7384
  };
@@ -7255,7 +7423,7 @@ var LiveMap = class _LiveMap extends AbstractCrdt {
7255
7423
  this.#unacknowledgedSet.set(key, nn(ops[0].opId));
7256
7424
  this._pool.dispatch(
7257
7425
  item._toOps(this._id, key, this._pool),
7258
- oldValue ? oldValue._toOps(this._id, key) : [{ type: 5 /* DELETE_CRDT */, id }],
7426
+ oldValue ? oldValue._toOps(this._id, key) : [{ type: OpCode.DELETE_CRDT, id }],
7259
7427
  storageUpdates
7260
7428
  );
7261
7429
  }
@@ -7303,7 +7471,7 @@ var LiveMap = class _LiveMap extends AbstractCrdt {
7303
7471
  this._pool.dispatch(
7304
7472
  [
7305
7473
  {
7306
- type: 5 /* DELETE_CRDT */,
7474
+ type: OpCode.DELETE_CRDT,
7307
7475
  id: item._id,
7308
7476
  opId: this._pool.generateOpId()
7309
7477
  }
@@ -7480,7 +7648,7 @@ var LiveObject = (_class2 = class _LiveObject extends AbstractCrdt {
7480
7648
  const opId = _optionalChain([pool, 'optionalAccess', _172 => _172.generateOpId, 'call', _173 => _173()]);
7481
7649
  const ops = [];
7482
7650
  const op = {
7483
- type: 4 /* CREATE_OBJECT */,
7651
+ type: OpCode.CREATE_OBJECT,
7484
7652
  id: this._id,
7485
7653
  opId,
7486
7654
  parentId,
@@ -7557,11 +7725,11 @@ var LiveObject = (_class2 = class _LiveObject extends AbstractCrdt {
7557
7725
  reverse = previousValue._toOps(thisId, key);
7558
7726
  previousValue._detach();
7559
7727
  } else if (previousValue === void 0) {
7560
- reverse = [{ type: 6 /* DELETE_OBJECT_KEY */, id: thisId, key }];
7728
+ reverse = [{ type: OpCode.DELETE_OBJECT_KEY, id: thisId, key }];
7561
7729
  } else {
7562
7730
  reverse = [
7563
7731
  {
7564
- type: 3 /* UPDATE_OBJECT */,
7732
+ type: OpCode.UPDATE_OBJECT,
7565
7733
  id: thisId,
7566
7734
  data: { [key]: previousValue }
7567
7735
  }
@@ -7617,9 +7785,9 @@ var LiveObject = (_class2 = class _LiveObject extends AbstractCrdt {
7617
7785
  }
7618
7786
  /** @internal */
7619
7787
  _apply(op, isLocal) {
7620
- if (op.type === 3 /* UPDATE_OBJECT */) {
7788
+ if (op.type === OpCode.UPDATE_OBJECT) {
7621
7789
  return this.#applyUpdate(op, isLocal);
7622
- } else if (op.type === 6 /* DELETE_OBJECT_KEY */) {
7790
+ } else if (op.type === OpCode.DELETE_OBJECT_KEY) {
7623
7791
  return this.#applyDeleteObjectKey(op, isLocal);
7624
7792
  }
7625
7793
  return super._apply(op, isLocal);
@@ -7634,14 +7802,14 @@ var LiveObject = (_class2 = class _LiveObject extends AbstractCrdt {
7634
7802
  }
7635
7803
  if (this.parent.type === "HasParent" && this.parent.node._id) {
7636
7804
  return {
7637
- type: 0 /* OBJECT */,
7805
+ type: CrdtType.OBJECT,
7638
7806
  parentId: this.parent.node._id,
7639
7807
  parentKey: this.parent.key,
7640
7808
  data
7641
7809
  };
7642
7810
  } else {
7643
7811
  return {
7644
- type: 0 /* OBJECT */,
7812
+ type: CrdtType.OBJECT,
7645
7813
  data
7646
7814
  };
7647
7815
  }
@@ -7651,7 +7819,7 @@ var LiveObject = (_class2 = class _LiveObject extends AbstractCrdt {
7651
7819
  const id = nn(this._id);
7652
7820
  const reverse = [];
7653
7821
  const reverseUpdate = {
7654
- type: 3 /* UPDATE_OBJECT */,
7822
+ type: OpCode.UPDATE_OBJECT,
7655
7823
  id,
7656
7824
  data: {}
7657
7825
  };
@@ -7663,7 +7831,7 @@ var LiveObject = (_class2 = class _LiveObject extends AbstractCrdt {
7663
7831
  } else if (oldValue !== void 0) {
7664
7832
  reverseUpdate.data[key] = oldValue;
7665
7833
  } else if (oldValue === void 0) {
7666
- reverse.push({ type: 6 /* DELETE_OBJECT_KEY */, id, key });
7834
+ reverse.push({ type: OpCode.DELETE_OBJECT_KEY, id, key });
7667
7835
  }
7668
7836
  }
7669
7837
  const updateDelta = {};
@@ -7720,7 +7888,7 @@ var LiveObject = (_class2 = class _LiveObject extends AbstractCrdt {
7720
7888
  } else if (oldValue !== void 0) {
7721
7889
  reverse = [
7722
7890
  {
7723
- type: 3 /* UPDATE_OBJECT */,
7891
+ type: OpCode.UPDATE_OBJECT,
7724
7892
  id,
7725
7893
  data: { [key]: oldValue }
7726
7894
  }
@@ -7787,7 +7955,7 @@ var LiveObject = (_class2 = class _LiveObject extends AbstractCrdt {
7787
7955
  } else {
7788
7956
  reverse = [
7789
7957
  {
7790
- type: 3 /* UPDATE_OBJECT */,
7958
+ type: OpCode.UPDATE_OBJECT,
7791
7959
  data: { [keyAsString]: oldValue },
7792
7960
  id: this._id
7793
7961
  }
@@ -7806,7 +7974,7 @@ var LiveObject = (_class2 = class _LiveObject extends AbstractCrdt {
7806
7974
  this._pool.dispatch(
7807
7975
  [
7808
7976
  {
7809
- type: 6 /* DELETE_OBJECT_KEY */,
7977
+ type: OpCode.DELETE_OBJECT_KEY,
7810
7978
  key: keyAsString,
7811
7979
  id: this._id,
7812
7980
  opId: this._pool.generateOpId()
@@ -7871,7 +8039,7 @@ var LiveObject = (_class2 = class _LiveObject extends AbstractCrdt {
7871
8039
  const updatedProps = {};
7872
8040
  const reverseUpdateOp = {
7873
8041
  id: this._id,
7874
- type: 3 /* UPDATE_OBJECT */,
8042
+ type: OpCode.UPDATE_OBJECT,
7875
8043
  data: {}
7876
8044
  };
7877
8045
  const updateDelta = {};
@@ -7885,7 +8053,7 @@ var LiveObject = (_class2 = class _LiveObject extends AbstractCrdt {
7885
8053
  reverseOps.push(...oldValue._toOps(this._id, key));
7886
8054
  oldValue._detach();
7887
8055
  } else if (oldValue === void 0) {
7888
- reverseOps.push({ type: 6 /* DELETE_OBJECT_KEY */, id: this._id, key });
8056
+ reverseOps.push({ type: OpCode.DELETE_OBJECT_KEY, id: this._id, key });
7889
8057
  } else {
7890
8058
  reverseUpdateOp.data[key] = oldValue;
7891
8059
  }
@@ -7915,7 +8083,7 @@ var LiveObject = (_class2 = class _LiveObject extends AbstractCrdt {
7915
8083
  ops.unshift({
7916
8084
  opId,
7917
8085
  id: this._id,
7918
- type: 3 /* UPDATE_OBJECT */,
8086
+ type: OpCode.UPDATE_OBJECT,
7919
8087
  data: updatedProps
7920
8088
  });
7921
8089
  }
@@ -7972,13 +8140,13 @@ function creationOpToLiveNode(op) {
7972
8140
  }
7973
8141
  function creationOpToLson(op) {
7974
8142
  switch (op.type) {
7975
- case 8 /* CREATE_REGISTER */:
8143
+ case OpCode.CREATE_REGISTER:
7976
8144
  return op.data;
7977
- case 4 /* CREATE_OBJECT */:
8145
+ case OpCode.CREATE_OBJECT:
7978
8146
  return new LiveObject(op.data);
7979
- case 7 /* CREATE_MAP */:
8147
+ case OpCode.CREATE_MAP:
7980
8148
  return new LiveMap();
7981
- case 2 /* CREATE_LIST */:
8149
+ case OpCode.CREATE_LIST:
7982
8150
  return new LiveList([]);
7983
8151
  default:
7984
8152
  return assertNever(op, "Unknown creation Op");
@@ -7995,16 +8163,16 @@ function isSameNodeOrChildOf(node, parent) {
7995
8163
  }
7996
8164
  function deserialize([id, crdt], parentToChildren, pool) {
7997
8165
  switch (crdt.type) {
7998
- case 0 /* OBJECT */: {
8166
+ case CrdtType.OBJECT: {
7999
8167
  return LiveObject._deserialize([id, crdt], parentToChildren, pool);
8000
8168
  }
8001
- case 1 /* LIST */: {
8169
+ case CrdtType.LIST: {
8002
8170
  return LiveList._deserialize([id, crdt], parentToChildren, pool);
8003
8171
  }
8004
- case 2 /* MAP */: {
8172
+ case CrdtType.MAP: {
8005
8173
  return LiveMap._deserialize([id, crdt], parentToChildren, pool);
8006
8174
  }
8007
- case 3 /* REGISTER */: {
8175
+ case CrdtType.REGISTER: {
8008
8176
  return LiveRegister._deserialize([id, crdt], parentToChildren, pool);
8009
8177
  }
8010
8178
  default: {
@@ -8014,16 +8182,16 @@ function deserialize([id, crdt], parentToChildren, pool) {
8014
8182
  }
8015
8183
  function deserializeToLson([id, crdt], parentToChildren, pool) {
8016
8184
  switch (crdt.type) {
8017
- case 0 /* OBJECT */: {
8185
+ case CrdtType.OBJECT: {
8018
8186
  return LiveObject._deserialize([id, crdt], parentToChildren, pool);
8019
8187
  }
8020
- case 1 /* LIST */: {
8188
+ case CrdtType.LIST: {
8021
8189
  return LiveList._deserialize([id, crdt], parentToChildren, pool);
8022
8190
  }
8023
- case 2 /* MAP */: {
8191
+ case CrdtType.MAP: {
8024
8192
  return LiveMap._deserialize([id, crdt], parentToChildren, pool);
8025
8193
  }
8026
- case 3 /* REGISTER */: {
8194
+ case CrdtType.REGISTER: {
8027
8195
  return crdt.data;
8028
8196
  }
8029
8197
  default: {
@@ -8073,7 +8241,7 @@ function getTreesDiffOperations(currentItems, newItems) {
8073
8241
  currentItems.forEach((_, id) => {
8074
8242
  if (!newItems.get(id)) {
8075
8243
  ops.push({
8076
- type: 5 /* DELETE_CRDT */,
8244
+ type: OpCode.DELETE_CRDT,
8077
8245
  id
8078
8246
  });
8079
8247
  }
@@ -8081,10 +8249,10 @@ function getTreesDiffOperations(currentItems, newItems) {
8081
8249
  newItems.forEach((crdt, id) => {
8082
8250
  const currentCrdt = currentItems.get(id);
8083
8251
  if (currentCrdt) {
8084
- if (crdt.type === 0 /* OBJECT */) {
8085
- if (currentCrdt.type !== 0 /* OBJECT */ || stringifyOrLog(crdt.data) !== stringifyOrLog(currentCrdt.data)) {
8252
+ if (crdt.type === CrdtType.OBJECT) {
8253
+ if (currentCrdt.type !== CrdtType.OBJECT || stringifyOrLog(crdt.data) !== stringifyOrLog(currentCrdt.data)) {
8086
8254
  ops.push({
8087
- type: 3 /* UPDATE_OBJECT */,
8255
+ type: OpCode.UPDATE_OBJECT,
8088
8256
  id,
8089
8257
  data: crdt.data
8090
8258
  });
@@ -8092,47 +8260,47 @@ function getTreesDiffOperations(currentItems, newItems) {
8092
8260
  }
8093
8261
  if (crdt.parentKey !== currentCrdt.parentKey) {
8094
8262
  ops.push({
8095
- type: 1 /* SET_PARENT_KEY */,
8263
+ type: OpCode.SET_PARENT_KEY,
8096
8264
  id,
8097
8265
  parentKey: nn(crdt.parentKey, "Parent key must not be missing")
8098
8266
  });
8099
8267
  }
8100
8268
  } else {
8101
8269
  switch (crdt.type) {
8102
- case 3 /* REGISTER */:
8270
+ case CrdtType.REGISTER:
8103
8271
  ops.push({
8104
- type: 8 /* CREATE_REGISTER */,
8272
+ type: OpCode.CREATE_REGISTER,
8105
8273
  id,
8106
8274
  parentId: crdt.parentId,
8107
8275
  parentKey: crdt.parentKey,
8108
8276
  data: crdt.data
8109
8277
  });
8110
8278
  break;
8111
- case 1 /* LIST */:
8279
+ case CrdtType.LIST:
8112
8280
  ops.push({
8113
- type: 2 /* CREATE_LIST */,
8281
+ type: OpCode.CREATE_LIST,
8114
8282
  id,
8115
8283
  parentId: crdt.parentId,
8116
8284
  parentKey: crdt.parentKey
8117
8285
  });
8118
8286
  break;
8119
- case 0 /* OBJECT */:
8287
+ case CrdtType.OBJECT:
8120
8288
  if (crdt.parentId === void 0 || crdt.parentKey === void 0) {
8121
8289
  throw new Error(
8122
8290
  "Internal error. Cannot serialize storage root into an operation"
8123
8291
  );
8124
8292
  }
8125
8293
  ops.push({
8126
- type: 4 /* CREATE_OBJECT */,
8294
+ type: OpCode.CREATE_OBJECT,
8127
8295
  id,
8128
8296
  parentId: crdt.parentId,
8129
8297
  parentKey: crdt.parentKey,
8130
8298
  data: crdt.data
8131
8299
  });
8132
8300
  break;
8133
- case 2 /* MAP */:
8301
+ case CrdtType.MAP:
8134
8302
  ops.push({
8135
- type: 7 /* CREATE_MAP */,
8303
+ type: OpCode.CREATE_MAP,
8136
8304
  id,
8137
8305
  parentId: crdt.parentId,
8138
8306
  parentKey: crdt.parentKey
@@ -8289,15 +8457,17 @@ function isJsonObject(data) {
8289
8457
  }
8290
8458
 
8291
8459
  // src/protocol/ClientMsg.ts
8292
- var ClientMsgCode = /* @__PURE__ */ ((ClientMsgCode2) => {
8293
- ClientMsgCode2[ClientMsgCode2["UPDATE_PRESENCE"] = 100] = "UPDATE_PRESENCE";
8294
- ClientMsgCode2[ClientMsgCode2["BROADCAST_EVENT"] = 103] = "BROADCAST_EVENT";
8295
- ClientMsgCode2[ClientMsgCode2["FETCH_STORAGE"] = 200] = "FETCH_STORAGE";
8296
- ClientMsgCode2[ClientMsgCode2["UPDATE_STORAGE"] = 201] = "UPDATE_STORAGE";
8297
- ClientMsgCode2[ClientMsgCode2["FETCH_YDOC"] = 300] = "FETCH_YDOC";
8298
- ClientMsgCode2[ClientMsgCode2["UPDATE_YDOC"] = 301] = "UPDATE_YDOC";
8299
- return ClientMsgCode2;
8300
- })(ClientMsgCode || {});
8460
+ var ClientMsgCode = Object.freeze({
8461
+ // For Presence
8462
+ UPDATE_PRESENCE: 100,
8463
+ BROADCAST_EVENT: 103,
8464
+ // For Storage
8465
+ FETCH_STORAGE: 200,
8466
+ UPDATE_STORAGE: 201,
8467
+ // For Yjs support
8468
+ FETCH_YDOC: 300,
8469
+ UPDATE_YDOC: 301
8470
+ });
8301
8471
 
8302
8472
  // src/refs/ManagedOthers.ts
8303
8473
  function makeUser(conn, presence) {
@@ -8805,7 +8975,7 @@ function createRoom(options, config) {
8805
8975
  }
8806
8976
  function* chunkMessages(messages) {
8807
8977
  if (messages.length < 2) {
8808
- if (messages[0].type === 201 /* UPDATE_STORAGE */) {
8978
+ if (messages[0].type === ClientMsgCode.UPDATE_STORAGE) {
8809
8979
  yield* chunkOps(messages[0]);
8810
8980
  return;
8811
8981
  } else {
@@ -9045,7 +9215,7 @@ function createRoom(options, config) {
9045
9215
  );
9046
9216
  output.reverse.pushLeft(applyOpResult.reverse);
9047
9217
  }
9048
- if (op.type === 2 /* CREATE_LIST */ || op.type === 7 /* CREATE_MAP */ || op.type === 4 /* CREATE_OBJECT */) {
9218
+ if (op.type === OpCode.CREATE_LIST || op.type === OpCode.CREATE_MAP || op.type === OpCode.CREATE_OBJECT) {
9049
9219
  createdNodeIds.add(nn(op.id));
9050
9220
  }
9051
9221
  }
@@ -9065,16 +9235,16 @@ function createRoom(options, config) {
9065
9235
  return { modified: false };
9066
9236
  }
9067
9237
  switch (op.type) {
9068
- case 6 /* DELETE_OBJECT_KEY */:
9069
- case 3 /* UPDATE_OBJECT */:
9070
- case 5 /* DELETE_CRDT */: {
9238
+ case OpCode.DELETE_OBJECT_KEY:
9239
+ case OpCode.UPDATE_OBJECT:
9240
+ case OpCode.DELETE_CRDT: {
9071
9241
  const node = context.pool.nodes.get(op.id);
9072
9242
  if (node === void 0) {
9073
9243
  return { modified: false };
9074
9244
  }
9075
9245
  return node._apply(op, source === 0 /* UNDOREDO_RECONNECT */);
9076
9246
  }
9077
- case 1 /* SET_PARENT_KEY */: {
9247
+ case OpCode.SET_PARENT_KEY: {
9078
9248
  const node = context.pool.nodes.get(op.id);
9079
9249
  if (node === void 0) {
9080
9250
  return { modified: false };
@@ -9088,10 +9258,10 @@ function createRoom(options, config) {
9088
9258
  }
9089
9259
  return { modified: false };
9090
9260
  }
9091
- case 4 /* CREATE_OBJECT */:
9092
- case 2 /* CREATE_LIST */:
9093
- case 7 /* CREATE_MAP */:
9094
- case 8 /* CREATE_REGISTER */: {
9261
+ case OpCode.CREATE_OBJECT:
9262
+ case OpCode.CREATE_LIST:
9263
+ case OpCode.CREATE_MAP:
9264
+ case OpCode.CREATE_REGISTER: {
9095
9265
  if (op.parentId === void 0) {
9096
9266
  return { modified: false };
9097
9267
  }
@@ -9170,10 +9340,14 @@ function createRoom(options, config) {
9170
9340
  context.dynamicSessionInfoSig.set({
9171
9341
  actor: message.actor,
9172
9342
  nonce: message.nonce,
9173
- scopes: message.scopes
9343
+ scopes: message.scopes,
9344
+ meta: message.meta
9174
9345
  });
9175
9346
  context.idFactory = makeIdFactory(message.actor);
9176
9347
  notifySelfChanged();
9348
+ if (message.meta.showBrand === true) {
9349
+ injectBrandBadge(_nullishCoalesce(config.badgeLocation, () => ( "bottom-right")));
9350
+ }
9177
9351
  for (const connectionId of context.others.connectionIds()) {
9178
9352
  const user = message.users[connectionId];
9179
9353
  if (user === void 0) {
@@ -9209,7 +9383,7 @@ function createRoom(options, config) {
9209
9383
  message.scopes
9210
9384
  );
9211
9385
  context.buffer.messages.push({
9212
- type: 100 /* UPDATE_PRESENCE */,
9386
+ type: ClientMsgCode.UPDATE_PRESENCE,
9213
9387
  data: context.myPresence.get(),
9214
9388
  targetActor: message.actor
9215
9389
  });
@@ -9241,7 +9415,7 @@ function createRoom(options, config) {
9241
9415
  const inOps = Array.from(offlineOps.values());
9242
9416
  const result = applyOps(inOps, true);
9243
9417
  messages.push({
9244
- type: 201 /* UPDATE_STORAGE */,
9418
+ type: ClientMsgCode.UPDATE_STORAGE,
9245
9419
  ops: result.ops
9246
9420
  });
9247
9421
  notify(result.updates);
@@ -9261,21 +9435,21 @@ function createRoom(options, config) {
9261
9435
  };
9262
9436
  for (const message of messages) {
9263
9437
  switch (message.type) {
9264
- case 101 /* USER_JOINED */: {
9438
+ case ServerMsgCode.USER_JOINED: {
9265
9439
  const userJoinedUpdate = onUserJoinedMessage(message);
9266
9440
  if (userJoinedUpdate) {
9267
9441
  updates.others.push(userJoinedUpdate);
9268
9442
  }
9269
9443
  break;
9270
9444
  }
9271
- case 100 /* UPDATE_PRESENCE */: {
9445
+ case ServerMsgCode.UPDATE_PRESENCE: {
9272
9446
  const othersPresenceUpdate = onUpdatePresenceMessage(message);
9273
9447
  if (othersPresenceUpdate) {
9274
9448
  updates.others.push(othersPresenceUpdate);
9275
9449
  }
9276
9450
  break;
9277
9451
  }
9278
- case 103 /* BROADCASTED_EVENT */: {
9452
+ case ServerMsgCode.BROADCASTED_EVENT: {
9279
9453
  const others = context.others.get();
9280
9454
  eventHub.customEvent.notify({
9281
9455
  connectionId: message.actor,
@@ -9284,27 +9458,27 @@ function createRoom(options, config) {
9284
9458
  });
9285
9459
  break;
9286
9460
  }
9287
- case 102 /* USER_LEFT */: {
9461
+ case ServerMsgCode.USER_LEFT: {
9288
9462
  const event2 = onUserLeftMessage(message);
9289
9463
  if (event2) {
9290
9464
  updates.others.push(event2);
9291
9465
  }
9292
9466
  break;
9293
9467
  }
9294
- case 300 /* UPDATE_YDOC */: {
9468
+ case ServerMsgCode.UPDATE_YDOC: {
9295
9469
  eventHub.ydoc.notify(message);
9296
9470
  break;
9297
9471
  }
9298
- case 104 /* ROOM_STATE */: {
9472
+ case ServerMsgCode.ROOM_STATE: {
9299
9473
  updates.others.push(onRoomStateMessage(message));
9300
9474
  break;
9301
9475
  }
9302
- case 200 /* INITIAL_STORAGE_STATE */: {
9476
+ case ServerMsgCode.INITIAL_STORAGE_STATE: {
9303
9477
  processInitialStorage(message);
9304
9478
  break;
9305
9479
  }
9306
9480
  // Write event
9307
- case 201 /* UPDATE_STORAGE */: {
9481
+ case ServerMsgCode.UPDATE_STORAGE: {
9308
9482
  const applyResult = applyOps(message.ops, false);
9309
9483
  for (const [key, value] of applyResult.updates.storageUpdates) {
9310
9484
  updates.storageUpdates.set(
@@ -9318,7 +9492,7 @@ function createRoom(options, config) {
9318
9492
  // longer in sync with the client. Trying to synchronize the client again by
9319
9493
  // rolling back particular Ops may be hard/impossible. It's fine to not try and
9320
9494
  // accept the out-of-sync reality and throw an error.
9321
- case 299 /* REJECT_STORAGE_OP */: {
9495
+ case ServerMsgCode.REJECT_STORAGE_OP: {
9322
9496
  errorWithTitle(
9323
9497
  "Storage mutation rejection error",
9324
9498
  message.reason
@@ -9330,15 +9504,15 @@ function createRoom(options, config) {
9330
9504
  }
9331
9505
  break;
9332
9506
  }
9333
- case 400 /* THREAD_CREATED */:
9334
- case 407 /* THREAD_DELETED */:
9335
- case 401 /* THREAD_METADATA_UPDATED */:
9336
- case 408 /* THREAD_UPDATED */:
9337
- case 405 /* COMMENT_REACTION_ADDED */:
9338
- case 406 /* COMMENT_REACTION_REMOVED */:
9339
- case 402 /* COMMENT_CREATED */:
9340
- case 403 /* COMMENT_EDITED */:
9341
- case 404 /* COMMENT_DELETED */: {
9507
+ case ServerMsgCode.THREAD_CREATED:
9508
+ case ServerMsgCode.THREAD_DELETED:
9509
+ case ServerMsgCode.THREAD_METADATA_UPDATED:
9510
+ case ServerMsgCode.THREAD_UPDATED:
9511
+ case ServerMsgCode.COMMENT_REACTION_ADDED:
9512
+ case ServerMsgCode.COMMENT_REACTION_REMOVED:
9513
+ case ServerMsgCode.COMMENT_CREATED:
9514
+ case ServerMsgCode.COMMENT_EDITED:
9515
+ case ServerMsgCode.COMMENT_DELETED: {
9342
9516
  eventHub.comments.notify(message);
9343
9517
  break;
9344
9518
  }
@@ -9388,14 +9562,14 @@ function createRoom(options, config) {
9388
9562
  if (context.buffer.presenceUpdates) {
9389
9563
  messages.push(
9390
9564
  context.buffer.presenceUpdates.type === "full" ? {
9391
- type: 100 /* UPDATE_PRESENCE */,
9565
+ type: ClientMsgCode.UPDATE_PRESENCE,
9392
9566
  // Populating the `targetActor` field turns this message into
9393
9567
  // a Full Presence™ update message (not a patch), which will get
9394
9568
  // interpreted by other clients as such.
9395
9569
  targetActor: -1,
9396
9570
  data: context.buffer.presenceUpdates.data
9397
9571
  } : {
9398
- type: 100 /* UPDATE_PRESENCE */,
9572
+ type: ClientMsgCode.UPDATE_PRESENCE,
9399
9573
  data: context.buffer.presenceUpdates.data
9400
9574
  }
9401
9575
  );
@@ -9405,7 +9579,7 @@ function createRoom(options, config) {
9405
9579
  }
9406
9580
  if (context.buffer.storageOperations.length > 0) {
9407
9581
  messages.push({
9408
- type: 201 /* UPDATE_STORAGE */,
9582
+ type: ClientMsgCode.UPDATE_STORAGE,
9409
9583
  ops: context.buffer.storageOperations
9410
9584
  });
9411
9585
  }
@@ -9413,7 +9587,7 @@ function createRoom(options, config) {
9413
9587
  }
9414
9588
  function updateYDoc(update, guid, isV2) {
9415
9589
  const clientMsg = {
9416
- type: 301 /* UPDATE_YDOC */,
9590
+ type: ClientMsgCode.UPDATE_YDOC,
9417
9591
  update,
9418
9592
  guid,
9419
9593
  v2: isV2
@@ -9429,7 +9603,7 @@ function createRoom(options, config) {
9429
9603
  return;
9430
9604
  }
9431
9605
  context.buffer.messages.push({
9432
- type: 103 /* BROADCAST_EVENT */,
9606
+ type: ClientMsgCode.BROADCAST_EVENT,
9433
9607
  event
9434
9608
  });
9435
9609
  flushNowOrSoon();
@@ -9454,14 +9628,14 @@ function createRoom(options, config) {
9454
9628
  async function streamStorage() {
9455
9629
  if (!managedSocket.authValue) return;
9456
9630
  const items = await httpClient.streamStorage({ roomId });
9457
- processInitialStorage({ type: 200 /* INITIAL_STORAGE_STATE */, items });
9631
+ processInitialStorage({ type: ServerMsgCode.INITIAL_STORAGE_STATE, items });
9458
9632
  }
9459
9633
  function refreshStorage(options2) {
9460
9634
  const messages = context.buffer.messages;
9461
9635
  if (config.unstable_streamData) {
9462
9636
  void streamStorage();
9463
- } else if (!messages.some((msg) => msg.type === 200 /* FETCH_STORAGE */)) {
9464
- messages.push({ type: 200 /* FETCH_STORAGE */ });
9637
+ } else if (!messages.some((msg) => msg.type === ClientMsgCode.FETCH_STORAGE)) {
9638
+ messages.push({ type: ClientMsgCode.FETCH_STORAGE });
9465
9639
  }
9466
9640
  if (options2.flush) {
9467
9641
  flushNowOrSoon();
@@ -9499,10 +9673,10 @@ function createRoom(options, config) {
9499
9673
  }
9500
9674
  function fetchYDoc(vector, guid, isV2) {
9501
9675
  if (!context.buffer.messages.find((m) => {
9502
- return m.type === 300 /* FETCH_YDOC */ && m.vector === vector && m.guid === guid && m.v2 === isV2;
9676
+ return m.type === ClientMsgCode.FETCH_YDOC && m.vector === vector && m.guid === guid && m.v2 === isV2;
9503
9677
  })) {
9504
9678
  context.buffer.messages.push({
9505
- type: 300 /* FETCH_YDOC */,
9679
+ type: ClientMsgCode.FETCH_YDOC,
9506
9680
  vector,
9507
9681
  guid,
9508
9682
  v2: isV2
@@ -10182,7 +10356,8 @@ function createClient(options) {
10182
10356
  largeMessageStrategy: clientOptions.largeMessageStrategy,
10183
10357
  unstable_streamData: !!clientOptions.unstable_streamData,
10184
10358
  roomHttpClient: httpClient,
10185
- createSyncSource
10359
+ createSyncSource,
10360
+ badgeLocation: _nullishCoalesce(clientOptions.badgeLocation, () => ( "bottom-right"))
10186
10361
  }
10187
10362
  );
10188
10363
  const newRoomDetails = {