@panphora/clayjs 1.18.1 → 1.20.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 +1 -1
- package/dist/all.js +1 -1
- package/dist/clay-dom.js +1 -1
- package/dist/clay-events.js +1 -1
- package/dist/clay-internals.js +1 -1
- package/dist/clay-options.js +1 -1
- package/dist/clay-router.js +1 -1
- package/dist/clay-ui.js +1 -1
- package/dist/clay-utils.js +1 -1
- package/dist/clay.js +1 -1
- package/dist/clay.standalone.js +8773 -8444
- package/dist/m/attrs/{refetch-on-save-ZUE7PSCI.js → refetch-on-save-DPGJJMGN.js} +1 -1
- package/dist/m/attrs/save-freeze-MTFVVYV5.js +1 -0
- package/dist/m/{c-KP64LT2A.js → c-2VB555FG.js} +1 -1
- package/dist/m/{c-KGHVFRR3.js → c-3AXJDL2P.js} +1 -1
- package/dist/m/{c-372N6H3B.js → c-3GJ4XARY.js} +1 -1
- package/dist/m/c-3TWCKFOP.js +1 -0
- package/dist/m/{c-U7SHNWDH.js → c-3YH6JSIL.js} +1 -1
- package/dist/m/{c-AMU3BPPR.js → c-44B5ODN7.js} +2 -2
- package/dist/m/{c-S2U6NJU4.js → c-62HZW5DH.js} +1 -1
- package/dist/m/{c-ZK4GIZH2.js → c-67ILSNPR.js} +1 -1
- package/dist/m/c-67LGZ52V.js +20 -0
- package/dist/m/{c-W6DQSHXI.js → c-7SXYQCN4.js} +1 -1
- package/dist/m/{c-5OOVFCJM.js → c-AL4RBJF2.js} +1 -1
- package/dist/m/{c-L42OLXWM.js → c-ANNFZFLN.js} +1 -1
- package/dist/m/{c-QO4HNGCQ.js → c-B4VYNXTQ.js} +1 -1
- package/dist/m/{c-7PRJCA3E.js → c-BJPZCWAV.js} +1 -1
- package/dist/m/{c-SW4YEG2D.js → c-BTLFLLML.js} +1 -1
- package/dist/m/c-C4IIQZGJ.js +1 -0
- package/dist/m/{c-5T6NZHNM.js → c-CAWNFER6.js} +1 -1
- package/dist/m/c-CSNE5EIF.js +1 -0
- package/dist/m/{c-DVYGFTSK.js → c-DDDOKPI6.js} +2 -2
- package/dist/m/{c-6DB2OLRJ.js → c-DHXPDLW6.js} +1 -1
- package/dist/m/{c-WCXLG3MV.js → c-E4IBSAQM.js} +1 -1
- package/dist/m/{c-IVTRVENZ.js → c-EDSPKYMA.js} +1 -1
- package/dist/m/{c-UORXLSD3.js → c-EFD6QNTE.js} +1 -1
- package/dist/m/{c-7MG5RU63.js → c-EGTIAL6P.js} +1 -1
- package/dist/m/{c-SPZPGD3R.js → c-EOCKLMKX.js} +1 -1
- package/dist/m/{c-HMV6P4RX.js → c-EOCZ2YVL.js} +1 -1
- package/dist/m/{c-B5UJQT7W.js → c-EZ7B5AZT.js} +1 -1
- package/dist/m/{c-UPD33ZPE.js → c-FDAXZ2PM.js} +1 -1
- package/dist/m/{c-RND3G2S2.js → c-FNVQAACK.js} +1 -1
- package/dist/m/c-FSWRGBVQ.js +1 -0
- package/dist/m/c-FTWGYI5E.js +1 -0
- package/dist/m/{c-CCQ25GFY.js → c-GKEATME6.js} +1 -1
- package/dist/m/{c-YBKHUAK7.js → c-GPGYKER7.js} +1 -1
- package/dist/m/{c-FWKHM4E7.js → c-GSRLXYWL.js} +1 -1
- package/dist/m/{c-B7J4K2AE.js → c-GVPNDIKJ.js} +2 -2
- package/dist/m/{c-AMYEFA2E.js → c-I2IFKJX2.js} +1 -1
- package/dist/m/c-ICMAOOGK.js +1 -0
- package/dist/m/{c-BUAYFEV5.js → c-J3BXFTZS.js} +1 -1
- package/dist/m/{c-BIJALSRD.js → c-JDZDF2QM.js} +1 -1
- package/dist/m/{c-UDHIVLYH.js → c-JH5FF4NL.js} +1 -1
- package/dist/m/{c-OYRZ7XG2.js → c-JHJR5BQX.js} +1 -1
- package/dist/m/{c-V44KWI2L.js → c-JOH753EJ.js} +2 -2
- package/dist/m/{c-P3OFYUMA.js → c-JUE7B4OX.js} +1 -1
- package/dist/m/c-K76AUL4I.js +7 -0
- package/dist/m/{c-ZWIOJGMT.js → c-LA2BW7UY.js} +1 -1
- package/dist/m/{c-ICJYHABF.js → c-LDUNOR57.js} +1 -1
- package/dist/m/{c-C6IPRG34.js → c-LIBE4HPD.js} +1 -1
- package/dist/m/c-LPUJXRXW.js +1 -0
- package/dist/m/{c-TTB5EK4S.js → c-LQU7TXIH.js} +1 -1
- package/dist/m/{c-5ZQV7KC4.js → c-LV5MABYD.js} +1 -1
- package/dist/m/{c-URSMSFCB.js → c-M4FSPNQ2.js} +1 -1
- package/dist/m/{c-2KIEGNC4.js → c-MEWUGR4D.js} +1 -1
- package/dist/m/c-MIL4B2JQ.js +1 -0
- package/dist/m/{c-IVMD3FEM.js → c-N7Y52HJH.js} +1 -1
- package/dist/m/{c-PLN76GF3.js → c-NFR673TL.js} +2 -2
- package/dist/m/{c-T637T7SN.js → c-NLZ5AN4L.js} +1 -1
- package/dist/m/{c-OPLUZR3A.js → c-OABVRYOT.js} +1 -1
- package/dist/m/c-PIVIYLTY.js +1 -0
- package/dist/m/{c-L7JL5TL3.js → c-QY7F6EN6.js} +1 -1
- package/dist/m/{c-UY4QX42B.js → c-RG6XUZFA.js} +1 -1
- package/dist/m/c-RHMPKZZ7.js +1 -0
- package/dist/m/{c-TJAXGIRV.js → c-RQRMPZXD.js} +1 -1
- package/dist/m/{c-GY422N3Q.js → c-RS77ODLY.js} +1 -1
- package/dist/m/{c-IMZCWYHR.js → c-RT3C74GY.js} +1 -1
- package/dist/m/{c-CAS3NND4.js → c-S5IEIZCN.js} +1 -1
- package/dist/m/{c-K3ADYNLU.js → c-SBSMJIPC.js} +1 -1
- package/dist/m/c-SFKI6OLM.js +2 -0
- package/dist/m/{c-4TXNLX4K.js → c-SJPD46ZO.js} +4 -4
- package/dist/m/{c-HHGJBU4D.js → c-SO63UGPQ.js} +1 -1
- package/dist/m/{c-PLP4JKFC.js → c-TUGVINJR.js} +1 -1
- package/dist/m/{c-Q26MME6N.js → c-TWCXBWS3.js} +1 -1
- package/dist/m/{c-GNDL3TKB.js → c-U5X57T4L.js} +1 -1
- package/dist/m/{c-4YU3BR4D.js → c-UXEVJ63W.js} +1 -1
- package/dist/m/{c-KJJPV77R.js → c-V2J5C5MT.js} +1 -1
- package/dist/m/{c-6UGWFMQC.js → c-VBLFAQD2.js} +1 -1
- package/dist/m/{c-ERQSNR6K.js → c-VQCEOGKH.js} +2 -2
- package/dist/m/{c-YVZ2L7CE.js → c-VSPAFOKU.js} +1 -1
- package/dist/m/{c-5ONTYIUI.js → c-VY6XRBOW.js} +1 -1
- package/dist/m/{c-2KL3BD52.js → c-W23KVGUO.js} +1 -1
- package/dist/m/{c-COPTL5WB.js → c-W3K23S72.js} +1 -1
- package/dist/m/c-WFMRX5RZ.js +1 -0
- package/dist/m/{c-BWFVSBDF.js → c-WN3MXOLT.js} +1 -1
- package/dist/m/{c-X5TSXZYJ.js → c-XD5MOROJ.js} +1 -1
- package/dist/m/{c-MWXFLW4J.js → c-XQSXKIKM.js} +1 -1
- package/dist/m/{c-OTMKN2OO.js → c-Y33LUUIQ.js} +1 -1
- package/dist/m/{c-JNLX3RJB.js → c-YQUJ74R3.js} +1 -1
- package/dist/m/{c-2GRUM77Q.js → c-YSB6JKV2.js} +2 -2
- package/dist/m/{c-WQWIRWO3.js → c-Z32V4MHK.js} +1 -1
- package/dist/m/{c-BHZYSHW4.js → c-ZJLU56DV.js} +1 -1
- package/dist/m/{c-DKLS74XB.js → c-ZQXNHZZT.js} +2 -2
- package/dist/m/{c-TNEM3RNM.js → c-ZSCBEB7I.js} +1 -1
- package/dist/m/core/{admin-attrs-YY7T5FGU.js → admin-attrs-ZG7R5V3E.js} +1 -1
- package/dist/m/core/{autosave-S6OMNDCK.js → autosave-VPORYJSE.js} +1 -1
- package/dist/m/core/{conflict-notice-IWHMHH43.js → conflict-notice-JMAZLVRX.js} +1 -1
- package/dist/m/core/{persist-UKXV5KLA.js → persist-3OPWJKZS.js} +1 -1
- package/dist/m/core/{save-LYY7K6U7.js → save-AOJBDSOK.js} +1 -1
- package/dist/m/core/{save-core-MKRPSEEO.js → save-core-IOCMXO5L.js} +1 -1
- package/dist/m/core/{snapshot-NU3YM6GR.js → snapshot-O7II2AGG.js} +1 -1
- package/dist/m/core/unsaved-warning-U5VUJFOE.js +1 -0
- package/dist/m/events/{index-RN2JNGBV.js → index-B6TGDYMG.js} +1 -1
- package/dist/m/internals/{index-TGLQINN3.js → index-HDRANDWE.js} +1 -1
- package/dist/m/lib/{cache-bust-MUMFXZK6.js → cache-bust-NH7VBWHO.js} +1 -1
- package/dist/m/lib/{region-policy-SB2AWVG5.js → region-policy-KWBPROWF.js} +1 -1
- package/dist/m/loader-DZZLUBVB.js +1 -0
- package/dist/m/manifest-3AEF5191.js +1 -0
- package/dist/m/manifest-edit-29A26F22.js +1 -0
- package/dist/m/manifest.json +1336 -1281
- package/dist/m/options/{options-EJMS3K24.js → options-55LQHSJ4.js} +1 -1
- package/dist/m/page/{editor-6LRB3GE4.js → editor-EY2WAAGB.js} +2 -2
- package/dist/m/plugins/{ai-edit-UTV7YO2I.js → ai-edit-J5VLSW5I.js} +1 -1
- package/dist/m/plugins/{demo-OYO5GCAO.js → demo-42BSYQ7T.js} +1 -1
- package/dist/m/plugins/like-EV7MTZ56.js +1 -0
- package/dist/m/plugins/{live-AD4H6XSL.js → live-5EZN2EYP.js} +1 -1
- package/dist/m/plugins/menu-KGWKT6CS.js +1 -0
- package/dist/m/plugins/{page-MD3T2ZX3.js → page-LVW5DWA4.js} +2 -2
- package/dist/m/plugins/{page-view-PAWVZNFY.js → page-view-5KQ76IJB.js} +1 -1
- package/dist/m/plugins/{sortable-4S6SQC3D.js → sortable-WJZZBM7R.js} +1 -1
- package/dist/m/plugins/{source-TJXOIOYY.js → source-CCEUM3OR.js} +1 -1
- package/dist/m/plugins/{undo-NLPGCJQY.js → undo-3JEYK5QY.js} +1 -1
- package/dist/m/plugins/{upgrade-HSUNDNJD.js → upgrade-NW556WJD.js} +1 -1
- package/dist/m/plugins/{upload-NHGJXZK2.js → upload-TTCQRIM5.js} +1 -1
- package/dist/m/plugins/{visitor-drafts-BW43DGY3.js → visitor-drafts-2AWNT23K.js} +2 -2
- package/dist/m/plugins/{visitor-drafts-owner-7ODQG7JX.js → visitor-drafts-owner-MZP45XSG.js} +1 -1
- package/dist/m/plugins/{wire-VBWXEXU2.js → wire-VRYPY6EJ.js} +1 -1
- package/dist/m/{reader-core-4W2KYEWQ.js → reader-core-2GXY7SHY.js} +2 -2
- package/dist/m/sync/{live-sync-MO5DH33W.js → live-sync-SKPMFYOO.js} +1 -1
- package/dist/m/ui/{index-IVWN2QC4.js → index-QNIPDHXQ.js} +1 -1
- package/dist/offline-manifest.json +652 -616
- package/docs/guide.md +25 -8
- package/package.json +4 -2
- package/src/core/conflict-download.js +8 -7
- package/src/core/conflict-notice-ui.js +4 -4
- package/src/core/copy-content.js +103 -0
- package/src/core/download.js +14 -2
- package/src/core/save-size-notice.js +2 -2
- package/src/core/upgrade-run.js +5 -1
- package/src/lib/region-policy.js +1 -1
- package/src/loader-logic.js +5 -1
- package/src/loader.js +2 -0
- package/src/page/features/export-html.js +4 -4
- package/src/page/features/export-markdown.js +2 -2
- package/src/page/recovery-ui.js +2 -2
- package/src/page/save-states.js +4 -4
- package/src/plugins/like.js +254 -0
- package/src/plugins/menu/actions.js +1 -1
- package/src/plugins/page.js +4 -4
- package/src/plugins/visitor-drafts/prompt.js +12 -12
- package/src/plugins/wire.js +3 -1
- package/dist/m/attrs/save-freeze-LWGF6XUN.js +0 -1
- package/dist/m/c-D5IKEKXW.js +0 -7
- package/dist/m/c-DCFSEJZG.js +0 -1
- package/dist/m/c-EVYAISP3.js +0 -1
- package/dist/m/c-GRXHHFPO.js +0 -1
- package/dist/m/c-HT2DKBV2.js +0 -1
- package/dist/m/c-MCOOHCSG.js +0 -1
- package/dist/m/c-VILENZTD.js +0 -1
- package/dist/m/c-VR2BJ4AN.js +0 -1
- package/dist/m/c-WGW764WX.js +0 -1
- package/dist/m/c-WNTYKCDG.js +0 -1
- package/dist/m/c-YBSS55KU.js +0 -20
- package/dist/m/core/unsaved-warning-7QTKEN7Z.js +0 -1
- package/dist/m/loader-3BBNZZGM.js +0 -1
- package/dist/m/manifest-26C55578.js +0 -1
- package/dist/m/manifest-edit-4396A009.js +0 -1
- package/dist/m/plugins/menu-M5WW7DBF.js +0 -1
- /package/dist/m/{c-QTTJYJMA.js → c-FILLTJA7.js} +0 -0
- /package/dist/m/plugins/{people-JCHVPF7P.js → people-C7TVBBMR.js} +0 -0
|
@@ -0,0 +1,254 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* like.js — a like button on any element, counted by the host.
|
|
3
|
+
*
|
|
4
|
+
* <button like="post-1">♥</button>
|
|
5
|
+
* const result = await clay.like.toggle("post-1"); // { ok, on, count, error }
|
|
6
|
+
*
|
|
7
|
+
* Any element carrying `like` (its value names the item; an empty value falls back
|
|
8
|
+
* to the element's `id`) toggles this visitor's like when clicked. The host finds
|
|
9
|
+
* the items by reading the `like` attributes in the saved file, so an element starts
|
|
10
|
+
* counting once the page is saved with it.
|
|
11
|
+
*
|
|
12
|
+
* Nothing the plugin draws is saved. The total goes in a `.like-count` span added
|
|
13
|
+
* inside the element as `editor-ui`, and a liked element gets the tab-only word
|
|
14
|
+
* `liked` (`[ephemeral~="liked"]`, Tailwind `ephemeral-liked:`). The visitor id and
|
|
15
|
+
* which items this visitor liked live in memory, mirrored to `localStorage` when the
|
|
16
|
+
* browser allows it.
|
|
17
|
+
*
|
|
18
|
+
* `clay:like` fires on the element after a successful toggle, with `{ item, on,
|
|
19
|
+
* count }`; `clay:like-failed` fires when a toggle the visitor asked for failed with
|
|
20
|
+
* a message. Cancel it to draw your own message instead of the toast. A host without
|
|
21
|
+
* likes (a file opened from disk, HTML Clay) answers without counts, and the
|
|
22
|
+
* elements stay inert.
|
|
23
|
+
*
|
|
24
|
+
* `toggle` never rejects, matching message and upload.
|
|
25
|
+
*/
|
|
26
|
+
|
|
27
|
+
const PATH = "/_/reactions";
|
|
28
|
+
const VISITOR_KEY = "clay-like-visitor";
|
|
29
|
+
const OFFLINE = "Couldn't reach the server. Check your connection and try again.";
|
|
30
|
+
// A read that found nothing new is not repeated sooner than this.
|
|
31
|
+
const REFRESH_GAP_MS = 5000;
|
|
32
|
+
|
|
33
|
+
let counts = null;
|
|
34
|
+
// null until the host answers: true when it serves likes, false when it does not.
|
|
35
|
+
let supported = null;
|
|
36
|
+
let formToken = null;
|
|
37
|
+
let loading = null;
|
|
38
|
+
let loadedAt = 0;
|
|
39
|
+
let visitorId = null;
|
|
40
|
+
let liked = null;
|
|
41
|
+
const pending = new Set();
|
|
42
|
+
|
|
43
|
+
function readStore(key) {
|
|
44
|
+
try { return localStorage.getItem(key); } catch { return null; }
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
function writeStore(key, value) {
|
|
48
|
+
try { localStorage.setItem(key, value); } catch {}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
function newVisitorId() {
|
|
52
|
+
if (typeof crypto.randomUUID === "function") return crypto.randomUUID();
|
|
53
|
+
return Array.from(crypto.getRandomValues(new Uint8Array(16)), (b) => b.toString(16).padStart(2, "0")).join("");
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
function visitor() {
|
|
57
|
+
if (visitorId) return visitorId;
|
|
58
|
+
const stored = readStore(VISITOR_KEY);
|
|
59
|
+
visitorId = stored && /^[A-Za-z0-9-]{16,64}$/.test(stored) ? stored : newVisitorId();
|
|
60
|
+
if (visitorId !== stored) writeStore(VISITOR_KEY, visitorId);
|
|
61
|
+
return visitorId;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
const likedKey = () => `clay-liked:${location.pathname}`;
|
|
65
|
+
|
|
66
|
+
function likedItems() {
|
|
67
|
+
if (!liked) {
|
|
68
|
+
try { liked = new Set(JSON.parse(readStore(likedKey()) || "[]")); } catch { liked = new Set(); }
|
|
69
|
+
}
|
|
70
|
+
return liked;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
function setLiked(item, on) {
|
|
74
|
+
const items = likedItems();
|
|
75
|
+
if (on) items.add(item);
|
|
76
|
+
else items.delete(item);
|
|
77
|
+
writeStore(likedKey(), JSON.stringify([...items]));
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
const itemOf = (el) => el.getAttribute("like") || el.id;
|
|
81
|
+
|
|
82
|
+
async function request(method, body) {
|
|
83
|
+
let res;
|
|
84
|
+
try {
|
|
85
|
+
res = await fetch(PATH, {
|
|
86
|
+
method,
|
|
87
|
+
credentials: "omit",
|
|
88
|
+
cache: "no-store",
|
|
89
|
+
headers: { "Content-Type": "application/json", "Document-URL": location.href },
|
|
90
|
+
body: body ? JSON.stringify(body) : undefined,
|
|
91
|
+
});
|
|
92
|
+
} catch {
|
|
93
|
+
return { ok: false, error: OFFLINE };
|
|
94
|
+
}
|
|
95
|
+
const data = await res.json().catch(() => null);
|
|
96
|
+
if (!data) {
|
|
97
|
+
// A host without likes answers its HTML page at 200, or refuses the unknown path with a
|
|
98
|
+
// plain 404 or 405 (HTML Clay, Hyperclay Local). Hyperclay's own refusals are JSON.
|
|
99
|
+
if (res.ok || (method === "GET" && (res.status === 404 || res.status === 405))) {
|
|
100
|
+
return { ok: false, unsupported: true, error: null };
|
|
101
|
+
}
|
|
102
|
+
return { ok: false, error: `The like couldn't be saved (${res.status}).` };
|
|
103
|
+
}
|
|
104
|
+
if (typeof data.formToken === "string") formToken = data.formToken;
|
|
105
|
+
if (res.ok) return { ok: true, ...data };
|
|
106
|
+
return { ok: false, code: data.code, error: data.error || data.msg || null };
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
function countSpan(el) {
|
|
110
|
+
for (const child of el.children) {
|
|
111
|
+
if (child.classList.contains("like-count") && child.getAttribute("clay") === "editor-ui") return child;
|
|
112
|
+
}
|
|
113
|
+
const span = document.createElement("span");
|
|
114
|
+
span.className = "like-count";
|
|
115
|
+
span.setAttribute("clay", "editor-ui");
|
|
116
|
+
el.append(span);
|
|
117
|
+
return span;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
function paint() {
|
|
121
|
+
if (!counts) return;
|
|
122
|
+
const items = likedItems();
|
|
123
|
+
for (const el of document.querySelectorAll("[like]")) {
|
|
124
|
+
const item = itemOf(el);
|
|
125
|
+
const count = counts[item]?.like;
|
|
126
|
+
if (typeof count !== "number") continue;
|
|
127
|
+
const span = countSpan(el);
|
|
128
|
+
if (span.textContent !== String(count)) span.textContent = String(count);
|
|
129
|
+
window.clay?.ephemeral?.toggle(el, "liked", items.has(item));
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
/** Read the totals from the host and paint every `[like]` element. */
|
|
134
|
+
export function refresh() {
|
|
135
|
+
if (!loading) {
|
|
136
|
+
loading = request("GET")
|
|
137
|
+
.then((result) => {
|
|
138
|
+
if (result.unsupported) supported = false;
|
|
139
|
+
else if (result.ok && result.counts) {
|
|
140
|
+
supported = true;
|
|
141
|
+
counts = result.counts;
|
|
142
|
+
loadedAt = Date.now();
|
|
143
|
+
}
|
|
144
|
+
paint();
|
|
145
|
+
})
|
|
146
|
+
.finally(() => {
|
|
147
|
+
loading = null;
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
return loading;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
// An item the totals do not list yet: read again, but not on every click or mutation.
|
|
154
|
+
function refreshForMissing() {
|
|
155
|
+
if (supported === false) return Promise.resolve();
|
|
156
|
+
if (loading) return loading;
|
|
157
|
+
if (counts && Date.now() - loadedAt < REFRESH_GAP_MS) return Promise.resolve();
|
|
158
|
+
return refresh();
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
async function put(item, on) {
|
|
162
|
+
const token = formToken;
|
|
163
|
+
formToken = null;
|
|
164
|
+
return request("PUT", { item, action: "like", visitor: visitor(), on, formToken: token });
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
async function attempt(item) {
|
|
168
|
+
if (loading) await loading;
|
|
169
|
+
if (!counts?.[item]) await refreshForMissing();
|
|
170
|
+
if (supported === false || !counts?.[item]) return { ok: false, error: null };
|
|
171
|
+
const on = !likedItems().has(item);
|
|
172
|
+
let result = await put(item, on);
|
|
173
|
+
// A spent or missing token: the refusal carried a fresh one, so try once more.
|
|
174
|
+
if (result.code === "form-token") result = await put(item, on);
|
|
175
|
+
if (!result.ok) return { ok: false, error: result.error };
|
|
176
|
+
setLiked(item, on);
|
|
177
|
+
if (counts?.[item]) counts[item].like = result.count;
|
|
178
|
+
paint();
|
|
179
|
+
return { ok: true, on, count: result.count, error: null };
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
/**
|
|
183
|
+
* Toggle this visitor's like on one item.
|
|
184
|
+
*
|
|
185
|
+
* @param {string} item - the value of the element's `like` attribute
|
|
186
|
+
* @returns {Promise<{ok: boolean, on?: boolean, count?: number, error: ?string}>}
|
|
187
|
+
*/
|
|
188
|
+
export async function toggle(item) {
|
|
189
|
+
if (pending.has(item)) return { ok: false, error: null };
|
|
190
|
+
pending.add(item);
|
|
191
|
+
try {
|
|
192
|
+
return await attempt(item);
|
|
193
|
+
} catch {
|
|
194
|
+
return { ok: false, error: "The like couldn't be saved. Try again." };
|
|
195
|
+
} finally {
|
|
196
|
+
pending.delete(item);
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
async function onClick(event) {
|
|
201
|
+
const el = event.target?.closest?.("[like]");
|
|
202
|
+
if (!el || event.defaultPrevented || el.isContentEditable || supported === false) return;
|
|
203
|
+
const item = itemOf(el);
|
|
204
|
+
if (!item) return;
|
|
205
|
+
event.preventDefault();
|
|
206
|
+
const result = await toggle(item);
|
|
207
|
+
if (result.ok) {
|
|
208
|
+
el.dispatchEvent(new CustomEvent("clay:like", { bubbles: true, detail: { item, on: result.on, count: result.count } }));
|
|
209
|
+
return;
|
|
210
|
+
}
|
|
211
|
+
if (!result.error) return;
|
|
212
|
+
const failed = new CustomEvent("clay:like-failed", { bubbles: true, cancelable: true, detail: { item, error: result.error } });
|
|
213
|
+
if (el.dispatchEvent(failed)) window.clay?.toast?.(result.error, "error");
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
function addedLikes(records) {
|
|
217
|
+
const found = [];
|
|
218
|
+
for (const record of records) {
|
|
219
|
+
for (const node of record.addedNodes) {
|
|
220
|
+
if (node.nodeType !== 1) continue;
|
|
221
|
+
if (node.matches("[like]")) found.push(node);
|
|
222
|
+
found.push(...node.querySelectorAll("[like]"));
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
return found;
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
if (typeof document !== "undefined") {
|
|
229
|
+
document.addEventListener("click", onClick);
|
|
230
|
+
// The loader's own helpers (clay.ephemeral, dom-ready) are reached at runtime, not
|
|
231
|
+
// imported: a shared import would split a chunk out of the reader's boot.
|
|
232
|
+
const start = () => {
|
|
233
|
+
if (document.querySelector("[like]")) refresh();
|
|
234
|
+
// An element added later (a new post, a live-sync merge) is painted on the next
|
|
235
|
+
// frame, and an item the totals do not list yet triggers a fresh read.
|
|
236
|
+
let queued = false;
|
|
237
|
+
new MutationObserver((records) => {
|
|
238
|
+
if (queued || supported === false) return;
|
|
239
|
+
const added = addedLikes(records);
|
|
240
|
+
if (!added.length) return;
|
|
241
|
+
queued = true;
|
|
242
|
+
requestAnimationFrame(() => {
|
|
243
|
+
queued = false;
|
|
244
|
+
if (added.some((el) => !counts?.[itemOf(el)])) refreshForMissing();
|
|
245
|
+
else paint();
|
|
246
|
+
});
|
|
247
|
+
}).observe(document.body, { childList: true, subtree: true });
|
|
248
|
+
};
|
|
249
|
+
if (document.readyState === "loading") document.addEventListener("DOMContentLoaded", start);
|
|
250
|
+
else start();
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
export const like = { toggle, refresh, counts: () => (counts ? structuredClone(counts) : null) };
|
|
254
|
+
export default like;
|
|
@@ -146,7 +146,7 @@ export function attachActions({ addItem, note, currentMode }) {
|
|
|
146
146
|
if (typeof html === "string" && /^https?:$/.test(location.protocol)) {
|
|
147
147
|
html = html.replace(/(^|[^\w./:-])\/_\/uploads\//g, `$1${location.origin}/_/uploads/`);
|
|
148
148
|
}
|
|
149
|
-
if (typeof html !== "string" || !downloadHtml({ html, name: `${documentName()}.html` })) {
|
|
149
|
+
if (typeof html !== "string" || !(await downloadHtml({ html, name: `${documentName()}.html` }))) {
|
|
150
150
|
note("Couldn't build the download. Try again.");
|
|
151
151
|
}
|
|
152
152
|
},
|
package/src/plugins/page.js
CHANGED
|
@@ -233,17 +233,17 @@ function stopEditing(inst) {
|
|
|
233
233
|
|
|
234
234
|
// The tab's own page, when the store no longer holds it (another page replaced it, or the
|
|
235
235
|
// room refused it): the saved document with the article rendered from the tab's document.
|
|
236
|
-
function downloadTabCopy(inst) {
|
|
237
|
-
if (!inst.tabValue) return downloadPageCopy();
|
|
236
|
+
async function downloadTabCopy(inst) {
|
|
237
|
+
if (!inst.tabValue) return await downloadPageCopy();
|
|
238
238
|
const { forSave } = captureForSaveAndComparison({ emitForSync: false });
|
|
239
239
|
const doc = new DOMParser().parseFromString(forSave, "text/html");
|
|
240
240
|
const articles = doc.querySelectorAll(ARTICLE_SEL);
|
|
241
|
-
if (articles.length !== 1) return downloadPageCopy();
|
|
241
|
+
if (articles.length !== 1) return await downloadPageCopy();
|
|
242
242
|
const rendered = pageCode.renderFromTags([JSON.stringify(inst.tabValue)]);
|
|
243
243
|
articles[0].innerHTML = rendered.html;
|
|
244
244
|
if (rendered.rev == null) articles[0].removeAttribute("data-rev");
|
|
245
245
|
else articles[0].setAttribute("data-rev", rendered.rev);
|
|
246
|
-
return downloadSnapshot(`<!DOCTYPE html>\n${doc.documentElement.outerHTML}`);
|
|
246
|
+
return await downloadSnapshot(`<!DOCTYPE html>\n${doc.documentElement.outerHTML}`);
|
|
247
247
|
}
|
|
248
248
|
|
|
249
249
|
function stopWithNotice(inst, text, { reload = true } = {}) {
|
|
@@ -103,22 +103,19 @@ export async function mountPrompt({ memory, appName, link }) {
|
|
|
103
103
|
});
|
|
104
104
|
}
|
|
105
105
|
|
|
106
|
-
function downloadCurrent() {
|
|
106
|
+
async function downloadCurrent() {
|
|
107
107
|
const getHTML = window.clay && window.clay.getHTML;
|
|
108
108
|
if (typeof getHTML !== "function" || typeof URL === "undefined" || typeof URL.createObjectURL !== "function") return false;
|
|
109
109
|
const segment = location.pathname.split("/").filter(Boolean).pop() || "index.html";
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
a.remove();
|
|
117
|
-
setTimeout(() => URL.revokeObjectURL?.(objectUrl), 1000);
|
|
118
|
-
return true;
|
|
110
|
+
try {
|
|
111
|
+
const { downloadHtml } = await import("../../core/download.js");
|
|
112
|
+
return await downloadHtml({ html: getHTML(), name: segment.replace(/\.html$/, ".htmlclay") });
|
|
113
|
+
} catch {
|
|
114
|
+
return false;
|
|
115
|
+
}
|
|
119
116
|
}
|
|
120
117
|
|
|
121
|
-
root.addEventListener("click", (e) => {
|
|
118
|
+
root.addEventListener("click", async (e) => {
|
|
122
119
|
const t = e.target.closest("[data-hcp]");
|
|
123
120
|
if (t) {
|
|
124
121
|
const act = t.getAttribute("data-hcp");
|
|
@@ -133,7 +130,10 @@ export async function mountPrompt({ memory, appName, link }) {
|
|
|
133
130
|
if (e.target.closest("[data-hcp-link]")) {
|
|
134
131
|
if (root.getAttribute("data-hcp-reason") === "error") {
|
|
135
132
|
e.preventDefault();
|
|
136
|
-
downloadCurrent()
|
|
133
|
+
if (!(await downloadCurrent())) {
|
|
134
|
+
root.querySelector(".hcp-body [data-hcp-for='error']").textContent = "The download could not be made. Keep this page open and try Download free again.";
|
|
135
|
+
return;
|
|
136
|
+
}
|
|
137
137
|
}
|
|
138
138
|
mem.downloaded = true; mem.shown = true; memory.save();
|
|
139
139
|
}
|
package/src/plugins/wire.js
CHANGED
|
@@ -788,7 +788,9 @@ function send(payload, opts = {}) {
|
|
|
788
788
|
// Accepted by the router and taken by nobody. Reporting this as an error
|
|
789
789
|
// rather than a pending request is the difference between a UI that says
|
|
790
790
|
// "start an agent" and one that spins forever.
|
|
791
|
-
finish(rec, "error",
|
|
791
|
+
finish(rec, "error", rec.helper
|
|
792
|
+
? `The local program "${rec.helper}" is not connected to this file.`
|
|
793
|
+
: "No program is connected to this file.");
|
|
792
794
|
}
|
|
793
795
|
};
|
|
794
796
|
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a}from"../c-OYRZ7XG2.js";import"../c-Q26MME6N.js";import"../c-ZWIOJGMT.js";import"../c-IJUK2GPW.js";import"../c-7MG5RU63.js";import"../c-XQXZAO7N.js";import"../c-S7LK4KUE.js";import"../c-VG5XIN4T.js";import"../c-2YYDMLNZ.js";import"../c-HA6INT6J.js";import"../c-DCFSEJZG.js";import"../c-WRBKEJD4.js";import"../c-VHNSBD2M.js";export{a as default};
|
package/dist/m/c-D5IKEKXW.js
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import{d as Ae,h as Ve,i as qe}from"./c-TRS6TM6O.js";import{a as Ne,b as Pe}from"./c-WNTYKCDG.js";import{a as Ie,b as Oe}from"./c-PZ4XEPUP.js";import{e as ke,f as Ke,g as W,h as Ue,l as re,m as $e,n as p}from"./c-BJ7YQ5QZ.js";import"./c-4JZDZFF6.js";import{b as U,c as Z,e as l,f as Ye}from"./c-VAK7SG37.js";import{b as He}from"./c-MHI3GYKF.js";import"./c-MCOOHCSG.js";import{b as T,c as Fe}from"./c-NUHP2XDB.js";import{a as We,q as V}from"./c-T637T7SN.js";import"./c-4ASQPRQL.js";import"./c-GQ6F6IDK.js";import"./c-I2SCCUEW.js";import"./c-5VYOWDTI.js";import{f as Te}from"./c-FWKHM4E7.js";import"./c-X5LNHET5.js";import"./c-WYFDLITL.js";import"./c-UGHH4MB3.js";import"./c-ZWIOJGMT.js";import"./c-B7J4K2AE.js";import"./c-ATKAOH23.js";import"./c-EK63G3CG.js";import"./c-NQJRVJ56.js";import"./c-XGH4GS2T.js";import"./c-IJUK2GPW.js";import{f as _e}from"./c-3O7OBDCM.js";import"./c-BPF2NSPV.js";import"./c-P7KNDG34.js";import"./c-CYWLPPUS.js";import"./c-N7JPUPGC.js";import"./c-7MG5RU63.js";import"./c-XQXZAO7N.js";import"./c-S7LK4KUE.js";import"./c-VG5XIN4T.js";import"./c-2YYDMLNZ.js";import"./c-HA6INT6J.js";import"./c-DCFSEJZG.js";import"./c-WRBKEJD4.js";import"./c-VHNSBD2M.js";var E="light-dark(#D08A1E, #E3A33F)",lt=5e3,st=4e3,dt=500,ct={"another-tab":"in another tab","another-person":"by someone else","an-agent":"by an agent"},pt='<svg viewBox="0 0 12 12" width="12" height="12" aria-hidden="true"><path d="M2.5 9.5h7" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="square"/></svg>',F=(e,t)=>`${e} ${t}${e===1?"":"s"}`,ut="This spot changed again. Review the latest edit or download your copy.",ft="A data value can't be put back from here. Download your copy to keep yours.",m="hidden",P=!1,S=[],J=new Set,M=new Set,h=null,Ee=0,I=null,v=null,le=null,u=null,R=!1,Y=!1,ve=!1,G=new Map,se=0,ae=!1,te=!1,b=null,j=null,L=null,Se=0,D=!1,de=0,ce=null,ne=null,k=[],x=[],oe=!1,pe=null,ue=null,s=null,B=null,q=new Map,z=()=>window.clay?.conflicts||null,Qe=()=>k.reduce((e,t)=>e+t.conflicts.length,0)+x.length,Le=()=>{let e=window.clay?.undo;return e&&typeof e.kept=="function"?e:null},fe=()=>z()?.list().filter(e=>!e.claimedBy&&e.kind!=="apply-incomplete")??[],De=()=>z()?.list().filter(e=>!e.claimedBy&&e.kind==="apply-incomplete")??[];function ze(){return I?"upgraded":h?"refused":fe().length?"replaced":De().length?"failed":k.length||x.length?"recovered":null}function f(e,t,n){let o=Fe(e,t,n);return t[0]==="all:initial"&&T(o,"color-scheme","inherit"),o.setAttribute("clay",ke),o}function _(e,t){return q.set(t,e),e}function ie(){if(!s)return;let e=window.visualViewport,t=e?Math.max(0,window.innerHeight-e.height-e.offsetTop):0;T(s,"bottom",`calc(${16+t}px + env(safe-area-inset-bottom,0px))`),ne&&T(ne,"max-height",`${Math.max(160,(e?.height||window.innerHeight)-32)}px`)}function ht(){s=f("div",["all:initial","position:fixed","left:50%","transform:translateX(-50%)","z-index:2147483001","display:none","flex-direction:column","align-items:center","max-width:calc(100vw - 24px)",`font:14px/1.5 ${U}`,`color:${l.ink}`,"text-align:left"]),s.setAttribute("data-clay-conflict",""),document.body.appendChild(s),window.visualViewport?.addEventListener("resize",ie),window.visualViewport?.addEventListener("scroll",ie)}function d(){if(ae)return;ae=!0;let e=()=>{ae=!1,w()};typeof requestAnimationFrame=="function"?requestAnimationFrame(e):setTimeout(e,16)}function w(){te&&(te=!1,h&&!V()&&(h=null));let e=ze();if(e?m==="hidden"&&(m="bar"):(m="hidden",P=!1,J.clear(),M.clear(),S=[],y(),ce=null,D=!1),!s){if(m==="hidden"&&!b||!document.body)return;ht()}!s.isConnected&&document.body&&document.body.appendChild(s);let t=document.activeElement,n=null;for(let[a,r]of q)r===t&&(n=a);let o=B?B.scrollTop:0;q=new Map,B=null,ne=null,s.replaceChildren(),b?s.append(wt(b)):m==="bar"?s.append(yt(e)):m==="panel"&&s.append(xt(e)),T(s,"display",b||m!=="hidden"?"flex":"none"),B&&(B.scrollTop=o);let i=L||n;i&&q.has(i)&&q.get(i).focus({preventScroll:!0}),b||(L=null),ie(),He(s)}function Xe(){return f("span",["all:initial","display:inline-block","flex:none","width:8px","height:8px","border-radius:50%",`background:${E}`])}function Ze(){return ct[h?.changedBy]||null}function gt(e,t){if(e==="upgraded")return I;if(e==="refused"){let n=Ze();return!n&&h.afterTimeout?"This page changed elsewhere, possibly by your own save that timed out. Your edits here are safe.":`This page changed ${n||"elsewhere"}. Your edits here are safe.`}return e==="failed"?"A sync update did not finish. Your edits here are safe.":e==="recovered"?`${F(t,"change")} replaced before this page loaded ${t===1?"is":"are"} still here.`:`Another edit replaced ${F(t,"change")}.`}function mt(e,t){return e==="upgraded"?I:e==="refused"?`This page changed ${Ze()||"elsewhere"}`:e==="failed"?"A sync update did not finish":e==="recovered"?`${F(t,"change")} kept from before this page loaded`:`Another edit replaced ${F(t,"change")}`}function wt(e){let t=re("div",["display:block",`border-left:3px solid ${l.teal}`,"padding:10px 14px","width:max-content","max-width:calc(100vw - 24px)"]);return t.setAttribute("role","status"),t.textContent=e,t}function yt(e){let t=e==="failed"?De().length:e==="recovered"?Qe():fe().length,n=re("div",["display:flex","flex-wrap:wrap","align-items:center","gap:10px 12px","padding:8px 8px 8px 14px","width:max-content","max-width:calc(100vw - 24px)"]),o=gt(e,t);return o!==ce&&(n.setAttribute("role",e==="refused"?"alert":"status"),ce=o),n.append(Xe(),p("span",[],o)),e==="upgraded"?(n.append(_(W("Reload",{variant:"primary",onClick:()=>window.location.reload()}),"reload")),n):(n.append(_(W("Review",{onClick:Dt}),"review")),n)}function $(e,t,{variant:n="default",onClick:o,push:i=!1}={}){let r=window.innerWidth<480?["flex:1 1 100%",...n==="primary"?["order:-1"]:[]]:i?["margin-left:auto"]:[];return _(W(e,{variant:n,onClick:o,extra:r}),t)}function A(e){return p("div",["display:block","padding:0 16px 12px",`color:${l["ink-2"]}`,"font-size:13.5px"],e)}function xt(e){let t=e==="replaced"?fe():e==="failed"?De():[],n=e==="refused"?fe():t,o=e==="recovered"?Qe():t.length;if(J.size)for(let c of t)J.has(c.id)||M.add(c.id);for(let c of[...M])t.some(N=>N.id===c)||M.delete(c);let i=mt(e,o),a=Math.max(160,(window.visualViewport?.height||window.innerHeight)-32),r=re("div",["display:flex","flex-direction:column","width:520px","max-width:calc(100vw - 24px)",`max-height:${a}px`]);ne=r,r.setAttribute("role","dialog"),r.setAttribute("aria-label",i);let g=f("div",["all:initial","display:flex","align-items:center","gap:8px","padding:12px 12px 8px 16px",`font:14px/1.5 ${U}`,`color:${l.ink}`]),K=_(p("b",["font-weight:600","font-size:14.5px","outline:none"],i),"title");K.setAttribute("tabindex","-1"),g.append(Xe(),K),e==="replaced"&&M.size&&g.append(p("span",[`font:600 10.5px/1 ${Z}`,"letter-spacing:.12em","text-transform:uppercase","padding:3px 6px",`color:color-mix(in srgb, ${l.brass} 80%, ${l.ink})`,`background:${l["brass-soft"]}`],`${M.size} new`));let X=f("span",["all:initial","display:inline-flex","margin-left:auto"]),Be=_(Ue(pt,{label:"Minimize",onClick:Je}),"minimize");if(Be.title="Minimize to the bar. Nothing is accepted until you choose.",X.append(Be),g.append(X),r.append(g),e==="recovered")return Et(r),r;if(e==="refused"){if(r.append(A("Your edits here are safe and not saved yet; nothing will be overwritten until you choose. Their version is not on this page, so there is no list of edits to compare. Keep yours, which saves over theirs, or accept theirs, which reloads the page and drops your unsaved edits.")),n.length&&r.append(A(`${F(n.length,"earlier replaced edit")} ${n.length===1?"is":"are"} also held in this tab. Download my copy includes them.`)),R&&r.append(A("That did not save either. Your edits here are still here.")),D&&r.append(A("Something changed on the page after your first press, so nothing was dropped. Press Accept theirs again if you still want their version.")),v){let c=f("div",["all:initial","display:block","margin:0 16px 12px","padding:8px 10px",`border-left:3px solid ${E}`,`background:color-mix(in srgb, ${E} 14%, transparent)`,`color:${l.ink}`,`font:13px/1.5 ${U}`]);c.append(f("b",["all:initial","font:inherit","font-weight:700","color:inherit"],"This drops your unsaved edits."),document.createTextNode(" Download your copy first if you might want them. Press again to confirm.")),r.append(c)}}else e==="upgraded"?r.append(A("Its layout and code changed with it, so this page stops here. Reload to see the new version.")):e==="failed"?r.append(A("Part of an update from elsewhere could not be applied, so this page may be missing some of it. Your edits here are safe. Download a copy of the page as you had it, or accept to keep the page as it is.")):r.append(A("The page is showing the other edit. This stays until you choose. You can also save a copy of the page as you had it."));let O=f("div",["all:initial","display:flex","flex-wrap:wrap","gap:8px","padding:0 16px 14px"]);if(e==="upgraded")return O.append($("Reload","reload",{variant:"primary",onClick:()=>window.location.reload(),push:!0})),r.append(O),S=[],r;let at=$(ve?"Try again":Y?"Downloaded":"Download my copy","download",{onClick:Bt});if(O.append(at),e==="refused"){let c=$(u==="overwrite"?"Saving\u2026":R?"Try again":"Keep mine","keep",{onClick:Pt});c.setDisabled(u==="overwrite"),O.append(c,$(v?"Yes, drop my edits":"Accept theirs","accept",{variant:"primary",onClick:Ft,push:!0}))}else{if(e==="replaced"){let c=z().hasPendingApply(),N=$(c?"Finishing the incoming edit\u2026":u==="revert"?"Putting back\u2026":"Revert to mine","revert",{onClick:Mt});N.setDisabled(c||u==="revert"),O.append(N)}O.append($("Accept theirs","accept",{variant:"primary",onClick:zt,push:!0}))}if(r.append(O),e==="replaced")if(P)r.append(vt(t));else{let c=f("div",["all:initial","display:flex","align-items:center","gap:8px",`border-top:1px solid ${l.line}`,"padding:8px 10px 8px 16px",`color:${l.muted}`,`font:13px/1.5 ${U}`]),N=f("span",["all:initial","display:inline-flex","margin-left:auto"]);N.append(_(W("See the edits",{small:!0,onClick:et}),"list")),c.append(f("span",["all:initial","font:inherit","color:inherit"],F(t.length,"edit")),N),r.append(c)}S=n.map(c=>c.id);for(let c of t)J.add(c.id);return r}function vt(e){let t=$e(["flex:1 1 auto","margin:0 16px 12px","min-height:0","overflow:auto",`background:${l.sunk}`,`border:1px solid ${l["line-2"]}`]),n=f("div",["all:initial","position:sticky","top:0","z-index:1","display:flex","align-items:center","gap:8px","padding:8px 12px",`background:${l.sunk}`,`border-bottom:1px solid ${l["line-2"]}`,`color:${l.muted}`,`font:600 10.5px/1 ${Z}`,"letter-spacing:.12em","text-transform:uppercase"]),o=f("span",["all:initial","display:inline-flex","margin-left:auto"]);return o.append(_(W("Hide",{small:!0,variant:"quiet",onClick:et}),"list")),n.append(f("span",["all:initial","font:inherit","color:inherit","letter-spacing:inherit","text-transform:inherit"],"Replaced edits"),o),t.append(n),e.forEach((i,a)=>t.append(St(i,a))),B=t,t}function Me(e){let t=e.context?.label||e.name||(e.context?.kind==="entry"?"Entry":"Edit");return e.context?.field?`${t} \xB7 ${e.context.field}`:t}var bt={"content-changed":"the page changed there","structure-changed":"the structure changed there","target-detached":"that part of the page is gone","duplicate-id":"another part of the page now has the same id",protected:"that region keeps its own history",unsupported:"this kind of step cannot be put back"},kt=e=>bt[e]||"the page changed there";function $t(e,t){let n=Array.isArray(e)?e:[];for(let o of n){if(!o||o.kind!=="text"&&o.kind!=="value")continue;let i=t==="redo"?o.after:o.before;if(typeof i=="string"&&i)return{text:i,id:o.target?.id??null}}for(let o of n){if(!o||o.kind!=="add"&&o.kind!=="remove")continue;let i=Array.isArray(o.nodes)?o.nodes.find(a=>typeof a?.html=="string"&&a.html):null;if(i)return{text:Ie(i.html).replace(/\s+/g," ").trim(),id:o.parent?.id??null}}for(let o of n){if(!o)continue;let i=t==="redo"?o.after:o.before;if(typeof i=="string"&&i)return{text:i,id:o.target?.id??null}}return{text:"",id:null}}function Tt(e){if(e==null||typeof document>"u")return"";let t=window.CSS?.escape?window.CSS.escape(String(e)):String(e).replace(/["\\]/g,"\\$&"),n=null;try{n=document.querySelector(`[data-id="${t}"]`)}catch{return""}if(!n)return"";let o=n.matches?.("input, textarea, select")?n.value:null;return(typeof o=="string"?o:n.textContent??"").replace(/\s+/g," ").trim()}function At(e){let t=e?.payload&&typeof e.payload=="object"?e.payload:{},n=String(e?.key??""),o={id:e?.id,revision:e?.revision,record:e,kind:e?.kind??"conflict"};if(n.startsWith("app:"))return{...o,name:typeof t.label=="string"&&t.label?t.label:n.slice(4),sentence:"",yours:typeof t.text=="string"?t.text:"",now:""};let i=t.direction==="redo"?"redo":"undo",g=((Array.isArray(t.context)?t.context:[]).find(X=>typeof X?.label=="string"&&X.label)??null)?.label||typeof t.label=="string"&&t.label||"Edit",K=$t(t.steps,i);return{...o,name:g,sentence:`The ${i} of "${g}" was not applied because ${kt(t.code)}.`,yours:K.text,now:K.id==null?"":Tt(K.id)}}function Ct(e){let t=Le();if(!e.record||typeof t?.reviewActionsFor!="function")return[];try{return(t.reviewActionsFor(e.record)||[]).filter(n=>n&&typeof n.run=="function"&&n.label)}catch{return[]}}var Ge=e=>({before:"",hit:e,after:"",cutBefore:!1,cutAfter:!1});function je(e){let t=p("div",["display:block","padding:8px 12px 10px"]),n=p("div",["display:flex","align-items:center","gap:8px","font-size:12.5px","font-weight:600",`color:${l["ink-2"]}`,"margin-bottom:4px"]);if(n.append(p("span",[],Me(e))),t.append(n),e.sentence&&t.append(p("div",["display:block","font-size:13px",`color:${l["ink-2"]}`],e.sentence)),e.yours){let i=p("div",["display:grid","grid-template-columns:44px 1fr","gap:3px 10px","align-items:start",`font:12.5px/1.5 ${Z}`,...e.sentence?["margin-top:4px"]:[]]);i.append(...he("Yours",Ge(e.yours),{mine:!0})),e.now&&i.append(...he("Now",Ge(e.now),{mine:!1})),t.append(i)}let o=f("div",["all:initial","display:flex","flex-wrap:wrap","gap:8px","margin-top:8px"]);return Ct(e).forEach((i,a)=>{let r=$(i.label,`run:${e.id}:${a}`,{onClick:()=>Nt(e,i,r)});o.append(r)}),o.append($(pe===e.id?"Copied":"Copy",`copy:${e.id}`,{onClick:()=>It(e)})),o.append($("Dismiss",`dismiss:${e.id}`,{onClick:()=>tt(e)})),t.append(o),t}function Et(e){e.append(A(k.length?"These copies were replaced before this page loaded. The page never puts them back on its own. Copy or download the ones you want; dismiss one when you no longer need it.":"These copies were kept because an undo could not be put back or the page set them aside. The page never puts them back on its own. Copy or download the ones you want; dismiss one when you no longer need it.")),oe&&e.append(A("That action did not run. The copy is still here."));let t=$e(["flex:1 1 auto","margin:0 16px 12px","min-height:0","overflow:auto",`background:${l.sunk}`,`border:1px solid ${l["line-2"]}`]);for(let o of k)for(let i of o.conflicts)t.append(je(i));for(let o of x)t.append(je(o));B=t,e.append(t);let n=f("div",["all:initial","display:flex","flex-wrap:wrap","gap:8px","padding:0 16px 14px"]);(k.some(o=>o.root)||x.length)&&n.append($(Y?"Downloaded":"Download my copy","download",{onClick:Ot})),e.append(n),S=[]}function he(e,t,{mine:n}){let o=[p("span",[`color:${l.faint}`,`font-family:${U}`],e)],i=p("span",["display:-webkit-box","-webkit-line-clamp:2","-webkit-box-orient:vertical","overflow:hidden","overflow-wrap:anywhere",...n?[`color:${l.ink}`]:[`color:${l.muted}`]]),a=(t.cutBefore?"\u2026":"")+t.before+t.hit+t.after+(t.cutAfter?"\u2026":"");i.title=a,t.before&&i.append(p("span",[`color:${l.faint}`],(t.cutBefore?"\u2026":"")+t.before));let r=p("span",n?[`background:color-mix(in srgb, ${E} 18%, transparent)`,"padding:0 4px"]:t.before||t.after?["text-decoration:underline",`text-decoration-color:color-mix(in srgb, ${E} 70%, transparent)`,"text-underline-offset:3px"]:[],t.hit||"(empty)");return i.append(r),t.after&&i.append(p("span",[`color:${l.faint}`],t.after+(t.cutAfter?"\u2026":""))),o.push(i),o}function St(e,t){let n=Oe(e),o=p("div",["display:block","padding:8px 12px 10px",...t?[`border-top:1px solid ${l.line}`]:[]]),i=p("div",["display:flex","align-items:center","gap:4px","font-size:12.5px","font-weight:600",`color:${l["ink-2"]}`,"margin-bottom:4px"]);if(i.append(p("span",[],n.name)),n.target&&n.target.isConnected&&i.append(_(Rt(n),`eye:${e.id}`)),o.append(i),n.sentence&&o.append(p("div",["display:block","font-size:13px",`color:${l["ink-2"]}`],n.sentence)),G.has(e.id)&&o.append(p("div",["display:block","font-size:13px","margin-top:4px",`color:${E}`],G.get(e.id))),n.yours){let a=p("div",["display:grid","grid-template-columns:44px 1fr","gap:3px 10px","align-items:start",`font:12.5px/1.5 ${Z}`,...n.sentence?["margin-top:4px"]:[]]);a.append(...he("Yours",n.yours,{mine:!0})),n.now&&a.append(...he("Now",n.now,{mine:!1})),o.append(a)}return o}function Rt(e){let t=["all:initial","color-scheme:inherit","box-sizing:border-box","cursor:pointer","display:inline-grid","place-items:center","width:22px","height:20px",`color:${l.ink}`],n=f("button",t);n.type="button",n.innerHTML=Ye.conflictEye,Ke(n.firstElementChild,16),n.setAttribute("aria-label",`Show ${e.name} on page`),n.title="Show on page";let o=i=>{n.style.cssText="";for(let a of[...t,...i]){let r=a.indexOf(":");n.style.setProperty(a.slice(0,r),a.slice(r+1),"important")}};return n.addEventListener("pointerenter",()=>o([`background:color-mix(in srgb, ${E} 16%, transparent)`])),n.addEventListener("pointerleave",()=>o([])),n.addEventListener("focus",()=>o([`outline:2px solid ${l.brass}`,"outline-offset:1px"])),n.addEventListener("blur",()=>o([])),n.addEventListener("click",()=>Lt(e.target)),n}var C=null,ge=null,me=null;function we(){clearTimeout(ge),window.removeEventListener("scroll",ee,!0),window.removeEventListener("resize",ee),C?.remove(),C=null,me=null}function ee(){if(!C||!me)return;let e=me.getBoundingClientRect();T(C,"left",`${e.left}px`),T(C,"top",`${e.top}px`),T(C,"width",`${e.width}px`),T(C,"height",`${e.height}px`)}function Lt(e){if(we(),!e||!e.isConnected)return;let n=!!window.matchMedia?.("(prefers-reduced-motion: reduce)").matches?"instant":"smooth",o=s?.getBoundingClientRect().top??0,i=s&&o>0?Math.max(0,window.innerHeight-o):0;if(!i)e.scrollIntoView?.({block:"center",behavior:n});else{e.scrollIntoView?.({block:"center",behavior:"instant"});let a=e.getBoundingClientRect(),r=window.innerHeight-i,g=a.height>r-24?a.top-12:a.top+a.height/2-r/2;window.scrollBy?.({top:g,behavior:n})}me=e,C=f("div",["all:initial","color-scheme:inherit","position:fixed","pointer-events:none","z-index:2147483001",`outline:2px solid ${E}`,"outline-offset:3px",`background:color-mix(in srgb, ${E} 14%, transparent)`]),document.body.appendChild(C),ee(),window.addEventListener("scroll",ee,!0),window.addEventListener("resize",ee),ge=setTimeout(we,2500)}function Dt(){I||(m="panel",L="title",w())}function Je(){we(),m="bar",y(),L="review",w()}function et(){P=!P,P&&M.clear(),w()}function zt(){let e=z(),t=S.filter(n=>{let o=e?.get(n);return o&&!o.claimedBy});e&&t.length&&e.acknowledge(t,{reason:"accepted"}),m=ze()?"bar":"hidden",L="review",d()}async function Mt(){let e=z();if(u||!e||e.hasPendingApply())return;let t=S.filter(r=>{let g=e.get(r);return g&&!g.claimedBy});if(!t.length)return;u="revert",w();let n=!0,o=r=>{n=!!s?.contains(r.target)};document.addEventListener("focus",o,!0);let i;try{let{revertConflicts:r}=await import("./c-C6IPRG34.js");i=await r(t)}catch(r){console.error("[clay] Revert to mine did not finish",r),i={revertedIds:[],blockedIds:t,saveResult:null}}finally{document.removeEventListener("focus",o,!0)}u=null;for(let r of i.blockedIds)G.set(r,z()?.get(r)?.kind==="json"?ft:ut);m=ze()?"bar":"hidden",L=n?"review":null;let a=i.saveResult&&(i.saveResult.ok||i.saveResult.msg==="Save already in progress");i.revertedIds.length&&a?be(`Put back ${F(i.revertedIds.length,"change")}. Saving.`):w()}var Q=null;function Bt(){let e=z(),t=h?e?.list()??[]:S.map(o=>e?.get(o)).filter(Boolean),n=Pe(t,{refused:!!h});ve=!n,Y=n,clearTimeout(Q),n&&(Q=setTimeout(()=>{Y=!1,d()},1200)),w()}async function H(){let e=null;if(Ae())try{e=await Ve()}catch{e=null}let t=Le(),n=null;if(t)try{n=await t.kept()}catch{n=null}let o=!1;if(e?.ok?(k=e.records,o=!0):!Ae()&&k.length&&(k=[],o=!0),n?.ok){let i=(Array.isArray(n.records)?n.records:[]).filter(r=>r&&r.supported!==!1).map(At);i.length===x.length&&i.every((r,g)=>r.id===x[g].id&&r.revision===x[g].revision)||(o=!0),x=i}else n&&x.length&&(x=[],o=!0);o&&d()}async function _t(e){try{return await navigator.clipboard.writeText(e),!0}catch{}let t=document.createElement("textarea");t.value=e,t.setAttribute("clay",ke),t.style.setProperty("position","fixed","important"),t.style.setProperty("opacity","0","important"),document.body?.append(t),t.select();let n=!1;try{n=document.execCommand?.("copy")===!0}catch{}return t.remove(),n}async function It(e){let t=e.record?e.yours:`${Me(e)}
|
|
2
|
-
|
|
3
|
-
Yours:
|
|
4
|
-
${e.yours}
|
|
5
|
-
|
|
6
|
-
Now:
|
|
7
|
-
${e.now}`;if(!await _t(t)){be("Could not copy. Select the text instead.");return}pe=e.id,clearTimeout(ue),ue=setTimeout(()=>{pe=null,d()},1200),w()}function Ot(){let e=k.find(o=>o.root),t=[];for(let o of k)for(let i of o.conflicts)t.push({id:i.id,kind:i.kind,name:Me(i),yours:i.yours,now:i.now,sentence:i.sentence});for(let o of x)t.push({id:o.id,kind:o.kind,name:o.name,yours:o.yours,now:o.now,sentence:o.sentence});let n=Ne({html:e?.root??null,edits:t});ve=!n,Y=n,clearTimeout(Q),n&&(Q=setTimeout(()=>{Y=!1,d()},1200)),w()}async function tt(e){let t;try{t=e.record?await Le()?.dismissKept(e.id,{revision:e.revision}):await qe([e.id]),t||={ok:!1}}catch{t={ok:!1}}t.ok||be("That copy could not be dismissed."),await H(),d()}var Ce=new Set;async function Nt(e,t,n=null){if(!Ce.has(t)){Ce.add(t),n&&(n.disabled=!0,n.setAttribute("aria-busy","true")),oe=!1;try{let o=null;try{o=await t.run(e.record)}catch{o=null}if(o?.ok===!0&&o?.dismiss===!0){await tt(e);return}oe=o?.ok!==!0,await H(),d()}finally{Ce.delete(t),n&&n.isConnected&&(n.disabled=!1,n.removeAttribute("aria-busy"))}}}function nt(e){e?.detail?.ok===!0&&(oe=!1,H(),d())}function y(){clearTimeout(le),le=null,v=null}async function Pt(){if(u)return;let e=++de;u="overwrite",R=!1,y(),w();let t;try{t=await window.clay?.save?.overwrite?.()}catch{t={ok:!1}}e!==de||u!=="overwrite"||(!t?.ok&&V()&&(u=null,R=!0),d())}function Ft(){if(!v){v={refusalGeneration:Ee,ledgerRevision:se,dirtyGeneration:Te().gen},Se=Date.now(),D=!1,clearTimeout(le),le=setTimeout(()=>{y(),d()},lt),w();return}if(Date.now()-Se<dt)return;let e=v;We({isCurrent:()=>v===e&&e.refusalGeneration===Ee&&e.ledgerRevision===se&&e.dirtyGeneration===Te().gen,reload:()=>window.location.reload()})||(y(),D=!0,w())}function be(e){b=e,clearTimeout(j),j=setTimeout(()=>{b=null,d()},st),w()}function Yt(){H(),d()}function ot(){se++,v&&y();for(let e of[...G.keys()])z()?.get(e)||G.delete(e);H(),d()}function it(e){I=e?.detail&&e.detail.message||"This document was upgraded.",b=null,clearTimeout(j),y(),u=null,R=!1,D=!1,m="bar",d()}function rt(e){let t=e?.detail||{};h={generation:++Ee,changedBy:t.changedBy,afterTimeout:!!t.afterTimeout,etag:t.etag??null},b=null,clearTimeout(j),y(),u=null,R=!1,de++,D=!1,d()}function Re(e){if(V()){e.type==="clay:save-saved"&&queueMicrotask(()=>{V()||Re(e)});return}let t=u==="overwrite"&&e.type==="clay:save-saved";(h||u)&&(h=null,u=null,R=!1,D=!1,y()),t?be("Saved your version over theirs."):d()}function Ht(){h&&(te=!0,d())}function Kt(){!h||V()||(h=null,u=null,R=!1,D=!1,y(),d())}function Ut(e){if(e.key!=="Escape")return;if(v){e.preventDefault(),y(),w();return}if(m!=="panel")return;let t=document.activeElement;t&&t!==document.body&&!s?.contains(t)||(e.preventDefault(),Je())}function Wt(e){!v||s?.contains(e.target)||(y(),d())}function Vt(e){b&&L&&!s?.contains(e.target)&&(L=null)}function qt(){xe=new AbortController;let{signal:e}=xe;document.addEventListener("clay:document-upgraded",it,{signal:e}),_e&&(document.addEventListener("clay:sync-conflicts-changed",ot,{signal:e}),document.addEventListener("clay:unsaved-state-changed",d,{signal:e}),document.addEventListener("clay:save-conflict",rt,{signal:e}),document.addEventListener("clay:save-saved",Re,{signal:e}),document.addEventListener("clay:save-conflict-resolved",Re,{signal:e}),document.addEventListener("clay:sync-applied",Ht,{signal:e}),document.addEventListener("clay:save-conflict-released",Kt,{signal:e}),document.addEventListener("keydown",Ut,{signal:e}),document.addEventListener("input",Wt,{capture:!0,signal:e}),document.addEventListener("focus",Vt,{capture:!0,signal:e}),document.addEventListener("clay:conflict-store-changed",Yt,{signal:e}),document.addEventListener("clay:undo-kept",nt,{signal:e}),z()?.size&&d(),H(),Promise.resolve(window.clay?.ready).catch(()=>{}).then(()=>{e.aborted||H()}))}var Gt={"clay:sync-conflicts-changed":ot,"clay:save-conflict":rt,"clay:document-upgraded":it,"clay:undo-kept":nt},ye=!1,xe=null;function an(e){ye||(ye=!0,qt());let t=e&&Gt[e.type];t&&t(e),h&&(te=!0,d())}function ln(){ye&&(ye=!1,xe?.abort(),xe=null,y(),clearTimeout(j),j=null,clearTimeout(Q),Q=null,clearTimeout(ue),ue=null,clearTimeout(ge),ge=null,we(),window.visualViewport?.removeEventListener("resize",ie),window.visualViewport?.removeEventListener("scroll",ie),s?.remove(),s=null,q=new Map,B=null,ne=null,m="hidden",P=!1,S=[],J.clear(),M.clear(),G.clear(),b=null,h=null,I=null,u=null,R=!1,de++,v=null,Se=0,D=!1,k=[],x=[],oe=!1,ae=!1,te=!1,L=null,ce=null,Y=!1,ve=!1,pe=null)}var sn={state:()=>({view:m,listOpen:P,renderedIds:S.slice(),refused:h,armed:v,busy:u,ledgerRevision:se,upgraded:I}),render:w,resetUpgrade:()=>{I=null}};export{E as WARN,sn as _test,d as schedule,an as start,ln as stop,be as toast};
|
package/dist/m/c-DCFSEJZG.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{b as m,c as g,d as c,e as f,f as v}from"./c-WRBKEJD4.js";var w=['[src^="chrome-extension://"]','[href^="chrome-extension://"]','[src^="moz-extension://"]','[href^="moz-extension://"]','[src^="safari-web-extension://"]','[href^="safari-web-extension://"]','[id="1p-menu-live-region"]',"com-1password-button","com-1password-menu","com-1password-notification","grammarly-extension","grammarly-desktop-integration","lt-div","lt-card","lt-toolbar","lt-highlighter","[data-lastpass-root]","[data-lastpass-icon-root]","[data-dashlane-shadowhost]","[data-klarna-extension]",'[class*="klarna-extension"]',".skiptranslate","#goog-gt-tt",".goog-te-banner-frame",".goog-te-balloon-frame","style.darkreader","style[data-darkreader-mode]","style[data-darkreader-scheme]","#loom-companion-mv3","loom-container","[ext-id]"],N=["data-grammarly","data-lt","data-1p","data-com-onepassword","data-lastpass","data-lp","data-kwimpala","data-bitwarden","data-bw","data-dashlane","data-np","data-protonpass","data-proton-pass","data-keeper","data-rf","data-roboform","data-honey","data-rakuten","data-capital-one","data-wikibuy","data-klarna","data-darkreader","data-evernote","data-pocket","data-pin"],u=w.join(","),_=new RegExp("^(?:"+N.join("|")+")(?:-|$)");function X(e){if(!(!e||!e.querySelectorAll))try{for(let a of e.querySelectorAll(u))a.remove();let t=a=>{let r=a.attributes;if(!r)return;let n=null;for(let s=0;s<r.length;s++){let o=r[s].name;_.test(o.toLowerCase())&&(n||(n=[])).push(o)}if(n)for(let s of n)a.removeAttribute(s)};t(e);for(let a of e.querySelectorAll("*"))t(a)}catch(t){typeof console<"u"&&console.warn("[clay] stripExtensionNoise skipped:",t)}}var l={FULL:"full",FROZEN:"frozen",NONE:"none"},k=["no-save","no-trigger-autosave","no-dirty","no-undo","no-watch","no-data","freeze","editor-ui","live"],A=[...m],i=g;function z(e,t){let a=new Set((e.getAttribute("clay")||"").trim().split(/\s+/).filter(Boolean));a.has(t)||(a.add(t),e.setAttribute("clay",Array.from(a).join(" ")))}var T=`${f("save")}, [save-remove]`,h='[clay~="freeze"], [freeze], [save-freeze]',y='[clay~="no-save"], [clay~="no-trigger-autosave"], [clay~="no-dirty"], [clay~="freeze"], [clay~="no-watch"], [no-save], [save-remove], [no-trigger-autosave], [no-dirty], [save-ignore], [freeze], [save-freeze], [no-watch], [mutations-ignore], [clay~="live"]',x='[clay~="no-trigger-autosave"], [no-trigger-autosave]',j='[clay~="live"]',R='[clay~="no-dirty"], [no-dirty], [save-ignore]',S='[clay~="no-save"], [clay~="no-dirty"], [clay~="freeze"], [clay~="no-watch"], [no-save], [save-remove], [no-dirty], [save-ignore], [freeze], [save-freeze], [no-watch], [mutations-ignore], [clay~="live"]',p=`${f("snapshot")}, [snapshot-remove]`,O=f("data");function I(e){let t=E(e);return!!(t&&t.closest&&t.closest(p))}function b(e){return v(e,"data")}var d={full:0,frozen:1,none:2},C=["full","frozen","none"];function E(e){return e&&e.nodeType!==1?e.parentElement:e}function L(e){let t=E(e);if(t&&t.closest&&t.closest(u))return{watched:!1,autosaveTriggered:!1,dirtyTracked:!1,undoable:!1,persist:l.FULL,extension:!0};let a=!0,r=!0,n=!1,s=!1,o=0;for(;t&&t.nodeType===1;)t.hasAttribute&&(c(t,"no-watch")&&(a=!1),i(t,"no-trigger-autosave")&&(n=!0),i(t,"no-dirty")&&(n=!0,s=!0),i(t,"live")&&(n=!0,s=!0,r=!1),c(t,"no-undo")&&(r=!1),c(t,"no-save")&&(o=Math.max(o,d.none)),i(t,"freeze")&&(o=Math.max(o,d.frozen)),i(t,"mutations-ignore")&&(a=!1),i(t,"save-remove")&&(o=Math.max(o,d.none),r=!1),i(t,"save-ignore")&&(n=!0,s=!0,r=!1),i(t,"save-freeze")&&(o=Math.max(o,d.frozen),r=!1)),t=t.parentElement;return a||(n=!0,r=!1,s=!0),o>0&&(n=!0,s=!0),{watched:a,autosaveTriggered:!n,dirtyTracked:!s,undoable:r,persist:C[o],extension:!1}}function P(e){let t=E(e);if(t&&t.closest&&t.closest(u))return!0;for(;t&&t.nodeType===1;){if(t.hasAttribute&&(c(t,"no-watch")||i(t,"mutations-ignore")))return!0;t=t.parentElement}return!1}function F(e,t){return{watched:e.watched&&t.watched,autosaveTriggered:e.autosaveTriggered&&t.autosaveTriggered,dirtyTracked:e.dirtyTracked&&t.dirtyTracked,undoable:e.undoable&&t.undoable,persist:d[e.persist]>=d[t.persist]?e.persist:t.persist,extension:e.extension||t.extension}}var D={"no-watch":e=>!e.watched,"mutations-ignore":e=>!e.watched,"no-save":e=>e.persist===l.NONE,"save-remove":e=>e.persist===l.NONE,freeze:e=>e.persist===l.FROZEN,"save-freeze":e=>e.persist===l.FROZEN,"no-trigger-autosave":e=>!e.autosaveTriggered,"no-dirty":e=>!e.dirtyTracked,"save-ignore":e=>!e.dirtyTracked,"no-undo":e=>!e.undoable};function M(e,t,a){if(e.extension)return!0;if(a&&a.length)return a.some(r=>D[r]?.(e)||!1);switch(t){case"observed":return!e.watched;case"autosave":return!e.autosaveTriggered;case"dirty":return!e.dirtyTracked;case"undo":return!e.undoable;default:return!e.watched||!e.autosaveTriggered||e.persist!==l.FULL}}var K={resolveRegionPolicy:L,isInert:P,isSnapshotRemoved:I,isDataExcluded:b,skipForPolicy:M,strictestPolicy:F,addRegionToken:z,PERSIST:l,TOKENS:A,REGION_ATTRS:k,STRIP_FROM_SAVE:T,STRIP_FROM_COMPARISON:y,STRIP_FROM_DIRTY_CHECK:S,NO_TRIGGER_AUTOSAVE_SELECTOR:x,NO_DIRTY_SELECTOR:R,SNAPSHOT_REMOVE_SELECTOR:p,NO_DATA_SELECTOR:O,FREEZE_SELECTOR:h,selectors:{stripFromSave:T,stripFromComparison:y,stripFromDirtyCheck:S,noTriggerAutosave:x,noDirty:R,snapshotRemove:p,noData:O,freeze:h}},q=K;export{u as a,_ as b,X as c,l as d,k as e,A as f,z as g,T as h,h as i,y as j,x as k,j as l,R as m,S as n,p as o,O as p,I as q,b as r,L as s,P as t,F as u,M as v,K as w,q as x};
|
package/dist/m/c-EVYAISP3.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as b,b as c,c as d,d as e,e as f}from"./c-SPZPGD3R.js";import{g as a}from"./c-4TXNLX4K.js";import"./c-EXKHPOVC.js";import"./c-L5VFATT6.js";import"./c-MWXFLW4J.js";import"./c-ZK4GIZH2.js";import"./c-W4JCVLAB.js";import"./c-7K4SCQB7.js";import"./c-WMRJKQ2V.js";import"./c-AMU3BPPR.js";import"./c-QIXT3Q7C.js";import"./c-WCXLG3MV.js";import"./c-57XDY6HC.js";import"./c-I2SCCUEW.js";import"./c-VHNSBD2M.js";export{e as ChartView,d as chartFromSlash,a as chartTables,b as insertChartAfterTable,f as refreshCharts,c as tableLabel};
|
package/dist/m/c-GRXHHFPO.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a,b,c}from"./c-UY4QX42B.js";import"./c-L7JL5TL3.js";import"./c-BJ7YQ5QZ.js";import"./c-4JZDZFF6.js";import"./c-VAK7SG37.js";import"./c-MHI3GYKF.js";import"./c-NUHP2XDB.js";import"./c-DCFSEJZG.js";import"./c-WRBKEJD4.js";import"./c-VHNSBD2M.js";export{c as default,b as dismissPersistent,a as toastPersistent};
|
package/dist/m/c-HT2DKBV2.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as d}from"./c-WNTYKCDG.js";import"./c-PZ4XEPUP.js";import{g as w,l as v,n as x,q as s}from"./c-BJ7YQ5QZ.js";import{a as p}from"./c-4JZDZFF6.js";import{e as f}from"./c-VAK7SG37.js";import{b as m}from"./c-MHI3GYKF.js";import"./c-MCOOHCSG.js";import{b as c}from"./c-NUHP2XDB.js";import{f as l}from"./c-3O7OBDCM.js";import"./c-BPF2NSPV.js";import"./c-P7KNDG34.js";import"./c-CYWLPPUS.js";import"./c-N7JPUPGC.js";import"./c-7MG5RU63.js";import"./c-XQXZAO7N.js";import"./c-S7LK4KUE.js";import"./c-VG5XIN4T.js";import"./c-2YYDMLNZ.js";import"./c-HA6INT6J.js";import"./c-DCFSEJZG.js";import"./c-WRBKEJD4.js";import"./c-VHNSBD2M.js";var $="Download a copy, then reduce its size; saving still works.",b="Download a copy to keep your work.",t=null,a=null,i=null,r=null;function h(e){return typeof e!="number"||!Number.isFinite(e)||e<0?"an unknown size":e>=1024*1024?`${(e/(1024*1024)).toFixed(1)} MB`:e>=1024?`${Math.max(1,Math.round(e/1024))} KB`:`${e} bytes`}function z({bytes:e,maxBytes:n,state:S}){let u=`At the last save attempt: ${h(e)} of ${h(n)}.`;return S==="over"?`This host can't save a file this size. ${u} ${b}`:`This file is getting large. ${u} ${$}`}function o(){if(!t)return;let e=window.visualViewport,n=e?Math.max(0,window.innerHeight-e.height-e.offsetTop):0;c(t,"bottom",`calc(${16+n}px + env(safe-area-inset-bottom,0px))`)}function y(){d({})}function A(){t=v("div",["position:fixed","left:50%","transform:translateX(-50%)","z-index:2147483000","display:flex","align-items:center","gap:10px 12px","width:max-content","max-width:calc(100vw - 24px)","flex-wrap:wrap","padding:8px 8px 8px 14px","text-align:left",`color-scheme:${p()}`]),t.setAttribute("clay","editor-ui"),t.setAttribute("data-clay-save-size",""),t.setAttribute("role","status"),a=x("span",[],""),i=w("Download my copy",{small:!0,onClick:y}),s(i,!1,"inline-flex"),t.append(a,i),document.body.appendChild(t),o(),window.visualViewport?.addEventListener("resize",o),window.visualViewport?.addEventListener("scroll",o)}function M(e){t||A(),a.textContent=z(e),s(i,e.state==="over","inline-flex"),o(),m(t,{background:f.surface})}function E(){t&&(window.visualViewport?.removeEventListener("resize",o),window.visualViewport?.removeEventListener("scroll",o),t.remove(),t=null,a=null,i=null)}function g(e){let n=e?.detail;n&&(n.state==="near"||n.state==="over"?M(n):E())}function k(){l||L()}function N(e){l&&(r||=new AbortController,document.addEventListener("clay:save-size",g,{signal:r.signal}),document.addEventListener("clay:modechange",k,{signal:r.signal}),e?.type==="clay:save-size"&&g(e))}function L(){r?.abort(),r=null,E()}export{N as start,L as stop};
|
package/dist/m/c-MCOOHCSG.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
function r(t=location.pathname){let o=t.split("/").filter(Boolean).pop();if(!o)return t.endsWith("/")||t===""?"index":"page";let l=o;try{l=decodeURIComponent(o)}catch{}return l.replace(/\.(html?|htmlclay)$/i,"")||"page"}function c({html:t,name:o,type:l="text/html"}){let n=null;try{n=URL.createObjectURL(new Blob([t],{type:l}));let e=document.createElement("a");return e.setAttribute("clay","no-save no-watch no-snapshot"),e.href=n,e.download=o,e.style.setProperty("display","none","important"),document.body.appendChild(e),e.click(),e.remove(),setTimeout(()=>URL.revokeObjectURL(n),4e4),!0}catch(e){return console.error("clayjs: could not build the download",e),n&&URL.revokeObjectURL(n),!1}}export{r as a,c as b};
|
package/dist/m/c-VILENZTD.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var o={table:{types:["table"],views:["table","table_cell"],module:"page/features/table.js",load:()=>import("./c-TTB5EK4S.js")},board:{types:["board"],module:"page/features/board.js",load:()=>import("./c-W6DQSHXI.js")},chart:{types:["chart"],views:["chart"],module:"page/features/chart.js",load:()=>import("./c-5ONTYIUI.js")},checklist:{types:[],views:[],match:e=>e.type.name==="list_item"&&e.attrs.kind==="check",module:"page/features/checklist.js",load:()=>import("./c-K3ADYNLU.js")},code:{types:["code_block"],module:"page/features/code.js",load:()=>import("./c-OPLUZR3A.js")},toc:{types:["toc"],module:"page/features/toc.js",load:()=>import("./c-URSMSFCB.js")},titleIcon:{types:[],views:["heading"],match:e=>e.attrs.pageIcon!=null||e.attrs.pageCoverSrc!=null,module:"page/features/title-icon.js",load:()=>import("./c-PLN76GF3.js")},media:{types:["image","file"],module:"page/features/media.js",load:()=>import("./c-KP64LT2A.js")},tool:{types:["tool"],module:"page/features/tool.js",boot:["page/tools.js","page/tool-data.js"],load:()=>import("./c-CCQ25GFY.js")}},r=e=>Object.keys(o).find(t=>o[t].types.includes(e))??null,s=e=>{for(let t of Object.keys(o)){let a=o[t];if(a.match?a.match(e):a.types.includes(e.type.name))return t}return null},l={mentions:{module:"page/features/mentions.js",load:()=>import("./c-X5TSXZYJ.js")},dates:{module:"page/features/dates.js",load:()=>import("./c-372N6H3B.js")},emoji:{module:"page/features/emoji.js",load:()=>import("./c-HMV6P4RX.js")},titleIcon:{module:"page/features/title-icon.js",load:()=>import("./c-PLN76GF3.js")},titleCover:{module:"page/features/title-cover.js",load:()=>import("./c-YBKHUAK7.js")},exportHtml:{module:"page/features/export-html.js",load:()=>import("./c-DKLS74XB.js")},importMarkdown:{module:"page/features/import-markdown.js",load:()=>import("./c-COPTL5WB.js")},exportMarkdown:{module:"page/features/export-markdown.js",load:()=>import("./c-ERQSNR6K.js")}};export{o as a,r as b,s as c,l as d};
|
package/dist/m/c-VR2BJ4AN.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{e as a,f as b,g as c}from"./c-TJAXGIRV.js";import"./c-BWFVSBDF.js";import"./c-XGH4GS2T.js";import"./c-3O7OBDCM.js";import"./c-BPF2NSPV.js";import"./c-P7KNDG34.js";import"./c-CYWLPPUS.js";import"./c-N7JPUPGC.js";import"./c-HA6INT6J.js";import"./c-DCFSEJZG.js";import"./c-WRBKEJD4.js";import"./c-VHNSBD2M.js";export{a as PresenceStore,c as default,b as presence};
|
package/dist/m/c-WGW764WX.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a,b,c,d,e}from"./c-2KL3BD52.js";import"./c-UY4QX42B.js";import"./c-BRLCTNMC.js";import"./c-QHWJ5ZIJ.js";import"./c-UL2YUY52.js";import"./c-L7JL5TL3.js";import"./c-CJFDLD43.js";import"./c-BJ7YQ5QZ.js";import"./c-4JZDZFF6.js";import"./c-VAK7SG37.js";import"./c-MHI3GYKF.js";import"./c-46XYM55L.js";import"./c-NUHP2XDB.js";import"./c-VKEDWYDF.js";import"./c-DCFSEJZG.js";import"./c-WRBKEJD4.js";import"./c-VHNSBD2M.js";export{a as ask,b as consent,e as init,d as snippet,c as tell};
|
package/dist/m/c-WNTYKCDG.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{b as f}from"./c-PZ4XEPUP.js";import{a as d,b as p}from"./c-MCOOHCSG.js";import{K as y,L as i}from"./c-7MG5RU63.js";function m(e=new Date){let t=r=>String(r).padStart(2,"0");return`${e.getFullYear()}${t(e.getMonth()+1)}${t(e.getDate())}-${t(e.getHours())}${t(e.getMinutes())}${t(e.getSeconds())}`}function g(e,t){let n=`<script type="application/json" id="clay-lost-edits" clay="no-save">${JSON.stringify(t).replace(/</g,"\\u003c")}<\/script>`,s=e.lastIndexOf("</body>");return s>=0?e.slice(0,s)+n+e.slice(s):e+n}function k(e,{refused:t=!1}={}){let r=window.clay?.conflicts||null,n=[],s=new Set;for(let o of e){let a=r?.recoveryOf(o.id);a&&!s.has(a.id)&&(s.add(a.id),n.push(a))}n.sort((o,a)=>(o.ticket||0)-(a.ticket||0));let u=o=>y(o.recoveryRoot??o.root,{prepared:o.domain==="save"}),c,l;t||!n.length?(c=i(),l=n):(c=u(n[n.length-1]),l=n.slice(0,-1));let h=e.map(o=>{if(o.kind==="apply-incomplete")return{id:o.id,kind:"apply-incomplete",name:"Sync update that did not finish",error:o.error??null};let{id:a,name:w,kind:$,yours:S,now:O,sentence:b}=f(o);return{id:a,name:w,kind:$,yours:S,now:O,sentence:b}}),v={format:"clay-lost-edits",version:1,savedAt:new Date().toISOString(),page:location.href,refused:!!t,edits:h,earlierPages:l.map(o=>({applyId:o.id,source:o.source,html:u(o)}))};return{html:g(c,v),name:`${d()}-${t?"my-version":"my-copy"}-${m()}.html`}}function A({html:e=null,edits:t=[]}={}){try{let r=typeof e=="string"?e:i(),n={format:"clay-lost-edits",version:1,savedAt:new Date().toISOString(),page:location.href,refused:!1,edits:Array.isArray(t)?t:[],earlierPages:[]};return p({html:g(r,n),name:`${d()}-my-copy-${m()}.html`})}catch(r){return console.error("clayjs: could not build the download",r),!1}}function D(e,{refused:t=!1}={}){try{let{html:r,name:n}=k(e,{refused:t});return p({html:r,name:n})}catch(r){return console.error("clayjs: could not build the download",r),!1}}export{A as a,D as b};
|
package/dist/m/c-YBSS55KU.js
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import{A as ee,D as te,G as oe,H as ne,I as re,i as J}from"./c-YCLU4UNT.js";import"./c-DHBRA6DL.js";import"./c-L3F5ZLIV.js";import{a as X}from"./c-WNTYKCDG.js";import"./c-PZ4XEPUP.js";import"./c-JRKY44DK.js";import"./c-EXKHPOVC.js";import"./c-L5VFATT6.js";import"./c-7K4SCQB7.js";import"./c-WMRJKQ2V.js";import{H as K,J as Q,O as Z,a as G,b as H,m as z}from"./c-QIXT3Q7C.js";import{b as Y}from"./c-L7JL5TL3.js";import"./c-MCOOHCSG.js";import"./c-57XDY6HC.js";import"./c-I2SCCUEW.js";import"./c-7MG5RU63.js";import"./c-XQXZAO7N.js";import"./c-S7LK4KUE.js";import"./c-VG5XIN4T.js";import"./c-2YYDMLNZ.js";import"./c-HA6INT6J.js";import"./c-DCFSEJZG.js";import"./c-WRBKEJD4.js";import"./c-VHNSBD2M.js";var pe="Work from an earlier session could not be put back. Read it, download it, or recover it as a copy.",le=`
|
|
2
|
-
:host { font: inherit !important; color: inherit !important; }
|
|
3
|
-
.page-recovery-root { display: contents; }
|
|
4
|
-
.page-recovery { position: fixed; right: 16px; bottom: 16px; z-index: 20; min-height: 36px; padding: 0 14px; font: inherit; font-size: 14px; color: var(--page-ink); background: var(--page-pop-bg); border: 1px solid var(--page-chrome-line-rest); border-radius: 999px; cursor: pointer; }
|
|
5
|
-
.page-recovery[hidden], .page-recovery-panel[hidden] { display: none; }
|
|
6
|
-
.page-recovery-panel { position: fixed; right: 16px; bottom: 64px; z-index: 21; width: min(420px, calc(100vw - 32px)); max-height: 60vh; overflow-y: auto; color: var(--page-ink); background: var(--page-pop-bg); border: 1px solid var(--page-chrome-line-rest); border-radius: var(--page-chrome-radius); padding: 8px; box-sizing: border-box; }
|
|
7
|
-
.page-recovery-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 4px 6px 8px; font-weight: 600; }
|
|
8
|
-
.page-recovery-note { margin: 0 6px 8px; font-size: 13px; opacity: .72; }
|
|
9
|
-
.page-recovery-failure { margin: 0 6px 8px; font-size: 13px; color: var(--page-warn, #b25b00); }
|
|
10
|
-
.page-recovery-row { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; align-items: center; min-height: 44px; padding: 8px 6px; border-top: 1px solid var(--page-chrome-line-rest); }
|
|
11
|
-
.page-recovery-meta { grid-column: 1; font-size: 12px; opacity: .72; }
|
|
12
|
-
.page-recovery-text { grid-column: 1; overflow-wrap: anywhere; white-space: pre-wrap; }
|
|
13
|
-
.page-recovery-row button, .page-recovery-head button { grid-column: 2; grid-row: 1 / span 2; min-height: 36px; padding: 0 12px; font: inherit; font-size: 14px; color: inherit; background: transparent; border: 1px solid var(--page-chrome-line-rest); border-radius: var(--page-chrome-radius); cursor: pointer; }
|
|
14
|
-
.page-recovery-row.is-busy button { opacity: .6; cursor: progress; }
|
|
15
|
-
@media (max-width: 560px) {
|
|
16
|
-
.page-recovery { top: 12px; bottom: auto; min-height: 44px; }
|
|
17
|
-
.page-recovery-panel { left: 0; right: 0; bottom: 0; width: 100%; max-height: 70vh; border-radius: var(--page-chrome-radius) var(--page-chrome-radius) 0 0; }
|
|
18
|
-
.page-recovery-row button, .page-recovery-head button { min-height: 44px; }
|
|
19
|
-
}
|
|
20
|
-
`,ae=280,u=(i,r,o,s={})=>{let c=i.createElement(r);o&&(c.className=o);for(let[b,w]of Object.entries(s))c.setAttribute(b,w);return c},ue=i=>Object.keys(i).sort((r,o)=>{let s=typeof i[r]?.pos=="string"?i[r].pos:"",c=typeof i[o]?.pos=="string"?i[o].pos:"";return s!==c?s<c?-1:1:r<o?-1:r>o?1:0});function fe(i){let r=ue(i??{}),o=new Map(r.map(c=>[c,Q()])),s=K(null,null,r.length);return r.map((c,b)=>{let w=i[c],p=typeof w?.parent=="string"?o.get(w.parent)??null:null;return{...w,id:o.get(c),pos:s[b],parent:p}})}function ge(i){let r=[];for(let o of fe(i)){let s=null;try{s=Z(z,o.id,o)}catch{s=null}!s&&typeof o.c=="string"&&o.c&&(s=z.nodes.paragraph.create({id:o.id,pos:o.pos,parent:o.parent},z.text(o.c))),s&&r.push(s)}return r}function he(i,r){if(!i||!i.state)return{ok:!1,code:"no-editor"};let o=ge(r??{});if(!o.length)return{ok:!1,code:"nothing-to-copy"};let s=i.state,c=s.tr.insert(s.doc.content.size,G.Fragment.from(o));return c.setSelection(H.Selection.near(c.doc.resolve(c.doc.content.size-1))),i.dispatch(c.scrollIntoView()),{ok:!0,ids:o.map(b=>b.attrs.id)}}var ie=(i,r)=>{let o=u(i,"div","page-recovery-text");return o.textContent=r.length>ae?`${r.slice(0,ae)}\u2026`:r,o};async function ye(i){try{return await navigator.clipboard.writeText(i),!0}catch{}let r=globalThis.document?.createElement("textarea");if(!r)return!1;r.value=i,r.style.setProperty("position","fixed","important"),r.style.setProperty("opacity","0","important"),globalThis.document.body?.append(r),r.select();let o=!1;try{o=globalThis.document.execCommand?.("copy")===!0}catch{}return r.remove(),o}function Ee({mount:i,getView:r=()=>null,getJournal:o=()=>null,service:s=globalThis.window?.clay?.recovery??null,isCurrent:c=()=>!0,onCopied:b=()=>{},onCovered:w=()=>{}}={}){let p=i.ownerDocument,y=u(p,"button","page-recovery",{type:"button","aria-haspopup":"dialog","aria-expanded":"false"}),l=u(p,"div","page-recovery-panel",{role:"dialog","aria-label":"Recover work"});y.hidden=!0,l.hidden=!0;let $=u(p,"div","page-recovery-root");$.append(y,l);let se=Y({name:"page-recovery",content:$,css:[le],parent:i}),m=[],f=[],v=null,C=new Set,I=new Set,E=null,x=null,L=!1,_=()=>m.length+f.length,ce=()=>{if(E)return E;try{E=ee(s)}catch{E=null}return E},j=()=>{if(x)return x;try{x=ne({channel:oe(s),key:o()?.key??""})}catch{x=null}return x},T=()=>{l.hidden=!0,y.setAttribute("aria-expanded","false")},M=()=>{let e=[];for(let n of m)e.push({id:n.id,kind:"recovered-page",name:n.message,yours:n.text,now:"",sentence:n.message});let t="Text typed while composing never reached the page.";for(let n of f)e.push({id:n.id,kind:"composing",name:"Typed text",yours:n.text,now:"",sentence:t});X({html:null,edits:e})||(v="That download could not be made."),k()};async function O(e){if(!e||I.has(e.id)||C.has(e.id))return{ok:!1,code:"busy"};I.add(e.id),v=null,k();try{if(!c())return{ok:!1,code:"stale"};let t=o(),n=t?.channel??null,a=ce(),d=await te({channel:n,copies:a,source:{key:t?.key??"",id:e.id,revision:e.revision},insert:async()=>{if(!c())throw new Error("stale");let g=r();if(!g)throw new Error("no-editor");let h=t?.next?t.next():null,B=e.blocks??J({capsule:e.capsule,batches:e.batches??[]}),U=he(g,B);if(!U.ok)throw new Error(U.code);if(!h)throw new Error("no-journal");let D=await h;if(!D)throw new Error("not-stored");return{key:t?.key??"",id:D.id,revision:D.revision}}});return!d.ok&&!c()?{ok:!1,code:"stale"}:(d.ok?(C.add(e.id),b(e,d)):d.code==="insert-failed"?v="That copy could not be stored on this device. It is still here to try again.":d.code==="already-copied"?(C.add(e.id),v="This work was already recovered as a copy."):d.code==="covered"?w(e):d.code!=="stale"&&d.code!=="busy"&&(v="Recovery is unavailable here. Download the copy instead."),d)}finally{I.delete(e.id),L||k()}}async function V(e){if(!e||!x)return{ok:!1,code:"unavailable"};let t=f.find(n=>n.id===e.id);if(!t)return{ok:!1,code:"unknown"};try{let n=await x.channel.dismiss(t.id,{revision:t.revision});return n?.ok&&(f=f.filter(a=>a.id!==t.id)),k(),n}catch{return{ok:!1,code:"error"}}}let S=(e,t)=>{let n=u(p,"button","",{type:"button"});return n.textContent=e,n.addEventListener("click",t),n};function k(){l.replaceChildren();let e=u(p,"div","page-recovery-head");e.append(p.createTextNode("Recover work")),e.append(S("Download",M));let t=S("Close",()=>{T(),y.focus()});e.append(t);let n=u(p,"p","page-recovery-note");if(n.textContent=pe,l.append(e,n),v){let a=u(p,"p","page-recovery-failure");a.textContent=v,l.append(a)}for(let a of m){let d=u(p,"div","page-recovery-row",{"data-capsule":String(a.id)});I.has(a.id)&&d.classList.add("is-busy");let g=u(p,"div","page-recovery-meta");g.textContent=`${a.message}${C.has(a.id)?" \xB7 Recovered as a copy":""}`;let h=S("Recover as a copy",()=>O(a));h.disabled=I.has(a.id)||C.has(a.id),d.append(g,ie(p,a.text||"(no text)"),h),l.append(d)}for(let a of f){let d=u(p,"div","page-recovery-row",{"data-composing":a.blockId}),g=u(p,"div","page-recovery-meta");g.textContent="Text typed while composing. It never reached the page.",d.append(g,ie(p,a.text));let h=u(p,"div","");h.append(S("Copy",async()=>{await ye(a.text)||(v="Could not copy. Select the text instead."),k()}),S("Dismiss",()=>V(a))),d.append(h),l.append(d)}}let W=()=>_()?(l.hidden=!1,y.setAttribute("aria-expanded","true"),k(),l.querySelector("button")?.focus(),!0):!1;y.addEventListener("click",()=>l.hidden?W():T()),l.addEventListener("keydown",e=>{e.key==="Escape"&&(e.stopPropagation(),T(),y.focus())});let A=new Map,F=e=>{let n=e?.target?.closest?.("[data-id]")??null;return{blockId:n?.getAttribute?.("data-id")??null,text:n?.textContent??""}},R=e=>{let t=F(e);t.blockId&&(A.set(t.blockId,t.text),j()?.keep(t))},N=e=>{let t=F(e),n=A.get(t.blockId);A.delete(t.blockId);let a=j();if(!a)return;let d=o(),g=t.text||n||"",h=d?.covers?d.covers(t.blockId,g):!1;a.clear({blockId:t.blockId,text:g,covered:h}).then(B=>{B?.ok&&P()},()=>{})};function de(e){return e?(e.addEventListener("compositionstart",R),e.addEventListener("compositionupdate",R),e.addEventListener("compositionend",N),()=>{e.removeEventListener("compositionstart",R),e.removeEventListener("compositionupdate",R),e.removeEventListener("compositionend",N)}):()=>{}}async function P(){let e=j();if(!e||L)return f;let t=null;try{t=await e.list()}catch{t=null}return L||(f=t?.ok?re(t.records):[],q({rows:m,refreshText:!1})),f}function q({rows:e=m,refreshText:t=!0}={}){m=(e||[]).map(a=>({...a}));let n=_();return y.hidden=n===0,y.textContent=`Recover work (${n})`,n?l.hidden||k():T(),t&&P(),m}return{open:W,close:T,download:M,recover:O,dismiss:V,refresh:P,watch:de,update:q,get count(){return _()},get rows(){return m},get journaled(){return f},destroy(){L=!0,se.remove(),x=null,E=null}}}export{pe as REVIEW_TEXT,fe as copyBlocks,ge as copyNodes,Ee as createRecoveryReview,he as insertCopy};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a,b,c}from"../c-T637T7SN.js";import"../c-4ASQPRQL.js";import"../c-GQ6F6IDK.js";import"../c-I2SCCUEW.js";import"../c-5VYOWDTI.js";import"../c-FWKHM4E7.js";import"../c-X5LNHET5.js";import"../c-WYFDLITL.js";import"../c-UGHH4MB3.js";import"../c-ZWIOJGMT.js";import"../c-B7J4K2AE.js";import"../c-ATKAOH23.js";import"../c-EK63G3CG.js";import"../c-NQJRVJ56.js";import"../c-XGH4GS2T.js";import"../c-IJUK2GPW.js";import"../c-3O7OBDCM.js";import"../c-BPF2NSPV.js";import"../c-P7KNDG34.js";import"../c-CYWLPPUS.js";import"../c-N7JPUPGC.js";import"../c-7MG5RU63.js";import"../c-XQXZAO7N.js";import"../c-S7LK4KUE.js";import"../c-VG5XIN4T.js";import"../c-2YYDMLNZ.js";import"../c-HA6INT6J.js";import"../c-DCFSEJZG.js";import"../c-WRBKEJD4.js";import"../c-VHNSBD2M.js";export{c as bytesUnsaved,b as hasUnsavedChanges,a as reloadAfterDiscard};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{f as W}from"./c-46XYM55L.js";import{a as J}from"./c-GY422N3Q.js";import"./c-7SWMYKAI.js";import{b as V}from"./c-QTTJYJMA.js";import{a as $}from"./c-VKEDWYDF.js";import"./c-UGHH4MB3.js";import"./c-ZWIOJGMT.js";import"./c-IJUK2GPW.js";import{b as F}from"./c-CYWLPPUS.js";import{i as H}from"./c-VG5XIN4T.js";import{a as G}from"./c-2YYDMLNZ.js";import{c as B,l as z}from"./c-HA6INT6J.js";import"./c-DCFSEJZG.js";import"./c-WRBKEJD4.js";import"./c-VHNSBD2M.js";var X={always:["lib/mutation.js","core/preserve-authored.js","core/edit-mode.js","core/mode-key.js","core/stale-host-notice.js","core/page-data.js"],editOnly:["core/snapshot.js","core/persist.js","core/admin-attrs.js","core/save-core.js","core/save.js","core/conflict-notice.js","core/recovery.js","core/unsaved-warning.js","core/autosave.js","attrs/save-freeze.js","attrs/onaftersave.js","attrs/refetch-on-save.js","attrs/add-from.js","lib/cache-bust.js"]},w={richclay:{path:"plugins/richclay.js",editOnly:!0,default:!0},indicator:{path:"plugins/indicator.js",editOnly:!0,default:!1},sync:{path:"sync/live-sync.js",editOnly:!1,default:!1},live:{path:"plugins/live.js",editOnly:!1,default:!1},page:{path:"plugins/page.js",editOnly:!0,default:!1},"page-view":{path:"plugins/page-view.js",editOnly:!1,default:!1,internal:!0},sortable:{path:"plugins/sortable.js",editOnly:!0,default:!1},undo:{path:"plugins/undo.js",editOnly:!0,default:!1},unsent:{path:"plugins/unsent.js",editOnly:!0,default:!1},cms:{path:"plugins/cms.js",editOnly:!1,default:!1},quickcrop:{path:"plugins/quickcrop.js",editOnly:!1,default:!1},upload:{path:"plugins/upload.js",editOnly:!0,default:!1},people:{path:"plugins/people.js",editOnly:!1,default:!1},menu:{path:"plugins/menu.js",editOnly:!1,default:!1},wire:{path:"plugins/wire.js",editOnly:!1,default:!1},message:{path:"plugins/message.js",editOnly:!1,default:!1},"ai-edit":{path:"plugins/ai-edit.js",editOnly:!0,default:!1},demo:{path:"plugins/demo.js",editOnly:!1,default:!1},source:{path:"plugins/source.js",editOnly:!0,default:!0},"visitor-drafts":{path:"plugins/visitor-drafts.js",ownerPath:"plugins/visitor-drafts-owner.js",editOnly:!1,default:!1},"bind-text":{path:"plugins/bind-text.js",editOnly:!0,default:!1},derive:{path:"plugins/derive.js",editOnly:!1,default:!1},upgrade:{path:"plugins/upgrade.js",editOnly:!1,default:!1}},b={"core/is-edit-mode.js":()=>import("./core/is-edit-mode-GCX6767E.js"),"core/draft-mode.js":()=>import("./core/draft-mode-WSQAT67S.js"),"lib/region-policy.js":()=>import("./lib/region-policy-SB2AWVG5.js"),"lib/mutation.js":()=>import("./reader-core-4W2KYEWQ.js").then(t=>t.core["lib/mutation.js"]),"core/edit-mode.js":()=>import("./reader-core-4W2KYEWQ.js").then(t=>t.core["core/edit-mode.js"]),"core/mode-key.js":()=>import("./reader-core-4W2KYEWQ.js").then(t=>t.core["core/mode-key.js"]),"core/stale-host-notice.js":()=>import("./reader-core-4W2KYEWQ.js").then(t=>t.core["core/stale-host-notice.js"]),"core/page-data.js":()=>import("./reader-core-4W2KYEWQ.js").then(t=>t.core["core/page-data.js"]),"core/preserve-authored.js":()=>import("./reader-core-4W2KYEWQ.js").then(t=>t.core["core/preserve-authored.js"]),"core/snapshot.js":()=>import("./core/snapshot-NU3YM6GR.js"),"core/save-core.js":()=>import("./core/save-core-MKRPSEEO.js"),"core/save.js":()=>import("./core/save-LYY7K6U7.js"),"core/conflict-notice.js":()=>import("./core/conflict-notice-IWHMHH43.js"),"core/recovery.js":()=>import("./core/recovery-DRFZRJED.js"),"core/unsaved-warning.js":()=>import("./core/unsaved-warning-7QTKEN7Z.js"),"core/persist.js":()=>import("./core/persist-UKXV5KLA.js"),"core/admin-attrs.js":()=>import("./core/admin-attrs-YY7T5FGU.js"),"core/autosave.js":()=>import("./core/autosave-S6OMNDCK.js"),"attrs/save-freeze.js":()=>import("./attrs/save-freeze-LWGF6XUN.js"),"attrs/onaftersave.js":()=>import("./attrs/onaftersave-OKSWEJQF.js"),"attrs/refetch-on-save.js":()=>import("./attrs/refetch-on-save-ZUE7PSCI.js"),"attrs/add-from.js":()=>import("./attrs/add-from-T5LJXFFI.js"),"lib/cache-bust.js":()=>import("./lib/cache-bust-MUMFXZK6.js"),"plugins/richclay.js":()=>import("./plugins/richclay-KLGETK77.js"),"plugins/indicator.js":()=>import("./plugins/indicator-4VDXWYTD.js"),"sync/live-sync.js":()=>import("./sync/live-sync-MO5DH33W.js"),"plugins/live.js":()=>import("./plugins/live-AD4H6XSL.js"),"plugins/page.js":()=>import("./plugins/page-MD3T2ZX3.js"),"plugins/page-view.js":()=>import("./plugins/page-view-PAWVZNFY.js"),"plugins/sortable.js":()=>import("./plugins/sortable-4S6SQC3D.js"),"plugins/undo.js":()=>import("./plugins/undo-NLPGCJQY.js"),"plugins/unsent.js":()=>import("./plugins/unsent-OA4RGBUT.js"),"plugins/cms.js":()=>import("./plugins/cms-LRAOZHT7.js"),"plugins/quickcrop.js":()=>import("./plugins/quickcrop-BQ5YYFCH.js"),"plugins/upload.js":()=>import("./plugins/upload-NHGJXZK2.js"),"plugins/people.js":()=>import("./plugins/people-JCHVPF7P.js"),"plugins/menu.js":()=>import("./plugins/menu-M5WW7DBF.js"),"plugins/wire.js":()=>import("./plugins/wire-VBWXEXU2.js"),"plugins/message.js":()=>import("./plugins/message-LQ6EDH4V.js"),"plugins/ai-edit.js":()=>import("./plugins/ai-edit-UTV7YO2I.js"),"plugins/demo.js":()=>import("./plugins/demo-OYO5GCAO.js"),"plugins/visitor-drafts.js":()=>import("./plugins/visitor-drafts-BW43DGY3.js"),"plugins/visitor-drafts-owner.js":()=>import("./plugins/visitor-drafts-owner-7ODQG7JX.js"),"plugins/bind-text.js":()=>import("./plugins/bind-text-NX46N5UV.js"),"plugins/source.js":()=>import("./plugins/source-TJXOIOYY.js"),"plugins/derive.js":()=>import("./plugins/derive-FRE5JJQE.js"),"plugins/upgrade.js":()=>import("./plugins/upgrade-HSUNDNJD.js")},ie=["visitor-drafts","richclay","indicator","sortable","undo","unsent","quickcrop","upload","people","menu","upgrade","cms","page-view","sync","live","page","message","wire","ai-edit","demo","derive","bind-text","source"],re={cms:["quickcrop","upload"],"ai-edit":["wire"],page:["live","sync","upload"]},ae={page:["richclay"]},ce=new Set(["source","sortable","menu","upgrade"]);function K(t,e,o,s){let u=t.get(e);if(u)for(let n of u.split(",")){let r=n.trim();if(r){if(!w[r]||w[r].internal){console.warn(`clayjs: unknown plugin "${r}"`);continue}s(o,r)}}}var le=["sync","live","page","upload","quickcrop","cms","people","menu","upgrade","wire","ai-edit","demo","source"],ue=["attrs/refetch-on-save.js","core/conflict-notice.js"],de="https://hyperclay.com/templates/";function P(t,e,{isDraftMode:o=!1,hasSap:s=!1,hasVariants:u=!1,canEdit:n=!1,templateSource:r=null}={}){let g=[...X.always];e&&g.push(...X.editOnly);let m=new Set;K(t,"plugins",m,(i,l)=>i.add(l));let a=new Set;K(t,"exclude",a,(i,l)=>i.add(l));let d=new Set(m);for(let[i,l]of Object.entries(w))l.default&&d.add(i);s&&d.add("derive"),u&&(e||n)&&d.add("menu"),a.has("wire")&&d.delete("ai-edit"),!e&&!o&&d.has("page")&&d.add("page-view");for(let i of[...d])if(!a.has(i)&&!(w[i].editOnly&&!e))for(let l of re[i]||[])d.add(l);for(let i of a)d.delete(i);if(o){for(let i of le)d.delete(i);for(let i of ue){let l=g.indexOf(i);l>-1&&g.splice(l,1)}d.add("visitor-drafts")}!o&&n&&!a.has("upgrade")&&r&&r.startsWith(de)&&d.add("upgrade");for(let[i,l]of Object.entries(ae))if(d.has(i))for(let v of l)m.has(v)||d.delete(v);let c=[],h=[];for(let i of ie){if(!d.has(i))continue;let l=w[i];l.editOnly&&!e||(ce.has(i)?h:c).push(l.ownerPath&&!o?l.ownerPath:l.path)}return{core:g,plugins:c,late:h}}var C="data-deleted-at",R=(t,e)=>window.clay?.undo?.commit?window.clay.undo.commit(t,e):e(),Q=(t,e)=>t.dispatchEvent(new CustomEvent(e,{bubbles:!0})),I=Object.assign((t,{at:e=new Date().toISOString()}={})=>(R("Move to Trash",()=>t.setAttribute(C,e)),Q(t,"clay:trashed"),{undo:()=>I.restore(t)}),{is:t=>!!t.getAttribute(C),restore(t){R("Restore",()=>t.removeAttribute(C)),Q(t,"clay:restored")},purge(t){R("Delete forever",()=>t.remove())}});var Y=50,pe=1e3,fe='[clay~="no-snapshot"], [no-snapshot], [snapshot-remove]',L=0,ge=t=>{let e=t.nodeType===1?t:t.parentElement;if(!e)return"a detached node";let o=e.localName;return e.id?o+="#"+e.id:e.classList.length&&(o+="."+[...e.classList].slice(0,2).join(".")),"<"+o+">"};function me(t){let e=window.clay?.region?.resolveRegionPolicy;if(!e)return null;let o=s=>!!s&&!s.closest(fe)&&e(s).dirtyTracked;for(let s of t){if(s.type==="attributes"&&z(s.attributeName,s.target))continue;let u=s.target.nodeType===1?s.target:s.target.parentElement;if(o(u)&&!(s.type==="childList"&&![...s.addedNodes,...s.removedNodes].some(n=>n.nodeType!==1||o(n))))return s.target}return null}function _(t){let e=window.clay,o=e.Mutation,s=new Set,u=(y,p)=>{s.has(y)||(s.add(y),console.warn("clay.effect: "+p))},n=!1,r=!1,g=0,m=0;L&&e.isEditMode&&console.warn("clay.effect: an effect was created inside another effect, so a new one starts on every run. Create effects once, in clay.start.");let a=()=>{let y=Date.now();y-g>pe&&(g=y,m=0),++m>Y&&u("loop",`this effect ran more than ${Y} times in a second. Something keeps changing the document, often a timer or async callback the effect started.`)},d=()=>{if(n=!1,r)return;let y=null;o.pause(),L++;try{e.isEditMode===!0&&(a(),s.has("saved")||(y=new MutationObserver(()=>{}),y.observe(document.documentElement,{subtree:!0,childList:!0,attributes:!0,characterData:!0})));let p=t();p&&typeof p.then=="function"&&(v(),console.error("clay.effect: fn returned a promise. It must be synchronous, so this effect was stopped."))}catch(p){console.error("clay.effect:",p)}finally{L--,o.resume();let p=y?y.takeRecords():[];if(y?.disconnect(),p.length){let O=me(p);O&&u("saved",`this effect changed ${ge(O)}, which is saved with the file. Effect writes never mark the page unsaved, so a merge can leave it dirty with no save scheduled. Draw derived values inside clay="no-dirty" or clay="editor-ui".`)}}},c=()=>{n||r||(n=!0,queueMicrotask(d))},h=["undo","redo"],i=()=>{for(let y of h)e.undo?.on?.(y,c)},l=o.onAnyChange({debounce:0,require:"observed"},c);document.addEventListener("clay:sync-applied",c),document.addEventListener("clay:modechange",i),i();let v=()=>{r=!0,l(),document.removeEventListener("clay:sync-applied",c),document.removeEventListener("clay:modechange",i);for(let y of h)e.undo?.off?.(y,c)};return c(),v}Object.defineProperty(_,"running",{get:()=>L>0});var he={overtype:()=>import("./c-PQ5LK6QE.js"),marked:()=>import("./c-XN6MBKI6.js"),highlight:()=>import("./c-33JJ6CBX.js"),"highlight/bash":()=>import("./c-KI7M4AY3.js"),"highlight/css":()=>import("./c-H4LG442Q.js"),"highlight/javascript":()=>import("./c-VDSS4K3Z.js"),"highlight/json":()=>import("./c-NRPJEVJS.js"),"highlight/python":()=>import("./c-5YIHJ3TJ.js"),"highlight/xml":()=>import("./c-WN5AY3OZ.js"),uimotion:()=>import("./c-B5CS55WR.js")};function ye(t){let e=new Map;function o(s){return Object.hasOwn(t,s)?(e.has(s)||e.set(s,t[s]().catch(u=>{throw e.delete(s),u})),e.get(s)):Promise.reject(new Error(`clay.assets: no asset named "${s}"`))}return{load:o,names:()=>Object.keys(t)}}var Z=ye(he);function M(t,e){if(!t||!e)return t;let o={...e,...t};for(let s of["entries","imports","bootImports"])o[s]={...e[s],...t[s]};return o}var je="plugins/page.js";function k(t,e,{isEditMode:o=!1,isDraftMode:s=!1,hasSapJs:u=!1}={},n=document){if(!t?.entries)return 0;let r=[...e];for(let c of e)for(let h of t.bootImports?.[c]??[])u&&h==="vendor/sap-core.vendor.js"||r.push(h);o&&!s&&r.push(...t.editBootImports??[]),o&&!s&&e.includes(je)&&r.push(...t.editorBootImports??[]);let g=new Set,m=c=>{if(!(!c||g.has(c))){g.add(c);for(let h of t.imports?.[c]??[])m(h)}};for(let c of r)m(t.entries[c]);let a=new Set([...n.querySelectorAll('link[rel="modulepreload"]')].map(c=>c.href)),d=0;for(let c of g){let h=new URL(c,t.base).href;if(a.has(h))continue;let i=n.createElement("link");i.rel="modulepreload",i.href=h,i.setAttribute("clay","no-save"),n.head.append(i),d++}return d}var E=Object.fromEntries(Object.entries(w).flatMap(([t,e])=>e.ownerPath?[[e.path,t],[e.ownerPath,t]]:[[e.path,t]])),j={},ee=new Set;function se(t){ee.has(t)||(ee.add(t),document.dispatchEvent(new CustomEvent("clay:plugin-ready",{detail:{plugin:E[t]}})))}var ve=(t,e,o,s)=>()=>t().then(u=>(k(M(e,u),[...o.core,...o.plugins,...o.late],{isEditMode:!0,hasSapJs:s}),u));function we(){return new Promise(t=>$(t))}function A(){let t=document.querySelector('meta[name="hyper-source"]');return t?t.getAttribute("content"):null}async function He(t,e,o,s=null,u=null,n=null){W(),(await b["core/draft-mode.js"]()).noteBootParams(e),await we();let g=await b["core/is-edit-mode.js"](),{isEditMode:m,isDraftMode:a,isOwner:d,siteVisibility:c,canEdit:h}=g;m&&!a&&import("./core/host-permission-6EVJGNPL.js").then(f=>f.checkHostPermission()).catch(()=>{}),window.__hyperclayEditMode=m;let i=await b["lib/region-policy.js"](),l=!!document.querySelector("[sap]"),v=document.querySelectorAll("head style[clay-variant]").length>=2,y=!!document.querySelector('script[src*="sap.js"]');G.holdSettle=l&&m;let p=P(e,m,{isDraftMode:a,hasSap:l,hasVariants:v,canEdit:h,templateSource:A()});p.plugins.includes("plugins/demo.js")&&g.commitModeFacts({destination:"demo"}),k(M(s,u),[...p.core,...p.plugins],{isEditMode:m,isDraftMode:a,hasSapJs:y}),(m||a)&&!u&&n&&n().then(f=>k(M(s,f),[...p.core,...p.plugins],{isEditMode:m,isDraftMode:a,hasSapJs:y})).catch(()=>{});let O,oe=new Promise(f=>{O=f}),ne={sync:p.plugins.includes("sync/live-sync.js")};for(let f of p.core)j[f]=await b[f](),j[f].install?.();if(Se(j,{isDraftMode:a,isOwner:d,siteVisibility:c},i),te(j),document.documentElement.getAttribute("clay-mode-switch")==="live"){let f=P(e,!0,{isDraftMode:a,hasSap:l,hasVariants:v,canEdit:h,templateSource:A()});j["core/edit-mode.js"].noteLiveSwitch({edit:f,view:P(e,!1,{isDraftMode:a,hasSap:l,hasVariants:v,canEdit:h,templateSource:A()}),loaded:j,modules:b,attach:(S,D)=>{N(S,D);let T=E[S],x=window.clay.plugins;T&&Array.isArray(x)&&!x.includes(T)&&(window.clay.plugins=Object.freeze([...x,T]))},attachEditCore:te,announce:se,loadEditHints:n?ve(n,s,f,y):null,late:oe})}await j["core/edit-mode.js"].activateInitialMode(),window.clay.plugins=Object.freeze([...p.plugins,...p.late].map(f=>E[f]));let U=m?p:P(e,!0,{isDraftMode:a,hasSap:l,hasVariants:v,canEdit:h,templateSource:A()});window.clay.editPlugins=Object.freeze([...U.plugins,...U.late].map(f=>E[f]));for(let f of p.plugins){let S;try{S=await b[f]()}catch(D){console.error(`clayjs: plugin "${f}" failed to load, continuing without it:`,D);continue}j[f]=S,f==="plugins/page-view.js"&&S.start(ne),N(f,S,j)}await Promise.allSettled(p.plugins.map(f=>j[f]?.ready).filter(Boolean)),l&&Oe(j),Ee(g),o(window.clay),document.dispatchEvent(new CustomEvent("clay:ready",{detail:{clay:window.clay}})),p.late.length?be(p.late,g).then(O,O):O()}var q=(t,e)=>w[E[t]]?.editOnly&&!e.startsAtImport();async function be(t,e){try{await window.clay.page?.ready}catch{}for(let o of t)if(!q(o,e))try{let s=await b[o]();if(q(o,e)||(j[o]=s,N(o,s,j),await s.ready,q(o,e)))continue;se(o)}catch(s){console.error(`clayjs: plugin "${o}" failed to load, continuing without it:`,s),document.dispatchEvent(new CustomEvent("clay:plugin-failed",{detail:{plugin:E[o]}}))}}function Oe(t){let e=t["core/save.js"],o=null;try{o=e?e.currentPaintSignature():null}catch(s){console.error("clayjs: could not read the page's painted values:",s)}try{window.Sap&&typeof window.Sap.mount=="function"&&window.Sap.mount()}catch(s){console.error("clayjs: the derive engine failed to mount:",s)}finally{e?.releaseBootSettle()}e&&o!=null&&e.schedulePaintHeal(o)}function Se(t,{isDraftMode:e,isOwner:o,siteVisibility:s},u){let n=window.clay,r=t["lib/mutation.js"],g=t["core/edit-mode.js"];Object.assign(n,{toggleEditMode:g.toggleEditMode,setMode:g.setMode,modeLifecycle:g.modeLifecycle,isDraftMode:e,isOwner:o,siteVisibility:s,Mutation:r.default,region:u.windowRegionShape});for(let a of["mode","isEditMode","canEdit"])Object.defineProperty(n,a,{get:()=>g[a],enumerable:!0,configurable:!0});n.assets=Z;let m=t["core/page-data.js"];n.readData=m.readData,n.writeData=m.writeData,n.ephemeral=B,n.storage=F,n.host={get versions(){return import("./c-ZRXJD4G6.js").then(a=>a.hostVersions())}},n.trash=I,n.derived=H,n.effect=_,n.style=J,n.morph=(a,d,c)=>V().then(({morph:h})=>h(a,d,c))}function te(t){let e=window.clay,o=t["core/save.js"];if(o){let r=o.savePage||o.default;r.force=o.savePageForce,r.overwrite=o.saveOverwritingConflict,r.flush=o.flushSave,r.soon=o.savePageSoon,r.limits=o.saveLimits,r.inspect=o.inspectSaveSize,e.save!==r&&typeof e.save?.replace=="function"&&(r.replace=e.save.replace),e.save!==r&&(e.save=r)}e.hasUnsavedChanges=t["core/unsaved-warning.js"]?.hasUnsavedChanges??e.hasUnsavedChanges??(()=>!1);let s=t["core/snapshot.js"];s&&(e.getHTML||(e.getHTML=s.getPageContents),e.addDocumentTransform||(e.addDocumentTransform=s.addDocumentTransform),e.onSnapshot||(e.onSnapshot=s.onSnapshot));let u=t["lib/cache-bust.js"];u&&!e.cacheBust&&(e.cacheBust=u.default);let n=t["core/recovery.js"];n&&!e.recovery&&(e.recovery=n.recovery)}function N(t,e,o=j){let s=window.clay;t==="plugins/undo.js"?s.undo=e.undo||e.default:t==="plugins/unsent.js"?s.unsent=e.unsent:t==="sync/live-sync.js"?(s.morph=e.morph,s.conflicts=e.conflicts,o["core/page-data.js"].setPageDataLiveSync(e.liveSync)):t==="plugins/live.js"?s.live=e.live:t==="plugins/page.js"?s.page=e.page:t==="plugins/upgrade.js"?(s.save=s.save||{},s.save.replace=e.replace):t==="plugins/cms.js"?s.cms=e.cms||e.default:t==="plugins/upload.js"?s.upload=e.upload||e.default:t==="plugins/people.js"?(s.people=e.people,s.author=e.author,Object.defineProperty(s,"me",{get:e.currentMe,configurable:!0,enumerable:!0})):t==="plugins/message.js"?s.message=e.message:t==="plugins/wire.js"?s.wire=e.wire||e.default:t==="plugins/ai-edit.js"?s.aiEdit=e.aiEdit||e.default:t==="plugins/demo.js"?s.demo=e.demo:t==="plugins/richclay.js"?s.RichClay=e.RichClay||e.default:t==="plugins/quickcrop.js"?s.quickcrop=e.quickcrop||e.default:t==="plugins/sortable.js"?s.sortable=e.sortable:t==="plugins/source.js"?s.source=e.source||e.default:t==="plugins/visitor-drafts.js"||t==="plugins/visitor-drafts-owner.js"?s.visitorDrafts=e.visitorDrafts:t==="plugins/bind-text.js"&&(s.bindText=e.bindText)}function Ee(t){t.isEditMode||document.addEventListener("click",e=>{e.target.closest?.("[trigger-save]")&&(t.isEditMode||(console.info("clayjs: you're not the owner of this page; changes stay local"),document.dispatchEvent(new CustomEvent("clay:view-save-attempt"))))})}export{He as boot,Oe as mountDerivedEngine};
|