visualproof 0.11.1 → 0.12.0
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/README.md +5 -1
- package/dist/server/app.js +18 -6
- package/dist/server/appaccess.js +7 -5
- package/dist/server/appcall.js +118 -0
- package/dist/server/appshare.js +27 -4
- package/dist/server/call.js +373 -0
- package/dist/server/children.js +6 -5
- package/dist/server/live.js +46 -2
- package/dist/server/livekit.js +193 -0
- package/dist/server/main.js +30 -0
- package/dist/server/options.js +45 -1
- package/dist/server/pipeline.js +4 -3
- package/dist/server/readonly.js +18 -4
- package/dist/server/readonlygate.js +5 -1
- package/dist/shared/call.js +5 -0
- package/dist/shared/notecard.js +60 -1
- package/dist/web/bundle/app.js +802 -51
- package/dist/web/bundle/call.js +33692 -0
- package/dist/web/index.html +27 -0
- package/dist/web/style.css +181 -9
- package/package.json +2 -1
package/dist/web/bundle/app.js
CHANGED
|
@@ -1758,8 +1758,8 @@ function layoutCluster(c3, pos) {
|
|
|
1758
1758
|
settle(items, potentials(c3));
|
|
1759
1759
|
}
|
|
1760
1760
|
const enc2 = items.length ? enclose_default(items.map((i2) => ({ x: i2.x, y: i2.y, r: i2.r }))) : { x: 0, y: 0, r: 0 };
|
|
1761
|
-
const
|
|
1762
|
-
c3.r = (enc2?.r ?? 0) +
|
|
1761
|
+
const pad2 = c3.parent ? 10 + Math.min(14, Math.sqrt(c3.count)) : 0;
|
|
1762
|
+
c3.r = (enc2?.r ?? 0) + pad2;
|
|
1763
1763
|
for (const it2 of items) {
|
|
1764
1764
|
const x2 = it2.x - (enc2?.x ?? 0);
|
|
1765
1765
|
const y2 = it2.y - (enc2?.y ?? 0);
|
|
@@ -5356,6 +5356,8 @@ function snapshotSource(info2) {
|
|
|
5356
5356
|
readOnlyLinks: async () => null,
|
|
5357
5357
|
makeReadOnly: async () => ({ error: "a snapshot has no server to share" }),
|
|
5358
5358
|
revokeReadOnly: async () => ({ error: "a snapshot has no server" }),
|
|
5359
|
+
readOnlyCall: async () => ({ error: "a snapshot has no server" }),
|
|
5360
|
+
callPost: async () => ({ status: 404, body: { error: "a snapshot has no call" } }),
|
|
5359
5361
|
chat: async () => null,
|
|
5360
5362
|
sendChat: async () => ({ error: "a snapshot has no server" }),
|
|
5361
5363
|
newChat: async () => ({ error: "a snapshot has no server" }),
|
|
@@ -5431,8 +5433,10 @@ function serverSource() {
|
|
|
5431
5433
|
myLink: () => fetch("/api/share/people/mine", { method: "POST", headers: headers(), body: "{}" }).then((r2) => r2.json()).catch(() => ({ error: "the server could not be reached" })),
|
|
5432
5434
|
renewMyLink: (stream) => fetch("/api/share/people/mine/renew", { method: "POST", headers: headers(), body: JSON.stringify(stream ? { stream } : {}) }).then((r2) => r2.json()).catch(() => ({ error: "the server could not be reached" })),
|
|
5433
5435
|
readOnlyLinks: () => fetch("/api/share/readonly").then((r2) => r2.ok ? r2.json() : null).then((b2) => b2?.links ?? null).catch(() => null),
|
|
5434
|
-
makeReadOnly: () => fetch("/api/share/readonly", { method: "POST", headers: headers(), body:
|
|
5436
|
+
makeReadOnly: (call) => fetch("/api/share/readonly", { method: "POST", headers: headers(), body: JSON.stringify(call ? { call: true } : {}) }).then((r2) => r2.json()).catch(() => ({ error: "the server could not be reached" })),
|
|
5435
5437
|
revokeReadOnly: (id) => fetch("/api/share/readonly/revoke", { method: "POST", headers: headers(), body: JSON.stringify({ id }) }).then((r2) => r2.json()).catch(() => ({ error: "the server could not be reached" })),
|
|
5438
|
+
readOnlyCall: (id, call) => fetch("/api/share/readonly/call", { method: "POST", headers: headers(), body: JSON.stringify({ id, call }) }).then((r2) => r2.json()).catch(() => ({ error: "the server could not be reached" })),
|
|
5439
|
+
callPost: (path, body) => fetch(path, { method: "POST", headers: headers(), body: JSON.stringify(body) }).then(async (r2) => ({ status: r2.status, body: await r2.json().catch(() => ({})) ?? {} })).catch(() => ({ status: 0, body: { error: "the server could not be reached" } })),
|
|
5436
5440
|
activity: () => fetch("/api/activity").then((r2) => r2.ok ? r2.json() : { events: [] }).then((b2) => b2.events).catch(() => []),
|
|
5437
5441
|
shareInfo: () => fetch("/api/share").then((r2) => r2.json()).then((b2) => ({ ...b2, path: typeof b2.path === "string" ? b2.path : null })),
|
|
5438
5442
|
updates: () => fetch("/api/updates").then((r2) => r2.ok ? r2.json() : null).then((b2) => b2 && typeof b2.running === "string" ? b2 : null).catch(() => null),
|
|
@@ -6346,7 +6350,7 @@ var FocusMenu = class {
|
|
|
6346
6350
|
};
|
|
6347
6351
|
|
|
6348
6352
|
// src/web/src/reload.ts
|
|
6349
|
-
var PAGE_VERSION = true ? "0.
|
|
6353
|
+
var PAGE_VERSION = true ? "0.12.0" : null;
|
|
6350
6354
|
var KEY = "visualproof:reload";
|
|
6351
6355
|
var FOR_KEY = "visualproof:reloaded-for";
|
|
6352
6356
|
var FRESH_MS = 10 * 6e4;
|
|
@@ -10561,6 +10565,10 @@ var Share = class {
|
|
|
10561
10565
|
/** a Revoke pressed once, waiting for the second press */
|
|
10562
10566
|
arming = null;
|
|
10563
10567
|
busy = false;
|
|
10568
|
+
/** the guest link opens the call's pre-join (`?call`, CallSpec decision 6): off until switched */
|
|
10569
|
+
callLink = false;
|
|
10570
|
+
/** a read-only link made now joins the call (CallSpec decision 4): off until switched */
|
|
10571
|
+
roCall = false;
|
|
10564
10572
|
constructor(btn, pop, hooks) {
|
|
10565
10573
|
this.btn = btn;
|
|
10566
10574
|
this.pop = pop;
|
|
@@ -10571,6 +10579,11 @@ var Share = class {
|
|
|
10571
10579
|
const tab = t2.closest("[data-tab]");
|
|
10572
10580
|
if (tab) return void this.show(tab.dataset.tab);
|
|
10573
10581
|
if (t2.closest("[data-exact]")) void this.setExact(!this.hooks.exact.get());
|
|
10582
|
+
else if (t2.closest("[data-call-link]")) void this.setCallLink(!this.callLink);
|
|
10583
|
+
else if (t2.closest("[data-ro-call]")) {
|
|
10584
|
+
this.roCall = !this.roCall;
|
|
10585
|
+
this.render();
|
|
10586
|
+
} else if (t2.closest("[data-ro-callsw]")) void this.switchReadOnlyCall(t2.closest("[data-ro-callsw]").dataset.roCallsw);
|
|
10574
10587
|
else if (t2.closest("[data-copy]")) void this.copyAgain(".sh-url", "[data-copy]");
|
|
10575
10588
|
else if (t2.closest("[data-copy-invite]")) void this.copyAgain(".sh-invite-url", "[data-copy-invite]");
|
|
10576
10589
|
else if (t2.closest("[data-copy-ro]")) void this.copyAgain(".sh-ro-url", "[data-copy-ro]");
|
|
@@ -10631,7 +10644,41 @@ var Share = class {
|
|
|
10631
10644
|
* read-only reader, the link they came by. */
|
|
10632
10645
|
async link() {
|
|
10633
10646
|
const { path } = await this.shareInfo();
|
|
10634
|
-
return `${this.hooks.base()}${path ?? "/"}${await this.fragment()}`;
|
|
10647
|
+
return `${this.hooks.base()}${path ?? "/"}${this.joinsCall() ? "?call" : ""}${await this.fragment()}`;
|
|
10648
|
+
}
|
|
10649
|
+
/** Whether the guest link opens the call's pre-join: switched on, where there is a call. */
|
|
10650
|
+
joinsCall() {
|
|
10651
|
+
return this.callLink && !!this.hooks.call?.();
|
|
10652
|
+
}
|
|
10653
|
+
/** Join the call switched (CallSpec decision 6): the guest link made again and copied. */
|
|
10654
|
+
async setCallLink(on) {
|
|
10655
|
+
this.callLink = on;
|
|
10656
|
+
const url = await this.link();
|
|
10657
|
+
this.person = { url, copied: await copy(url) };
|
|
10658
|
+
this.render();
|
|
10659
|
+
this.pop.querySelector("[data-call-link]")?.focus();
|
|
10660
|
+
}
|
|
10661
|
+
/** The switch Join the call, where there is a call: whoever opens the link finds its pre-join. */
|
|
10662
|
+
callRow() {
|
|
10663
|
+
if (!this.hooks.call?.()) return "";
|
|
10664
|
+
const on = this.joinsCall();
|
|
10665
|
+
return `<button type="button" class="sh-exact" role="switch" aria-checked="${on}" data-call-link title="Whoever opens the link finds the call ready to join"><span class="sh-switch" aria-hidden="true"></span>Join the call</button>`;
|
|
10666
|
+
}
|
|
10667
|
+
/** Whether a read-only link joins the call, switched by anyone let in (CallSpec decision 4). */
|
|
10668
|
+
async switchReadOnlyCall(id) {
|
|
10669
|
+
const l2 = this.readOnlyLinks?.find((x2) => x2.id === id);
|
|
10670
|
+
if (!l2) return;
|
|
10671
|
+
const r2 = await this.hooks.data.readOnlyCall(id, !l2.call);
|
|
10672
|
+
if (r2.links) this.readOnlyLinks = r2.links.filter((x2) => !x2.revoked);
|
|
10673
|
+
const ro = this.readOnly;
|
|
10674
|
+
if (ro.kind === "link" && ro.id === id) {
|
|
10675
|
+
const now = this.readOnlyLinks?.find((x2) => x2.id === id);
|
|
10676
|
+
if (now) {
|
|
10677
|
+
const base = now.link + (now.call ? "?call" : "");
|
|
10678
|
+
this.readOnly = { ...ro, base, link: base + await this.fragment() };
|
|
10679
|
+
}
|
|
10680
|
+
}
|
|
10681
|
+
this.render();
|
|
10635
10682
|
}
|
|
10636
10683
|
/** What a link carries after `#`: the address, and with Exactly what I see the snapshot of what the
|
|
10637
10684
|
* reader sees after it. */
|
|
@@ -10739,7 +10786,7 @@ var Share = class {
|
|
|
10739
10786
|
if (this.tab === "person") {
|
|
10740
10787
|
const { url, copied } = this.person;
|
|
10741
10788
|
const keyed = new URL(url, location.href).pathname.startsWith("/k/");
|
|
10742
|
-
body = `<input class="sh-url" readonly value="${escapeHtml(url)}" aria-label="The link" spellcheck="false">` + this.exactRow() + `<div class="sh-note muted">${copied ? "Copied. " : ""}` + (keyed ? "Anyone with it comes in as a guest." : "This server lets in anyone who can reach it.") + `</div><div class="modal-actions"><button class="rv-btn" data-close>Close</button><button class="rv-btn primary" data-copy>${copied ? "Copy again" : "Copy"}</button></div>`;
|
|
10789
|
+
body = `<input class="sh-url" readonly value="${escapeHtml(url)}" aria-label="The link" spellcheck="false">` + this.exactRow() + this.callRow() + `<div class="sh-note muted">${copied ? "Copied. " : ""}` + (keyed ? "Anyone with it comes in as a guest." : "This server lets in anyone who can reach it.") + `</div><div class="modal-actions"><button class="rv-btn" data-close>Close</button><button class="rv-btn primary" data-copy>${copied ? "Copy again" : "Copy"}</button></div>`;
|
|
10743
10790
|
} else body = this.tab === "readonly" ? this.readOnlyBody() : this.tab === "invite" ? this.inviteBody() : this.agentBody();
|
|
10744
10791
|
keepFocus(this.pop, () => this.pop.innerHTML = tabs + `<div class="sh-body">${body}</div>` + this.readOnlyList() + this.peopleList() + this.tokenList());
|
|
10745
10792
|
if (focus) this.pop.querySelector(`[data-f=${focus}]`)?.focus();
|
|
@@ -10753,7 +10800,7 @@ var Share = class {
|
|
|
10753
10800
|
const note = byAddress ? "Anyone who reaches this server may read the project: the address is the read-only link." : this.info.readOnly ? "The link you came by: it shows the project to whoever has it, read-only. Whoever made it can revoke it, which ends every page it opened." : this.info.public ? "This server lets anyone who reaches it read the project (it runs with --public): the address is the read-only link." : `Whoever has it sees what a guest sees, changes nothing and is not seen. It lasts until revoked below.${r2.made ? "" : " Shown again."}`;
|
|
10754
10801
|
return `<input class="sh-url sh-ro-url" readonly value="${escapeHtml(r2.link)}" aria-label="The read-only link" spellcheck="false">` + this.exactRow() + `<div class="sh-note muted">${r2.copied ? "Copied. " : ""}${note}</div><div class="modal-actions">${r2.id ? `<button class="rv-btn" data-ro-again>${this.info.public ? "The address" : "Another link"}</button>` : `<button class="rv-btn" data-close>Close</button>`}<button class="rv-btn primary" data-copy-ro>${r2.copied ? "Copy again" : "Copy"}</button></div>`;
|
|
10755
10802
|
}
|
|
10756
|
-
return `<div class="sh-note muted">Anyone with it can look, unseen, and change nothing, until you revoke it.</div>` + this.exactRow() + (r2.error ? `<div class="modal-err">${escapeHtml(r2.error)}</div>` : "") + `<div class="modal-actions"><button class="rv-btn" data-close>Close</button><button class="rv-btn primary" data-ro-create${this.busy ? " disabled" : ""}>Create link</button></div>`;
|
|
10803
|
+
return `<div class="sh-note muted">Anyone with it can look, unseen, and change nothing, until you revoke it.</div>` + this.exactRow() + (this.hooks.call?.() ? `<button type="button" class="sh-exact" role="switch" aria-checked="${this.roCall}" data-ro-call title="Whoever has it may join the call too, under a name they give: seen in the call, nowhere else"><span class="sh-switch" aria-hidden="true"></span>Can join the call</button>` : "") + (r2.error ? `<div class="modal-err">${escapeHtml(r2.error)}</div>` : "") + `<div class="modal-actions"><button class="rv-btn" data-close>Close</button><button class="rv-btn primary" data-ro-create${this.busy ? " disabled" : ""}>Create link</button></div>`;
|
|
10757
10804
|
}
|
|
10758
10805
|
/** The read-only links in force: who made each and when, when it was last used, the link shown
|
|
10759
10806
|
* again on a click on it, and Revoke. */
|
|
@@ -10766,22 +10813,23 @@ var Share = class {
|
|
|
10766
10813
|
const armed = this.arming === `r:${l2.id}`;
|
|
10767
10814
|
const shown2 = this.tab === "readonly" && this.readOnly.kind === "link" && this.readOnly.id === l2.id;
|
|
10768
10815
|
const id = escapeHtml(l2.id);
|
|
10769
|
-
return `<div class="sh-tok${shown2 ? " on" : ""}"><div class="sh-tok-text" data-ro-show="${id}" title="Show the link again"><div><b>Read-only link</b> <span class="sh-lvl">${id}</span></div><div class="muted">${l2.by ? `by ${escapeHtml(l2.by)}, ` : ""}${escapeHtml(ago(l2.created))} \xB7 ${l2.lastUsed ? `last used ${escapeHtml(ago(l2.lastUsed))}` : "not used yet"}</div></div
|
|
10816
|
+
return `<div class="sh-tok${shown2 ? " on" : ""}"><div class="sh-tok-text" data-ro-show="${id}" title="Show the link again"><div><b>Read-only link</b> <span class="sh-lvl">${id}</span></div><div class="muted">${l2.by ? `by ${escapeHtml(l2.by)}, ` : ""}${escapeHtml(ago(l2.created))} \xB7 ${l2.lastUsed ? `last used ${escapeHtml(ago(l2.lastUsed))}` : "not used yet"}${l2.call ? " \xB7 joins the call" : ""}</div></div>` + (this.hooks.call?.() ? `<button class="rv-btn sh-act" data-ro-callsw="${id}" aria-pressed="${!!l2.call}" title="${l2.call ? "Whoever has it may join the call: press to stop that (they leave it at once)" : "Let whoever has it join the call, under a name they give"}">${l2.call ? "Call \u2713" : "Call"}</button>` : "") + `<button class="rv-btn sh-act" data-ro-show="${id}" aria-pressed="${shown2}" title="The link, to give again">Show link</button><button class="rv-btn sh-act${armed ? " bad" : ""}" data-revoke-ro="${id}" title="It lets nobody in any more, and the pages it opened close, at once">${armed ? "Revoke it" : "Revoke"}</button></div>`;
|
|
10770
10817
|
}
|
|
10771
10818
|
/** Make a read-only link: under the reader's name if they have one (none is asked for). */
|
|
10772
10819
|
async makeReadOnly() {
|
|
10773
10820
|
if (this.busy) return;
|
|
10774
10821
|
this.busy = true;
|
|
10775
10822
|
this.render();
|
|
10776
|
-
const r2 = await this.hooks.data.makeReadOnly();
|
|
10823
|
+
const r2 = await this.hooks.data.makeReadOnly(this.roCall && !!this.hooks.call?.());
|
|
10777
10824
|
this.busy = false;
|
|
10778
10825
|
if ("error" in r2) {
|
|
10779
10826
|
this.readOnly = { kind: "form", error: r2.error };
|
|
10780
10827
|
return this.render();
|
|
10781
10828
|
}
|
|
10782
10829
|
this.readOnlyLinks = r2.links.filter((l2) => !l2.revoked);
|
|
10783
|
-
const
|
|
10784
|
-
|
|
10830
|
+
const base = r2.made.link + (r2.made.call ? "?call" : "");
|
|
10831
|
+
const link = base + await this.fragment();
|
|
10832
|
+
this.readOnly = { kind: "link", id: r2.made.id, base, link, made: true, copied: await copy(link) };
|
|
10785
10833
|
await this.show("readonly");
|
|
10786
10834
|
}
|
|
10787
10835
|
/** Show a read-only link again, in its tab, copied as showing a link copies it. */
|
|
@@ -10789,8 +10837,9 @@ var Share = class {
|
|
|
10789
10837
|
this.arming = null;
|
|
10790
10838
|
const l2 = this.readOnlyLinks?.find((x2) => x2.id === id);
|
|
10791
10839
|
if (!l2) return;
|
|
10792
|
-
const
|
|
10793
|
-
|
|
10840
|
+
const base = l2.link + (l2.call ? "?call" : "");
|
|
10841
|
+
const link = base + await this.fragment();
|
|
10842
|
+
this.readOnly = { kind: "link", id, base, link, made: false, copied: await copy(link) };
|
|
10794
10843
|
await this.show("readonly");
|
|
10795
10844
|
}
|
|
10796
10845
|
/** Revoke a read-only link, under the reader's name: the first press arms the button, the
|
|
@@ -11164,6 +11213,7 @@ var ITEMS = [
|
|
|
11164
11213
|
{ id: "export-btn", label: "Export" },
|
|
11165
11214
|
{ id: "activity-btn", label: "Activity" },
|
|
11166
11215
|
{ id: "talk-btn", label: "Conversations" },
|
|
11216
|
+
{ id: "call-btn", label: "Call" },
|
|
11167
11217
|
{ id: "who", label: "" },
|
|
11168
11218
|
{ id: "help-btn", label: "Help" }
|
|
11169
11219
|
];
|
|
@@ -11188,7 +11238,7 @@ var TALL_LEAST = 0.33;
|
|
|
11188
11238
|
var TALL_TOP_PX = 120;
|
|
11189
11239
|
var EDGE_PX = 12;
|
|
11190
11240
|
var SHEETS = ["panel", "activity", "lostfound"];
|
|
11191
|
-
var DOCKED = "#windows > :is(.sw-win, .pw-win, #convo):not(.collapsed, [hidden])";
|
|
11241
|
+
var DOCKED = "#windows > :is(.sw-win, .pw-win, #convo, #call):not(.collapsed, [hidden])";
|
|
11192
11242
|
function tallInsets() {
|
|
11193
11243
|
const $7 = (id) => document.getElementById(id);
|
|
11194
11244
|
const bar = $7("selbar");
|
|
@@ -11309,6 +11359,8 @@ var Phone = class {
|
|
|
11309
11359
|
const badges = {
|
|
11310
11360
|
"activity-btn": () => shown2("activity-badge", "act-badge"),
|
|
11311
11361
|
"talk-btn": () => shown2("talk-badge", "act-badge") + shown2("talk-at", "talk-at"),
|
|
11362
|
+
// how many are in the call (CallSpec)
|
|
11363
|
+
"call-btn": () => shown2("call-badge", "act-badge"),
|
|
11312
11364
|
// who follows the reader (the owner's decision of 2026-10-20), as the name's mark says it
|
|
11313
11365
|
who: () => {
|
|
11314
11366
|
const said2 = document.getElementById("who-fol")?.getAttribute("aria-label");
|
|
@@ -11610,6 +11662,10 @@ var YOURS = [
|
|
|
11610
11662
|
// link followed from a message — the reader's own tool changing a followed part, which says so
|
|
11611
11663
|
// itself (web/src/talk.ts) — and Esc; its button and a mention's notice open it
|
|
11612
11664
|
{ id: "conversation", what: "the conversation window \u2014 its channels, its thread, its box, a link to what you see \u2014, the conversation button and a mention's notice", where: "#convo, #talk-btn, #talk-notice", whole: true },
|
|
11665
|
+
// the reader's own call (CallSpec decisions 5 and 8): following never opens, closes or moves its
|
|
11666
|
+
// window, and nothing in it ends following — Follow and Ask everyone to follow me in it are the
|
|
11667
|
+
// people's menu's, which start following, as their initials' do
|
|
11668
|
+
{ id: "call", what: "the call: its window \u2014 the pre-join, the tiles, the controls, People \u2014, its button and its notices", where: "#call, #call-btn, #call-notice", whole: true },
|
|
11613
11669
|
{ id: "followingStrip", what: "the following strip: whom you follow, and its \u2715; once following has ended by a move, Follow again", where: "#following", whole: true },
|
|
11614
11670
|
{ id: "hoverCards", what: "hover cards", where: ".hcard" },
|
|
11615
11671
|
// the InfoView hidden or shown (ReviewSpec, "The InfoView"): how the reader looks at the source
|
|
@@ -13071,18 +13127,18 @@ function timeline(snaps) {
|
|
|
13071
13127
|
}
|
|
13072
13128
|
var RULER = { pad: 7, minStep: 8, maxStep: 22, minWidth: 90 };
|
|
13073
13129
|
function ruler(n3, room2) {
|
|
13074
|
-
const { pad, minStep, maxStep, minWidth } = RULER;
|
|
13130
|
+
const { pad: pad2, minStep, maxStep, minWidth } = RULER;
|
|
13075
13131
|
if (n3 <= 1) {
|
|
13076
13132
|
const w2 = Math.min(room2, minWidth);
|
|
13077
13133
|
return { n: n3, step: 0, width: w2, strip: w2 };
|
|
13078
13134
|
}
|
|
13079
|
-
let step2 = Math.max(minStep, Math.min(maxStep, (room2 - 2 *
|
|
13080
|
-
let width = Math.min(room2, (n3 - 1) * step2 + 2 *
|
|
13135
|
+
let step2 = Math.max(minStep, Math.min(maxStep, (room2 - 2 * pad2) / (n3 - 1)));
|
|
13136
|
+
let width = Math.min(room2, (n3 - 1) * step2 + 2 * pad2);
|
|
13081
13137
|
if (width < minWidth && room2 > width) {
|
|
13082
13138
|
width = Math.min(room2, minWidth);
|
|
13083
|
-
step2 = (width - 2 *
|
|
13139
|
+
step2 = (width - 2 * pad2) / (n3 - 1);
|
|
13084
13140
|
}
|
|
13085
|
-
return { n: n3, step: step2, width, strip: Math.max(width, (n3 - 1) * step2 + 2 *
|
|
13141
|
+
return { n: n3, step: step2, width, strip: Math.max(width, (n3 - 1) * step2 + 2 * pad2) };
|
|
13086
13142
|
}
|
|
13087
13143
|
function tickX(r2, i2) {
|
|
13088
13144
|
return r2.n <= 1 ? r2.width / 2 : RULER.pad + i2 * r2.step;
|
|
@@ -14458,9 +14514,9 @@ var TimeMachine = class {
|
|
|
14458
14514
|
let lastX = 0;
|
|
14459
14515
|
let timer = null;
|
|
14460
14516
|
const place2 = (clientX) => {
|
|
14461
|
-
const
|
|
14462
|
-
if (!
|
|
14463
|
-
const b2 =
|
|
14517
|
+
const svg2 = this.bar.querySelector(".tm-line svg");
|
|
14518
|
+
if (!svg2 || !this.ruler) return null;
|
|
14519
|
+
const b2 = svg2.getBoundingClientRect();
|
|
14464
14520
|
return { x: (clientX - b2.left) / Math.max(1, b2.width) * this.ruler.width, w: this.ruler.width };
|
|
14465
14521
|
};
|
|
14466
14522
|
const at = (clientX) => {
|
|
@@ -16219,6 +16275,10 @@ function meets(a3, b2) {
|
|
|
16219
16275
|
function coveredBy(me, others) {
|
|
16220
16276
|
return others.some((o2) => o2.z > me.z && o2.at.w > 0 && o2.at.h > 0 && meets(o2.at, me.at));
|
|
16221
16277
|
}
|
|
16278
|
+
function maximizedRect(vp, top = EDGE) {
|
|
16279
|
+
const y2 = Math.min(Math.max(top, EDGE), Math.max(EDGE, vp.h - EDGE - 80));
|
|
16280
|
+
return { x: EDGE, y: y2, w: Math.max(vp.w - 2 * EDGE, 120), h: Math.max(vp.h - y2 - EDGE, 80) };
|
|
16281
|
+
}
|
|
16222
16282
|
var EDGES = ["n", "s", "e", "w", "ne", "nw", "se", "sw"];
|
|
16223
16283
|
var DRAG_PX = 3;
|
|
16224
16284
|
var viewport = () => ({ w: document.documentElement.clientWidth || innerWidth, h: document.documentElement.clientHeight || innerHeight });
|
|
@@ -16241,6 +16301,8 @@ var FloatWindow = class {
|
|
|
16241
16301
|
/** the reader moved or resized it since its place was last set by the page (`ownPlace`, `unmove`):
|
|
16242
16302
|
* what the source and reference windows, paired, keep as the reader's choice */
|
|
16243
16303
|
byHand = false;
|
|
16304
|
+
/** maximized by its button: it fills the viewport under the bars until restored */
|
|
16305
|
+
maximized = false;
|
|
16244
16306
|
watch = null;
|
|
16245
16307
|
resized = () => this.layout();
|
|
16246
16308
|
constructor(el, o2) {
|
|
@@ -16265,6 +16327,7 @@ var FloatWindow = class {
|
|
|
16265
16327
|
const t2 = e2.target;
|
|
16266
16328
|
if (t2.closest(this.o.collapser)) this.collapse(true);
|
|
16267
16329
|
else if (t2.closest(this.o.opener)) this.collapse(false);
|
|
16330
|
+
else if (this.o.maximizer && t2.closest(this.o.maximizer)) this.maximize(!this.maximized);
|
|
16268
16331
|
});
|
|
16269
16332
|
window.addEventListener("resize", this.resized);
|
|
16270
16333
|
if (o2.fit && typeof ResizeObserver !== "undefined") {
|
|
@@ -16316,7 +16379,8 @@ var FloatWindow = class {
|
|
|
16316
16379
|
const vp = viewport();
|
|
16317
16380
|
const k2 = this.kept();
|
|
16318
16381
|
this.fitting = false;
|
|
16319
|
-
if (this.
|
|
16382
|
+
if (this.maximized && !this.collapsed) this.rect = maximizedRect(vp, this.o.top?.());
|
|
16383
|
+
else if (this.own) {
|
|
16320
16384
|
const r2 = clampRect(this.own, vp, this.o.min);
|
|
16321
16385
|
this.rect = this.o.top && !this.byHand ? underRect(r2, vp, this.o.top(), this.o.min) : r2;
|
|
16322
16386
|
} else if (k2.place) this.rect = rectOf(k2.place, vp, this.o.min);
|
|
@@ -16380,7 +16444,8 @@ var FloatWindow = class {
|
|
|
16380
16444
|
* windows too. */
|
|
16381
16445
|
reset() {
|
|
16382
16446
|
this.collapsed = false;
|
|
16383
|
-
this.
|
|
16447
|
+
this.maximized = false;
|
|
16448
|
+
this.el.classList.remove("collapsed", "maximized");
|
|
16384
16449
|
for (const k2 of ["left", "top", "right", "bottom", "width", "height", "maxWidth", "maxHeight", "minWidth", "minHeight", "zIndex"]) this.el.style[k2] = "";
|
|
16385
16450
|
stack = stack.filter((el) => el !== this.el);
|
|
16386
16451
|
restack();
|
|
@@ -16401,10 +16466,20 @@ var FloatWindow = class {
|
|
|
16401
16466
|
if (inside3) this.el.querySelector(on ? this.o.opener : this.o.collapser)?.focus();
|
|
16402
16467
|
this.o.collapsed?.(on);
|
|
16403
16468
|
}
|
|
16469
|
+
/** Maximize the window, or restore it where it was: nothing of it is kept. */
|
|
16470
|
+
maximize(on) {
|
|
16471
|
+
if (!this.o.live() || on === this.maximized) return;
|
|
16472
|
+
this.maximized = on;
|
|
16473
|
+
this.el.classList.toggle("maximized", on);
|
|
16474
|
+
if (on && this.collapsed) this.setCollapsed(false);
|
|
16475
|
+
else this.layout();
|
|
16476
|
+
this.front();
|
|
16477
|
+
this.o.maximized?.(on);
|
|
16478
|
+
}
|
|
16404
16479
|
/** A press on the title bar moves the window, on an edge or a corner resizes it; mouse, pen or
|
|
16405
|
-
* touch alike, the pointer captured until it is let go. */
|
|
16480
|
+
* touch alike, the pointer captured until it is let go. A maximized window stays where it is. */
|
|
16406
16481
|
press(e2) {
|
|
16407
|
-
if (!this.o.live() || this.collapsed || this.dragging || !e2.isPrimary || e2.pointerType === "mouse" && e2.button !== 0) return;
|
|
16482
|
+
if (!this.o.live() || this.collapsed || this.maximized || this.dragging || !e2.isPrimary || e2.pointerType === "mouse" && e2.button !== 0) return;
|
|
16408
16483
|
if (sheeted() || isMonitor()) return;
|
|
16409
16484
|
const t2 = e2.target;
|
|
16410
16485
|
const edge = t2.closest("[data-rz]");
|
|
@@ -16719,6 +16794,13 @@ var AGAIN_MS = 900;
|
|
|
16719
16794
|
var SIDE_MIN = 700;
|
|
16720
16795
|
var FITTED_MIN = 540;
|
|
16721
16796
|
var SCREEN_MIN = 1e3;
|
|
16797
|
+
var PANE_W = 360;
|
|
16798
|
+
var PANE_MIN = 240;
|
|
16799
|
+
var CODE_MIN = 300;
|
|
16800
|
+
function paneWidth(want, room2) {
|
|
16801
|
+
const w2 = want !== null && Number.isFinite(want) ? want : PANE_W;
|
|
16802
|
+
return Math.round(Math.max(PANE_MIN, Math.min(w2, room2 - CODE_MIN)));
|
|
16803
|
+
}
|
|
16722
16804
|
function paneSide(winWidth, fitted, screenWidth) {
|
|
16723
16805
|
if (screenWidth < SCREEN_MIN && winWidth < SIDE_MIN) return false;
|
|
16724
16806
|
return winWidth >= (fitted && screenWidth >= SCREEN_MIN ? FITTED_MIN : SIDE_MIN);
|
|
@@ -16781,6 +16863,7 @@ function headHtml(caret, sides, interactive) {
|
|
|
16781
16863
|
return `<div class="iv-head"><span class="iv-title">InfoView</span><span class="iv-where" title="${interactive ? "Hover a subterm for its type" : ""}">line ${caret.line + 1}, column ${caret.ch + 1}</span>${seg}<button type="button" class="icon iv-hide" data-iv-hide aria-label="Hide the InfoView" title="Hide the InfoView in every source window (kept in this browser)">${HIDE}</button></div>`;
|
|
16782
16864
|
}
|
|
16783
16865
|
var HIDE = `<svg viewBox="0 0 16 16" width="14" height="14" aria-hidden="true"><path d="M6 4l4 4-4 4"/></svg>`;
|
|
16866
|
+
var GRIP = `<div class="iv-grip" aria-hidden="true" title="Drag to widen or narrow the InfoView; double-click for its own width"></div>`;
|
|
16784
16867
|
var InfoView = class {
|
|
16785
16868
|
hooks;
|
|
16786
16869
|
code = null;
|
|
@@ -16799,6 +16882,8 @@ var InfoView = class {
|
|
|
16799
16882
|
hoverWait = null;
|
|
16800
16883
|
hoverTurn = 0;
|
|
16801
16884
|
sizer = null;
|
|
16885
|
+
/** the last press in the pane was on its grip, beside the code */
|
|
16886
|
+
onGrip = false;
|
|
16802
16887
|
constructor(hooks) {
|
|
16803
16888
|
this.hooks = hooks;
|
|
16804
16889
|
}
|
|
@@ -16976,7 +17061,7 @@ var InfoView = class {
|
|
|
16976
17061
|
if (had) this.hooks.win().focus({ preventScroll: true });
|
|
16977
17062
|
return this.below();
|
|
16978
17063
|
}
|
|
16979
|
-
pane.innerHTML = headHtml(k2, v2.sides, !!this.answer?.interactive) + `<div class="iv-body">${v2.html}</div>`;
|
|
17064
|
+
pane.innerHTML = GRIP + headHtml(k2, v2.sides, !!this.answer?.interactive) + `<div class="iv-body">${v2.html}</div>`;
|
|
16980
17065
|
pane.setAttribute("aria-label", "What Lean says at the caret");
|
|
16981
17066
|
if (had && !had.isConnected) (pane.querySelector(`[data-iv-when="${when}"]`) ?? this.hooks.win()).focus({ preventScroll: true });
|
|
16982
17067
|
this.below();
|
|
@@ -17021,6 +17106,13 @@ var InfoView = class {
|
|
|
17021
17106
|
this.hooks.moved();
|
|
17022
17107
|
}
|
|
17023
17108
|
});
|
|
17109
|
+
pane.addEventListener("pointerdown", (e2) => {
|
|
17110
|
+
this.onGrip = !!split?.classList.contains("iv-side") && !!e2.target.closest(".iv-grip");
|
|
17111
|
+
if (this.onGrip) this.drag(e2);
|
|
17112
|
+
});
|
|
17113
|
+
pane.addEventListener("dblclick", () => {
|
|
17114
|
+
if (this.onGrip) this.hooks.setWidth(null);
|
|
17115
|
+
});
|
|
17024
17116
|
pane.addEventListener("mousemove", (e2) => {
|
|
17025
17117
|
if (e2.buttons) return;
|
|
17026
17118
|
const t2 = e2.target;
|
|
@@ -17071,8 +17163,51 @@ var InfoView = class {
|
|
|
17071
17163
|
if (!r2 || r2.error || r2.pending || r2.stale || !r2.type && !r2.expr) return;
|
|
17072
17164
|
this.hooks.cards.show(subtermHtml(r2, (w2) => this.hooks.resolve(w2)), box);
|
|
17073
17165
|
}
|
|
17074
|
-
/**
|
|
17075
|
-
*
|
|
17166
|
+
/** A press on the pane's edge beside the code: dragged, the pane as wide as the pointer makes it,
|
|
17167
|
+
* in this window as it moves and, let go, kept for every window (hooks.setWidth). Dragged left it
|
|
17168
|
+
* widens, the code giving way, or the window growing where it is fitted to its code. */
|
|
17169
|
+
drag(e2) {
|
|
17170
|
+
const pane = this.pane;
|
|
17171
|
+
const split = pane?.parentElement;
|
|
17172
|
+
if (!pane || !split || !e2.isPrimary || e2.pointerType === "mouse" && e2.button !== 0) return;
|
|
17173
|
+
e2.preventDefault();
|
|
17174
|
+
const x0 = e2.clientX, w0 = pane.offsetWidth;
|
|
17175
|
+
let w2 = w0;
|
|
17176
|
+
pane.setPointerCapture(e2.pointerId);
|
|
17177
|
+
split.classList.add("iv-sizing");
|
|
17178
|
+
const move = (ev) => {
|
|
17179
|
+
if (ev.pointerId !== e2.pointerId) return;
|
|
17180
|
+
w2 = paneWidth(w0 + x0 - ev.clientX, this.room());
|
|
17181
|
+
pane.style.width = `${w2}px`;
|
|
17182
|
+
};
|
|
17183
|
+
const end = (ev) => {
|
|
17184
|
+
if (ev.pointerId !== e2.pointerId) return;
|
|
17185
|
+
pane.removeEventListener("pointermove", move);
|
|
17186
|
+
pane.removeEventListener("pointerup", end);
|
|
17187
|
+
pane.removeEventListener("pointercancel", end);
|
|
17188
|
+
split.classList.remove("iv-sizing");
|
|
17189
|
+
if (w2 !== w0) this.hooks.setWidth(w2);
|
|
17190
|
+
};
|
|
17191
|
+
pane.addEventListener("pointermove", move);
|
|
17192
|
+
pane.addEventListener("pointerup", end);
|
|
17193
|
+
pane.addEventListener("pointercancel", end);
|
|
17194
|
+
}
|
|
17195
|
+
/** The width the code and the pane beside it may share (paneWidth's `room`): the window's, or the
|
|
17196
|
+
* most it may grow to where it is fitted to its code. */
|
|
17197
|
+
room() {
|
|
17198
|
+
const split = this.pane?.parentElement;
|
|
17199
|
+
if (!split) return 0;
|
|
17200
|
+
const win2 = this.hooks.win();
|
|
17201
|
+
const max = this.hooks.fitted() ? parseFloat(getComputedStyle(win2).maxWidth) : NaN;
|
|
17202
|
+
return split.clientWidth + (Number.isFinite(max) ? Math.max(0, max - win2.offsetWidth) : 0);
|
|
17203
|
+
}
|
|
17204
|
+
/** The reader's width for the pane changed, in another window or this one: it takes it. */
|
|
17205
|
+
resized() {
|
|
17206
|
+
this.size();
|
|
17207
|
+
}
|
|
17208
|
+
/** Keep the pane beside the code where the window is wide enough, else below it, as wide there as
|
|
17209
|
+
* the reader made it (paneWidth); and tell the pane how tall the window's scrolled view is, which
|
|
17210
|
+
* it stays within. */
|
|
17076
17211
|
watchSize() {
|
|
17077
17212
|
if (this.sizer || typeof ResizeObserver === "undefined") return this.size();
|
|
17078
17213
|
this.sizer = new ResizeObserver(() => this.size());
|
|
@@ -17085,6 +17220,12 @@ var InfoView = class {
|
|
|
17085
17220
|
if (!split || !scroll) return;
|
|
17086
17221
|
const side2 = paneSide(this.hooks.win().offsetWidth, this.hooks.fitted(), document.documentElement.clientWidth || innerWidth);
|
|
17087
17222
|
split.classList.toggle("iv-side", side2);
|
|
17223
|
+
const pane = this.pane;
|
|
17224
|
+
if (!side2) pane.style.width = "";
|
|
17225
|
+
else if (!split.classList.contains("iv-sizing")) {
|
|
17226
|
+
const w2 = `${paneWidth(this.hooks.width(), this.room())}px`;
|
|
17227
|
+
if (pane.style.width !== w2) pane.style.width = w2;
|
|
17228
|
+
}
|
|
17088
17229
|
scroll.style.setProperty("--sw-view", `${scroll.clientHeight}px`);
|
|
17089
17230
|
this.below();
|
|
17090
17231
|
}
|
|
@@ -17673,6 +17814,8 @@ var SourceWindow = class {
|
|
|
17673
17814
|
card: (name) => ({ html: this.fromGraph(name), more: this.describe(name) }),
|
|
17674
17815
|
hidden: () => this.hooks.infoHidden?.() ?? false,
|
|
17675
17816
|
hide: (on) => this.hooks.hideInfo?.(on),
|
|
17817
|
+
width: () => this.hooks.infoWidth?.() ?? null,
|
|
17818
|
+
setWidth: (w2) => this.hooks.setInfoWidth?.(w2),
|
|
17676
17819
|
moved: () => this.hooks.caretMoved?.(this),
|
|
17677
17820
|
win: () => this.el,
|
|
17678
17821
|
fitted: () => this.win.fitted,
|
|
@@ -18018,6 +18161,10 @@ var SourceWindow = class {
|
|
|
18018
18161
|
infoChanged() {
|
|
18019
18162
|
this.info.draw();
|
|
18020
18163
|
}
|
|
18164
|
+
/** The InfoView's width beside the code set by the reader, in every window. */
|
|
18165
|
+
infoResized() {
|
|
18166
|
+
this.info.resized();
|
|
18167
|
+
}
|
|
18021
18168
|
/** Nothing picked: the quote button goes. */
|
|
18022
18169
|
unpick() {
|
|
18023
18170
|
this.picked = null;
|
|
@@ -42338,6 +42485,16 @@ function panelsPart(page) {
|
|
|
42338
42485
|
store2.save();
|
|
42339
42486
|
for (const w2 of sources.all) w2.infoChanged();
|
|
42340
42487
|
},
|
|
42488
|
+
// its width beside the code, the reader's too (the owner's decision of 2026-11-10)
|
|
42489
|
+
infoWidth: () => {
|
|
42490
|
+
const w2 = store2.data.infoWidth;
|
|
42491
|
+
return typeof w2 === "number" && Number.isFinite(w2) ? w2 : null;
|
|
42492
|
+
},
|
|
42493
|
+
setInfoWidth: (w2) => {
|
|
42494
|
+
store2.data.infoWidth = w2 ?? void 0;
|
|
42495
|
+
store2.save();
|
|
42496
|
+
for (const s2 of sources.all) s2.infoResized();
|
|
42497
|
+
},
|
|
42341
42498
|
caretMoved: (w2) => {
|
|
42342
42499
|
for (const o2 of sources.all) if (o2 !== w2) o2.followCaret(null);
|
|
42343
42500
|
page.people.report();
|
|
@@ -46295,7 +46452,7 @@ var GraphCanvas = class {
|
|
|
46295
46452
|
[lab.width, lab.height] = [W2, rows];
|
|
46296
46453
|
this.ctx = lab.getContext("2d");
|
|
46297
46454
|
this.labelBase = [f2, 0, 0, f2, -rect.x * f2, -(rect.y * f2 + y0)];
|
|
46298
|
-
this.drawLabels((sx, sy,
|
|
46455
|
+
this.drawLabels((sx, sy, pad2) => sx > -pad2 && sy > -pad2 && sx < this.w + pad2 && sy < this.h + pad2, dotR);
|
|
46299
46456
|
out.drawImage(lab, 0, 0);
|
|
46300
46457
|
} finally {
|
|
46301
46458
|
this.cam = was.cam;
|
|
@@ -46313,7 +46470,7 @@ var GraphCanvas = class {
|
|
|
46313
46470
|
this.ctx = ctx;
|
|
46314
46471
|
this.labelBase = [1, 0, 0, 1, 0, 0];
|
|
46315
46472
|
try {
|
|
46316
|
-
this.drawLabels((sx, sy,
|
|
46473
|
+
this.drawLabels((sx, sy, pad2) => sx > -pad2 && sy > -pad2 && sx < this.w + pad2 && sy < this.h + pad2, this.dotPx());
|
|
46317
46474
|
} finally {
|
|
46318
46475
|
this.ctx = was;
|
|
46319
46476
|
this.labelBase = null;
|
|
@@ -47305,7 +47462,7 @@ var GraphCanvas = class {
|
|
|
47305
47462
|
this.buildScene();
|
|
47306
47463
|
}
|
|
47307
47464
|
const dotR = this.dotPx();
|
|
47308
|
-
const onScreen2 = (sx, sy,
|
|
47465
|
+
const onScreen2 = (sx, sy, pad2) => sx > -pad2 && sy > -pad2 && sx < this.w + pad2 && sy < this.h + pad2;
|
|
47309
47466
|
const activeDots = [];
|
|
47310
47467
|
if (this.active) {
|
|
47311
47468
|
for (const i2 of this.activeList) {
|
|
@@ -48655,6 +48812,48 @@ function hangCard(icon, off, w2, h2, room2, avoid = null) {
|
|
|
48655
48812
|
}
|
|
48656
48813
|
return { box: best.box, flip: best.flip };
|
|
48657
48814
|
}
|
|
48815
|
+
var CARD_APART = 6;
|
|
48816
|
+
function spreadCards(cards) {
|
|
48817
|
+
const out = cards.map((c3) => c3.box);
|
|
48818
|
+
const taken = cards.filter((c3) => c3.fixed).map((c3) => c3.box);
|
|
48819
|
+
const free = cards.map((c3, i2) => ({ c: c3, i: i2 })).filter(({ c: c3 }) => !c3.fixed).sort((a3, b2) => a3.c.box.y0 - b2.c.box.y0 || a3.c.box.x0 - b2.c.box.x0 || a3.i - b2.i);
|
|
48820
|
+
for (const { c: c3, i: i2 } of free) {
|
|
48821
|
+
const b2 = c3.box;
|
|
48822
|
+
const meets2 = (x2) => taken.some((t2) => area(x2, t2) > 0);
|
|
48823
|
+
if (!meets2(b2)) {
|
|
48824
|
+
taken.push(b2);
|
|
48825
|
+
continue;
|
|
48826
|
+
}
|
|
48827
|
+
const w2 = b2.x1 - b2.x0, h2 = b2.y1 - b2.y0;
|
|
48828
|
+
const outside2 = (x2) => Math.max(0, w2 * h2 - area(x2, c3.room));
|
|
48829
|
+
const was = { out: outside2(b2), covers: !!c3.avoid && area(b2, c3.avoid) > 0 };
|
|
48830
|
+
const [ix, iy] = c3.icon;
|
|
48831
|
+
const off = [(b2.x0 + b2.x1) / 2 - ix, (b2.y0 + b2.y1) / 2 - iy];
|
|
48832
|
+
const fits = (x2) => {
|
|
48833
|
+
const dx = (x2.x0 + x2.x1) / 2 - ix, dy = (x2.y0 + x2.y1) / 2 - iy;
|
|
48834
|
+
if (Math.abs(dx) > CARD_REACH || Math.abs(dy) > CARD_REACH) return false;
|
|
48835
|
+
if (Math.abs(dx) < w2 / 2 + ICON_CLEAR && Math.abs(dy) < h2 / 2 + ICON_CLEAR) return false;
|
|
48836
|
+
if (outside2(x2) > was.out + 0.5) return false;
|
|
48837
|
+
if (!was.covers && c3.avoid && area(x2, c3.avoid) > 0) return false;
|
|
48838
|
+
return !meets2(x2);
|
|
48839
|
+
};
|
|
48840
|
+
const by = (x2, dx, dy) => ({ x0: x2.x0 + dx, y0: x2.y0 + dy, x1: x2.x1 + dx, y1: x2.y1 + dy });
|
|
48841
|
+
const ways = [];
|
|
48842
|
+
for (const [fx, fy] of FLIPS) {
|
|
48843
|
+
const f2 = cardBox(ix, iy, [off[0] * fx, off[1] * fy], w2, h2);
|
|
48844
|
+
ways.push(f2);
|
|
48845
|
+
for (const t2 of taken)
|
|
48846
|
+
ways.push(by(f2, 0, t2.y0 - CARD_APART - f2.y1), by(f2, 0, t2.y1 + CARD_APART - f2.y0), by(f2, t2.x0 - CARD_APART - f2.x1, 0), by(f2, t2.x1 + CARD_APART - f2.x0, 0));
|
|
48847
|
+
}
|
|
48848
|
+
const cx = (b2.x0 + b2.x1) / 2, cy = (b2.y0 + b2.y1) / 2;
|
|
48849
|
+
const far = ways.map((x2, k2) => ({ x: x2, k: k2, d: Math.hypot((x2.x0 + x2.x1) / 2 - cx, (x2.y0 + x2.y1) / 2 - cy) }));
|
|
48850
|
+
far.sort((p2, q2) => p2.d - q2.d || p2.k - q2.k);
|
|
48851
|
+
const best = far.find((p2) => fits(p2.x))?.x ?? b2;
|
|
48852
|
+
out[i2] = best;
|
|
48853
|
+
taken.push(best);
|
|
48854
|
+
}
|
|
48855
|
+
return out;
|
|
48856
|
+
}
|
|
48658
48857
|
function leaderLine(x2, y2, b2) {
|
|
48659
48858
|
const px2 = Math.max(b2.x0, Math.min(b2.x1, x2)), py = Math.max(b2.y0, Math.min(b2.y1, y2));
|
|
48660
48859
|
const d2 = Math.hypot(px2 - x2, py - y2);
|
|
@@ -49026,6 +49225,8 @@ var Stickies = class {
|
|
|
49026
49225
|
nbOf = { L: null, nodes: null, mode: null };
|
|
49027
49226
|
/** the ring around the board, as drawn in the last frame */
|
|
49028
49227
|
ring = null;
|
|
49228
|
+
/** the cards open this frame, as each hangs by itself: set apart once all are placed (hangCards) */
|
|
49229
|
+
opened = [];
|
|
49029
49230
|
/** what would hold the note whose icon is dragged, were it let go now */
|
|
49030
49231
|
target = null;
|
|
49031
49232
|
/** the circle round its declaration, while the icon of a note attached to one is dragged */
|
|
@@ -49305,6 +49506,7 @@ var Stickies = class {
|
|
|
49305
49506
|
const S7 = C7.scene;
|
|
49306
49507
|
const W2 = innerWidth, H2 = innerHeight;
|
|
49307
49508
|
this.topRing = void 0;
|
|
49509
|
+
this.opened = [];
|
|
49308
49510
|
const onRing = [];
|
|
49309
49511
|
const inCluster = [];
|
|
49310
49512
|
for (const d3 of this.drawn.values()) {
|
|
@@ -49320,6 +49522,7 @@ var Stickies = class {
|
|
|
49320
49522
|
else this.place(d3, s2.x, s2.y, look, t2, s2.point);
|
|
49321
49523
|
}
|
|
49322
49524
|
this.frameRing(onRing);
|
|
49525
|
+
this.hangCards();
|
|
49323
49526
|
const p2 = this.dragging();
|
|
49324
49527
|
const d2 = p2?.part === "icon" && p2.now ? this.drawn.get(p2.id) : void 0;
|
|
49325
49528
|
const aim2 = d2 && p2?.now ? this.aimFor(d2, p2.now) : null;
|
|
@@ -49423,9 +49626,10 @@ var Stickies = class {
|
|
|
49423
49626
|
/** Note `d` drawn at (wx, wy) of the board's world — its place, or, attached to a declaration whose
|
|
49424
49627
|
* point is at `point`, its spot at its offset from it —, in `look`, `t` of its icon showing (1 its
|
|
49425
49628
|
* icon, 0 its dot, between a blend: shared/notecard.ts, iconShare): its mark, and where it is open
|
|
49426
|
-
* its card, hanging as its offset says and flipped to stay on the screen,
|
|
49427
|
-
*
|
|
49428
|
-
*
|
|
49629
|
+
* its card, hanging as its offset says and flipped to stay on the screen, then set apart from the
|
|
49630
|
+
* other open cards and joined to the icon by its leader (hangCards); attached, the dashed leader to
|
|
49631
|
+
* the declaration's point. Hidden where its mark is off the screen. What is dragged follows the
|
|
49632
|
+
* pointer instead: the icon with its card, or the card alone. */
|
|
49429
49633
|
place(d2, wx, wy, look, t2 = 1, point = null) {
|
|
49430
49634
|
const C7 = this.canvas;
|
|
49431
49635
|
const k2 = C7.cam.k;
|
|
@@ -49458,13 +49662,30 @@ var Stickies = class {
|
|
|
49458
49662
|
return;
|
|
49459
49663
|
}
|
|
49460
49664
|
const [w2, h2] = this.cardSizeOf(d2);
|
|
49461
|
-
|
|
49665
|
+
const room2 = this.room();
|
|
49666
|
+
let box, avoid = null;
|
|
49462
49667
|
if (p2?.part === "card" && p2.now) box = { x0: p2.now[0], y0: p2.now[1], x1: p2.now[0] + w2, y1: p2.now[1] + h2 };
|
|
49463
49668
|
else {
|
|
49464
|
-
const
|
|
49465
|
-
|
|
49669
|
+
const hang = this.hangOf(d2, w2, h2);
|
|
49670
|
+
avoid = hang.avoid;
|
|
49671
|
+
box = hangCard([sx, sy], hang.off, w2, h2, room2, avoid).box;
|
|
49466
49672
|
}
|
|
49467
49673
|
d2.box = box;
|
|
49674
|
+
this.opened.push({ d: d2, card: { icon: [sx, sy], box, room: room2, avoid, fixed: !!p2 || !!d2.note.card } });
|
|
49675
|
+
}
|
|
49676
|
+
/** The open cards set apart from one another, as far as they can be (the owner's decision of
|
|
49677
|
+
* 2026-11-10; shared/notecard.ts, spreadCards), and each hung there, joined to its icon by its
|
|
49678
|
+
* leader. */
|
|
49679
|
+
hangCards() {
|
|
49680
|
+
const opened = this.opened;
|
|
49681
|
+
this.opened = [];
|
|
49682
|
+
const boxes = spreadCards(opened.map((o2) => o2.card));
|
|
49683
|
+
opened.forEach(({ d: d2, card }, k2) => this.hang(d2, card.icon, boxes[k2]));
|
|
49684
|
+
}
|
|
49685
|
+
/** Note `d`'s card hung at `box`, its leader from its icon at `icon`. */
|
|
49686
|
+
hang(d2, icon, box) {
|
|
49687
|
+
const [sx, sy] = icon;
|
|
49688
|
+
d2.box = box;
|
|
49468
49689
|
d2.card.style.transform = `translate(${Math.round(box.x0)}px, ${Math.round(box.y0)}px)`;
|
|
49469
49690
|
const line = leaderLine(sx, sy, box);
|
|
49470
49691
|
d2.lead.hidden = !line;
|
|
@@ -49941,7 +50162,7 @@ var Stickies = class {
|
|
|
49941
50162
|
const ir = d2.icon.getBoundingClientRect();
|
|
49942
50163
|
if (!(ir.width > 0)) continue;
|
|
49943
50164
|
const r2 = ir.width / 2, s2 = r2 / ICON_R;
|
|
49944
|
-
const ic = style(d2.icon),
|
|
50165
|
+
const ic = style(d2.icon), svg2 = d2.icon.querySelector("svg.sk-icon");
|
|
49945
50166
|
const dot = d2.icon.querySelector(".sk-dot");
|
|
49946
50167
|
let decl = null;
|
|
49947
50168
|
const dl = !d2.dlead.hidden ? ends(d2.dlead) : null;
|
|
@@ -49984,9 +50205,9 @@ var Stickies = class {
|
|
|
49984
50205
|
ring: ic.borderTopColor,
|
|
49985
50206
|
ringW: (parseFloat(ic.borderTopWidth) || 1.5) * s2,
|
|
49986
50207
|
dashed: ic.borderTopStyle === "dashed",
|
|
49987
|
-
glyph:
|
|
50208
|
+
glyph: svg2?.innerHTML ?? "",
|
|
49988
50209
|
glyphPx: 14 * s2,
|
|
49989
|
-
colour:
|
|
50210
|
+
colour: svg2 ? style(svg2).color : ic.borderTopColor,
|
|
49990
50211
|
dot: dot ? style(dot).backgroundColor : ic.borderTopColor,
|
|
49991
50212
|
surface,
|
|
49992
50213
|
decl,
|
|
@@ -52838,7 +53059,7 @@ var ArtFrame = class {
|
|
|
52838
53059
|
await Promise.all(ART_FACES.map((f2) => document.fonts?.load(f2).catch(() => []))).catch(() => {
|
|
52839
53060
|
});
|
|
52840
53061
|
if (kind === "svg") {
|
|
52841
|
-
const
|
|
53062
|
+
const svg2 = artSvg(rect, s2, bg, ART_SANS, this.measure, (pen) => {
|
|
52842
53063
|
const ctx = pen;
|
|
52843
53064
|
if (ground) drawBackdrop(ctx, s2.style, rect);
|
|
52844
53065
|
if (s2.border) {
|
|
@@ -52858,7 +53079,7 @@ var ArtFrame = class {
|
|
|
52858
53079
|
if (s2.border) pen.raw(`</g>`);
|
|
52859
53080
|
this.writeOver(ctx, s2, rect);
|
|
52860
53081
|
}, await faces());
|
|
52861
|
-
download(new Blob([
|
|
53082
|
+
download(new Blob([svg2], { type: "image/svg+xml" }), name);
|
|
52862
53083
|
return true;
|
|
52863
53084
|
}
|
|
52864
53085
|
this.busy = true;
|
|
@@ -52986,7 +53207,7 @@ function download(blob, name) {
|
|
|
52986
53207
|
// src/web/src/pageart.ts
|
|
52987
53208
|
function artPart(page) {
|
|
52988
53209
|
const { data, store: store2, S: S7 } = page;
|
|
52989
|
-
const ART_INERT = "#bar .brand, #bar .library-wrap, #export-btn, #activity-btn, #bar .talk-wrap, #bar .peers-wrap, #bar .who-wrap, #help-btn, #bar .more-wrap";
|
|
53210
|
+
const ART_INERT = "#bar .brand, #bar .library-wrap, #export-btn, #activity-btn, #bar .talk-wrap, #bar .call-wrap, #bar .peers-wrap, #bar .who-wrap, #help-btn, #bar .more-wrap";
|
|
52990
53211
|
const ART_KEYS = /* @__PURE__ */ new Set(["/", "1", "2", "3", "f", "+", "=", "-", "_", "e", "[", "]", "l"]);
|
|
52991
53212
|
page.artLook = null;
|
|
52992
53213
|
let gitNow = null;
|
|
@@ -53957,7 +54178,7 @@ var store = {
|
|
|
53957
54178
|
}
|
|
53958
54179
|
};
|
|
53959
54180
|
var sizes = typeof localStorage === "object" ? store.read() : {};
|
|
53960
|
-
var WINDOWS = "#windows > :is(.sw-win, .pw-win, #convo):not([hidden])";
|
|
54181
|
+
var WINDOWS = "#windows > :is(.sw-win, .pw-win, #convo, #call):not([hidden])";
|
|
53961
54182
|
var kindOf = (el) => el.classList.contains("sw-win") ? "source" : el.classList.contains("pw-win") ? "paper" : "talk";
|
|
53962
54183
|
var paneOpen = () => ["panel", "activity", "lostfound"].some((id) => $5(id)?.classList.contains("open"));
|
|
53963
54184
|
function current2() {
|
|
@@ -55035,6 +55256,527 @@ function peoplePart(page) {
|
|
|
55035
55256
|
return { people, asking, syncPeers };
|
|
55036
55257
|
}
|
|
55037
55258
|
|
|
55259
|
+
// src/shared/call.ts
|
|
55260
|
+
var CALL_TAB = /^[A-Za-z0-9_-]{16,64}$/;
|
|
55261
|
+
|
|
55262
|
+
// src/web/src/call/tab.ts
|
|
55263
|
+
var TAB_KEY = "visualproof:call:tab";
|
|
55264
|
+
var ASK_MS2 = 150;
|
|
55265
|
+
var ALPHANUMERIC = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
|
|
55266
|
+
function newTab(random = (b2) => crypto.getRandomValues(b2)) {
|
|
55267
|
+
let tab = "";
|
|
55268
|
+
while (tab.length < 16) {
|
|
55269
|
+
for (const b2 of random(new Uint8Array(32))) if (b2 < 248 && tab.length < 16) tab += ALPHANUMERIC[b2 % 62];
|
|
55270
|
+
}
|
|
55271
|
+
return tab;
|
|
55272
|
+
}
|
|
55273
|
+
var browserDeps = () => {
|
|
55274
|
+
let storage = null;
|
|
55275
|
+
try {
|
|
55276
|
+
storage = sessionStorage;
|
|
55277
|
+
} catch {
|
|
55278
|
+
}
|
|
55279
|
+
return { storage, channel: typeof BroadcastChannel === "function" ? new BroadcastChannel("visualproof:call-tab") : null, random: (b2) => crypto.getRandomValues(b2), askMs: ASK_MS2 };
|
|
55280
|
+
};
|
|
55281
|
+
function callTab(deps = browserDeps()) {
|
|
55282
|
+
const keep2 = (tab2) => {
|
|
55283
|
+
try {
|
|
55284
|
+
deps.storage?.setItem(TAB_KEY, tab2);
|
|
55285
|
+
} catch {
|
|
55286
|
+
}
|
|
55287
|
+
return tab2;
|
|
55288
|
+
};
|
|
55289
|
+
let kept = null;
|
|
55290
|
+
try {
|
|
55291
|
+
kept = deps.storage?.getItem(TAB_KEY) ?? null;
|
|
55292
|
+
} catch {
|
|
55293
|
+
kept = null;
|
|
55294
|
+
}
|
|
55295
|
+
let tab = kept !== null && CALL_TAB.test(kept) ? kept : keep2(newTab(deps.random));
|
|
55296
|
+
const me = newTab(deps.random);
|
|
55297
|
+
const waiting = /* @__PURE__ */ new Set();
|
|
55298
|
+
const channel = deps.channel;
|
|
55299
|
+
if (channel)
|
|
55300
|
+
channel.onmessage = (e2) => {
|
|
55301
|
+
const m3 = e2.data;
|
|
55302
|
+
if (!m3 || typeof m3 !== "object") return;
|
|
55303
|
+
if ("ask" in m3 && m3.ask === tab && typeof m3.from === "string" && m3.from !== me) channel.postMessage({ taken: tab, to: m3.from });
|
|
55304
|
+
else if ("taken" in m3 && m3.to === me && typeof m3.taken === "string") for (const f2 of waiting) f2(m3.taken);
|
|
55305
|
+
};
|
|
55306
|
+
const renew = () => tab = keep2(newTab(deps.random));
|
|
55307
|
+
const ask = async () => {
|
|
55308
|
+
if (!channel) return false;
|
|
55309
|
+
const asked = tab;
|
|
55310
|
+
const taken = await new Promise((resolve) => {
|
|
55311
|
+
const on = (t2) => {
|
|
55312
|
+
if (t2 !== asked) return;
|
|
55313
|
+
waiting.delete(on);
|
|
55314
|
+
clearTimeout(timer);
|
|
55315
|
+
resolve(true);
|
|
55316
|
+
};
|
|
55317
|
+
const timer = setTimeout(() => {
|
|
55318
|
+
waiting.delete(on);
|
|
55319
|
+
resolve(false);
|
|
55320
|
+
}, deps.askMs);
|
|
55321
|
+
waiting.add(on);
|
|
55322
|
+
channel.postMessage({ ask: asked, from: me });
|
|
55323
|
+
});
|
|
55324
|
+
if (taken && tab === asked) renew();
|
|
55325
|
+
return taken;
|
|
55326
|
+
};
|
|
55327
|
+
const copy2 = ask();
|
|
55328
|
+
return {
|
|
55329
|
+
async get() {
|
|
55330
|
+
await copy2;
|
|
55331
|
+
await ask();
|
|
55332
|
+
return tab;
|
|
55333
|
+
},
|
|
55334
|
+
copy: copy2,
|
|
55335
|
+
renew,
|
|
55336
|
+
close() {
|
|
55337
|
+
if (channel) {
|
|
55338
|
+
channel.onmessage = null;
|
|
55339
|
+
channel.close();
|
|
55340
|
+
}
|
|
55341
|
+
}
|
|
55342
|
+
};
|
|
55343
|
+
}
|
|
55344
|
+
|
|
55345
|
+
// src/web/src/call/icons.ts
|
|
55346
|
+
var svg = (body, size = 16) => `<svg viewBox="0 0 16 16" width="${size}" height="${size}" aria-hidden="true" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round">${body}</svg>`;
|
|
55347
|
+
var PATHS = {
|
|
55348
|
+
call: `<rect x="1.8" y="4.2" width="8.6" height="7.6" rx="1.6"/><path d="M10.4 7.1 14.2 5v6l-3.8-2.1"/>`,
|
|
55349
|
+
camOff: `<rect x="1.8" y="4.2" width="8.6" height="7.6" rx="1.6"/><path d="M10.4 7.1 14.2 5v6l-3.8-2.1M2 2l12 12"/>`,
|
|
55350
|
+
mic: `<rect x="6" y="1.8" width="4" height="7.6" rx="2"/><path d="M3.6 7.6a4.4 4.4 0 0 0 8.8 0M8 12v2.2"/>`,
|
|
55351
|
+
micOff: `<rect x="6" y="1.8" width="4" height="7.6" rx="2"/><path d="M3.6 7.6a4.4 4.4 0 0 0 8.8 0M8 12v2.2M2.2 2.2l11.6 11.6"/>`,
|
|
55352
|
+
screen: `<rect x="1.6" y="2.6" width="12.8" height="8.6" rx="1.4"/><path d="M5.5 14h5M8 11.2V14M8 9V5M6.2 6.6 8 4.8l1.8 1.8"/>`,
|
|
55353
|
+
hand: `<path d="M5.2 8.2V3.6a1 1 0 0 1 2 0v3.8M7.2 7V2.6a1 1 0 0 1 2 0V7M9.2 7.2V3.6a1 1 0 0 1 2 0v5.2M11.2 6.4a1 1 0 0 1 2 0v2.4c0 3-2 5.2-4.8 5.2-1.7 0-2.8-.8-3.8-2.3L3 9.4a1 1 0 0 1 1.6-1.1l.6.8"/>`,
|
|
55354
|
+
smile: `<circle cx="8" cy="8" r="6.2"/><path d="M5.4 9.4c.6 1 1.5 1.5 2.6 1.5s2-.5 2.6-1.5M6 6.3h.01M10 6.3h.01"/>`,
|
|
55355
|
+
people: `<circle cx="6" cy="5.4" r="2.3"/><path d="M1.8 13.4c.5-2.5 2.1-3.7 4.2-3.7s3.7 1.2 4.2 3.7M10.6 3.4a2.2 2.2 0 0 1 0 4.2M11.8 9.8c1.3.4 2.1 1.6 2.4 3.4"/>`,
|
|
55356
|
+
layout: `<rect x="1.8" y="2.6" width="12.4" height="10.8" rx="1.4"/><path d="M9.6 2.6v10.8M9.6 8h4.6"/>`,
|
|
55357
|
+
leave: `<path d="M2.2 9.6c3.4-3 8.2-3 11.6 0l-1.3 1.9-2.4-.9V8.9a7.6 7.6 0 0 0-4.2 0v1.7l-2.4.9z"/>`,
|
|
55358
|
+
up: `<path d="M4.5 9.8 8 6.3l3.5 3.5"/>`,
|
|
55359
|
+
more: `<circle cx="3.5" cy="8" r=".8"/><circle cx="8" cy="8" r=".8"/><circle cx="12.5" cy="8" r=".8"/>`,
|
|
55360
|
+
pin: `<path d="M9.8 2.2 13.8 6.2l-2 .6-2.6 2.6.2 2.8-1 1-2.4-2.4-3.2 3.2M5.2 9.2 2.8 6.8l1-1 2.8.2L9.2 3.4z"/>`,
|
|
55361
|
+
follow: `<path d="M1.6 8s2.4-4.4 6.4-4.4S14.4 8 14.4 8 12 12.4 8 12.4 1.6 8 1.6 8z"/><circle cx="8" cy="8" r="1.9"/>`,
|
|
55362
|
+
link: `<path d="M6.5 9.5l3-3M7 4.5l1.2-1.2a2.6 2.6 0 0 1 3.7 3.7L10.7 8.2M9 11.5l-1.2 1.2a2.6 2.6 0 0 1-3.7-3.7L5.3 7.8"/>`,
|
|
55363
|
+
max: `<path d="M3 6V3h3M13 6V3h-3M3 10v3h3M13 10v3h-3"/>`,
|
|
55364
|
+
restore: `<path d="M6 3v3H3M10 3v3h3M6 13v-3H3M10 13v-3h3"/>`,
|
|
55365
|
+
weak: `<path d="M3 12.5v-1M6.3 12.5v-3M9.7 12.5V7.6M13 12.5V5" opacity=".9"/>`
|
|
55366
|
+
};
|
|
55367
|
+
var callIcon = (name, size = 16) => svg(PATHS[name], size);
|
|
55368
|
+
|
|
55369
|
+
// src/web/src/call/model.ts
|
|
55370
|
+
var ASPECT = 16 / 9;
|
|
55371
|
+
var pad = (n3) => String(n3).padStart(2, "0");
|
|
55372
|
+
function clockText(ms) {
|
|
55373
|
+
const s2 = Math.max(0, Math.floor(ms / 1e3));
|
|
55374
|
+
const h2 = Math.floor(s2 / 3600);
|
|
55375
|
+
const m3 = Math.floor(s2 % 3600 / 60);
|
|
55376
|
+
return h2 ? `${h2}:${pad(m3)}:${pad(s2 % 60)}` : `${m3}:${pad(s2 % 60)}`;
|
|
55377
|
+
}
|
|
55378
|
+
function namesLine(names2) {
|
|
55379
|
+
if (!names2.length) return "";
|
|
55380
|
+
if (names2.length === 1) return names2[0];
|
|
55381
|
+
if (names2.length === 2) return `${names2[0]} and ${names2[1]}`;
|
|
55382
|
+
if (names2.length === 3) return `${names2[0]}, ${names2[1]} and ${names2[2]}`;
|
|
55383
|
+
return `${names2[0]}, ${names2[1]} and ${names2.length - 2} others`;
|
|
55384
|
+
}
|
|
55385
|
+
|
|
55386
|
+
// src/web/src/pagecall.ts
|
|
55387
|
+
var MIN4 = { w: 300, h: 200 };
|
|
55388
|
+
var DEFAULT2 = { w: 720, h: 480 };
|
|
55389
|
+
var FOOT2 = 56;
|
|
55390
|
+
var REJOIN_MS = 5 * 6e4;
|
|
55391
|
+
var REJOIN_KEY = "visualproof:call:rejoin";
|
|
55392
|
+
function defaultRect2(vp) {
|
|
55393
|
+
const w2 = Math.min(DEFAULT2.w, vp.w - 2 * EDGE);
|
|
55394
|
+
const h2 = Math.min(DEFAULT2.h, vp.h - FOOT2 - EDGE);
|
|
55395
|
+
return clampRect({ x: vp.w - EDGE - w2, y: vp.h - FOOT2 - h2, w: w2, h: h2 }, vp, MIN4);
|
|
55396
|
+
}
|
|
55397
|
+
function callPart(page) {
|
|
55398
|
+
const { data, store: store2, reader, site } = page;
|
|
55399
|
+
const el = $("#call");
|
|
55400
|
+
const body = el.querySelector(".cl-body");
|
|
55401
|
+
const btn = $("#call-btn");
|
|
55402
|
+
const badge = $("#call-badge");
|
|
55403
|
+
const notice = $("#call-notice");
|
|
55404
|
+
const tab = data.snapshot ? null : callTab();
|
|
55405
|
+
let asked = new URLSearchParams(location.search).has("call");
|
|
55406
|
+
if (asked) {
|
|
55407
|
+
try {
|
|
55408
|
+
history.replaceState(history.state, "", location.pathname + location.hash);
|
|
55409
|
+
} catch {
|
|
55410
|
+
}
|
|
55411
|
+
}
|
|
55412
|
+
let rejoin = null;
|
|
55413
|
+
try {
|
|
55414
|
+
const r2 = JSON.parse(sessionStorage.getItem(REJOIN_KEY) ?? "null");
|
|
55415
|
+
if (r2 && typeof r2.session === "string" && Date.now() - r2.at < REJOIN_MS) rejoin = { session: r2.session, at: r2.at, mic: !!r2.mic, cam: !!r2.cam };
|
|
55416
|
+
} catch {
|
|
55417
|
+
rejoin = null;
|
|
55418
|
+
}
|
|
55419
|
+
const forgetRejoin = () => {
|
|
55420
|
+
rejoin = null;
|
|
55421
|
+
try {
|
|
55422
|
+
sessionStorage.removeItem(REJOIN_KEY);
|
|
55423
|
+
} catch {
|
|
55424
|
+
}
|
|
55425
|
+
};
|
|
55426
|
+
let state = null;
|
|
55427
|
+
let readOnlyCall = false;
|
|
55428
|
+
if (reader === "link" && !data.snapshot)
|
|
55429
|
+
void data.identity().then((id) => {
|
|
55430
|
+
readOnlyCall = !!id.readOnly?.call;
|
|
55431
|
+
drawButton();
|
|
55432
|
+
if (asked && state && may()) {
|
|
55433
|
+
asked = false;
|
|
55434
|
+
void open();
|
|
55435
|
+
}
|
|
55436
|
+
});
|
|
55437
|
+
let shown2 = false;
|
|
55438
|
+
let view = null;
|
|
55439
|
+
let loading = null;
|
|
55440
|
+
let roName = null;
|
|
55441
|
+
let droppedAt = -Infinity;
|
|
55442
|
+
let namedAt = -Infinity;
|
|
55443
|
+
const may = () => !data.snapshot && (reader === null || reader === "link" && readOnlyCall);
|
|
55444
|
+
const inCall = () => !!view?.inCall;
|
|
55445
|
+
const win2 = new FloatWindow(el, {
|
|
55446
|
+
min: MIN4,
|
|
55447
|
+
handle: ".cl-head",
|
|
55448
|
+
collapser: "[data-collapse]",
|
|
55449
|
+
opener: ".fl-pill-open",
|
|
55450
|
+
maximizer: "[data-cl-max]",
|
|
55451
|
+
keeper: {
|
|
55452
|
+
read: () => store2.data.call,
|
|
55453
|
+
write: (change) => {
|
|
55454
|
+
store2.data.call = { ...readKept(store2.data.call), ...change };
|
|
55455
|
+
store2.save();
|
|
55456
|
+
}
|
|
55457
|
+
},
|
|
55458
|
+
start: (vp) => defaultRect2(vp),
|
|
55459
|
+
live: () => shown2,
|
|
55460
|
+
// maximized, it keeps under the bars, which stay the reader's
|
|
55461
|
+
top: () => $("#viewbar").getBoundingClientRect().bottom + 8,
|
|
55462
|
+
collapsed: () => {
|
|
55463
|
+
view?.shownChanged();
|
|
55464
|
+
drawHead();
|
|
55465
|
+
},
|
|
55466
|
+
maximized: (on) => {
|
|
55467
|
+
const b2 = el.querySelector("[data-cl-max]");
|
|
55468
|
+
b2.innerHTML = callIcon(on ? "restore" : "max", 14);
|
|
55469
|
+
b2.title = on ? "Restore the window" : "Maximize the window";
|
|
55470
|
+
b2.setAttribute("aria-label", b2.title);
|
|
55471
|
+
}
|
|
55472
|
+
});
|
|
55473
|
+
const load = () => {
|
|
55474
|
+
const url = "/call.js";
|
|
55475
|
+
loading ??= import(url).then((m3) => m3.startCall);
|
|
55476
|
+
loading.catch(() => loading = null);
|
|
55477
|
+
return loading;
|
|
55478
|
+
};
|
|
55479
|
+
const open = async (o2 = {}) => {
|
|
55480
|
+
if (!may()) return;
|
|
55481
|
+
if (!shown2) {
|
|
55482
|
+
shown2 = true;
|
|
55483
|
+
el.hidden = false;
|
|
55484
|
+
win2.setCollapsed(false);
|
|
55485
|
+
btn.setAttribute("aria-pressed", "true");
|
|
55486
|
+
}
|
|
55487
|
+
win2.layout();
|
|
55488
|
+
win2.front();
|
|
55489
|
+
if (win2.collapsed) win2.collapse(false);
|
|
55490
|
+
notice.hidden = true;
|
|
55491
|
+
if (view) {
|
|
55492
|
+
if (!view.inCall) view.start(o2);
|
|
55493
|
+
return;
|
|
55494
|
+
}
|
|
55495
|
+
body.innerHTML = `<div class="cl-wait muted">Loading the call\u2026</div>`;
|
|
55496
|
+
let start;
|
|
55497
|
+
try {
|
|
55498
|
+
start = await load();
|
|
55499
|
+
} catch {
|
|
55500
|
+
body.innerHTML = `<div class="cl-wait">The call could not be loaded. <button type="button" class="rv-btn" data-cl-retry>Try again</button></div>`;
|
|
55501
|
+
return;
|
|
55502
|
+
}
|
|
55503
|
+
if (!shown2) return;
|
|
55504
|
+
view ??= start(env);
|
|
55505
|
+
view.start(o2);
|
|
55506
|
+
};
|
|
55507
|
+
const close = () => {
|
|
55508
|
+
if (!shown2) return;
|
|
55509
|
+
if (el.contains(document.activeElement)) document.activeElement.blur();
|
|
55510
|
+
shown2 = false;
|
|
55511
|
+
el.hidden = true;
|
|
55512
|
+
win2.reset();
|
|
55513
|
+
btn.setAttribute("aria-pressed", "false");
|
|
55514
|
+
view?.dispose();
|
|
55515
|
+
view = null;
|
|
55516
|
+
body.innerHTML = "";
|
|
55517
|
+
drawButton();
|
|
55518
|
+
};
|
|
55519
|
+
let closeArmed = 0;
|
|
55520
|
+
el.addEventListener("click", (e2) => {
|
|
55521
|
+
const t2 = e2.target;
|
|
55522
|
+
if (t2.closest("[data-cl-retry]")) return void open();
|
|
55523
|
+
if (t2.closest("[data-cl-link]")) return void copyLink2();
|
|
55524
|
+
if (t2.closest("[data-cl-mic]")) return view?.toggleMic();
|
|
55525
|
+
const x2 = t2.closest("[data-cl-close]");
|
|
55526
|
+
if (!x2) return;
|
|
55527
|
+
if (!inCall()) return close();
|
|
55528
|
+
if (Date.now() - closeArmed > 4e3) {
|
|
55529
|
+
closeArmed = Date.now();
|
|
55530
|
+
for (const b2 of el.querySelectorAll("[data-cl-close]")) {
|
|
55531
|
+
b2.classList.add("armed");
|
|
55532
|
+
b2.title = "Press again to leave the call";
|
|
55533
|
+
}
|
|
55534
|
+
setTimeout(() => el.querySelectorAll("[data-cl-close]").forEach((b2) => (b2.classList.remove("armed"), b2.title = "Leave the call and close")), 4e3);
|
|
55535
|
+
return;
|
|
55536
|
+
}
|
|
55537
|
+
closeArmed = 0;
|
|
55538
|
+
void view?.leave();
|
|
55539
|
+
});
|
|
55540
|
+
const drawHead = () => {
|
|
55541
|
+
const n3 = state?.participants.length ?? 0;
|
|
55542
|
+
const since = state?.session ? Date.parse(state.session.started) : NaN;
|
|
55543
|
+
const clock = Number.isFinite(since) && n3 ? clockText(Date.now() - since) : "";
|
|
55544
|
+
el.querySelector(".cl-count").textContent = n3 ? `\xB7 ${n3}` : "";
|
|
55545
|
+
el.querySelector(".cl-clock").textContent = clock;
|
|
55546
|
+
const pill = el.querySelector(".fl-pill-text");
|
|
55547
|
+
const text2 = `${callIcon("call", 14)}<span>Call${n3 ? ` \xB7 ${n3}` : ""}</span>${clock ? `<span class="fl-pill-state">${clock}</span>` : ""}`;
|
|
55548
|
+
if (pill.innerHTML !== text2) pill.innerHTML = text2;
|
|
55549
|
+
const mic = el.querySelector("[data-cl-mic]");
|
|
55550
|
+
mic.hidden = !inCall();
|
|
55551
|
+
const on = !!view?.mic;
|
|
55552
|
+
const m3 = callIcon(on ? "mic" : "micOff", 14);
|
|
55553
|
+
if (mic.innerHTML !== m3) mic.innerHTML = m3;
|
|
55554
|
+
mic.classList.toggle("off", !on);
|
|
55555
|
+
mic.title = on ? "Turn the microphone off" : "Turn the microphone on";
|
|
55556
|
+
};
|
|
55557
|
+
setInterval(() => {
|
|
55558
|
+
if (shown2 && state?.session) drawHead();
|
|
55559
|
+
}, 1e3);
|
|
55560
|
+
const drawButton = () => {
|
|
55561
|
+
btn.hidden = !may() || state === null;
|
|
55562
|
+
const ps = state?.participants ?? [];
|
|
55563
|
+
badge.hidden = ps.length === 0;
|
|
55564
|
+
badge.textContent = ps.length > 99 ? "99+" : String(ps.length);
|
|
55565
|
+
btn.classList.toggle("live", ps.length > 0);
|
|
55566
|
+
btn.classList.toggle("rejoin", !!rejoin && !inCall());
|
|
55567
|
+
const names2 = ps.map((p2) => p2.name ?? "someone");
|
|
55568
|
+
btn.title = inCall() ? `The call: you and ${Math.max(0, ps.length - 1)} more \u2014 click to show it` : ps.length ? `The call: ${namesLine(names2)} ${ps.length === 1 ? "is" : "are"} in it \u2014 click to join` : "The call: a video call with the people here \u2014 click to start one";
|
|
55569
|
+
btn.setAttribute("aria-label", ps.length ? `Call, ${ps.length} in it` : "Call");
|
|
55570
|
+
};
|
|
55571
|
+
let noticeTimer = null;
|
|
55572
|
+
const say = (html, acts2 = [], ms = 1e4) => {
|
|
55573
|
+
notice.innerHTML = `<div class="cn-text">${html}</div>` + (acts2.length ? `<div class="cn-acts">${acts2.map((a3, i2) => `<button type="button" class="rv-btn${a3.primary ? " primary" : ""}" data-cn="${i2}">${escapeHtml(a3.label)}</button>`).join("")}<button type="button" class="cn-x" data-cn="x" aria-label="Dismiss" title="Dismiss">\u2715</button></div>` : "");
|
|
55574
|
+
notice.hidden = false;
|
|
55575
|
+
noticeActs = acts2;
|
|
55576
|
+
if (noticeTimer) clearTimeout(noticeTimer);
|
|
55577
|
+
noticeTimer = ms ? setTimeout(() => notice.hidden = true, ms) : null;
|
|
55578
|
+
};
|
|
55579
|
+
let noticeActs = [];
|
|
55580
|
+
notice.addEventListener("click", (e2) => {
|
|
55581
|
+
const b2 = e2.target.closest("[data-cn]");
|
|
55582
|
+
if (!b2) return;
|
|
55583
|
+
notice.hidden = true;
|
|
55584
|
+
if (b2.dataset.cn === "x") {
|
|
55585
|
+
if (rejoin) forgetRejoin(), drawButton();
|
|
55586
|
+
return;
|
|
55587
|
+
}
|
|
55588
|
+
noticeActs[Number(b2.dataset.cn)]?.run();
|
|
55589
|
+
});
|
|
55590
|
+
btn.addEventListener("click", () => {
|
|
55591
|
+
if (!shown2) return void open(rejoin && state?.session?.id === rejoin.session ? { rejoin: takeRejoin() } : {});
|
|
55592
|
+
if (win2.collapsed || win2.covered) {
|
|
55593
|
+
if (win2.collapsed) win2.collapse(false);
|
|
55594
|
+
win2.front();
|
|
55595
|
+
return;
|
|
55596
|
+
}
|
|
55597
|
+
if (inCall()) win2.collapse(true);
|
|
55598
|
+
else close();
|
|
55599
|
+
});
|
|
55600
|
+
const takeRejoin = () => {
|
|
55601
|
+
const r2 = rejoin;
|
|
55602
|
+
forgetRejoin();
|
|
55603
|
+
return { mic: r2.mic, cam: r2.cam };
|
|
55604
|
+
};
|
|
55605
|
+
const chime = () => {
|
|
55606
|
+
try {
|
|
55607
|
+
const ctx = new AudioContext();
|
|
55608
|
+
const at = ctx.currentTime;
|
|
55609
|
+
for (const [f2, t2] of [[660, 0], [880, 0.16]]) {
|
|
55610
|
+
const o2 = ctx.createOscillator();
|
|
55611
|
+
const g2 = ctx.createGain();
|
|
55612
|
+
o2.frequency.value = f2;
|
|
55613
|
+
g2.gain.setValueAtTime(1e-4, at + t2);
|
|
55614
|
+
g2.gain.exponentialRampToValueAtTime(0.12, at + t2 + 0.02);
|
|
55615
|
+
g2.gain.exponentialRampToValueAtTime(1e-4, at + t2 + 0.22);
|
|
55616
|
+
o2.connect(g2).connect(ctx.destination);
|
|
55617
|
+
o2.start(at + t2);
|
|
55618
|
+
o2.stop(at + t2 + 0.25);
|
|
55619
|
+
}
|
|
55620
|
+
setTimeout(() => void ctx.close().catch(() => void 0), 800);
|
|
55621
|
+
} catch {
|
|
55622
|
+
}
|
|
55623
|
+
};
|
|
55624
|
+
const post = async (path, extra = {}) => {
|
|
55625
|
+
const stream = page.people.stream?.token;
|
|
55626
|
+
if (!stream) return { status: 0, body: { error: "This page is not connected to the server: wait a moment." } };
|
|
55627
|
+
const r2 = await data.callPost(path, { token: stream, ...extra });
|
|
55628
|
+
return r2;
|
|
55629
|
+
};
|
|
55630
|
+
const refusal = async (path, extra = {}) => {
|
|
55631
|
+
const r2 = await post(path, extra);
|
|
55632
|
+
return r2.status === 200 ? null : String(r2.body.error ?? "It could not be done.");
|
|
55633
|
+
};
|
|
55634
|
+
const link = async () => {
|
|
55635
|
+
const info2 = await data.shareInfo().catch(() => ({ path: null }));
|
|
55636
|
+
return `${site.base}${info2.path ?? "/"}?call${location.hash}`;
|
|
55637
|
+
};
|
|
55638
|
+
const copyLink2 = async () => {
|
|
55639
|
+
const l2 = await link();
|
|
55640
|
+
const keyed = /\/[kr]\//.test(new URL(l2).pathname);
|
|
55641
|
+
const ok = await copy(l2);
|
|
55642
|
+
page.say(ok ? `Call link copied: whoever opens it ${keyed ? "comes in by it and " : ""}finds the call ready to join.` : `Copy the call link: ${l2}`);
|
|
55643
|
+
};
|
|
55644
|
+
const env = {
|
|
55645
|
+
el: body,
|
|
55646
|
+
state: () => state,
|
|
55647
|
+
me: () => ({ name: page.people.name, readOnly: reader !== null, private: data.privateSession !== null, page: page.people.stream?.id ?? null }),
|
|
55648
|
+
here: () => page.people.peers.filter((p2) => !p2.agent && p2.name && p2.id !== page.people.stream?.id).map((p2) => ({ page: p2.id, name: p2.name, verified: !!p2.verified })),
|
|
55649
|
+
token: async (name) => {
|
|
55650
|
+
if (name !== null) roName = name;
|
|
55651
|
+
const r2 = await post("/api/call/token", { tab: await tab.get(), ...name !== null ? { name } : {} });
|
|
55652
|
+
if (r2.status === 200) return r2.body;
|
|
55653
|
+
return { error: String(r2.body.error ?? "The call could not be joined."), ...r2.body.who ? { who: true } : {}, ...r2.body.private ? { private: true } : {} };
|
|
55654
|
+
},
|
|
55655
|
+
end: () => refusal("/api/call/end"),
|
|
55656
|
+
remove: (identity) => refusal("/api/call/remove", { identity }),
|
|
55657
|
+
invite: (to) => refusal("/api/call/invite", { to }),
|
|
55658
|
+
left: () => {
|
|
55659
|
+
const stream = page.people.stream?.token;
|
|
55660
|
+
if (stream) void data.callPost("/api/call/leave", { token: stream });
|
|
55661
|
+
forgetRejoin();
|
|
55662
|
+
},
|
|
55663
|
+
ensureName: () => page.people.ensure(),
|
|
55664
|
+
goVisible: async () => {
|
|
55665
|
+
page.people.setPrivate(false);
|
|
55666
|
+
await new Promise((r2) => setTimeout(r2, 300));
|
|
55667
|
+
},
|
|
55668
|
+
follow: (id) => {
|
|
55669
|
+
const p2 = page.people.peers.find((x2) => x2.id === id);
|
|
55670
|
+
if (p2) page.people.follow(personKey(p2));
|
|
55671
|
+
},
|
|
55672
|
+
askToFollow: async (to) => {
|
|
55673
|
+
const stream = page.people.stream?.token;
|
|
55674
|
+
if (!stream) return "This page is not connected to the server: wait a moment.";
|
|
55675
|
+
const r2 = await data.askFollow(stream, to);
|
|
55676
|
+
return "error" in r2 ? r2.error : null;
|
|
55677
|
+
},
|
|
55678
|
+
copyLink: () => void copyLink2(),
|
|
55679
|
+
say: (t2) => page.say(t2),
|
|
55680
|
+
changed: () => {
|
|
55681
|
+
drawButton();
|
|
55682
|
+
drawHead();
|
|
55683
|
+
},
|
|
55684
|
+
seen: () => shown2 && !win2.collapsed && !document.hidden,
|
|
55685
|
+
dropped: (why) => {
|
|
55686
|
+
if (why === "elsewhere") {
|
|
55687
|
+
tab?.renew();
|
|
55688
|
+
close();
|
|
55689
|
+
say("Your call went on in another tab of this browser, a copy of this one.", [{ label: "Join here too", primary: true, run: () => void open() }], 0);
|
|
55690
|
+
} else if (why === "removed" || why === "ended") {
|
|
55691
|
+
droppedAt = Date.now();
|
|
55692
|
+
close();
|
|
55693
|
+
if (Date.now() - namedAt > 1e4) say(why === "ended" ? "The call was ended." : "You were removed from the call.", [], 8e3);
|
|
55694
|
+
}
|
|
55695
|
+
drawButton();
|
|
55696
|
+
},
|
|
55697
|
+
close: () => close()
|
|
55698
|
+
};
|
|
55699
|
+
window.addEventListener("beforeunload", (e2) => {
|
|
55700
|
+
if (!inCall()) return;
|
|
55701
|
+
e2.preventDefault();
|
|
55702
|
+
e2.returnValue = "";
|
|
55703
|
+
});
|
|
55704
|
+
window.addEventListener("pagehide", () => {
|
|
55705
|
+
if (!inCall() || !view) return;
|
|
55706
|
+
try {
|
|
55707
|
+
if (state?.session) sessionStorage.setItem(REJOIN_KEY, JSON.stringify({ session: state.session.id, at: Date.now(), mic: view.mic, cam: view.cam }));
|
|
55708
|
+
} catch {
|
|
55709
|
+
}
|
|
55710
|
+
const stream = page.people.stream?.token;
|
|
55711
|
+
if (stream) navigator.sendBeacon?.("/api/call/leave", JSON.stringify({ token: stream }));
|
|
55712
|
+
view.pageGone();
|
|
55713
|
+
});
|
|
55714
|
+
document.addEventListener("visibilitychange", () => view?.shownChanged());
|
|
55715
|
+
setInterval(() => {
|
|
55716
|
+
if (inCall() && data.privateSession !== null) {
|
|
55717
|
+
void view?.leave();
|
|
55718
|
+
page.say("You went private: you left the call, where everyone is seen.");
|
|
55719
|
+
}
|
|
55720
|
+
}, 1e3);
|
|
55721
|
+
const calls = {
|
|
55722
|
+
get on() {
|
|
55723
|
+
return state !== null && may();
|
|
55724
|
+
},
|
|
55725
|
+
get inCall() {
|
|
55726
|
+
return inCall();
|
|
55727
|
+
},
|
|
55728
|
+
heard(s2) {
|
|
55729
|
+
const was = state;
|
|
55730
|
+
state = s2;
|
|
55731
|
+
drawButton();
|
|
55732
|
+
drawHead();
|
|
55733
|
+
view?.stateChanged();
|
|
55734
|
+
if (!may()) return;
|
|
55735
|
+
if (asked) {
|
|
55736
|
+
asked = false;
|
|
55737
|
+
void open();
|
|
55738
|
+
return;
|
|
55739
|
+
}
|
|
55740
|
+
if (rejoin && !inCall()) {
|
|
55741
|
+
if (s2.session?.id === rejoin.session) {
|
|
55742
|
+
say("You were in the call when this page reloaded.", [{ label: "Rejoin", primary: true, run: () => void open({ rejoin: takeRejoin() }) }, { label: "Not now", run: () => (forgetRejoin(), drawButton()) }], 0);
|
|
55743
|
+
} else if (s2.session === null || s2.session.id !== rejoin.session) {
|
|
55744
|
+
forgetRejoin();
|
|
55745
|
+
drawButton();
|
|
55746
|
+
}
|
|
55747
|
+
return;
|
|
55748
|
+
}
|
|
55749
|
+
const mine = page.people.stream?.id;
|
|
55750
|
+
if (was && !was.session && s2.session && !inCall() && !shown2 && s2.participants.length && !s2.participants.some((p2) => p2.page === mine)) {
|
|
55751
|
+
const who = s2.participants[0].name ?? "Someone";
|
|
55752
|
+
say(`<b>${escapeHtml(who)}</b> started a call.`, [{ label: "Join", primary: true, run: () => void open() }], 12e3);
|
|
55753
|
+
}
|
|
55754
|
+
},
|
|
55755
|
+
invited(i2) {
|
|
55756
|
+
if (!may() || inCall()) return;
|
|
55757
|
+
chime();
|
|
55758
|
+
say(`<b>${escapeHtml(i2.from)}</b> invites you to the call.`, [{ label: "Join", primary: true, run: () => void open() }], 6e4);
|
|
55759
|
+
},
|
|
55760
|
+
removed(b2) {
|
|
55761
|
+
namedAt = Date.now();
|
|
55762
|
+
close();
|
|
55763
|
+
say(`${b2.by ? `<b>${escapeHtml(b2.by)}</b>` : "Someone"} removed you from the call.`, [], 8e3);
|
|
55764
|
+
},
|
|
55765
|
+
ended(b2) {
|
|
55766
|
+
if (!shown2 && !inCall() && Date.now() - droppedAt > 1e4) return;
|
|
55767
|
+
namedAt = Date.now();
|
|
55768
|
+
close();
|
|
55769
|
+
say(`${b2.by ? `<b>${escapeHtml(b2.by)}</b>` : "Someone"} ended the call.`, [], 8e3);
|
|
55770
|
+
},
|
|
55771
|
+
connected() {
|
|
55772
|
+
if (inCall()) void env.token(reader !== null ? roName : null);
|
|
55773
|
+
},
|
|
55774
|
+
link
|
|
55775
|
+
};
|
|
55776
|
+
if (data.snapshot) btn.hidden = true;
|
|
55777
|
+
return { calls };
|
|
55778
|
+
}
|
|
55779
|
+
|
|
55038
55780
|
// src/shared/pointer.ts
|
|
55039
55781
|
var LEAD_MS = 60;
|
|
55040
55782
|
var FOLLOW_MS = 100;
|
|
@@ -56411,6 +57153,8 @@ function sharePart(page) {
|
|
|
56411
57153
|
snapshot: () => writeSnapshot(followedOf(page.parts.read), page.canvas.screen),
|
|
56412
57154
|
// the reader's own conversation with the server's agent (AgentSpec decision 10)
|
|
56413
57155
|
talk: (agent) => page.talk.open(agent),
|
|
57156
|
+
// a call this reader may join (CallSpec decisions 4 and 6)
|
|
57157
|
+
call: () => page.calls.on,
|
|
56414
57158
|
exact: {
|
|
56415
57159
|
get: () => S7.shareExact !== false,
|
|
56416
57160
|
set: (on) => {
|
|
@@ -58031,6 +58775,7 @@ function livePart(page) {
|
|
|
58031
58775
|
if (page.exportModal.isOpen) return "the export window";
|
|
58032
58776
|
if (page.artLook) return "the artwork mode";
|
|
58033
58777
|
if (page.linear.shown) return "the linear form";
|
|
58778
|
+
if (page.calls.inCall) return "the call";
|
|
58034
58779
|
return null;
|
|
58035
58780
|
},
|
|
58036
58781
|
kept: () => ({
|
|
@@ -58086,6 +58831,7 @@ function livePart(page) {
|
|
|
58086
58831
|
const hello = JSON.parse(e2.data);
|
|
58087
58832
|
void page.people.connected(hello).then(() => !reader && page.talk.connected());
|
|
58088
58833
|
page.pointers.connected();
|
|
58834
|
+
page.calls.connected();
|
|
58089
58835
|
updatingTo = null;
|
|
58090
58836
|
reloader.hello(hello.server);
|
|
58091
58837
|
const release = hello.server?.version;
|
|
@@ -58121,6 +58867,10 @@ function livePart(page) {
|
|
|
58121
58867
|
es.addEventListener("ask", (e2) => page.asking.asked(JSON.parse(e2.data)));
|
|
58122
58868
|
es.addEventListener("ask-answer", (e2) => page.asking.answered(JSON.parse(e2.data)));
|
|
58123
58869
|
es.addEventListener("ask-end", (e2) => page.asking.ended(JSON.parse(e2.data).id));
|
|
58870
|
+
es.addEventListener("call", (e2) => page.calls.heard(JSON.parse(e2.data)));
|
|
58871
|
+
es.addEventListener("call-invite", (e2) => page.calls.invited(JSON.parse(e2.data)));
|
|
58872
|
+
es.addEventListener("call-removed", (e2) => page.calls.removed(JSON.parse(e2.data)));
|
|
58873
|
+
es.addEventListener("call-ended", (e2) => page.calls.ended(JSON.parse(e2.data)));
|
|
58124
58874
|
es.addEventListener("views", (e2) => {
|
|
58125
58875
|
const d2 = JSON.parse(e2.data);
|
|
58126
58876
|
if (d2.all && !reconnected) {
|
|
@@ -61522,12 +62272,12 @@ var Guide = class {
|
|
|
61522
62272
|
const s2 = this.steps[this.k];
|
|
61523
62273
|
if (!s2) return;
|
|
61524
62274
|
const r2 = (s2.views ? s2.views[this.v].at : s2.at)?.() ?? null;
|
|
61525
|
-
const
|
|
62275
|
+
const pad2 = 6;
|
|
61526
62276
|
const card = this.card;
|
|
61527
62277
|
const w2 = card.offsetWidth, h2 = card.offsetHeight;
|
|
61528
62278
|
this.spot.classList.toggle("none", !r2);
|
|
61529
62279
|
const W2 = innerWidth, H2 = innerHeight;
|
|
61530
|
-
const hole = r2 ? { l: r2.left -
|
|
62280
|
+
const hole = r2 ? { l: r2.left - pad2, t: r2.top - pad2, r: r2.right + pad2, b: r2.bottom + pad2 } : { l: W2 / 2, t: H2 / 2, r: W2 / 2, b: H2 / 2 };
|
|
61531
62281
|
const rect = (el, l2, t2, w22, h22) => Object.assign(el.style, { left: `${l2}px`, top: `${t2}px`, width: `${Math.max(0, w22)}px`, height: `${Math.max(0, h22)}px` });
|
|
61532
62282
|
rect(this.shades[0], 0, 0, W2, hole.t);
|
|
61533
62283
|
rect(this.shades[1], 0, hole.b, W2, H2 - hole.b);
|
|
@@ -61541,10 +62291,10 @@ var Guide = class {
|
|
|
61541
62291
|
const gap = 14;
|
|
61542
62292
|
const room2 = { below: innerHeight - r2.bottom, above: r2.top, right: innerWidth - r2.right, left: r2.left };
|
|
61543
62293
|
let x2, y2;
|
|
61544
|
-
if (room2.below >= h2 + gap +
|
|
61545
|
-
else if (room2.above >= h2 + gap +
|
|
61546
|
-
else if (room2.left >= w2 + gap +
|
|
61547
|
-
else if (room2.right >= w2 + gap +
|
|
62294
|
+
if (room2.below >= h2 + gap + pad2) [x2, y2] = [r2.left, r2.bottom + gap + pad2];
|
|
62295
|
+
else if (room2.above >= h2 + gap + pad2) [x2, y2] = [r2.left, r2.top - h2 - gap - pad2];
|
|
62296
|
+
else if (room2.left >= w2 + gap + pad2) [x2, y2] = [r2.left - w2 - gap - pad2, r2.top];
|
|
62297
|
+
else if (room2.right >= w2 + gap + pad2) [x2, y2] = [r2.right + gap + pad2, r2.top];
|
|
61548
62298
|
else [x2, y2] = [r2.left + 24, r2.bottom - h2 - 24];
|
|
61549
62299
|
x2 = Math.max(12, Math.min(x2, innerWidth - w2 - 12));
|
|
61550
62300
|
y2 = Math.max(12, Math.min(y2, innerHeight - h2 - 12));
|
|
@@ -62048,6 +62798,7 @@ async function boot() {
|
|
|
62048
62798
|
Object.assign(page, followPart(page));
|
|
62049
62799
|
Object.assign(page, talkPart(page));
|
|
62050
62800
|
Object.assign(page, peoplePart(page));
|
|
62801
|
+
Object.assign(page, callPart(page));
|
|
62051
62802
|
Object.assign(page, pointerPart(page));
|
|
62052
62803
|
Object.assign(page, tabsPart(page));
|
|
62053
62804
|
Object.assign(page, sharePart(page));
|