@roudanio/awesome-comment 0.10.4 → 0.10.6

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.
@@ -1,31 +1,31 @@
1
- import { i as R, r as C, c as Y, w as G, d as U, o as se, q as ue, v, x as ie, y as k, z as Oe, A as $, B as m, C as Me, D as _e, E, G as de, F as M, H, I as f, J as B, f as D, K as Pe, L as je, M as Be, N as Ee, O as De } from "./vendor-vue-BTtW1k2s.js";
2
- import { d as Se, c as Ue } from "./vendor-pinia-Dzo8X_0B.js";
3
- import { E as Fe, G as Te } from "./vendor-auth0-DkqbqvnH.js";
4
- import { u as F, c as Ke } from "./vendor-i18n-B4UB934p.js";
5
- import { o as ze } from "./vendor-lodash-CKuyBgAy.js";
6
- import { T as Ve, a as Ge, R as He, B as Je } from "./vendor-lucide-Cl8oS5sQ.js";
7
- import { d as We } from "./vendor-marked-B6IoMkOX.js";
8
- const Ye = { admin: "Admin", anonymous: "Anonym", approve_hint: "Wir werden Ihren Kommentar innerhalb von 24 Stunden beantworten, ohne Ihre E-Mail zu spammen. Schauen Sie bitte bald wieder vorbei. :)", discussion: "Diskussion", edit: "Bearbeiten", load_more: "Mehr laden", login: "Anmelden", logout: "Abmelden", placeholder: "Schreiben Sie ein Kommentar...", post_comment: "Kommentar absenden", post_reply: "Antwort absenden", reply: "Antwort", reply_to: "Antwort auf", save_editing: "Speichern", ui_texts: ["Seien Sie der Erste, der die Diskussion beginnt!", "Beteiligen Sie sich an der Konversation (#)", "Laden...", "Kommentare laden"], your_comment: "Dein Kommentar" }, qe = { admin: "Admin", anonymous: "Anonymous", approve_hint: "We’ll reply to your comment within 24 hours without spamming your email, so please check back soon :)", discussion: "Discussion", edit: "Edit", load_more: "Load More", login: "LOGIN", login_or_verify: "Please log in or complete the verification to post.", logout: "Logout", placeholder: "Write a comment...", post_comment: "POST COMMENT", post_reply: "POST REPLY", reply: "Reply", reply_to: "reply to", save_editing: "Save", ui_texts: ["Be the first to start the discussion!", "Join the Conversation (#)", "Loading...", "Load Comments"], your_comment: "Your comment" }, Ze = { admin: "Administrador", anonymous: "Anónimo", approve_hint: "los comentarios son normalmente aprobados dentro de 24 horas", discussion: "Discusión", edit: "Editar", load_more: "Cargar Más", login: "INICIAR SESIÓN", logout: "Cerrar Sesión", placeholder: "Escribe un comentario...", post_comment: "PUBLICAR COMENTARIO", post_reply: "PUBLICAR RESPUESTA", reply: "Responder", reply_to: "Responder a", save_editing: "Guardar", ui_texts: ["¡Sé el primero en iniciar la discusión!", "Únete a la Conversación (#)", "Cargando...", "Cargar Comentarios"], your_comment: "Tu comentario" }, Xe = { admin: "Admin", anonymous: "Anonyme", approve_hint: "Nous répondrons à votre commentaire dans les 24 heures sans vous spammer par e-mail, alors revenez bientôt :)", discussion: "Discussion", edit: "Modifier", load_more: "Charger plus", login: "CONNEXION", logout: "Déconnexion", placeholder: "Écrivez un commentaire...", post_comment: "POSTER UN COMMENTAIRE", post_reply: "POSTER UNE RÉPONSE", reply: "Répondre", reply_to: "répondre à", save_editing: "Enregistrer", ui_texts: ["Soyez le premier à lancer la discussion !", "Rejoignez la conversation (#)", "Chargement...", "Charger les commentaires"], your_comment: "Votre commentaire" }, Qe = { admin: "Admin", anonymous: "Anonim", approve_hint: "komentar biasanya disetujui dalam waktu 24 jam", discussion: "Diskusi", edit: "Edit", load_more: "Muat Lebih Banyak", login: "MASUK", logout: "Keluar", placeholder: "Tulis komentar...", post_comment: "KIRIM KOMENTAR", post_reply: "KIRIM BALASAN", reply: "Balas", reply_to: "balas ke", save_editing: "Simpan", your_comment: "Komentar Anda" }, et = { admin: "Amministratore", anonymous: "Anonimo", approve_hint: "i commenti vengono normalmente approvati entro 24 ore", discussion: "Discussione", edit: "Modifica", load_more: "Carica Altri", login: "ACCEDI", logout: "Esci", placeholder: "Scrivi un commento...", post_comment: "INVIA COMMENTO", post_reply: "INVIA RISPOSTA", reply: "Risposta", reply_to: "rispondi a", save_editing: "Salva", your_comment: "Il tuo commento" }, tt = { admin: "管理者", anonymous: "匿名", approve_hint: "コメントは通常24時間以内に承認されます", discussion: "ディスカッション", edit: "編集", load_more: "もっと読み込む", login: "ログイン", logout: "ログアウト", placeholder: "コメントを書く...", post_comment: "コメントを投稿", post_reply: "返信を投稿", reply: "返信", reply_to: "返信先", save_editing: "保存", your_comment: "あなたのコメント" }, nt = { admin: "관리자", anonymous: "익명", approve_hint: "댓글은 보통 24시간 내에 승인됩니다", discussion: "토론", edit: "편집", load_more: "더 보기", login: "로그인", logout: "로그아웃", placeholder: "댓글을 입력하세요...", post_comment: "댓글 게시", post_reply: "답글 게시", reply: "답장", reply_to: "답장 대상", save_editing: "저장", your_comment: "당신의 댓글" }, ot = { admin: "Administrador", anonymous: "Anônimo", approve_hint: "os comentários são normalmente aprovados dentro de 24 horas", discussion: "Discussão", edit: "Editar", load_more: "Carregar Mais", login: "ENTRAR", logout: "Sair", placeholder: "Escreva um comentário...", post_comment: "PUBLICAR COMENTÁRIO", post_reply: "PUBLICAR RESPOSTA", reply: "Responder", reply_to: "responder a", save_editing: "Salvar", your_comment: "Seu comentário" }, st = { admin: "แอดมิน", anonymous: "นิรนาม", approve_hint: "โดยปกติความคิดเห็นจะได้รับการอนุมัติภายใน 24 ชั่วโมง", discussion: "การอภิปราย", edit: "แก้ไข", load_more: "โหลดเพิ่ม", login: "ลงชื่อเข้าใช้", logout: "ลงชื่อออก", placeholder: "เขียนความคิดเห็น...", post_comment: "โพสต์ความคิดเห็น", post_reply: "โพสต์การตอบกลับ", reply: "ตอบกลับ", reply_to: "ตอบกลับถึง", save_editing: "บันทึก", ui_texts: ["เป็นคนแรกที่เริ่มการอภิปราย", "เข้าร่วมการสนทนา (#)", "กำลังโหลด...", "โหลดความคิดเห็น"], your_comment: "ความคิดเห็นของคุณ" }, at = { admin: "管理員", anonymous: "匿名", approve_hint: "評論通常在24小時內獲得批準,並且每壹條評論都會獲得回復", discussion: "討論", edit: "修改", load_more: "加載更多", login: "登錄", login_or_verify: "請登錄或完成驗證碼後再發表評論。", logout: "登出", placeholder: "寫評論...", post_comment: "發表評論", post_reply: "發表回複", reply: "回複", reply_to: "回複給", save_editing: "保存", your_comment: "您的評論" }, rt = { admin: "管理员", anonymous: "匿名", approve_hint: "评论通常在24小时内公开(我们也会回复您)", discussion: "讨论", edit: "编辑", load_more: "加载更多", login: "登录", login_or_verify: "请登录或完成验证码后再发表评论。", logout: "登出", placeholder: "写评论...", post_comment: "发表评论", post_reply: "发表回复", reply: "回复", reply_to: "回复给", save_editing: "保存", your_comment: "您的评论" }, we = {
9
- de: Ye,
1
+ import { i as N, r as $, w as G, f as Y, j as D, p as se, n as de, v, x as ce, y as A, z as I, A as m, B as Me, C as Pe, D as we, E as me, G as E, F as M, H, I as f, J as j, u as B, K as je, L as Be, M as De, N as Se, O as Ue } from "./vendor-vue-njoJvG0v.js";
2
+ import { d as Te, c as Fe } from "./vendor-pinia-DRSupkuV.js";
3
+ import { E as Ke, G as Le } from "./vendor-auth0-FyrIO3oS.js";
4
+ import { u as U, c as ze } from "./vendor-i18n--NfXv8rP.js";
5
+ import { o as Ve } from "./vendor-lodash-CKuyBgAy.js";
6
+ import { T as Ge, a as He, R as Je, B as We } from "./vendor-lucide-C7toM1hZ.js";
7
+ import { d as Ye } from "./vendor-marked-B6IoMkOX.js";
8
+ const Ze = { admin: "Admin", anonymous: "Anonym", approve_hint: "Wir werden Ihren Kommentar innerhalb von 24 Stunden beantworten, ohne Ihre E-Mail zu spammen. Schauen Sie bitte bald wieder vorbei. :)", discussion: "Diskussion", edit: "Bearbeiten", load_more: "Mehr laden", login: "Anmelden", logout: "Abmelden", placeholder: "Schreiben Sie ein Kommentar...", post_comment: "Kommentar absenden", post_reply: "Antwort absenden", reply: "Antwort", reply_to: "Antwort auf", save_editing: "Speichern", ui_texts: ["Seien Sie der Erste, der die Diskussion beginnt!", "Beteiligen Sie sich an der Konversation (#)", "Laden...", "Kommentare laden"], your_comment: "Dein Kommentar" }, qe = { admin: "Admin", anonymous: "Anonymous", approve_hint: "We’ll reply to your comment within 24 hours without spamming your email, so please check back soon :)", discussion: "Discussion", edit: "Edit", load_more: "Load More", login: "LOGIN", login_or_verify: "Please log in or complete the verification to post.", logout: "Logout", placeholder: "Write a comment...", post_comment: "POST COMMENT", post_reply: "POST REPLY", reply: "Reply", reply_to: "reply to", save_editing: "Save", ui_texts: ["Be the first to start the discussion!", "Join the Conversation (#)", "Loading...", "Load Comments"], your_comment: "Your comment" }, Xe = { admin: "Administrador", anonymous: "Anónimo", approve_hint: "los comentarios son normalmente aprobados dentro de 24 horas", discussion: "Discusión", edit: "Editar", load_more: "Cargar Más", login: "INICIAR SESIÓN", logout: "Cerrar Sesión", placeholder: "Escribe un comentario...", post_comment: "PUBLICAR COMENTARIO", post_reply: "PUBLICAR RESPUESTA", reply: "Responder", reply_to: "Responder a", save_editing: "Guardar", ui_texts: ["¡Sé el primero en iniciar la discusión!", "Únete a la Conversación (#)", "Cargando...", "Cargar Comentarios"], your_comment: "Tu comentario" }, Qe = { admin: "Admin", anonymous: "Anonyme", approve_hint: "Nous répondrons à votre commentaire dans les 24 heures sans vous spammer par e-mail, alors revenez bientôt :)", discussion: "Discussion", edit: "Modifier", load_more: "Charger plus", login: "CONNEXION", logout: "Déconnexion", placeholder: "Écrivez un commentaire...", post_comment: "POSTER UN COMMENTAIRE", post_reply: "POSTER UNE RÉPONSE", reply: "Répondre", reply_to: "répondre à", save_editing: "Enregistrer", ui_texts: ["Soyez le premier à lancer la discussion !", "Rejoignez la conversation (#)", "Chargement...", "Charger les commentaires"], your_comment: "Votre commentaire" }, et = { admin: "Admin", anonymous: "Anonim", approve_hint: "komentar biasanya disetujui dalam waktu 24 jam", discussion: "Diskusi", edit: "Edit", load_more: "Muat Lebih Banyak", login: "MASUK", logout: "Keluar", placeholder: "Tulis komentar...", post_comment: "KIRIM KOMENTAR", post_reply: "KIRIM BALASAN", reply: "Balas", reply_to: "balas ke", save_editing: "Simpan", your_comment: "Komentar Anda" }, tt = { admin: "Amministratore", anonymous: "Anonimo", approve_hint: "i commenti vengono normalmente approvati entro 24 ore", discussion: "Discussione", edit: "Modifica", load_more: "Carica Altri", login: "ACCEDI", logout: "Esci", placeholder: "Scrivi un commento...", post_comment: "INVIA COMMENTO", post_reply: "INVIA RISPOSTA", reply: "Risposta", reply_to: "rispondi a", save_editing: "Salva", your_comment: "Il tuo commento" }, nt = { admin: "管理者", anonymous: "匿名", approve_hint: "コメントは通常24時間以内に承認されます", discussion: "ディスカッション", edit: "編集", load_more: "もっと読み込む", login: "ログイン", logout: "ログアウト", placeholder: "コメントを書く...", post_comment: "コメントを投稿", post_reply: "返信を投稿", reply: "返信", reply_to: "返信先", save_editing: "保存", your_comment: "あなたのコメント" }, ot = { admin: "관리자", anonymous: "익명", approve_hint: "댓글은 보통 24시간 내에 승인됩니다", discussion: "토론", edit: "편집", load_more: "더 보기", login: "로그인", logout: "로그아웃", placeholder: "댓글을 입력하세요...", post_comment: "댓글 게시", post_reply: "답글 게시", reply: "답장", reply_to: "답장 대상", save_editing: "저장", your_comment: "당신의 댓글" }, st = { admin: "Administrador", anonymous: "Anônimo", approve_hint: "os comentários são normalmente aprovados dentro de 24 horas", discussion: "Discussão", edit: "Editar", load_more: "Carregar Mais", login: "ENTRAR", logout: "Sair", placeholder: "Escreva um comentário...", post_comment: "PUBLICAR COMENTÁRIO", post_reply: "PUBLICAR RESPOSTA", reply: "Responder", reply_to: "responder a", save_editing: "Salvar", your_comment: "Seu comentário" }, at = { admin: "แอดมิน", anonymous: "นิรนาม", approve_hint: "โดยปกติความคิดเห็นจะได้รับการอนุมัติภายใน 24 ชั่วโมง", discussion: "การอภิปราย", edit: "แก้ไข", load_more: "โหลดเพิ่ม", login: "ลงชื่อเข้าใช้", logout: "ลงชื่อออก", placeholder: "เขียนความคิดเห็น...", post_comment: "โพสต์ความคิดเห็น", post_reply: "โพสต์การตอบกลับ", reply: "ตอบกลับ", reply_to: "ตอบกลับถึง", save_editing: "บันทึก", ui_texts: ["เป็นคนแรกที่เริ่มการอภิปราย", "เข้าร่วมการสนทนา (#)", "กำลังโหลด...", "โหลดความคิดเห็น"], your_comment: "ความคิดเห็นของคุณ" }, rt = { admin: "管理員", anonymous: "匿名", approve_hint: "評論通常在24小時內獲得批準,並且每壹條評論都會獲得回復", discussion: "討論", edit: "修改", load_more: "加載更多", login: "登錄", login_or_verify: "請登錄或完成驗證碼後再發表評論。", logout: "登出", placeholder: "寫評論...", post_comment: "發表評論", post_reply: "發表回複", reply: "回複", reply_to: "回複給", save_editing: "保存", your_comment: "您的評論" }, it = { admin: "管理员", anonymous: "匿名", approve_hint: "评论通常在24小时内公开(我们也会回复您)", discussion: "讨论", edit: "编辑", load_more: "加载更多", login: "登录", login_or_verify: "请登录或完成验证码后再发表评论。", logout: "登出", placeholder: "写评论...", post_comment: "发表评论", post_reply: "发表回复", reply: "回复", reply_to: "回复给", save_editing: "保存", your_comment: "您的评论" }, ke = {
9
+ de: Ze,
10
10
  en: qe,
11
- es: Ze,
12
- fr: Xe,
13
- id: Qe,
14
- it: et,
15
- ja: tt,
16
- ko: nt,
17
- pt: ot,
18
- th: st,
19
- zh: at,
20
- cn: rt
11
+ es: Xe,
12
+ fr: Qe,
13
+ id: et,
14
+ it: tt,
15
+ ja: nt,
16
+ ko: ot,
17
+ pt: st,
18
+ th: at,
19
+ zh: rt,
20
+ cn: it
21
21
  };
22
- function it() {
22
+ function ct() {
23
23
  return !!navigator.userAgent.match(/Macintosh/);
24
24
  }
25
- function ct(e, s) {
26
- return (it() ? e.metaKey : e.ctrlKey) && e.key === s;
25
+ function lt(e, s) {
26
+ return (ct() ? e.metaKey : e.ctrlKey) && e.key === s;
27
27
  }
28
- const lt = {
28
+ const ut = {
29
29
  maxConsecutivePunctuation: 5,
30
30
  maxConsecutiveSpaces: 3,
31
31
  maxConsecutiveNewlines: 3,
@@ -35,48 +35,48 @@ const lt = {
35
35
  allowedPunctuation: [],
36
36
  blockPatterns: []
37
37
  };
38
- function ut(e, s = {}) {
39
- const t = { ...lt, ...s }, n = [];
38
+ function dt(e, s = {}) {
39
+ const t = { ...ut, ...s }, n = [];
40
40
  if (!e || typeof e != "string")
41
41
  return { valid: !1, errors: ["Content is required"] };
42
- const r = e.trim();
43
- r.length < t.minLength && n.push(`Content must be at least ${t.minLength} characters`), r.length > t.maxLength && n.push(`Content must not exceed ${t.maxLength} characters`);
44
- const d = dt(r, t.maxConsecutivePunctuation);
45
- d.valid || n.push(...d.errors), /^\w{35,}$/.test(r) && n.push("Content contains too many consecutive letters");
46
- const u = mt(r, t.maxConsecutiveSpaces);
42
+ const i = e.trim();
43
+ i.length < t.minLength && n.push(`Content must be at least ${t.minLength} characters`), i.length > t.maxLength && n.push(`Content must not exceed ${t.maxLength} characters`);
44
+ const d = mt(i, t.maxConsecutivePunctuation);
45
+ d.valid || n.push(...d.errors), /^\w{35,}$/.test(i) && n.push("Content contains too many consecutive letters");
46
+ const u = pt(i, t.maxConsecutiveSpaces);
47
47
  u.valid || n.push(...u.errors);
48
- const l = pt(r, t.maxConsecutiveNewlines);
48
+ const l = ft(i, t.maxConsecutiveNewlines);
49
49
  l.valid || n.push(...l.errors);
50
- const o = ft(r, t.minWords);
50
+ const o = ht(i, t.minWords);
51
51
  if (o.valid || n.push(...o.errors), t.blockPatterns.length > 0) {
52
- const a = ht(r, t.blockPatterns);
53
- a.valid || n.push(...a.errors);
52
+ const r = vt(i, t.blockPatterns);
53
+ r.valid || n.push(...r.errors);
54
54
  }
55
55
  return {
56
56
  valid: n.length === 0,
57
57
  errors: n
58
58
  };
59
59
  }
60
- function dt(e, s) {
60
+ function mt(e, s) {
61
61
  const t = [], n = ["!", "?", ".", ",", ";", ":", "!", "?", "。", ",", ";", ":", "…", "~", "~"];
62
62
  for (const u of n) {
63
63
  const l = new RegExp(`\\${u}{${s + 1},}`, "g"), o = e.match(l);
64
64
  o && t.push(`Too many consecutive "${u}" (max ${s}). Found: ${o[0]}`);
65
65
  }
66
- const r = new RegExp(`[${n.join("")}]{${s + 1},}`, "g"), d = e.match(r);
66
+ const i = new RegExp(`[${n.join("")}]{${s + 1},}`, "g"), d = e.match(i);
67
67
  return d && t.push(`Too many consecutive punctuation marks (max ${s}). Found: ${d[0]}`), {
68
68
  valid: t.length === 0,
69
69
  errors: t
70
70
  };
71
71
  }
72
- function mt(e, s) {
72
+ function pt(e, s) {
73
73
  const t = new RegExp(` {${s + 1},}`, "g");
74
74
  return e.match(t) ? {
75
75
  valid: !1,
76
76
  errors: [`Too many consecutive spaces (max ${s})`]
77
77
  } : { valid: !0, errors: [] };
78
78
  }
79
- function pt(e, s) {
79
+ function ft(e, s) {
80
80
  const t = new RegExp(`
81
81
  {${s + 1},}`, "g");
82
82
  return e.match(t) ? {
@@ -84,7 +84,7 @@ function pt(e, s) {
84
84
  errors: [`Too many consecutive line breaks (max ${s})`]
85
85
  } : { valid: !0, errors: [] };
86
86
  }
87
- function ft(e, s) {
87
+ function ht(e, s) {
88
88
  const t = e.replace(/[^\p{L}\p{N}\s]/gu, " ").trim(), n = t.match(/[\u4e00-\u9fa5]/g);
89
89
  if (n && n.length > t.length * 0.3) {
90
90
  if (t.replace(/\s+/g, "").length < s)
@@ -99,7 +99,7 @@ function ft(e, s) {
99
99
  };
100
100
  return { valid: !0, errors: [] };
101
101
  }
102
- function ht(e, s) {
102
+ function vt(e, s) {
103
103
  const t = [];
104
104
  for (const n of s)
105
105
  n.test(e) && t.push(`Content contains blocked pattern: ${n.source}`);
@@ -109,32 +109,32 @@ function ht(e, s) {
109
109
  };
110
110
  }
111
111
  var te = /* @__PURE__ */ ((e) => (e[e.Pending = 0] = "Pending", e[e.Approved = 1] = "Approved", e[e.Rejected = 2] = "Rejected", e[e.UnReplied = 255] = "UnReplied", e[e["Replied to Admin"] = 256] = "Replied to Admin", e))(te || {});
112
- const vt = /@([a-zA-Z0-9-]+\.)+[a-zA-Z]{2,}$/;
112
+ const gt = /@([a-zA-Z0-9-]+\.)+[a-zA-Z]{2,}$/;
113
113
  function ne(e) {
114
114
  return e < 10 ? `0${e}` : `${e}`;
115
115
  }
116
- function Le(e) {
116
+ function Ne(e) {
117
117
  return e = `${e.substring(0, 10)}T${e.substring(11, 19)}Z`, new Date(e);
118
118
  }
119
- function ke(e) {
119
+ function xe(e) {
120
120
  const s = e.getFullYear(), t = e.getMonth() + 1, n = e.getDate();
121
121
  return `${s}-${ne(t)}-${ne(n)}`;
122
122
  }
123
- function xe(e) {
124
- e instanceof Date || (e = Le(e));
125
- const s = /* @__PURE__ */ new Date(), t = ke(e);
126
- if (ke(s) === t) {
127
- const n = e.getHours(), r = e.getMinutes();
128
- return `${ne(n)}:${ne(r)}`;
123
+ function Ae(e) {
124
+ e instanceof Date || (e = Ne(e));
125
+ const s = /* @__PURE__ */ new Date(), t = xe(e);
126
+ if (xe(s) === t) {
127
+ const n = e.getHours(), i = e.getMinutes();
128
+ return `${ne(n)}:${ne(i)}`;
129
129
  }
130
130
  return t;
131
131
  }
132
- function gt(e) {
132
+ function yt(e) {
133
133
  const {
134
134
  id: s,
135
135
  created_at: t,
136
136
  parent_id: n,
137
- ancestor_id: r,
137
+ ancestor_id: i,
138
138
  post_id: d,
139
139
  user_id: u,
140
140
  ...l
@@ -147,263 +147,263 @@ function gt(e) {
147
147
  parentId: Number(n),
148
148
  post_id: d,
149
149
  postId: d,
150
- ancestorId: Number(r),
150
+ ancestorId: Number(i),
151
151
  status: Number(e.status),
152
- createdAt: Le(t)
152
+ createdAt: Ne(t || l.createdAt || "")
153
153
  };
154
154
  }
155
- const me = "awesome-comment-comments", Ae = localStorage.getItem(me), V = Ae ? JSON.parse(Ae) : {}, J = Se("store", () => {
156
- const e = R("postId"), s = R("siteId"), t = R("comments"), n = R("total"), r = C(!!t?.length), d = C(0), u = C(""), l = C([]), o = C(n || 0), a = R("ApiBaseUrl"), c = C(!1), i = C(!1);
157
- function w(x) {
158
- const p = {}, A = [];
159
- x.forEach((b) => {
160
- h(Number(b.id));
161
- const T = gt(b);
162
- !b.ancestor_id || Number(b.ancestor_id) === 0 ? p[b.id] = T : A.push(T);
155
+ const pe = "awesome-comment-comments", Ie = localStorage.getItem(pe), V = Ie ? JSON.parse(Ie) : {}, J = Te("store", () => {
156
+ const e = N("postId"), s = N("siteId"), t = N("comments"), n = N("total"), i = $(!!t?.length), d = $(0), u = $(""), l = $([]), o = $(n || 0), r = N("ApiBaseUrl"), a = $(!1), c = $(!1);
157
+ function k(b) {
158
+ const h = {}, x = [];
159
+ b.forEach((w) => {
160
+ p(Number(w.id));
161
+ const C = yt(w);
162
+ !w.ancestor_id || Number(w.ancestor_id) === 0 ? h[w.id] = C : x.push(C);
163
163
  });
164
- const _ = V[e];
165
- _ && (_.createdAt = new Date(_.createdAt), !_.ancestorId || Number(_.ancestorId) === 0 ? p[_.id] = _ : A.push(_)), A.forEach((b) => {
166
- if (b.ancestorId in p) {
167
- const T = p[b.ancestorId];
168
- T.children = [b, ...T.children || []];
164
+ const y = V[e];
165
+ y && (y.createdAt = new Date(y.createdAt), !y.ancestorId || Number(y.ancestorId) === 0 ? h[y.id] = y : x.push(y)), x.forEach((w) => {
166
+ if (w.ancestorId in h) {
167
+ const C = h[w.ancestorId];
168
+ C.children = [w, ...C.children || []];
169
169
  }
170
170
  });
171
- for (const b in p) {
172
- const T = p[b];
173
- T.children && (T.children = T.children.sort((P, K) => P.id - K.id));
171
+ for (const w in h) {
172
+ const C = h[w];
173
+ C.children && (C.children = C.children.sort((F, K) => F.id - K.id));
174
174
  }
175
- return p;
175
+ return h;
176
176
  }
177
- async function g(x = !1) {
178
- if (c.value) return;
179
- u.value = "", c.value = !0;
180
- let p;
181
- if (x && t?.length)
182
- p = w(t);
177
+ async function g(b = !1) {
178
+ if (a.value) return;
179
+ u.value = "", a.value = !0;
180
+ let h;
181
+ if (b && t?.length)
182
+ h = k(t);
183
183
  else {
184
- const A = new URLSearchParams();
185
- A.append("postId", e), s && A.append("siteId", s), A.append("start", d.value.toString());
186
- const _ = await fetch(`${a}/api/comments?${A}`);
187
- if (!_.ok) {
188
- u.value = "Load comments failed. " + _.statusText, r.value = !0, c.value = !1;
184
+ const x = new URLSearchParams();
185
+ x.append("postId", e), s && x.append("siteId", s), x.append("start", d.value.toString());
186
+ const y = await fetch(`${r}/api/comments?${x}`);
187
+ if (!y.ok) {
188
+ u.value = "Load comments failed. " + y.statusText, i.value = !0, a.value = !1;
189
189
  return;
190
190
  }
191
- const b = await _.json();
192
- if (b.code !== 0) {
193
- u.value = "Load comments failed. " + b.message, r.value = !0, c.value = !1;
191
+ const w = await y.json();
192
+ if (w.code !== 0) {
193
+ u.value = "Load comments failed. " + w.message, i.value = !0, a.value = !1;
194
194
  return;
195
195
  }
196
- p = w(b.data || []), o.value = b.meta?.total || b.data?.length || 0;
196
+ h = k(w.data || []), o.value = w.meta?.total || w.data?.length || 0;
197
197
  }
198
- i.value = Object.keys(p).length > 20, i.value && delete p[Object.keys(p)[0]], Object.assign(l.value, p), r.value = !0, c.value = !1;
198
+ c.value = Object.keys(h).length > 20, c.value && delete h[Object.keys(h)[0]], Object.assign(l.value, h), i.value = !0, a.value = !1;
199
199
  }
200
- function y(x, p, A, _ = te.Pending, b, T) {
201
- const { sub: P = "", name: K = "", picture: ae = "", email: q = "", nickname: Z = "" } = A, O = {
202
- id: x,
200
+ function _(b, h, x, y = te.Pending, w, C) {
201
+ const { sub: F = "", name: K = "", picture: Z = "", email: ae = "", nickname: q = "" } = x, O = {
202
+ id: b,
203
203
  post_id: e,
204
204
  postId: e,
205
- content: p,
205
+ content: h,
206
206
  createdAt: /* @__PURE__ */ new Date(),
207
207
  user: {
208
- avatar: ae,
209
- email: q,
210
- name: Z || K
208
+ avatar: Z,
209
+ email: ae,
210
+ name: q || K
211
211
  },
212
- user_id: P,
213
- userId: P,
214
- status: _,
212
+ user_id: F,
213
+ userId: F,
214
+ status: y,
215
215
  isNew: !0
216
216
  };
217
- if (b || T) {
218
- O.ancestorId = b, O.parentId = T;
219
- const j = l.value[b];
220
- if (j.children || (j.children = []), b === T)
221
- j.children.unshift(O);
217
+ if (w || C) {
218
+ O.ancestorId = w, O.parentId = C;
219
+ const P = l.value[w];
220
+ if (P.children || (P.children = []), w === C)
221
+ P.children.unshift(O);
222
222
  else {
223
- const L = j.children.findIndex((S) => Number(S.id) === T);
224
- j.children.splice(L + 1, 0, O);
223
+ const re = P.children.findIndex((T) => Number(T.id) === C);
224
+ P.children.splice(re + 1, 0, O);
225
225
  }
226
226
  } else
227
- O.ancestorId = 0, O.parentId = 0, l.value = { [x]: O, ...l.value };
228
- o.value++, _ !== te.Approved && (V[e] = O, localStorage.setItem(me, JSON.stringify(V)));
227
+ O.ancestorId = 0, O.parentId = 0, l.value = { [b]: O, ...l.value };
228
+ o.value++, y !== te.Approved && (V[e] = O, localStorage.setItem(pe, JSON.stringify(V)));
229
229
  }
230
- function h(x) {
231
- V[e]?.id === x && (delete V[e], localStorage.setItem(me, JSON.stringify(V)));
230
+ function p(b) {
231
+ V[e]?.id === b && (delete V[e], localStorage.setItem(pe, JSON.stringify(V)));
232
232
  }
233
- function I(x, p) {
234
- let A = l.value[x];
235
- if (!A) {
236
- for (const _ of Object.values(l.value))
237
- if (_.children && (A = _.children.find((b) => Number(b.id) === x), A))
233
+ function S(b, h) {
234
+ let x = l.value[b];
235
+ if (!x) {
236
+ for (const y of Object.values(l.value))
237
+ if (y.children && (x = y.children.find((w) => Number(w.id) === b), x))
238
238
  break;
239
239
  }
240
- A && Object.assign(A, p);
240
+ x && Object.assign(x, h);
241
241
  }
242
242
  return {
243
- isLoaded: r,
243
+ isLoaded: i,
244
244
  message: u,
245
245
  postId: e,
246
246
  comments: l,
247
247
  total: o,
248
248
  start: d,
249
- hasMore: i,
250
- loadingMore: c,
249
+ hasMore: c,
250
+ loadingMore: a,
251
251
  loadComments: g,
252
- addComment: y,
253
- updateComment: I
252
+ addComment: _,
253
+ updateComment: S
254
254
  };
255
255
  });
256
- var Ie = { exports: {} }, $e;
257
- function yt() {
258
- return $e || ($e = 1, (function(e) {
256
+ var $e = { exports: {} }, Ce;
257
+ function bt() {
258
+ return Ce || (Ce = 1, (function(e) {
259
259
  var s = Object.prototype.hasOwnProperty, t = "~";
260
260
  function n() {
261
261
  }
262
262
  Object.create && (n.prototype = /* @__PURE__ */ Object.create(null), new n().__proto__ || (t = !1));
263
- function r(o, a, c) {
264
- this.fn = o, this.context = a, this.once = c || !1;
263
+ function i(o, r, a) {
264
+ this.fn = o, this.context = r, this.once = a || !1;
265
265
  }
266
- function d(o, a, c, i, w) {
267
- if (typeof c != "function")
266
+ function d(o, r, a, c, k) {
267
+ if (typeof a != "function")
268
268
  throw new TypeError("The listener must be a function");
269
- var g = new r(c, i || o, w), y = t ? t + a : a;
270
- return o._events[y] ? o._events[y].fn ? o._events[y] = [o._events[y], g] : o._events[y].push(g) : (o._events[y] = g, o._eventsCount++), o;
269
+ var g = new i(a, c || o, k), _ = t ? t + r : r;
270
+ return o._events[_] ? o._events[_].fn ? o._events[_] = [o._events[_], g] : o._events[_].push(g) : (o._events[_] = g, o._eventsCount++), o;
271
271
  }
272
- function u(o, a) {
273
- --o._eventsCount === 0 ? o._events = new n() : delete o._events[a];
272
+ function u(o, r) {
273
+ --o._eventsCount === 0 ? o._events = new n() : delete o._events[r];
274
274
  }
275
275
  function l() {
276
276
  this._events = new n(), this._eventsCount = 0;
277
277
  }
278
278
  l.prototype.eventNames = function() {
279
- var o = [], a, c;
279
+ var o = [], r, a;
280
280
  if (this._eventsCount === 0) return o;
281
- for (c in a = this._events)
282
- s.call(a, c) && o.push(t ? c.slice(1) : c);
283
- return Object.getOwnPropertySymbols ? o.concat(Object.getOwnPropertySymbols(a)) : o;
281
+ for (a in r = this._events)
282
+ s.call(r, a) && o.push(t ? a.slice(1) : a);
283
+ return Object.getOwnPropertySymbols ? o.concat(Object.getOwnPropertySymbols(r)) : o;
284
284
  }, l.prototype.listeners = function(o) {
285
- var a = t ? t + o : o, c = this._events[a];
286
- if (!c) return [];
287
- if (c.fn) return [c.fn];
288
- for (var i = 0, w = c.length, g = new Array(w); i < w; i++)
289
- g[i] = c[i].fn;
285
+ var r = t ? t + o : o, a = this._events[r];
286
+ if (!a) return [];
287
+ if (a.fn) return [a.fn];
288
+ for (var c = 0, k = a.length, g = new Array(k); c < k; c++)
289
+ g[c] = a[c].fn;
290
290
  return g;
291
291
  }, l.prototype.listenerCount = function(o) {
292
- var a = t ? t + o : o, c = this._events[a];
293
- return c ? c.fn ? 1 : c.length : 0;
294
- }, l.prototype.emit = function(o, a, c, i, w, g) {
295
- var y = t ? t + o : o;
296
- if (!this._events[y]) return !1;
297
- var h = this._events[y], I = arguments.length, x, p;
298
- if (h.fn) {
299
- switch (h.once && this.removeListener(o, h.fn, void 0, !0), I) {
292
+ var r = t ? t + o : o, a = this._events[r];
293
+ return a ? a.fn ? 1 : a.length : 0;
294
+ }, l.prototype.emit = function(o, r, a, c, k, g) {
295
+ var _ = t ? t + o : o;
296
+ if (!this._events[_]) return !1;
297
+ var p = this._events[_], S = arguments.length, b, h;
298
+ if (p.fn) {
299
+ switch (p.once && this.removeListener(o, p.fn, void 0, !0), S) {
300
300
  case 1:
301
- return h.fn.call(h.context), !0;
301
+ return p.fn.call(p.context), !0;
302
302
  case 2:
303
- return h.fn.call(h.context, a), !0;
303
+ return p.fn.call(p.context, r), !0;
304
304
  case 3:
305
- return h.fn.call(h.context, a, c), !0;
305
+ return p.fn.call(p.context, r, a), !0;
306
306
  case 4:
307
- return h.fn.call(h.context, a, c, i), !0;
307
+ return p.fn.call(p.context, r, a, c), !0;
308
308
  case 5:
309
- return h.fn.call(h.context, a, c, i, w), !0;
309
+ return p.fn.call(p.context, r, a, c, k), !0;
310
310
  case 6:
311
- return h.fn.call(h.context, a, c, i, w, g), !0;
311
+ return p.fn.call(p.context, r, a, c, k, g), !0;
312
312
  }
313
- for (p = 1, x = new Array(I - 1); p < I; p++)
314
- x[p - 1] = arguments[p];
315
- h.fn.apply(h.context, x);
313
+ for (h = 1, b = new Array(S - 1); h < S; h++)
314
+ b[h - 1] = arguments[h];
315
+ p.fn.apply(p.context, b);
316
316
  } else {
317
- var A = h.length, _;
318
- for (p = 0; p < A; p++)
319
- switch (h[p].once && this.removeListener(o, h[p].fn, void 0, !0), I) {
317
+ var x = p.length, y;
318
+ for (h = 0; h < x; h++)
319
+ switch (p[h].once && this.removeListener(o, p[h].fn, void 0, !0), S) {
320
320
  case 1:
321
- h[p].fn.call(h[p].context);
321
+ p[h].fn.call(p[h].context);
322
322
  break;
323
323
  case 2:
324
- h[p].fn.call(h[p].context, a);
324
+ p[h].fn.call(p[h].context, r);
325
325
  break;
326
326
  case 3:
327
- h[p].fn.call(h[p].context, a, c);
327
+ p[h].fn.call(p[h].context, r, a);
328
328
  break;
329
329
  case 4:
330
- h[p].fn.call(h[p].context, a, c, i);
330
+ p[h].fn.call(p[h].context, r, a, c);
331
331
  break;
332
332
  default:
333
- if (!x) for (_ = 1, x = new Array(I - 1); _ < I; _++)
334
- x[_ - 1] = arguments[_];
335
- h[p].fn.apply(h[p].context, x);
333
+ if (!b) for (y = 1, b = new Array(S - 1); y < S; y++)
334
+ b[y - 1] = arguments[y];
335
+ p[h].fn.apply(p[h].context, b);
336
336
  }
337
337
  }
338
338
  return !0;
339
- }, l.prototype.on = function(o, a, c) {
340
- return d(this, o, a, c, !1);
341
- }, l.prototype.once = function(o, a, c) {
342
- return d(this, o, a, c, !0);
343
- }, l.prototype.removeListener = function(o, a, c, i) {
344
- var w = t ? t + o : o;
345
- if (!this._events[w]) return this;
346
- if (!a)
347
- return u(this, w), this;
348
- var g = this._events[w];
339
+ }, l.prototype.on = function(o, r, a) {
340
+ return d(this, o, r, a, !1);
341
+ }, l.prototype.once = function(o, r, a) {
342
+ return d(this, o, r, a, !0);
343
+ }, l.prototype.removeListener = function(o, r, a, c) {
344
+ var k = t ? t + o : o;
345
+ if (!this._events[k]) return this;
346
+ if (!r)
347
+ return u(this, k), this;
348
+ var g = this._events[k];
349
349
  if (g.fn)
350
- g.fn === a && (!i || g.once) && (!c || g.context === c) && u(this, w);
350
+ g.fn === r && (!c || g.once) && (!a || g.context === a) && u(this, k);
351
351
  else {
352
- for (var y = 0, h = [], I = g.length; y < I; y++)
353
- (g[y].fn !== a || i && !g[y].once || c && g[y].context !== c) && h.push(g[y]);
354
- h.length ? this._events[w] = h.length === 1 ? h[0] : h : u(this, w);
352
+ for (var _ = 0, p = [], S = g.length; _ < S; _++)
353
+ (g[_].fn !== r || c && !g[_].once || a && g[_].context !== a) && p.push(g[_]);
354
+ p.length ? this._events[k] = p.length === 1 ? p[0] : p : u(this, k);
355
355
  }
356
356
  return this;
357
357
  }, l.prototype.removeAllListeners = function(o) {
358
- var a;
359
- return o ? (a = t ? t + o : o, this._events[a] && u(this, a)) : (this._events = new n(), this._eventsCount = 0), this;
358
+ var r;
359
+ return o ? (r = t ? t + o : o, this._events[r] && u(this, r)) : (this._events = new n(), this._eventsCount = 0), this;
360
360
  }, l.prototype.off = l.prototype.removeListener, l.prototype.addListener = l.prototype.on, l.prefixed = t, l.EventEmitter = l, e.exports = l;
361
- })(Ie)), Ie.exports;
361
+ })($e)), $e.exports;
362
362
  }
363
- yt();
364
- class bt extends Error {
363
+ bt();
364
+ class _t extends Error {
365
365
  }
366
- bt.prototype.name = "InvalidTokenError";
367
- var _t = typeof global == "object" && global && global.Object === Object && global, wt = typeof self == "object" && self && self.Object === Object && self, kt = _t || wt || Function("return this")(), oe = kt.Symbol;
366
+ _t.prototype.name = "InvalidTokenError";
367
+ var wt = typeof global == "object" && global && global.Object === Object && global, kt = typeof self == "object" && self && self.Object === Object && self, xt = wt || kt || Function("return this")(), oe = xt.Symbol;
368
368
  oe && oe.toStringTag;
369
369
  oe && oe.toStringTag;
370
370
  var Q = /* @__PURE__ */ ((e) => (e.INIT = "init", e.VERIFYING = "verifying", e.VERIFIED = "verified", e.REFRESH = "refresh", e.ERROR = "error", e))(Q || {});
371
- const fe = Se("auth", () => {
372
- const e = R("awesomeAuth"), s = !e && Fe(), t = C(!1), n = C(!1), r = C(), d = !!e, u = Y(() => e ? e.root : "");
371
+ const he = Te("auth", () => {
372
+ const e = N("awesomeAuth"), s = !e && Ke(), t = $(!1), n = $(!1), i = $(), d = !!e, u = Y(() => e ? e.root : "");
373
373
  async function l() {
374
374
  return e ? e.accessToken : s ? await s.getAccessTokenSilently() : "";
375
375
  }
376
376
  function o() {
377
377
  e ? e.doSignIn() : s && s.loginWithPopup();
378
378
  }
379
- function a(i) {
380
- e ? e.doSignOut() : s && s.logout(i);
379
+ function r(c) {
380
+ e ? e.doSignOut() : s && s.logout(c);
381
381
  }
382
- async function c(i, w) {
383
- e && await e.renderButton(i, w);
382
+ async function a(c, k) {
383
+ e && await e.renderButton(c, k);
384
384
  }
385
- return e ? (e.on(Q.INIT, (i) => {
386
- n.value = i, i && (t.value = !1);
387
- }), e.on(Q.VERIFYING, (i) => {
388
- n.value = i;
389
- }), e.on(Q.VERIFIED, (i) => {
390
- t.value = i, r.value = i ? e.user : void 0;
391
- }), n.value = e.isVerifying, t.value = e.isVerified, r.value = e.user) : s && (G(
385
+ return e ? (e.on(Q.INIT, (c) => {
386
+ n.value = c, c && (t.value = !1);
387
+ }), e.on(Q.VERIFYING, (c) => {
388
+ n.value = c;
389
+ }), e.on(Q.VERIFIED, (c) => {
390
+ t.value = c, i.value = c ? e.user : void 0;
391
+ }), n.value = e.isVerifying, t.value = e.isVerified, i.value = e.user) : s && (G(
392
392
  s.isLoading,
393
- (i) => {
394
- n.value = i;
393
+ (c) => {
394
+ n.value = c;
395
395
  },
396
396
  { immediate: !0 }
397
397
  ), G(
398
398
  s.isAuthenticated,
399
- (i) => {
400
- t.value = i;
399
+ (c) => {
400
+ t.value = c;
401
401
  },
402
402
  { immediate: !0 }
403
403
  ), G(
404
404
  s.user,
405
- (i) => {
406
- r.value = i;
405
+ (c) => {
406
+ i.value = c;
407
407
  },
408
408
  { immediate: !0 }
409
409
  )), {
@@ -411,25 +411,25 @@ const fe = Se("auth", () => {
411
411
  isAwesomeAuth: d,
412
412
  isLoading: n,
413
413
  authEndpoint: u,
414
- user: r,
414
+ user: i,
415
415
  getAccessToken: l,
416
- renderGoogleButton: c,
416
+ renderGoogleButton: a,
417
417
  login: o,
418
- logout: a
418
+ logout: r
419
419
  };
420
- }), xt = { class: "ac-form-control bg-base-200 rounded-lg" }, At = {
420
+ }), At = { class: "ac-form-control bg-base-200 rounded-lg" }, It = {
421
421
  class: "sr-only",
422
422
  for: "ac-comment"
423
- }, It = ["placeholder"], $t = { class: "p-2 rounded-b-lg bg-base-300 flex items-center relative" }, Ct = {
423
+ }, $t = ["placeholder"], Ct = { class: "p-2 rounded-b-lg bg-base-300 flex items-center relative" }, Et = {
424
424
  key: 1,
425
425
  class: "ac-alert ac-alert-error ms-4 me-auto py-1"
426
- }, Et = ["disabled"], St = {
426
+ }, St = ["disabled"], Tt = {
427
427
  key: 0,
428
428
  class: "ac-loading ac-loading-spinner"
429
- }, Tt = {
429
+ }, Lt = {
430
430
  name: "CommentForm"
431
- }, ee = /* @__PURE__ */ U({
432
- ...Tt,
431
+ }, ee = /* @__PURE__ */ D({
432
+ ...Lt,
433
433
  props: {
434
434
  noVersion: { type: Boolean },
435
435
  currentId: {},
@@ -440,65 +440,65 @@ const fe = Se("auth", () => {
440
440
  },
441
441
  emits: ["close", "update"],
442
442
  setup(e, { emit: s }) {
443
- const t = e, n = s, r = fe(), d = J(), { t: u } = F(), l = R("ApiBaseUrl"), o = R("Auth0Domain"), a = R("siteId"), c = R("TurnstileSiteKey"), i = "0.10.4", w = C(), g = C(), y = C(!1), h = C(t.content || ""), I = C(""), x = C(!1), p = C(""), A = C(""), _ = Y(() => !r.isAuthenticated);
444
- let b = null;
445
- function T() {
443
+ const t = e, n = s, i = he(), d = J(), { t: u } = U(), l = N("ApiBaseUrl"), o = N("Auth0Domain"), r = N("siteId"), a = N("TurnstileSiteKey"), c = N("AutoFocus"), k = "0.10.6", g = $(), _ = $(), p = $(!1), S = $(t.content || ""), b = $(""), h = $(!1), x = $(""), y = $(""), w = Y(() => !i.isAuthenticated);
444
+ let C = null;
445
+ function F() {
446
446
  if (typeof window > "u") return Promise.reject(new Error("Turnstile 仅支持浏览器环境"));
447
447
  if (window.turnstile) return Promise.resolve();
448
- if (b) return b;
449
- const L = "https://challenges.cloudflare.com/turnstile/v0/api.js?render=explicit";
450
- return b = new Promise((S, z) => {
451
- const W = document.querySelector(`script[src="${L}"]`), N = W || document.createElement("script");
452
- function he() {
453
- S();
448
+ if (C) return C;
449
+ const T = "https://challenges.cloudflare.com/turnstile/v0/api.js?render=explicit";
450
+ return C = new Promise((L, z) => {
451
+ const W = document.querySelector(`script[src="${T}"]`), R = W || document.createElement("script");
452
+ function ve() {
453
+ L();
454
454
  }
455
455
  function X() {
456
456
  z(new Error("Failed to load Turnstile script"));
457
457
  }
458
- N.addEventListener("load", he, { once: !0 }), N.addEventListener("error", X, { once: !0 }), W || (N.src = L, N.async = !0, N.defer = !0, document.head.appendChild(N));
459
- }), b.catch(() => {
460
- b = null;
461
- }), b;
458
+ R.addEventListener("load", ve, { once: !0 }), R.addEventListener("error", X, { once: !0 }), W || (R.src = T, R.async = !0, R.defer = !0, document.head.appendChild(R));
459
+ }), C.catch(() => {
460
+ C = null;
461
+ }), C;
462
462
  }
463
- async function P() {
464
- if (!(!c || !g.value)) {
465
- if (await T(), !window.turnstile) {
466
- I.value = "Turnstile initialization failed";
463
+ async function K() {
464
+ if (!(!a || !_.value)) {
465
+ if (await F(), !window.turnstile) {
466
+ b.value = "Turnstile initialization failed";
467
467
  return;
468
468
  }
469
- if (A.value) {
470
- window.turnstile.reset(A.value);
469
+ if (y.value) {
470
+ window.turnstile.reset(y.value);
471
471
  return;
472
472
  }
473
- A.value = window.turnstile.render(g.value, {
474
- sitekey: c,
473
+ y.value = window.turnstile.render(_.value, {
474
+ sitekey: a,
475
475
  size: "compact",
476
- callback: (L) => {
477
- p.value = L, I.value = "";
476
+ callback: (T) => {
477
+ x.value = T, b.value = "";
478
478
  },
479
479
  "expired-callback": () => {
480
- p.value = "";
480
+ x.value = "";
481
481
  },
482
482
  "error-callback": () => {
483
- p.value = "", I.value = "Turnstile validation failed, please try again.";
483
+ x.value = "", b.value = "Turnstile validation failed, please try again.";
484
484
  }
485
485
  });
486
486
  }
487
487
  }
488
- function K() {
489
- if (!A.value || !window.turnstile) {
490
- p.value = "";
488
+ function Z() {
489
+ if (!y.value || !window.turnstile) {
490
+ x.value = "";
491
491
  return;
492
492
  }
493
493
  try {
494
- window.turnstile.remove(A.value);
494
+ window.turnstile.remove(y.value);
495
495
  } catch {
496
- window.turnstile.reset(A.value);
496
+ window.turnstile.reset(y.value);
497
497
  }
498
- A.value = "", p.value = "";
498
+ y.value = "", x.value = "";
499
499
  }
500
500
  function ae() {
501
- return r.user ? r.user : {
501
+ return i.user ? i.user : {
502
502
  sub: "anonymous",
503
503
  name: "anonymous",
504
504
  nickname: "anonymous",
@@ -506,251 +506,251 @@ const fe = Se("auth", () => {
506
506
  email: ""
507
507
  };
508
508
  }
509
- async function q(L) {
510
- if (!r.isAuthenticated) {
511
- if (!c)
512
- return Z();
513
- if (x.value = !0, !p.value) {
514
- await ue(), await P();
509
+ async function q(T) {
510
+ if (!i.isAuthenticated) {
511
+ if (!a)
512
+ return O();
513
+ if (h.value = !0, !x.value) {
514
+ await de(), await K();
515
515
  return;
516
516
  }
517
517
  }
518
- if (L.target.matches(":invalid")) return;
519
- const S = h.value.trim();
520
- if (!S) return;
521
- if (!ut(S).valid) {
522
- I.value = "We encourage meaningful contributions to foster a positive community. Thank you for your understanding!";
518
+ if (T.target.matches(":invalid")) return;
519
+ const L = S.value.trim();
520
+ if (!L) return;
521
+ if (!dt(L).valid) {
522
+ b.value = "We encourage meaningful contributions to foster a positive community. Thank you for your understanding!";
523
523
  return;
524
524
  }
525
- y.value = !0, I.value = "";
525
+ p.value = !0, b.value = "";
526
526
  let z = l + "/api/comment", W = "POST";
527
527
  t.currentId && (z += "/" + t.currentId, W = "PATCH");
528
528
  try {
529
- const N = r.isAuthenticated ? await r.getAccessToken() : "", X = {
529
+ const R = i.isAuthenticated ? await i.getAccessToken() : "", X = {
530
530
  "Content-Type": "application/json",
531
- "Auth-Endpoint": r.authEndpoint
531
+ "Auth-Endpoint": i.authEndpoint
532
532
  };
533
- N && (X.Authorization = `Bearer ${N}`);
534
- const Ne = _.value ? {
533
+ R && (X.Authorization = `Bearer ${R}`);
534
+ const Re = w.value ? {
535
535
  referrer: document.referrer || "",
536
536
  language: navigator.language || "",
537
537
  languages: navigator.languages || [],
538
538
  timezone: Intl.DateTimeFormat().resolvedOptions().timeZone || "",
539
539
  platform: navigator.platform || ""
540
- } : null, Re = _.value ? {
540
+ } : null, Oe = w.value ? {
541
541
  custom: window.custom_comment_data ?? null,
542
- anonymous: Ne
543
- } : window.custom_comment_data, ve = await fetch(z, {
542
+ anonymous: Re
543
+ } : window.custom_comment_data, ge = await fetch(z, {
544
544
  method: W,
545
545
  headers: X,
546
546
  body: JSON.stringify({
547
- comment: S,
547
+ comment: L,
548
548
  postId: d.postId,
549
- siteId: a,
549
+ siteId: r,
550
550
  domain: o,
551
551
  ancestorId: t.ancestorId ? Number(t.ancestorId) : void 0,
552
552
  parentId: t.parentId ? Number(t.parentId) : void 0,
553
553
  status: t.status,
554
554
  window: `${window.innerWidth}x${window.innerHeight} / ${screen.width, screen.height}`,
555
- customData: Re,
555
+ customData: Oe,
556
556
  extraData: `${window.BM_LEVEL}:${window.BM_VALUE}`,
557
- turnstileToken: _.value ? p.value : void 0
557
+ turnstileToken: w.value ? x.value : void 0
558
558
  })
559
- }), re = await ve.json();
560
- if (!ve.ok || re.message) {
561
- I.value = "Failed to post comment: " + (re.message || "Unknown"), y.value = !1;
559
+ }), ie = await ge.json();
560
+ if (!ge.ok || ie.message) {
561
+ b.value = "Failed to post comment: " + (ie.message || "Unknown"), p.value = !1;
562
562
  return;
563
563
  }
564
- const { id: ge, status: ye } = re.data, be = ae();
565
- t.ancestorId || t.parentId ? d.addComment(ge, S, be, ye, t.ancestorId, t.parentId) : t.currentId ? n("update", S) : d.addComment(ge, S, be, ye), h.value = "", n("close"), _.value && (K(), x.value = !1);
566
- } catch (N) {
567
- I.value = N.message || String(N);
564
+ const { id: ye, status: be } = ie.data, _e = ae();
565
+ t.ancestorId || t.parentId ? d.addComment(ye, L, _e, be, t.ancestorId, t.parentId) : t.currentId ? n("update", L) : d.addComment(ye, L, _e, be), S.value = "", n("close"), w.value && (Z(), h.value = !1);
566
+ } catch (R) {
567
+ b.value = R.message || String(R);
568
568
  }
569
- y.value = !1;
569
+ p.value = !1;
570
570
  }
571
- function Z() {
572
- r.login();
571
+ function O() {
572
+ i.login();
573
573
  }
574
- function O(L) {
575
- ct(L, "Enter") && q(L);
574
+ function P(T) {
575
+ lt(T, "Enter") && q(T);
576
576
  }
577
- function j() {
577
+ function re() {
578
578
  n("close");
579
579
  }
580
580
  return se(() => {
581
- w.value?.focus();
581
+ (c || t.currentId) && g.value?.focus();
582
582
  }), G(
583
- () => x.value,
584
- async (L) => {
585
- !L || r.isAuthenticated || (await ue(), await P());
583
+ () => h.value,
584
+ async (T) => {
585
+ !T || i.isAuthenticated || (await de(), await K());
586
586
  }
587
587
  ), G(
588
- () => r.isAuthenticated,
589
- (L) => {
590
- L && (x.value = !1, K());
588
+ () => i.isAuthenticated,
589
+ (T) => {
590
+ T && (h.value = !1, Z());
591
591
  }
592
- ), (L, S) => (f(), v("form", {
592
+ ), (T, L) => (f(), v("form", {
593
593
  class: "mb-6",
594
- onSubmit: ie(q, ["prevent"])
594
+ onSubmit: ce(q, ["prevent"])
595
595
  }, [
596
- k("div", xt, [
597
- k("label", At, $(m(u)("your_comment")), 1),
598
- Oe(k("textarea", {
596
+ A("div", At, [
597
+ A("label", It, I(m(u)("your_comment")), 1),
598
+ Me(A("textarea", {
599
599
  id: "ac-comment",
600
600
  ref_key: "textarea",
601
- ref: w,
602
- "onUpdate:modelValue": S[0] || (S[0] = (z) => h.value = z),
601
+ ref: g,
602
+ "onUpdate:modelValue": L[0] || (L[0] = (z) => S.value = z),
603
603
  placeholder: m(u)("placeholder"),
604
604
  class: "ac-textarea ac-textarea-bordered bg-base-200 rounded-b-none focus:outline-none",
605
605
  required: "",
606
606
  rows: "3",
607
607
  onKeydown: [
608
- S[1] || (S[1] = ie(() => {
608
+ L[1] || (L[1] = ce(() => {
609
609
  }, ["stop"])),
610
- _e(O, ["enter"]),
611
- _e(j, ["esc"])
610
+ we(P, ["enter"]),
611
+ we(re, ["esc"])
612
612
  ],
613
- onKeyup: S[2] || (S[2] = ie(() => {
613
+ onKeyup: L[2] || (L[2] = ce(() => {
614
614
  }, ["stop"]))
615
- }, null, 40, It), [
616
- [Me, h.value]
615
+ }, null, 40, $t), [
616
+ [Pe, S.value]
617
617
  ]),
618
- k("div", $t, [
618
+ A("div", Ct, [
619
619
  e.noVersion ? E("", !0) : (f(), v("div", {
620
620
  key: 0,
621
- class: de(["text-xs text-neutral-400/40", { "me-auto": !I.value }])
622
- }, " v" + $(m(i)), 3)),
623
- I.value ? (f(), v("div", Ct, $(I.value), 1)) : E("", !0),
624
- x.value && !m(r).isAuthenticated ? (f(), v(M, { key: 2 }, [
625
- m(r).isAwesomeAuth ? E("", !0) : (f(), v("button", {
621
+ class: me(["text-xs text-neutral-400/40", { "me-auto": !b.value }])
622
+ }, " v" + I(m(k)), 3)),
623
+ b.value ? (f(), v("div", Et, I(b.value), 1)) : E("", !0),
624
+ h.value && !m(i).isAuthenticated ? (f(), v(M, { key: 2 }, [
625
+ m(i).isAwesomeAuth ? E("", !0) : (f(), v("button", {
626
626
  key: 0,
627
627
  class: "ac-btn ac-btn-secondary ac-btn-xs mx-4",
628
628
  type: "button",
629
- onClick: Z
630
- }, $(m(u)("login")), 1)),
631
- m(c) ? (f(), v("div", {
629
+ onClick: O
630
+ }, I(m(u)("login")), 1)),
631
+ m(a) ? (f(), v("div", {
632
632
  key: 1,
633
633
  ref_key: "turnstileContainer",
634
- ref: g,
634
+ ref: _,
635
635
  class: "absolute right-2 top-10"
636
636
  }, null, 512)) : E("", !0)
637
637
  ], 64)) : E("", !0),
638
- k("button", {
639
- disabled: y.value || x.value && !m(r).isAuthenticated && !p.value,
638
+ A("button", {
639
+ disabled: p.value || h.value && !m(i).isAuthenticated && !x.value,
640
640
  class: "ac-btn ac-btn-primary ac-btn-sm"
641
641
  }, [
642
- y.value ? (f(), v("span", St)) : E("", !0),
642
+ p.value ? (f(), v("span", Tt)) : E("", !0),
643
643
  e.currentId ? (f(), v(M, { key: 1 }, [
644
- H($(m(u)("save_editing")), 1)
644
+ H(I(m(u)("save_editing")), 1)
645
645
  ], 64)) : e.parentId ? (f(), v(M, { key: 2 }, [
646
- H($(m(u)("post_reply")), 1)
646
+ H(I(m(u)("post_reply")), 1)
647
647
  ], 64)) : (f(), v(M, { key: 3 }, [
648
- H($(m(u)("post_comment")), 1)
648
+ H(I(m(u)("post_comment")), 1)
649
649
  ], 64))
650
- ], 8, Et)
650
+ ], 8, St)
651
651
  ])
652
652
  ])
653
653
  ], 32));
654
654
  }
655
- }), Lt = { class: "flex items-center gap-2" }, Nt = ["aria-label", "title", "disabled"], Rt = {
655
+ }), Nt = { class: "flex items-center gap-2" }, Rt = ["aria-label", "title", "disabled"], Ot = {
656
656
  key: 0,
657
657
  class: "ac-loading ac-loading-spinner"
658
- }, Ot = { class: "text-sm text-gray-500 dark:text-gray-400" }, Mt = ["aria-label", "title", "disabled"], Pt = {
658
+ }, Mt = { class: "text-sm text-gray-500 dark:text-gray-400" }, Pt = ["aria-label", "title", "disabled"], jt = {
659
659
  key: 0,
660
660
  class: "ac-loading ac-loading-spinner"
661
- }, jt = ["aria-label", "title"], ce = "awesome-comment-likes", Bt = /* @__PURE__ */ U({
661
+ }, Bt = ["aria-label", "title"], le = "awesome-comment-likes", Dt = /* @__PURE__ */ D({
662
662
  __name: "comment-actions",
663
663
  props: {
664
664
  comment: {}
665
665
  },
666
666
  emits: ["reply"],
667
667
  setup(e, { emit: s }) {
668
- const t = e, n = s, r = J(), { t: d } = F(), u = R("ApiBaseUrl"), l = R("siteId"), o = C(0);
669
- async function a(c = !0) {
668
+ const t = e, n = s, i = J(), { t: d } = U(), u = N("ApiBaseUrl"), l = N("siteId"), o = $(0);
669
+ async function r(a = !0) {
670
670
  if (o.value) return;
671
- const i = localStorage.getItem(ce);
672
- if (i) {
673
- const y = JSON.parse(i), h = Date.now(), I = y[t.comment.id];
674
- if (y[t.comment.id] = h, localStorage.setItem(ce, JSON.stringify(y)), I && h - I < 6e4) {
675
- r.updateComment(t.comment.id, {
676
- like: Math.max((t.comment.like || 0) + (c ? 1 : -1), 0)
671
+ const c = localStorage.getItem(le);
672
+ if (c) {
673
+ const _ = JSON.parse(c), p = Date.now(), S = _[t.comment.id];
674
+ if (_[t.comment.id] = p, localStorage.setItem(le, JSON.stringify(_)), S && p - S < 6e4) {
675
+ i.updateComment(t.comment.id, {
676
+ like: Math.max((t.comment.like || 0) + (a ? 1 : -1), 0)
677
677
  });
678
678
  return;
679
679
  }
680
680
  } else
681
- localStorage.setItem(ce, JSON.stringify({ [t.comment.id]: Date.now() }));
682
- o.value = c ? 1 : -1;
681
+ localStorage.setItem(le, JSON.stringify({ [t.comment.id]: Date.now() }));
682
+ o.value = a ? 1 : -1;
683
683
  const g = await (await fetch(`${u}/api/like/${t.comment.id}`, {
684
684
  method: "POST",
685
685
  headers: {
686
686
  "Content-Type": "application/json"
687
687
  },
688
688
  body: JSON.stringify({
689
- like: c,
689
+ like: a,
690
690
  postId: t.comment.postId,
691
691
  siteId: l
692
692
  })
693
693
  })).json();
694
- r.updateComment(t.comment.id, {
694
+ i.updateComment(t.comment.id, {
695
695
  like: g.data?.like || 0
696
696
  }), o.value = 0;
697
697
  }
698
- return (c, i) => (f(), v("div", Lt, [
699
- k("button", {
698
+ return (a, c) => (f(), v("div", Nt, [
699
+ A("button", {
700
700
  "aria-label": m(d)("like"),
701
701
  title: m(d)("like"),
702
702
  class: "ac-btn ac-btn-sm ac-btn-circle border-0 shadow-none",
703
703
  disabled: o.value !== 0,
704
704
  type: "button",
705
- onClick: i[0] || (i[0] = (w) => a())
705
+ onClick: c[0] || (c[0] = (k) => r())
706
706
  }, [
707
- o.value > 0 ? (f(), v("span", Rt)) : (f(), B(m(Ve), {
707
+ o.value > 0 ? (f(), v("span", Ot)) : (f(), j(m(Ge), {
708
708
  key: 1,
709
709
  size: 16
710
710
  }))
711
- ], 8, Nt),
712
- k("span", Ot, $(e.comment.like || 0), 1),
713
- k("button", {
711
+ ], 8, Rt),
712
+ A("span", Mt, I(e.comment.like || 0), 1),
713
+ A("button", {
714
714
  "aria-label": m(d)("dislike"),
715
715
  title: m(d)("dislike"),
716
716
  class: "ac-btn ac-btn-sm ac-btn-circle border-0 shadow-none",
717
717
  disabled: o.value !== 0,
718
718
  type: "button",
719
- onClick: i[1] || (i[1] = (w) => a(!1))
719
+ onClick: c[1] || (c[1] = (k) => r(!1))
720
720
  }, [
721
- o.value < 0 ? (f(), v("span", Pt)) : (f(), B(m(Ge), {
721
+ o.value < 0 ? (f(), v("span", jt)) : (f(), j(m(He), {
722
722
  key: 1,
723
723
  size: 16
724
724
  }))
725
- ], 8, Mt),
726
- k("button", {
725
+ ], 8, Pt),
726
+ A("button", {
727
727
  "aria-label": m(d)("reply"),
728
728
  title: m(d)("reply"),
729
729
  class: "ac-btn ac-btn-sm ac-btn-circle border-0 shadow-none -me-1.5",
730
730
  type: "button",
731
- onClick: i[2] || (i[2] = (w) => n("reply"))
731
+ onClick: c[2] || (c[2] = (k) => n("reply"))
732
732
  }, [
733
- D(m(He), { size: 16 })
734
- ], 8, jt)
733
+ B(m(Je), { size: 16 })
734
+ ], 8, Bt)
735
735
  ]));
736
736
  }
737
- }), Dt = ["href"], Ut = ["innerHTML"], Ft = {
737
+ }), Ut = ["href"], Ft = ["innerHTML"], Kt = {
738
738
  key: 1,
739
739
  class: "text-gray-500 break-words overflow-x-auto whitespace-pre-line pb-3 mb-0 dark:text-gray-400"
740
- }, Kt = ["href"], zt = /* @__PURE__ */ U({
740
+ }, zt = ["href"], Vt = /* @__PURE__ */ D({
741
741
  __name: "comment-content",
742
742
  props: {
743
743
  ancestorId: {},
744
744
  comment: {}
745
745
  },
746
746
  setup(e) {
747
- const s = e, { t } = F(), n = J();
748
- function r(u) {
749
- return We(u).replace(/<a/g, '<a target="_blank"');
747
+ const s = e, { t } = U(), n = J();
748
+ function i(u) {
749
+ return Ye(u).replace(/<a/g, '<a target="_blank"');
750
750
  }
751
751
  function d(u) {
752
752
  if (s.ancestorId) {
753
- const o = n.comments[s.ancestorId]?.children?.find((a) => Number(a.id) === Number(u));
753
+ const o = n.comments[s.ancestorId]?.children?.find((r) => Number(r.id) === Number(u));
754
754
  return o?.isAdmin ? t("admin") : o?.user?.name || o?.user?.email || "";
755
755
  }
756
756
  return "";
@@ -761,37 +761,37 @@ const fe = Se("auth", () => {
761
761
  href: `#awcm-${e.comment.parentId}`,
762
762
  class: "inline-block px-2 py-1 rounded-lg mt-2 bg-base-300 text-gray-500 dark:bg-neutral-400/20 dark:text-gray-400",
763
763
  target: "_self"
764
- }, "@" + $(d(e.comment.parentId)), 9, Dt)) : E("", !0),
765
- k("article", {
764
+ }, "@" + I(d(e.comment.parentId)), 9, Ut)) : E("", !0),
765
+ A("article", {
766
766
  class: "text-gray-500 break-words overflow-x-auto dark:text-gray-400",
767
- innerHTML: r(e.comment.content)
768
- }, null, 8, Ut)
769
- ], 64)) : (f(), v("p", Ft, [
767
+ innerHTML: i(e.comment.content)
768
+ }, null, 8, Ft)
769
+ ], 64)) : (f(), v("p", Kt, [
770
770
  e.comment.parentId && e.comment.parentId !== e.comment.ancestorId ? (f(), v("a", {
771
771
  key: 0,
772
772
  href: `#awcm-${e.comment.parentId}`,
773
773
  class: "inline-block px-2 py-1 rounded-lg me-1 bg-base-300 text-gray-500 dark:bg-neutral-400/20 dark:text-gray-400",
774
774
  target: "_self"
775
- }, "@" + $(d(e.comment.parentId)), 9, Kt)) : E("", !0),
776
- H($(e.comment.content), 1)
775
+ }, "@" + I(d(e.comment.parentId)), 9, zt)) : E("", !0),
776
+ H(I(e.comment.content), 1)
777
777
  ]));
778
778
  }
779
779
  });
780
- function Vt(e) {
780
+ function Gt(e) {
781
781
  let s = 0;
782
782
  for (let n = 0; n < e.length; n++)
783
783
  s = e.charCodeAt(n) + ((s << 5) - s);
784
784
  let t = "#";
785
785
  for (let n = 0; n < 3; n++) {
786
- const r = s >> n * 8 & 255;
787
- t += ("00" + r.toString(16)).slice(-2);
786
+ const i = s >> n * 8 & 255;
787
+ t += ("00" + i.toString(16)).slice(-2);
788
788
  }
789
789
  return t;
790
790
  }
791
- const Gt = { class: "flex items-center gap-2 text-sm text-base-content dark:text-white" }, Ht = { class: "ac-avatar" }, Jt = {
791
+ const Ht = { class: "flex items-center gap-2 text-sm text-base-content dark:text-white" }, Jt = { class: "ac-avatar" }, Wt = {
792
792
  key: 0,
793
793
  class: "w-6 h-6"
794
- }, Wt = ["alt", "src"], Yt = { class: "text-neutral-content mix-blend-color-dodge uppercase font-bold leading-6" }, qt = ["data-tip"], Zt = ["href"], Xt = ["datetime", "title"], Qt = /* @__PURE__ */ U({
794
+ }, Yt = ["alt", "src"], Zt = { class: "text-neutral-content mix-blend-color-dodge uppercase font-bold leading-6" }, qt = ["data-tip"], Xt = ["href"], Qt = ["datetime", "title"], en = /* @__PURE__ */ D({
795
795
  __name: "comment-header",
796
796
  props: {
797
797
  comment: {},
@@ -800,66 +800,66 @@ const Gt = { class: "flex items-center gap-2 text-sm text-base-content dark:text
800
800
  },
801
801
  emits: ["edit"],
802
802
  setup(e, { emit: s }) {
803
- const t = e, n = s, { t: r } = F(), d = Y(() => {
804
- if (t.comment.isAdmin) return r("admin");
805
- let l = t.comment.user?.name || r("anonymous");
806
- return l = l.replace(vt, ""), l;
803
+ const t = e, n = s, { t: i } = U(), d = Y(() => {
804
+ if (t.comment.isAdmin) return i("admin");
805
+ let l = t.comment.user?.name || i("anonymous");
806
+ return l = l.replace(gt, ""), l;
807
807
  });
808
808
  function u(l) {
809
809
  return `${location.origin}${location.pathname}#awcm-${l}`;
810
810
  }
811
- return (l, o) => (f(), v("div", Gt, [
812
- k("div", Ht, [
813
- e.comment.user?.avatar ? (f(), v("div", Jt, [
814
- k("img", {
811
+ return (l, o) => (f(), v("div", Ht, [
812
+ A("div", Jt, [
813
+ e.comment.user?.avatar ? (f(), v("div", Wt, [
814
+ A("img", {
815
815
  alt: d.value,
816
816
  src: e.comment.user?.avatar,
817
817
  class: "rounded-full max-w-full max-h-full"
818
- }, null, 8, Wt)
818
+ }, null, 8, Yt)
819
819
  ])) : (f(), v("div", {
820
820
  key: 1,
821
- style: Pe({ "background-color": m(Vt)(d.value) }),
821
+ style: je({ "background-color": m(Gt)(d.value) }),
822
822
  class: "avatar-char rounded-full w-6 h-6 text-center"
823
823
  }, [
824
- k("span", Yt, $(d.value.substring(0, 1)), 1)
824
+ A("span", Zt, I(d.value.substring(0, 1)), 1)
825
825
  ], 4))
826
826
  ]),
827
- H(" " + $(d.value) + " ", 1),
827
+ H(" " + I(d.value) + " ", 1),
828
828
  e.comment.isAdmin ? (f(), v("div", {
829
829
  key: 0,
830
- "data-tip": m(r)("admin"),
830
+ "data-tip": m(i)("admin"),
831
831
  class: "ac-tooltip text-success"
832
832
  }, [
833
- D(m(Je), {
833
+ B(m(We), {
834
834
  class: "block",
835
835
  size: 18
836
836
  })
837
837
  ], 8, qt)) : E("", !0),
838
- k("a", {
838
+ A("a", {
839
839
  href: u(e.comment.id),
840
840
  class: "no-underline hover:underline hover:decoration-green-middle"
841
841
  }, [
842
- k("time", {
842
+ A("time", {
843
843
  datetime: e.comment.createdAt.toISOString(),
844
- title: m(xe)(e.comment.createdAt),
844
+ title: m(Ae)(e.comment.createdAt),
845
845
  class: "text-xs text-gray-600 dark:text-gray-400"
846
- }, $(m(xe)(e.comment.createdAt)), 9, Xt)
847
- ], 8, Zt),
846
+ }, I(m(Ae)(e.comment.createdAt)), 9, Qt)
847
+ ], 8, Xt),
848
848
  e.isEditable ? (f(), v("button", {
849
849
  key: 1,
850
850
  class: "ac-btn ac-btn-link ac-btn-xs hover:no-underline",
851
851
  type: "button",
852
- onClick: o[0] || (o[0] = (a) => n("edit"))
853
- }, $(m(r)("edit")), 1)) : E("", !0)
852
+ onClick: o[0] || (o[0] = (r) => n("edit"))
853
+ }, I(m(i)("edit")), 1)) : E("", !0)
854
854
  ]));
855
855
  }
856
- }), en = ["id"], tn = { class: "flex justify-between items-center font-sans" }, nn = {
856
+ }), tn = ["id"], nn = { class: "flex justify-between items-center font-sans" }, on = {
857
857
  key: 0,
858
858
  class: "italic mt-4 text-emerald-600 mb-0 text-sm dark:text-emerald-300"
859
- }, on = {
859
+ }, sn = {
860
860
  name: "CommentItem"
861
- }, sn = /* @__PURE__ */ U({
862
- ...on,
861
+ }, an = /* @__PURE__ */ D({
862
+ ...sn,
863
863
  props: {
864
864
  comment: {},
865
865
  isFirst: { type: Boolean },
@@ -868,103 +868,103 @@ const Gt = { class: "flex items-center gap-2 text-sm text-base-content dark:text
868
868
  ancestorId: {}
869
869
  },
870
870
  setup(e) {
871
- const s = e, { t } = F(), n = J(), r = fe();
871
+ const s = e, { t } = U(), n = J(), i = he();
872
872
  let d;
873
- const u = C(Date.now()), l = C(!1), o = C(!1), a = Y(() => s.comment.userId === r.user?.sub && u.value - s.comment.createdAt.getTime() < 36e5);
873
+ const u = $(Date.now()), l = $(!1), o = $(!1), r = Y(() => s.comment.userId === i.user?.sub && u.value - s.comment.createdAt.getTime() < 36e5);
874
874
  return se(() => {
875
- a.value && (d = setInterval(() => {
876
- u.value = Date.now(), a.value || clearInterval(d);
875
+ r.value && (d = setInterval(() => {
876
+ u.value = Date.now(), r.value || clearInterval(d);
877
877
  }, 1e3));
878
- }), je(() => {
878
+ }), Be(() => {
879
879
  clearInterval(d);
880
- }), (c, i) => {
881
- const w = Be("comment-item", !0);
880
+ }), (a, c) => {
881
+ const k = De("comment-item", !0);
882
882
  return f(), v("div", {
883
883
  id: "awcm-" + e.comment.id,
884
- class: de([[{ "animated flash": e.comment.isNew }, e.isFirstLevel ? "mb-4" : e.isFirst ? "-mt-4" : "mt-1"], "comment-item target:outline target:outline-green-500 target:outline-2 dark:target:outline-1"]),
885
- onAnimationend: i[6] || (i[6] = (g) => m(n).updateComment(e.comment.id, { isNew: !1 }))
884
+ class: me([[{ "animated flash": e.comment.isNew }, e.isFirstLevel ? "mb-4" : e.isFirst ? "-mt-4" : "mt-1"], "comment-item target:outline target:outline-green-500 target:outline-2 dark:target:outline-1"]),
885
+ onAnimationend: c[6] || (c[6] = (g) => m(n).updateComment(e.comment.id, { isNew: !1 }))
886
886
  }, [
887
- k("div", {
888
- class: de(["pt-2 px-4 text-base bg-base-200 dark:bg-gray-900", [{ "rounded-lg": e.isFirstLevel, "rounded-b-lg": e.isLast, "rounded-t-lg shadow-outline-md": e.isFirst }, e.comment.children?.length ? "pb-6" : "pb-3"]])
887
+ A("div", {
888
+ class: me(["pt-2 px-4 text-base bg-base-200 dark:bg-gray-900", [{ "rounded-lg": e.isFirstLevel, "rounded-b-lg": e.isLast, "rounded-t-lg shadow-outline-md": e.isFirst }, e.comment.children?.length ? "pb-6" : "pb-3"]])
889
889
  }, [
890
- k("header", tn, [
891
- D(Qt, {
890
+ A("header", nn, [
891
+ B(en, {
892
892
  comment: e.comment,
893
- "is-editable": a.value,
893
+ "is-editable": r.value,
894
894
  "is-editing": l.value,
895
- onEdit: i[0] || (i[0] = (g) => l.value = !l.value)
895
+ onEdit: c[0] || (c[0] = (g) => l.value = !l.value)
896
896
  }, null, 8, ["comment", "is-editable", "is-editing"]),
897
- D(Bt, {
897
+ B(Dt, {
898
898
  comment: e.comment,
899
- onReply: i[1] || (i[1] = (g) => o.value = !o.value)
899
+ onReply: c[1] || (c[1] = (g) => o.value = !o.value)
900
900
  }, null, 8, ["comment"])
901
901
  ]),
902
- D(zt, {
902
+ B(Vt, {
903
903
  "ancestor-id": e.ancestorId,
904
904
  comment: e.comment
905
905
  }, null, 8, ["ancestor-id", "comment"]),
906
- e.comment.status === m(te).Pending ? (f(), v("p", nn, $(m(t)("approve_hint")), 1)) : E("", !0)
906
+ e.comment.status === m(te).Pending ? (f(), v("p", on, I(m(t)("approve_hint")), 1)) : E("", !0)
907
907
  ], 2),
908
- l.value ? (f(), B(ee, {
908
+ l.value ? (f(), j(ee, {
909
909
  key: 0,
910
910
  content: e.comment.content,
911
911
  "current-id": e.comment.id,
912
912
  status: e.comment.status,
913
913
  class: "mt-3",
914
914
  "no-version": "",
915
- onClose: i[2] || (i[2] = (g) => l.value = !1),
916
- onUpdate: i[3] || (i[3] = (g) => m(n).updateComment(e.comment.id, { content: g }))
915
+ onClose: c[2] || (c[2] = (g) => l.value = !1),
916
+ onUpdate: c[3] || (c[3] = (g) => m(n).updateComment(e.comment.id, { content: g }))
917
917
  }, null, 8, ["content", "current-id", "status"])) : E("", !0),
918
- o.value && e.isFirstLevel ? (f(), B(ee, {
918
+ o.value && e.isFirstLevel ? (f(), j(ee, {
919
919
  key: 1,
920
920
  "ancestor-id": e.ancestorId,
921
921
  "parent-id": Number(e.comment.id),
922
922
  class: "mt-2 ms-7",
923
923
  "no-version": "",
924
- onClose: i[4] || (i[4] = (g) => o.value = !1)
924
+ onClose: c[4] || (c[4] = (g) => o.value = !1)
925
925
  }, null, 8, ["ancestor-id", "parent-id"])) : E("", !0),
926
- e.comment.children?.length ? (f(!0), v(M, { key: 2 }, Ee(e.comment.children, (g, y) => (f(), B(w, {
926
+ e.comment.children?.length ? (f(!0), v(M, { key: 2 }, Se(e.comment.children, (g, _) => (f(), j(k, {
927
927
  key: g.id,
928
928
  "ancestor-id": e.ancestorId,
929
929
  comment: g,
930
- "is-first": y === 0,
930
+ "is-first": _ === 0,
931
931
  "is-first-level": !1,
932
- "is-last": y === e.comment.children.length - 1,
932
+ "is-last": _ === e.comment.children.length - 1,
933
933
  class: "ms-7"
934
934
  }, null, 8, ["ancestor-id", "comment", "is-first", "is-last"]))), 128)) : E("", !0),
935
- o.value && !e.isFirstLevel ? (f(), B(ee, {
935
+ o.value && !e.isFirstLevel ? (f(), j(ee, {
936
936
  key: 3,
937
937
  "ancestor-id": e.ancestorId,
938
938
  "parent-id": e.comment.id,
939
939
  class: "mt-2 ms-7",
940
940
  "no-version": "",
941
- onClose: i[5] || (i[5] = (g) => o.value = !1)
941
+ onClose: c[5] || (c[5] = (g) => o.value = !1)
942
942
  }, null, 8, ["ancestor-id", "parent-id"])) : E("", !0)
943
- ], 42, en);
943
+ ], 42, tn);
944
944
  };
945
945
  }
946
- }), an = {
946
+ }), rn = {
947
947
  key: 0,
948
948
  class: "comments-wrapper"
949
- }, rn = ["disabled"], cn = {
949
+ }, cn = ["disabled"], ln = {
950
950
  key: 0,
951
951
  class: "ac-loading ac-loading-xs ac-loading-spinner"
952
- }, ln = {
952
+ }, un = {
953
953
  key: 1,
954
954
  class: "py-8 text-center"
955
- }, un = {
955
+ }, dn = {
956
956
  name: "CommentSections"
957
- }, dn = /* @__PURE__ */ U({
958
- ...un,
957
+ }, mn = /* @__PURE__ */ D({
958
+ ...dn,
959
959
  setup(e) {
960
- const { t: s } = F(), t = J();
960
+ const { t: s } = U(), t = J();
961
961
  function n() {
962
962
  t.start += 20, t.loadComments();
963
963
  }
964
964
  return se(() => {
965
965
  t.isLoaded || t.loadComments();
966
- }), (r, d) => m(t).isLoaded ? (f(), v("div", an, [
967
- (f(!0), v(M, null, Ee(Object.values(m(t).comments).reverse(), (u) => (f(), B(sn, {
966
+ }), (i, d) => m(t).isLoaded ? (f(), v("div", rn, [
967
+ (f(!0), v(M, null, Se(Object.values(m(t).comments).reverse(), (u) => (f(), j(an, {
968
968
  key: u.id,
969
969
  "ancestor-id": u.id,
970
970
  comment: u,
@@ -978,48 +978,48 @@ const Gt = { class: "flex items-center gap-2 text-sm text-base-content dark:text
978
978
  type: "button",
979
979
  onClick: n
980
980
  }, [
981
- m(t).loadingMore ? (f(), v("span", cn)) : E("", !0),
982
- H(" " + $(m(s)("load_more")), 1)
983
- ], 8, rn)) : E("", !0)
984
- ])) : (f(), v("div", ln, [...d[0] || (d[0] = [
985
- k("span", { class: "ac-loading ac-loading-spinner text-base-content" }, null, -1)
981
+ m(t).loadingMore ? (f(), v("span", ln)) : E("", !0),
982
+ H(" " + I(m(s)("load_more")), 1)
983
+ ], 8, cn)) : E("", !0)
984
+ ])) : (f(), v("div", un, [...d[0] || (d[0] = [
985
+ A("span", { class: "ac-loading ac-loading-spinner text-base-content" }, null, -1)
986
986
  ])]));
987
987
  }
988
- }), mn = { class: "awesome-comment" }, pn = {
988
+ }), pn = { class: "awesome-comment" }, fn = {
989
989
  key: 0,
990
990
  class: "ac-alert ac-alert-error mb-4"
991
- }, fn = { class: "flex justify-between items-center py-2" }, hn = { class: "text-lg font-bold text-base-content my-0" }, vn = {
991
+ }, hn = { class: "flex justify-between items-center py-2" }, vn = { class: "text-lg font-bold text-base-content my-0" }, gn = {
992
992
  key: 0,
993
993
  class: "ac-loading ac-loading-spinner"
994
- }, gn = {
994
+ }, yn = {
995
995
  key: 1,
996
996
  class: "ac-dropdown ac-dropdown-end"
997
- }, yn = {
997
+ }, bn = {
998
998
  key: 0,
999
999
  class: "ac-avatar flex",
1000
1000
  tabindex: "0"
1001
- }, bn = { class: "block w-6 h-6 rounded-full" }, _n = ["alt", "src"], wn = {
1001
+ }, _n = { class: "block w-6 h-6 rounded-full" }, wn = ["alt", "src"], kn = {
1002
1002
  key: 1,
1003
1003
  class: "ac-btn ac-btn-ghost",
1004
1004
  tabindex: "0"
1005
- }, kn = {
1005
+ }, xn = {
1006
1006
  class: "ac-dropdown-content z-10 ac-menu p-2 shadow bg-base-100 rounded-box w-52",
1007
1007
  tabindex: "0"
1008
- }, xn = {
1008
+ }, An = {
1009
1009
  key: 0,
1010
1010
  class: "border-b border-neutral pb-2 mb-2 pointer-events-none"
1011
- }, An = { class: "text-base-content" }, In = ["disabled"], $n = ["disabled"], Cn = /* @__PURE__ */ U({
1011
+ }, In = { class: "text-base-content" }, $n = ["disabled"], Cn = ["disabled"], En = /* @__PURE__ */ D({
1012
1012
  __name: "App",
1013
1013
  setup(e) {
1014
- const s = J(), { t } = F(), n = fe(), r = C(), d = Y(() => {
1015
- const a = s.hasMore ? s.total + "+" : s.total;
1014
+ const s = J(), { t } = U(), n = he(), i = $(), d = Y(() => {
1015
+ const r = s.hasMore ? s.total + "+" : s.total;
1016
1016
  if (s.total === 0) return "0";
1017
- const c = new CustomEvent("AwesomeComment:total", {
1017
+ const a = new CustomEvent("AwesomeComment:total", {
1018
1018
  bubbles: !0,
1019
1019
  cancelable: !0,
1020
1020
  detail: s.total
1021
1021
  });
1022
- return document.body.dispatchEvent(c), a;
1022
+ return document.body.dispatchEvent(a), r;
1023
1023
  });
1024
1024
  function u() {
1025
1025
  n.login();
@@ -1031,13 +1031,13 @@ const Gt = { class: "flex items-center gap-2 text-sm text-base-content dark:text
1031
1031
  }
1032
1032
  async function o() {
1033
1033
  if (!n.isAwesomeAuth || n.isAuthenticated) return;
1034
- await ue();
1035
- const a = r.value;
1036
- if (!a) return;
1037
- a.innerHTML = "";
1038
- const c = window.matchMedia?.("(prefers-color-scheme: dark)").matches;
1039
- await n.renderGoogleButton(a, {
1040
- theme: c ? "filled_black" : "outline",
1034
+ await de();
1035
+ const r = i.value;
1036
+ if (!r) return;
1037
+ r.innerHTML = "";
1038
+ const a = window.matchMedia?.("(prefers-color-scheme: dark)").matches;
1039
+ await n.renderGoogleButton(r, {
1040
+ theme: a ? "filled_black" : "outline",
1041
1041
  size: "medium",
1042
1042
  text: "signin_with",
1043
1043
  shape: "pill"
@@ -1047,43 +1047,43 @@ const Gt = { class: "flex items-center gap-2 text-sm text-base-content dark:text
1047
1047
  o();
1048
1048
  }), G(
1049
1049
  () => n.isAuthenticated,
1050
- (a) => {
1051
- a || o();
1050
+ (r) => {
1051
+ r || o();
1052
1052
  }
1053
- ), (a, c) => (f(), v("div", mn, [
1054
- m(s).message ? (f(), v("div", pn, [
1055
- k("p", null, $(m(s).message), 1)
1053
+ ), (r, a) => (f(), v("div", pn, [
1054
+ m(s).message ? (f(), v("div", fn, [
1055
+ A("p", null, I(m(s).message), 1)
1056
1056
  ])) : E("", !0),
1057
- k("header", fn, [
1058
- k("h2", hn, $(m(t)("discussion")) + " (" + $(d.value) + ") ", 1),
1059
- m(n).isLoading ? (f(), v("span", vn)) : m(n).isAuthenticated && m(n).user ? (f(), v("div", gn, [
1060
- m(n).user.picture ? (f(), v("label", yn, [
1061
- k("span", bn, [
1062
- k("img", {
1057
+ A("header", hn, [
1058
+ A("h2", vn, I(m(t)("discussion")) + " (" + I(d.value) + ") ", 1),
1059
+ m(n).isLoading ? (f(), v("span", gn)) : m(n).isAuthenticated && m(n).user ? (f(), v("div", yn, [
1060
+ m(n).user.picture ? (f(), v("label", bn, [
1061
+ A("span", _n, [
1062
+ A("img", {
1063
1063
  alt: m(n).user.name || m(n).user.email,
1064
1064
  src: m(n).user.picture,
1065
1065
  class: "w-full h-full block"
1066
- }, null, 8, _n)
1066
+ }, null, 8, wn)
1067
1067
  ])
1068
- ])) : (f(), v("label", wn, $(m(n).user.email), 1)),
1069
- k("ul", kn, [
1070
- m(n).user.picture ? (f(), v("li", xn, [
1071
- k("span", An, $(m(n).user.email), 1)
1068
+ ])) : (f(), v("label", kn, I(m(n).user.email), 1)),
1069
+ A("ul", xn, [
1070
+ m(n).user.picture ? (f(), v("li", An, [
1071
+ A("span", In, I(m(n).user.email), 1)
1072
1072
  ])) : E("", !0),
1073
- k("li", null, [
1074
- k("button", {
1073
+ A("li", null, [
1074
+ A("button", {
1075
1075
  disabled: m(n).isLoading,
1076
1076
  class: "border-0 bg-base-100",
1077
1077
  type: "button",
1078
1078
  onClick: l
1079
- }, $(m(t)("logout")), 9, In)
1079
+ }, I(m(t)("logout")), 9, $n)
1080
1080
  ])
1081
1081
  ])
1082
1082
  ])) : (f(), v(M, { key: 2 }, [
1083
1083
  m(n).isAwesomeAuth ? (f(), v("div", {
1084
1084
  key: 0,
1085
1085
  ref_key: "googleButton",
1086
- ref: r,
1086
+ ref: i,
1087
1087
  class: "g-id-signin"
1088
1088
  }, null, 512)) : (f(), v("button", {
1089
1089
  key: 1,
@@ -1091,38 +1091,38 @@ const Gt = { class: "flex items-center gap-2 text-sm text-base-content dark:text
1091
1091
  class: "ac-btn ac-btn-secondary ac-btn-xs",
1092
1092
  type: "button",
1093
1093
  onClick: u
1094
- }, $(m(t)("login")), 9, $n))
1094
+ }, I(m(t)("login")), 9, Cn))
1095
1095
  ], 64))
1096
1096
  ]),
1097
- D(ee),
1098
- D(dn)
1097
+ B(ee),
1098
+ B(mn)
1099
1099
  ]));
1100
1100
  }
1101
- }), Ce = [];
1102
- let le = 0, pe = null;
1103
- function En({
1101
+ }), Ee = [];
1102
+ let ue = 0, fe = null;
1103
+ function Sn({
1104
1104
  domain: e,
1105
1105
  clientId: s,
1106
1106
  locale: t = navigator.language
1107
1107
  }) {
1108
- const n = De(Cn), r = Ue(), d = pe || e && s && Te({
1108
+ const n = Ue(En), i = Fe(), d = fe || e && s && Le({
1109
1109
  domain: e,
1110
1110
  clientId: s,
1111
1111
  authorizationParams: {
1112
1112
  redirect_uri: location.origin
1113
1113
  }
1114
- }), u = Ke({
1114
+ }), u = ze({
1115
1115
  legacy: !1,
1116
1116
  locale: t,
1117
1117
  fallbackLocale: "en",
1118
1118
  messages: {
1119
- ...ze(we, "cn"),
1120
- "zh-CN": we.cn
1119
+ ...Ve(ke, "cn"),
1120
+ "zh-CN": ke.cn
1121
1121
  }
1122
1122
  });
1123
- return d && n.use(d), n.use(r), n.use(u), n;
1123
+ return d && n.use(d), n.use(i), n.use(u), n;
1124
1124
  }
1125
- const Pn = {
1125
+ const jn = {
1126
1126
  postId: "",
1127
1127
  apiUrl: "",
1128
1128
  domain: "",
@@ -1130,37 +1130,55 @@ const Pn = {
1130
1130
  locale: "",
1131
1131
  awesomeAuth: void 0,
1132
1132
  turnstileSiteKey: "",
1133
- init(e, { postId: s, apiUrl: t, domain: n, clientId: r, awesomeAuth: d, turnstileSiteKey: u, locale: l = navigator.language, siteId: o } = {}) {
1134
- s ??= this.postId, t ??= this.apiUrl, n ??= this.domain || "", r ??= this.clientId, d ??= this.awesomeAuth, u ??= this.turnstileSiteKey, o ??= this.siteId;
1135
- const a = En({ domain: n, clientId: r, locale: l });
1136
- a.provide("ApiBaseUrl", t), a.provide("postId", s), a.provide("Auth0Domain", n), a.provide("comments", Ce), a.provide("total", le), a.provide("awesomeAuth", d), a.provide("TurnstileSiteKey", u), a.provide("siteId", o), a.mount(e);
1133
+ init(e, {
1134
+ postId: s,
1135
+ apiUrl: t,
1136
+ domain: n,
1137
+ clientId: i,
1138
+ awesomeAuth: d,
1139
+ turnstileSiteKey: u,
1140
+ locale: l = navigator.language,
1141
+ siteId: o,
1142
+ autoFocus: r
1143
+ } = {}) {
1144
+ s ??= this.postId, t ??= this.apiUrl, n ??= this.domain || "", i ??= this.clientId, d ??= this.awesomeAuth, u ??= this.turnstileSiteKey, o ??= this.siteId;
1145
+ const a = Sn({ domain: n, clientId: i, locale: l });
1146
+ a.provide("ApiBaseUrl", t), a.provide("postId", s), a.provide("Auth0Domain", n), a.provide("comments", Ee), a.provide("total", ue), a.provide("awesomeAuth", d), a.provide("TurnstileSiteKey", u), a.provide("siteId", o), a.provide("AutoFocus", r || !1), a.mount(e);
1137
1147
  },
1138
- async preload({ postId: e, apiUrl: s, domain: t, clientId: n, awesomeAuth: r, turnstileSiteKey: d, siteId: u }) {
1139
- if (this.postId = e || "", this.apiUrl = s || "", this.domain = t || "", this.clientId = n || "", this.turnstileSiteKey = d || "", this.siteId = u || "", t && n && (pe = Te({
1148
+ async preload({
1149
+ postId: e,
1150
+ apiUrl: s,
1151
+ domain: t,
1152
+ clientId: n,
1153
+ awesomeAuth: i,
1154
+ turnstileSiteKey: d,
1155
+ siteId: u
1156
+ }) {
1157
+ if (this.postId = e || "", this.apiUrl = s || "", this.domain = t || "", this.clientId = n || "", this.turnstileSiteKey = d || "", this.siteId = u || "", t && n && (fe = Le({
1140
1158
  domain: t,
1141
1159
  clientId: n,
1142
1160
  authorizationParams: {
1143
1161
  redirect_uri: window.location.origin
1144
1162
  }
1145
- })), !pe && !r)
1163
+ })), !fe && !i)
1146
1164
  throw new Error("You need at least 1 Auth provider.");
1147
- this.awesomeAuth = r;
1165
+ this.awesomeAuth = i;
1148
1166
  const l = new URLSearchParams();
1149
1167
  l.set("postId", e), u && l.set("siteId", u);
1150
1168
  const o = await fetch(`${s}/api/comments?${l.toString()}`);
1151
1169
  o.ok || console.log("[Awesome comment] Failed to preload comments.");
1152
- const a = await o.json();
1153
- if (a.data) {
1154
- Ce.push(...a.data), le = a.meta?.total || a.data.length;
1155
- const c = new CustomEvent("AwesomeComment:total", {
1170
+ const r = await o.json();
1171
+ if (r.data) {
1172
+ Ee.push(...r.data), ue = r.meta?.total || r.data.length;
1173
+ const a = new CustomEvent("AwesomeComment:total", {
1156
1174
  bubbles: !0,
1157
1175
  cancelable: !0,
1158
- detail: le
1176
+ detail: ue
1159
1177
  });
1160
- document.body.dispatchEvent(c);
1178
+ document.body.dispatchEvent(a);
1161
1179
  }
1162
1180
  }
1163
1181
  };
1164
1182
  export {
1165
- Pn as default
1183
+ jn as default
1166
1184
  };