@realsee/live 0.7.7 → 0.7.9
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.js +3 -3
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +729 -729
- package/dist/index.es.js.map +1 -1
- package/docs/classes/Live.html +13 -13
- package/package.json +1 -1
package/dist/index.es.js
CHANGED
|
@@ -1,26 +1,26 @@
|
|
|
1
1
|
var on = Object.defineProperty;
|
|
2
2
|
var cn = (i, t, e) => t in i ? on(i, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : i[t] = e;
|
|
3
3
|
var a = (i, t, e) => cn(i, typeof t != "symbol" ? t + "" : t, e);
|
|
4
|
-
import
|
|
4
|
+
import ae from "trtc-js-sdk";
|
|
5
5
|
import { ConsoleLogger as ln, LogLevel as an, DefaultDeviceController as hn, MeetingSessionConfiguration as un, DefaultMeetingSession as dn, DefaultModality as Fe, MeetingSessionStatusCode as fn } from "amazon-chime-sdk-js";
|
|
6
6
|
import gn from "@realsee/jsbridge-x";
|
|
7
|
-
import
|
|
8
|
-
const
|
|
9
|
-
function
|
|
10
|
-
return i[
|
|
7
|
+
import M, { createContext as pn, useCallback as W } from "react";
|
|
8
|
+
const ft = Symbol("$$REALSEE_LIVE_EVENT$$");
|
|
9
|
+
function xt(i) {
|
|
10
|
+
return i[ft] || (i[ft] = {}), i[ft];
|
|
11
11
|
}
|
|
12
12
|
function Pe(i) {
|
|
13
|
-
const t = i[
|
|
13
|
+
const t = i[ft];
|
|
14
14
|
if (!t) return;
|
|
15
|
-
Object.keys(t).some((n) => Array.isArray(t[n]) && t[n].length > 0) || delete i[
|
|
15
|
+
Object.keys(t).some((n) => Array.isArray(t[n]) && t[n].length > 0) || delete i[ft];
|
|
16
16
|
}
|
|
17
|
-
class
|
|
17
|
+
class Lt {
|
|
18
18
|
/**
|
|
19
19
|
* 判断是否注册了事件
|
|
20
20
|
* @param name 事件类型
|
|
21
21
|
*/
|
|
22
22
|
hasListener(t) {
|
|
23
|
-
const e =
|
|
23
|
+
const e = xt(this);
|
|
24
24
|
return e && e[t] && e[t].length > 0;
|
|
25
25
|
}
|
|
26
26
|
/**
|
|
@@ -33,7 +33,7 @@ class At {
|
|
|
33
33
|
* @template C 回调函数函数上下文
|
|
34
34
|
*/
|
|
35
35
|
on(t, e, n) {
|
|
36
|
-
const s =
|
|
36
|
+
const s = xt(this);
|
|
37
37
|
return s[t] || (s[t] = []), s[t].push([e, n || !1]), () => this.off(t, e);
|
|
38
38
|
}
|
|
39
39
|
/**
|
|
@@ -57,9 +57,9 @@ class At {
|
|
|
57
57
|
* @template K 预设的监听事件名称
|
|
58
58
|
*/
|
|
59
59
|
off(t, e) {
|
|
60
|
-
const n =
|
|
60
|
+
const n = xt(this);
|
|
61
61
|
if (!t) {
|
|
62
|
-
delete this[
|
|
62
|
+
delete this[ft];
|
|
63
63
|
return;
|
|
64
64
|
}
|
|
65
65
|
if (n[t] || (n[t] = []), e === void 0) {
|
|
@@ -78,7 +78,7 @@ class At {
|
|
|
78
78
|
*/
|
|
79
79
|
emit(t, ...e) {
|
|
80
80
|
let n = !1;
|
|
81
|
-
const r =
|
|
81
|
+
const r = xt(this)[t] || [];
|
|
82
82
|
for (let o of r.slice()) {
|
|
83
83
|
const [c, l = !1] = o, h = c(...e);
|
|
84
84
|
l && this.off(t, c), h === !1 && (n = !0);
|
|
@@ -86,13 +86,13 @@ class At {
|
|
|
86
86
|
return n;
|
|
87
87
|
}
|
|
88
88
|
}
|
|
89
|
-
class
|
|
89
|
+
class Ae extends Lt {
|
|
90
90
|
}
|
|
91
|
-
var
|
|
91
|
+
var lt = /* @__PURE__ */ ((i) => (i.RealseeBrowserRTC = "RealseeBrowserRTC", i.RealseeVRWebViewRTC = "RealseeVRWebViewRTC", i.RealseeBrowserChimeRTC = "RealseeBrowserChimeRTC", i))(lt || {}), fi = /* @__PURE__ */ ((i) => (i.RealseeXTRTC = "trtc", i.RealseeXChimeRTC = "chime", i))(fi || {});
|
|
92
92
|
const _n = () => {
|
|
93
93
|
const i = /* @__PURE__ */ new Date(), t = i.getFullYear(), e = (i.getMonth() + 1).toString().padStart(2, "0"), n = i.getDate().toString().padStart(2, "0"), s = i.getHours().toString().padStart(2, "0"), r = i.getMinutes().toString().padStart(2, "0"), o = i.getSeconds().toString().padStart(2, "0"), c = i.getMilliseconds().toString().padStart(3, "0");
|
|
94
94
|
return `[${t}-${e}-${n} ${s}:${r}:${o}.${c}]`;
|
|
95
|
-
},
|
|
95
|
+
}, It = (i, t = []) => {
|
|
96
96
|
const e = `Realsee Live ${_n()} <${i}> `;
|
|
97
97
|
switch (i) {
|
|
98
98
|
case "INFO":
|
|
@@ -111,24 +111,24 @@ const _n = () => {
|
|
|
111
111
|
console.log(e, ...t);
|
|
112
112
|
}
|
|
113
113
|
}, m = {
|
|
114
|
-
log: (...i) =>
|
|
114
|
+
log: (...i) => It("LOG", i),
|
|
115
115
|
// 普通日志
|
|
116
|
-
info: (...i) =>
|
|
116
|
+
info: (...i) => It("INFO", i),
|
|
117
117
|
// 信息日志
|
|
118
|
-
error: (...i) =>
|
|
118
|
+
error: (...i) => It("ERROR", i),
|
|
119
119
|
// 错误日志
|
|
120
|
-
warn: (...i) =>
|
|
120
|
+
warn: (...i) => It("WARN", i),
|
|
121
121
|
// 警告日志
|
|
122
|
-
debug: (...i) =>
|
|
122
|
+
debug: (...i) => It("DEBUG", i)
|
|
123
123
|
// 调试日志
|
|
124
124
|
};
|
|
125
|
-
function
|
|
125
|
+
function et() {
|
|
126
126
|
return ((1 + Math.random()) * 65536 | 0).toString(16).substring(1);
|
|
127
127
|
}
|
|
128
|
-
function
|
|
129
|
-
return [
|
|
128
|
+
function Tt() {
|
|
129
|
+
return [et(), et(), "4" + et().substring(0, 3), et(), et(), et() + et() + et()].join("-").toLowerCase();
|
|
130
130
|
}
|
|
131
|
-
class mn extends
|
|
131
|
+
class mn extends Ae {
|
|
132
132
|
/**
|
|
133
133
|
* 创建 BrowserRTC 实例
|
|
134
134
|
*
|
|
@@ -138,7 +138,7 @@ class mn extends Re {
|
|
|
138
138
|
*/
|
|
139
139
|
constructor(e) {
|
|
140
140
|
super();
|
|
141
|
-
a(this, "type",
|
|
141
|
+
a(this, "type", lt.RealseeBrowserRTC);
|
|
142
142
|
a(this, "joined", !1);
|
|
143
143
|
a(this, "micro", !1);
|
|
144
144
|
a(this, "voiceId", "");
|
|
@@ -153,7 +153,7 @@ class mn extends Re {
|
|
|
153
153
|
*
|
|
154
154
|
* @returns 系统要求检查结果
|
|
155
155
|
*/
|
|
156
|
-
a(this, "checkRequirement", () =>
|
|
156
|
+
a(this, "checkRequirement", () => ae.checkSystemRequirements());
|
|
157
157
|
/**
|
|
158
158
|
* DOM 容器(内部使用)
|
|
159
159
|
*/
|
|
@@ -173,7 +173,7 @@ class mn extends Re {
|
|
|
173
173
|
roomId: e.roomId,
|
|
174
174
|
userId: e.userId
|
|
175
175
|
});
|
|
176
|
-
this._trtc.client =
|
|
176
|
+
this._trtc.client = ae.createClient({
|
|
177
177
|
mode: "rtc",
|
|
178
178
|
...n,
|
|
179
179
|
enableAutoPlayDialog: typeof this._autoPlayConfirm != "function"
|
|
@@ -182,7 +182,7 @@ class mn extends Re {
|
|
|
182
182
|
var c;
|
|
183
183
|
(c = this._trtc.client) == null || c.join({ roomId: Number(e.voiceId) }).then(() => o(!0)).catch(() => o(!1));
|
|
184
184
|
});
|
|
185
|
-
return this.joined = s, s ? (this._trtc.stream =
|
|
185
|
+
return this.joined = s, s ? (this._trtc.stream = ae.createStream({
|
|
186
186
|
userId: n.userId,
|
|
187
187
|
audio: !0,
|
|
188
188
|
video: !1
|
|
@@ -215,7 +215,7 @@ class mn extends Re {
|
|
|
215
215
|
this._getVoiceSign = e.getVoiceSign, this._autoPlayConfirm = e.autoPlayConfirm, this._initParentDom();
|
|
216
216
|
}
|
|
217
217
|
_initParentDom() {
|
|
218
|
-
this.$dom.id = `rs-rtc-${
|
|
218
|
+
this.$dom.id = `rs-rtc-${Tt()}`, this.$dom.style.display = "none", document.body.appendChild(this.$dom);
|
|
219
219
|
}
|
|
220
220
|
quit() {
|
|
221
221
|
return new Promise(async (e) => {
|
|
@@ -262,7 +262,7 @@ class mn extends Re {
|
|
|
262
262
|
), (r = this._trtc.client) == null || r.on("error", (o) => this.emit("error", o));
|
|
263
263
|
}
|
|
264
264
|
}
|
|
265
|
-
class We extends
|
|
265
|
+
class We extends Ae {
|
|
266
266
|
/**
|
|
267
267
|
* 创建 BrowserRTC4Chime 实例
|
|
268
268
|
*
|
|
@@ -273,7 +273,7 @@ class We extends Re {
|
|
|
273
273
|
*/
|
|
274
274
|
constructor(e) {
|
|
275
275
|
super();
|
|
276
|
-
a(this, "type",
|
|
276
|
+
a(this, "type", lt.RealseeBrowserChimeRTC);
|
|
277
277
|
a(this, "joined", !1);
|
|
278
278
|
a(this, "micro", !1);
|
|
279
279
|
a(this, "voiceId", "");
|
|
@@ -297,7 +297,7 @@ class We extends Re {
|
|
|
297
297
|
* 创建并挂载 audio 标签到页面
|
|
298
298
|
*/
|
|
299
299
|
a(this, "_initDom", () => {
|
|
300
|
-
this.$audio.id = `rs-rtc-${
|
|
300
|
+
this.$audio.id = `rs-rtc-${Tt()}`, this.$dom.id = `rs-rtc-${Tt()}`, this.$dom.appendChild(this.$audio), document.body.appendChild(this.$dom);
|
|
301
301
|
});
|
|
302
302
|
/**
|
|
303
303
|
* 初始化事件监听器
|
|
@@ -358,7 +358,7 @@ class We extends Re {
|
|
|
358
358
|
if (e) {
|
|
359
359
|
const h = /* @__PURE__ */ new Map(), u = () => {
|
|
360
360
|
const d = [];
|
|
361
|
-
return h.forEach((g,
|
|
361
|
+
return h.forEach((g, _) => {
|
|
362
362
|
d.push({
|
|
363
363
|
userId: g.userId,
|
|
364
364
|
volume: g.muted || g.signalStrength === 0 || !g.volume ? 0 : g.volume
|
|
@@ -366,28 +366,28 @@ class We extends Re {
|
|
|
366
366
|
}), d;
|
|
367
367
|
};
|
|
368
368
|
(o = this.meetingSession) == null || o.audioVideo.realtimeSubscribeToAttendeeIdPresence(
|
|
369
|
-
(d, g,
|
|
370
|
-
var
|
|
369
|
+
(d, g, _) => {
|
|
370
|
+
var w;
|
|
371
371
|
if (!g) {
|
|
372
372
|
h.delete(d), this.emit("userVolumes", u());
|
|
373
373
|
return;
|
|
374
374
|
}
|
|
375
|
-
(
|
|
375
|
+
(w = this.meetingSession) == null || w.audioVideo.realtimeSubscribeToVolumeIndicator(
|
|
376
376
|
d,
|
|
377
|
-
(
|
|
378
|
-
new Fe(
|
|
379
|
-
userId:
|
|
380
|
-
volume:
|
|
381
|
-
muted:
|
|
382
|
-
signalStrength:
|
|
377
|
+
(b, y, I, p) => {
|
|
378
|
+
new Fe(b).base() === b && (h.set(b, {
|
|
379
|
+
userId: _ || b,
|
|
380
|
+
volume: y,
|
|
381
|
+
muted: I,
|
|
382
|
+
signalStrength: p
|
|
383
383
|
}), this.emit("userVolumes", u()));
|
|
384
384
|
}
|
|
385
385
|
);
|
|
386
386
|
}
|
|
387
387
|
), (c = this.meetingSession) == null || c.audioVideo.realtimeSubscribeToVolumeIndicator(
|
|
388
388
|
e,
|
|
389
|
-
(d, g,
|
|
390
|
-
new Fe(d).base() === d &&
|
|
389
|
+
(d, g, _, w) => {
|
|
390
|
+
new Fe(d).base() === d && w !== null && w !== 1 && this.emit("weakNetwork");
|
|
391
391
|
}
|
|
392
392
|
), (l = this.meetingSession) == null || l.audioVideo.realtimeSubscribeToFatalError((d) => this.emit("error", d));
|
|
393
393
|
}
|
|
@@ -411,7 +411,7 @@ class We extends Re {
|
|
|
411
411
|
this.userId = l;
|
|
412
412
|
const { attendence: d, vendor_wrapper: g } = JSON.parse(
|
|
413
413
|
decodeURIComponent(u)
|
|
414
|
-
),
|
|
414
|
+
), _ = new un(
|
|
415
415
|
{
|
|
416
416
|
Meeting: g
|
|
417
417
|
},
|
|
@@ -423,34 +423,34 @@ class We extends Re {
|
|
|
423
423
|
}
|
|
424
424
|
}
|
|
425
425
|
);
|
|
426
|
-
this.meetingSession = new dn(
|
|
427
|
-
const
|
|
426
|
+
this.meetingSession = new dn(_, this.logger, this.deviceController), this._registerRtcEvent(), this.meetingSession.audioVideo.addDeviceChangeObserver(this.deviceChangeObserver), this.meetingSession.audioVideo.addObserver(this.audioVideoObserver), this.meetingSession.audioVideo.bindAudioElement(this.$audio);
|
|
427
|
+
const w = {
|
|
428
428
|
audioVideoDidStart: () => {
|
|
429
|
-
var
|
|
430
|
-
(
|
|
429
|
+
var b;
|
|
430
|
+
(b = this.meetingSession) == null || b.audioVideo.realtimeMuteLocalAudio(), this.joined = !0, this.emit("joined"), n(!0);
|
|
431
431
|
},
|
|
432
432
|
audioVideoDidStop: () => {
|
|
433
433
|
this.joined = !1, n(!1);
|
|
434
434
|
}
|
|
435
435
|
};
|
|
436
|
-
this.meetingSession.audioVideo.addObserver(
|
|
436
|
+
this.meetingSession.audioVideo.addObserver(w), this.audioMixObserver && this.meetingSession.audioVideo.addAudioMixObserver(this.audioMixObserver), this.meetingSession.audioVideo.setDeviceLabelTrigger(
|
|
437
437
|
async () => await navigator.mediaDevices.getUserMedia({ audio: !0, video: !1 })
|
|
438
438
|
);
|
|
439
439
|
try {
|
|
440
|
-
const
|
|
441
|
-
m.info("audioInputDevices ===>",
|
|
442
|
-
const
|
|
443
|
-
await this.meetingSession.audioVideo.startAudioInput(
|
|
444
|
-
} catch (
|
|
445
|
-
m.error(`设置语音输入设备失败:${
|
|
440
|
+
const b = await this.meetingSession.audioVideo.listAudioInputDevices();
|
|
441
|
+
m.info("audioInputDevices ===>", b);
|
|
442
|
+
const y = ((r = b[0]) == null ? void 0 : r.deviceId) || "default";
|
|
443
|
+
await this.meetingSession.audioVideo.startAudioInput(y);
|
|
444
|
+
} catch (b) {
|
|
445
|
+
m.error(`设置语音输入设备失败:${b.message}`);
|
|
446
446
|
}
|
|
447
447
|
try {
|
|
448
|
-
const
|
|
449
|
-
m.info("audioOutputDevices ===>",
|
|
450
|
-
const
|
|
451
|
-
await this.meetingSession.audioVideo.chooseAudioOutput(
|
|
452
|
-
} catch (
|
|
453
|
-
m.error(`设置语音输出设备失败:${
|
|
448
|
+
const b = await this.meetingSession.audioVideo.listAudioOutputDevices();
|
|
449
|
+
m.info("audioOutputDevices ===>", b);
|
|
450
|
+
const y = ((o = b[0]) == null ? void 0 : o.deviceId) || "default";
|
|
451
|
+
await this.meetingSession.audioVideo.chooseAudioOutput(y);
|
|
452
|
+
} catch (b) {
|
|
453
|
+
m.error(`设置语音输出设备失败:${b.message}`);
|
|
454
454
|
}
|
|
455
455
|
this.meetingSession.audioVideo.start();
|
|
456
456
|
} catch (c) {
|
|
@@ -492,8 +492,8 @@ class We extends Re {
|
|
|
492
492
|
throw new Error("Method not implemented.");
|
|
493
493
|
}
|
|
494
494
|
}
|
|
495
|
-
var
|
|
496
|
-
class wn extends
|
|
495
|
+
var ut = /* @__PURE__ */ ((i) => (i[i.Success = 0] = "Success", i[i.Failure = 1] = "Failure", i[i.ReJoin = 2] = "ReJoin", i[i.NoMicroPermission = 3] = "NoMicroPermission", i[i.Unknown = 500] = "Unknown", i))(ut || {});
|
|
496
|
+
class wn extends Ae {
|
|
497
497
|
/**
|
|
498
498
|
* 创建 VRWebViewRTC 实例
|
|
499
499
|
*
|
|
@@ -503,7 +503,7 @@ class wn extends Re {
|
|
|
503
503
|
*/
|
|
504
504
|
constructor({ jsBridge: e, getVoiceSign: n }) {
|
|
505
505
|
super();
|
|
506
|
-
a(this, "type",
|
|
506
|
+
a(this, "type", lt.RealseeVRWebViewRTC);
|
|
507
507
|
a(this, "joined", !1);
|
|
508
508
|
a(this, "micro", !1);
|
|
509
509
|
a(this, "voiceId", "");
|
|
@@ -602,14 +602,14 @@ class wn extends Re {
|
|
|
602
602
|
this.jsBridge.callAndListen(
|
|
603
603
|
`live/join?sdkAppID=${r}&userID=${o}&roomID=${l}&userSig=${c}`,
|
|
604
604
|
(h) => {
|
|
605
|
-
h === !0 ? this.emit("inner.rtc.success", h) : typeof h == "object" ? h.code ===
|
|
605
|
+
h === !0 ? this.emit("inner.rtc.success", h) : typeof h == "object" ? h.code === ut.Success || h.code === ut.ReJoin ? this.emit("inner.rtc.success", h) : this.emit("inner.rtc.fail", h) : this.emit("inner.rtc.fail", h);
|
|
606
606
|
}
|
|
607
607
|
);
|
|
608
608
|
} catch (r) {
|
|
609
609
|
n(
|
|
610
610
|
this.handleJoinResult({
|
|
611
611
|
message: r.message,
|
|
612
|
-
code:
|
|
612
|
+
code: ut.Unknown
|
|
613
613
|
})
|
|
614
614
|
);
|
|
615
615
|
}
|
|
@@ -643,8 +643,8 @@ class wn extends Re {
|
|
|
643
643
|
a(this, "handleJoinResult", (e) => {
|
|
644
644
|
switch (!0) {
|
|
645
645
|
case e === !0:
|
|
646
|
-
case (typeof e == "object" && e.code ===
|
|
647
|
-
case (typeof e == "object" && e.code ===
|
|
646
|
+
case (typeof e == "object" && e.code === ut.Success):
|
|
647
|
+
case (typeof e == "object" && e.code === ut.ReJoin): {
|
|
648
648
|
this.emit("joined"), this.joined = !0;
|
|
649
649
|
break;
|
|
650
650
|
}
|
|
@@ -709,7 +709,7 @@ class wn extends Re {
|
|
|
709
709
|
return this.options.jsBridge;
|
|
710
710
|
}
|
|
711
711
|
}
|
|
712
|
-
var B = /* @__PURE__ */ ((i) => (i.SelfUserInfo = "SELF_USER_INFO", i.RoomInfo = "ROOM_INFO", i.RTCInfo = "RTC_INFO", i.UserList = "USER_LIST", i.BuiltinMsg = "BUILTIN_MSG", i.CustomEvent = "CUSTOM_EVENT", i.KeyframeSync = "KEYFRAME_SYNC", i.UserKickOut = "USER_KICK_OUT", i))(B || {}),
|
|
712
|
+
var B = /* @__PURE__ */ ((i) => (i.SelfUserInfo = "SELF_USER_INFO", i.RoomInfo = "ROOM_INFO", i.RTCInfo = "RTC_INFO", i.UserList = "USER_LIST", i.BuiltinMsg = "BUILTIN_MSG", i.CustomEvent = "CUSTOM_EVENT", i.KeyframeSync = "KEYFRAME_SYNC", i.UserKickOut = "USER_KICK_OUT", i))(B || {}), K = /* @__PURE__ */ ((i) => (i.UserChange = "user_change", i.RoomChange = "room_change", i))(K || {}), Y = /* @__PURE__ */ ((i) => (i.UserMicroStatus = "change_micro_status", i.UserMicroStatusSync = "sync_micro_status", i.UserPermission = "change_permission", i.UserStatus = "change_status", i.UserInfo = "change_info", i.RoomClose = "close", i))(Y || {}), ct = /* @__PURE__ */ ((i) => (i.OPEN = "OPEN", i.CLOSE = "CLOSE", i))(ct || {});
|
|
713
713
|
function Mr(i) {
|
|
714
714
|
try {
|
|
715
715
|
const t = JSON.parse(i), e = {
|
|
@@ -730,7 +730,7 @@ function Mr(i) {
|
|
|
730
730
|
return !1;
|
|
731
731
|
}
|
|
732
732
|
}
|
|
733
|
-
var j = /* @__PURE__ */ ((i) => (i[i.NOTINITIALIZED = -1] = "NOTINITIALIZED", i[i.CONNECTING = 0] = "CONNECTING", i[i.OPEN = 1] = "OPEN", i[i.CLOSED = 3] = "CLOSED", i))(j || {}), yn = /* @__PURE__ */ ((i) => (i[i.Normal = 0] = "Normal", i[i.Removed = 1] = "Removed", i[i.Replaced = 2] = "Replaced", i))(yn || {}), bn = /* @__PURE__ */ ((i) => (i.WAIT_ENTER = "WAIT_ENTER", i.ONLINE = "ONLINE", i.LEAVE = "LEAVE", i.KICK_OUT = "KICK_OUT", i.BE_REPLACE = "BE_REPLACE", i.EXCEPTION = "EXCEPTION", i))(bn || {}),
|
|
733
|
+
var j = /* @__PURE__ */ ((i) => (i[i.NOTINITIALIZED = -1] = "NOTINITIALIZED", i[i.CONNECTING = 0] = "CONNECTING", i[i.OPEN = 1] = "OPEN", i[i.CLOSED = 3] = "CLOSED", i))(j || {}), yn = /* @__PURE__ */ ((i) => (i[i.Normal = 0] = "Normal", i[i.Removed = 1] = "Removed", i[i.Replaced = 2] = "Replaced", i))(yn || {}), bn = /* @__PURE__ */ ((i) => (i.WAIT_ENTER = "WAIT_ENTER", i.ONLINE = "ONLINE", i.LEAVE = "LEAVE", i.KICK_OUT = "KICK_OUT", i.BE_REPLACE = "BE_REPLACE", i.EXCEPTION = "EXCEPTION", i))(bn || {}), Se = /* @__PURE__ */ ((i) => (i[i.NOTINITIALIZED = -1] = "NOTINITIALIZED", i[i.CONNECTING = 0] = "CONNECTING", i[i.OPEN = 1] = "OPEN", i[i.CLOSING = 2] = "CLOSING", i[i.CLOSED = 3] = "CLOSED", i))(Se || {}), Sn = /* @__PURE__ */ ((i) => (i.Error = "Error", i.Close = "Close", i.MicroAuth = "MicroAuth", i.DuplicateConnect = "DuplicateConnect", i.IllegalURL = "IllegalURL", i.Unknown = "Unknown", i.IllegalArgs = "IllegalArgs", i))(Sn || {}), Cn = /* @__PURE__ */ ((i) => (i.Err_1000 = "CLOSE_NORMAL", i.Err_1001 = "CLOSE_GOING_AWAY", i.Err_1002 = "CLOSE_PROTOCOL_ERROR", i.Err_1003 = "CLOSE_UNSUPPORTED", i.Err_1006 = "CLOSE_ABNORMAL", i.Err_1007 = "Unsupported Data", i.Err_1008 = "Policy Violation", i.Err_1009 = "CLOSE_TOO_LARGE", i.Err_unknown = "unknown", i))(Cn || {});
|
|
734
734
|
function En(i) {
|
|
735
735
|
switch (i) {
|
|
736
736
|
case 1e3:
|
|
@@ -764,50 +764,50 @@ const gi = (() => {
|
|
|
764
764
|
var e;
|
|
765
765
|
const i = typeof process != "undefined" && ((e = process.versions) == null ? void 0 : e.node) != null;
|
|
766
766
|
return typeof window != "undefined" && "Deno" in window || i || typeof window == "undefined";
|
|
767
|
-
})(),
|
|
768
|
-
function
|
|
767
|
+
})(), pt = gi ? "" : navigator.userAgent, vn = /android/i.test(pt), In = /iPhone|iPad|iPod|iPadOS/i.test(pt) || !gi && /Macintosh/.test(pt) && "ontouchend" in globalThis, Ke = /MicroMessenger/i.test(pt) && /miniProgram/i.test(pt), Ge = /realsee/i.test(pt);
|
|
768
|
+
function Ht(i) {
|
|
769
769
|
return Object.prototype.toString.call(i) === "[object Object]";
|
|
770
770
|
}
|
|
771
|
-
function
|
|
771
|
+
function ee(i, t) {
|
|
772
772
|
return i === t ? !0 : i == null || t == null || typeof i != typeof t ? !1 : Number.isNaN(i) && Number.isNaN(t);
|
|
773
773
|
}
|
|
774
774
|
function On(i, t) {
|
|
775
775
|
if (i === t) return !0;
|
|
776
776
|
if (i == null || t == null) return !1;
|
|
777
777
|
const e = Object.keys(i), n = Object.keys(t);
|
|
778
|
-
return e.length !== n.length ? !1 : e.every((s) =>
|
|
778
|
+
return e.length !== n.length ? !1 : e.every((s) => ee(i[s], t[s]));
|
|
779
779
|
}
|
|
780
780
|
function Rn(i, t) {
|
|
781
|
-
return i === t ? !0 : i == null || t == null || i.length !== t.length ? !1 : i.every((e, n) =>
|
|
781
|
+
return i === t ? !0 : i == null || t == null || i.length !== t.length ? !1 : i.every((e, n) => ee(e, t[n]));
|
|
782
782
|
}
|
|
783
783
|
function An(i, t) {
|
|
784
|
-
return
|
|
784
|
+
return ee(i, t) ? !0 : Ht(i) && Ht(t) ? On(i, t) : Array.isArray(i) && Array.isArray(t) ? Rn(i, t) : !1;
|
|
785
785
|
}
|
|
786
|
-
function
|
|
787
|
-
return
|
|
786
|
+
function Le(i, t) {
|
|
787
|
+
return ee(i, t) ? !0 : Ht(i) && Ht(t) ? Tn(i, t) : Array.isArray(i) && Array.isArray(t) ? Ln(i, t) : !1;
|
|
788
788
|
}
|
|
789
789
|
function Ln(i, t) {
|
|
790
790
|
if (i.length !== t.length) return !1;
|
|
791
791
|
for (let e = 0, n = i.length; e < n; e++)
|
|
792
|
-
if (!
|
|
792
|
+
if (!Le(i[e], t[e])) return !1;
|
|
793
793
|
return !0;
|
|
794
794
|
}
|
|
795
795
|
function Tn(i, t) {
|
|
796
796
|
if (i === t) return !0;
|
|
797
797
|
if (i == null || t == null) return !1;
|
|
798
798
|
const e = Object.keys(i), n = Object.keys(t);
|
|
799
|
-
return e.length !== n.length ? !1 : e.every((s) =>
|
|
799
|
+
return e.length !== n.length ? !1 : e.every((s) => Le(i[s], t[s]));
|
|
800
800
|
}
|
|
801
801
|
function Dn(i, t, e = { deep: !1 }) {
|
|
802
|
-
return e.deep ?
|
|
802
|
+
return e.deep ? Le(i, t) : An(i, t);
|
|
803
803
|
}
|
|
804
|
-
class Mn extends
|
|
804
|
+
class Mn extends Lt {
|
|
805
805
|
constructor(e) {
|
|
806
806
|
super();
|
|
807
807
|
a(this, "_realWebSocket");
|
|
808
808
|
a(this, "_url");
|
|
809
809
|
a(this, "_protocols");
|
|
810
|
-
a(this, "_readyState",
|
|
810
|
+
a(this, "_readyState", Se.NOTINITIALIZED);
|
|
811
811
|
a(this, "_options", {
|
|
812
812
|
timeout: 1e4,
|
|
813
813
|
shouldReconnect: (e, n) => {
|
|
@@ -832,7 +832,7 @@ class Mn extends At {
|
|
|
832
832
|
a(this, "_healthCheck", async () => {
|
|
833
833
|
if (this._realWebSocket) {
|
|
834
834
|
const e = this._realWebSocket.readyState;
|
|
835
|
-
e !== this._readyState && (this._readyState = e, this._readyState ===
|
|
835
|
+
e !== this._readyState && (this._readyState = e, this._readyState === Se.CLOSING && this.emit("closing"));
|
|
836
836
|
}
|
|
837
837
|
await new Promise((e) => setTimeout(e, 2e3)), this._heathCheckTimer = requestAnimationFrame(this._healthCheck);
|
|
838
838
|
});
|
|
@@ -1021,7 +1021,7 @@ class Mn extends At {
|
|
|
1021
1021
|
typeof r == "number" ? (m.debug(`RobustWebSocket: Reconnecting in ${r}ms...`), this._pendingReconnect = setTimeout(this._createWebSocket, r)) : m.debug("RobustWebSocket: No reconnection will be attempted.");
|
|
1022
1022
|
}
|
|
1023
1023
|
}
|
|
1024
|
-
class Nn extends
|
|
1024
|
+
class Nn extends Lt {
|
|
1025
1025
|
/**
|
|
1026
1026
|
* 创建带看控制器实例
|
|
1027
1027
|
*
|
|
@@ -1237,12 +1237,12 @@ class Nn extends At {
|
|
|
1237
1237
|
return this._state;
|
|
1238
1238
|
}
|
|
1239
1239
|
}
|
|
1240
|
-
const
|
|
1241
|
-
const t =
|
|
1240
|
+
const J = () => /* @__PURE__ */ new Map(), Ce = (i) => {
|
|
1241
|
+
const t = J();
|
|
1242
1242
|
return i.forEach((e, n) => {
|
|
1243
1243
|
t.set(n, e);
|
|
1244
1244
|
}), t;
|
|
1245
|
-
},
|
|
1245
|
+
}, St = (i, t, e) => {
|
|
1246
1246
|
let n = i.get(t);
|
|
1247
1247
|
return n === void 0 && i.set(t, n = e()), n;
|
|
1248
1248
|
}, Vn = (i, t) => {
|
|
@@ -1255,10 +1255,10 @@ const G = () => /* @__PURE__ */ new Map(), Se = (i) => {
|
|
|
1255
1255
|
if (t(n, e))
|
|
1256
1256
|
return !0;
|
|
1257
1257
|
return !1;
|
|
1258
|
-
},
|
|
1258
|
+
}, _t = () => /* @__PURE__ */ new Set(), he = (i) => i[i.length - 1], mt = Array.from, jn = Array.isArray;
|
|
1259
1259
|
class $n {
|
|
1260
1260
|
constructor() {
|
|
1261
|
-
this._observers =
|
|
1261
|
+
this._observers = J();
|
|
1262
1262
|
}
|
|
1263
1263
|
/**
|
|
1264
1264
|
* @template {keyof EVENTS & string} NAME
|
|
@@ -1266,11 +1266,11 @@ class $n {
|
|
|
1266
1266
|
* @param {EVENTS[NAME]} f
|
|
1267
1267
|
*/
|
|
1268
1268
|
on(t, e) {
|
|
1269
|
-
return
|
|
1269
|
+
return St(
|
|
1270
1270
|
this._observers,
|
|
1271
1271
|
/** @type {string} */
|
|
1272
1272
|
t,
|
|
1273
|
-
|
|
1273
|
+
_t
|
|
1274
1274
|
).add(e), e;
|
|
1275
1275
|
}
|
|
1276
1276
|
/**
|
|
@@ -1312,35 +1312,35 @@ class $n {
|
|
|
1312
1312
|
* @param {Parameters<EVENTS[NAME]>} args The arguments that are applied to the event listener.
|
|
1313
1313
|
*/
|
|
1314
1314
|
emit(t, e) {
|
|
1315
|
-
return
|
|
1315
|
+
return mt((this._observers.get(t) || J()).values()).forEach((n) => n(...e));
|
|
1316
1316
|
}
|
|
1317
1317
|
destroy() {
|
|
1318
|
-
this._observers =
|
|
1318
|
+
this._observers = J();
|
|
1319
1319
|
}
|
|
1320
1320
|
}
|
|
1321
|
-
const
|
|
1321
|
+
const at = Math.floor, Wt = Math.abs, pi = (i, t) => i < t ? i : t, Ct = (i, t) => i > t ? i : t, xn = (i) => i !== 0 ? i < 0 : 1 / i < 0, Je = 1, He = 2, ue = 4, de = 8, Bn = 32, _i = 64, qt = 128, Fn = 31, qe = 63, Rt = 127, Pn = 2147483647, Wn = Number.isInteger || ((i) => typeof i == "number" && isFinite(i) && at(i) === i), Kn = (i) => i.toLowerCase(), Gn = /^\s*/g, Jn = (i) => i.replace(Gn, ""), Hn = /([A-Z])/g, ze = (i, t) => Jn(i.replace(Hn, (e) => `${t}${Kn(e)}`)), qn = (i) => {
|
|
1322
1322
|
const t = unescape(encodeURIComponent(i)), e = t.length, n = new Uint8Array(e);
|
|
1323
1323
|
for (let s = 0; s < e; s++)
|
|
1324
1324
|
n[s] = /** @type {number} */
|
|
1325
1325
|
t.codePointAt(s);
|
|
1326
1326
|
return n;
|
|
1327
|
-
},
|
|
1327
|
+
}, Dt = (
|
|
1328
1328
|
/** @type {TextEncoder} */
|
|
1329
1329
|
typeof TextEncoder != "undefined" ? new TextEncoder() : null
|
|
1330
|
-
), zn = (i) =>
|
|
1331
|
-
let
|
|
1332
|
-
|
|
1333
|
-
class
|
|
1330
|
+
), zn = (i) => Dt.encode(i), Yn = Dt ? zn : qn;
|
|
1331
|
+
let fe = typeof TextDecoder == "undefined" ? null : new TextDecoder("utf-8", { fatal: !0, ignoreBOM: !0 });
|
|
1332
|
+
fe && fe.decode(new Uint8Array()).length === 1 && (fe = null);
|
|
1333
|
+
class $t {
|
|
1334
1334
|
constructor() {
|
|
1335
1335
|
this.cpos = 0, this.cbuf = new Uint8Array(100), this.bufs = [];
|
|
1336
1336
|
}
|
|
1337
1337
|
}
|
|
1338
|
-
const
|
|
1338
|
+
const Te = () => new $t(), Xn = (i) => {
|
|
1339
1339
|
let t = i.cpos;
|
|
1340
1340
|
for (let e = 0; e < i.bufs.length; e++)
|
|
1341
1341
|
t += i.bufs[e].length;
|
|
1342
1342
|
return t;
|
|
1343
|
-
},
|
|
1343
|
+
}, X = (i) => {
|
|
1344
1344
|
const t = new Uint8Array(Xn(i));
|
|
1345
1345
|
let e = 0;
|
|
1346
1346
|
for (let n = 0; n < i.bufs.length; n++) {
|
|
@@ -1350,86 +1350,86 @@ const Le = () => new jt(), Xn = (i) => {
|
|
|
1350
1350
|
return t.set(new Uint8Array(i.cbuf.buffer, 0, i.cpos), e), t;
|
|
1351
1351
|
}, Zn = (i, t) => {
|
|
1352
1352
|
const e = i.cbuf.length;
|
|
1353
|
-
e - i.cpos < t && (i.bufs.push(new Uint8Array(i.cbuf.buffer, 0, i.cpos)), i.cbuf = new Uint8Array(
|
|
1354
|
-
},
|
|
1353
|
+
e - i.cpos < t && (i.bufs.push(new Uint8Array(i.cbuf.buffer, 0, i.cpos)), i.cbuf = new Uint8Array(Ct(e, t) * 2), i.cpos = 0);
|
|
1354
|
+
}, L = (i, t) => {
|
|
1355
1355
|
const e = i.cbuf.length;
|
|
1356
1356
|
i.cpos === e && (i.bufs.push(i.cbuf), i.cbuf = new Uint8Array(e * 2), i.cpos = 0), i.cbuf[i.cpos++] = t;
|
|
1357
|
-
},
|
|
1358
|
-
for (; t >
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
},
|
|
1357
|
+
}, Ee = L, E = (i, t) => {
|
|
1358
|
+
for (; t > Rt; )
|
|
1359
|
+
L(i, qt | Rt & t), t = at(t / 128);
|
|
1360
|
+
L(i, Rt & t);
|
|
1361
|
+
}, De = (i, t) => {
|
|
1362
1362
|
const e = xn(t);
|
|
1363
|
-
for (e && (t = -t),
|
|
1364
|
-
|
|
1365
|
-
},
|
|
1363
|
+
for (e && (t = -t), L(i, (t > qe ? qt : 0) | (e ? _i : 0) | qe & t), t = at(t / 64); t > 0; )
|
|
1364
|
+
L(i, (t > Rt ? qt : 0) | Rt & t), t = at(t / 128);
|
|
1365
|
+
}, ke = new Uint8Array(3e4), Qn = ke.length / 3, ts = (i, t) => {
|
|
1366
1366
|
if (t.length < Qn) {
|
|
1367
|
-
const e =
|
|
1368
|
-
|
|
1367
|
+
const e = Dt.encodeInto(t, ke).written || 0;
|
|
1368
|
+
E(i, e);
|
|
1369
1369
|
for (let n = 0; n < e; n++)
|
|
1370
|
-
|
|
1370
|
+
L(i, ke[n]);
|
|
1371
1371
|
} else
|
|
1372
1372
|
x(i, Yn(t));
|
|
1373
1373
|
}, es = (i, t) => {
|
|
1374
1374
|
const e = unescape(encodeURIComponent(t)), n = e.length;
|
|
1375
|
-
|
|
1375
|
+
E(i, n);
|
|
1376
1376
|
for (let s = 0; s < n; s++)
|
|
1377
|
-
|
|
1377
|
+
L(
|
|
1378
1378
|
i,
|
|
1379
1379
|
/** @type {number} */
|
|
1380
1380
|
e.codePointAt(s)
|
|
1381
1381
|
);
|
|
1382
|
-
},
|
|
1383
|
-
|
|
1382
|
+
}, gt = Dt && /** @type {any} */
|
|
1383
|
+
Dt.encodeInto ? ts : es, Me = (i, t) => {
|
|
1384
1384
|
const e = i.cbuf.length, n = i.cpos, s = pi(e - n, t.length), r = t.length - s;
|
|
1385
|
-
i.cbuf.set(t.subarray(0, s), n), i.cpos += s, r > 0 && (i.bufs.push(i.cbuf), i.cbuf = new Uint8Array(
|
|
1385
|
+
i.cbuf.set(t.subarray(0, s), n), i.cpos += s, r > 0 && (i.bufs.push(i.cbuf), i.cbuf = new Uint8Array(Ct(e * 2, r)), i.cbuf.set(t.subarray(s)), i.cpos = r);
|
|
1386
1386
|
}, x = (i, t) => {
|
|
1387
|
-
|
|
1388
|
-
},
|
|
1387
|
+
E(i, t.byteLength), Me(i, t);
|
|
1388
|
+
}, Ne = (i, t) => {
|
|
1389
1389
|
Zn(i, t);
|
|
1390
1390
|
const e = new DataView(i.cbuf.buffer, i.cpos, t);
|
|
1391
1391
|
return i.cpos += t, e;
|
|
1392
|
-
}, is = (i, t) =>
|
|
1392
|
+
}, is = (i, t) => Ne(i, 4).setFloat32(0, t, !1), ns = (i, t) => Ne(i, 8).setFloat64(0, t, !1), ss = (i, t) => (
|
|
1393
1393
|
/** @type {any} */
|
|
1394
|
-
|
|
1395
|
-
), Ye = new DataView(new ArrayBuffer(4)), rs = (i) => (Ye.setFloat32(0, i), Ye.getFloat32(0) === i),
|
|
1394
|
+
Ne(i, 8).setBigInt64(0, t, !1)
|
|
1395
|
+
), Ye = new DataView(new ArrayBuffer(4)), rs = (i) => (Ye.setFloat32(0, i), Ye.getFloat32(0) === i), Mt = (i, t) => {
|
|
1396
1396
|
switch (typeof t) {
|
|
1397
1397
|
case "string":
|
|
1398
|
-
|
|
1398
|
+
L(i, 119), gt(i, t);
|
|
1399
1399
|
break;
|
|
1400
1400
|
case "number":
|
|
1401
|
-
Wn(t) &&
|
|
1401
|
+
Wn(t) && Wt(t) <= Pn ? (L(i, 125), De(i, t)) : rs(t) ? (L(i, 124), is(i, t)) : (L(i, 123), ns(i, t));
|
|
1402
1402
|
break;
|
|
1403
1403
|
case "bigint":
|
|
1404
|
-
|
|
1404
|
+
L(i, 122), ss(i, t);
|
|
1405
1405
|
break;
|
|
1406
1406
|
case "object":
|
|
1407
1407
|
if (t === null)
|
|
1408
|
-
|
|
1408
|
+
L(i, 126);
|
|
1409
1409
|
else if (jn(t)) {
|
|
1410
|
-
|
|
1410
|
+
L(i, 117), E(i, t.length);
|
|
1411
1411
|
for (let e = 0; e < t.length; e++)
|
|
1412
|
-
|
|
1412
|
+
Mt(i, t[e]);
|
|
1413
1413
|
} else if (t instanceof Uint8Array)
|
|
1414
|
-
|
|
1414
|
+
L(i, 116), x(i, t);
|
|
1415
1415
|
else {
|
|
1416
|
-
|
|
1416
|
+
L(i, 118);
|
|
1417
1417
|
const e = Object.keys(t);
|
|
1418
|
-
|
|
1418
|
+
E(i, e.length);
|
|
1419
1419
|
for (let n = 0; n < e.length; n++) {
|
|
1420
1420
|
const s = e[n];
|
|
1421
|
-
|
|
1421
|
+
gt(i, s), Mt(i, t[s]);
|
|
1422
1422
|
}
|
|
1423
1423
|
}
|
|
1424
1424
|
break;
|
|
1425
1425
|
case "boolean":
|
|
1426
|
-
|
|
1426
|
+
L(i, t ? 120 : 121);
|
|
1427
1427
|
break;
|
|
1428
1428
|
default:
|
|
1429
|
-
|
|
1429
|
+
L(i, 127);
|
|
1430
1430
|
}
|
|
1431
1431
|
};
|
|
1432
|
-
class Xe extends
|
|
1432
|
+
class Xe extends $t {
|
|
1433
1433
|
/**
|
|
1434
1434
|
* @param {function(Encoder, T):void} writer
|
|
1435
1435
|
*/
|
|
@@ -1440,15 +1440,15 @@ class Xe extends jt {
|
|
|
1440
1440
|
* @param {T} v
|
|
1441
1441
|
*/
|
|
1442
1442
|
write(t) {
|
|
1443
|
-
this.s === t ? this.count++ : (this.count > 0 &&
|
|
1443
|
+
this.s === t ? this.count++ : (this.count > 0 && E(this, this.count - 1), this.count = 1, this.w(this, t), this.s = t);
|
|
1444
1444
|
}
|
|
1445
1445
|
}
|
|
1446
1446
|
const Ze = (i) => {
|
|
1447
|
-
i.count > 0 && (
|
|
1447
|
+
i.count > 0 && (De(i.encoder, i.count === 1 ? i.s : -i.s), i.count > 1 && E(i.encoder, i.count - 2));
|
|
1448
1448
|
};
|
|
1449
|
-
class
|
|
1449
|
+
class Kt {
|
|
1450
1450
|
constructor() {
|
|
1451
|
-
this.encoder = new
|
|
1451
|
+
this.encoder = new $t(), this.s = 0, this.count = 0;
|
|
1452
1452
|
}
|
|
1453
1453
|
/**
|
|
1454
1454
|
* @param {number} v
|
|
@@ -1462,18 +1462,18 @@ class Wt {
|
|
|
1462
1462
|
* Note that this should only be called once.
|
|
1463
1463
|
*/
|
|
1464
1464
|
toUint8Array() {
|
|
1465
|
-
return Ze(this),
|
|
1465
|
+
return Ze(this), X(this.encoder);
|
|
1466
1466
|
}
|
|
1467
1467
|
}
|
|
1468
1468
|
const Qe = (i) => {
|
|
1469
1469
|
if (i.count > 0) {
|
|
1470
1470
|
const t = i.diff * 2 + (i.count === 1 ? 0 : 1);
|
|
1471
|
-
|
|
1471
|
+
De(i.encoder, t), i.count > 1 && E(i.encoder, i.count - 2);
|
|
1472
1472
|
}
|
|
1473
1473
|
};
|
|
1474
|
-
class
|
|
1474
|
+
class ge {
|
|
1475
1475
|
constructor() {
|
|
1476
|
-
this.encoder = new
|
|
1476
|
+
this.encoder = new $t(), this.s = 0, this.count = 0, this.diff = 0;
|
|
1477
1477
|
}
|
|
1478
1478
|
/**
|
|
1479
1479
|
* @param {number} v
|
|
@@ -1487,12 +1487,12 @@ class fe {
|
|
|
1487
1487
|
* Note that this should only be called once.
|
|
1488
1488
|
*/
|
|
1489
1489
|
toUint8Array() {
|
|
1490
|
-
return Qe(this),
|
|
1490
|
+
return Qe(this), X(this.encoder);
|
|
1491
1491
|
}
|
|
1492
1492
|
}
|
|
1493
1493
|
class os {
|
|
1494
1494
|
constructor() {
|
|
1495
|
-
this.sarr = [], this.s = "", this.lensE = new
|
|
1495
|
+
this.sarr = [], this.s = "", this.lensE = new Kt();
|
|
1496
1496
|
}
|
|
1497
1497
|
/**
|
|
1498
1498
|
* @param {string} string
|
|
@@ -1501,14 +1501,14 @@ class os {
|
|
|
1501
1501
|
this.s += t, this.s.length > 19 && (this.sarr.push(this.s), this.s = ""), this.lensE.write(t.length);
|
|
1502
1502
|
}
|
|
1503
1503
|
toUint8Array() {
|
|
1504
|
-
const t = new
|
|
1505
|
-
return this.sarr.push(this.s), this.s = "",
|
|
1504
|
+
const t = new $t();
|
|
1505
|
+
return this.sarr.push(this.s), this.s = "", gt(t, this.sarr.join("")), Me(t, this.lensE.toUint8Array()), X(t);
|
|
1506
1506
|
}
|
|
1507
1507
|
}
|
|
1508
|
-
const
|
|
1509
|
-
throw
|
|
1510
|
-
},
|
|
1511
|
-
throw
|
|
1508
|
+
const wt = (i) => new Error(i), H = () => {
|
|
1509
|
+
throw wt("Method unimplemented");
|
|
1510
|
+
}, ht = () => {
|
|
1511
|
+
throw wt("Unexpected case");
|
|
1512
1512
|
}, cs = crypto.getRandomValues.bind(crypto), mi = () => cs(new Uint32Array(1))[0], ls = "10000000-1000-4000-8000" + -1e11, as = () => ls.replace(
|
|
1513
1513
|
/[018]/g,
|
|
1514
1514
|
/** @param {number} c */
|
|
@@ -1560,37 +1560,37 @@ const ds = wi, fs = Object.assign, gs = Object.keys, ps = (i, t) => {
|
|
|
1560
1560
|
(typeof e == "object" || typeof e == "function") && yi(i[t]);
|
|
1561
1561
|
}
|
|
1562
1562
|
return bs(i);
|
|
1563
|
-
},
|
|
1563
|
+
}, Ve = (i, t, e = 0) => {
|
|
1564
1564
|
try {
|
|
1565
1565
|
for (; e < i.length; e++)
|
|
1566
1566
|
i[e](...t);
|
|
1567
1567
|
} finally {
|
|
1568
|
-
e < i.length &&
|
|
1568
|
+
e < i.length && Ve(i, t, e + 1);
|
|
1569
1569
|
}
|
|
1570
|
-
}, Ss = (i, t) => t.includes(i),
|
|
1571
|
-
let
|
|
1570
|
+
}, Ss = (i, t) => t.includes(i), Nt = typeof process != "undefined" && process.release && /node|io\.js/.test(process.release.name) && Object.prototype.toString.call(typeof process != "undefined" ? process : 0) === "[object process]";
|
|
1571
|
+
let G;
|
|
1572
1572
|
const Cs = () => {
|
|
1573
|
-
if (
|
|
1574
|
-
if (
|
|
1575
|
-
|
|
1573
|
+
if (G === void 0)
|
|
1574
|
+
if (Nt) {
|
|
1575
|
+
G = J();
|
|
1576
1576
|
const i = process.argv;
|
|
1577
1577
|
let t = null;
|
|
1578
1578
|
for (let e = 0; e < i.length; e++) {
|
|
1579
1579
|
const n = i[e];
|
|
1580
|
-
n[0] === "-" ? (t !== null &&
|
|
1580
|
+
n[0] === "-" ? (t !== null && G.set(t, ""), t = n) : t !== null && (G.set(t, n), t = null);
|
|
1581
1581
|
}
|
|
1582
|
-
t !== null &&
|
|
1583
|
-
} else typeof location == "object" ? (
|
|
1582
|
+
t !== null && G.set(t, "");
|
|
1583
|
+
} else typeof location == "object" ? (G = J(), (location.search || "?").slice(1).split("&").forEach((i) => {
|
|
1584
1584
|
if (i.length !== 0) {
|
|
1585
1585
|
const [t, e] = i.split("=");
|
|
1586
|
-
|
|
1586
|
+
G.set(`--${ze(t, "-")}`, e), G.set(`-${ze(t, "-")}`, e);
|
|
1587
1587
|
}
|
|
1588
|
-
})) :
|
|
1589
|
-
return
|
|
1590
|
-
},
|
|
1588
|
+
})) : G = J();
|
|
1589
|
+
return G;
|
|
1590
|
+
}, ve = (i) => Cs().has(i), zt = (i) => ei(Nt ? process.env[i.toUpperCase().replaceAll("-", "_")] : ds.getItem(i)), bi = (i) => ve("--" + i) || zt(i) !== null;
|
|
1591
1591
|
bi("production");
|
|
1592
|
-
const Es =
|
|
1593
|
-
!bi("no-color") && (!
|
|
1592
|
+
const Es = Nt && Ss(process.env.FORCE_COLOR, ["true", "1", "2"]), ks = Es || !ve("--no-colors") && // @todo deprecate --no-colors
|
|
1593
|
+
!bi("no-color") && (!Nt || process.stdout.isTTY) && (!Nt || ve("--color") || zt("COLORTERM") !== null || (zt("TERM") || "").includes("color"));
|
|
1594
1594
|
class vs {
|
|
1595
1595
|
/**
|
|
1596
1596
|
* @param {L} left
|
|
@@ -1600,9 +1600,9 @@ class vs {
|
|
|
1600
1600
|
this.left = t, this.right = e;
|
|
1601
1601
|
}
|
|
1602
1602
|
}
|
|
1603
|
-
const
|
|
1603
|
+
const z = (i, t) => new vs(i, t);
|
|
1604
1604
|
typeof DOMParser != "undefined" && new DOMParser();
|
|
1605
|
-
const Is = (i) => Vn(i, (t, e) => `${e}:${t};`).join(""),
|
|
1605
|
+
const Is = (i) => Vn(i, (t, e) => `${e}:${t};`).join(""), tt = Symbol, Si = tt(), Ci = tt(), Os = tt(), Rs = tt(), As = tt(), Ei = tt(), Ls = tt(), Ue = tt(), Ts = tt(), Ds = (i) => {
|
|
1606
1606
|
var s;
|
|
1607
1607
|
i.length === 1 && ((s = i[0]) == null ? void 0 : s.constructor) === Function && (i = /** @type {Array<string|Symbol|Object|number>} */
|
|
1608
1608
|
/** @type {[function]} */
|
|
@@ -1624,22 +1624,22 @@ const Is = (i) => Vn(i, (t, e) => `${e}:${t};`).join(""), Q = Symbol, Si = Q(),
|
|
|
1624
1624
|
}
|
|
1625
1625
|
return e;
|
|
1626
1626
|
}, Ms = {
|
|
1627
|
-
[Si]:
|
|
1628
|
-
[Ci]:
|
|
1629
|
-
[Os]:
|
|
1630
|
-
[As]:
|
|
1631
|
-
[Rs]:
|
|
1632
|
-
[Ei]:
|
|
1633
|
-
[Ls]:
|
|
1634
|
-
[
|
|
1627
|
+
[Si]: z("font-weight", "bold"),
|
|
1628
|
+
[Ci]: z("font-weight", "normal"),
|
|
1629
|
+
[Os]: z("color", "blue"),
|
|
1630
|
+
[As]: z("color", "green"),
|
|
1631
|
+
[Rs]: z("color", "grey"),
|
|
1632
|
+
[Ei]: z("color", "red"),
|
|
1633
|
+
[Ls]: z("color", "purple"),
|
|
1634
|
+
[Ue]: z("color", "orange"),
|
|
1635
1635
|
// not well supported in chrome when debugging node with inspector - TODO: deprecate
|
|
1636
|
-
[Ts]:
|
|
1636
|
+
[Ts]: z("color", "black")
|
|
1637
1637
|
}, Ns = (i) => {
|
|
1638
1638
|
var o;
|
|
1639
1639
|
i.length === 1 && ((o = i[0]) == null ? void 0 : o.constructor) === Function && (i = /** @type {Array<string|Symbol|Object|number>} */
|
|
1640
1640
|
/** @type {[function]} */
|
|
1641
1641
|
i[0]());
|
|
1642
|
-
const t = [], e = [], n =
|
|
1642
|
+
const t = [], e = [], n = J();
|
|
1643
1643
|
let s = [], r = 0;
|
|
1644
1644
|
for (; r < i.length; r++) {
|
|
1645
1645
|
const c = i[r], l = Ms[c];
|
|
@@ -1663,8 +1663,8 @@ const Is = (i) => Vn(i, (t, e) => `${e}:${t};`).join(""), Q = Symbol, Si = Q(),
|
|
|
1663
1663
|
}, ki = ks ? Ns : Ds, Vs = (...i) => {
|
|
1664
1664
|
console.log(...ki(i)), vi.forEach((t) => t.print(i));
|
|
1665
1665
|
}, Us = (...i) => {
|
|
1666
|
-
console.warn(...ki(i)), i.unshift(
|
|
1667
|
-
}, vi =
|
|
1666
|
+
console.warn(...ki(i)), i.unshift(Ue), vi.forEach((t) => t.print(i));
|
|
1667
|
+
}, vi = _t(), Ii = (i) => ({
|
|
1668
1668
|
/**
|
|
1669
1669
|
* @return {IterableIterator<T>}
|
|
1670
1670
|
*/
|
|
@@ -1679,7 +1679,7 @@ const Is = (i) => Vn(i, (t, e) => `${e}:${t};`).join(""), Q = Symbol, Si = Q(),
|
|
|
1679
1679
|
e = i.next();
|
|
1680
1680
|
while (!e.done && !t(e.value));
|
|
1681
1681
|
return e;
|
|
1682
|
-
}),
|
|
1682
|
+
}), pe = (i, t) => Ii(() => {
|
|
1683
1683
|
const { done: e, value: n } = i.next();
|
|
1684
1684
|
return { done: e, value: e ? void 0 : t(n) };
|
|
1685
1685
|
});
|
|
@@ -1709,7 +1709,7 @@ const Oi = (i, t, e) => t.clients.forEach((n, s) => {
|
|
|
1709
1709
|
}), Bs = (i, t) => {
|
|
1710
1710
|
let e = 0, n = i.length - 1;
|
|
1711
1711
|
for (; e <= n; ) {
|
|
1712
|
-
const s =
|
|
1712
|
+
const s = at((e + n) / 2), r = i[s], o = r.clock;
|
|
1713
1713
|
if (o <= t) {
|
|
1714
1714
|
if (t < o + r.len)
|
|
1715
1715
|
return s;
|
|
@@ -1727,27 +1727,27 @@ const Oi = (i, t, e) => t.clients.forEach((n, s) => {
|
|
|
1727
1727
|
let e, n;
|
|
1728
1728
|
for (e = 1, n = 1; e < t.length; e++) {
|
|
1729
1729
|
const s = t[n - 1], r = t[e];
|
|
1730
|
-
s.clock + s.len >= r.clock ? s.len =
|
|
1730
|
+
s.clock + s.len >= r.clock ? s.len = Ct(s.len, r.clock + r.len - s.clock) : (n < e && (t[n] = r), n++);
|
|
1731
1731
|
}
|
|
1732
1732
|
t.length = n;
|
|
1733
1733
|
});
|
|
1734
1734
|
}, Li = (i, t, e, n) => {
|
|
1735
|
-
|
|
1735
|
+
St(i.clients, t, () => (
|
|
1736
1736
|
/** @type {Array<DeleteItem>} */
|
|
1737
1737
|
[]
|
|
1738
1738
|
)).push(new $s(e, n));
|
|
1739
1739
|
}, Fs = (i, t) => {
|
|
1740
|
-
|
|
1741
|
-
i.resetDsCurVal(),
|
|
1740
|
+
E(i.restEncoder, t.clients.size), mt(t.clients.entries()).sort((e, n) => n[0] - e[0]).forEach(([e, n]) => {
|
|
1741
|
+
i.resetDsCurVal(), E(i.restEncoder, e);
|
|
1742
1742
|
const s = n.length;
|
|
1743
|
-
|
|
1743
|
+
E(i.restEncoder, s);
|
|
1744
1744
|
for (let r = 0; r < s; r++) {
|
|
1745
1745
|
const o = n[r];
|
|
1746
1746
|
i.writeDsClock(o.clock), i.writeDsLen(o.len);
|
|
1747
1747
|
}
|
|
1748
1748
|
});
|
|
1749
1749
|
}, Ti = mi;
|
|
1750
|
-
class
|
|
1750
|
+
class Et extends $n {
|
|
1751
1751
|
/**
|
|
1752
1752
|
* @param {DocOpts} opts configuration
|
|
1753
1753
|
*/
|
|
@@ -1776,7 +1776,7 @@ class Ct extends $n {
|
|
|
1776
1776
|
*/
|
|
1777
1777
|
load() {
|
|
1778
1778
|
const t = this._item;
|
|
1779
|
-
t !== null && !this.shouldLoad &&
|
|
1779
|
+
t !== null && !this.shouldLoad && k(
|
|
1780
1780
|
/** @type {any} */
|
|
1781
1781
|
t.parent.doc,
|
|
1782
1782
|
(e) => {
|
|
@@ -1790,7 +1790,7 @@ class Ct extends $n {
|
|
|
1790
1790
|
return this.subdocs;
|
|
1791
1791
|
}
|
|
1792
1792
|
getSubdocGuids() {
|
|
1793
|
-
return new Set(
|
|
1793
|
+
return new Set(mt(this.subdocs).map((t) => t.guid));
|
|
1794
1794
|
}
|
|
1795
1795
|
/**
|
|
1796
1796
|
* Changes that happen inside of a transaction are bundled. This means that
|
|
@@ -1806,7 +1806,7 @@ class Ct extends $n {
|
|
|
1806
1806
|
* @public
|
|
1807
1807
|
*/
|
|
1808
1808
|
transact(t, e = null) {
|
|
1809
|
-
return
|
|
1809
|
+
return k(this, t, e);
|
|
1810
1810
|
}
|
|
1811
1811
|
/**
|
|
1812
1812
|
* Define a shared data type.
|
|
@@ -1837,14 +1837,14 @@ class Ct extends $n {
|
|
|
1837
1837
|
*/
|
|
1838
1838
|
get(t, e = (
|
|
1839
1839
|
/** @type {any} */
|
|
1840
|
-
|
|
1840
|
+
N
|
|
1841
1841
|
)) {
|
|
1842
|
-
const n =
|
|
1842
|
+
const n = St(this.share, t, () => {
|
|
1843
1843
|
const r = new e();
|
|
1844
1844
|
return r._integrate(this, null), r;
|
|
1845
1845
|
}), s = n.constructor;
|
|
1846
|
-
if (e !==
|
|
1847
|
-
if (s ===
|
|
1846
|
+
if (e !== N && s !== e)
|
|
1847
|
+
if (s === N) {
|
|
1848
1848
|
const r = new e();
|
|
1849
1849
|
r._map = n._map, n._map.forEach(
|
|
1850
1850
|
/** @param {Item?} n */
|
|
@@ -1874,7 +1874,7 @@ class Ct extends $n {
|
|
|
1874
1874
|
getArray(t = "") {
|
|
1875
1875
|
return (
|
|
1876
1876
|
/** @type {YArray<T>} */
|
|
1877
|
-
this.get(t,
|
|
1877
|
+
this.get(t, At)
|
|
1878
1878
|
);
|
|
1879
1879
|
}
|
|
1880
1880
|
/**
|
|
@@ -1884,7 +1884,7 @@ class Ct extends $n {
|
|
|
1884
1884
|
* @public
|
|
1885
1885
|
*/
|
|
1886
1886
|
getText(t = "") {
|
|
1887
|
-
return this.get(t,
|
|
1887
|
+
return this.get(t, Qt);
|
|
1888
1888
|
}
|
|
1889
1889
|
/**
|
|
1890
1890
|
* @template T
|
|
@@ -1896,7 +1896,7 @@ class Ct extends $n {
|
|
|
1896
1896
|
getMap(t = "") {
|
|
1897
1897
|
return (
|
|
1898
1898
|
/** @type {YMap<T>} */
|
|
1899
|
-
this.get(t,
|
|
1899
|
+
this.get(t, Zt)
|
|
1900
1900
|
);
|
|
1901
1901
|
}
|
|
1902
1902
|
/**
|
|
@@ -1908,7 +1908,7 @@ class Ct extends $n {
|
|
|
1908
1908
|
getXmlElement(t = "") {
|
|
1909
1909
|
return (
|
|
1910
1910
|
/** @type {YXmlElement<{[key:string]:string}>} */
|
|
1911
|
-
this.get(t,
|
|
1911
|
+
this.get(t, jt)
|
|
1912
1912
|
);
|
|
1913
1913
|
}
|
|
1914
1914
|
/**
|
|
@@ -1918,7 +1918,7 @@ class Ct extends $n {
|
|
|
1918
1918
|
* @public
|
|
1919
1919
|
*/
|
|
1920
1920
|
getXmlFragment(t = "") {
|
|
1921
|
-
return this.get(t,
|
|
1921
|
+
return this.get(t, yt);
|
|
1922
1922
|
}
|
|
1923
1923
|
/**
|
|
1924
1924
|
* Converts the entire document into a js object, recursively traversing each yjs type
|
|
@@ -1938,7 +1938,7 @@ class Ct extends $n {
|
|
|
1938
1938
|
* Emit `destroy` event and unregister all event handlers.
|
|
1939
1939
|
*/
|
|
1940
1940
|
destroy() {
|
|
1941
|
-
this.isDestroyed = !0,
|
|
1941
|
+
this.isDestroyed = !0, mt(this.subdocs).forEach((e) => e.destroy());
|
|
1942
1942
|
const t = this._item;
|
|
1943
1943
|
if (t !== null) {
|
|
1944
1944
|
this._item = null;
|
|
@@ -1946,7 +1946,7 @@ class Ct extends $n {
|
|
|
1946
1946
|
/** @type {ContentDoc} */
|
|
1947
1947
|
t.content
|
|
1948
1948
|
);
|
|
1949
|
-
e.doc = new
|
|
1949
|
+
e.doc = new Et({ guid: this.guid, ...e.opts, shouldLoad: !1 }), e.doc._item = t, k(
|
|
1950
1950
|
/** @type {any} */
|
|
1951
1951
|
t.parent.doc,
|
|
1952
1952
|
(n) => {
|
|
@@ -1962,10 +1962,10 @@ class Ct extends $n {
|
|
|
1962
1962
|
}
|
|
1963
1963
|
class Ps {
|
|
1964
1964
|
constructor() {
|
|
1965
|
-
this.restEncoder =
|
|
1965
|
+
this.restEncoder = Te();
|
|
1966
1966
|
}
|
|
1967
1967
|
toUint8Array() {
|
|
1968
|
-
return
|
|
1968
|
+
return X(this.restEncoder);
|
|
1969
1969
|
}
|
|
1970
1970
|
resetDsCurVal() {
|
|
1971
1971
|
}
|
|
@@ -1973,13 +1973,13 @@ class Ps {
|
|
|
1973
1973
|
* @param {number} clock
|
|
1974
1974
|
*/
|
|
1975
1975
|
writeDsClock(t) {
|
|
1976
|
-
|
|
1976
|
+
E(this.restEncoder, t);
|
|
1977
1977
|
}
|
|
1978
1978
|
/**
|
|
1979
1979
|
* @param {number} len
|
|
1980
1980
|
*/
|
|
1981
1981
|
writeDsLen(t) {
|
|
1982
|
-
|
|
1982
|
+
E(this.restEncoder, t);
|
|
1983
1983
|
}
|
|
1984
1984
|
}
|
|
1985
1985
|
class Ws extends Ps {
|
|
@@ -1987,44 +1987,44 @@ class Ws extends Ps {
|
|
|
1987
1987
|
* @param {ID} id
|
|
1988
1988
|
*/
|
|
1989
1989
|
writeLeftID(t) {
|
|
1990
|
-
|
|
1990
|
+
E(this.restEncoder, t.client), E(this.restEncoder, t.clock);
|
|
1991
1991
|
}
|
|
1992
1992
|
/**
|
|
1993
1993
|
* @param {ID} id
|
|
1994
1994
|
*/
|
|
1995
1995
|
writeRightID(t) {
|
|
1996
|
-
|
|
1996
|
+
E(this.restEncoder, t.client), E(this.restEncoder, t.clock);
|
|
1997
1997
|
}
|
|
1998
1998
|
/**
|
|
1999
1999
|
* Use writeClient and writeClock instead of writeID if possible.
|
|
2000
2000
|
* @param {number} client
|
|
2001
2001
|
*/
|
|
2002
2002
|
writeClient(t) {
|
|
2003
|
-
|
|
2003
|
+
E(this.restEncoder, t);
|
|
2004
2004
|
}
|
|
2005
2005
|
/**
|
|
2006
2006
|
* @param {number} info An unsigned 8-bit integer
|
|
2007
2007
|
*/
|
|
2008
2008
|
writeInfo(t) {
|
|
2009
|
-
|
|
2009
|
+
Ee(this.restEncoder, t);
|
|
2010
2010
|
}
|
|
2011
2011
|
/**
|
|
2012
2012
|
* @param {string} s
|
|
2013
2013
|
*/
|
|
2014
2014
|
writeString(t) {
|
|
2015
|
-
|
|
2015
|
+
gt(this.restEncoder, t);
|
|
2016
2016
|
}
|
|
2017
2017
|
/**
|
|
2018
2018
|
* @param {boolean} isYKey
|
|
2019
2019
|
*/
|
|
2020
2020
|
writeParentInfo(t) {
|
|
2021
|
-
|
|
2021
|
+
E(this.restEncoder, t ? 1 : 0);
|
|
2022
2022
|
}
|
|
2023
2023
|
/**
|
|
2024
2024
|
* @param {number} info An unsigned 8-bit integer
|
|
2025
2025
|
*/
|
|
2026
2026
|
writeTypeRef(t) {
|
|
2027
|
-
|
|
2027
|
+
E(this.restEncoder, t);
|
|
2028
2028
|
}
|
|
2029
2029
|
/**
|
|
2030
2030
|
* Write len of a struct - well suited for Opt RLE encoder.
|
|
@@ -2032,13 +2032,13 @@ class Ws extends Ps {
|
|
|
2032
2032
|
* @param {number} len
|
|
2033
2033
|
*/
|
|
2034
2034
|
writeLen(t) {
|
|
2035
|
-
|
|
2035
|
+
E(this.restEncoder, t);
|
|
2036
2036
|
}
|
|
2037
2037
|
/**
|
|
2038
2038
|
* @param {any} any
|
|
2039
2039
|
*/
|
|
2040
2040
|
writeAny(t) {
|
|
2041
|
-
|
|
2041
|
+
Mt(this.restEncoder, t);
|
|
2042
2042
|
}
|
|
2043
2043
|
/**
|
|
2044
2044
|
* @param {Uint8Array} buf
|
|
@@ -2050,21 +2050,21 @@ class Ws extends Ps {
|
|
|
2050
2050
|
* @param {any} embed
|
|
2051
2051
|
*/
|
|
2052
2052
|
writeJSON(t) {
|
|
2053
|
-
|
|
2053
|
+
gt(this.restEncoder, JSON.stringify(t));
|
|
2054
2054
|
}
|
|
2055
2055
|
/**
|
|
2056
2056
|
* @param {string} key
|
|
2057
2057
|
*/
|
|
2058
2058
|
writeKey(t) {
|
|
2059
|
-
|
|
2059
|
+
gt(this.restEncoder, t);
|
|
2060
2060
|
}
|
|
2061
2061
|
}
|
|
2062
2062
|
class Ks {
|
|
2063
2063
|
constructor() {
|
|
2064
|
-
this.restEncoder =
|
|
2064
|
+
this.restEncoder = Te(), this.dsCurrVal = 0;
|
|
2065
2065
|
}
|
|
2066
2066
|
toUint8Array() {
|
|
2067
|
-
return
|
|
2067
|
+
return X(this.restEncoder);
|
|
2068
2068
|
}
|
|
2069
2069
|
resetDsCurVal() {
|
|
2070
2070
|
this.dsCurrVal = 0;
|
|
@@ -2074,22 +2074,22 @@ class Ks {
|
|
|
2074
2074
|
*/
|
|
2075
2075
|
writeDsClock(t) {
|
|
2076
2076
|
const e = t - this.dsCurrVal;
|
|
2077
|
-
this.dsCurrVal = t,
|
|
2077
|
+
this.dsCurrVal = t, E(this.restEncoder, e);
|
|
2078
2078
|
}
|
|
2079
2079
|
/**
|
|
2080
2080
|
* @param {number} len
|
|
2081
2081
|
*/
|
|
2082
2082
|
writeDsLen(t) {
|
|
2083
|
-
t === 0 &&
|
|
2083
|
+
t === 0 && ht(), E(this.restEncoder, t - 1), this.dsCurrVal += t;
|
|
2084
2084
|
}
|
|
2085
2085
|
}
|
|
2086
2086
|
class Gs extends Ks {
|
|
2087
2087
|
constructor() {
|
|
2088
|
-
super(), this.keyMap = /* @__PURE__ */ new Map(), this.keyClock = 0, this.keyClockEncoder = new
|
|
2088
|
+
super(), this.keyMap = /* @__PURE__ */ new Map(), this.keyClock = 0, this.keyClockEncoder = new ge(), this.clientEncoder = new Kt(), this.leftClockEncoder = new ge(), this.rightClockEncoder = new ge(), this.infoEncoder = new Xe(Ee), this.stringEncoder = new os(), this.parentInfoEncoder = new Xe(Ee), this.typeRefEncoder = new Kt(), this.lenEncoder = new Kt();
|
|
2089
2089
|
}
|
|
2090
2090
|
toUint8Array() {
|
|
2091
|
-
const t =
|
|
2092
|
-
return
|
|
2091
|
+
const t = Te();
|
|
2092
|
+
return E(t, 0), x(t, this.keyClockEncoder.toUint8Array()), x(t, this.clientEncoder.toUint8Array()), x(t, this.leftClockEncoder.toUint8Array()), x(t, this.rightClockEncoder.toUint8Array()), x(t, X(this.infoEncoder)), x(t, this.stringEncoder.toUint8Array()), x(t, X(this.parentInfoEncoder)), x(t, this.typeRefEncoder.toUint8Array()), x(t, this.lenEncoder.toUint8Array()), Me(t, X(this.restEncoder)), X(t);
|
|
2093
2093
|
}
|
|
2094
2094
|
/**
|
|
2095
2095
|
* @param {ID} id
|
|
@@ -2145,7 +2145,7 @@ class Gs extends Ks {
|
|
|
2145
2145
|
* @param {any} any
|
|
2146
2146
|
*/
|
|
2147
2147
|
writeAny(t) {
|
|
2148
|
-
|
|
2148
|
+
Mt(this.restEncoder, t);
|
|
2149
2149
|
}
|
|
2150
2150
|
/**
|
|
2151
2151
|
* @param {Uint8Array} buf
|
|
@@ -2161,7 +2161,7 @@ class Gs extends Ks {
|
|
|
2161
2161
|
* @param {any} embed
|
|
2162
2162
|
*/
|
|
2163
2163
|
writeJSON(t) {
|
|
2164
|
-
|
|
2164
|
+
Mt(this.restEncoder, t);
|
|
2165
2165
|
}
|
|
2166
2166
|
/**
|
|
2167
2167
|
* Property keys are often reused. For example, in y-prosemirror the key `bold` might
|
|
@@ -2177,9 +2177,9 @@ class Gs extends Ks {
|
|
|
2177
2177
|
}
|
|
2178
2178
|
}
|
|
2179
2179
|
const Js = (i, t, e, n) => {
|
|
2180
|
-
n =
|
|
2181
|
-
const s =
|
|
2182
|
-
|
|
2180
|
+
n = Ct(n, t[0].id.clock);
|
|
2181
|
+
const s = Z(t, n);
|
|
2182
|
+
E(i.restEncoder, t.length - s), i.writeClient(e), E(i.restEncoder, n);
|
|
2183
2183
|
const r = t[s];
|
|
2184
2184
|
r.write(i, n - r.id.clock);
|
|
2185
2185
|
for (let o = s + 1; o < t.length; o++)
|
|
@@ -2188,9 +2188,9 @@ const Js = (i, t, e, n) => {
|
|
|
2188
2188
|
const n = /* @__PURE__ */ new Map();
|
|
2189
2189
|
e.forEach((s, r) => {
|
|
2190
2190
|
$(t, r) > s && n.set(r, s);
|
|
2191
|
-
}),
|
|
2191
|
+
}), je(t).forEach((s, r) => {
|
|
2192
2192
|
e.has(r) || n.set(r, 0);
|
|
2193
|
-
}),
|
|
2193
|
+
}), E(i.restEncoder, n.size), mt(n.entries()).sort((s, r) => r[0] - s[0]).forEach(([s, r]) => {
|
|
2194
2194
|
Js(
|
|
2195
2195
|
i,
|
|
2196
2196
|
/** @type {Array<GC|Item>} */
|
|
@@ -2208,8 +2208,8 @@ class zs {
|
|
|
2208
2208
|
const ni = () => new zs(), si = (i, t) => i.l.push(t), ri = (i, t) => {
|
|
2209
2209
|
const e = i.l, n = e.length;
|
|
2210
2210
|
i.l = e.filter((s) => t !== s), n === i.l.length && console.error("[yjs] Tried to remove event handler that doesn't exist.");
|
|
2211
|
-
}, Di = (i, t, e) =>
|
|
2212
|
-
class
|
|
2211
|
+
}, Di = (i, t, e) => Ve(i.l, [t, e]);
|
|
2212
|
+
class Gt {
|
|
2213
2213
|
/**
|
|
2214
2214
|
* @param {number} client client id
|
|
2215
2215
|
* @param {number} clock unique per client id, continuous number
|
|
@@ -2218,15 +2218,15 @@ class Kt {
|
|
|
2218
2218
|
this.client = t, this.clock = e;
|
|
2219
2219
|
}
|
|
2220
2220
|
}
|
|
2221
|
-
const
|
|
2221
|
+
const Bt = (i, t) => i === t || i !== null && t !== null && i.client === t.client && i.clock === t.clock, v = (i, t) => new Gt(i, t), Ys = (i) => {
|
|
2222
2222
|
for (const [t, e] of i.doc.share.entries())
|
|
2223
2223
|
if (e === i)
|
|
2224
2224
|
return t;
|
|
2225
|
-
throw
|
|
2226
|
-
},
|
|
2227
|
-
const e =
|
|
2225
|
+
throw ht();
|
|
2226
|
+
}, dt = (i, t) => t === void 0 ? !i.deleted : t.sv.has(i.id.client) && (t.sv.get(i.id.client) || 0) > i.id.clock && !Ri(t.ds, i.id), Ie = (i, t) => {
|
|
2227
|
+
const e = St(i.meta, Ie, _t), n = i.doc.store;
|
|
2228
2228
|
e.has(t) || (t.sv.forEach((s, r) => {
|
|
2229
|
-
s < $(n, r) &&
|
|
2229
|
+
s < $(n, r) && st(i, v(r, s));
|
|
2230
2230
|
}), Oi(i, t.ds, (s) => {
|
|
2231
2231
|
}), e.add(t));
|
|
2232
2232
|
};
|
|
@@ -2235,7 +2235,7 @@ class Xs {
|
|
|
2235
2235
|
this.clients = /* @__PURE__ */ new Map(), this.pendingStructs = null, this.pendingDs = null;
|
|
2236
2236
|
}
|
|
2237
2237
|
}
|
|
2238
|
-
const
|
|
2238
|
+
const je = (i) => {
|
|
2239
2239
|
const t = /* @__PURE__ */ new Map();
|
|
2240
2240
|
return i.clients.forEach((e, n) => {
|
|
2241
2241
|
const s = e[e.length - 1];
|
|
@@ -2254,14 +2254,14 @@ const Ue = (i) => {
|
|
|
2254
2254
|
else {
|
|
2255
2255
|
const n = e[e.length - 1];
|
|
2256
2256
|
if (n.id.clock + n.length !== t.id.clock)
|
|
2257
|
-
throw
|
|
2257
|
+
throw ht();
|
|
2258
2258
|
}
|
|
2259
2259
|
e.push(t);
|
|
2260
|
-
},
|
|
2260
|
+
}, Z = (i, t) => {
|
|
2261
2261
|
let e = 0, n = i.length - 1, s = i[n], r = s.id.clock;
|
|
2262
2262
|
if (r === t)
|
|
2263
2263
|
return n;
|
|
2264
|
-
let o =
|
|
2264
|
+
let o = at(t / (r + s.length - 1) * n);
|
|
2265
2265
|
for (; e <= n; ) {
|
|
2266
2266
|
if (s = i[o], r = s.id.clock, r <= t) {
|
|
2267
2267
|
if (t < r + s.length)
|
|
@@ -2269,40 +2269,40 @@ const Ue = (i) => {
|
|
|
2269
2269
|
e = o + 1;
|
|
2270
2270
|
} else
|
|
2271
2271
|
n = o - 1;
|
|
2272
|
-
o =
|
|
2272
|
+
o = at((e + n) / 2);
|
|
2273
2273
|
}
|
|
2274
|
-
throw
|
|
2274
|
+
throw ht();
|
|
2275
2275
|
}, Zs = (i, t) => {
|
|
2276
2276
|
const e = i.clients.get(t.client);
|
|
2277
|
-
return e[
|
|
2278
|
-
},
|
|
2277
|
+
return e[Z(e, t.clock)];
|
|
2278
|
+
}, _e = (
|
|
2279
2279
|
/** @type {function(StructStore,ID):Item} */
|
|
2280
2280
|
Zs
|
|
2281
|
-
),
|
|
2282
|
-
const n =
|
|
2281
|
+
), Oe = (i, t, e) => {
|
|
2282
|
+
const n = Z(t, e), s = t[n];
|
|
2283
2283
|
return s.id.clock < e && s instanceof V ? (t.splice(n + 1, 0, Zi(i, s, e - s.id.clock)), n + 1) : n;
|
|
2284
|
-
},
|
|
2284
|
+
}, st = (i, t) => {
|
|
2285
2285
|
const e = (
|
|
2286
2286
|
/** @type {Array<Item>} */
|
|
2287
2287
|
i.doc.store.clients.get(t.client)
|
|
2288
2288
|
);
|
|
2289
|
-
return e[
|
|
2289
|
+
return e[Oe(i, e, t.clock)];
|
|
2290
2290
|
}, oi = (i, t, e) => {
|
|
2291
|
-
const n = t.clients.get(e.client), s =
|
|
2292
|
-
return e.clock !== r.id.clock + r.length - 1 && r.constructor !==
|
|
2291
|
+
const n = t.clients.get(e.client), s = Z(n, e.clock), r = n[s];
|
|
2292
|
+
return e.clock !== r.id.clock + r.length - 1 && r.constructor !== it && n.splice(s + 1, 0, Zi(i, r, e.clock - r.id.clock + 1)), r;
|
|
2293
2293
|
}, Qs = (i, t, e) => {
|
|
2294
2294
|
const n = (
|
|
2295
2295
|
/** @type {Array<GC|Item>} */
|
|
2296
2296
|
i.clients.get(t.id.client)
|
|
2297
2297
|
);
|
|
2298
|
-
n[
|
|
2298
|
+
n[Z(n, t.id.clock)] = e;
|
|
2299
2299
|
}, Ni = (i, t, e, n, s) => {
|
|
2300
2300
|
if (n === 0)
|
|
2301
2301
|
return;
|
|
2302
2302
|
const r = e + n;
|
|
2303
|
-
let o =
|
|
2303
|
+
let o = Oe(i, t, e), c;
|
|
2304
2304
|
do
|
|
2305
|
-
c = t[o++], r < c.id.clock + c.length &&
|
|
2305
|
+
c = t[o++], r < c.id.clock + c.length && Oe(i, t, r), s(c);
|
|
2306
2306
|
while (o < t.length && t[o].id.clock < r);
|
|
2307
2307
|
};
|
|
2308
2308
|
class tr {
|
|
@@ -2312,13 +2312,13 @@ class tr {
|
|
|
2312
2312
|
* @param {boolean} local
|
|
2313
2313
|
*/
|
|
2314
2314
|
constructor(t, e, n) {
|
|
2315
|
-
this.doc = t, this.deleteSet = new xs(), this.beforeState =
|
|
2315
|
+
this.doc = t, this.deleteSet = new xs(), this.beforeState = je(t.store), this.afterState = /* @__PURE__ */ new Map(), this.changed = /* @__PURE__ */ new Map(), this.changedParentTypes = /* @__PURE__ */ new Map(), this._mergeStructs = [], this.origin = e, this.meta = /* @__PURE__ */ new Map(), this.local = n, this.subdocsAdded = /* @__PURE__ */ new Set(), this.subdocsRemoved = /* @__PURE__ */ new Set(), this.subdocsLoaded = /* @__PURE__ */ new Set(), this._needFormattingCleanup = !1;
|
|
2316
2316
|
}
|
|
2317
2317
|
}
|
|
2318
2318
|
const ci = (i, t) => t.deleteSet.clients.size === 0 && !Un(t.afterState, (e, n) => t.beforeState.get(n) !== e) ? !1 : (Ai(t.deleteSet), qs(i, t), Fs(i, t.deleteSet), !0), li = (i, t, e) => {
|
|
2319
2319
|
const n = t._item;
|
|
2320
|
-
(n === null || n.id.clock < (i.beforeState.get(n.id.client) || 0) && !n.deleted) &&
|
|
2321
|
-
},
|
|
2320
|
+
(n === null || n.id.clock < (i.beforeState.get(n.id.client) || 0) && !n.deleted) && St(i.changed, t, _t).add(e);
|
|
2321
|
+
}, Jt = (i, t) => {
|
|
2322
2322
|
let e = i[t], n = i[t - 1], s = t;
|
|
2323
2323
|
for (; s > 0; e = n, n = i[--s - 1]) {
|
|
2324
2324
|
if (n.deleted === e.deleted && n.constructor === e.constructor && n.mergeWith(e)) {
|
|
@@ -2342,7 +2342,7 @@ const ci = (i, t) => t.deleteSet.clients.size === 0 && !Un(t.afterState, (e, n)
|
|
|
2342
2342
|
);
|
|
2343
2343
|
for (let o = s.length - 1; o >= 0; o--) {
|
|
2344
2344
|
const c = s[o], l = c.clock + c.len;
|
|
2345
|
-
for (let h =
|
|
2345
|
+
for (let h = Z(r, c.clock), u = r[h]; h < r.length && u.id.clock < l; u = r[++h]) {
|
|
2346
2346
|
const d = r[h];
|
|
2347
2347
|
if (c.clock + c.len <= d.id.clock)
|
|
2348
2348
|
break;
|
|
@@ -2357,16 +2357,16 @@ const ci = (i, t) => t.deleteSet.clients.size === 0 && !Un(t.afterState, (e, n)
|
|
|
2357
2357
|
t.clients.get(n)
|
|
2358
2358
|
);
|
|
2359
2359
|
for (let r = e.length - 1; r >= 0; r--) {
|
|
2360
|
-
const o = e[r], c = pi(s.length - 1, 1 +
|
|
2360
|
+
const o = e[r], c = pi(s.length - 1, 1 + Z(s, o.clock + o.len - 1));
|
|
2361
2361
|
for (let l = c, h = s[l]; l > 0 && h.id.clock >= o.clock; h = s[l])
|
|
2362
|
-
l -= 1 +
|
|
2362
|
+
l -= 1 + Jt(s, l);
|
|
2363
2363
|
}
|
|
2364
2364
|
});
|
|
2365
2365
|
}, Vi = (i, t) => {
|
|
2366
2366
|
if (t < i.length) {
|
|
2367
2367
|
const e = i[t], n = e.doc, s = n.store, r = e.deleteSet, o = e._mergeStructs;
|
|
2368
2368
|
try {
|
|
2369
|
-
Ai(r), e.afterState =
|
|
2369
|
+
Ai(r), e.afterState = je(e.doc.store), n.emit("beforeObserverCalls", [e, n]);
|
|
2370
2370
|
const c = [];
|
|
2371
2371
|
e.changed.forEach(
|
|
2372
2372
|
(l, h) => c.push(() => {
|
|
@@ -2380,27 +2380,27 @@ const ci = (i, t) => t.deleteSet.clients.size === 0 && !Un(t.afterState, (e, n)
|
|
|
2380
2380
|
u.currentTarget = h, u._path = null;
|
|
2381
2381
|
}), l.sort((u, d) => u.path.length - d.path.length), Di(h._dEH, l, e));
|
|
2382
2382
|
});
|
|
2383
|
-
}), c.push(() => n.emit("afterTransaction", [e, n])),
|
|
2383
|
+
}), c.push(() => n.emit("afterTransaction", [e, n])), Ve(c, []), e._needFormattingCleanup && gr(e);
|
|
2384
2384
|
} finally {
|
|
2385
2385
|
n.gc && er(r, s, n.gcFilter), ir(r, s), e.afterState.forEach((u, d) => {
|
|
2386
2386
|
const g = e.beforeState.get(d) || 0;
|
|
2387
2387
|
if (g !== u) {
|
|
2388
|
-
const
|
|
2388
|
+
const _ = (
|
|
2389
2389
|
/** @type {Array<GC|Item>} */
|
|
2390
2390
|
s.clients.get(d)
|
|
2391
|
-
),
|
|
2392
|
-
for (let
|
|
2393
|
-
|
|
2391
|
+
), w = Ct(Z(_, g), 1);
|
|
2392
|
+
for (let b = _.length - 1; b >= w; )
|
|
2393
|
+
b -= 1 + Jt(_, b);
|
|
2394
2394
|
}
|
|
2395
2395
|
});
|
|
2396
2396
|
for (let u = o.length - 1; u >= 0; u--) {
|
|
2397
|
-
const { client: d, clock: g } = o[u].id,
|
|
2397
|
+
const { client: d, clock: g } = o[u].id, _ = (
|
|
2398
2398
|
/** @type {Array<GC|Item>} */
|
|
2399
2399
|
s.clients.get(d)
|
|
2400
|
-
),
|
|
2401
|
-
|
|
2400
|
+
), w = Z(_, g);
|
|
2401
|
+
w + 1 < _.length && Jt(_, w + 1) > 1 || w > 0 && Jt(_, w);
|
|
2402
2402
|
}
|
|
2403
|
-
if (!e.local && e.afterState.get(n.clientID) !== e.beforeState.get(n.clientID) && (Vs(
|
|
2403
|
+
if (!e.local && e.afterState.get(n.clientID) !== e.beforeState.get(n.clientID) && (Vs(Ue, Si, "[yjs] ", Ci, Ei, "Changed the client-id because another client seems to be using it."), n.clientID = Ti()), n.emit("afterTransactionCleanup", [e, n]), n._observers.has("update")) {
|
|
2404
2404
|
const u = new Ws();
|
|
2405
2405
|
ci(u, e) && n.emit("update", [u.toUint8Array(), e.origin, n, e]);
|
|
2406
2406
|
}
|
|
@@ -2414,7 +2414,7 @@ const ci = (i, t) => t.deleteSet.clients.size === 0 && !Un(t.afterState, (e, n)
|
|
|
2414
2414
|
}), h.forEach((u) => n.subdocs.delete(u)), n.emit("subdocs", [{ loaded: l, added: c, removed: h }, n, e]), h.forEach((u) => u.destroy())), i.length <= t + 1 ? (n._transactionCleanups = [], n.emit("afterAllTransactions", [n, i])) : Vi(i, t + 1);
|
|
2415
2415
|
}
|
|
2416
2416
|
}
|
|
2417
|
-
},
|
|
2417
|
+
}, k = (i, t, e = null, n = !0) => {
|
|
2418
2418
|
const s = i._transactionCleanups;
|
|
2419
2419
|
let r = !1, o = null;
|
|
2420
2420
|
i._transaction === null && (r = !0, i._transaction = new tr(i, e, n), s.push(i._transaction), s.length === 1 && i.emit("beforeAllTransactions", [i]), i.emit("beforeTransaction", [i._transaction, i]));
|
|
@@ -2428,7 +2428,7 @@ const ci = (i, t) => t.deleteSet.clients.size === 0 && !Un(t.afterState, (e, n)
|
|
|
2428
2428
|
}
|
|
2429
2429
|
return o;
|
|
2430
2430
|
}, ai = "You must not compute changes after the event-handler fired.";
|
|
2431
|
-
class
|
|
2431
|
+
class ie {
|
|
2432
2432
|
/**
|
|
2433
2433
|
* @param {T} target The changed type.
|
|
2434
2434
|
* @param {Transaction} transaction
|
|
@@ -2469,7 +2469,7 @@ class ee {
|
|
|
2469
2469
|
get keys() {
|
|
2470
2470
|
if (this._keys === null) {
|
|
2471
2471
|
if (this.transaction.doc._transactionCleanups.length === 0)
|
|
2472
|
-
throw
|
|
2472
|
+
throw wt(ai);
|
|
2473
2473
|
const t = /* @__PURE__ */ new Map(), e = this.target;
|
|
2474
2474
|
/** @type Set<string|null> */
|
|
2475
2475
|
this.transaction.changed.get(e).forEach((s) => {
|
|
@@ -2485,13 +2485,13 @@ class ee {
|
|
|
2485
2485
|
l = l.left;
|
|
2486
2486
|
if (this.deletes(r))
|
|
2487
2487
|
if (l !== null && this.deletes(l))
|
|
2488
|
-
o = "delete", c =
|
|
2488
|
+
o = "delete", c = he(l.content.getContent());
|
|
2489
2489
|
else
|
|
2490
2490
|
return;
|
|
2491
2491
|
else
|
|
2492
|
-
l !== null && this.deletes(l) ? (o = "update", c =
|
|
2492
|
+
l !== null && this.deletes(l) ? (o = "update", c = he(l.content.getContent())) : (o = "add", c = void 0);
|
|
2493
2493
|
} else if (this.deletes(r))
|
|
2494
|
-
o = "delete", c =
|
|
2494
|
+
o = "delete", c = he(
|
|
2495
2495
|
/** @type {Item} */
|
|
2496
2496
|
r.content.getContent()
|
|
2497
2497
|
);
|
|
@@ -2537,8 +2537,8 @@ class ee {
|
|
|
2537
2537
|
let t = this._changes;
|
|
2538
2538
|
if (t === null) {
|
|
2539
2539
|
if (this.transaction.doc._transactionCleanups.length === 0)
|
|
2540
|
-
throw
|
|
2541
|
-
const e = this.target, n =
|
|
2540
|
+
throw wt(ai);
|
|
2541
|
+
const e = this.target, n = _t(), s = _t(), r = [];
|
|
2542
2542
|
if (t = {
|
|
2543
2543
|
added: n,
|
|
2544
2544
|
deleted: s,
|
|
@@ -2583,20 +2583,20 @@ const nr = (i, t) => {
|
|
|
2583
2583
|
}, U = () => {
|
|
2584
2584
|
Us("Invalid access: Add Yjs type to a document before reading data.");
|
|
2585
2585
|
}, Ui = 80;
|
|
2586
|
-
let
|
|
2586
|
+
let $e = 0;
|
|
2587
2587
|
class sr {
|
|
2588
2588
|
/**
|
|
2589
2589
|
* @param {Item} p
|
|
2590
2590
|
* @param {number} index
|
|
2591
2591
|
*/
|
|
2592
2592
|
constructor(t, e) {
|
|
2593
|
-
t.marker = !0, this.p = t, this.index = e, this.timestamp =
|
|
2593
|
+
t.marker = !0, this.p = t, this.index = e, this.timestamp = $e++;
|
|
2594
2594
|
}
|
|
2595
2595
|
}
|
|
2596
2596
|
const rr = (i) => {
|
|
2597
|
-
i.timestamp =
|
|
2597
|
+
i.timestamp = $e++;
|
|
2598
2598
|
}, ji = (i, t, e) => {
|
|
2599
|
-
i.p.marker = !1, i.p = t, t.marker = !0, i.index = e, i.timestamp =
|
|
2599
|
+
i.p.marker = !1, i.p = t, t.marker = !0, i.index = e, i.timestamp = $e++;
|
|
2600
2600
|
}, or = (i, t, e) => {
|
|
2601
2601
|
if (i.length >= Ui) {
|
|
2602
2602
|
const n = i.reduce((s, r) => s.timestamp < r.timestamp ? s : r);
|
|
@@ -2605,10 +2605,10 @@ const rr = (i) => {
|
|
|
2605
2605
|
const n = new sr(t, e);
|
|
2606
2606
|
return i.push(n), n;
|
|
2607
2607
|
}
|
|
2608
|
-
},
|
|
2608
|
+
}, ne = (i, t) => {
|
|
2609
2609
|
if (i._start === null || t === 0 || i._searchMarker === null)
|
|
2610
2610
|
return null;
|
|
2611
|
-
const e = i._searchMarker.length === 0 ? null : i._searchMarker.reduce((r, o) =>
|
|
2611
|
+
const e = i._searchMarker.length === 0 ? null : i._searchMarker.reduce((r, o) => Wt(t - r.index) < Wt(t - o.index) ? r : o);
|
|
2612
2612
|
let n = i._start, s = 0;
|
|
2613
2613
|
for (e !== null && (n = e.p, s = e.index, rr(e)); n.right !== null && s < t; ) {
|
|
2614
2614
|
if (!n.deleted && n.countable) {
|
|
@@ -2622,9 +2622,9 @@ const rr = (i) => {
|
|
|
2622
2622
|
n = n.left, !n.deleted && n.countable && (s -= n.length);
|
|
2623
2623
|
for (; n.left !== null && n.left.id.client === n.id.client && n.left.id.clock + n.left.length === n.id.clock; )
|
|
2624
2624
|
n = n.left, !n.deleted && n.countable && (s -= n.length);
|
|
2625
|
-
return e !== null &&
|
|
2625
|
+
return e !== null && Wt(e.index - s) < /** @type {YText|YArray<any>} */
|
|
2626
2626
|
n.parent.length / Ui ? (ji(e, n, s), e) : or(i._searchMarker, n, s);
|
|
2627
|
-
},
|
|
2627
|
+
}, Vt = (i, t, e) => {
|
|
2628
2628
|
for (let n = i.length - 1; n >= 0; n--) {
|
|
2629
2629
|
const s = i[n];
|
|
2630
2630
|
if (e > 0) {
|
|
@@ -2637,16 +2637,16 @@ const rr = (i) => {
|
|
|
2637
2637
|
}
|
|
2638
2638
|
s.p = r, r.marker = !0;
|
|
2639
2639
|
}
|
|
2640
|
-
(t < s.index || e > 0 && t === s.index) && (s.index =
|
|
2640
|
+
(t < s.index || e > 0 && t === s.index) && (s.index = Ct(t, s.index + e));
|
|
2641
2641
|
}
|
|
2642
|
-
},
|
|
2642
|
+
}, se = (i, t, e) => {
|
|
2643
2643
|
const n = i, s = t.changedParentTypes;
|
|
2644
|
-
for (;
|
|
2644
|
+
for (; St(s, i, () => []).push(e), i._item !== null; )
|
|
2645
2645
|
i = /** @type {AbstractType<any>} */
|
|
2646
2646
|
i._item.parent;
|
|
2647
2647
|
Di(n._eH, e, t);
|
|
2648
2648
|
};
|
|
2649
|
-
class
|
|
2649
|
+
class N {
|
|
2650
2650
|
constructor() {
|
|
2651
2651
|
this._item = null, this._map = /* @__PURE__ */ new Map(), this._start = null, this.doc = null, this._length = 0, this._eH = ni(), this._dEH = ni(), this._searchMarker = null;
|
|
2652
2652
|
}
|
|
@@ -2676,7 +2676,7 @@ class M {
|
|
|
2676
2676
|
* @return {AbstractType<EventType>}
|
|
2677
2677
|
*/
|
|
2678
2678
|
_copy() {
|
|
2679
|
-
throw
|
|
2679
|
+
throw H();
|
|
2680
2680
|
}
|
|
2681
2681
|
/**
|
|
2682
2682
|
* Makes a copy of this data type that can be included somewhere else.
|
|
@@ -2686,7 +2686,7 @@ class M {
|
|
|
2686
2686
|
* @return {AbstractType<EventType>}
|
|
2687
2687
|
*/
|
|
2688
2688
|
clone() {
|
|
2689
|
-
throw
|
|
2689
|
+
throw H();
|
|
2690
2690
|
}
|
|
2691
2691
|
/**
|
|
2692
2692
|
* @param {UpdateEncoderV1 | UpdateEncoderV2} _encoder
|
|
@@ -2785,7 +2785,7 @@ const $i = (i, t, e) => {
|
|
|
2785
2785
|
e = e.right;
|
|
2786
2786
|
}
|
|
2787
2787
|
return t;
|
|
2788
|
-
},
|
|
2788
|
+
}, Ut = (i, t) => {
|
|
2789
2789
|
var s;
|
|
2790
2790
|
let e = 0, n = i._start;
|
|
2791
2791
|
for ((s = i.doc) != null || U(); n !== null; ) {
|
|
@@ -2798,7 +2798,7 @@ const $i = (i, t, e) => {
|
|
|
2798
2798
|
}
|
|
2799
2799
|
}, Bi = (i, t) => {
|
|
2800
2800
|
const e = [];
|
|
2801
|
-
return
|
|
2801
|
+
return Ut(i, (n, s) => {
|
|
2802
2802
|
e.push(t(n, s, i));
|
|
2803
2803
|
}), e;
|
|
2804
2804
|
}, cr = (i) => {
|
|
@@ -2828,7 +2828,7 @@ const $i = (i, t, e) => {
|
|
|
2828
2828
|
}, Fi = (i, t) => {
|
|
2829
2829
|
var s;
|
|
2830
2830
|
(s = i.doc) != null || U();
|
|
2831
|
-
const e =
|
|
2831
|
+
const e = ne(i, t);
|
|
2832
2832
|
let n = i._start;
|
|
2833
2833
|
for (e !== null && (n = e.p, t -= e.index); n !== null; n = n.right)
|
|
2834
2834
|
if (!n.deleted && n.countable) {
|
|
@@ -2836,12 +2836,12 @@ const $i = (i, t, e) => {
|
|
|
2836
2836
|
return n.content.getContent()[t];
|
|
2837
2837
|
t -= n.length;
|
|
2838
2838
|
}
|
|
2839
|
-
},
|
|
2839
|
+
}, Yt = (i, t, e, n) => {
|
|
2840
2840
|
let s = e;
|
|
2841
2841
|
const r = i.doc, o = r.clientID, c = r.store, l = e === null ? t._start : e.right;
|
|
2842
2842
|
let h = [];
|
|
2843
2843
|
const u = () => {
|
|
2844
|
-
h.length > 0 && (s = new V(
|
|
2844
|
+
h.length > 0 && (s = new V(v(o, $(c, o)), s, s && s.lastId, l, l && l.id, t, null, new bt(h)), s.integrate(i, 0), h = []);
|
|
2845
2845
|
};
|
|
2846
2846
|
n.forEach((d) => {
|
|
2847
2847
|
if (d === null)
|
|
@@ -2859,72 +2859,72 @@ const $i = (i, t, e) => {
|
|
|
2859
2859
|
switch (u(), d.constructor) {
|
|
2860
2860
|
case Uint8Array:
|
|
2861
2861
|
case ArrayBuffer:
|
|
2862
|
-
s = new V(
|
|
2862
|
+
s = new V(v(o, $(c, o)), s, s && s.lastId, l, l && l.id, t, null, new re(new Uint8Array(
|
|
2863
2863
|
/** @type {Uint8Array} */
|
|
2864
2864
|
d
|
|
2865
2865
|
))), s.integrate(i, 0);
|
|
2866
2866
|
break;
|
|
2867
|
-
case
|
|
2868
|
-
s = new V(
|
|
2867
|
+
case Et:
|
|
2868
|
+
s = new V(v(o, $(c, o)), s, s && s.lastId, l, l && l.id, t, null, new oe(
|
|
2869
2869
|
/** @type {Doc} */
|
|
2870
2870
|
d
|
|
2871
2871
|
)), s.integrate(i, 0);
|
|
2872
2872
|
break;
|
|
2873
2873
|
default:
|
|
2874
|
-
if (d instanceof
|
|
2875
|
-
s = new V(
|
|
2874
|
+
if (d instanceof N)
|
|
2875
|
+
s = new V(v(o, $(c, o)), s, s && s.lastId, l, l && l.id, t, null, new rt(d)), s.integrate(i, 0);
|
|
2876
2876
|
else
|
|
2877
2877
|
throw new Error("Unexpected content type in insert operation");
|
|
2878
2878
|
}
|
|
2879
2879
|
}
|
|
2880
2880
|
}), u();
|
|
2881
|
-
}, Pi = () =>
|
|
2881
|
+
}, Pi = () => wt("Length exceeded!"), Wi = (i, t, e, n) => {
|
|
2882
2882
|
if (e > t._length)
|
|
2883
2883
|
throw Pi();
|
|
2884
2884
|
if (e === 0)
|
|
2885
|
-
return t._searchMarker &&
|
|
2886
|
-
const s = e, r =
|
|
2885
|
+
return t._searchMarker && Vt(t._searchMarker, e, n.length), Yt(i, t, null, n);
|
|
2886
|
+
const s = e, r = ne(t, e);
|
|
2887
2887
|
let o = t._start;
|
|
2888
2888
|
for (r !== null && (o = r.p, e -= r.index, e === 0 && (o = o.prev, e += o && o.countable && !o.deleted ? o.length : 0)); o !== null; o = o.right)
|
|
2889
2889
|
if (!o.deleted && o.countable) {
|
|
2890
2890
|
if (e <= o.length) {
|
|
2891
|
-
e < o.length &&
|
|
2891
|
+
e < o.length && st(i, v(o.id.client, o.id.clock + e));
|
|
2892
2892
|
break;
|
|
2893
2893
|
}
|
|
2894
2894
|
e -= o.length;
|
|
2895
2895
|
}
|
|
2896
|
-
return t._searchMarker &&
|
|
2896
|
+
return t._searchMarker && Vt(t._searchMarker, s, n.length), Yt(i, t, o, n);
|
|
2897
2897
|
}, lr = (i, t, e) => {
|
|
2898
2898
|
let s = (t._searchMarker || []).reduce((r, o) => o.index > r.index ? o : r, { index: 0, p: t._start }).p;
|
|
2899
2899
|
if (s)
|
|
2900
2900
|
for (; s.right; )
|
|
2901
2901
|
s = s.right;
|
|
2902
|
-
return
|
|
2902
|
+
return Yt(i, t, s, e);
|
|
2903
2903
|
}, Ki = (i, t, e, n) => {
|
|
2904
2904
|
if (n === 0)
|
|
2905
2905
|
return;
|
|
2906
|
-
const s = e, r = n, o =
|
|
2906
|
+
const s = e, r = n, o = ne(t, e);
|
|
2907
2907
|
let c = t._start;
|
|
2908
2908
|
for (o !== null && (c = o.p, e -= o.index); c !== null && e > 0; c = c.right)
|
|
2909
|
-
!c.deleted && c.countable && (e < c.length &&
|
|
2909
|
+
!c.deleted && c.countable && (e < c.length && st(i, v(c.id.client, c.id.clock + e)), e -= c.length);
|
|
2910
2910
|
for (; n > 0 && c !== null; )
|
|
2911
|
-
c.deleted || (n < c.length &&
|
|
2911
|
+
c.deleted || (n < c.length && st(i, v(c.id.client, c.id.clock + n)), c.delete(i), n -= c.length), c = c.right;
|
|
2912
2912
|
if (n > 0)
|
|
2913
2913
|
throw Pi();
|
|
2914
|
-
t._searchMarker &&
|
|
2914
|
+
t._searchMarker && Vt(
|
|
2915
2915
|
t._searchMarker,
|
|
2916
2916
|
s,
|
|
2917
2917
|
-r + n
|
|
2918
2918
|
/* in case we remove the above exception */
|
|
2919
2919
|
);
|
|
2920
|
-
},
|
|
2920
|
+
}, Xt = (i, t, e) => {
|
|
2921
2921
|
const n = t._map.get(e);
|
|
2922
2922
|
n !== void 0 && n.delete(i);
|
|
2923
|
-
},
|
|
2923
|
+
}, xe = (i, t, e, n) => {
|
|
2924
2924
|
const s = t._map.get(e) || null, r = i.doc, o = r.clientID;
|
|
2925
2925
|
let c;
|
|
2926
2926
|
if (n == null)
|
|
2927
|
-
c = new
|
|
2927
|
+
c = new bt([n]);
|
|
2928
2928
|
else
|
|
2929
2929
|
switch (n.constructor) {
|
|
2930
2930
|
case Number:
|
|
@@ -2932,28 +2932,28 @@ const $i = (i, t, e) => {
|
|
|
2932
2932
|
case Boolean:
|
|
2933
2933
|
case Array:
|
|
2934
2934
|
case String:
|
|
2935
|
-
c = new
|
|
2935
|
+
c = new bt([n]);
|
|
2936
2936
|
break;
|
|
2937
2937
|
case Uint8Array:
|
|
2938
|
-
c = new
|
|
2938
|
+
c = new re(
|
|
2939
2939
|
/** @type {Uint8Array} */
|
|
2940
2940
|
n
|
|
2941
2941
|
);
|
|
2942
2942
|
break;
|
|
2943
|
-
case
|
|
2944
|
-
c = new
|
|
2943
|
+
case Et:
|
|
2944
|
+
c = new oe(
|
|
2945
2945
|
/** @type {Doc} */
|
|
2946
2946
|
n
|
|
2947
2947
|
);
|
|
2948
2948
|
break;
|
|
2949
2949
|
default:
|
|
2950
|
-
if (n instanceof
|
|
2951
|
-
c = new
|
|
2950
|
+
if (n instanceof N)
|
|
2951
|
+
c = new rt(n);
|
|
2952
2952
|
else
|
|
2953
2953
|
throw new Error("Unexpected content type");
|
|
2954
2954
|
}
|
|
2955
|
-
new V(
|
|
2956
|
-
},
|
|
2955
|
+
new V(v(o, $(r.store, o)), s, s && s.lastId, null, null, t, e, c).integrate(i, 0);
|
|
2956
|
+
}, Be = (i, t) => {
|
|
2957
2957
|
var n;
|
|
2958
2958
|
(n = i.doc) != null || U();
|
|
2959
2959
|
const e = i._map.get(t);
|
|
@@ -2975,9 +2975,9 @@ const $i = (i, t, e) => {
|
|
|
2975
2975
|
let r = n;
|
|
2976
2976
|
for (; r !== null && (!t.sv.has(r.id.client) || r.id.clock >= (t.sv.get(r.id.client) || 0)); )
|
|
2977
2977
|
r = r.left;
|
|
2978
|
-
r !== null &&
|
|
2978
|
+
r !== null && dt(r, t) && (e[s] = r.content.getContent()[r.length - 1]);
|
|
2979
2979
|
}), e;
|
|
2980
|
-
},
|
|
2980
|
+
}, Ft = (i) => {
|
|
2981
2981
|
var t;
|
|
2982
2982
|
return (t = i.doc) != null || U(), js(
|
|
2983
2983
|
i._map.entries(),
|
|
@@ -2985,9 +2985,9 @@ const $i = (i, t, e) => {
|
|
|
2985
2985
|
(e) => !e[1].deleted
|
|
2986
2986
|
);
|
|
2987
2987
|
};
|
|
2988
|
-
class hr extends
|
|
2988
|
+
class hr extends ie {
|
|
2989
2989
|
}
|
|
2990
|
-
class
|
|
2990
|
+
class At extends N {
|
|
2991
2991
|
constructor() {
|
|
2992
2992
|
super(), this._prelimContent = [], this._searchMarker = [];
|
|
2993
2993
|
}
|
|
@@ -2998,7 +2998,7 @@ class Rt extends M {
|
|
|
2998
2998
|
* @return {YArray<T>}
|
|
2999
2999
|
*/
|
|
3000
3000
|
static from(t) {
|
|
3001
|
-
const e = new
|
|
3001
|
+
const e = new At();
|
|
3002
3002
|
return e.push(t), e;
|
|
3003
3003
|
}
|
|
3004
3004
|
/**
|
|
@@ -3022,7 +3022,7 @@ class Rt extends M {
|
|
|
3022
3022
|
* @return {YArray<T>}
|
|
3023
3023
|
*/
|
|
3024
3024
|
_copy() {
|
|
3025
|
-
return new
|
|
3025
|
+
return new At();
|
|
3026
3026
|
}
|
|
3027
3027
|
/**
|
|
3028
3028
|
* Makes a copy of this data type that can be included somewhere else.
|
|
@@ -3032,9 +3032,9 @@ class Rt extends M {
|
|
|
3032
3032
|
* @return {YArray<T>}
|
|
3033
3033
|
*/
|
|
3034
3034
|
clone() {
|
|
3035
|
-
const t = new
|
|
3035
|
+
const t = new At();
|
|
3036
3036
|
return t.insert(0, this.toArray().map(
|
|
3037
|
-
(e) => e instanceof
|
|
3037
|
+
(e) => e instanceof N ? (
|
|
3038
3038
|
/** @type {typeof el} */
|
|
3039
3039
|
e.clone()
|
|
3040
3040
|
) : e
|
|
@@ -3051,7 +3051,7 @@ class Rt extends M {
|
|
|
3051
3051
|
* @param {Set<null|string>} parentSubs Keys changed on this type. `null` if list was modified.
|
|
3052
3052
|
*/
|
|
3053
3053
|
_callObserver(t, e) {
|
|
3054
|
-
super._callObserver(t, e),
|
|
3054
|
+
super._callObserver(t, e), se(this, t, new hr(this, t));
|
|
3055
3055
|
}
|
|
3056
3056
|
/**
|
|
3057
3057
|
* Inserts new content at an index.
|
|
@@ -3070,7 +3070,7 @@ class Rt extends M {
|
|
|
3070
3070
|
* @param {Array<T>} content The array of content
|
|
3071
3071
|
*/
|
|
3072
3072
|
insert(t, e) {
|
|
3073
|
-
this.doc !== null ?
|
|
3073
|
+
this.doc !== null ? k(this.doc, (n) => {
|
|
3074
3074
|
Wi(
|
|
3075
3075
|
n,
|
|
3076
3076
|
this,
|
|
@@ -3088,7 +3088,7 @@ class Rt extends M {
|
|
|
3088
3088
|
* @todo Use the following implementation in all types.
|
|
3089
3089
|
*/
|
|
3090
3090
|
push(t) {
|
|
3091
|
-
this.doc !== null ?
|
|
3091
|
+
this.doc !== null ? k(this.doc, (e) => {
|
|
3092
3092
|
lr(
|
|
3093
3093
|
e,
|
|
3094
3094
|
this,
|
|
@@ -3112,7 +3112,7 @@ class Rt extends M {
|
|
|
3112
3112
|
* @param {number} length The number of elements to remove. Defaults to 1.
|
|
3113
3113
|
*/
|
|
3114
3114
|
delete(t, e = 1) {
|
|
3115
|
-
this.doc !== null ?
|
|
3115
|
+
this.doc !== null ? k(this.doc, (n) => {
|
|
3116
3116
|
Ki(n, this, t, e);
|
|
3117
3117
|
}) : this._prelimContent.splice(t, e);
|
|
3118
3118
|
}
|
|
@@ -3150,7 +3150,7 @@ class Rt extends M {
|
|
|
3150
3150
|
* @return {Array<any>}
|
|
3151
3151
|
*/
|
|
3152
3152
|
toJSON() {
|
|
3153
|
-
return this.map((t) => t instanceof
|
|
3153
|
+
return this.map((t) => t instanceof N ? t.toJSON() : t);
|
|
3154
3154
|
}
|
|
3155
3155
|
/**
|
|
3156
3156
|
* Returns an Array with the result of calling a provided function on every
|
|
@@ -3174,7 +3174,7 @@ class Rt extends M {
|
|
|
3174
3174
|
* @param {function(T,number,YArray<T>):void} f A function to execute on every element of this YArray.
|
|
3175
3175
|
*/
|
|
3176
3176
|
forEach(t) {
|
|
3177
|
-
|
|
3177
|
+
Ut(this, t);
|
|
3178
3178
|
}
|
|
3179
3179
|
/**
|
|
3180
3180
|
* @return {IterableIterator<T>}
|
|
@@ -3189,7 +3189,7 @@ class Rt extends M {
|
|
|
3189
3189
|
t.writeTypeRef(br);
|
|
3190
3190
|
}
|
|
3191
3191
|
}
|
|
3192
|
-
class ur extends
|
|
3192
|
+
class ur extends ie {
|
|
3193
3193
|
/**
|
|
3194
3194
|
* @param {YMap<T>} ymap The YArray that changed.
|
|
3195
3195
|
* @param {Transaction} transaction
|
|
@@ -3199,7 +3199,7 @@ class ur extends ee {
|
|
|
3199
3199
|
super(t, e), this.keysChanged = n;
|
|
3200
3200
|
}
|
|
3201
3201
|
}
|
|
3202
|
-
class
|
|
3202
|
+
class Zt extends N {
|
|
3203
3203
|
/**
|
|
3204
3204
|
*
|
|
3205
3205
|
* @param {Iterable<readonly [string, any]>=} entries - an optional iterable to initialize the YMap
|
|
@@ -3226,7 +3226,7 @@ class Xt extends M {
|
|
|
3226
3226
|
* @return {YMap<MapType>}
|
|
3227
3227
|
*/
|
|
3228
3228
|
_copy() {
|
|
3229
|
-
return new
|
|
3229
|
+
return new Zt();
|
|
3230
3230
|
}
|
|
3231
3231
|
/**
|
|
3232
3232
|
* Makes a copy of this data type that can be included somewhere else.
|
|
@@ -3236,9 +3236,9 @@ class Xt extends M {
|
|
|
3236
3236
|
* @return {YMap<MapType>}
|
|
3237
3237
|
*/
|
|
3238
3238
|
clone() {
|
|
3239
|
-
const t = new
|
|
3239
|
+
const t = new Zt();
|
|
3240
3240
|
return this.forEach((e, n) => {
|
|
3241
|
-
t.set(n, e instanceof
|
|
3241
|
+
t.set(n, e instanceof N ? (
|
|
3242
3242
|
/** @type {typeof value} */
|
|
3243
3243
|
e.clone()
|
|
3244
3244
|
) : e);
|
|
@@ -3251,7 +3251,7 @@ class Xt extends M {
|
|
|
3251
3251
|
* @param {Set<null|string>} parentSubs Keys changed on this type. `null` if list was modified.
|
|
3252
3252
|
*/
|
|
3253
3253
|
_callObserver(t, e) {
|
|
3254
|
-
|
|
3254
|
+
se(this, t, new ur(this, t, e));
|
|
3255
3255
|
}
|
|
3256
3256
|
/**
|
|
3257
3257
|
* Transforms this Shared Type to a JSON object.
|
|
@@ -3265,7 +3265,7 @@ class Xt extends M {
|
|
|
3265
3265
|
return this._map.forEach((n, s) => {
|
|
3266
3266
|
if (!n.deleted) {
|
|
3267
3267
|
const r = n.content.getContent()[n.length - 1];
|
|
3268
|
-
t[s] = r instanceof
|
|
3268
|
+
t[s] = r instanceof N ? r.toJSON() : r;
|
|
3269
3269
|
}
|
|
3270
3270
|
}), t;
|
|
3271
3271
|
}
|
|
@@ -3275,7 +3275,7 @@ class Xt extends M {
|
|
|
3275
3275
|
* @return {number}
|
|
3276
3276
|
*/
|
|
3277
3277
|
get size() {
|
|
3278
|
-
return [...
|
|
3278
|
+
return [...Ft(this)].length;
|
|
3279
3279
|
}
|
|
3280
3280
|
/**
|
|
3281
3281
|
* Returns the keys for each element in the YMap Type.
|
|
@@ -3283,8 +3283,8 @@ class Xt extends M {
|
|
|
3283
3283
|
* @return {IterableIterator<string>}
|
|
3284
3284
|
*/
|
|
3285
3285
|
keys() {
|
|
3286
|
-
return
|
|
3287
|
-
|
|
3286
|
+
return pe(
|
|
3287
|
+
Ft(this),
|
|
3288
3288
|
/** @param {any} v */
|
|
3289
3289
|
(t) => t[0]
|
|
3290
3290
|
);
|
|
@@ -3295,8 +3295,8 @@ class Xt extends M {
|
|
|
3295
3295
|
* @return {IterableIterator<MapType>}
|
|
3296
3296
|
*/
|
|
3297
3297
|
values() {
|
|
3298
|
-
return
|
|
3299
|
-
|
|
3298
|
+
return pe(
|
|
3299
|
+
Ft(this),
|
|
3300
3300
|
/** @param {any} v */
|
|
3301
3301
|
(t) => t[1].content.getContent()[t[1].length - 1]
|
|
3302
3302
|
);
|
|
@@ -3307,8 +3307,8 @@ class Xt extends M {
|
|
|
3307
3307
|
* @return {IterableIterator<[string, MapType]>}
|
|
3308
3308
|
*/
|
|
3309
3309
|
entries() {
|
|
3310
|
-
return
|
|
3311
|
-
|
|
3310
|
+
return pe(
|
|
3311
|
+
Ft(this),
|
|
3312
3312
|
/** @param {any} v */
|
|
3313
3313
|
(t) => (
|
|
3314
3314
|
/** @type {any} */
|
|
@@ -3341,8 +3341,8 @@ class Xt extends M {
|
|
|
3341
3341
|
* @param {string} key The key of the element to remove.
|
|
3342
3342
|
*/
|
|
3343
3343
|
delete(t) {
|
|
3344
|
-
this.doc !== null ?
|
|
3345
|
-
|
|
3344
|
+
this.doc !== null ? k(this.doc, (e) => {
|
|
3345
|
+
Xt(e, this, t);
|
|
3346
3346
|
}) : this._prelimContent.delete(t);
|
|
3347
3347
|
}
|
|
3348
3348
|
/**
|
|
@@ -3354,8 +3354,8 @@ class Xt extends M {
|
|
|
3354
3354
|
* @return {VAL}
|
|
3355
3355
|
*/
|
|
3356
3356
|
set(t, e) {
|
|
3357
|
-
return this.doc !== null ?
|
|
3358
|
-
|
|
3357
|
+
return this.doc !== null ? k(this.doc, (n) => {
|
|
3358
|
+
xe(
|
|
3359
3359
|
n,
|
|
3360
3360
|
this,
|
|
3361
3361
|
t,
|
|
@@ -3373,7 +3373,7 @@ class Xt extends M {
|
|
|
3373
3373
|
get(t) {
|
|
3374
3374
|
return (
|
|
3375
3375
|
/** @type {any} */
|
|
3376
|
-
|
|
3376
|
+
Be(this, t)
|
|
3377
3377
|
);
|
|
3378
3378
|
}
|
|
3379
3379
|
/**
|
|
@@ -3389,9 +3389,9 @@ class Xt extends M {
|
|
|
3389
3389
|
* Removes all elements from this YMap.
|
|
3390
3390
|
*/
|
|
3391
3391
|
clear() {
|
|
3392
|
-
this.doc !== null ?
|
|
3392
|
+
this.doc !== null ? k(this.doc, (t) => {
|
|
3393
3393
|
this.forEach(function(e, n, s) {
|
|
3394
|
-
|
|
3394
|
+
Xt(t, s, n);
|
|
3395
3395
|
});
|
|
3396
3396
|
}) : this._prelimContent.clear();
|
|
3397
3397
|
}
|
|
@@ -3402,8 +3402,8 @@ class Xt extends M {
|
|
|
3402
3402
|
t.writeTypeRef(Sr);
|
|
3403
3403
|
}
|
|
3404
3404
|
}
|
|
3405
|
-
const
|
|
3406
|
-
class
|
|
3405
|
+
const nt = (i, t) => i === t || typeof i == "object" && typeof t == "object" && i && t && ys(i, t);
|
|
3406
|
+
class Re {
|
|
3407
3407
|
/**
|
|
3408
3408
|
* @param {Item|null} left
|
|
3409
3409
|
* @param {Item|null} right
|
|
@@ -3417,9 +3417,9 @@ class Oe {
|
|
|
3417
3417
|
* Only call this if you know that this.right is defined
|
|
3418
3418
|
*/
|
|
3419
3419
|
forward() {
|
|
3420
|
-
switch (this.right === null &&
|
|
3421
|
-
case
|
|
3422
|
-
this.right.deleted ||
|
|
3420
|
+
switch (this.right === null && ht(), this.right.content.constructor) {
|
|
3421
|
+
case T:
|
|
3422
|
+
this.right.deleted || kt(
|
|
3423
3423
|
this.currentAttributes,
|
|
3424
3424
|
/** @type {ContentFormat} */
|
|
3425
3425
|
this.right.content
|
|
@@ -3435,31 +3435,31 @@ class Oe {
|
|
|
3435
3435
|
const hi = (i, t, e) => {
|
|
3436
3436
|
for (; t.right !== null && e > 0; ) {
|
|
3437
3437
|
switch (t.right.content.constructor) {
|
|
3438
|
-
case
|
|
3439
|
-
t.right.deleted ||
|
|
3438
|
+
case T:
|
|
3439
|
+
t.right.deleted || kt(
|
|
3440
3440
|
t.currentAttributes,
|
|
3441
3441
|
/** @type {ContentFormat} */
|
|
3442
3442
|
t.right.content
|
|
3443
3443
|
);
|
|
3444
3444
|
break;
|
|
3445
3445
|
default:
|
|
3446
|
-
t.right.deleted || (e < t.right.length &&
|
|
3446
|
+
t.right.deleted || (e < t.right.length && st(i, v(t.right.id.client, t.right.id.clock + e)), t.index += t.right.length, e -= t.right.length);
|
|
3447
3447
|
break;
|
|
3448
3448
|
}
|
|
3449
3449
|
t.left = t.right, t.right = t.right.right;
|
|
3450
3450
|
}
|
|
3451
3451
|
return t;
|
|
3452
|
-
},
|
|
3453
|
-
const s = /* @__PURE__ */ new Map(), r = n ?
|
|
3452
|
+
}, Pt = (i, t, e, n) => {
|
|
3453
|
+
const s = /* @__PURE__ */ new Map(), r = n ? ne(t, e) : null;
|
|
3454
3454
|
if (r) {
|
|
3455
|
-
const o = new
|
|
3455
|
+
const o = new Re(r.p.left, r.p, r.index, s);
|
|
3456
3456
|
return hi(i, o, e - r.index);
|
|
3457
3457
|
} else {
|
|
3458
|
-
const o = new
|
|
3458
|
+
const o = new Re(null, t._start, 0, s);
|
|
3459
3459
|
return hi(i, o, e);
|
|
3460
3460
|
}
|
|
3461
3461
|
}, Hi = (i, t, e, n) => {
|
|
3462
|
-
for (; e.right !== null && (e.right.deleted === !0 || e.right.content.constructor ===
|
|
3462
|
+
for (; e.right !== null && (e.right.deleted === !0 || e.right.content.constructor === T && nt(
|
|
3463
3463
|
n.get(
|
|
3464
3464
|
/** @type {ContentFormat} */
|
|
3465
3465
|
e.right.content.key
|
|
@@ -3473,16 +3473,16 @@ const hi = (i, t, e) => {
|
|
|
3473
3473
|
), e.forward();
|
|
3474
3474
|
const s = i.doc, r = s.clientID;
|
|
3475
3475
|
n.forEach((o, c) => {
|
|
3476
|
-
const l = e.left, h = e.right, u = new V(
|
|
3476
|
+
const l = e.left, h = e.right, u = new V(v(r, $(s.store, r)), l, l && l.lastId, h, h && h.id, t, null, new T(c, o));
|
|
3477
3477
|
u.integrate(i, 0), e.right = u, e.forward();
|
|
3478
3478
|
});
|
|
3479
|
-
},
|
|
3479
|
+
}, kt = (i, t) => {
|
|
3480
3480
|
const { key: e, value: n } = t;
|
|
3481
3481
|
n === null ? i.delete(e) : i.set(e, n);
|
|
3482
3482
|
}, qi = (i, t) => {
|
|
3483
3483
|
var e;
|
|
3484
3484
|
for (; i.right !== null; ) {
|
|
3485
|
-
if (!(i.right.deleted || i.right.content.constructor ===
|
|
3485
|
+
if (!(i.right.deleted || i.right.content.constructor === T && nt(
|
|
3486
3486
|
(e = t[
|
|
3487
3487
|
/** @type {ContentFormat} */
|
|
3488
3488
|
i.right.content.key
|
|
@@ -3497,39 +3497,39 @@ const hi = (i, t, e) => {
|
|
|
3497
3497
|
const s = i.doc, r = s.clientID, o = /* @__PURE__ */ new Map();
|
|
3498
3498
|
for (const l in n) {
|
|
3499
3499
|
const h = n[l], u = (c = e.currentAttributes.get(l)) != null ? c : null;
|
|
3500
|
-
if (!
|
|
3500
|
+
if (!nt(u, h)) {
|
|
3501
3501
|
o.set(l, u);
|
|
3502
3502
|
const { left: d, right: g } = e;
|
|
3503
|
-
e.right = new V(
|
|
3503
|
+
e.right = new V(v(r, $(s.store, r)), d, d && d.lastId, g, g && g.id, t, null, new T(l, h)), e.right.integrate(i, 0), e.forward();
|
|
3504
3504
|
}
|
|
3505
3505
|
}
|
|
3506
3506
|
return o;
|
|
3507
|
-
},
|
|
3508
|
-
e.currentAttributes.forEach((g,
|
|
3509
|
-
s[
|
|
3507
|
+
}, me = (i, t, e, n, s) => {
|
|
3508
|
+
e.currentAttributes.forEach((g, _) => {
|
|
3509
|
+
s[_] === void 0 && (s[_] = null);
|
|
3510
3510
|
});
|
|
3511
3511
|
const r = i.doc, o = r.clientID;
|
|
3512
3512
|
qi(e, s);
|
|
3513
|
-
const c = zi(i, t, e, s), l = n.constructor === String ? new
|
|
3513
|
+
const c = zi(i, t, e, s), l = n.constructor === String ? new Q(
|
|
3514
3514
|
/** @type {string} */
|
|
3515
3515
|
n
|
|
3516
|
-
) : n instanceof
|
|
3516
|
+
) : n instanceof N ? new rt(n) : new vt(n);
|
|
3517
3517
|
let { left: h, right: u, index: d } = e;
|
|
3518
|
-
t._searchMarker &&
|
|
3518
|
+
t._searchMarker && Vt(t._searchMarker, e.index, l.getLength()), u = new V(v(o, $(r.store, o)), h, h && h.lastId, u, u && u.id, t, null, l), u.integrate(i, 0), e.right = u, e.index = d, e.forward(), Hi(i, t, e, c);
|
|
3519
3519
|
}, ui = (i, t, e, n, s) => {
|
|
3520
3520
|
const r = i.doc, o = r.clientID;
|
|
3521
3521
|
qi(e, s);
|
|
3522
3522
|
const c = zi(i, t, e, s);
|
|
3523
|
-
t: for (; e.right !== null && (n > 0 || c.size > 0 && (e.right.deleted || e.right.content.constructor ===
|
|
3523
|
+
t: for (; e.right !== null && (n > 0 || c.size > 0 && (e.right.deleted || e.right.content.constructor === T)); ) {
|
|
3524
3524
|
if (!e.right.deleted)
|
|
3525
3525
|
switch (e.right.content.constructor) {
|
|
3526
|
-
case
|
|
3526
|
+
case T: {
|
|
3527
3527
|
const { key: l, value: h } = (
|
|
3528
3528
|
/** @type {ContentFormat} */
|
|
3529
3529
|
e.right.content
|
|
3530
3530
|
), u = s[l];
|
|
3531
3531
|
if (u !== void 0) {
|
|
3532
|
-
if (
|
|
3532
|
+
if (nt(u, h))
|
|
3533
3533
|
c.delete(l);
|
|
3534
3534
|
else {
|
|
3535
3535
|
if (n === 0)
|
|
@@ -3542,7 +3542,7 @@ const hi = (i, t, e) => {
|
|
|
3542
3542
|
break;
|
|
3543
3543
|
}
|
|
3544
3544
|
default:
|
|
3545
|
-
n < e.right.length &&
|
|
3545
|
+
n < e.right.length && st(i, v(e.right.id.client, e.right.id.clock + n)), n -= e.right.length;
|
|
3546
3546
|
break;
|
|
3547
3547
|
}
|
|
3548
3548
|
e.forward();
|
|
@@ -3552,15 +3552,15 @@ const hi = (i, t, e) => {
|
|
|
3552
3552
|
for (; n > 0; n--)
|
|
3553
3553
|
l += `
|
|
3554
3554
|
`;
|
|
3555
|
-
e.right = new V(
|
|
3555
|
+
e.right = new V(v(o, $(r.store, o)), e.left, e.left && e.left.lastId, e.right, e.right && e.right.id, t, null, new Q(l)), e.right.integrate(i, 0), e.forward();
|
|
3556
3556
|
}
|
|
3557
3557
|
Hi(i, t, e, c);
|
|
3558
3558
|
}, Yi = (i, t, e, n, s) => {
|
|
3559
3559
|
var h, u;
|
|
3560
3560
|
let r = t;
|
|
3561
|
-
const o =
|
|
3561
|
+
const o = J();
|
|
3562
3562
|
for (; r && (!r.countable || r.deleted); ) {
|
|
3563
|
-
if (!r.deleted && r.content.constructor ===
|
|
3563
|
+
if (!r.deleted && r.content.constructor === T) {
|
|
3564
3564
|
const d = (
|
|
3565
3565
|
/** @type {ContentFormat} */
|
|
3566
3566
|
r.content
|
|
@@ -3574,12 +3574,12 @@ const hi = (i, t, e) => {
|
|
|
3574
3574
|
if (e === t && (l = !0), !t.deleted) {
|
|
3575
3575
|
const d = t.content;
|
|
3576
3576
|
switch (d.constructor) {
|
|
3577
|
-
case
|
|
3578
|
-
const { key: g, value:
|
|
3577
|
+
case T: {
|
|
3578
|
+
const { key: g, value: _ } = (
|
|
3579
3579
|
/** @type {ContentFormat} */
|
|
3580
3580
|
d
|
|
3581
|
-
),
|
|
3582
|
-
(o.get(g) !== d ||
|
|
3581
|
+
), w = (h = n.get(g)) != null ? h : null;
|
|
3582
|
+
(o.get(g) !== d || w === _) && (t.delete(i), c++, !l && ((u = s.get(g)) != null ? u : null) === _ && w !== _ && (w === null ? s.delete(g) : s.set(g, w))), !l && !t.deleted && kt(
|
|
3583
3583
|
s,
|
|
3584
3584
|
/** @type {ContentFormat} */
|
|
3585
3585
|
d
|
|
@@ -3597,7 +3597,7 @@ const hi = (i, t, e) => {
|
|
|
3597
3597
|
t = t.right;
|
|
3598
3598
|
const e = /* @__PURE__ */ new Set();
|
|
3599
3599
|
for (; t && (t.deleted || !t.countable); ) {
|
|
3600
|
-
if (!t.deleted && t.content.constructor ===
|
|
3600
|
+
if (!t.deleted && t.content.constructor === T) {
|
|
3601
3601
|
const n = (
|
|
3602
3602
|
/** @type {ContentFormat} */
|
|
3603
3603
|
t.content.key
|
|
@@ -3608,27 +3608,27 @@ const hi = (i, t, e) => {
|
|
|
3608
3608
|
}
|
|
3609
3609
|
}, fr = (i) => {
|
|
3610
3610
|
let t = 0;
|
|
3611
|
-
return
|
|
3611
|
+
return k(
|
|
3612
3612
|
/** @type {Doc} */
|
|
3613
3613
|
i.doc,
|
|
3614
3614
|
(e) => {
|
|
3615
3615
|
let n = (
|
|
3616
3616
|
/** @type {Item} */
|
|
3617
3617
|
i._start
|
|
3618
|
-
), s = i._start, r =
|
|
3619
|
-
const o =
|
|
3618
|
+
), s = i._start, r = J();
|
|
3619
|
+
const o = Ce(r);
|
|
3620
3620
|
for (; s; ) {
|
|
3621
3621
|
if (s.deleted === !1)
|
|
3622
3622
|
switch (s.content.constructor) {
|
|
3623
|
-
case
|
|
3624
|
-
|
|
3623
|
+
case T:
|
|
3624
|
+
kt(
|
|
3625
3625
|
o,
|
|
3626
3626
|
/** @type {ContentFormat} */
|
|
3627
3627
|
s.content
|
|
3628
3628
|
);
|
|
3629
3629
|
break;
|
|
3630
3630
|
default:
|
|
3631
|
-
t += Yi(e, n, s, r, o), r =
|
|
3631
|
+
t += Yi(e, n, s, r, o), r = Ce(o), n = s;
|
|
3632
3632
|
break;
|
|
3633
3633
|
}
|
|
3634
3634
|
s = s.right;
|
|
@@ -3647,16 +3647,16 @@ const hi = (i, t, e) => {
|
|
|
3647
3647
|
s,
|
|
3648
3648
|
(o) => {
|
|
3649
3649
|
!o.deleted && /** @type {Item} */
|
|
3650
|
-
o.content.constructor ===
|
|
3650
|
+
o.content.constructor === T && o.constructor !== it && t.add(
|
|
3651
3651
|
/** @type {any} */
|
|
3652
3652
|
o.parent
|
|
3653
3653
|
);
|
|
3654
3654
|
}
|
|
3655
3655
|
);
|
|
3656
3656
|
}
|
|
3657
|
-
|
|
3657
|
+
k(e, (n) => {
|
|
3658
3658
|
Oi(i, i.deleteSet, (s) => {
|
|
3659
|
-
if (s instanceof
|
|
3659
|
+
if (s instanceof it || !/** @type {YText} */
|
|
3660
3660
|
s.parent._hasFormatting || t.has(
|
|
3661
3661
|
/** @type {YText} */
|
|
3662
3662
|
s.parent
|
|
@@ -3666,20 +3666,20 @@ const hi = (i, t, e) => {
|
|
|
3666
3666
|
/** @type {YText} */
|
|
3667
3667
|
s.parent
|
|
3668
3668
|
);
|
|
3669
|
-
s.content.constructor ===
|
|
3669
|
+
s.content.constructor === T ? t.add(r) : dr(n, s);
|
|
3670
3670
|
});
|
|
3671
3671
|
for (const s of t)
|
|
3672
3672
|
fr(s);
|
|
3673
3673
|
});
|
|
3674
3674
|
}, di = (i, t, e) => {
|
|
3675
|
-
const n = e, s =
|
|
3675
|
+
const n = e, s = Ce(t.currentAttributes), r = t.right;
|
|
3676
3676
|
for (; e > 0 && t.right !== null; ) {
|
|
3677
3677
|
if (t.right.deleted === !1)
|
|
3678
3678
|
switch (t.right.content.constructor) {
|
|
3679
|
-
case
|
|
3680
|
-
case
|
|
3681
|
-
case
|
|
3682
|
-
e < t.right.length &&
|
|
3679
|
+
case rt:
|
|
3680
|
+
case vt:
|
|
3681
|
+
case Q:
|
|
3682
|
+
e < t.right.length && st(i, v(t.right.id.client, t.right.id.clock + e)), e -= t.right.length, t.right.delete(i);
|
|
3683
3683
|
break;
|
|
3684
3684
|
}
|
|
3685
3685
|
t.forward();
|
|
@@ -3690,9 +3690,9 @@ const hi = (i, t, e) => {
|
|
|
3690
3690
|
/** @type {Item} */
|
|
3691
3691
|
(t.left || t.right).parent
|
|
3692
3692
|
);
|
|
3693
|
-
return o._searchMarker &&
|
|
3693
|
+
return o._searchMarker && Vt(o._searchMarker, t.index, -n + e), t;
|
|
3694
3694
|
};
|
|
3695
|
-
class pr extends
|
|
3695
|
+
class pr extends ie {
|
|
3696
3696
|
/**
|
|
3697
3697
|
* @param {YText} ytext
|
|
3698
3698
|
* @param {Transaction} transaction
|
|
@@ -3735,61 +3735,61 @@ class pr extends ee {
|
|
|
3735
3735
|
/** @type {Doc} */
|
|
3736
3736
|
this.target.doc
|
|
3737
3737
|
), e = [];
|
|
3738
|
-
|
|
3739
|
-
var
|
|
3738
|
+
k(t, (n) => {
|
|
3739
|
+
var _, w, b;
|
|
3740
3740
|
const s = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Map();
|
|
3741
3741
|
let o = this.target._start, c = null;
|
|
3742
3742
|
const l = {};
|
|
3743
3743
|
let h = "", u = 0, d = 0;
|
|
3744
3744
|
const g = () => {
|
|
3745
3745
|
if (c !== null) {
|
|
3746
|
-
let
|
|
3746
|
+
let y = null;
|
|
3747
3747
|
switch (c) {
|
|
3748
3748
|
case "delete":
|
|
3749
|
-
d > 0 && (
|
|
3749
|
+
d > 0 && (y = { delete: d }), d = 0;
|
|
3750
3750
|
break;
|
|
3751
3751
|
case "insert":
|
|
3752
|
-
(typeof h == "object" || h.length > 0) && (
|
|
3753
|
-
|
|
3752
|
+
(typeof h == "object" || h.length > 0) && (y = { insert: h }, s.size > 0 && (y.attributes = {}, s.forEach((I, p) => {
|
|
3753
|
+
I !== null && (y.attributes[p] = I);
|
|
3754
3754
|
}))), h = "";
|
|
3755
3755
|
break;
|
|
3756
3756
|
case "retain":
|
|
3757
|
-
u > 0 && (
|
|
3757
|
+
u > 0 && (y = { retain: u }, _s(l) || (y.attributes = fs({}, l))), u = 0;
|
|
3758
3758
|
break;
|
|
3759
3759
|
}
|
|
3760
|
-
|
|
3760
|
+
y && e.push(y), c = null;
|
|
3761
3761
|
}
|
|
3762
3762
|
};
|
|
3763
3763
|
for (; o !== null; ) {
|
|
3764
3764
|
switch (o.content.constructor) {
|
|
3765
|
-
case
|
|
3766
|
-
case
|
|
3765
|
+
case rt:
|
|
3766
|
+
case vt:
|
|
3767
3767
|
this.adds(o) ? this.deletes(o) || (g(), c = "insert", h = o.content.getContent()[0], g()) : this.deletes(o) ? (c !== "delete" && (g(), c = "delete"), d += 1) : o.deleted || (c !== "retain" && (g(), c = "retain"), u += 1);
|
|
3768
3768
|
break;
|
|
3769
|
-
case
|
|
3769
|
+
case Q:
|
|
3770
3770
|
this.adds(o) ? this.deletes(o) || (c !== "insert" && (g(), c = "insert"), h += /** @type {ContentString} */
|
|
3771
3771
|
o.content.str) : this.deletes(o) ? (c !== "delete" && (g(), c = "delete"), d += o.length) : o.deleted || (c !== "retain" && (g(), c = "retain"), u += o.length);
|
|
3772
3772
|
break;
|
|
3773
|
-
case
|
|
3774
|
-
const { key:
|
|
3773
|
+
case T: {
|
|
3774
|
+
const { key: y, value: I } = (
|
|
3775
3775
|
/** @type {ContentFormat} */
|
|
3776
3776
|
o.content
|
|
3777
3777
|
);
|
|
3778
3778
|
if (this.adds(o)) {
|
|
3779
3779
|
if (!this.deletes(o)) {
|
|
3780
|
-
const
|
|
3781
|
-
|
|
3780
|
+
const p = (_ = s.get(y)) != null ? _ : null;
|
|
3781
|
+
nt(p, I) ? I !== null && o.delete(n) : (c === "retain" && g(), nt(I, (w = r.get(y)) != null ? w : null) ? delete l[y] : l[y] = I);
|
|
3782
3782
|
}
|
|
3783
3783
|
} else if (this.deletes(o)) {
|
|
3784
|
-
r.set(
|
|
3785
|
-
const
|
|
3786
|
-
|
|
3784
|
+
r.set(y, I);
|
|
3785
|
+
const p = (b = s.get(y)) != null ? b : null;
|
|
3786
|
+
nt(p, I) || (c === "retain" && g(), l[y] = p);
|
|
3787
3787
|
} else if (!o.deleted) {
|
|
3788
|
-
r.set(
|
|
3789
|
-
const
|
|
3790
|
-
|
|
3788
|
+
r.set(y, I);
|
|
3789
|
+
const p = l[y];
|
|
3790
|
+
p !== void 0 && (nt(p, I) ? p !== null && o.delete(n) : (c === "retain" && g(), I === null ? delete l[y] : l[y] = I));
|
|
3791
3791
|
}
|
|
3792
|
-
o.deleted || (c === "insert" && g(),
|
|
3792
|
+
o.deleted || (c === "insert" && g(), kt(
|
|
3793
3793
|
s,
|
|
3794
3794
|
/** @type {ContentFormat} */
|
|
3795
3795
|
o.content
|
|
@@ -3800,8 +3800,8 @@ class pr extends ee {
|
|
|
3800
3800
|
o = o.right;
|
|
3801
3801
|
}
|
|
3802
3802
|
for (g(); e.length > 0; ) {
|
|
3803
|
-
const
|
|
3804
|
-
if (
|
|
3803
|
+
const y = e[e.length - 1];
|
|
3804
|
+
if (y.retain !== void 0 && y.attributes === void 0)
|
|
3805
3805
|
e.pop();
|
|
3806
3806
|
else
|
|
3807
3807
|
break;
|
|
@@ -3814,7 +3814,7 @@ class pr extends ee {
|
|
|
3814
3814
|
);
|
|
3815
3815
|
}
|
|
3816
3816
|
}
|
|
3817
|
-
class
|
|
3817
|
+
class Qt extends N {
|
|
3818
3818
|
/**
|
|
3819
3819
|
* @param {String} [string] The initial value of the YText.
|
|
3820
3820
|
*/
|
|
@@ -3844,7 +3844,7 @@ class Zt extends M {
|
|
|
3844
3844
|
this._pending = null;
|
|
3845
3845
|
}
|
|
3846
3846
|
_copy() {
|
|
3847
|
-
return new
|
|
3847
|
+
return new Qt();
|
|
3848
3848
|
}
|
|
3849
3849
|
/**
|
|
3850
3850
|
* Makes a copy of this data type that can be included somewhere else.
|
|
@@ -3854,7 +3854,7 @@ class Zt extends M {
|
|
|
3854
3854
|
* @return {YText}
|
|
3855
3855
|
*/
|
|
3856
3856
|
clone() {
|
|
3857
|
-
const t = new
|
|
3857
|
+
const t = new Qt();
|
|
3858
3858
|
return t.applyDelta(this.toDelta()), t;
|
|
3859
3859
|
}
|
|
3860
3860
|
/**
|
|
@@ -3866,7 +3866,7 @@ class Zt extends M {
|
|
|
3866
3866
|
_callObserver(t, e) {
|
|
3867
3867
|
super._callObserver(t, e);
|
|
3868
3868
|
const n = new pr(this, t, e);
|
|
3869
|
-
|
|
3869
|
+
se(this, t, n), !t.local && this._hasFormatting && (t._needFormattingCleanup = !0);
|
|
3870
3870
|
}
|
|
3871
3871
|
/**
|
|
3872
3872
|
* Returns the unformatted string representation of this YText type.
|
|
@@ -3878,7 +3878,7 @@ class Zt extends M {
|
|
|
3878
3878
|
(n = this.doc) != null || U();
|
|
3879
3879
|
let t = "", e = this._start;
|
|
3880
3880
|
for (; e !== null; )
|
|
3881
|
-
!e.deleted && e.countable && e.content.constructor ===
|
|
3881
|
+
!e.deleted && e.countable && e.content.constructor === Q && (t += /** @type {ContentString} */
|
|
3882
3882
|
e.content.str), e = e.right;
|
|
3883
3883
|
return t;
|
|
3884
3884
|
}
|
|
@@ -3902,14 +3902,14 @@ class Zt extends M {
|
|
|
3902
3902
|
* @public
|
|
3903
3903
|
*/
|
|
3904
3904
|
applyDelta(t, { sanitize: e = !0 } = {}) {
|
|
3905
|
-
this.doc !== null ?
|
|
3906
|
-
const s = new
|
|
3905
|
+
this.doc !== null ? k(this.doc, (n) => {
|
|
3906
|
+
const s = new Re(null, this._start, 0, /* @__PURE__ */ new Map());
|
|
3907
3907
|
for (let r = 0; r < t.length; r++) {
|
|
3908
3908
|
const o = t[r];
|
|
3909
3909
|
if (o.insert !== void 0) {
|
|
3910
3910
|
const c = !e && typeof o.insert == "string" && r === t.length - 1 && s.right === null && o.insert.slice(-1) === `
|
|
3911
3911
|
` ? o.insert.slice(0, -1) : o.insert;
|
|
3912
|
-
(typeof c != "string" || c.length > 0) &&
|
|
3912
|
+
(typeof c != "string" || c.length > 0) && me(n, this, s, c, o.attributes || {});
|
|
3913
3913
|
} else o.retain !== void 0 ? ui(n, this, s, o.retain, o.attributes || {}) : o.delete !== void 0 && di(n, s, o.delete);
|
|
3914
3914
|
}
|
|
3915
3915
|
}) : this._pending.push(() => this.applyDelta(t));
|
|
@@ -3935,44 +3935,44 @@ class Zt extends M {
|
|
|
3935
3935
|
function h() {
|
|
3936
3936
|
if (c.length > 0) {
|
|
3937
3937
|
const g = {};
|
|
3938
|
-
let
|
|
3939
|
-
r.forEach((
|
|
3940
|
-
|
|
3938
|
+
let _ = !1;
|
|
3939
|
+
r.forEach((b, y) => {
|
|
3940
|
+
_ = !0, g[y] = b;
|
|
3941
3941
|
});
|
|
3942
|
-
const
|
|
3943
|
-
|
|
3942
|
+
const w = { insert: c };
|
|
3943
|
+
_ && (w.attributes = g), s.push(w), c = "";
|
|
3944
3944
|
}
|
|
3945
3945
|
}
|
|
3946
3946
|
const u = () => {
|
|
3947
3947
|
for (; l !== null; ) {
|
|
3948
|
-
if (
|
|
3948
|
+
if (dt(l, t) || e !== void 0 && dt(l, e))
|
|
3949
3949
|
switch (l.content.constructor) {
|
|
3950
|
-
case
|
|
3950
|
+
case Q: {
|
|
3951
3951
|
const g = r.get("ychange");
|
|
3952
|
-
t !== void 0 && !
|
|
3952
|
+
t !== void 0 && !dt(l, t) ? (g === void 0 || g.user !== l.id.client || g.type !== "removed") && (h(), r.set("ychange", n ? n("removed", l.id) : { type: "removed" })) : e !== void 0 && !dt(l, e) ? (g === void 0 || g.user !== l.id.client || g.type !== "added") && (h(), r.set("ychange", n ? n("added", l.id) : { type: "added" })) : g !== void 0 && (h(), r.delete("ychange")), c += /** @type {ContentString} */
|
|
3953
3953
|
l.content.str;
|
|
3954
3954
|
break;
|
|
3955
3955
|
}
|
|
3956
|
-
case
|
|
3957
|
-
case
|
|
3956
|
+
case rt:
|
|
3957
|
+
case vt: {
|
|
3958
3958
|
h();
|
|
3959
3959
|
const g = {
|
|
3960
3960
|
insert: l.content.getContent()[0]
|
|
3961
3961
|
};
|
|
3962
3962
|
if (r.size > 0) {
|
|
3963
|
-
const
|
|
3963
|
+
const _ = (
|
|
3964
3964
|
/** @type {Object<string,any>} */
|
|
3965
3965
|
{}
|
|
3966
3966
|
);
|
|
3967
|
-
g.attributes =
|
|
3968
|
-
|
|
3967
|
+
g.attributes = _, r.forEach((w, b) => {
|
|
3968
|
+
_[b] = w;
|
|
3969
3969
|
});
|
|
3970
3970
|
}
|
|
3971
3971
|
s.push(g);
|
|
3972
3972
|
break;
|
|
3973
3973
|
}
|
|
3974
|
-
case
|
|
3975
|
-
|
|
3974
|
+
case T:
|
|
3975
|
+
dt(l, t) && (h(), kt(
|
|
3976
3976
|
r,
|
|
3977
3977
|
/** @type {ContentFormat} */
|
|
3978
3978
|
l.content
|
|
@@ -3983,8 +3983,8 @@ class Zt extends M {
|
|
|
3983
3983
|
}
|
|
3984
3984
|
h();
|
|
3985
3985
|
};
|
|
3986
|
-
return t || e ?
|
|
3987
|
-
t &&
|
|
3986
|
+
return t || e ? k(o, (g) => {
|
|
3987
|
+
t && Ie(g, t), e && Ie(g, e), u();
|
|
3988
3988
|
}, "cleanup") : u(), s;
|
|
3989
3989
|
}
|
|
3990
3990
|
/**
|
|
@@ -4001,11 +4001,11 @@ class Zt extends M {
|
|
|
4001
4001
|
if (e.length <= 0)
|
|
4002
4002
|
return;
|
|
4003
4003
|
const s = this.doc;
|
|
4004
|
-
s !== null ?
|
|
4005
|
-
const o =
|
|
4004
|
+
s !== null ? k(s, (r) => {
|
|
4005
|
+
const o = Pt(r, this, t, !n);
|
|
4006
4006
|
n || (n = {}, o.currentAttributes.forEach((c, l) => {
|
|
4007
4007
|
n[l] = c;
|
|
4008
|
-
})),
|
|
4008
|
+
})), me(r, this, o, e, n);
|
|
4009
4009
|
}) : this._pending.push(() => this.insert(t, e, n));
|
|
4010
4010
|
}
|
|
4011
4011
|
/**
|
|
@@ -4020,9 +4020,9 @@ class Zt extends M {
|
|
|
4020
4020
|
*/
|
|
4021
4021
|
insertEmbed(t, e, n) {
|
|
4022
4022
|
const s = this.doc;
|
|
4023
|
-
s !== null ?
|
|
4024
|
-
const o =
|
|
4025
|
-
|
|
4023
|
+
s !== null ? k(s, (r) => {
|
|
4024
|
+
const o = Pt(r, this, t, !n);
|
|
4025
|
+
me(r, this, o, e, n || {});
|
|
4026
4026
|
}) : this._pending.push(() => this.insertEmbed(t, e, n || {}));
|
|
4027
4027
|
}
|
|
4028
4028
|
/**
|
|
@@ -4037,8 +4037,8 @@ class Zt extends M {
|
|
|
4037
4037
|
if (e === 0)
|
|
4038
4038
|
return;
|
|
4039
4039
|
const n = this.doc;
|
|
4040
|
-
n !== null ?
|
|
4041
|
-
di(s,
|
|
4040
|
+
n !== null ? k(n, (s) => {
|
|
4041
|
+
di(s, Pt(s, this, t, !0), e);
|
|
4042
4042
|
}) : this._pending.push(() => this.delete(t, e));
|
|
4043
4043
|
}
|
|
4044
4044
|
/**
|
|
@@ -4055,8 +4055,8 @@ class Zt extends M {
|
|
|
4055
4055
|
if (e === 0)
|
|
4056
4056
|
return;
|
|
4057
4057
|
const s = this.doc;
|
|
4058
|
-
s !== null ?
|
|
4059
|
-
const o =
|
|
4058
|
+
s !== null ? k(s, (r) => {
|
|
4059
|
+
const o = Pt(r, this, t, !1);
|
|
4060
4060
|
o.right !== null && ui(r, this, o, e, n);
|
|
4061
4061
|
}) : this._pending.push(() => this.format(t, e, n));
|
|
4062
4062
|
}
|
|
@@ -4070,8 +4070,8 @@ class Zt extends M {
|
|
|
4070
4070
|
* @public
|
|
4071
4071
|
*/
|
|
4072
4072
|
removeAttribute(t) {
|
|
4073
|
-
this.doc !== null ?
|
|
4074
|
-
|
|
4073
|
+
this.doc !== null ? k(this.doc, (e) => {
|
|
4074
|
+
Xt(e, this, t);
|
|
4075
4075
|
}) : this._pending.push(() => this.removeAttribute(t));
|
|
4076
4076
|
}
|
|
4077
4077
|
/**
|
|
@@ -4085,8 +4085,8 @@ class Zt extends M {
|
|
|
4085
4085
|
* @public
|
|
4086
4086
|
*/
|
|
4087
4087
|
setAttribute(t, e) {
|
|
4088
|
-
this.doc !== null ?
|
|
4089
|
-
|
|
4088
|
+
this.doc !== null ? k(this.doc, (n) => {
|
|
4089
|
+
xe(n, this, t, e);
|
|
4090
4090
|
}) : this._pending.push(() => this.setAttribute(t, e));
|
|
4091
4091
|
}
|
|
4092
4092
|
/**
|
|
@@ -4103,7 +4103,7 @@ class Zt extends M {
|
|
|
4103
4103
|
getAttribute(t) {
|
|
4104
4104
|
return (
|
|
4105
4105
|
/** @type {any} */
|
|
4106
|
-
|
|
4106
|
+
Be(this, t)
|
|
4107
4107
|
);
|
|
4108
4108
|
}
|
|
4109
4109
|
/**
|
|
@@ -4125,7 +4125,7 @@ class Zt extends M {
|
|
|
4125
4125
|
t.writeTypeRef(Cr);
|
|
4126
4126
|
}
|
|
4127
4127
|
}
|
|
4128
|
-
class
|
|
4128
|
+
class we {
|
|
4129
4129
|
/**
|
|
4130
4130
|
* @param {YXmlFragment | YXmlElement} root
|
|
4131
4131
|
* @param {function(AbstractType<any>):boolean} [f]
|
|
@@ -4151,7 +4151,7 @@ class me {
|
|
|
4151
4151
|
if (t !== null && (!this._firstCall || t.deleted || !this._filter(e)))
|
|
4152
4152
|
do
|
|
4153
4153
|
if (e = /** @type {any} */
|
|
4154
|
-
t.content.type, !t.deleted && (e.constructor ===
|
|
4154
|
+
t.content.type, !t.deleted && (e.constructor === jt || e.constructor === yt) && e._start !== null)
|
|
4155
4155
|
t = e._start;
|
|
4156
4156
|
else
|
|
4157
4157
|
for (; t !== null; )
|
|
@@ -4170,7 +4170,7 @@ class me {
|
|
|
4170
4170
|
), done: !1 });
|
|
4171
4171
|
}
|
|
4172
4172
|
}
|
|
4173
|
-
class
|
|
4173
|
+
class yt extends N {
|
|
4174
4174
|
constructor() {
|
|
4175
4175
|
super(), this._prelimContent = [];
|
|
4176
4176
|
}
|
|
@@ -4199,7 +4199,7 @@ class wt extends M {
|
|
|
4199
4199
|
), this._prelimContent = null;
|
|
4200
4200
|
}
|
|
4201
4201
|
_copy() {
|
|
4202
|
-
return new
|
|
4202
|
+
return new yt();
|
|
4203
4203
|
}
|
|
4204
4204
|
/**
|
|
4205
4205
|
* Makes a copy of this data type that can be included somewhere else.
|
|
@@ -4209,8 +4209,8 @@ class wt extends M {
|
|
|
4209
4209
|
* @return {YXmlFragment}
|
|
4210
4210
|
*/
|
|
4211
4211
|
clone() {
|
|
4212
|
-
const t = new
|
|
4213
|
-
return t.insert(0, this.toArray().map((e) => e instanceof
|
|
4212
|
+
const t = new yt();
|
|
4213
|
+
return t.insert(0, this.toArray().map((e) => e instanceof N ? e.clone() : e)), t;
|
|
4214
4214
|
}
|
|
4215
4215
|
get length() {
|
|
4216
4216
|
var t;
|
|
@@ -4234,7 +4234,7 @@ class wt extends M {
|
|
|
4234
4234
|
* @public
|
|
4235
4235
|
*/
|
|
4236
4236
|
createTreeWalker(t) {
|
|
4237
|
-
return new
|
|
4237
|
+
return new we(this, t);
|
|
4238
4238
|
}
|
|
4239
4239
|
/**
|
|
4240
4240
|
* Returns the first YXmlElement that matches the query.
|
|
@@ -4253,7 +4253,7 @@ class wt extends M {
|
|
|
4253
4253
|
*/
|
|
4254
4254
|
querySelector(t) {
|
|
4255
4255
|
t = t.toUpperCase();
|
|
4256
|
-
const n = new
|
|
4256
|
+
const n = new we(this, (s) => s.nodeName && s.nodeName.toUpperCase() === t).next();
|
|
4257
4257
|
return n.done ? null : n.value;
|
|
4258
4258
|
}
|
|
4259
4259
|
/**
|
|
@@ -4268,7 +4268,7 @@ class wt extends M {
|
|
|
4268
4268
|
* @public
|
|
4269
4269
|
*/
|
|
4270
4270
|
querySelectorAll(t) {
|
|
4271
|
-
return t = t.toUpperCase(),
|
|
4271
|
+
return t = t.toUpperCase(), mt(new we(this, (e) => e.nodeName && e.nodeName.toUpperCase() === t));
|
|
4272
4272
|
}
|
|
4273
4273
|
/**
|
|
4274
4274
|
* Creates YXmlEvent and calls observers.
|
|
@@ -4277,7 +4277,7 @@ class wt extends M {
|
|
|
4277
4277
|
* @param {Set<null|string>} parentSubs Keys changed on this type. `null` if list was modified.
|
|
4278
4278
|
*/
|
|
4279
4279
|
_callObserver(t, e) {
|
|
4280
|
-
|
|
4280
|
+
se(this, t, new _r(this, e, t));
|
|
4281
4281
|
}
|
|
4282
4282
|
/**
|
|
4283
4283
|
* Get the string representation of all the children of this YXmlFragment.
|
|
@@ -4310,7 +4310,7 @@ class wt extends M {
|
|
|
4310
4310
|
*/
|
|
4311
4311
|
toDOM(t = document, e = {}, n) {
|
|
4312
4312
|
const s = t.createDocumentFragment();
|
|
4313
|
-
return n !== void 0 && n._createAssociation(s, this),
|
|
4313
|
+
return n !== void 0 && n._createAssociation(s, this), Ut(this, (r) => {
|
|
4314
4314
|
s.insertBefore(r.toDOM(t, e, n), null);
|
|
4315
4315
|
}), s;
|
|
4316
4316
|
}
|
|
@@ -4325,7 +4325,7 @@ class wt extends M {
|
|
|
4325
4325
|
* @param {Array<YXmlElement|YXmlText>} content The array of content
|
|
4326
4326
|
*/
|
|
4327
4327
|
insert(t, e) {
|
|
4328
|
-
this.doc !== null ?
|
|
4328
|
+
this.doc !== null ? k(this.doc, (n) => {
|
|
4329
4329
|
Wi(n, this, t, e);
|
|
4330
4330
|
}) : this._prelimContent.splice(t, 0, ...e);
|
|
4331
4331
|
}
|
|
@@ -4341,9 +4341,9 @@ class wt extends M {
|
|
|
4341
4341
|
*/
|
|
4342
4342
|
insertAfter(t, e) {
|
|
4343
4343
|
if (this.doc !== null)
|
|
4344
|
-
|
|
4345
|
-
const s = t && t instanceof
|
|
4346
|
-
|
|
4344
|
+
k(this.doc, (n) => {
|
|
4345
|
+
const s = t && t instanceof N ? t._item : t;
|
|
4346
|
+
Yt(n, this, s, e);
|
|
4347
4347
|
});
|
|
4348
4348
|
else {
|
|
4349
4349
|
const n = (
|
|
@@ -4351,7 +4351,7 @@ class wt extends M {
|
|
|
4351
4351
|
this._prelimContent
|
|
4352
4352
|
), s = t === null ? 0 : n.findIndex((r) => r === t) + 1;
|
|
4353
4353
|
if (s === 0 && t !== null)
|
|
4354
|
-
throw
|
|
4354
|
+
throw wt("Reference item not found");
|
|
4355
4355
|
n.splice(s, 0, ...e);
|
|
4356
4356
|
}
|
|
4357
4357
|
}
|
|
@@ -4362,7 +4362,7 @@ class wt extends M {
|
|
|
4362
4362
|
* @param {number} [length=1] The number of elements to remove. Defaults to 1.
|
|
4363
4363
|
*/
|
|
4364
4364
|
delete(t, e = 1) {
|
|
4365
|
-
this.doc !== null ?
|
|
4365
|
+
this.doc !== null ? k(this.doc, (n) => {
|
|
4366
4366
|
Ki(n, this, t, e);
|
|
4367
4367
|
}) : this._prelimContent.splice(t, e);
|
|
4368
4368
|
}
|
|
@@ -4416,7 +4416,7 @@ class wt extends M {
|
|
|
4416
4416
|
* @param {function(YXmlElement|YXmlText,number, typeof self):void} f A function to execute on every element of this YArray.
|
|
4417
4417
|
*/
|
|
4418
4418
|
forEach(t) {
|
|
4419
|
-
|
|
4419
|
+
Ut(this, t);
|
|
4420
4420
|
}
|
|
4421
4421
|
/**
|
|
4422
4422
|
* Transform the properties of this type to binary and write it to an
|
|
@@ -4430,7 +4430,7 @@ class wt extends M {
|
|
|
4430
4430
|
t.writeTypeRef(kr);
|
|
4431
4431
|
}
|
|
4432
4432
|
}
|
|
4433
|
-
class
|
|
4433
|
+
class jt extends yt {
|
|
4434
4434
|
constructor(t = "UNDEFINED") {
|
|
4435
4435
|
super(), this.nodeName = t, this._prelimAttrs = /* @__PURE__ */ new Map();
|
|
4436
4436
|
}
|
|
@@ -4478,7 +4478,7 @@ class Ut extends wt {
|
|
|
4478
4478
|
* @return {YXmlElement}
|
|
4479
4479
|
*/
|
|
4480
4480
|
_copy() {
|
|
4481
|
-
return new
|
|
4481
|
+
return new jt(this.nodeName);
|
|
4482
4482
|
}
|
|
4483
4483
|
/**
|
|
4484
4484
|
* Makes a copy of this data type that can be included somewhere else.
|
|
@@ -4488,10 +4488,10 @@ class Ut extends wt {
|
|
|
4488
4488
|
* @return {YXmlElement<KV>}
|
|
4489
4489
|
*/
|
|
4490
4490
|
clone() {
|
|
4491
|
-
const t = new
|
|
4491
|
+
const t = new jt(this.nodeName), e = this.getAttributes();
|
|
4492
4492
|
return ps(e, (n, s) => {
|
|
4493
4493
|
typeof n == "string" && t.setAttribute(s, n);
|
|
4494
|
-
}), t.insert(0, this.toArray().map((n) => n instanceof
|
|
4494
|
+
}), t.insert(0, this.toArray().map((n) => n instanceof N ? n.clone() : n)), t;
|
|
4495
4495
|
}
|
|
4496
4496
|
/**
|
|
4497
4497
|
* Returns the XML serialization of this YXmlElement.
|
|
@@ -4523,8 +4523,8 @@ class Ut extends wt {
|
|
|
4523
4523
|
* @public
|
|
4524
4524
|
*/
|
|
4525
4525
|
removeAttribute(t) {
|
|
4526
|
-
this.doc !== null ?
|
|
4527
|
-
|
|
4526
|
+
this.doc !== null ? k(this.doc, (e) => {
|
|
4527
|
+
Xt(e, this, t);
|
|
4528
4528
|
}) : this._prelimAttrs.delete(t);
|
|
4529
4529
|
}
|
|
4530
4530
|
/**
|
|
@@ -4538,8 +4538,8 @@ class Ut extends wt {
|
|
|
4538
4538
|
* @public
|
|
4539
4539
|
*/
|
|
4540
4540
|
setAttribute(t, e) {
|
|
4541
|
-
this.doc !== null ?
|
|
4542
|
-
|
|
4541
|
+
this.doc !== null ? k(this.doc, (n) => {
|
|
4542
|
+
xe(n, this, t, e);
|
|
4543
4543
|
}) : this._prelimAttrs.set(t, e);
|
|
4544
4544
|
}
|
|
4545
4545
|
/**
|
|
@@ -4556,7 +4556,7 @@ class Ut extends wt {
|
|
|
4556
4556
|
getAttribute(t) {
|
|
4557
4557
|
return (
|
|
4558
4558
|
/** @type {any} */
|
|
4559
|
-
|
|
4559
|
+
Be(this, t)
|
|
4560
4560
|
);
|
|
4561
4561
|
}
|
|
4562
4562
|
/**
|
|
@@ -4608,7 +4608,7 @@ class Ut extends wt {
|
|
|
4608
4608
|
const c = r[o];
|
|
4609
4609
|
typeof c == "string" && s.setAttribute(o, c);
|
|
4610
4610
|
}
|
|
4611
|
-
return
|
|
4611
|
+
return Ut(this, (o) => {
|
|
4612
4612
|
s.appendChild(o.toDOM(t, e, n));
|
|
4613
4613
|
}), n !== void 0 && n._createAssociation(s, this), s;
|
|
4614
4614
|
}
|
|
@@ -4624,7 +4624,7 @@ class Ut extends wt {
|
|
|
4624
4624
|
t.writeTypeRef(Er), t.writeKey(this.nodeName);
|
|
4625
4625
|
}
|
|
4626
4626
|
}
|
|
4627
|
-
class _r extends
|
|
4627
|
+
class _r extends ie {
|
|
4628
4628
|
/**
|
|
4629
4629
|
* @param {YXmlElement|YXmlText|YXmlFragment} target The target on which the event is created.
|
|
4630
4630
|
* @param {Set<string|null>} subs The set of changed attributes. `null` is included if the
|
|
@@ -4650,7 +4650,7 @@ class Xi {
|
|
|
4650
4650
|
* @type {boolean}
|
|
4651
4651
|
*/
|
|
4652
4652
|
get deleted() {
|
|
4653
|
-
throw
|
|
4653
|
+
throw H();
|
|
4654
4654
|
}
|
|
4655
4655
|
/**
|
|
4656
4656
|
* Merge this struct with the item to the right.
|
|
@@ -4668,18 +4668,18 @@ class Xi {
|
|
|
4668
4668
|
* @param {number} encodingRef
|
|
4669
4669
|
*/
|
|
4670
4670
|
write(t, e, n) {
|
|
4671
|
-
throw
|
|
4671
|
+
throw H();
|
|
4672
4672
|
}
|
|
4673
4673
|
/**
|
|
4674
4674
|
* @param {Transaction} transaction
|
|
4675
4675
|
* @param {number} offset
|
|
4676
4676
|
*/
|
|
4677
4677
|
integrate(t, e) {
|
|
4678
|
-
throw
|
|
4678
|
+
throw H();
|
|
4679
4679
|
}
|
|
4680
4680
|
}
|
|
4681
4681
|
const mr = 0;
|
|
4682
|
-
class
|
|
4682
|
+
class it extends Xi {
|
|
4683
4683
|
get deleted() {
|
|
4684
4684
|
return !0;
|
|
4685
4685
|
}
|
|
@@ -4715,7 +4715,7 @@ class et extends Xi {
|
|
|
4715
4715
|
return null;
|
|
4716
4716
|
}
|
|
4717
4717
|
}
|
|
4718
|
-
class
|
|
4718
|
+
class re {
|
|
4719
4719
|
/**
|
|
4720
4720
|
* @param {Uint8Array} content
|
|
4721
4721
|
*/
|
|
@@ -4744,14 +4744,14 @@ class se {
|
|
|
4744
4744
|
* @return {ContentBinary}
|
|
4745
4745
|
*/
|
|
4746
4746
|
copy() {
|
|
4747
|
-
return new
|
|
4747
|
+
return new re(this.content);
|
|
4748
4748
|
}
|
|
4749
4749
|
/**
|
|
4750
4750
|
* @param {number} offset
|
|
4751
4751
|
* @return {ContentBinary}
|
|
4752
4752
|
*/
|
|
4753
4753
|
splice(t) {
|
|
4754
|
-
throw
|
|
4754
|
+
throw H();
|
|
4755
4755
|
}
|
|
4756
4756
|
/**
|
|
4757
4757
|
* @param {ContentBinary} right
|
|
@@ -4790,7 +4790,7 @@ class se {
|
|
|
4790
4790
|
return 3;
|
|
4791
4791
|
}
|
|
4792
4792
|
}
|
|
4793
|
-
class
|
|
4793
|
+
class te {
|
|
4794
4794
|
/**
|
|
4795
4795
|
* @param {number} len
|
|
4796
4796
|
*/
|
|
@@ -4819,14 +4819,14 @@ class Qt {
|
|
|
4819
4819
|
* @return {ContentDeleted}
|
|
4820
4820
|
*/
|
|
4821
4821
|
copy() {
|
|
4822
|
-
return new
|
|
4822
|
+
return new te(this.len);
|
|
4823
4823
|
}
|
|
4824
4824
|
/**
|
|
4825
4825
|
* @param {number} offset
|
|
4826
4826
|
* @return {ContentDeleted}
|
|
4827
4827
|
*/
|
|
4828
4828
|
splice(t) {
|
|
4829
|
-
const e = new
|
|
4829
|
+
const e = new te(this.len - t);
|
|
4830
4830
|
return this.len = t, e;
|
|
4831
4831
|
}
|
|
4832
4832
|
/**
|
|
@@ -4867,8 +4867,8 @@ class Qt {
|
|
|
4867
4867
|
return 1;
|
|
4868
4868
|
}
|
|
4869
4869
|
}
|
|
4870
|
-
const wr = (i, t) => new
|
|
4871
|
-
class
|
|
4870
|
+
const wr = (i, t) => new Et({ guid: i, ...t, shouldLoad: t.shouldLoad || t.autoLoad || !1 });
|
|
4871
|
+
class oe {
|
|
4872
4872
|
/**
|
|
4873
4873
|
* @param {Doc} doc
|
|
4874
4874
|
*/
|
|
@@ -4899,14 +4899,14 @@ class re {
|
|
|
4899
4899
|
* @return {ContentDoc}
|
|
4900
4900
|
*/
|
|
4901
4901
|
copy() {
|
|
4902
|
-
return new
|
|
4902
|
+
return new oe(wr(this.doc.guid, this.opts));
|
|
4903
4903
|
}
|
|
4904
4904
|
/**
|
|
4905
4905
|
* @param {number} offset
|
|
4906
4906
|
* @return {ContentDoc}
|
|
4907
4907
|
*/
|
|
4908
4908
|
splice(t) {
|
|
4909
|
-
throw
|
|
4909
|
+
throw H();
|
|
4910
4910
|
}
|
|
4911
4911
|
/**
|
|
4912
4912
|
* @param {ContentDoc} right
|
|
@@ -4947,7 +4947,7 @@ class re {
|
|
|
4947
4947
|
return 9;
|
|
4948
4948
|
}
|
|
4949
4949
|
}
|
|
4950
|
-
class
|
|
4950
|
+
class vt {
|
|
4951
4951
|
/**
|
|
4952
4952
|
* @param {Object} embed
|
|
4953
4953
|
*/
|
|
@@ -4976,14 +4976,14 @@ class kt {
|
|
|
4976
4976
|
* @return {ContentEmbed}
|
|
4977
4977
|
*/
|
|
4978
4978
|
copy() {
|
|
4979
|
-
return new
|
|
4979
|
+
return new vt(this.embed);
|
|
4980
4980
|
}
|
|
4981
4981
|
/**
|
|
4982
4982
|
* @param {number} offset
|
|
4983
4983
|
* @return {ContentEmbed}
|
|
4984
4984
|
*/
|
|
4985
4985
|
splice(t) {
|
|
4986
|
-
throw
|
|
4986
|
+
throw H();
|
|
4987
4987
|
}
|
|
4988
4988
|
/**
|
|
4989
4989
|
* @param {ContentEmbed} right
|
|
@@ -5022,7 +5022,7 @@ class kt {
|
|
|
5022
5022
|
return 5;
|
|
5023
5023
|
}
|
|
5024
5024
|
}
|
|
5025
|
-
class
|
|
5025
|
+
class T {
|
|
5026
5026
|
/**
|
|
5027
5027
|
* @param {string} key
|
|
5028
5028
|
* @param {Object} value
|
|
@@ -5052,14 +5052,14 @@ class L {
|
|
|
5052
5052
|
* @return {ContentFormat}
|
|
5053
5053
|
*/
|
|
5054
5054
|
copy() {
|
|
5055
|
-
return new
|
|
5055
|
+
return new T(this.key, this.value);
|
|
5056
5056
|
}
|
|
5057
5057
|
/**
|
|
5058
5058
|
* @param {number} _offset
|
|
5059
5059
|
* @return {ContentFormat}
|
|
5060
5060
|
*/
|
|
5061
5061
|
splice(t) {
|
|
5062
|
-
throw
|
|
5062
|
+
throw H();
|
|
5063
5063
|
}
|
|
5064
5064
|
/**
|
|
5065
5065
|
* @param {ContentFormat} _right
|
|
@@ -5103,8 +5103,8 @@ class L {
|
|
|
5103
5103
|
return 6;
|
|
5104
5104
|
}
|
|
5105
5105
|
}
|
|
5106
|
-
const yr =
|
|
5107
|
-
class
|
|
5106
|
+
const yr = zt("node_env") === "development";
|
|
5107
|
+
class bt {
|
|
5108
5108
|
/**
|
|
5109
5109
|
* @param {Array<any>} arr
|
|
5110
5110
|
*/
|
|
@@ -5133,14 +5133,14 @@ class yt {
|
|
|
5133
5133
|
* @return {ContentAny}
|
|
5134
5134
|
*/
|
|
5135
5135
|
copy() {
|
|
5136
|
-
return new
|
|
5136
|
+
return new bt(this.arr);
|
|
5137
5137
|
}
|
|
5138
5138
|
/**
|
|
5139
5139
|
* @param {number} offset
|
|
5140
5140
|
* @return {ContentAny}
|
|
5141
5141
|
*/
|
|
5142
5142
|
splice(t) {
|
|
5143
|
-
const e = new
|
|
5143
|
+
const e = new bt(this.arr.slice(t));
|
|
5144
5144
|
return this.arr = this.arr.slice(0, t), e;
|
|
5145
5145
|
}
|
|
5146
5146
|
/**
|
|
@@ -5185,7 +5185,7 @@ class yt {
|
|
|
5185
5185
|
return 8;
|
|
5186
5186
|
}
|
|
5187
5187
|
}
|
|
5188
|
-
class
|
|
5188
|
+
class Q {
|
|
5189
5189
|
/**
|
|
5190
5190
|
* @param {string} str
|
|
5191
5191
|
*/
|
|
@@ -5214,14 +5214,14 @@ class Z {
|
|
|
5214
5214
|
* @return {ContentString}
|
|
5215
5215
|
*/
|
|
5216
5216
|
copy() {
|
|
5217
|
-
return new
|
|
5217
|
+
return new Q(this.str);
|
|
5218
5218
|
}
|
|
5219
5219
|
/**
|
|
5220
5220
|
* @param {number} offset
|
|
5221
5221
|
* @return {ContentString}
|
|
5222
5222
|
*/
|
|
5223
5223
|
splice(t) {
|
|
5224
|
-
const e = new
|
|
5224
|
+
const e = new Q(this.str.slice(t));
|
|
5225
5225
|
this.str = this.str.slice(0, t);
|
|
5226
5226
|
const n = this.str.charCodeAt(t - 1);
|
|
5227
5227
|
return n >= 55296 && n <= 56319 && (this.str = this.str.slice(0, t - 1) + "�", e.str = "�" + e.str.slice(1)), e;
|
|
@@ -5264,7 +5264,7 @@ class Z {
|
|
|
5264
5264
|
}
|
|
5265
5265
|
}
|
|
5266
5266
|
const br = 0, Sr = 1, Cr = 2, Er = 3, kr = 4;
|
|
5267
|
-
class
|
|
5267
|
+
class rt {
|
|
5268
5268
|
/**
|
|
5269
5269
|
* @param {AbstractType<any>} type
|
|
5270
5270
|
*/
|
|
@@ -5293,14 +5293,14 @@ class st {
|
|
|
5293
5293
|
* @return {ContentType}
|
|
5294
5294
|
*/
|
|
5295
5295
|
copy() {
|
|
5296
|
-
return new
|
|
5296
|
+
return new rt(this.type._copy());
|
|
5297
5297
|
}
|
|
5298
5298
|
/**
|
|
5299
5299
|
* @param {number} offset
|
|
5300
5300
|
* @return {ContentType}
|
|
5301
5301
|
*/
|
|
5302
5302
|
splice(t) {
|
|
5303
|
-
throw
|
|
5303
|
+
throw H();
|
|
5304
5304
|
}
|
|
5305
5305
|
/**
|
|
5306
5306
|
* @param {ContentType} right
|
|
@@ -5358,16 +5358,16 @@ class st {
|
|
|
5358
5358
|
}
|
|
5359
5359
|
const Zi = (i, t, e) => {
|
|
5360
5360
|
const { client: n, clock: s } = t.id, r = new V(
|
|
5361
|
-
|
|
5361
|
+
v(n, s + e),
|
|
5362
5362
|
t,
|
|
5363
|
-
|
|
5363
|
+
v(n, s + e - 1),
|
|
5364
5364
|
t.right,
|
|
5365
5365
|
t.rightOrigin,
|
|
5366
5366
|
t.parent,
|
|
5367
5367
|
t.parentSub,
|
|
5368
5368
|
t.content.splice(e)
|
|
5369
5369
|
);
|
|
5370
|
-
return t.deleted && r.markDeleted(), t.keep && (r.keep = !0), t.redone !== null && (r.redone =
|
|
5370
|
+
return t.deleted && r.markDeleted(), t.keep && (r.keep = !0), t.redone !== null && (r.redone = v(t.redone.client, t.redone.clock + e)), t.right = r, r.right !== null && (r.right.left = r), i._mergeStructs.push(r), r.parentSub !== null && r.right === null && r.parent._map.set(r.parentSub, r), t.length = e, r;
|
|
5371
5371
|
};
|
|
5372
5372
|
class V extends Xi {
|
|
5373
5373
|
/**
|
|
@@ -5389,10 +5389,10 @@ class V extends Xi {
|
|
|
5389
5389
|
* @type {boolean}
|
|
5390
5390
|
*/
|
|
5391
5391
|
set marker(t) {
|
|
5392
|
-
(this.info &
|
|
5392
|
+
(this.info & de) > 0 !== t && (this.info ^= de);
|
|
5393
5393
|
}
|
|
5394
5394
|
get marker() {
|
|
5395
|
-
return (this.info &
|
|
5395
|
+
return (this.info & de) > 0;
|
|
5396
5396
|
}
|
|
5397
5397
|
/**
|
|
5398
5398
|
* If true, do not garbage collect this Item.
|
|
@@ -5411,13 +5411,13 @@ class V extends Xi {
|
|
|
5411
5411
|
* @type {Boolean}
|
|
5412
5412
|
*/
|
|
5413
5413
|
get deleted() {
|
|
5414
|
-
return (this.info &
|
|
5414
|
+
return (this.info & ue) > 0;
|
|
5415
5415
|
}
|
|
5416
5416
|
set deleted(t) {
|
|
5417
|
-
this.deleted !== t && (this.info ^=
|
|
5417
|
+
this.deleted !== t && (this.info ^= ue);
|
|
5418
5418
|
}
|
|
5419
5419
|
markDeleted() {
|
|
5420
|
-
this.info |=
|
|
5420
|
+
this.info |= ue;
|
|
5421
5421
|
}
|
|
5422
5422
|
/**
|
|
5423
5423
|
* Return the creator clientID of the missing op or define missing items and return null.
|
|
@@ -5431,15 +5431,15 @@ class V extends Xi {
|
|
|
5431
5431
|
return this.origin.client;
|
|
5432
5432
|
if (this.rightOrigin && this.rightOrigin.client !== this.id.client && this.rightOrigin.clock >= $(e, this.rightOrigin.client))
|
|
5433
5433
|
return this.rightOrigin.client;
|
|
5434
|
-
if (this.parent && this.parent.constructor ===
|
|
5434
|
+
if (this.parent && this.parent.constructor === Gt && this.id.client !== this.parent.client && this.parent.clock >= $(e, this.parent.client))
|
|
5435
5435
|
return this.parent.client;
|
|
5436
|
-
if (this.origin && (this.left = oi(t, e, this.origin), this.origin = this.left.lastId), this.rightOrigin && (this.right =
|
|
5436
|
+
if (this.origin && (this.left = oi(t, e, this.origin), this.origin = this.left.lastId), this.rightOrigin && (this.right = st(t, this.rightOrigin), this.rightOrigin = this.right.id), this.left && this.left.constructor === it || this.right && this.right.constructor === it)
|
|
5437
5437
|
this.parent = null;
|
|
5438
5438
|
else if (!this.parent)
|
|
5439
5439
|
this.left && this.left.constructor === V && (this.parent = this.left.parent, this.parentSub = this.left.parentSub), this.right && this.right.constructor === V && (this.parent = this.right.parent, this.parentSub = this.right.parentSub);
|
|
5440
|
-
else if (this.parent.constructor ===
|
|
5441
|
-
const n =
|
|
5442
|
-
n.constructor ===
|
|
5440
|
+
else if (this.parent.constructor === Gt) {
|
|
5441
|
+
const n = _e(e, this.parent);
|
|
5442
|
+
n.constructor === it ? this.parent = null : this.parent = /** @type {ContentType} */
|
|
5443
5443
|
n.content.type;
|
|
5444
5444
|
}
|
|
5445
5445
|
return null;
|
|
@@ -5449,7 +5449,7 @@ class V extends Xi {
|
|
|
5449
5449
|
* @param {number} offset
|
|
5450
5450
|
*/
|
|
5451
5451
|
integrate(t, e) {
|
|
5452
|
-
if (e > 0 && (this.id.clock += e, this.left = oi(t, t.doc.store,
|
|
5452
|
+
if (e > 0 && (this.id.clock += e, this.left = oi(t, t.doc.store, v(this.id.client, this.id.clock - 1)), this.origin = this.left.lastId, this.content = this.content.splice(e), this.length -= e), this.parent) {
|
|
5453
5453
|
if (!this.left && (!this.right || this.right.left !== null) || this.left && this.left.right !== this.right) {
|
|
5454
5454
|
let n = this.left, s;
|
|
5455
5455
|
if (n !== null)
|
|
@@ -5463,13 +5463,13 @@ class V extends Xi {
|
|
|
5463
5463
|
this.parent._start;
|
|
5464
5464
|
const r = /* @__PURE__ */ new Set(), o = /* @__PURE__ */ new Set();
|
|
5465
5465
|
for (; s !== null && s !== this.right; ) {
|
|
5466
|
-
if (o.add(s), r.add(s),
|
|
5466
|
+
if (o.add(s), r.add(s), Bt(this.origin, s.origin)) {
|
|
5467
5467
|
if (s.id.client < this.id.client)
|
|
5468
5468
|
n = s, r.clear();
|
|
5469
|
-
else if (
|
|
5469
|
+
else if (Bt(this.rightOrigin, s.rightOrigin))
|
|
5470
5470
|
break;
|
|
5471
|
-
} else if (s.origin !== null && o.has(
|
|
5472
|
-
r.has(
|
|
5471
|
+
} else if (s.origin !== null && o.has(_e(t.doc.store, s.origin)))
|
|
5472
|
+
r.has(_e(t.doc.store, s.origin)) || (n = s, r.clear());
|
|
5473
5473
|
else
|
|
5474
5474
|
break;
|
|
5475
5475
|
s = s.right;
|
|
@@ -5499,7 +5499,7 @@ class V extends Xi {
|
|
|
5499
5499
|
(this.parent._item !== null && /** @type {AbstractType<any>} */
|
|
5500
5500
|
this.parent._item.deleted || this.parentSub !== null && this.right !== null) && this.delete(t);
|
|
5501
5501
|
} else
|
|
5502
|
-
new
|
|
5502
|
+
new it(this.id, this.length).integrate(t, 0);
|
|
5503
5503
|
}
|
|
5504
5504
|
/**
|
|
5505
5505
|
* Returns the next non-deleted item
|
|
@@ -5523,7 +5523,7 @@ class V extends Xi {
|
|
|
5523
5523
|
* Computes the last content address of this Item.
|
|
5524
5524
|
*/
|
|
5525
5525
|
get lastId() {
|
|
5526
|
-
return this.length === 1 ? this.id :
|
|
5526
|
+
return this.length === 1 ? this.id : v(this.id.client, this.id.clock + this.length - 1);
|
|
5527
5527
|
}
|
|
5528
5528
|
/**
|
|
5529
5529
|
* Try to merge two items
|
|
@@ -5532,7 +5532,7 @@ class V extends Xi {
|
|
|
5532
5532
|
* @return {boolean}
|
|
5533
5533
|
*/
|
|
5534
5534
|
mergeWith(t) {
|
|
5535
|
-
if (this.constructor === t.constructor &&
|
|
5535
|
+
if (this.constructor === t.constructor && Bt(t.origin, this.lastId) && this.right === t && Bt(this.rightOrigin, t.rightOrigin) && this.id.client === t.id.client && this.id.clock + this.length === t.id.clock && this.deleted === t.deleted && this.redone === null && t.redone === null && this.content.constructor === t.content.constructor && this.content.mergeWith(t.content)) {
|
|
5536
5536
|
const e = (
|
|
5537
5537
|
/** @type {AbstractType<any>} */
|
|
5538
5538
|
this.parent._searchMarker
|
|
@@ -5563,8 +5563,8 @@ class V extends Xi {
|
|
|
5563
5563
|
*/
|
|
5564
5564
|
gc(t, e) {
|
|
5565
5565
|
if (!this.deleted)
|
|
5566
|
-
throw
|
|
5567
|
-
this.content.gc(t), e ? Qs(t, this, new
|
|
5566
|
+
throw ht();
|
|
5567
|
+
this.content.gc(t), e ? Qs(t, this, new it(this.id, this.length)) : this.content = new te(this.length);
|
|
5568
5568
|
}
|
|
5569
5569
|
/**
|
|
5570
5570
|
* Transform the properties of this type to binary and write it to an
|
|
@@ -5576,7 +5576,7 @@ class V extends Xi {
|
|
|
5576
5576
|
* @param {number} offset
|
|
5577
5577
|
*/
|
|
5578
5578
|
write(t, e) {
|
|
5579
|
-
const n = e > 0 ?
|
|
5579
|
+
const n = e > 0 ? v(this.id.client, this.id.clock + e - 1) : this.origin, s = this.rightOrigin, r = this.parentSub, o = this.content.getRef() & Fn | (n === null ? 0 : qt) | // origin is defined
|
|
5580
5580
|
(s === null ? 0 : _i) | // right origin is defined
|
|
5581
5581
|
(r === null ? 0 : Bn);
|
|
5582
5582
|
if (t.writeInfo(o), n !== null && t.writeLeftID(n), s !== null && t.writeRightID(s), n === null && s === null) {
|
|
@@ -5591,7 +5591,7 @@ class V extends Xi {
|
|
|
5591
5591
|
t.writeParentInfo(!0), t.writeString(h);
|
|
5592
5592
|
} else
|
|
5593
5593
|
t.writeParentInfo(!1), t.writeLeftID(l.id);
|
|
5594
|
-
} else c.constructor === String ? (t.writeParentInfo(!0), t.writeString(c)) : c.constructor ===
|
|
5594
|
+
} else c.constructor === String ? (t.writeParentInfo(!0), t.writeString(c)) : c.constructor === Gt ? (t.writeParentInfo(!1), t.writeLeftID(c)) : ht();
|
|
5595
5595
|
r !== null && t.writeString(r);
|
|
5596
5596
|
}
|
|
5597
5597
|
this.content.write(t, e);
|
|
@@ -5603,9 +5603,9 @@ const Qi = (
|
|
|
5603
5603
|
), tn = "__ $YJS$ __";
|
|
5604
5604
|
Qi[tn] === !0 && console.error("Yjs was already imported. This breaks constructor checks and will lead to issues! - https://github.com/yjs/yjs/issues/438");
|
|
5605
5605
|
Qi[tn] = !0;
|
|
5606
|
-
const
|
|
5606
|
+
const Ot = (i) => Promise.reject(new Error("unimplemented method GetVoiceSign")), ye = (i, t = {}, e = []) => ({
|
|
5607
5607
|
command: i,
|
|
5608
|
-
front_request_id:
|
|
5608
|
+
front_request_id: Tt(),
|
|
5609
5609
|
data: {
|
|
5610
5610
|
...t,
|
|
5611
5611
|
to_user_ids: Array.isArray(e) ? e : [e]
|
|
@@ -5614,7 +5614,7 @@ const It = (i) => Promise.reject(new Error("unimplemented method GetVoiceSign"))
|
|
|
5614
5614
|
var i, t;
|
|
5615
5615
|
window != null && window.__Realsee_Live__ && ((t = (i = window == null ? void 0 : window.__Realsee_Live__) == null ? void 0 : i.dispose) == null || t.call(i), window.__Realsee_Live__ = null);
|
|
5616
5616
|
};
|
|
5617
|
-
class Ir extends
|
|
5617
|
+
class Ir extends Lt {
|
|
5618
5618
|
/**
|
|
5619
5619
|
* 创建 Live 带看实例
|
|
5620
5620
|
*
|
|
@@ -5678,7 +5678,7 @@ class Ir extends At {
|
|
|
5678
5678
|
* })
|
|
5679
5679
|
* ```
|
|
5680
5680
|
*/
|
|
5681
|
-
a(this, "keyframes", new
|
|
5681
|
+
a(this, "keyframes", new Lt());
|
|
5682
5682
|
/**
|
|
5683
5683
|
* 带看的 Yjs 文档实例(用于帧数据同步)
|
|
5684
5684
|
*/
|
|
@@ -5705,7 +5705,7 @@ class Ir extends At {
|
|
|
5705
5705
|
const { transaction: n, target: s, changes: r } = e;
|
|
5706
5706
|
if (s === this._buildInData.keyframes)
|
|
5707
5707
|
if (n.origin.triggerUserId === ((o = this.selfInfo) == null ? void 0 : o.id)) {
|
|
5708
|
-
const c =
|
|
5708
|
+
const c = ye(B.KeyframeSync, this.snapshot, void 0);
|
|
5709
5709
|
try {
|
|
5710
5710
|
this._controller.sendMessage(c);
|
|
5711
5711
|
} catch (l) {
|
|
@@ -5794,7 +5794,7 @@ class Ir extends At {
|
|
|
5794
5794
|
*/
|
|
5795
5795
|
a(this, "_initializeOptions", (e) => {
|
|
5796
5796
|
var n;
|
|
5797
|
-
this._options = Object.assign({ initialMicroStatus:
|
|
5797
|
+
this._options = Object.assign({ initialMicroStatus: ct.OPEN }, e), this._options.jsBridge = this._initializeJsBridge(e), this._options.getVoiceSign = (n = e.getVoiceSign) != null ? n : Ot, this._options.autoPlayConfirm = e.autoPlayConfirm, this._options.rtc = this._initializeRTC(e);
|
|
5798
5798
|
});
|
|
5799
5799
|
/**
|
|
5800
5800
|
* 初始化 JSBridge 实例(内部方法)
|
|
@@ -5827,14 +5827,14 @@ class Ir extends At {
|
|
|
5827
5827
|
return;
|
|
5828
5828
|
}
|
|
5829
5829
|
switch (e.rtcType) {
|
|
5830
|
-
case
|
|
5830
|
+
case lt.RealseeVRWebViewRTC:
|
|
5831
5831
|
return this._createVRWebViewRTC();
|
|
5832
|
-
case
|
|
5832
|
+
case lt.RealseeBrowserChimeRTC:
|
|
5833
5833
|
return new We({
|
|
5834
|
-
getVoiceSign: (n = this._options.getVoiceSign) != null ? n :
|
|
5834
|
+
getVoiceSign: (n = this._options.getVoiceSign) != null ? n : Ot,
|
|
5835
5835
|
logLevel: e.__debug__ ? 0 : 1
|
|
5836
5836
|
});
|
|
5837
|
-
case
|
|
5837
|
+
case lt.RealseeBrowserRTC:
|
|
5838
5838
|
return this._createBrowserRTC();
|
|
5839
5839
|
default:
|
|
5840
5840
|
m.error("unknown built-in RTC type");
|
|
@@ -5850,7 +5850,7 @@ class Ir extends At {
|
|
|
5850
5850
|
if (this._options.jsBridge)
|
|
5851
5851
|
return new wn({
|
|
5852
5852
|
jsBridge: this._options.jsBridge,
|
|
5853
|
-
getVoiceSign: (e = this._options.getVoiceSign) != null ? e :
|
|
5853
|
+
getVoiceSign: (e = this._options.getVoiceSign) != null ? e : Ot
|
|
5854
5854
|
});
|
|
5855
5855
|
m.error("JsBridge instance must be passed when using built-in VRWebViewRTC instances");
|
|
5856
5856
|
});
|
|
@@ -5865,7 +5865,7 @@ class Ir extends At {
|
|
|
5865
5865
|
return;
|
|
5866
5866
|
}
|
|
5867
5867
|
return new mn({
|
|
5868
|
-
getVoiceSign: (e = this._options.getVoiceSign) != null ? e :
|
|
5868
|
+
getVoiceSign: (e = this._options.getVoiceSign) != null ? e : Ot,
|
|
5869
5869
|
autoPlayConfirm: this._options.autoPlayConfirm
|
|
5870
5870
|
});
|
|
5871
5871
|
});
|
|
@@ -5877,7 +5877,7 @@ class Ir extends At {
|
|
|
5877
5877
|
*/
|
|
5878
5878
|
a(this, "_createDefaultRTC", (e) => {
|
|
5879
5879
|
var s;
|
|
5880
|
-
const n = (s = this._options.getVoiceSign) != null ? s :
|
|
5880
|
+
const n = (s = this._options.getVoiceSign) != null ? s : Ot;
|
|
5881
5881
|
return !this._options.jsBridge || !Ge && !Ke ? e.builtInRTCType === fi.RealseeXChimeRTC ? new We({ getVoiceSign: n }) : this._createBrowserRTC() : Ge && (vn || In) || Ke ? this._createVRWebViewRTC() : this._createBrowserRTC();
|
|
5882
5882
|
});
|
|
5883
5883
|
/**
|
|
@@ -5919,81 +5919,81 @@ class Ir extends At {
|
|
|
5919
5919
|
* @param liveMsg
|
|
5920
5920
|
*/
|
|
5921
5921
|
a(this, "_handleMessage", async (e) => {
|
|
5922
|
-
var n, s, r, o, c, l;
|
|
5922
|
+
var n, s, r, o, c, l, h, u, d;
|
|
5923
5923
|
if (m.debug("Received message:", e), typeof e == "object") {
|
|
5924
|
-
const { command:
|
|
5925
|
-
if (
|
|
5926
|
-
switch (
|
|
5924
|
+
const { command: g, data: _ = {}, frontRequestId: w, code: b, message: y, triggerUserId: I } = e;
|
|
5925
|
+
if (b === "SUCCESS")
|
|
5926
|
+
switch (g) {
|
|
5927
5927
|
case B.SelfUserInfo: {
|
|
5928
|
-
const p =
|
|
5929
|
-
Dn(this.selfInfo, p, { deep: !0 }) || (this._buildInData.selfInfo = p, this.emit("selfInfoUpdate", this._buildInData.selfInfo,
|
|
5928
|
+
const p = _;
|
|
5929
|
+
Dn(this.selfInfo, p, { deep: !0 }) || (this._buildInData.selfInfo = p, this.emit("selfInfoUpdate", this._buildInData.selfInfo, w));
|
|
5930
5930
|
break;
|
|
5931
5931
|
}
|
|
5932
5932
|
case B.RoomInfo: {
|
|
5933
|
-
const p =
|
|
5933
|
+
const p = _;
|
|
5934
5934
|
this._buildInData.roomInfo = Object.assign({}, p);
|
|
5935
|
-
const
|
|
5935
|
+
const F = p.last_frame || {};
|
|
5936
5936
|
this._yDoc.transact(
|
|
5937
5937
|
() => {
|
|
5938
|
-
for (const
|
|
5939
|
-
this._buildInData.keyframes.set(
|
|
5938
|
+
for (const f in F)
|
|
5939
|
+
this._buildInData.keyframes.set(f, F[f]);
|
|
5940
5940
|
},
|
|
5941
5941
|
{
|
|
5942
5942
|
triggerUserId: "readyKeyframeSync",
|
|
5943
|
-
frontRequestId:
|
|
5943
|
+
frontRequestId: w
|
|
5944
5944
|
}
|
|
5945
5945
|
), this.emit("readyKeyframeSync", p.last_frame || {});
|
|
5946
5946
|
break;
|
|
5947
5947
|
}
|
|
5948
5948
|
case B.RTCInfo: {
|
|
5949
|
-
m.info("RTC info updated:",
|
|
5950
|
-
const { voice_id: p, type:
|
|
5951
|
-
if (this._buildInData.rtcInfo = { voiceId: p, type:
|
|
5949
|
+
m.info("RTC info updated:", _);
|
|
5950
|
+
const { voice_id: p, type: F } = _;
|
|
5951
|
+
if (this._buildInData.rtcInfo = { voiceId: p, type: F }, (n = this.$RTC) != null && n.joined)
|
|
5952
5952
|
m.warn("已加入语音房间,无需重复加入!");
|
|
5953
5953
|
else if (await ((o = this.$RTC) == null ? void 0 : o.join({
|
|
5954
5954
|
voiceId: p,
|
|
5955
5955
|
userId: ((s = this.selfInfo) == null ? void 0 : s.id) || "",
|
|
5956
5956
|
roomId: (r = this.roomInfo) == null ? void 0 : r.info.room_code,
|
|
5957
|
-
type:
|
|
5957
|
+
type: F
|
|
5958
5958
|
}))) {
|
|
5959
|
-
const
|
|
5960
|
-
await this.toggleMicro(
|
|
5959
|
+
const S = (c = this._options.initialMicroStatus) != null ? c : ct.OPEN;
|
|
5960
|
+
await this.toggleMicro(S === ct.OPEN);
|
|
5961
5961
|
} else
|
|
5962
5962
|
m.error("加入语音房间失败");
|
|
5963
5963
|
break;
|
|
5964
5964
|
}
|
|
5965
5965
|
case B.UserList: {
|
|
5966
|
-
const p =
|
|
5967
|
-
this._buildInData.userList = p, this.emit("userListUpdate", this.userList,
|
|
5966
|
+
const p = _;
|
|
5967
|
+
this._buildInData.userList = p, this.emit("userListUpdate", this.userList, w);
|
|
5968
5968
|
break;
|
|
5969
5969
|
}
|
|
5970
5970
|
case B.CustomEvent: {
|
|
5971
|
-
const p =
|
|
5972
|
-
this.emit("broadcast", p,
|
|
5971
|
+
const p = _;
|
|
5972
|
+
this.emit("broadcast", p, w);
|
|
5973
5973
|
break;
|
|
5974
5974
|
}
|
|
5975
5975
|
case B.KeyframeSync: {
|
|
5976
|
-
const p =
|
|
5977
|
-
if (
|
|
5976
|
+
const p = _;
|
|
5977
|
+
if (I === ((l = this.selfInfo) == null ? void 0 : l.id))
|
|
5978
5978
|
return;
|
|
5979
5979
|
this._yDoc.transact(
|
|
5980
5980
|
() => {
|
|
5981
|
-
for (const
|
|
5981
|
+
for (const F in p)
|
|
5982
5982
|
this._buildInData.keyframes.set(
|
|
5983
|
-
|
|
5984
|
-
p[
|
|
5983
|
+
F,
|
|
5984
|
+
p[F]
|
|
5985
5985
|
);
|
|
5986
5986
|
},
|
|
5987
5987
|
{
|
|
5988
|
-
triggerUserId:
|
|
5989
|
-
frontRequestId:
|
|
5988
|
+
triggerUserId: I,
|
|
5989
|
+
frontRequestId: w
|
|
5990
5990
|
}
|
|
5991
5991
|
);
|
|
5992
5992
|
break;
|
|
5993
5993
|
}
|
|
5994
5994
|
case B.BuiltinMsg: {
|
|
5995
|
-
const p =
|
|
5996
|
-
this.emit("builtinEvent", p), p.event_type ===
|
|
5995
|
+
const p = _;
|
|
5996
|
+
this.emit("builtinEvent", p), p.event_type === K.UserChange && this.emit("userChange", p), p.event_type === K.RoomChange && this.emit("roomChange", p), p.event_type === K.UserChange && p.action === Y.UserMicroStatus && p.to_user_ids.includes((u = (h = this.selfInfo) == null ? void 0 : h.id) != null ? u : "") && await ((d = this.$RTC) == null ? void 0 : d.toggleMicro(p.data.status === ct.OPEN)), p.event_type === K.RoomChange && p.action === Y.RoomClose && await this._exit();
|
|
5997
5997
|
break;
|
|
5998
5998
|
}
|
|
5999
5999
|
case B.UserKickOut: {
|
|
@@ -6001,10 +6001,10 @@ class Ir extends At {
|
|
|
6001
6001
|
break;
|
|
6002
6002
|
}
|
|
6003
6003
|
default:
|
|
6004
|
-
m.warn("Unknown command received:",
|
|
6004
|
+
m.warn("Unknown command received:", g);
|
|
6005
6005
|
}
|
|
6006
6006
|
else
|
|
6007
|
-
m.error("Error in message:",
|
|
6007
|
+
m.error("Error in message:", y), this.emit("error", e);
|
|
6008
6008
|
}
|
|
6009
6009
|
});
|
|
6010
6010
|
/**
|
|
@@ -6135,7 +6135,7 @@ class Ir extends At {
|
|
|
6135
6135
|
} catch (n) {
|
|
6136
6136
|
m.warn(n);
|
|
6137
6137
|
}
|
|
6138
|
-
await this.updateStatus(
|
|
6138
|
+
await this.updateStatus(K.RoomChange, Y.RoomClose, {});
|
|
6139
6139
|
});
|
|
6140
6140
|
/**
|
|
6141
6141
|
* 销毁带看实例
|
|
@@ -6184,7 +6184,7 @@ class Ir extends At {
|
|
|
6184
6184
|
* })
|
|
6185
6185
|
* ```
|
|
6186
6186
|
*/
|
|
6187
|
-
a(this, "setSelfInfo", async (e) => await this.updateStatus(
|
|
6187
|
+
a(this, "setSelfInfo", async (e) => await this.updateStatus(K.UserChange, Y.UserInfo, e));
|
|
6188
6188
|
/**
|
|
6189
6189
|
* 自定义广播消息
|
|
6190
6190
|
*
|
|
@@ -6226,7 +6226,7 @@ class Ir extends At {
|
|
|
6226
6226
|
* ```
|
|
6227
6227
|
*/
|
|
6228
6228
|
a(this, "broadcast", (e, n, s) => this.state !== j.OPEN ? !1 : new Promise((r, o) => {
|
|
6229
|
-
const c =
|
|
6229
|
+
const c = ye(B.CustomEvent, e, n), l = c.front_request_id, h = s ? setTimeout(() => {
|
|
6230
6230
|
o(new Error("RESPONSE TIMEOUT")), this.off("broadcast", u);
|
|
6231
6231
|
}, s) : void 0, u = (d, g) => {
|
|
6232
6232
|
g === l && (h && clearTimeout(h), this.off("broadcast", u), r(d));
|
|
@@ -6269,10 +6269,10 @@ class Ir extends At {
|
|
|
6269
6269
|
if (!((r = (s = this.selfInfo) == null ? void 0 : s.permission) != null && r.control_own_micro)) return !1;
|
|
6270
6270
|
const n = await ((o = this.$RTC) == null ? void 0 : o.toggleMicro(e));
|
|
6271
6271
|
return n && await this.updateStatus(
|
|
6272
|
-
|
|
6273
|
-
|
|
6272
|
+
K.UserChange,
|
|
6273
|
+
Y.UserMicroStatusSync,
|
|
6274
6274
|
{
|
|
6275
|
-
status: e ?
|
|
6275
|
+
status: e ? ct.OPEN : ct.CLOSE
|
|
6276
6276
|
},
|
|
6277
6277
|
[]
|
|
6278
6278
|
), n;
|
|
@@ -6302,8 +6302,8 @@ class Ir extends At {
|
|
|
6302
6302
|
a(this, "forbidMicro", async (e, n) => {
|
|
6303
6303
|
var s, r;
|
|
6304
6304
|
return typeof this._options.canForbidUserMicro == "function" && !this._options.canForbidUserMicro(n) || !((r = (s = this.selfInfo) == null ? void 0 : s.permission) != null && r.control_other_micro) ? !1 : await this.updateStatus(
|
|
6305
|
-
|
|
6306
|
-
|
|
6305
|
+
K.UserChange,
|
|
6306
|
+
Y.UserMicroStatus,
|
|
6307
6307
|
{
|
|
6308
6308
|
status: e
|
|
6309
6309
|
},
|
|
@@ -6330,8 +6330,8 @@ class Ir extends At {
|
|
|
6330
6330
|
a(this, "forbidSync", async (e, n) => {
|
|
6331
6331
|
var s, r;
|
|
6332
6332
|
return typeof this._options.canForbidUserSync == "function" && !this._options.canForbidUserSync(n) || !((r = (s = this.selfInfo) == null ? void 0 : s.permission) != null && r.control_other_sync) ? !1 : await this.updateStatus(
|
|
6333
|
-
|
|
6334
|
-
|
|
6333
|
+
K.UserChange,
|
|
6334
|
+
Y.UserPermission,
|
|
6335
6335
|
{ sync_frame: e },
|
|
6336
6336
|
n
|
|
6337
6337
|
);
|
|
@@ -6360,8 +6360,8 @@ class Ir extends At {
|
|
|
6360
6360
|
a(this, "kick", async (e) => {
|
|
6361
6361
|
var n, s;
|
|
6362
6362
|
return typeof this._options.canForbidUserKick == "function" && !this._options.canForbidUserKick(e) || !((s = (n = this.selfInfo) == null ? void 0 : n.permission) != null && s.change_other_status) ? !1 : await this.updateStatus(
|
|
6363
|
-
|
|
6364
|
-
|
|
6363
|
+
K.UserChange,
|
|
6364
|
+
Y.UserStatus,
|
|
6365
6365
|
{
|
|
6366
6366
|
status: "KICK_OUT"
|
|
6367
6367
|
},
|
|
@@ -6382,8 +6382,8 @@ class Ir extends At {
|
|
|
6382
6382
|
* ```
|
|
6383
6383
|
*/
|
|
6384
6384
|
a(this, "getSnapshotForKey", (e) => this.snapshot[e]);
|
|
6385
|
-
m.info("Initializing Live instance with options:", e), this._addLiveControllerEventListeners(), this._yDoc = new
|
|
6386
|
-
guid:
|
|
6385
|
+
m.info("Initializing Live instance with options:", e), this._addLiveControllerEventListeners(), this._yDoc = new Et({
|
|
6386
|
+
guid: Tt()
|
|
6387
6387
|
}), this._buildInData = {
|
|
6388
6388
|
keyframes: this._yDoc.getMap("keyframes")
|
|
6389
6389
|
}, this._initializeKeyframesObservers(), this._initializeOptions(e), this._autoConnect(), this._debugSetup();
|
|
@@ -6532,7 +6532,7 @@ class Ir extends At {
|
|
|
6532
6532
|
*/
|
|
6533
6533
|
async updateStatus(e, n, s, r) {
|
|
6534
6534
|
if (this.state !== j.OPEN) return !1;
|
|
6535
|
-
const o = Object.assign({ event_type: e, action: n }, { data: s }), c =
|
|
6535
|
+
const o = Object.assign({ event_type: e, action: n }, { data: s }), c = ye(B.BuiltinMsg, o, r);
|
|
6536
6536
|
try {
|
|
6537
6537
|
return this._controller.sendMessage(c), !0;
|
|
6538
6538
|
} catch (l) {
|
|
@@ -6542,137 +6542,137 @@ class Ir extends At {
|
|
|
6542
6542
|
}
|
|
6543
6543
|
const Or = (i) => (vr(), new Ir(i));
|
|
6544
6544
|
function Nr(i) {
|
|
6545
|
-
const t = pn(null), e = Or(i), n = e.jsBridge, s = (f) =>
|
|
6546
|
-
const f =
|
|
6545
|
+
const t = pn(null), e = Or(i), n = e.jsBridge, s = (f) => M.createElement(t.Provider, { value: e }, f.children), r = () => {
|
|
6546
|
+
const f = M.useContext(t);
|
|
6547
6547
|
if (!f) throw new Error("LiveProvider never found.");
|
|
6548
6548
|
return f;
|
|
6549
6549
|
}, o = () => e, c = () => e.$RTC, l = () => c(), h = () => async (f) => await e.connect(f);
|
|
6550
|
-
function u(f,
|
|
6551
|
-
const
|
|
6552
|
-
return
|
|
6550
|
+
function u(f, S, A = []) {
|
|
6551
|
+
const C = r(), O = [C, f, ...A], D = () => C.keyframes.off(f, S);
|
|
6552
|
+
return M.useEffect(() => (C.keyframes.on(f, S), D), O), D;
|
|
6553
6553
|
}
|
|
6554
6554
|
function d() {
|
|
6555
|
-
const f = r(),
|
|
6556
|
-
async (
|
|
6557
|
-
await f.connect(
|
|
6555
|
+
const f = r(), S = W(
|
|
6556
|
+
async (R) => {
|
|
6557
|
+
await f.connect(R);
|
|
6558
6558
|
},
|
|
6559
6559
|
[f]
|
|
6560
|
-
),
|
|
6561
|
-
(
|
|
6562
|
-
f.toggleMicro(
|
|
6560
|
+
), A = W(
|
|
6561
|
+
(R) => {
|
|
6562
|
+
f.toggleMicro(R);
|
|
6563
6563
|
},
|
|
6564
6564
|
[f]
|
|
6565
|
-
),
|
|
6566
|
-
async (
|
|
6567
|
-
await f.broadcast(
|
|
6565
|
+
), C = W(
|
|
6566
|
+
async (R, q, le = 0) => {
|
|
6567
|
+
await f.broadcast(R, q, le);
|
|
6568
6568
|
},
|
|
6569
6569
|
[f]
|
|
6570
|
-
),
|
|
6570
|
+
), O = W(async () => {
|
|
6571
6571
|
await f.exit();
|
|
6572
|
-
}, [f]),
|
|
6573
|
-
async (
|
|
6574
|
-
await f.kick(
|
|
6572
|
+
}, [f]), D = W(
|
|
6573
|
+
async (R) => {
|
|
6574
|
+
await f.kick(R);
|
|
6575
6575
|
},
|
|
6576
6576
|
[f]
|
|
6577
|
-
),
|
|
6578
|
-
async (
|
|
6579
|
-
await f.forbidMicro(
|
|
6577
|
+
), P = W(
|
|
6578
|
+
async (R, q = []) => {
|
|
6579
|
+
await f.forbidMicro(R, q);
|
|
6580
6580
|
},
|
|
6581
6581
|
[f]
|
|
6582
|
-
),
|
|
6583
|
-
(
|
|
6584
|
-
f.forbidSync(
|
|
6582
|
+
), ot = W(
|
|
6583
|
+
(R, q = []) => {
|
|
6584
|
+
f.forbidSync(R, q);
|
|
6585
6585
|
},
|
|
6586
6586
|
[f]
|
|
6587
|
-
),
|
|
6588
|
-
(
|
|
6587
|
+
), ce = W(
|
|
6588
|
+
(R) => f.getFramesByKey(R),
|
|
6589
6589
|
[f]
|
|
6590
|
-
), en =
|
|
6591
|
-
(
|
|
6592
|
-
f.sendKeyframe(
|
|
6590
|
+
), en = W(
|
|
6591
|
+
(R, q) => {
|
|
6592
|
+
f.sendKeyframe(R, q);
|
|
6593
6593
|
},
|
|
6594
6594
|
[f]
|
|
6595
|
-
), nn =
|
|
6596
|
-
(
|
|
6597
|
-
f.setSelfInfo(
|
|
6595
|
+
), nn = W(
|
|
6596
|
+
(R) => {
|
|
6597
|
+
f.setSelfInfo(R);
|
|
6598
6598
|
},
|
|
6599
6599
|
[f]
|
|
6600
|
-
), sn =
|
|
6601
|
-
(
|
|
6602
|
-
f.updateStatus(
|
|
6600
|
+
), sn = W(
|
|
6601
|
+
(R, q, le, rn) => {
|
|
6602
|
+
f.updateStatus(R, q, le, rn);
|
|
6603
6603
|
},
|
|
6604
6604
|
[f]
|
|
6605
6605
|
);
|
|
6606
6606
|
return {
|
|
6607
|
-
connect:
|
|
6608
|
-
broadcast:
|
|
6609
|
-
exit:
|
|
6610
|
-
kick:
|
|
6611
|
-
toggleMicro:
|
|
6612
|
-
forbidMicro:
|
|
6613
|
-
forbidSync:
|
|
6607
|
+
connect: S,
|
|
6608
|
+
broadcast: C,
|
|
6609
|
+
exit: O,
|
|
6610
|
+
kick: D,
|
|
6611
|
+
toggleMicro: A,
|
|
6612
|
+
forbidMicro: P,
|
|
6613
|
+
forbidSync: ot,
|
|
6614
6614
|
sendKeyframe: en,
|
|
6615
|
-
getFramesByKey:
|
|
6615
|
+
getFramesByKey: ce,
|
|
6616
6616
|
setSelfInfo: nn,
|
|
6617
6617
|
updateStatus: sn
|
|
6618
6618
|
};
|
|
6619
6619
|
}
|
|
6620
6620
|
function g(f) {
|
|
6621
|
-
const
|
|
6622
|
-
|
|
6623
|
-
const
|
|
6624
|
-
return
|
|
6625
|
-
}, [
|
|
6626
|
-
const
|
|
6627
|
-
return [
|
|
6628
|
-
}
|
|
6629
|
-
function
|
|
6630
|
-
const
|
|
6631
|
-
return
|
|
6632
|
-
}
|
|
6633
|
-
function
|
|
6634
|
-
const f = r(), [
|
|
6635
|
-
return
|
|
6636
|
-
const
|
|
6637
|
-
return f.on("stateChange",
|
|
6638
|
-
}, [f]),
|
|
6639
|
-
}
|
|
6640
|
-
function
|
|
6621
|
+
const S = r(), [A, C] = M.useState(S.getFramesByKey(f));
|
|
6622
|
+
M.useEffect(() => {
|
|
6623
|
+
const D = (ce) => C(ce), P = f, ot = D;
|
|
6624
|
+
return S.keyframes.on(P, ot), () => S.keyframes.off(P, ot);
|
|
6625
|
+
}, [S]);
|
|
6626
|
+
const O = M.useCallback((D) => S.sendKeyframe(f, D), [S]);
|
|
6627
|
+
return [A, O];
|
|
6628
|
+
}
|
|
6629
|
+
function _(f, S, A = []) {
|
|
6630
|
+
const C = r(), O = () => C.off(f, S), D = [C, f, ...A];
|
|
6631
|
+
return M.useEffect(() => (C.on(f, S), O), D), O;
|
|
6632
|
+
}
|
|
6633
|
+
function w() {
|
|
6634
|
+
const f = r(), [S, A] = M.useState(f.state);
|
|
6635
|
+
return M.useEffect(() => {
|
|
6636
|
+
const C = (O) => A(O);
|
|
6637
|
+
return f.on("stateChange", C), () => f.off("stateChange", C);
|
|
6638
|
+
}, [f]), S;
|
|
6639
|
+
}
|
|
6640
|
+
function b() {
|
|
6641
6641
|
const f = r();
|
|
6642
6642
|
return {
|
|
6643
|
-
join: (
|
|
6643
|
+
join: (P) => f.$RTC.join(P),
|
|
6644
6644
|
quit: () => f.$RTC.quit(),
|
|
6645
6645
|
shock: () => {
|
|
6646
|
-
var
|
|
6647
|
-
return (
|
|
6646
|
+
var P, ot;
|
|
6647
|
+
return (ot = (P = f.$RTC).shock) == null ? void 0 : ot.call(P);
|
|
6648
6648
|
},
|
|
6649
|
-
toggleMicro: (
|
|
6649
|
+
toggleMicro: (P) => f.$RTC.toggleMicro(P),
|
|
6650
6650
|
detectMicro: () => f.$RTC.detectMicro()
|
|
6651
6651
|
};
|
|
6652
6652
|
}
|
|
6653
|
-
function
|
|
6654
|
-
const
|
|
6655
|
-
return
|
|
6653
|
+
function y(f, S, A = []) {
|
|
6654
|
+
const C = r(), O = () => C.$RTC.off(f, S), D = [C, f, ...A];
|
|
6655
|
+
return M.useEffect(() => (C.$RTC.on(f, S), O), D), O;
|
|
6656
6656
|
}
|
|
6657
|
-
function
|
|
6658
|
-
const f = r(), [
|
|
6659
|
-
|
|
6660
|
-
const
|
|
6661
|
-
async (
|
|
6657
|
+
function I() {
|
|
6658
|
+
const f = r(), [S, A] = M.useState(f.selfInfo || {}), C = (D) => A(D);
|
|
6659
|
+
M.useEffect(() => (f.on("selfInfoUpdate", C), () => f.off("selfInfoUpdate", C)), [f]);
|
|
6660
|
+
const O = M.useCallback(
|
|
6661
|
+
async (D) => await f.setSelfInfo(D),
|
|
6662
6662
|
[f]
|
|
6663
6663
|
);
|
|
6664
|
-
return [
|
|
6664
|
+
return [S, O];
|
|
6665
6665
|
}
|
|
6666
|
-
function
|
|
6667
|
-
const f = r(), [
|
|
6668
|
-
return
|
|
6669
|
-
const
|
|
6670
|
-
return f.on("keyframes",
|
|
6671
|
-
}, [f]),
|
|
6666
|
+
function p() {
|
|
6667
|
+
const f = r(), [S, A] = M.useState(f.snapshot);
|
|
6668
|
+
return M.useEffect(() => {
|
|
6669
|
+
const C = (O) => A(O);
|
|
6670
|
+
return f.on("keyframes", C), () => f.off("keyframes", C);
|
|
6671
|
+
}, [f]), S;
|
|
6672
6672
|
}
|
|
6673
|
-
function
|
|
6674
|
-
const f = r(), [
|
|
6675
|
-
return
|
|
6673
|
+
function F() {
|
|
6674
|
+
const f = r(), [S, A] = M.useState(f.userList), C = (O) => A(O);
|
|
6675
|
+
return M.useEffect(() => (f.on("userListUpdate", C), () => f.off("userListUpdate", C)), [f]), S;
|
|
6676
6676
|
}
|
|
6677
6677
|
return {
|
|
6678
6678
|
live: e,
|
|
@@ -6684,40 +6684,40 @@ function Nr(i) {
|
|
|
6684
6684
|
useKeyframe: g,
|
|
6685
6685
|
useKeyframeUpdateCallback: u,
|
|
6686
6686
|
useLiveAction: d,
|
|
6687
|
-
useLiveEventCallback:
|
|
6688
|
-
useLiveState:
|
|
6689
|
-
useRTCAction:
|
|
6690
|
-
useRTCEventCallback:
|
|
6691
|
-
useSelfInfo:
|
|
6692
|
-
useKeyframesSnapshot:
|
|
6693
|
-
useUserList:
|
|
6687
|
+
useLiveEventCallback: _,
|
|
6688
|
+
useLiveState: w,
|
|
6689
|
+
useRTCAction: b,
|
|
6690
|
+
useRTCEventCallback: y,
|
|
6691
|
+
useSelfInfo: I,
|
|
6692
|
+
useKeyframesSnapshot: p,
|
|
6693
|
+
useUserList: F
|
|
6694
6694
|
};
|
|
6695
6695
|
}
|
|
6696
|
-
const
|
|
6697
|
-
(
|
|
6698
|
-
"%c@realsee/live@0.7.
|
|
6696
|
+
const be = globalThis.__REALSEE_LIVE_BADGE_LOG__;
|
|
6697
|
+
(be == null || be) && console.log(
|
|
6698
|
+
"%c@realsee/live@0.7.9 (8/10/2026, 5:30:44 PM)",
|
|
6699
6699
|
"background: linear-gradient(to right, #1890ff, #52c41a); color: white; padding: 3px 6px; border-radius: 4px; font-weight: bold; text-shadow: 0 1px 0 rgba(0,0,0,0.2);"
|
|
6700
6700
|
);
|
|
6701
6701
|
export {
|
|
6702
6702
|
mn as BrowserRTC,
|
|
6703
6703
|
We as BrowserRTC4Chime,
|
|
6704
6704
|
fi as BuiltInRTCType,
|
|
6705
|
-
|
|
6706
|
-
|
|
6705
|
+
Y as BuiltinActionType,
|
|
6706
|
+
K as BuiltinEventType,
|
|
6707
6707
|
B as Command,
|
|
6708
|
-
|
|
6708
|
+
Ae as CoreRTC,
|
|
6709
6709
|
Ir as Live,
|
|
6710
6710
|
j as LiveState,
|
|
6711
6711
|
bn as MemUserStatus,
|
|
6712
|
-
|
|
6713
|
-
|
|
6714
|
-
|
|
6715
|
-
|
|
6712
|
+
ct as MicroStatus,
|
|
6713
|
+
ut as RTCJoinedInfoCodeEnum,
|
|
6714
|
+
lt as RTCType,
|
|
6715
|
+
Lt as Subscribe,
|
|
6716
6716
|
yn as UserStatus,
|
|
6717
6717
|
wn as VRWebViewRTC,
|
|
6718
6718
|
Cn as WebSocketCloseError,
|
|
6719
6719
|
Sn as WebSocketErrorType,
|
|
6720
|
-
|
|
6720
|
+
Se as WebSocketState,
|
|
6721
6721
|
vr as _clearLiveInstanceIfNeed,
|
|
6722
6722
|
Or as createLive,
|
|
6723
6723
|
Nr as createLiveReact,
|