UNPKG

sodesu-comment

Version:

Comment system with SolidJS

1,528 lines (1,523 loc) 67.9 kB
import { isDev as pe, isServer as ne, template as y, spread as st, insert as h, effect as E, setAttribute as I, delegateEvents as X, createComponent as f, memo as ue, use as Te, className as ze, classList as it, Portal as at } from "solid-js/web"; import { createRoot as W, createSignal as _, createMemo as A, createEffect as O, createUniqueId as lt, untrack as de, onMount as ct, onCleanup as Be, createResource as ut, Show as L, For as Pe, Index as De, Switch as dt, Match as re } from "solid-js"; import { reconcile as mt } from "solid-js/store"; const be = "0.5.0", Ne = { "Content-Type": "application/json" }, H = (e) => `${e.replace(/\/?$/, "/")}api/`, V = (e, t = "") => { if (typeof e == "object" && e.errno) throw new TypeError(`${t} failed with ${e.errno}: ${e.errmsg}`); return e; }, gt = ({ serverURL: e, lang: t, paths: n, type: r, signal: o }) => fetch(`${H(e)}article?path=${encodeURIComponent(n.join(","))}&type=${encodeURIComponent(r.join(","))}&lang=${t}`, { signal: o }).then((s) => s.json()).then((s) => V(s, "Get counter").data), ht = ({ serverURL: e, lang: t, path: n, type: r, action: o }) => fetch(`${H(e)}article?lang=${t}`, { method: "POST", headers: Ne, body: JSON.stringify({ path: n, type: r, action: o }) }).then((s) => s.json()).then((s) => V(s, "Update counter").data), ft = ({ serverURL: e, lang: t, path: n, page: r, pageSize: o, sortBy: s, signal: i, token: m }) => { const c = {}; return m && (c.Authorization = `Bearer ${m}`), fetch(`${H(e)}comment?path=${encodeURIComponent(n)}&pageSize=${o}&page=${r}&lang=${t}&sortBy=${s}`, { signal: i, headers: c }).then((l) => l.json()).then((l) => V(l, "Get comment data").data); }, vt = ({ serverURL: e, lang: t, token: n, comment: r }) => { const o = { "Content-Type": "application/json" }; return n && (o.Authorization = `Bearer ${n}`), fetch(`${H(e)}comment?lang=${t}`, { method: "POST", headers: o, body: JSON.stringify(r) }).then((s) => s.json()); }, pt = ({ serverURL: e, lang: t, token: n, objectId: r }) => fetch(`${H(e)}comment/${r}?lang=${t}`, { method: "DELETE", headers: { Authorization: `Bearer ${n}` } }).then((o) => o.json()).then((o) => V(o, "Delete comment")), Fe = ({ serverURL: e, lang: t, token: n, objectId: r, comment: o }) => fetch(`${H(e)}comment/${r}?lang=${t}`, { method: "PUT", headers: { ...Ne, Authorization: `Bearer ${n}` }, body: JSON.stringify(o) }).then((s) => s.json()).then((s) => V(s, "Update comment")), bt = ({ serverURL: e, lang: t, paths: n, signal: r }) => fetch(`${H(e)}comment?type=count&url=${encodeURIComponent(n.join(","))}&lang=${t}`, { signal: r }).then((o) => o.json()).then((o) => V(o, "Get comment count").data), $t = ({ lang: e, serverURL: t }) => { const n = (window.innerWidth - 450) / 2, r = (window.innerHeight - 450) / 2, o = window.open(`${t.replace(/\/$/, "")}/ui/login?lng=${encodeURIComponent(e)}`, "_blank", `width=450,height=450,left=${n},top=${r},scrollbars=no,resizable=no,status=no,location=no,toolbar=no,menubar=no`); return o?.postMessage({ type: "TOKEN", data: null }, "*"), new Promise((s) => { const i = ({ data: m }) => { !m || typeof m != "object" || m.type !== "userInfo" || m.data.token && (o?.close(), window.removeEventListener("message", i), s(m.data)); }; window.addEventListener("message", i); }); }, wt = ({ serverURL: e, lang: t, paths: n, signal: r }) => gt({ serverURL: e, lang: t, paths: n, type: ["time"], signal: r }), yt = (e) => ht({ ...e, type: "time", action: "inc" }), kt = (e) => ( // \u00C0-\u024F are Latin Supplement letters, maybe used in language like french // \u0400-\u04FF are Cyrillic letters, used in russian e.match(/[\w\s,.\u00C0-\u024F\u0400-\u04FF]+/giu) ), xt = (e) => e.match(/[\u4E00-\u9FD5]/gu), Ct = (e) => (kt(e)?.reduce( (t, n) => t + (["", ",", "."].includes(n.trim()) ? 0 : n.trim().split(/\s+/u).length), 0 ) ?? 0) + (xt(e)?.length ?? 0), Q = (e, t, n, r) => r ? [e, t, n, r] : [e, t, n]; function Oe(e, t) { let n = ""; typeof t == "number" && (n = " ".repeat(t)), typeof t == "string" ? n = t : n = e.match(/^([\t ])+/)?.[0] ?? ""; const r = new RegExp(`^${n}`, "gm"); return e.replace(r, ""); } function fe(e) { return (e + "").replace(/"/g, "&quot;").replace(/</g, "&lt;").replace(/>/g, "&gt;"); } function U(e, t, n) { const r = n ? ve(n) : ""; return `<${e}${r}>${Array.isArray(t) ? t.join("") : t}</${e}>`; } function _t(e = "") { const t = [], n = []; let r = ""; for (const { groups: s } of e.matchAll(/(?<attr_name>\w+)="(?<attr_val>[^"]+)"|(?:\.(?<cls>[\w-]+))|(?:#(?<id>[\w-]+))/g)) s?.id ? r = s?.id : s?.cls ? n.push(s?.cls) : t.push(`${s?.attr_name}="${s?.attr_val}"`); const o = [ t.join(" "), n.length ? `class="${n.join(" ")}"` : "", r ? `id="${r}"` : "" ].filter(Boolean).join(" ").trim(); return o ? ` ${o}` : ""; } function Lt(e) { const t = e.replace(/^<\/?([A-z]+)[> /][.\n\r\t\S\s]*/m, "$1"); return /^(?:a|abbr|acronym|audio|b|bdi|bdo|big|br|button|canvas|cite|code|data|datalist|del|dfn|em|embed|i|iframe|img|input|ins|kbd|label|map|mark|meter|noscript|object|output|picture|progress|q|ruby|s|samp|script|select|slot|small|span|strong|sub|sup|svg|template|textarea|time|u|tt|var|video|wbr)$/.test(t); } function* He(e, t) { let n = 0; for (const r of e) { if (t(r, n++)) break; yield r; } } function ve(e) { const t = Object.entries(e).filter(([n, r]) => r != null && typeof n != "symbol").map(([n, r]) => typeof r == "boolean" ? n : `${n}="${r}"`).join(" ").trim(); return t && ` ${t}`; } function St(e) { const t = []; for (const [n, { regex: r }] of e) t.push(`(?:${r.source.replace(/\\k<([^>]+?)>/giu, `\\k<${n}__$1>`)})`.replace(/\(\?<((?:[^=!])[^>]*?)>/giu, `(?<${n}__$1>`)); return new RegExp(t.join("|"), "guid"); } function It(e) { const t = new Map(e.map((c) => [c.name, c])), n = St(t); function* r(c) { let l = 0; for (; l < c.length; ) { const a = o(c, l); a[1] !== l && (yield Q(c.slice(l, a[1]), l, a[1])), l = a[2], yield a; } } function o(c, l) { n.lastIndex = -1; const a = n.exec(c.slice(l)); if (!a) return [c.slice(l), l, c.length]; const { groups: u, index: v, 0: { length: p } } = a, b = Object.entries(u ?? {}).filter((g) => g[1]), w = Object.fromEntries(b.map(([g, C]) => [g.split("__")[1], C])), d = l + v + p, [$] = b[0]?.[0].split("__") ?? [], { handler: x } = t.get($ ?? ""), k = x(w, { index: l + v, src: c, length: p, lastIndex: d, ...m }); return Array.isArray(k) ? k : Q(k, l + v, d, w); } function s(c) { return [...r(c)].map(([l]) => l).flat(1 / 0).join(""); } function i(c) { let l = ""; const a = /(?:\r?\n)+(```[^\n]*|::: ?[^\n]*|-{3,}|\* \* \*(?: \*)*)(?:\r?\n)+/gm, u = /(\r?\n[^\r\n >].*)(?:\r?\n)(>)/gm, v = /(\r?\n[>] .*)(?:\r?\n)([^\r\n >])/gm, p = ` ${c} `.replace(a, ` $1 `).replace(u, `$1 $2`).replace(v, `$1 $2`), b = / *(?:\r?\n){2,}/gm, w = p.split(b); let d = !1; const $ = w.reduce((k, g) => d ? (k[k.length - 1] += d === ":::" ? ` ${g}` : ` ${g}`, g === d && (d = !1), k) : ((/```[^\n]*/.test(g) || /::: ?[^\n]*/.test(g)) && (d = g.trim().slice(0, 3)), g && k.push(g.replace(/(?:^\n+|\n+$)/g, "")), k), []); let x = $.length; for (; x--; ) { const k = $[x] ?? "", g = s(k); l = (g && (!g.startsWith("<") || Lt(g)) ? `<p>${g.trim()}</p>` : g) + l; } return l.trim(); } const m = { parse: i, parseIter: r, parseNext: o, parseParagraph: s }; return m; } const oe = Symbol("isLinkEnd"), Et = { name: "anchor", regex: /(?<start>\[)|(?<end>\])(?:\((?<href>[^")]+?)(?: "(?<title>[^"]+)")?\))?(?:\{:(?<ial>.+?)\})?/, handler: ({ start: e, href: t, title: n, ial: r }, { index: o, src: s, lastIndex: i, parseNext: m, parseIter: c }) => { if (!e) return ["", o, i, { href: t, title: n, ial: r, [oe]: !0 }]; const l = [...He(c(s.slice(o + 1)), (w) => w[3]?.[oe])], a = l.map(([w]) => w).join(""), u = l.at(-1)?.[2] ?? 0, v = m(s, o + u + 1), { ial: p, ...b } = v[3] ?? {}; return Q(`<a${ve(b ?? {})}${_t(p)}>${a}</a>`, o, v[2], { content: a, ...v[3], [oe]: !1 }); } }, Rt = { name: "bis", regex: /(?<t>\*\*?|__?|~~)(?<content>.*?)(?<ns>[^\\\n])\k<t>/, handler: ({ t: e, content: t, ns: n }, { parseParagraph: r }) => { const o = e === "~~" ? "s" : e?.length === 1 ? "em" : "strong"; return U(o, r((t ?? "") + n)); } }, At = { name: "codeblock", regex: /^```\s*(?<lang>\w*)\n(?<str>[\s\S]+)\n```(?:\n|$)/, handler: ({ lang: e, str: t }) => `<pre class="code ${e ?? ""}"><code${e ? ` class="language-${e.toLowerCase()}"` : ""}>${Oe(fe(t ?? "").replace(/(?:^\n+|\n+$)/g, ""))}</code></pre>` }, Mt = { name: "escape", regex: /\\(?<c>.)/i, handler: ({ c: e }) => e ?? "" }, jt = { name: "fencedDiv", regex: /^::: ?(?<cls>[^\n]+)?\n(?<content>[\s\S]+?)\n:::(?:\n|$)/, handler: ({ cls: e, content: t }, { parse: n }) => `<div class="${["fenced", e ?? ""].join(" ").trim()}">${n(t ?? "")}</div>` }, Ut = { name: "hashHeading", regex: /^(?<level>#{1,6})\s*(?<txt>.+)(?:\n|$)/, handler: ({ level: e, txt: t }, { parseParagraph: n }) => U(`h${e?.length}`, n(t ?? "")) }, Tt = { name: "hr", regex: /(?<p>^|n\*)(?<l>-{3,}|\*(?: \*){2,})(?:$|\n+)/i, handler: () => "<hr />" }, zt = { name: "html", regex: /<(?<tagContent>[^>]+)>/, handler: ({ tagContent: e }) => `<${e}>` }, Bt = { name: "image", regex: /!\[(?<alt>[^\\)]*)\]\((?<src>[^" ]+?)(?: "(?<title>[^"]+)")?\)/, handler: ({ alt: e = "", src: t, title: n }) => `<img${ve({ src: t, alt: e, title: n })} />` }, Pt = { name: "inlineCode", regex: /`(?<c>[^`]*)?`/, handler: ({ c: e }) => U("code", fe(e ?? "")) }, Dt = { name: "newLine", regex: /(?<lb> {2}\n)/, handler: () => "<br />" }, $e = (e) => e.replace(/^\d+[.)]\s+/, "").trim(), Nt = { name: "ol", regex: /^(?<all>(?:\n?\d+[.)]\s+)[.\n\r\t\S\s]+)/, handler: ({ all: e }, { parseParagraph: t }) => { const n = e?.split(/\n(?=\d)/g), r = n?.some((c) => c.endsWith(` `)), [o, ...s] = n ?? [], i = o?.match(/^\d+/)?.[0], m = r ? (c) => U("p", t(c)) : (c) => t(c); return U("ol", [ U("li", m($e(o ?? ""))), ...s.map((c) => U("li", m($e(c)))) ], { start: i == "1" ? null : i }); } }, Ft = { name: "poetry", regex: /(?:^|\n+)(?<tab>\t| {4})(?<content>[\s\S]+)(?:$|\n{2,})*/, handler: ({ content: e, tab: t }) => `<pre class="code poetry">${Oe(U("code", fe(e ?? "")), t)}</pre>` }, Ot = { name: "quote", regex: /^(?<all>(?:>\s+[^$\n]+(?:\n|$))+)/, handler: ({ all: e }, { parseParagraph: t }) => U("blockquote", t(e?.split(` `).map((n) => n.slice(1).trim()).join(` `) ?? "")) }, we = Symbol("table"), Ht = { name: "table", regex: /^(?:(?<loose>^\| *[^$|\n]+(?:\|? *[^$|\n]+)+\|?)|(?<defined>(?:\| *[^$|\n]+)+ *\|))(?<heading>(?:\n)\|? *-{3,} *?(?:\| *-{3,} *)*\|?)?(?:\n|$)/, handler: ({ loose: e, defined: t, heading: n }, { index: r, lastIndex: o, src: s, parseIter: i, parseParagraph: m }) => { const c = !!n, l = (e ?? t)?.match(/\s*([^|]+)\s*(?=\||$)/gmu), a = [ ...He(i(s.slice(o)), ([, , , p]) => !p?.[we]) ], u = [ l.map((p) => p.trim()), ...a.flatMap(([, , , p]) => p?.cells) ], v = u.map((p, b) => U("tr", p.map((w) => U(b === 0 && c ? "th" : "td", m(w))))); return Q(U("table", v), r, o + (a.at(-1)?.[2] ?? 0), { cells: u, hasHeading: c, [we]: !0 }); } }, Wt = { name: "ul", regex: /^(?<all>(?:\n?[*+-]\s+[.\n\r\t\S\s]+)+)/, handler: ({ all: e }, { parseParagraph: t }) => U("ul", e?.slice(1).split(/\n[*+-]/g).map((n) => U("li", t(n.trim()))) ?? "") }, Vt = { name: "underlineHeading", regex: /^(?<txt>[^\n]+)\n(?<line>-{3,}|={3,})(?:\n|$)/, handler: ({ txt: e, line: t }, { parseParagraph: n }) => U(`h${t?.[0] === "=" ? "1" : "2"}`, n(e ?? "")) }, Gt = [ Mt, // must always come first Tt, // must always come second // the remaining order doesn't matter Et, Rt, At, jt, Ut, zt, Bt, Pt, Dt, Nt, Ft, Ot, Ht, Wt, Vt ]; function qt(e, { plugins: t = [...Gt] } = {}) { if (!e) return "<p></p>"; const { parse: n } = It(t); return n(e); } const Jt = ["nick", "mail", "link"], ye = (e) => e.filter((t) => Jt.includes(t)), ke = [ "//unpkg.com/@waline/emojis@1.1.0/weibo" ], Kt = [ "//unpkg.com/@waline/emojis/tieba/tieba_agree.png", "//unpkg.com/@waline/emojis/tieba/tieba_look_down.png", "//unpkg.com/@waline/emojis/tieba/tieba_sunglasses.png", "//unpkg.com/@waline/emojis/tieba/tieba_pick_nose.png", "//unpkg.com/@waline/emojis/tieba/tieba_awkward.png", "//unpkg.com/@waline/emojis/tieba/tieba_sleep.png" ], Xt = (e) => new Promise((t, n) => { if (e.size > 128 * 1e3) return n(new Error("File too large! File size limit 128KB")); const r = new FileReader(); r.readAsDataURL(e), r.onload = () => t(r.result), r.onerror = n; }), Yt = (e) => e ? '<p class="wl-tex">TeX is not available in preview</p>' : '<span class="wl-tex">TeX is not available in preview</span>', Zt = (e) => { const t = async (n, r = {}) => fetch( `https://api.giphy.com/v1/gifs/${n}?${new URLSearchParams({ lang: e, limit: "20", rating: "g", // eslint-disable-next-line @typescript-eslint/naming-convention api_key: "6CIMLkNMMOhRcXPoMCPkFy4Ybk2XUiMp", ...r }).toString()}` ).then((o) => o.json()).then( ({ data: o }) => o.map((s) => ({ title: s.title, src: s.images.downsized_medium.url })) ); return { search: (n) => t("search", { q: n, offset: "0" }), default: () => t("trending", {}), more: (n, r = 0) => t("search", { q: n, offset: r.toString() }) }; }, Qt = /[\u4E00-\u9FFF\u3400-\u4DBF\uF900-\uFAFF\u3040-\u309F\uAC00-\uD7AF\u0400-\u04FF]+|\w+/, en = /</, tn = /(?:^|\s)\/\/(.+)$/gm, nn = /\/\*([\s\S]*?)\*\//g, rn = new RegExp( `(${Qt.source}|${en.source})|((?:${tn.source})|(?:${nn.source}))`, "gim" ), xe = [ "23AC69", "91C132", "F19726", "E8552D", "1AAB8E", "E1147F", "2980C1", "1BA1E6", "9FA0A0", "F19726", "E30B20", "E30B20", "A3338B" ], se = {}, on = (e) => { let t = 0; return e.replace(rn, (n, r, o) => { if (o) return `<span style="color: slategray">${o}</span>`; if (r === "<") return "&lt;"; let s; se[r] ? s = se[r] : (s = xe[t], se[r] = s); const i = `<span style="color: #${s}">${r}</span>`; return t = ++t % xe.length, i; }); }, sn = [ "nick", "nickError", "mail", "mailError", "link", "optional", "placeholder", "sofa", "submit", "like", "cancelLike", "reply", "cancelReply", "comment", "refresh", "more", "preview", "emoji", "uploadImage", "seconds", "minutes", "hours", "days", "now", "uploading", "login", "logout", "admin", "sticky", "word", "wordHint", "anonymous", "level0", "level1", "level2", "level3", "level4", "level5", "gif", "gifSearchPlaceholder", "profile", "approved", "waiting", "spam", "unsticky", "oldest", "latest", "hottest", "reactionTitle" ], z = (e) => Object.fromEntries( e.map((t, n) => [sn[n], t]) ), an = z([ "Benutzername", "Der Benutzername darf nicht weniger als 3 Bytes umfassen.", "E-Mail", "Bitte bestätigen Sie Ihre E-Mail-Adresse.", "Webseite", "Optional", "Kommentieren Sie hier...", "Noch keine Kommentare.", "Senden", "Gefällt mir", "Gefällt mir nicht mehr", "Antworten", "Antwort abbrechen", "Kommentare", "Aktualisieren", "Mehr laden...", "Vorschau", "Emoji", "Ein Bild hochladen", "Vor einigen Sekunden", "Vor einigen Minuten", "Vor einigen Stunden", "Vor einigen Tagen", "Gerade eben", "Hochladen läuft", "Anmelden", "Abmelden", "Admin", "Angeheftet", "Wörter", "Bitte geben Sie Kommentare zwischen $0 und $1 Wörtern ein! Aktuelle Anzahl der Wörter: $2", "Anonym", "Zwerge", "Hobbits", "Ents", "Magier", "Elfen", "Maïar", "GIF", "Nach einem GIF suchen", "Profil", "Genehmigt", "Ausstehend", "Spam", "Lösen", "Älteste", "Neueste", "Am beliebtesten", "Was denken Sie?" ]), Ce = z([ "NickName", "NickName cannot be less than 3 bytes.", "E-Mail", "Please confirm your email address.", "Website", "Optional", "Comment here...", "No comment yet.", "Submit", "Like", "Cancel like", "Reply", "Cancel reply", "Comments", "Refresh", "Load More...", "Preview", "Emoji", "Upload Image", "seconds ago", "minutes ago", "hours ago", "days ago", "just now", "Uploading", "Login", "logout", "Admin", "Sticky", "Words", `Please input comments between $0 and $1 words! Current word number: $2`, "Anonymous", "Dwarves", "Hobbits", "Ents", "Wizards", "Elves", "Maiar", "GIF", "Search GIF", "Profile", "Approved", "Waiting", "Spam", "Unsticky", "Oldest", "Latest", "Hottest", "What do you think?" ]), _e = z([ "Nombre de usuario", "El nombre de usuario no puede tener menos de 3 bytes.", "Correo electrónico", "Por favor confirma tu dirección de correo electrónico.", "Sitio web", "Opcional", "Comenta aquí...", "Sin comentarios todavía.", "Enviar", "Like", "Anular like", "Responder", "Anular respuesta", "Comentarios", "Recargar", "Cargar Más...", "Previsualizar", "Emoji", "Subir Imagen", "segundos atrás", "minutos atrás", "horas atrás", "días atrás", "justo ahora", "Subiendo", "Iniciar sesión", "cerrar sesión", "Admin", "Fijado", "Palabras", `Por favor escriba entre $0 y $1 palabras! El número actual de palabras: $2`, "Anónimo", "Enanos", "Hobbits", "Ents", "Magos", "Elfos", "Maiar", "GIF", "Buscar GIF", "Perfil", "Aprobado", "Esperando", "Spam", "Desfijar", "Más antiguos", "Más recientes", "Más vistos", "¿Qué piensas?" ]), Le = z([ "Pseudo", "Le pseudo ne peut pas faire moins de 3 octets.", "E-mail", "Veuillez confirmer votre adresse e-mail.", "Site Web", "Optionnel", "Commentez ici...", "Aucun commentaire pour l'instant.", "Envoyer", "J'aime", "Annuler le j'aime", "Répondre", "Annuler la réponse", "Commentaires", "Actualiser", "Charger plus...", "Aperçu", "Emoji", "Télécharger une image", "Il y a quelques secondes", "Il y a quelques minutes", "Il y a quelques heures", "Il y a quelques jours", "À l'instant", "Téléchargement en cours", "Connexion", "Déconnexion", "Admin", "Épinglé", "Mots", `Veuillez saisir des commentaires entre $0 et $1 mots ! Nombre actuel de mots : $2`, "Anonyme", "Nains", "Hobbits", "Ents", "Mages", "Elfes", "Maïar", "GIF", "Rechercher un GIF", "Profil", "Approuvé", "En attente", "Indésirable", "Détacher", "Le plus ancien", "Dernier", "Le plus populaire", "Qu'en pensez-vous ?" ]), Se = z([ "ニックネーム", "3バイト以上のニックネームをご入力ください.", "メールアドレス", "メールアドレスをご確認ください.", "サイト", "オプション", "ここにコメント", "コメントしましょう~", "提出する", "Like", "Cancel like", "返信する", "キャンセル", "コメント", "更新", "さらに読み込む", "プレビュー", "絵文字", "画像をアップロード", "秒前", "分前", "時間前", "日前", "たっだ今", "アップロード", "ログインする", "ログアウト", "管理者", "トップに置く", "ワード", `コメントは $0 から $1 ワードの間でなければなりません! 現在の単語番号: $2`, "匿名", "うえにん", "なかにん", "しもおし", "特にしもおし", "かげ", "なぬし", "GIF", "探す GIF", "個人情報", "承認済み", "待っている", "スパム", "べたつかない", "逆順", "正順", "人気順", "どう思いますか?" ]), ln = z([ "Apelido", "Apelido não pode ser menor que 3 bytes.", "E-Mail", "Por favor, confirme seu endereço de e-mail.", "Website", "Opcional", "Comente aqui...", "Nenhum comentário, ainda.", "Enviar", "Like", "Cancel like", "Responder", "Cancelar resposta", "Comentários", "Refrescar", "Carregar Mais...", "Visualizar", "Emoji", "Enviar Imagem", "segundos atrás", "minutos atrás", "horas atrás", "dias atrás", "agora mesmo", "Enviando", "Entrar", "Sair", "Admin", "Sticky", "Palavras", `Favor enviar comentário com $0 a $1 palavras! Número de palavras atuais: $2`, "Anônimo", "Dwarves", "Hobbits", "Ents", "Wizards", "Elves", "Maiar", "GIF", "Pesquisar GIF", "informação pessoal", "Aprovado", "Espera", "Spam", "Unsticky", "Mais velho", "Mais recentes", "Mais quente", "O que você acha?" ]), Ie = z([ "Псевдоним", "Никнейм не может быть меньше 3 байт.", "Эл. адрес", "Пожалуйста, подтвердите адрес вашей электронной почты.", "Веб-сайт", "Необязательный", "Комментарий здесь...", "Пока нет комментариев.", "Отправить", "Like", "Cancel like", "Отвечать", "Отменить ответ", "Комментарии", "Обновить", "Загрузи больше...", "Превью", "эмодзи", "Загрузить изображение", "секунд назад", "несколько минут назад", "несколько часов назад", "дней назад", "прямо сейчас", "Загрузка", "Авторизоваться", "Выход из системы", "Админ", "Липкий", "Слова", `Пожалуйста, введите комментарии от $0 до $1 слов! Номер текущего слова: $2`, "Анонимный", "Dwarves", "Hobbits", "Ents", "Wizards", "Elves", "Maiar", "GIF", "Поиск GIF", "Персональные данные", "Одобренный", "Ожидающий", "Спам", "Нелипкий", "самый старый", "последний", "самый горячий", "Что вы думаете?" ]), Ee = z([ "Tên", "Tên không được nhỏ hơn 3 ký tự.", "E-Mail", "Vui lòng xác nhập địa chỉ email của bạn.", "Website", "Tùy chọn", "Hãy bình luận có văn hoá!", "Chưa có bình luận", "Gửi", "Thích", "Bỏ thích", "Trả lời", "Hủy bỏ", "bình luận", "Làm mới", "Tải thêm...", "Xem trước", "Emoji", "Tải lên hình ảnh", "giây trước", "phút trước", "giờ trước", "ngày trước", "Vừa xong", "Đang tải lên", "Đăng nhập", "đăng xuất", "Quản trị viên", "Dính", "từ", `Bình luận phải có độ dài giữa $0 và $1 từ! Số từ hiện tại: $2`, "Vô danh", "Người lùn", "Người tí hon", "Thần rừng", "Pháp sư", "Tiên tộc", "Maiar", "Ảnh GIF", "Tìm kiếm ảnh GIF", "thông tin cá nhân", "Đã được phê duyệt", "Đang chờ đợi", "Thư rác", "Không dính", "lâu đời nhất", "muộn nhất", "nóng nhất", "What do you think?" ]), Re = z([ "昵称", "昵称不能少于3个字符", "邮箱", "请填写正确的邮件地址", "网址", "可选", "欢迎评论", "来发评论吧~", "提交", "喜欢", "取消喜欢", "回复", "取消回复", "评论", "刷新", "加载更多...", "预览", "表情", "上传图片", "秒前", "分钟前", "小时前", "天前", "刚刚", "正在上传", "登录", "退出", "博主", "置顶", "字", `评论字数应在 $0 到 $1 字之间! 当前字数:$2`, "匿名", "潜水", "冒泡", "吐槽", "活跃", "话痨", "传说", "表情包", "搜索表情包", "个人资料", "通过", "待审核", "垃圾", "取消置顶", "按倒序", "按正序", "按热度", "你认为这篇文章怎么样?" ]), cn = z([ "暱稱", "暱稱不能少於3個字元", "郵箱", "請填寫正確的郵件地址", "網址", "可選", "歡迎留言", "來發留言吧~", "送出", "喜歡", "取消喜歡", "回覆", "取消回覆", "留言", "重整", "載入更多...", "預覽", "表情", "上傳圖片", "秒前", "分鐘前", "小時前", "天前", "剛剛", "正在上傳", "登入", "登出", "管理者", "置頂", "字", `留言字數應在 $0 到 $1 字之間! 目前字數:$2`, "匿名", "潛水", "冒泡", "吐槽", "活躍", "多話", "傳說", "表情包", "搜尋表情包", "個人資料", "通過", "待審核", "垃圾", "取消置頂", "最早", "最新", "熱門", "你認為這篇文章怎麼樣?" ]), We = "en-US", me = { zh: Re, "zh-cn": Re, "zh-tw": cn, en: Ce, "en-us": Ce, fr: Le, "fr-fr": Le, jp: Se, "jp-jp": Se, "pt-br": ln, ru: Ie, "ru-ru": Ie, vi: Ee, "vi-vn": Ee, de: an, es: _e, "es-mx": _e }, un = (e) => ( // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition me[e.toLowerCase()] || me[We.toLowerCase()] ), Ae = (e) => Object.keys(me).includes(e.toLowerCase()) ? e : We, Ve = (e) => { try { e = decodeURI(e); } catch { } return e; }, dn = (e = "") => e.replace(/\/$/u, ""), Ge = (e) => /^(https?:)?\/\//.test(e), ee = (e) => { const t = dn(e); return Ge(t) ? t : `https://${t}`; }, mn = (e) => Array.isArray(e) ? e : e ? [0, e] : !1, J = (e, t) => e == null || e === !0 ? t : e === !1 ? null : e, gn = ({ serverURL: e, path: t = location.pathname, lang: n = typeof navigator > "u" ? "en-US" : navigator.language, locale: r, meta: o = ["nick", "mail", "link"], requiredMeta: s = [], dark: i = !1, pageSize: m = 10, wordLimit: c, noCopyright: l = !1, login: a = "enable", recaptchaV3Key: u = "", turnstileKey: v = "", commentSorting: p = "latest", emoji: b = ke, imageUploader: w, highlighter: d, texRenderer: $, search: x, reaction: k, ...g }) => ({ serverURL: ee(e), path: Ve(t), lang: Ae(n), locale: { ...un(Ae(n)), ...typeof r == "object" ? r : {} }, wordLimit: mn(c), meta: ye(o), requiredMeta: ye(s), dark: i, pageSize: m, commentSorting: p, login: a, noCopyright: l, recaptchaV3Key: u, turnstileKey: v, ...g, // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing reaction: k === !0 ? Kt : k || null, imageUploader: J(w, Xt), highlighter: J(d, on), texRenderer: J($, Yt), emoji: J(b, ke), search: J(x, Zt(n)) }), qe = (e) => typeof e == "string", ie = (e, t) => { let n = e.toString(); for (; n.length < t; ) n = `0${n}`; return n; }, hn = (e) => { const t = ie(e.getDate(), 2), n = ie(e.getMonth() + 1, 2); return `${ie(e.getFullYear(), 2)}-${n}-${t}`; }, fn = (e, t, n) => { if (!e) return ""; const r = qe(e) ? new Date(e.includes(" ") ? e.replace(/-/g, "/") : e) : e, o = t.getTime() - r.getTime(), s = Math.floor(o / (24 * 3600 * 1e3)); if (s === 0) { const i = o % 864e5, m = Math.floor(i / (3600 * 1e3)); if (m === 0) { const c = i % 36e5, l = Math.floor(c / (60 * 1e3)); if (l === 0) { const a = c % 6e4; return `${Math.round(a / 1e3)} ${n.seconds}`; } return `${l} ${n.minutes}`; } return `${m} ${n.hours}`; } return s < 0 ? n.now : s < 8 ? `${s} ${n.days}` : hn(r); }, Je = (e) => { e.name !== "AbortError" && console.error(e.message); }, vn = (e) => e instanceof HTMLElement ? e : qe(e) ? document.querySelector(e) : null, ge = (e) => { const { path: t } = e.dataset; return t?.length ? t : null; }, pn = ({ serverURL: e, path: t = window.location.pathname, selector: n = ".waline-comment-count", lang: r = navigator.language }) => { const o = new AbortController(), s = document.querySelectorAll(n); return s.length && bt({ serverURL: ee(e), paths: Array.from(s).map((i) => Ve(ge(i) ?? t)), lang: r, signal: o.signal }).then((i) => { s.forEach((m, c) => { m.innerText = i[c].toString(); }); }).catch(Je), o.abort.bind(o); }, Me = (e, t) => { t.forEach((n, r) => { const o = e[r].time; typeof o == "number" && (n.innerText = o.toString()); }); }, bn = ({ serverURL: e, path: t = window.location.pathname, selector: n = ".waline-pageview-count", update: r = !0, lang: o = navigator.language }) => { const s = new AbortController(), i = Array.from( // pageview selectors document.querySelectorAll(n) ), m = (l) => { const a = ge(l); return a !== null && t !== a; }, c = (l) => wt({ serverURL: ee(e), paths: l.map((a) => ge(a) ?? t), lang: o, signal: s.signal }).then((a) => Me(a, l)).catch(Je); if (r) { const l = i.filter((u) => !m(u)), a = i.filter(m); yt({ serverURL: ee(e), path: t, lang: o }).then((u) => Me(u, l)), a.length && c(a); } else c(i); return s.abort.bind(s); }, T = W(() => { const [e, t] = _({ serverURL: "", path: "" }), [n, r] = _(""), o = A(() => ({ ...gn(e()), commentClassName: n(), renderPreview: e().renderPreview || (async (b) => qt(b)) })), s = A(() => o().locale), [i, m] = _(void 0), [c, l] = _(void 0), a = ({ el: b = "#sodesu", path: w = window.location.pathname, ...d }) => { const $ = b ? vn(b) : null; if (b && !$) throw new Error("Option 'el' do not match any domElement!"); if (!$) throw new Error("Cannot get root!"); if (!d.serverURL) throw new Error("Option 'serverURL' is missing!"); return t({ ...d, path: w }), r(d.commentClassName || ""), m(d.pageview), l(d.comment), $; }, u = (b) => { t((w) => ({ ...w, ...b })), b.commentClassName && r(b.commentClassName); }, v = () => { i() && bn({ serverURL: o().serverURL, path: o().path, selector: typeof i() == "string" ? i() : void 0 }); }, p = () => { c() && pn({ serverURL: o().serverURL, path: o().path, selector: typeof c() == "string" ? c() : void 0 }); }; return O(() => { v(); }), O(() => { p(); }), { setProps: t, config: o, locale: s, init: a, update: u, commentClassName: n }; }); function Ke(e, t = {}) { const n = t.storage || globalThis.localStorage, r = t.name || `storage-${lt()}`; if (!n) return [e[0], e[1], null]; const o = t.storageOptions, s = t.serialize || JSON.stringify.bind(JSON), i = t.deserialize || JSON.parse.bind(JSON), m = n.getItem(r, o), c = typeof e[0] == "function" ? (a) => { try { const u = i(a); e[1](() => u); } catch (u) { pe && console.warn(u); } } : (a) => { try { const u = i(a); e[1](mt(u)); } catch (u) { pe && console.warn(u); } }; let l = !0; if (m instanceof Promise ? m.then((a) => l && a && c(a)) : m && c(m), typeof t.sync?.[0] == "function") { const a = typeof e[0] == "function" ? e[0] : () => e[0]; t.sync[0]((u) => { u.key !== r || !ne && (u.url || globalThis.location.href) !== globalThis.location.href || u.newValue === s(de(a)) || c(u.newValue); }); } return [ e[0], typeof e[0] == "function" ? (a) => { const u = e[1](a), v = a != null ? s(u) : a; return t.sync?.[1](r, v), v != null ? n.setItem(r, v, o) : n.removeItem(r, o), l = !1, u; } : (...a) => { e[1](...a); const u = s(de(() => e[0])); t.sync?.[1](r, u), n.setItem(r, u, o), l = !1; }, m ]; } const B = W(() => { const [e, t] = Ke(_(null), { name: "WALINE_USER", deserialize: (s) => { try { return JSON.parse(s); } catch { return null; } }, serialize: (s) => JSON.stringify(s) }), n = A(() => !!e()?.token), r = A(() => e()?.type === "administrator"), o = ({ data: s }) => { !s || s.type !== "profile" || (t((i) => ({ ...i, ...s.data })), [localStorage, sessionStorage].filter((i) => i.getItem("WALINE_USER")).forEach((i) => i.setItem("WALINE_USER", JSON.stringify(e)))); }; return ct(() => { window.addEventListener("message", o); }), Be(() => { window.removeEventListener("message", o); }), { userInfo: e, isLogin: n, setUserInfo: t, isAdmin: r }; }); async function $n() { const { config: e } = T, { setUserInfo: t } = B, n = await $t({ serverURL: e().serverURL, lang: e().lang }), { remember: r, ...o } = n; t({ ...o }); } async function wn() { const { setUserInfo: e } = B; e(null), localStorage.removeItem("WALINE_USER"), sessionStorage.removeItem("WALINE_USER"), K(); } async function je() { const { config: e } = T, { userInfo: t } = B, { serverURL: n, lang: r } = e(), o = 800, s = 800, i = (window.innerWidth - o) / 2, m = (window.innerHeight - s) / 2, c = new URLSearchParams({ lng: r, token: t().token }); window.open( `${n}/ui/profile?${c.toString()}`, "_blank", `width=${o},height=${s},left=${i},top=${m},scrollbars=no,resizable=no,status=no,location=no,toolbar=no,menubar=no` )?.postMessage({ type: "TOKEN", data: t().token }, "*"); } const Xe = { latest: "insertedAt_desc", oldest: "insertedAt_asc", hottest: "like_desc" }, yn = Object.keys(Xe); function he(e) { const [t, n] = _( Ye("children" in e ? e.children : []) ), [r, o] = _(e.like || 0), [s, i] = _(e.comment), [m, c] = _(e.orig); return { ...e, time: e.time, children: t, setChildren: n, like: r, setLike: o, comment: s, setComment: i, orig: m, setOrig: c }; } function Ye(e) { return e.map((t) => he(t)); } const G = W(() => { const { config: e } = T, [t, n] = _("loading"), [r, o] = _(e().commentSorting), [s, i] = _(1), [m, c] = _(1), [l, a] = _([]), [u, v] = _(0); return { status: t, sorting: r, page: s, count: m, data: l, totalPages: u, setStatus: n, setSorting: o, setPage: i, setCount: c, setData: a, setTotalPages: v }; }); let Ue; function Ze(e) { const { sorting: t, setStatus: n, setCount: r, setData: o, setPage: s, setTotalPages: i } = G, { config: m } = T, { userInfo: c } = B, l = new AbortController(); n("loading"), Ue?.(), ft({ serverURL: m().serverURL, lang: m().lang, path: m().path, pageSize: m().pageSize, sortBy: Xe[t()], page: e, signal: l.signal, token: c()?.token }).then((a) => { n("success"), r(a.count), o((u) => u.concat(...Ye(a.data))), s(e), i(a.totalPages); }).catch((a) => { a.name !== "AbortError" && (console.error(a.message), n("error")); }), Ue = l.abort.bind(l); } function kn() { const { page: e } = G; Ze(e() + 1); } function K() { const { setCount: e, setData: t } = G; e(0), t([]), Ze(1); } function xn(e) { const { setData: t } = G; t( (n) => n.filter((r) => (r.setChildren((o) => o.filter((s) => s.objectId !== e)), r.objectId !== e)) ); } const D = W(() => { const [e, t] = _(null), [n, r] = _(), [o, s] = _(), [i, m] = _(), [c, l] = _(""), [a, u] = _(0), [v, p] = _(!1), [b, w] = _(0), [d, $] = _(!1), [x, k] = _(!1), { config: g } = T, C = A(() => ({ showPreview: x(), content: c() })), [R, { mutate: M }] = ut( C, async (j) => j.showPreview ? g().renderPreview(j.content) : "" ), S = A(() => g().wordLimit); let N; return O(() => { u(Ct(c())); }), O(() => { if (S()) { const j = S(); a() < j[0] && j[0] !== 0 ? (w(j[0]), p(!1)) : a() > j[1] ? (w(j[1]), p(!1)) : (w(j[1]), p(!0)); } else w(0), p(!0); }), O(() => { e() && l(e().orig() || ""); }), { edit: e, rootId: n, replyId: o, replyUser: i, content: c, wordCount: a, isWordCountLegal: v, wordLimit: b, isSubmitting: d, previewText: R, editorRef: N, showPreview: x, setEdit: t, setReplyId: s, setReplyUser: m, setRootId: r, setContent: l, setWordCount: u, setIsSubmitting: $, setPreviewText: M, setShowPreview: k }; }), Qe = W(() => { const [e, t] = _({ nick: "", mail: "", link: "" }); return { userMeta: e, setUserMeta: t, inputRefs: { nick: void 0, mail: void 0, link: void 0 } }; }); function Z() { const { setReplyId: e, setReplyUser: t, setRootId: n } = D; e(void 0), t(void 0), n(void 0); } function et() { const { config: e, locale: t } = T, { edit: n, content: r, wordCount: o, isWordCountLegal: s, rootId: i, replyId: m, replyUser: c, editorRef: l, setIsSubmitting: a, setEdit: u, setContent: v, setPreviewText: p } = D, { userMeta: b, inputRefs: w } = Qe, { userInfo: d } = B, { serverURL: $, lang: x, login: k, wordLimit: g, requiredMeta: C } = e(), { data: R, setData: M } = G, S = { comment: r(), nick: b().nick, mail: b().mail, link: b().link, ua: navigator.userAgent, url: e().path, recaptchaV3: "" }; if (d()?.token) S.nick = d().display_name, S.mail = d().email, S.link = d().url; else { if (k === "force") return null; if (C.includes("nick") && !S.nick) return w.nick?.focus(), alert(t().nickError); if (C.includes("mail") && !S.mail || S.mail && !/^\w(?:[\w.\-]*\w)?@(?:\w(?:[\w-]*\w)?\.)*\w+$/.exec(S.mail)) return w.mail?.focus(), alert(t().mailError); if (!S.comment) return l?.focus(), null; S.nick || (S.nick = t().anonymous); } if (!s()) return alert( t().wordHint.replace("$0", g[0].toString()).replace("$1", g[1].toString()).replace("$2", o().toString()) ); m() && i() && (S.pid = m(), S.rid = i(), S.at = c()), a(!0); const N = { serverURL: $, lang: x, token: d()?.token || "", comment: S }; return (n() ? Fe({ objectId: n().objectId, ...N }) : vt(N)).then((j) => { if (a(!1), j.errmsg) return alert(j.errmsg); const F = j.data; if (n()) { const P = R().find((q) => q.objectId === n().objectId); if (!P) return null; P.setComment(F.comment), F.orig && P.setOrig(F.orig), u(null), Z(); } else if ("rid" in F) { const P = R().find((q) => q.objectId === F.rid); if (!P) return null; P.setChildren((q) => [...q, he(F)]), Z(); } else M((P) => [he(F), ...P]); return v(""), p(""), m() && Z(), null; }).catch((j) => { a(!1), alert(j.message); }); } var Cn = /* @__PURE__ */ y('<button class="mb-0 ms-3 inline-block min-w-10 cursor-pointer touch-manipulation select-none border border-sBorder rounded-lg border-solid bg-transparent px-4 py-2 text-center text-xs text-sColor transition duration-400 disabled:cursor-not-allowed disabled:cursor-not-allowed disabled:border-sBorder hover:border-sTheme disabled:bg-sDisableBg disabled:text-sDisable disabled:text-sDisable hover:text-sTheme disabled:hover:border-sBorder disabled:hover:bg-sDisableBg disabled:hover:text-sDisable">'); const te = (e) => (() => { var t = Cn(); return st(t, e, !1, !0), h(t, () => e.children), t; })(); var _n = /* @__PURE__ */ y('<svg viewBox="0 0 1024 1024"width=24 height=24><path>'), Ln = /* @__PURE__ */ y('<svg viewBox="0 0 100 100"preserveAspectRatio=xMidYMid><circle cx=50 cy=50 fill=none stroke=currentColor stroke-width=4 r=40 stroke-dasharray="85 30"><animateTransform attributeName=transform type=rotate repeatCount=indefinite dur=1s values="0 50 50;360 50 50"keyTimes=0;1>'), Sn = /* @__PURE__ */ y('<svg xmlns=http://www.w3.org/2000/svg viewBox="0 0 24 24"><path fill=currentColor d="M20.56 18H3.44C2.65 18 2 17.37 2 16.59V7.41C2 6.63 2.65 6 3.44 6h17.12c.79 0 1.44.63 1.44 1.41v9.18c0 .78-.65 1.41-1.44 1.41M6.81 15.19v-3.66l1.92 2.35l1.92-2.35v3.66h1.93V8.81h-1.93l-1.92 2.35l-1.92-2.35H4.89v6.38h1.92M19.69 12h-1.92V8.81h-1.92V12h-1.93l2.89 3.28L19.69 12Z">'), In = /* @__PURE__ */ y('<svg viewBox="0 0 1024 1024"width=24 height=24><path fill=currentColor d="M810.667 213.333a64 64 0 0 1 64 64V704a64 64 0 0 1-64 64H478.336l-146.645 96.107a21.333 21.333 0 0 1-33.024-17.856V768h-85.334a64 64 0 0 1-64-64V277.333a64 64 0 0 1 64-64h597.334zm0 64H213.333V704h149.334v63.296L459.243 704h351.424V277.333zm-271.36 213.334v64h-176.64v-64h176.64zm122.026-128v64H362.667v-64h298.666z">'), En = /* @__PURE__ */ y('<svg viewBox="0 0 1024 1024"width=24 height=24><path d="M813.039 318.772L480.53 651.278H360.718V531.463L693.227 198.961C697.904 194.284 704.027 192 710.157 192C716.302 192 722.436 194.284 727.114 198.961L813.039 284.88C817.72 289.561 820 295.684 820 301.825C820 307.95 817.72 314.093 813.039 318.772ZM710.172 261.888L420.624 551.431V591.376H460.561L750.109 301.825L710.172 261.888ZM490.517 291.845H240.906V771.09H720.156V521.479C720.156 504.947 733.559 491.529 750.109 491.529C766.653 491.529 780.063 504.947 780.063 521.479V791.059C780.063 813.118 762.18 831 740.125 831H220.937C198.882 831 181 813.118 181 791.059V271.872C181 249.817 198.882 231.935 220.937 231.935H490.517C507.06 231.935 520.47 245.352 520.47 261.888C520.47 278.424 507.06 291.845 490.517 291.845Z"fill=currentColor>'), Rn = /* @__PURE__ */ y('<svg viewBox="0 0 1024 1024"width=14 height=14 class="absolute inset-inline-[calc(var(--sds-avatar-real-size)*3/4)] top-[calc(var(--sds-avatar-real-size)*3/4)] rounded-full bg-sBg"><path d="m894.4 461.56-54.4-63.2c-10.4-12-18.8-34.4-18.8-50.4v-68c0-42.4-34.8-77.2-77.2-77.2h-68c-15.6 0-38.4-8.4-50.4-18.8l-63.2-54.4c-27.6-23.6-72.8-23.6-100.8 0l-62.8 54.8c-12 10-34.8 18.4-50.4 18.4h-69.2c-42.4 0-77.2 34.8-77.2 77.2v68.4c0 15.6-8.4 38-18.4 50l-54 63.6c-23.2 27.6-23.2 72.4 0 100l54 63.6c10 12 18.4 34.4 18.4 50v68.4c0 42.4 34.8 77.2 77.2 77.2h69.2c15.6 0 38.4 8.4 50.4 18.8l63.2 54.4c27.6 23.6 72.8 23.6 100.8 0l63.2-54.4c12-10.4 34.4-18.8 50.4-18.8h68c42.4 0 77.2-34.8 77.2-77.2v-68c0-15.6 8.4-38.4 18.8-50.4l54.4-63.2c23.2-27.6 23.2-73.2-.4-100.8zm-216-25.2-193.2 193.2a30 30 0 0 1-42.4 0l-96.8-96.8a30.16 30.16 0 0 1 0-42.4c11.6-11.6 30.8-11.6 42.4 0l75.6 75.6 172-172c11.6-11.6 30.8-11.6 42.4 0 11.6 11.6 11.6 30.8 0 42.4z"fill=#27ae60>'), An = /* @__PURE__ */ y('<svg viewBox="0 0 1024 1024"width=24 height=24><path d="m341.013 394.667 27.755 393.45h271.83l27.733-393.45h64.106l-28.01 397.952a64 64 0 0 1-63.83 59.498H368.768a64 64 0 0 1-63.83-59.52l-28.053-397.93h64.128zm139.307 19.818v298.667h-64V414.485h64zm117.013 0v298.667h-64V414.485h64zM181.333 288h640v64h-640v-64zm453.483-106.667v64h-256v-64h256z"fill=red>'), Mn = /* @__PURE__ */ y('<svg viewBox="0 0 1024 1024"width=24 height=24><path fill=currentColor d="M710.816 654.301c70.323-96.639 61.084-230.578-23.705-314.843-46.098-46.098-107.183-71.109-172.28-71.109-65.008 0-126.092 25.444-172.28 71.109-45.227 46.098-70.756 107.183-70.756 172.106 0 64.923 25.444 126.007 71.194 172.106 46.099 46.098 107.184 71.109 172.28 71.109 51.414 0 100.648-16.212 142.824-47.404l126.53 126.006c7.058 7.06 16.297 10.979 26.406 10.979 10.105 0 19.343-3.919 26.402-10.979 14.467-14.467 14.467-38.172 0-52.723L710.816 654.301zm-315.107-23.265c-65.88-65.88-65.88-172.54 0-238.42 32.069-32.07 74.245-49.149 119.471-49.149 45.227 0 87.407 17.603 119.472 49.149 65.88 65.879 65.88 172.539 0 238.42-63.612 63.178-175.242 63.178-238.943 0zm0 0"></path><path fill=currentColor d="M703.319 121.603H321.03c-109.8 0-199.469 89.146-199.469 199.38v382.034c0 109.796 89.236 199.38 199.469 199.38h207.397c20.653 0 37.384-16.645 37.384-37.299 0-20.649-16.731-37.296-37.384-37.296H321.03c-68.582 0-124.352-55.77-124.352-124.267V321.421c0-68.496 55.77-124.267 124.352-124.267h382.289c68.582 0 124.352 55.771 124.352 124.267V524.72c0 20.654 16.736 37.299 37.385 37.299 20.654 0 37.384-16.645 37.384-37.299V320.549c-.085-109.8-89.321-198.946-199.121-198.946zm0 0">'); const jn = (e) => (() => { var t = _n(), n = t.firstChild; return E((r) => { var o = `M850.654 323.804c-11.042-25.625-26.862-48.532-46.885-68.225-20.022-19.61-43.258-34.936-69.213-45.73-26.78-11.124-55.124-16.727-84.375-16.727-40.622 0-80.256 11.123-114.698 32.135A214.79 214.79 0 0 0 512 241.819a214.79 214.79 0 0 0-23.483-16.562c-34.442-21.012-74.076-32.135-114.698-32.135-29.25 0-57.595 5.603-84.375 16.727-25.872 10.711-49.19 26.12-69.213 45.73-20.105 19.693-35.843 42.6-46.885 68.225-11.453 26.615-17.303 54.877-17.303 83.963 0 27.439 5.603 56.03 16.727 85.117 9.31 24.307 22.659 49.52 39.715 74.981 27.027 40.293 64.188 82.316 110.33 124.915 76.465 70.615 152.189 119.394 155.402 121.371l19.528 12.525c8.652 5.52 19.776 5.52 28.427 0l19.529-12.525c3.213-2.06 78.854-50.756 155.401-121.371 46.143-42.6 83.304-84.622 110.33-124.915 17.057-25.46 30.487-50.674 39.716-74.981 11.124-29.087 16.727-57.678 16.727-85.117.082-29.086-5.768-57.348-17.221-83.963z${e.active ? "" : "M512 761.5S218.665 573.55 218.665 407.767c0-83.963 69.461-152.023 155.154-152.023 60.233 0 112.473 33.618 138.181 82.727 25.708-49.109 77.948-82.727 138.18-82.727 85.694 0 155.155 68.06 155.155 152.023C805.335 573.551 512 761.5 512 761.5z"}`, s = e.active ? "red" : "currentColor"; return o !== r.e && I(n, "d", r.e = o), s !== r.t && I(n, "fill", r.t = s), r; }, { e: void 0, t: void 0 }), t; })(), tt = (e) => (() => { var t = Ln(); return E((n) => { var r = e.size, o = e.size; return r !== n.e && I(t, "width", n.e = r), o !== n.t && I(t, "height", n.t = o), n; }, { e: void 0, t: void 0 }), t; })(), Un = (e) => (() => { var t = Sn(); return E((n) => { var r = e.size, o = e.size; return r !== n.e && I(t, "width", n.e = r), o !== n.t && I(t, "height", n.t = o), n; }, { e: void 0, t: void 0 }), t; })(), Tn = () => In(), zn = () => En(), Bn = () => Rn(), Pn = () => An(), Dn = () => Mn(); var Nn = /* @__PURE__ */ y('<button type=submit class="mb-0 ms-3 inline-block min-w-10 flex cursor-pointer touch-manipulation select-none justify-center border border-sTheme rounded-lg border-solid bg-sTheme bg-sTheme px-4 py-2 text-xs text-sWhite transition duration-400 disabled:cursor-not-allowed disabled:border-sBorder hover:border-sActive disabled:bg-sDisableBg hover:bg-sActive disabled:text-sDisable disabled:hover:border-sBorder disabled:hover:bg-sDisableBg disabled:hover:text-sDisable">'), Fn = /* @__PURE__ */ y('<div class="mx-3 my-2 flex flex-wrap"><div class="flex flex-shrink flex-grow-2 items-center"><a title="Markdown Guide"aria-label="Markdown is supported"rel="noopener noreferrer"href=https://guides.github.com/features/mastering-markdown/ class="m-[2px] h-6 w-6 border-none bg-transparent p-0"></a><button type=button class="m-[2px] h-6 w-6 border-none bg-transparent p-0 hover:text-sTheme"></button></div><div class="flex flex-shrink flex-grow-3 items-center justify-end">'); const On = () => { const { config: e, locale: t } = T, { isSubmitting: n, showPreview: r, setShowPreview: o } = D, { isLogin: s } = B; return (() => { var i = Fn(), m = i.firstChild, c = m.firstChild, l = c.nextSibling, a = m.nextSibling; return h(c, f(Un, { size: "24" })), l.$$click = (u) => { u.preventDefault(), o((v) => !v); }, h(l, f(Dn, {})), h(a, f(L, { get when() { return ue(() => e().login !== "disable")() && !s(); }, get fallback() { return f(te, { type: "button", onClick: (u) => { u.preventDefault(), wn(); }, get children() { return t().logout; } }); }, get children() { return f(te, { type: "button", onClick: (u) => { u.preventDefault(), $n(); }, get children() { return t().login; } }); } }), null), h(a, f(L, { get when() { return e().login !== "force" || s(); }, get children() { var u = Nn(); return u.$$click = (v) => { v.preventDefault(), et(); }, h(u, f(L, { get when() { return n(); }, get fallback() { return t().submit; }, get children() { return f(tt, { size: "16" }); } })), E(() => u.disabled = n()), u; } }), null), E((u) => { var v = !!r(), p = t().preview; return v !== u.e && l.classList.toggle("text-sActive", u.e = v), p !== u.t && I(l, "title", u.t = p), u; }, { e: void 0, t: void 0 }), i; })(); }; X(["click"]); var Hn = /* @__PURE__ */ y('<div class="bb flex flex-wrap justify-evenly px-4 text-[0.625rem]">'), Wn = /* @__PURE__ */ y('<div class="flex flex-grow items-center"><label class="px-2 py-3 text-sColor"></label><input class="flex-grow border-none bg-transparent p-2 text-sColor outline-none transition-colors duration-300 focus:bg-sBgLight">'); const Vn = () => { const { config: e, locale: t } = T, { userMeta: n, setUserMeta: r, inputRefs: o } = Qe; return (() => { var s = Hn(); return h(s, f(Pe, { get each() { return e().meta; }, children: (i) => { const m = A(() => n()[i]); return (() => { var c = Wn(), l = c.firstChild, a = l.nextSibling; I(l, "for", `wl-${i}`), h(l, () => t()[i] + (e().requiredMeta.includes(i) || !e().requiredMeta.length ? "" : `(${t().optional})`)), a.$$input = (v) => { r({ ...n(), [i]: v.currentTarget.value }); }; var u = o[i]; return typeof u == "function" ? Te(u, a) : o[i] = a, I(a, "id", `wl-${i}`), I(a, "type", i === "mail" ? "email" : "text"), E(() => a.value = m()), c; })(); } })), s; })(); }; X(["input"]); var Gn = /* @__PURE__ */ y('<div class="me-2 max-w-20 text-center"><div class=sds-comment><button class="cursor-pointer border-none bg-transparent hover:bg-transparent"><img alt="Avatar of current user"class=sds-avatar></button></div><button class="max-w-20 cursor-pointer break-words border-none bg-transparent text-xs text-sTheme break-word hover:bg-transparent hover:text-sActive">'), qn = /* @__PURE__ */ y('<div class="mb-3 flex"><div class="w-full flex flex-col border border-sBorder rounded-xl border-solid"><textarea class="mx-2 my-3 min-h-35 resize-y rounded-lg border-none bg-transparent text-sm text-sColor font-sans outline-none transition-colors duration-300 disabled:cursor-not-allowed focus:bg-sBgLight">'), Jn = /* @__PURE__ */ y('<div class="py-2 pl-2"><hr class="my-[0.825rem] border-sBgLight border-dashed"><h4></h4><div>'); const nt = (e) => { const { locale: t, config: n } = T, { replyUser: r, content: o, edit: s, setContent: i, showPreview: m, previewText: c } = D, { isLogin: l, userInfo: a } = B, u = A(() => e.isMain && (!!r() || !!s())); return f(L, { get when() { return !u(); }, get children() { var v = qn(), p = v.firstChild, b = p.firstChild; h(v, f(L, { get when() { return ue(() => !!(n().login !== "disable" && l()))() && !s()?.objectId; }, get children() { var d = Gn(), $ = d.firstChild, x = $.firstChild, k = x.firstChild, g = $.nextSibling; return x.$$click = (C) => { C.preventDefault(), je(); }, g.$$click = (C) => { C.preventDefault(), je(); }, h(g, () => a()?.display_name), E((C) => { var R = t().profile, M = a()?.avatar, S = t().profile; return R !== C.e && I(x, "title", C.e = R), M !== C.t && I(k, "src", C.t = M), S !== C.a && I(g, "title", C.a = S), C; }, { e: void 0, t: void 0, a: void 0 }), d; } }), p), h(p, f(L, { get when() { return ue(() => !!(n().login !== "force" && n().meta.length))() && !l(); }, get children() {