studiograph 1.3.3-next.21 → 1.3.3-next.22
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/server/chrome/chrome.js +23 -252
- package/dist/server/collab.d.ts +27 -0
- package/dist/server/collab.js +117 -0
- package/dist/server/collab.js.map +1 -0
- package/dist/server/index.js +11 -6
- package/dist/server/index.js.map +1 -1
- package/dist/server/routes/collab.d.ts +6 -0
- package/dist/server/routes/collab.js +10 -0
- package/dist/server/routes/collab.js.map +1 -0
- package/dist/server/routes/graph-api.d.ts +2 -2
- package/dist/server/routes/graph-api.js +25 -6
- package/dist/server/routes/graph-api.js.map +1 -1
- package/dist/server/routes/sync-api.d.ts +2 -1
- package/dist/server/routes/sync-api.js +13 -1
- package/dist/server/routes/sync-api.js.map +1 -1
- package/dist/server/routes/ws.js +38 -0
- package/dist/server/routes/ws.js.map +1 -1
- package/dist/server/session-manager.d.ts +40 -0
- package/dist/server/session-manager.js +130 -0
- package/dist/server/session-manager.js.map +1 -0
- package/dist/server/ws-hub.d.ts +60 -1
- package/dist/server/ws-hub.js +113 -2
- package/dist/server/ws-hub.js.map +1 -1
- package/dist/web/_app/immutable/assets/AppShell.EyPUoNrB.css +1 -0
- package/dist/web/_app/immutable/assets/{editor.CaaAjbLg.css → entity.Bjlko8oW.css} +1 -1
- package/dist/web/_app/immutable/chunks/{DRChbfXz.js → 38MyG-mV.js} +1 -1
- package/dist/web/_app/immutable/chunks/{DFSquWcI.js → BV_9Nfp2.js} +1 -1
- package/dist/web/_app/immutable/chunks/Bk7i2AGK.js +5 -0
- package/dist/web/_app/immutable/chunks/ByFfmBEu.js +2 -0
- package/dist/web/_app/immutable/chunks/Bz2vmWce.js +2 -0
- package/dist/web/_app/immutable/chunks/C6jTKM_R.js +1 -0
- package/dist/web/_app/immutable/chunks/CaITTL5o.js +2 -0
- package/dist/web/_app/immutable/chunks/Cc7CYb94.js +1 -0
- package/dist/web/_app/immutable/chunks/{BDskUnFZ.js → CiTQ_W2r.js} +10 -10
- package/dist/web/_app/immutable/chunks/{BfTJ6NzK.js → CjKjQEMp.js} +1 -1
- package/dist/web/_app/immutable/chunks/{GRkK54yd.js → D-tW7Byc.js} +1 -1
- package/dist/web/_app/immutable/chunks/{Ddy4RvyP.js → DCWeodCf.js} +1 -1
- package/dist/web/_app/immutable/chunks/DWSjaG46.js +1 -0
- package/dist/web/_app/immutable/chunks/DkM5hMeY.js +1 -0
- package/dist/web/_app/immutable/chunks/{BbLYZVsw.js → Dpn7ZAUg.js} +1 -1
- package/dist/web/_app/immutable/chunks/EhE2EcYu.js +1 -0
- package/dist/web/_app/immutable/chunks/JFkcr2-N.js +1 -0
- package/dist/web/_app/immutable/chunks/Mxe2MMs2.js +27 -0
- package/dist/web/_app/immutable/chunks/{BjnErSlK.js → eEhMI0BQ.js} +1 -1
- package/dist/web/_app/immutable/entry/app.DLneBeWX.js +2 -0
- package/dist/web/_app/immutable/entry/start.BYwqba4F.js +1 -0
- package/dist/web/_app/immutable/nodes/0.DtQFMo5Z.js +2 -0
- package/dist/web/_app/immutable/nodes/{1.gy-UNDF3.js → 1.DJ2AQD2m.js} +1 -1
- package/dist/web/_app/immutable/nodes/{2.CFmJZos9.js → 2.DWr3ykuO.js} +1 -1
- package/dist/web/_app/immutable/nodes/3.qGcB9YWB.js +1 -0
- package/dist/web/_app/immutable/nodes/4.DU5ubOPD.js +17 -0
- package/dist/web/_app/immutable/nodes/{5.C7yLiq2I.js → 5.CD_z4c5g.js} +1 -1
- package/dist/web/_app/immutable/nodes/{6.DKaTmAiw.js → 6.Bd2482PN.js} +1 -1
- package/dist/web/_app/immutable/nodes/{7.CA3sQ74A.js → 7.BTx2RBdr.js} +1 -1
- package/dist/web/_app/immutable/nodes/8.I6vnVY2_.js +2 -0
- package/dist/web/_app/immutable/nodes/{9.BVVyKTae.js → 9.u8QBhCns.js} +1 -1
- package/dist/web/_app/version.json +1 -1
- package/dist/web/index.html +10 -10
- package/package.json +2 -1
- package/dist/web/_app/immutable/assets/AppShell.C00jH_aT.css +0 -1
- package/dist/web/_app/immutable/chunks/B3v6bkHV.js +0 -27
- package/dist/web/_app/immutable/chunks/BQlTvYWB.js +0 -1
- package/dist/web/_app/immutable/chunks/BzhnXU6Q.js +0 -1
- package/dist/web/_app/immutable/chunks/CRcLi9EQ.js +0 -1
- package/dist/web/_app/immutable/chunks/DL7u7dQi.js +0 -2
- package/dist/web/_app/immutable/chunks/m74CvwCG.js +0 -2
- package/dist/web/_app/immutable/chunks/trveDs8t.js +0 -1
- package/dist/web/_app/immutable/entry/app.3j3I-9SC.js +0 -2
- package/dist/web/_app/immutable/entry/start.CYScsHkx.js +0 -1
- package/dist/web/_app/immutable/nodes/0.CxCm4CPW.js +0 -2
- package/dist/web/_app/immutable/nodes/3.D1yvWsPv.js +0 -1
- package/dist/web/_app/immutable/nodes/4.LKUIo9Zg.js +0 -16
- package/dist/web/_app/immutable/nodes/8.DEuJARDO.js +0 -2
package/dist/server/ws-hub.d.ts
CHANGED
|
@@ -23,12 +23,71 @@ export interface WsRepoSyncEvent {
|
|
|
23
23
|
actor: string;
|
|
24
24
|
timestamp: string;
|
|
25
25
|
}
|
|
26
|
-
|
|
26
|
+
/** Emitted when a user's edit session closes and changes are committed. */
|
|
27
|
+
export interface WsSessionCommitEvent {
|
|
28
|
+
type: 'session_commit';
|
|
29
|
+
repo: string;
|
|
30
|
+
entities: string[];
|
|
31
|
+
actor: string;
|
|
32
|
+
timestamp: string;
|
|
33
|
+
}
|
|
34
|
+
/** Emitted when a sync pipeline run completes for a collection. */
|
|
35
|
+
export interface WsSyncCompleteEvent {
|
|
36
|
+
type: 'sync_complete';
|
|
37
|
+
repo: string;
|
|
38
|
+
source: string;
|
|
39
|
+
created: number;
|
|
40
|
+
updated: number;
|
|
41
|
+
deleted: number;
|
|
42
|
+
actor: string;
|
|
43
|
+
timestamp: string;
|
|
44
|
+
}
|
|
45
|
+
/** Emitted when a collection is created or deleted. */
|
|
46
|
+
export interface WsCollectionEvent {
|
|
47
|
+
type: 'collection_created' | 'collection_deleted';
|
|
48
|
+
repo: string;
|
|
49
|
+
actor: string;
|
|
50
|
+
timestamp: string;
|
|
51
|
+
}
|
|
52
|
+
/** Emitted when a user enters or leaves an entity view (presence). */
|
|
53
|
+
export interface WsPresenceEvent {
|
|
54
|
+
type: 'presence';
|
|
55
|
+
action: 'enter' | 'leave' | 'heartbeat';
|
|
56
|
+
repo: string;
|
|
57
|
+
entityType: string;
|
|
58
|
+
entityId: string;
|
|
59
|
+
user: {
|
|
60
|
+
id: string;
|
|
61
|
+
name: string;
|
|
62
|
+
color?: string;
|
|
63
|
+
};
|
|
64
|
+
timestamp: string;
|
|
65
|
+
}
|
|
66
|
+
export type WsEvent = WsChangeEvent | WsRepoSyncEvent | WsSessionCommitEvent | WsSyncCompleteEvent | WsCollectionEvent | WsPresenceEvent;
|
|
27
67
|
export declare class WsHub {
|
|
28
68
|
private clients;
|
|
29
69
|
private heartbeatTimer;
|
|
70
|
+
private presenceMap;
|
|
30
71
|
constructor();
|
|
31
72
|
addClient(ws: WebSocket, user: AuthUser | null, collections: string[] | null): void;
|
|
73
|
+
/**
|
|
74
|
+
* Handle a presence message sent by a client.
|
|
75
|
+
* Updates server-side presence state and broadcasts to collection peers.
|
|
76
|
+
*/
|
|
77
|
+
handlePresence(action: 'enter' | 'leave' | 'heartbeat', repo: string, entityType: string, entityId: string, user: {
|
|
78
|
+
id: string;
|
|
79
|
+
name: string;
|
|
80
|
+
color?: string;
|
|
81
|
+
}): void;
|
|
82
|
+
/** Return current presence for an entity (for initial state on connect). */
|
|
83
|
+
getPresence(repo: string, entityType: string, entityId: string): Array<{
|
|
84
|
+
id: string;
|
|
85
|
+
name: string;
|
|
86
|
+
color?: string;
|
|
87
|
+
}>;
|
|
88
|
+
/** Send the full current presence map to a single newly connected client. */
|
|
89
|
+
sendPresenceSnapshot(ws: WebSocket, collections: Set<string> | null): void;
|
|
90
|
+
private clearUserPresence;
|
|
32
91
|
broadcast(event: WsEvent): void;
|
|
33
92
|
get connectionCount(): number;
|
|
34
93
|
destroy(): void;
|
package/dist/server/ws-hub.js
CHANGED
|
@@ -4,12 +4,24 @@
|
|
|
4
4
|
* Tracks authenticated WebSocket connections and broadcasts entity/repo
|
|
5
5
|
* change events scoped to each client's collection access.
|
|
6
6
|
*/
|
|
7
|
+
const PRESENCE_STALE_MS = 90_000; // 90s — heartbeat every 30s, so 3 missed = gone
|
|
8
|
+
/** Assign a stable color to a user based on their id. */
|
|
9
|
+
const PRESENCE_COLORS = ['#4f8ef7', '#e05252', '#52c27d', '#e0a252', '#9b52e0', '#52bde0'];
|
|
10
|
+
function presenceColor(userId) {
|
|
11
|
+
let hash = 0;
|
|
12
|
+
for (let i = 0; i < userId.length; i++)
|
|
13
|
+
hash = (hash * 31 + userId.charCodeAt(i)) | 0;
|
|
14
|
+
return PRESENCE_COLORS[Math.abs(hash) % PRESENCE_COLORS.length];
|
|
15
|
+
}
|
|
7
16
|
export class WsHub {
|
|
8
17
|
clients = new Set();
|
|
9
18
|
heartbeatTimer = null;
|
|
19
|
+
// entityKey → Map<userId, PresenceEntry>
|
|
20
|
+
presenceMap = new Map();
|
|
10
21
|
constructor() {
|
|
11
|
-
// Ping all clients every 30s
|
|
22
|
+
// Ping all clients every 30s and clean stale presence entries
|
|
12
23
|
this.heartbeatTimer = setInterval(() => {
|
|
24
|
+
const now = Date.now();
|
|
13
25
|
for (const client of this.clients) {
|
|
14
26
|
if (client.ws.readyState === 1 /* OPEN */) {
|
|
15
27
|
client.ws.ping();
|
|
@@ -18,6 +30,17 @@ export class WsHub {
|
|
|
18
30
|
this.clients.delete(client);
|
|
19
31
|
}
|
|
20
32
|
}
|
|
33
|
+
// Clean stale presence
|
|
34
|
+
for (const [entityKey, users] of this.presenceMap) {
|
|
35
|
+
for (const [userId, entry] of users) {
|
|
36
|
+
if (now - entry.lastSeen > PRESENCE_STALE_MS) {
|
|
37
|
+
users.delete(userId);
|
|
38
|
+
// No broadcast needed — clients will expire stale entries themselves
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
if (users.size === 0)
|
|
42
|
+
this.presenceMap.delete(entityKey);
|
|
43
|
+
}
|
|
21
44
|
}, 30_000);
|
|
22
45
|
}
|
|
23
46
|
addClient(ws, user, collections) {
|
|
@@ -27,9 +50,97 @@ export class WsHub {
|
|
|
27
50
|
collections: collections ? new Set(collections) : null,
|
|
28
51
|
};
|
|
29
52
|
this.clients.add(client);
|
|
30
|
-
ws.on('close', () =>
|
|
53
|
+
ws.on('close', () => {
|
|
54
|
+
this.clients.delete(client);
|
|
55
|
+
// Clear presence for this user on disconnect
|
|
56
|
+
if (user)
|
|
57
|
+
this.clearUserPresence(String(user.id), user.displayName, collections);
|
|
58
|
+
});
|
|
31
59
|
ws.on('error', () => this.clients.delete(client));
|
|
32
60
|
}
|
|
61
|
+
/**
|
|
62
|
+
* Handle a presence message sent by a client.
|
|
63
|
+
* Updates server-side presence state and broadcasts to collection peers.
|
|
64
|
+
*/
|
|
65
|
+
handlePresence(action, repo, entityType, entityId, user) {
|
|
66
|
+
const entityKey = `${repo}/${entityType}/${entityId}`;
|
|
67
|
+
const color = user.color ?? presenceColor(user.id);
|
|
68
|
+
if (action === 'leave') {
|
|
69
|
+
const users = this.presenceMap.get(entityKey);
|
|
70
|
+
if (users) {
|
|
71
|
+
users.delete(user.id);
|
|
72
|
+
if (users.size === 0)
|
|
73
|
+
this.presenceMap.delete(entityKey);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
else {
|
|
77
|
+
// enter or heartbeat
|
|
78
|
+
if (!this.presenceMap.has(entityKey)) {
|
|
79
|
+
this.presenceMap.set(entityKey, new Map());
|
|
80
|
+
}
|
|
81
|
+
this.presenceMap.get(entityKey).set(user.id, {
|
|
82
|
+
user: { id: user.id, name: user.name, color },
|
|
83
|
+
lastSeen: Date.now(),
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
this.broadcast({
|
|
87
|
+
type: 'presence',
|
|
88
|
+
action,
|
|
89
|
+
repo,
|
|
90
|
+
entityType,
|
|
91
|
+
entityId,
|
|
92
|
+
user: { id: user.id, name: user.name, color },
|
|
93
|
+
timestamp: new Date().toISOString(),
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
/** Return current presence for an entity (for initial state on connect). */
|
|
97
|
+
getPresence(repo, entityType, entityId) {
|
|
98
|
+
const entityKey = `${repo}/${entityType}/${entityId}`;
|
|
99
|
+
const users = this.presenceMap.get(entityKey);
|
|
100
|
+
if (!users)
|
|
101
|
+
return [];
|
|
102
|
+
return Array.from(users.values()).map(e => e.user);
|
|
103
|
+
}
|
|
104
|
+
/** Send the full current presence map to a single newly connected client. */
|
|
105
|
+
sendPresenceSnapshot(ws, collections) {
|
|
106
|
+
const now = new Date().toISOString();
|
|
107
|
+
for (const [entityKey, users] of this.presenceMap) {
|
|
108
|
+
const [repo, entityType, entityId] = entityKey.split('/');
|
|
109
|
+
if (!repo || !entityType || !entityId)
|
|
110
|
+
continue;
|
|
111
|
+
if (collections && !collections.has(repo))
|
|
112
|
+
continue;
|
|
113
|
+
for (const entry of users.values()) {
|
|
114
|
+
ws.send(JSON.stringify({
|
|
115
|
+
type: 'presence',
|
|
116
|
+
action: 'enter',
|
|
117
|
+
repo,
|
|
118
|
+
entityType,
|
|
119
|
+
entityId,
|
|
120
|
+
user: entry.user,
|
|
121
|
+
timestamp: now,
|
|
122
|
+
}));
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
clearUserPresence(userId, userName, collections) {
|
|
127
|
+
for (const [entityKey, users] of this.presenceMap) {
|
|
128
|
+
if (users.has(userId)) {
|
|
129
|
+
users.delete(userId);
|
|
130
|
+
const [repo, entityType, entityId] = entityKey.split('/');
|
|
131
|
+
if (repo && entityType && entityId) {
|
|
132
|
+
this.broadcast({
|
|
133
|
+
type: 'presence', action: 'leave',
|
|
134
|
+
repo, entityType, entityId,
|
|
135
|
+
user: { id: userId, name: userName },
|
|
136
|
+
timestamp: new Date().toISOString(),
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
if (users.size === 0)
|
|
140
|
+
this.presenceMap.delete(entityKey);
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
}
|
|
33
144
|
broadcast(event) {
|
|
34
145
|
const payload = JSON.stringify(event);
|
|
35
146
|
for (const client of this.clients) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ws-hub.js","sourceRoot":"","sources":["../../src/server/ws-hub.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;
|
|
1
|
+
{"version":3,"file":"ws-hub.js","sourceRoot":"","sources":["../../src/server/ws-hub.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.dialog-overlay{position:fixed;inset:0;z-index:1000;background:#0009}[data-theme=light] .dialog-overlay{background:#00000040}.dialog-content{position:fixed;z-index:1001;top:80px;left:50%;transform:translate(-50%);display:flex;flex-direction:column;background:var(--color-bg-elevated);border:1px solid var(--color-border-strong);border-radius:12px;overflow:hidden;box-shadow:0 24px 80px #00000080;max-height:calc(100vh - 120px)}.dialog-sm{width:420px;max-width:90vw}.dialog-md{width:560px;max-width:90vw}.dialog-lg{width:680px;max-width:90vw}.dialog-xl{width:800px;max-width:90vw}.dialog-fit{width:fit-content;min-width:320px;max-width:min(640px,90vw)}.dialog-header{display:flex;align-items:center;justify-content:space-between;padding:20px 24px 0;flex-shrink:0}.dialog-title{font-size:16px;font-weight:500;color:var(--color-text-primary);margin:0}.dialog-description{font-size:13px;color:var(--color-text-secondary);line-height:1.5;margin:0}.dialog-body{padding:12px 24px 20px;overflow-y:auto;flex:1;min-height:0}.dialog-footer{display:flex;align-items:center;justify-content:flex-end;gap:8px;padding:16px 24px;border-top:1px solid var(--color-border);flex-shrink:0}.dialog-close-btn{width:28px;height:28px;display:flex;align-items:center;justify-content:center;border:none;background:transparent;color:var(--color-text-tertiary);cursor:pointer;border-radius:6px;line-height:1;transition:color .15s,background .15s}.dialog-close-btn:hover{background:var(--color-bg-hover);color:var(--color-text-primary)}.entity-body{padding:16px 24px 24px;display:flex;flex-direction:column;gap:20px}.type-section.svelte-ak7t5k{display:flex;flex-direction:column;gap:8px}.type-section-label.svelte-ak7t5k{font-size:10px;font-weight:600;text-transform:uppercase;letter-spacing:.05em;color:var(--color-text-tertiary)}.type-grid.svelte-ak7t5k{display:grid;grid-template-columns:repeat(3,1fr);gap:8px}.type-grid.svelte-ak7t5k .type-card{display:flex;flex-direction:column;align-items:flex-start;gap:10px;padding:12px;height:auto;border-radius:8px;text-align:left;color:var(--color-text-secondary);justify-content:flex-start}.type-grid.svelte-ak7t5k .type-card:hover{background:var(--color-bg-hover);border-color:var(--color-border-strong)}.type-grid.svelte-ak7t5k .type-card:hover .type-name{color:var(--color-text-primary)}.type-dot.svelte-ak7t5k{width:8px;height:8px;border-radius:50%}.type-info.svelte-ak7t5k{display:flex;flex-direction:column;gap:2px}.type-name.svelte-ak7t5k{font-size:13px;font-weight:500;color:var(--color-text-secondary)}.type-desc.svelte-ak7t5k{font-size:11px;color:var(--color-text-tertiary);line-height:1.3}.sidebar.svelte-6dohdz{width:340px;min-width:340px;display:flex;flex-direction:column;overflow:hidden;background:var(--color-bg);border-right:1px solid var(--color-border)}.sidebar-header.svelte-6dohdz{height:40px;display:flex;align-items:center;gap:11px;padding:0 12px 0 19px;border-bottom:1px solid var(--color-border);flex-shrink:0}.sidebar-header.svelte-6dohdz .settings-btn{margin-left:auto}.sidebar-header.svelte-6dohdz .home-btn{display:inline-flex;align-items:center;gap:11px;padding:0;min-width:0;text-align:left;border-radius:0;height:auto;background:transparent!important}.sidebar-header.svelte-6dohdz .home-btn:hover .workspace-icon{opacity:.8}.sidebar-header.svelte-6dohdz .home-btn:hover .workspace-name{color:var(--color-text-secondary)}.workspace-icon.svelte-6dohdz{width:22px;height:22px;border-radius:50%;background:var(--color-accent, #6e6ee8);color:#fff;display:flex;align-items:center;justify-content:center;font-weight:600;font-size:10px;flex-shrink:0}.workspace-name.svelte-6dohdz{flex:1;font-size:13px;font-weight:600;color:var(--color-text-primary)}.settings-nav.svelte-6dohdz{display:flex;flex-direction:column;flex:1;padding-top:0}.settings-nav.svelte-6dohdz button[data-slot=tabs-trigger]{display:flex;align-items:center;width:100%;height:40px;padding:0 12px 0 19px;gap:11px;border:none;background:transparent;cursor:pointer;font-family:inherit;font-size:13px;color:var(--color-text-secondary);transition:color .15s,background .15s}.settings-nav.svelte-6dohdz button[data-slot=tabs-trigger]:hover{background:var(--color-bg-hover);color:var(--color-text-primary)}.settings-nav.svelte-6dohdz button[data-slot=tabs-trigger][data-state=active]{background:var(--color-bg-hover);color:var(--color-text-primary);font-weight:500}.settings-nav.svelte-6dohdz button[data-slot=tabs-trigger] svg{width:14px;height:14px;flex-shrink:0;box-sizing:content-box;padding:0 4px}.filter-bar.svelte-6dohdz{position:relative;display:flex;align-items:center;height:40px;padding:0 12px 0 52px;border-bottom:1px solid var(--color-border);flex-shrink:0}.filter-icon.svelte-6dohdz{position:absolute;left:22px;top:50%;transform:translateY(-50%);display:flex;align-items:center;justify-content:center;width:16px;color:var(--color-text-tertiary)}.filter-bar.svelte-6dohdz .filter-input{flex:1;background:transparent;border:none;outline:none;padding:0;margin:0;font-size:13px;line-height:1.4;height:auto;border-radius:0}.filter-bar.svelte-6dohdz .filter-clear{width:20px;height:20px;flex-shrink:0}.filter-bar.svelte-6dohdz .sort-toggle{width:28px;height:28px;flex-shrink:0;margin-left:4px}.filter-bar.svelte-6dohdz .sort-toggle.active{color:var(--color-accent, #6e6ee8)}.repo-type-icon.svelte-6dohdz{display:inline-flex;align-items:center;color:var(--color-text-tertiary);margin-right:6px;flex-shrink:0;align-self:center}.tree.svelte-6dohdz{flex:1;overflow-y:auto;padding-top:0}.tree-group.svelte-6dohdz{display:flex;flex-direction:column}.tree-group.svelte-6dohdz+.tree-group:where(.svelte-6dohdz){margin-top:0}.repo-row{display:flex;align-items:baseline;height:32px;line-height:32px;width:100%;padding:0 12px 0 20px;border:none;background:transparent;font-family:inherit;text-align:left;border-left:2px solid transparent;border-radius:0;gap:0;justify-content:flex-start}.repo-row:hover,.repo-row.focused{background:var(--color-bg-hover)}.repo-row.repo-active{border-left-color:var(--active-color)}.repo-name.svelte-6dohdz{font-size:13px;color:var(--color-text-secondary)}.repo-row.repo-active .repo-name.svelte-6dohdz,.repo-row.repo-active .repo-type-icon.svelte-6dohdz{font-weight:600;color:var(--color-text-primary)}.tree-row{position:relative;display:flex;align-items:baseline;height:32px;line-height:32px;padding-right:40px;color:var(--color-text-secondary);font-size:13px;border:none;background:transparent;font-family:inherit;text-align:left;width:100%;border-left:2px solid transparent;border-radius:0;gap:0;justify-content:flex-start}.tree-row:hover,.tree-row.focused{background:var(--color-bg-hover)}.tree-row.selected{background:var(--color-bg-selected);border-left-color:var(--active-color);color:var(--color-text-primary);font-weight:600}.row-chevron.svelte-6dohdz{display:inline-flex;align-items:center;justify-content:center;width:16px;height:32px;flex-shrink:0;margin-right:14px;color:var(--color-text-tertiary);align-self:center}.row-label.svelte-6dohdz{flex:1;overflow:hidden;white-space:nowrap;mask-image:linear-gradient(to right,black calc(100% - 16px),transparent 100%);-webkit-mask-image:linear-gradient(to right,black calc(100% - 16px),transparent 100%)}.item-count.svelte-6dohdz{font-size:11px;color:var(--color-text-tertiary);margin-left:8px;flex-shrink:0}.indent-group.svelte-6dohdz{position:relative}.indent-group.svelte-6dohdz:before{content:"";position:absolute;left:var(--guide-left);top:0;bottom:0;width:1px;background:var(--color-border);pointer-events:none}.loading-row.svelte-6dohdz{height:32px;display:flex;align-items:center;font-size:13px;color:var(--color-text-tertiary)}.type-header-row{color:var(--color-text-secondary);border-left:2px solid transparent}.type-header-row.type-active{color:var(--color-text-primary);font-weight:600}.type-header-row .row-label.svelte-6dohdz{flex:none;mask-image:none;-webkit-mask-image:none}.new-entity-row{color:var(--color-text-tertiary);align-items:center}.new-entity-row:hover{color:var(--color-text-secondary)}.entity-row-wrapper.svelte-6dohdz{position:relative;display:flex;align-items:center}.entity-row-wrapper.svelte-6dohdz .tree-row{flex:1;min-width:0}.entity-row-wrapper.svelte-6dohdz .entity-delete-btn{display:none;width:20px;height:20px;position:absolute;right:16px;flex-shrink:0;padding:0}.entity-row-wrapper.svelte-6dohdz .entity-delete-btn:hover{color:var(--color-error, #e55)}.entity-row-wrapper.svelte-6dohdz:hover .tree-row{background:var(--color-bg-hover)}.entity-row-wrapper.svelte-6dohdz:hover .entity-delete-btn{display:inline-flex}.entity-type-dot.svelte-6dohdz{width:6px;height:6px;border-radius:50%;flex-shrink:0;margin-right:19px;align-self:center}.recent-time.svelte-6dohdz{font-size:11px;color:var(--color-text-tertiary);position:absolute;right:26px;top:50%;transform:translate(50%,-50%);white-space:nowrap}.entity-row-wrapper.svelte-6dohdz:hover .recent-time:where(.svelte-6dohdz){display:none}.presence-stack.svelte-6dohdz{display:flex;align-items:center;gap:-4px;margin-left:auto;flex-shrink:0;align-self:center}.presence-avatar.svelte-6dohdz{width:18px;height:18px;border-radius:50%;font-size:9px;font-weight:600;color:#fff;background:var(--color-accent);display:flex;align-items:center;justify-content:center;margin-left:-3px;border:1px solid var(--color-bg);box-sizing:border-box;flex-shrink:0;align-self:center}.presence-stack.svelte-6dohdz .presence-avatar:where(.svelte-6dohdz):first-child{margin-left:4px}.presence-avatar.svelte-6dohdz:nth-child(1){z-index:3}.presence-avatar.svelte-6dohdz:nth-child(2){z-index:2}.presence-avatar.svelte-6dohdz:nth-child(3){z-index:1}.filter-match.svelte-6dohdz{background:color-mix(in srgb,var(--color-accent, #6e6ee8) 25%,transparent);color:inherit;border-radius:2px;padding:0}.no-results.svelte-6dohdz{padding:24px 16px;font-size:13px;color:var(--color-text-tertiary);text-align:center}.repo-row .repo-rename-input{flex:1;min-width:0;height:100%;padding:0 6px;margin:0;border:1px solid var(--color-accent, #6e6ee8);border-radius:3px;font-size:13px;font-weight:600}.repo-row-wrapper.svelte-6dohdz{position:relative;display:flex;align-items:center}.repo-row-wrapper.svelte-6dohdz .repo-row{flex:1;min-width:0}.repo-row-wrapper.svelte-6dohdz .repo-delete-btn{display:none;width:20px;height:20px;position:absolute;right:16px;flex-shrink:0;padding:0}.repo-row-wrapper.svelte-6dohdz .repo-delete-btn:hover{color:var(--color-error, #e55)}.repo-row-wrapper.svelte-6dohdz:hover .repo-row{background:var(--color-bg-hover)}.repo-row-wrapper.svelte-6dohdz:hover .repo-delete-btn{display:inline-flex}.repo-row-wrapper.svelte-6dohdz .repo-sync-btn{display:none;width:20px;height:20px;position:absolute;right:44px;flex-shrink:0;padding:0}.repo-row-wrapper.svelte-6dohdz .repo-sync-btn:hover{color:var(--color-accent, #4af)}.repo-row-wrapper.svelte-6dohdz .repo-sync-btn.syncing{display:inline-flex;animation:svelte-6dohdz-spin 1s linear infinite}.repo-row-wrapper.svelte-6dohdz:hover .repo-sync-btn{display:inline-flex}@keyframes svelte-6dohdz-spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.new-collection-btn,.new-collection-btn .repo-name.svelte-6dohdz,.new-collection-btn .row-chevron.svelte-6dohdz{color:var(--color-text-tertiary)}.new-collection-btn:hover,.new-collection-btn:hover .repo-name.svelte-6dohdz{color:var(--color-text-secondary)}.new-collection-row.svelte-6dohdz{display:flex;align-items:center;height:32px;padding:0 12px 0 20px;border-left:2px solid transparent}.new-collection-row.svelte-6dohdz .new-collection-input{flex:1;height:100%;padding:0 0 0 30px;border:none;background:transparent;font-size:13px;border-radius:0}.new-collection-row.svelte-6dohdz .new-collection-clear{width:20px;height:20px;flex-shrink:0;margin-right:4px}.new-collection-row.svelte-6dohdz .private-toggle{width:20px;height:20px;flex-shrink:0;margin-left:auto;margin-right:4px;color:var(--color-text-secondary)}.new-collection-row.svelte-6dohdz .private-toggle.active{color:var(--color-accent, #6e6ee8)}@keyframes svelte-6dohdz-shake{0%,to{transform:translate(0)}20%{transform:translate(-4px)}40%{transform:translate(4px)}60%{transform:translate(-3px)}80%{transform:translate(2px)}}.new-collection-row.svelte-6dohdz .new-collection-input.shake{animation:svelte-6dohdz-shake .3s ease-in-out}.sidebar-footer.svelte-6dohdz{display:flex;align-items:center;height:40px;padding:0 12px 0 19px;border-top:1px solid var(--color-border);flex-shrink:0;gap:8px}.user-email.svelte-6dohdz{flex:1;font-size:12px;color:var(--color-text-tertiary);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.sidebar-footer.svelte-6dohdz .footer-icon-btn{width:28px;height:28px}.search-header.svelte-1xems06{display:flex;align-items:center;height:52px;padding:0 16px;gap:10px;border-bottom:1px solid var(--color-border)}.search-header.svelte-1xems06 svg{color:var(--color-text-tertiary);flex-shrink:0}.search-header.svelte-1xems06 .search-input{flex:1;font-size:15px;line-height:20px;border:none;background:transparent;box-shadow:none;padding:0;height:auto}.search-header.svelte-1xems06 .search-input:focus{box-shadow:none;border:none}.esc-badge.svelte-1xems06{font-family:var(--font-sans);font-size:11px;line-height:1;padding:3px 6px;border-radius:4px;background:var(--color-bg-surface);border:1px solid var(--color-border);color:var(--color-text-tertiary)}.results-list.svelte-1xems06{flex:1;overflow-y:auto;min-height:0}.empty-results.svelte-1xems06{padding:24px 16px;text-align:center;font-size:13px;color:var(--color-text-tertiary)}.results-list.svelte-1xems06 .result-row{display:flex;align-items:flex-start;padding:10px 16px;width:100%;text-align:left;border-radius:0;height:auto;justify-content:flex-start}.results-list.svelte-1xems06 .result-row:hover,.results-list.svelte-1xems06 .result-row.selected{background:var(--color-bg-hover)}.result-body.svelte-1xems06{flex:1;min-width:0;display:flex;flex-direction:column;gap:2px}.result-title-row.svelte-1xems06{display:flex;align-items:center;gap:8px}.result-title.svelte-1xems06{font-size:13px;font-weight:500;color:var(--color-text-primary);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.entity-tag.svelte-1xems06{flex-shrink:0;font-size:10px;font-weight:500;letter-spacing:.04em;text-transform:uppercase;padding:1px 6px;border-radius:3px;background:var(--color-badge-bg);color:var(--color-badge-text)}.result-meta.svelte-1xems06{font-size:12px;color:var(--color-text-tertiary)}.search-footer.svelte-1xems06{display:flex;align-items:center;height:39px;padding:0 16px;gap:16px;border-top:1px solid var(--color-border)}.shortcut-group.svelte-1xems06{display:flex;align-items:center;gap:4px}.shortcut-key.svelte-1xems06{display:inline-flex;align-items:center;justify-content:center;min-width:20px;height:20px;padding:0 4px;border-radius:4px;background:var(--color-bg-surface);border:1px solid var(--color-border);color:var(--color-text-tertiary)}.shortcut-label.svelte-1xems06{font-size:11px;color:var(--color-text-tertiary);margin-left:2px}.app-frame.svelte-vr1z90{width:100vw;height:100vh;display:flex;flex-direction:column;overflow:hidden;background:var(--color-bg)}.app-body.svelte-vr1z90{flex:1;display:flex;min-height:0;overflow:hidden}.main-content.svelte-vr1z90{flex:1;display:flex;flex-direction:column;min-width:0;min-height:0;overflow:hidden}#sg-chrome-footer{flex-shrink:0}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.autocomplete.svelte-84vb17{position:relative;width:100%}.input-row.svelte-84vb17{display:flex;flex-wrap:wrap;align-items:center;gap:4px;min-height:22px;padding:0;background:transparent;border:none;border-radius:4px}.chip.svelte-84vb17{display:inline-flex;align-items:center;gap:4px;height:20px;padding:0 8px;border-radius:9999px;font-size:12px;background:var(--color-accent-muted);color:var(--color-link, #8b8bf0);flex-shrink:0}.chip.svelte-84vb17 .chip-remove{width:14px;height:14px;padding:0;color:var(--color-text-tertiary);font-size:12px;line-height:1}.chip.svelte-84vb17 .chip-remove:hover{color:var(--color-text-primary)}.ac-input.svelte-84vb17{flex:1;min-width:80px;height:22px;padding:0;font-size:13px;font-family:inherit;color:var(--color-text-primary);background:transparent;border:none;outline:none}.dropdown.svelte-84vb17{position:absolute;top:100%;left:0;right:0;margin-top:4px;max-height:240px;overflow-y:auto;background:var(--color-bg-elevated);border:1px solid var(--color-border);border-radius:6px;box-shadow:0 4px 16px #00000040;z-index:50}.dropdown-item.svelte-84vb17{display:flex;align-items:center;justify-content:space-between;padding:6px 10px;cursor:pointer;gap:8px}.dropdown-item.highlighted.svelte-84vb17{background:var(--color-bg-hover)}.entity-title.svelte-84vb17{font-size:13px;color:var(--color-text-primary);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;min-width:0}.entity-meta.svelte-84vb17{display:flex;align-items:center;gap:6px;flex-shrink:0}.entity-type-badge.svelte-84vb17{font-size:11px;padding:1px 6px;border-radius:9999px;background:var(--color-badge-bg);color:var(--color-badge-text)}.entity-repo.svelte-84vb17{font-size:11px;color:var(--color-text-tertiary)}.inline-properties.svelte-x7sio8{padding:16px 40px 8px;border-bottom:1px solid var(--color-border)}.ip-row.svelte-x7sio8{display:grid;grid-template-columns:20px 120px 1fr;align-items:start;gap:8px;padding:5px 8px;margin:0 -8px;border-radius:4px;min-height:30px;outline:2px solid transparent;transition:outline-color .1s}.ip-row.svelte-x7sio8:hover{outline-color:var(--color-border)}.ip-row.ip-focused.svelte-x7sio8{outline-color:var(--color-accent)}.ip-icon.svelte-x7sio8{display:flex;align-items:center;justify-content:center;color:var(--color-text-tertiary);position:relative;height:22px}.ip-key.svelte-x7sio8{font-size:13px;color:var(--color-text-tertiary);line-height:22px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.ip-value.svelte-x7sio8{display:flex;align-items:center;min-height:22px;line-height:22px;position:relative;cursor:text}.ip-edit-input.svelte-x7sio8{font-size:13px;font-family:inherit;color:var(--color-text-primary);background:transparent;border:none;padding:0 4px;height:22px;line-height:22px;width:100%;outline:none}.ip-status-wrap.svelte-x7sio8{position:relative;width:100%}.ip-status-dropdown.svelte-x7sio8{position:absolute;top:100%;left:-4px;margin-top:4px;min-width:180px;background:var(--color-bg-elevated);border:1px solid var(--color-border);border-radius:6px;box-shadow:0 4px 16px #00000040;z-index:50;padding:4px;max-height:240px;overflow-y:auto}.ip-status-dropdown.svelte-x7sio8 .ip-status-option{display:flex;align-items:center;gap:6px;width:100%;padding:5px 8px;font-size:13px;color:var(--color-text-primary);border-radius:4px;text-align:left;justify-content:flex-start;height:auto}.ip-status-dropdown.svelte-x7sio8 .ip-status-option:hover{background:var(--color-bg-hover)}.ip-status-dropdown.svelte-x7sio8 .ip-status-option.selected{color:var(--color-accent)}.ip-cal-wrap.svelte-x7sio8{position:relative;width:100%}.ip-cal-dropdown.svelte-x7sio8{position:absolute;top:100%;left:-4px;margin-top:4px;background:var(--color-bg-elevated);border:1px solid var(--color-border);border-radius:6px;box-shadow:0 4px 16px #00000040;z-index:50;padding:12px;width:264px}.ip-cal-header.svelte-x7sio8{display:flex;align-items:center;justify-content:space-between;margin-bottom:8px}.ip-cal-title.svelte-x7sio8{font-size:13px;font-weight:500;color:var(--color-text-primary)}.ip-cal-header.svelte-x7sio8 .ip-cal-nav{width:28px;height:28px}.ip-cal-weekdays.svelte-x7sio8{display:grid;grid-template-columns:repeat(7,1fr);margin-bottom:4px}.ip-cal-wd.svelte-x7sio8{font-size:11px;color:var(--color-text-tertiary);text-align:center;padding:4px 0}.ip-cal-week.svelte-x7sio8{display:grid;grid-template-columns:repeat(7,1fr)}.ip-cal-week.svelte-x7sio8 .ip-cal-day{display:flex;align-items:center;justify-content:center;width:100%;aspect-ratio:1;border-radius:4px;font-size:13px;color:var(--color-text-primary);padding:0;height:auto}.ip-cal-week.svelte-x7sio8 .ip-cal-day:hover{background:var(--color-bg-hover)}.ip-cal-week.svelte-x7sio8 .ip-cal-day.outside{color:var(--color-text-tertiary);opacity:.5}.ip-cal-week.svelte-x7sio8 .ip-cal-day.today{font-weight:600;color:var(--color-accent)}.ip-cal-week.svelte-x7sio8 .ip-cal-day.selected{background:var(--color-accent);color:#fff;font-weight:500}.ip-cal-week.svelte-x7sio8 .ip-cal-day.selected:hover{background:var(--color-accent-hover)}.ip-badge.svelte-x7sio8{display:inline-flex;align-items:center;height:22px;padding:0 8px;border-radius:9999px;font-size:12px;text-transform:lowercase;background:var(--color-badge-bg);color:var(--color-badge-text)}.ip-wikilink-group.svelte-x7sio8{display:flex;flex-wrap:wrap;gap:6px}.ip-wikilink-group.svelte-x7sio8 .ip-wikilink-chip{display:inline-flex;align-items:center;height:22px;padding:0 8px;border-radius:9999px;font-size:12px;background:var(--color-accent-muted);color:var(--color-link, #8b8bf0)}.ip-wikilink-group.svelte-x7sio8 .ip-wikilink-chip:hover{background:#8b8bf029}.ip-status-value.svelte-x7sio8{display:flex;align-items:center;gap:5px;height:22px}.ip-status-dot.svelte-x7sio8{width:6px;height:6px;border-radius:3px;flex-shrink:0}.ip-status-text.svelte-x7sio8,.ip-date-text.svelte-x7sio8,.ip-text-value.svelte-x7sio8{font-size:13px;line-height:22px;color:var(--color-text-primary)}.ip-url-link.svelte-x7sio8{font-size:13px;line-height:22px;color:var(--color-link, #8b8bf0);text-decoration:none;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.ip-url-link.svelte-x7sio8:hover{text-decoration:underline}.inline-properties.svelte-x7sio8 .ip-add-btn{margin:8px -8px;font-size:13px}.ip-add-key-input.svelte-x7sio8{font-size:13px;font-family:inherit;color:var(--color-text-primary);background:transparent;border:none;border-bottom:1px solid var(--color-accent);padding:2px 0;width:100%;outline:none}.ip-add-row.svelte-x7sio8{background:var(--color-bg-hover)}.ip-icon-trigger{all:unset;display:flex;align-items:center;justify-content:center;cursor:pointer;border-radius:4px;color:var(--color-text-tertiary)}.ip-icon-trigger:hover{color:var(--color-text-secondary)}.ip-menu-content{min-width:160px;background:var(--color-bg-elevated);border:1px solid var(--color-border);border-radius:6px;box-shadow:0 4px 16px #00000040;z-index:50;padding:4px}.ip-menu-item{display:flex;align-items:center;gap:8px;width:100%;padding:5px 8px;font-size:13px;cursor:pointer;border-radius:4px;color:var(--color-text-primary)}.ip-menu-item:hover,.ip-menu-item[data-highlighted]{background:var(--color-bg-hover)}.ip-menu-destructive{color:var(--color-destructive)!important}.ip-menu-destructive:hover,.ip-menu-destructive[data-highlighted]{background:#e54d4d1a!important}.ip-menu-item-icon.svelte-x7sio8{display:flex;align-items:center;flex-shrink:0}.ip-menu-check.svelte-x7sio8{margin-left:auto;display:flex;align-items:center}.ip-menu-sep{height:1px;background:var(--color-border);margin:4px 0}.editor-wrap.svelte-ok7wy5{display:flex;min-height:0}.cm-container.svelte-ok7wy5{flex:1}.cm-container.svelte-ok7wy5 .cm-editor{min-height:400px;outline:none}.cm-container.svelte-ok7wy5 .cm-scroller{overflow:visible!important}
|
|
1
|
+
.autocomplete.svelte-84vb17{position:relative;width:100%}.input-row.svelte-84vb17{display:flex;flex-wrap:wrap;align-items:center;gap:4px;min-height:22px;padding:0;background:transparent;border:none;border-radius:4px}.chip.svelte-84vb17{display:inline-flex;align-items:center;gap:4px;height:20px;padding:0 8px;border-radius:9999px;font-size:12px;background:var(--color-accent-muted);color:var(--color-link, #8b8bf0);flex-shrink:0}.chip.svelte-84vb17 .chip-remove{width:14px;height:14px;padding:0;color:var(--color-text-tertiary);font-size:12px;line-height:1}.chip.svelte-84vb17 .chip-remove:hover{color:var(--color-text-primary)}.ac-input.svelte-84vb17{flex:1;min-width:80px;height:22px;padding:0;font-size:13px;font-family:inherit;color:var(--color-text-primary);background:transparent;border:none;outline:none}.dropdown.svelte-84vb17{position:absolute;top:100%;left:0;right:0;margin-top:4px;max-height:240px;overflow-y:auto;background:var(--color-bg-elevated);border:1px solid var(--color-border);border-radius:6px;box-shadow:0 4px 16px #00000040;z-index:50}.dropdown-item.svelte-84vb17{display:flex;align-items:center;justify-content:space-between;padding:6px 10px;cursor:pointer;gap:8px}.dropdown-item.highlighted.svelte-84vb17{background:var(--color-bg-hover)}.entity-title.svelte-84vb17{font-size:13px;color:var(--color-text-primary);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;min-width:0}.entity-meta.svelte-84vb17{display:flex;align-items:center;gap:6px;flex-shrink:0}.entity-type-badge.svelte-84vb17{font-size:11px;padding:1px 6px;border-radius:9999px;background:var(--color-badge-bg);color:var(--color-badge-text)}.entity-repo.svelte-84vb17{font-size:11px;color:var(--color-text-tertiary)}.inline-properties.svelte-x7sio8{padding:16px 40px 8px;border-bottom:1px solid var(--color-border)}.ip-row.svelte-x7sio8{display:grid;grid-template-columns:20px 120px 1fr;align-items:start;gap:8px;padding:5px 8px;margin:0 -8px;border-radius:4px;min-height:30px;outline:2px solid transparent;transition:outline-color .1s}.ip-row.svelte-x7sio8:hover{outline-color:var(--color-border)}.ip-row.ip-focused.svelte-x7sio8{outline-color:var(--color-accent)}.ip-icon.svelte-x7sio8{display:flex;align-items:center;justify-content:center;color:var(--color-text-tertiary);position:relative;height:22px}.ip-key.svelte-x7sio8{font-size:13px;color:var(--color-text-tertiary);line-height:22px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.ip-value.svelte-x7sio8{display:flex;align-items:center;min-height:22px;line-height:22px;position:relative;cursor:text}.ip-edit-input.svelte-x7sio8{font-size:13px;font-family:inherit;color:var(--color-text-primary);background:transparent;border:none;padding:0 4px;height:22px;line-height:22px;width:100%;outline:none}.ip-status-wrap.svelte-x7sio8{position:relative;width:100%}.ip-status-dropdown.svelte-x7sio8{position:absolute;top:100%;left:-4px;margin-top:4px;min-width:180px;background:var(--color-bg-elevated);border:1px solid var(--color-border);border-radius:6px;box-shadow:0 4px 16px #00000040;z-index:50;padding:4px;max-height:240px;overflow-y:auto}.ip-status-dropdown.svelte-x7sio8 .ip-status-option{display:flex;align-items:center;gap:6px;width:100%;padding:5px 8px;font-size:13px;color:var(--color-text-primary);border-radius:4px;text-align:left;justify-content:flex-start;height:auto}.ip-status-dropdown.svelte-x7sio8 .ip-status-option:hover{background:var(--color-bg-hover)}.ip-status-dropdown.svelte-x7sio8 .ip-status-option.selected{color:var(--color-accent)}.ip-cal-wrap.svelte-x7sio8{position:relative;width:100%}.ip-cal-dropdown.svelte-x7sio8{position:absolute;top:100%;left:-4px;margin-top:4px;background:var(--color-bg-elevated);border:1px solid var(--color-border);border-radius:6px;box-shadow:0 4px 16px #00000040;z-index:50;padding:12px;width:264px}.ip-cal-header.svelte-x7sio8{display:flex;align-items:center;justify-content:space-between;margin-bottom:8px}.ip-cal-title.svelte-x7sio8{font-size:13px;font-weight:500;color:var(--color-text-primary)}.ip-cal-header.svelte-x7sio8 .ip-cal-nav{width:28px;height:28px}.ip-cal-weekdays.svelte-x7sio8{display:grid;grid-template-columns:repeat(7,1fr);margin-bottom:4px}.ip-cal-wd.svelte-x7sio8{font-size:11px;color:var(--color-text-tertiary);text-align:center;padding:4px 0}.ip-cal-week.svelte-x7sio8{display:grid;grid-template-columns:repeat(7,1fr)}.ip-cal-week.svelte-x7sio8 .ip-cal-day{display:flex;align-items:center;justify-content:center;width:100%;aspect-ratio:1;border-radius:4px;font-size:13px;color:var(--color-text-primary);padding:0;height:auto}.ip-cal-week.svelte-x7sio8 .ip-cal-day:hover{background:var(--color-bg-hover)}.ip-cal-week.svelte-x7sio8 .ip-cal-day.outside{color:var(--color-text-tertiary);opacity:.5}.ip-cal-week.svelte-x7sio8 .ip-cal-day.today{font-weight:600;color:var(--color-accent)}.ip-cal-week.svelte-x7sio8 .ip-cal-day.selected{background:var(--color-accent);color:#fff;font-weight:500}.ip-cal-week.svelte-x7sio8 .ip-cal-day.selected:hover{background:var(--color-accent-hover)}.ip-badge.svelte-x7sio8{display:inline-flex;align-items:center;height:22px;padding:0 8px;border-radius:9999px;font-size:12px;text-transform:lowercase;background:var(--color-badge-bg);color:var(--color-badge-text)}.ip-wikilink-group.svelte-x7sio8{display:flex;flex-wrap:wrap;gap:6px}.ip-wikilink-group.svelte-x7sio8 .ip-wikilink-chip{display:inline-flex;align-items:center;height:22px;padding:0 8px;border-radius:9999px;font-size:12px;background:var(--color-accent-muted);color:var(--color-link, #8b8bf0)}.ip-wikilink-group.svelte-x7sio8 .ip-wikilink-chip:hover{background:#8b8bf029}.ip-status-value.svelte-x7sio8{display:flex;align-items:center;gap:5px;height:22px}.ip-status-dot.svelte-x7sio8{width:6px;height:6px;border-radius:3px;flex-shrink:0}.ip-status-text.svelte-x7sio8,.ip-date-text.svelte-x7sio8,.ip-text-value.svelte-x7sio8{font-size:13px;line-height:22px;color:var(--color-text-primary)}.ip-url-link.svelte-x7sio8{font-size:13px;line-height:22px;color:var(--color-link, #8b8bf0);text-decoration:none;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.ip-url-link.svelte-x7sio8:hover{text-decoration:underline}.inline-properties.svelte-x7sio8 .ip-add-btn{margin:8px -8px;font-size:13px}.ip-add-key-input.svelte-x7sio8{font-size:13px;font-family:inherit;color:var(--color-text-primary);background:transparent;border:none;border-bottom:1px solid var(--color-accent);padding:2px 0;width:100%;outline:none}.ip-add-row.svelte-x7sio8{background:var(--color-bg-hover)}.ip-icon-trigger{all:unset;display:flex;align-items:center;justify-content:center;cursor:pointer;border-radius:4px;color:var(--color-text-tertiary)}.ip-icon-trigger:hover{color:var(--color-text-secondary)}.ip-menu-content{min-width:160px;background:var(--color-bg-elevated);border:1px solid var(--color-border);border-radius:6px;box-shadow:0 4px 16px #00000040;z-index:50;padding:4px}.ip-menu-item{display:flex;align-items:center;gap:8px;width:100%;padding:5px 8px;font-size:13px;cursor:pointer;border-radius:4px;color:var(--color-text-primary)}.ip-menu-item:hover,.ip-menu-item[data-highlighted]{background:var(--color-bg-hover)}.ip-menu-destructive{color:var(--color-destructive)!important}.ip-menu-destructive:hover,.ip-menu-destructive[data-highlighted]{background:#e54d4d1a!important}.ip-menu-item-icon.svelte-x7sio8{display:flex;align-items:center;flex-shrink:0}.ip-menu-check.svelte-x7sio8{margin-left:auto;display:flex;align-items:center}.ip-menu-sep{height:1px;background:var(--color-border);margin:4px 0}.editor-wrap.svelte-ok7wy5{display:flex;min-height:0}.cm-container.svelte-ok7wy5{flex:1}.cm-container.svelte-ok7wy5 .cm-editor{min-height:400px;outline:none}.cm-container.svelte-ok7wy5 .cm-scroller{overflow:visible!important}.cm-container.svelte-ok7wy5 .cm-ySelectionInfo{font-family:var(--font-sans),Inter,sans-serif;font-size:12px;font-weight:500}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as p,a as i}from"./
|
|
1
|
+
import{c as p,a as i}from"./CjKjQEMp.js";import"./eEhMI0BQ.js";import{f as l}from"./D-tW7Byc.js";import{I as c,s as m}from"./JFkcr2-N.js";import{l as d,s as f}from"./EhE2EcYu.js";function P(s,o){const t=d(o,["children","$$slots","$$events","$$legacy"]);const e=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z"}],["path",{d:"m15 5 4 4"}]];c(s,f({name:"pencil"},()=>t,{get iconNode(){return e},children:(r,$)=>{var a=p(),n=l(a);m(n,o,"default",{}),i(r,a)},$$slots:{default:!0}}))}export{P};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as b,f as m}from"./
|
|
1
|
+
import{a as b,f as m}from"./CjKjQEMp.js";import{b as _,c as h}from"./ByFfmBEu.js";import{N as y,O as v,P as x,F as k,Q as E,h as S,R as I,p as P,n as V}from"./D-tW7Byc.js";import{p as i,b as w,r as F}from"./EhE2EcYu.js";function M(e,r,o=r){var s=new WeakSet;y(e,"input",async l=>{var a=l?e.defaultValue:e.value;if(a=n(e)?u(a):a,o(a),v!==null&&s.add(v),await x(),a!==(a=r())){var t=e.selectionStart,c=e.selectionEnd,d=e.value.length;if(e.value=a??"",c!==null){var f=e.value.length;t===c&&c===d&&f>d?(e.selectionStart=f,e.selectionEnd=f):(e.selectionStart=t,e.selectionEnd=Math.min(c,f))}}}),(S&&e.defaultValue!==e.value||k(r)==null&&e.value)&&(o(n(e)?u(e.value):e.value),v!==null&&s.add(v)),E(()=>{var l=r();if(e===document.activeElement){var a=I??v;if(s.has(a))return}n(e)&&l===u(e.value)||e.type==="date"&&!l&&!e.value||l!==e.value&&(e.value=l??"")})}function n(e){var r=e.type;return r==="number"||r==="range"}function u(e){return e===""?null:+e}var N=m("<input/>");function g(e,r){P(r,!0);let o=i(r,"ref",15,null),s=i(r,"value",15),l=F(r,["$$slots","$$events","$$legacy","class","ref","value"]);var a=N();_(a,t=>({class:t,...l}),[()=>h("h-8 w-full rounded-md border border-[var(--color-border)] bg-[var(--color-bg)] px-2.5 text-[13px] text-[var(--color-text-primary)] font-[inherit] outline-none transition-colors placeholder:text-[var(--color-text-tertiary)] focus:border-[var(--color-accent,#6e6ee8)] disabled:cursor-not-allowed disabled:opacity-50",r.class)],void 0,void 0,void 0,!0),w(a,t=>o(t),()=>o()),M(a,s),b(e,a),V()}export{g as I,M as b};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
const F=()=>new Map,je=e=>{const t=F();return e.forEach((n,s)=>{t.set(s,n)}),t},tt=(e,t,n)=>{let s=e.get(t);return s===void 0&&e.set(t,s=n()),s},pr=(e,t)=>{const n=[];for(const[s,r]of e)n.push(t(r,s));return n},wr=(e,t)=>{for(const[n,s]of e)if(t(s,n))return!0;return!1},wt=()=>new Set,xe=e=>e[e.length-1],mr=(e,t)=>{for(let n=0;n<t.length;n++)e.push(t[n])},Q=Array.from,Pe=(e,t)=>{for(let n=0;n<e.length;n++)if(!t(e[n],n,e))return!1;return!0},Ze=(e,t)=>{for(let n=0;n<e.length;n++)if(t(e[n],n,e))return!0;return!1},kr=(e,t)=>{const n=new Array(e);for(let s=0;s<e;s++)n[s]=t(s,n);return n},mt=Array.isArray;class Zn{constructor(){this._observers=F()}on(t,n){return tt(this._observers,t,wt).add(n),n}once(t,n){const s=(...r)=>{this.off(t,s),n(...r)};this.on(t,s)}off(t,n){const s=this._observers.get(t);s!==void 0&&(s.delete(n),s.size===0&&this._observers.delete(t))}emit(t,n){return Q((this._observers.get(t)||F()).values()).forEach(s=>s(...n))}destroy(){this._observers=F()}}const J=Math.floor,Zt=Math.abs,Qn=(e,t)=>e<t?e:t,it=(e,t)=>e>t?e:t,ts=e=>e!==0?e<0:1/e<0,Dn=1,An=2,Le=4,Ue=8,Ut=32,W=64,R=128,we=31,Be=63,et=127,yr=2147483647,se=Number.MAX_SAFE_INTEGER,In=Number.MIN_SAFE_INTEGER,_r=Number.isInteger||(e=>typeof e=="number"&&isFinite(e)&&J(e)===e),Sr=String.fromCharCode,br=e=>e.toLowerCase(),Er=/^\s*/g,Cr=e=>e.replace(Er,""),Dr=/([A-Z])/g,Tn=(e,t)=>Cr(e.replace(Dr,n=>`${t}${br(n)}`)),Ar=e=>{const t=unescape(encodeURIComponent(e)),n=t.length,s=new Uint8Array(n);for(let r=0;r<n;r++)s[r]=t.codePointAt(r);return s},Nt=typeof TextEncoder<"u"?new TextEncoder:null,Ir=e=>Nt.encode(e),Tr=Nt?Ir:Ar;let Lt=typeof TextDecoder>"u"?null:new TextDecoder("utf-8",{fatal:!0,ignoreBOM:!0});Lt&&Lt.decode(new Uint8Array).length===1&&(Lt=null);const Or=(e,t)=>kr(t,()=>e).join("");class Gt{constructor(){this.cpos=0,this.cbuf=new Uint8Array(100),this.bufs=[]}}const me=()=>new Gt,xr=e=>{let t=e.cpos;for(let n=0;n<e.bufs.length;n++)t+=e.bufs[n].length;return t},B=e=>{const t=new Uint8Array(xr(e));let n=0;for(let s=0;s<e.bufs.length;s++){const r=e.bufs[s];t.set(r,n),n+=r.length}return t.set(new Uint8Array(e.cbuf.buffer,0,e.cpos),n),t},Lr=(e,t)=>{const n=e.cbuf.length;n-e.cpos<t&&(e.bufs.push(new Uint8Array(e.cbuf.buffer,0,e.cpos)),e.cbuf=new Uint8Array(it(n,t)*2),e.cpos=0)},A=(e,t)=>{const n=e.cbuf.length;e.cpos===n&&(e.bufs.push(e.cbuf),e.cbuf=new Uint8Array(n*2),e.cpos=0),e.cbuf[e.cpos++]=t},Je=A,k=(e,t)=>{for(;t>et;)A(e,R|et&t),t=J(t/128);A(e,et&t)},Qe=(e,t)=>{const n=ts(t);for(n&&(t=-t),A(e,(t>Be?R:0)|(n?W:0)|Be&t),t=J(t/64);t>0;)A(e,(t>et?R:0)|et&t),t=J(t/128)},Ge=new Uint8Array(3e4),Ur=Ge.length/3,Nr=(e,t)=>{if(t.length<Ur){const n=Nt.encodeInto(t,Ge).written||0;k(e,n);for(let s=0;s<n;s++)A(e,Ge[s])}else U(e,Tr(t))},Rr=(e,t)=>{const n=unescape(encodeURIComponent(t)),s=n.length;k(e,s);for(let r=0;r<s;r++)A(e,n.codePointAt(r))},at=Nt&&Nt.encodeInto?Nr:Rr,ke=(e,t)=>{const n=e.cbuf.length,s=e.cpos,r=Qn(n-s,t.length),i=t.length-r;e.cbuf.set(t.subarray(0,r),s),e.cpos+=r,i>0&&(e.bufs.push(e.cbuf),e.cbuf=new Uint8Array(it(n*2,i)),e.cbuf.set(t.subarray(r)),e.cpos=i)},U=(e,t)=>{k(e,t.byteLength),ke(e,t)},tn=(e,t)=>{Lr(e,t);const n=new DataView(e.cbuf.buffer,e.cpos,t);return e.cpos+=t,n},Mr=(e,t)=>tn(e,4).setFloat32(0,t,!1),$r=(e,t)=>tn(e,8).setFloat64(0,t,!1),vr=(e,t)=>tn(e,8).setBigInt64(0,t,!1),On=new DataView(new ArrayBuffer(4)),Fr=e=>(On.setFloat32(0,e),On.getFloat32(0)===e),Rt=(e,t)=>{switch(typeof t){case"string":A(e,119),at(e,t);break;case"number":_r(t)&&Zt(t)<=yr?(A(e,125),Qe(e,t)):Fr(t)?(A(e,124),Mr(e,t)):(A(e,123),$r(e,t));break;case"bigint":A(e,122),vr(e,t);break;case"object":if(t===null)A(e,126);else if(mt(t)){A(e,117),k(e,t.length);for(let n=0;n<t.length;n++)Rt(e,t[n])}else if(t instanceof Uint8Array)A(e,116),U(e,t);else{A(e,118);const n=Object.keys(t);k(e,n.length);for(let s=0;s<n.length;s++){const r=n[s];at(e,r),Rt(e,t[r])}}break;case"boolean":A(e,t?120:121);break;default:A(e,127)}};class xn extends Gt{constructor(t){super(),this.w=t,this.s=null,this.count=0}write(t){this.s===t?this.count++:(this.count>0&&k(this,this.count-1),this.count=1,this.w(this,t),this.s=t)}}const Ln=e=>{e.count>0&&(Qe(e.encoder,e.count===1?e.s:-e.s),e.count>1&&k(e.encoder,e.count-2))};class Qt{constructor(){this.encoder=new Gt,this.s=0,this.count=0}write(t){this.s===t?this.count++:(Ln(this),this.count=1,this.s=t)}toUint8Array(){return Ln(this),B(this.encoder)}}const Un=e=>{if(e.count>0){const t=e.diff*2+(e.count===1?0:1);Qe(e.encoder,t),e.count>1&&k(e.encoder,e.count-2)}};class Ne{constructor(){this.encoder=new Gt,this.s=0,this.count=0,this.diff=0}write(t){this.diff===t-this.s?(this.s=t,this.count++):(Un(this),this.count=1,this.diff=t-this.s,this.s=t)}toUint8Array(){return Un(this),B(this.encoder)}}class Vr{constructor(){this.sarr=[],this.s="",this.lensE=new Qt}write(t){this.s+=t,this.s.length>19&&(this.sarr.push(this.s),this.s=""),this.lensE.write(t.length)}toUint8Array(){const t=new Gt;return this.sarr.push(this.s),this.s="",at(t,this.sarr.join("")),ke(t,this.lensE.toUint8Array()),B(t)}}const G=e=>new Error(e),V=()=>{throw G("Method unimplemented")},M=()=>{throw G("Unexpected case")},es=G("Unexpected end of array"),ns=G("Integer out of Range");class ye{constructor(t){this.arr=t,this.pos=0}}const Dt=e=>new ye(e),jr=e=>e.pos!==e.arr.length,Br=(e,t)=>{const n=new Uint8Array(e.arr.buffer,e.pos+e.arr.byteOffset,t);return e.pos+=t,n},N=e=>Br(e,m(e)),kt=e=>e.arr[e.pos++],m=e=>{let t=0,n=1;const s=e.arr.length;for(;e.pos<s;){const r=e.arr[e.pos++];if(t=t+(r&et)*n,n*=128,r<R)return t;if(t>se)throw ns}throw es},en=e=>{let t=e.arr[e.pos++],n=t&Be,s=64;const r=(t&W)>0?-1:1;if((t&R)===0)return r*n;const i=e.arr.length;for(;e.pos<i;){if(t=e.arr[e.pos++],n=n+(t&et)*s,s*=128,t<R)return r*n;if(n>se)throw ns}throw es},Jr=e=>{let t=m(e);if(t===0)return"";{let n=String.fromCodePoint(kt(e));if(--t<100)for(;t--;)n+=String.fromCodePoint(kt(e));else for(;t>0;){const s=t<1e4?t:1e4,r=e.arr.subarray(e.pos,e.pos+s);e.pos+=s,n+=String.fromCodePoint.apply(null,r),t-=s}return decodeURIComponent(escape(n))}},Gr=e=>Lt.decode(N(e)),ut=Lt?Gr:Jr,nn=(e,t)=>{const n=new DataView(e.arr.buffer,e.arr.byteOffset+e.pos,t);return e.pos+=t,n},Yr=e=>nn(e,4).getFloat32(0,!1),Hr=e=>nn(e,8).getFloat64(0,!1),zr=e=>nn(e,8).getBigInt64(0,!1),Kr=[e=>{},e=>null,en,Yr,Hr,zr,e=>!1,e=>!0,ut,e=>{const t=m(e),n={};for(let s=0;s<t;s++){const r=ut(e);n[r]=Mt(e)}return n},e=>{const t=m(e),n=[];for(let s=0;s<t;s++)n.push(Mt(e));return n},N],Mt=e=>Kr[127-kt(e)](e);class Nn extends ye{constructor(t,n){super(t),this.reader=n,this.s=null,this.count=0}read(){return this.count===0&&(this.s=this.reader(this),jr(this)?this.count=m(this)+1:this.count=-1),this.count--,this.s}}class te extends ye{constructor(t){super(t),this.s=0,this.count=0}read(){if(this.count===0){this.s=en(this);const t=ts(this.s);this.count=1,t&&(this.s=-this.s,this.count=m(this)+2)}return this.count--,this.s}}class Re extends ye{constructor(t){super(t),this.s=0,this.count=0,this.diff=0}read(){if(this.count===0){const t=en(this),n=t&1;this.diff=J(t/2),this.count=1,n&&(this.count=m(this)+2)}return this.s+=this.diff,this.count--,this.s}}class Xr{constructor(t){this.decoder=new te(t),this.str=ut(this.decoder),this.spos=0}read(){const t=this.spos+this.decoder.read(),n=this.str.slice(this.spos,t);return this.spos=t,n}}const Wr=crypto.getRandomValues.bind(crypto),ss=()=>Wr(new Uint32Array(1))[0],qr="10000000-1000-4000-8000"+-1e11,Pr=()=>qr.replace(/[018]/g,e=>(e^ss()&15>>e/4).toString(16)),Zr=Date.now,Rn=e=>new Promise(e);Promise.all.bind(Promise);const Mn=e=>e===void 0?null:e;class Qr{constructor(){this.map=new Map}setItem(t,n){this.map.set(t,n)}getItem(t){return this.map.get(t)}}let rs=new Qr,ti=!0;try{typeof localStorage<"u"&&localStorage&&(rs=localStorage,ti=!1)}catch{}const ei=rs,$t=Symbol("Equality"),is=(e,t)=>e===t||!!e?.[$t]?.(t)||!1,ni=e=>typeof e=="object",si=Object.assign,ri=Object.keys,ii=(e,t)=>{for(const n in e)t(e[n],n)},re=e=>ri(e).length,li=e=>{for(const t in e)return!1;return!0},Yt=(e,t)=>{for(const n in e)if(!t(e[n],n))return!1;return!0},sn=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),oi=(e,t)=>e===t||re(e)===re(t)&&Yt(e,(n,s)=>(n!==void 0||sn(t,s))&&is(t[s],n)),ci=Object.freeze,ls=e=>{for(const t in e){const n=e[t];(typeof n=="object"||typeof n=="function")&&ls(e[t])}return ci(e)},rn=(e,t,n=0)=>{try{for(;n<e.length;n++)e[n](...t)}finally{n<e.length&&rn(e,t,n+1)}},hi=e=>e,ee=(e,t)=>{if(e===t)return!0;if(e==null||t==null||e.constructor!==t.constructor&&(e.constructor||Object)!==(t.constructor||Object))return!1;if(e[$t]!=null)return e[$t](t);switch(e.constructor){case ArrayBuffer:e=new Uint8Array(e),t=new Uint8Array(t);case Uint8Array:{if(e.byteLength!==t.byteLength)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;break}case Set:{if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;break}case Map:{if(e.size!==t.size)return!1;for(const n of e.keys())if(!t.has(n)||!ee(e.get(n),t.get(n)))return!1;break}case void 0:case Object:if(re(e)!==re(t))return!1;for(const n in e)if(!sn(e,n)||!ee(e[n],t[n]))return!1;break;case Array:if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(!ee(e[n],t[n]))return!1;break;default:return!1}return!0},ai=(e,t)=>t.includes(e);var os={};const vt=typeof process<"u"&&process.release&&/node|io\.js/.test(process.release.name)&&Object.prototype.toString.call(typeof process<"u"?process:0)==="[object process]";let j;const ui=()=>{if(j===void 0)if(vt){j=F();const e=process.argv;let t=null;for(let n=0;n<e.length;n++){const s=e[n];s[0]==="-"?(t!==null&&j.set(t,""),t=s):t!==null&&(j.set(t,s),t=null)}t!==null&&j.set(t,"")}else typeof location=="object"?(j=F(),(location.search||"?").slice(1).split("&").forEach(e=>{if(e.length!==0){const[t,n]=e.split("=");j.set(`--${Tn(t,"-")}`,n),j.set(`-${Tn(t,"-")}`,n)}})):j=F();return j},Ye=e=>ui().has(e),ie=e=>Mn(vt?os[e.toUpperCase().replaceAll("-","_")]:ei.getItem(e)),cs=e=>Ye("--"+e)||ie(e)!==null,di=cs("production"),fi=vt&&ai(os.FORCE_COLOR,["true","1","2"]),gi=fi||!Ye("--no-colors")&&!cs("no-color")&&(!vt||process.stdout.isTTY)&&(!vt||Ye("--color")||ie("COLORTERM")!==null||(ie("TERM")||"").includes("color")),pi=e=>new Uint8Array(e),wi=e=>{const t=pi(e.byteLength);return t.set(e),t};class mi{constructor(t,n){this.left=t,this.right=n}}const X=(e,t)=>new mi(e,t),ki=(e,t)=>e.forEach(n=>t(n.left,n.right)),$n=e=>e.next()>=.5,Me=(e,t,n)=>J(e.next()*(n+1-t)+t),hs=(e,t,n)=>J(e.next()*(n+1-t)+t),ln=(e,t,n)=>hs(e,t,n),yi=e=>Sr(ln(e,97,122)),_i=(e,t=0,n=20)=>{const s=ln(e,t,n);let r="";for(let i=0;i<s;i++)r+=yi(e);return r},$e=(e,t)=>t[ln(e,0,t.length-1)],Si=Symbol("0schema");class bi{constructor(){this._rerrs=[]}extend(t,n,s,r=null){this._rerrs.push({path:t,expected:n,has:s,message:r})}toString(){const t=[];for(let n=this._rerrs.length-1;n>0;n--){const s=this._rerrs[n];t.push(Or(" ",(this._rerrs.length-n)*2)+`${s.path!=null?`[${s.path}] `:""}${s.has} doesn't match ${s.expected}. ${s.message}`)}return t.join(`
|
|
2
|
+
`)}}const He=(e,t)=>e===t?!0:e==null||t==null||e.constructor!==t.constructor?!1:e[$t]?is(e,t):mt(e)?Pe(e,n=>Ze(t,s=>He(n,s))):ni(e)?Yt(e,(n,s)=>He(n,t[s])):!1;class x{static _dilutes=!1;extends(t){let[n,s]=[this.shape,t.shape];return this.constructor._dilutes&&([s,n]=[n,s]),He(n,s)}equals(t){return this.constructor===t.constructor&&ee(this.shape,t.shape)}[Si](){return!0}[$t](t){return this.equals(t)}validate(t){return this.check(t)}check(t,n){V()}get nullable(){return At(this,Ce)}get optional(){return new ds(this)}cast(t){return vn(t,this),t}expect(t){return vn(t,this),t}}class on extends x{constructor(t,n){super(),this.shape=t,this._c=n}check(t,n=void 0){const s=t?.constructor===this.shape&&(this._c==null||this._c(t));return!s&&n?.extend(null,this.shape.name,t?.constructor.name,t?.constructor!==this.shape?"Constructor match failed":"Check failed"),s}}const C=(e,t=null)=>new on(e,t);C(on);class cn extends x{constructor(t){super(),this.shape=t}check(t,n){const s=this.shape(t);return!s&&n?.extend(null,"custom prop",t?.constructor.name,"failed to check custom prop"),s}}const T=e=>new cn(e);C(cn);class _e extends x{constructor(t){super(),this.shape=t}check(t,n){const s=this.shape.some(r=>r===t);return!s&&n?.extend(null,this.shape.join(" | "),t.toString()),s}}const Se=(...e)=>new _e(e),as=C(_e),Ei=RegExp.escape||(e=>e.replace(/[().|&,$^[\]]/g,t=>"\\"+t)),us=e=>{if(yt.check(e))return[Ei(e)];if(as.check(e))return e.shape.map(t=>t+"");if(Ss.check(e))return["[+-]?\\d+.?\\d*"];if(bs.check(e))return[".*"];if(le.check(e))return e.shape.map(us).flat(1);M()};class Ci extends x{constructor(t){super(),this.shape=t,this._r=new RegExp("^"+t.map(us).map(n=>`(${n.join("|")})`).join("")+"$")}check(t,n){const s=this._r.exec(t)!=null;return!s&&n?.extend(null,this._r.toString(),t.toString(),"String doesn't match string template."),s}}C(Ci);const Di=Symbol("optional");class ds extends x{constructor(t){super(),this.shape=t}check(t,n){const s=t===void 0||this.shape.check(t);return!s&&n?.extend(null,"undefined (optional)","()"),s}get[Di](){return!0}}const Ai=C(ds);class Ii extends x{check(t,n){return n?.extend(null,"never",typeof t),!1}}C(Ii);class be extends x{constructor(t,n=!1){super(),this.shape=t,this._isPartial=n}static _dilutes=!0;get partial(){return new be(this.shape,!0)}check(t,n){return t==null?(n?.extend(null,"object","null"),!1):Yt(this.shape,(s,r)=>{const i=this._isPartial&&!sn(t,r)||s.check(t[r],n);return!i&&n?.extend(r.toString(),s.toString(),typeof t[r],"Object property does not match"),i})}}const Ti=e=>new be(e),Oi=C(be),xi=T(e=>e!=null&&(e.constructor===Object||e.constructor==null));class fs extends x{constructor(t,n){super(),this.shape={keys:t,values:n}}check(t,n){return t!=null&&Yt(t,(s,r)=>{const i=this.shape.keys.check(r,n);return!i&&n?.extend(r+"","Record",typeof t,i?"Key doesn't match schema":"Value doesn't match value"),i&&this.shape.values.check(s,n)})}}const gs=(e,t)=>new fs(e,t),Li=C(fs);class ps extends x{constructor(t){super(),this.shape=t}check(t,n){return t!=null&&Yt(this.shape,(s,r)=>{const i=s.check(t[r],n);return!i&&n?.extend(r.toString(),"Tuple",typeof s),i})}}const Ui=(...e)=>new ps(e);C(ps);class ws extends x{constructor(t){super(),this.shape=t.length===1?t[0]:new hn(t)}check(t,n){const s=mt(t)&&Pe(t,r=>this.shape.check(r));return!s&&n?.extend(null,"Array",""),s}}const ms=(...e)=>new ws(e),Ni=C(ws),Ri=T(e=>mt(e));class ks extends x{constructor(t,n){super(),this.shape=t,this._c=n}check(t,n){const s=t instanceof this.shape&&(this._c==null||this._c(t));return!s&&n?.extend(null,this.shape.name,t?.constructor.name),s}}const Mi=(e,t=null)=>new ks(e,t);C(ks);const $i=Mi(x);class vi extends x{constructor(t){super(),this.len=t.length-1,this.args=Ui(...t.slice(-1)),this.res=t[this.len]}check(t,n){const s=t.constructor===Function&&t.length<=this.len;return!s&&n?.extend(null,"function",typeof t),s}}const Fi=C(vi),Vi=T(e=>typeof e=="function");class ji extends x{constructor(t){super(),this.shape=t}check(t,n){const s=Pe(this.shape,r=>r.check(t,n));return!s&&n?.extend(null,"Intersectinon",typeof t),s}}C(ji,e=>e.shape.length>0);class hn extends x{static _dilutes=!0;constructor(t){super(),this.shape=t}check(t,n){const s=Ze(this.shape,r=>r.check(t,n));return n?.extend(null,"Union",typeof t),s}}const At=(...e)=>e.findIndex(t=>le.check(t))>=0?At(...e.map(t=>Ft(t)).map(t=>le.check(t)?t.shape:[t]).flat(1)):e.length===1?e[0]:new hn(e),le=C(hn),ys=()=>!0,oe=T(ys),Bi=C(cn,e=>e.shape===ys),an=T(e=>typeof e=="bigint"),Ji=T(e=>e===an),_s=T(e=>typeof e=="symbol");T(e=>e===_s);const dt=T(e=>typeof e=="number"),Ss=T(e=>e===dt),yt=T(e=>typeof e=="string"),bs=T(e=>e===yt),Ee=T(e=>typeof e=="boolean"),Gi=T(e=>e===Ee),Es=Se(void 0);C(_e,e=>e.shape.length===1&&e.shape[0]===void 0);Se(void 0);const Ce=Se(null),Yi=C(_e,e=>e.shape.length===1&&e.shape[0]===null);C(Uint8Array);C(on,e=>e.shape===Uint8Array);const Hi=At(dt,yt,Ce,Es,an,Ee,_s);(()=>{const e=ms(oe),t=gs(yt,oe),n=At(dt,yt,Ce,Ee,e,t);return e.shape=n,t.shape.values=n,n})();const Ft=e=>{if($i.check(e))return e;if(xi.check(e)){const t={};for(const n in e)t[n]=Ft(e[n]);return Ti(t)}else{if(Ri.check(e))return At(...e.map(Ft));if(Hi.check(e))return Se(e);if(Vi.check(e))return C(e)}M()},vn=di?()=>{}:(e,t)=>{const n=new bi;if(!t.check(e,n))throw G(`Expected value to be of type ${t.constructor.name}.
|
|
3
|
+
${n.toString()}`)};class zi{constructor(t){this.patterns=[],this.$state=t}if(t,n){return this.patterns.push({if:Ft(t),h:n}),this}else(t){return this.if(oe,t)}done(){return(t,n)=>{for(let s=0;s<this.patterns.length;s++){const r=this.patterns[s];if(r.if.check(t))return r.h(t,n)}throw G("Unhandled pattern")}}}const Ki=e=>new zi(e),Cs=Ki(oe).if(Ss,(e,t)=>Me(t,In,se)).if(bs,(e,t)=>_i(t)).if(Gi,(e,t)=>$n(t)).if(Ji,(e,t)=>BigInt(Me(t,In,se))).if(le,(e,t)=>ot(t,$e(t,e.shape))).if(Oi,(e,t)=>{const n={};for(const s in e.shape){let r=e.shape[s];if(Ai.check(r)){if($n(t))continue;r=r.shape}n[s]=Cs(r,t)}return n}).if(Ni,(e,t)=>{const n=[],s=hs(t,0,42);for(let r=0;r<s;r++)n.push(ot(t,e.shape));return n}).if(as,(e,t)=>$e(t,e.shape)).if(Yi,(e,t)=>null).if(Fi,(e,t)=>{const n=ot(t,e.res);return()=>n}).if(Bi,(e,t)=>ot(t,$e(t,[dt,yt,Ce,Es,an,Ee,ms(dt),gs(At("a","b","c"),dt)]))).if(Li,(e,t)=>{const n={},s=Me(t,0,3);for(let r=0;r<s;r++){const i=ot(t,e.shape.keys),l=ot(t,e.shape.values);n[i]=l}return n}).done(),ot=(e,t)=>Cs(Ft(t),e),z=typeof document<"u"?document:{},Xi=e=>z.createElement(e),Wi=()=>z.createDocumentFragment();T(e=>e.nodeType===rl);const qi=e=>z.createTextNode(e);typeof DOMParser<"u"&&new DOMParser;const Pi=(e,t)=>(ki(t,(n,s)=>{s===!1?e.removeAttribute(n):s===!0?e.setAttribute(n,""):e.setAttribute(n,s)}),e),Zi=e=>{const t=Wi();for(let n=0;n<e.length;n++)Ds(t,e[n]);return t},Qi=(e,t)=>(Ds(e,Zi(t)),e),Ro=(e,t=[],n=[])=>Qi(Pi(Xi(e),t),n);T(e=>e.nodeType===el);const Mo=qi;T(e=>e.nodeType===nl);const tl=e=>pr(e,(t,n)=>`${n}:${t};`).join(""),Ds=(e,t)=>e.appendChild(t),el=z.ELEMENT_NODE,nl=z.TEXT_NODE;z.CDATA_SECTION_NODE;z.COMMENT_NODE;const sl=z.DOCUMENT_NODE;z.DOCUMENT_TYPE_NODE;const rl=z.DOCUMENT_FRAGMENT_NODE;T(e=>e.nodeType===sl);const q=Symbol,As=q(),Is=q(),il=q(),ll=q(),ol=q(),Ts=q(),cl=q(),un=q(),hl=q(),al=e=>{e.length===1&&e[0]?.constructor===Function&&(e=e[0]());const t=[],n=[];let s=0;for(;s<e.length;s++){const r=e[s];if(r===void 0)break;if(r.constructor===String||r.constructor===Number)t.push(r);else if(r.constructor===Object)break}for(s>0&&n.push(t.join(""));s<e.length;s++){const r=e[s];r instanceof Symbol||n.push(r)}return n},ul={[As]:X("font-weight","bold"),[Is]:X("font-weight","normal"),[il]:X("color","blue"),[ol]:X("color","green"),[ll]:X("color","grey"),[Ts]:X("color","red"),[cl]:X("color","purple"),[un]:X("color","orange"),[hl]:X("color","black")},dl=e=>{e.length===1&&e[0]?.constructor===Function&&(e=e[0]());const t=[],n=[],s=F();let r=[],i=0;for(;i<e.length;i++){const l=e[i],o=ul[l];if(o!==void 0)s.set(o.left,o.right);else{if(l===void 0)break;if(l.constructor===String||l.constructor===Number){const c=tl(s);i>0||c.length>0?(t.push("%c"+l),n.push(c)):t.push(l)}else break}}for(i>0&&(r=n,r.unshift(t.join("")));i<e.length;i++){const l=e[i];l instanceof Symbol||r.push(l)}return r},Os=gi?dl:al,fl=(...e)=>{console.log(...Os(e)),Ls.forEach(t=>t.print(e))},xs=(...e)=>{console.warn(...Os(e)),e.unshift(un),Ls.forEach(t=>t.print(e))},Ls=wt(),Us=e=>({[Symbol.iterator](){return this},next:e}),gl=(e,t)=>Us(()=>{let n;do n=e.next();while(!n.done&&!t(n.value));return n}),ve=(e,t)=>Us(()=>{const{done:n,value:s}=e.next();return{done:n,value:n?void 0:t(s)}});class De{constructor(t,n){this.clock=t,this.len=n}}class It{constructor(){this.clients=new Map}}const _t=(e,t,n)=>t.clients.forEach((s,r)=>{const i=e.doc.store.clients.get(r);if(i!=null){const l=i[i.length-1],o=l.id.clock+l.length;for(let c=0,a=s[c];c<s.length&&a.clock<o;a=s[++c])zs(e,i,a.clock,a.len,n)}}),pl=(e,t)=>{let n=0,s=e.length-1;for(;n<=s;){const r=J((n+s)/2),i=e[r],l=i.clock;if(l<=t){if(t<l+i.len)return r;n=r+1}else s=r-1}return null},Ht=(e,t)=>{const n=e.clients.get(t.client);return n!==void 0&&pl(n,t.clock)!==null},dn=e=>{e.clients.forEach(t=>{t.sort((r,i)=>r.clock-i.clock);let n,s;for(n=1,s=1;n<t.length;n++){const r=t[s-1],i=t[n];r.clock+r.len>=i.clock?t[s-1]=new De(r.clock,it(r.len,i.clock+i.len-r.clock)):(s<n&&(t[s]=i),s++)}t.length=s})},ze=e=>{const t=new It;for(let n=0;n<e.length;n++)e[n].clients.forEach((s,r)=>{if(!t.clients.has(r)){const i=s.slice();for(let l=n+1;l<e.length;l++)mr(i,e[l].clients.get(r)||[]);t.clients.set(r,i)}});return dn(t),t},Vt=(e,t,n,s)=>{tt(e.clients,t,()=>[]).push(new De(n,s))},wl=()=>new It,ml=e=>{const t=wl();return e.clients.forEach((n,s)=>{const r=[];for(let i=0;i<n.length;i++){const l=n[i];if(l.deleted){const o=l.id.clock;let c=l.length;if(i+1<n.length)for(let a=n[i+1];i+1<n.length&&a.deleted;a=n[++i+1])c+=a.length;r.push(new De(o,c))}}r.length>0&&t.clients.set(s,r)}),t},Tt=(e,t)=>{k(e.restEncoder,t.clients.size),Q(t.clients.entries()).sort((n,s)=>s[0]-n[0]).forEach(([n,s])=>{e.resetDsCurVal(),k(e.restEncoder,n);const r=s.length;k(e.restEncoder,r);for(let i=0;i<r;i++){const l=s[i];e.writeDsClock(l.clock),e.writeDsLen(l.len)}})},fn=e=>{const t=new It,n=m(e.restDecoder);for(let s=0;s<n;s++){e.resetDsCurVal();const r=m(e.restDecoder),i=m(e.restDecoder);if(i>0){const l=tt(t.clients,r,()=>[]);for(let o=0;o<i;o++)l.push(new De(e.readDsClock(),e.readDsLen()))}}return t},Fn=(e,t,n)=>{const s=new It,r=m(e.restDecoder);for(let i=0;i<r;i++){e.resetDsCurVal();const l=m(e.restDecoder),o=m(e.restDecoder),c=n.clients.get(l)||[],a=E(n,l);for(let h=0;h<o;h++){const u=e.readDsClock(),d=u+e.readDsLen();if(u<a){a<d&&Vt(s,l,a,d-a);let f=Y(c,u),g=c[f];for(!g.deleted&&g.id.clock<u&&(c.splice(f+1,0,pe(t,g,u-g.id.clock)),f++);f<c.length&&(g=c[f++],g.id.clock<d);)g.deleted||(d<g.id.clock+g.length&&c.splice(f,0,pe(t,g,d-g.id.clock)),g.delete(t))}else Vt(s,l,u,d-u)}}if(s.clients.size>0){const i=new nt;return k(i.restEncoder,0),Tt(i,s),i.toUint8Array()}return null},Ns=ss;class Ot extends Zn{constructor({guid:t=Pr(),collectionid:n=null,gc:s=!0,gcFilter:r=()=>!0,meta:i=null,autoLoad:l=!1,shouldLoad:o=!0}={}){super(),this.gc=s,this.gcFilter=r,this.clientID=Ns(),this.guid=t,this.collectionid=n,this.share=new Map,this.store=new Ys,this._transaction=null,this._transactionCleanups=[],this.subdocs=new Set,this._item=null,this.shouldLoad=o,this.autoLoad=l,this.meta=i,this.isLoaded=!1,this.isSynced=!1,this.isDestroyed=!1,this.whenLoaded=Rn(a=>{this.on("load",()=>{this.isLoaded=!0,a(this)})});const c=()=>Rn(a=>{const h=u=>{(u===void 0||u===!0)&&(this.off("sync",h),a())};this.on("sync",h)});this.on("sync",a=>{a===!1&&this.isSynced&&(this.whenSynced=c()),this.isSynced=a===void 0||a===!0,this.isSynced&&!this.isLoaded&&this.emit("load",[this])}),this.whenSynced=c()}load(){const t=this._item;t!==null&&!this.shouldLoad&&y(t.parent.doc,n=>{n.subdocsLoaded.add(this)},null,!0),this.shouldLoad=!0}getSubdocs(){return this.subdocs}getSubdocGuids(){return new Set(Q(this.subdocs).map(t=>t.guid))}transact(t,n=null){return y(this,t,n)}get(t,n=I){const s=tt(this.share,t,()=>{const i=new n;return i._integrate(this,null),i}),r=s.constructor;if(n!==I&&r!==n)if(r===I){const i=new n;i._map=s._map,s._map.forEach(l=>{for(;l!==null;l=l.left)l.parent=i}),i._start=s._start;for(let l=i._start;l!==null;l=l.right)l.parent=i;return i._length=s._length,this.share.set(t,i),i._integrate(this,null),i}else throw new Error(`Type with the name ${t} has already been defined with a different constructor`);return s}getArray(t=""){return this.get(t,pt)}getText(t=""){return this.get(t,Et)}getMap(t=""){return this.get(t,bt)}getXmlElement(t=""){return this.get(t,Ct)}getXmlFragment(t=""){return this.get(t,st)}toJSON(){const t={};return this.share.forEach((n,s)=>{t[s]=n.toJSON()}),t}destroy(){this.isDestroyed=!0,Q(this.subdocs).forEach(n=>n.destroy());const t=this._item;if(t!==null){this._item=null;const n=t.content;n.doc=new Ot({guid:this.guid,...n.opts,shouldLoad:!1}),n.doc._item=t,y(t.parent.doc,s=>{const r=n.doc;t.deleted||s.subdocsAdded.add(r),s.subdocsRemoved.add(this)},null,!0)}this.emit("destroyed",[!0]),this.emit("destroy",[this]),super.destroy()}}class Rs{constructor(t){this.restDecoder=t}resetDsCurVal(){}readDsClock(){return m(this.restDecoder)}readDsLen(){return m(this.restDecoder)}}class Ms extends Rs{readLeftID(){return p(m(this.restDecoder),m(this.restDecoder))}readRightID(){return p(m(this.restDecoder),m(this.restDecoder))}readClient(){return m(this.restDecoder)}readInfo(){return kt(this.restDecoder)}readString(){return ut(this.restDecoder)}readParentInfo(){return m(this.restDecoder)===1}readTypeRef(){return m(this.restDecoder)}readLen(){return m(this.restDecoder)}readAny(){return Mt(this.restDecoder)}readBuf(){return wi(N(this.restDecoder))}readJSON(){return JSON.parse(ut(this.restDecoder))}readKey(){return ut(this.restDecoder)}}class kl{constructor(t){this.dsCurrVal=0,this.restDecoder=t}resetDsCurVal(){this.dsCurrVal=0}readDsClock(){return this.dsCurrVal+=m(this.restDecoder),this.dsCurrVal}readDsLen(){const t=m(this.restDecoder)+1;return this.dsCurrVal+=t,t}}class St extends kl{constructor(t){super(t),this.keys=[],m(t),this.keyClockDecoder=new Re(N(t)),this.clientDecoder=new te(N(t)),this.leftClockDecoder=new Re(N(t)),this.rightClockDecoder=new Re(N(t)),this.infoDecoder=new Nn(N(t),kt),this.stringDecoder=new Xr(N(t)),this.parentInfoDecoder=new Nn(N(t),kt),this.typeRefDecoder=new te(N(t)),this.lenDecoder=new te(N(t))}readLeftID(){return new ft(this.clientDecoder.read(),this.leftClockDecoder.read())}readRightID(){return new ft(this.clientDecoder.read(),this.rightClockDecoder.read())}readClient(){return this.clientDecoder.read()}readInfo(){return this.infoDecoder.read()}readString(){return this.stringDecoder.read()}readParentInfo(){return this.parentInfoDecoder.read()===1}readTypeRef(){return this.typeRefDecoder.read()}readLen(){return this.lenDecoder.read()}readAny(){return Mt(this.restDecoder)}readBuf(){return N(this.restDecoder)}readJSON(){return Mt(this.restDecoder)}readKey(){const t=this.keyClockDecoder.read();if(t<this.keys.length)return this.keys[t];{const n=this.stringDecoder.read();return this.keys.push(n),n}}}class $s{constructor(){this.restEncoder=me()}toUint8Array(){return B(this.restEncoder)}resetDsCurVal(){}writeDsClock(t){k(this.restEncoder,t)}writeDsLen(t){k(this.restEncoder,t)}}class zt extends $s{writeLeftID(t){k(this.restEncoder,t.client),k(this.restEncoder,t.clock)}writeRightID(t){k(this.restEncoder,t.client),k(this.restEncoder,t.clock)}writeClient(t){k(this.restEncoder,t)}writeInfo(t){Je(this.restEncoder,t)}writeString(t){at(this.restEncoder,t)}writeParentInfo(t){k(this.restEncoder,t?1:0)}writeTypeRef(t){k(this.restEncoder,t)}writeLen(t){k(this.restEncoder,t)}writeAny(t){Rt(this.restEncoder,t)}writeBuf(t){U(this.restEncoder,t)}writeJSON(t){at(this.restEncoder,JSON.stringify(t))}writeKey(t){at(this.restEncoder,t)}}class vs{constructor(){this.restEncoder=me(),this.dsCurrVal=0}toUint8Array(){return B(this.restEncoder)}resetDsCurVal(){this.dsCurrVal=0}writeDsClock(t){const n=t-this.dsCurrVal;this.dsCurrVal=t,k(this.restEncoder,n)}writeDsLen(t){t===0&&M(),k(this.restEncoder,t-1),this.dsCurrVal+=t}}class nt extends vs{constructor(){super(),this.keyMap=new Map,this.keyClock=0,this.keyClockEncoder=new Ne,this.clientEncoder=new Qt,this.leftClockEncoder=new Ne,this.rightClockEncoder=new Ne,this.infoEncoder=new xn(Je),this.stringEncoder=new Vr,this.parentInfoEncoder=new xn(Je),this.typeRefEncoder=new Qt,this.lenEncoder=new Qt}toUint8Array(){const t=me();return k(t,0),U(t,this.keyClockEncoder.toUint8Array()),U(t,this.clientEncoder.toUint8Array()),U(t,this.leftClockEncoder.toUint8Array()),U(t,this.rightClockEncoder.toUint8Array()),U(t,B(this.infoEncoder)),U(t,this.stringEncoder.toUint8Array()),U(t,B(this.parentInfoEncoder)),U(t,this.typeRefEncoder.toUint8Array()),U(t,this.lenEncoder.toUint8Array()),ke(t,B(this.restEncoder)),B(t)}writeLeftID(t){this.clientEncoder.write(t.client),this.leftClockEncoder.write(t.clock)}writeRightID(t){this.clientEncoder.write(t.client),this.rightClockEncoder.write(t.clock)}writeClient(t){this.clientEncoder.write(t)}writeInfo(t){this.infoEncoder.write(t)}writeString(t){this.stringEncoder.write(t)}writeParentInfo(t){this.parentInfoEncoder.write(t?1:0)}writeTypeRef(t){this.typeRefEncoder.write(t)}writeLen(t){this.lenEncoder.write(t)}writeAny(t){Rt(this.restEncoder,t)}writeBuf(t){U(this.restEncoder,t)}writeJSON(t){Rt(this.restEncoder,t)}writeKey(t){const n=this.keyMap.get(t);n===void 0?(this.keyClockEncoder.write(this.keyClock++),this.stringEncoder.write(t)):this.keyClockEncoder.write(n)}}const yl=(e,t,n,s)=>{s=it(s,t[0].id.clock);const r=Y(t,s);k(e.restEncoder,t.length-r),e.writeClient(n),k(e.restEncoder,s);const i=t[r];i.write(e,s-i.id.clock);for(let l=r+1;l<t.length;l++)t[l].write(e,0)},gn=(e,t,n)=>{const s=new Map;n.forEach((r,i)=>{E(t,i)>r&&s.set(i,r)}),Ae(t).forEach((r,i)=>{n.has(i)||s.set(i,0)}),k(e.restEncoder,s.size),Q(s.entries()).sort((r,i)=>i[0]-r[0]).forEach(([r,i])=>{yl(e,t.clients.get(r),r,i)})},_l=(e,t)=>{const n=F(),s=m(e.restDecoder);for(let r=0;r<s;r++){const i=m(e.restDecoder),l=new Array(i),o=e.readClient();let c=m(e.restDecoder);n.set(o,{i:0,refs:l});for(let a=0;a<i;a++){const h=e.readInfo();switch(we&h){case 0:{const u=e.readLen();l[a]=new $(p(o,c),u),c+=u;break}case 10:{const u=m(e.restDecoder);l[a]=new v(p(o,c),u),c+=u;break}default:{const u=(h&(W|R))===0,d=new _(p(o,c),null,(h&R)===R?e.readLeftID():null,null,(h&W)===W?e.readRightID():null,u?e.readParentInfo()?t.get(e.readString()):e.readLeftID():null,u&&(h&Ut)===Ut?e.readString():null,dr(e,h));l[a]=d,c+=d.length}}}}return n},Sl=(e,t,n)=>{const s=[];let r=Q(n.keys()).sort((f,g)=>f-g);if(r.length===0)return null;const i=()=>{if(r.length===0)return null;let f=n.get(r[r.length-1]);for(;f.refs.length===f.i;)if(r.pop(),r.length>0)f=n.get(r[r.length-1]);else return null;return f};let l=i();if(l===null)return null;const o=new Ys,c=new Map,a=(f,g)=>{const w=c.get(f);(w==null||w>g)&&c.set(f,g)};let h=l.refs[l.i++];const u=new Map,d=()=>{for(const f of s){const g=f.id.client,w=n.get(g);w?(w.i--,o.clients.set(g,w.refs.slice(w.i)),n.delete(g),w.i=0,w.refs=[]):o.clients.set(g,[f]),r=r.filter(S=>S!==g)}s.length=0};for(;;){if(h.constructor!==v){const g=tt(u,h.id.client,()=>E(t,h.id.client))-h.id.clock;if(g<0)s.push(h),a(h.id.client,h.id.clock-1),d();else{const w=h.getMissing(e,t);if(w!==null){s.push(h);const S=n.get(w)||{refs:[],i:0};if(S.refs.length===S.i)a(w,E(t,w)),d();else{h=S.refs[S.i++];continue}}else(g===0||g<h.length)&&(h.integrate(e,g),u.set(h.id.client,h.id.clock+h.length))}}if(s.length>0)h=s.pop();else if(l!==null&&l.i<l.refs.length)h=l.refs[l.i++];else{if(l=i(),l===null)break;h=l.refs[l.i++]}}if(o.clients.size>0){const f=new nt;return gn(f,o,new Map),k(f.restEncoder,0),{missing:c,update:f.toUint8Array()}}return null},bl=(e,t)=>gn(e,t.doc.store,t.beforeState),El=(e,t,n,s=new St(e))=>y(t,r=>{r.local=!1;let i=!1;const l=r.doc,o=l.store,c=_l(s,l),a=Sl(r,o,c),h=o.pendingStructs;if(h){for(const[d,f]of h.missing)if(f<E(o,d)){i=!0;break}if(a){for(const[d,f]of a.missing){const g=h.missing.get(d);(g==null||g>f)&&h.missing.set(d,f)}h.update=he([h.update,a.update])}}else o.pendingStructs=a;const u=Fn(s,r,o);if(o.pendingDs){const d=new St(Dt(o.pendingDs));m(d.restDecoder);const f=Fn(d,r,o);u&&f?o.pendingDs=he([u,f]):o.pendingDs=u||f}else o.pendingDs=u;if(i){const d=o.pendingStructs.update;o.pendingStructs=null,Fs(r.doc,d)}},n,!1),Fs=(e,t,n,s=St)=>{const r=Dt(t);El(r,e,n,new s(r))},$o=(e,t,n)=>Fs(e,t,n,Ms),Cl=(e,t,n=new Map)=>{gn(e,t.store,n),Tt(e,ml(t.store))},Dl=(e,t=new Uint8Array([0]),n=new nt)=>{const s=Vs(t);Cl(n,e,s);const r=[n.toUint8Array()];if(e.store.pendingDs&&r.push(e.store.pendingDs),e.store.pendingStructs&&r.push(Jl(e.store.pendingStructs.update,t)),r.length>1){if(n.constructor===zt)return jl(r.map((i,l)=>l===0?i:Yl(i)));if(n.constructor===nt)return he(r)}return r[0]},vo=(e,t)=>Dl(e,t,new zt),Al=e=>{const t=new Map,n=m(e.restDecoder);for(let s=0;s<n;s++){const r=m(e.restDecoder),i=m(e.restDecoder);t.set(r,i)}return t},Vs=e=>Al(new Rs(Dt(e))),js=(e,t)=>(k(e.restEncoder,t.size),Q(t.entries()).sort((n,s)=>s[0]-n[0]).forEach(([n,s])=>{k(e.restEncoder,n),k(e.restEncoder,s)}),e),Il=(e,t)=>js(e,Ae(t.store)),Tl=(e,t=new vs)=>(e instanceof Map?js(t,e):Il(t,e),t.toUint8Array()),Fo=e=>Tl(e,new $s);class Ol{constructor(){this.l=[]}}const Vn=()=>new Ol,jn=(e,t)=>e.l.push(t),Bn=(e,t)=>{const n=e.l,s=n.length;e.l=n.filter(r=>t!==r),s===e.l.length&&console.error("[yjs] Tried to remove event handler that doesn't exist.")},Bs=(e,t,n)=>rn(e.l,[t,n]);class ft{constructor(t,n){this.client=t,this.clock=n}}const ht=(e,t)=>e===t||e!==null&&t!==null&&e.client===t.client&&e.clock===t.clock,p=(e,t)=>new ft(e,t),Js=e=>{for(const[t,n]of e.doc.share.entries())if(n===e)return t;throw M()},ce=(e,t)=>{for(;t!==null;){if(t.parent===e)return!0;t=t.parent._item}return!1};class Gs{constructor(t,n,s,r=0){this.type=t,this.tname=n,this.item=s,this.assoc=r}}const Vo=e=>{const t={};return e.type&&(t.type=e.type),e.tname&&(t.tname=e.tname),e.item&&(t.item=e.item),e.assoc!=null&&(t.assoc=e.assoc),t},jo=e=>new Gs(e.type==null?null:p(e.type.client,e.type.clock),e.tname??null,e.item==null?null:p(e.item.client,e.item.clock),e.assoc==null?0:e.assoc);class xl{constructor(t,n,s=0){this.type=t,this.index=n,this.assoc=s}}const Ll=(e,t,n=0)=>new xl(e,t,n),Wt=(e,t,n)=>{let s=null,r=null;return e._item===null?r=Js(e):s=p(e._item.id.client,e._item.id.clock),new Gs(s,r,t,n)},Bo=(e,t,n=0)=>{let s=e._start;if(n<0){if(t===0)return Wt(e,null,n);t--}for(;s!==null;){if(!s.deleted&&s.countable){if(s.length>t)return Wt(e,p(s.id.client,s.id.clock+t),n);t-=s.length}if(s.right===null&&n<0)return Wt(e,s.lastId,n);s=s.right}return Wt(e,null,n)},Ul=(e,t)=>{const n=gt(e,t),s=t.clock-n.id.clock;return{item:n,diff:s}},Jo=(e,t,n=!0)=>{const s=t.store,r=e.item,i=e.type,l=e.tname,o=e.assoc;let c=null,a=0;if(r!==null){if(E(s,r.client)<=r.clock)return null;const h=n?qe(s,r):Ul(s,r),u=h.item;if(!(u instanceof _))return null;if(c=u.parent,c._item===null||!c._item.deleted){a=u.deleted||!u.countable?0:h.diff+(o>=0?0:1);let d=u.left;for(;d!==null;)!d.deleted&&d.countable&&(a+=d.length),d=d.left}}else{if(l!==null)c=t.get(l);else if(i!==null){if(E(s,i.client)<=i.clock)return null;const{item:h}=n?qe(s,i):{item:gt(s,i)};if(h instanceof _&&h.content instanceof K)c=h.content.type;else return null}else throw M();o>=0?a=c._length:a=0}return Ll(c,a,e.assoc)},Go=(e,t)=>e===t||e!==null&&t!==null&&e.tname===t.tname&&ht(e.item,t.item)&&ht(e.type,t.type)&&e.assoc===t.assoc,ct=(e,t)=>t===void 0?!e.deleted:t.sv.has(e.id.client)&&(t.sv.get(e.id.client)||0)>e.id.clock&&!Ht(t.ds,e.id),Ke=(e,t)=>{const n=tt(e.meta,Ke,wt),s=e.doc.store;n.has(t)||(t.sv.forEach((r,i)=>{r<E(s,i)&&L(e,p(i,r))}),_t(e,t.ds,r=>{}),n.add(t))};class Ys{constructor(){this.clients=new Map,this.pendingStructs=null,this.pendingDs=null}}const Ae=e=>{const t=new Map;return e.clients.forEach((n,s)=>{const r=n[n.length-1];t.set(s,r.id.clock+r.length)}),t},E=(e,t)=>{const n=e.clients.get(t);if(n===void 0)return 0;const s=n[n.length-1];return s.id.clock+s.length},Hs=(e,t)=>{let n=e.clients.get(t.id.client);if(n===void 0)n=[],e.clients.set(t.id.client,n);else{const s=n[n.length-1];if(s.id.clock+s.length!==t.id.clock)throw M()}n.push(t)},Y=(e,t)=>{let n=0,s=e.length-1,r=e[s],i=r.id.clock;if(i===t)return s;let l=J(t/(i+r.length-1)*s);for(;n<=s;){if(r=e[l],i=r.id.clock,i<=t){if(t<i+r.length)return l;n=l+1}else s=l-1;l=J((n+s)/2)}throw M()},Nl=(e,t)=>{const n=e.clients.get(t.client);return n[Y(n,t.clock)]},gt=Nl,Xe=(e,t,n)=>{const s=Y(t,n),r=t[s];return r.id.clock<n&&r instanceof _?(t.splice(s+1,0,pe(e,r,n-r.id.clock)),s+1):s},L=(e,t)=>{const n=e.doc.store.clients.get(t.client);return n[Xe(e,n,t.clock)]},Jn=(e,t,n)=>{const s=t.clients.get(n.client),r=Y(s,n.clock),i=s[r];return n.clock!==i.id.clock+i.length-1&&i.constructor!==$&&s.splice(r+1,0,pe(e,i,n.clock-i.id.clock+1)),i},Rl=(e,t,n)=>{const s=e.clients.get(t.id.client);s[Y(s,t.id.clock)]=n},zs=(e,t,n,s,r)=>{if(s===0)return;const i=n+s;let l=Xe(e,t,n),o;do o=t[l++],i<o.id.clock+o.length&&Xe(e,t,i),r(o);while(l<t.length&&t[l].id.clock<i)};class Ml{constructor(t,n,s){this.doc=t,this.deleteSet=new It,this.beforeState=Ae(t.store),this.afterState=new Map,this.changed=new Map,this.changedParentTypes=new Map,this._mergeStructs=[],this.origin=n,this.meta=new Map,this.local=s,this.subdocsAdded=new Set,this.subdocsRemoved=new Set,this.subdocsLoaded=new Set,this._needFormattingCleanup=!1}}const Gn=(e,t)=>t.deleteSet.clients.size===0&&!wr(t.afterState,(n,s)=>t.beforeState.get(s)!==n)?!1:(dn(t.deleteSet),bl(e,t),Tt(e,t.deleteSet),!0),Yn=(e,t,n)=>{const s=t._item;(s===null||s.id.clock<(e.beforeState.get(s.id.client)||0)&&!s.deleted)&&tt(e.changed,t,wt).add(n)},ne=(e,t)=>{let n=e[t],s=e[t-1],r=t;for(;r>0;n=s,s=e[--r-1]){if(s.deleted===n.deleted&&s.constructor===n.constructor&&s.mergeWith(n)){n instanceof _&&n.parentSub!==null&&n.parent._map.get(n.parentSub)===n&&n.parent._map.set(n.parentSub,s);continue}break}const i=t-r;return i&&e.splice(t+1-i,i),i},$l=(e,t,n)=>{for(const[s,r]of e.clients.entries()){const i=t.clients.get(s);for(let l=r.length-1;l>=0;l--){const o=r[l],c=o.clock+o.len;for(let a=Y(i,o.clock),h=i[a];a<i.length&&h.id.clock<c;h=i[++a]){const u=i[a];if(o.clock+o.len<=u.id.clock)break;u instanceof _&&u.deleted&&!u.keep&&n(u)&&u.gc(t,!1)}}}},vl=(e,t)=>{e.clients.forEach((n,s)=>{const r=t.clients.get(s);for(let i=n.length-1;i>=0;i--){const l=n[i],o=Qn(r.length-1,1+Y(r,l.clock+l.len-1));for(let c=o,a=r[c];c>0&&a.id.clock>=l.clock;a=r[c])c-=1+ne(r,c)}})},Ks=(e,t)=>{if(t<e.length){const n=e[t],s=n.doc,r=s.store,i=n.deleteSet,l=n._mergeStructs;try{dn(i),n.afterState=Ae(n.doc.store),s.emit("beforeObserverCalls",[n,s]);const o=[];n.changed.forEach((c,a)=>o.push(()=>{(a._item===null||!a._item.deleted)&&a._callObserver(n,c)})),o.push(()=>{n.changedParentTypes.forEach((c,a)=>{a._dEH.l.length>0&&(a._item===null||!a._item.deleted)&&(c=c.filter(h=>h.target._item===null||!h.target._item.deleted),c.forEach(h=>{h.currentTarget=a,h._path=null}),c.sort((h,u)=>h.path.length-u.path.length),o.push(()=>{Bs(a._dEH,c,n)}))}),o.push(()=>s.emit("afterTransaction",[n,s])),o.push(()=>{n._needFormattingCleanup&&ro(n)})}),rn(o,[])}finally{s.gc&&$l(i,r,s.gcFilter),vl(i,r),n.afterState.forEach((h,u)=>{const d=n.beforeState.get(u)||0;if(d!==h){const f=r.clients.get(u),g=it(Y(f,d),1);for(let w=f.length-1;w>=g;)w-=1+ne(f,w)}});for(let h=l.length-1;h>=0;h--){const{client:u,clock:d}=l[h].id,f=r.clients.get(u),g=Y(f,d);g+1<f.length&&ne(f,g+1)>1||g>0&&ne(f,g)}if(!n.local&&n.afterState.get(s.clientID)!==n.beforeState.get(s.clientID)&&(fl(un,As,"[yjs] ",Is,Ts,"Changed the client-id because another client seems to be using it."),s.clientID=Ns()),s.emit("afterTransactionCleanup",[n,s]),s._observers.has("update")){const h=new zt;Gn(h,n)&&s.emit("update",[h.toUint8Array(),n.origin,s,n])}if(s._observers.has("updateV2")){const h=new nt;Gn(h,n)&&s.emit("updateV2",[h.toUint8Array(),n.origin,s,n])}const{subdocsAdded:o,subdocsLoaded:c,subdocsRemoved:a}=n;(o.size>0||a.size>0||c.size>0)&&(o.forEach(h=>{h.clientID=s.clientID,h.collectionid==null&&(h.collectionid=s.collectionid),s.subdocs.add(h)}),a.forEach(h=>s.subdocs.delete(h)),s.emit("subdocs",[{loaded:c,added:o,removed:a},s,n]),a.forEach(h=>h.destroy())),e.length<=t+1?(s._transactionCleanups=[],s.emit("afterAllTransactions",[s,e])):Ks(e,t+1)}}},y=(e,t,n=null,s=!0)=>{const r=e._transactionCleanups;let i=!1,l=null;e._transaction===null&&(i=!0,e._transaction=new Ml(e,n,s),r.push(e._transaction),r.length===1&&e.emit("beforeAllTransactions",[e]),e.emit("beforeTransaction",[e._transaction,e]));try{l=t(e._transaction)}finally{if(i){const o=e._transaction===r[0];e._transaction=null,o&&Ks(r,0)}}return l};class Fl{constructor(t,n){this.insertions=n,this.deletions=t,this.meta=new Map}}const Hn=(e,t,n)=>{_t(e,n.deletions,s=>{s instanceof _&&t.scope.some(r=>r===e.doc||ce(r,s))&&bn(s,!1)})},zn=(e,t,n)=>{let s=null;const r=e.doc,i=e.scope;y(r,o=>{for(;t.length>0&&e.currStackItem===null;){const c=r.store,a=t.pop(),h=new Set,u=[];let d=!1;_t(o,a.insertions,f=>{if(f instanceof _){if(f.redone!==null){let{item:g,diff:w}=qe(c,f.id);w>0&&(g=L(o,p(g.id.client,g.id.clock+w))),f=g}!f.deleted&&i.some(g=>g===o.doc||ce(g,f))&&u.push(f)}}),_t(o,a.deletions,f=>{f instanceof _&&i.some(g=>g===o.doc||ce(g,f))&&!Ht(a.insertions,f.id)&&h.add(f)}),h.forEach(f=>{d=ur(o,f,h,a.insertions,e.ignoreRemoteMapChanges,e)!==null||d});for(let f=u.length-1;f>=0;f--){const g=u[f];e.deleteFilter(g)&&(g.delete(o),d=!0)}e.currStackItem=d?a:null}o.changed.forEach((c,a)=>{c.has(null)&&a._searchMarker&&(a._searchMarker.length=0)}),s=o},e);const l=e.currStackItem;if(l!=null){const o=s.changedParentTypes;e.emit("stack-item-popped",[{stackItem:l,type:n,changedParentTypes:o,origin:e},e]),e.currStackItem=null}return l};class Yo extends Zn{constructor(t,{captureTimeout:n=500,captureTransaction:s=c=>!0,deleteFilter:r=()=>!0,trackedOrigins:i=new Set([null]),ignoreRemoteMapChanges:l=!1,doc:o=mt(t)?t[0].doc:t instanceof Ot?t:t.doc}={}){super(),this.scope=[],this.doc=o,this.addToScope(t),this.deleteFilter=r,i.add(this),this.trackedOrigins=i,this.captureTransaction=s,this.undoStack=[],this.redoStack=[],this.undoing=!1,this.redoing=!1,this.currStackItem=null,this.lastChange=0,this.ignoreRemoteMapChanges=l,this.captureTimeout=n,this.afterTransactionHandler=c=>{if(!this.captureTransaction(c)||!this.scope.some(S=>c.changedParentTypes.has(S)||S===this.doc)||!this.trackedOrigins.has(c.origin)&&(!c.origin||!this.trackedOrigins.has(c.origin.constructor)))return;const a=this.undoing,h=this.redoing,u=a?this.redoStack:this.undoStack;a?this.stopCapturing():h||this.clear(!1,!0);const d=new It;c.afterState.forEach((S,b)=>{const En=c.beforeState.get(b)||0,Cn=S-En;Cn>0&&Vt(d,b,En,Cn)});const f=Zr();let g=!1;if(this.lastChange>0&&f-this.lastChange<this.captureTimeout&&u.length>0&&!a&&!h){const S=u[u.length-1];S.deletions=ze([S.deletions,c.deleteSet]),S.insertions=ze([S.insertions,d])}else u.push(new Fl(c.deleteSet,d)),g=!0;!a&&!h&&(this.lastChange=f),_t(c,c.deleteSet,S=>{S instanceof _&&this.scope.some(b=>b===c.doc||ce(b,S))&&bn(S,!0)});const w=[{stackItem:u[u.length-1],origin:c.origin,type:a?"redo":"undo",changedParentTypes:c.changedParentTypes},this];g?this.emit("stack-item-added",w):this.emit("stack-item-updated",w)},this.doc.on("afterTransaction",this.afterTransactionHandler),this.doc.on("destroy",()=>{this.destroy()})}addToScope(t){const n=new Set(this.scope);t=mt(t)?t:[t],t.forEach(s=>{n.has(s)||(n.add(s),(s instanceof I?s.doc!==this.doc:s!==this.doc)&&xs("[yjs#509] Not same Y.Doc"),this.scope.push(s))})}addTrackedOrigin(t){this.trackedOrigins.add(t)}removeTrackedOrigin(t){this.trackedOrigins.delete(t)}clear(t=!0,n=!0){(t&&this.canUndo()||n&&this.canRedo())&&this.doc.transact(s=>{t&&(this.undoStack.forEach(r=>Hn(s,this,r)),this.undoStack=[]),n&&(this.redoStack.forEach(r=>Hn(s,this,r)),this.redoStack=[]),this.emit("stack-cleared",[{undoStackCleared:t,redoStackCleared:n}])})}stopCapturing(){this.lastChange=0}undo(){this.undoing=!0;let t;try{t=zn(this,this.undoStack,"undo")}finally{this.undoing=!1}return t}redo(){this.redoing=!0;let t;try{t=zn(this,this.redoStack,"redo")}finally{this.redoing=!1}return t}canUndo(){return this.undoStack.length>0}canRedo(){return this.redoStack.length>0}destroy(){this.trackedOrigins.delete(this),this.doc.off("afterTransaction",this.afterTransactionHandler),super.destroy()}}function*Vl(e){const t=m(e.restDecoder);for(let n=0;n<t;n++){const s=m(e.restDecoder),r=e.readClient();let i=m(e.restDecoder);for(let l=0;l<s;l++){const o=e.readInfo();if(o===10){const c=m(e.restDecoder);yield new v(p(r,i),c),i+=c}else if((we&o)!==0){const c=(o&(W|R))===0,a=new _(p(r,i),null,(o&R)===R?e.readLeftID():null,null,(o&W)===W?e.readRightID():null,c?e.readParentInfo()?e.readString():e.readLeftID():null,c&&(o&Ut)===Ut?e.readString():null,dr(e,o));yield a,i+=a.length}else{const c=e.readLen();yield new $(p(r,i),c),i+=c}}}}class pn{constructor(t,n){this.gen=Vl(t),this.curr=null,this.done=!1,this.filterSkips=n,this.next()}next(){do this.curr=this.gen.next().value||null;while(this.filterSkips&&this.curr!==null&&this.curr.constructor===v);return this.curr}}class wn{constructor(t){this.currClient=0,this.startClock=0,this.written=0,this.encoder=t,this.clientStructs=[]}}const jl=e=>he(e,Ms,zt),Bl=(e,t)=>{if(e.constructor===$){const{client:n,clock:s}=e.id;return new $(p(n,s+t),e.length-t)}else if(e.constructor===v){const{client:n,clock:s}=e.id;return new v(p(n,s+t),e.length-t)}else{const n=e,{client:s,clock:r}=n.id;return new _(p(s,r+t),null,p(s,r+t-1),null,n.rightOrigin,n.parent,n.parentSub,n.content.splice(t))}},he=(e,t=St,n=nt)=>{if(e.length===1)return e[0];const s=e.map(h=>new t(Dt(h)));let r=s.map(h=>new pn(h,!0)),i=null;const l=new n,o=new wn(l);for(;r=r.filter(d=>d.curr!==null),r.sort((d,f)=>{if(d.curr.id.client===f.curr.id.client){const g=d.curr.id.clock-f.curr.id.clock;return g===0?d.curr.constructor===f.curr.constructor?0:d.curr.constructor===v?1:-1:g}else return f.curr.id.client-d.curr.id.client}),r.length!==0;){const h=r[0],u=h.curr.id.client;if(i!==null){let d=h.curr,f=!1;for(;d!==null&&d.id.clock+d.length<=i.struct.id.clock+i.struct.length&&d.id.client>=i.struct.id.client;)d=h.next(),f=!0;if(d===null||d.id.client!==u||f&&d.id.clock>i.struct.id.clock+i.struct.length)continue;if(u!==i.struct.id.client)P(o,i.struct,i.offset),i={struct:d,offset:0},h.next();else if(i.struct.id.clock+i.struct.length<d.id.clock)if(i.struct.constructor===v)i.struct.length=d.id.clock+d.length-i.struct.id.clock;else{P(o,i.struct,i.offset);const g=d.id.clock-i.struct.id.clock-i.struct.length;i={struct:new v(p(u,i.struct.id.clock+i.struct.length),g),offset:0}}else{const g=i.struct.id.clock+i.struct.length-d.id.clock;g>0&&(i.struct.constructor===v?i.struct.length-=g:d=Bl(d,g)),i.struct.mergeWith(d)||(P(o,i.struct,i.offset),i={struct:d,offset:0},h.next())}}else i={struct:h.curr,offset:0},h.next();for(let d=h.curr;d!==null&&d.id.client===u&&d.id.clock===i.struct.id.clock+i.struct.length&&d.constructor!==v;d=h.next())P(o,i.struct,i.offset),i={struct:d,offset:0}}i!==null&&(P(o,i.struct,i.offset),i=null),mn(o);const c=s.map(h=>fn(h)),a=ze(c);return Tt(l,a),l.toUint8Array()},Jl=(e,t,n=St,s=nt)=>{const r=Vs(t),i=new s,l=new wn(i),o=new n(Dt(e)),c=new pn(o,!1);for(;c.curr;){const h=c.curr,u=h.id.client,d=r.get(u)||0;if(c.curr.constructor===v){c.next();continue}if(h.id.clock+h.length>d)for(P(l,h,it(d-h.id.clock,0)),c.next();c.curr&&c.curr.id.client===u;)P(l,c.curr,0),c.next();else for(;c.curr&&c.curr.id.client===u&&c.curr.id.clock+c.curr.length<=d;)c.next()}mn(l);const a=fn(o);return Tt(i,a),i.toUint8Array()},Xs=e=>{e.written>0&&(e.clientStructs.push({written:e.written,restEncoder:B(e.encoder.restEncoder)}),e.encoder.restEncoder=me(),e.written=0)},P=(e,t,n)=>{e.written>0&&e.currClient!==t.id.client&&Xs(e),e.written===0&&(e.currClient=t.id.client,e.encoder.writeClient(t.id.client),k(e.encoder.restEncoder,t.id.clock+n)),t.write(e.encoder,n),e.written++},mn=e=>{Xs(e);const t=e.encoder.restEncoder;k(t,e.clientStructs.length);for(let n=0;n<e.clientStructs.length;n++){const s=e.clientStructs[n];k(t,s.written),ke(t,s.restEncoder)}},Gl=(e,t,n,s)=>{const r=new n(Dt(e)),i=new pn(r,!1),l=new s,o=new wn(l);for(let a=i.curr;a!==null;a=i.next())P(o,t(a),0);mn(o);const c=fn(r);return Tt(l,c),l.toUint8Array()},Yl=e=>Gl(e,hi,St,zt),Kn="You must not compute changes after the event-handler fired.";class Ie{constructor(t,n){this.target=t,this.currentTarget=t,this.transaction=n,this._changes=null,this._keys=null,this._delta=null,this._path=null}get path(){return this._path||(this._path=Hl(this.currentTarget,this.target))}deletes(t){return Ht(this.transaction.deleteSet,t.id)}get keys(){if(this._keys===null){if(this.transaction.doc._transactionCleanups.length===0)throw G(Kn);const t=new Map,n=this.target;this.transaction.changed.get(n).forEach(r=>{if(r!==null){const i=n._map.get(r);let l,o;if(this.adds(i)){let c=i.left;for(;c!==null&&this.adds(c);)c=c.left;if(this.deletes(i))if(c!==null&&this.deletes(c))l="delete",o=xe(c.content.getContent());else return;else c!==null&&this.deletes(c)?(l="update",o=xe(c.content.getContent())):(l="add",o=void 0)}else if(this.deletes(i))l="delete",o=xe(i.content.getContent());else return;t.set(r,{action:l,oldValue:o})}}),this._keys=t}return this._keys}get delta(){return this.changes.delta}adds(t){return t.id.clock>=(this.transaction.beforeState.get(t.id.client)||0)}get changes(){let t=this._changes;if(t===null){if(this.transaction.doc._transactionCleanups.length===0)throw G(Kn);const n=this.target,s=wt(),r=wt(),i=[];if(t={added:s,deleted:r,delta:i,keys:this.keys},this.transaction.changed.get(n).has(null)){let o=null;const c=()=>{o&&i.push(o)};for(let a=n._start;a!==null;a=a.right)a.deleted?this.deletes(a)&&!this.adds(a)&&((o===null||o.delete===void 0)&&(c(),o={delete:0}),o.delete+=a.length,r.add(a)):this.adds(a)?((o===null||o.insert===void 0)&&(c(),o={insert:[]}),o.insert=o.insert.concat(a.content.getContent()),s.add(a)):((o===null||o.retain===void 0)&&(c(),o={retain:0}),o.retain+=a.length);o!==null&&o.retain===void 0&&c()}this._changes=t}return t}}const Hl=(e,t)=>{const n=[];for(;t._item!==null&&t!==e;){if(t._item.parentSub!==null)n.unshift(t._item.parentSub);else{let s=0,r=t._item.parent._start;for(;r!==t._item&&r!==null;)!r.deleted&&r.countable&&(s+=r.length),r=r.right;n.unshift(s)}t=t._item.parent}return n},O=()=>{xs("Invalid access: Add Yjs type to a document before reading data.")},Ws=80;let kn=0;class zl{constructor(t,n){t.marker=!0,this.p=t,this.index=n,this.timestamp=kn++}}const Kl=e=>{e.timestamp=kn++},qs=(e,t,n)=>{e.p.marker=!1,e.p=t,t.marker=!0,e.index=n,e.timestamp=kn++},Xl=(e,t,n)=>{if(e.length>=Ws){const s=e.reduce((r,i)=>r.timestamp<i.timestamp?r:i);return qs(s,t,n),s}else{const s=new zl(t,n);return e.push(s),s}},Te=(e,t)=>{if(e._start===null||t===0||e._searchMarker===null)return null;const n=e._searchMarker.length===0?null:e._searchMarker.reduce((i,l)=>Zt(t-i.index)<Zt(t-l.index)?i:l);let s=e._start,r=0;for(n!==null&&(s=n.p,r=n.index,Kl(n));s.right!==null&&r<t;){if(!s.deleted&&s.countable){if(t<r+s.length)break;r+=s.length}s=s.right}for(;s.left!==null&&r>t;)s=s.left,!s.deleted&&s.countable&&(r-=s.length);for(;s.left!==null&&s.left.id.client===s.id.client&&s.left.id.clock+s.left.length===s.id.clock;)s=s.left,!s.deleted&&s.countable&&(r-=s.length);return n!==null&&Zt(n.index-r)<s.parent.length/Ws?(qs(n,s,r),n):Xl(e._searchMarker,s,r)},jt=(e,t,n)=>{for(let s=e.length-1;s>=0;s--){const r=e[s];if(n>0){let i=r.p;for(i.marker=!1;i&&(i.deleted||!i.countable);)i=i.left,i&&!i.deleted&&i.countable&&(r.index-=i.length);if(i===null||i.marker===!0){e.splice(s,1);continue}r.p=i,i.marker=!0}(t<r.index||n>0&&t===r.index)&&(r.index=it(t,r.index+n))}},Oe=(e,t,n)=>{const s=e,r=t.changedParentTypes;for(;tt(r,e,()=>[]).push(n),e._item!==null;)e=e._item.parent;Bs(s._eH,n,t)};class I{constructor(){this._item=null,this._map=new Map,this._start=null,this.doc=null,this._length=0,this._eH=Vn(),this._dEH=Vn(),this._searchMarker=null}get parent(){return this._item?this._item.parent:null}_integrate(t,n){this.doc=t,this._item=n}_copy(){throw V()}clone(){throw V()}_write(t){}get _first(){let t=this._start;for(;t!==null&&t.deleted;)t=t.right;return t}_callObserver(t,n){!t.local&&this._searchMarker&&(this._searchMarker.length=0)}observe(t){jn(this._eH,t)}observeDeep(t){jn(this._dEH,t)}unobserve(t){Bn(this._eH,t)}unobserveDeep(t){Bn(this._dEH,t)}toJSON(){}}const Ps=(e,t,n)=>{e.doc??O(),t<0&&(t=e._length+t),n<0&&(n=e._length+n);let s=n-t;const r=[];let i=e._start;for(;i!==null&&s>0;){if(i.countable&&!i.deleted){const l=i.content.getContent();if(l.length<=t)t-=l.length;else{for(let o=t;o<l.length&&s>0;o++)r.push(l[o]),s--;t=0}}i=i.right}return r},Zs=e=>{e.doc??O();const t=[];let n=e._start;for(;n!==null;){if(n.countable&&!n.deleted){const s=n.content.getContent();for(let r=0;r<s.length;r++)t.push(s[r])}n=n.right}return t},Bt=(e,t)=>{let n=0,s=e._start;for(e.doc??O();s!==null;){if(s.countable&&!s.deleted){const r=s.content.getContent();for(let i=0;i<r.length;i++)t(r[i],n++,e)}s=s.right}},Qs=(e,t)=>{const n=[];return Bt(e,(s,r)=>{n.push(t(s,r,e))}),n},Wl=e=>{let t=e._start,n=null,s=0;return{[Symbol.iterator](){return this},next:()=>{if(n===null){for(;t!==null&&t.deleted;)t=t.right;if(t===null)return{done:!0,value:void 0};n=t.content.getContent(),s=0,t=t.right}const r=n[s++];return n.length<=s&&(n=null),{done:!1,value:r}}}},tr=(e,t)=>{e.doc??O();const n=Te(e,t);let s=e._start;for(n!==null&&(s=n.p,t-=n.index);s!==null;s=s.right)if(!s.deleted&&s.countable){if(t<s.length)return s.content.getContent()[t];t-=s.length}},ae=(e,t,n,s)=>{let r=n;const i=e.doc,l=i.clientID,o=i.store,c=n===null?t._start:n.right;let a=[];const h=()=>{a.length>0&&(r=new _(p(l,E(o,l)),r,r&&r.lastId,c,c&&c.id,t,null,new rt(a)),r.integrate(e,0),a=[])};s.forEach(u=>{if(u===null)a.push(u);else switch(u.constructor){case Number:case Object:case Boolean:case Array:case String:a.push(u);break;default:switch(h(),u.constructor){case Uint8Array:case ArrayBuffer:r=new _(p(l,E(o,l)),r,r&&r.lastId,c,c&&c.id,t,null,new Kt(new Uint8Array(u))),r.integrate(e,0);break;case Ot:r=new _(p(l,E(o,l)),r,r&&r.lastId,c,c&&c.id,t,null,new Xt(u)),r.integrate(e,0);break;default:if(u instanceof I)r=new _(p(l,E(o,l)),r,r&&r.lastId,c,c&&c.id,t,null,new K(u)),r.integrate(e,0);else throw new Error("Unexpected content type in insert operation")}}}),h()},er=()=>G("Length exceeded!"),nr=(e,t,n,s)=>{if(n>t._length)throw er();if(n===0)return t._searchMarker&&jt(t._searchMarker,n,s.length),ae(e,t,null,s);const r=n,i=Te(t,n);let l=t._start;for(i!==null&&(l=i.p,n-=i.index,n===0&&(l=l.prev,n+=l&&l.countable&&!l.deleted?l.length:0));l!==null;l=l.right)if(!l.deleted&&l.countable){if(n<=l.length){n<l.length&&L(e,p(l.id.client,l.id.clock+n));break}n-=l.length}return t._searchMarker&&jt(t._searchMarker,r,s.length),ae(e,t,l,s)},ql=(e,t,n)=>{let r=(t._searchMarker||[]).reduce((i,l)=>l.index>i.index?l:i,{index:0,p:t._start}).p;if(r)for(;r.right;)r=r.right;return ae(e,t,r,n)},sr=(e,t,n,s)=>{if(s===0)return;const r=n,i=s,l=Te(t,n);let o=t._start;for(l!==null&&(o=l.p,n-=l.index);o!==null&&n>0;o=o.right)!o.deleted&&o.countable&&(n<o.length&&L(e,p(o.id.client,o.id.clock+n)),n-=o.length);for(;s>0&&o!==null;)o.deleted||(s<o.length&&L(e,p(o.id.client,o.id.clock+s)),o.delete(e),s-=o.length),o=o.right;if(s>0)throw er();t._searchMarker&&jt(t._searchMarker,r,-i+s)},ue=(e,t,n)=>{const s=t._map.get(n);s!==void 0&&s.delete(e)},yn=(e,t,n,s)=>{const r=t._map.get(n)||null,i=e.doc,l=i.clientID;let o;if(s==null)o=new rt([s]);else switch(s.constructor){case Number:case Object:case Boolean:case Array:case String:case Date:case BigInt:o=new rt([s]);break;case Uint8Array:o=new Kt(s);break;case Ot:o=new Xt(s);break;default:if(s instanceof I)o=new K(s);else throw new Error("Unexpected content type")}new _(p(l,E(i.store,l)),r,r&&r.lastId,null,null,t,n,o).integrate(e,0)},_n=(e,t)=>{e.doc??O();const n=e._map.get(t);return n!==void 0&&!n.deleted?n.content.getContent()[n.length-1]:void 0},rr=e=>{const t={};return e.doc??O(),e._map.forEach((n,s)=>{n.deleted||(t[s]=n.content.getContent()[n.length-1])}),t},ir=(e,t)=>{e.doc??O();const n=e._map.get(t);return n!==void 0&&!n.deleted},Pl=(e,t)=>{const n={};return e._map.forEach((s,r)=>{let i=s;for(;i!==null&&(!t.sv.has(i.id.client)||i.id.clock>=(t.sv.get(i.id.client)||0));)i=i.left;i!==null&&ct(i,t)&&(n[r]=i.content.getContent()[i.length-1])}),n},qt=e=>(e.doc??O(),gl(e._map.entries(),t=>!t[1].deleted));class Zl extends Ie{}class pt extends I{constructor(){super(),this._prelimContent=[],this._searchMarker=[]}static from(t){const n=new pt;return n.push(t),n}_integrate(t,n){super._integrate(t,n),this.insert(0,this._prelimContent),this._prelimContent=null}_copy(){return new pt}clone(){const t=new pt;return t.insert(0,this.toArray().map(n=>n instanceof I?n.clone():n)),t}get length(){return this.doc??O(),this._length}_callObserver(t,n){super._callObserver(t,n),Oe(this,t,new Zl(this,t))}insert(t,n){this.doc!==null?y(this.doc,s=>{nr(s,this,t,n)}):this._prelimContent.splice(t,0,...n)}push(t){this.doc!==null?y(this.doc,n=>{ql(n,this,t)}):this._prelimContent.push(...t)}unshift(t){this.insert(0,t)}delete(t,n=1){this.doc!==null?y(this.doc,s=>{sr(s,this,t,n)}):this._prelimContent.splice(t,n)}get(t){return tr(this,t)}toArray(){return Zs(this)}slice(t=0,n=this.length){return Ps(this,t,n)}toJSON(){return this.map(t=>t instanceof I?t.toJSON():t)}map(t){return Qs(this,t)}forEach(t){Bt(this,t)}[Symbol.iterator](){return Wl(this)}_write(t){t.writeTypeRef(Co)}}const Ql=e=>new pt;class to extends Ie{constructor(t,n,s){super(t,n),this.keysChanged=s}}class bt extends I{constructor(t){super(),this._prelimContent=null,t===void 0?this._prelimContent=new Map:this._prelimContent=new Map(t)}_integrate(t,n){super._integrate(t,n),this._prelimContent.forEach((s,r)=>{this.set(r,s)}),this._prelimContent=null}_copy(){return new bt}clone(){const t=new bt;return this.forEach((n,s)=>{t.set(s,n instanceof I?n.clone():n)}),t}_callObserver(t,n){Oe(this,t,new to(this,t,n))}toJSON(){this.doc??O();const t={};return this._map.forEach((n,s)=>{if(!n.deleted){const r=n.content.getContent()[n.length-1];t[s]=r instanceof I?r.toJSON():r}}),t}get size(){return[...qt(this)].length}keys(){return ve(qt(this),t=>t[0])}values(){return ve(qt(this),t=>t[1].content.getContent()[t[1].length-1])}entries(){return ve(qt(this),t=>[t[0],t[1].content.getContent()[t[1].length-1]])}forEach(t){this.doc??O(),this._map.forEach((n,s)=>{n.deleted||t(n.content.getContent()[n.length-1],s,this)})}[Symbol.iterator](){return this.entries()}delete(t){this.doc!==null?y(this.doc,n=>{ue(n,this,t)}):this._prelimContent.delete(t)}set(t,n){return this.doc!==null?y(this.doc,s=>{yn(s,this,t,n)}):this._prelimContent.set(t,n),n}get(t){return _n(this,t)}has(t){return ir(this,t)}clear(){this.doc!==null?y(this.doc,t=>{this.forEach(function(n,s,r){ue(t,r,s)})}):this._prelimContent.clear()}_write(t){t.writeTypeRef(Do)}}const eo=e=>new bt,Z=(e,t)=>e===t||typeof e=="object"&&typeof t=="object"&&e&&t&&oi(e,t);class We{constructor(t,n,s,r){this.left=t,this.right=n,this.index=s,this.currentAttributes=r}forward(){this.right===null&&M(),this.right.content.constructor===D?this.right.deleted||xt(this.currentAttributes,this.right.content):this.right.deleted||(this.index+=this.right.length),this.left=this.right,this.right=this.right.right}}const Xn=(e,t,n)=>{for(;t.right!==null&&n>0;)t.right.content.constructor===D?t.right.deleted||xt(t.currentAttributes,t.right.content):t.right.deleted||(n<t.right.length&&L(e,p(t.right.id.client,t.right.id.clock+n)),t.index+=t.right.length,n-=t.right.length),t.left=t.right,t.right=t.right.right;return t},Pt=(e,t,n,s)=>{const r=new Map,i=s?Te(t,n):null;if(i){const l=new We(i.p.left,i.p,i.index,r);return Xn(e,l,n-i.index)}else{const l=new We(null,t._start,0,r);return Xn(e,l,n)}},lr=(e,t,n,s)=>{for(;n.right!==null&&(n.right.deleted===!0||n.right.content.constructor===D&&Z(s.get(n.right.content.key),n.right.content.value));)n.right.deleted||s.delete(n.right.content.key),n.forward();const r=e.doc,i=r.clientID;s.forEach((l,o)=>{const c=n.left,a=n.right,h=new _(p(i,E(r.store,i)),c,c&&c.lastId,a,a&&a.id,t,null,new D(o,l));h.integrate(e,0),n.right=h,n.forward()})},xt=(e,t)=>{const{key:n,value:s}=t;s===null?e.delete(n):e.set(n,s)},or=(e,t)=>{for(;e.right!==null;){if(!(e.right.deleted||e.right.content.constructor===D&&Z(t[e.right.content.key]??null,e.right.content.value)))break;e.forward()}},cr=(e,t,n,s)=>{const r=e.doc,i=r.clientID,l=new Map;for(const o in s){const c=s[o],a=n.currentAttributes.get(o)??null;if(!Z(a,c)){l.set(o,a);const{left:h,right:u}=n;n.right=new _(p(i,E(r.store,i)),h,h&&h.lastId,u,u&&u.id,t,null,new D(o,c)),n.right.integrate(e,0),n.forward()}}return l},Fe=(e,t,n,s,r)=>{n.currentAttributes.forEach((d,f)=>{r[f]===void 0&&(r[f]=null)});const i=e.doc,l=i.clientID;or(n,r);const o=cr(e,t,n,r),c=s.constructor===String?new H(s):s instanceof I?new K(s):new lt(s);let{left:a,right:h,index:u}=n;t._searchMarker&&jt(t._searchMarker,n.index,c.getLength()),h=new _(p(l,E(i.store,l)),a,a&&a.lastId,h,h&&h.id,t,null,c),h.integrate(e,0),n.right=h,n.index=u,n.forward(),lr(e,t,n,o)},Wn=(e,t,n,s,r)=>{const i=e.doc,l=i.clientID;or(n,r);const o=cr(e,t,n,r);t:for(;n.right!==null&&(s>0||o.size>0&&(n.right.deleted||n.right.content.constructor===D));){if(!n.right.deleted)switch(n.right.content.constructor){case D:{const{key:c,value:a}=n.right.content,h=r[c];if(h!==void 0){if(Z(h,a))o.delete(c);else{if(s===0)break t;o.set(c,a)}n.right.delete(e)}else n.currentAttributes.set(c,a);break}default:s<n.right.length&&L(e,p(n.right.id.client,n.right.id.clock+s)),s-=n.right.length;break}n.forward()}if(s>0){let c="";for(;s>0;s--)c+=`
|
|
4
|
+
`;n.right=new _(p(l,E(i.store,l)),n.left,n.left&&n.left.lastId,n.right,n.right&&n.right.id,t,null,new H(c)),n.right.integrate(e,0),n.forward()}lr(e,t,n,o)},hr=(e,t,n,s,r)=>{let i=t;const l=F();for(;i&&(!i.countable||i.deleted);){if(!i.deleted&&i.content.constructor===D){const a=i.content;l.set(a.key,a)}i=i.right}let o=0,c=!1;for(;t!==i;){if(n===t&&(c=!0),!t.deleted){const a=t.content;if(a.constructor===D){const{key:h,value:u}=a,d=s.get(h)??null;(l.get(h)!==a||d===u)&&(t.delete(e),o++,!c&&(r.get(h)??null)===u&&d!==u&&(d===null?r.delete(h):r.set(h,d))),!c&&!t.deleted&&xt(r,a)}}t=t.right}return o},no=(e,t)=>{for(;t&&t.right&&(t.right.deleted||!t.right.countable);)t=t.right;const n=new Set;for(;t&&(t.deleted||!t.countable);){if(!t.deleted&&t.content.constructor===D){const s=t.content.key;n.has(s)?t.delete(e):n.add(s)}t=t.left}},so=e=>{let t=0;return y(e.doc,n=>{let s=e._start,r=e._start,i=F();const l=je(i);for(;r;)r.deleted===!1&&(r.content.constructor===D?xt(l,r.content):(t+=hr(n,s,r,i,l),i=je(l),s=r)),r=r.right}),t},ro=e=>{const t=new Set,n=e.doc;for(const[s,r]of e.afterState.entries()){const i=e.beforeState.get(s)||0;r!==i&&zs(e,n.store.clients.get(s),i,r,l=>{!l.deleted&&l.content.constructor===D&&l.constructor!==$&&t.add(l.parent)})}y(n,s=>{_t(e,e.deleteSet,r=>{if(r instanceof $||!r.parent._hasFormatting||t.has(r.parent))return;const i=r.parent;r.content.constructor===D?t.add(i):no(s,r)});for(const r of t)so(r)})},qn=(e,t,n)=>{const s=n,r=je(t.currentAttributes),i=t.right;for(;n>0&&t.right!==null;){if(t.right.deleted===!1)switch(t.right.content.constructor){case K:case lt:case H:n<t.right.length&&L(e,p(t.right.id.client,t.right.id.clock+n)),n-=t.right.length,t.right.delete(e);break}t.forward()}i&&hr(e,i,t.right,r,t.currentAttributes);const l=(t.left||t.right).parent;return l._searchMarker&&jt(l._searchMarker,t.index,-s+n),t};class io extends Ie{constructor(t,n,s){super(t,n),this.childListChanged=!1,this.keysChanged=new Set,s.forEach(r=>{r===null?this.childListChanged=!0:this.keysChanged.add(r)})}get changes(){if(this._changes===null){const t={keys:this.keys,delta:this.delta,added:new Set,deleted:new Set};this._changes=t}return this._changes}get delta(){if(this._delta===null){const t=this.target.doc,n=[];y(t,s=>{const r=new Map,i=new Map;let l=this.target._start,o=null;const c={};let a="",h=0,u=0;const d=()=>{if(o!==null){let f=null;switch(o){case"delete":u>0&&(f={delete:u}),u=0;break;case"insert":(typeof a=="object"||a.length>0)&&(f={insert:a},r.size>0&&(f.attributes={},r.forEach((g,w)=>{g!==null&&(f.attributes[w]=g)}))),a="";break;case"retain":h>0&&(f={retain:h},li(c)||(f.attributes=si({},c))),h=0;break}f&&n.push(f),o=null}};for(;l!==null;){switch(l.content.constructor){case K:case lt:this.adds(l)?this.deletes(l)||(d(),o="insert",a=l.content.getContent()[0],d()):this.deletes(l)?(o!=="delete"&&(d(),o="delete"),u+=1):l.deleted||(o!=="retain"&&(d(),o="retain"),h+=1);break;case H:this.adds(l)?this.deletes(l)||(o!=="insert"&&(d(),o="insert"),a+=l.content.str):this.deletes(l)?(o!=="delete"&&(d(),o="delete"),u+=l.length):l.deleted||(o!=="retain"&&(d(),o="retain"),h+=l.length);break;case D:{const{key:f,value:g}=l.content;if(this.adds(l)){if(!this.deletes(l)){const w=r.get(f)??null;Z(w,g)?g!==null&&l.delete(s):(o==="retain"&&d(),Z(g,i.get(f)??null)?delete c[f]:c[f]=g)}}else if(this.deletes(l)){i.set(f,g);const w=r.get(f)??null;Z(w,g)||(o==="retain"&&d(),c[f]=w)}else if(!l.deleted){i.set(f,g);const w=c[f];w!==void 0&&(Z(w,g)?w!==null&&l.delete(s):(o==="retain"&&d(),g===null?delete c[f]:c[f]=g))}l.deleted||(o==="insert"&&d(),xt(r,l.content));break}}l=l.right}for(d();n.length>0;){const f=n[n.length-1];if(f.retain!==void 0&&f.attributes===void 0)n.pop();else break}}),this._delta=n}return this._delta}}class Et extends I{constructor(t){super(),this._pending=t!==void 0?[()=>this.insert(0,t)]:[],this._searchMarker=[],this._hasFormatting=!1}get length(){return this.doc??O(),this._length}_integrate(t,n){super._integrate(t,n);try{this._pending.forEach(s=>s())}catch(s){console.error(s)}this._pending=null}_copy(){return new Et}clone(){const t=new Et;return t.applyDelta(this.toDelta()),t}_callObserver(t,n){super._callObserver(t,n);const s=new io(this,t,n);Oe(this,t,s),!t.local&&this._hasFormatting&&(t._needFormattingCleanup=!0)}toString(){this.doc??O();let t="",n=this._start;for(;n!==null;)!n.deleted&&n.countable&&n.content.constructor===H&&(t+=n.content.str),n=n.right;return t}toJSON(){return this.toString()}applyDelta(t,{sanitize:n=!0}={}){this.doc!==null?y(this.doc,s=>{const r=new We(null,this._start,0,new Map);for(let i=0;i<t.length;i++){const l=t[i];if(l.insert!==void 0){const o=!n&&typeof l.insert=="string"&&i===t.length-1&&r.right===null&&l.insert.slice(-1)===`
|
|
5
|
+
`?l.insert.slice(0,-1):l.insert;(typeof o!="string"||o.length>0)&&Fe(s,this,r,o,l.attributes||{})}else l.retain!==void 0?Wn(s,this,r,l.retain,l.attributes||{}):l.delete!==void 0&&qn(s,r,l.delete)}}):this._pending.push(()=>this.applyDelta(t))}toDelta(t,n,s){this.doc??O();const r=[],i=new Map,l=this.doc;let o="",c=this._start;function a(){if(o.length>0){const u={};let d=!1;i.forEach((g,w)=>{d=!0,u[w]=g});const f={insert:o};d&&(f.attributes=u),r.push(f),o=""}}const h=()=>{for(;c!==null;){if(ct(c,t)||n!==void 0&&ct(c,n))switch(c.content.constructor){case H:{const u=i.get("ychange");t!==void 0&&!ct(c,t)?(u===void 0||u.user!==c.id.client||u.type!=="removed")&&(a(),i.set("ychange",s?s("removed",c.id):{type:"removed"})):n!==void 0&&!ct(c,n)?(u===void 0||u.user!==c.id.client||u.type!=="added")&&(a(),i.set("ychange",s?s("added",c.id):{type:"added"})):u!==void 0&&(a(),i.delete("ychange")),o+=c.content.str;break}case K:case lt:{a();const u={insert:c.content.getContent()[0]};if(i.size>0){const d={};u.attributes=d,i.forEach((f,g)=>{d[g]=f})}r.push(u);break}case D:ct(c,t)&&(a(),xt(i,c.content));break}c=c.right}a()};return t||n?y(l,u=>{t&&Ke(u,t),n&&Ke(u,n),h()},"cleanup"):h(),r}insert(t,n,s){if(n.length<=0)return;const r=this.doc;r!==null?y(r,i=>{const l=Pt(i,this,t,!s);s||(s={},l.currentAttributes.forEach((o,c)=>{s[c]=o})),Fe(i,this,l,n,s)}):this._pending.push(()=>this.insert(t,n,s))}insertEmbed(t,n,s){const r=this.doc;r!==null?y(r,i=>{const l=Pt(i,this,t,!s);Fe(i,this,l,n,s||{})}):this._pending.push(()=>this.insertEmbed(t,n,s||{}))}delete(t,n){if(n===0)return;const s=this.doc;s!==null?y(s,r=>{qn(r,Pt(r,this,t,!0),n)}):this._pending.push(()=>this.delete(t,n))}format(t,n,s){if(n===0)return;const r=this.doc;r!==null?y(r,i=>{const l=Pt(i,this,t,!1);l.right!==null&&Wn(i,this,l,n,s)}):this._pending.push(()=>this.format(t,n,s))}removeAttribute(t){this.doc!==null?y(this.doc,n=>{ue(n,this,t)}):this._pending.push(()=>this.removeAttribute(t))}setAttribute(t,n){this.doc!==null?y(this.doc,s=>{yn(s,this,t,n)}):this._pending.push(()=>this.setAttribute(t,n))}getAttribute(t){return _n(this,t)}getAttributes(){return rr(this)}_write(t){t.writeTypeRef(Ao)}}const lo=e=>new Et;class Ve{constructor(t,n=()=>!0){this._filter=n,this._root=t,this._currentNode=t._start,this._firstCall=!0,t.doc??O()}[Symbol.iterator](){return this}next(){let t=this._currentNode,n=t&&t.content&&t.content.type;if(t!==null&&(!this._firstCall||t.deleted||!this._filter(n)))do if(n=t.content.type,!t.deleted&&(n.constructor===Ct||n.constructor===st)&&n._start!==null)t=n._start;else for(;t!==null;){const s=t.next;if(s!==null){t=s;break}else t.parent===this._root?t=null:t=t.parent._item}while(t!==null&&(t.deleted||!this._filter(t.content.type)));return this._firstCall=!1,t===null?{value:void 0,done:!0}:(this._currentNode=t,{value:t.content.type,done:!1})}}class st extends I{constructor(){super(),this._prelimContent=[]}get firstChild(){const t=this._first;return t?t.content.getContent()[0]:null}_integrate(t,n){super._integrate(t,n),this.insert(0,this._prelimContent),this._prelimContent=null}_copy(){return new st}clone(){const t=new st;return t.insert(0,this.toArray().map(n=>n instanceof I?n.clone():n)),t}get length(){return this.doc??O(),this._prelimContent===null?this._length:this._prelimContent.length}createTreeWalker(t){return new Ve(this,t)}querySelector(t){t=t.toUpperCase();const s=new Ve(this,r=>r.nodeName&&r.nodeName.toUpperCase()===t).next();return s.done?null:s.value}querySelectorAll(t){return t=t.toUpperCase(),Q(new Ve(this,n=>n.nodeName&&n.nodeName.toUpperCase()===t))}_callObserver(t,n){Oe(this,t,new ho(this,n,t))}toString(){return Qs(this,t=>t.toString()).join("")}toJSON(){return this.toString()}toDOM(t=document,n={},s){const r=t.createDocumentFragment();return s!==void 0&&s._createAssociation(r,this),Bt(this,i=>{r.insertBefore(i.toDOM(t,n,s),null)}),r}insert(t,n){this.doc!==null?y(this.doc,s=>{nr(s,this,t,n)}):this._prelimContent.splice(t,0,...n)}insertAfter(t,n){if(this.doc!==null)y(this.doc,s=>{const r=t&&t instanceof I?t._item:t;ae(s,this,r,n)});else{const s=this._prelimContent,r=t===null?0:s.findIndex(i=>i===t)+1;if(r===0&&t!==null)throw G("Reference item not found");s.splice(r,0,...n)}}delete(t,n=1){this.doc!==null?y(this.doc,s=>{sr(s,this,t,n)}):this._prelimContent.splice(t,n)}toArray(){return Zs(this)}push(t){this.insert(this.length,t)}unshift(t){this.insert(0,t)}get(t){return tr(this,t)}slice(t=0,n=this.length){return Ps(this,t,n)}forEach(t){Bt(this,t)}_write(t){t.writeTypeRef(To)}}const oo=e=>new st;class Ct extends st{constructor(t="UNDEFINED"){super(),this.nodeName=t,this._prelimAttrs=new Map}get nextSibling(){const t=this._item?this._item.next:null;return t?t.content.type:null}get prevSibling(){const t=this._item?this._item.prev:null;return t?t.content.type:null}_integrate(t,n){super._integrate(t,n),this._prelimAttrs.forEach((s,r)=>{this.setAttribute(r,s)}),this._prelimAttrs=null}_copy(){return new Ct(this.nodeName)}clone(){const t=new Ct(this.nodeName),n=this.getAttributes();return ii(n,(s,r)=>{t.setAttribute(r,s)}),t.insert(0,this.toArray().map(s=>s instanceof I?s.clone():s)),t}toString(){const t=this.getAttributes(),n=[],s=[];for(const o in t)s.push(o);s.sort();const r=s.length;for(let o=0;o<r;o++){const c=s[o];n.push(c+'="'+t[c]+'"')}const i=this.nodeName.toLocaleLowerCase(),l=n.length>0?" "+n.join(" "):"";return`<${i}${l}>${super.toString()}</${i}>`}removeAttribute(t){this.doc!==null?y(this.doc,n=>{ue(n,this,t)}):this._prelimAttrs.delete(t)}setAttribute(t,n){this.doc!==null?y(this.doc,s=>{yn(s,this,t,n)}):this._prelimAttrs.set(t,n)}getAttribute(t){return _n(this,t)}hasAttribute(t){return ir(this,t)}getAttributes(t){return t?Pl(this,t):rr(this)}toDOM(t=document,n={},s){const r=t.createElement(this.nodeName),i=this.getAttributes();for(const l in i){const o=i[l];typeof o=="string"&&r.setAttribute(l,o)}return Bt(this,l=>{r.appendChild(l.toDOM(t,n,s))}),s!==void 0&&s._createAssociation(r,this),r}_write(t){t.writeTypeRef(Io),t.writeKey(this.nodeName)}}const co=e=>new Ct(e.readKey());class ho extends Ie{constructor(t,n,s){super(t,s),this.childListChanged=!1,this.attributesChanged=new Set,n.forEach(r=>{r===null?this.childListChanged=!0:this.attributesChanged.add(r)})}}class de extends bt{constructor(t){super(),this.hookName=t}_copy(){return new de(this.hookName)}clone(){const t=new de(this.hookName);return this.forEach((n,s)=>{t.set(s,n)}),t}toDOM(t=document,n={},s){const r=n[this.hookName];let i;return r!==void 0?i=r.createDom(this):i=document.createElement(this.hookName),i.setAttribute("data-yjs-hook",this.hookName),s!==void 0&&s._createAssociation(i,this),i}_write(t){t.writeTypeRef(Oo),t.writeKey(this.hookName)}}const ao=e=>new de(e.readKey());class fe extends Et{get nextSibling(){const t=this._item?this._item.next:null;return t?t.content.type:null}get prevSibling(){const t=this._item?this._item.prev:null;return t?t.content.type:null}_copy(){return new fe}clone(){const t=new fe;return t.applyDelta(this.toDelta()),t}toDOM(t=document,n,s){const r=t.createTextNode(this.toString());return s!==void 0&&s._createAssociation(r,this),r}toString(){return this.toDelta().map(t=>{const n=[];for(const r in t.attributes){const i=[];for(const l in t.attributes[r])i.push({key:l,value:t.attributes[r][l]});i.sort((l,o)=>l.key<o.key?-1:1),n.push({nodeName:r,attrs:i})}n.sort((r,i)=>r.nodeName<i.nodeName?-1:1);let s="";for(let r=0;r<n.length;r++){const i=n[r];s+=`<${i.nodeName}`;for(let l=0;l<i.attrs.length;l++){const o=i.attrs[l];s+=` ${o.key}="${o.value}"`}s+=">"}s+=t.insert;for(let r=n.length-1;r>=0;r--)s+=`</${n[r].nodeName}>`;return s}).join("")}toJSON(){return this.toString()}_write(t){t.writeTypeRef(xo)}}const uo=e=>new fe;class Sn{constructor(t,n){this.id=t,this.length=n}get deleted(){throw V()}mergeWith(t){return!1}write(t,n,s){throw V()}integrate(t,n){throw V()}}const fo=0;class $ extends Sn{get deleted(){return!0}delete(){}mergeWith(t){return this.constructor!==t.constructor?!1:(this.length+=t.length,!0)}integrate(t,n){n>0&&(this.id.clock+=n,this.length-=n),Hs(t.doc.store,this)}write(t,n){t.writeInfo(fo),t.writeLen(this.length-n)}getMissing(t,n){return null}}class Kt{constructor(t){this.content=t}getLength(){return 1}getContent(){return[this.content]}isCountable(){return!0}copy(){return new Kt(this.content)}splice(t){throw V()}mergeWith(t){return!1}integrate(t,n){}delete(t){}gc(t){}write(t,n){t.writeBuf(this.content)}getRef(){return 3}}const go=e=>new Kt(e.readBuf());class Jt{constructor(t){this.len=t}getLength(){return this.len}getContent(){return[]}isCountable(){return!1}copy(){return new Jt(this.len)}splice(t){const n=new Jt(this.len-t);return this.len=t,n}mergeWith(t){return this.len+=t.len,!0}integrate(t,n){Vt(t.deleteSet,n.id.client,n.id.clock,this.len),n.markDeleted()}delete(t){}gc(t){}write(t,n){t.writeLen(this.len-n)}getRef(){return 1}}const po=e=>new Jt(e.readLen()),ar=(e,t)=>new Ot({guid:e,...t,shouldLoad:t.shouldLoad||t.autoLoad||!1});class Xt{constructor(t){t._item&&console.error("This document was already integrated as a sub-document. You should create a second instance instead with the same guid."),this.doc=t;const n={};this.opts=n,t.gc||(n.gc=!1),t.autoLoad&&(n.autoLoad=!0),t.meta!==null&&(n.meta=t.meta)}getLength(){return 1}getContent(){return[this.doc]}isCountable(){return!0}copy(){return new Xt(ar(this.doc.guid,this.opts))}splice(t){throw V()}mergeWith(t){return!1}integrate(t,n){this.doc._item=n,t.subdocsAdded.add(this.doc),this.doc.shouldLoad&&t.subdocsLoaded.add(this.doc)}delete(t){t.subdocsAdded.has(this.doc)?t.subdocsAdded.delete(this.doc):t.subdocsRemoved.add(this.doc)}gc(t){}write(t,n){t.writeString(this.doc.guid),t.writeAny(this.opts)}getRef(){return 9}}const wo=e=>new Xt(ar(e.readString(),e.readAny()));class lt{constructor(t){this.embed=t}getLength(){return 1}getContent(){return[this.embed]}isCountable(){return!0}copy(){return new lt(this.embed)}splice(t){throw V()}mergeWith(t){return!1}integrate(t,n){}delete(t){}gc(t){}write(t,n){t.writeJSON(this.embed)}getRef(){return 5}}const mo=e=>new lt(e.readJSON());class D{constructor(t,n){this.key=t,this.value=n}getLength(){return 1}getContent(){return[]}isCountable(){return!1}copy(){return new D(this.key,this.value)}splice(t){throw V()}mergeWith(t){return!1}integrate(t,n){const s=n.parent;s._searchMarker=null,s._hasFormatting=!0}delete(t){}gc(t){}write(t,n){t.writeKey(this.key),t.writeJSON(this.value)}getRef(){return 6}}const ko=e=>new D(e.readKey(),e.readJSON());class ge{constructor(t){this.arr=t}getLength(){return this.arr.length}getContent(){return this.arr}isCountable(){return!0}copy(){return new ge(this.arr)}splice(t){const n=new ge(this.arr.slice(t));return this.arr=this.arr.slice(0,t),n}mergeWith(t){return this.arr=this.arr.concat(t.arr),!0}integrate(t,n){}delete(t){}gc(t){}write(t,n){const s=this.arr.length;t.writeLen(s-n);for(let r=n;r<s;r++){const i=this.arr[r];t.writeString(i===void 0?"undefined":JSON.stringify(i))}}getRef(){return 2}}const yo=e=>{const t=e.readLen(),n=[];for(let s=0;s<t;s++){const r=e.readString();r==="undefined"?n.push(void 0):n.push(JSON.parse(r))}return new ge(n)},_o=ie("node_env")==="development";class rt{constructor(t){this.arr=t,_o&&ls(t)}getLength(){return this.arr.length}getContent(){return this.arr}isCountable(){return!0}copy(){return new rt(this.arr)}splice(t){const n=new rt(this.arr.slice(t));return this.arr=this.arr.slice(0,t),n}mergeWith(t){return this.arr=this.arr.concat(t.arr),!0}integrate(t,n){}delete(t){}gc(t){}write(t,n){const s=this.arr.length;t.writeLen(s-n);for(let r=n;r<s;r++){const i=this.arr[r];t.writeAny(i)}}getRef(){return 8}}const So=e=>{const t=e.readLen(),n=[];for(let s=0;s<t;s++)n.push(e.readAny());return new rt(n)};class H{constructor(t){this.str=t}getLength(){return this.str.length}getContent(){return this.str.split("")}isCountable(){return!0}copy(){return new H(this.str)}splice(t){const n=new H(this.str.slice(t));this.str=this.str.slice(0,t);const s=this.str.charCodeAt(t-1);return s>=55296&&s<=56319&&(this.str=this.str.slice(0,t-1)+"�",n.str="�"+n.str.slice(1)),n}mergeWith(t){return this.str+=t.str,!0}integrate(t,n){}delete(t){}gc(t){}write(t,n){t.writeString(n===0?this.str:this.str.slice(n))}getRef(){return 4}}const bo=e=>new H(e.readString()),Eo=[Ql,eo,lo,co,oo,ao,uo],Co=0,Do=1,Ao=2,Io=3,To=4,Oo=5,xo=6;class K{constructor(t){this.type=t}getLength(){return 1}getContent(){return[this.type]}isCountable(){return!0}copy(){return new K(this.type._copy())}splice(t){throw V()}mergeWith(t){return!1}integrate(t,n){this.type._integrate(t.doc,n)}delete(t){let n=this.type._start;for(;n!==null;)n.deleted?n.id.clock<(t.beforeState.get(n.id.client)||0)&&t._mergeStructs.push(n):n.delete(t),n=n.right;this.type._map.forEach(s=>{s.deleted?s.id.clock<(t.beforeState.get(s.id.client)||0)&&t._mergeStructs.push(s):s.delete(t)}),t.changed.delete(this.type)}gc(t){let n=this.type._start;for(;n!==null;)n.gc(t,!0),n=n.right;this.type._start=null,this.type._map.forEach(s=>{for(;s!==null;)s.gc(t,!0),s=s.left}),this.type._map=new Map}write(t,n){this.type._write(t)}getRef(){return 7}}const Lo=e=>new K(Eo[e.readTypeRef()](e)),qe=(e,t)=>{let n=t,s=0,r;do s>0&&(n=p(n.client,n.clock+s)),r=gt(e,n),s=n.clock-r.id.clock,n=r.redone;while(n!==null&&r instanceof _);return{item:r,diff:s}},bn=(e,t)=>{for(;e!==null&&e.keep!==t;)e.keep=t,e=e.parent._item},pe=(e,t,n)=>{const{client:s,clock:r}=t.id,i=new _(p(s,r+n),t,p(s,r+n-1),t.right,t.rightOrigin,t.parent,t.parentSub,t.content.splice(n));return t.deleted&&i.markDeleted(),t.keep&&(i.keep=!0),t.redone!==null&&(i.redone=p(t.redone.client,t.redone.clock+n)),t.right=i,i.right!==null&&(i.right.left=i),e._mergeStructs.push(i),i.parentSub!==null&&i.right===null&&i.parent._map.set(i.parentSub,i),t.length=n,i},Pn=(e,t)=>Ze(e,n=>Ht(n.deletions,t)),ur=(e,t,n,s,r,i)=>{const l=e.doc,o=l.store,c=l.clientID,a=t.redone;if(a!==null)return L(e,a);let h=t.parent._item,u=null,d;if(h!==null&&h.deleted===!0){if(h.redone===null&&(!n.has(h)||ur(e,h,n,s,r,i)===null))return null;for(;h.redone!==null;)h=L(e,h.redone)}const f=h===null?t.parent:h.content.type;if(t.parentSub===null){for(u=t.left,d=t;u!==null;){let b=u;for(;b!==null&&b.parent._item!==h;)b=b.redone===null?null:L(e,b.redone);if(b!==null&&b.parent._item===h){u=b;break}u=u.left}for(;d!==null;){let b=d;for(;b!==null&&b.parent._item!==h;)b=b.redone===null?null:L(e,b.redone);if(b!==null&&b.parent._item===h){d=b;break}d=d.right}}else if(d=null,t.right&&!r){for(u=t;u!==null&&u.right!==null&&(u.right.redone||Ht(s,u.right.id)||Pn(i.undoStack,u.right.id)||Pn(i.redoStack,u.right.id));)for(u=u.right;u.redone;)u=L(e,u.redone);if(u&&u.right!==null)return null}else u=f._map.get(t.parentSub)||null;const g=E(o,c),w=p(c,g),S=new _(w,u,u&&u.lastId,d,d&&d.id,f,t.parentSub,t.content.copy());return t.redone=w,bn(S,!0),S.integrate(e,0),S};class _ extends Sn{constructor(t,n,s,r,i,l,o,c){super(t,c.getLength()),this.origin=s,this.left=n,this.right=r,this.rightOrigin=i,this.parent=l,this.parentSub=o,this.redone=null,this.content=c,this.info=this.content.isCountable()?An:0}set marker(t){(this.info&Ue)>0!==t&&(this.info^=Ue)}get marker(){return(this.info&Ue)>0}get keep(){return(this.info&Dn)>0}set keep(t){this.keep!==t&&(this.info^=Dn)}get countable(){return(this.info&An)>0}get deleted(){return(this.info&Le)>0}set deleted(t){this.deleted!==t&&(this.info^=Le)}markDeleted(){this.info|=Le}getMissing(t,n){if(this.origin&&this.origin.client!==this.id.client&&this.origin.clock>=E(n,this.origin.client))return this.origin.client;if(this.rightOrigin&&this.rightOrigin.client!==this.id.client&&this.rightOrigin.clock>=E(n,this.rightOrigin.client))return this.rightOrigin.client;if(this.parent&&this.parent.constructor===ft&&this.id.client!==this.parent.client&&this.parent.clock>=E(n,this.parent.client))return this.parent.client;if(this.origin&&(this.left=Jn(t,n,this.origin),this.origin=this.left.lastId),this.rightOrigin&&(this.right=L(t,this.rightOrigin),this.rightOrigin=this.right.id),this.left&&this.left.constructor===$||this.right&&this.right.constructor===$)this.parent=null;else if(!this.parent)this.left&&this.left.constructor===_?(this.parent=this.left.parent,this.parentSub=this.left.parentSub):this.right&&this.right.constructor===_&&(this.parent=this.right.parent,this.parentSub=this.right.parentSub);else if(this.parent.constructor===ft){const s=gt(n,this.parent);s.constructor===$?this.parent=null:this.parent=s.content.type}return null}integrate(t,n){if(n>0&&(this.id.clock+=n,this.left=Jn(t,t.doc.store,p(this.id.client,this.id.clock-1)),this.origin=this.left.lastId,this.content=this.content.splice(n),this.length-=n),this.parent){if(!this.left&&(!this.right||this.right.left!==null)||this.left&&this.left.right!==this.right){let s=this.left,r;if(s!==null)r=s.right;else if(this.parentSub!==null)for(r=this.parent._map.get(this.parentSub)||null;r!==null&&r.left!==null;)r=r.left;else r=this.parent._start;const i=new Set,l=new Set;for(;r!==null&&r!==this.right;){if(l.add(r),i.add(r),ht(this.origin,r.origin)){if(r.id.client<this.id.client)s=r,i.clear();else if(ht(this.rightOrigin,r.rightOrigin))break}else if(r.origin!==null&&l.has(gt(t.doc.store,r.origin)))i.has(gt(t.doc.store,r.origin))||(s=r,i.clear());else break;r=r.right}this.left=s}if(this.left!==null){const s=this.left.right;this.right=s,this.left.right=this}else{let s;if(this.parentSub!==null)for(s=this.parent._map.get(this.parentSub)||null;s!==null&&s.left!==null;)s=s.left;else s=this.parent._start,this.parent._start=this;this.right=s}this.right!==null?this.right.left=this:this.parentSub!==null&&(this.parent._map.set(this.parentSub,this),this.left!==null&&this.left.delete(t)),this.parentSub===null&&this.countable&&!this.deleted&&(this.parent._length+=this.length),Hs(t.doc.store,this),this.content.integrate(t,this),Yn(t,this.parent,this.parentSub),(this.parent._item!==null&&this.parent._item.deleted||this.parentSub!==null&&this.right!==null)&&this.delete(t)}else new $(this.id,this.length).integrate(t,0)}get next(){let t=this.right;for(;t!==null&&t.deleted;)t=t.right;return t}get prev(){let t=this.left;for(;t!==null&&t.deleted;)t=t.left;return t}get lastId(){return this.length===1?this.id:p(this.id.client,this.id.clock+this.length-1)}mergeWith(t){if(this.constructor===t.constructor&&ht(t.origin,this.lastId)&&this.right===t&&ht(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)){const n=this.parent._searchMarker;return n&&n.forEach(s=>{s.p===t&&(s.p=this,!this.deleted&&this.countable&&(s.index-=this.length))}),t.keep&&(this.keep=!0),this.right=t.right,this.right!==null&&(this.right.left=this),this.length+=t.length,!0}return!1}delete(t){if(!this.deleted){const n=this.parent;this.countable&&this.parentSub===null&&(n._length-=this.length),this.markDeleted(),Vt(t.deleteSet,this.id.client,this.id.clock,this.length),Yn(t,n,this.parentSub),this.content.delete(t)}}gc(t,n){if(!this.deleted)throw M();this.content.gc(t),n?Rl(t,this,new $(this.id,this.length)):this.content=new Jt(this.length)}write(t,n){const s=n>0?p(this.id.client,this.id.clock+n-1):this.origin,r=this.rightOrigin,i=this.parentSub,l=this.content.getRef()&we|(s===null?0:R)|(r===null?0:W)|(i===null?0:Ut);if(t.writeInfo(l),s!==null&&t.writeLeftID(s),r!==null&&t.writeRightID(r),s===null&&r===null){const o=this.parent;if(o._item!==void 0){const c=o._item;if(c===null){const a=Js(o);t.writeParentInfo(!0),t.writeString(a)}else t.writeParentInfo(!1),t.writeLeftID(c.id)}else o.constructor===String?(t.writeParentInfo(!0),t.writeString(o)):o.constructor===ft?(t.writeParentInfo(!1),t.writeLeftID(o)):M();i!==null&&t.writeString(i)}this.content.write(t,n)}}const dr=(e,t)=>Uo[t&we](e),Uo=[()=>{M()},po,yo,go,bo,mo,ko,Lo,So,wo,()=>{M()}],No=10;class v extends Sn{get deleted(){return!0}delete(){}mergeWith(t){return this.constructor!==t.constructor?!1:(this.length+=t.length,!0)}integrate(t,n){M()}write(t,n){t.writeInfo(No),k(t.restEncoder,this.length-n)}getMissing(t,n){return null}}const fr=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:{},gr="__ $YJS$ __";fr[gr]===!0&&console.error("Yjs was already imported. This breaks constructor checks and will lead to issues! - https://github.com/yjs/yjs/issues/438");fr[gr]=!0;export{Ot as D,Yo as U,$o as a,vo as b,jo as c,Bo as d,Fo as e,Jo as f,Go as g,it as h,Ro as i,X as j,Qn as m,Vo as r,Mo as t};
|