@waline/client 3.10.0 → 3.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/pageview.js CHANGED
@@ -1,2 +1,2 @@
1
- const y="3.10.0",$={"Content-Type":"application/json"},h=e=>`${e.replace(/\/?$/,"/")}api/`,u=(e,t="")=>{if(typeof e=="object"&&e.errno)throw new TypeError(`${t} failed with ${e.errno}: ${e.errmsg}`);return e},f=({serverURL:e,lang:t,paths:r,type:o,signal:a})=>fetch(`${h(e)}article?path=${encodeURIComponent(r.join(","))}&type=${encodeURIComponent(o.join(","))}&lang=${t}`,{signal:a}).then(n=>n.json()).then(n=>u(n,"Get counter").data),R=({serverURL:e,lang:t,path:r,type:o,action:a})=>fetch(`${h(e)}article?lang=${t}`,{method:"POST",headers:$,body:JSON.stringify({path:r,type:o,action:a})}).then(n=>n.json()).then(n=>u(n,"Update counter").data),U=({serverURL:e,lang:t,paths:r,signal:o})=>f({serverURL:e,lang:t,paths:r,type:["time"],signal:o}),w=e=>R({...e,type:"time",action:"inc"}),L=(e="")=>e.replace(/\/$/u,""),b=e=>/^(https?:)?\/\//.test(e),d=e=>{const t=L(e);return b(t)?t:`https://${t}`},j=e=>{e.name!=="AbortError"&&console.error(e.message)},m=e=>{const{path:t}=e.dataset;return t!=null&&t.length?t:null},v=(e,t)=>{t.forEach((r,o)=>{const a=e[o].time;typeof a=="number"&&(r.textContent=a.toString())})},C=({serverURL:e,path:t=window.location.pathname,selector:r=".waline-pageview-count",update:o=!0,lang:a=navigator.language})=>{const n=new AbortController,i=[...document.querySelectorAll(r)],p=l=>{const s=m(l);return s!=null&&t!==s},g=l=>U({serverURL:d(e),paths:l.map(s=>m(s)??t),lang:a,signal:n.signal}).then(s=>{v(s,l)}).catch(j);if(o){const l=i.filter(c=>!p(c)),s=i.filter(c=>p(c));w({serverURL:d(e),path:t,lang:a}).then(c=>{v(c,l)}),s.length>0&&g(s)}else g(i);return n.abort.bind(n)};export{C as pageviewCount,y as version};
1
+ const y="3.12.0",$={"Content-Type":"application/json"},h=e=>`${e.replace(/\/?$/,"/")}api/`,u=(e,t="")=>{if(typeof e=="object"&&e.errno)throw new TypeError(`${t} failed with ${e.errno}: ${e.errmsg}`);return e},f=({serverURL:e,lang:t,paths:r,type:o,signal:a})=>fetch(`${h(e)}article?path=${encodeURIComponent(r.join(","))}&type=${encodeURIComponent(o.join(","))}&lang=${t}`,{signal:a}).then(n=>n.json()).then(n=>u(n,"Get counter").data),R=({serverURL:e,lang:t,path:r,type:o,action:a})=>fetch(`${h(e)}article?lang=${t}`,{method:"POST",headers:$,body:JSON.stringify({path:r,type:o,action:a})}).then(n=>n.json()).then(n=>u(n,"Update counter").data),U=({serverURL:e,lang:t,paths:r,signal:o})=>f({serverURL:e,lang:t,paths:r,type:["time"],signal:o}),w=e=>R({...e,type:"time",action:"inc"}),L=(e="")=>e.replace(/\/$/u,""),b=e=>/^(https?:)?\/\//.test(e),d=e=>{const t=L(e);return b(t)?t:`https://${t}`},j=e=>{e.name!=="AbortError"&&console.error(e.message)},m=e=>{const{path:t}=e.dataset;return t!=null&&t.length?t:null},v=(e,t)=>{t.forEach((r,o)=>{const a=e[o].time;typeof a=="number"&&(r.textContent=a.toString())})},C=({serverURL:e,path:t=window.location.pathname,selector:r=".waline-pageview-count",update:o=!0,lang:a=navigator.language})=>{const n=new AbortController,i=[...document.querySelectorAll(r)],p=l=>{const s=m(l);return s!=null&&t!==s},g=l=>U({serverURL:d(e),paths:l.map(s=>m(s)??t),lang:a,signal:n.signal}).then(s=>{v(s,l)}).catch(j);if(o){const l=i.filter(c=>!p(c)),s=i.filter(c=>p(c));w({serverURL:d(e),path:t,lang:a}).then(c=>{v(c,l)}),s.length>0&&g(s)}else g(i);return n.abort.bind(n)};export{C as pageviewCount,y as version};
2
2
  //# sourceMappingURL=pageview.js.map
package/dist/slim.d.ts CHANGED
@@ -166,6 +166,9 @@ interface WalineLocale extends WalineDateLocale, WalineLevelLocale, WalineReacti
166
166
  profile: string;
167
167
  logout: string;
168
168
  commentUnderReview: string;
169
+ subPostComment: string;
170
+ subSiteComment: string;
171
+ subscribeToReplies: string;
169
172
  }
170
173
 
171
174
  interface WalineProps {
@@ -688,14 +691,40 @@ interface WalineUserListResult {
688
691
  }
689
692
  declare const UserList: ({ el, serverURL, count, locale, lang, mode, }: WalineUserListOptions) => Promise<WalineUserListResult>;
690
693
 
694
+ /**
695
+ * Options for the star rating widget.
696
+ */
691
697
  interface WalineStarOptions {
692
- el: string | HTMLElement;
698
+ /**
699
+ * Element or CSS selector on which to mount the widget.
700
+ */
701
+ el?: string | HTMLElement;
702
+ /**
703
+ * Path identifying the current page or article.
704
+ */
693
705
  path: string;
694
- lang: string;
706
+ /**
707
+ * Language code used by the widget, such as `en` or `zh-CN`.
708
+ */
709
+ lang?: string;
710
+ /**
711
+ * Waline server URL.
712
+ */
695
713
  serverURL: string;
714
+ /**
715
+ * Callback invoked after the user submits a rating.
716
+ *
717
+ * @param score The score selected by the user.
718
+ */
696
719
  onRate?: (score: number) => void;
697
720
  }
721
+ /**
722
+ * Star widget result.
723
+ */
698
724
  interface WalineStarResult {
725
+ /**
726
+ * Destroy star widget instance.
727
+ */
699
728
  destroy: () => void;
700
729
  }
701
730
  declare const Star: ({ el, path, lang, serverURL, onRate, }: WalineStarOptions) => WalineStarResult;
package/dist/slim.js CHANGED
@@ -1,13 +1,14 @@
1
- import{fetchCommentCount as _t,getArticleCounter as Be,updateArticleCounter as fe,updateComment as we,addComment as Tt,login as Ft,deleteComment as Nt,getComment as Bt,updatePageview as Pt,getPageview as Wt,getRecentComment as Dt,getUserList as qt}from"@waline/api";export*from"@waline/api";import{h as y,defineComponent as le,inject as Ae,ref as x,computed as T,onMounted as ue,onUnmounted as Pe,openBlock as o,createElementBlock as m,createElementVNode as v,toDisplayString as U,Fragment as D,renderList as X,normalizeClass as q,createBlock as J,unref as L,createCommentVNode as A,useTemplateRef as ee,watch as Me,onBeforeUnmount as Ot,normalizeStyle as Se,nextTick as We,reactive as xe,createVNode as O,withDirectives as ye,vModelDynamic as Gt,isRef as Kt,vModelText as Zt,vShow as De,createTextVNode as te,resolveComponent as Xt,provide as Yt,createApp as qe,watchEffect as Oe}from"vue";import{useStorage as ie,useScriptTag as Jt,watchImmediate as oe,useDebounceFn as Qt,useEventListener as Ge,useNow as ea,useStyleTag as ta}from"@vueuse/core";import Ke from"autosize";import{Marked as aa}from"marked";import{markedHighlight as la}from"marked-highlight";import{load as na}from"recaptcha-v3";const ra=new Set(["nick","mail","link"]),Ze=e=>e.filter(a=>ra.has(a)),Xe=["//unpkg.com/@waline/emojis@1.1.0/weibo"],ia=["//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"],oa=e=>new Promise((a,t)=>{if(e.size>128*1e3){t(new Error("File too large! File size limit 128KB"));return}const l=new FileReader;l.readAsDataURL(e),l.addEventListener("load",()=>{a(l.result)}),l.addEventListener("error",t)}),sa=e=>e?'<p class="wl-tex">TeX is not available in preview</p>':'<span class="wl-tex">TeX is not available in preview</span>',ca=e=>{const a=(t,l={})=>fetch(`https://api.giphy.com/v1/gifs/${t}?${new URLSearchParams({lang:e,limit:"20",rating:"g",api_key:"6CIMLkNMMOhRcXPoMCPkFy4Ybk2XUiMp",...l}).toString()}`).then(n=>n.json()).then(({data:n})=>n.map(r=>({title:r.title,src:r.images.downsized_medium.url})));return{search:t=>a("search",{q:t,offset:"0"}),default:()=>a("trending",{}),more:(t,l=0)=>a("search",{q:t,offset:l.toString()})}},ua=/[\u4E00-\u9FFF\u3400-\u4DBF\uF900-\uFAFF\u3040-\u309F\uAC00-\uD7AF\u0400-\u04FF]+|\w+/,ma=/</,va=/(?:^|\s)\/\/(.+?)$/gm,da=/\/\*([\S\s]*?)\*\//gm,pa=new RegExp(`(${ua.source}|${ma.source})|((?:${va.source})|(?:${da.source}))`,"gmi"),Ye=["23AC69","91C132","F19726","E8552D","1AAB8E","E1147F","2980C1","1BA1E6","9FA0A0","F19726","E30B20","E30B20","A3338B"],Ue={},ga=e=>{let a=0;return e.replace(pa,(t,l,n)=>{if(n)return`<span style="color: slategray">${n}</span>`;if(l==="<")return"&lt;";let r;Ue[l]?r=Ue[l]:(r=Ye[a],Ue[l]=r);const d=`<span style="color: #${r}">${l}</span>`;return a=++a%Ye.length,d})},ha=["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","commentUnderReview"],Y=e=>Object.fromEntries(e.map((a,t)=>[ha[t],a]));var fa=Y(["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?","Ihr Kommentar wird überprüft und ist derzeit nur für Sie sichtbar. Nach der Genehmigung wird er öffentlich angezeigt."]),Je=Y(["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!
2
- 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?","Your comment is under review and is currently only visible to you. It will be publicly visible after approval."]),Qe=Y(["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!
3
- 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?","Tu comentario está en revisión y actualmente solo es visible para ti. Será visible públicamente después de la aprobación."]),et=Y(["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 !
4
- 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 ?","Votre commentaire est en cours de révision et n'est actuellement visible que par vous. Il sera visible publiquement après approbation."]),tt=Y(["Nickname","Il nickname non può avere meno di 3 caratteri.","E-mail","Per favore conferma il tuo indirizzo e-mail.","Sito web","Facoltativo","Scrivi un commento...","Ancora nessun commento.","Invia","Mi piace","Annulla mi piace","Rispondi","Annulla risposta","Commenti","Aggiorna","Carica altri...","Anteprima","Emoji","Carica immagine","secondi fa","minuti fa","ore fa","giorni fa","adesso","Caricamento in corso...","Accedi","Esci","Admin","In evidenza","Parole",`Inserisci un commento tra $0 e $1 parole!
5
- Numero attuale di parole: $2`,"Anonimo","Nano","Hobbit","Ent","Mago","Elfo","Maiar","GIF","Cerca GIF","Profilo","Approvato","In attesa","Spam","Rimuovi evidenza","Più vecchi","Più recenti","Più popolari","Cosa ne pensi?","Il tuo commento è in fase di revisione ed è attualmente visibile solo a te. Sarà visibile pubblicamente dopo l'approvazione."]),at=Y(["ニックネーム","3バイト以上のニックネームをご入力ください.","メールアドレス","メールアドレスをご確認ください.","サイト","オプション","ここにコメント","コメントしましょう~","提出する","Like","Cancel like","返信する","キャンセル","コメント","更新","さらに読み込む","プレビュー","絵文字","画像をアップロード","秒前","分前","時間前","日前","たっだ今","アップロード","ログインする","ログアウト","管理者","トップに置く","ワード",`コメントは $0 から $1 ワードの間でなければなりません!
6
- 現在の単語番号: $2`,"匿名","うえにん","なかにん","しもおし","特にしもおし","かげ","なぬし","GIF","探す GIF","個人情報","承認済み","待っている","スパム","べたつかない","逆順","正順","人気順","どう思いますか?","あなたのコメントは審査中で、現在はあなただけに表示されています。承認後に公開されます。"]),wa=Y(["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!
7
- 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?","Seu comentário está em revisão e atualmente está visível apenas para você. Ele será visível publicamente após a aprovação."]),lt=Y(["Псевдоним","Никнейм не может быть меньше 3 байт.","Эл. адрес","Пожалуйста, подтвердите адрес вашей электронной почты.","Веб-сайт","Необязательный","Комментарий здесь...","Пока нет комментариев.","Отправить","Like","Cancel like","Отвечать","Отменить ответ","Комментарии","Обновить","Загрузи больше...","Превью","эмодзи","Загрузить изображение","секунд назад","несколько минут назад","несколько часов назад","дней назад","прямо сейчас","Загрузка","Авторизоваться","Выход из системы","Админ","Липкий","Слова",`Пожалуйста, введите комментарии от $0 до $1 слов!
8
- Номер текущего слова: $2`,"Анонимный","Dwarves","Hobbits","Ents","Wizards","Elves","Maiar","GIF","Поиск GIF","Персональные данные","Одобренный","Ожидающий","Спам","Нелипкий","самый старый","последний","самый горячий","Что вы думаете?","Ваш комментарий находится на рассмотрении и в настоящее время виден только вам. После одобрения он станет общедоступным."]),nt=Y(["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 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 độ dài giữa $0 $1 từ!
9
- 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?","Bình luận của bạn đang được xem xét hiện chỉ hiển thị với bạn. sẽ được công khai sau khi được phê duyệt."]),rt=Y(["昵称","昵称不能少于3个字符","邮箱","请填写正确的邮件地址","网址","可选","欢迎评论","来发评论吧~","提交","喜欢","取消喜欢","回复","取消回复","评论","刷新","加载更多...","预览","表情","上传图片","秒前","分钟前","小时前","天前","刚刚","正在上传","登录","退出","博主","置顶","",`评论字数应在 $0 $1 字之间!
10
- 当前字数:$2`,"匿名","潜水","冒泡","吐槽","活跃","话痨","传说","表情包","搜索表情包","个人资料","通过","待审核","垃圾","取消置顶","按倒序","按正序","按热度","你认为这篇文章怎么样?","评论正在审核中,当前仅自己可见,审核通过后公开可见。"]),ya=Y(["暱稱","暱稱不能少於3個字元","郵箱","請填寫正確的郵件地址","網址","可選","歡迎留言","來發留言吧~","送出","喜歡","取消喜歡","回覆","取消回覆","留言","重整","載入更多...","預覽","表情","上傳圖片","秒前","分鐘前","小時前","天前","剛剛","正在上傳","登入","登出","管理者","置頂","字",`留言字數應在 $0 到 $1 字之間!
11
- 目前字數:$2`,"匿名","潛水","冒泡","吐槽","活躍","多話","傳說","表情包","搜尋表情包","個人資料","通過","待審核","垃圾","取消置頂","最早","最新","熱門","你認為這篇文章怎麼樣?","您的評論正在審核中,目前僅您可見。審核通過後將公開顯示。"]);const it="en-US",be={zh:rt,"zh-cn":rt,"zh-tw":ya,en:Je,"en-us":Je,fr:et,"fr-fr":et,it:tt,"it-it":tt,jp:at,"jp-jp":at,"pt-br":wa,ru:lt,"ru-ru":lt,vi:nt,"vi-vn":nt,de:fa,es:Qe,"es-mx":Qe},ot=e=>be[e.toLowerCase()]??be[it.toLowerCase()],st=e=>Object.keys(be).includes(e.toLowerCase())?e:it,ct={latest:"insertedAt_desc",oldest:"insertedAt_asc",hottest:"like_desc"},ba=Object.keys(ct),ke=Symbol("waline-config"),ut=e=>{try{return decodeURI(e)}catch{return e}},mt=(e="")=>e.replace(/\/$/u,""),vt=e=>/^(https?:)?\/\//.test(e),Ce=e=>{const a=mt(e);return vt(a)?a:`https://${a}`},ka=e=>Array.isArray(e)?e:typeof e=="number"?[0,e]:!1,me=(e,a)=>e==null||e===!0?a:e===!1?null:e,Ca=({serverURL:e,path:a=location.pathname,lang:t=typeof navigator>"u"?"en-US":navigator.language,locale:l,meta:n=["nick","mail","link"],requiredMeta:r=[],dark:d=!1,pageSize:c=10,wordLimit:u,noCopyright:R=!1,login:s="enable",recaptchaV3Key:f="",turnstileKey:S="",commentSorting:k="latest",emoji:p=Xe,imageUploader:$,highlighter:E,texRenderer:g,search:H,reaction:G,...M})=>({serverURL:Ce(e),path:ut(a),lang:st(t),locale:{...ot(st(t)),...typeof l=="object"?l:{}},wordLimit:ka(u),meta:Ze(n),requiredMeta:Ze(r),dark:d,pageSize:c,commentSorting:k,login:s,noCopyright:R,recaptchaV3Key:f,turnstileKey:S,...M,reaction:G===!0?ia:G||null,imageUploader:me($,oa),highlighter:me(E,ga),texRenderer:me(g,sa),emoji:me(p,Xe),search:me(H,ca(t))}),se=e=>typeof e=="string",ze="{--waline-white:#000;--waline-light-grey:#666;--waline-dark-grey:#999;--waline-color:#888;--waline-bg-color:#1e1e1e;--waline-bg-color-light:#272727;--waline-bg-color-hover: #444;--waline-border-color:#333;--waline-disable-bg-color:#444;--waline-disable-color:#272727;--waline-bq-color:#272727;--waline-info-bg-color:#272727;--waline-info-color:#666}",$a=e=>se(e)?e==="auto"?`@media(prefers-color-scheme:dark){body${ze}}`:`${e}${ze}`:e===!0?`:root${ze}`:"",je=(e,a)=>{let t=e.toString();for(;t.length<a;)t=`0${t}`;return t},La=e=>{const a=je(e.getDate(),2),t=je(e.getMonth()+1,2);return`${je(e.getFullYear(),2)}-${t}-${a}`},Ea=(e,a,t)=>{if(!e)return"";const l=se(e)?new Date(e.includes(" ")?e.replaceAll("-","/"):e):e,n=a.getTime()-l.getTime(),r=Math.floor(n/(24*3600*1e3));if(r===0){const d=n%864e5,c=Math.floor(d/(3600*1e3));if(c===0){const u=d%36e5,R=Math.floor(u/(60*1e3));if(R===0){const s=u%6e4;return`${Math.round(s/1e3)} ${t.seconds}`}return`${R} ${t.minutes}`}return`${c} ${t.hours}`}return r<0?t.now:r<8?`${r} ${t.days}`:La(l)},Ia=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,Ra=e=>Ia.test(e),Aa="WALINE_EMOJI",dt=ie(Aa,{}),Ma=e=>/@[0-9]+\.[0-9]+\.[0-9]+/.test(e),Sa=e=>{const a=Ma(e);if(a){const t=dt.value[e];if(t)return Promise.resolve(t)}return fetch(`${e}/info.json`).then(t=>t.json()).then(t=>{const l={folder:e,...t};return a&&(dt.value[e]=l),l})},pt=(e,a="",t="",l="")=>`${a?`${a}/`:""}${t}${e}${l?`.${l}`:""}`,xa=e=>Promise.all(e?e.map(a=>se(a)?Sa(mt(a)):Promise.resolve(a)):[]).then(a=>{const t={tabs:[],map:{}};return a.forEach(l=>{const{name:n,folder:r,icon:d,prefix:c="",type:u,items:R}=l;t.tabs.push({name:n,icon:pt(d,r,c,u),items:R.map(s=>{const f=`${c}${s}`;return t.map[f]=pt(s,r,c,u),f})})}),t}),gt=e=>{e.name!=="AbortError"&&console.error(e.message)},$e=e=>e instanceof HTMLElement?e:se(e)?document.querySelector(e):null,ht=e=>{const a=[...e].find(t=>t.type.includes("image"));return a?a.getAsFile():null},Ua=/\$.*?\$/,za=/^\$(.*?)\$/,ja=/^(?:\s{0,3})\$\$((?:[^\n]|\n[^\n])+?)\n{0,1}\$\$/,Va=e=>[{name:"blockMath",level:"block",tokenizer(a){const t=ja.exec(a);if(t!=null)return{type:"html",raw:t[0],text:e(!0,t[1])}}},{name:"inlineMath",level:"inline",start(a){const t=a.search(Ua);return t===-1?a.length:t},tokenizer(a){const t=za.exec(a);if(t!=null)return{type:"html",raw:t[0],text:e(!1,t[1])}}}],ft=(e="",a={})=>e.replaceAll(/:(.+?):/g,(t,l)=>a[l]?`<img class="wl-emoji" src="${a[l]}" alt="${l}">`:t),Ha=(e,{emojiMap:a,highlighter:t,texRenderer:l})=>{const n=new aa;if(n.setOptions({breaks:!0}),t&&n.use(la({highlight:t})),l){const r=Va(l);n.use({extensions:r})}return n.parse(ft(e,a))},Ve=e=>{const{path:a}=e.dataset;return a!=null&&a.length?a:null},_a=e=>e.match(/[\w\d\s,.\u00C0-\u024F\u0400-\u04FF]+/giu),Ta=e=>e.match(/[\u4E00-\u9FD5]/gu),Fa=e=>{var a,t;return(((a=_a(e))==null?void 0:a.reduce((l,n)=>l+(["",",","."].includes(n.trim())?0:n.trim().split(/\s+/u).length),0))??0)+(((t=Ta(e))==null?void 0:t.length)??0)},Na=async()=>{const{userAgentData:e}=navigator;let a=navigator.userAgent;if((e==null?void 0:e.platform)!=="Windows")return a;const{platformVersion:t}=await e.getHighEntropyValues(["platformVersion"]);return t&&Number.parseInt(t.split(".")[0],10)>=13&&(a=a.replace("Windows NT 10.0","Windows NT 11.0")),a},wt=({serverURL:e,path:a=window.location.pathname,selector:t=".waline-comment-count",lang:l=navigator.language})=>{const n=new AbortController,r=document.querySelectorAll(t);return r.length>0&&_t({serverURL:Ce(e),paths:Array.from(r,d=>ut(Ve(d)??a)),lang:l,signal:n.signal}).then(d=>{r.forEach((c,u)=>{c.textContent=d[u].toString()})}).catch(gt),n.abort.bind(n)},yt=({size:e})=>y("svg",{class:"wl-close-icon",viewBox:"0 0 1024 1024",width:e,height:e},[y("path",{d:"M697.173 85.333h-369.92c-144.64 0-241.92 101.547-241.92 252.587v348.587c0 150.613 97.28 252.16 241.92 252.16h369.92c144.64 0 241.494-101.547 241.494-252.16V337.92c0-151.04-96.854-252.587-241.494-252.587z",fill:"currentColor"}),y("path",{d:"m640.683 587.52-75.947-75.861 75.904-75.862a37.29 37.29 0 0 0 0-52.778 37.205 37.205 0 0 0-52.779 0l-75.946 75.818-75.862-75.946a37.419 37.419 0 0 0-52.821 0 37.419 37.419 0 0 0 0 52.821l75.947 75.947-75.776 75.733a37.29 37.29 0 1 0 52.778 52.821l75.776-75.776 75.947 75.947a37.376 37.376 0 0 0 52.779-52.821z",fill:"#888"})]),Ba=()=>y("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},y("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"})),Pa=()=>y("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},y("path",{d:"M563.2 463.3 677 540c1.7 1.2 3.7 1.8 5.8 1.8.7 0 1.4-.1 2-.2 2.7-.5 5.1-2.1 6.6-4.4l25.3-37.8c1.5-2.3 2.1-5.1 1.6-7.8s-2.1-5.1-4.4-6.6l-73.6-49.1 73.6-49.1c2.3-1.5 3.9-3.9 4.4-6.6.5-2.7 0-5.5-1.6-7.8l-25.3-37.8a10.1 10.1 0 0 0-6.6-4.4c-.7-.1-1.3-.2-2-.2-2.1 0-4.1.6-5.8 1.8l-113.8 76.6c-9.2 6.2-14.7 16.4-14.7 27.5.1 11 5.5 21.3 14.7 27.4zM387 348.8h-45.5c-5.7 0-10.4 4.7-10.4 10.4v153.3c0 5.7 4.7 10.4 10.4 10.4H387c5.7 0 10.4-4.7 10.4-10.4V359.2c0-5.7-4.7-10.4-10.4-10.4zm333.8 241.3-41-20a10.3 10.3 0 0 0-8.1-.5c-2.6.9-4.8 2.9-5.9 5.4-30.1 64.9-93.1 109.1-164.4 115.2-5.7.5-9.9 5.5-9.5 11.2l3.9 45.5c.5 5.3 5 9.5 10.3 9.5h.9c94.8-8 178.5-66.5 218.6-152.7 2.4-5 .3-11.2-4.8-13.6zm186-186.1c-11.9-42-30.5-81.4-55.2-117.1-24.1-34.9-53.5-65.6-87.5-91.2-33.9-25.6-71.5-45.5-111.6-59.2-41.2-14-84.1-21.1-127.8-21.1h-1.2c-75.4 0-148.8 21.4-212.5 61.7-63.7 40.3-114.3 97.6-146.5 165.8-32.2 68.1-44.3 143.6-35.1 218.4 9.3 74.8 39.4 145 87.3 203.3.1.2.3.3.4.5l36.2 38.4c1.1 1.2 2.5 2.1 3.9 2.6 73.3 66.7 168.2 103.5 267.5 103.5 73.3 0 145.2-20.3 207.7-58.7 37.3-22.9 70.3-51.5 98.1-85 27.1-32.7 48.7-69.5 64.2-109.1 15.5-39.7 24.4-81.3 26.6-123.8 2.4-43.6-2.5-87-14.5-129zm-60.5 181.1c-8.3 37-22.8 72-43 104-19.7 31.1-44.3 58.6-73.1 81.7-28.8 23.1-61 41-95.7 53.4-35.6 12.7-72.9 19.1-110.9 19.1-82.6 0-161.7-30.6-222.8-86.2l-34.1-35.8c-23.9-29.3-42.4-62.2-55.1-97.7-12.4-34.7-18.8-71-19.2-107.9-.4-36.9 5.4-73.3 17.1-108.2 12-35.8 30-69.2 53.4-99.1 31.7-40.4 71.1-72 117.2-94.1 44.5-21.3 94-32.6 143.4-32.6 49.3 0 97 10.8 141.8 32 34.3 16.3 65.3 38.1 92 64.8 26.1 26 47.5 56 63.6 89.2 16.2 33.2 26.6 68.5 31 105.1 4.6 37.5 2.7 75.3-5.6 112.3z",fill:"currentColor"})),Wa=()=>y("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},[y("path",{d:"M784 112H240c-88 0-160 72-160 160v480c0 88 72 160 160 160h544c88 0 160-72 160-160V272c0-88-72-160-160-160zm96 640c0 52.8-43.2 96-96 96H240c-52.8 0-96-43.2-96-96V272c0-52.8 43.2-96 96-96h544c52.8 0 96 43.2 96 96v480z",fill:"currentColor"}),y("path",{d:"M352 480c52.8 0 96-43.2 96-96s-43.2-96-96-96-96 43.2-96 96 43.2 96 96 96zm0-128c17.6 0 32 14.4 32 32s-14.4 32-32 32-32-14.4-32-32 14.4-32 32-32zm462.4 379.2-3.2-3.2-177.6-177.6c-25.6-25.6-65.6-25.6-91.2 0l-80 80-36.8-36.8c-25.6-25.6-65.6-25.6-91.2 0L200 728c-4.8 6.4-8 14.4-8 24 0 17.6 14.4 32 32 32 9.6 0 16-3.2 22.4-9.6L380.8 640l134.4 134.4c6.4 6.4 14.4 9.6 24 9.6 17.6 0 32-14.4 32-32 0-9.6-4.8-17.6-9.6-24l-52.8-52.8 80-80L769.6 776c6.4 4.8 12.8 8 20.8 8 17.6 0 32-14.4 32-32 0-8-3.2-16-8-20.8z",fill:"currentColor"})]),Da=({active:e=!1})=>y("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},[y("path",{d:`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?"":"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"}`,fill:e?"red":"currentColor"})]),qa=()=>y("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},[y("path",{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",fill:"currentColor"}),y("path",{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",fill:"currentColor"})]),Oa=()=>y("svg",{width:"16",height:"16",ariaHidden:"true"},y("path",{d:"M14.85 3H1.15C.52 3 0 3.52 0 4.15v7.69C0 12.48.52 13 1.15 13h13.69c.64 0 1.15-.52 1.15-1.15v-7.7C16 3.52 15.48 3 14.85 3zM9 11H7V8L5.5 9.92 4 8v3H2V5h2l1.5 2L7 5h2v6zm2.99.5L9.5 8H11V5h2v3h1.5l-2.51 3.5z",fill:"currentColor"})),Ga=()=>y("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},y("path",{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",fill:"currentColor"})),Ka=()=>y("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},y("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"})),Za=()=>y("svg",{class:"verified-icon",viewBox:"0 0 1024 1024",width:"14",height:"14"},y("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"})),Xa=()=>y("svg",{class:"administrator-icon",viewBox:"0 0 1024 1024",width:"14",height:"14"},[y("path",{d:"M461.6 129.56C489.6 105.96 534.8 105.96 562.4 129.56L625.6 183.96C637.6 194.36 660.4 202.76 676 202.76H744C786.4 202.76 821.2 237.56 821.2 279.96V347.96C821.2 363.96 829.6 386.36 840 398.36L894.4 461.56C918 489.16 918 534.76 894.8 562.36L840.4 625.56C830 637.56 821.6 660.36 821.6 675.96V743.96C821.6 786.36 786.8 821.16 744.4 821.16H676.4C660.4 821.16 638 829.56 626 839.96L562.8 894.36C534.8 917.96 489.6 917.96 462 894.36L398.8 839.96C386.8 829.56 364 821.16 348.4 821.16H279.2C236.8 821.16 202 786.36 202 743.96V675.56C201.999 659.96 193.6 637.56 183.6 625.56L129.6 561.96C106.4 534.36 106.4 489.56 129.6 461.96L183.6 398.36C193.6 386.359 202 363.959 202 348.36V279.96C202 237.56 236.8 202.76 279.2 202.76H348.4C364 202.76 386.8 194.36 398.8 184.36L461.6 129.56ZM549.567 331.896C530.047 303.082 486.645 306.12 471.433 337.412L442.175 396.526C435.587 409.848 422.856 419.097 408.146 421.226L342.706 430.726C340.776 431 338.884 431.397 336.993 431.946C303.482 441.361 292.756 483.493 317.671 507.812L364.975 553.96C375.623 564.321 380.507 579.299 377.991 593.954L366.917 659.102C366.595 661.03 366.355 662.967 366.279 664.923C364.906 699.688 401.683 722.937 432.514 706.738L491.05 675.966C504.217 669.068 519.954 669.069 533.121 675.966L591.675 706.738C593.406 707.645 595.174 708.432 597.028 709.104C629.666 721.205 663.139 693.382 657.273 659.102L646.069 593.954C643.42 579.176 648.24 564.083 659.001 553.6L706.315 507.461C707.687 506.118 708.994 504.66 710.215 503.127C731.779 475.809 715.737 435.41 681.281 430.365L615.839 420.874C601.13 418.745 588.4 409.486 581.821 396.174L552.562 337.052C551.644 335.284 550.674 333.551 549.567 331.896Z",fill:"#f59831"})]),ve=({size:e=100})=>y("svg",{width:e,height:e,viewBox:"0 0 100 100",preserveAspectRatio:"xMidYMid"},y("circle",{cx:50,cy:50,fill:"none",stroke:"currentColor",strokeWidth:"4",r:"40","stroke-dasharray":"85 30"},y("animateTransform",{attributeName:"transform",type:"rotate",repeatCount:"indefinite",dur:"1s",values:"0 50 50;360 50 50",keyTimes:"0;1"}))),Ya=()=>y("svg",{width:24,height:24,fill:"currentcolor",viewBox:"0 0 24 24"},[y("path",{style:"transform: translateY(0.5px)",d:"M18.968 10.5H15.968V11.484H17.984V12.984H15.968V15H14.468V9H18.968V10.5V10.5ZM8.984 9C9.26533 9 9.49967 9.09367 9.687 9.281C9.87433 9.46833 9.968 9.70267 9.968 9.984V10.5H6.499V13.5H8.468V12H9.968V14.016C9.968 14.2973 9.87433 14.5317 9.687 14.719C9.49967 14.9063 9.26533 15 8.984 15H5.984C5.70267 15 5.46833 14.9063 5.281 14.719C5.09367 14.5317 5 14.2973 5 14.016V9.985C5 9.70367 5.09367 9.46933 5.281 9.282C5.46833 9.09467 5.70267 9.001 5.984 9.001H8.984V9ZM11.468 9H12.968V15H11.468V9V9Z"}),y("path",{d:"M18.5 3H5.75C3.6875 3 2 4.6875 2 6.75V18C2 20.0625 3.6875 21.75 5.75 21.75H18.5C20.5625 21.75 22.25 20.0625 22.25 18V6.75C22.25 4.6875 20.5625 3 18.5 3ZM20.75 18C20.75 19.2375 19.7375 20.25 18.5 20.25H5.75C4.5125 20.25 3.5 19.2375 3.5 18V6.75C3.5 5.5125 4.5125 4.5 5.75 4.5H18.5C19.7375 4.5 20.75 5.5125 20.75 6.75V18Z"})]),Ja=()=>ie("WALINE_USER_META",{nick:"",mail:"",link:""}),Qa=()=>ie("WALINE_COMMENT_BOX_EDITOR",""),el="WALINE_LIKE",tl=ie(el,[]),bt=()=>tl,al="WALINE_REACTION",ll=ie(al,{}),kt=()=>ll,Ct={},nl=e=>{const a=Ct[e]??(Ct[e]=na(e,{useRecaptchaNet:!0,autoHideBadge:!0}));return{execute:t=>a.then(l=>l.execute(t))}},rl=e=>({execute:async a=>{const{load:t}=Jt("https://challenges.cloudflare.com/turnstile/v0/api.js",void 0,{async:!1});await t();const{turnstile:l}=window;return new Promise(n=>{l==null||l.ready(()=>{l.render(".wl-captcha-container",{sitekey:e,action:a,size:"compact",callback:n})})})}}),il="WALINE_USER",ol=ie(il,{}),Le=()=>ol,sl={key:0,class:"wl-reaction"},cl=["textContent"],ul={class:"wl-reaction-list"},ml=["onClick"],vl={class:"wl-reaction-img"},dl=["src","alt"],pl=["textContent"],gl=["textContent"];var hl=le({__name:"ArticleReaction",setup(e){const a=kt(),t=Ae(ke),l=x(-1),n=x([]),r=T(()=>t.value.locale),d=T(()=>{const{reaction:f}=t.value;return f!=null&&f.length?f:null}),c=T(()=>{var f;const{path:S}=t.value;return((f=d.value)==null?void 0:f.map((k,p)=>({icon:k,desc:r.value[`reaction${p}`],active:a.value[S]===p})))??null});let u;const R=async()=>{const{serverURL:f,lang:S,path:k}=t.value;if(!d.value)return;const p=new AbortController;u=p.abort.bind(p);const[$]=await Be({serverURL:f,lang:S,paths:[k],type:d.value.map((E,g)=>`reaction${g}`),signal:p.signal});n.value=d.value.map((E,g)=>$[`reaction${g}`])},s=async f=>{if(l.value!==-1)return;const{serverURL:S,lang:k,path:p}=t.value,$=a.value[p];l.value=f,$!=null&&(await fe({serverURL:S,lang:k,path:p,type:`reaction${$}`,action:"desc"}),n.value[$]=Math.max(n.value[$]-1,0)),$!==f&&(await fe({serverURL:S,lang:k,path:p,type:`reaction${f}`}),n.value[f]=(n.value[f]||0)+1),$===f?delete a.value[p]:a.value[p]=f,l.value=-1};return ue(()=>{oe(()=>[t.value.serverURL,t.value.path],()=>R())}),Pe(()=>{u==null||u()}),(f,S)=>c.value?(o(),m("div",sl,[v("div",{class:"wl-reaction-title",textContent:U(r.value.reactionTitle)},null,8,cl),v("ul",ul,[(o(!0),m(D,null,X(c.value,({active:k,icon:p,desc:$},E)=>(o(),m("li",{key:E,class:q(["wl-reaction-item",{active:k}]),onClick:g=>s(E)},[v("div",vl,[v("img",{src:p,alt:$},null,8,dl),l.value===E?(o(),J(L(ve),{key:0,class:"wl-reaction-loading"})):(o(),m("div",{key:1,class:"wl-reaction-votes",textContent:U(n.value[E]||0)},null,8,pl))]),v("div",{class:"wl-reaction-text",textContent:U($)},null,8,gl)],10,ml))),128))])])):A("v-if",!0)}});const fl=["data-index"],wl=["src","title","onClick"];var yl=le({__name:"ImageWall",props:{items:{default:()=>[]},columnWidth:{default:300},gap:{default:0}},emits:["insert"],setup(e){let a=null;const t=ee("wall"),l=x({}),n=x([]),r=()=>{const s=Math.floor((t.value.getBoundingClientRect().width+e.gap)/(e.columnWidth+e.gap));return s>0?s:1},d=s=>Array.from({length:s},()=>[]),c=async s=>{var f;if(s>=e.items.length)return;await We();const S=[...((f=t.value)==null?void 0:f.children)??[]].reduce((k,p)=>p.getBoundingClientRect().height<k.getBoundingClientRect().height?p:k);n.value[Number(S.dataset.index)].push(s),await c(s+1)},u=async(s=!1)=>{if(n.value.length===r()&&!s)return;n.value=d(r());const{scrollY:f}=window;await c(0),window.scrollTo({top:f})},R=s=>{l.value[s.target.src]=!0};return ue(()=>{u(!0),a=new ResizeObserver(()=>{u()}),a.observe(t.value),Me(()=>[e.items],()=>{l.value={},u(!0)}),Me(()=>[e.columnWidth,e.gap],()=>{u()})}),Ot(()=>{a.unobserve(t.value)}),(s,f)=>(o(),m("div",{ref_key:"wall",ref:t,class:"wl-gallery",style:Se({gap:`${e.gap}px`})},[(o(!0),m(D,null,X(n.value,(S,k)=>(o(),m("div",{key:k,class:"wl-gallery-column","data-index":k,style:Se({gap:`${e.gap}px`})},[(o(!0),m(D,null,X(S,p=>(o(),m(D,{key:p},[l.value[e.items[p].src]?A("v-if",!0):(o(),J(L(ve),{key:0,size:36,style:{margin:"20px auto"}})),v("img",{class:"wl-gallery-item",src:e.items[p].src,title:e.items[p].title,loading:"lazy",onLoad:R,onClick:$=>s.$emit("insert",`![](${e.items[p].src})`)},null,40,wl)],64))),128))],12,fl))),128))],4))}});const bl={key:0,class:"wl-login-info"},kl={class:"wl-avatar"},Cl=["title"],$l=["title"],Ll=["src"],El=["title","textContent"],Il={class:"wl-panel"},Rl=["for","textContent"],Al=["id","onUpdate:modelValue","name","type"],Ml=["placeholder"],Sl={class:"wl-preview"},xl=["innerHTML"],Ul={class:"wl-footer"},zl={class:"wl-actions"},jl={href:"https://guides.github.com/features/mastering-markdown/",title:"Markdown Guide","aria-label":"Markdown is supported",class:"wl-action",target:"_blank",rel:"noopener noreferrer"},Vl=["title"],Hl=["title"],_l=["title","aria-label"],Tl=["title"],Fl={class:"wl-info"},Nl={class:"wl-text-number"},Bl={key:0},Pl=["textContent"],Wl=["textContent"],Dl=["disabled"],ql=["placeholder"],Ol={key:1,class:"wl-loading"},Gl=["title","onClick","onMouseenter"],Kl=["src","alt"],Zl=["src"],Xl={key:0,class:"wl-tabs"},Yl=["onClick"],Jl=["src","alt","title"],Ql=["title"];var $t=le({__name:"CommentBox",props:{edit:{},rootId:{},replyId:{},replyUser:{}},emits:["log","cancelEdit","cancelReply","submit"],setup(e,{emit:a}){const t=e,l=a,n=Ae(ke),r=Qa(),d=Ja(),c=Le(),u=x({}),R=ee("textarea"),s=ee("image-uploader"),f=ee("emoji-button"),S=ee("emoji-popup"),k=ee("gif-button"),p=ee("gif-popup"),$=ee("gif-search"),E=x({tabs:[],map:{}}),g=x(0),H=x(!1),G=x(""),M=x({});let F;const de=(h,i)=>{clearTimeout(F),G.value=i;const b=h.currentTarget,j=S.value;if(b&&j){const w=b.getBoundingClientRect(),P=j.getBoundingClientRect();M.value={left:`${w.left-P.left+w.width/2}px`,top:`${w.top-P.top}px`,transform:"translate(-50%, -100%)"}}},pe=()=>{F=setTimeout(()=>{G.value=""},50)},Q=x(!1),ne=x(!1),ce=x(""),C=x(0),I=xe({loading:!0,list:[]}),z=x(0),N=x(!1),K=x(""),B=x(!1),ae=x(!1),V=T(()=>n.value.locale),re=T(()=>!!c.value.token),ge=T(()=>n.value.imageUploader!=null),Ee=h=>{const i=R.value,b=i.selectionStart,j=i.selectionEnd||0,{scrollTop:w}=i;r.value=i.value.slice(0,b)+h+i.value.slice(j),i.focus(),i.selectionStart=b+h.length,i.selectionEnd=b+h.length,i.scrollTop=w},St=({key:h,ctrlKey:i,metaKey:b})=>{B.value||(i||b)&&h==="Enter"&&_e()},Ie=async h=>{const i=`![${n.value.locale.uploading} ${h.name}]()`;Ee(i),B.value=!0;try{const b=await n.value.imageUploader(h);r.value=r.value.replace(i,`\r
12
- ![${h.name}](${b})`)}catch(b){alert(b.message),r.value=r.value.replace(i,"")}finally{B.value=!1}},xt=h=>{var i;if((i=h.dataTransfer)!=null&&i.items){const b=ht(h.dataTransfer.items);b&&ge.value&&(Ie(b),h.preventDefault())}},Ut=h=>{if(h.clipboardData){const i=ht(h.clipboardData.items);i&&ge.value&&Ie(i)}},zt=()=>{const h=s.value;h.files&&ge.value&&Ie(h.files[0]).then(()=>{h.value=""})},_e=async()=>{var h;const{serverURL:i,lang:b,login:j,wordLimit:w,requiredMeta:P,recaptchaV3Key:W,turnstileKey:Z}=n.value,_={comment:K.value,nick:d.value.nick,mail:d.value.mail,link:d.value.link,url:n.value.path,ua:await Na()};if(!t.edit)if(c.value.token)_.nick=c.value.display_name,_.mail=c.value.email,_.link=c.value.url;else{if(j==="force")return;if(P.includes("nick")&&!_.nick){u.value.nick.focus(),alert(V.value.nickError);return}if(P.includes("mail")&&!_.mail||_.mail&&!Ra(_.mail)){u.value.mail.focus(),alert(V.value.mailError);return}_.nick||(_.nick=V.value.anonymous)}if(!_.comment){R.value.focus();return}if(!N.value){alert(V.value.wordHint.replace("$0",w[0].toString()).replace("$1",w[1].toString()).replace("$2",C.value.toString()));return}_.comment=ft(_.comment,E.value.map),t.replyId&&t.rootId&&(_.pid=t.replyId,_.rid=t.rootId,_.at=t.replyUser),B.value=!0;try{W&&(_.recaptchaV3=await nl(W).execute("social")),Z&&(_.turnstile=await rl(Z).execute("social"));const he={serverURL:i,lang:b,token:c.value.token,comment:_},Re=await(t.edit?we({objectId:t.edit.objectId,...he}):Tt(he));if(B.value=!1,Re.errmsg){alert(Re.errmsg);return}l("submit",Re.data),r.value="",ce.value="",await We(),t.replyId&&l("cancelReply"),(h=t.edit)!=null&&h.objectId&&l("cancelEdit")}catch(he){B.value=!1,alert(he.message)}},jt=h=>{h.preventDefault();const{lang:i,serverURL:b}=n.value;Ft({serverURL:b,lang:i}).then(j=>{c.value=j,(j.remember?localStorage:sessionStorage).setItem("WALINE_USER",JSON.stringify(j)),l("log")})},Vt=()=>{c.value={},localStorage.setItem("WALINE_USER","null"),sessionStorage.setItem("WALINE_USER","null"),l("log")},Te=h=>{h.preventDefault();const{lang:i,serverURL:b}=n.value,j=800,w=800,P=(window.innerWidth-j)/2,W=(window.innerHeight-w)/2,Z=new URLSearchParams({lng:i,token:c.value.token}),_=window.open(`${b}/ui/profile?${Z.toString()}`,"_blank",`width=${j},height=${w},left=${P},top=${W},scrollbars=no,resizable=no,status=no,location=no,toolbar=no,menubar=no`);_==null||_.postMessage({type:"TOKEN",data:c.value.token},"*")},Ht=h=>{var i,b,j,w;!((i=f.value)!=null&&i.contains(h.target))&&!((b=S.value)!=null&&b.contains(h.target))&&(H.value=!1),!((j=k.value)!=null&&j.contains(h.target))&&!((w=p.value)!=null&&w.contains(h.target))&&(Q.value=!1)},Fe=async h=>{var i;const{scrollTop:b,clientHeight:j,scrollHeight:w}=h.target,P=(j+b)/w,W=n.value.search,Z=((i=$.value)==null?void 0:i.value)??"";P<.9||I.loading||ae.value||(I.loading=!0,(W.more&&I.list.length>0?await W.more(Z,I.list.length):await W.search(Z)).length>0?I.list=[...I.list,...W.more&&I.list.length>0?await W.more(Z,I.list.length):await W.search(Z)]:ae.value=!0,I.loading=!1,setTimeout(()=>{h.target.scrollTop=b},50))},Ne=Qt(h=>{I.list=[],ae.value=!1,Fe(h)},300);return Ge("click",Ht),Ge("message",({data:h})=>{(h==null?void 0:h.type)==="profile"&&(c.value={...c.value,...h.data},[localStorage,sessionStorage].filter(i=>i.getItem("WALINE_USER")).forEach(i=>{i.setItem("WALINE_USER",JSON.stringify(c))}))}),oe([n,C],([h,i])=>{const{wordLimit:b}=h;b?i<b[0]&&b[0]!==0?([z.value]=b,N.value=!1):i>b[1]?([,z.value]=b,N.value=!1):([,z.value]=b,N.value=!0):(z.value=0,N.value=!0)}),Me(Q,async h=>{var i;if(!h)return;const b=n.value.search;$.value&&($.value.value=""),I.loading=!0,I.list=await(((i=b.default)==null?void 0:i.call(b))??b.search("")),I.loading=!1}),ue(()=>{var h;(h=t.edit)!=null&&h.objectId&&(r.value=t.edit.orig),oe(()=>r.value,i=>{const{highlighter:b,texRenderer:j}=n.value;K.value=i,ce.value=Ha(i,{emojiMap:E.value.map,highlighter:b,texRenderer:j}),C.value=Fa(i),i?Ke(R.value):Ke.destroy(R.value)}),oe(()=>n.value.emoji,async i=>{E.value=await xa(i)})}),(h,i)=>{var b,j;return o(),m("div",{key:L(c).token,class:"wl-comment"},[L(n).login!=="disable"&&re.value&&!((b=e.edit)!=null&&b.objectId)?(o(),m("div",bl,[v("div",kl,[v("button",{type:"submit",class:"wl-logout-btn",title:V.value.logout,onClick:Vt},[O(L(yt),{size:14})],8,Cl),v("a",{href:"#",class:"wl-login-nick","aria-label":"Profile",title:V.value.profile,onClick:Te},[v("img",{src:L(c).avatar,alt:"avatar"},null,8,Ll)],8,$l)]),v("a",{href:"#",class:"wl-login-nick","aria-label":"Profile",title:V.value.profile,onClick:Te,textContent:U(L(c).display_name)},null,8,El)])):A("v-if",!0),v("div",Il,[L(n).login!=="force"&&L(n).meta.length&&!re.value?(o(),m("div",{key:0,class:q(["wl-header",`item${L(n).meta.length}`])},[(o(!0),m(D,null,X(L(n).meta,w=>(o(),m("div",{key:w,class:"wl-header-item"},[v("label",{for:`wl-${w}`,textContent:U(V.value[w]+(L(n).requiredMeta.includes(w)||!L(n).requiredMeta.length?"":`(${V.value.optional})`))},null,8,Rl),ye(v("input",{id:`wl-${w}`,ref_for:!0,ref:P=>{P&&(u.value[w]=P)},"onUpdate:modelValue":P=>L(d)[w]=P,class:q(["wl-input",`wl-${w}`]),name:w,type:w==="mail"?"email":"text"},null,10,Al),[[Gt,L(d)[w]]])]))),128))],2)):A("v-if",!0),ye(v("textarea",{id:"wl-edit",ref:"textarea","onUpdate:modelValue":i[0]||(i[0]=w=>Kt(r)?r.value=w:null),class:"wl-editor",placeholder:e.replyUser?`@${e.replyUser}`:V.value.placeholder,onKeydown:St,onDrop:xt,onPaste:Ut},null,40,Ml),[[Zt,L(r)]]),ye(v("div",Sl,[i[7]||(i[7]=v("hr",null,null,-1)),v("h4",null,U(V.value.preview)+":",1),v("div",{class:"wl-content",innerHTML:ce.value},null,8,xl)],512),[[De,ne.value]]),v("div",Ul,[v("div",zl,[v("a",jl,[O(L(Oa))]),ye(v("button",{ref:"emoji-button",type:"button",class:q(["wl-action",{active:H.value}]),title:V.value.emoji,onClick:i[1]||(i[1]=w=>H.value=!H.value)},[O(L(Pa))],10,Vl),[[De,E.value.tabs.length]]),L(n).search?(o(),m("button",{key:0,ref:"gif-button",type:"button",class:q(["wl-action",{active:Q.value}]),title:V.value.gif,onClick:i[2]||(i[2]=w=>Q.value=!Q.value)},[O(L(Ya))],10,Hl)):A("v-if",!0),v("input",{id:"wl-image-upload",ref:"image-uploader",class:"upload","aria-hidden":"true",type:"file",accept:".png,.jpg,.jpeg,.webp,.bmp,.gif",onChange:zt},null,544),ge.value?(o(),m("label",{key:1,for:"wl-image-upload",class:"wl-action",title:V.value.uploadImage,"aria-label":V.value.uploadImage},[O(L(Wa))],8,_l)):A("v-if",!0),v("button",{type:"button",class:q(["wl-action",{active:ne.value}]),title:V.value.preview,onClick:i[3]||(i[3]=w=>ne.value=!ne.value)},[O(L(qa))],10,Tl)]),v("div",Fl,[i[9]||(i[9]=v("div",{class:"wl-captcha-container"},null,-1)),v("div",Nl,[te(U(C.value)+" ",1),L(n).wordLimit?(o(),m("span",Bl,[i[8]||(i[8]=te("  /  ",-1)),v("span",{class:q({illegal:!N.value}),textContent:U(z.value)},null,10,Pl)])):A("v-if",!0),te("  "+U(V.value.word),1)]),L(n).login!=="disable"&&!re.value?(o(),m("button",{key:0,type:"button",class:"wl-btn",onClick:jt,textContent:U(V.value.login)},null,8,Wl)):A("v-if",!0),L(n).login!=="force"||re.value?(o(),m("button",{key:1,type:"submit",class:"primary wl-btn",title:"Cmd|Ctrl + Enter",disabled:B.value,onClick:_e},[B.value?(o(),J(L(ve),{key:0,size:16})):(o(),m(D,{key:1},[te(U(V.value.submit),1)],64))],8,Dl)):A("v-if",!0)]),v("div",{ref:"gif-popup",class:q(["wl-gif-popup",{display:Q.value}])},[v("input",{ref:"gif-search",type:"text",placeholder:V.value.gifSearchPlaceholder,onInput:i[4]||(i[4]=(...w)=>L(Ne)&&L(Ne)(...w))},null,40,ql),I.list.length?(o(),J(yl,{key:0,items:I.list,"column-width":200,gap:6,onInsert:i[5]||(i[5]=w=>Ee(w)),onScroll:Fe},null,8,["items"])):A("v-if",!0),I.loading?(o(),m("div",Ol,[O(L(ve),{size:30})])):A("v-if",!0)],2),v("div",{ref:"emoji-popup",class:q(["wl-emoji-popup",{display:H.value}])},[(o(!0),m(D,null,X(E.value.tabs,(w,P)=>(o(),m(D,{key:w.name},[P===g.value?(o(),m("div",{key:0,class:"wl-tab-wrapper",onScroll:pe},[(o(!0),m(D,null,X(w.items,W=>(o(),m("button",{key:W,type:"button",title:W,onClick:Z=>Ee(`:${W}:`),onMouseenter:Z=>de(Z,W),onMouseleave:pe},[H.value?(o(),m("img",{key:0,class:"wl-emoji",src:E.value.map[W],alt:W,loading:"lazy",referrerPolicy:"no-referrer"},null,8,Kl)):A("v-if",!0)],40,Gl))),128))],32)):A("v-if",!0)],64))),128)),v("div",null,[G.value?(o(),m("img",{key:0,class:"wl-emoji-preview",src:E.value.map[G.value],alt:"preview",loading:"lazy",referrerPolicy:"no-referrer",style:Se(M.value)},null,12,Zl)):A("v-if",!0)]),E.value.tabs.length>1?(o(),m("div",Xl,[(o(!0),m(D,null,X(E.value.tabs,(w,P)=>(o(),m("button",{key:w.name,type:"button",class:q(["wl-tab",{active:g.value===P}]),onClick:W=>g.value=P},[v("img",{class:"wl-emoji",src:w.icon,alt:w.name,title:w.name,loading:"lazy",referrerPolicy:"no-referrer"},null,8,Jl)],10,Yl))),128))])):A("v-if",!0)],2)])]),e.replyId||(j=e.edit)!=null&&j.objectId?(o(),m("button",{key:1,type:"button",class:"wl-close",title:V.value.cancelReply,onClick:i[6]||(i[6]=w=>e.replyId?l("cancelReply"):l("cancelEdit"))},[O(L(yt),{size:24})],8,Ql)):A("v-if",!0)])}}});const en=["id"],tn={class:"wl-user","aria-hidden":"true"},an=["src"],ln={class:"wl-card"},nn={class:"wl-head"},rn=["href"],on={key:1,class:"wl-nick"},sn=["textContent"],cn=["textContent"],un=["textContent"],mn=["textContent"],vn={class:"wl-comment-actions"},dn=["title"],pn=["title"],gn={class:"wl-meta","aria-hidden":"true"},hn=["data-value","textContent"],fn={key:0,class:"wl-warning","aria-hidden":"true"},wn={key:1,class:"wl-content"},yn={key:0},bn=["href"],kn=["innerHTML"],Cn={key:2,class:"wl-admin-actions"},$n={class:"wl-comment-status"},Ln=["disabled","onClick","textContent"],En={key:4,class:"wl-quote"};var In=le({__name:"CommentCard",props:{comment:{},edit:{},rootId:{},reply:{}},emits:["log","submit","delete","like","sticky","edit","reply","status"],setup(e,{emit:a}){const t=a,l=["approved","waiting","spam"],n=Ae(ke),r=bt(),d=ea(),c=Le(),u=T(()=>n.value.locale),R=T(()=>{const{link:E}=e.comment;return E?vt(E)?E:`https://${E}`:""}),s=T(()=>r.value.includes(e.comment.objectId)),f=T(()=>Ea(new Date(e.comment.time),d.value,u.value)),S=T(()=>c.value.type==="administrator"),k=T(()=>e.comment.user_id&&c.value.objectId===e.comment.user_id),p=T(()=>{var E;return e.comment.objectId===((E=e.reply)==null?void 0:E.objectId)}),$=T(()=>{var E;return e.comment.objectId===((E=e.edit)==null?void 0:E.objectId)});return(E,g)=>{var H;const G=Xt("CommentCard",!0);return o(),m("div",{id:e.comment.objectId.toString(),class:"wl-card-item"},[v("div",tn,[e.comment.avatar?(o(),m("img",{key:0,class:"wl-user-avatar",src:e.comment.avatar,alt:""},null,8,an)):A("v-if",!0),e.comment.type==="guest"?(o(),J(L(Za),{key:1})):A("v-if",!0),e.comment.type==="administrator"?(o(),J(L(Xa),{key:2})):A("v-if",!0)]),v("div",ln,[v("div",nn,[R.value?(o(),m("a",{key:0,class:"wl-nick",href:R.value,target:"_blank",rel:"nofollow noopener noreferrer"},U(e.comment.nick),9,rn)):(o(),m("span",on,U(e.comment.nick),1)),e.comment.label?(o(),m("span",{key:2,class:"wl-badge",textContent:U(e.comment.label)},null,8,sn)):A("v-if",!0),e.comment.sticky?(o(),m("span",{key:3,class:"wl-badge",textContent:U(u.value.sticky)},null,8,cn)):A("v-if",!0),typeof e.comment.level=="number"?(o(),m("span",{key:4,class:q(`wl-badge level${e.comment.level}`),textContent:U(u.value[`level${e.comment.level}`]||`Level ${e.comment.level}`)},null,10,un)):A("v-if",!0),v("span",{class:"wl-time",textContent:U(f.value)},null,8,mn),v("div",vn,[S.value||k.value?(o(),m(D,{key:0},[v("button",{type:"button",class:"wl-edit",onClick:g[0]||(g[0]=M=>t("edit",e.comment))},[O(L(Ka))]),v("button",{type:"button",class:"wl-delete",onClick:g[1]||(g[1]=M=>t("delete",e.comment))},[O(L(Ba))])],64)):A("v-if",!0),v("button",{type:"button",class:"wl-like",title:s.value?u.value.cancelLike:u.value.like,onClick:g[2]||(g[2]=M=>t("like",e.comment))},[O(L(Da),{active:s.value},null,8,["active"]),te(" "+U("like"in e.comment?e.comment.like:""),1)],8,dn),v("button",{type:"button",class:q(["wl-reply",{active:p.value}]),title:p.value?u.value.cancelReply:u.value.reply,onClick:g[3]||(g[3]=M=>t("reply",p.value?null:e.comment))},[O(L(Ga))],10,pn)])]),v("div",gn,[(o(),m(D,null,X(["addr","browser","os"],M=>(o(),m(D,null,[e.comment[M]?(o(),m("span",{key:M,class:q(`wl-${M}`),"data-value":e.comment[M],textContent:U(e.comment[M])},null,10,hn)):A("v-if",!0)],64))),64))]),e.comment.status==="waiting"&&!S.value?(o(),m("div",fn,U(u.value.commentUnderReview),1)):A("v-if",!0),$.value?A("v-if",!0):(o(),m("div",wn,["reply_user"in e.comment&&e.comment.reply_user?(o(),m("p",yn,[v("a",{href:"#"+e.comment.pid},"@"+U(e.comment.reply_user.nick),9,bn),g[17]||(g[17]=v("span",null,": ",-1))])):A("v-if",!0),v("div",{innerHTML:e.comment.comment},null,8,kn)])),S.value&&!$.value?(o(),m("div",Cn,[v("span",$n,[(o(),m(D,null,X(l,M=>v("button",{key:M,type:"submit",class:q(`wl-btn wl-${M}`),disabled:e.comment.status===M,onClick:F=>t("status",{status:M,comment:e.comment}),textContent:U(u.value[M])},null,10,Ln)),64))]),S.value&&!("rid"in e.comment)?(o(),m("button",{key:0,type:"submit",class:"wl-btn wl-sticky",onClick:g[4]||(g[4]=M=>t("sticky",e.comment))},U(e.comment.sticky?u.value.unsticky:u.value.sticky),1)):A("v-if",!0)])):A("v-if",!0),p.value||$.value?(o(),m("div",{key:3,class:q({"wl-reply-wrapper":p.value,"wl-edit-wrapper":$.value})},[O($t,{edit:e.edit,"reply-id":(H=e.reply)==null?void 0:H.objectId,"reply-user":e.comment.nick,"root-id":e.rootId,onLog:g[5]||(g[5]=M=>t("log")),onCancelReply:g[6]||(g[6]=M=>t("reply",null)),onCancelEdit:g[7]||(g[7]=M=>t("edit",null)),onSubmit:g[8]||(g[8]=M=>t("submit",M))},null,8,["edit","reply-id","reply-user","root-id"])],2)):A("v-if",!0),"children"in e.comment?(o(),m("div",En,[(o(!0),m(D,null,X(e.comment.children,M=>(o(),J(G,{key:M.objectId,comment:M,reply:e.reply,edit:e.edit,"root-id":e.rootId,onLog:g[9]||(g[9]=F=>t("log")),onDelete:g[10]||(g[10]=F=>t("delete",F)),onEdit:g[11]||(g[11]=F=>t("edit",F)),onLike:g[12]||(g[12]=F=>t("like",F)),onReply:g[13]||(g[13]=F=>t("reply",F)),onStatus:g[14]||(g[14]=F=>t("status",F)),onSticky:g[15]||(g[15]=F=>t("sticky",F)),onSubmit:g[16]||(g[16]=F=>t("submit",F))},null,8,["comment","reply","edit","root-id"]))),128))])):A("v-if",!0)])],8,en)}}});const Lt="3.10.0",Rn={"data-waline":""},An={class:"wl-meta-head"},Mn={class:"wl-count"},Sn=["textContent"],xn={class:"wl-sort"},Un=["onClick"],zn={class:"wl-cards"},jn={key:1,class:"wl-operation"},Vn=["textContent"],Hn={key:2,class:"wl-loading"},_n=["textContent"],Tn={key:4,class:"wl-operation"},Fn=["textContent"],Nn={key:5,class:"wl-power"};var Bn=le({__name:"WalineComment",props:{serverURL:{},path:{},meta:{},requiredMeta:{},wordLimit:{},pageSize:{},lang:{},locale:{},commentSorting:{},dark:{type:[String,Boolean]},login:{},noCopyright:{type:Boolean},recaptchaV3Key:{},turnstileKey:{},reaction:{type:[Array,Boolean]},emoji:{},search:{},highlighter:{type:Function},imageUploader:{type:Function},texRenderer:{type:Function}},setup(e){const a=e,t=Le(),l=bt(),n=x("loading"),r=x(0),d=x(1),c=x(0),u=T(()=>Ca(a)),R=x(u.value.commentSorting),s=x([]),f=x(null),S=x(null),k=T(()=>$a(u.value.dark)),p=T(()=>u.value.locale);ta(k,{id:"waline-darkmode"});let $=null;const E=C=>{const{serverURL:I,path:z,pageSize:N}=u.value,K=new AbortController;n.value="loading",$==null||$(),Bt({serverURL:I,lang:u.value.lang,path:z,pageSize:N,sortBy:ct[R.value],page:C,signal:K.signal,token:t.value.token}).then(B=>{n.value="success",r.value=B.count,s.value.push(...B.data),d.value=C,c.value=B.totalPages}).catch(B=>{B.name!=="AbortError"&&(console.error(B.message),n.value="error")}),$=K.abort.bind(K)},g=()=>{E(d.value+1)},H=()=>{r.value=0,s.value=[],E(1)},G=C=>{R.value!==C&&(R.value=C,H())},M=C=>{f.value=C},F=C=>{S.value=C},de=C=>{if(S.value)S.value.comment=C.comment,S.value.orig=C.orig;else if("rid"in C){const I=s.value.find(({objectId:z})=>z===C.rid);if(!I)return;Array.isArray(I.children)||(I.children=[]),I.children.push(C)}else s.value.unshift(C),r.value+=1},pe=async({comment:C,status:I})=>{if(C.status===I)return;const{serverURL:z,lang:N}=u.value;await we({serverURL:z,lang:N,token:t.value.token,objectId:C.objectId,comment:{status:I}}),C.status=I},Q=async C=>{if("rid"in C)return;const{serverURL:I,lang:z}=u.value;await we({serverURL:I,lang:z,token:t.value.token,objectId:C.objectId,comment:{sticky:C.sticky?0:1}}),C.sticky=!C.sticky},ne=async({objectId:C})=>{if(!confirm("Are you sure you want to delete this comment?"))return;const{serverURL:I,lang:z}=u.value;await Nt({serverURL:I,lang:z,token:t.value.token,objectId:C}),s.value.some((N,K)=>N.objectId===C?(s.value=s.value.filter((B,ae)=>ae!==K),!0):N.children.some((B,ae)=>B.objectId===C?(s.value[K].children=N.children.filter((V,re)=>re!==ae),!0):!1))},ce=async C=>{const{serverURL:I,lang:z}=u.value,{objectId:N}=C,K=l.value.includes(N);await we({serverURL:I,lang:z,objectId:N,token:t.value.token,comment:{like:!K}}),K?l.value=l.value.filter(B=>B!==N):(l.value=[...l.value,N],l.value.length>50&&(l.value=l.value.slice(-50))),C.like=Math.max(0,(C.like||0)+(K?-1:1))};return Yt(ke,u),ue(()=>{oe(()=>[a.serverURL,a.path],()=>{H()})}),Pe(()=>{$==null||$()}),(C,I)=>(o(),m("div",Rn,[O(hl),!f.value&&!S.value?(o(),J($t,{key:0,onLog:H,onSubmit:de})):A("v-if",!0),v("div",An,[v("div",Mn,[r.value?(o(),m("span",{key:0,class:"wl-num",textContent:U(r.value)},null,8,Sn)):A("v-if",!0),te(" "+U(p.value.comment),1)]),v("ul",xn,[(o(!0),m(D,null,X(L(ba),z=>(o(),m("li",{key:z,class:q([z===R.value?"active":""]),onClick:N=>G(z)},U(p.value[z]),11,Un))),128))])]),v("div",zn,[(o(!0),m(D,null,X(s.value,z=>(o(),J(In,{key:z.objectId,"root-id":z.objectId,comment:z,reply:f.value,edit:S.value,onLog:H,onReply:M,onEdit:F,onSubmit:de,onStatus:pe,onDelete:ne,onSticky:Q,onLike:ce},null,8,["root-id","comment","reply","edit"]))),128))]),n.value==="error"?(o(),m("div",jn,[v("button",{type:"button",class:"wl-btn",onClick:H,textContent:U(p.value.refresh)},null,8,Vn)])):n.value==="loading"?(o(),m("div",Hn,[O(L(ve),{size:30})])):s.value.length?d.value<c.value?(o(),m("div",Tn,[v("button",{type:"button",class:"wl-btn",onClick:g,textContent:U(p.value.more)},null,8,Fn)])):A("v-if",!0):(o(),m("div",{key:3,class:"wl-empty",textContent:U(p.value.sofa)},null,8,_n)),u.value.noCopyright?A("v-if",!0):(o(),m("div",Nn,[I[0]||(I[0]=te(" Powered by ",-1)),I[1]||(I[1]=v("a",{href:"https://github.com/walinejs/waline",target:"_blank",rel:"noopener noreferrer"}," Waline ",-1)),te(" v"+U(L(Lt)),1)]))]))}});const Et=(e,a)=>{a.forEach((t,l)=>{const n=e[l].time;typeof n=="number"&&(t.textContent=n.toString())})},It=({serverURL:e,path:a=window.location.pathname,selector:t=".waline-pageview-count",update:l=!0,lang:n=navigator.language})=>{const r=new AbortController,d=[...document.querySelectorAll(t)],c=R=>{const s=Ve(R);return s!=null&&a!==s},u=R=>Wt({serverURL:Ce(e),paths:R.map(s=>Ve(s)??a),lang:n,signal:r.signal}).then(s=>{Et(s,R)}).catch(gt);if(l){const R=d.filter(f=>!c(f)),s=d.filter(f=>c(f));Pt({serverURL:Ce(e),path:a,lang:n}).then(f=>{Et(f,R)}),s.length>0&&u(s)}else u(d);return r.abort.bind(r)},Pn=({el:e="#waline",path:a=window.location.pathname,comment:t=!1,pageview:l=!1,...n})=>{const r=e?$e(e):null;if(e&&!r)throw new Error("Option 'el' do not match any domElement!");if(!n.serverURL)throw new Error("Option 'serverURL' is missing!");const d=xe({...n}),c=xe({comment:t,pageview:l,path:a}),u=()=>{c.comment&&wt({serverURL:d.serverURL,path:c.path,...se(c.comment)?{selector:c.comment}:{}})},R=()=>{c.pageview&&It({serverURL:d.serverURL,path:c.path,...se(c.pageview)?{selector:c.pageview}:{}})};let s=null;r&&(s=qe(()=>y(Bn,{path:c.path,...d})),s.mount(r));const f=Oe(u),S=Oe(R);return{el:r,update:({comment:k,pageview:p,path:$=window.location.pathname,...E}={})=>{Object.entries(E).forEach(([g,H])=>{d[g]=H}),c.path=$,k!=null&&(c.comment=k),p!=null&&(c.pageview=p)},destroy:()=>{s==null||s.unmount(),f(),S()}}},Wn=({el:e,serverURL:a,count:t,lang:l=navigator.language})=>{const n=Le(),r=$e(e),d=new AbortController;return Dt({serverURL:a,count:t,lang:l,signal:d.signal,token:n.value.token}).then(c=>r&&c.length>0?(r.innerHTML=`<ul class="wl-recent-list">${c.map(u=>`<li class="wl-recent-item"><a href="${u.url}">${u.nick}</a>:${u.comment}</li>`).join("")}</ul>`,{comments:c,destroy:()=>{d.abort(),r.innerHTML=""}}):{comments:c,destroy:()=>{d.abort()}})},Dn=({el:e,serverURL:a,count:t,locale:l,lang:n=navigator.language,mode:r="list"})=>{const d=$e(e),c=new AbortController;return qt({serverURL:a,pageSize:t,lang:n,signal:c.signal}).then(u=>{if(!d||u.length===0)return{users:u,destroy:()=>{c.abort()}};const R={...ot(n),...typeof l=="object"?l:{}};return d.innerHTML=`<ul class="wl-user-${r}">${u.map((s,f)=>[`<li class="wl-user-item" aria-label="${s.nick}">`,s.link?`<a href="${s.link}" target="_blank">`:"",'<div class="wl-user-avatar">',`<img src="${s.avatar}" alt="${s.nick}">`,`<span class="wl-user-badge">${f+1}</span>`,"</div>",'<div class="wl-user-meta">','<div class="wl-user-name">',s.nick,typeof s.level=="number"?`<span class="wl-badge">${R[`level${s.level}`]??`Level ${s.level}`}</span>`:"",s.label?`<span class="wl-badge">${s.label}</span>`:"","</div>",s.link,"</div>",s.link?"</a>":"","</li>"].filter(Boolean).join("")).join("")}</ul>`,{users:u,destroy:()=>{c.abort(),d.innerHTML=""}}})},Rt=kt(),qn=async({serverURL:e,lang:a,path:t})=>{const l=[1,2,3,4,5],n=new AbortController,r=n.abort.bind(n),[d]=await Be({serverURL:e,lang:a,paths:[t],type:[1,2,3,4,5].map((c,u)=>`reaction${u}`),signal:n.signal});return{value:l.map((c,u)=>d[`reaction${u}`]),abort:r}},He=e=>{if(Number.isNaN(e))return 0;const a=Math.round(e);return Math.min(5,Math.max(0,a))},At=(e=[])=>Array.from({length:5},(a,t)=>{const l=e[t]??0;return typeof l=="number"&&l>0?l:0}),On="M12 2l3.09 6.26L22 9.27l-5 4.87L18.18 22 12 18.56 5.82 22 7 14.14l-5-4.87 6.91-1.01L12 2z",Mt=le({name:"WalineStarDisplay",props:{score:{type:Number,default:0}},setup(e){const a=T(()=>He(e.score));return()=>[1,2,3,4,5].map((t,l)=>y("span",{key:l,class:"wl-star-item"},[y("svg",{class:"wl-star-icon",viewBox:"0 0 24 24"},[y("path",{class:[a.value>=t?"wl-star-solid":"wl-star-outline"],d:On})])]))}}),Gn=le({name:"WalineStarWidget",props:{path:{type:String,default:""},serverURL:{type:String,default:""},lang:{type:String,default:""}},emits:["rate"],setup(e,{emit:a}){const t=x(null),l=x(He(Rt.value[e.path]??0)),n=x(null),r=x(At([]));ue(()=>{oe(()=>[e.serverURL,e.path],async()=>{const k=await qn({serverURL:e.serverURL,path:e.path,lang:e.lang});r.value=At(k.value)})});const d=T(()=>n.value??l.value),c=T(()=>r.value.reduce((k,p)=>k+p,0)),u=T(()=>r.value.map(k=>c.value?k/c.value:0)),R=k=>{if(!t.value)return 0;const{firstElementChild:p,lastElementChild:$}=t.value;if(!p||!$)return 0;const{left:E}=p.getBoundingClientRect(),{right:g}=$.getBoundingClientRect(),H=g-E,G=(k.clientX-E)/H,M=Math.min(1,Math.max(0,G))*5;return He(M)},s=k=>{n.value=R(k)},f=()=>{n.value=null},S=async k=>{const p=n.value??R(k),$={serverURL:e.serverURL,lang:e.lang,path:e.path};l.value&&await fe({...$,type:`reaction${l.value}`,action:"desc"}),l.value=p,Rt.value[e.path]=p,await fe({serverURL:e.serverURL,lang:e.lang,path:e.path,type:`reaction${p}`,action:"inc"}),a("rate",p)};return()=>y("div",{class:"wl-star"},[y("div",{ref:t,class:["wl-star-rate"],onMousemove:s,onMouseleave:f,onClick:S},[y(Mt,{score:d.value})]),y("div",{class:"wl-star-score"},[5,4,3,2,1].map(k=>{const p=r.value[k-1]??0,$=`${((u.value[k-1]??0)*100).toFixed(1)}%`;return y("div",{key:k,class:"wl-star-row"},[y("div",{class:["wl-star-rate"]},[y(Mt,{score:k})]),y("div",{class:"wl-star-progress"},[y("div",{class:"wl-star-progress-bar",style:{width:$},"data-count":p.toString()})]),y("span",{class:"wl-star-percent"},$)])}))])}}),Kn=({el:e,path:a,lang:t,serverURL:l,onRate:n})=>{const r=$e(e);if(!r)return{destroy:()=>{}};const d=qe(Gn,{path:a,lang:t,serverURL:l,onRate:n});return d.mount(r),{destroy:()=>{d.unmount(),r.innerHTML=""}}};export{Wn as RecentComments,Kn as Star,Dn as UserList,wt as commentCount,be as defaultLocales,Pn as init,It as pageviewCount,Lt as version};
1
+ import{fetchCommentCount as Tt,getArticleCounter as Be,updateArticleCounter as fe,updateComment as we,addComment as Nt,login as Bt,deleteComment as Pt,getComment as Wt,updatePageview as Dt,getPageview as qt,getRecentComment as Gt,getUserList as Ot}from"@waline/api";export*from"@waline/api";import{h as k,defineComponent as ne,inject as Me,ref as x,computed as N,onMounted as ve,onUnmounted as Pe,openBlock as i,createElementBlock as p,createElementVNode as m,toDisplayString as M,Fragment as G,renderList as K,normalizeClass as O,createBlock as Q,unref as b,createCommentVNode as I,useTemplateRef as ee,watch as Re,onBeforeUnmount as Kt,normalizeStyle as ye,nextTick as We,reactive as xe,createVNode as W,withDirectives as be,vModelDynamic as Zt,isRef as Xt,vModelText as Yt,vShow as De,createTextVNode as te,resolveComponent as qe,provide as Jt,createApp as Ge,watchEffect as Oe}from"vue";import{useStorage as se,useScriptTag as Qt,watchImmediate as ce,useDebounceFn as ea,useEventListener as Ke,useNow as ta,useStyleTag as aa}from"@vueuse/core";import Ze from"autosize";import{Marked as na}from"marked";import{markedHighlight as la}from"marked-highlight";import{load as ra}from"recaptcha-v3";const oa=new Set(["nick","mail","link"]),Xe=e=>e.filter(a=>oa.has(a)),Ye=["//unpkg.com/@waline/emojis@1.1.0/weibo"],ia=["//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"],sa=e=>new Promise((a,t)=>{if(e.size>128*1e3){t(new Error("File too large! File size limit 128KB"));return}const l=new FileReader;l.readAsDataURL(e),l.addEventListener("load",()=>{a(l.result)}),l.addEventListener("error",t)}),ca=e=>e?'<p class="wl-tex">TeX is not available in preview</p>':'<span class="wl-tex">TeX is not available in preview</span>',ua=e=>{const a=(t,l={})=>fetch(`https://api.giphy.com/v1/gifs/${t}?${new URLSearchParams({lang:e,limit:"20",rating:"g",api_key:"6CIMLkNMMOhRcXPoMCPkFy4Ybk2XUiMp",...l}).toString()}`).then(n=>n.json()).then(({data:n})=>n.map(o=>({title:o.title,src:o.images.downsized_medium.url})));return{search:t=>a("search",{q:t,offset:"0"}),default:()=>a("trending",{}),more:(t,l=0)=>a("search",{q:t,offset:l.toString()})}},ma=/[\u4E00-\u9FFF\u3400-\u4DBF\uF900-\uFAFF\u3040-\u309F\uAC00-\uD7AF\u0400-\u04FF]+|\w+/,va=/</,da=/(?:^|\s)\/\/(.+?)$/gm,pa=/\/\*([\S\s]*?)\*\//gm,ga=new RegExp(`(${ma.source}|${va.source})|((?:${da.source})|(?:${pa.source}))`,"gmi"),Je=["23AC69","91C132","F19726","E8552D","1AAB8E","E1147F","2980C1","1BA1E6","9FA0A0","F19726","E30B20","E30B20","A3338B"],ze={},ha=e=>{let a=0;return e.replace(ga,(t,l,n)=>{if(n)return`<span style="color: slategray">${n}</span>`;if(l==="<")return"&lt;";let o;ze[l]?o=ze[l]:(o=Je[a],ze[l]=o);const d=`<span style="color: #${o}">${l}</span>`;return a=++a%Je.length,d})},fa=["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","commentUnderReview","subPostComment","subSiteComment","subscribeToReplies"],Y=e=>Object.fromEntries(e.map((a,t)=>[fa[t],a]));var wa=Y(["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?","Ihr Kommentar wird überprüft und ist derzeit nur für Sie sichtbar. Nach der Genehmigung wird er öffentlich angezeigt.","Abonnieren Sie die Kommentare zu diesem Beitrag","Abonnieren Sie die Kommentare auf dieser Seite","Abonnieren Sie die Antworten auf Ihre Kommentare"]),Qe=Y(["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!
2
+ 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?","Your comment is under review and is currently only visible to you. It will be publicly visible after approval.","Subscribe to comments of this post","Subscribe to comments of this site","Subscribe to replies of your comments"]),et=Y(["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!
3
+ 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?","Tu comentario está en revisión y actualmente solo es visible para ti. Será visible públicamente después de la aprobación.","Suscribirse a los comentarios de esta publicación","Suscribirse a los comentarios de este sitio","Suscribirse a las respuestas de tus comentarios"]),tt=Y(["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 !
4
+ 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 ?","Votre commentaire est en cours de révision et n'est actuellement visible que par vous. Il sera visible publiquement après approbation.","S’abonner aux commentaires de ce post","S’abonner aux commentaires de ce site","S’abonner aux réponses de vos commentaires"]),at=Y(["Nickname","Il nickname non può avere meno di 3 caratteri.","E-mail","Per favore conferma il tuo indirizzo e-mail.","Sito web","Facoltativo","Scrivi un commento...","Ancora nessun commento.","Invia","Mi piace","Annulla mi piace","Rispondi","Annulla risposta","Commenti","Aggiorna","Carica altri...","Anteprima","Emoji","Carica immagine","secondi fa","minuti fa","ore fa","giorni fa","adesso","Caricamento in corso...","Accedi","Esci","Admin","In evidenza","Parole",`Inserisci un commento tra $0 e $1 parole!
5
+ Numero attuale di parole: $2`,"Anonimo","Nano","Hobbit","Ent","Mago","Elfo","Maiar","GIF","Cerca GIF","Profilo","Approvato","In attesa","Spam","Rimuovi evidenza","Più vecchi","Più recenti","Più popolari","Cosa ne pensi?","Il tuo commento è in fase di revisione ed è attualmente visibile solo a te. Sarà visibile pubblicamente dopo l'approvazione.","Iscriviti ai commenti di questo post","Iscriviti ai commenti di questo sito","Iscriviti alle risposte dei tuoi commenti"]),nt=Y(["ニックネーム","3バイト以上のニックネームをご入力ください.","メールアドレス","メールアドレスをご確認ください.","サイト","オプション","ここにコメント","コメントしましょう~","提出する","Like","Cancel like","返信する","キャンセル","コメント","更新","さらに読み込む","プレビュー","絵文字","画像をアップロード","秒前","分前","時間前","日前","たっだ今","アップロード","ログインする","ログアウト","管理者","トップに置く","ワード",`コメントは $0 から $1 ワードの間でなければなりません!
6
+ 現在の単語番号: $2`,"匿名","うえにん","なかにん","しもおし","特にしもおし","かげ","なぬし","GIF","探す GIF","個人情報","承認済み","待っている","スパム","べたつかない","逆順","正順","人気順","どう思いますか?","あなたのコメントは審査中で、現在はあなただけに表示されています。承認後に公開されます。","この投稿のコメントを購読する","このサイトのコメントを購読する","あなたのコメントの返信を購読する"]),lt=Y(["닉네임","닉네임은 3바이트 이상이어야 합니다.","이메일","이메일 주소를 확인해 주세요.","웹사이트","선택사항","여기에 댓글을 입력하세요...","아직 댓글이 없습니다.","제출","좋아요","좋아요 취소","답글","답글 취소","댓글","새로고침"," 보기...","미리보기","이모지","이미지 업로드"," "," ","시간 "," ","방금 ","업로드 중","로그인","로그아웃","관리자","고정","글자 수",`댓글은 $0자에서 $1 사이여야 합니다!
7
+ 현재 글자 수: $2`,"익명","난쟁이","호빗","엔트","마법사","엘프","마이아","GIF","GIF 검색","프로필","승인됨","대기 중","스팸","고정 해제","오래된 ","최신 ","인기순","어떻게 생각하시나요?","댓글이 검토 중이며 현재 본인만 있습니다. 승인 공개됩니다.","이 게시물의 댓글 구독","이 사이트의 댓글 구독","댓글에 대한 답글 구독"]),ya=Y(["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!
8
+ 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?","Seu comentário está em revisão e atualmente está visível apenas para você. Ele será visível publicamente após a aprovação.","Assinar os comentários deste post","Assinar os comentários deste site","Assinar as respostas dos seus comentários"]),rt=Y(["Псевдоним","Никнейм не может быть меньше 3 байт.","Эл. адрес","Пожалуйста, подтвердите адрес вашей электронной почты.","Веб-сайт","Необязательный","Комментарий здесь...","Пока нет комментариев.","Отправить","Like","Cancel like","Отвечать","Отменить ответ","Комментарии","Обновить","Загрузи больше...","Превью","эмодзи","Загрузить изображение","секунд назад","несколько минут назад","несколько часов назад","дней назад","прямо сейчас","Загрузка","Авторизоваться","Выход из системы","Админ","Липкий","Слова",`Пожалуйста, введите комментарии от $0 до $1 слов!
9
+ Номер текущего слова: $2`,"Анонимный","Dwarves","Hobbits","Ents","Wizards","Elves","Maiar","GIF","Поиск GIF","Персональные данные","Одобренный","Ожидающий","Спам","Нелипкий","самый старый","последний","самый горячий","Что вы думаете?","Ваш комментарий находится на рассмотрении и в настоящее время виден только вам. После одобрения он станет общедоступным.","Подписаться на комментарии к этому посту","Подписаться на комментарии этого сайта","Подписаться на ответы ваших комментариев"]),ot=Y(["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 $1 từ!
10
+ 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?","Bình luận của bạn đang được xem xét và hiện chỉ hiển thị với bạn. Nó sẽ được công khai sau khi được phê duyệt.","Đăng ký nhận xét của bài viết này","Đăng ký nhận xét của trang web này","Đăng ký nhận xét của bạn"]),it=Y(["昵称","昵称不能少于3个字符","邮箱","请填写正确的邮件地址","网址","可选","欢迎评论","来发评论吧~","提交","喜欢","取消喜欢","回复","取消回复","评论","刷新","加载更多...","预览","表情","上传图片","秒前","分钟前","小时前","天前","刚刚","正在上传","登录","退出","博主","置顶","字",`评论字数应在 $0 到 $1 字之间!
11
+ 当前字数:$2`,"匿名","潜水","冒泡","吐槽","活跃","话痨","传说","表情包","搜索表情包","个人资料","通过","待审核","垃圾","取消置顶","按倒序","按正序","按热度","你认为这篇文章怎么样?","评论正在审核中,当前仅自己可见,审核通过后公开可见。","订阅本文评论","订阅本站评论","订阅你的评论回复"]),ba=Y(["暱稱","暱稱不能少於3個字元","郵箱","請填寫正確的郵件地址","網址","可選","歡迎留言","來發留言吧~","送出","喜歡","取消喜歡","回覆","取消回覆","留言","重整","載入更多...","預覽","表情","上傳圖片","秒前","分鐘前","小時前","天前","剛剛","正在上傳","登入","登出","管理者","置頂","字",`留言字數應在 $0 到 $1 字之間!
12
+ 目前字數:$2`,"匿名","潛水","冒泡","吐槽","活躍","多話","傳說","表情包","搜尋表情包","個人資料","通過","待審核","垃圾","取消置頂","最早","最新","熱門","你認為這篇文章怎麼樣?","您的評論正在審核中,目前僅您可見。審核通過後將公開顯示。","訂閱此文章的評論","訂閱本站的評論","訂閱您的評論回覆"]);const st="en-US",ke={zh:it,"zh-cn":it,"zh-tw":ba,en:Qe,"en-us":Qe,fr:tt,"fr-fr":tt,it:at,"it-it":at,jp:nt,"jp-jp":nt,ko:lt,"ko-kr":lt,"pt-br":ya,ru:rt,"ru-ru":rt,vi:ot,"vi-vn":ot,de:wa,es:et,"es-mx":et},ct=e=>ke[e.toLowerCase()]??ke[st.toLowerCase()],ut=e=>Object.keys(ke).includes(e.toLowerCase())?e:st,mt={latest:"insertedAt_desc",oldest:"insertedAt_asc",hottest:"like_desc"},ka=Object.keys(mt),Ce=Symbol("waline-config"),vt=e=>{try{return decodeURI(e)}catch{return e}},dt=(e="")=>e.replace(/\/$/u,""),pt=e=>/^(https?:)?\/\//.test(e),$e=e=>{const a=dt(e);return pt(a)?a:`https://${a}`},Ca=e=>Array.isArray(e)?e:typeof e=="number"?[0,e]:!1,de=(e,a)=>e==null||e===!0?a:e===!1?null:e,$a=({serverURL:e,path:a=location.pathname,lang:t=typeof navigator>"u"?"en-US":navigator.language,locale:l,meta:n=["nick","mail","link"],requiredMeta:o=[],dark:d=!1,pageSize:r=10,wordLimit:u,noCopyright:L=!1,login:c="enable",recaptchaV3Key:h="",turnstileKey:R="",commentSorting:_="latest",emoji:f=Ye,imageUploader:A,highlighter:S,texRenderer:v,search:z,reaction:H,...E})=>({serverURL:$e(e),path:vt(a),lang:ut(t),locale:{...ct(ut(t)),...typeof l=="object"?l:{}},wordLimit:Ca(u),meta:Xe(n),requiredMeta:Xe(o),dark:d,pageSize:r,commentSorting:_,login:c,noCopyright:L,recaptchaV3Key:h,turnstileKey:R,...E,reaction:H===!0?ia:H||null,imageUploader:de(A,sa),highlighter:de(S,ha),texRenderer:de(v,ca),emoji:de(f,Ye),search:de(z,ua(t))}),ue=e=>typeof e=="string",Ue="{--waline-white:#000;--waline-light-grey:#666;--waline-dark-grey:#999;--waline-color:#888;--waline-bg-color:#1e1e1e;--waline-bg-color-light:#272727;--waline-bg-color-hover: #444;--waline-border-color:#333;--waline-disable-bg-color:#444;--waline-disable-color:#272727;--waline-bq-color:#272727;--waline-info-bg-color:#272727;--waline-info-color:#666}",La=e=>ue(e)?e==="auto"?`@media(prefers-color-scheme:dark){body${Ue}}`:`${e}${Ue}`:e===!0?`:root${Ue}`:"",_e=(e,a)=>{let t=e.toString();for(;t.length<a;)t=`0${t}`;return t},Sa=e=>{const a=_e(e.getDate(),2),t=_e(e.getMonth()+1,2);return`${_e(e.getFullYear(),2)}-${t}-${a}`},Ia=(e,a,t)=>{if(!e)return"";const l=ue(e)?new Date(e.includes(" ")?e.replaceAll("-","/"):e):e,n=a.getTime()-l.getTime(),o=Math.floor(n/(24*3600*1e3));if(o===0){const d=n%864e5,r=Math.floor(d/(3600*1e3));if(r===0){const u=d%36e5,L=Math.floor(u/(60*1e3));if(L===0){const c=u%6e4;return`${Math.round(c/1e3)} ${t.seconds}`}return`${L} ${t.minutes}`}return`${r} ${t.hours}`}return o<0?t.now:o<8?`${o} ${t.days}`:Sa(l)},Ea=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,Aa=e=>Ea.test(e),Ma="WALINE_EMOJI",gt=se(Ma,{}),Ra=e=>/@[0-9]+\.[0-9]+\.[0-9]+/.test(e),xa=e=>{const a=Ra(e);if(a){const t=gt.value[e];if(t)return Promise.resolve(t)}return fetch(`${e}/info.json`).then(t=>t.json()).then(t=>{const l={folder:e,...t};return a&&(gt.value[e]=l),l})},ht=(e,a="",t="",l="")=>`${a?`${a}/`:""}${t}${e}${l?`.${l}`:""}`,za=e=>Promise.all(e?e.map(a=>ue(a)?xa(dt(a)):Promise.resolve(a)):[]).then(a=>{const t={tabs:[],map:{}};return a.forEach(l=>{const{name:n,folder:o,icon:d,prefix:r="",type:u,items:L}=l;t.tabs.push({name:n,icon:ht(d,o,r,u),items:L.map(c=>{const h=`${r}${c}`;return t.map[h]=ht(c,o,r,u),h})})}),t}),ft=e=>{e.name!=="AbortError"&&console.error(e.message)},Le=e=>e instanceof HTMLElement?e:ue(e)?document.querySelector(e):null,wt=e=>{const a=[...e].find(t=>t.type.includes("image"));return a?a.getAsFile():null},Ua=/\$.*?\$/,_a=/^\$(.*?)\$/,ja=/^(?:\s{0,3})\$\$((?:[^\n]|\n[^\n])+?)\n{0,1}\$\$/,Va=e=>[{name:"blockMath",level:"block",tokenizer(a){const t=ja.exec(a);if(t!=null)return{type:"html",raw:t[0],text:e(!0,t[1])}}},{name:"inlineMath",level:"inline",start(a){const t=a.search(Ua);return t===-1?a.length:t},tokenizer(a){const t=_a.exec(a);if(t!=null)return{type:"html",raw:t[0],text:e(!1,t[1])}}}],yt=(e="",a={})=>e.replaceAll(/:(.+?):/g,(t,l)=>a[l]?`<img class="wl-emoji" src="${a[l]}" alt="${l}">`:t),Ha=(e,{emojiMap:a,highlighter:t,texRenderer:l})=>{const n=new na;if(n.setOptions({breaks:!0}),t&&n.use(la({highlight:t})),l){const o=Va(l);n.use({extensions:o})}return n.parse(yt(e,a))},je=e=>{const{path:a}=e.dataset;return a!=null&&a.length?a:null},Fa=e=>e.match(/[\w\d\s,.\u00C0-\u024F\u0400-\u04FF]+/giu),Ta=e=>e.match(/[\u4E00-\u9FD5]/gu),Na=e=>{var a,t;return(((a=Fa(e))==null?void 0:a.reduce((l,n)=>l+(["",",","."].includes(n.trim())?0:n.trim().split(/\s+/u).length),0))??0)+(((t=Ta(e))==null?void 0:t.length)??0)},Ba=async()=>{const{userAgentData:e}=navigator;let a=navigator.userAgent;if((e==null?void 0:e.platform)!=="Windows")return a;const{platformVersion:t}=await e.getHighEntropyValues(["platformVersion"]);return t&&Number.parseInt(t.split(".")[0],10)>=13&&(a=a.replace("Windows NT 10.0","Windows NT 11.0")),a},bt=({serverURL:e,path:a=window.location.pathname,selector:t=".waline-comment-count",lang:l=navigator.language})=>{const n=new AbortController,o=document.querySelectorAll(t);return o.length>0&&Tt({serverURL:$e(e),paths:Array.from(o,d=>vt(je(d)??a)),lang:l,signal:n.signal}).then(d=>{o.forEach((r,u)=>{r.textContent=d[u].toString()})}).catch(ft),n.abort.bind(n)},kt=({size:e})=>k("svg",{class:"wl-close-icon",viewBox:"0 0 1024 1024",width:e,height:e},[k("path",{d:"M697.173 85.333h-369.92c-144.64 0-241.92 101.547-241.92 252.587v348.587c0 150.613 97.28 252.16 241.92 252.16h369.92c144.64 0 241.494-101.547 241.494-252.16V337.92c0-151.04-96.854-252.587-241.494-252.587z",fill:"currentColor"}),k("path",{d:"m640.683 587.52-75.947-75.861 75.904-75.862a37.29 37.29 0 0 0 0-52.778 37.205 37.205 0 0 0-52.779 0l-75.946 75.818-75.862-75.946a37.419 37.419 0 0 0-52.821 0 37.419 37.419 0 0 0 0 52.821l75.947 75.947-75.776 75.733a37.29 37.29 0 1 0 52.778 52.821l75.776-75.776 75.947 75.947a37.376 37.376 0 0 0 52.779-52.821z",fill:"#888"})]),Pa=()=>k("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},k("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"})),Wa=()=>k("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},k("path",{d:"M563.2 463.3 677 540c1.7 1.2 3.7 1.8 5.8 1.8.7 0 1.4-.1 2-.2 2.7-.5 5.1-2.1 6.6-4.4l25.3-37.8c1.5-2.3 2.1-5.1 1.6-7.8s-2.1-5.1-4.4-6.6l-73.6-49.1 73.6-49.1c2.3-1.5 3.9-3.9 4.4-6.6.5-2.7 0-5.5-1.6-7.8l-25.3-37.8a10.1 10.1 0 0 0-6.6-4.4c-.7-.1-1.3-.2-2-.2-2.1 0-4.1.6-5.8 1.8l-113.8 76.6c-9.2 6.2-14.7 16.4-14.7 27.5.1 11 5.5 21.3 14.7 27.4zM387 348.8h-45.5c-5.7 0-10.4 4.7-10.4 10.4v153.3c0 5.7 4.7 10.4 10.4 10.4H387c5.7 0 10.4-4.7 10.4-10.4V359.2c0-5.7-4.7-10.4-10.4-10.4zm333.8 241.3-41-20a10.3 10.3 0 0 0-8.1-.5c-2.6.9-4.8 2.9-5.9 5.4-30.1 64.9-93.1 109.1-164.4 115.2-5.7.5-9.9 5.5-9.5 11.2l3.9 45.5c.5 5.3 5 9.5 10.3 9.5h.9c94.8-8 178.5-66.5 218.6-152.7 2.4-5 .3-11.2-4.8-13.6zm186-186.1c-11.9-42-30.5-81.4-55.2-117.1-24.1-34.9-53.5-65.6-87.5-91.2-33.9-25.6-71.5-45.5-111.6-59.2-41.2-14-84.1-21.1-127.8-21.1h-1.2c-75.4 0-148.8 21.4-212.5 61.7-63.7 40.3-114.3 97.6-146.5 165.8-32.2 68.1-44.3 143.6-35.1 218.4 9.3 74.8 39.4 145 87.3 203.3.1.2.3.3.4.5l36.2 38.4c1.1 1.2 2.5 2.1 3.9 2.6 73.3 66.7 168.2 103.5 267.5 103.5 73.3 0 145.2-20.3 207.7-58.7 37.3-22.9 70.3-51.5 98.1-85 27.1-32.7 48.7-69.5 64.2-109.1 15.5-39.7 24.4-81.3 26.6-123.8 2.4-43.6-2.5-87-14.5-129zm-60.5 181.1c-8.3 37-22.8 72-43 104-19.7 31.1-44.3 58.6-73.1 81.7-28.8 23.1-61 41-95.7 53.4-35.6 12.7-72.9 19.1-110.9 19.1-82.6 0-161.7-30.6-222.8-86.2l-34.1-35.8c-23.9-29.3-42.4-62.2-55.1-97.7-12.4-34.7-18.8-71-19.2-107.9-.4-36.9 5.4-73.3 17.1-108.2 12-35.8 30-69.2 53.4-99.1 31.7-40.4 71.1-72 117.2-94.1 44.5-21.3 94-32.6 143.4-32.6 49.3 0 97 10.8 141.8 32 34.3 16.3 65.3 38.1 92 64.8 26.1 26 47.5 56 63.6 89.2 16.2 33.2 26.6 68.5 31 105.1 4.6 37.5 2.7 75.3-5.6 112.3z",fill:"currentColor"})),Da=()=>k("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},[k("path",{d:"M784 112H240c-88 0-160 72-160 160v480c0 88 72 160 160 160h544c88 0 160-72 160-160V272c0-88-72-160-160-160zm96 640c0 52.8-43.2 96-96 96H240c-52.8 0-96-43.2-96-96V272c0-52.8 43.2-96 96-96h544c52.8 0 96 43.2 96 96v480z",fill:"currentColor"}),k("path",{d:"M352 480c52.8 0 96-43.2 96-96s-43.2-96-96-96-96 43.2-96 96 43.2 96 96 96zm0-128c17.6 0 32 14.4 32 32s-14.4 32-32 32-32-14.4-32-32 14.4-32 32-32zm462.4 379.2-3.2-3.2-177.6-177.6c-25.6-25.6-65.6-25.6-91.2 0l-80 80-36.8-36.8c-25.6-25.6-65.6-25.6-91.2 0L200 728c-4.8 6.4-8 14.4-8 24 0 17.6 14.4 32 32 32 9.6 0 16-3.2 22.4-9.6L380.8 640l134.4 134.4c6.4 6.4 14.4 9.6 24 9.6 17.6 0 32-14.4 32-32 0-9.6-4.8-17.6-9.6-24l-52.8-52.8 80-80L769.6 776c6.4 4.8 12.8 8 20.8 8 17.6 0 32-14.4 32-32 0-8-3.2-16-8-20.8z",fill:"currentColor"})]),qa=({active:e=!1})=>k("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},[k("path",{d:`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?"":"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"}`,fill:e?"red":"currentColor"})]),Ga=()=>k("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},[k("path",{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",fill:"currentColor"}),k("path",{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",fill:"currentColor"})]),Oa=()=>k("svg",{width:"16",height:"16",ariaHidden:"true"},k("path",{d:"M14.85 3H1.15C.52 3 0 3.52 0 4.15v7.69C0 12.48.52 13 1.15 13h13.69c.64 0 1.15-.52 1.15-1.15v-7.7C16 3.52 15.48 3 14.85 3zM9 11H7V8L5.5 9.92 4 8v3H2V5h2l1.5 2L7 5h2v6zm2.99.5L9.5 8H11V5h2v3h1.5l-2.51 3.5z",fill:"currentColor"})),Ka=()=>k("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},k("path",{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",fill:"currentColor"})),Za=()=>k("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},k("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"})),Xa=()=>k("svg",{class:"verified-icon",viewBox:"0 0 1024 1024",width:"14",height:"14"},k("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"})),Ya=()=>k("svg",{class:"administrator-icon",viewBox:"0 0 1024 1024",width:"14",height:"14"},[k("path",{d:"M461.6 129.56C489.6 105.96 534.8 105.96 562.4 129.56L625.6 183.96C637.6 194.36 660.4 202.76 676 202.76H744C786.4 202.76 821.2 237.56 821.2 279.96V347.96C821.2 363.96 829.6 386.36 840 398.36L894.4 461.56C918 489.16 918 534.76 894.8 562.36L840.4 625.56C830 637.56 821.6 660.36 821.6 675.96V743.96C821.6 786.36 786.8 821.16 744.4 821.16H676.4C660.4 821.16 638 829.56 626 839.96L562.8 894.36C534.8 917.96 489.6 917.96 462 894.36L398.8 839.96C386.8 829.56 364 821.16 348.4 821.16H279.2C236.8 821.16 202 786.36 202 743.96V675.56C201.999 659.96 193.6 637.56 183.6 625.56L129.6 561.96C106.4 534.36 106.4 489.56 129.6 461.96L183.6 398.36C193.6 386.359 202 363.959 202 348.36V279.96C202 237.56 236.8 202.76 279.2 202.76H348.4C364 202.76 386.8 194.36 398.8 184.36L461.6 129.56ZM549.567 331.896C530.047 303.082 486.645 306.12 471.433 337.412L442.175 396.526C435.587 409.848 422.856 419.097 408.146 421.226L342.706 430.726C340.776 431 338.884 431.397 336.993 431.946C303.482 441.361 292.756 483.493 317.671 507.812L364.975 553.96C375.623 564.321 380.507 579.299 377.991 593.954L366.917 659.102C366.595 661.03 366.355 662.967 366.279 664.923C364.906 699.688 401.683 722.937 432.514 706.738L491.05 675.966C504.217 669.068 519.954 669.069 533.121 675.966L591.675 706.738C593.406 707.645 595.174 708.432 597.028 709.104C629.666 721.205 663.139 693.382 657.273 659.102L646.069 593.954C643.42 579.176 648.24 564.083 659.001 553.6L706.315 507.461C707.687 506.118 708.994 504.66 710.215 503.127C731.779 475.809 715.737 435.41 681.281 430.365L615.839 420.874C601.13 418.745 588.4 409.486 581.821 396.174L552.562 337.052C551.644 335.284 550.674 333.551 549.567 331.896Z",fill:"#f59831"})]),pe=({size:e=100})=>k("svg",{width:e,height:e,viewBox:"0 0 100 100",preserveAspectRatio:"xMidYMid"},k("circle",{cx:50,cy:50,fill:"none",stroke:"currentColor",strokeWidth:"4",r:"40","stroke-dasharray":"85 30"},k("animateTransform",{attributeName:"transform",type:"rotate",repeatCount:"indefinite",dur:"1s",values:"0 50 50;360 50 50",keyTimes:"0;1"}))),Ja=()=>k("svg",{width:24,height:24,fill:"currentcolor",viewBox:"0 0 24 24"},[k("path",{style:"transform: translateY(0.5px)",d:"M18.968 10.5H15.968V11.484H17.984V12.984H15.968V15H14.468V9H18.968V10.5V10.5ZM8.984 9C9.26533 9 9.49967 9.09367 9.687 9.281C9.87433 9.46833 9.968 9.70267 9.968 9.984V10.5H6.499V13.5H8.468V12H9.968V14.016C9.968 14.2973 9.87433 14.5317 9.687 14.719C9.49967 14.9063 9.26533 15 8.984 15H5.984C5.70267 15 5.46833 14.9063 5.281 14.719C5.09367 14.5317 5 14.2973 5 14.016V9.985C5 9.70367 5.09367 9.46933 5.281 9.282C5.46833 9.09467 5.70267 9.001 5.984 9.001H8.984V9ZM11.468 9H12.968V15H11.468V9V9Z"}),k("path",{d:"M18.5 3H5.75C3.6875 3 2 4.6875 2 6.75V18C2 20.0625 3.6875 21.75 5.75 21.75H18.5C20.5625 21.75 22.25 20.0625 22.25 18V6.75C22.25 4.6875 20.5625 3 18.5 3ZM20.75 18C20.75 19.2375 19.7375 20.25 18.5 20.25H5.75C4.5125 20.25 3.5 19.2375 3.5 18V6.75C3.5 5.5125 4.5125 4.5 5.75 4.5H18.5C19.7375 4.5 20.75 5.5125 20.75 6.75V18Z"})]),Ct=()=>k("svg",{width:"16",height:"16",viewBox:"0 0 24 24"},k("g",{transform:"translate(0 -1028.4)"},k("g",{},[k("path",{d:"m4 1031.4c-1.1046 0-2 0.9-2 2v16c0 1.1 0.8954 2 2 2h16c1.105 0 2-0.9 2-2v-16c0-1.1-0.895-2-2-2h-16z",fill:"#d35400"}),k("path",{d:"m4 2c-1.1046 0-2 0.8954-2 2v16c0 1.105 0.8954 2 2 2h16c1.105 0 2-0.895 2-2v-16c0-1.1046-0.895-2-2-2h-16z",transform:"translate(0 1028.4)",fill:"#e67e22"}),k("path",{d:"m5 1034.4v2.3c6.443 0 11.667 5.2 11.667 11.7h2.333c0-7.8-6.268-14-14-14zm0 4.6v2.4c3.866 0 7 3.1 7 7h2.333c0-5.2-4.178-9.4-9.333-9.4zm2.0417 5.3c-1.1276 0-2.0417 0.9-2.0417 2s0.9141 2.1 2.0417 2.1c1.1275 0 2.0416-1 2.0416-2.1s-0.9141-2-2.0416-2z",fill:"#d35400"}),k("path",{d:"m5 1033.4v2.3c6.443 0 11.667 5.2 11.667 11.7h2.333c0-7.8-6.268-14-14-14zm0 4.6v2.4c3.866 0 7 3.1 7 7h2.333c0-5.2-4.178-9.4-9.333-9.4zm2.0417 5.3c-1.1276 0-2.0417 0.9-2.0417 2s0.9141 2.1 2.0417 2.1c1.1275 0 2.0416-1 2.0416-2.1s-0.9141-2-2.0416-2z",fill:"#ecf0f1"})]))),Qa=()=>k("svg",{fill:"currentColor",width:"24",height:"24",viewBox:"-3 0 19 19",class:"cf-icon-svg"},k("path",{d:"M.926 12.818a1.403 1.403 0 1 1 0 1.984 1.402 1.402 0 0 1 0-1.984zm10.531 2.357a1.03 1.03 0 0 1-1.029-1.03 8.775 8.775 0 0 0-.694-3.438A8.826 8.826 0 0 0 1.591 5.31a1.03 1.03 0 1 1 0-2.059 10.817 10.817 0 0 1 4.24.857 10.893 10.893 0 0 1 3.463 2.334 10.867 10.867 0 0 1 3.19 7.703 1.027 1.027 0 0 1-1.027 1.029zm-4.538 0a1.03 1.03 0 0 1-1.029-1.03 4.297 4.297 0 0 0-4.299-4.298 1.03 1.03 0 0 1 0-2.059 6.362 6.362 0 0 1 5.857 3.883 6.298 6.298 0 0 1 .5 2.475 1.03 1.03 0 0 1-1.029 1.029z"})),en=()=>se("WALINE_USER_META",{nick:"",mail:"",link:""}),tn=()=>se("WALINE_COMMENT_BOX_EDITOR",""),an="WALINE_LIKE",nn=se(an,[]),$t=()=>nn,ln="WALINE_REACTION",rn=se(ln,{}),Lt=()=>rn,St={},on=e=>{const a=St[e]??(St[e]=ra(e,{useRecaptchaNet:!0,autoHideBadge:!0}));return{execute:t=>a.then(l=>l.execute(t))}},sn=e=>({execute:async a=>{const{load:t}=Qt("https://challenges.cloudflare.com/turnstile/v0/api.js",void 0,{async:!1});await t();const{turnstile:l}=window;return new Promise(n=>{l==null||l.ready(()=>{l.render(".wl-captcha-container",{sitekey:e,action:a,size:"compact",callback:n})})})}}),cn="WALINE_USER",un=se(cn,{}),Se=()=>un,mn={key:0,class:"wl-reaction"},vn=["textContent"],dn={class:"wl-reaction-list"},pn=["onClick"],gn={class:"wl-reaction-img"},hn=["src","alt"],fn=["textContent"],wn=["textContent"];var yn=ne({__name:"ArticleReaction",setup(e){const a=Lt(),t=Me(Ce),l=x(-1),n=x([]),o=N(()=>t.value.locale),d=N(()=>{const{reaction:h}=t.value;return h!=null&&h.length?h:null}),r=N(()=>{var h;const{path:R}=t.value;return((h=d.value)==null?void 0:h.map((_,f)=>({icon:_,desc:o.value[`reaction${f}`],active:a.value[R]===f})))??null});let u;const L=async()=>{const{serverURL:h,lang:R,path:_}=t.value;if(!d.value)return;const f=new AbortController;u=f.abort.bind(f);const[A]=await Be({serverURL:h,lang:R,paths:[_],type:d.value.map((S,v)=>`reaction${v}`),signal:f.signal});n.value=d.value.map((S,v)=>A[`reaction${v}`])},c=async h=>{if(l.value!==-1)return;const{serverURL:R,lang:_,path:f}=t.value,A=a.value[f];l.value=h,A!=null&&(await fe({serverURL:R,lang:_,path:f,type:`reaction${A}`,action:"desc"}),n.value[A]=Math.max(n.value[A]-1,0)),A!==h&&(await fe({serverURL:R,lang:_,path:f,type:`reaction${h}`}),n.value[h]=(n.value[h]||0)+1),A===h?delete a.value[f]:a.value[f]=h,l.value=-1};return ve(()=>{ce(()=>[t.value.serverURL,t.value.path],()=>L())}),Pe(()=>{u==null||u()}),(h,R)=>r.value?(i(),p("div",mn,[m("div",{class:"wl-reaction-title",textContent:M(o.value.reactionTitle)},null,8,vn),m("ul",dn,[(i(!0),p(G,null,K(r.value,({active:_,icon:f,desc:A},S)=>(i(),p("li",{key:S,class:O(["wl-reaction-item",{active:_}]),onClick:v=>c(S)},[m("div",gn,[m("img",{src:f,alt:A},null,8,hn),l.value===S?(i(),Q(b(pe),{key:0,class:"wl-reaction-loading"})):(i(),p("div",{key:1,class:"wl-reaction-votes",textContent:M(n.value[S]||0)},null,8,fn))]),m("div",{class:"wl-reaction-text",textContent:M(A)},null,8,wn)],10,pn))),128))])])):I("v-if",!0)}});const bn=["data-index"],kn=["src","title","onClick"];var Cn=ne({__name:"ImageWall",props:{items:{default:()=>[]},columnWidth:{default:300},gap:{default:0}},emits:["insert"],setup(e){let a=null;const t=ee("wall"),l=x({}),n=x([]),o=()=>{const c=Math.floor((t.value.getBoundingClientRect().width+e.gap)/(e.columnWidth+e.gap));return c>0?c:1},d=c=>Array.from({length:c},()=>[]),r=async c=>{var h;if(c>=e.items.length)return;await We();const R=[...((h=t.value)==null?void 0:h.children)??[]].reduce((_,f)=>f.getBoundingClientRect().height<_.getBoundingClientRect().height?f:_);n.value[Number(R.dataset.index)].push(c),await r(c+1)},u=async(c=!1)=>{if(n.value.length===o()&&!c)return;n.value=d(o());const{scrollY:h}=window;await r(0),window.scrollTo({top:h})},L=c=>{l.value[c.target.src]=!0};return ve(()=>{u(!0),a=new ResizeObserver(()=>{u()}),a.observe(t.value),Re(()=>[e.items],()=>{l.value={},u(!0)}),Re(()=>[e.columnWidth,e.gap],()=>{u()})}),Kt(()=>{a.unobserve(t.value)}),(c,h)=>(i(),p("div",{ref_key:"wall",ref:t,class:"wl-gallery",style:ye({gap:`${e.gap}px`})},[(i(!0),p(G,null,K(n.value,(R,_)=>(i(),p("div",{key:_,class:"wl-gallery-column","data-index":_,style:ye({gap:`${e.gap}px`})},[(i(!0),p(G,null,K(R,f=>(i(),p(G,{key:f},[l.value[e.items[f].src]?I("v-if",!0):(i(),Q(b(pe),{key:0,size:36,style:{margin:"20px auto"}})),m("img",{class:"wl-gallery-item",src:e.items[f].src,title:e.items[f].title,loading:"lazy",onLoad:L,onClick:A=>c.$emit("insert",`![](${e.items[f].src})`)},null,40,kn)],64))),128))],12,bn))),128))],4))}});const $n={key:0,class:"wl-login-info"},Ln={class:"wl-avatar"},Sn=["title"],In=["title"],En=["src"],An=["title","textContent"],Mn={class:"wl-panel"},Rn=["for","textContent"],xn=["id","onUpdate:modelValue","name","type"],zn=["placeholder"],Un={class:"wl-preview"},_n=["innerHTML"],jn={class:"wl-footer"},Vn={class:"wl-actions"},Hn={href:"https://guides.github.com/features/mastering-markdown/",title:"Markdown Guide","aria-label":"Markdown is supported",class:"wl-action",target:"_blank",rel:"noopener noreferrer"},Fn=["title"],Tn=["title"],Nn=["title","aria-label"],Bn=["title"],Pn={class:"wl-info"},Wn={class:"wl-text-number"},Dn={key:0},qn=["textContent"],Gn=["textContent"],On=["disabled"],Kn=["placeholder"],Zn={key:1,class:"wl-loading"},Xn=["title","onClick","onMouseenter"],Yn=["src","alt"],Jn=["src"],Qn={key:0,class:"wl-tabs"},el=["onClick"],tl=["src","alt","title"],al=["title"];var It=ne({__name:"CommentBox",props:{edit:{},rootId:{},replyId:{},replyUser:{}},emits:["log","cancelEdit","cancelReply","submit"],setup(e,{emit:a}){const t=e,l=a,n=Me(Ce),o=tn(),d=en(),r=Se(),u=x({}),L=ee("textarea"),c=ee("image-uploader"),h=ee("emoji-button"),R=ee("emoji-popup"),_=ee("gif-button"),f=ee("gif-popup"),A=ee("gif-search"),S=x({tabs:[],map:{}}),v=x(0),z=x(!1),H=x(""),E=x({});let U;const le=(g,s)=>{clearTimeout(U),H.value=s;const y=g.currentTarget,V=R.value;if(y&&V){const w=y.getBoundingClientRect(),D=V.getBoundingClientRect();E.value={left:`${w.left-D.left+w.width/2}px`,top:`${w.top-D.top}px`,transform:"translate(-50%, -100%)"}}},re=()=>{U=setTimeout(()=>{H.value=""},50)},J=x(!1),oe=x(!1),me=x(""),C=x(0),$=xe({loading:!0,list:[]}),j=x(0),B=x(!1),Z=x(""),P=x(!1),ae=x(!1),F=N(()=>n.value.locale),ie=N(()=>!!r.value.token),ge=N(()=>n.value.imageUploader!=null),Ie=g=>{const s=L.value,y=s.selectionStart,V=s.selectionEnd||0,{scrollTop:w}=s;o.value=s.value.slice(0,y)+g+s.value.slice(V),s.focus(),s.selectionStart=y+g.length,s.selectionEnd=y+g.length,s.scrollTop=w},zt=({key:g,ctrlKey:s,metaKey:y})=>{P.value||(s||y)&&g==="Enter"&&He()},Ee=async g=>{const s=`![${n.value.locale.uploading} ${g.name}]()`;Ie(s),P.value=!0;try{const y=await n.value.imageUploader(g);o.value=o.value.replace(s,`\r
13
+ ![${g.name}](${y})`)}catch(y){alert(y.message),o.value=o.value.replace(s,"")}finally{P.value=!1}},Ut=g=>{var s;if((s=g.dataTransfer)!=null&&s.items){const y=wt(g.dataTransfer.items);y&&ge.value&&(Ee(y),g.preventDefault())}},_t=g=>{if(g.clipboardData){const s=wt(g.clipboardData.items);s&&ge.value&&Ee(s)}},jt=()=>{const g=c.value;g.files&&ge.value&&Ee(g.files[0]).then(()=>{g.value=""})},He=async()=>{var g;const{serverURL:s,lang:y,login:V,wordLimit:w,requiredMeta:D,recaptchaV3Key:q,turnstileKey:X}=n.value,T={comment:Z.value,nick:d.value.nick,mail:d.value.mail,link:d.value.link,url:n.value.path,ua:await Ba()};if(!t.edit)if(r.value.token)T.nick=r.value.display_name,T.mail=r.value.email,T.link=r.value.url;else{if(V==="force")return;if(D.includes("nick")&&!T.nick){u.value.nick.focus(),alert(F.value.nickError);return}if(D.includes("mail")&&!T.mail||T.mail&&!Aa(T.mail)){u.value.mail.focus(),alert(F.value.mailError);return}T.nick||(T.nick=F.value.anonymous)}if(!T.comment){L.value.focus();return}if(!B.value){alert(F.value.wordHint.replace("$0",w[0].toString()).replace("$1",w[1].toString()).replace("$2",C.value.toString()));return}T.comment=yt(T.comment,S.value.map),t.replyId&&t.rootId&&(T.pid=t.replyId,T.rid=t.rootId,T.at=t.replyUser),P.value=!0;try{q&&(T.recaptchaV3=await on(q).execute("social")),X&&(T.turnstile=await sn(X).execute("social"));const he={serverURL:s,lang:y,token:r.value.token,comment:T},Ae=await(t.edit?we({objectId:t.edit.objectId,...he}):Nt(he));if(P.value=!1,Ae.errmsg){alert(Ae.errmsg);return}l("submit",Ae.data),o.value="",me.value="",await We(),t.replyId&&l("cancelReply"),(g=t.edit)!=null&&g.objectId&&l("cancelEdit")}catch(he){P.value=!1,alert(he.message)}},Vt=g=>{g.preventDefault();const{lang:s,serverURL:y}=n.value;Bt({serverURL:y,lang:s}).then(V=>{r.value=V,(V.remember?localStorage:sessionStorage).setItem("WALINE_USER",JSON.stringify(V)),l("log")})},Ht=()=>{r.value={},localStorage.setItem("WALINE_USER","null"),sessionStorage.setItem("WALINE_USER","null"),l("log")},Fe=g=>{g.preventDefault();const{lang:s,serverURL:y}=n.value,V=800,w=800,D=(window.innerWidth-V)/2,q=(window.innerHeight-w)/2,X=new URLSearchParams({lng:s,token:r.value.token}),T=window.open(`${y}/ui/profile?${X.toString()}`,"_blank",`width=${V},height=${w},left=${D},top=${q},scrollbars=no,resizable=no,status=no,location=no,toolbar=no,menubar=no`);T==null||T.postMessage({type:"TOKEN",data:r.value.token},"*")},Ft=g=>{var s,y,V,w;!((s=h.value)!=null&&s.contains(g.target))&&!((y=R.value)!=null&&y.contains(g.target))&&(z.value=!1),!((V=_.value)!=null&&V.contains(g.target))&&!((w=f.value)!=null&&w.contains(g.target))&&(J.value=!1)},Te=async g=>{var s;const{scrollTop:y,clientHeight:V,scrollHeight:w}=g.target,D=(V+y)/w,q=n.value.search,X=((s=A.value)==null?void 0:s.value)??"";D<.9||$.loading||ae.value||($.loading=!0,(q.more&&$.list.length>0?await q.more(X,$.list.length):await q.search(X)).length>0?$.list=[...$.list,...q.more&&$.list.length>0?await q.more(X,$.list.length):await q.search(X)]:ae.value=!0,$.loading=!1,setTimeout(()=>{g.target.scrollTop=y},50))},Ne=ea(g=>{$.list=[],ae.value=!1,Te(g)},300);return Ke("click",Ft),Ke("message",({data:g})=>{(g==null?void 0:g.type)==="profile"&&(r.value={...r.value,...g.data},[localStorage,sessionStorage].filter(s=>s.getItem("WALINE_USER")).forEach(s=>{s.setItem("WALINE_USER",JSON.stringify(r))}))}),ce([n,C],([g,s])=>{const{wordLimit:y}=g;y?s<y[0]&&y[0]!==0?([j.value]=y,B.value=!1):s>y[1]?([,j.value]=y,B.value=!1):([,j.value]=y,B.value=!0):(j.value=0,B.value=!0)}),Re(J,async g=>{var s;if(!g)return;const y=n.value.search;A.value&&(A.value.value=""),$.loading=!0,$.list=await(((s=y.default)==null?void 0:s.call(y))??y.search("")),$.loading=!1}),ve(()=>{var g;(g=t.edit)!=null&&g.objectId&&(o.value=t.edit.orig),ce(()=>o.value,s=>{const{highlighter:y,texRenderer:V}=n.value;Z.value=s,me.value=Ha(s,{emojiMap:S.value.map,highlighter:y,texRenderer:V}),C.value=Na(s),s?Ze(L.value):Ze.destroy(L.value)}),ce(()=>n.value.emoji,async s=>{S.value=await za(s)})}),(g,s)=>{var y,V;return i(),p("div",{key:b(r).token,class:"wl-comment"},[b(n).login!=="disable"&&ie.value&&!((y=e.edit)!=null&&y.objectId)?(i(),p("div",$n,[m("div",Ln,[m("button",{type:"submit",class:"wl-logout-btn",title:F.value.logout,onClick:Ht},[W(b(kt),{size:14})],8,Sn),m("a",{href:"#",class:"wl-login-nick","aria-label":"Profile",title:F.value.profile,onClick:Fe},[m("img",{src:b(r).avatar,alt:"avatar"},null,8,En)],8,In)]),m("a",{href:"#",class:"wl-login-nick","aria-label":"Profile",title:F.value.profile,onClick:Fe,textContent:M(b(r).display_name)},null,8,An)])):I("v-if",!0),m("div",Mn,[b(n).login!=="force"&&b(n).meta.length&&!ie.value?(i(),p("div",{key:0,class:O(["wl-header",`item${b(n).meta.length}`])},[(i(!0),p(G,null,K(b(n).meta,w=>(i(),p("div",{key:w,class:"wl-header-item"},[m("label",{for:`wl-${w}`,textContent:M(F.value[w]+(b(n).requiredMeta.includes(w)||!b(n).requiredMeta.length?"":`(${F.value.optional})`))},null,8,Rn),be(m("input",{id:`wl-${w}`,ref_for:!0,ref:D=>{D&&(u.value[w]=D)},"onUpdate:modelValue":D=>b(d)[w]=D,class:O(["wl-input",`wl-${w}`]),name:w,type:w==="mail"?"email":"text"},null,10,xn),[[Zt,b(d)[w]]])]))),128))],2)):I("v-if",!0),be(m("textarea",{id:"wl-edit",ref:"textarea","onUpdate:modelValue":s[0]||(s[0]=w=>Xt(o)?o.value=w:null),class:"wl-editor",placeholder:e.replyUser?`@${e.replyUser}`:F.value.placeholder,onKeydown:zt,onDrop:Ut,onPaste:_t},null,40,zn),[[Yt,b(o)]]),be(m("div",Un,[s[7]||(s[7]=m("hr",null,null,-1)),m("h4",null,M(F.value.preview)+":",1),m("div",{class:"wl-content",innerHTML:me.value},null,8,_n)],512),[[De,oe.value]]),m("div",jn,[m("div",Vn,[m("a",Hn,[W(b(Oa))]),be(m("button",{ref:"emoji-button",type:"button",class:O(["wl-action",{active:z.value}]),title:F.value.emoji,onClick:s[1]||(s[1]=w=>z.value=!z.value)},[W(b(Wa))],10,Fn),[[De,S.value.tabs.length]]),b(n).search?(i(),p("button",{key:0,ref:"gif-button",type:"button",class:O(["wl-action",{active:J.value}]),title:F.value.gif,onClick:s[2]||(s[2]=w=>J.value=!J.value)},[W(b(Ja))],10,Tn)):I("v-if",!0),m("input",{id:"wl-image-upload",ref:"image-uploader",class:"upload","aria-hidden":"true",type:"file",accept:".png,.jpg,.jpeg,.webp,.bmp,.gif",onChange:jt},null,544),ge.value?(i(),p("label",{key:1,for:"wl-image-upload",class:"wl-action",title:F.value.uploadImage,"aria-label":F.value.uploadImage},[W(b(Da))],8,Nn)):I("v-if",!0),m("button",{type:"button",class:O(["wl-action",{active:oe.value}]),title:F.value.preview,onClick:s[3]||(s[3]=w=>oe.value=!oe.value)},[W(b(Ga))],10,Bn)]),m("div",Pn,[s[9]||(s[9]=m("div",{class:"wl-captcha-container"},null,-1)),m("div",Wn,[te(M(C.value)+" ",1),b(n).wordLimit?(i(),p("span",Dn,[s[8]||(s[8]=te("  /  ",-1)),m("span",{class:O({illegal:!B.value}),textContent:M(j.value)},null,10,qn)])):I("v-if",!0),te("  "+M(F.value.word),1)]),b(n).login!=="disable"&&!ie.value?(i(),p("button",{key:0,type:"button",class:"wl-btn",onClick:Vt,textContent:M(F.value.login)},null,8,Gn)):I("v-if",!0),b(n).login!=="force"||ie.value?(i(),p("button",{key:1,type:"submit",class:"primary wl-btn",title:"Cmd|Ctrl + Enter",disabled:P.value,onClick:He},[P.value?(i(),Q(b(pe),{key:0,size:16})):(i(),p(G,{key:1},[te(M(F.value.submit),1)],64))],8,On)):I("v-if",!0)]),m("div",{ref:"gif-popup",class:O(["wl-gif-popup",{display:J.value}])},[m("input",{ref:"gif-search",type:"text",placeholder:F.value.gifSearchPlaceholder,onInput:s[4]||(s[4]=(...w)=>b(Ne)&&b(Ne)(...w))},null,40,Kn),$.list.length?(i(),Q(Cn,{key:0,items:$.list,"column-width":200,gap:6,onInsert:s[5]||(s[5]=w=>Ie(w)),onScroll:Te},null,8,["items"])):I("v-if",!0),$.loading?(i(),p("div",Zn,[W(b(pe),{size:30})])):I("v-if",!0)],2),m("div",{ref:"emoji-popup",class:O(["wl-emoji-popup",{display:z.value}])},[(i(!0),p(G,null,K(S.value.tabs,(w,D)=>(i(),p(G,{key:w.name},[D===v.value?(i(),p("div",{key:0,class:"wl-tab-wrapper",onScroll:re},[(i(!0),p(G,null,K(w.items,q=>(i(),p("button",{key:q,type:"button",title:q,onClick:X=>Ie(`:${q}:`),onMouseenter:X=>le(X,q),onMouseleave:re},[z.value?(i(),p("img",{key:0,class:"wl-emoji",src:S.value.map[q],alt:q,loading:"lazy",referrerPolicy:"no-referrer"},null,8,Yn)):I("v-if",!0)],40,Xn))),128))],32)):I("v-if",!0)],64))),128)),m("div",null,[H.value?(i(),p("img",{key:0,class:"wl-emoji-preview",src:S.value.map[H.value],alt:"preview",loading:"lazy",referrerPolicy:"no-referrer",style:ye(E.value)},null,12,Jn)):I("v-if",!0)]),S.value.tabs.length>1?(i(),p("div",Qn,[(i(!0),p(G,null,K(S.value.tabs,(w,D)=>(i(),p("button",{key:w.name,type:"button",class:O(["wl-tab",{active:v.value===D}]),onClick:q=>v.value=D},[m("img",{class:"wl-emoji",src:w.icon,alt:w.name,title:w.name,loading:"lazy",referrerPolicy:"no-referrer"},null,8,tl)],10,el))),128))])):I("v-if",!0)],2)])]),e.replyId||(V=e.edit)!=null&&V.objectId?(i(),p("button",{key:1,type:"button",class:"wl-close",title:F.value.cancelReply,onClick:s[6]||(s[6]=w=>e.replyId?l("cancelReply"):l("cancelEdit"))},[W(b(kt),{size:24})],8,al)):I("v-if",!0)])}}});const nl=["id"],ll={class:"wl-user","aria-hidden":"true"},rl=["src"],ol={class:"wl-card"},il={class:"wl-head"},sl=["href"],cl={key:1,class:"wl-nick"},ul=["textContent"],ml=["textContent"],vl=["textContent"],dl=["textContent"],pl={class:"wl-comment-actions"},gl=["title","href"],hl=["title"],fl=["title"],wl={class:"wl-meta","aria-hidden":"true"},yl=["data-value","textContent"],bl={key:0,class:"wl-warning","aria-hidden":"true"},kl={key:1,class:"wl-content"},Cl={key:0},$l=["href"],Ll=["innerHTML"],Sl={key:2,class:"wl-admin-actions"},Il={class:"wl-comment-status"},El=["disabled","onClick","textContent"],Al={key:4,class:"wl-quote"};var Ml=ne({__name:"CommentCard",props:{comment:{},edit:{},rootId:{},reply:{}},emits:["log","submit","delete","like","sticky","edit","reply","status"],setup(e,{emit:a}){const t=a,l=["approved","waiting","spam"],n=Me(Ce),o=$t(),d=ta(),r=Se(),u=N(()=>n.value.locale),L=N(()=>{const{link:S}=e.comment;return S?pt(S)?S:`https://${S}`:""}),c=N(()=>o.value.includes(e.comment.objectId)),h=N(()=>Ia(new Date(e.comment.time),d.value,u.value)),R=N(()=>r.value.type==="administrator"),_=N(()=>e.comment.user_id&&r.value.objectId===e.comment.user_id),f=N(()=>{var S;return e.comment.objectId===((S=e.reply)==null?void 0:S.objectId)}),A=N(()=>{var S;return e.comment.objectId===((S=e.edit)==null?void 0:S.objectId)});return(S,v)=>{var z;const H=qe("CommentCard",!0);return i(),p("div",{id:e.comment.objectId.toString(),class:"wl-card-item"},[m("div",ll,[e.comment.avatar?(i(),p("img",{key:0,class:"wl-user-avatar",src:e.comment.avatar,alt:""},null,8,rl)):I("v-if",!0),e.comment.type==="guest"?(i(),Q(b(Xa),{key:1})):I("v-if",!0),e.comment.type==="administrator"?(i(),Q(b(Ya),{key:2})):I("v-if",!0)]),m("div",ol,[m("div",il,[L.value?(i(),p("a",{key:0,class:"wl-nick",href:L.value,target:"_blank",rel:"nofollow noopener noreferrer"},M(e.comment.nick),9,sl)):(i(),p("span",cl,M(e.comment.nick),1)),e.comment.label?(i(),p("span",{key:2,class:"wl-badge",textContent:M(e.comment.label)},null,8,ul)):I("v-if",!0),e.comment.sticky?(i(),p("span",{key:3,class:"wl-badge",textContent:M(u.value.sticky)},null,8,ml)):I("v-if",!0),typeof e.comment.level=="number"?(i(),p("span",{key:4,class:O(`wl-badge level${e.comment.level}`),textContent:M(u.value[`level${e.comment.level}`]||`Level ${e.comment.level}`)},null,10,vl)):I("v-if",!0),m("span",{class:"wl-time",textContent:M(h.value)},null,8,dl),m("div",pl,[R.value||_.value?(i(),p(G,{key:0},[m("button",{type:"button",class:"wl-edit",onClick:v[0]||(v[0]=E=>t("edit",e.comment))},[W(b(Za))]),m("button",{type:"button",class:"wl-delete",onClick:v[1]||(v[1]=E=>t("delete",e.comment))},[W(b(Pa))])],64)):I("v-if",!0),_.value?(i(),p("a",{key:1,role:"button",class:"wl-rss",title:u.value.subscribeToReplies,href:`${b(n).serverURL}/api/comment/rss?user_id=${e.comment.user_id}`,target:"_blank",rel:"noopener noreferrer"},[W(b(Qa))],8,gl)):I("v-if",!0),m("button",{type:"button",class:"wl-like",title:c.value?u.value.cancelLike:u.value.like,onClick:v[2]||(v[2]=E=>t("like",e.comment))},[W(b(qa),{active:c.value},null,8,["active"]),te(" "+M("like"in e.comment?e.comment.like:""),1)],8,hl),m("button",{type:"button",class:O(["wl-reply",{active:f.value}]),title:f.value?u.value.cancelReply:u.value.reply,onClick:v[3]||(v[3]=E=>t("reply",f.value?null:e.comment))},[W(b(Ka))],10,fl)])]),m("div",wl,[(i(),p(G,null,K(["addr","browser","os"],E=>(i(),p(G,null,[e.comment[E]?(i(),p("span",{key:E,class:O(`wl-${E}`),"data-value":e.comment[E],textContent:M(e.comment[E])},null,10,yl)):I("v-if",!0)],64))),64))]),e.comment.status==="waiting"&&!R.value?(i(),p("div",bl,M(u.value.commentUnderReview),1)):I("v-if",!0),A.value?I("v-if",!0):(i(),p("div",kl,["reply_user"in e.comment&&e.comment.reply_user?(i(),p("p",Cl,[m("a",{href:"#"+e.comment.pid},"@"+M(e.comment.reply_user.nick),9,$l),v[17]||(v[17]=m("span",null,": ",-1))])):I("v-if",!0),m("div",{innerHTML:e.comment.comment},null,8,Ll)])),R.value&&!A.value?(i(),p("div",Sl,[m("span",Il,[(i(),p(G,null,K(l,E=>m("button",{key:E,type:"submit",class:O(`wl-btn wl-${E}`),disabled:e.comment.status===E,onClick:U=>t("status",{status:E,comment:e.comment}),textContent:M(u.value[E])},null,10,El)),64))]),R.value&&!("rid"in e.comment)?(i(),p("button",{key:0,type:"submit",class:"wl-btn wl-sticky",onClick:v[4]||(v[4]=E=>t("sticky",e.comment))},M(e.comment.sticky?u.value.unsticky:u.value.sticky),1)):I("v-if",!0)])):I("v-if",!0),f.value||A.value?(i(),p("div",{key:3,class:O({"wl-reply-wrapper":f.value,"wl-edit-wrapper":A.value})},[W(It,{edit:e.edit,"reply-id":(z=e.reply)==null?void 0:z.objectId,"reply-user":e.comment.nick,"root-id":e.rootId,onLog:v[5]||(v[5]=E=>t("log")),onCancelReply:v[6]||(v[6]=E=>t("reply",null)),onCancelEdit:v[7]||(v[7]=E=>t("edit",null)),onSubmit:v[8]||(v[8]=E=>t("submit",E))},null,8,["edit","reply-id","reply-user","root-id"])],2)):I("v-if",!0),"children"in e.comment?(i(),p("div",Al,[(i(!0),p(G,null,K(e.comment.children,E=>(i(),Q(H,{key:E.objectId,comment:E,reply:e.reply,edit:e.edit,"root-id":e.rootId,onLog:v[9]||(v[9]=U=>t("log")),onDelete:v[10]||(v[10]=U=>t("delete",U)),onEdit:v[11]||(v[11]=U=>t("edit",U)),onLike:v[12]||(v[12]=U=>t("like",U)),onReply:v[13]||(v[13]=U=>t("reply",U)),onStatus:v[14]||(v[14]=U=>t("status",U)),onSticky:v[15]||(v[15]=U=>t("sticky",U)),onSubmit:v[16]||(v[16]=U=>t("submit",U))},null,8,["comment","reply","edit","root-id"]))),128))])):I("v-if",!0)])],8,nl)}}});const Et="3.12.0",Rl={"data-waline":""},xl={class:"wl-meta-head"},zl={class:"wl-count"},Ul=["textContent"],_l={class:"wl-sort"},jl=["onClick"],Vl={class:"wl-cards"},Hl={key:1,class:"wl-operation"},Fl=["textContent"],Tl={key:2,class:"wl-loading"},Nl=["textContent"],Bl={key:4,class:"wl-operation"},Pl=["textContent"],Wl={key:5,class:"wl-meta-foot"},Dl={class:"wl-rss"},ql=["href"],Gl=["textContent"],Ol=["href"],Kl=["textContent"],Zl={key:0,class:"wl-power"};var Xl=ne({__name:"WalineComment",props:{serverURL:{},path:{},meta:{},requiredMeta:{},wordLimit:{},pageSize:{},lang:{},locale:{},commentSorting:{},dark:{type:[String,Boolean]},login:{},noCopyright:{type:Boolean},recaptchaV3Key:{},turnstileKey:{},reaction:{type:[Array,Boolean]},emoji:{},search:{},highlighter:{type:Function},imageUploader:{type:Function},texRenderer:{type:Function}},setup(e){const a=e,t=Se(),l=$t(),n=x("loading"),o=x(0),d=x(1),r=x(0),u=N(()=>$a(a)),L=x(u.value.commentSorting),c=x([]),h=x(null),R=x(null),_=N(()=>La(u.value.dark)),f=N(()=>u.value.locale);aa(_,{id:"waline-darkmode"});let A=null;const S=C=>{const{serverURL:$,path:j,pageSize:B}=u.value,Z=new AbortController;n.value="loading",A==null||A(),Wt({serverURL:$,lang:u.value.lang,path:j,pageSize:B,sortBy:mt[L.value],page:C,signal:Z.signal,token:t.value.token}).then(P=>{n.value="success",o.value=P.count,c.value.push(...P.data),d.value=C,r.value=P.totalPages}).catch(P=>{P.name!=="AbortError"&&(console.error(P.message),n.value="error")}),A=Z.abort.bind(Z)},v=()=>{S(d.value+1)},z=()=>{o.value=0,c.value=[],S(1)},H=C=>{L.value!==C&&(L.value=C,z())},E=C=>{h.value=C},U=C=>{R.value=C},le=C=>{if(R.value)R.value.comment=C.comment,R.value.orig=C.orig;else if("rid"in C){const $=c.value.find(({objectId:j})=>j===C.rid);if(!$)return;Array.isArray($.children)||($.children=[]),$.children.push(C)}else c.value.unshift(C),o.value+=1},re=async({comment:C,status:$})=>{if(C.status===$)return;const{serverURL:j,lang:B}=u.value;await we({serverURL:j,lang:B,token:t.value.token,objectId:C.objectId,comment:{status:$}}),C.status=$},J=async C=>{if("rid"in C)return;const{serverURL:$,lang:j}=u.value;await we({serverURL:$,lang:j,token:t.value.token,objectId:C.objectId,comment:{sticky:C.sticky?0:1}}),C.sticky=!C.sticky},oe=async({objectId:C})=>{if(!confirm("Are you sure you want to delete this comment?"))return;const{serverURL:$,lang:j}=u.value;await Pt({serverURL:$,lang:j,token:t.value.token,objectId:C}),c.value.some((B,Z)=>B.objectId===C?(c.value=c.value.filter((P,ae)=>ae!==Z),!0):B.children.some((P,ae)=>P.objectId===C?(c.value[Z].children=B.children.filter((F,ie)=>ie!==ae),!0):!1))},me=async C=>{const{serverURL:$,lang:j}=u.value,{objectId:B}=C,Z=l.value.includes(B);await we({serverURL:$,lang:j,objectId:B,token:t.value.token,comment:{like:!Z}}),Z?l.value=l.value.filter(P=>P!==B):(l.value=[...l.value,B],l.value.length>50&&(l.value=l.value.slice(-50))),C.like=Math.max(0,(C.like||0)+(Z?-1:1))};return Jt(Ce,u),ve(()=>{ce(()=>[a.serverURL,a.path],()=>{z()})}),Pe(()=>{A==null||A()}),(C,$)=>(i(),p("div",Rl,[W(yn),!h.value&&!R.value?(i(),Q(It,{key:0,onLog:z,onSubmit:le})):I("v-if",!0),m("div",xl,[m("div",zl,[o.value?(i(),p("span",{key:0,class:"wl-num",textContent:M(o.value)},null,8,Ul)):I("v-if",!0),te(" "+M(f.value.comment),1)]),m("ul",_l,[(i(!0),p(G,null,K(b(ka),j=>(i(),p("li",{key:j,class:O([j===L.value?"active":""]),onClick:B=>H(j)},M(f.value[j]),11,jl))),128))])]),m("div",Vl,[(i(!0),p(G,null,K(c.value,j=>(i(),Q(Ml,{key:j.objectId,"root-id":j.objectId,comment:j,reply:h.value,edit:R.value,onLog:z,onReply:E,onEdit:U,onSubmit:le,onStatus:re,onDelete:oe,onSticky:J,onLike:me},null,8,["root-id","comment","reply","edit"]))),128))]),n.value==="error"?(i(),p("div",Hl,[m("button",{type:"button",class:"wl-btn",onClick:z,textContent:M(f.value.refresh)},null,8,Fl)])):n.value==="loading"?(i(),p("div",Tl,[W(b(pe),{size:30})])):c.value.length?d.value<r.value?(i(),p("div",Bl,[m("button",{type:"button",class:"wl-btn",onClick:v,textContent:M(f.value.more)},null,8,Pl)])):I("v-if",!0):(i(),p("div",{key:3,class:"wl-empty",textContent:M(f.value.sofa)},null,8,Nl)),c.value.length||n.value!=="loading"?(i(),p("div",Wl,[m("div",Dl,[m("a",{href:`${u.value.serverURL}/api/comment/rss?path=${encodeURIComponent(u.value.path)}`,target:"_blank",rel:"noopener noreferrer"},[W(b(Ct)),m("span",{textContent:M(f.value.subPostComment)},null,8,Gl)],8,ql),m("a",{href:`${u.value.serverURL}/api/comment/rss`,target:"_blank",rel:"noopener noreferrer"},[W(b(Ct)),m("span",{textContent:M(f.value.subSiteComment)},null,8,Kl)],8,Ol)]),u.value.noCopyright?I("v-if",!0):(i(),p("div",Zl,[$[0]||($[0]=te(" Powered by ",-1)),$[1]||($[1]=m("a",{href:"https://github.com/walinejs/waline",target:"_blank",rel:"noopener noreferrer"}," Waline ",-1)),te(" v"+M(b(Et)),1)]))])):I("v-if",!0)]))}});const At=(e,a)=>{a.forEach((t,l)=>{const n=e[l].time;typeof n=="number"&&(t.textContent=n.toString())})},Mt=({serverURL:e,path:a=window.location.pathname,selector:t=".waline-pageview-count",update:l=!0,lang:n=navigator.language})=>{const o=new AbortController,d=[...document.querySelectorAll(t)],r=L=>{const c=je(L);return c!=null&&a!==c},u=L=>qt({serverURL:$e(e),paths:L.map(c=>je(c)??a),lang:n,signal:o.signal}).then(c=>{At(c,L)}).catch(ft);if(l){const L=d.filter(h=>!r(h)),c=d.filter(h=>r(h));Dt({serverURL:$e(e),path:a,lang:n}).then(h=>{At(h,L)}),c.length>0&&u(c)}else u(d);return o.abort.bind(o)},Yl=({el:e="#waline",path:a=window.location.pathname,comment:t=!1,pageview:l=!1,...n})=>{const o=e?Le(e):null;if(e&&!o)throw new Error("Option 'el' do not match any domElement!");if(!n.serverURL)throw new Error("Option 'serverURL' is missing!");const d=xe({...n}),r=xe({comment:t,pageview:l,path:a}),u=()=>{r.comment&&bt({serverURL:d.serverURL,path:r.path,...ue(r.comment)?{selector:r.comment}:{}})},L=()=>{r.pageview&&Mt({serverURL:d.serverURL,path:r.path,...ue(r.pageview)?{selector:r.pageview}:{}})};let c=null;o&&(c=Ge(()=>k(Xl,{path:r.path,...d})),c.mount(o));const h=Oe(u),R=Oe(L);return{el:o,update:({comment:_,pageview:f,path:A=window.location.pathname,...S}={})=>{Object.entries(S).forEach(([v,z])=>{d[v]=z}),r.path=A,_!=null&&(r.comment=_),f!=null&&(r.pageview=f)},destroy:()=>{c==null||c.unmount(),h(),R()}}},Jl=({el:e,serverURL:a,count:t,lang:l=navigator.language})=>{const n=Se(),o=Le(e),d=new AbortController;return Gt({serverURL:a,count:t,lang:l,signal:d.signal,token:n.value.token}).then(r=>o&&r.length>0?(o.innerHTML=`<ul class="wl-recent-list">${r.map(u=>`<li class="wl-recent-item"><a href="${u.url}">${u.nick}</a>:${u.comment}</li>`).join("")}</ul>`,{comments:r,destroy:()=>{d.abort(),o.innerHTML=""}}):{comments:r,destroy:()=>{d.abort()}})},Ql=({el:e,serverURL:a,count:t,locale:l,lang:n=navigator.language,mode:o="list"})=>{const d=Le(e),r=new AbortController;return Ot({serverURL:a,pageSize:t,lang:n,signal:r.signal}).then(u=>{if(!d||u.length===0)return{users:u,destroy:()=>{r.abort()}};const L={...ct(n),...typeof l=="object"?l:{}};return d.innerHTML=`<ul class="wl-user-${o}">${u.map((c,h)=>[`<li class="wl-user-item" aria-label="${c.nick}">`,c.link?`<a href="${c.link}" target="_blank">`:"",'<div class="wl-user-avatar">',`<img src="${c.avatar}" alt="${c.nick}">`,`<span class="wl-user-badge">${h+1}</span>`,"</div>",'<div class="wl-user-meta">','<div class="wl-user-name">',c.nick,typeof c.level=="number"?`<span class="wl-badge">${L[`level${c.level}`]??`Level ${c.level}`}</span>`:"",c.label?`<span class="wl-badge">${c.label}</span>`:"","</div>",c.link,"</div>",c.link?"</a>":"","</li>"].filter(Boolean).join("")).join("")}</ul>`,{users:u,destroy:()=>{r.abort(),d.innerHTML=""}}})},er=async({serverURL:e,lang:a,path:t})=>{const l=[1,2,3,4,5],n=new AbortController,o=n.abort.bind(n),[d]=await Be({serverURL:e,lang:a,paths:[t],type:Array.from({length:5},(r,u)=>`reaction${u}`),signal:n.signal});return{value:l.map((r,u)=>d[`reaction${u}`]),abort:o}},Ve=e=>{if(Number.isNaN(e))return 0;const a=Math.round(e);return Math.min(5,Math.max(0,a))},Rt=(e=[])=>Array.from({length:5},(a,t)=>{const l=e[t]??0;return typeof l=="number"&&l>0?l:0});var tr=ne({name:"WalineStarDisplay",props:{score:{type:Number,default:0}},setup(e){const a=N(()=>Ve(e.score));return{displayScore:a,displayClass:t=>a.value>=t?"wl-star-solid":"wl-star-outline"}}}),xt=(e,a)=>{const t=e.__vccOpts||e;for(const[l,n]of a)t[l]=n;return t};const ar={class:"wl-star-icon",viewBox:"0 0 24 24"};function nr(e,a,t,l,n,o){return i(),p(G,null,K([1,2,3,4,5],d=>m("span",{key:d,class:"wl-star-item"},[(i(),p("svg",ar,[m("path",{class:O(e.displayClass(d)),d:"M12 2l3.09 6.26L22 9.27l-5 4.87L18.18 22 12 18.56 5.82 22 7 14.14l-5-4.87 6.91-1.01L12 2z"},null,2)]))])),64)}var lr=xt(tr,[["render",nr]]),rr=ne({name:"WalineStarWidget",components:{StarDisplay:lr},props:{path:{type:String,default:""},serverURL:{type:String,default:""},lang:{type:String,default:""}},emits:["rate"],setup(e,{emit:a}){const t=x(null),l=Lt(),n=x(Ve((l.value[e.path]??0)+1)),o=x(null),d=x(Rt([])),r=x(!1);ve(()=>{ce(()=>[e.serverURL,e.path],async()=>{try{const v=await er({serverURL:e.serverURL,path:e.path,lang:e.lang});d.value=Rt(v.value)}catch(v){console.error("Failed to fetch reaction data:",v)}})});const u=N(()=>o.value??n.value),L=N(()=>d.value.reduce((v,z)=>v+z,0)),c=N(()=>d.value.map(v=>L.value?v/L.value:0)),h=v=>{if(!t.value)return 0;const{firstElementChild:z,lastElementChild:H}=t.value;if(!z||!H)return 0;const{left:E}=z.getBoundingClientRect(),{right:U}=H.getBoundingClientRect(),le=U-E,re=(v.clientX-E)/le,J=Math.min(1,Math.max(0,re))*5;return Ve(J)},R=v=>{o.value=h(v)},_=()=>{o.value=null},f=async v=>{const z=o.value??h(v);if(z===n.value||r.value)return;r.value=!0;const H=n.value,E={serverURL:e.serverURL,lang:e.lang,path:e.path};try{H&&(await fe({...E,type:`reaction${H-1}`,action:"desc"}),d.value[H-1]=Math.max(0,(d.value[H-1]??0)-1)),n.value=z;const U=z-1;l.value[e.path]=U,await fe({serverURL:e.serverURL,lang:e.lang,path:e.path,type:`reaction${U}`,action:"inc"}),d.value[U]=(d.value[U]??0)+1,a("rate",z)}catch(U){n.value=H,H?l.value[e.path]=H-1:delete l.value[e.path],console.error("[Waline] Failed to update reaction counter",U)}finally{r.value=!1}};function A(v){return d.value[v-1]??0}function S(v){return`${((c.value[v-1]??0)*100).toFixed(1)}%`}return{ratingArea:t,displayScore:u,onMouseMove:R,onMouseLeave:_,onClick:f,countFor:A,percentText:S}}});const or={class:"wl-star"},ir={class:"wl-star-score"},sr={class:"wl-star-rate"},cr={class:"wl-star-progress"},ur=["data-count"],mr={class:"wl-star-percent"};function vr(e,a,t,l,n,o){const d=qe("StarDisplay");return i(),p("div",or,[m("div",{ref:"ratingArea",class:"wl-star-rate",onMousemove:a[0]||(a[0]=(...r)=>e.onMouseMove&&e.onMouseMove(...r)),onMouseleave:a[1]||(a[1]=(...r)=>e.onMouseLeave&&e.onMouseLeave(...r)),onClick:a[2]||(a[2]=(...r)=>e.onClick&&e.onClick(...r))},[W(d,{score:e.displayScore},null,8,["score"])],544),m("div",ir,[(i(),p(G,null,K([5,4,3,2,1],r=>m("div",{key:r,class:"wl-star-row"},[m("div",sr,[W(d,{score:r},null,8,["score"])]),m("div",cr,[m("div",{class:"wl-star-progress-bar",style:ye({width:e.percentText(r)}),"data-count":e.countFor(r).toString()},null,12,ur)]),m("span",mr,M(e.percentText(r)),1)])),64))])])}var dr=xt(rr,[["render",vr]]);const pr=({el:e,path:a,lang:t=navigator.language,serverURL:l,onRate:n})=>{const o=Le(e);if(!o)return{destroy:()=>{}};const d=Ge(dr,{path:a,lang:t,serverURL:l,onRate:n});return d.mount(o),{destroy:()=>{d.unmount(),o.innerHTML=""}}};export{Jl as RecentComments,pr as Star,Ql as UserList,bt as commentCount,ke as defaultLocales,Yl as init,Mt as pageviewCount,Et as version};
13
14
  //# sourceMappingURL=slim.js.map