@aperture-browser/session-client 0.0.0-stage → 1.0.0-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +36 -2
- package/dist/effect.d.ts +2 -0
- package/dist/effect.js +2 -0
- package/dist/index.d.ts +153 -0
- package/dist/index.js +82 -0
- package/dist/index.js.map +1 -0
- package/dist/rolldown-runtime-D7D4PA-g.js +13 -0
- package/dist/session-CSF1mk8K.js +2990 -0
- package/dist/session-CSF1mk8K.js.map +1 -0
- package/dist/session-Di6f5DYK.d.ts +2892 -0
- package/package.json +48 -3
|
@@ -0,0 +1,2990 @@
|
|
|
1
|
+
import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.js";
|
|
2
|
+
import * as Effect from "effect/Effect";
|
|
3
|
+
import * as Exit from "effect/Exit";
|
|
4
|
+
import * as Scope from "effect/Scope";
|
|
5
|
+
import * as Context from "effect/Context";
|
|
6
|
+
import * as Equal from "effect/Equal";
|
|
7
|
+
import * as FiberSet from "effect/FiberSet";
|
|
8
|
+
import * as Layer from "effect/Layer";
|
|
9
|
+
import * as Queue from "effect/Queue";
|
|
10
|
+
import * as Result from "effect/Result";
|
|
11
|
+
import * as Stream from "effect/Stream";
|
|
12
|
+
import * as Schema from "effect/Schema";
|
|
13
|
+
import { enumDesc, fileDesc, messageDesc } from "@bufbuild/protobuf/codegenv2";
|
|
14
|
+
import { create, fromBinary, fromJsonString, toBinary } from "@bufbuild/protobuf";
|
|
15
|
+
//#region ../shared/src/url-path.ts
|
|
16
|
+
/**
|
|
17
|
+
* Request paths and urls built from values that may hold what a url treats specially
|
|
18
|
+
* (`/`, `?`, `#`, `%`, spaces): a file's name, a session's id, a ticket. Every
|
|
19
|
+
* interpolation is encoded unless it says otherwise, so a value cannot leave its segment
|
|
20
|
+
* because one call site forgot to encode it.
|
|
21
|
+
*
|
|
22
|
+
* Effect has no such builder: `HttpApiClient` encodes `:param` paths only for endpoints
|
|
23
|
+
* declared through `HttpApi`, and `Url.setPathname` leaves `/`, `?`, and `#` as they are.
|
|
24
|
+
*/
|
|
25
|
+
var Raw = class {
|
|
26
|
+
text;
|
|
27
|
+
constructor(text) {
|
|
28
|
+
this.text = text;
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
var Segments = class {
|
|
32
|
+
path;
|
|
33
|
+
constructor(path) {
|
|
34
|
+
this.path = path;
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* A value that is itself several segments, `downloads/report.pdf`: each `/`-separated
|
|
39
|
+
* segment is encoded and the slashes stay.
|
|
40
|
+
*/
|
|
41
|
+
const segments = (path) => new Segments(path);
|
|
42
|
+
const encode$1 = (part) => {
|
|
43
|
+
if (part instanceof Raw) return part.text;
|
|
44
|
+
if (part instanceof Segments) return part.path.split("/").map(encodeURIComponent).join("/");
|
|
45
|
+
return encodeURIComponent(part);
|
|
46
|
+
};
|
|
47
|
+
/** `` make`/sessions/${id}/files/${name}` ``: every interpolation encoded as one segment. */
|
|
48
|
+
const make$2 = (literals, ...parts) => {
|
|
49
|
+
let url = literals[0] ?? "";
|
|
50
|
+
parts.forEach((part, index) => {
|
|
51
|
+
url += encode$1(part) + (literals[index + 1] ?? "");
|
|
52
|
+
});
|
|
53
|
+
return url;
|
|
54
|
+
};
|
|
55
|
+
//#endregion
|
|
56
|
+
//#region src/address.ts
|
|
57
|
+
const based = (address, path) => {
|
|
58
|
+
const origin = globalThis.location?.href;
|
|
59
|
+
const base = new URL(address.url, origin);
|
|
60
|
+
base.pathname = `${base.pathname.replace(/\/+$/u, "")}${path}`;
|
|
61
|
+
return base;
|
|
62
|
+
};
|
|
63
|
+
/** A route below the session's base, for a request that carries the token in a header. */
|
|
64
|
+
const route = (address, path) => based(address, path).toString();
|
|
65
|
+
/**
|
|
66
|
+
* A route below the session's base that carries the token itself, for what cannot send a
|
|
67
|
+
* header: a link, a picture, the session socket.
|
|
68
|
+
*/
|
|
69
|
+
const authenticated = (address, path) => {
|
|
70
|
+
const url = based(address, path);
|
|
71
|
+
if (address.token !== void 0) url.searchParams.set("token", address.token);
|
|
72
|
+
return url;
|
|
73
|
+
};
|
|
74
|
+
const socketUrl = (address) => {
|
|
75
|
+
const url = authenticated(address, "/ws");
|
|
76
|
+
if (address.name !== void 0 && address.name !== "") url.searchParams.set("name", address.name);
|
|
77
|
+
url.protocol = url.protocol === "https:" ? "wss:" : "ws:";
|
|
78
|
+
return url.toString();
|
|
79
|
+
};
|
|
80
|
+
const fileUrl = (address, path) => authenticated(address, make$2`/files/${segments(path.replace(/^\/+/u, ""))}`).toString();
|
|
81
|
+
const screenshotUrl = (address, tab, width) => {
|
|
82
|
+
const url = authenticated(address, make$2`/targets/${tab}/screenshot.png`);
|
|
83
|
+
if (width !== void 0) url.searchParams.set("width", String(Math.round(width)));
|
|
84
|
+
return url.toString();
|
|
85
|
+
};
|
|
86
|
+
/** The tab as it looks now, small: for a list of the tabs. */
|
|
87
|
+
const previewUrl = (address, tab) => authenticated(address, make$2`/targets/${tab}/preview.png`).toString();
|
|
88
|
+
/**
|
|
89
|
+
* The icon of the tab's page, fetched by the session. `site` is what the page is of: the
|
|
90
|
+
* icon is kept by its address here, and another site's is another address.
|
|
91
|
+
*/
|
|
92
|
+
const faviconUrl = (address, tab, site) => {
|
|
93
|
+
const url = authenticated(address, make$2`/targets/${tab}/favicon`);
|
|
94
|
+
url.searchParams.set("of", site);
|
|
95
|
+
return url.toString();
|
|
96
|
+
};
|
|
97
|
+
const headers = (address) => address.token === void 0 ? {} : { Authorization: `Bearer ${address.token}` };
|
|
98
|
+
//#endregion
|
|
99
|
+
//#region src/clipboard.ts
|
|
100
|
+
/** The forms of text a clipboard carries. */
|
|
101
|
+
const TEXTS = ["text/plain", "text/html"];
|
|
102
|
+
/** What of the session's clipboard a clipboard here takes. */
|
|
103
|
+
const TAKEN = /^(?:text\/(?:plain|html)|image\/.+)$/u;
|
|
104
|
+
const form = async (type, blob) => ({
|
|
105
|
+
type,
|
|
106
|
+
data: new Uint8Array(await blob.arrayBuffer())
|
|
107
|
+
});
|
|
108
|
+
const textForm = (type, text) => ({
|
|
109
|
+
type,
|
|
110
|
+
data: new TextEncoder().encode(text)
|
|
111
|
+
});
|
|
112
|
+
const blobOf = (one) => new Blob([new Uint8Array(one.data)], { type: one.type });
|
|
113
|
+
/** A picture drawn again as a PNG: what it looks like, and nothing else it carried. */
|
|
114
|
+
const drawn = async (picture) => {
|
|
115
|
+
const draw = (source, width, height) => {
|
|
116
|
+
const canvas = new OffscreenCanvas(width, height);
|
|
117
|
+
canvas.getContext("2d")?.drawImage(source, 0, 0, width, height);
|
|
118
|
+
return canvas.convertToBlob({ type: "image/png" });
|
|
119
|
+
};
|
|
120
|
+
try {
|
|
121
|
+
const bitmap = await createImageBitmap(picture);
|
|
122
|
+
try {
|
|
123
|
+
return await draw(bitmap, bitmap.width, bitmap.height);
|
|
124
|
+
} finally {
|
|
125
|
+
bitmap.close();
|
|
126
|
+
}
|
|
127
|
+
} catch {
|
|
128
|
+
const url = URL.createObjectURL(picture);
|
|
129
|
+
try {
|
|
130
|
+
const image = new Image();
|
|
131
|
+
image.src = url;
|
|
132
|
+
await image.decode();
|
|
133
|
+
return await draw(image, image.naturalWidth || 300, image.naturalHeight || 150);
|
|
134
|
+
} finally {
|
|
135
|
+
URL.revokeObjectURL(url);
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
};
|
|
139
|
+
/** A picture as the PNG clipboards carry. */
|
|
140
|
+
const png = (picture) => picture.type === "image/png" ? Promise.resolve(picture) : drawn(picture);
|
|
141
|
+
const blobs = async (forms) => {
|
|
142
|
+
const taken = forms.filter((one) => TAKEN.test(one.type));
|
|
143
|
+
const had = await Promise.all(taken.map(async (one) => {
|
|
144
|
+
const blob = blobOf(one);
|
|
145
|
+
return one.type.startsWith("image/") ? ["image/png", await png(blob)] : [one.type, blob];
|
|
146
|
+
}));
|
|
147
|
+
return Object.fromEntries(had);
|
|
148
|
+
};
|
|
149
|
+
/**
|
|
150
|
+
* Puts what the session copied on the clipboard here, which a browser lets a page do at
|
|
151
|
+
* any time or only in a click. Tells whether it did.
|
|
152
|
+
*/
|
|
153
|
+
const write = async (forms) => {
|
|
154
|
+
if (typeof ClipboardItem === "undefined" || navigator.clipboard?.write === void 0) return false;
|
|
155
|
+
try {
|
|
156
|
+
const had = await blobs(forms);
|
|
157
|
+
if (Object.keys(had).length === 0) return false;
|
|
158
|
+
await navigator.clipboard.write([new ClipboardItem(had)]);
|
|
159
|
+
return true;
|
|
160
|
+
} catch {
|
|
161
|
+
return false;
|
|
162
|
+
}
|
|
163
|
+
};
|
|
164
|
+
/**
|
|
165
|
+
* Copies the old way, which is deprecated and the one way where the clipboard is not a
|
|
166
|
+
* page's to write: the browser is told to copy, and is handed the texts as it does.
|
|
167
|
+
*/
|
|
168
|
+
const copyOldWay = (texts) => {
|
|
169
|
+
const from = document.createElement("textarea");
|
|
170
|
+
from.value = texts.get("text/plain") ?? "";
|
|
171
|
+
document.body.append(from);
|
|
172
|
+
from.focus();
|
|
173
|
+
from.select();
|
|
174
|
+
let handed = false;
|
|
175
|
+
const hand = (event) => {
|
|
176
|
+
for (const [type, text] of texts) event.clipboardData?.setData(type, text);
|
|
177
|
+
event.preventDefault();
|
|
178
|
+
event.stopImmediatePropagation();
|
|
179
|
+
handed = true;
|
|
180
|
+
};
|
|
181
|
+
window.addEventListener("copy", hand, { capture: true });
|
|
182
|
+
const copied = document.execCommand("copy");
|
|
183
|
+
window.removeEventListener("copy", hand, { capture: true });
|
|
184
|
+
from.remove();
|
|
185
|
+
return copied && (handed || from.value !== "");
|
|
186
|
+
};
|
|
187
|
+
/**
|
|
188
|
+
* Copies in a click what `write` could not: text is copied the old way, and a picture
|
|
189
|
+
* opens to be copied by hand.
|
|
190
|
+
*
|
|
191
|
+
* What the session copied is what a page there made of it, and nothing of it is opened
|
|
192
|
+
* as it came: a document made of it here would be this page's own, and run as whoever
|
|
193
|
+
* watches. Text stays text, and a picture opens as the PNG it is drawn to.
|
|
194
|
+
*/
|
|
195
|
+
const writeByHand = async (forms) => {
|
|
196
|
+
if (await write(forms)) return true;
|
|
197
|
+
const texts = new Map(forms.filter((one) => TEXTS.some((type) => type === one.type)).map((one) => [one.type, new TextDecoder().decode(one.data)]));
|
|
198
|
+
const marked = texts.get("text/html");
|
|
199
|
+
if (marked !== void 0 && !texts.has("text/plain")) {
|
|
200
|
+
const read = new DOMParser().parseFromString(marked, "text/html");
|
|
201
|
+
for (const unread of read.querySelectorAll("script, style, template")) unread.remove();
|
|
202
|
+
texts.set("text/plain", read.body.textContent ?? "");
|
|
203
|
+
}
|
|
204
|
+
if (texts.size > 0) return copyOldWay(texts);
|
|
205
|
+
const picture = forms.find((one) => one.type.startsWith("image/"));
|
|
206
|
+
if (picture === void 0) return false;
|
|
207
|
+
try {
|
|
208
|
+
window.open(URL.createObjectURL(await drawn(blobOf(picture))));
|
|
209
|
+
return true;
|
|
210
|
+
} catch {
|
|
211
|
+
return false;
|
|
212
|
+
}
|
|
213
|
+
};
|
|
214
|
+
/** What the clipboard here has, where the browser lets a page read it. */
|
|
215
|
+
const read = async () => {
|
|
216
|
+
const items = await navigator.clipboard.read();
|
|
217
|
+
const forms = [];
|
|
218
|
+
for (const type of [...TEXTS, "image/png"]) {
|
|
219
|
+
const item = items.find((one) => one.types.includes(type));
|
|
220
|
+
if (item !== void 0) forms.push(await form(type, await item.getType(type)));
|
|
221
|
+
}
|
|
222
|
+
return forms;
|
|
223
|
+
};
|
|
224
|
+
/** The text a paste or a drag carries, in each form it has it. */
|
|
225
|
+
const texts = (carried) => TEXTS.map((type) => [type, carried.getData(type)]).filter(([, text]) => text !== "").map(([type, text]) => textForm(type, text));
|
|
226
|
+
//#endregion
|
|
227
|
+
//#region src/codecs.ts
|
|
228
|
+
/**
|
|
229
|
+
* What a decoder is asked for, by the form of the frames. Without a description the
|
|
230
|
+
* frames are read as Annex B, which they are.
|
|
231
|
+
*/
|
|
232
|
+
const CODECS = {
|
|
233
|
+
h264: "avc1.42e01f",
|
|
234
|
+
"full-chroma": "avc1.f4001f",
|
|
235
|
+
h265: "hev1.1.6.L153.B0",
|
|
236
|
+
vp9: "vp09.00.51.08",
|
|
237
|
+
"vp9-full-chroma": "vp09.01.51.08.03",
|
|
238
|
+
av1: "av01.0.13M.08"
|
|
239
|
+
};
|
|
240
|
+
/** What a WebRTC connection calls the formats it carries; it carries no H.264 4:4:4. */
|
|
241
|
+
const RTC_CODECS = {
|
|
242
|
+
h264: (codec) => codec.mimeType === "video/H264",
|
|
243
|
+
h265: (codec) => codec.mimeType === "video/H265",
|
|
244
|
+
vp9: (codec) => codec.mimeType === "video/VP9" && /profile-id=0/u.test(codec.sdpFmtpLine ?? "profile-id=0"),
|
|
245
|
+
"vp9-full-chroma": (codec) => codec.mimeType === "video/VP9" && /profile-id=1/u.test(codec.sdpFmtpLine ?? ""),
|
|
246
|
+
av1: (codec) => codec.mimeType === "video/AV1"
|
|
247
|
+
};
|
|
248
|
+
const ALL = Object.keys(CODECS);
|
|
249
|
+
/** The ways this environment can take a picture, best first. */
|
|
250
|
+
const waysHere = () => {
|
|
251
|
+
const ways = [];
|
|
252
|
+
if (typeof RTCPeerConnection !== "undefined") ways.push("video");
|
|
253
|
+
if (typeof VideoDecoder !== "undefined") ways.push("frames");
|
|
254
|
+
ways.push("tiles");
|
|
255
|
+
return ways;
|
|
256
|
+
};
|
|
257
|
+
const decodes = async (format) => {
|
|
258
|
+
try {
|
|
259
|
+
const { supported } = await VideoDecoder.isConfigSupported({ codec: CODECS[format] });
|
|
260
|
+
return supported === true;
|
|
261
|
+
} catch {
|
|
262
|
+
return false;
|
|
263
|
+
}
|
|
264
|
+
};
|
|
265
|
+
/** The formats this browser takes the way the picture comes. */
|
|
266
|
+
const decodable = async (way) => {
|
|
267
|
+
if (way === "video") {
|
|
268
|
+
const codecs = RTCRtpReceiver.getCapabilities("video")?.codecs ?? [];
|
|
269
|
+
return ALL.filter((format) => {
|
|
270
|
+
const carries = RTC_CODECS[format];
|
|
271
|
+
return carries !== void 0 && codecs.some(carries);
|
|
272
|
+
});
|
|
273
|
+
}
|
|
274
|
+
if (way === "frames") {
|
|
275
|
+
const supported = await Promise.all(ALL.map(decodes));
|
|
276
|
+
return ALL.filter((_, at) => supported[at]);
|
|
277
|
+
}
|
|
278
|
+
return [];
|
|
279
|
+
};
|
|
280
|
+
//#endregion
|
|
281
|
+
//#region src/errors.ts
|
|
282
|
+
/** A request to the session that could not be made, or that the session refused. */
|
|
283
|
+
var SessionError = class extends Schema.TaggedError()("SessionError", {
|
|
284
|
+
message: Schema.String,
|
|
285
|
+
/** The HTTP status the session answered with, when it answered. */
|
|
286
|
+
status: Schema.optional(Schema.Number),
|
|
287
|
+
cause: Schema.optional(Schema.Defect())
|
|
288
|
+
}) {};
|
|
289
|
+
//#endregion
|
|
290
|
+
//#region src/http.ts
|
|
291
|
+
var http_exports = /* @__PURE__ */ __exportAll({
|
|
292
|
+
annotateRecording: () => annotateRecording,
|
|
293
|
+
downloads: () => downloads,
|
|
294
|
+
editRecording: () => editRecording,
|
|
295
|
+
exportStorageState: () => exportStorageState,
|
|
296
|
+
getPace: () => getPace,
|
|
297
|
+
getRecording: () => getRecording,
|
|
298
|
+
importStorageState: () => importStorageState,
|
|
299
|
+
listRecordings: () => listRecordings,
|
|
300
|
+
listScreenshots: () => listScreenshots,
|
|
301
|
+
removeUpload: () => removeUpload,
|
|
302
|
+
retargetRecording: () => retargetRecording,
|
|
303
|
+
setPace: () => setPace,
|
|
304
|
+
setViewport: () => setViewport,
|
|
305
|
+
startRecording: () => startRecording,
|
|
306
|
+
stopRecording: () => stopRecording,
|
|
307
|
+
takeScreenshot: () => takeScreenshot,
|
|
308
|
+
targets: () => targets,
|
|
309
|
+
upload: () => upload,
|
|
310
|
+
uploads: () => uploads
|
|
311
|
+
});
|
|
312
|
+
const failed = (cause) => new SessionError({
|
|
313
|
+
message: cause instanceof Error ? cause.message : "the session could not be reached",
|
|
314
|
+
cause
|
|
315
|
+
});
|
|
316
|
+
const refused = (status, text) => new SessionError({
|
|
317
|
+
message: text === "" ? `the session answered ${status}` : text,
|
|
318
|
+
status
|
|
319
|
+
});
|
|
320
|
+
const request = Effect.fnUntraced(function* (address, path, asked = {}) {
|
|
321
|
+
const response = yield* Effect.tryPromise({
|
|
322
|
+
try: (signal) => fetch(route(address, path), {
|
|
323
|
+
method: asked.method ?? "GET",
|
|
324
|
+
headers: {
|
|
325
|
+
...headers(address),
|
|
326
|
+
...asked.json === void 0 ? {} : { "Content-Type": "application/json" }
|
|
327
|
+
},
|
|
328
|
+
body: asked.json === void 0 ? null : JSON.stringify(asked.json),
|
|
329
|
+
signal
|
|
330
|
+
}),
|
|
331
|
+
catch: failed
|
|
332
|
+
});
|
|
333
|
+
if (!response.ok) {
|
|
334
|
+
const text = yield* Effect.tryPromise({
|
|
335
|
+
try: () => response.text(),
|
|
336
|
+
catch: failed
|
|
337
|
+
});
|
|
338
|
+
return yield* refused(response.status, text);
|
|
339
|
+
}
|
|
340
|
+
return response;
|
|
341
|
+
});
|
|
342
|
+
const json = (address, path, asked) => request(address, path, asked).pipe(Effect.flatMap((response) => Effect.tryPromise({
|
|
343
|
+
try: () => response.json(),
|
|
344
|
+
catch: failed
|
|
345
|
+
})));
|
|
346
|
+
const named$1 = (name) => make$2`/uploads/${name}`;
|
|
347
|
+
const uploadTold = (address, file, onProgress) => Effect.callback((resume) => {
|
|
348
|
+
const sending = new XMLHttpRequest();
|
|
349
|
+
sending.open("PUT", route(address, named$1(file.name)));
|
|
350
|
+
for (const [name, value] of Object.entries(headers(address))) sending.setRequestHeader(name, value);
|
|
351
|
+
sending.upload.addEventListener("progress", (event) => {
|
|
352
|
+
onProgress({
|
|
353
|
+
loaded: event.loaded,
|
|
354
|
+
total: event.lengthComputable ? event.total : file.size
|
|
355
|
+
});
|
|
356
|
+
});
|
|
357
|
+
sending.addEventListener("error", () => {
|
|
358
|
+
resume(Effect.fail(new SessionError({ message: "the session could not be reached" })));
|
|
359
|
+
});
|
|
360
|
+
sending.addEventListener("load", () => {
|
|
361
|
+
if (sending.status < 200 || sending.status >= 300) {
|
|
362
|
+
resume(Effect.fail(refused(sending.status, sending.responseText)));
|
|
363
|
+
return;
|
|
364
|
+
}
|
|
365
|
+
resume(Effect.try({
|
|
366
|
+
try: () => JSON.parse(sending.responseText),
|
|
367
|
+
catch: failed
|
|
368
|
+
}));
|
|
369
|
+
});
|
|
370
|
+
sending.send(file);
|
|
371
|
+
return Effect.sync(() => sending.abort());
|
|
372
|
+
});
|
|
373
|
+
/** Every target of the session, oldest first. */
|
|
374
|
+
const targets = Effect.fn("SessionHttp.targets")((address) => json(address, "/targets"));
|
|
375
|
+
/** Gives a target its own viewport, as near to the one asked for as it can be given. */
|
|
376
|
+
const setViewport = Effect.fn("SessionHttp.setViewport")((address, tab, viewport) => request(address, make$2`/targets/${tab}/viewport`, {
|
|
377
|
+
method: "PUT",
|
|
378
|
+
json: viewport
|
|
379
|
+
}).pipe(Effect.asVoid));
|
|
380
|
+
const downloads = Effect.fn("SessionHttp.downloads")((address) => json(address, "/downloads"));
|
|
381
|
+
const uploads = Effect.fn("SessionHttp.uploads")((address) => json(address, "/uploads"));
|
|
382
|
+
/**
|
|
383
|
+
* Puts a file into the session's uploads under its own name, in place of one there was.
|
|
384
|
+
* Files get to the session's browser this way: they are put there, and the browser is
|
|
385
|
+
* told where they are.
|
|
386
|
+
*/
|
|
387
|
+
const upload = Effect.fn("SessionHttp.upload")(function* (address, file, onProgress) {
|
|
388
|
+
if (onProgress !== void 0 && typeof XMLHttpRequest !== "undefined") return yield* uploadTold(address, file, onProgress);
|
|
389
|
+
const response = yield* Effect.tryPromise({
|
|
390
|
+
try: (signal) => fetch(route(address, named$1(file.name)), {
|
|
391
|
+
method: "PUT",
|
|
392
|
+
headers: headers(address),
|
|
393
|
+
body: file,
|
|
394
|
+
signal
|
|
395
|
+
}),
|
|
396
|
+
catch: failed
|
|
397
|
+
});
|
|
398
|
+
const text = yield* Effect.tryPromise({
|
|
399
|
+
try: () => response.text(),
|
|
400
|
+
catch: failed
|
|
401
|
+
});
|
|
402
|
+
if (!response.ok) return yield* refused(response.status, text);
|
|
403
|
+
const uploaded = yield* Effect.try({
|
|
404
|
+
try: () => JSON.parse(text),
|
|
405
|
+
catch: failed
|
|
406
|
+
});
|
|
407
|
+
onProgress?.({
|
|
408
|
+
loaded: uploaded.size,
|
|
409
|
+
total: uploaded.size
|
|
410
|
+
});
|
|
411
|
+
return uploaded;
|
|
412
|
+
});
|
|
413
|
+
const removeUpload = Effect.fn("SessionHttp.removeUpload")((address, name) => request(address, named$1(name), { method: "DELETE" }).pipe(Effect.asVoid));
|
|
414
|
+
const listRecordings = Effect.fn("SessionHttp.listRecordings")((address) => json(address, "/recordings"));
|
|
415
|
+
const getRecording = Effect.fn("SessionHttp.getRecording")((address, id) => json(address, make$2`/recordings/${id}`));
|
|
416
|
+
const startRecording = Effect.fn("SessionHttp.startRecording")((address, options = {}) => json(address, "/recordings", {
|
|
417
|
+
method: "POST",
|
|
418
|
+
json: options
|
|
419
|
+
}));
|
|
420
|
+
/** Stops a recording. Its edit is made after, with `options`. */
|
|
421
|
+
const stopRecording = Effect.fn("SessionHttp.stopRecording")((address, id, options = {}) => json(address, make$2`/recordings/${id}/stop`, {
|
|
422
|
+
method: "POST",
|
|
423
|
+
json: options
|
|
424
|
+
}));
|
|
425
|
+
/**
|
|
426
|
+
* Makes the edit of a stopped recording again, of the same raw video and with `options`. It
|
|
427
|
+
* takes the place of the edit there is once it is made. Refused while an edit of the
|
|
428
|
+
* recording is being made, and for a recording whose raw video is gone.
|
|
429
|
+
*/
|
|
430
|
+
const editRecording = Effect.fn("SessionHttp.editRecording")((address, id, options = {}) => json(address, make$2`/recordings/${id}/edit`, {
|
|
431
|
+
method: "POST",
|
|
432
|
+
json: options
|
|
433
|
+
}));
|
|
434
|
+
const getPace = Effect.fn("SessionHttp.getPace")((address) => json(address, "/pace").pipe(Effect.map((told) => told.pace)));
|
|
435
|
+
/** Sets the session's pace, for every recording and whoever watches. */
|
|
436
|
+
const setPace = Effect.fn("SessionHttp.setPace")((address, pace) => json(address, "/pace", {
|
|
437
|
+
method: "PUT",
|
|
438
|
+
json: { pace }
|
|
439
|
+
}).pipe(Effect.map((told) => told.pace)));
|
|
440
|
+
/** Has a running recording go on with another tab, in the same video. */
|
|
441
|
+
const retargetRecording = Effect.fn("SessionHttp.retargetRecording")((address, id, tab) => json(address, make$2`/recordings/${id}/retarget`, {
|
|
442
|
+
method: "POST",
|
|
443
|
+
json: { tab }
|
|
444
|
+
}));
|
|
445
|
+
/** Adds an annotation to a running recording: the one named, or the only one that runs. */
|
|
446
|
+
const annotateRecording = Effect.fn("SessionHttp.annotateRecording")((address, annotation, id) => {
|
|
447
|
+
const { kind, ...given } = annotation;
|
|
448
|
+
return request(address, make$2`/recordings/annotations/${kind}`, {
|
|
449
|
+
method: "POST",
|
|
450
|
+
json: id === void 0 ? given : {
|
|
451
|
+
...given,
|
|
452
|
+
id
|
|
453
|
+
}
|
|
454
|
+
}).pipe(Effect.asVoid);
|
|
455
|
+
});
|
|
456
|
+
/** Takes cookies and the storage of origins out of the session's browser. */
|
|
457
|
+
const exportStorageState = Effect.fn("SessionHttp.exportStorageState")((address, asked = {}) => json(address, "/storage-state", {
|
|
458
|
+
method: "POST",
|
|
459
|
+
json: asked
|
|
460
|
+
}));
|
|
461
|
+
/**
|
|
462
|
+
* Puts cookies and the storage of origins into the session's browser: the cookies beside
|
|
463
|
+
* those there are, each origin's local storage in place of what the origin had, and each
|
|
464
|
+
* of its databases in place of the origin's one of that name.
|
|
465
|
+
*/
|
|
466
|
+
const importStorageState = Effect.fn("SessionHttp.importStorageState")((address, state) => request(address, "/storage-state", {
|
|
467
|
+
method: "PUT",
|
|
468
|
+
json: state
|
|
469
|
+
}).pipe(Effect.asVoid));
|
|
470
|
+
const listScreenshots = Effect.fn("SessionHttp.listScreenshots")((address) => json(address, "/screenshots"));
|
|
471
|
+
/** Takes a screenshot of a tab, the newest one when none is named, and keeps it. */
|
|
472
|
+
const takeScreenshot = Effect.fn("SessionHttp.takeScreenshot")((address, tab) => json(address, "/screenshots", {
|
|
473
|
+
method: "POST",
|
|
474
|
+
json: { tab }
|
|
475
|
+
}));
|
|
476
|
+
//#endregion
|
|
477
|
+
//#region src/gen/aperture/live/v1/live_pb.ts
|
|
478
|
+
var live_pb_exports = /* @__PURE__ */ __exportAll({
|
|
479
|
+
Along: () => Along,
|
|
480
|
+
AlongSchema: () => AlongSchema,
|
|
481
|
+
Asked: () => Asked,
|
|
482
|
+
AskedSchema: () => AskedSchema,
|
|
483
|
+
AudioFrameSchema: () => AudioFrameSchema,
|
|
484
|
+
ClientMessageSchema: () => ClientMessageSchema,
|
|
485
|
+
ClipboardSchema: () => ClipboardSchema,
|
|
486
|
+
Clipboard_FormSchema: () => Clipboard_FormSchema,
|
|
487
|
+
CloseSchema: () => CloseSchema,
|
|
488
|
+
CopyPictureSchema: () => CopyPictureSchema,
|
|
489
|
+
CursorSchema: () => CursorSchema,
|
|
490
|
+
Cursor_HiddenSchema: () => Cursor_HiddenSchema,
|
|
491
|
+
DeviceSchema: () => DeviceSchema,
|
|
492
|
+
DownloadSchema: () => DownloadSchema,
|
|
493
|
+
DownloadState: () => DownloadState,
|
|
494
|
+
DownloadStateSchema: () => DownloadStateSchema,
|
|
495
|
+
DownloadsSchema: () => DownloadsSchema,
|
|
496
|
+
DrawSchema: () => DrawSchema,
|
|
497
|
+
DropSchema: () => DropSchema,
|
|
498
|
+
FailedSchema: () => FailedSchema,
|
|
499
|
+
FeaturesSchema: () => FeaturesSchema,
|
|
500
|
+
FileRequestSchema: () => FileRequestSchema,
|
|
501
|
+
FileRequestsSchema: () => FileRequestsSchema,
|
|
502
|
+
FilesChosenSchema: () => FilesChosenSchema,
|
|
503
|
+
FollowSchema: () => FollowSchema,
|
|
504
|
+
GoSchema: () => GoSchema,
|
|
505
|
+
GrantSchema: () => GrantSchema,
|
|
506
|
+
HeldTabSchema: () => HeldTabSchema,
|
|
507
|
+
HelloSchema: () => HelloSchema,
|
|
508
|
+
KeySchema: () => KeySchema,
|
|
509
|
+
LeaseAction: () => LeaseAction,
|
|
510
|
+
LeaseActionSchema: () => LeaseActionSchema,
|
|
511
|
+
LeaseSchema: () => LeaseSchema,
|
|
512
|
+
MemberSchema: () => MemberSchema,
|
|
513
|
+
MenuSchema: () => MenuSchema,
|
|
514
|
+
MouseButton: () => MouseButton,
|
|
515
|
+
MouseButtonSchema: () => MouseButtonSchema,
|
|
516
|
+
Pace: () => Pace,
|
|
517
|
+
PaceSchema: () => PaceSchema,
|
|
518
|
+
PacedSchema: () => PacedSchema,
|
|
519
|
+
PageMode: () => PageMode,
|
|
520
|
+
PageModeSchema: () => PageModeSchema,
|
|
521
|
+
Pixels: () => Pixels,
|
|
522
|
+
PixelsSchema: () => PixelsSchema,
|
|
523
|
+
PointSchema: () => PointSchema,
|
|
524
|
+
PointerButtonSchema: () => PointerButtonSchema,
|
|
525
|
+
PointerLeaveSchema: () => PointerLeaveSchema,
|
|
526
|
+
PointerMotionSchema: () => PointerMotionSchema,
|
|
527
|
+
PointerSchema: () => PointerSchema,
|
|
528
|
+
PointerScrollSchema: () => PointerScrollSchema,
|
|
529
|
+
PointingSchema: () => PointingSchema,
|
|
530
|
+
PresenceSchema: () => PresenceSchema,
|
|
531
|
+
RestoringSchema: () => RestoringSchema,
|
|
532
|
+
Role: () => Role,
|
|
533
|
+
RoleSchema: () => RoleSchema,
|
|
534
|
+
RtcAnswerSchema: () => RtcAnswerSchema,
|
|
535
|
+
RtcOfferSchema: () => RtcOfferSchema,
|
|
536
|
+
RtcRefusedSchema: () => RtcRefusedSchema,
|
|
537
|
+
SelectSchema: () => SelectSchema,
|
|
538
|
+
SelectedSchema: () => SelectedSchema,
|
|
539
|
+
ServerMessageSchema: () => ServerMessageSchema,
|
|
540
|
+
SetModeSchema: () => SetModeSchema,
|
|
541
|
+
StrokePhase: () => StrokePhase,
|
|
542
|
+
StrokePhaseSchema: () => StrokePhaseSchema,
|
|
543
|
+
StrokeSchema: () => StrokeSchema,
|
|
544
|
+
TargetSchema: () => TargetSchema,
|
|
545
|
+
TargetsSchema: () => TargetsSchema,
|
|
546
|
+
TextSchema: () => TextSchema,
|
|
547
|
+
TileSchema: () => TileSchema,
|
|
548
|
+
VideoFormat: () => VideoFormat,
|
|
549
|
+
VideoFormatSchema: () => VideoFormatSchema,
|
|
550
|
+
VideoFrameSchema: () => VideoFrameSchema,
|
|
551
|
+
VideoQuality: () => VideoQuality,
|
|
552
|
+
VideoQualitySchema: () => VideoQualitySchema,
|
|
553
|
+
VideoShownSchema: () => VideoShownSchema,
|
|
554
|
+
VideoStatusSchema: () => VideoStatusSchema,
|
|
555
|
+
ViewportSchema: () => ViewportSchema,
|
|
556
|
+
file_aperture_live_v1_live: () => file_aperture_live_v1_live
|
|
557
|
+
});
|
|
558
|
+
/**
|
|
559
|
+
* Describes the file aperture/live/v1/live.proto.
|
|
560
|
+
*/
|
|
561
|
+
const file_aperture_live_v1_live = /*@__PURE__*/ fileDesc("ChthcGVydHVyZS9saXZlL3YxL2xpdmUucHJvdG8SEGFwZXJ0dXJlLmxpdmUudjEi3QgKDUNsaWVudE1lc3NhZ2USKgoGc2VsZWN0GAEgASgLMhguYXBlcnR1cmUubGl2ZS52MS5TZWxlY3RIABI5Cg5wb2ludGVyX21vdGlvbhgCIAEoCzIfLmFwZXJ0dXJlLmxpdmUudjEuUG9pbnRlck1vdGlvbkgAEjkKDnBvaW50ZXJfYnV0dG9uGAMgASgLMh8uYXBlcnR1cmUubGl2ZS52MS5Qb2ludGVyQnV0dG9uSAASOQoOcG9pbnRlcl9zY3JvbGwYBCABKAsyHy5hcGVydHVyZS5saXZlLnYxLlBvaW50ZXJTY3JvbGxIABI3Cg1wb2ludGVyX2xlYXZlGAUgASgLMh4uYXBlcnR1cmUubGl2ZS52MS5Qb2ludGVyTGVhdmVIABIkCgNrZXkYBiABKAsyFS5hcGVydHVyZS5saXZlLnYxLktleUgAEiYKBHRleHQYByABKAsyFi5hcGVydHVyZS5saXZlLnYxLlRleHRIABIuCgh2aWV3cG9ydBgIIAEoCzIaLmFwZXJ0dXJlLmxpdmUudjEuVmlld3BvcnRIABIoCgVoZWxsbxgJIAEoCzIXLmFwZXJ0dXJlLmxpdmUudjEuSGVsbG9IABIvCglydGNfb2ZmZXIYCiABKAsyGi5hcGVydHVyZS5saXZlLnYxLlJ0Y09mZmVySAASMwoLdmlkZW9fc2hvd24YCyABKAsyHC5hcGVydHVyZS5saXZlLnYxLlZpZGVvU2hvd25IABIwCgljbGlwYm9hcmQYDCABKAsyGy5hcGVydHVyZS5saXZlLnYxLkNsaXBib2FyZEgAEiYKBGRyb3AYDSABKAsyFi5hcGVydHVyZS5saXZlLnYxLkRyb3BIABI1CgxmaWxlc19jaG9zZW4YDiABKAsyHS5hcGVydHVyZS5saXZlLnYxLkZpbGVzQ2hvc2VuSAASKAoFbGVhc2UYDyABKAsyFy5hcGVydHVyZS5saXZlLnYxLkxlYXNlSAASIgoCZ28YECABKAsyFC5hcGVydHVyZS5saXZlLnYxLkdvSAASNQoMY29weV9waWN0dXJlGBEgASgLMh0uYXBlcnR1cmUubGl2ZS52MS5Db3B5UGljdHVyZUgAEigKBWNsb3NlGBIgASgLMhcuYXBlcnR1cmUubGl2ZS52MS5DbG9zZUgAEioKBmZvbGxvdxgTIAEoCzIYLmFwZXJ0dXJlLmxpdmUudjEuRm9sbG93SAASJgoEZHJhdxgUIAEoCzIWLmFwZXJ0dXJlLmxpdmUudjEuRHJhd0gAEi4KCHBvaW50aW5nGBUgASgLMhouYXBlcnR1cmUubGl2ZS52MS5Qb2ludGluZ0gAEioKBmRldmljZRgWIAEoCzIYLmFwZXJ0dXJlLmxpdmUudjEuRGV2aWNlSAASLQoIc2V0X21vZGUYFyABKAsyGS5hcGVydHVyZS5saXZlLnYxLlNldE1vZGVIAEIJCgdtZXNzYWdlItYHCg1TZXJ2ZXJNZXNzYWdlEiwKB3RhcmdldHMYASABKAsyGS5hcGVydHVyZS5saXZlLnYxLlRhcmdldHNIABIuCghzZWxlY3RlZBgCIAEoCzIaLmFwZXJ0dXJlLmxpdmUudjEuU2VsZWN0ZWRIABIqCgZjdXJzb3IYAyABKAsyGC5hcGVydHVyZS5saXZlLnYxLkN1cnNvckgAEjEKCnJ0Y19hbnN3ZXIYBCABKAsyGy5hcGVydHVyZS5saXZlLnYxLlJ0Y0Fuc3dlckgAEiYKBHRpbGUYBSABKAsyFi5hcGVydHVyZS5saXZlLnYxLlRpbGVIABIzCgtydGNfcmVmdXNlZBgGIAEoCzIcLmFwZXJ0dXJlLmxpdmUudjEuUnRjUmVmdXNlZEgAEjMKC3ZpZGVvX2ZyYW1lGAcgASgLMhwuYXBlcnR1cmUubGl2ZS52MS5WaWRlb0ZyYW1lSAASNQoMdmlkZW9fc3RhdHVzGAggASgLMh0uYXBlcnR1cmUubGl2ZS52MS5WaWRlb1N0YXR1c0gAEjAKCWNsaXBib2FyZBgJIAEoCzIbLmFwZXJ0dXJlLmxpdmUudjEuQ2xpcGJvYXJkSAASMAoJZG93bmxvYWRzGAogASgLMhsuYXBlcnR1cmUubGl2ZS52MS5Eb3dubG9hZHNIABI3Cg1maWxlX3JlcXVlc3RzGAsgASgLMh4uYXBlcnR1cmUubGl2ZS52MS5GaWxlUmVxdWVzdHNIABIuCghwcmVzZW5jZRgMIAEoCzIaLmFwZXJ0dXJlLmxpdmUudjEuUHJlc2VuY2VIABImCgRtZW51GA0gASgLMhYuYXBlcnR1cmUubGl2ZS52MS5NZW51SAASLQoFYXVkaW8YDiABKAsyHC5hcGVydHVyZS5saXZlLnYxLkF1ZGlvRnJhbWVIABIuCghmZWF0dXJlcxgPIAEoCzIaLmFwZXJ0dXJlLmxpdmUudjEuRmVhdHVyZXNIABIqCgZmYWlsZWQYECABKAsyGC5hcGVydHVyZS5saXZlLnYxLkZhaWxlZEgAEiwKB3BvaW50ZXIYESABKAsyGS5hcGVydHVyZS5saXZlLnYxLlBvaW50ZXJIABIqCgZzdHJva2UYEiABKAsyGC5hcGVydHVyZS5saXZlLnYxLlN0cm9rZUgAEigKBXBhY2VkGBMgASgLMhcuYXBlcnR1cmUubGl2ZS52MS5QYWNlZEgAEjAKCXJlc3RvcmluZxgUIAEoCzIbLmFwZXJ0dXJlLmxpdmUudjEuUmVzdG9yaW5nSABCCQoHbWVzc2FnZSJvCglSZXN0b3JpbmcSEAoIdW5kZXJ3YXkYASABKAgSDAoEdGFicxgCIAEoDRIPCgdjb29raWVzGAMgASgNEg8KB29yaWdpbnMYBCABKA0SFAoHZmFpbHVyZRgFIAEoCUgAiAEBQgoKCF9mYWlsdXJlIi0KBVBhY2VkEiQKBHBhY2UYASABKA4yFi5hcGVydHVyZS5saXZlLnYxLlBhY2UizQMKCEZlYXR1cmVzEiYKBWlucHV0GAkgASgLMhcuYXBlcnR1cmUubGl2ZS52MS5HcmFudBIlCgR0YWJzGAogASgLMhcuYXBlcnR1cmUubGl2ZS52MS5HcmFudBImCgVsZWFzZRgLIAEoCzIXLmFwZXJ0dXJlLmxpdmUudjEuR3JhbnQSJgoFc291bmQYASABKAsyFy5hcGVydHVyZS5saXZlLnYxLkdyYW50EigKB3VwbG9hZHMYAiABKAsyFy5hcGVydHVyZS5saXZlLnYxLkdyYW50EioKCWRvd25sb2FkcxgDIAEoCzIXLmFwZXJ0dXJlLmxpdmUudjEuR3JhbnQSKwoKcmVjb3JkaW5ncxgEIAEoCzIXLmFwZXJ0dXJlLmxpdmUudjEuR3JhbnQSKgoJY2xpcGJvYXJkGAUgASgLMhcuYXBlcnR1cmUubGl2ZS52MS5HcmFudBIkCgNtY3AYBiABKAsyFy5hcGVydHVyZS5saXZlLnYxLkdyYW50EiQKA2NkcBgHIAEoCzIXLmFwZXJ0dXJlLmxpdmUudjEuR3JhbnQSJwoGdHVubmVsGAggASgLMhcuYXBlcnR1cmUubGl2ZS52MS5HcmFudCIkCgVHcmFudBIMCgRyZWFkGAEgASgIEg0KBXdyaXRlGAIgASgIIrsBCgVIZWxsbxIoCgZwaXhlbHMYASABKA4yGC5hcGVydHVyZS5saXZlLnYxLlBpeGVscxIuCgdmb3JtYXRzGAIgAygOMh0uYXBlcnR1cmUubGl2ZS52MS5WaWRlb0Zvcm1hdBIvCgdxdWFsaXR5GAMgASgOMh4uYXBlcnR1cmUubGl2ZS52MS5WaWRlb1F1YWxpdHkSEAoDZnBzGAQgASgNSACIAQESDQoFYXVkaW8YBSABKAhCBgoEX2ZwcyJ6CgtWaWRlb1N0YXR1cxItCgZmb3JtYXQYASABKA4yHS5hcGVydHVyZS5saXZlLnYxLlZpZGVvRm9ybWF0Ei8KB3F1YWxpdHkYAiABKA4yHi5hcGVydHVyZS5saXZlLnYxLlZpZGVvUXVhbGl0eRILCgNmcHMYAyABKA0iKwoKQXVkaW9GcmFtZRIPCgd0aW1lX3VzGAEgASgEEgwKBGRhdGEYAiABKAwiHQoKVmlkZW9TaG93bhIPCgd0aW1lX3VzGAEgASgEIhcKCFJ0Y09mZmVyEgsKA3NkcBgBIAEoCSIYCglSdGNBbnN3ZXISCwoDc2RwGAEgASgJIhwKClJ0Y1JlZnVzZWQSDgoGcmVhc29uGAEgASgJIpgBCgpWaWRlb0ZyYW1lEgsKA3RhYhgBIAEoDRIQCghrZXlmcmFtZRgCIAEoCBIPCgd0aW1lX3VzGAMgASgEEgwKBGRhdGEYBCABKAwSLQoGZm9ybWF0GAUgASgOMh0uYXBlcnR1cmUubGl2ZS52MS5WaWRlb0Zvcm1hdBINCgV3aWR0aBgGIAEoDRIOCgZoZWlnaHQYByABKA0iVQoEVGlsZRILCgN0YWIYASABKA0SCQoBeBgCIAEoDRIJCgF5GAMgASgNEg0KBXdpZHRoGAQgASgNEg4KBmhlaWdodBgFIAEoDRILCgNwbmcYBiABKAwiFQoGU2VsZWN0EgsKA3RhYhgBIAEoDSIlCg1Qb2ludGVyTW90aW9uEgkKAXgYASABKAESCQoBeRgCIAEoASJlCg1Qb2ludGVyQnV0dG9uEgkKAXgYASABKAESCQoBeRgCIAEoARItCgZidXR0b24YAyABKA4yHS5hcGVydHVyZS5saXZlLnYxLk1vdXNlQnV0dG9uEg8KB3ByZXNzZWQYBCABKAgiPQoNUG9pbnRlclNjcm9sbBIJCgF4GAEgASgBEgkKAXkYAiABKAESCgoCZHgYAyABKAESCgoCZHkYBCABKAEiDgoMUG9pbnRlckxlYXZlIiQKA0tleRIMCgRjb2RlGAEgASgNEg8KB3ByZXNzZWQYAiABKAgiJwoEVGV4dBIMCgR0ZXh0GAEgASgJEhEKCWNvbXBvc2luZxgCIAEoCCI6CglEb3dubG9hZHMSLQoJZG93bmxvYWRzGAEgAygLMhouYXBlcnR1cmUubGl2ZS52MS5Eb3dubG9hZCKjAQoIRG93bmxvYWQSCgoCaWQYASABKAkSDAoEbmFtZRgCIAEoCRILCgN1cmwYAyABKAkSFgoOcmVjZWl2ZWRfYnl0ZXMYBCABKAQSGAoLdG90YWxfYnl0ZXMYBSABKARIAIgBARIuCgVzdGF0ZRgGIAEoDjIfLmFwZXJ0dXJlLmxpdmUudjEuRG93bmxvYWRTdGF0ZUIOCgxfdG90YWxfYnl0ZXMiawoIUHJlc2VuY2USCwoDeW91GAEgASgEEikKB21lbWJlcnMYAiADKAsyGC5hcGVydHVyZS5saXZlLnYxLk1lbWJlchInCgRoZWxkGAMgAygLMhkuYXBlcnR1cmUubGl2ZS52MS5IZWxkVGFiIpMBCgZNZW1iZXISCgoCaWQYASABKAQSDAoEbmFtZRgCIAEoCRIkCgRyb2xlGAMgASgOMhYuYXBlcnR1cmUubGl2ZS52MS5Sb2xlEhAKA3RhYhgEIAEoDUgAiAEBEg0KBWFnZW50GAUgASgIEhQKB2ZvbGxvd3MYBiABKARIAYgBAUIGCgRfdGFiQgoKCF9mb2xsb3dzIigKBkZvbGxvdxITCgZtZW1iZXIYASABKARIAIgBAUIJCgdfbWVtYmVyIkoKB1BvaW50ZXISDgoGbWVtYmVyGAEgASgEEigKAmF0GAIgASgLMhcuYXBlcnR1cmUubGl2ZS52MS5Qb2ludEgAiAEBQgUKA19hdCIdCgVQb2ludBIJCgF4GAEgASgBEgkKAXkYAiABKAEiOwoIUG9pbnRpbmcSKAoCYXQYASABKAsyFy5hcGVydHVyZS5saXZlLnYxLlBvaW50SACIAQFCBQoDX2F0IloKBERyYXcSDgoGc3Ryb2tlGAEgASgNEiwKBXBoYXNlGAIgASgOMh0uYXBlcnR1cmUubGl2ZS52MS5TdHJva2VQaGFzZRIJCgF4GAMgASgBEgkKAXkYBCABKAEibAoGU3Ryb2tlEg4KBm1lbWJlchgBIAEoBBIOCgZzdHJva2UYAiABKA0SLAoFcGhhc2UYAyABKA4yHS5hcGVydHVyZS5saXZlLnYxLlN0cm9rZVBoYXNlEgkKAXgYBCABKAESCQoBeRgFIAEoASJKCgdIZWxkVGFiEgsKA3RhYhgBIAEoDRIOCgZob2xkZXIYAiABKAQSFQoIYXNrZWRfYnkYAyABKARIAIgBAUILCglfYXNrZWRfYnkiNgoFTGVhc2USLQoGYWN0aW9uGAEgASgOMh0uYXBlcnR1cmUubGl2ZS52MS5MZWFzZUFjdGlvbiJuCgRNZW51EhEKBGxpbmsYASABKAlIAIgBARISCgVpbWFnZRgCIAEoCUgBiAEBEhEKBHRleHQYAyABKAlIAogBARIQCghlZGl0YWJsZRgEIAEoCEIHCgVfbGlua0IICgZfaW1hZ2VCBwoFX3RleHQiVAoCR28SDQoDdXJsGAEgASgJSAASKAoFYWxvbmcYAiABKA4yFy5hcGVydHVyZS5saXZlLnYxLkFsb25nSAASDwoHbmV3X3RhYhgDIAEoCEIECgJ0byIUCgVDbG9zZRILCgN0YWIYASABKA0iQAoGRmFpbGVkEiYKBWFza2VkGAEgASgOMhcuYXBlcnR1cmUubGl2ZS52MS5Bc2tlZBIOCgZyZWFzb24YAiABKAkiFwoGRGV2aWNlEg0KBXBob25lGAEgASgIIjMKB1NldE1vZGUSKAoEbW9kZRgBIAEoDjIaLmFwZXJ0dXJlLmxpdmUudjEuUGFnZU1vZGUiGgoLQ29weVBpY3R1cmUSCwoDdXJsGAEgASgJIj8KDEZpbGVSZXF1ZXN0cxIvCghyZXF1ZXN0cxgBIAMoCzIdLmFwZXJ0dXJlLmxpdmUudjEuRmlsZVJlcXVlc3QiOAoLRmlsZVJlcXVlc3QSCgoCaWQYASABKAQSCwoDdGFiGAIgASgNEhAKCG11bHRpcGxlGAMgASgIIigKC0ZpbGVzQ2hvc2VuEgoKAmlkGAEgASgEEg0KBWZpbGVzGAIgAygJIkoKBERyb3ASCQoBeBgBIAEoARIJCgF5GAIgASgBEiwKB2NvbnRlbnQYAyABKAsyGy5hcGVydHVyZS5saXZlLnYxLkNsaXBib2FyZCJgCglDbGlwYm9hcmQSLwoFZm9ybXMYASADKAsyIC5hcGVydHVyZS5saXZlLnYxLkNsaXBib2FyZC5Gb3JtGiIKBEZvcm0SDAoEdHlwZRgBIAEoCRIMCgRkYXRhGAIgASgMIkcKCFZpZXdwb3J0Eg0KBXdpZHRoGAEgASgNEg4KBmhlaWdodBgCIAEoDRISCgVzY2FsZRgDIAEoAUgAiAEBQggKBl9zY2FsZSLeAQoGVGFyZ2V0EgoKAmlkGAEgASgJEg0KBXRpdGxlGAIgASgJEgsKA3VybBgDIAEoCRINCgV3aWR0aBgEIAEoDRIOCgZoZWlnaHQYBSABKA0SDQoFc2NhbGUYBiABKAESCwoDdGFiGAcgASgNEg4KBnNvdW5kcxgIIAEoCBIRCglnb2VzX2JhY2sYCSABKAgSFAoMZ29lc19mb3J3YXJkGAogASgIEigKBG1vZGUYCyABKA4yGi5hcGVydHVyZS5saXZlLnYxLlBhZ2VNb2RlEg4KBm1vYmlsZRgMIAEoCCI0CgdUYXJnZXRzEikKB3RhcmdldHMYASADKAsyGC5hcGVydHVyZS5saXZlLnYxLlRhcmdldCIkCghTZWxlY3RlZBIQCgN0YWIYASABKA1IAIgBAUIGCgRfdGFiImAKBkN1cnNvchIPCgVuYW1lZBgBIAEoCUgAEjEKBmhpZGRlbhgCIAEoCzIfLmFwZXJ0dXJlLmxpdmUudjEuQ3Vyc29yLkhpZGRlbkgAGggKBkhpZGRlbkIICgZjdXJzb3IqTAoEUGFjZRIUChBQQUNFX1VOU1BFQ0lGSUVEEAASEAoMUEFDRV9JTlNUQU5UEAESDQoJUEFDRV9GQVNUEAISDQoJUEFDRV9TTE9XEAMqxQEKC1ZpZGVvRm9ybWF0EhwKGFZJREVPX0ZPUk1BVF9VTlNQRUNJRklFRBAAEhUKEVZJREVPX0ZPUk1BVF9IMjY0EAESHAoYVklERU9fRk9STUFUX0ZVTExfQ0hST01BEAISFQoRVklERU9fRk9STUFUX0gyNjUQAxIUChBWSURFT19GT1JNQVRfVlA5EAQSIAocVklERU9fRk9STUFUX1ZQOV9GVUxMX0NIUk9NQRAFEhQKEFZJREVPX0ZPUk1BVF9BVjEQBip2CgxWaWRlb1F1YWxpdHkSHQoZVklERU9fUVVBTElUWV9VTlNQRUNJRklFRBAAEhUKEVZJREVPX1FVQUxJVFlfTE9XEAESGAoUVklERU9fUVVBTElUWV9NRURJVU0QAhIWChJWSURFT19RVUFMSVRZX0ZVTEwQAypXCgZQaXhlbHMSFgoSUElYRUxTX1VOU1BFQ0lGSUVEEAASEAoMUElYRUxTX1ZJREVPEAESEAoMUElYRUxTX1RJTEVTEAISEQoNUElYRUxTX0ZSQU1FUxADKqQBCgtNb3VzZUJ1dHRvbhIcChhNT1VTRV9CVVRUT05fVU5TUEVDSUZJRUQQABIVChFNT1VTRV9CVVRUT05fTEVGVBABEhYKEk1PVVNFX0JVVFRPTl9SSUdIVBACEhcKE01PVVNFX0JVVFRPTl9NSURETEUQAxIVChFNT1VTRV9CVVRUT05fQkFDSxAEEhgKFE1PVVNFX0JVVFRPTl9GT1JXQVJEEAUqfwoNRG93bmxvYWRTdGF0ZRIeChpET1dOTE9BRF9TVEFURV9VTlNQRUNJRklFRBAAEhoKFkRPV05MT0FEX1NUQVRFX1JVTk5JTkcQARIXChNET1dOTE9BRF9TVEFURV9ET05FEAISGQoVRE9XTkxPQURfU1RBVEVfRkFJTEVEEAMqcAoLU3Ryb2tlUGhhc2USHAoYU1RST0tFX1BIQVNFX1VOU1BFQ0lGSUVEEAASFgoSU1RST0tFX1BIQVNFX1NUQVJUEAESFQoRU1RST0tFX1BIQVNFX01PVkUQAhIUChBTVFJPS0VfUEhBU0VfRU5EEAMqTQoEUm9sZRIUChBST0xFX1VOU1BFQ0lGSUVEEAASDQoJUk9MRV9WSUVXEAESEAoMUk9MRV9DT05UUk9MEAISDgoKUk9MRV9BRE1JThADKosBCgtMZWFzZUFjdGlvbhIcChhMRUFTRV9BQ1RJT05fVU5TUEVDSUZJRUQQABIVChFMRUFTRV9BQ1RJT05fVEFLRRABEhgKFExFQVNFX0FDVElPTl9SRUxFQVNFEAISFgoSTEVBU0VfQUNUSU9OX0FMTE9XEAMSFQoRTEVBU0VfQUNUSU9OX0tFRVAQBCpTCgVBbG9uZxIVChFBTE9OR19VTlNQRUNJRklFRBAAEg4KCkFMT05HX0JBQ0sQARIRCg1BTE9OR19GT1JXQVJEEAISEAoMQUxPTkdfUkVMT0FEEAMqkwEKBUFza2VkEhUKEUFTS0VEX1VOU1BFQ0lGSUVEEAASDAoIQVNLRURfR08QARIPCgtBU0tFRF9DTE9TRRACEhYKEkFTS0VEX0NPUFlfUElDVFVSRRADEhYKEkFTS0VEX0ZJTEVTX0NIT1NFThAEEhAKDEFTS0VEX0ZPTExPVxAFEhIKDkFTS0VEX1NFVF9NT0RFEAYqZgoIUGFnZU1vZGUSGQoVUEFHRV9NT0RFX1VOU1BFQ0lGSUVEEAASEgoOUEFHRV9NT0RFX0FVVE8QARIVChFQQUdFX01PREVfREVTS1RPUBACEhQKEFBBR0VfTU9ERV9NT0JJTEUQA2IGcHJvdG8z");
|
|
562
|
+
/**
|
|
563
|
+
* Describes the message aperture.live.v1.ClientMessage.
|
|
564
|
+
* Use `create(ClientMessageSchema)` to create a new message.
|
|
565
|
+
*/
|
|
566
|
+
const ClientMessageSchema = /*@__PURE__*/ messageDesc(file_aperture_live_v1_live, 0);
|
|
567
|
+
/**
|
|
568
|
+
* Describes the message aperture.live.v1.ServerMessage.
|
|
569
|
+
* Use `create(ServerMessageSchema)` to create a new message.
|
|
570
|
+
*/
|
|
571
|
+
const ServerMessageSchema = /*@__PURE__*/ messageDesc(file_aperture_live_v1_live, 1);
|
|
572
|
+
/**
|
|
573
|
+
* Describes the message aperture.live.v1.Restoring.
|
|
574
|
+
* Use `create(RestoringSchema)` to create a new message.
|
|
575
|
+
*/
|
|
576
|
+
const RestoringSchema = /*@__PURE__*/ messageDesc(file_aperture_live_v1_live, 2);
|
|
577
|
+
/**
|
|
578
|
+
* Describes the message aperture.live.v1.Paced.
|
|
579
|
+
* Use `create(PacedSchema)` to create a new message.
|
|
580
|
+
*/
|
|
581
|
+
const PacedSchema = /*@__PURE__*/ messageDesc(file_aperture_live_v1_live, 3);
|
|
582
|
+
/**
|
|
583
|
+
* Describes the message aperture.live.v1.Features.
|
|
584
|
+
* Use `create(FeaturesSchema)` to create a new message.
|
|
585
|
+
*/
|
|
586
|
+
const FeaturesSchema = /*@__PURE__*/ messageDesc(file_aperture_live_v1_live, 4);
|
|
587
|
+
/**
|
|
588
|
+
* Describes the message aperture.live.v1.Grant.
|
|
589
|
+
* Use `create(GrantSchema)` to create a new message.
|
|
590
|
+
*/
|
|
591
|
+
const GrantSchema = /*@__PURE__*/ messageDesc(file_aperture_live_v1_live, 5);
|
|
592
|
+
/**
|
|
593
|
+
* Describes the message aperture.live.v1.Hello.
|
|
594
|
+
* Use `create(HelloSchema)` to create a new message.
|
|
595
|
+
*/
|
|
596
|
+
const HelloSchema = /*@__PURE__*/ messageDesc(file_aperture_live_v1_live, 6);
|
|
597
|
+
/**
|
|
598
|
+
* Describes the message aperture.live.v1.VideoStatus.
|
|
599
|
+
* Use `create(VideoStatusSchema)` to create a new message.
|
|
600
|
+
*/
|
|
601
|
+
const VideoStatusSchema = /*@__PURE__*/ messageDesc(file_aperture_live_v1_live, 7);
|
|
602
|
+
/**
|
|
603
|
+
* Describes the message aperture.live.v1.AudioFrame.
|
|
604
|
+
* Use `create(AudioFrameSchema)` to create a new message.
|
|
605
|
+
*/
|
|
606
|
+
const AudioFrameSchema = /*@__PURE__*/ messageDesc(file_aperture_live_v1_live, 8);
|
|
607
|
+
/**
|
|
608
|
+
* Describes the message aperture.live.v1.VideoShown.
|
|
609
|
+
* Use `create(VideoShownSchema)` to create a new message.
|
|
610
|
+
*/
|
|
611
|
+
const VideoShownSchema = /*@__PURE__*/ messageDesc(file_aperture_live_v1_live, 9);
|
|
612
|
+
/**
|
|
613
|
+
* Describes the message aperture.live.v1.RtcOffer.
|
|
614
|
+
* Use `create(RtcOfferSchema)` to create a new message.
|
|
615
|
+
*/
|
|
616
|
+
const RtcOfferSchema = /*@__PURE__*/ messageDesc(file_aperture_live_v1_live, 10);
|
|
617
|
+
/**
|
|
618
|
+
* Describes the message aperture.live.v1.RtcAnswer.
|
|
619
|
+
* Use `create(RtcAnswerSchema)` to create a new message.
|
|
620
|
+
*/
|
|
621
|
+
const RtcAnswerSchema = /*@__PURE__*/ messageDesc(file_aperture_live_v1_live, 11);
|
|
622
|
+
/**
|
|
623
|
+
* Describes the message aperture.live.v1.RtcRefused.
|
|
624
|
+
* Use `create(RtcRefusedSchema)` to create a new message.
|
|
625
|
+
*/
|
|
626
|
+
const RtcRefusedSchema = /*@__PURE__*/ messageDesc(file_aperture_live_v1_live, 12);
|
|
627
|
+
/**
|
|
628
|
+
* Describes the message aperture.live.v1.VideoFrame.
|
|
629
|
+
* Use `create(VideoFrameSchema)` to create a new message.
|
|
630
|
+
*/
|
|
631
|
+
const VideoFrameSchema = /*@__PURE__*/ messageDesc(file_aperture_live_v1_live, 13);
|
|
632
|
+
/**
|
|
633
|
+
* Describes the message aperture.live.v1.Tile.
|
|
634
|
+
* Use `create(TileSchema)` to create a new message.
|
|
635
|
+
*/
|
|
636
|
+
const TileSchema = /*@__PURE__*/ messageDesc(file_aperture_live_v1_live, 14);
|
|
637
|
+
/**
|
|
638
|
+
* Describes the message aperture.live.v1.Select.
|
|
639
|
+
* Use `create(SelectSchema)` to create a new message.
|
|
640
|
+
*/
|
|
641
|
+
const SelectSchema = /*@__PURE__*/ messageDesc(file_aperture_live_v1_live, 15);
|
|
642
|
+
/**
|
|
643
|
+
* Describes the message aperture.live.v1.PointerMotion.
|
|
644
|
+
* Use `create(PointerMotionSchema)` to create a new message.
|
|
645
|
+
*/
|
|
646
|
+
const PointerMotionSchema = /*@__PURE__*/ messageDesc(file_aperture_live_v1_live, 16);
|
|
647
|
+
/**
|
|
648
|
+
* Describes the message aperture.live.v1.PointerButton.
|
|
649
|
+
* Use `create(PointerButtonSchema)` to create a new message.
|
|
650
|
+
*/
|
|
651
|
+
const PointerButtonSchema = /*@__PURE__*/ messageDesc(file_aperture_live_v1_live, 17);
|
|
652
|
+
/**
|
|
653
|
+
* Describes the message aperture.live.v1.PointerScroll.
|
|
654
|
+
* Use `create(PointerScrollSchema)` to create a new message.
|
|
655
|
+
*/
|
|
656
|
+
const PointerScrollSchema = /*@__PURE__*/ messageDesc(file_aperture_live_v1_live, 18);
|
|
657
|
+
/**
|
|
658
|
+
* Describes the message aperture.live.v1.PointerLeave.
|
|
659
|
+
* Use `create(PointerLeaveSchema)` to create a new message.
|
|
660
|
+
*/
|
|
661
|
+
const PointerLeaveSchema = /*@__PURE__*/ messageDesc(file_aperture_live_v1_live, 19);
|
|
662
|
+
/**
|
|
663
|
+
* Describes the message aperture.live.v1.Key.
|
|
664
|
+
* Use `create(KeySchema)` to create a new message.
|
|
665
|
+
*/
|
|
666
|
+
const KeySchema = /*@__PURE__*/ messageDesc(file_aperture_live_v1_live, 20);
|
|
667
|
+
/**
|
|
668
|
+
* Describes the message aperture.live.v1.Text.
|
|
669
|
+
* Use `create(TextSchema)` to create a new message.
|
|
670
|
+
*/
|
|
671
|
+
const TextSchema = /*@__PURE__*/ messageDesc(file_aperture_live_v1_live, 21);
|
|
672
|
+
/**
|
|
673
|
+
* Describes the message aperture.live.v1.Downloads.
|
|
674
|
+
* Use `create(DownloadsSchema)` to create a new message.
|
|
675
|
+
*/
|
|
676
|
+
const DownloadsSchema = /*@__PURE__*/ messageDesc(file_aperture_live_v1_live, 22);
|
|
677
|
+
/**
|
|
678
|
+
* Describes the message aperture.live.v1.Download.
|
|
679
|
+
* Use `create(DownloadSchema)` to create a new message.
|
|
680
|
+
*/
|
|
681
|
+
const DownloadSchema = /*@__PURE__*/ messageDesc(file_aperture_live_v1_live, 23);
|
|
682
|
+
/**
|
|
683
|
+
* Describes the message aperture.live.v1.Presence.
|
|
684
|
+
* Use `create(PresenceSchema)` to create a new message.
|
|
685
|
+
*/
|
|
686
|
+
const PresenceSchema = /*@__PURE__*/ messageDesc(file_aperture_live_v1_live, 24);
|
|
687
|
+
/**
|
|
688
|
+
* Describes the message aperture.live.v1.Member.
|
|
689
|
+
* Use `create(MemberSchema)` to create a new message.
|
|
690
|
+
*/
|
|
691
|
+
const MemberSchema = /*@__PURE__*/ messageDesc(file_aperture_live_v1_live, 25);
|
|
692
|
+
/**
|
|
693
|
+
* Describes the message aperture.live.v1.Follow.
|
|
694
|
+
* Use `create(FollowSchema)` to create a new message.
|
|
695
|
+
*/
|
|
696
|
+
const FollowSchema = /*@__PURE__*/ messageDesc(file_aperture_live_v1_live, 26);
|
|
697
|
+
/**
|
|
698
|
+
* Describes the message aperture.live.v1.Pointer.
|
|
699
|
+
* Use `create(PointerSchema)` to create a new message.
|
|
700
|
+
*/
|
|
701
|
+
const PointerSchema = /*@__PURE__*/ messageDesc(file_aperture_live_v1_live, 27);
|
|
702
|
+
/**
|
|
703
|
+
* Describes the message aperture.live.v1.Point.
|
|
704
|
+
* Use `create(PointSchema)` to create a new message.
|
|
705
|
+
*/
|
|
706
|
+
const PointSchema = /*@__PURE__*/ messageDesc(file_aperture_live_v1_live, 28);
|
|
707
|
+
/**
|
|
708
|
+
* Describes the message aperture.live.v1.Pointing.
|
|
709
|
+
* Use `create(PointingSchema)` to create a new message.
|
|
710
|
+
*/
|
|
711
|
+
const PointingSchema = /*@__PURE__*/ messageDesc(file_aperture_live_v1_live, 29);
|
|
712
|
+
/**
|
|
713
|
+
* Describes the message aperture.live.v1.Draw.
|
|
714
|
+
* Use `create(DrawSchema)` to create a new message.
|
|
715
|
+
*/
|
|
716
|
+
const DrawSchema = /*@__PURE__*/ messageDesc(file_aperture_live_v1_live, 30);
|
|
717
|
+
/**
|
|
718
|
+
* Describes the message aperture.live.v1.Stroke.
|
|
719
|
+
* Use `create(StrokeSchema)` to create a new message.
|
|
720
|
+
*/
|
|
721
|
+
const StrokeSchema = /*@__PURE__*/ messageDesc(file_aperture_live_v1_live, 31);
|
|
722
|
+
/**
|
|
723
|
+
* Describes the message aperture.live.v1.HeldTab.
|
|
724
|
+
* Use `create(HeldTabSchema)` to create a new message.
|
|
725
|
+
*/
|
|
726
|
+
const HeldTabSchema = /*@__PURE__*/ messageDesc(file_aperture_live_v1_live, 32);
|
|
727
|
+
/**
|
|
728
|
+
* Describes the message aperture.live.v1.Lease.
|
|
729
|
+
* Use `create(LeaseSchema)` to create a new message.
|
|
730
|
+
*/
|
|
731
|
+
const LeaseSchema = /*@__PURE__*/ messageDesc(file_aperture_live_v1_live, 33);
|
|
732
|
+
/**
|
|
733
|
+
* Describes the message aperture.live.v1.Menu.
|
|
734
|
+
* Use `create(MenuSchema)` to create a new message.
|
|
735
|
+
*/
|
|
736
|
+
const MenuSchema = /*@__PURE__*/ messageDesc(file_aperture_live_v1_live, 34);
|
|
737
|
+
/**
|
|
738
|
+
* Describes the message aperture.live.v1.Go.
|
|
739
|
+
* Use `create(GoSchema)` to create a new message.
|
|
740
|
+
*/
|
|
741
|
+
const GoSchema = /*@__PURE__*/ messageDesc(file_aperture_live_v1_live, 35);
|
|
742
|
+
/**
|
|
743
|
+
* Describes the message aperture.live.v1.Close.
|
|
744
|
+
* Use `create(CloseSchema)` to create a new message.
|
|
745
|
+
*/
|
|
746
|
+
const CloseSchema = /*@__PURE__*/ messageDesc(file_aperture_live_v1_live, 36);
|
|
747
|
+
/**
|
|
748
|
+
* Describes the message aperture.live.v1.Failed.
|
|
749
|
+
* Use `create(FailedSchema)` to create a new message.
|
|
750
|
+
*/
|
|
751
|
+
const FailedSchema = /*@__PURE__*/ messageDesc(file_aperture_live_v1_live, 37);
|
|
752
|
+
/**
|
|
753
|
+
* Describes the message aperture.live.v1.Device.
|
|
754
|
+
* Use `create(DeviceSchema)` to create a new message.
|
|
755
|
+
*/
|
|
756
|
+
const DeviceSchema = /*@__PURE__*/ messageDesc(file_aperture_live_v1_live, 38);
|
|
757
|
+
/**
|
|
758
|
+
* Describes the message aperture.live.v1.SetMode.
|
|
759
|
+
* Use `create(SetModeSchema)` to create a new message.
|
|
760
|
+
*/
|
|
761
|
+
const SetModeSchema = /*@__PURE__*/ messageDesc(file_aperture_live_v1_live, 39);
|
|
762
|
+
/**
|
|
763
|
+
* Describes the message aperture.live.v1.CopyPicture.
|
|
764
|
+
* Use `create(CopyPictureSchema)` to create a new message.
|
|
765
|
+
*/
|
|
766
|
+
const CopyPictureSchema = /*@__PURE__*/ messageDesc(file_aperture_live_v1_live, 40);
|
|
767
|
+
/**
|
|
768
|
+
* Describes the message aperture.live.v1.FileRequests.
|
|
769
|
+
* Use `create(FileRequestsSchema)` to create a new message.
|
|
770
|
+
*/
|
|
771
|
+
const FileRequestsSchema = /*@__PURE__*/ messageDesc(file_aperture_live_v1_live, 41);
|
|
772
|
+
/**
|
|
773
|
+
* Describes the message aperture.live.v1.FileRequest.
|
|
774
|
+
* Use `create(FileRequestSchema)` to create a new message.
|
|
775
|
+
*/
|
|
776
|
+
const FileRequestSchema = /*@__PURE__*/ messageDesc(file_aperture_live_v1_live, 42);
|
|
777
|
+
/**
|
|
778
|
+
* Describes the message aperture.live.v1.FilesChosen.
|
|
779
|
+
* Use `create(FilesChosenSchema)` to create a new message.
|
|
780
|
+
*/
|
|
781
|
+
const FilesChosenSchema = /*@__PURE__*/ messageDesc(file_aperture_live_v1_live, 43);
|
|
782
|
+
/**
|
|
783
|
+
* Describes the message aperture.live.v1.Drop.
|
|
784
|
+
* Use `create(DropSchema)` to create a new message.
|
|
785
|
+
*/
|
|
786
|
+
const DropSchema = /*@__PURE__*/ messageDesc(file_aperture_live_v1_live, 44);
|
|
787
|
+
/**
|
|
788
|
+
* Describes the message aperture.live.v1.Clipboard.
|
|
789
|
+
* Use `create(ClipboardSchema)` to create a new message.
|
|
790
|
+
*/
|
|
791
|
+
const ClipboardSchema = /*@__PURE__*/ messageDesc(file_aperture_live_v1_live, 45);
|
|
792
|
+
/**
|
|
793
|
+
* Describes the message aperture.live.v1.Clipboard.Form.
|
|
794
|
+
* Use `create(Clipboard_FormSchema)` to create a new message.
|
|
795
|
+
*/
|
|
796
|
+
const Clipboard_FormSchema = /*@__PURE__*/ messageDesc(file_aperture_live_v1_live, 45, 0);
|
|
797
|
+
/**
|
|
798
|
+
* Describes the message aperture.live.v1.Viewport.
|
|
799
|
+
* Use `create(ViewportSchema)` to create a new message.
|
|
800
|
+
*/
|
|
801
|
+
const ViewportSchema = /*@__PURE__*/ messageDesc(file_aperture_live_v1_live, 46);
|
|
802
|
+
/**
|
|
803
|
+
* Describes the message aperture.live.v1.Target.
|
|
804
|
+
* Use `create(TargetSchema)` to create a new message.
|
|
805
|
+
*/
|
|
806
|
+
const TargetSchema = /*@__PURE__*/ messageDesc(file_aperture_live_v1_live, 47);
|
|
807
|
+
/**
|
|
808
|
+
* Describes the message aperture.live.v1.Targets.
|
|
809
|
+
* Use `create(TargetsSchema)` to create a new message.
|
|
810
|
+
*/
|
|
811
|
+
const TargetsSchema = /*@__PURE__*/ messageDesc(file_aperture_live_v1_live, 48);
|
|
812
|
+
/**
|
|
813
|
+
* Describes the message aperture.live.v1.Selected.
|
|
814
|
+
* Use `create(SelectedSchema)` to create a new message.
|
|
815
|
+
*/
|
|
816
|
+
const SelectedSchema = /*@__PURE__*/ messageDesc(file_aperture_live_v1_live, 49);
|
|
817
|
+
/**
|
|
818
|
+
* Describes the message aperture.live.v1.Cursor.
|
|
819
|
+
* Use `create(CursorSchema)` to create a new message.
|
|
820
|
+
*/
|
|
821
|
+
const CursorSchema = /*@__PURE__*/ messageDesc(file_aperture_live_v1_live, 50);
|
|
822
|
+
/**
|
|
823
|
+
* Describes the message aperture.live.v1.Cursor.Hidden.
|
|
824
|
+
* Use `create(Cursor_HiddenSchema)` to create a new message.
|
|
825
|
+
*/
|
|
826
|
+
const Cursor_HiddenSchema = /*@__PURE__*/ messageDesc(file_aperture_live_v1_live, 50, 0);
|
|
827
|
+
/**
|
|
828
|
+
* @generated from enum aperture.live.v1.Pace
|
|
829
|
+
*/
|
|
830
|
+
let Pace = /* @__PURE__ */ function(Pace) {
|
|
831
|
+
/**
|
|
832
|
+
* @generated from enum value: PACE_UNSPECIFIED = 0;
|
|
833
|
+
*/
|
|
834
|
+
Pace[Pace["UNSPECIFIED"] = 0] = "UNSPECIFIED";
|
|
835
|
+
/**
|
|
836
|
+
* The pointer jumps to each action.
|
|
837
|
+
*
|
|
838
|
+
* @generated from enum value: PACE_INSTANT = 1;
|
|
839
|
+
*/
|
|
840
|
+
Pace[Pace["INSTANT"] = 1] = "INSTANT";
|
|
841
|
+
/**
|
|
842
|
+
* The pointer travels there, quickly but so that the eye can follow, and text is typed
|
|
843
|
+
* out.
|
|
844
|
+
*
|
|
845
|
+
* @generated from enum value: PACE_FAST = 2;
|
|
846
|
+
*/
|
|
847
|
+
Pace[Pace["FAST"] = 2] = "FAST";
|
|
848
|
+
/**
|
|
849
|
+
* Unhurried travel, for demos.
|
|
850
|
+
*
|
|
851
|
+
* @generated from enum value: PACE_SLOW = 3;
|
|
852
|
+
*/
|
|
853
|
+
Pace[Pace["SLOW"] = 3] = "SLOW";
|
|
854
|
+
return Pace;
|
|
855
|
+
}({});
|
|
856
|
+
/**
|
|
857
|
+
* Describes the enum aperture.live.v1.Pace.
|
|
858
|
+
*/
|
|
859
|
+
const PaceSchema = /*@__PURE__*/ enumDesc(file_aperture_live_v1_live, 0);
|
|
860
|
+
/**
|
|
861
|
+
* The form a target's video takes.
|
|
862
|
+
*
|
|
863
|
+
* @generated from enum aperture.live.v1.VideoFormat
|
|
864
|
+
*/
|
|
865
|
+
let VideoFormat = /* @__PURE__ */ function(VideoFormat) {
|
|
866
|
+
/**
|
|
867
|
+
* @generated from enum value: VIDEO_FORMAT_UNSPECIFIED = 0;
|
|
868
|
+
*/
|
|
869
|
+
VideoFormat[VideoFormat["UNSPECIFIED"] = 0] = "UNSPECIFIED";
|
|
870
|
+
/**
|
|
871
|
+
* H.264 constrained baseline, 4:2:0. Everything decodes it; colored text loses detail.
|
|
872
|
+
*
|
|
873
|
+
* @generated from enum value: VIDEO_FORMAT_H264 = 1;
|
|
874
|
+
*/
|
|
875
|
+
VideoFormat[VideoFormat["H264"] = 1] = "H264";
|
|
876
|
+
/**
|
|
877
|
+
* H.264 High 4:4:4, in BT.709: color as sharp as light. For frames on the session
|
|
878
|
+
* socket, where the client's decoder takes it; WebRTC does not carry it.
|
|
879
|
+
*
|
|
880
|
+
* @generated from enum value: VIDEO_FORMAT_FULL_CHROMA = 2;
|
|
881
|
+
*/
|
|
882
|
+
VideoFormat[VideoFormat["FULL_CHROMA"] = 2] = "FULL_CHROMA";
|
|
883
|
+
/**
|
|
884
|
+
* H.265 Main, 4:2:0: fewer bits than H.264 for the same picture.
|
|
885
|
+
*
|
|
886
|
+
* @generated from enum value: VIDEO_FORMAT_H265 = 3;
|
|
887
|
+
*/
|
|
888
|
+
VideoFormat[VideoFormat["H265"] = 3] = "H265";
|
|
889
|
+
/**
|
|
890
|
+
* VP9 profile 0, 4:2:0.
|
|
891
|
+
*
|
|
892
|
+
* @generated from enum value: VIDEO_FORMAT_VP9 = 4;
|
|
893
|
+
*/
|
|
894
|
+
VideoFormat[VideoFormat["VP9"] = 4] = "VP9";
|
|
895
|
+
/**
|
|
896
|
+
* VP9 profile 1, 4:4:4: color as sharp as light, also over WebRTC.
|
|
897
|
+
*
|
|
898
|
+
* @generated from enum value: VIDEO_FORMAT_VP9_FULL_CHROMA = 5;
|
|
899
|
+
*/
|
|
900
|
+
VideoFormat[VideoFormat["VP9_FULL_CHROMA"] = 5] = "VP9_FULL_CHROMA";
|
|
901
|
+
/**
|
|
902
|
+
* AV1 main, 4:2:0.
|
|
903
|
+
*
|
|
904
|
+
* @generated from enum value: VIDEO_FORMAT_AV1 = 6;
|
|
905
|
+
*/
|
|
906
|
+
VideoFormat[VideoFormat["AV1"] = 6] = "AV1";
|
|
907
|
+
return VideoFormat;
|
|
908
|
+
}({});
|
|
909
|
+
/**
|
|
910
|
+
* Describes the enum aperture.live.v1.VideoFormat.
|
|
911
|
+
*/
|
|
912
|
+
const VideoFormatSchema = /*@__PURE__*/ enumDesc(file_aperture_live_v1_live, 1);
|
|
913
|
+
/**
|
|
914
|
+
* How much a target's video costs the client's link. The session picks it, by what the
|
|
915
|
+
* link carries, and changes it as that changes: over WebRTC by the connection's own
|
|
916
|
+
* estimate, on the session socket by how late the client shows frames (`video_shown`).
|
|
917
|
+
*
|
|
918
|
+
* @generated from enum aperture.live.v1.VideoQuality
|
|
919
|
+
*/
|
|
920
|
+
let VideoQuality = /* @__PURE__ */ function(VideoQuality) {
|
|
921
|
+
/**
|
|
922
|
+
* @generated from enum value: VIDEO_QUALITY_UNSPECIFIED = 0;
|
|
923
|
+
*/
|
|
924
|
+
VideoQuality[VideoQuality["UNSPECIFIED"] = 0] = "UNSPECIFIED";
|
|
925
|
+
/**
|
|
926
|
+
* Up to 0.7 Mbit/s, 15 frames a second. Bitrates are for a picture of 1280x720 pixels;
|
|
927
|
+
* larger ones get more.
|
|
928
|
+
*
|
|
929
|
+
* @generated from enum value: VIDEO_QUALITY_LOW = 1;
|
|
930
|
+
*/
|
|
931
|
+
VideoQuality[VideoQuality["LOW"] = 1] = "LOW";
|
|
932
|
+
/**
|
|
933
|
+
* Up to 2.5 Mbit/s, 30 frames a second.
|
|
934
|
+
*
|
|
935
|
+
* @generated from enum value: VIDEO_QUALITY_MEDIUM = 2;
|
|
936
|
+
*/
|
|
937
|
+
VideoQuality[VideoQuality["MEDIUM"] = 2] = "MEDIUM";
|
|
938
|
+
/**
|
|
939
|
+
* A constant quality whatever it takes, 60 frames a second.
|
|
940
|
+
*
|
|
941
|
+
* @generated from enum value: VIDEO_QUALITY_FULL = 3;
|
|
942
|
+
*/
|
|
943
|
+
VideoQuality[VideoQuality["FULL"] = 3] = "FULL";
|
|
944
|
+
return VideoQuality;
|
|
945
|
+
}({});
|
|
946
|
+
/**
|
|
947
|
+
* Describes the enum aperture.live.v1.VideoQuality.
|
|
948
|
+
*/
|
|
949
|
+
const VideoQualitySchema = /*@__PURE__*/ enumDesc(file_aperture_live_v1_live, 2);
|
|
950
|
+
/**
|
|
951
|
+
* How the pixels of the watched target reach a client.
|
|
952
|
+
*
|
|
953
|
+
* @generated from enum aperture.live.v1.Pixels
|
|
954
|
+
*/
|
|
955
|
+
let Pixels = /* @__PURE__ */ function(Pixels) {
|
|
956
|
+
/**
|
|
957
|
+
* None: the client only controls, or has yet to say.
|
|
958
|
+
*
|
|
959
|
+
* @generated from enum value: PIXELS_UNSPECIFIED = 0;
|
|
960
|
+
*/
|
|
961
|
+
Pixels[Pixels["UNSPECIFIED"] = 0] = "UNSPECIFIED";
|
|
962
|
+
/**
|
|
963
|
+
* Video over WebRTC, once the client has offered a connection.
|
|
964
|
+
*
|
|
965
|
+
* @generated from enum value: PIXELS_VIDEO = 1;
|
|
966
|
+
*/
|
|
967
|
+
Pixels[Pixels["VIDEO"] = 1] = "VIDEO";
|
|
968
|
+
/**
|
|
969
|
+
* Tiles on the session socket.
|
|
970
|
+
*
|
|
971
|
+
* @generated from enum value: PIXELS_TILES = 2;
|
|
972
|
+
*/
|
|
973
|
+
Pixels[Pixels["TILES"] = 2] = "TILES";
|
|
974
|
+
/**
|
|
975
|
+
* Video frames on the session socket.
|
|
976
|
+
*
|
|
977
|
+
* @generated from enum value: PIXELS_FRAMES = 3;
|
|
978
|
+
*/
|
|
979
|
+
Pixels[Pixels["FRAMES"] = 3] = "FRAMES";
|
|
980
|
+
return Pixels;
|
|
981
|
+
}({});
|
|
982
|
+
/**
|
|
983
|
+
* Describes the enum aperture.live.v1.Pixels.
|
|
984
|
+
*/
|
|
985
|
+
const PixelsSchema = /*@__PURE__*/ enumDesc(file_aperture_live_v1_live, 3);
|
|
986
|
+
/**
|
|
987
|
+
* @generated from enum aperture.live.v1.MouseButton
|
|
988
|
+
*/
|
|
989
|
+
let MouseButton = /* @__PURE__ */ function(MouseButton) {
|
|
990
|
+
/**
|
|
991
|
+
* @generated from enum value: MOUSE_BUTTON_UNSPECIFIED = 0;
|
|
992
|
+
*/
|
|
993
|
+
MouseButton[MouseButton["UNSPECIFIED"] = 0] = "UNSPECIFIED";
|
|
994
|
+
/**
|
|
995
|
+
* @generated from enum value: MOUSE_BUTTON_LEFT = 1;
|
|
996
|
+
*/
|
|
997
|
+
MouseButton[MouseButton["LEFT"] = 1] = "LEFT";
|
|
998
|
+
/**
|
|
999
|
+
* @generated from enum value: MOUSE_BUTTON_RIGHT = 2;
|
|
1000
|
+
*/
|
|
1001
|
+
MouseButton[MouseButton["RIGHT"] = 2] = "RIGHT";
|
|
1002
|
+
/**
|
|
1003
|
+
* @generated from enum value: MOUSE_BUTTON_MIDDLE = 3;
|
|
1004
|
+
*/
|
|
1005
|
+
MouseButton[MouseButton["MIDDLE"] = 3] = "MIDDLE";
|
|
1006
|
+
/**
|
|
1007
|
+
* @generated from enum value: MOUSE_BUTTON_BACK = 4;
|
|
1008
|
+
*/
|
|
1009
|
+
MouseButton[MouseButton["BACK"] = 4] = "BACK";
|
|
1010
|
+
/**
|
|
1011
|
+
* @generated from enum value: MOUSE_BUTTON_FORWARD = 5;
|
|
1012
|
+
*/
|
|
1013
|
+
MouseButton[MouseButton["FORWARD"] = 5] = "FORWARD";
|
|
1014
|
+
return MouseButton;
|
|
1015
|
+
}({});
|
|
1016
|
+
/**
|
|
1017
|
+
* Describes the enum aperture.live.v1.MouseButton.
|
|
1018
|
+
*/
|
|
1019
|
+
const MouseButtonSchema = /*@__PURE__*/ enumDesc(file_aperture_live_v1_live, 4);
|
|
1020
|
+
/**
|
|
1021
|
+
* @generated from enum aperture.live.v1.DownloadState
|
|
1022
|
+
*/
|
|
1023
|
+
let DownloadState = /* @__PURE__ */ function(DownloadState) {
|
|
1024
|
+
/**
|
|
1025
|
+
* @generated from enum value: DOWNLOAD_STATE_UNSPECIFIED = 0;
|
|
1026
|
+
*/
|
|
1027
|
+
DownloadState[DownloadState["UNSPECIFIED"] = 0] = "UNSPECIFIED";
|
|
1028
|
+
/**
|
|
1029
|
+
* @generated from enum value: DOWNLOAD_STATE_RUNNING = 1;
|
|
1030
|
+
*/
|
|
1031
|
+
DownloadState[DownloadState["RUNNING"] = 1] = "RUNNING";
|
|
1032
|
+
/**
|
|
1033
|
+
* @generated from enum value: DOWNLOAD_STATE_DONE = 2;
|
|
1034
|
+
*/
|
|
1035
|
+
DownloadState[DownloadState["DONE"] = 2] = "DONE";
|
|
1036
|
+
/**
|
|
1037
|
+
* @generated from enum value: DOWNLOAD_STATE_FAILED = 3;
|
|
1038
|
+
*/
|
|
1039
|
+
DownloadState[DownloadState["FAILED"] = 3] = "FAILED";
|
|
1040
|
+
return DownloadState;
|
|
1041
|
+
}({});
|
|
1042
|
+
/**
|
|
1043
|
+
* Describes the enum aperture.live.v1.DownloadState.
|
|
1044
|
+
*/
|
|
1045
|
+
const DownloadStateSchema = /*@__PURE__*/ enumDesc(file_aperture_live_v1_live, 5);
|
|
1046
|
+
/**
|
|
1047
|
+
* @generated from enum aperture.live.v1.StrokePhase
|
|
1048
|
+
*/
|
|
1049
|
+
let StrokePhase = /* @__PURE__ */ function(StrokePhase) {
|
|
1050
|
+
/**
|
|
1051
|
+
* @generated from enum value: STROKE_PHASE_UNSPECIFIED = 0;
|
|
1052
|
+
*/
|
|
1053
|
+
StrokePhase[StrokePhase["UNSPECIFIED"] = 0] = "UNSPECIFIED";
|
|
1054
|
+
/**
|
|
1055
|
+
* @generated from enum value: STROKE_PHASE_START = 1;
|
|
1056
|
+
*/
|
|
1057
|
+
StrokePhase[StrokePhase["START"] = 1] = "START";
|
|
1058
|
+
/**
|
|
1059
|
+
* @generated from enum value: STROKE_PHASE_MOVE = 2;
|
|
1060
|
+
*/
|
|
1061
|
+
StrokePhase[StrokePhase["MOVE"] = 2] = "MOVE";
|
|
1062
|
+
/**
|
|
1063
|
+
* @generated from enum value: STROKE_PHASE_END = 3;
|
|
1064
|
+
*/
|
|
1065
|
+
StrokePhase[StrokePhase["END"] = 3] = "END";
|
|
1066
|
+
return StrokePhase;
|
|
1067
|
+
}({});
|
|
1068
|
+
/**
|
|
1069
|
+
* Describes the enum aperture.live.v1.StrokePhase.
|
|
1070
|
+
*/
|
|
1071
|
+
const StrokePhaseSchema = /*@__PURE__*/ enumDesc(file_aperture_live_v1_live, 6);
|
|
1072
|
+
/**
|
|
1073
|
+
* @generated from enum aperture.live.v1.Role
|
|
1074
|
+
*/
|
|
1075
|
+
let Role = /* @__PURE__ */ function(Role) {
|
|
1076
|
+
/**
|
|
1077
|
+
* @generated from enum value: ROLE_UNSPECIFIED = 0;
|
|
1078
|
+
*/
|
|
1079
|
+
Role[Role["UNSPECIFIED"] = 0] = "UNSPECIFIED";
|
|
1080
|
+
/**
|
|
1081
|
+
* Watches.
|
|
1082
|
+
*
|
|
1083
|
+
* @generated from enum value: ROLE_VIEW = 1;
|
|
1084
|
+
*/
|
|
1085
|
+
Role[Role["VIEW"] = 1] = "VIEW";
|
|
1086
|
+
/**
|
|
1087
|
+
* Gives input.
|
|
1088
|
+
*
|
|
1089
|
+
* @generated from enum value: ROLE_CONTROL = 2;
|
|
1090
|
+
*/
|
|
1091
|
+
Role[Role["CONTROL"] = 2] = "CONTROL";
|
|
1092
|
+
/**
|
|
1093
|
+
* Takes a tab from whoever holds it.
|
|
1094
|
+
*
|
|
1095
|
+
* @generated from enum value: ROLE_ADMIN = 3;
|
|
1096
|
+
*/
|
|
1097
|
+
Role[Role["ADMIN"] = 3] = "ADMIN";
|
|
1098
|
+
return Role;
|
|
1099
|
+
}({});
|
|
1100
|
+
/**
|
|
1101
|
+
* Describes the enum aperture.live.v1.Role.
|
|
1102
|
+
*/
|
|
1103
|
+
const RoleSchema = /*@__PURE__*/ enumDesc(file_aperture_live_v1_live, 7);
|
|
1104
|
+
/**
|
|
1105
|
+
* @generated from enum aperture.live.v1.LeaseAction
|
|
1106
|
+
*/
|
|
1107
|
+
let LeaseAction = /* @__PURE__ */ function(LeaseAction) {
|
|
1108
|
+
/**
|
|
1109
|
+
* @generated from enum value: LEASE_ACTION_UNSPECIFIED = 0;
|
|
1110
|
+
*/
|
|
1111
|
+
LeaseAction[LeaseAction["UNSPECIFIED"] = 0] = "UNSPECIFIED";
|
|
1112
|
+
/**
|
|
1113
|
+
* Asks for the tab. One nobody holds is the client's at once, and so is any an admin
|
|
1114
|
+
* asks for. Another holder is asked, and the tab is the client's when the holder allows
|
|
1115
|
+
* it or does not answer for ten seconds.
|
|
1116
|
+
*
|
|
1117
|
+
* @generated from enum value: LEASE_ACTION_TAKE = 1;
|
|
1118
|
+
*/
|
|
1119
|
+
LeaseAction[LeaseAction["TAKE"] = 1] = "TAKE";
|
|
1120
|
+
/**
|
|
1121
|
+
* Lets go of the tab the client holds.
|
|
1122
|
+
*
|
|
1123
|
+
* @generated from enum value: LEASE_ACTION_RELEASE = 2;
|
|
1124
|
+
*/
|
|
1125
|
+
LeaseAction[LeaseAction["RELEASE"] = 2] = "RELEASE";
|
|
1126
|
+
/**
|
|
1127
|
+
* Answers the member who asks for the tab the client holds.
|
|
1128
|
+
*
|
|
1129
|
+
* @generated from enum value: LEASE_ACTION_ALLOW = 3;
|
|
1130
|
+
*/
|
|
1131
|
+
LeaseAction[LeaseAction["ALLOW"] = 3] = "ALLOW";
|
|
1132
|
+
/**
|
|
1133
|
+
* @generated from enum value: LEASE_ACTION_KEEP = 4;
|
|
1134
|
+
*/
|
|
1135
|
+
LeaseAction[LeaseAction["KEEP"] = 4] = "KEEP";
|
|
1136
|
+
return LeaseAction;
|
|
1137
|
+
}({});
|
|
1138
|
+
/**
|
|
1139
|
+
* Describes the enum aperture.live.v1.LeaseAction.
|
|
1140
|
+
*/
|
|
1141
|
+
const LeaseActionSchema = /*@__PURE__*/ enumDesc(file_aperture_live_v1_live, 8);
|
|
1142
|
+
/**
|
|
1143
|
+
* Where along a page's history.
|
|
1144
|
+
*
|
|
1145
|
+
* @generated from enum aperture.live.v1.Along
|
|
1146
|
+
*/
|
|
1147
|
+
let Along = /* @__PURE__ */ function(Along) {
|
|
1148
|
+
/**
|
|
1149
|
+
* @generated from enum value: ALONG_UNSPECIFIED = 0;
|
|
1150
|
+
*/
|
|
1151
|
+
Along[Along["UNSPECIFIED"] = 0] = "UNSPECIFIED";
|
|
1152
|
+
/**
|
|
1153
|
+
* @generated from enum value: ALONG_BACK = 1;
|
|
1154
|
+
*/
|
|
1155
|
+
Along[Along["BACK"] = 1] = "BACK";
|
|
1156
|
+
/**
|
|
1157
|
+
* @generated from enum value: ALONG_FORWARD = 2;
|
|
1158
|
+
*/
|
|
1159
|
+
Along[Along["FORWARD"] = 2] = "FORWARD";
|
|
1160
|
+
/**
|
|
1161
|
+
* @generated from enum value: ALONG_RELOAD = 3;
|
|
1162
|
+
*/
|
|
1163
|
+
Along[Along["RELOAD"] = 3] = "RELOAD";
|
|
1164
|
+
return Along;
|
|
1165
|
+
}({});
|
|
1166
|
+
/**
|
|
1167
|
+
* Describes the enum aperture.live.v1.Along.
|
|
1168
|
+
*/
|
|
1169
|
+
const AlongSchema = /*@__PURE__*/ enumDesc(file_aperture_live_v1_live, 9);
|
|
1170
|
+
/**
|
|
1171
|
+
* @generated from enum aperture.live.v1.Asked
|
|
1172
|
+
*/
|
|
1173
|
+
let Asked = /* @__PURE__ */ function(Asked) {
|
|
1174
|
+
/**
|
|
1175
|
+
* @generated from enum value: ASKED_UNSPECIFIED = 0;
|
|
1176
|
+
*/
|
|
1177
|
+
Asked[Asked["UNSPECIFIED"] = 0] = "UNSPECIFIED";
|
|
1178
|
+
/**
|
|
1179
|
+
* @generated from enum value: ASKED_GO = 1;
|
|
1180
|
+
*/
|
|
1181
|
+
Asked[Asked["GO"] = 1] = "GO";
|
|
1182
|
+
/**
|
|
1183
|
+
* @generated from enum value: ASKED_CLOSE = 2;
|
|
1184
|
+
*/
|
|
1185
|
+
Asked[Asked["CLOSE"] = 2] = "CLOSE";
|
|
1186
|
+
/**
|
|
1187
|
+
* @generated from enum value: ASKED_COPY_PICTURE = 3;
|
|
1188
|
+
*/
|
|
1189
|
+
Asked[Asked["COPY_PICTURE"] = 3] = "COPY_PICTURE";
|
|
1190
|
+
/**
|
|
1191
|
+
* @generated from enum value: ASKED_FILES_CHOSEN = 4;
|
|
1192
|
+
*/
|
|
1193
|
+
Asked[Asked["FILES_CHOSEN"] = 4] = "FILES_CHOSEN";
|
|
1194
|
+
/**
|
|
1195
|
+
* @generated from enum value: ASKED_FOLLOW = 5;
|
|
1196
|
+
*/
|
|
1197
|
+
Asked[Asked["FOLLOW"] = 5] = "FOLLOW";
|
|
1198
|
+
/**
|
|
1199
|
+
* @generated from enum value: ASKED_SET_MODE = 6;
|
|
1200
|
+
*/
|
|
1201
|
+
Asked[Asked["SET_MODE"] = 6] = "SET_MODE";
|
|
1202
|
+
return Asked;
|
|
1203
|
+
}({});
|
|
1204
|
+
/**
|
|
1205
|
+
* Describes the enum aperture.live.v1.Asked.
|
|
1206
|
+
*/
|
|
1207
|
+
const AskedSchema = /*@__PURE__*/ enumDesc(file_aperture_live_v1_live, 10);
|
|
1208
|
+
/**
|
|
1209
|
+
* How a tab's pages are shown.
|
|
1210
|
+
*
|
|
1211
|
+
* @generated from enum aperture.live.v1.PageMode
|
|
1212
|
+
*/
|
|
1213
|
+
let PageMode = /* @__PURE__ */ function(PageMode) {
|
|
1214
|
+
/**
|
|
1215
|
+
* @generated from enum value: PAGE_MODE_UNSPECIFIED = 0;
|
|
1216
|
+
*/
|
|
1217
|
+
PageMode[PageMode["UNSPECIFIED"] = 0] = "UNSPECIFIED";
|
|
1218
|
+
/**
|
|
1219
|
+
* As on what its holder uses: as on a phone once a client that is a phone holds the
|
|
1220
|
+
* tab, and as on a desktop once one that is none does. Watching changes nothing, and
|
|
1221
|
+
* neither does the session's automation, which has no device: the tab stays as it was.
|
|
1222
|
+
* A page that is there when this changes is left as it loaded; the pages that load
|
|
1223
|
+
* after are asked for as the tab is by then.
|
|
1224
|
+
*
|
|
1225
|
+
* @generated from enum value: PAGE_MODE_AUTO = 1;
|
|
1226
|
+
*/
|
|
1227
|
+
PageMode[PageMode["AUTO"] = 1] = "AUTO";
|
|
1228
|
+
/**
|
|
1229
|
+
* @generated from enum value: PAGE_MODE_DESKTOP = 2;
|
|
1230
|
+
*/
|
|
1231
|
+
PageMode[PageMode["DESKTOP"] = 2] = "DESKTOP";
|
|
1232
|
+
/**
|
|
1233
|
+
* As on a phone: a phone's user agent and client hints, touch in place of a mouse, and
|
|
1234
|
+
* a viewport pages lay themselves out for as for a phone's.
|
|
1235
|
+
*
|
|
1236
|
+
* @generated from enum value: PAGE_MODE_MOBILE = 3;
|
|
1237
|
+
*/
|
|
1238
|
+
PageMode[PageMode["MOBILE"] = 3] = "MOBILE";
|
|
1239
|
+
return PageMode;
|
|
1240
|
+
}({});
|
|
1241
|
+
/**
|
|
1242
|
+
* Describes the enum aperture.live.v1.PageMode.
|
|
1243
|
+
*/
|
|
1244
|
+
const PageModeSchema = /*@__PURE__*/ enumDesc(file_aperture_live_v1_live, 11);
|
|
1245
|
+
//#endregion
|
|
1246
|
+
//#region src/keys.ts
|
|
1247
|
+
/** `KeyboardEvent.code` to Linux evdev key codes. */
|
|
1248
|
+
const KEYS = {
|
|
1249
|
+
Escape: 1,
|
|
1250
|
+
Digit1: 2,
|
|
1251
|
+
Digit2: 3,
|
|
1252
|
+
Digit3: 4,
|
|
1253
|
+
Digit4: 5,
|
|
1254
|
+
Digit5: 6,
|
|
1255
|
+
Digit6: 7,
|
|
1256
|
+
Digit7: 8,
|
|
1257
|
+
Digit8: 9,
|
|
1258
|
+
Digit9: 10,
|
|
1259
|
+
Digit0: 11,
|
|
1260
|
+
Minus: 12,
|
|
1261
|
+
Equal: 13,
|
|
1262
|
+
Backspace: 14,
|
|
1263
|
+
Tab: 15,
|
|
1264
|
+
KeyQ: 16,
|
|
1265
|
+
KeyW: 17,
|
|
1266
|
+
KeyE: 18,
|
|
1267
|
+
KeyR: 19,
|
|
1268
|
+
KeyT: 20,
|
|
1269
|
+
KeyY: 21,
|
|
1270
|
+
KeyU: 22,
|
|
1271
|
+
KeyI: 23,
|
|
1272
|
+
KeyO: 24,
|
|
1273
|
+
KeyP: 25,
|
|
1274
|
+
BracketLeft: 26,
|
|
1275
|
+
BracketRight: 27,
|
|
1276
|
+
Enter: 28,
|
|
1277
|
+
ControlLeft: 29,
|
|
1278
|
+
KeyA: 30,
|
|
1279
|
+
KeyS: 31,
|
|
1280
|
+
KeyD: 32,
|
|
1281
|
+
KeyF: 33,
|
|
1282
|
+
KeyG: 34,
|
|
1283
|
+
KeyH: 35,
|
|
1284
|
+
KeyJ: 36,
|
|
1285
|
+
KeyK: 37,
|
|
1286
|
+
KeyL: 38,
|
|
1287
|
+
Semicolon: 39,
|
|
1288
|
+
Quote: 40,
|
|
1289
|
+
Backquote: 41,
|
|
1290
|
+
ShiftLeft: 42,
|
|
1291
|
+
Backslash: 43,
|
|
1292
|
+
KeyZ: 44,
|
|
1293
|
+
KeyX: 45,
|
|
1294
|
+
KeyC: 46,
|
|
1295
|
+
KeyV: 47,
|
|
1296
|
+
KeyB: 48,
|
|
1297
|
+
KeyN: 49,
|
|
1298
|
+
KeyM: 50,
|
|
1299
|
+
Comma: 51,
|
|
1300
|
+
Period: 52,
|
|
1301
|
+
Slash: 53,
|
|
1302
|
+
ShiftRight: 54,
|
|
1303
|
+
NumpadMultiply: 55,
|
|
1304
|
+
AltLeft: 56,
|
|
1305
|
+
Space: 57,
|
|
1306
|
+
CapsLock: 58,
|
|
1307
|
+
F1: 59,
|
|
1308
|
+
F2: 60,
|
|
1309
|
+
F3: 61,
|
|
1310
|
+
F4: 62,
|
|
1311
|
+
F5: 63,
|
|
1312
|
+
F6: 64,
|
|
1313
|
+
F7: 65,
|
|
1314
|
+
F8: 66,
|
|
1315
|
+
F9: 67,
|
|
1316
|
+
F10: 68,
|
|
1317
|
+
NumLock: 69,
|
|
1318
|
+
ScrollLock: 70,
|
|
1319
|
+
Numpad7: 71,
|
|
1320
|
+
Numpad8: 72,
|
|
1321
|
+
Numpad9: 73,
|
|
1322
|
+
NumpadSubtract: 74,
|
|
1323
|
+
Numpad4: 75,
|
|
1324
|
+
Numpad5: 76,
|
|
1325
|
+
Numpad6: 77,
|
|
1326
|
+
NumpadAdd: 78,
|
|
1327
|
+
Numpad1: 79,
|
|
1328
|
+
Numpad2: 80,
|
|
1329
|
+
Numpad3: 81,
|
|
1330
|
+
Numpad0: 82,
|
|
1331
|
+
NumpadDecimal: 83,
|
|
1332
|
+
IntlBackslash: 86,
|
|
1333
|
+
F11: 87,
|
|
1334
|
+
F12: 88,
|
|
1335
|
+
NumpadEnter: 96,
|
|
1336
|
+
ControlRight: 97,
|
|
1337
|
+
NumpadDivide: 98,
|
|
1338
|
+
AltRight: 100,
|
|
1339
|
+
Home: 102,
|
|
1340
|
+
ArrowUp: 103,
|
|
1341
|
+
PageUp: 104,
|
|
1342
|
+
ArrowLeft: 105,
|
|
1343
|
+
ArrowRight: 106,
|
|
1344
|
+
End: 107,
|
|
1345
|
+
ArrowDown: 108,
|
|
1346
|
+
PageDown: 109,
|
|
1347
|
+
Insert: 110,
|
|
1348
|
+
Delete: 111,
|
|
1349
|
+
MetaLeft: 125,
|
|
1350
|
+
MetaRight: 126,
|
|
1351
|
+
ContextMenu: 127
|
|
1352
|
+
};
|
|
1353
|
+
const KEY = {
|
|
1354
|
+
enter: 28,
|
|
1355
|
+
backspace: 14,
|
|
1356
|
+
delete: 111,
|
|
1357
|
+
a: 30,
|
|
1358
|
+
c: 46,
|
|
1359
|
+
v: 47
|
|
1360
|
+
};
|
|
1361
|
+
const CONTROLS = [29, 97];
|
|
1362
|
+
const METAS = [125, 126];
|
|
1363
|
+
const DIGITS = "1!2@3#4$5%6^7&8*9(0)";
|
|
1364
|
+
const LETTERS = "abcdefghijklmnopqrstuvwxyz";
|
|
1365
|
+
const layout = () => {
|
|
1366
|
+
const written = {
|
|
1367
|
+
Space: " ",
|
|
1368
|
+
Minus: "-_",
|
|
1369
|
+
Equal: "=+",
|
|
1370
|
+
BracketLeft: "[{",
|
|
1371
|
+
BracketRight: "]}",
|
|
1372
|
+
Backslash: "\\|",
|
|
1373
|
+
Semicolon: ";:",
|
|
1374
|
+
Quote: "'\"",
|
|
1375
|
+
Backquote: "`~",
|
|
1376
|
+
Comma: ",<",
|
|
1377
|
+
Period: ".>",
|
|
1378
|
+
Slash: "/?"
|
|
1379
|
+
};
|
|
1380
|
+
for (let at = 0; at < 20; at += 2) written[`Digit${DIGITS[at]}`] = DIGITS.slice(at, at + 2);
|
|
1381
|
+
for (const letter of LETTERS) written[`Key${letter.toUpperCase()}`] = letter + letter.toUpperCase();
|
|
1382
|
+
return written;
|
|
1383
|
+
};
|
|
1384
|
+
/**
|
|
1385
|
+
* What the keys of a US keyboard write, plain and with Shift, by `KeyboardEvent.code`.
|
|
1386
|
+
* The session's keyboard is a US one.
|
|
1387
|
+
*/
|
|
1388
|
+
const US = layout();
|
|
1389
|
+
const makeKeyboard = (send) => {
|
|
1390
|
+
const held = /* @__PURE__ */ new Set();
|
|
1391
|
+
const press = (code, pressed) => {
|
|
1392
|
+
if (pressed) held.add(code);
|
|
1393
|
+
else if (!held.delete(code)) return;
|
|
1394
|
+
send(code, pressed);
|
|
1395
|
+
};
|
|
1396
|
+
const tap = (code) => {
|
|
1397
|
+
press(code, true);
|
|
1398
|
+
press(code, false);
|
|
1399
|
+
};
|
|
1400
|
+
return {
|
|
1401
|
+
press,
|
|
1402
|
+
tap,
|
|
1403
|
+
chord: (code) => {
|
|
1404
|
+
press(CONTROLS[0], true);
|
|
1405
|
+
tap(code);
|
|
1406
|
+
press(CONTROLS[0], false);
|
|
1407
|
+
},
|
|
1408
|
+
paste: () => {
|
|
1409
|
+
for (const code of METAS) press(code, false);
|
|
1410
|
+
const controlled = CONTROLS.some((code) => held.has(code));
|
|
1411
|
+
if (!controlled) press(CONTROLS[0], true);
|
|
1412
|
+
tap(KEY.v);
|
|
1413
|
+
if (!controlled) press(CONTROLS[0], false);
|
|
1414
|
+
},
|
|
1415
|
+
releaseAll: () => {
|
|
1416
|
+
for (const code of held) press(code, false);
|
|
1417
|
+
}
|
|
1418
|
+
};
|
|
1419
|
+
};
|
|
1420
|
+
//#endregion
|
|
1421
|
+
//#region src/input.ts
|
|
1422
|
+
/** `MouseEvent.button` to the protocol's buttons. */
|
|
1423
|
+
const BUTTONS = [
|
|
1424
|
+
1,
|
|
1425
|
+
3,
|
|
1426
|
+
2,
|
|
1427
|
+
4,
|
|
1428
|
+
5
|
|
1429
|
+
];
|
|
1430
|
+
/** How long the stage has to keep a size before the viewport follows it. */
|
|
1431
|
+
const RESIZE_SETTLES_MS = 200;
|
|
1432
|
+
/** Pixels and lines of a wheel to a notch of it. */
|
|
1433
|
+
const NOTCH = {
|
|
1434
|
+
pixels: 100,
|
|
1435
|
+
lines: 3
|
|
1436
|
+
};
|
|
1437
|
+
/** How far a finger may stray, in pixels here, and still be a tap and not a drag. */
|
|
1438
|
+
const TAP_SLOP = 10;
|
|
1439
|
+
/** How long a finger rests in place before it is a press of the right button. */
|
|
1440
|
+
const LONG_PRESS_MS = 500;
|
|
1441
|
+
/** What a page that was flung keeps of its speed after each millisecond, and where it stops. */
|
|
1442
|
+
const FLING = {
|
|
1443
|
+
keeps: .996,
|
|
1444
|
+
least: .05,
|
|
1445
|
+
stops: .01
|
|
1446
|
+
};
|
|
1447
|
+
/**
|
|
1448
|
+
* The part of an element's box its picture covers. An element whose box has not the
|
|
1449
|
+
* picture's proportions shows it whole and centred when it is told to contain it, as a
|
|
1450
|
+
* `video` is unless told otherwise.
|
|
1451
|
+
*/
|
|
1452
|
+
const covered = (view, picture) => {
|
|
1453
|
+
const box = view.getBoundingClientRect();
|
|
1454
|
+
const fit = getComputedStyle(view).objectFit;
|
|
1455
|
+
if (!(fit === "contain" || fit === "scale-down") || picture.width === 0 || picture.height === 0) return box;
|
|
1456
|
+
const most = fit === "scale-down" ? 1 : Number.POSITIVE_INFINITY;
|
|
1457
|
+
const scale = Math.min(box.width / picture.width, box.height / picture.height, most);
|
|
1458
|
+
const width = picture.width * scale;
|
|
1459
|
+
const height = picture.height * scale;
|
|
1460
|
+
return {
|
|
1461
|
+
left: box.left + (box.width - width) / 2,
|
|
1462
|
+
top: box.top + (box.height - height) / 2,
|
|
1463
|
+
width,
|
|
1464
|
+
height
|
|
1465
|
+
};
|
|
1466
|
+
};
|
|
1467
|
+
/**
|
|
1468
|
+
* Wires the pointer, the wheel, the keyboard, input methods, the clipboard and dragging
|
|
1469
|
+
* of the surfaces to a session. Closing the scope unwires them and releases the keys
|
|
1470
|
+
* that are held.
|
|
1471
|
+
*/
|
|
1472
|
+
const wire = Effect.fn("Input.wire")(function* (surfaces, wiring) {
|
|
1473
|
+
const { video, canvas, keys, stage } = surfaces;
|
|
1474
|
+
const { send, keyboard } = wiring;
|
|
1475
|
+
const { signal } = yield* Effect.acquireRelease(Effect.sync(() => new AbortController()), (controller) => Effect.sync(() => {
|
|
1476
|
+
controller.abort();
|
|
1477
|
+
keyboard.releaseAll();
|
|
1478
|
+
}));
|
|
1479
|
+
const position = (event) => {
|
|
1480
|
+
const shows = wiring.way() === "video";
|
|
1481
|
+
const picture = shows ? {
|
|
1482
|
+
width: video.videoWidth,
|
|
1483
|
+
height: video.videoHeight
|
|
1484
|
+
} : {
|
|
1485
|
+
width: canvas.width,
|
|
1486
|
+
height: canvas.height
|
|
1487
|
+
};
|
|
1488
|
+
const box = covered(shows ? video : canvas, picture);
|
|
1489
|
+
const { width, height } = wiring.watched() ?? picture;
|
|
1490
|
+
if (box.width === 0 || box.height === 0) return;
|
|
1491
|
+
return {
|
|
1492
|
+
x: (event.clientX - box.left) * (width / box.width),
|
|
1493
|
+
y: (event.clientY - box.top) * (height / box.height)
|
|
1494
|
+
};
|
|
1495
|
+
};
|
|
1496
|
+
const focus = () => keys.focus({ preventScroll: true });
|
|
1497
|
+
const button = (surface, pressed) => (event) => {
|
|
1498
|
+
focus();
|
|
1499
|
+
if (pressed) {
|
|
1500
|
+
wiring.dismissMenu();
|
|
1501
|
+
surface.setPointerCapture(event.pointerId);
|
|
1502
|
+
}
|
|
1503
|
+
if (event.button === 2) wiring.menuAt({
|
|
1504
|
+
x: event.clientX,
|
|
1505
|
+
y: event.clientY
|
|
1506
|
+
});
|
|
1507
|
+
const at = position(event);
|
|
1508
|
+
const pressedButton = BUTTONS[event.button];
|
|
1509
|
+
if (at !== void 0 && pressedButton !== void 0) send({
|
|
1510
|
+
case: "pointerButton",
|
|
1511
|
+
value: {
|
|
1512
|
+
...at,
|
|
1513
|
+
button: pressedButton,
|
|
1514
|
+
pressed
|
|
1515
|
+
}
|
|
1516
|
+
});
|
|
1517
|
+
event.preventDefault();
|
|
1518
|
+
};
|
|
1519
|
+
/**
|
|
1520
|
+
* A finger is no mouse: it has no buttons and nothing to turn. One that is put down and
|
|
1521
|
+
* lifted in place is a click of the left button; one that rests is a click of the right;
|
|
1522
|
+
* one that moves turns the wheel, so that the page scrolls under it as a page under a
|
|
1523
|
+
* finger does, and goes on for a while when it is flung. More fingers move the page as
|
|
1524
|
+
* one does: nothing is pressed while they are down.
|
|
1525
|
+
*/
|
|
1526
|
+
const touches = (surface) => {
|
|
1527
|
+
const fingers = /* @__PURE__ */ new Map();
|
|
1528
|
+
let gesture;
|
|
1529
|
+
let resting;
|
|
1530
|
+
let flung;
|
|
1531
|
+
const still = () => {
|
|
1532
|
+
clearTimeout(resting);
|
|
1533
|
+
if (flung !== void 0) {
|
|
1534
|
+
cancelAnimationFrame(flung);
|
|
1535
|
+
flung = void 0;
|
|
1536
|
+
}
|
|
1537
|
+
};
|
|
1538
|
+
signal.addEventListener("abort", still);
|
|
1539
|
+
/** The middle of the fingers, in the target's pixels. */
|
|
1540
|
+
const middle = () => {
|
|
1541
|
+
let clientX = 0;
|
|
1542
|
+
let clientY = 0;
|
|
1543
|
+
for (const finger of fingers.values()) {
|
|
1544
|
+
clientX += finger.clientX / fingers.size;
|
|
1545
|
+
clientY += finger.clientY / fingers.size;
|
|
1546
|
+
}
|
|
1547
|
+
return position({
|
|
1548
|
+
clientX,
|
|
1549
|
+
clientY
|
|
1550
|
+
});
|
|
1551
|
+
};
|
|
1552
|
+
const click = (at, pressedButton) => {
|
|
1553
|
+
send({
|
|
1554
|
+
case: "pointerMotion",
|
|
1555
|
+
value: at
|
|
1556
|
+
});
|
|
1557
|
+
send({
|
|
1558
|
+
case: "pointerButton",
|
|
1559
|
+
value: {
|
|
1560
|
+
...at,
|
|
1561
|
+
button: pressedButton,
|
|
1562
|
+
pressed: true
|
|
1563
|
+
}
|
|
1564
|
+
});
|
|
1565
|
+
send({
|
|
1566
|
+
case: "pointerButton",
|
|
1567
|
+
value: {
|
|
1568
|
+
...at,
|
|
1569
|
+
button: pressedButton,
|
|
1570
|
+
pressed: false
|
|
1571
|
+
}
|
|
1572
|
+
});
|
|
1573
|
+
};
|
|
1574
|
+
const scroll = (at, by) => {
|
|
1575
|
+
send({
|
|
1576
|
+
case: "pointerScroll",
|
|
1577
|
+
value: {
|
|
1578
|
+
...at,
|
|
1579
|
+
dx: by.x / NOTCH.pixels,
|
|
1580
|
+
dy: by.y / NOTCH.pixels
|
|
1581
|
+
}
|
|
1582
|
+
});
|
|
1583
|
+
wiring.dragged(by);
|
|
1584
|
+
};
|
|
1585
|
+
const fling = (at, speed) => {
|
|
1586
|
+
let before = performance.now();
|
|
1587
|
+
let going = speed;
|
|
1588
|
+
const step = (now) => {
|
|
1589
|
+
const elapsed = Math.min(now - before, 50);
|
|
1590
|
+
before = now;
|
|
1591
|
+
const kept = FLING.keeps ** elapsed;
|
|
1592
|
+
going = {
|
|
1593
|
+
x: going.x * kept,
|
|
1594
|
+
y: going.y * kept
|
|
1595
|
+
};
|
|
1596
|
+
if (Math.hypot(going.x, going.y) < FLING.stops) {
|
|
1597
|
+
flung = void 0;
|
|
1598
|
+
return;
|
|
1599
|
+
}
|
|
1600
|
+
scroll(at, {
|
|
1601
|
+
x: going.x * elapsed,
|
|
1602
|
+
y: going.y * elapsed
|
|
1603
|
+
});
|
|
1604
|
+
flung = requestAnimationFrame(step);
|
|
1605
|
+
};
|
|
1606
|
+
flung = requestAnimationFrame(step);
|
|
1607
|
+
};
|
|
1608
|
+
const down = (event) => {
|
|
1609
|
+
event.preventDefault();
|
|
1610
|
+
still();
|
|
1611
|
+
wiring.dismissMenu();
|
|
1612
|
+
surface.setPointerCapture(event.pointerId);
|
|
1613
|
+
fingers.set(event.pointerId, event);
|
|
1614
|
+
const at = position(event);
|
|
1615
|
+
if (fingers.size > 1 || at === void 0) {
|
|
1616
|
+
if (gesture !== void 0) {
|
|
1617
|
+
gesture.kind = gesture.kind === "held" ? "held" : "scroll";
|
|
1618
|
+
gesture.middle = void 0;
|
|
1619
|
+
}
|
|
1620
|
+
return;
|
|
1621
|
+
}
|
|
1622
|
+
const began = {
|
|
1623
|
+
clientX: event.clientX,
|
|
1624
|
+
clientY: event.clientY
|
|
1625
|
+
};
|
|
1626
|
+
gesture = {
|
|
1627
|
+
kind: "tap",
|
|
1628
|
+
began,
|
|
1629
|
+
at,
|
|
1630
|
+
middle: at,
|
|
1631
|
+
moved: 0,
|
|
1632
|
+
speed: {
|
|
1633
|
+
x: 0,
|
|
1634
|
+
y: 0
|
|
1635
|
+
}
|
|
1636
|
+
};
|
|
1637
|
+
send({
|
|
1638
|
+
case: "pointerMotion",
|
|
1639
|
+
value: at
|
|
1640
|
+
});
|
|
1641
|
+
resting = setTimeout(() => {
|
|
1642
|
+
if (gesture?.kind === "tap") {
|
|
1643
|
+
gesture.kind = "held";
|
|
1644
|
+
wiring.menuAt({
|
|
1645
|
+
x: began.clientX,
|
|
1646
|
+
y: began.clientY
|
|
1647
|
+
});
|
|
1648
|
+
click(at, 2);
|
|
1649
|
+
}
|
|
1650
|
+
}, LONG_PRESS_MS);
|
|
1651
|
+
};
|
|
1652
|
+
const move = (event) => {
|
|
1653
|
+
if (gesture === void 0 || !fingers.has(event.pointerId)) return;
|
|
1654
|
+
fingers.set(event.pointerId, event);
|
|
1655
|
+
if (gesture.kind === "tap") {
|
|
1656
|
+
if (Math.hypot(event.clientX - gesture.began.clientX, event.clientY - gesture.began.clientY) <= TAP_SLOP) return;
|
|
1657
|
+
clearTimeout(resting);
|
|
1658
|
+
gesture.kind = "scroll";
|
|
1659
|
+
gesture.middle = void 0;
|
|
1660
|
+
}
|
|
1661
|
+
if (gesture.kind !== "scroll") return;
|
|
1662
|
+
const now = middle();
|
|
1663
|
+
const before = gesture.middle;
|
|
1664
|
+
gesture.middle = now;
|
|
1665
|
+
if (now === void 0 || before === void 0) {
|
|
1666
|
+
gesture.moved = event.timeStamp;
|
|
1667
|
+
return;
|
|
1668
|
+
}
|
|
1669
|
+
const by = {
|
|
1670
|
+
x: before.x - now.x,
|
|
1671
|
+
y: before.y - now.y
|
|
1672
|
+
};
|
|
1673
|
+
scroll(gesture.at, by);
|
|
1674
|
+
const elapsed = Math.max(event.timeStamp - gesture.moved, 1);
|
|
1675
|
+
gesture.moved = event.timeStamp;
|
|
1676
|
+
gesture.speed = {
|
|
1677
|
+
x: gesture.speed.x * .6 + by.x / elapsed * .4,
|
|
1678
|
+
y: gesture.speed.y * .6 + by.y / elapsed * .4
|
|
1679
|
+
};
|
|
1680
|
+
};
|
|
1681
|
+
const up = (lifted) => (event) => {
|
|
1682
|
+
if (!fingers.delete(event.pointerId) || gesture === void 0) return;
|
|
1683
|
+
event.preventDefault();
|
|
1684
|
+
if (fingers.size > 0) {
|
|
1685
|
+
gesture.middle = void 0;
|
|
1686
|
+
return;
|
|
1687
|
+
}
|
|
1688
|
+
clearTimeout(resting);
|
|
1689
|
+
const ended = gesture;
|
|
1690
|
+
gesture = void 0;
|
|
1691
|
+
if (!lifted) return;
|
|
1692
|
+
if (ended.kind === "tap") click(ended.at, 1);
|
|
1693
|
+
else if (ended.kind === "scroll" && event.timeStamp - ended.moved < 100 && Math.hypot(ended.speed.x, ended.speed.y) > FLING.least) fling(ended.at, ended.speed);
|
|
1694
|
+
};
|
|
1695
|
+
return {
|
|
1696
|
+
down,
|
|
1697
|
+
move,
|
|
1698
|
+
up: up(true),
|
|
1699
|
+
cancel: up(false)
|
|
1700
|
+
};
|
|
1701
|
+
};
|
|
1702
|
+
const dropped = async (at, files, carried) => {
|
|
1703
|
+
const forms = files.length > 0 ? [await wiring.listed(files)] : carried;
|
|
1704
|
+
if (forms.length > 0) send({
|
|
1705
|
+
case: "drop",
|
|
1706
|
+
value: {
|
|
1707
|
+
...at,
|
|
1708
|
+
content: { forms: [...forms] }
|
|
1709
|
+
}
|
|
1710
|
+
});
|
|
1711
|
+
};
|
|
1712
|
+
const pictures = [video, canvas];
|
|
1713
|
+
for (const surface of pictures) {
|
|
1714
|
+
const finger = touches(surface);
|
|
1715
|
+
const byFinger = (event) => event.pointerType === "touch";
|
|
1716
|
+
const pressed = button(surface, true);
|
|
1717
|
+
const released = button(surface, false);
|
|
1718
|
+
surface.addEventListener("pointermove", (event) => {
|
|
1719
|
+
if (byFinger(event)) {
|
|
1720
|
+
finger.move(event);
|
|
1721
|
+
return;
|
|
1722
|
+
}
|
|
1723
|
+
const at = position(event);
|
|
1724
|
+
if (at !== void 0) send({
|
|
1725
|
+
case: "pointerMotion",
|
|
1726
|
+
value: at
|
|
1727
|
+
});
|
|
1728
|
+
}, { signal });
|
|
1729
|
+
surface.addEventListener("pointerleave", () => send({
|
|
1730
|
+
case: "pointerLeave",
|
|
1731
|
+
value: {}
|
|
1732
|
+
}), { signal });
|
|
1733
|
+
surface.addEventListener("pointerdown", (event) => byFinger(event) ? finger.down(event) : pressed(event), { signal });
|
|
1734
|
+
surface.addEventListener("pointerup", (event) => byFinger(event) ? finger.up(event) : released(event), { signal });
|
|
1735
|
+
surface.addEventListener("pointercancel", (event) => byFinger(event) ? finger.cancel(event) : void 0, { signal });
|
|
1736
|
+
surface.addEventListener("contextmenu", (event) => event.preventDefault(), { signal });
|
|
1737
|
+
surface.addEventListener("wheel", (event) => {
|
|
1738
|
+
const at = position(event);
|
|
1739
|
+
const notch = event.deltaMode === WheelEvent.DOM_DELTA_PIXEL ? NOTCH.pixels : NOTCH.lines;
|
|
1740
|
+
if (at !== void 0) {
|
|
1741
|
+
const scrolled = {
|
|
1742
|
+
...at,
|
|
1743
|
+
dx: event.deltaX / notch,
|
|
1744
|
+
dy: event.deltaY / notch
|
|
1745
|
+
};
|
|
1746
|
+
send({
|
|
1747
|
+
case: "pointerScroll",
|
|
1748
|
+
value: scrolled
|
|
1749
|
+
});
|
|
1750
|
+
}
|
|
1751
|
+
event.preventDefault();
|
|
1752
|
+
}, {
|
|
1753
|
+
passive: false,
|
|
1754
|
+
signal
|
|
1755
|
+
});
|
|
1756
|
+
surface.addEventListener("dragover", (event) => {
|
|
1757
|
+
event.preventDefault();
|
|
1758
|
+
if (event.dataTransfer !== null) event.dataTransfer.dropEffect = "copy";
|
|
1759
|
+
}, { signal });
|
|
1760
|
+
surface.addEventListener("drop", (event) => {
|
|
1761
|
+
event.preventDefault();
|
|
1762
|
+
const at = position(event);
|
|
1763
|
+
const carried = event.dataTransfer;
|
|
1764
|
+
if (at === void 0 || carried === null) return;
|
|
1765
|
+
dropped(at, [...carried.files], texts(carried)).catch((cause) => wiring.failed("a drop", cause));
|
|
1766
|
+
}, { signal });
|
|
1767
|
+
}
|
|
1768
|
+
const text = (written, composing = false) => send({
|
|
1769
|
+
case: "text",
|
|
1770
|
+
value: {
|
|
1771
|
+
text: written,
|
|
1772
|
+
composing
|
|
1773
|
+
}
|
|
1774
|
+
});
|
|
1775
|
+
const rest = () => {
|
|
1776
|
+
keys.value = " ";
|
|
1777
|
+
};
|
|
1778
|
+
rest();
|
|
1779
|
+
keys.addEventListener("keydown", (event) => {
|
|
1780
|
+
if (event.key === "Escape") wiring.dismissMenu();
|
|
1781
|
+
if (event.isComposing || event.keyCode === 229) return;
|
|
1782
|
+
const code = KEYS[event.code];
|
|
1783
|
+
if (code === void 0) return;
|
|
1784
|
+
const shortcut = event.ctrlKey || event.metaKey;
|
|
1785
|
+
if (shortcut && event.code === "KeyV") return;
|
|
1786
|
+
const written = Array.from(event.key).length === 1 && !shortcut ? event.key : void 0;
|
|
1787
|
+
const same = US[event.code]?.[event.shiftKey ? 1 : 0] === written;
|
|
1788
|
+
if (written === void 0 || same) keyboard.press(code, true);
|
|
1789
|
+
else text(written);
|
|
1790
|
+
event.preventDefault();
|
|
1791
|
+
}, { signal });
|
|
1792
|
+
keys.addEventListener("keyup", (event) => {
|
|
1793
|
+
const code = KEYS[event.code];
|
|
1794
|
+
if (code !== void 0) keyboard.press(code, false);
|
|
1795
|
+
event.preventDefault();
|
|
1796
|
+
}, { signal });
|
|
1797
|
+
keys.addEventListener("blur", () => keyboard.releaseAll(), { signal });
|
|
1798
|
+
keys.addEventListener("compositionupdate", (event) => text(event.data, true), { signal });
|
|
1799
|
+
keys.addEventListener("compositionend", (event) => {
|
|
1800
|
+
text(event.data);
|
|
1801
|
+
rest();
|
|
1802
|
+
}, { signal });
|
|
1803
|
+
keys.addEventListener("beforeinput", (event) => {
|
|
1804
|
+
if (event.isComposing || /Composition/u.test(event.inputType)) return;
|
|
1805
|
+
event.preventDefault();
|
|
1806
|
+
if (/^insert(?:Text|ReplacementText)$/u.test(event.inputType) && event.data) text(event.data);
|
|
1807
|
+
if (/^insert(?:LineBreak|Paragraph)$/u.test(event.inputType)) keyboard.tap(KEY.enter);
|
|
1808
|
+
if (event.inputType === "deleteContentBackward") keyboard.tap(KEY.backspace);
|
|
1809
|
+
if (event.inputType === "deleteContentForward") keyboard.tap(KEY.delete);
|
|
1810
|
+
}, { signal });
|
|
1811
|
+
keys.addEventListener("input", rest, { signal });
|
|
1812
|
+
const pasted = async (carried, files) => {
|
|
1813
|
+
const forms = [...carried];
|
|
1814
|
+
const [only] = files;
|
|
1815
|
+
const picture = files.length === 1 && only?.type.startsWith("image/") ? only : void 0;
|
|
1816
|
+
if (picture !== void 0) forms.push(await form("image/png", await png(picture)));
|
|
1817
|
+
else if (files.length > 0) forms.push(await wiring.listed(files));
|
|
1818
|
+
if (forms.length === 0) return;
|
|
1819
|
+
send({
|
|
1820
|
+
case: "clipboard",
|
|
1821
|
+
value: { forms }
|
|
1822
|
+
});
|
|
1823
|
+
keyboard.paste();
|
|
1824
|
+
};
|
|
1825
|
+
keys.addEventListener("paste", (event) => {
|
|
1826
|
+
event.preventDefault();
|
|
1827
|
+
const carried = event.clipboardData;
|
|
1828
|
+
if (carried === null) return;
|
|
1829
|
+
pasted(texts(carried), [...carried.files]).catch((cause) => wiring.failed("a paste", cause));
|
|
1830
|
+
}, { signal });
|
|
1831
|
+
if (typeof ResizeObserver !== "undefined") {
|
|
1832
|
+
let settling;
|
|
1833
|
+
const sizes = new ResizeObserver(() => {
|
|
1834
|
+
clearTimeout(settling);
|
|
1835
|
+
settling = setTimeout(wiring.resized, RESIZE_SETTLES_MS);
|
|
1836
|
+
});
|
|
1837
|
+
sizes.observe(stage);
|
|
1838
|
+
signal.addEventListener("abort", () => {
|
|
1839
|
+
clearTimeout(settling);
|
|
1840
|
+
sizes.disconnect();
|
|
1841
|
+
});
|
|
1842
|
+
}
|
|
1843
|
+
});
|
|
1844
|
+
//#endregion
|
|
1845
|
+
//#region src/model.ts
|
|
1846
|
+
const NOTHING = {
|
|
1847
|
+
read: false,
|
|
1848
|
+
write: false
|
|
1849
|
+
};
|
|
1850
|
+
/** What a client may do before the session has told: nothing. */
|
|
1851
|
+
const NO_FEATURES = {
|
|
1852
|
+
input: NOTHING,
|
|
1853
|
+
tabs: NOTHING,
|
|
1854
|
+
lease: NOTHING,
|
|
1855
|
+
sound: NOTHING,
|
|
1856
|
+
clipboard: NOTHING,
|
|
1857
|
+
uploads: NOTHING,
|
|
1858
|
+
downloads: NOTHING,
|
|
1859
|
+
recordings: NOTHING,
|
|
1860
|
+
mcp: NOTHING,
|
|
1861
|
+
cdp: NOTHING,
|
|
1862
|
+
tunnel: NOTHING
|
|
1863
|
+
};
|
|
1864
|
+
const grantOf = (grant) => grant === void 0 ? NOTHING : {
|
|
1865
|
+
read: grant.read,
|
|
1866
|
+
write: grant.write
|
|
1867
|
+
};
|
|
1868
|
+
const featuresOf = (features) => ({
|
|
1869
|
+
input: grantOf(features.input),
|
|
1870
|
+
tabs: grantOf(features.tabs),
|
|
1871
|
+
lease: grantOf(features.lease),
|
|
1872
|
+
sound: grantOf(features.sound),
|
|
1873
|
+
clipboard: grantOf(features.clipboard),
|
|
1874
|
+
uploads: grantOf(features.uploads),
|
|
1875
|
+
downloads: grantOf(features.downloads),
|
|
1876
|
+
recordings: grantOf(features.recordings),
|
|
1877
|
+
mcp: grantOf(features.mcp),
|
|
1878
|
+
cdp: grantOf(features.cdp),
|
|
1879
|
+
tunnel: grantOf(features.tunnel)
|
|
1880
|
+
});
|
|
1881
|
+
const restoringOf = (told) => told.underway || told.failure !== void 0 ? {
|
|
1882
|
+
tabs: told.tabs,
|
|
1883
|
+
cookies: told.cookies,
|
|
1884
|
+
origins: told.origins,
|
|
1885
|
+
failure: told.failure
|
|
1886
|
+
} : void 0;
|
|
1887
|
+
const paceOf = (pace) => {
|
|
1888
|
+
switch (pace) {
|
|
1889
|
+
case 1: return "instant";
|
|
1890
|
+
case 3: return "slow";
|
|
1891
|
+
default: return "fast";
|
|
1892
|
+
}
|
|
1893
|
+
};
|
|
1894
|
+
const FORMATS = {
|
|
1895
|
+
h264: 1,
|
|
1896
|
+
"full-chroma": 2,
|
|
1897
|
+
h265: 3,
|
|
1898
|
+
vp9: 4,
|
|
1899
|
+
"vp9-full-chroma": 5,
|
|
1900
|
+
av1: 6
|
|
1901
|
+
};
|
|
1902
|
+
const QUALITIES = {
|
|
1903
|
+
low: 1,
|
|
1904
|
+
medium: 2,
|
|
1905
|
+
full: 3
|
|
1906
|
+
};
|
|
1907
|
+
const PIXELS = {
|
|
1908
|
+
video: 1,
|
|
1909
|
+
frames: 3,
|
|
1910
|
+
tiles: 2
|
|
1911
|
+
};
|
|
1912
|
+
const ALONGS = {
|
|
1913
|
+
back: 1,
|
|
1914
|
+
forward: 2,
|
|
1915
|
+
reload: 3
|
|
1916
|
+
};
|
|
1917
|
+
const LEASE_ACTIONS = {
|
|
1918
|
+
take: 1,
|
|
1919
|
+
release: 2,
|
|
1920
|
+
allow: 3,
|
|
1921
|
+
keep: 4
|
|
1922
|
+
};
|
|
1923
|
+
const PAGE_MODES = {
|
|
1924
|
+
auto: 1,
|
|
1925
|
+
desktop: 2,
|
|
1926
|
+
mobile: 3
|
|
1927
|
+
};
|
|
1928
|
+
const ROLES = {
|
|
1929
|
+
[1]: "view",
|
|
1930
|
+
[2]: "control",
|
|
1931
|
+
[3]: "admin"
|
|
1932
|
+
};
|
|
1933
|
+
const ASKED = {
|
|
1934
|
+
[1]: "go",
|
|
1935
|
+
[2]: "close",
|
|
1936
|
+
[3]: "copyPicture",
|
|
1937
|
+
[4]: "chooseFiles",
|
|
1938
|
+
[5]: "follow",
|
|
1939
|
+
[6]: "setMode"
|
|
1940
|
+
};
|
|
1941
|
+
const STROKE_PHASES = {
|
|
1942
|
+
[1]: "start",
|
|
1943
|
+
[2]: "move",
|
|
1944
|
+
[3]: "end"
|
|
1945
|
+
};
|
|
1946
|
+
const STROKE_PHASE = {
|
|
1947
|
+
start: 1,
|
|
1948
|
+
move: 2,
|
|
1949
|
+
end: 3
|
|
1950
|
+
};
|
|
1951
|
+
const pointerOf = (pointer) => ({
|
|
1952
|
+
member: Number(pointer.member),
|
|
1953
|
+
at: pointer.at === void 0 ? void 0 : {
|
|
1954
|
+
x: pointer.at.x,
|
|
1955
|
+
y: pointer.at.y
|
|
1956
|
+
}
|
|
1957
|
+
});
|
|
1958
|
+
/** None for a point of a phase this client does not know. */
|
|
1959
|
+
const strokeOf = (stroke) => {
|
|
1960
|
+
const phase = STROKE_PHASES[stroke.phase];
|
|
1961
|
+
return phase === void 0 ? void 0 : {
|
|
1962
|
+
member: Number(stroke.member),
|
|
1963
|
+
stroke: stroke.stroke,
|
|
1964
|
+
phase,
|
|
1965
|
+
x: stroke.x,
|
|
1966
|
+
y: stroke.y
|
|
1967
|
+
};
|
|
1968
|
+
};
|
|
1969
|
+
const failureOf = (failed) => ({
|
|
1970
|
+
asked: ASKED[failed.asked],
|
|
1971
|
+
reason: failed.reason
|
|
1972
|
+
});
|
|
1973
|
+
const DOWNLOAD_STATES = {
|
|
1974
|
+
[1]: "running",
|
|
1975
|
+
[2]: "done",
|
|
1976
|
+
[3]: "failed"
|
|
1977
|
+
};
|
|
1978
|
+
const named = (names, value) => {
|
|
1979
|
+
return Object.entries(names).find(([, one]) => one === value)?.[0];
|
|
1980
|
+
};
|
|
1981
|
+
const formatOf = (format) => named(FORMATS, format);
|
|
1982
|
+
const qualityOf = (quality) => named(QUALITIES, quality);
|
|
1983
|
+
const count = (id) => id === void 0 ? void 0 : Number(id);
|
|
1984
|
+
const targetOf = (target) => ({
|
|
1985
|
+
id: target.id,
|
|
1986
|
+
tab: target.tab,
|
|
1987
|
+
title: target.title,
|
|
1988
|
+
url: target.url,
|
|
1989
|
+
width: target.width,
|
|
1990
|
+
height: target.height,
|
|
1991
|
+
scale: target.scale,
|
|
1992
|
+
mode: named(PAGE_MODES, target.mode) ?? "auto",
|
|
1993
|
+
mobile: target.mobile,
|
|
1994
|
+
sounds: target.sounds,
|
|
1995
|
+
goesBack: target.goesBack,
|
|
1996
|
+
goesForward: target.goesForward
|
|
1997
|
+
});
|
|
1998
|
+
const presenceOf = (presence) => ({
|
|
1999
|
+
you: Number(presence.you),
|
|
2000
|
+
members: presence.members.map((member) => ({
|
|
2001
|
+
id: Number(member.id),
|
|
2002
|
+
name: member.name,
|
|
2003
|
+
role: ROLES[member.role],
|
|
2004
|
+
tab: member.tab,
|
|
2005
|
+
agent: member.agent,
|
|
2006
|
+
follows: count(member.follows)
|
|
2007
|
+
})),
|
|
2008
|
+
held: presence.held.map((held) => ({
|
|
2009
|
+
tab: held.tab,
|
|
2010
|
+
holder: Number(held.holder),
|
|
2011
|
+
askedBy: count(held.askedBy)
|
|
2012
|
+
}))
|
|
2013
|
+
});
|
|
2014
|
+
const downloadOf = (download) => ({
|
|
2015
|
+
id: download.id,
|
|
2016
|
+
name: download.name,
|
|
2017
|
+
url: download.url,
|
|
2018
|
+
receivedBytes: Number(download.receivedBytes),
|
|
2019
|
+
totalBytes: count(download.totalBytes),
|
|
2020
|
+
state: DOWNLOAD_STATES[download.state]
|
|
2021
|
+
});
|
|
2022
|
+
const fileRequestOf = (request) => ({
|
|
2023
|
+
id: Number(request.id),
|
|
2024
|
+
tab: request.tab,
|
|
2025
|
+
multiple: request.multiple
|
|
2026
|
+
});
|
|
2027
|
+
const menuOf = (menu) => ({
|
|
2028
|
+
link: menu.link,
|
|
2029
|
+
image: menu.image,
|
|
2030
|
+
text: menu.text,
|
|
2031
|
+
editable: menu.editable
|
|
2032
|
+
});
|
|
2033
|
+
const statusOf = (status) => ({
|
|
2034
|
+
format: formatOf(status.format),
|
|
2035
|
+
quality: qualityOf(status.quality),
|
|
2036
|
+
fps: status.fps
|
|
2037
|
+
});
|
|
2038
|
+
//#endregion
|
|
2039
|
+
//#region src/socket.ts
|
|
2040
|
+
const encode = (message) => toBinary(ClientMessageSchema, create(ClientMessageSchema, { message }));
|
|
2041
|
+
const decode = (data) => {
|
|
2042
|
+
if (typeof data === "string") return fromJsonString(ServerMessageSchema, data, { ignoreUnknownFields: true });
|
|
2043
|
+
if (data instanceof ArrayBuffer) return fromBinary(ServerMessageSchema, new Uint8Array(data));
|
|
2044
|
+
};
|
|
2045
|
+
/** Opens the session socket. Closing the scope closes it, and `closed` is not told then. */
|
|
2046
|
+
const open = Effect.fn("Socket.open")(function* (url, handlers) {
|
|
2047
|
+
const listening = new AbortController();
|
|
2048
|
+
const socket = yield* Effect.acquireRelease(Effect.sync(() => {
|
|
2049
|
+
const opened = new WebSocket(url);
|
|
2050
|
+
opened.binaryType = "arraybuffer";
|
|
2051
|
+
return opened;
|
|
2052
|
+
}), (opened) => Effect.sync(() => {
|
|
2053
|
+
listening.abort();
|
|
2054
|
+
opened.close();
|
|
2055
|
+
}));
|
|
2056
|
+
const { signal } = listening;
|
|
2057
|
+
socket.addEventListener("open", () => handlers.opened(), { signal });
|
|
2058
|
+
socket.addEventListener("message", (event) => {
|
|
2059
|
+
let decoded;
|
|
2060
|
+
try {
|
|
2061
|
+
decoded = decode(event.data);
|
|
2062
|
+
} catch {
|
|
2063
|
+
return;
|
|
2064
|
+
}
|
|
2065
|
+
const message = decoded?.message;
|
|
2066
|
+
if (message !== void 0 && message.case !== void 0) handlers.message(message);
|
|
2067
|
+
}, { signal });
|
|
2068
|
+
socket.addEventListener("close", (event) => handlers.closed(event.reason === "" ? void 0 : event.reason), { signal });
|
|
2069
|
+
return {
|
|
2070
|
+
isOpen: () => socket.readyState === WebSocket.OPEN,
|
|
2071
|
+
send: (message) => {
|
|
2072
|
+
if (socket.readyState !== WebSocket.OPEN) return false;
|
|
2073
|
+
socket.send(encode(message));
|
|
2074
|
+
return true;
|
|
2075
|
+
}
|
|
2076
|
+
};
|
|
2077
|
+
});
|
|
2078
|
+
//#endregion
|
|
2079
|
+
//#region src/sound.ts
|
|
2080
|
+
/** How far ahead of now sound starts that came too late for its turn, in seconds. */
|
|
2081
|
+
const AHEAD = .06;
|
|
2082
|
+
/** Sound that would wait longer than this is left out: it stays with the picture. */
|
|
2083
|
+
const WAIT_MOST = .4;
|
|
2084
|
+
/**
|
|
2085
|
+
* The session's sound. With a WebRTC connection it comes on a track of that; otherwise as
|
|
2086
|
+
* packets on the session socket, which are decoded and played one after the other.
|
|
2087
|
+
*/
|
|
2088
|
+
const make$1 = Effect.fn("Sound.make")(function* () {
|
|
2089
|
+
const speaker = typeof Audio === "undefined" ? void 0 : new Audio();
|
|
2090
|
+
if (speaker !== void 0) {
|
|
2091
|
+
speaker.autoplay = true;
|
|
2092
|
+
speaker.muted = true;
|
|
2093
|
+
}
|
|
2094
|
+
let on = false;
|
|
2095
|
+
let context;
|
|
2096
|
+
let decoder;
|
|
2097
|
+
let playAt = 0;
|
|
2098
|
+
const play = (ears, audio) => {
|
|
2099
|
+
const buffer = ears.createBuffer(audio.numberOfChannels, audio.numberOfFrames, audio.sampleRate);
|
|
2100
|
+
for (let channel = 0; channel < audio.numberOfChannels; channel++) audio.copyTo(buffer.getChannelData(channel), {
|
|
2101
|
+
planeIndex: channel,
|
|
2102
|
+
format: "f32-planar"
|
|
2103
|
+
});
|
|
2104
|
+
audio.close();
|
|
2105
|
+
const now = ears.currentTime;
|
|
2106
|
+
if (playAt < now) playAt = now + AHEAD;
|
|
2107
|
+
if (playAt > now + WAIT_MOST) return;
|
|
2108
|
+
const source = ears.createBufferSource();
|
|
2109
|
+
source.buffer = buffer;
|
|
2110
|
+
source.connect(ears.destination);
|
|
2111
|
+
source.start(playAt);
|
|
2112
|
+
playAt += buffer.duration;
|
|
2113
|
+
};
|
|
2114
|
+
const listen = () => {
|
|
2115
|
+
if (typeof AudioContext === "undefined" || typeof AudioDecoder === "undefined") return;
|
|
2116
|
+
context ??= new AudioContext({
|
|
2117
|
+
sampleRate: 48e3,
|
|
2118
|
+
latencyHint: "interactive"
|
|
2119
|
+
});
|
|
2120
|
+
const ears = context;
|
|
2121
|
+
if (decoder?.state !== "configured") {
|
|
2122
|
+
decoder = new AudioDecoder({
|
|
2123
|
+
output: (audio) => play(ears, audio),
|
|
2124
|
+
error: () => {}
|
|
2125
|
+
});
|
|
2126
|
+
decoder.configure({
|
|
2127
|
+
codec: "opus",
|
|
2128
|
+
sampleRate: 48e3,
|
|
2129
|
+
numberOfChannels: 2
|
|
2130
|
+
});
|
|
2131
|
+
}
|
|
2132
|
+
return decoder;
|
|
2133
|
+
};
|
|
2134
|
+
const start = () => {
|
|
2135
|
+
if (!on) return;
|
|
2136
|
+
speaker?.play().catch(() => {});
|
|
2137
|
+
context?.resume().catch(() => {});
|
|
2138
|
+
};
|
|
2139
|
+
const gestures = new AbortController();
|
|
2140
|
+
if (typeof document !== "undefined") for (const gesture of ["pointerdown", "keydown"]) document.addEventListener(gesture, start, {
|
|
2141
|
+
capture: true,
|
|
2142
|
+
signal: gestures.signal
|
|
2143
|
+
});
|
|
2144
|
+
yield* Effect.addFinalizer(() => Effect.sync(() => {
|
|
2145
|
+
on = false;
|
|
2146
|
+
gestures.abort();
|
|
2147
|
+
if (decoder !== void 0 && decoder.state !== "closed") decoder.close();
|
|
2148
|
+
context?.close().catch(() => {});
|
|
2149
|
+
if (speaker !== void 0) {
|
|
2150
|
+
speaker.pause();
|
|
2151
|
+
speaker.srcObject = null;
|
|
2152
|
+
}
|
|
2153
|
+
}));
|
|
2154
|
+
return {
|
|
2155
|
+
turn: (wanted) => {
|
|
2156
|
+
on = wanted;
|
|
2157
|
+
if (speaker !== void 0) speaker.muted = !wanted;
|
|
2158
|
+
start();
|
|
2159
|
+
},
|
|
2160
|
+
track: (track) => {
|
|
2161
|
+
if (speaker !== void 0) speaker.srcObject = track === void 0 ? null : new MediaStream([track]);
|
|
2162
|
+
},
|
|
2163
|
+
hear: (timeUs, data) => {
|
|
2164
|
+
if (!on) return;
|
|
2165
|
+
const heard = listen();
|
|
2166
|
+
if (heard === void 0) return;
|
|
2167
|
+
try {
|
|
2168
|
+
heard.decode(new EncodedAudioChunk({
|
|
2169
|
+
type: "key",
|
|
2170
|
+
timestamp: Number(timeUs),
|
|
2171
|
+
data
|
|
2172
|
+
}));
|
|
2173
|
+
} catch {}
|
|
2174
|
+
}
|
|
2175
|
+
};
|
|
2176
|
+
});
|
|
2177
|
+
//#endregion
|
|
2178
|
+
//#region src/surface.ts
|
|
2179
|
+
const context = (canvas) => canvas instanceof HTMLCanvasElement ? canvas.getContext("2d") : canvas.getContext("2d");
|
|
2180
|
+
const makeSurface = () => {
|
|
2181
|
+
let canvas;
|
|
2182
|
+
let attached = false;
|
|
2183
|
+
return {
|
|
2184
|
+
size: () => ({
|
|
2185
|
+
width: canvas?.width ?? 0,
|
|
2186
|
+
height: canvas?.height ?? 0
|
|
2187
|
+
}),
|
|
2188
|
+
draw: (image, x, y, width, height) => {
|
|
2189
|
+
if (canvas === void 0 && typeof OffscreenCanvas !== "undefined") canvas = new OffscreenCanvas(width, height);
|
|
2190
|
+
const onto = canvas;
|
|
2191
|
+
if (onto === void 0) return;
|
|
2192
|
+
if (onto.width !== width || onto.height !== height) {
|
|
2193
|
+
onto.width = width;
|
|
2194
|
+
onto.height = height;
|
|
2195
|
+
}
|
|
2196
|
+
context(onto)?.drawImage(image, x, y);
|
|
2197
|
+
},
|
|
2198
|
+
attach: (element) => {
|
|
2199
|
+
const kept = canvas;
|
|
2200
|
+
if (kept !== void 0 && kept !== element && kept.width > 0 && kept.height > 0) {
|
|
2201
|
+
element.width = kept.width;
|
|
2202
|
+
element.height = kept.height;
|
|
2203
|
+
context(element)?.drawImage(kept, 0, 0);
|
|
2204
|
+
}
|
|
2205
|
+
canvas = element;
|
|
2206
|
+
attached = true;
|
|
2207
|
+
},
|
|
2208
|
+
detach: () => {
|
|
2209
|
+
if (!attached) return;
|
|
2210
|
+
const shown = canvas;
|
|
2211
|
+
canvas = void 0;
|
|
2212
|
+
attached = false;
|
|
2213
|
+
if (shown === void 0 || !(typeof OffscreenCanvas !== "undefined") || shown.width === 0 || shown.height === 0) return;
|
|
2214
|
+
canvas = new OffscreenCanvas(shown.width, shown.height);
|
|
2215
|
+
context(canvas)?.drawImage(shown, 0, 0);
|
|
2216
|
+
}
|
|
2217
|
+
};
|
|
2218
|
+
};
|
|
2219
|
+
//#endregion
|
|
2220
|
+
//#region src/session.ts
|
|
2221
|
+
/** A WebRTC connection that says nothing for this long is taken not to connect. */
|
|
2222
|
+
const RTC_CONNECTS_WITHIN = "8 seconds";
|
|
2223
|
+
/**
|
|
2224
|
+
* What frames are asked for when the choice is left to this client: sharp color where
|
|
2225
|
+
* frames are decoded here. Over WebRTC the session picks what every browser takes.
|
|
2226
|
+
*/
|
|
2227
|
+
const BEST_FRAMES = ["full-chroma", "h264"];
|
|
2228
|
+
/** How long sound that was sent before a tab was to be heard keeps arriving. */
|
|
2229
|
+
const SOUND_SETTLES_MS = 300;
|
|
2230
|
+
const pixels = (side) => Math.max(0, Math.round(side));
|
|
2231
|
+
/** The widest the shorter side of a phone's window is, in CSS pixels. */
|
|
2232
|
+
const PHONE_WITHIN = 600;
|
|
2233
|
+
/**
|
|
2234
|
+
* The most pixels a page shown as on a phone draws to one of its own, unless it is given
|
|
2235
|
+
* another scale: a phone's screen has three and more, and a picture of that many is three
|
|
2236
|
+
* times the video of one of two, which reads as well on a screen that small.
|
|
2237
|
+
*/
|
|
2238
|
+
const SHARPEST = 2;
|
|
2239
|
+
/**
|
|
2240
|
+
* Whether this is a phone: a finger is what points, and the window is narrow. A tablet
|
|
2241
|
+
* and a laptop with a touch screen are none.
|
|
2242
|
+
*/
|
|
2243
|
+
const onPhone = () => typeof window !== "undefined" && typeof window.matchMedia === "function" && window.matchMedia("(pointer: coarse)").matches && Math.min(window.innerWidth, window.innerHeight) <= PHONE_WITHIN;
|
|
2244
|
+
/**
|
|
2245
|
+
* Connects to a session. Closing the scope unwires what is attached, ends the picture's
|
|
2246
|
+
* WebRTC connection and decoder, then the sound, then the session socket.
|
|
2247
|
+
*/
|
|
2248
|
+
const make = Effect.fn("Session.make")(function* (options) {
|
|
2249
|
+
const address = {
|
|
2250
|
+
url: options.url,
|
|
2251
|
+
token: options.token,
|
|
2252
|
+
name: options.name
|
|
2253
|
+
};
|
|
2254
|
+
const ways = waysHere();
|
|
2255
|
+
let way = ways[Math.max(0, ways.indexOf(options.pixels ?? "video"))] ?? "tiles";
|
|
2256
|
+
let settings = {};
|
|
2257
|
+
let closed = false;
|
|
2258
|
+
let sounds = false;
|
|
2259
|
+
let fitting = false;
|
|
2260
|
+
let attached;
|
|
2261
|
+
let menuAt = {
|
|
2262
|
+
x: 0,
|
|
2263
|
+
y: 0
|
|
2264
|
+
};
|
|
2265
|
+
let snapshot = {
|
|
2266
|
+
connection: { state: "connecting" },
|
|
2267
|
+
targets: [],
|
|
2268
|
+
selected: void 0,
|
|
2269
|
+
presence: void 0,
|
|
2270
|
+
downloads: [],
|
|
2271
|
+
fileRequests: [],
|
|
2272
|
+
cursor: "default",
|
|
2273
|
+
picture: {
|
|
2274
|
+
way,
|
|
2275
|
+
ways,
|
|
2276
|
+
status: void 0,
|
|
2277
|
+
formats: [],
|
|
2278
|
+
settings,
|
|
2279
|
+
rtc: void 0
|
|
2280
|
+
},
|
|
2281
|
+
features: NO_FEATURES,
|
|
2282
|
+
pace: "fast",
|
|
2283
|
+
restoring: void 0,
|
|
2284
|
+
muted: [],
|
|
2285
|
+
menu: void 0,
|
|
2286
|
+
fit: false,
|
|
2287
|
+
phone: onPhone()
|
|
2288
|
+
};
|
|
2289
|
+
const listeners = /* @__PURE__ */ new Set();
|
|
2290
|
+
const clipboardListeners = /* @__PURE__ */ new Set();
|
|
2291
|
+
const update = (change) => {
|
|
2292
|
+
const changed = Object.entries(change).filter(([key, value]) => !Equal.equals(snapshot[key], value));
|
|
2293
|
+
if (changed.length === 0) return;
|
|
2294
|
+
snapshot = {
|
|
2295
|
+
...snapshot,
|
|
2296
|
+
...Object.fromEntries(changed)
|
|
2297
|
+
};
|
|
2298
|
+
for (const listener of listeners) listener();
|
|
2299
|
+
};
|
|
2300
|
+
const updatePicture = (change) => {
|
|
2301
|
+
update({ picture: {
|
|
2302
|
+
...snapshot.picture,
|
|
2303
|
+
...change
|
|
2304
|
+
} });
|
|
2305
|
+
};
|
|
2306
|
+
const listening = (listeners) => (listener) => {
|
|
2307
|
+
listeners.add(listener);
|
|
2308
|
+
return () => {
|
|
2309
|
+
listeners.delete(listener);
|
|
2310
|
+
};
|
|
2311
|
+
};
|
|
2312
|
+
const subscribe = listening(listeners);
|
|
2313
|
+
const onClipboard = listening(clipboardListeners);
|
|
2314
|
+
const draggedListeners = /* @__PURE__ */ new Set();
|
|
2315
|
+
const onDragged = listening(draggedListeners);
|
|
2316
|
+
const failureListeners = /* @__PURE__ */ new Set();
|
|
2317
|
+
const onFailure = listening(failureListeners);
|
|
2318
|
+
const pointerListeners = /* @__PURE__ */ new Set();
|
|
2319
|
+
const strokeListeners = /* @__PURE__ */ new Set();
|
|
2320
|
+
const watched = () => snapshot.targets.find((target) => target.tab === snapshot.selected);
|
|
2321
|
+
const socket = yield* open(socketUrl(address), {
|
|
2322
|
+
opened: () => {
|
|
2323
|
+
update({ connection: { state: "open" } });
|
|
2324
|
+
socket.send({
|
|
2325
|
+
case: "device",
|
|
2326
|
+
value: { phone: snapshot.phone }
|
|
2327
|
+
});
|
|
2328
|
+
runFork(start());
|
|
2329
|
+
},
|
|
2330
|
+
message: (message) => receive(message),
|
|
2331
|
+
closed: (reason) => {
|
|
2332
|
+
update({ connection: reason === void 0 ? { state: "closed" } : {
|
|
2333
|
+
state: "closed",
|
|
2334
|
+
reason
|
|
2335
|
+
} });
|
|
2336
|
+
runFork(stop());
|
|
2337
|
+
}
|
|
2338
|
+
});
|
|
2339
|
+
const sound = yield* make$1();
|
|
2340
|
+
const surface = makeSurface();
|
|
2341
|
+
const scope = yield* Effect.scope;
|
|
2342
|
+
const pictureScope = yield* Scope.fork(scope);
|
|
2343
|
+
const runFork = yield* FiberSet.makeRuntime();
|
|
2344
|
+
let peer;
|
|
2345
|
+
let stream;
|
|
2346
|
+
let decoder;
|
|
2347
|
+
let decodes;
|
|
2348
|
+
let wayScope;
|
|
2349
|
+
let turns = 0;
|
|
2350
|
+
const send = (message) => {
|
|
2351
|
+
const pointer = peer?.pointer;
|
|
2352
|
+
if (message.case === "pointerMotion" && pointer?.readyState === "open") {
|
|
2353
|
+
pointer.send(new Uint8Array(encode(message)));
|
|
2354
|
+
return;
|
|
2355
|
+
}
|
|
2356
|
+
socket.send(message);
|
|
2357
|
+
};
|
|
2358
|
+
const keyboard = makeKeyboard((code, pressed) => send({
|
|
2359
|
+
case: "key",
|
|
2360
|
+
value: {
|
|
2361
|
+
code,
|
|
2362
|
+
pressed
|
|
2363
|
+
}
|
|
2364
|
+
}));
|
|
2365
|
+
/** Says how the picture is to come: again whenever something changes that. */
|
|
2366
|
+
const hello = Effect.fn("Session.hello")(function* () {
|
|
2367
|
+
const asked = way;
|
|
2368
|
+
const decoded = yield* Effect.tryPromise(() => decodable(asked)).pipe(Effect.orElseSucceed(() => []));
|
|
2369
|
+
if (closed || asked !== way) return;
|
|
2370
|
+
if (settings.format !== void 0 && !decoded.includes(settings.format)) {
|
|
2371
|
+
const { format: _, ...kept } = settings;
|
|
2372
|
+
settings = kept;
|
|
2373
|
+
}
|
|
2374
|
+
updatePicture({
|
|
2375
|
+
formats: decoded,
|
|
2376
|
+
settings
|
|
2377
|
+
});
|
|
2378
|
+
const best = asked === "frames" ? BEST_FRAMES.filter((format) => decoded.includes(format)) : [];
|
|
2379
|
+
const wanted = settings.format === void 0 ? best : [settings.format];
|
|
2380
|
+
send({
|
|
2381
|
+
case: "hello",
|
|
2382
|
+
value: {
|
|
2383
|
+
pixels: PIXELS[asked],
|
|
2384
|
+
formats: wanted.map((format) => FORMATS[format]),
|
|
2385
|
+
quality: settings.quality === void 0 ? void 0 : QUALITIES[settings.quality],
|
|
2386
|
+
fps: settings.fps,
|
|
2387
|
+
audio: sounds && asked !== "video"
|
|
2388
|
+
}
|
|
2389
|
+
});
|
|
2390
|
+
});
|
|
2391
|
+
const closeDecoder = () => {
|
|
2392
|
+
if (decoder !== void 0 && decoder.state !== "closed") decoder.close();
|
|
2393
|
+
decoder = void 0;
|
|
2394
|
+
decodes = void 0;
|
|
2395
|
+
};
|
|
2396
|
+
/** What fails falls to the next way: video over WebRTC, the same video as frames, tiles. */
|
|
2397
|
+
const fall = (reason) => {
|
|
2398
|
+
const failed = way;
|
|
2399
|
+
const next = ways[ways.indexOf(failed) + 1];
|
|
2400
|
+
if (closed || next === void 0 || !socket.isOpen()) return;
|
|
2401
|
+
way = next;
|
|
2402
|
+
runFork(Effect.logWarning(`${failed}: ${reason}`).pipe(Effect.andThen(start())));
|
|
2403
|
+
};
|
|
2404
|
+
const watchVideo = Effect.fn("Session.watchVideo")(function* (turn, within) {
|
|
2405
|
+
const connection = yield* Effect.acquireRelease(Effect.sync(() => new RTCPeerConnection()), (made) => Effect.sync(() => {
|
|
2406
|
+
made.close();
|
|
2407
|
+
if (peer?.connection === made) peer = void 0;
|
|
2408
|
+
stream = void 0;
|
|
2409
|
+
sound.track(void 0);
|
|
2410
|
+
if (attached !== void 0) attached.video.srcObject = null;
|
|
2411
|
+
})).pipe(Scope.provide(within));
|
|
2412
|
+
connection.addTransceiver("video", { direction: "recvonly" });
|
|
2413
|
+
connection.addTransceiver("audio", { direction: "recvonly" });
|
|
2414
|
+
peer = {
|
|
2415
|
+
connection,
|
|
2416
|
+
pointer: connection.createDataChannel("pointer", {
|
|
2417
|
+
ordered: true,
|
|
2418
|
+
maxRetransmits: 0
|
|
2419
|
+
})
|
|
2420
|
+
};
|
|
2421
|
+
connection.addEventListener("track", (event) => {
|
|
2422
|
+
if (event.track.kind === "audio") {
|
|
2423
|
+
sound.track(event.track);
|
|
2424
|
+
return;
|
|
2425
|
+
}
|
|
2426
|
+
const receiver = event.receiver;
|
|
2427
|
+
receiver.jitterBufferTarget = 0;
|
|
2428
|
+
receiver.playoutDelayHint = 0;
|
|
2429
|
+
stream = new MediaStream([event.track]);
|
|
2430
|
+
if (attached !== void 0) attached.video.srcObject = stream;
|
|
2431
|
+
});
|
|
2432
|
+
connection.addEventListener("connectionstatechange", () => {
|
|
2433
|
+
if (peer?.connection !== connection) return;
|
|
2434
|
+
updatePicture({ rtc: connection.connectionState });
|
|
2435
|
+
if (connection.connectionState === "failed") fall("WebRTC failed");
|
|
2436
|
+
});
|
|
2437
|
+
const offer = yield* Effect.tryPromise(async () => {
|
|
2438
|
+
await connection.setLocalDescription(await connection.createOffer());
|
|
2439
|
+
return connection.localDescription?.sdp;
|
|
2440
|
+
}).pipe(Effect.result);
|
|
2441
|
+
if (closed || turn !== turns) return;
|
|
2442
|
+
if (Result.isFailure(offer) || offer.success === void 0) {
|
|
2443
|
+
const cause = Result.isFailure(offer) ? offer.failure.cause : void 0;
|
|
2444
|
+
fall(cause instanceof Error ? cause.message : "WebRTC made no offer");
|
|
2445
|
+
return;
|
|
2446
|
+
}
|
|
2447
|
+
send({
|
|
2448
|
+
case: "rtcOffer",
|
|
2449
|
+
value: { sdp: offer.success }
|
|
2450
|
+
});
|
|
2451
|
+
const waiting = runFork(Effect.sleep(RTC_CONNECTS_WITHIN).pipe(Effect.andThen(Effect.sync(() => {
|
|
2452
|
+
if (turn === turns && connection.connectionState !== "connected") fall("WebRTC did not connect");
|
|
2453
|
+
}))));
|
|
2454
|
+
yield* Scope.addFinalizer(within, Effect.sync(() => waiting.interruptUnsafe()));
|
|
2455
|
+
});
|
|
2456
|
+
/** Ends however the picture comes. */
|
|
2457
|
+
const stop = Effect.fn("Session.stop")(function* () {
|
|
2458
|
+
turns += 1;
|
|
2459
|
+
const before = wayScope;
|
|
2460
|
+
wayScope = void 0;
|
|
2461
|
+
if (before !== void 0) yield* Scope.close(before, Exit.void);
|
|
2462
|
+
});
|
|
2463
|
+
/** Starts the picture the way it is to come, in place of however it came before. */
|
|
2464
|
+
const start = Effect.fn("Session.start")(function* () {
|
|
2465
|
+
yield* stop();
|
|
2466
|
+
const turn = turns;
|
|
2467
|
+
if (closed) return;
|
|
2468
|
+
const within = yield* Scope.fork(pictureScope);
|
|
2469
|
+
wayScope = within;
|
|
2470
|
+
updatePicture({
|
|
2471
|
+
way,
|
|
2472
|
+
status: void 0,
|
|
2473
|
+
rtc: void 0
|
|
2474
|
+
});
|
|
2475
|
+
yield* Scope.addFinalizer(within, Effect.sync(closeDecoder));
|
|
2476
|
+
yield* hello();
|
|
2477
|
+
if (closed || turn !== turns || way !== "video") return;
|
|
2478
|
+
yield* watchVideo(turn, within);
|
|
2479
|
+
});
|
|
2480
|
+
const answer = (sdp) => {
|
|
2481
|
+
const connection = peer?.connection;
|
|
2482
|
+
if (connection === void 0) return;
|
|
2483
|
+
connection.setRemoteDescription({
|
|
2484
|
+
type: "answer",
|
|
2485
|
+
sdp
|
|
2486
|
+
}).catch((cause) => {
|
|
2487
|
+
if (peer?.connection === connection) fall(cause instanceof Error ? cause.message : "WebRTC took no answer");
|
|
2488
|
+
});
|
|
2489
|
+
};
|
|
2490
|
+
const shown = (timeUs) => send({
|
|
2491
|
+
case: "videoShown",
|
|
2492
|
+
value: { timeUs }
|
|
2493
|
+
});
|
|
2494
|
+
const decodeFrame = (frame) => {
|
|
2495
|
+
const format = formatOf(frame.format);
|
|
2496
|
+
if (!(frame.tab === snapshot.selected && way === "frames") || format === void 0 || typeof VideoDecoder === "undefined") {
|
|
2497
|
+
shown(frame.timeUs);
|
|
2498
|
+
return;
|
|
2499
|
+
}
|
|
2500
|
+
if (decoder?.state !== "configured" || decodes !== format) {
|
|
2501
|
+
if (!frame.keyframe) {
|
|
2502
|
+
shown(frame.timeUs);
|
|
2503
|
+
return;
|
|
2504
|
+
}
|
|
2505
|
+
closeDecoder();
|
|
2506
|
+
const made = new VideoDecoder({
|
|
2507
|
+
output: (picture) => {
|
|
2508
|
+
surface.draw(picture, 0, 0, picture.displayWidth, picture.displayHeight);
|
|
2509
|
+
shown(BigInt(picture.timestamp));
|
|
2510
|
+
picture.close();
|
|
2511
|
+
},
|
|
2512
|
+
error: (error) => {
|
|
2513
|
+
if (decoder === made) fall(error.message);
|
|
2514
|
+
}
|
|
2515
|
+
});
|
|
2516
|
+
made.configure({
|
|
2517
|
+
codec: CODECS[format],
|
|
2518
|
+
optimizeForLatency: true
|
|
2519
|
+
});
|
|
2520
|
+
decoder = made;
|
|
2521
|
+
decodes = format;
|
|
2522
|
+
}
|
|
2523
|
+
try {
|
|
2524
|
+
decoder.decode(new EncodedVideoChunk({
|
|
2525
|
+
type: frame.keyframe ? "key" : "delta",
|
|
2526
|
+
timestamp: Number(frame.timeUs),
|
|
2527
|
+
data: frame.data
|
|
2528
|
+
}));
|
|
2529
|
+
} catch (cause) {
|
|
2530
|
+
shown(frame.timeUs);
|
|
2531
|
+
fall(cause instanceof Error ? cause.message : "a frame was not decoded");
|
|
2532
|
+
}
|
|
2533
|
+
};
|
|
2534
|
+
const tiles = yield* Queue.unbounded();
|
|
2535
|
+
const drawTile = Effect.fnUntraced(function* (tile) {
|
|
2536
|
+
const image = yield* Effect.tryPromise(() => createImageBitmap(new Blob([new Uint8Array(tile.png)], { type: "image/png" }))).pipe(Effect.catch((cause) => Effect.sync(() => console.warn("A tile of the session's picture was not decoded", cause))));
|
|
2537
|
+
if (image === void 0) return;
|
|
2538
|
+
if (tile.tab === snapshot.selected && way === "tiles") surface.draw(image, tile.x, tile.y, tile.width, tile.height);
|
|
2539
|
+
image.close();
|
|
2540
|
+
});
|
|
2541
|
+
runFork(Effect.forever(Queue.take(tiles).pipe(Effect.flatMap(drawTile))));
|
|
2542
|
+
/** What the session copied goes to the clipboard here, where the browser lets it. */
|
|
2543
|
+
const copied = (forms) => {
|
|
2544
|
+
if (forms.length === 0) return;
|
|
2545
|
+
runFork(Effect.promise(() => write(forms)).pipe(Effect.andThen((written) => Effect.sync(() => {
|
|
2546
|
+
for (const listener of clipboardListeners) listener({
|
|
2547
|
+
forms,
|
|
2548
|
+
written
|
|
2549
|
+
});
|
|
2550
|
+
}))));
|
|
2551
|
+
};
|
|
2552
|
+
const receive = (message) => {
|
|
2553
|
+
take(message);
|
|
2554
|
+
follow();
|
|
2555
|
+
tune();
|
|
2556
|
+
};
|
|
2557
|
+
let unmuting;
|
|
2558
|
+
/** Hears the watched tab unless it is muted here, and stops hearing as that changes. */
|
|
2559
|
+
const tune = () => {
|
|
2560
|
+
const target = watched();
|
|
2561
|
+
const on = snapshot.features.sound.read && target !== void 0 && !snapshot.muted.includes(target.tab);
|
|
2562
|
+
if (on === sounds) return;
|
|
2563
|
+
sounds = on;
|
|
2564
|
+
clearTimeout(unmuting);
|
|
2565
|
+
if (on) unmuting = setTimeout(() => sound.turn(sounds), SOUND_SETTLES_MS);
|
|
2566
|
+
else sound.turn(false);
|
|
2567
|
+
if (way !== "video" && socket.isOpen()) runFork(hello());
|
|
2568
|
+
};
|
|
2569
|
+
const take = (message) => {
|
|
2570
|
+
switch (message.case) {
|
|
2571
|
+
case "rtcAnswer":
|
|
2572
|
+
answer(message.value.sdp);
|
|
2573
|
+
break;
|
|
2574
|
+
case "rtcRefused":
|
|
2575
|
+
fall(message.value.reason);
|
|
2576
|
+
break;
|
|
2577
|
+
case "videoStatus":
|
|
2578
|
+
updatePicture({ status: statusOf(message.value) });
|
|
2579
|
+
break;
|
|
2580
|
+
case "failed": {
|
|
2581
|
+
const failure = failureOf(message.value);
|
|
2582
|
+
for (const listener of failureListeners) listener(failure);
|
|
2583
|
+
break;
|
|
2584
|
+
}
|
|
2585
|
+
case "pointer": {
|
|
2586
|
+
const pointer = pointerOf(message.value);
|
|
2587
|
+
for (const listener of pointerListeners) listener(pointer);
|
|
2588
|
+
break;
|
|
2589
|
+
}
|
|
2590
|
+
case "stroke": {
|
|
2591
|
+
const point = strokeOf(message.value);
|
|
2592
|
+
if (point !== void 0) for (const listener of strokeListeners) listener(point);
|
|
2593
|
+
break;
|
|
2594
|
+
}
|
|
2595
|
+
case "features":
|
|
2596
|
+
update({ features: featuresOf(message.value) });
|
|
2597
|
+
break;
|
|
2598
|
+
case "paced":
|
|
2599
|
+
update({ pace: paceOf(message.value.pace) });
|
|
2600
|
+
break;
|
|
2601
|
+
case "restoring":
|
|
2602
|
+
update({ restoring: restoringOf(message.value) });
|
|
2603
|
+
break;
|
|
2604
|
+
case "presence":
|
|
2605
|
+
update({ presence: presenceOf(message.value) });
|
|
2606
|
+
break;
|
|
2607
|
+
case "menu":
|
|
2608
|
+
update({ menu: {
|
|
2609
|
+
...menuOf(message.value),
|
|
2610
|
+
...menuAt
|
|
2611
|
+
} });
|
|
2612
|
+
break;
|
|
2613
|
+
case "clipboard":
|
|
2614
|
+
copied(message.value.forms.map(({ type, data }) => ({
|
|
2615
|
+
type,
|
|
2616
|
+
data
|
|
2617
|
+
})));
|
|
2618
|
+
break;
|
|
2619
|
+
case "downloads":
|
|
2620
|
+
update({ downloads: message.value.downloads.map(downloadOf) });
|
|
2621
|
+
break;
|
|
2622
|
+
case "fileRequests":
|
|
2623
|
+
update({ fileRequests: message.value.requests.map(fileRequestOf) });
|
|
2624
|
+
break;
|
|
2625
|
+
case "tile":
|
|
2626
|
+
if (typeof createImageBitmap !== "undefined") Queue.offerUnsafe(tiles, message.value);
|
|
2627
|
+
break;
|
|
2628
|
+
case "audio":
|
|
2629
|
+
if (way !== "video") sound.hear(message.value.timeUs, message.value.data);
|
|
2630
|
+
break;
|
|
2631
|
+
case "videoFrame":
|
|
2632
|
+
decodeFrame(message.value);
|
|
2633
|
+
break;
|
|
2634
|
+
case "targets":
|
|
2635
|
+
update({ targets: message.value.targets.map(targetOf) });
|
|
2636
|
+
break;
|
|
2637
|
+
case "selected":
|
|
2638
|
+
update({ selected: message.value.tab });
|
|
2639
|
+
break;
|
|
2640
|
+
case "cursor": {
|
|
2641
|
+
const { cursor } = message.value;
|
|
2642
|
+
const named = cursor.case === "named" && cursor.value !== "" ? cursor.value : "default";
|
|
2643
|
+
update({ cursor: cursor.case === "hidden" ? "none" : named });
|
|
2644
|
+
break;
|
|
2645
|
+
}
|
|
2646
|
+
}
|
|
2647
|
+
};
|
|
2648
|
+
/**
|
|
2649
|
+
* Whether the watched tab is this member's to size without being asked to: it holds the
|
|
2650
|
+
* tab, or nobody holds it and nobody else watches it. A tab has one size for everyone, so
|
|
2651
|
+
* a window that merely opens or changes its size does not take the tab from those at work
|
|
2652
|
+
* in it.
|
|
2653
|
+
*/
|
|
2654
|
+
const free = () => {
|
|
2655
|
+
const target = watched();
|
|
2656
|
+
if (target === void 0) return false;
|
|
2657
|
+
const presence = snapshot.presence;
|
|
2658
|
+
if (presence === void 0) return true;
|
|
2659
|
+
const held = presence.held.find((one) => one.tab === target.tab);
|
|
2660
|
+
if (held !== void 0) return held.holder === presence.you;
|
|
2661
|
+
return !presence.members.some((one) => one.id !== presence.you && one.tab === target.tab);
|
|
2662
|
+
};
|
|
2663
|
+
/**
|
|
2664
|
+
* The target that was last fitted because it was this member's to size, and whether it
|
|
2665
|
+
* was shown as on a phone then: it is fitted another way once that changes.
|
|
2666
|
+
*/
|
|
2667
|
+
let followed;
|
|
2668
|
+
/** Fits the watched target once it becomes this member's to size, and each one that does. */
|
|
2669
|
+
const follow = () => {
|
|
2670
|
+
const target = watched();
|
|
2671
|
+
const mine = fitting && target !== void 0 && free() ? `${target.tab} ${target.mobile}` : void 0;
|
|
2672
|
+
if (mine === followed) return;
|
|
2673
|
+
followed = mine;
|
|
2674
|
+
if (mine !== void 0) fit(false);
|
|
2675
|
+
};
|
|
2676
|
+
/**
|
|
2677
|
+
* Gives the watched target the size of the stage, while the viewport is to fit it.
|
|
2678
|
+
* `unasked` is for what no one chose just now, such as the window changing its size.
|
|
2679
|
+
*/
|
|
2680
|
+
const fit = (unasked) => {
|
|
2681
|
+
const target = watched();
|
|
2682
|
+
if (!fitting || attached === void 0 || target === void 0) return;
|
|
2683
|
+
if (unasked && !free()) return;
|
|
2684
|
+
const { clientWidth, clientHeight } = attached.stage;
|
|
2685
|
+
if (clientWidth <= 0 || clientHeight <= 0) return;
|
|
2686
|
+
if (target.mobile) {
|
|
2687
|
+
if (snapshot.phone) {
|
|
2688
|
+
const scale = Math.min(Math.max(window.devicePixelRatio, 1), SHARPEST);
|
|
2689
|
+
send({
|
|
2690
|
+
case: "viewport",
|
|
2691
|
+
value: {
|
|
2692
|
+
width: clientWidth,
|
|
2693
|
+
height: clientHeight,
|
|
2694
|
+
scale
|
|
2695
|
+
}
|
|
2696
|
+
});
|
|
2697
|
+
} else if (target.mode === "auto") send({
|
|
2698
|
+
case: "lease",
|
|
2699
|
+
value: { action: LEASE_ACTIONS.take }
|
|
2700
|
+
});
|
|
2701
|
+
return;
|
|
2702
|
+
}
|
|
2703
|
+
const widened = Math.max(1, NARROWEST / clientWidth);
|
|
2704
|
+
send({
|
|
2705
|
+
case: "viewport",
|
|
2706
|
+
value: {
|
|
2707
|
+
width: Math.round(clientWidth * widened),
|
|
2708
|
+
height: Math.round(clientHeight * widened)
|
|
2709
|
+
}
|
|
2710
|
+
});
|
|
2711
|
+
};
|
|
2712
|
+
const listed = async (files) => {
|
|
2713
|
+
const uris = (await Promise.all(files.map((file) => Effect.runPromise(upload(address, file))))).map((file) => {
|
|
2714
|
+
return `${make$2`file://${segments(file.path)}`}\r\n`;
|
|
2715
|
+
});
|
|
2716
|
+
return textForm("text/uri-list", uris.join(""));
|
|
2717
|
+
};
|
|
2718
|
+
const wiring = {
|
|
2719
|
+
send,
|
|
2720
|
+
keyboard,
|
|
2721
|
+
way: () => way,
|
|
2722
|
+
watched,
|
|
2723
|
+
listed,
|
|
2724
|
+
menuAt: (at) => {
|
|
2725
|
+
menuAt = at;
|
|
2726
|
+
},
|
|
2727
|
+
dismissMenu: () => update({ menu: void 0 }),
|
|
2728
|
+
dragged: (by) => {
|
|
2729
|
+
for (const listener of draggedListeners) listener(by);
|
|
2730
|
+
},
|
|
2731
|
+
resized: () => fit(true),
|
|
2732
|
+
failed: (what, cause) => {
|
|
2733
|
+
runFork(Effect.logWarning(`${what} did not reach the session`, cause));
|
|
2734
|
+
}
|
|
2735
|
+
};
|
|
2736
|
+
const attach = Effect.fn("Session.attach")(function* (surfaces) {
|
|
2737
|
+
yield* Effect.acquireRelease(Effect.sync(() => {
|
|
2738
|
+
attached = surfaces;
|
|
2739
|
+
surface.attach(surfaces.canvas);
|
|
2740
|
+
surfaces.video.muted = true;
|
|
2741
|
+
surfaces.video.autoplay = true;
|
|
2742
|
+
surfaces.video.playsInline = true;
|
|
2743
|
+
surfaces.video.srcObject = stream ?? null;
|
|
2744
|
+
}), () => Effect.sync(() => {
|
|
2745
|
+
surfaces.video.srcObject = null;
|
|
2746
|
+
if (attached === surfaces) {
|
|
2747
|
+
attached = void 0;
|
|
2748
|
+
surface.detach();
|
|
2749
|
+
}
|
|
2750
|
+
}));
|
|
2751
|
+
yield* wire(surfaces, wiring);
|
|
2752
|
+
});
|
|
2753
|
+
const paste = Effect.fn("Session.paste")(function* (given) {
|
|
2754
|
+
const forms = given ?? (yield* Effect.tryPromise(() => read()).pipe(Effect.orElseSucceed(() => [])));
|
|
2755
|
+
if (forms.length === 0) return false;
|
|
2756
|
+
send({
|
|
2757
|
+
case: "clipboard",
|
|
2758
|
+
value: { forms: [...forms] }
|
|
2759
|
+
});
|
|
2760
|
+
keyboard.chord(KEY.v);
|
|
2761
|
+
return true;
|
|
2762
|
+
});
|
|
2763
|
+
const setPicture = (change) => {
|
|
2764
|
+
const { way: asked, ...changed } = change;
|
|
2765
|
+
settings = {
|
|
2766
|
+
...settings,
|
|
2767
|
+
...changed
|
|
2768
|
+
};
|
|
2769
|
+
updatePicture({ settings });
|
|
2770
|
+
if (!socket.isOpen()) {
|
|
2771
|
+
if (asked !== void 0 && ways.includes(asked)) {
|
|
2772
|
+
way = asked;
|
|
2773
|
+
updatePicture({ way });
|
|
2774
|
+
}
|
|
2775
|
+
return;
|
|
2776
|
+
}
|
|
2777
|
+
if (asked !== void 0 && asked !== way && ways.includes(asked)) {
|
|
2778
|
+
way = asked;
|
|
2779
|
+
runFork(start());
|
|
2780
|
+
return;
|
|
2781
|
+
}
|
|
2782
|
+
runFork(hello());
|
|
2783
|
+
};
|
|
2784
|
+
if (typeof window !== "undefined" && typeof window.matchMedia === "function") {
|
|
2785
|
+
const coarse = window.matchMedia("(pointer: coarse)");
|
|
2786
|
+
const looked = () => {
|
|
2787
|
+
const phone = onPhone();
|
|
2788
|
+
if (phone === snapshot.phone) return;
|
|
2789
|
+
update({ phone });
|
|
2790
|
+
socket.send({
|
|
2791
|
+
case: "device",
|
|
2792
|
+
value: { phone }
|
|
2793
|
+
});
|
|
2794
|
+
followed = void 0;
|
|
2795
|
+
follow();
|
|
2796
|
+
};
|
|
2797
|
+
yield* Effect.acquireRelease(Effect.sync(() => {
|
|
2798
|
+
window.addEventListener("resize", looked);
|
|
2799
|
+
coarse.addEventListener("change", looked);
|
|
2800
|
+
}), () => Effect.sync(() => {
|
|
2801
|
+
window.removeEventListener("resize", looked);
|
|
2802
|
+
coarse.removeEventListener("change", looked);
|
|
2803
|
+
}));
|
|
2804
|
+
}
|
|
2805
|
+
yield* Effect.addFinalizer(() => Effect.sync(() => {
|
|
2806
|
+
closed = true;
|
|
2807
|
+
clearTimeout(unmuting);
|
|
2808
|
+
if (snapshot.connection.state !== "closed") update({ connection: { state: "closed" } });
|
|
2809
|
+
update({ menu: void 0 });
|
|
2810
|
+
}));
|
|
2811
|
+
return {
|
|
2812
|
+
store: {
|
|
2813
|
+
get: () => snapshot,
|
|
2814
|
+
subscribe
|
|
2815
|
+
},
|
|
2816
|
+
snapshot: Effect.sync(() => snapshot),
|
|
2817
|
+
changes: Stream.callback((queue) => Effect.acquireRelease(Effect.sync(() => {
|
|
2818
|
+
Queue.offerUnsafe(queue, snapshot);
|
|
2819
|
+
return subscribe(() => Queue.offerUnsafe(queue, snapshot));
|
|
2820
|
+
}), (unsubscribe) => Effect.sync(unsubscribe))),
|
|
2821
|
+
clipboard: Stream.callback((queue) => Effect.acquireRelease(Effect.sync(() => onClipboard((event) => Queue.offerUnsafe(queue, event))), (unsubscribe) => Effect.sync(unsubscribe))),
|
|
2822
|
+
onClipboard,
|
|
2823
|
+
failures: Stream.callback((queue) => Effect.acquireRelease(Effect.sync(() => onFailure((failure) => Queue.offerUnsafe(queue, failure))), (unsubscribe) => Effect.sync(unsubscribe))),
|
|
2824
|
+
onFailure,
|
|
2825
|
+
onDragged,
|
|
2826
|
+
onPointer: listening(pointerListeners),
|
|
2827
|
+
onStroke: listening(strokeListeners),
|
|
2828
|
+
follow: (member) => Effect.sync(() => send({
|
|
2829
|
+
case: "follow",
|
|
2830
|
+
value: member === void 0 ? {} : { member: BigInt(member) }
|
|
2831
|
+
})),
|
|
2832
|
+
draw: (stroke, phase, at) => Effect.sync(() => send({
|
|
2833
|
+
case: "draw",
|
|
2834
|
+
value: {
|
|
2835
|
+
stroke,
|
|
2836
|
+
phase: STROKE_PHASE[phase],
|
|
2837
|
+
x: at.x,
|
|
2838
|
+
y: at.y
|
|
2839
|
+
}
|
|
2840
|
+
})),
|
|
2841
|
+
point: (at) => Effect.sync(() => send({
|
|
2842
|
+
case: "pointing",
|
|
2843
|
+
value: at === void 0 ? {} : { at }
|
|
2844
|
+
})),
|
|
2845
|
+
select: (tab) => Effect.sync(() => send({
|
|
2846
|
+
case: "select",
|
|
2847
|
+
value: { tab }
|
|
2848
|
+
})),
|
|
2849
|
+
go: (to, { newTab = false } = {}) => Effect.sync(() => {
|
|
2850
|
+
const destination = "url" in to ? {
|
|
2851
|
+
case: "url",
|
|
2852
|
+
value: to.url
|
|
2853
|
+
} : {
|
|
2854
|
+
case: "along",
|
|
2855
|
+
value: ALONGS[to.along]
|
|
2856
|
+
};
|
|
2857
|
+
send({
|
|
2858
|
+
case: "go",
|
|
2859
|
+
value: {
|
|
2860
|
+
to: destination,
|
|
2861
|
+
newTab
|
|
2862
|
+
}
|
|
2863
|
+
});
|
|
2864
|
+
}),
|
|
2865
|
+
newTab: Effect.sync(() => send({
|
|
2866
|
+
case: "go",
|
|
2867
|
+
value: {
|
|
2868
|
+
to: {
|
|
2869
|
+
case: "url",
|
|
2870
|
+
value: ""
|
|
2871
|
+
},
|
|
2872
|
+
newTab: true
|
|
2873
|
+
}
|
|
2874
|
+
})),
|
|
2875
|
+
closeTab: (tab) => Effect.sync(() => send({
|
|
2876
|
+
case: "close",
|
|
2877
|
+
value: { tab }
|
|
2878
|
+
})),
|
|
2879
|
+
setViewport: (viewport, options) => Effect.sync(() => {
|
|
2880
|
+
fitting = viewport === "fit";
|
|
2881
|
+
update({ fit: fitting });
|
|
2882
|
+
if (viewport === "fit") {
|
|
2883
|
+
followed = void 0;
|
|
2884
|
+
if (options?.whenFree === true) follow();
|
|
2885
|
+
else fit(false);
|
|
2886
|
+
return;
|
|
2887
|
+
}
|
|
2888
|
+
const { width, height, scale } = viewport;
|
|
2889
|
+
send({
|
|
2890
|
+
case: "viewport",
|
|
2891
|
+
value: {
|
|
2892
|
+
width: pixels(width),
|
|
2893
|
+
height: pixels(height),
|
|
2894
|
+
scale
|
|
2895
|
+
}
|
|
2896
|
+
});
|
|
2897
|
+
}),
|
|
2898
|
+
setScale: (scale) => Effect.sync(() => {
|
|
2899
|
+
const target = watched();
|
|
2900
|
+
if (target !== void 0) {
|
|
2901
|
+
const { width, height } = target;
|
|
2902
|
+
send({
|
|
2903
|
+
case: "viewport",
|
|
2904
|
+
value: {
|
|
2905
|
+
width,
|
|
2906
|
+
height,
|
|
2907
|
+
scale
|
|
2908
|
+
}
|
|
2909
|
+
});
|
|
2910
|
+
}
|
|
2911
|
+
}),
|
|
2912
|
+
setMode: (mode) => Effect.sync(() => send({
|
|
2913
|
+
case: "setMode",
|
|
2914
|
+
value: { mode: PAGE_MODES[mode] }
|
|
2915
|
+
})),
|
|
2916
|
+
setPicture: (change) => Effect.sync(() => setPicture(change)),
|
|
2917
|
+
setMuted: (tab, muted) => Effect.sync(() => {
|
|
2918
|
+
const others = snapshot.muted.filter((one) => one !== tab);
|
|
2919
|
+
update({ muted: muted ? [...others, tab] : others });
|
|
2920
|
+
tune();
|
|
2921
|
+
}),
|
|
2922
|
+
lease: (action) => Effect.sync(() => send({
|
|
2923
|
+
case: "lease",
|
|
2924
|
+
value: { action: LEASE_ACTIONS[action] }
|
|
2925
|
+
})),
|
|
2926
|
+
attach,
|
|
2927
|
+
focus: Effect.sync(() => attached?.keys.focus({ preventScroll: true })),
|
|
2928
|
+
dismissMenu: Effect.sync(() => update({ menu: void 0 })),
|
|
2929
|
+
copyPicture: (url) => Effect.sync(() => send({
|
|
2930
|
+
case: "copyPicture",
|
|
2931
|
+
value: { url }
|
|
2932
|
+
})),
|
|
2933
|
+
writeClipboard: (forms) => Effect.sync(() => send({
|
|
2934
|
+
case: "clipboard",
|
|
2935
|
+
value: { forms: [...forms] }
|
|
2936
|
+
})),
|
|
2937
|
+
paste,
|
|
2938
|
+
copySelection: Effect.sync(() => keyboard.chord(KEY.c)),
|
|
2939
|
+
selectAll: Effect.sync(() => keyboard.chord(KEY.a)),
|
|
2940
|
+
copyHere: (forms) => Effect.promise(() => writeByHand(forms)),
|
|
2941
|
+
upload: (file, onProgress) => upload(address, file, onProgress),
|
|
2942
|
+
uploads: uploads(address),
|
|
2943
|
+
removeUpload: (name) => removeUpload(address, name),
|
|
2944
|
+
chooseFiles: (request, names) => Effect.sync(() => send({
|
|
2945
|
+
case: "filesChosen",
|
|
2946
|
+
value: {
|
|
2947
|
+
id: BigInt(request),
|
|
2948
|
+
files: [...names]
|
|
2949
|
+
}
|
|
2950
|
+
})),
|
|
2951
|
+
fileUrl: (path) => fileUrl(address, path),
|
|
2952
|
+
screenshotUrl: (tab, width) => screenshotUrl(address, tab, width),
|
|
2953
|
+
previewUrl: (tab) => previewUrl(address, tab),
|
|
2954
|
+
faviconUrl: (target) => {
|
|
2955
|
+
const site = /^https?:\/\/[^/?#]+/u.exec(target.url)?.[0];
|
|
2956
|
+
return site === void 0 ? void 0 : faviconUrl(address, target.tab, site);
|
|
2957
|
+
},
|
|
2958
|
+
recordings: {
|
|
2959
|
+
list: listRecordings(address),
|
|
2960
|
+
get: (id) => getRecording(address, id),
|
|
2961
|
+
start: (started) => startRecording(address, started),
|
|
2962
|
+
stop: (id, options) => stopRecording(address, id, options),
|
|
2963
|
+
edit: (id, options) => editRecording(address, id, options),
|
|
2964
|
+
retarget: (id, tab) => retargetRecording(address, id, tab),
|
|
2965
|
+
annotate: (annotation, id) => annotateRecording(address, annotation, id)
|
|
2966
|
+
},
|
|
2967
|
+
storageState: {
|
|
2968
|
+
export: (asked) => exportStorageState(address, asked),
|
|
2969
|
+
import: (state) => importStorageState(address, state)
|
|
2970
|
+
},
|
|
2971
|
+
pace: {
|
|
2972
|
+
get: getPace(address),
|
|
2973
|
+
set: (pace) => setPace(address, pace)
|
|
2974
|
+
},
|
|
2975
|
+
screenshots: {
|
|
2976
|
+
list: listScreenshots(address),
|
|
2977
|
+
take: (tab) => takeScreenshot(address, tab)
|
|
2978
|
+
}
|
|
2979
|
+
};
|
|
2980
|
+
});
|
|
2981
|
+
/** One session's client, for programs that pass it along as a service. */
|
|
2982
|
+
var Session = class extends Context.Service()("@aperture-browser/session-client/Session") {};
|
|
2983
|
+
/** Connects to a session for as long as the layer lives. */
|
|
2984
|
+
const layer = (options) => Layer.effect(Session, make(options));
|
|
2985
|
+
/** The narrowest the session's browser makes a window: asked for less, it stays this wide. */
|
|
2986
|
+
const NARROWEST = 500;
|
|
2987
|
+
//#endregion
|
|
2988
|
+
export { live_pb_exports as a, KEYS as i, layer as n, http_exports as o, make as r, SessionError as s, Session as t };
|
|
2989
|
+
|
|
2990
|
+
//# sourceMappingURL=session-CSF1mk8K.js.map
|