@liveblocks/core 3.4.0 → 3.4.2
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 +103 -92
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +8 -1
- package/dist/index.d.ts +8 -1
- package/dist/index.js +15 -4
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
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.4.
|
|
9
|
+
var PKG_VERSION = "3.4.2";
|
|
10
10
|
var PKG_FORMAT = "cjs";
|
|
11
11
|
|
|
12
12
|
// src/dupe-detection.ts
|
|
@@ -4129,6 +4129,7 @@ function createStore_forChatMessages(toolsStore, setToolResultFn) {
|
|
|
4129
4129
|
_optimistic: true
|
|
4130
4130
|
});
|
|
4131
4131
|
} else {
|
|
4132
|
+
const copilotId = third;
|
|
4132
4133
|
upsert({
|
|
4133
4134
|
id,
|
|
4134
4135
|
chatId,
|
|
@@ -4137,6 +4138,7 @@ function createStore_forChatMessages(toolsStore, setToolResultFn) {
|
|
|
4137
4138
|
createdAt,
|
|
4138
4139
|
status: "generating",
|
|
4139
4140
|
contentSoFar: [],
|
|
4141
|
+
copilotId,
|
|
4140
4142
|
_optimistic: true
|
|
4141
4143
|
});
|
|
4142
4144
|
}
|
|
@@ -4199,8 +4201,9 @@ function createStore_forChatMessages(toolsStore, setToolResultFn) {
|
|
|
4199
4201
|
message.chatId,
|
|
4200
4202
|
message.id,
|
|
4201
4203
|
toolInvocation.invocationId,
|
|
4202
|
-
_nullishCoalesce(result, () => ( { data: {} }))
|
|
4203
|
-
|
|
4204
|
+
_nullishCoalesce(result, () => ( { data: {} })),
|
|
4205
|
+
{ copilotId: message.copilotId }
|
|
4206
|
+
// TODO: Should we pass the other generation options (tools, knowledge) as well?
|
|
4204
4207
|
);
|
|
4205
4208
|
})().catch((err) => {
|
|
4206
4209
|
error2(
|
|
@@ -4348,10 +4351,18 @@ function createStore_forChatMessages(toolsStore, setToolResultFn) {
|
|
|
4348
4351
|
function getChatMessagesForBranch\u03A3(chatId, branch) {
|
|
4349
4352
|
return immutableMessagesByBranch.getOrCreate(chatId).getOrCreate(branch || null);
|
|
4350
4353
|
}
|
|
4354
|
+
function getLastUsedCopilotId(chatId) {
|
|
4355
|
+
const pool = messagePoolByChatId\u03A3.getOrCreate(chatId).get();
|
|
4356
|
+
const latest = pool.sorted.findRight(
|
|
4357
|
+
(m) => m.role === "assistant" && !m.deletedAt
|
|
4358
|
+
);
|
|
4359
|
+
return _optionalChain([latest, 'optionalAccess', _73 => _73.copilotId]);
|
|
4360
|
+
}
|
|
4351
4361
|
return {
|
|
4352
4362
|
// Readers
|
|
4353
4363
|
getMessageById,
|
|
4354
4364
|
getChatMessagesForBranch\u03A3,
|
|
4365
|
+
getLastUsedCopilotId,
|
|
4355
4366
|
// Mutations
|
|
4356
4367
|
createOptimistically,
|
|
4357
4368
|
upsert,
|
|
@@ -4453,7 +4464,6 @@ function createAi(config) {
|
|
|
4453
4464
|
function onDidConnect() {
|
|
4454
4465
|
}
|
|
4455
4466
|
function onDidDisconnect() {
|
|
4456
|
-
warn("onDidDisconnect");
|
|
4457
4467
|
}
|
|
4458
4468
|
function handleServerMessage(event) {
|
|
4459
4469
|
if (typeof event.data !== "string")
|
|
@@ -4470,7 +4480,7 @@ function createAi(config) {
|
|
|
4470
4480
|
if ("event" in msg) {
|
|
4471
4481
|
switch (msg.event) {
|
|
4472
4482
|
case "cmd-failed":
|
|
4473
|
-
_optionalChain([pendingCmd, 'optionalAccess',
|
|
4483
|
+
_optionalChain([pendingCmd, 'optionalAccess', _74 => _74.reject, 'call', _75 => _75(new Error(msg.error))]);
|
|
4474
4484
|
break;
|
|
4475
4485
|
case "delta": {
|
|
4476
4486
|
const { id, delta } = msg;
|
|
@@ -4552,7 +4562,7 @@ function createAi(config) {
|
|
|
4552
4562
|
return assertNever(msg, "Unhandled case");
|
|
4553
4563
|
}
|
|
4554
4564
|
}
|
|
4555
|
-
_optionalChain([pendingCmd, 'optionalAccess',
|
|
4565
|
+
_optionalChain([pendingCmd, 'optionalAccess', _76 => _76.resolve, 'call', _77 => _77(msg)]);
|
|
4556
4566
|
}
|
|
4557
4567
|
managedSocket.events.onMessage.subscribe(handleServerMessage);
|
|
4558
4568
|
managedSocket.events.statusDidChange.subscribe(onStatusDidChange);
|
|
@@ -4637,9 +4647,9 @@ function createAi(config) {
|
|
|
4637
4647
|
invocationId,
|
|
4638
4648
|
result,
|
|
4639
4649
|
generationOptions: {
|
|
4640
|
-
copilotId: _optionalChain([options, 'optionalAccess',
|
|
4641
|
-
stream: _optionalChain([options, 'optionalAccess',
|
|
4642
|
-
timeout: _optionalChain([options, 'optionalAccess',
|
|
4650
|
+
copilotId: _optionalChain([options, 'optionalAccess', _78 => _78.copilotId]),
|
|
4651
|
+
stream: _optionalChain([options, 'optionalAccess', _79 => _79.stream]),
|
|
4652
|
+
timeout: _optionalChain([options, 'optionalAccess', _80 => _80.timeout]),
|
|
4643
4653
|
// Knowledge and tools aren't coming from the options, but retrieved
|
|
4644
4654
|
// from the global context
|
|
4645
4655
|
knowledge: knowledge.length > 0 ? knowledge : void 0,
|
|
@@ -4668,7 +4678,7 @@ function createAi(config) {
|
|
|
4668
4678
|
clearChat: (chatId) => sendClientMsgWithResponse({ cmd: "clear-chat", chatId }),
|
|
4669
4679
|
askUserMessageInChat: async (chatId, userMessage, targetMessageId, options) => {
|
|
4670
4680
|
const globalKnowledge = context.knowledge.get();
|
|
4671
|
-
const requestKnowledge = _optionalChain([options, 'optionalAccess',
|
|
4681
|
+
const requestKnowledge = _optionalChain([options, 'optionalAccess', _81 => _81.knowledge]) || [];
|
|
4672
4682
|
const combinedKnowledge = [...globalKnowledge, ...requestKnowledge];
|
|
4673
4683
|
const tools = context.toolsStore.getToolDescriptions(chatId);
|
|
4674
4684
|
messagesStore.markMine(targetMessageId);
|
|
@@ -4678,9 +4688,9 @@ function createAi(config) {
|
|
|
4678
4688
|
sourceMessage: userMessage,
|
|
4679
4689
|
targetMessageId,
|
|
4680
4690
|
generationOptions: {
|
|
4681
|
-
copilotId: _optionalChain([options, 'optionalAccess',
|
|
4682
|
-
stream: _optionalChain([options, 'optionalAccess',
|
|
4683
|
-
timeout: _optionalChain([options, 'optionalAccess',
|
|
4691
|
+
copilotId: _optionalChain([options, 'optionalAccess', _82 => _82.copilotId]),
|
|
4692
|
+
stream: _optionalChain([options, 'optionalAccess', _83 => _83.stream]),
|
|
4693
|
+
timeout: _optionalChain([options, 'optionalAccess', _84 => _84.timeout]),
|
|
4684
4694
|
// Combine global knowledge with request-specific knowledge
|
|
4685
4695
|
knowledge: combinedKnowledge.length > 0 ? combinedKnowledge : void 0,
|
|
4686
4696
|
tools: tools.length > 0 ? tools : void 0
|
|
@@ -4697,6 +4707,7 @@ function createAi(config) {
|
|
|
4697
4707
|
},
|
|
4698
4708
|
getChatById: context.chatsStore.getChatById,
|
|
4699
4709
|
queryChats: context.chatsStore.findMany,
|
|
4710
|
+
getLastUsedCopilotId: context.messagesStore.getLastUsedCopilotId,
|
|
4700
4711
|
registerKnowledgeLayer,
|
|
4701
4712
|
deregisterKnowledgeLayer,
|
|
4702
4713
|
updateKnowledge,
|
|
@@ -4780,7 +4791,7 @@ function createAuthManager(authOptions, onAuthenticate) {
|
|
|
4780
4791
|
return void 0;
|
|
4781
4792
|
}
|
|
4782
4793
|
async function makeAuthRequest(options) {
|
|
4783
|
-
const fetcher = _nullishCoalesce(_optionalChain([authOptions, 'access',
|
|
4794
|
+
const fetcher = _nullishCoalesce(_optionalChain([authOptions, 'access', _85 => _85.polyfills, 'optionalAccess', _86 => _86.fetch]), () => ( (typeof window === "undefined" ? void 0 : window.fetch)));
|
|
4784
4795
|
if (authentication.type === "private") {
|
|
4785
4796
|
if (fetcher === void 0) {
|
|
4786
4797
|
throw new StopRetrying(
|
|
@@ -4796,7 +4807,7 @@ function createAuthManager(authOptions, onAuthenticate) {
|
|
|
4796
4807
|
"The same Liveblocks auth token was issued from the backend before. Caching Liveblocks tokens is not supported."
|
|
4797
4808
|
);
|
|
4798
4809
|
}
|
|
4799
|
-
_optionalChain([onAuthenticate, 'optionalCall',
|
|
4810
|
+
_optionalChain([onAuthenticate, 'optionalCall', _87 => _87(parsed.parsed)]);
|
|
4800
4811
|
return parsed;
|
|
4801
4812
|
}
|
|
4802
4813
|
if (authentication.type === "custom") {
|
|
@@ -4804,7 +4815,7 @@ function createAuthManager(authOptions, onAuthenticate) {
|
|
|
4804
4815
|
if (response && typeof response === "object") {
|
|
4805
4816
|
if (typeof response.token === "string") {
|
|
4806
4817
|
const parsed = parseAuthToken(response.token);
|
|
4807
|
-
_optionalChain([onAuthenticate, 'optionalCall',
|
|
4818
|
+
_optionalChain([onAuthenticate, 'optionalCall', _88 => _88(parsed.parsed)]);
|
|
4808
4819
|
return parsed;
|
|
4809
4820
|
} else if (typeof response.error === "string") {
|
|
4810
4821
|
const reason = `Authentication failed: ${"reason" in response && typeof response.reason === "string" ? response.reason : "Forbidden"}`;
|
|
@@ -4962,7 +4973,7 @@ function sendToPanel(message, options) {
|
|
|
4962
4973
|
...message,
|
|
4963
4974
|
source: "liveblocks-devtools-client"
|
|
4964
4975
|
};
|
|
4965
|
-
if (!(_optionalChain([options, 'optionalAccess',
|
|
4976
|
+
if (!(_optionalChain([options, 'optionalAccess', _89 => _89.force]) || _bridgeActive)) {
|
|
4966
4977
|
return;
|
|
4967
4978
|
}
|
|
4968
4979
|
window.postMessage(fullMsg, "*");
|
|
@@ -4970,7 +4981,7 @@ function sendToPanel(message, options) {
|
|
|
4970
4981
|
var eventSource = makeEventSource();
|
|
4971
4982
|
if (process.env.NODE_ENV !== "production" && typeof window !== "undefined") {
|
|
4972
4983
|
window.addEventListener("message", (event) => {
|
|
4973
|
-
if (event.source === window && _optionalChain([event, 'access',
|
|
4984
|
+
if (event.source === window && _optionalChain([event, 'access', _90 => _90.data, 'optionalAccess', _91 => _91.source]) === "liveblocks-devtools-panel") {
|
|
4974
4985
|
eventSource.notify(event.data);
|
|
4975
4986
|
} else {
|
|
4976
4987
|
}
|
|
@@ -5112,7 +5123,7 @@ function fullSync(room) {
|
|
|
5112
5123
|
msg: "room::sync::full",
|
|
5113
5124
|
roomId: room.id,
|
|
5114
5125
|
status: room.getStatus(),
|
|
5115
|
-
storage: _nullishCoalesce(_optionalChain([root, 'optionalAccess',
|
|
5126
|
+
storage: _nullishCoalesce(_optionalChain([root, 'optionalAccess', _92 => _92.toTreeNode, 'call', _93 => _93("root"), 'access', _94 => _94.payload]), () => ( null)),
|
|
5116
5127
|
me,
|
|
5117
5128
|
others
|
|
5118
5129
|
});
|
|
@@ -5403,7 +5414,7 @@ function createManagedPool(roomId, options) {
|
|
|
5403
5414
|
generateId: () => `${getCurrentConnectionId()}:${clock++}`,
|
|
5404
5415
|
generateOpId: () => `${getCurrentConnectionId()}:${opClock++}`,
|
|
5405
5416
|
dispatch(ops, reverse, storageUpdates) {
|
|
5406
|
-
_optionalChain([onDispatch, 'optionalCall',
|
|
5417
|
+
_optionalChain([onDispatch, 'optionalCall', _95 => _95(ops, reverse, storageUpdates)]);
|
|
5407
5418
|
},
|
|
5408
5419
|
assertStorageIsWritable: () => {
|
|
5409
5420
|
if (!isStorageWritable()) {
|
|
@@ -5630,7 +5641,7 @@ var LiveRegister = class _LiveRegister extends AbstractCrdt {
|
|
|
5630
5641
|
return [
|
|
5631
5642
|
{
|
|
5632
5643
|
type: 8 /* CREATE_REGISTER */,
|
|
5633
|
-
opId: _optionalChain([pool, 'optionalAccess',
|
|
5644
|
+
opId: _optionalChain([pool, 'optionalAccess', _96 => _96.generateOpId, 'call', _97 => _97()]),
|
|
5634
5645
|
id: this._id,
|
|
5635
5646
|
parentId,
|
|
5636
5647
|
parentKey,
|
|
@@ -5736,7 +5747,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
|
|
|
5736
5747
|
const ops = [];
|
|
5737
5748
|
const op = {
|
|
5738
5749
|
id: this._id,
|
|
5739
|
-
opId: _optionalChain([pool, 'optionalAccess',
|
|
5750
|
+
opId: _optionalChain([pool, 'optionalAccess', _98 => _98.generateOpId, 'call', _99 => _99()]),
|
|
5740
5751
|
type: 2 /* CREATE_LIST */,
|
|
5741
5752
|
parentId,
|
|
5742
5753
|
parentKey
|
|
@@ -6007,7 +6018,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
|
|
|
6007
6018
|
#applyInsertUndoRedo(op) {
|
|
6008
6019
|
const { id, parentKey: key } = op;
|
|
6009
6020
|
const child = creationOpToLiveNode(op);
|
|
6010
|
-
if (_optionalChain([this, 'access',
|
|
6021
|
+
if (_optionalChain([this, 'access', _100 => _100._pool, 'optionalAccess', _101 => _101.getNode, 'call', _102 => _102(id)]) !== void 0) {
|
|
6011
6022
|
return { modified: false };
|
|
6012
6023
|
}
|
|
6013
6024
|
child._attach(id, nn(this._pool));
|
|
@@ -6015,8 +6026,8 @@ var LiveList = class _LiveList extends AbstractCrdt {
|
|
|
6015
6026
|
const existingItemIndex = this._indexOfPosition(key);
|
|
6016
6027
|
let newKey = key;
|
|
6017
6028
|
if (existingItemIndex !== -1) {
|
|
6018
|
-
const before2 = _optionalChain([this, 'access',
|
|
6019
|
-
const after2 = _optionalChain([this, 'access',
|
|
6029
|
+
const before2 = _optionalChain([this, 'access', _103 => _103.#items, 'access', _104 => _104[existingItemIndex], 'optionalAccess', _105 => _105._parentPos]);
|
|
6030
|
+
const after2 = _optionalChain([this, 'access', _106 => _106.#items, 'access', _107 => _107[existingItemIndex + 1], 'optionalAccess', _108 => _108._parentPos]);
|
|
6020
6031
|
newKey = makePosition(before2, after2);
|
|
6021
6032
|
child._setParentLink(this, newKey);
|
|
6022
6033
|
}
|
|
@@ -6030,7 +6041,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
|
|
|
6030
6041
|
#applySetUndoRedo(op) {
|
|
6031
6042
|
const { id, parentKey: key } = op;
|
|
6032
6043
|
const child = creationOpToLiveNode(op);
|
|
6033
|
-
if (_optionalChain([this, 'access',
|
|
6044
|
+
if (_optionalChain([this, 'access', _109 => _109._pool, 'optionalAccess', _110 => _110.getNode, 'call', _111 => _111(id)]) !== void 0) {
|
|
6034
6045
|
return { modified: false };
|
|
6035
6046
|
}
|
|
6036
6047
|
this.#unacknowledgedSets.set(key, nn(op.opId));
|
|
@@ -6151,7 +6162,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
|
|
|
6151
6162
|
} else {
|
|
6152
6163
|
this.#items[existingItemIndex]._setParentLink(
|
|
6153
6164
|
this,
|
|
6154
|
-
makePosition(newKey, _optionalChain([this, 'access',
|
|
6165
|
+
makePosition(newKey, _optionalChain([this, 'access', _112 => _112.#items, 'access', _113 => _113[existingItemIndex + 1], 'optionalAccess', _114 => _114._parentPos]))
|
|
6155
6166
|
);
|
|
6156
6167
|
const previousIndex = this.#items.indexOf(child);
|
|
6157
6168
|
child._setParentLink(this, newKey);
|
|
@@ -6176,7 +6187,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
|
|
|
6176
6187
|
if (existingItemIndex !== -1) {
|
|
6177
6188
|
this.#items[existingItemIndex]._setParentLink(
|
|
6178
6189
|
this,
|
|
6179
|
-
makePosition(newKey, _optionalChain([this, 'access',
|
|
6190
|
+
makePosition(newKey, _optionalChain([this, 'access', _115 => _115.#items, 'access', _116 => _116[existingItemIndex + 1], 'optionalAccess', _117 => _117._parentPos]))
|
|
6180
6191
|
);
|
|
6181
6192
|
}
|
|
6182
6193
|
child._setParentLink(this, newKey);
|
|
@@ -6195,7 +6206,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
|
|
|
6195
6206
|
if (existingItemIndex !== -1) {
|
|
6196
6207
|
this.#items[existingItemIndex]._setParentLink(
|
|
6197
6208
|
this,
|
|
6198
|
-
makePosition(newKey, _optionalChain([this, 'access',
|
|
6209
|
+
makePosition(newKey, _optionalChain([this, 'access', _118 => _118.#items, 'access', _119 => _119[existingItemIndex + 1], 'optionalAccess', _120 => _120._parentPos]))
|
|
6199
6210
|
);
|
|
6200
6211
|
}
|
|
6201
6212
|
child._setParentLink(this, newKey);
|
|
@@ -6222,7 +6233,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
|
|
|
6222
6233
|
if (existingItemIndex !== -1) {
|
|
6223
6234
|
this.#items[existingItemIndex]._setParentLink(
|
|
6224
6235
|
this,
|
|
6225
|
-
makePosition(newKey, _optionalChain([this, 'access',
|
|
6236
|
+
makePosition(newKey, _optionalChain([this, 'access', _121 => _121.#items, 'access', _122 => _122[existingItemIndex + 1], 'optionalAccess', _123 => _123._parentPos]))
|
|
6226
6237
|
);
|
|
6227
6238
|
}
|
|
6228
6239
|
child._setParentLink(this, newKey);
|
|
@@ -6280,7 +6291,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
|
|
|
6280
6291
|
* @param element The element to add to the end of the LiveList.
|
|
6281
6292
|
*/
|
|
6282
6293
|
push(element) {
|
|
6283
|
-
_optionalChain([this, 'access',
|
|
6294
|
+
_optionalChain([this, 'access', _124 => _124._pool, 'optionalAccess', _125 => _125.assertStorageIsWritable, 'call', _126 => _126()]);
|
|
6284
6295
|
return this.insert(element, this.length);
|
|
6285
6296
|
}
|
|
6286
6297
|
/**
|
|
@@ -6289,7 +6300,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
|
|
|
6289
6300
|
* @param index The index at which you want to insert the element.
|
|
6290
6301
|
*/
|
|
6291
6302
|
insert(element, index) {
|
|
6292
|
-
_optionalChain([this, 'access',
|
|
6303
|
+
_optionalChain([this, 'access', _127 => _127._pool, 'optionalAccess', _128 => _128.assertStorageIsWritable, 'call', _129 => _129()]);
|
|
6293
6304
|
if (index < 0 || index > this.#items.length) {
|
|
6294
6305
|
throw new Error(
|
|
6295
6306
|
`Cannot insert list item at index "${index}". index should be between 0 and ${this.#items.length}`
|
|
@@ -6319,7 +6330,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
|
|
|
6319
6330
|
* @param targetIndex The index where the element should be after moving.
|
|
6320
6331
|
*/
|
|
6321
6332
|
move(index, targetIndex) {
|
|
6322
|
-
_optionalChain([this, 'access',
|
|
6333
|
+
_optionalChain([this, 'access', _130 => _130._pool, 'optionalAccess', _131 => _131.assertStorageIsWritable, 'call', _132 => _132()]);
|
|
6323
6334
|
if (targetIndex < 0) {
|
|
6324
6335
|
throw new Error("targetIndex cannot be less than 0");
|
|
6325
6336
|
}
|
|
@@ -6377,7 +6388,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
|
|
|
6377
6388
|
* @param index The index of the element to delete
|
|
6378
6389
|
*/
|
|
6379
6390
|
delete(index) {
|
|
6380
|
-
_optionalChain([this, 'access',
|
|
6391
|
+
_optionalChain([this, 'access', _133 => _133._pool, 'optionalAccess', _134 => _134.assertStorageIsWritable, 'call', _135 => _135()]);
|
|
6381
6392
|
if (index < 0 || index >= this.#items.length) {
|
|
6382
6393
|
throw new Error(
|
|
6383
6394
|
`Cannot delete list item at index "${index}". index should be between 0 and ${this.#items.length - 1}`
|
|
@@ -6410,7 +6421,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
|
|
|
6410
6421
|
}
|
|
6411
6422
|
}
|
|
6412
6423
|
clear() {
|
|
6413
|
-
_optionalChain([this, 'access',
|
|
6424
|
+
_optionalChain([this, 'access', _136 => _136._pool, 'optionalAccess', _137 => _137.assertStorageIsWritable, 'call', _138 => _138()]);
|
|
6414
6425
|
if (this._pool) {
|
|
6415
6426
|
const ops = [];
|
|
6416
6427
|
const reverseOps = [];
|
|
@@ -6444,7 +6455,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
|
|
|
6444
6455
|
}
|
|
6445
6456
|
}
|
|
6446
6457
|
set(index, item) {
|
|
6447
|
-
_optionalChain([this, 'access',
|
|
6458
|
+
_optionalChain([this, 'access', _139 => _139._pool, 'optionalAccess', _140 => _140.assertStorageIsWritable, 'call', _141 => _141()]);
|
|
6448
6459
|
if (index < 0 || index >= this.#items.length) {
|
|
6449
6460
|
throw new Error(
|
|
6450
6461
|
`Cannot set list item at index "${index}". index should be between 0 and ${this.#items.length - 1}`
|
|
@@ -6590,7 +6601,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
|
|
|
6590
6601
|
#shiftItemPosition(index, key) {
|
|
6591
6602
|
const shiftedPosition = makePosition(
|
|
6592
6603
|
key,
|
|
6593
|
-
this.#items.length > index + 1 ? _optionalChain([this, 'access',
|
|
6604
|
+
this.#items.length > index + 1 ? _optionalChain([this, 'access', _142 => _142.#items, 'access', _143 => _143[index + 1], 'optionalAccess', _144 => _144._parentPos]) : void 0
|
|
6594
6605
|
);
|
|
6595
6606
|
this.#items[index]._setParentLink(this, shiftedPosition);
|
|
6596
6607
|
}
|
|
@@ -6715,7 +6726,7 @@ var LiveMap = class _LiveMap extends AbstractCrdt {
|
|
|
6715
6726
|
const ops = [];
|
|
6716
6727
|
const op = {
|
|
6717
6728
|
id: this._id,
|
|
6718
|
-
opId: _optionalChain([pool, 'optionalAccess',
|
|
6729
|
+
opId: _optionalChain([pool, 'optionalAccess', _145 => _145.generateOpId, 'call', _146 => _146()]),
|
|
6719
6730
|
type: 7 /* CREATE_MAP */,
|
|
6720
6731
|
parentId,
|
|
6721
6732
|
parentKey
|
|
@@ -6850,7 +6861,7 @@ var LiveMap = class _LiveMap extends AbstractCrdt {
|
|
|
6850
6861
|
* @param value The value of the element to add. Should be serializable to JSON.
|
|
6851
6862
|
*/
|
|
6852
6863
|
set(key, value) {
|
|
6853
|
-
_optionalChain([this, 'access',
|
|
6864
|
+
_optionalChain([this, 'access', _147 => _147._pool, 'optionalAccess', _148 => _148.assertStorageIsWritable, 'call', _149 => _149()]);
|
|
6854
6865
|
const oldValue = this.#map.get(key);
|
|
6855
6866
|
if (oldValue) {
|
|
6856
6867
|
oldValue._detach();
|
|
@@ -6896,7 +6907,7 @@ var LiveMap = class _LiveMap extends AbstractCrdt {
|
|
|
6896
6907
|
* @returns true if an element existed and has been removed, or false if the element does not exist.
|
|
6897
6908
|
*/
|
|
6898
6909
|
delete(key) {
|
|
6899
|
-
_optionalChain([this, 'access',
|
|
6910
|
+
_optionalChain([this, 'access', _150 => _150._pool, 'optionalAccess', _151 => _151.assertStorageIsWritable, 'call', _152 => _152()]);
|
|
6900
6911
|
const item = this.#map.get(key);
|
|
6901
6912
|
if (item === void 0) {
|
|
6902
6913
|
return false;
|
|
@@ -7086,7 +7097,7 @@ var LiveObject = (_class2 = class _LiveObject extends AbstractCrdt {
|
|
|
7086
7097
|
if (this._id === void 0) {
|
|
7087
7098
|
throw new Error("Cannot serialize item is not attached");
|
|
7088
7099
|
}
|
|
7089
|
-
const opId = _optionalChain([pool, 'optionalAccess',
|
|
7100
|
+
const opId = _optionalChain([pool, 'optionalAccess', _153 => _153.generateOpId, 'call', _154 => _154()]);
|
|
7090
7101
|
const ops = [];
|
|
7091
7102
|
const op = {
|
|
7092
7103
|
type: 4 /* CREATE_OBJECT */,
|
|
@@ -7358,7 +7369,7 @@ var LiveObject = (_class2 = class _LiveObject extends AbstractCrdt {
|
|
|
7358
7369
|
* @param value The value of the property to add
|
|
7359
7370
|
*/
|
|
7360
7371
|
set(key, value) {
|
|
7361
|
-
_optionalChain([this, 'access',
|
|
7372
|
+
_optionalChain([this, 'access', _155 => _155._pool, 'optionalAccess', _156 => _156.assertStorageIsWritable, 'call', _157 => _157()]);
|
|
7362
7373
|
this.update({ [key]: value });
|
|
7363
7374
|
}
|
|
7364
7375
|
/**
|
|
@@ -7373,7 +7384,7 @@ var LiveObject = (_class2 = class _LiveObject extends AbstractCrdt {
|
|
|
7373
7384
|
* @param key The key of the property to delete
|
|
7374
7385
|
*/
|
|
7375
7386
|
delete(key) {
|
|
7376
|
-
_optionalChain([this, 'access',
|
|
7387
|
+
_optionalChain([this, 'access', _158 => _158._pool, 'optionalAccess', _159 => _159.assertStorageIsWritable, 'call', _160 => _160()]);
|
|
7377
7388
|
const keyAsString = key;
|
|
7378
7389
|
const oldValue = this.#map.get(keyAsString);
|
|
7379
7390
|
if (oldValue === void 0) {
|
|
@@ -7426,7 +7437,7 @@ var LiveObject = (_class2 = class _LiveObject extends AbstractCrdt {
|
|
|
7426
7437
|
* @param patch The object used to overrides properties
|
|
7427
7438
|
*/
|
|
7428
7439
|
update(patch) {
|
|
7429
|
-
_optionalChain([this, 'access',
|
|
7440
|
+
_optionalChain([this, 'access', _161 => _161._pool, 'optionalAccess', _162 => _162.assertStorageIsWritable, 'call', _163 => _163()]);
|
|
7430
7441
|
if (_LiveObject.detectLargeObjects) {
|
|
7431
7442
|
const data = {};
|
|
7432
7443
|
for (const [key, value] of this.#map) {
|
|
@@ -8174,15 +8185,15 @@ function installBackgroundTabSpy() {
|
|
|
8174
8185
|
const doc = typeof document !== "undefined" ? document : void 0;
|
|
8175
8186
|
const inBackgroundSince = { current: null };
|
|
8176
8187
|
function onVisibilityChange() {
|
|
8177
|
-
if (_optionalChain([doc, 'optionalAccess',
|
|
8188
|
+
if (_optionalChain([doc, 'optionalAccess', _164 => _164.visibilityState]) === "hidden") {
|
|
8178
8189
|
inBackgroundSince.current = _nullishCoalesce(inBackgroundSince.current, () => ( Date.now()));
|
|
8179
8190
|
} else {
|
|
8180
8191
|
inBackgroundSince.current = null;
|
|
8181
8192
|
}
|
|
8182
8193
|
}
|
|
8183
|
-
_optionalChain([doc, 'optionalAccess',
|
|
8194
|
+
_optionalChain([doc, 'optionalAccess', _165 => _165.addEventListener, 'call', _166 => _166("visibilitychange", onVisibilityChange)]);
|
|
8184
8195
|
const unsub = () => {
|
|
8185
|
-
_optionalChain([doc, 'optionalAccess',
|
|
8196
|
+
_optionalChain([doc, 'optionalAccess', _167 => _167.removeEventListener, 'call', _168 => _168("visibilitychange", onVisibilityChange)]);
|
|
8186
8197
|
};
|
|
8187
8198
|
return [inBackgroundSince, unsub];
|
|
8188
8199
|
}
|
|
@@ -8362,7 +8373,7 @@ function createRoom(options, config) {
|
|
|
8362
8373
|
}
|
|
8363
8374
|
}
|
|
8364
8375
|
function isStorageWritable() {
|
|
8365
|
-
const scopes = _optionalChain([context, 'access',
|
|
8376
|
+
const scopes = _optionalChain([context, 'access', _169 => _169.dynamicSessionInfoSig, 'access', _170 => _170.get, 'call', _171 => _171(), 'optionalAccess', _172 => _172.scopes]);
|
|
8366
8377
|
return scopes !== void 0 ? canWriteStorage(scopes) : true;
|
|
8367
8378
|
}
|
|
8368
8379
|
const eventHub = {
|
|
@@ -8488,7 +8499,7 @@ function createRoom(options, config) {
|
|
|
8488
8499
|
}
|
|
8489
8500
|
case "experimental-fallback-to-http": {
|
|
8490
8501
|
warn("Message is too large for websockets, so sending over HTTP instead");
|
|
8491
|
-
const nonce = _nullishCoalesce(_optionalChain([context, 'access',
|
|
8502
|
+
const nonce = _nullishCoalesce(_optionalChain([context, 'access', _173 => _173.dynamicSessionInfoSig, 'access', _174 => _174.get, 'call', _175 => _175(), 'optionalAccess', _176 => _176.nonce]), () => ( raise("Session is not authorized to send message over HTTP")));
|
|
8492
8503
|
void httpClient.sendMessages({ roomId, nonce, messages }).then((resp) => {
|
|
8493
8504
|
if (!resp.ok && resp.status === 403) {
|
|
8494
8505
|
managedSocket.reconnect();
|
|
@@ -8539,7 +8550,7 @@ function createRoom(options, config) {
|
|
|
8539
8550
|
} else {
|
|
8540
8551
|
context.root = LiveObject._fromItems(message.items, context.pool);
|
|
8541
8552
|
}
|
|
8542
|
-
const canWrite = _nullishCoalesce(_optionalChain([self, 'access',
|
|
8553
|
+
const canWrite = _nullishCoalesce(_optionalChain([self, 'access', _177 => _177.get, 'call', _178 => _178(), 'optionalAccess', _179 => _179.canWrite]), () => ( true));
|
|
8543
8554
|
const stackSizeBefore = context.undoStack.length;
|
|
8544
8555
|
for (const key in context.initialStorage) {
|
|
8545
8556
|
if (context.root.get(key) === void 0) {
|
|
@@ -8742,7 +8753,7 @@ function createRoom(options, config) {
|
|
|
8742
8753
|
}
|
|
8743
8754
|
context.myPresence.patch(patch);
|
|
8744
8755
|
if (context.activeBatch) {
|
|
8745
|
-
if (_optionalChain([options2, 'optionalAccess',
|
|
8756
|
+
if (_optionalChain([options2, 'optionalAccess', _180 => _180.addToHistory])) {
|
|
8746
8757
|
context.activeBatch.reverseOps.pushLeft({
|
|
8747
8758
|
type: "presence",
|
|
8748
8759
|
data: oldValues
|
|
@@ -8751,7 +8762,7 @@ function createRoom(options, config) {
|
|
|
8751
8762
|
context.activeBatch.updates.presence = true;
|
|
8752
8763
|
} else {
|
|
8753
8764
|
flushNowOrSoon();
|
|
8754
|
-
if (_optionalChain([options2, 'optionalAccess',
|
|
8765
|
+
if (_optionalChain([options2, 'optionalAccess', _181 => _181.addToHistory])) {
|
|
8755
8766
|
addToUndoStack([{ type: "presence", data: oldValues }]);
|
|
8756
8767
|
}
|
|
8757
8768
|
notify({ presence: true });
|
|
@@ -8948,7 +8959,7 @@ function createRoom(options, config) {
|
|
|
8948
8959
|
if (process.env.NODE_ENV !== "production") {
|
|
8949
8960
|
const traces = /* @__PURE__ */ new Set();
|
|
8950
8961
|
for (const opId of message.opIds) {
|
|
8951
|
-
const trace = _optionalChain([context, 'access',
|
|
8962
|
+
const trace = _optionalChain([context, 'access', _182 => _182.opStackTraces, 'optionalAccess', _183 => _183.get, 'call', _184 => _184(opId)]);
|
|
8952
8963
|
if (trace) {
|
|
8953
8964
|
traces.add(trace);
|
|
8954
8965
|
}
|
|
@@ -9082,7 +9093,7 @@ ${Array.from(traces).join("\n\n")}`
|
|
|
9082
9093
|
const unacknowledgedOps = new Map(context.unacknowledgedOps);
|
|
9083
9094
|
createOrUpdateRootFromMessage(message);
|
|
9084
9095
|
applyAndSendOps(unacknowledgedOps);
|
|
9085
|
-
_optionalChain([_resolveStoragePromise, 'optionalCall',
|
|
9096
|
+
_optionalChain([_resolveStoragePromise, 'optionalCall', _185 => _185()]);
|
|
9086
9097
|
notifyStorageStatus();
|
|
9087
9098
|
eventHub.storageDidLoad.notify();
|
|
9088
9099
|
}
|
|
@@ -9303,8 +9314,8 @@ ${Array.from(traces).join("\n\n")}`
|
|
|
9303
9314
|
async function getThreads(options2) {
|
|
9304
9315
|
return httpClient.getThreads({
|
|
9305
9316
|
roomId,
|
|
9306
|
-
query: _optionalChain([options2, 'optionalAccess',
|
|
9307
|
-
cursor: _optionalChain([options2, 'optionalAccess',
|
|
9317
|
+
query: _optionalChain([options2, 'optionalAccess', _186 => _186.query]),
|
|
9318
|
+
cursor: _optionalChain([options2, 'optionalAccess', _187 => _187.cursor])
|
|
9308
9319
|
});
|
|
9309
9320
|
}
|
|
9310
9321
|
async function getThread(threadId) {
|
|
@@ -9411,7 +9422,7 @@ ${Array.from(traces).join("\n\n")}`
|
|
|
9411
9422
|
function getSubscriptionSettings(options2) {
|
|
9412
9423
|
return httpClient.getSubscriptionSettings({
|
|
9413
9424
|
roomId,
|
|
9414
|
-
signal: _optionalChain([options2, 'optionalAccess',
|
|
9425
|
+
signal: _optionalChain([options2, 'optionalAccess', _188 => _188.signal])
|
|
9415
9426
|
});
|
|
9416
9427
|
}
|
|
9417
9428
|
function updateSubscriptionSettings(settings) {
|
|
@@ -9433,7 +9444,7 @@ ${Array.from(traces).join("\n\n")}`
|
|
|
9433
9444
|
{
|
|
9434
9445
|
[kInternal]: {
|
|
9435
9446
|
get presenceBuffer() {
|
|
9436
|
-
return deepClone(_nullishCoalesce(_optionalChain([context, 'access',
|
|
9447
|
+
return deepClone(_nullishCoalesce(_optionalChain([context, 'access', _189 => _189.buffer, 'access', _190 => _190.presenceUpdates, 'optionalAccess', _191 => _191.data]), () => ( null)));
|
|
9437
9448
|
},
|
|
9438
9449
|
// prettier-ignore
|
|
9439
9450
|
get undoStack() {
|
|
@@ -9448,9 +9459,9 @@ ${Array.from(traces).join("\n\n")}`
|
|
|
9448
9459
|
return context.yjsProvider;
|
|
9449
9460
|
},
|
|
9450
9461
|
setYjsProvider(newProvider) {
|
|
9451
|
-
_optionalChain([context, 'access',
|
|
9462
|
+
_optionalChain([context, 'access', _192 => _192.yjsProvider, 'optionalAccess', _193 => _193.off, 'call', _194 => _194("status", yjsStatusDidChange)]);
|
|
9452
9463
|
context.yjsProvider = newProvider;
|
|
9453
|
-
_optionalChain([newProvider, 'optionalAccess',
|
|
9464
|
+
_optionalChain([newProvider, 'optionalAccess', _195 => _195.on, 'call', _196 => _196("status", yjsStatusDidChange)]);
|
|
9454
9465
|
context.yjsProviderDidChange.notify();
|
|
9455
9466
|
},
|
|
9456
9467
|
yjsProviderDidChange: context.yjsProviderDidChange.observable,
|
|
@@ -9496,7 +9507,7 @@ ${Array.from(traces).join("\n\n")}`
|
|
|
9496
9507
|
source.dispose();
|
|
9497
9508
|
}
|
|
9498
9509
|
eventHub.roomWillDestroy.notify();
|
|
9499
|
-
_optionalChain([context, 'access',
|
|
9510
|
+
_optionalChain([context, 'access', _197 => _197.yjsProvider, 'optionalAccess', _198 => _198.off, 'call', _199 => _199("status", yjsStatusDidChange)]);
|
|
9500
9511
|
syncSourceForStorage.destroy();
|
|
9501
9512
|
syncSourceForYjs.destroy();
|
|
9502
9513
|
uninstallBgTabSpy();
|
|
@@ -9646,7 +9657,7 @@ function makeClassicSubscribeFn(roomId, events, errorEvents) {
|
|
|
9646
9657
|
}
|
|
9647
9658
|
if (isLiveNode(first)) {
|
|
9648
9659
|
const node = first;
|
|
9649
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
9660
|
+
if (_optionalChain([options, 'optionalAccess', _200 => _200.isDeep])) {
|
|
9650
9661
|
const storageCallback = second;
|
|
9651
9662
|
return subscribeToLiveStructureDeeply(node, storageCallback);
|
|
9652
9663
|
} else {
|
|
@@ -9725,8 +9736,8 @@ function createClient(options) {
|
|
|
9725
9736
|
const userId = token.k === "sec-legacy" /* SECRET_LEGACY */ ? token.id : token.uid;
|
|
9726
9737
|
currentUserId.set(() => userId);
|
|
9727
9738
|
});
|
|
9728
|
-
const fetchPolyfill = _optionalChain([clientOptions, 'access',
|
|
9729
|
-
_optionalChain([globalThis, 'access',
|
|
9739
|
+
const fetchPolyfill = _optionalChain([clientOptions, 'access', _201 => _201.polyfills, 'optionalAccess', _202 => _202.fetch]) || /* istanbul ignore next */
|
|
9740
|
+
_optionalChain([globalThis, 'access', _203 => _203.fetch, 'optionalAccess', _204 => _204.bind, 'call', _205 => _205(globalThis)]);
|
|
9730
9741
|
const httpClient = createApiClient({
|
|
9731
9742
|
baseUrl,
|
|
9732
9743
|
fetchPolyfill,
|
|
@@ -9744,7 +9755,7 @@ function createClient(options) {
|
|
|
9744
9755
|
delegates: {
|
|
9745
9756
|
createSocket: makeCreateSocketDelegateForAi(
|
|
9746
9757
|
baseUrl,
|
|
9747
|
-
_optionalChain([clientOptions, 'access',
|
|
9758
|
+
_optionalChain([clientOptions, 'access', _206 => _206.polyfills, 'optionalAccess', _207 => _207.WebSocket])
|
|
9748
9759
|
),
|
|
9749
9760
|
authenticate: async () => {
|
|
9750
9761
|
const resp = await authManager.getAuthValue({
|
|
@@ -9812,7 +9823,7 @@ function createClient(options) {
|
|
|
9812
9823
|
createSocket: makeCreateSocketDelegateForRoom(
|
|
9813
9824
|
roomId,
|
|
9814
9825
|
baseUrl,
|
|
9815
|
-
_optionalChain([clientOptions, 'access',
|
|
9826
|
+
_optionalChain([clientOptions, 'access', _208 => _208.polyfills, 'optionalAccess', _209 => _209.WebSocket])
|
|
9816
9827
|
),
|
|
9817
9828
|
authenticate: makeAuthDelegateForRoom(roomId, authManager)
|
|
9818
9829
|
})),
|
|
@@ -9835,7 +9846,7 @@ function createClient(options) {
|
|
|
9835
9846
|
const shouldConnect = _nullishCoalesce(options2.autoConnect, () => ( true));
|
|
9836
9847
|
if (shouldConnect) {
|
|
9837
9848
|
if (typeof atob === "undefined") {
|
|
9838
|
-
if (_optionalChain([clientOptions, 'access',
|
|
9849
|
+
if (_optionalChain([clientOptions, 'access', _210 => _210.polyfills, 'optionalAccess', _211 => _211.atob]) === void 0) {
|
|
9839
9850
|
throw new Error(
|
|
9840
9851
|
"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"
|
|
9841
9852
|
);
|
|
@@ -9847,7 +9858,7 @@ function createClient(options) {
|
|
|
9847
9858
|
return leaseRoom(newRoomDetails);
|
|
9848
9859
|
}
|
|
9849
9860
|
function getRoom(roomId) {
|
|
9850
|
-
const room = _optionalChain([roomsById, 'access',
|
|
9861
|
+
const room = _optionalChain([roomsById, 'access', _212 => _212.get, 'call', _213 => _213(roomId), 'optionalAccess', _214 => _214.room]);
|
|
9851
9862
|
return room ? room : null;
|
|
9852
9863
|
}
|
|
9853
9864
|
function logout() {
|
|
@@ -9867,7 +9878,7 @@ function createClient(options) {
|
|
|
9867
9878
|
const batchedResolveUsers = new Batch(
|
|
9868
9879
|
async (batchedUserIds) => {
|
|
9869
9880
|
const userIds = batchedUserIds.flat();
|
|
9870
|
-
const users = await _optionalChain([resolveUsers, 'optionalCall',
|
|
9881
|
+
const users = await _optionalChain([resolveUsers, 'optionalCall', _215 => _215({ userIds })]);
|
|
9871
9882
|
warnIfNoResolveUsers();
|
|
9872
9883
|
return _nullishCoalesce(users, () => ( userIds.map(() => void 0)));
|
|
9873
9884
|
},
|
|
@@ -9885,7 +9896,7 @@ function createClient(options) {
|
|
|
9885
9896
|
const batchedResolveRoomsInfo = new Batch(
|
|
9886
9897
|
async (batchedRoomIds) => {
|
|
9887
9898
|
const roomIds = batchedRoomIds.flat();
|
|
9888
|
-
const roomsInfo = await _optionalChain([resolveRoomsInfo, 'optionalCall',
|
|
9899
|
+
const roomsInfo = await _optionalChain([resolveRoomsInfo, 'optionalCall', _216 => _216({ roomIds })]);
|
|
9889
9900
|
warnIfNoResolveRoomsInfo();
|
|
9890
9901
|
return _nullishCoalesce(roomsInfo, () => ( roomIds.map(() => void 0)));
|
|
9891
9902
|
},
|
|
@@ -9938,7 +9949,7 @@ function createClient(options) {
|
|
|
9938
9949
|
}
|
|
9939
9950
|
};
|
|
9940
9951
|
const win = typeof window !== "undefined" ? window : void 0;
|
|
9941
|
-
_optionalChain([win, 'optionalAccess',
|
|
9952
|
+
_optionalChain([win, 'optionalAccess', _217 => _217.addEventListener, 'call', _218 => _218("beforeunload", maybePreventClose)]);
|
|
9942
9953
|
}
|
|
9943
9954
|
async function getNotificationSettings(options2) {
|
|
9944
9955
|
const plainSettings = await httpClient.getNotificationSettings(options2);
|
|
@@ -10077,7 +10088,7 @@ var commentBodyElementsTypes = {
|
|
|
10077
10088
|
mention: "inline"
|
|
10078
10089
|
};
|
|
10079
10090
|
function traverseCommentBody(body, elementOrVisitor, possiblyVisitor) {
|
|
10080
|
-
if (!body || !_optionalChain([body, 'optionalAccess',
|
|
10091
|
+
if (!body || !_optionalChain([body, 'optionalAccess', _219 => _219.content])) {
|
|
10081
10092
|
return;
|
|
10082
10093
|
}
|
|
10083
10094
|
const element = typeof elementOrVisitor === "string" ? elementOrVisitor : void 0;
|
|
@@ -10087,13 +10098,13 @@ function traverseCommentBody(body, elementOrVisitor, possiblyVisitor) {
|
|
|
10087
10098
|
for (const block of body.content) {
|
|
10088
10099
|
if (type === "all" || type === "block") {
|
|
10089
10100
|
if (guard(block)) {
|
|
10090
|
-
_optionalChain([visitor, 'optionalCall',
|
|
10101
|
+
_optionalChain([visitor, 'optionalCall', _220 => _220(block)]);
|
|
10091
10102
|
}
|
|
10092
10103
|
}
|
|
10093
10104
|
if (type === "all" || type === "inline") {
|
|
10094
10105
|
for (const inline of block.children) {
|
|
10095
10106
|
if (guard(inline)) {
|
|
10096
|
-
_optionalChain([visitor, 'optionalCall',
|
|
10107
|
+
_optionalChain([visitor, 'optionalCall', _221 => _221(inline)]);
|
|
10097
10108
|
}
|
|
10098
10109
|
}
|
|
10099
10110
|
}
|
|
@@ -10127,7 +10138,7 @@ async function resolveUsersInCommentBody(body, resolveUsers) {
|
|
|
10127
10138
|
userIds
|
|
10128
10139
|
});
|
|
10129
10140
|
for (const [index, userId] of userIds.entries()) {
|
|
10130
|
-
const user = _optionalChain([users, 'optionalAccess',
|
|
10141
|
+
const user = _optionalChain([users, 'optionalAccess', _222 => _222[index]]);
|
|
10131
10142
|
if (user) {
|
|
10132
10143
|
resolvedUsers.set(userId, user);
|
|
10133
10144
|
}
|
|
@@ -10246,7 +10257,7 @@ var stringifyCommentBodyPlainElements = {
|
|
|
10246
10257
|
text: ({ element }) => element.text,
|
|
10247
10258
|
link: ({ element }) => _nullishCoalesce(element.text, () => ( element.url)),
|
|
10248
10259
|
mention: ({ element, user }) => {
|
|
10249
|
-
return `@${_nullishCoalesce(_optionalChain([user, 'optionalAccess',
|
|
10260
|
+
return `@${_nullishCoalesce(_optionalChain([user, 'optionalAccess', _223 => _223.name]), () => ( element.id))}`;
|
|
10250
10261
|
}
|
|
10251
10262
|
};
|
|
10252
10263
|
var stringifyCommentBodyHtmlElements = {
|
|
@@ -10276,7 +10287,7 @@ var stringifyCommentBodyHtmlElements = {
|
|
|
10276
10287
|
return html`<a href="${href}" target="_blank" rel="noopener noreferrer">${element.text ? html`${element.text}` : element.url}</a>`;
|
|
10277
10288
|
},
|
|
10278
10289
|
mention: ({ element, user }) => {
|
|
10279
|
-
return html`<span data-mention>@${_optionalChain([user, 'optionalAccess',
|
|
10290
|
+
return html`<span data-mention>@${_optionalChain([user, 'optionalAccess', _224 => _224.name]) ? html`${_optionalChain([user, 'optionalAccess', _225 => _225.name])}` : element.id}</span>`;
|
|
10280
10291
|
}
|
|
10281
10292
|
};
|
|
10282
10293
|
var stringifyCommentBodyMarkdownElements = {
|
|
@@ -10306,19 +10317,19 @@ var stringifyCommentBodyMarkdownElements = {
|
|
|
10306
10317
|
return markdown`[${_nullishCoalesce(element.text, () => ( element.url))}](${href})`;
|
|
10307
10318
|
},
|
|
10308
10319
|
mention: ({ element, user }) => {
|
|
10309
|
-
return markdown`@${_nullishCoalesce(_optionalChain([user, 'optionalAccess',
|
|
10320
|
+
return markdown`@${_nullishCoalesce(_optionalChain([user, 'optionalAccess', _226 => _226.name]), () => ( element.id))}`;
|
|
10310
10321
|
}
|
|
10311
10322
|
};
|
|
10312
10323
|
async function stringifyCommentBody(body, options) {
|
|
10313
|
-
const format = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
10314
|
-
const separator = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
10324
|
+
const format = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _227 => _227.format]), () => ( "plain"));
|
|
10325
|
+
const separator = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _228 => _228.separator]), () => ( (format === "markdown" ? "\n\n" : "\n")));
|
|
10315
10326
|
const elements = {
|
|
10316
10327
|
...format === "html" ? stringifyCommentBodyHtmlElements : format === "markdown" ? stringifyCommentBodyMarkdownElements : stringifyCommentBodyPlainElements,
|
|
10317
|
-
..._optionalChain([options, 'optionalAccess',
|
|
10328
|
+
..._optionalChain([options, 'optionalAccess', _229 => _229.elements])
|
|
10318
10329
|
};
|
|
10319
10330
|
const resolvedUsers = await resolveUsersInCommentBody(
|
|
10320
10331
|
body,
|
|
10321
|
-
_optionalChain([options, 'optionalAccess',
|
|
10332
|
+
_optionalChain([options, 'optionalAccess', _230 => _230.resolveUsers])
|
|
10322
10333
|
);
|
|
10323
10334
|
const blocks = body.content.flatMap((block, blockIndex) => {
|
|
10324
10335
|
switch (block.type) {
|
|
@@ -10604,12 +10615,12 @@ function legacy_patchImmutableNode(state, path, update) {
|
|
|
10604
10615
|
}
|
|
10605
10616
|
const newState = Object.assign({}, state);
|
|
10606
10617
|
for (const key in update.updates) {
|
|
10607
|
-
if (_optionalChain([update, 'access',
|
|
10618
|
+
if (_optionalChain([update, 'access', _231 => _231.updates, 'access', _232 => _232[key], 'optionalAccess', _233 => _233.type]) === "update") {
|
|
10608
10619
|
const val = update.node.get(key);
|
|
10609
10620
|
if (val !== void 0) {
|
|
10610
10621
|
newState[key] = lsonToJson(val);
|
|
10611
10622
|
}
|
|
10612
|
-
} else if (_optionalChain([update, 'access',
|
|
10623
|
+
} else if (_optionalChain([update, 'access', _234 => _234.updates, 'access', _235 => _235[key], 'optionalAccess', _236 => _236.type]) === "delete") {
|
|
10613
10624
|
delete newState[key];
|
|
10614
10625
|
}
|
|
10615
10626
|
}
|
|
@@ -10670,12 +10681,12 @@ function legacy_patchImmutableNode(state, path, update) {
|
|
|
10670
10681
|
}
|
|
10671
10682
|
const newState = Object.assign({}, state);
|
|
10672
10683
|
for (const key in update.updates) {
|
|
10673
|
-
if (_optionalChain([update, 'access',
|
|
10684
|
+
if (_optionalChain([update, 'access', _237 => _237.updates, 'access', _238 => _238[key], 'optionalAccess', _239 => _239.type]) === "update") {
|
|
10674
10685
|
const value = update.node.get(key);
|
|
10675
10686
|
if (value !== void 0) {
|
|
10676
10687
|
newState[key] = lsonToJson(value);
|
|
10677
10688
|
}
|
|
10678
|
-
} else if (_optionalChain([update, 'access',
|
|
10689
|
+
} else if (_optionalChain([update, 'access', _240 => _240.updates, 'access', _241 => _241[key], 'optionalAccess', _242 => _242.type]) === "delete") {
|
|
10679
10690
|
delete newState[key];
|
|
10680
10691
|
}
|
|
10681
10692
|
}
|
|
@@ -10755,9 +10766,9 @@ function makePoller(callback, intervalMs, options) {
|
|
|
10755
10766
|
const startTime = performance.now();
|
|
10756
10767
|
const doc = typeof document !== "undefined" ? document : void 0;
|
|
10757
10768
|
const win = typeof window !== "undefined" ? window : void 0;
|
|
10758
|
-
const maxStaleTimeMs = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
10769
|
+
const maxStaleTimeMs = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _243 => _243.maxStaleTimeMs]), () => ( Number.POSITIVE_INFINITY));
|
|
10759
10770
|
const context = {
|
|
10760
|
-
inForeground: _optionalChain([doc, 'optionalAccess',
|
|
10771
|
+
inForeground: _optionalChain([doc, 'optionalAccess', _244 => _244.visibilityState]) !== "hidden",
|
|
10761
10772
|
lastSuccessfulPollAt: startTime,
|
|
10762
10773
|
count: 0,
|
|
10763
10774
|
backoff: 0
|
|
@@ -10838,11 +10849,11 @@ function makePoller(callback, intervalMs, options) {
|
|
|
10838
10849
|
pollNowIfStale();
|
|
10839
10850
|
}
|
|
10840
10851
|
function onVisibilityChange() {
|
|
10841
|
-
setInForeground(_optionalChain([doc, 'optionalAccess',
|
|
10852
|
+
setInForeground(_optionalChain([doc, 'optionalAccess', _245 => _245.visibilityState]) !== "hidden");
|
|
10842
10853
|
}
|
|
10843
|
-
_optionalChain([doc, 'optionalAccess',
|
|
10844
|
-
_optionalChain([win, 'optionalAccess',
|
|
10845
|
-
_optionalChain([win, 'optionalAccess',
|
|
10854
|
+
_optionalChain([doc, 'optionalAccess', _246 => _246.addEventListener, 'call', _247 => _247("visibilitychange", onVisibilityChange)]);
|
|
10855
|
+
_optionalChain([win, 'optionalAccess', _248 => _248.addEventListener, 'call', _249 => _249("online", onVisibilityChange)]);
|
|
10856
|
+
_optionalChain([win, 'optionalAccess', _250 => _250.addEventListener, 'call', _251 => _251("focus", pollNowIfStale)]);
|
|
10846
10857
|
fsm.start();
|
|
10847
10858
|
return {
|
|
10848
10859
|
inc,
|