@commentkit/comment-kit 1.5.1 → 2.0.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/CHANGELOG.md +281 -582
- package/README.md +334 -154
- package/SECURITY.md +47 -46
- package/dist/node/THIRD_PARTY_NOTICES.txt +56 -0
- package/dist/node/browser.js +17 -0
- package/dist/node/cli/api.js +226 -0
- package/dist/node/cli/bin.js +18 -0
- package/dist/node/cli/credentials.js +268 -0
- package/dist/node/cli/doctor.js +725 -0
- package/dist/node/cli/format.js +54 -0
- package/dist/node/cli/init.js +372 -0
- package/dist/node/cli/main.js +519 -0
- package/dist/node/cli/mcp.js +114 -0
- package/dist/node/cli/open.js +20 -0
- package/dist/node/plugins/astro-B5y1Gtbf.js +31 -0
- package/dist/node/plugins/astro.js +26 -0
- package/dist/node/plugins/git-BIXLbL3f.js +92 -0
- package/dist/node/plugins/jsx-Bg4BdSph.js +7958 -0
- package/dist/node/plugins/next.js +48 -0
- package/dist/node/plugins/options-THop1K92.js +71 -0
- package/dist/node/plugins/transform-CKiAuSbk.js +1155 -0
- package/dist/node/plugins/vite-BdAYUW10.js +74 -0
- package/dist/node/plugins/vite.js +1 -0
- package/dist/node/plugins/webpack-R2U2DLlY.js +35 -0
- package/dist/node/plugins/webpack-loader.cjs +21 -0
- package/dist/node/plugins/webpack-loader.js +18 -0
- package/dist/node/plugins/webpack.js +1 -0
- package/dist/node/shared/endpoint.js +26 -0
- package/dist/node/shared/format.js +63 -0
- package/dist/node/types/astro.d.ts +11 -0
- package/dist/node/types/next.d.ts +34 -0
- package/dist/node/types/options.d.ts +59 -0
- package/dist/node/types/vite.d.ts +11 -0
- package/dist/node/types/webpack-loader.d.ts +22 -0
- package/dist/node/types/webpack.d.ts +27 -0
- package/dist/npm/THIRD_PARTY_NOTICES.txt +6 -6
- package/dist/npm/chunks/AgentSend-DxRJIYiz.js +68 -0
- package/dist/npm/chunks/Checklist-CnlfeSbc.js +282 -0
- package/dist/npm/chunks/Composer-B1bBVszY.js +725 -0
- package/dist/npm/chunks/Guest-vvNPz8h-.js +267 -0
- package/dist/npm/chunks/MarkupEditor-VCOXh9d2.js +338 -0
- package/dist/npm/chunks/Panel-F37vIL1K.js +1206 -0
- package/dist/npm/chunks/Settings-BGoZS2iV.js +231 -0
- package/dist/npm/chunks/Shortcuts-B2OMvczr.js +62 -0
- package/dist/npm/chunks/StyleEditor-CJ_d8Huf.js +46 -0
- package/dist/npm/chunks/StylePanel-yQzHHlY7.js +199 -0
- package/dist/npm/chunks/TaskFields-fmy6_HtK.js +289 -0
- package/dist/npm/chunks/ThreadCard-D51slKST.js +1113 -0
- package/dist/npm/chunks/Viewer-BOBadqmC.js +111 -0
- package/dist/npm/chunks/{agent-CqDO3JMA.js → agent-C1OQzBAm.js} +20 -21
- package/dist/npm/chunks/{anchor-OCQnjp_6.js → anchor-BsQNVkHj.js} +109 -87
- package/dist/npm/chunks/{ar-BQ9K9Oqf.js → ar-CAJ3XT8e.js} +73 -20
- package/dist/npm/chunks/card-bits-CAnzrqx3.js +53 -0
- package/dist/npm/chunks/{client-dZeNdizE.js → client-kNAo2TTG.js} +292 -285
- package/dist/npm/chunks/{colors-CAjY4jxf.js → colors-CWAn_swA.js} +1 -2
- package/dist/npm/chunks/confetti-CkBdSu19.js +49 -0
- package/dist/npm/chunks/context-B8UAzve0.js +20 -0
- package/dist/npm/chunks/context-BuMl7A07.js +48 -0
- package/dist/npm/chunks/{de-CcPi8xdC.js → de-Dl18G48t.js} +64 -19
- package/dist/npm/chunks/dialog-GO04oC3D.js +3 -0
- package/dist/npm/chunks/dpop-U48QIQd7.js +96 -0
- package/dist/npm/chunks/drafts-B0ctr1g9.js +21 -0
- package/dist/npm/chunks/{es-DXgkjDCG.js → es-Dxk79lS9.js} +64 -19
- package/dist/npm/chunks/extension-CKFpPWmi.js +62 -0
- package/dist/npm/chunks/{extension-BFkXOmX5.js → extension-E81hWyiT.js} +21 -14
- package/dist/npm/chunks/files-DyD5BZgp.js +114 -0
- package/dist/npm/chunks/{fr-IjJaUbWh.js → fr-8BebGKYD.js} +121 -76
- package/dist/npm/chunks/{hi-BhKQK2MU.js → hi-BIN6Yy_p.js} +65 -20
- package/dist/npm/chunks/{html2canvas-pro.esm-lgs6tb4C.js → html2canvas-pro.esm-B7b8p5Wr.js} +608 -528
- package/dist/npm/chunks/i18n-DOBt8e9U.js +936 -0
- package/dist/npm/chunks/identify-CN-3xzqL.js +106 -0
- package/dist/npm/chunks/{it-DKiSCkiD.js → it-Cr6EwpPQ.js} +83 -38
- package/dist/npm/chunks/{ja-BI1WagDg.js → ja-Iy3s5aur.js} +62 -17
- package/dist/npm/chunks/late-words-B2bmZceJ.js +12 -0
- package/dist/npm/chunks/live-CelVeZfP.js +85 -0
- package/dist/npm/chunks/locale-D8Q4Q2Nt.js +26 -0
- package/dist/npm/chunks/{lock-C82sC17d.js → lock-B1JLlOhz.js} +0 -1
- package/dist/npm/chunks/{nl-CJw3VUQ5.js → nl-B84WHqqe.js} +65 -20
- package/dist/npm/chunks/page-key-DepmJzC1.js +62 -0
- package/dist/npm/chunks/{pick-dDDLxCDI.js → pick-yTyqtxN0.js} +46 -46
- package/dist/npm/chunks/pkce-ChKGSW_4.js +8 -0
- package/dist/npm/chunks/placement-BF_HOUDD.js +74 -0
- package/dist/npm/chunks/privacy-BWUGlHw5.js +57 -0
- package/dist/npm/chunks/{pt-BR-CjBolC5g.js → pt-BR-DOkdlfoe.js} +64 -19
- package/dist/npm/chunks/{realtime-D22tI_AS.js → realtime-C79zF50C.js} +16 -15
- package/dist/npm/chunks/report-CrIqQZDI.js +44 -0
- package/dist/npm/chunks/{rolldown-runtime-Y_bBpyJl.js → rolldown-runtime-QGRDbDUS.js} +1 -2
- package/dist/npm/chunks/show-BgVC8gWY.js +97 -0
- package/dist/npm/chunks/signin-Dd1rb2BP.js +75 -0
- package/dist/npm/chunks/{source-BQS2_xfB.js → source-pXVve2Cx.js} +2 -3
- package/dist/npm/chunks/src-BTMy4Gyc.js +208 -0
- package/dist/npm/chunks/start-DtVlpt7p.js +1878 -0
- package/dist/npm/chunks/states-sfTbjZz8.js +3 -0
- package/dist/npm/chunks/upload-MgPYqPyE.js +42 -0
- package/dist/npm/chunks/uploads-D49mywwz.js +1146 -0
- package/dist/npm/chunks/wrap-Bl0gbnFa.js +69 -0
- package/dist/npm/chunks/{zh-CN-BrZGx2S0.js → zh-CN-Z5fQCb7G.js} +63 -18
- package/dist/npm/element.js +59 -23
- package/dist/npm/headless.js +7 -3
- package/dist/npm/index.js +3 -3
- package/dist/npm/react.js +19 -13
- package/dist/npm/svelte.js +29 -14
- package/dist/npm/types/adapters/react.d.ts +4 -1
- package/dist/npm/types/adapters/svelte.d.ts +4 -1
- package/dist/npm/types/adapters/vue.d.ts +35 -2
- package/dist/npm/types/anchor/index.d.ts +19 -0
- package/dist/npm/types/capture/privacy.d.ts +14 -0
- package/dist/npm/types/core/api.d.ts +20 -1
- package/dist/npm/types/core/auth.d.ts +47 -14
- package/dist/npm/types/core/client.d.ts +60 -4
- package/dist/npm/types/core/page-key.d.ts +42 -0
- package/dist/npm/types/core/types.d.ts +87 -4
- package/dist/npm/types/element.d.ts +17 -7
- package/dist/npm/types/headless.d.ts +2 -1
- package/dist/npm/types/index.d.ts +16 -6
- package/dist/npm/vue.js +45 -11
- package/package.json +95 -21
- package/dist/npm/chunks/AgentSend-DjFZSC0S.js +0 -64
- package/dist/npm/chunks/Checklist-BEz4IZdT.js +0 -259
- package/dist/npm/chunks/Composer-D1wbmdjF.js +0 -681
- package/dist/npm/chunks/Guest-CtyRy8Kz.js +0 -170
- package/dist/npm/chunks/MarkupEditor-CPH4yKx4.js +0 -334
- package/dist/npm/chunks/Panel-DSoUAlbQ.js +0 -863
- package/dist/npm/chunks/Settings-C_qV4n7J.js +0 -206
- package/dist/npm/chunks/Shortcuts-ChnaribX.js +0 -60
- package/dist/npm/chunks/StyleEditor-DqZd6C5o.js +0 -44
- package/dist/npm/chunks/StylePanel-DMC3riYK.js +0 -199
- package/dist/npm/chunks/TaskFields-BfjjllMx.js +0 -272
- package/dist/npm/chunks/ThreadCard-DmKAelSL.js +0 -1026
- package/dist/npm/chunks/Viewer-mw69qSI5.js +0 -110
- package/dist/npm/chunks/card-bits-C7bIk5KX.js +0 -126
- package/dist/npm/chunks/confetti-DKeKR7-6.js +0 -41
- package/dist/npm/chunks/drafts-CpQdHhcK.js +0 -51
- package/dist/npm/chunks/extension-Gvei3opb.js +0 -54
- package/dist/npm/chunks/i18n-DAJGndZ2.js +0 -904
- package/dist/npm/chunks/live-MvvBdoGd.js +0 -34
- package/dist/npm/chunks/report-DoDVi1qT.js +0 -28
- package/dist/npm/chunks/src-C_oUnL0i.js +0 -150
- package/dist/npm/chunks/start-C5-rebEU.js +0 -1783
- package/dist/npm/chunks/upload-CzPAjktW.js +0 -42
- package/dist/npm/chunks/uploads-tpLjiJdH.js +0 -541
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import { p as e } from "./client-dZeNdizE.js";
|
|
2
|
-
//#region src/core/upload.ts
|
|
3
|
-
async function t(e, t, a, o, s) {
|
|
4
|
-
let c = await e.request("/uploads", {
|
|
5
|
-
method: "POST",
|
|
6
|
-
idempotent: !0,
|
|
7
|
-
body: {
|
|
8
|
-
name: a,
|
|
9
|
-
mime: t.type || "application/octet-stream",
|
|
10
|
-
bytes: t.size,
|
|
11
|
-
kind: o
|
|
12
|
-
}
|
|
13
|
-
});
|
|
14
|
-
if (s.signal?.aborted) throw r();
|
|
15
|
-
let l = s.onProgress ? await i(c.upload, t, s.onProgress, s.signal) : (await fetch(c.upload.url, {
|
|
16
|
-
method: "PUT",
|
|
17
|
-
headers: c.upload.headers,
|
|
18
|
-
body: t,
|
|
19
|
-
credentials: "omit",
|
|
20
|
-
signal: s.signal
|
|
21
|
-
})).status;
|
|
22
|
-
if (l < 200 || l >= 300) throw n(l);
|
|
23
|
-
return e.request(`/uploads/${encodeURIComponent(c.id)}/complete`, {
|
|
24
|
-
method: "POST",
|
|
25
|
-
idempotent: !0
|
|
26
|
-
}).then((e) => e.data);
|
|
27
|
-
}
|
|
28
|
-
var n = (t) => new e(t, "upload_failed", "The file could not be uploaded. Try again."), r = () => new e(0, "upload_cancelled", "Cancelled");
|
|
29
|
-
function i(e, t, i, a) {
|
|
30
|
-
return new Promise((o, s) => {
|
|
31
|
-
let c = new XMLHttpRequest();
|
|
32
|
-
c.open("PUT", e.url);
|
|
33
|
-
for (let [t, n] of Object.entries(e.headers)) c.setRequestHeader(t, n);
|
|
34
|
-
c.upload.onprogress = (e) => e.lengthComputable && i(e.loaded / e.total);
|
|
35
|
-
let l = () => c.abort(), u = (e, t) => {
|
|
36
|
-
a?.removeEventListener("abort", l), e(t);
|
|
37
|
-
};
|
|
38
|
-
c.onload = () => u(o, c.status), c.onerror = () => u(s, n(0)), c.onabort = () => u(s, r()), a?.addEventListener("abort", l, { once: !0 }), c.send(t);
|
|
39
|
-
});
|
|
40
|
-
}
|
|
41
|
-
//#endregion
|
|
42
|
-
export { t as upload };
|
|
@@ -1,541 +0,0 @@
|
|
|
1
|
-
import { p as e } from "./client-dZeNdizE.js";
|
|
2
|
-
import { f as t, l as n, m as r, s as i, u as a } from "./i18n-DAJGndZ2.js";
|
|
3
|
-
import { a as o } from "./card-bits-C7bIk5KX.js";
|
|
4
|
-
import { d as s, l as c, n as l } from "./start-C5-rebEU.js";
|
|
5
|
-
//#region src/ui/editing.ts
|
|
6
|
-
var u = {
|
|
7
|
-
bold: "**",
|
|
8
|
-
italic: "_",
|
|
9
|
-
code: "`",
|
|
10
|
-
strike: "~~"
|
|
11
|
-
};
|
|
12
|
-
function d(e) {
|
|
13
|
-
if (!(e.metaKey || e.ctrlKey) || e.altKey) return null;
|
|
14
|
-
let t = e.key.toLowerCase();
|
|
15
|
-
return e.shiftKey ? t === "x" ? "strike" : null : t === "b" ? "bold" : t === "i" ? "italic" : t === "e" ? "code" : null;
|
|
16
|
-
}
|
|
17
|
-
function f(e, t, n, r) {
|
|
18
|
-
let i = u[r], a = e.slice(0, t), o = e.slice(t, n), s = e.slice(n);
|
|
19
|
-
if (a.endsWith(i) && s.startsWith(i)) return {
|
|
20
|
-
value: a.slice(0, -i.length) + o + s.slice(i.length),
|
|
21
|
-
start: t - i.length,
|
|
22
|
-
end: n - i.length
|
|
23
|
-
};
|
|
24
|
-
if (o.length > 2 * i.length && o.startsWith(i) && o.endsWith(i)) {
|
|
25
|
-
let e = o.slice(i.length, -i.length);
|
|
26
|
-
return {
|
|
27
|
-
value: a + e + s,
|
|
28
|
-
start: t,
|
|
29
|
-
end: t + e.length
|
|
30
|
-
};
|
|
31
|
-
}
|
|
32
|
-
return {
|
|
33
|
-
value: a + i + o + i + s,
|
|
34
|
-
start: t + i.length,
|
|
35
|
-
end: n + i.length
|
|
36
|
-
};
|
|
37
|
-
}
|
|
38
|
-
function p(e) {
|
|
39
|
-
let t = e.replace(/\r\n/g, "\n").split("\n").filter((e) => e.trim());
|
|
40
|
-
return t.length < 2 || e.includes("```") ? !1 : t.filter((e) => /[{};]\s*$|^\s*[<}\])]|=>|^\s*(import|export|const|let|var|function|return|if|for|def|class)\b|^\s{2,}\S|^\t/.test(e)).length / t.length >= .5;
|
|
41
|
-
}
|
|
42
|
-
function m(e) {
|
|
43
|
-
return `\`\`\`\n${e.replace(/\r\n/g, "\n").replace(/\n+$/, "")}\n\`\`\``;
|
|
44
|
-
}
|
|
45
|
-
//#endregion
|
|
46
|
-
//#region src/ui/compose.css?inline
|
|
47
|
-
var h = ".ck-textarea{resize:none;field-sizing:content;border-radius:var(--ck-radius-md);border:1px solid var(--ck-border);background:var(--ck-bg);outline:none;width:100%;min-height:68px;max-height:220px;padding:8px 11px;line-height:1.5;transition:border-color .12s,box-shadow .12s;display:block}.ck-textarea:focus{border-color:var(--ck-accent);box-shadow:0 0 0 3px color-mix(in srgb, var(--ck-accent) 18%, transparent);outline:none}.ck-textarea[aria-invalid=true]{border-color:var(--ck-danger)}.ck-shot{border-radius:var(--ck-radius-md);background:var(--ck-bg-muted);margin-top:10px;position:relative;overflow:hidden}.ck-shot img,.ck-shot canvas{outline:1px solid var(--ck-img-outline);outline-offset:-1px;border-radius:inherit;width:100%;height:auto;display:block}.ck-msg .ck-shot img{object-fit:cover;object-position:top;max-height:150px}.ck-composer .ck-shot{height:140px}.ck-composer .ck-shot img{object-fit:cover;height:100%}.ck-shot-wait{place-items:center;font-size:12px;display:grid}.ck-shot-tools{flex-wrap:wrap;gap:4px;margin-top:8px;display:flex}.ck-composer .ck-shot-tools{margin:0;position:absolute;top:auto;bottom:8px;left:8px;right:8px}.ck-composer .ck-shot-tools .ck-chip{box-shadow:var(--ck-shadow-sm)}.ck-files{flex-wrap:wrap;gap:6px;margin-top:8px;display:flex}.ck-file{background:var(--ck-bg-muted);border-radius:6px;padding:4px 8px;font-size:12px}.ck-suggest{background:var(--ck-bg);max-height:180px;box-shadow:var(--ck-shadow);z-index:3;animation:ck-pop .12s var(--ck-ease);border-radius:12px;padding:4px;position:absolute;bottom:56px;left:14px;right:14px;overflow:auto}.ck-suggest button{border-radius:var(--ck-radius-sm);text-align:start;background:0 0;border:0;align-items:center;gap:8px;width:100%;padding:6px 8px;display:flex}.ck-suggest button[aria-selected=true]{background:var(--ck-bg-hover)}.ck-guest{gap:10px;margin-top:12px;display:grid}.ck-guest-privacy{margin:0;font-size:12px;line-height:1.45}.ck-guest-privacy a{color:inherit;text-underline-offset:2px;text-decoration:underline}.ck-error{color:var(--ck-danger);font-size:12px;font-weight:500}@media (pointer:coarse){.ck-textarea{font-size:16px}}@media (hover:hover){.ck-textarea:hover{border-color:color-mix(in srgb, var(--ck-text-muted) 45%, var(--ck-border))}.ck-suggest button:hover{background:var(--ck-bg-hover)}}.ck-suggest{overscroll-behavior:contain;border:1px solid #0000}.ck-compose{position:relative}.ck-format{gap:2px;margin-top:4px;display:flex}.ck-uploads{flex-wrap:wrap;gap:6px;margin:8px 0 0;padding:0;list-style:none;display:flex}.ck-upload{border-radius:var(--ck-radius-sm);background:var(--ck-bg-muted);max-width:100%;box-shadow:0 0 0 1px var(--ck-hairline);align-items:center;display:flex;position:relative;overflow:hidden}.ck-upload[data-image]{width:56px;height:56px}.ck-upload-thumb{cursor:zoom-in;background:0 0;border:0;width:100%;height:100%;padding:0}.ck-upload-thumb img{object-fit:cover;width:100%;height:100%;display:block}.ck-upload-name{text-overflow:ellipsis;white-space:nowrap;min-width:0;max-width:200px;color:var(--ck-text);align-items:center;gap:5px;padding:6px 28px 6px 9px;font-size:12.5px;display:inline-flex;overflow:hidden}.ck-upload[data-state=uploading] .ck-upload-thumb img{opacity:.6}.ck-upload-bar{left:6px;right:6px;background:#12131626;border-radius:2px;height:3px;position:absolute;bottom:5px;overflow:hidden}.ck-upload-bar>span{background:var(--ck-accent);height:100%;transition:width .16s linear;display:block}.ck-upload[data-state=failed]{box-shadow:0 0 0 1px color-mix(in srgb, var(--ck-danger) 55%, transparent)}.ck-upload-retry{background:var(--ck-danger);color:#fff;border:0;justify-content:center;align-items:center;gap:3px;height:20px;padding:0;font-size:10.5px;font-weight:700;display:flex;position:absolute;top:auto;bottom:0;left:0;right:0}.ck-upload:not([data-image]) .ck-upload-retry{border-radius:6px;height:auto;margin-inline-end:26px;padding:2px 6px;position:static}.ck-upload-remove{top:3px;color:#fff;background:#12131699;border:0;border-radius:50%;place-items:center;width:18px;height:18px;padding:0;display:grid;position:absolute}.ck-upload-remove:not(:-webkit-any(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi))){right:3px}.ck-upload-remove:not(:is(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi))){right:3px}.ck-upload-remove:-webkit-any(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)){left:3px}.ck-upload-remove:is(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)){left:3px}.ck-upload:not([data-image]) .ck-upload-remove{color:var(--ck-text-muted);background:0 0;top:50%;translate:0 -50%}@media (pointer:coarse){.ck-upload-remove{top:1px;width:26px;height:26px}.ck-upload-remove:not(:-webkit-any(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi))){right:1px}.ck-upload-remove:not(:is(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi))){right:1px}.ck-upload-remove:-webkit-any(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)){left:1px}.ck-upload-remove:is(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)){left:1px}}.ck-extra-add{gap:8px;margin-top:6px;display:flex}.ck-draft-list{gap:4px;margin-top:8px;display:grid}.ck-draft-item{align-items:center;gap:8px;font-size:13px;display:flex}.ck-draft-item bdi{overflow-wrap:anywhere;flex:1;min-width:0}.ck-draft-item .ck-ghost,.ck-checklist li .ck-ghost{flex:none;place-items:center;width:24px;height:24px;min-height:0;padding:0;display:grid}.ck-draft-box{width:13px;height:13px;box-shadow:inset 0 0 0 1.5px var(--ck-border);border-radius:3px;flex:none}.ck-pending-pin{z-index:var(--ck-z);pointer-events:none;filter:drop-shadow(0 0 .6px #fff)drop-shadow(0 3px 6px #12131647);width:30px;height:34px;animation:ck-pin-drop .26s var(--ck-ease);transform-origin:49% 97%;position:fixed;transform:translate(-49%,-97%)}.ck-pending-region{z-index:var(--ck-z);pointer-events:none;border-radius:6px;position:fixed}.ck-pending-pin svg{width:100%;height:100%;position:absolute;top:0;bottom:0;left:0;right:0;overflow:visible}.ck-pending-pin path{fill:var(--ck-accent);stroke:#121316;stroke-width:3px;stroke-linejoin:round}.ck-composer{animation:ck-pop .2s var(--ck-ease) 80ms backwards}.ck-style-list .ck-draft-item code,.ck-style-card li code{overflow-wrap:anywhere;flex:1;min-width:0;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;font-size:12px}.ck-style-card{border-radius:var(--ck-radius-sm);background:var(--ck-bg-muted);margin-top:8px;padding:8px 10px}.ck-style-card-head{color:var(--ck-text-muted);justify-content:space-between;align-items:center;gap:8px;font-size:12px;font-weight:600;display:flex}.ck-style-card ul{gap:3px;margin:6px 0 0;padding:0;list-style:none;display:grid}";
|
|
48
|
-
//#endregion
|
|
49
|
-
//#region src/ui/MentionBox.tsx
|
|
50
|
-
l(h);
|
|
51
|
-
var g = /* @__PURE__ */ new WeakMap();
|
|
52
|
-
function _(e) {
|
|
53
|
-
let t = g.get(e);
|
|
54
|
-
return t || g.set(e, t = e.people().catch(() => [])), t;
|
|
55
|
-
}
|
|
56
|
-
var v = [
|
|
57
|
-
{
|
|
58
|
-
mark: "bold",
|
|
59
|
-
icon: "bold",
|
|
60
|
-
label: "formatBold",
|
|
61
|
-
keys: "Meta+B"
|
|
62
|
-
},
|
|
63
|
-
{
|
|
64
|
-
mark: "italic",
|
|
65
|
-
icon: "italic",
|
|
66
|
-
label: "formatItalic",
|
|
67
|
-
keys: "Meta+I"
|
|
68
|
-
},
|
|
69
|
-
{
|
|
70
|
-
mark: "strike",
|
|
71
|
-
icon: "strike",
|
|
72
|
-
label: "formatStrike",
|
|
73
|
-
keys: "Meta+Shift+X"
|
|
74
|
-
},
|
|
75
|
-
{
|
|
76
|
-
mark: "code",
|
|
77
|
-
icon: "code",
|
|
78
|
-
label: "formatCode",
|
|
79
|
-
keys: "Meta+E"
|
|
80
|
-
}
|
|
81
|
-
];
|
|
82
|
-
function y({ client: e, value: o, onChange: l, onMentions: u, onSubmit: h, placeholder: g, autofocus: y, disabled: x, canMention: S, above: C }) {
|
|
83
|
-
let w = t(null), [T, E] = r([]), [D, O] = r(null), [k, A] = r(0), [j, M] = r(/* @__PURE__ */ new Map()), [N] = r(() => typeof matchMedia == "function" && matchMedia("(pointer: coarse)").matches);
|
|
84
|
-
a(() => {
|
|
85
|
-
y && w.current?.focus();
|
|
86
|
-
}, [y]), a(() => {
|
|
87
|
-
S && _(e).then(E);
|
|
88
|
-
}, [e, S]);
|
|
89
|
-
let P = D === null ? [] : T.filter((e) => e.name.toLowerCase().includes(D.toLowerCase())).slice(0, 8), F = (e, t = j) => [...t.entries()].filter(([t]) => e.includes(`@${t}`)).map(([, e]) => e), I = (e) => {
|
|
90
|
-
l(e);
|
|
91
|
-
let t = w.current?.selectionStart ?? e.length, n = e.slice(0, t), r = /(^|\s)@([\p{L}\p{N}._-]{0,30})$/u.exec(n);
|
|
92
|
-
O(S && r ? r[2] ?? "" : null), A(0), u(F(e));
|
|
93
|
-
}, L = (e, t, n = t) => {
|
|
94
|
-
let r = w.current;
|
|
95
|
-
l(e), u(F(e)), requestAnimationFrame(() => {
|
|
96
|
-
r && r.value === e && (r.focus(), r.setSelectionRange(t, n));
|
|
97
|
-
});
|
|
98
|
-
}, R = (e) => {
|
|
99
|
-
let t = w.current;
|
|
100
|
-
if (!t || e.id === null) return;
|
|
101
|
-
let n = t.selectionStart ?? o.length, r = o.slice(0, n).replace(/@[\p{L}\p{N}._-]*$/u, `@${e.name} `), i = r + o.slice(n), a = /^\d+$/.test(e.id) ? new Map(j).set(e.name, Number(e.id)) : j;
|
|
102
|
-
M(a), O(null), l(i), u(F(i, a)), requestAnimationFrame(() => {
|
|
103
|
-
t.value === i && (t.focus(), t.setSelectionRange(r.length, r.length));
|
|
104
|
-
});
|
|
105
|
-
}, z = (e) => {
|
|
106
|
-
let t = w.current;
|
|
107
|
-
if (!t || x) return;
|
|
108
|
-
let n = f(o, t.selectionStart ?? o.length, t.selectionEnd ?? o.length, e);
|
|
109
|
-
L(n.value, n.start, n.end);
|
|
110
|
-
};
|
|
111
|
-
return /* @__PURE__ */ n("div", {
|
|
112
|
-
class: "ck-compose",
|
|
113
|
-
children: [
|
|
114
|
-
C,
|
|
115
|
-
/* @__PURE__ */ n("textarea", {
|
|
116
|
-
ref: w,
|
|
117
|
-
class: "ck-textarea",
|
|
118
|
-
dir: o ? "auto" : void 0,
|
|
119
|
-
value: o,
|
|
120
|
-
placeholder: g,
|
|
121
|
-
disabled: x,
|
|
122
|
-
maxLength: 1e4,
|
|
123
|
-
"aria-label": g,
|
|
124
|
-
"aria-autocomplete": "list",
|
|
125
|
-
"aria-controls": P.length ? "ck-suggest" : void 0,
|
|
126
|
-
"aria-activedescendant": P.length ? `ck-opt-${k}` : void 0,
|
|
127
|
-
"aria-keyshortcuts": N ? void 0 : "Enter",
|
|
128
|
-
onInput: (e) => I(e.target.value),
|
|
129
|
-
onPaste: (e) => {
|
|
130
|
-
let t = e.clipboardData?.getData("text/plain") ?? "";
|
|
131
|
-
if (e.clipboardData?.files.length || !p(t)) return;
|
|
132
|
-
let n = w.current;
|
|
133
|
-
if (!n) return;
|
|
134
|
-
e.preventDefault();
|
|
135
|
-
let r = n.selectionStart ?? o.length, i = n.selectionEnd ?? o.length, a = (r > 0 && o[r - 1] !== "\n" ? "\n" : "") + m(t) + "\n";
|
|
136
|
-
L(o.slice(0, r) + a + o.slice(i), r + a.length);
|
|
137
|
-
},
|
|
138
|
-
onKeyDown: (e) => {
|
|
139
|
-
if ((e.key !== "Escape" || P.length) && e.stopPropagation(), P.length && [
|
|
140
|
-
"ArrowDown",
|
|
141
|
-
"ArrowUp",
|
|
142
|
-
"Enter",
|
|
143
|
-
"Tab",
|
|
144
|
-
"Escape"
|
|
145
|
-
].includes(e.key)) {
|
|
146
|
-
e.preventDefault(), e.key === "ArrowDown" ? A((e) => (e + 1) % P.length) : e.key === "ArrowUp" ? A((e) => (e - 1 + P.length) % P.length) : e.key === "Escape" ? O(null) : R(P[k]);
|
|
147
|
-
return;
|
|
148
|
-
}
|
|
149
|
-
let t = d(e);
|
|
150
|
-
if (t) return e.preventDefault(), z(t);
|
|
151
|
-
e.key === "Enter" && !e.shiftKey && !e.isComposing && e.keyCode !== 229 && (!N || e.metaKey || e.ctrlKey) && (e.preventDefault(), h());
|
|
152
|
-
}
|
|
153
|
-
}),
|
|
154
|
-
P.length ? /* @__PURE__ */ n("div", {
|
|
155
|
-
class: "ck-suggest",
|
|
156
|
-
id: "ck-suggest",
|
|
157
|
-
role: "listbox",
|
|
158
|
-
"aria-label": i("mentionList"),
|
|
159
|
-
children: P.map((e, t) => /* @__PURE__ */ n("button", {
|
|
160
|
-
type: "button",
|
|
161
|
-
role: "option",
|
|
162
|
-
id: `ck-opt-${t}`,
|
|
163
|
-
"aria-selected": t === k,
|
|
164
|
-
onMouseDown: (t) => {
|
|
165
|
-
t.preventDefault(), R(e);
|
|
166
|
-
},
|
|
167
|
-
children: [/* @__PURE__ */ n(c, { person: e }), /* @__PURE__ */ n("bdi", { children: e.name })]
|
|
168
|
-
}))
|
|
169
|
-
}) : null,
|
|
170
|
-
/* @__PURE__ */ n("div", {
|
|
171
|
-
class: "ck-format",
|
|
172
|
-
role: "toolbar",
|
|
173
|
-
"aria-label": i("formatting"),
|
|
174
|
-
children: v.map((e) => /* @__PURE__ */ n("button", {
|
|
175
|
-
type: "button",
|
|
176
|
-
class: "ck-ghost ck-ghost-sm",
|
|
177
|
-
"aria-label": i(e.label),
|
|
178
|
-
title: `${i(e.label)} (${e.keys.replace("Meta", b() ? "⌘" : "Ctrl").replace(/\+/g, " ")})`,
|
|
179
|
-
"aria-keyshortcuts": e.keys,
|
|
180
|
-
disabled: x,
|
|
181
|
-
onMouseDown: (e) => e.preventDefault(),
|
|
182
|
-
onClick: () => z(e.mark),
|
|
183
|
-
children: /* @__PURE__ */ n(s, {
|
|
184
|
-
name: e.icon,
|
|
185
|
-
size: 14
|
|
186
|
-
})
|
|
187
|
-
}))
|
|
188
|
-
})
|
|
189
|
-
]
|
|
190
|
-
});
|
|
191
|
-
}
|
|
192
|
-
function b() {
|
|
193
|
-
return typeof navigator < "u" && /Mac|iPhone|iPad/.test(navigator.platform || navigator.userAgent);
|
|
194
|
-
}
|
|
195
|
-
//#endregion
|
|
196
|
-
//#region src/ui/style-edit.ts
|
|
197
|
-
var x = [
|
|
198
|
-
{
|
|
199
|
-
property: "font-size",
|
|
200
|
-
kind: "length"
|
|
201
|
-
},
|
|
202
|
-
{
|
|
203
|
-
property: "font-weight",
|
|
204
|
-
kind: "number"
|
|
205
|
-
},
|
|
206
|
-
{
|
|
207
|
-
property: "line-height",
|
|
208
|
-
kind: "length"
|
|
209
|
-
},
|
|
210
|
-
{
|
|
211
|
-
property: "letter-spacing",
|
|
212
|
-
kind: "length"
|
|
213
|
-
},
|
|
214
|
-
{
|
|
215
|
-
property: "text-align",
|
|
216
|
-
kind: "choice",
|
|
217
|
-
options: [
|
|
218
|
-
"start",
|
|
219
|
-
"left",
|
|
220
|
-
"center",
|
|
221
|
-
"right",
|
|
222
|
-
"end",
|
|
223
|
-
"justify"
|
|
224
|
-
]
|
|
225
|
-
},
|
|
226
|
-
{
|
|
227
|
-
property: "color",
|
|
228
|
-
kind: "color"
|
|
229
|
-
},
|
|
230
|
-
{
|
|
231
|
-
property: "background-color",
|
|
232
|
-
kind: "color"
|
|
233
|
-
},
|
|
234
|
-
{
|
|
235
|
-
property: "border-color",
|
|
236
|
-
kind: "color"
|
|
237
|
-
},
|
|
238
|
-
{
|
|
239
|
-
property: "border-width",
|
|
240
|
-
kind: "length"
|
|
241
|
-
},
|
|
242
|
-
{
|
|
243
|
-
property: "border-style",
|
|
244
|
-
kind: "choice",
|
|
245
|
-
options: [
|
|
246
|
-
"none",
|
|
247
|
-
"solid",
|
|
248
|
-
"dashed",
|
|
249
|
-
"dotted",
|
|
250
|
-
"double"
|
|
251
|
-
]
|
|
252
|
-
},
|
|
253
|
-
{
|
|
254
|
-
property: "border-radius",
|
|
255
|
-
kind: "length"
|
|
256
|
-
},
|
|
257
|
-
{
|
|
258
|
-
property: "opacity",
|
|
259
|
-
kind: "number"
|
|
260
|
-
},
|
|
261
|
-
{
|
|
262
|
-
property: "margin",
|
|
263
|
-
kind: "box"
|
|
264
|
-
},
|
|
265
|
-
{
|
|
266
|
-
property: "padding",
|
|
267
|
-
kind: "box"
|
|
268
|
-
},
|
|
269
|
-
{
|
|
270
|
-
property: "width",
|
|
271
|
-
kind: "length"
|
|
272
|
-
},
|
|
273
|
-
{
|
|
274
|
-
property: "height",
|
|
275
|
-
kind: "length"
|
|
276
|
-
},
|
|
277
|
-
{
|
|
278
|
-
property: "gap",
|
|
279
|
-
kind: "length"
|
|
280
|
-
},
|
|
281
|
-
{
|
|
282
|
-
property: "display",
|
|
283
|
-
kind: "choice",
|
|
284
|
-
options: [
|
|
285
|
-
"block",
|
|
286
|
-
"inline",
|
|
287
|
-
"inline-block",
|
|
288
|
-
"flex",
|
|
289
|
-
"inline-flex",
|
|
290
|
-
"grid",
|
|
291
|
-
"none"
|
|
292
|
-
]
|
|
293
|
-
}
|
|
294
|
-
], S = new Set(x.map((e) => e.property)), C = /* @__PURE__ */ new Set([
|
|
295
|
-
"rgb",
|
|
296
|
-
"rgba",
|
|
297
|
-
"hsl",
|
|
298
|
-
"hsla",
|
|
299
|
-
"hwb",
|
|
300
|
-
"lab",
|
|
301
|
-
"lch",
|
|
302
|
-
"oklab",
|
|
303
|
-
"oklch",
|
|
304
|
-
"color",
|
|
305
|
-
"color-mix",
|
|
306
|
-
"calc",
|
|
307
|
-
"min",
|
|
308
|
-
"max",
|
|
309
|
-
"clamp",
|
|
310
|
-
"var"
|
|
311
|
-
]);
|
|
312
|
-
function w(e) {
|
|
313
|
-
if (e.length > 120 || !/^[A-Za-z0-9#.%,()/*+ -]*$/.test(e) || /javascript|expression|import/i.test(e)) return !1;
|
|
314
|
-
let t = [...e.matchAll(/([A-Za-z-]+)\s*\(/g)].map((e) => e[1].toLowerCase()), n = e.split("(").length - 1;
|
|
315
|
-
return t.every((e) => C.has(e)) && n === t.length && n === e.split(")").length - 1;
|
|
316
|
-
}
|
|
317
|
-
function T(e) {
|
|
318
|
-
return typeof e == "string" && S.has(e);
|
|
319
|
-
}
|
|
320
|
-
function E(e) {
|
|
321
|
-
if (!Array.isArray(e)) return [];
|
|
322
|
-
let t = /* @__PURE__ */ new Set(), n = [];
|
|
323
|
-
for (let r of e) {
|
|
324
|
-
if (!r || !T(r.property) || t.has(r.property)) continue;
|
|
325
|
-
let e = typeof r.to == "string" && r.to.trim() ? r.to.trim() : null, i = typeof r.from == "string" && r.from.trim() ? r.from.trim() : null;
|
|
326
|
-
if (!(e !== null && !w(e) || i !== null && !w(i)) && (t.add(r.property), n.push({
|
|
327
|
-
property: r.property,
|
|
328
|
-
from: i,
|
|
329
|
-
to: e
|
|
330
|
-
}), n.length >= 20)) break;
|
|
331
|
-
}
|
|
332
|
-
return n;
|
|
333
|
-
}
|
|
334
|
-
function D(e) {
|
|
335
|
-
let t = getComputedStyle(e), n = {};
|
|
336
|
-
for (let { property: e } of x) {
|
|
337
|
-
let r = O(t, e).trim();
|
|
338
|
-
n[e] = w(r) ? r : "";
|
|
339
|
-
}
|
|
340
|
-
return n;
|
|
341
|
-
}
|
|
342
|
-
function O(e, t) {
|
|
343
|
-
let n = e.getPropertyValue(t);
|
|
344
|
-
if (n || ![
|
|
345
|
-
"margin",
|
|
346
|
-
"padding",
|
|
347
|
-
"border-width",
|
|
348
|
-
"border-color",
|
|
349
|
-
"border-style",
|
|
350
|
-
"border-radius"
|
|
351
|
-
].includes(t)) return n;
|
|
352
|
-
let r = t === "border-radius" ? [
|
|
353
|
-
"top-left",
|
|
354
|
-
"top-right",
|
|
355
|
-
"bottom-right",
|
|
356
|
-
"bottom-left"
|
|
357
|
-
].map((t) => e.getPropertyValue(`border-${t}-radius`)) : [
|
|
358
|
-
"top",
|
|
359
|
-
"right",
|
|
360
|
-
"bottom",
|
|
361
|
-
"left"
|
|
362
|
-
].map((n) => e.getPropertyValue(t.startsWith("border-") ? `border-${n}-${t.slice(7)}` : `${t}-${n}`)), [i, a, o, s] = r;
|
|
363
|
-
return r.some((e) => !e) ? "" : i === a && a === o && o === s ? i : i === o && a === s ? `${i} ${a}` : a === s ? `${i} ${a} ${o}` : r.join(" ");
|
|
364
|
-
}
|
|
365
|
-
function k(e) {
|
|
366
|
-
return `${e.property} ${e.from || i("styleNotSet")} → ${e.to ?? i("styleRemoved")}`;
|
|
367
|
-
}
|
|
368
|
-
var A = class {
|
|
369
|
-
constructor(e) {
|
|
370
|
-
this.element = e, this.saved = /* @__PURE__ */ new Map(), this.hadStyle = e.hasAttribute("style");
|
|
371
|
-
}
|
|
372
|
-
apply(e) {
|
|
373
|
-
let t = new Map(e.filter((e) => T(e.property) && (e.to === null || w(e.to))).map((e) => [e.property, e.to]));
|
|
374
|
-
for (let e of [...this.saved.keys()]) t.has(e) || this.restore(e);
|
|
375
|
-
let n = this.element.style;
|
|
376
|
-
for (let [e, r] of t) this.saved.has(e) || this.saved.set(e, [e, ...M[e] ?? []].map((e) => ({
|
|
377
|
-
name: e,
|
|
378
|
-
value: n.getPropertyValue(e),
|
|
379
|
-
priority: n.getPropertyPriority(e)
|
|
380
|
-
}))), n.setProperty(e, r ?? "unset", "important");
|
|
381
|
-
this.saved.size || this.cleanUp();
|
|
382
|
-
}
|
|
383
|
-
revert() {
|
|
384
|
-
for (let e of [...this.saved.keys()]) this.restore(e);
|
|
385
|
-
this.cleanUp();
|
|
386
|
-
}
|
|
387
|
-
restore(e) {
|
|
388
|
-
let t = this.saved.get(e);
|
|
389
|
-
this.saved.delete(e);
|
|
390
|
-
let n = this.element.style;
|
|
391
|
-
for (let { name: e } of [...t].reverse()) n.removeProperty(e);
|
|
392
|
-
let r = t[0];
|
|
393
|
-
if (r.value) n.setProperty(r.name, r.value, r.priority);
|
|
394
|
-
else for (let { name: e, value: r, priority: i } of t.slice(1)) r && n.setProperty(e, r, i);
|
|
395
|
-
}
|
|
396
|
-
cleanUp() {
|
|
397
|
-
!this.hadStyle && this.element.getAttribute("style") === "" && this.element.removeAttribute("style");
|
|
398
|
-
}
|
|
399
|
-
}, j = (e) => [
|
|
400
|
-
"top",
|
|
401
|
-
"right",
|
|
402
|
-
"bottom",
|
|
403
|
-
"left"
|
|
404
|
-
].map((t) => e.replace("*", t)), M = {
|
|
405
|
-
margin: j("margin-*"),
|
|
406
|
-
padding: j("padding-*"),
|
|
407
|
-
"border-width": j("border-*-width"),
|
|
408
|
-
"border-color": j("border-*-color"),
|
|
409
|
-
"border-style": j("border-*-style"),
|
|
410
|
-
"border-radius": [
|
|
411
|
-
"top-left",
|
|
412
|
-
"top-right",
|
|
413
|
-
"bottom-right",
|
|
414
|
-
"bottom-left"
|
|
415
|
-
].map((e) => `border-${e}-radius`),
|
|
416
|
-
gap: ["row-gap", "column-gap"]
|
|
417
|
-
};
|
|
418
|
-
//#endregion
|
|
419
|
-
//#region src/ui/uploads.tsx
|
|
420
|
-
l(h);
|
|
421
|
-
function N(n, i) {
|
|
422
|
-
let [s, c] = r([]), l = t(/* @__PURE__ */ new Map()), u = t(/* @__PURE__ */ new Map()), d = t(/* @__PURE__ */ new Map()), f = t(s);
|
|
423
|
-
f.current = s;
|
|
424
|
-
let p = (e, t) => c((n) => n.map((n) => n.key === e ? {
|
|
425
|
-
...n,
|
|
426
|
-
...t
|
|
427
|
-
} : n)), m = (t) => {
|
|
428
|
-
d.current.delete(t.key);
|
|
429
|
-
let r = new AbortController();
|
|
430
|
-
l.current.set(t.key, r), p(t.key, {
|
|
431
|
-
state: "uploading",
|
|
432
|
-
progress: 0
|
|
433
|
-
});
|
|
434
|
-
let i = n.upload(t.file, t.file.name, "file", {
|
|
435
|
-
signal: r.signal,
|
|
436
|
-
onProgress: (e) => p(t.key, { progress: e })
|
|
437
|
-
}).then((e) => {
|
|
438
|
-
d.current.set(t.key, e.id), p(t.key, {
|
|
439
|
-
state: "done",
|
|
440
|
-
progress: 1,
|
|
441
|
-
attachmentId: e.id
|
|
442
|
-
});
|
|
443
|
-
}).catch((n) => {
|
|
444
|
-
n instanceof e && n.code === "upload_cancelled" || (d.current.set(t.key, "failed"), p(t.key, { state: "failed" }));
|
|
445
|
-
}).finally(() => l.current.delete(t.key));
|
|
446
|
-
u.current.set(t.key, i);
|
|
447
|
-
};
|
|
448
|
-
return a(() => () => {
|
|
449
|
-
l.current.forEach((e) => e.abort()), f.current.forEach((e) => e.preview && URL.revokeObjectURL(e.preview));
|
|
450
|
-
}, []), {
|
|
451
|
-
items: s,
|
|
452
|
-
add: (e) => {
|
|
453
|
-
let t = f.current.map((e) => e.file), r = o(t, e, n.state.get().config?.limits.max_upload_bytes ?? 10485760), a = r.files.filter((e) => !t.includes(e)).map((e) => ({
|
|
454
|
-
key: crypto.randomUUID(),
|
|
455
|
-
file: e,
|
|
456
|
-
preview: e.type.startsWith("image/") ? URL.createObjectURL(e) : null,
|
|
457
|
-
progress: 0,
|
|
458
|
-
state: "uploading",
|
|
459
|
-
attachmentId: null
|
|
460
|
-
}));
|
|
461
|
-
c((e) => [...e, ...a]), a.forEach(m), r.problem && i(r.problem);
|
|
462
|
-
},
|
|
463
|
-
remove: (e) => {
|
|
464
|
-
l.current.get(e.key)?.abort(), e.preview && URL.revokeObjectURL(e.preview), c((t) => t.filter((t) => t.key !== e.key));
|
|
465
|
-
},
|
|
466
|
-
retry: m,
|
|
467
|
-
clear: () => {
|
|
468
|
-
d.current.clear(), f.current.forEach((e) => e.preview && URL.revokeObjectURL(e.preview)), c([]);
|
|
469
|
-
},
|
|
470
|
-
ready: async () => {
|
|
471
|
-
let e = f.current.map((e) => e.key);
|
|
472
|
-
await Promise.all(e.map((e) => u.current.get(e)));
|
|
473
|
-
let t = e.map((e) => d.current.get(e));
|
|
474
|
-
return {
|
|
475
|
-
ids: t.filter((e) => !!e && e !== "failed"),
|
|
476
|
-
missing: t.some((e) => e !== void 0 && e === "failed")
|
|
477
|
-
};
|
|
478
|
-
},
|
|
479
|
-
busy: s.some((e) => e.state === "uploading")
|
|
480
|
-
};
|
|
481
|
-
}
|
|
482
|
-
function P({ items: e, onRemove: t, onRetry: r, onOpen: a }) {
|
|
483
|
-
if (!e.length) return null;
|
|
484
|
-
let o = e.filter((e) => e.preview);
|
|
485
|
-
return /* @__PURE__ */ n("ul", {
|
|
486
|
-
class: "ck-uploads",
|
|
487
|
-
"aria-label": i("attachments"),
|
|
488
|
-
children: e.map((e) => /* @__PURE__ */ n("li", {
|
|
489
|
-
class: "ck-upload",
|
|
490
|
-
"data-state": e.state,
|
|
491
|
-
"data-image": e.preview ? "true" : void 0,
|
|
492
|
-
children: [
|
|
493
|
-
e.preview ? /* @__PURE__ */ n("button", {
|
|
494
|
-
class: "ck-upload-thumb",
|
|
495
|
-
"aria-label": i("openImage", { name: e.file.name }),
|
|
496
|
-
onClick: () => a?.(o.indexOf(e)),
|
|
497
|
-
children: /* @__PURE__ */ n("img", {
|
|
498
|
-
src: e.preview,
|
|
499
|
-
alt: ""
|
|
500
|
-
})
|
|
501
|
-
}) : /* @__PURE__ */ n("span", {
|
|
502
|
-
class: "ck-upload-name",
|
|
503
|
-
children: [/* @__PURE__ */ n(s, {
|
|
504
|
-
name: "paperclip",
|
|
505
|
-
size: 13
|
|
506
|
-
}), /* @__PURE__ */ n("bdi", { children: e.file.name })]
|
|
507
|
-
}),
|
|
508
|
-
e.state === "uploading" ? /* @__PURE__ */ n("span", {
|
|
509
|
-
class: "ck-upload-bar",
|
|
510
|
-
role: "progressbar",
|
|
511
|
-
"aria-label": i("uploading", { name: e.file.name }),
|
|
512
|
-
"aria-valuemin": 0,
|
|
513
|
-
"aria-valuemax": 100,
|
|
514
|
-
"aria-valuenow": Math.round(e.progress * 100),
|
|
515
|
-
children: /* @__PURE__ */ n("span", { style: { width: `${Math.round(e.progress * 100)}%` } })
|
|
516
|
-
}) : null,
|
|
517
|
-
e.state === "failed" ? /* @__PURE__ */ n("button", {
|
|
518
|
-
class: "ck-upload-retry",
|
|
519
|
-
"aria-label": i("retryUpload", { name: e.file.name }),
|
|
520
|
-
title: i("uploadFailedShort"),
|
|
521
|
-
onClick: () => r(e),
|
|
522
|
-
children: [/* @__PURE__ */ n(s, {
|
|
523
|
-
name: "alert",
|
|
524
|
-
size: 13
|
|
525
|
-
}), i("retry")]
|
|
526
|
-
}) : null,
|
|
527
|
-
/* @__PURE__ */ n("button", {
|
|
528
|
-
class: "ck-upload-remove",
|
|
529
|
-
"aria-label": i("removeFile", { name: e.file.name }),
|
|
530
|
-
onClick: () => t(e),
|
|
531
|
-
children: /* @__PURE__ */ n(s, {
|
|
532
|
-
name: "close",
|
|
533
|
-
size: 12
|
|
534
|
-
})
|
|
535
|
-
})
|
|
536
|
-
]
|
|
537
|
-
}))
|
|
538
|
-
});
|
|
539
|
-
}
|
|
540
|
-
//#endregion
|
|
541
|
-
export { E as a, k as c, h as d, A as i, y as l, N as n, D as o, x as r, w as s, P as t, _ as u };
|