@waline/client 3.2.4 → 3.2.5

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 v="3.2.4",$={"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),U=({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),R=({serverURL:e,lang:t,paths:r,signal:o})=>f({serverURL:e,lang:t,paths:r,type:["time"],signal:o}),w=e=>U({...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},y=(e,t)=>{t.forEach((r,o)=>{const a=e[o].time;typeof a=="number"&&(r.innerText=a.toString())})},S=({serverURL:e,path:t=window.location.pathname,selector:r=".waline-pageview-count",update:o=!0,lang:a=navigator.language})=>{const n=new AbortController,i=Array.from(document.querySelectorAll(r)),p=l=>{const s=m(l);return s!==null&&t!==s},g=l=>R({serverURL:d(e),paths:l.map(s=>m(s)??t),lang:a,signal:n.signal}).then(s=>y(s,l)).catch(j);if(o){const l=i.filter(c=>!p(c)),s=i.filter(p);w({serverURL:d(e),path:t,lang:a}).then(c=>y(c,l)),s.length&&g(s)}else g(i);return n.abort.bind(n)};export{S as pageviewCount,v as version};
1
+ const v="3.2.5",$={"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),U=({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),R=({serverURL:e,lang:t,paths:r,signal:o})=>f({serverURL:e,lang:t,paths:r,type:["time"],signal:o}),w=e=>U({...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},y=(e,t)=>{t.forEach((r,o)=>{const a=e[o].time;typeof a=="number"&&(r.innerText=a.toString())})},S=({serverURL:e,path:t=window.location.pathname,selector:r=".waline-pageview-count",update:o=!0,lang:a=navigator.language})=>{const n=new AbortController,i=Array.from(document.querySelectorAll(r)),p=l=>{const s=m(l);return s!==null&&t!==s},g=l=>R({serverURL:d(e),paths:l.map(s=>m(s)??t),lang:a,signal:n.signal}).then(s=>y(s,l)).catch(j);if(o){const l=i.filter(c=>!p(c)),s=i.filter(p);w({serverURL:d(e),path:t,lang:a}).then(c=>y(c,l)),s.length&&g(s)}else g(i);return n.abort.bind(n)};export{S as pageviewCount,v as version};
2
2
  //# sourceMappingURL=pageview.js.map
package/dist/slim.js CHANGED
@@ -1,11 +1,11 @@
1
- import{fetchCommentCount as Et,getArticleCounter as St,updateArticleCounter as We,updateComment as fe,addComment as xt,login as jt,getComment as Mt,deleteComment as At,updatePageview as Ut,getPageview as zt,getRecentComment as Tt,getUserList as Vt}from"@waline/api";export*from"@waline/api";import{h as C,defineComponent as me,inject as Re,ref as p,computed as T,onMounted as we,watch as $,onUnmounted as Be,openBlock as c,createElementBlock as d,createElementVNode as m,toDisplayString as I,Fragment as V,renderList as O,normalizeClass as P,createBlock as ee,createCommentVNode as k,onBeforeUnmount as Ht,nextTick as Fe,normalizeStyle as Oe,reactive as Ee,getCurrentInstance as Pt,createVNode as W,withDirectives as ye,vModelDynamic as Nt,vModelText as Dt,vShow as qe,createTextVNode as te,resolveComponent as Wt,provide as Bt,createApp as Ft,watchEffect as Ge}from"vue";import{useStorage as ie,useScriptTag as Ot,useDebounceFn as qt,useEventListener as Ke,useNow as Gt,useStyleTag as Kt}from"@vueuse/core";import Ze from"autosize";import{Marked as Zt}from"marked";import{markedHighlight as Xt}from"marked-highlight";import{load as Yt}from"recaptcha-v3";const Jt=["nick","mail","link"],Xe=n=>n.filter(o=>Jt.includes(o)),Ye=["//unpkg.com/@waline/emojis@1.1.0/weibo"],Qt=["//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"],$t=n=>new Promise((o,t)=>{if(n.size>128e3)return t(new Error("File too large! File size limit 128KB"));const e=new FileReader;e.readAsDataURL(n),e.onload=()=>{var i;return o(((i=e.result)==null?void 0:i.toString())??"")},e.onerror=t}),en=n=>n===!0?'<p class="wl-tex">TeX is not available in preview</p>':'<span class="wl-tex">TeX is not available in preview</span>',tn=n=>{const o=async(t,e={})=>fetch(`https://api.giphy.com/v1/gifs/${t}?${new URLSearchParams({lang:n,limit:"20",rating:"g",api_key:"6CIMLkNMMOhRcXPoMCPkFy4Ybk2XUiMp",...e}).toString()}`).then(i=>i.json()).then(({data:i})=>i.map(s=>({title:s.title,src:s.images.downsized_medium.url})));return{search:t=>o("search",{q:t,offset:"0"}),default:()=>o("trending",{}),more:(t,e=0)=>o("search",{q:t,offset:e.toString()})}},nn=/[\u4E00-\u9FFF\u3400-\u4dbf\uf900-\ufaff\u3040-\u309f\uac00-\ud7af\u0400-\u04FF]+|\w+/,on=/</,ln=/(?:^|\s)\/\/(.+?)$/gm,an=/\/\*([\S\s]*?)\*\//gm,rn=new RegExp(`(${nn.source}|${on.source})|((?:${ln.source})|(?:${an.source}))`,"gmi"),Je=["23AC69","91C132","F19726","E8552D","1AAB8E","E1147F","2980C1","1BA1E6","9FA0A0","F19726","E30B20","E30B20","A3338B"],Se={},sn=n=>{let o=0;return n.replace(rn,(t,e,i)=>{if(i)return`<span style="color: slategray">${i}</span>`;if(e==="<")return"&lt;";let s;Se[e]?s=Se[e]:(s=Je[o],Se[e]=s);const r=`<span style="color: #${s}">${e}</span>`;return o=++o%Je.length,r})},cn=["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"],ne=n=>Object.fromEntries(n.map((o,t)=>[cn[t],o]));var Qe=ne(["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?"]),$e=ne(["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 !
3
- 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 ?"]),et=ne(["ニックネーム","3バイト以上のニックネームをご入力ください.","メールアドレス","メールアドレスをご確認ください.","サイト","オプション","ここにコメント","コメントしましょう~","提出する","Like","Cancel like","返信する","キャンセル","コメント","更新","さらに読み込む","プレビュー","絵文字","画像をアップロード","秒前","分前","時間前","日前","たっだ今","アップロード","ログインする","ログアウト","管理者","トップに置く","ワード",`コメントは $0 から $1 ワードの間でなければなりません!
4
- 現在の単語番号: $2`,"匿名","うえにん","なかにん","しもおし","特にしもおし","かげ","なぬし","GIF","探す GIF","個人情報","承認済み","待っている","スパム","べたつかない","逆順","正順","人気順","どう思いますか?"]),un=ne(["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!
5
- 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?"]),tt=ne(["Псевдоним","Никнейм не может быть меньше 3 байт.","Эл. адрес","Пожалуйста, подтвердите адрес вашей электронной почты.","Веб-сайт","Необязательный","Комментарий здесь...","Пока нет комментариев.","Отправить","Like","Cancel like","Отвечать","Отменить ответ","Комментарии","Обновить","Загрузи больше...","Превью","эмодзи","Загрузить изображение","секунд назад","несколько минут назад","несколько часов назад","дней назад","прямо сейчас","Загрузка","Авторизоваться","Выход из системы","Админ","Липкий","Слова",`Пожалуйста, введите комментарии от $0 до $1 слов!
6
- Номер текущего слова: $2`,"Анонимный","Dwarves","Hobbits","Ents","Wizards","Elves","Maiar","GIF","Поиск GIF","Персональные данные","Одобренный","Ожидающий","Спам","Нелипкий","самый старый","последний","самый горячий","Что вы думаете?"]),nt=ne(["Tên","Tên không được nhỏ hơn 3 ký tự.","E-Mail","Vui lòng xác nhập địa chỉ email của bạn.","Website","Tùy chọn","Hãy bình luận có văn hoá!","Chưa có bình luận","Gửi","Thích","Bỏ thích","Trả lời","Hủy bỏ","bình luận","Làm mới","Tải thêm...","Xem trước","Emoji","Tải lên hình ảnh","giây trước","phút trước","giờ trước","ngày trước","Vừa xong","Đang tải lên","Đăng nhập","đăng xuất","Quản trị viên","Dính","từ",`Bình luận phải có độ dài giữa $0 và $1 từ!
7
- 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?"]),ot=ne(["昵称","昵称不能少于3个字符","邮箱","请填写正确的邮件地址","网址","可选","欢迎评论","来发评论吧~","提交","喜欢","取消喜欢","回复","取消回复","评论","刷新","加载更多...","预览","表情","上传图片","秒前","分钟前","小时前","天前","刚刚","正在上传","登录","退出","博主","置顶","字",`评论字数应在 $0 到 $1 字之间!
8
- 当前字数:$2`,"匿名","潜水","冒泡","吐槽","活跃","话痨","传说","表情包","搜索表情包","个人资料","通过","待审核","垃圾","取消置顶","按倒序","按正序","按热度","你认为这篇文章怎么样?"]),dn=ne(["暱稱","暱稱不能少於3個字元","郵箱","請填寫正確的郵件地址","網址","可選","歡迎留言","來發留言吧~","送出","喜歡","取消喜歡","回覆","取消回覆","留言","重整","載入更多...","預覽","表情","上傳圖片","秒前","分鐘前","小時前","天前","剛剛","正在上傳","登入","登出","管理者","置頂","字",`留言字數應在 $0 到 $1 字之間!
9
- 目前字數:$2`,"匿名","潛水","冒泡","吐槽","活躍","多話","傳說","表情包","搜尋表情包","個人資料","通過","待審核","垃圾","取消置頂","最早","最新","熱門","你認為這篇文章怎麼樣?"]);const lt="en-US",be={zh:ot,"zh-cn":ot,"zh-tw":dn,en:Qe,"en-us":Qe,fr:$e,"fr-fr":$e,jp:et,"jp-jp":et,"pt-br":un,ru:tt,"ru-ru":tt,vi:nt,"vi-vn":nt},at=n=>be[n.toLowerCase()]||be[lt],mn=n=>Object.keys(be).includes(n.toLowerCase())?n:lt,it=n=>{try{n=decodeURI(n)}catch{}return n},rt=(n="")=>n.replace(/\/$/u,""),st=n=>/^(https?:)?\/\//.test(n),pe=n=>{const o=rt(n);return st(o)?o:`https://${o}`},vn=n=>Array.isArray(n)?n:n?[0,n]:!1,xe=(n,o)=>typeof n=="function"?n:n===!1?!1:o,gn=({serverURL:n,path:o=location.pathname,lang:t=typeof navigator>"u"?"en-US":navigator.language,locale:e,emoji:i=Ye,meta:s=["nick","mail","link"],requiredMeta:r=[],dark:u=!1,pageSize:l=10,wordLimit:a,imageUploader:g,highlighter:b,texRenderer:j,copyright:f=!0,login:S="enable",search:R,reaction:_,recaptchaV3Key:L="",turnstileKey:M="",commentSorting:x="latest",...q})=>({serverURL:pe(n),path:it(o),lang:mn(t),locale:{...at(t),...typeof e=="object"?e:{}},wordLimit:vn(a),meta:Xe(s),requiredMeta:Xe(r),imageUploader:xe(g,$t),highlighter:xe(b,sn),texRenderer:xe(j,en),dark:u,emoji:typeof i=="boolean"?i?Ye:[]:i,pageSize:l,login:S,copyright:f,search:R===!1?!1:typeof R=="object"?R:tn(t),recaptchaV3Key:L,turnstileKey:M,reaction:Array.isArray(_)?_:_===!0?Qt:[],commentSorting:x,...q}),re=n=>typeof n=="string",je="{--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}",hn=n=>re(n)?n==="auto"?`@media(prefers-color-scheme:dark){body${je}}`:`${n}${je}`:n===!0?`:root${je}`:"",Me=(n,o)=>{let t=n.toString();for(;t.length<o;)t="0"+t;return t},fn=n=>{const o=Me(n.getDate(),2),t=Me(n.getMonth()+1,2);return`${Me(n.getFullYear(),2)}-${t}-${o}`},wn=(n,o,t)=>{if(!n)return"";const e=re(n)?new Date(n.indexOf(" ")!==-1?n.replace(/-/g,"/"):n):n,i=o.getTime()-e.getTime(),s=Math.floor(i/(24*3600*1e3));if(s===0){const r=i%864e5,u=Math.floor(r/(3600*1e3));if(u===0){const l=r%36e5,a=Math.floor(l/(60*1e3));if(a===0){const g=l%6e4;return`${Math.round(g/1e3)} ${t.seconds}`}return`${a} ${t.minutes}`}return`${u} ${t.hours}`}return s<0?t.now:s<8?`${s} ${t.days}`:fn(e)},yn=/^[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])?)*$/,bn=n=>yn.test(n),pn=n=>!!/@[0-9]+\.[0-9]+\.[0-9]+/.test(n),kn=n=>{const o=ie("WALINE_EMOJI",{}),t=pn(n);if(t){const e=o.value[n];if(e)return Promise.resolve(e)}return fetch(`${n}/info.json`).then(e=>e.json()).then(e=>{const i={folder:n,...e};return t&&(o.value[n]=i),i})},ct=(n,o="",t="",e="")=>`${o?`${o}/`:""}${t}${n}${e?`.${e}`:""}`,_n=n=>Promise.all(n.map(o=>re(o)?kn(rt(o)):Promise.resolve(o))).then(o=>{const t={tabs:[],map:{}};return o.forEach(e=>{const{name:i,folder:s,icon:r,prefix:u="",type:l,items:a}=e;t.tabs.push({name:i,icon:ct(r,s,u,l),items:a.map(g=>{const b=`${u}${g}`;return t.map[b]=ct(g,s,u,l),b})})}),t}),ut=n=>{n.name!=="AbortError"&&console.error(n.message)},Ae=n=>n instanceof HTMLElement?n:re(n)?document.querySelector(n):null,Cn=n=>n.type.includes("image"),dt=n=>{const o=Array.from(n).find(Cn);return o?o.getAsFile():null},In=/\$.*?\$/,Ln=/^\$(.*?)\$/,Rn=/^(?:\s{0,3})\$\$((?:[^\n]|\n[^\n])+?)\n{0,1}\$\$/,En=n=>[{name:"blockMath",level:"block",tokenizer(o){const t=Rn.exec(o);if(t!==null)return{type:"html",raw:t[0],text:n(!0,t[1])}}},{name:"inlineMath",level:"inline",start(o){const t=o.search(In);return t!==-1?t:o.length},tokenizer(o){const t=Ln.exec(o);if(t!==null)return{type:"html",raw:t[0],text:n(!1,t[1])}}}],mt=(n="",o={})=>n.replace(/:(.+?):/g,(t,e)=>o[e]?`<img class="wl-emoji" src="${o[e]}" alt="${e}">`:t),Sn=(n,{emojiMap:o,highlighter:t,texRenderer:e})=>{const i=new Zt;if(i.setOptions({breaks:!0}),t&&i.use(Xt({highlight:t})),e){const s=En(e);i.use({extensions:s})}return i.parse(mt(n,o))},Ue=n=>{const{path:o}=n.dataset;return o!=null&&o.length?o:null},xn=n=>n.match(/[\w\d\s,.\u00C0-\u024F\u0400-\u04FF]+/giu),jn=n=>n.match(/[\u4E00-\u9FD5]/gu),Mn=n=>{var o,t;return(((o=xn(n))==null?void 0:o.reduce((e,i)=>e+(["",",","."].includes(i.trim())?0:i.trim().split(/\s+/u).length),0))??0)+(((t=jn(n))==null?void 0:t.length)??0)},An=async()=>{if(!navigator)return"";const{userAgentData:n}=navigator;let o=navigator.userAgent;if(!n||n.platform!=="Windows")return o;const{platformVersion:t}=await n.getHighEntropyValues(["platformVersion"]);return t&&parseInt(t.split(".")[0])>=13&&(o=o.replace("Windows NT 10.0","Windows NT 11.0")),o},vt=({serverURL:n,path:o=window.location.pathname,selector:t=".waline-comment-count",lang:e=navigator.language})=>{const i=new AbortController,s=document.querySelectorAll(t);return s.length&&Et({serverURL:pe(n),paths:Array.from(s).map(r=>it(Ue(r)??o)),lang:e,signal:i.signal}).then(r=>{s.forEach((u,l)=>{u.innerText=r[l].toString()})}).catch(ut),i.abort.bind(i)},Un=({size:n})=>C("svg",{class:"wl-close-icon",viewBox:"0 0 1024 1024",width:n,height:n},[C("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"}),C("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"})]),zn=()=>C("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},C("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"})),Tn=()=>C("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},C("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"})),Vn=()=>C("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},[C("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"}),C("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"})]),Hn=({active:n=!1})=>C("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},[C("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${n?"":"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:n?"red":"currentColor"})]),Pn=()=>C("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},[C("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"}),C("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"})]),Nn=()=>C("svg",{width:"16",height:"16",ariaHidden:"true"},C("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"})),Dn=()=>C("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},C("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"})),Wn=()=>C("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},C("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"})),Bn=()=>C("svg",{class:"verified-icon",viewBox:"0 0 1024 1024",width:"14",height:"14"},C("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"})),ke=({size:n=100})=>C("svg",{width:n,height:n,viewBox:"0 0 100 100",preserveAspectRatio:"xMidYMid"},C("circle",{cx:50,cy:50,fill:"none",stroke:"currentColor",strokeWidth:"4",r:"40","stroke-dasharray":"85 30"},C("animateTransform",{attributeName:"transform",type:"rotate",repeatCount:"indefinite",dur:"1s",values:"0 50 50;360 50 50",keyTimes:"0;1"}))),Fn=()=>C("svg",{width:24,height:24,fill:"currentcolor",viewBox:"0 0 24 24"},[C("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"}),C("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"})]),On=()=>ie("WALINE_USER_META",{nick:"",mail:"",link:""}),qn=()=>ie("WALINE_COMMENT_BOX_EDITOR",""),Gn="WALINE_LIKE";let gt=null;const ht=()=>gt??(gt=ie(Gn,[])),Kn="WALINE_REACTION";let ft=null;const Zn=()=>ft??(ft=ie(Kn,{})),wt={},Xn=n=>{const o=wt[n]??(wt[n]=Yt(n,{useRecaptchaNet:!0,autoHideBadge:!0}));return{execute:t=>o.then(e=>e.execute(t))}},Yn=n=>({execute:async o=>{const{load:t}=Ot("https://challenges.cloudflare.com/turnstile/v0/api.js",void 0,{async:!1});await t();const e=window==null?void 0:window.turnstile;return new Promise(i=>{e==null||e.ready(()=>{e==null||e.render(".wl-captcha-container",{sitekey:n,action:o,size:"compact",callback:i})})})}}),Jn="WALINE_USER";let yt=null;const _e=()=>yt??(yt=ie(Jn,{}));var Qn=me({__name:"ArticleReaction",setup(n,{expose:o}){o();const t=Zn(),e=Re("config"),i=p(-1),s=p([]),r=T(()=>e.value.locale),u=T(()=>e.value.reaction.length>0),l=T(()=>{const{reaction:f,path:S}=e.value;return f.map((R,_)=>({icon:R,desc:r.value[`reaction${_}`],active:t.value[S]===_}))});let a;const g=async()=>{if(!u.value)return;const{serverURL:f,lang:S,path:R,reaction:_}=e.value,L=new AbortController;a=L.abort.bind(L);const M=await St({serverURL:f,lang:S,paths:[R],type:_.map((x,q)=>`reaction${q}`),signal:L.signal});s.value=_.map((x,q)=>M[0][`reaction${q}`])},b=async f=>{if(i.value===-1){const{serverURL:S,lang:R,path:_}=e.value,L=t.value[_];i.value=f,L!==void 0&&(await We({serverURL:S,lang:R,path:_,type:`reaction${L}`,action:"desc"}),s.value[L]=Math.max(s.value[L]-1,0)),L!==f&&(await We({serverURL:S,lang:R,path:_,type:`reaction${f}`}),s.value[f]=(s.value[f]||0)+1),L===f?delete t.value[_]:t.value[_]=f,i.value=-1}};we(()=>{$(()=>[e.value.serverURL,e.value.path],()=>{g()},{immediate:!0})}),Be(()=>a==null?void 0:a());const j={reactionStorage:t,config:e,votingIndex:i,voteNumbers:s,locale:r,isReactionEnabled:u,reactionsInfo:l,get abort(){return a},set abort(f){a=f},fetchReaction:g,vote:b,get LoadingIcon(){return ke}};return Object.defineProperty(j,"__isScriptSetup",{enumerable:!1,value:!0}),j}}),ve=(n,o)=>{const t=n.__vccOpts||n;for(const[e,i]of o)t[e]=i;return t};const $n={key:0,class:"wl-reaction"},eo=["textContent"],to={class:"wl-reaction-list"},no=["onClick"],oo={class:"wl-reaction-img"},lo=["src","alt"],ao=["textContent"],io=["textContent"];function ro(n,o,t,e,i,s){return e.reactionsInfo.length?(c(),d("div",$n,[m("div",{class:"wl-reaction-title",textContent:I(e.locale.reactionTitle)},null,8,eo),m("ul",to,[(c(!0),d(V,null,O(e.reactionsInfo,({active:r,icon:u,desc:l},a)=>(c(),d("li",{key:a,class:P(["wl-reaction-item",{active:r}]),onClick:g=>e.vote(a)},[m("div",oo,[m("img",{src:u,alt:l},null,8,lo),e.votingIndex===a?(c(),ee(e.LoadingIcon,{key:0,class:"wl-reaction-loading"})):(c(),d("div",{key:1,class:"wl-reaction-votes",textContent:I(e.voteNumbers[a]||0)},null,8,ao))]),m("div",{class:"wl-reaction-text",textContent:I(l)},null,8,io)],10,no))),128))])])):k("v-if",!0)}var so=ve(Qn,[["render",ro],["__file","ArticleReaction.vue"]]),co=me({__name:"ImageWall",props:{items:{default:()=>[]},columnWidth:{default:300},gap:{default:0}},emits:["insert"],setup(n,{expose:o}){const t=n;o();let e=null;const i=p(null),s=p({}),r=p([]),u=()=>{const f=Math.floor((i.value.getBoundingClientRect().width+t.gap)/(t.columnWidth+t.gap));return f>0?f:1},l=f=>new Array(f).fill(null).map(()=>[]),a=async f=>{var S;if(f>=t.items.length)return;await Fe();const R=Array.from(((S=i.value)==null?void 0:S.children)??[]).reduce((_,L)=>L.getBoundingClientRect().height<_.getBoundingClientRect().height?L:_);r.value[Number(R.dataset.index)].push(f),await a(f+1)},g=async(f=!1)=>{if(r.value.length===u()&&!f)return;r.value=l(u());const S=window.scrollY;await a(0),window.scrollTo({top:S})},b=f=>{s.value[f.target.src]=!0};we(()=>{g(!0),e=new ResizeObserver(()=>{g()}),e.observe(i.value),$(()=>[t.items],()=>{s.value={},g(!0)}),$(()=>[t.columnWidth,t.gap],()=>{g()})}),Ht(()=>e.unobserve(i.value));const j={props:t,get resizeObserver(){return e},set resizeObserver(f){e=f},wall:i,state:s,columns:r,getColumnCount:u,createColumns:l,fillColumns:a,redraw:g,imageLoad:b,get LoadingIcon(){return ke}};return Object.defineProperty(j,"__isScriptSetup",{enumerable:!1,value:!0}),j}});const uo=["data-index"],mo=["src","title","onClick"];function vo(n,o,t,e,i,s){return c(),d("div",{ref:"wall",class:"wl-gallery",style:Oe({gap:`${t.gap}px`})},[(c(!0),d(V,null,O(e.columns,(r,u)=>(c(),d("div",{key:u,class:"wl-gallery-column","data-index":u,style:Oe({gap:`${t.gap}px`})},[(c(!0),d(V,null,O(r,l=>(c(),d(V,{key:l},[e.state[t.items[l].src]?k("v-if",!0):(c(),ee(e.LoadingIcon,{key:0,size:36,style:{margin:"20px auto"}})),m("img",{class:"wl-gallery-item",src:t.items[l].src,title:t.items[l].title,loading:"lazy",onLoad:e.imageLoad,onClick:a=>n.$emit("insert",`![](${t.items[l].src})`)},null,40,mo)],64))),128))],12,uo))),128))],4)}var go=ve(co,[["render",vo],["__file","ImageWall.vue"]]),ho=me({__name:"CommentBox",props:{edit:{default:null},rootId:{default:""},replyId:{default:""},replyUser:{default:""}},emits:["log","cancelEdit","cancelReply","submit"],setup(n,{expose:o,emit:t}){o();const e=n,i=t,s=Re("config"),r=qn(),u=On(),l=_e(),a=p({}),g=p(null),b=p(null),j=p(null),f=p(null),S=p(null),R=p(null),_=p(null),L=p({tabs:[],map:{}}),M=p(0),x=p(!1),q=p(!1),se=p(!1),ce=p(""),le=p(0),H=Ee({loading:!0,list:[]}),oe=p(0),X=p(!1),ue=p(""),Y=p(!1),ae=p(!1),J=T(()=>s.value.locale),y=T(()=>{var v;return!!((v=l.value)!=null&&v.token)}),E=T(()=>s.value.imageUploader!==!1),N=v=>{const h=g.value,w=h.selectionStart,A=h.selectionEnd||0,D=h.scrollTop;r.value=h.value.substring(0,w)+v+h.value.substring(A,h.value.length),h.focus(),h.selectionStart=w+v.length,h.selectionEnd=w+v.length,h.scrollTop=D},G=v=>{const h=v.key;(v.ctrlKey||v.metaKey)&&h==="Enter"&&Ce()},z=v=>{const h=`![${s.value.locale.uploading} ${v.name}]()`;return N(h),Y.value=!0,Promise.resolve().then(()=>s.value.imageUploader(v)).then(w=>{r.value=r.value.replace(h,`\r
10
- ![${v.name}](${w})`)}).catch(w=>{alert(w.message),r.value=r.value.replace(h,"")}).then(()=>{Y.value=!1})},F=v=>{var h;if((h=v.dataTransfer)!=null&&h.items){const w=dt(v.dataTransfer.items);w&&E.value&&(z(w),v.preventDefault())}},B=v=>{if(v.clipboardData){const h=dt(v.clipboardData.items);h&&E.value&&z(h)}},de=()=>{const v=b.value;v.files&&E.value&&z(v.files[0]).then(()=>{v.value=""})},Ce=async()=>{var v,h,w,A,D,Z;const{serverURL:K,lang:Q,login:ge,wordLimit:He,requiredMeta:Pe,recaptchaV3Key:Ne,turnstileKey:De}=s.value,Rt=await An(),U={comment:ue.value,nick:u.value.nick,mail:u.value.mail,link:u.value.link,url:s.value.path,ua:Rt};if((v=l.value)!=null&&v.token&&!e.edit)U.nick=l.value.display_name,U.mail=l.value.email,U.link=l.value.url;else{if(ge==="force")return;if(Pe.indexOf("nick")>-1&&!U.nick)return(h=a.value.nick)==null||h.focus(),alert(J.value.nickError);if(Pe.indexOf("mail")>-1&&!U.mail||U.mail&&!bn(U.mail))return(w=a.value.mail)==null||w.focus(),alert(J.value.mailError);U.nick||(U.nick=J.value.anonymous)}if(!U.comment){(A=g.value)==null||A.focus();return}if(!X.value)return alert(J.value.wordHint.replace("$0",He[0].toString()).replace("$1",He[1].toString()).replace("$2",le.value.toString()));U.comment=mt(U.comment,L.value.map),e.replyId&&e.rootId&&(U.pid=e.replyId,U.rid=e.rootId,U.at=e.replyUser),Y.value=!0;try{Ne&&(U.recaptchaV3=await Xn(Ne).execute("social")),De&&(U.turnstile=await Yn(De).execute("social"));const he={serverURL:K,lang:Q,token:(D=l.value)==null?void 0:D.token,comment:U},Le=await(e.edit?fe({objectId:e.edit.objectId,...he}):xt(he));if(Y.value=!1,Le.errmsg)return alert(Le.errmsg);i("submit",Le.data),r.value="",ce.value="",await Fe(),e.replyId&&i("cancelReply"),(Z=e.edit)!=null&&Z.objectId&&i("cancelEdit")}catch(he){Y.value=!1,alert(he.message)}},Ie=v=>{v.preventDefault();const{lang:h,serverURL:w}=s.value;jt({serverURL:w,lang:h}).then(A=>{var D;l.value=A,(A.remember?localStorage:sessionStorage).setItem("WALINE_USER",JSON.stringify(A));const Z=Pt();(D=Z==null?void 0:Z.proxy)==null||D.$forceUpdate(),i("log")})},Ct=()=>{l.value={},localStorage.setItem("WALINE_USER","null"),sessionStorage.setItem("WALINE_USER","null"),i("log")},It=v=>{v.preventDefault();const{lang:h,serverURL:w}=s.value,A=800,D=800,Z=(window.innerWidth-A)/2,K=(window.innerHeight-D)/2,Q=new URLSearchParams({lng:h,token:l.value.token}),ge=window.open(`${w}/ui/profile?${Q.toString()}`,"_blank",`width=${A},height=${D},left=${Z},top=${K},scrollbars=no,resizable=no,status=no,location=no,toolbar=no,menubar=no`);ge==null||ge.postMessage({type:"TOKEN",data:l.value.token},"*")},ze=v=>{var h,w,A,D;!((h=j.value)!=null&&h.contains(v.target))&&!((w=f.value)!=null&&w.contains(v.target))&&(x.value=!1),!((A=S.value)!=null&&A.contains(v.target))&&!((D=R.value)!=null&&D.contains(v.target))&&(q.value=!1)},Te=async v=>{var h;const{scrollTop:w,clientHeight:A,scrollHeight:D}=v.target,Z=(A+w)/D,K=s.value.search,Q=((h=_.value)==null?void 0:h.value)??"";Z<.9||H.loading||ae.value||(H.loading=!0,(K.more&&H.list.length?await K.more(Q,H.list.length):await K.search(Q)).length?H.list=[...H.list,...K.more&&H.list.length?await K.more(Q,H.list.length):await K.search(Q)]:ae.value=!0,H.loading=!1,setTimeout(()=>{v.target.scrollTop=w},50))},Lt=qt(v=>{H.list=[],ae.value=!1,Te(v)},300);$([s,le],([v,h])=>{const{wordLimit:w}=v;w?h<w[0]&&w[0]!==0?(oe.value=w[0],X.value=!1):h>w[1]?(oe.value=w[1],X.value=!1):(oe.value=w[1],X.value=!0):(oe.value=0,X.value=!0)},{immediate:!0}),Ke("click",ze),Ke("message",({data:v})=>{!v||v.type!=="profile"||(l.value={...l.value,...v.data},[localStorage,sessionStorage].filter(h=>h.getItem("WALINE_USER")).forEach(h=>h.setItem("WALINE_USER",JSON.stringify(l))))}),$(q,async v=>{var h;if(!v)return;const w=s.value.search;_.value&&(_.value.value=""),H.loading=!0,H.list=await(((h=w.default)==null?void 0:h.call(w))??w.search("")),H.loading=!1}),we(()=>{var v;(v=e.edit)!=null&&v.objectId&&(r.value=e.edit.orig),$(()=>r.value,h=>{const{highlighter:w,texRenderer:A}=s.value;ue.value=h,ce.value=Sn(h,{emojiMap:L.value.map,highlighter:w,texRenderer:A}),le.value=Mn(h),h?Ze(g.value):Ze.destroy(g.value)},{immediate:!0}),$(()=>s.value.emoji,h=>_n(h).then(w=>{L.value=w}),{immediate:!0})});const Ve={props:e,emit:i,config:s,editor:r,userMeta:u,userInfo:l,inputRefs:a,editorRef:g,imageUploadRef:b,emojiButtonRef:j,emojiPopupRef:f,gifButtonRef:S,gifPopupRef:R,gifSearchInputRef:_,emoji:L,emojiTabIndex:M,showEmoji:x,showGif:q,showPreview:se,previewText:ce,wordNumber:le,searchResults:H,wordLimit:oe,isWordNumberLegal:X,content:ue,isSubmitting:Y,isImageListEnd:ae,locale:J,isLogin:y,canUploadImage:E,insert:N,onKeyDown:G,uploadImage:z,onDrop:F,onPaste:B,onChange:de,submitComment:Ce,onLogin:Ie,onLogout:Ct,onProfile:It,popupHandler:ze,onImageWallScroll:Te,onGifSearch:Lt,get CloseIcon(){return Un},get EmojiIcon(){return Tn},get GifIcon(){return Fn},get ImageIcon(){return Vn},get LoadingIcon(){return ke},get MarkdownIcon(){return Nn},get PreviewIcon(){return Pn},ImageWall:go};return Object.defineProperty(Ve,"__isScriptSetup",{enumerable:!1,value:!0}),Ve}});const fo={class:"wl-comment"},wo={key:0,class:"wl-login-info"},yo={class:"wl-avatar"},bo=["title"],po=["title"],ko=["src"],_o=["title","textContent"],Co={class:"wl-panel"},Io=["for","textContent"],Lo=["id","onUpdate:modelValue","name","type"],Ro=["placeholder"],Eo={class:"wl-preview"},So=m("hr",null,null,-1),xo=["innerHTML"],jo={class:"wl-footer"},Mo={class:"wl-actions"},Ao={href:"https://guides.github.com/features/mastering-markdown/",title:"Markdown Guide","aria-label":"Markdown is supported",class:"wl-action",target:"_blank",rel:"noopener noreferrer"},Uo=["title"],zo=["title"],To=["title"],Vo=["title"],Ho={class:"wl-info"},Po=m("div",{class:"wl-captcha-container"},null,-1),No={class:"wl-text-number"},Do={key:0},Wo=["textContent"],Bo=["textContent"],Fo=["disabled"],Oo=["placeholder"],qo={key:1,class:"wl-loading"},Go={key:0,class:"wl-tab-wrapper"},Ko=["title","onClick"],Zo=["src","alt"],Xo={key:0,class:"wl-tabs"},Yo=["onClick"],Jo=["src","alt","title"],Qo=["title"];function $o(n,o,t,e,i,s){var r,u;return c(),d("div",fo,[e.config.login!=="disable"&&e.isLogin&&!((r=t.edit)!=null&&r.objectId)?(c(),d("div",wo,[m("div",yo,[m("button",{type:"submit",class:"wl-logout-btn",title:e.locale.logout,onClick:e.onLogout},[W(e.CloseIcon,{size:14})],8,bo),m("a",{href:"#",class:"wl-login-nick","aria-label":"Profile",title:e.locale.profile,onClick:e.onProfile},[m("img",{src:e.userInfo.avatar,alt:"avatar"},null,8,ko)],8,po)]),m("a",{href:"#",class:"wl-login-nick","aria-label":"Profile",title:e.locale.profile,onClick:e.onProfile,textContent:I(e.userInfo.display_name)},null,8,_o)])):k("v-if",!0),m("div",Co,[e.config.login!=="force"&&e.config.meta.length&&!e.isLogin?(c(),d("div",{key:0,class:P(["wl-header",`item${e.config.meta.length}`])},[(c(!0),d(V,null,O(e.config.meta,l=>(c(),d("div",{key:l,class:"wl-header-item"},[m("label",{for:`wl-${l}`,textContent:I(e.locale[l]+(e.config.requiredMeta.includes(l)||!e.config.requiredMeta.length?"":`(${e.locale.optional})`))},null,8,Io),ye(m("input",{id:`wl-${l}`,ref_for:!0,ref:a=>{a&&(e.inputRefs[l]=a)},"onUpdate:modelValue":a=>e.userMeta[l]=a,class:P(["wl-input",`wl-${l}`]),name:l,type:l==="mail"?"email":"text"},null,10,Lo),[[Nt,e.userMeta[l]]])]))),128))],2)):k("v-if",!0),ye(m("textarea",{id:"wl-edit",ref:"editorRef","onUpdate:modelValue":o[0]||(o[0]=l=>e.editor=l),class:"wl-editor",placeholder:t.replyUser?`@${t.replyUser}`:e.locale.placeholder,onKeydown:e.onKeyDown,onDrop:e.onDrop,onPaste:e.onPaste},null,40,Ro),[[Dt,e.editor]]),ye(m("div",Eo,[So,m("h4",null,I(e.locale.preview)+":",1),m("div",{class:"wl-content",innerHTML:e.previewText},null,8,xo)],512),[[qe,e.showPreview]]),m("div",jo,[m("div",Mo,[m("a",Ao,[W(e.MarkdownIcon)]),ye(m("button",{ref:"emojiButtonRef",type:"button",class:P(["wl-action",{active:e.showEmoji}]),title:e.locale.emoji,onClick:o[1]||(o[1]=l=>e.showEmoji=!e.showEmoji)},[W(e.EmojiIcon)],10,Uo),[[qe,e.emoji.tabs.length]]),e.config.search?(c(),d("button",{key:0,ref:"gifButtonRef",type:"button",class:P(["wl-action",{active:e.showGif}]),title:e.locale.gif,onClick:o[2]||(o[2]=l=>e.showGif=!e.showGif)},[W(e.GifIcon)],10,zo)):k("v-if",!0),m("input",{id:"wl-image-upload",ref:"imageUploadRef",class:"upload",type:"file",accept:".png,.jpg,.jpeg,.webp,.bmp,.gif",onChange:e.onChange},null,544),e.canUploadImage?(c(),d("label",{key:1,for:"wl-image-upload",class:"wl-action",title:e.locale.uploadImage},[W(e.ImageIcon)],8,To)):k("v-if",!0),m("button",{type:"button",class:P(["wl-action",{active:e.showPreview}]),title:e.locale.preview,onClick:o[3]||(o[3]=l=>e.showPreview=!e.showPreview)},[W(e.PreviewIcon)],10,Vo)]),m("div",Ho,[Po,m("div",No,[te(I(e.wordNumber)+" ",1),e.config.wordLimit?(c(),d("span",Do,[te("  /  "),m("span",{class:P({illegal:!e.isWordNumberLegal}),textContent:I(e.wordLimit)},null,10,Wo)])):k("v-if",!0),te("  "+I(e.locale.word),1)]),e.config.login!=="disable"&&!e.isLogin?(c(),d("button",{key:0,type:"button",class:"wl-btn",onClick:e.onLogin,textContent:I(e.locale.login)},null,8,Bo)):k("v-if",!0),e.config.login!=="force"||e.isLogin?(c(),d("button",{key:1,type:"submit",class:"primary wl-btn",title:"Cmd|Ctrl + Enter",disabled:e.isSubmitting,onClick:e.submitComment},[e.isSubmitting?(c(),ee(e.LoadingIcon,{key:0,size:16})):(c(),d(V,{key:1},[te(I(e.locale.submit),1)],64))],8,Fo)):k("v-if",!0)]),m("div",{ref:"gifPopupRef",class:P(["wl-gif-popup",{display:e.showGif}])},[m("input",{ref:"gifSearchInputRef",type:"text",placeholder:e.locale.gifSearchPlaceholder,onInput:o[4]||(o[4]=(...l)=>e.onGifSearch&&e.onGifSearch(...l))},null,40,Oo),e.searchResults.list.length?(c(),ee(e.ImageWall,{key:0,items:e.searchResults.list,"column-width":200,gap:6,onInsert:o[5]||(o[5]=l=>e.insert(l)),onScroll:e.onImageWallScroll},null,8,["items"])):k("v-if",!0),e.searchResults.loading?(c(),d("div",qo,[W(e.LoadingIcon,{size:30})])):k("v-if",!0)],2),m("div",{ref:"emojiPopupRef",class:P(["wl-emoji-popup",{display:e.showEmoji}])},[(c(!0),d(V,null,O(e.emoji.tabs,(l,a)=>(c(),d(V,{key:l.name},[a===e.emojiTabIndex?(c(),d("div",Go,[(c(!0),d(V,null,O(l.items,g=>(c(),d("button",{key:g,type:"button",title:g,onClick:b=>e.insert(`:${g}:`)},[e.showEmoji?(c(),d("img",{key:0,class:"wl-emoji",src:e.emoji.map[g],alt:g,loading:"lazy",referrerPolicy:"no-referrer"},null,8,Zo)):k("v-if",!0)],8,Ko))),128))])):k("v-if",!0)],64))),128)),e.emoji.tabs.length>1?(c(),d("div",Xo,[(c(!0),d(V,null,O(e.emoji.tabs,(l,a)=>(c(),d("button",{key:l.name,type:"button",class:P(["wl-tab",{active:e.emojiTabIndex===a}]),onClick:g=>e.emojiTabIndex=a},[m("img",{class:"wl-emoji",src:l.icon,alt:l.name,title:l.name,loading:"lazy",referrerPolicy:"no-referrer"},null,8,Jo)],10,Yo))),128))])):k("v-if",!0)],2)])]),t.replyId||(u=t.edit)!=null&&u.objectId?(c(),d("button",{key:1,type:"button",class:"wl-close",title:e.locale.cancelReply,onClick:o[6]||(o[6]=l=>t.replyId?e.emit("cancelReply"):e.emit("cancelEdit"))},[W(e.CloseIcon,{size:24})],8,Qo)):k("v-if",!0)])}var bt=ve(ho,[["render",$o],["__file","CommentBox.vue"]]),el=me({__name:"CommentCard",props:{comment:{},edit:{default:null},rootId:{},reply:{default:null}},emits:["log","submit","delete","edit","like","status","sticky","reply"],setup(n,{expose:o,emit:t}){o();const e=n,i=t,s=["approved","waiting","spam"],r=Re("config"),u=ht(),l=Gt(),a=_e(),g=T(()=>r.value.locale),b=T(()=>{const{link:x}=e.comment;return x?st(x)?x:`https://${x}`:""}),j=T(()=>u.value.includes(e.comment.objectId)),f=T(()=>wn(new Date(e.comment.time),l.value,g.value)),S=T(()=>a.value.type==="administrator"),R=T(()=>e.comment.user_id&&a.value.objectId===e.comment.user_id),_=T(()=>{var x;return e.comment.objectId===((x=e.reply)==null?void 0:x.objectId)}),L=T(()=>{var x;return e.comment.objectId===((x=e.edit)==null?void 0:x.objectId)}),M={props:e,emit:i,commentStatus:s,config:r,likes:u,now:l,userInfo:a,locale:g,link:b,like:j,time:f,isAdmin:S,isOwner:R,isReplyingCurrent:_,isEditingCurrent:L,CommentBox:bt,get DeleteIcon(){return zn},get EditIcon(){return Wn},get LikeIcon(){return Hn},get ReplyIcon(){return Dn},get VerifiedIcon(){return Bn}};return Object.defineProperty(M,"__isScriptSetup",{enumerable:!1,value:!0}),M}});const tl=["id"],nl={class:"wl-user","aria-hidden":"true"},ol=["src"],ll={class:"wl-card"},al={class:"wl-head"},il=["href"],rl={key:1,class:"wl-nick"},sl=["textContent"],cl=["textContent"],ul=["textContent"],dl=["textContent"],ml=["textContent"],vl={class:"wl-comment-actions"},gl=["title"],hl=["title"],fl={class:"wl-meta","aria-hidden":"true"},wl=["data-value","textContent"],yl={key:0,class:"wl-content"},bl={key:0},pl=["href"],kl=m("span",null,": ",-1),_l=["innerHTML"],Cl={key:1,class:"wl-admin-actions"},Il={class:"wl-comment-status"},Ll=["disabled","onClick","textContent"],Rl={key:3,class:"wl-quote"};function El(n,o,t,e,i,s){var u;const r=Wt("CommentCard",!0);return c(),d("div",{id:t.comment.objectId,class:"wl-card-item"},[m("div",nl,[t.comment.avatar?(c(),d("img",{key:0,class:"wl-user-avatar",src:t.comment.avatar},null,8,ol)):k("v-if",!0),t.comment.type?(c(),ee(e.VerifiedIcon,{key:1})):k("v-if",!0)]),m("div",ll,[m("div",al,[e.link?(c(),d("a",{key:0,class:"wl-nick",href:e.link,target:"_blank",rel:"nofollow noopener noreferrer"},I(t.comment.nick),9,il)):(c(),d("span",rl,I(t.comment.nick),1)),t.comment.type==="administrator"?(c(),d("span",{key:2,class:"wl-badge",textContent:I(e.locale.admin)},null,8,sl)):k("v-if",!0),t.comment.label?(c(),d("span",{key:3,class:"wl-badge",textContent:I(t.comment.label)},null,8,cl)):k("v-if",!0),t.comment.sticky?(c(),d("span",{key:4,class:"wl-badge",textContent:I(e.locale.sticky)},null,8,ul)):k("v-if",!0),typeof t.comment.level=="number"?(c(),d("span",{key:5,class:P(`wl-badge level${t.comment.level}`),textContent:I(e.locale[`level${t.comment.level}`]||`Level ${t.comment.level}`)},null,10,dl)):k("v-if",!0),m("span",{class:"wl-time",textContent:I(e.time)},null,8,ml),m("div",vl,[e.isAdmin||e.isOwner?(c(),d(V,{key:0},[m("button",{type:"button",class:"wl-edit",onClick:o[0]||(o[0]=l=>e.emit("edit",t.comment))},[W(e.EditIcon)]),m("button",{type:"button",class:"wl-delete",onClick:o[1]||(o[1]=l=>e.emit("delete",t.comment))},[W(e.DeleteIcon)])],64)):k("v-if",!0),m("button",{type:"button",class:"wl-like",title:e.like?e.locale.cancelLike:e.locale.like,onClick:o[2]||(o[2]=l=>e.emit("like",t.comment))},[W(e.LikeIcon,{active:e.like},null,8,["active"]),te(" "+I("like"in t.comment?t.comment.like:""),1)],8,gl),m("button",{type:"button",class:P(["wl-reply",{active:e.isReplyingCurrent}]),title:e.isReplyingCurrent?e.locale.cancelReply:e.locale.reply,onClick:o[3]||(o[3]=l=>e.emit("reply",e.isReplyingCurrent?null:t.comment))},[W(e.ReplyIcon)],10,hl)])]),m("div",fl,[(c(),d(V,null,O(["addr","browser","os"],l=>(c(),d(V,null,[t.comment[l]?(c(),d("span",{key:l,class:P(`wl-${l}`),"data-value":t.comment[l],textContent:I(t.comment[l])},null,10,wl)):k("v-if",!0)],64))),64))]),e.isEditingCurrent?k("v-if",!0):(c(),d("div",yl,[t.comment.reply_user?(c(),d("p",bl,[m("a",{href:"#"+t.comment.pid},"@"+I(t.comment.reply_user.nick),9,pl),kl])):k("v-if",!0),m("div",{innerHTML:t.comment.comment},null,8,_l)])),e.isAdmin&&!e.isEditingCurrent?(c(),d("div",Cl,[m("span",Il,[(c(),d(V,null,O(e.commentStatus,l=>m("button",{key:l,type:"submit",class:P(`wl-btn wl-${l}`),disabled:t.comment.status===l,onClick:a=>e.emit("status",{status:l,comment:t.comment}),textContent:I(e.locale[l])},null,10,Ll)),64))]),e.isAdmin&&!("rid"in t.comment)?(c(),d("button",{key:0,type:"submit",class:"wl-btn wl-sticky",onClick:o[4]||(o[4]=l=>e.emit("sticky",t.comment))},I(t.comment.sticky?e.locale.unsticky:e.locale.sticky),1)):k("v-if",!0)])):k("v-if",!0),e.isReplyingCurrent||e.isEditingCurrent?(c(),d("div",{key:2,class:P({"wl-reply-wrapper":e.isReplyingCurrent,"wl-edit-wrapper":e.isEditingCurrent})},[W(e.CommentBox,{edit:t.edit,"reply-id":(u=t.reply)==null?void 0:u.objectId,"reply-user":t.comment.nick,"root-id":t.rootId,onLog:o[5]||(o[5]=l=>e.emit("log")),onCancelReply:o[6]||(o[6]=l=>e.emit("reply",null)),onCancelEdit:o[7]||(o[7]=l=>e.emit("edit",null)),onSubmit:o[8]||(o[8]=l=>e.emit("submit",l))},null,8,["edit","reply-id","reply-user","root-id"])],2)):k("v-if",!0),"children"in t.comment?(c(),d("div",Rl,[(c(!0),d(V,null,O(t.comment.children,l=>(c(),ee(r,{key:l.objectId,comment:l,reply:t.reply,edit:t.edit,"root-id":t.rootId,onLog:o[9]||(o[9]=a=>e.emit("log")),onDelete:o[10]||(o[10]=a=>e.emit("delete",a)),onEdit:o[11]||(o[11]=a=>e.emit("edit",a)),onLike:o[12]||(o[12]=a=>e.emit("like",a)),onReply:o[13]||(o[13]=a=>e.emit("reply",a)),onStatus:o[14]||(o[14]=a=>e.emit("status",a)),onSticky:o[15]||(o[15]=a=>e.emit("sticky",a)),onSubmit:o[16]||(o[16]=a=>e.emit("submit",a))},null,8,["comment","reply","edit","root-id"]))),128))])):k("v-if",!0)])],8,tl)}var Sl=ve(el,[["render",El],["__file","CommentCard.vue"]]);const pt="3.2.4";var xl=me({__name:"WalineComment",props:["serverURL","path","meta","requiredMeta","dark","commentSorting","lang","locale","pageSize","wordLimit","emoji","login","highlighter","texRenderer","imageUploader","search","copyright","recaptchaV3Key","turnstileKey","reaction"],setup(n,{expose:o}){o();const t=n,e={latest:"insertedAt_desc",oldest:"insertedAt_asc",hottest:"like_desc"},i=Object.keys(e),s=_e(),r=ht(),u=p("loading"),l=p(0),a=p(1),g=p(0),b=T(()=>gn(t)),j=p(b.value.commentSorting),f=p([]),S=p(null),R=p(null),_=T(()=>hn(b.value.dark)),L=T(()=>b.value.locale);Kt(_,{id:"waline-darkmode"});let M;const x=y=>{var E;const{serverURL:N,path:G,pageSize:z}=b.value,F=new AbortController;u.value="loading",M==null||M(),Mt({serverURL:N,lang:b.value.lang,path:G,pageSize:z,sortBy:e[j.value],page:y,signal:F.signal,token:(E=s.value)==null?void 0:E.token}).then(B=>{u.value="success",l.value=B.count,f.value.push(...B.data),a.value=y,g.value=B.totalPages}).catch(B=>{B.name!=="AbortError"&&(console.error(B.message),u.value="error")}),M=F.abort.bind(F)},q=()=>x(a.value+1),se=()=>{l.value=0,f.value=[],x(1)},ce=y=>{j.value!==y&&(j.value=y,se())},le=y=>{S.value=y},H=y=>{R.value=y},oe=y=>{if(R.value)R.value.comment=y.comment,R.value.orig=y.orig;else if("rid"in y){const E=f.value.find(({objectId:N})=>N===y.rid);if(!E)return;Array.isArray(E.children)||(E.children=[]),E.children.push(y)}else f.value.unshift(y),l.value+=1},X=async({comment:y,status:E})=>{var N;if(y.status===E)return;const{serverURL:G,lang:z}=b.value;await fe({serverURL:G,lang:z,token:(N=s.value)==null?void 0:N.token,objectId:y.objectId,comment:{status:E}}),y.status=E},ue=async y=>{var E;if("rid"in y)return;const{serverURL:N,lang:G}=b.value;await fe({serverURL:N,lang:G,token:(E=s.value)==null?void 0:E.token,objectId:y.objectId,comment:{sticky:y.sticky?0:1}}),y.sticky=!y.sticky},Y=async({objectId:y})=>{var E;if(!confirm("Are you sure you want to delete this comment?"))return;const{serverURL:N,lang:G}=b.value;await At({serverURL:N,lang:G,token:(E=s.value)==null?void 0:E.token,objectId:y}),f.value.some((z,F)=>z.objectId===y?(f.value=f.value.filter((B,de)=>de!==F),!0):z.children.some((B,de)=>B.objectId===y?(f.value[F].children=z.children.filter((Ce,Ie)=>Ie!==de),!0):!1))},ae=async y=>{var E;const{serverURL:N,lang:G}=b.value,{objectId:z}=y,F=r.value.includes(z);await fe({serverURL:N,lang:G,objectId:z,token:(E=s.value)==null?void 0:E.token,comment:{like:!F}}),F?r.value=r.value.filter(B=>B!==z):(r.value=[...r.value,z],r.value.length>50&&(r.value=r.value.slice(-50))),y.like=(y.like||0)+(F?-1:1)};Bt("config",b),we(()=>{$(()=>[t.serverURL,t.path],()=>se(),{immediate:!0})}),Be(()=>M==null?void 0:M());const J={props:t,sortKeyMap:e,sortingMethods:i,userInfo:s,likeStorage:r,status:u,count:l,page:a,totalPages:g,config:b,commentSortingRef:j,data:f,reply:S,edit:R,darkmodeStyle:_,i18n:L,get abort(){return M},set abort(y){M=y},getCommentData:x,loadMore:q,refresh:se,onSortByChange:ce,onReply:le,onEdit:H,onSubmit:oe,onStatusChange:X,onSticky:ue,onDelete:Y,onLike:ae,Reaction:so,CommentBox:bt,CommentCard:Sl,get LoadingIcon(){return ke},get version(){return pt}};return Object.defineProperty(J,"__isScriptSetup",{enumerable:!1,value:!0}),J}});const jl={"data-waline":""},Ml={class:"wl-meta-head"},Al={class:"wl-count"},Ul=["textContent"],zl={class:"wl-sort"},Tl=["onClick"],Vl={class:"wl-cards"},Hl={key:1,class:"wl-operation"},Pl=["textContent"],Nl={key:2,class:"wl-loading"},Dl=["textContent"],Wl={key:4,class:"wl-operation"},Bl=["textContent"],Fl={key:5,class:"wl-power"},Ol=m("a",{href:"https://github.com/walinejs/waline",target:"_blank",rel:"noopener noreferrer"}," Waline ",-1);function ql(n,o,t,e,i,s){return c(),d("div",jl,[W(e.Reaction),e.reply?k("v-if",!0):(c(),ee(e.CommentBox,{key:0,onLog:e.refresh,onSubmit:e.onSubmit})),m("div",Ml,[m("div",Al,[e.count?(c(),d("span",{key:0,class:"wl-num",textContent:I(e.count)},null,8,Ul)):k("v-if",!0),te(" "+I(e.i18n.comment),1)]),m("ul",zl,[(c(!0),d(V,null,O(e.sortingMethods,r=>(c(),d("li",{key:r,class:P([r===e.commentSortingRef?"active":""]),onClick:u=>e.onSortByChange(r)},I(e.i18n[r]),11,Tl))),128))])]),m("div",Vl,[(c(!0),d(V,null,O(e.data,r=>(c(),ee(e.CommentCard,{key:r.objectId,"root-id":r.objectId,comment:r,reply:e.reply,edit:e.edit,onLog:e.refresh,onReply:e.onReply,onEdit:e.onEdit,onSubmit:e.onSubmit,onStatus:e.onStatusChange,onDelete:e.onDelete,onSticky:e.onSticky,onLike:e.onLike},null,8,["root-id","comment","reply","edit"]))),128))]),e.status==="error"?(c(),d("div",Hl,[m("button",{type:"button",class:"wl-btn",onClick:e.refresh,textContent:I(e.i18n.refresh)},null,8,Pl)])):e.status==="loading"?(c(),d("div",Nl,[W(e.LoadingIcon,{size:30})])):e.data.length?e.page<e.totalPages?(c(),d("div",Wl,[m("button",{type:"button",class:"wl-btn",onClick:e.loadMore,textContent:I(e.i18n.more)},null,8,Bl)])):k("v-if",!0):(c(),d("div",{key:3,class:"wl-empty",textContent:I(e.i18n.sofa)},null,8,Dl)),e.config.copyright?(c(),d("div",Fl,[te(" Powered by "),Ol,te(" v"+I(e.version),1)])):k("v-if",!0)])}var Gl=ve(xl,[["render",ql],["__file","WalineComment.vue"]]);const kt=(n,o)=>{o.forEach((t,e)=>{const i=n[e].time;typeof i=="number"&&(t.innerText=i.toString())})},_t=({serverURL:n,path:o=window.location.pathname,selector:t=".waline-pageview-count",update:e=!0,lang:i=navigator.language})=>{const s=new AbortController,r=Array.from(document.querySelectorAll(t)),u=a=>{const g=Ue(a);return g!==null&&o!==g},l=a=>zt({serverURL:pe(n),paths:a.map(g=>Ue(g)??o),lang:i,signal:s.signal}).then(g=>kt(g,a)).catch(ut);if(e){const a=r.filter(b=>!u(b)),g=r.filter(u);Ut({serverURL:pe(n),path:o,lang:i}).then(b=>kt(b,a)),g.length&&l(g)}else l(r);return s.abort.bind(s)},Kl=({el:n="#waline",path:o=window.location.pathname,comment:t=!1,pageview:e=!1,...i})=>{const s=n?Ae(n):null;if(n&&!s)throw new Error("Option 'el' do not match any domElement!");if(!i.serverURL)throw new Error("Option 'serverURL' is missing!");const r=Ee({...i}),u=Ee({comment:t,pageview:e,path:o}),l=()=>{u.comment&&vt({serverURL:r.serverURL,path:u.path,...re(u.comment)?{selector:u.comment}:{}})},a=()=>{u.pageview&&_t({serverURL:r.serverURL,path:u.path,...re(u.pageview)?{selector:u.pageview}:{}})},g=s?Ft(()=>C(Gl,{path:u.path,...r})):null;g&&g.mount(s);const b=Ge(l),j=Ge(a);return{el:s,update:({comment:f,pageview:S,path:R=window.location.pathname,..._}={})=>{Object.entries(_).forEach(([L,M])=>{r[L]=M}),u.path=R,f!==void 0&&(u.comment=f),S!==void 0&&(u.pageview=S)},destroy:()=>{g==null||g.unmount(),b(),j()}}},Zl=({el:n,serverURL:o,count:t,lang:e=navigator.language})=>{var i;const s=_e(),r=Ae(n),u=new AbortController;return Tt({serverURL:o,count:t,lang:e,signal:u.signal,token:(i=s.value)==null?void 0:i.token}).then(l=>r&&l.length?(r.innerHTML=`<ul class="wl-recent-list">${l.map(a=>`<li class="wl-recent-item"><a href="${a.url}">${a.nick}</a>:${a.comment}</li>`).join("")}</ul>`,{comments:l,destroy:()=>{u.abort(),r.innerHTML=""}}):{comments:l,destroy:()=>u.abort()})},Xl=({el:n,serverURL:o,count:t,locale:e,lang:i=navigator.language,mode:s="list"})=>{const r=Ae(n),u=new AbortController;return Vt({serverURL:o,pageSize:t,lang:i,signal:u.signal}).then(l=>!r||!l.length?{users:l,destroy:()=>u.abort()}:(e={...at(i),...typeof e=="object"?e:{}},r.innerHTML=`<ul class="wl-user-${s}">${l.map((a,g)=>[`<li class="wl-user-item" aria-label="${a.nick}">`,a.link&&`<a href="${a.link}" target="_blank">`,'<div class="wl-user-avatar">',`<img src="${a.avatar}" alt="${a.nick}">`,`<span class="wl-user-badge">${g+1}</span>`,"</div>",'<div class="wl-user-meta">','<div class="wl-user-name">',a.nick,a.level&&`<span class="wl-badge">${e?e[`level${a.level}`]:`Level ${a.level}`}</span>`,a.label&&`<span class="wl-badge">${a.label}</span>`,"</div>",a.link&&a.link,"</div>",a.link&&"</a>","</li>"].filter(b=>b).join("")).join("")}</ul>`,{users:l,destroy:()=>{u.abort(),r.innerHTML=""}}))};export{Zl as RecentComments,Xl as UserList,vt as commentCount,be as defaultLocales,Kl as init,_t as pageviewCount,pt as version};
1
+ import{fetchCommentCount as Et,getArticleCounter as St,updateArticleCounter as We,updateComment as fe,addComment as xt,login as jt,getComment as Mt,deleteComment as At,updatePageview as Ut,getPageview as zt,getRecentComment as Tt,getUserList as Vt}from"@waline/api";export*from"@waline/api";import{h as C,defineComponent as me,inject as Re,ref as p,computed as T,onMounted as we,watch as Q,onUnmounted as Be,openBlock as c,createElementBlock as d,createElementVNode as m,toDisplayString as L,Fragment as V,renderList as O,normalizeClass as P,createBlock as $,createCommentVNode as k,onBeforeUnmount as Ht,nextTick as Fe,normalizeStyle as Oe,reactive as Ee,createVNode as D,withDirectives as ye,vModelDynamic as Pt,vModelText as Nt,vShow as qe,createTextVNode as ee,resolveComponent as Dt,provide as Wt,createApp as Bt,watchEffect as Ge}from"vue";import{useStorage as ie,useScriptTag as Ft,useDebounceFn as Ot,useEventListener as Ke,useNow as qt,useStyleTag as Gt}from"@vueuse/core";import Ze from"autosize";import{Marked as Kt}from"marked";import{markedHighlight as Zt}from"marked-highlight";import{load as Xt}from"recaptcha-v3";const Yt=["nick","mail","link"],Xe=n=>n.filter(o=>Yt.includes(o)),Ye=["//unpkg.com/@waline/emojis@1.1.0/weibo"],Jt=["//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"],Qt=n=>new Promise((o,t)=>{if(n.size>128e3)return t(new Error("File too large! File size limit 128KB"));const e=new FileReader;e.readAsDataURL(n),e.onload=()=>{var i;return o(((i=e.result)==null?void 0:i.toString())??"")},e.onerror=t}),$t=n=>n===!0?'<p class="wl-tex">TeX is not available in preview</p>':'<span class="wl-tex">TeX is not available in preview</span>',en=n=>{const o=async(t,e={})=>fetch(`https://api.giphy.com/v1/gifs/${t}?${new URLSearchParams({lang:n,limit:"20",rating:"g",api_key:"6CIMLkNMMOhRcXPoMCPkFy4Ybk2XUiMp",...e}).toString()}`).then(i=>i.json()).then(({data:i})=>i.map(s=>({title:s.title,src:s.images.downsized_medium.url})));return{search:t=>o("search",{q:t,offset:"0"}),default:()=>o("trending",{}),more:(t,e=0)=>o("search",{q:t,offset:e.toString()})}},tn=/[\u4E00-\u9FFF\u3400-\u4dbf\uf900-\ufaff\u3040-\u309f\uac00-\ud7af\u0400-\u04FF]+|\w+/,nn=/</,on=/(?:^|\s)\/\/(.+?)$/gm,ln=/\/\*([\S\s]*?)\*\//gm,an=new RegExp(`(${tn.source}|${nn.source})|((?:${on.source})|(?:${ln.source}))`,"gmi"),Je=["23AC69","91C132","F19726","E8552D","1AAB8E","E1147F","2980C1","1BA1E6","9FA0A0","F19726","E30B20","E30B20","A3338B"],Se={},rn=n=>{let o=0;return n.replace(an,(t,e,i)=>{if(i)return`<span style="color: slategray">${i}</span>`;if(e==="<")return"&lt;";let s;Se[e]?s=Se[e]:(s=Je[o],Se[e]=s);const r=`<span style="color: #${s}">${e}</span>`;return o=++o%Je.length,r})},sn=["nick","nickError","mail","mailError","link","optional","placeholder","sofa","submit","like","cancelLike","reply","cancelReply","comment","refresh","more","preview","emoji","uploadImage","seconds","minutes","hours","days","now","uploading","login","logout","admin","sticky","word","wordHint","anonymous","level0","level1","level2","level3","level4","level5","gif","gifSearchPlaceholder","profile","approved","waiting","spam","unsticky","oldest","latest","hottest","reactionTitle"],te=n=>Object.fromEntries(n.map((o,t)=>[sn[t],o]));var Qe=te(["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?"]),$e=te(["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 !
3
+ 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 ?"]),et=te(["ニックネーム","3バイト以上のニックネームをご入力ください.","メールアドレス","メールアドレスをご確認ください.","サイト","オプション","ここにコメント","コメントしましょう~","提出する","Like","Cancel like","返信する","キャンセル","コメント","更新","さらに読み込む","プレビュー","絵文字","画像をアップロード","秒前","分前","時間前","日前","たっだ今","アップロード","ログインする","ログアウト","管理者","トップに置く","ワード",`コメントは $0 から $1 ワードの間でなければなりません!
4
+ 現在の単語番号: $2`,"匿名","うえにん","なかにん","しもおし","特にしもおし","かげ","なぬし","GIF","探す GIF","個人情報","承認済み","待っている","スパム","べたつかない","逆順","正順","人気順","どう思いますか?"]),cn=te(["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!
5
+ 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?"]),tt=te(["Псевдоним","Никнейм не может быть меньше 3 байт.","Эл. адрес","Пожалуйста, подтвердите адрес вашей электронной почты.","Веб-сайт","Необязательный","Комментарий здесь...","Пока нет комментариев.","Отправить","Like","Cancel like","Отвечать","Отменить ответ","Комментарии","Обновить","Загрузи больше...","Превью","эмодзи","Загрузить изображение","секунд назад","несколько минут назад","несколько часов назад","дней назад","прямо сейчас","Загрузка","Авторизоваться","Выход из системы","Админ","Липкий","Слова",`Пожалуйста, введите комментарии от $0 до $1 слов!
6
+ Номер текущего слова: $2`,"Анонимный","Dwarves","Hobbits","Ents","Wizards","Elves","Maiar","GIF","Поиск GIF","Персональные данные","Одобренный","Ожидающий","Спам","Нелипкий","самый старый","последний","самый горячий","Что вы думаете?"]),nt=te(["Tên","Tên không được nhỏ hơn 3 ký tự.","E-Mail","Vui lòng xác nhập địa chỉ email của bạn.","Website","Tùy chọn","Hãy bình luận có văn hoá!","Chưa có bình luận","Gửi","Thích","Bỏ thích","Trả lời","Hủy bỏ","bình luận","Làm mới","Tải thêm...","Xem trước","Emoji","Tải lên hình ảnh","giây trước","phút trước","giờ trước","ngày trước","Vừa xong","Đang tải lên","Đăng nhập","đăng xuất","Quản trị viên","Dính","từ",`Bình luận phải có độ dài giữa $0 và $1 từ!
7
+ 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?"]),ot=te(["昵称","昵称不能少于3个字符","邮箱","请填写正确的邮件地址","网址","可选","欢迎评论","来发评论吧~","提交","喜欢","取消喜欢","回复","取消回复","评论","刷新","加载更多...","预览","表情","上传图片","秒前","分钟前","小时前","天前","刚刚","正在上传","登录","退出","博主","置顶","字",`评论字数应在 $0 到 $1 字之间!
8
+ 当前字数:$2`,"匿名","潜水","冒泡","吐槽","活跃","话痨","传说","表情包","搜索表情包","个人资料","通过","待审核","垃圾","取消置顶","按倒序","按正序","按热度","你认为这篇文章怎么样?"]),un=te(["暱稱","暱稱不能少於3個字元","郵箱","請填寫正確的郵件地址","網址","可選","歡迎留言","來發留言吧~","送出","喜歡","取消喜歡","回覆","取消回覆","留言","重整","載入更多...","預覽","表情","上傳圖片","秒前","分鐘前","小時前","天前","剛剛","正在上傳","登入","登出","管理者","置頂","字",`留言字數應在 $0 到 $1 字之間!
9
+ 目前字數:$2`,"匿名","潛水","冒泡","吐槽","活躍","多話","傳說","表情包","搜尋表情包","個人資料","通過","待審核","垃圾","取消置頂","最早","最新","熱門","你認為這篇文章怎麼樣?"]);const lt="en-US",be={zh:ot,"zh-cn":ot,"zh-tw":un,en:Qe,"en-us":Qe,fr:$e,"fr-fr":$e,jp:et,"jp-jp":et,"pt-br":cn,ru:tt,"ru-ru":tt,vi:nt,"vi-vn":nt},at=n=>be[n.toLowerCase()]||be[lt],dn=n=>Object.keys(be).includes(n.toLowerCase())?n:lt,it=n=>{try{n=decodeURI(n)}catch{}return n},rt=(n="")=>n.replace(/\/$/u,""),st=n=>/^(https?:)?\/\//.test(n),pe=n=>{const o=rt(n);return st(o)?o:`https://${o}`},mn=n=>Array.isArray(n)?n:n?[0,n]:!1,xe=(n,o)=>typeof n=="function"?n:n===!1?!1:o,vn=({serverURL:n,path:o=location.pathname,lang:t=typeof navigator>"u"?"en-US":navigator.language,locale:e,emoji:i=Ye,meta:s=["nick","mail","link"],requiredMeta:r=[],dark:u=!1,pageSize:l=10,wordLimit:a,imageUploader:g,highlighter:b,texRenderer:j,copyright:f=!0,login:S="enable",search:R,reaction:_,recaptchaV3Key:I="",turnstileKey:M="",commentSorting:x="latest",...q})=>({serverURL:pe(n),path:it(o),lang:dn(t),locale:{...at(t),...typeof e=="object"?e:{}},wordLimit:mn(a),meta:Xe(s),requiredMeta:Xe(r),imageUploader:xe(g,Qt),highlighter:xe(b,rn),texRenderer:xe(j,$t),dark:u,emoji:typeof i=="boolean"?i?Ye:[]:i,pageSize:l,login:S,copyright:f,search:R===!1?!1:typeof R=="object"?R:en(t),recaptchaV3Key:I,turnstileKey:M,reaction:Array.isArray(_)?_:_===!0?Jt:[],commentSorting:x,...q}),re=n=>typeof n=="string",je="{--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}",gn=n=>re(n)?n==="auto"?`@media(prefers-color-scheme:dark){body${je}}`:`${n}${je}`:n===!0?`:root${je}`:"",Me=(n,o)=>{let t=n.toString();for(;t.length<o;)t="0"+t;return t},hn=n=>{const o=Me(n.getDate(),2),t=Me(n.getMonth()+1,2);return`${Me(n.getFullYear(),2)}-${t}-${o}`},fn=(n,o,t)=>{if(!n)return"";const e=re(n)?new Date(n.indexOf(" ")!==-1?n.replace(/-/g,"/"):n):n,i=o.getTime()-e.getTime(),s=Math.floor(i/(24*3600*1e3));if(s===0){const r=i%864e5,u=Math.floor(r/(3600*1e3));if(u===0){const l=r%36e5,a=Math.floor(l/(60*1e3));if(a===0){const g=l%6e4;return`${Math.round(g/1e3)} ${t.seconds}`}return`${a} ${t.minutes}`}return`${u} ${t.hours}`}return s<0?t.now:s<8?`${s} ${t.days}`:hn(e)},wn=/^[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])?)*$/,yn=n=>wn.test(n),bn=n=>!!/@[0-9]+\.[0-9]+\.[0-9]+/.test(n),pn=n=>{const o=ie("WALINE_EMOJI",{}),t=bn(n);if(t){const e=o.value[n];if(e)return Promise.resolve(e)}return fetch(`${n}/info.json`).then(e=>e.json()).then(e=>{const i={folder:n,...e};return t&&(o.value[n]=i),i})},ct=(n,o="",t="",e="")=>`${o?`${o}/`:""}${t}${n}${e?`.${e}`:""}`,kn=n=>Promise.all(n.map(o=>re(o)?pn(rt(o)):Promise.resolve(o))).then(o=>{const t={tabs:[],map:{}};return o.forEach(e=>{const{name:i,folder:s,icon:r,prefix:u="",type:l,items:a}=e;t.tabs.push({name:i,icon:ct(r,s,u,l),items:a.map(g=>{const b=`${u}${g}`;return t.map[b]=ct(g,s,u,l),b})})}),t}),ut=n=>{n.name!=="AbortError"&&console.error(n.message)},Ae=n=>n instanceof HTMLElement?n:re(n)?document.querySelector(n):null,_n=n=>n.type.includes("image"),dt=n=>{const o=Array.from(n).find(_n);return o?o.getAsFile():null},Cn=/\$.*?\$/,Ln=/^\$(.*?)\$/,In=/^(?:\s{0,3})\$\$((?:[^\n]|\n[^\n])+?)\n{0,1}\$\$/,Rn=n=>[{name:"blockMath",level:"block",tokenizer(o){const t=In.exec(o);if(t!==null)return{type:"html",raw:t[0],text:n(!0,t[1])}}},{name:"inlineMath",level:"inline",start(o){const t=o.search(Cn);return t!==-1?t:o.length},tokenizer(o){const t=Ln.exec(o);if(t!==null)return{type:"html",raw:t[0],text:n(!1,t[1])}}}],mt=(n="",o={})=>n.replace(/:(.+?):/g,(t,e)=>o[e]?`<img class="wl-emoji" src="${o[e]}" alt="${e}">`:t),En=(n,{emojiMap:o,highlighter:t,texRenderer:e})=>{const i=new Kt;if(i.setOptions({breaks:!0}),t&&i.use(Zt({highlight:t})),e){const s=Rn(e);i.use({extensions:s})}return i.parse(mt(n,o))},Ue=n=>{const{path:o}=n.dataset;return o!=null&&o.length?o:null},Sn=n=>n.match(/[\w\d\s,.\u00C0-\u024F\u0400-\u04FF]+/giu),xn=n=>n.match(/[\u4E00-\u9FD5]/gu),jn=n=>{var o,t;return(((o=Sn(n))==null?void 0:o.reduce((e,i)=>e+(["",",","."].includes(i.trim())?0:i.trim().split(/\s+/u).length),0))??0)+(((t=xn(n))==null?void 0:t.length)??0)},Mn=async()=>{if(!navigator)return"";const{userAgentData:n}=navigator;let o=navigator.userAgent;if(!n||n.platform!=="Windows")return o;const{platformVersion:t}=await n.getHighEntropyValues(["platformVersion"]);return t&&parseInt(t.split(".")[0])>=13&&(o=o.replace("Windows NT 10.0","Windows NT 11.0")),o},vt=({serverURL:n,path:o=window.location.pathname,selector:t=".waline-comment-count",lang:e=navigator.language})=>{const i=new AbortController,s=document.querySelectorAll(t);return s.length&&Et({serverURL:pe(n),paths:Array.from(s).map(r=>it(Ue(r)??o)),lang:e,signal:i.signal}).then(r=>{s.forEach((u,l)=>{u.innerText=r[l].toString()})}).catch(ut),i.abort.bind(i)},An=({size:n})=>C("svg",{class:"wl-close-icon",viewBox:"0 0 1024 1024",width:n,height:n},[C("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"}),C("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"})]),Un=()=>C("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},C("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"})),zn=()=>C("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},C("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"})),Tn=()=>C("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},[C("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"}),C("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"})]),Vn=({active:n=!1})=>C("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},[C("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${n?"":"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:n?"red":"currentColor"})]),Hn=()=>C("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},[C("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"}),C("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"})]),Pn=()=>C("svg",{width:"16",height:"16",ariaHidden:"true"},C("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"})),Nn=()=>C("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},C("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"})),Dn=()=>C("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},C("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"})),Wn=()=>C("svg",{class:"verified-icon",viewBox:"0 0 1024 1024",width:"14",height:"14"},C("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"})),ke=({size:n=100})=>C("svg",{width:n,height:n,viewBox:"0 0 100 100",preserveAspectRatio:"xMidYMid"},C("circle",{cx:50,cy:50,fill:"none",stroke:"currentColor",strokeWidth:"4",r:"40","stroke-dasharray":"85 30"},C("animateTransform",{attributeName:"transform",type:"rotate",repeatCount:"indefinite",dur:"1s",values:"0 50 50;360 50 50",keyTimes:"0;1"}))),Bn=()=>C("svg",{width:24,height:24,fill:"currentcolor",viewBox:"0 0 24 24"},[C("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"}),C("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"})]),Fn=()=>ie("WALINE_USER_META",{nick:"",mail:"",link:""}),On=()=>ie("WALINE_COMMENT_BOX_EDITOR",""),qn="WALINE_LIKE";let gt=null;const ht=()=>gt??(gt=ie(qn,[])),Gn="WALINE_REACTION";let ft=null;const Kn=()=>ft??(ft=ie(Gn,{})),wt={},Zn=n=>{const o=wt[n]??(wt[n]=Xt(n,{useRecaptchaNet:!0,autoHideBadge:!0}));return{execute:t=>o.then(e=>e.execute(t))}},Xn=n=>({execute:async o=>{const{load:t}=Ft("https://challenges.cloudflare.com/turnstile/v0/api.js",void 0,{async:!1});await t();const e=window==null?void 0:window.turnstile;return new Promise(i=>{e==null||e.ready(()=>{e==null||e.render(".wl-captcha-container",{sitekey:n,action:o,size:"compact",callback:i})})})}}),Yn="WALINE_USER";let yt=null;const _e=()=>yt??(yt=ie(Yn,{}));var Jn=me({__name:"ArticleReaction",setup(n,{expose:o}){o();const t=Kn(),e=Re("config"),i=p(-1),s=p([]),r=T(()=>e.value.locale),u=T(()=>e.value.reaction.length>0),l=T(()=>{const{reaction:f,path:S}=e.value;return f.map((R,_)=>({icon:R,desc:r.value[`reaction${_}`],active:t.value[S]===_}))});let a;const g=async()=>{if(!u.value)return;const{serverURL:f,lang:S,path:R,reaction:_}=e.value,I=new AbortController;a=I.abort.bind(I);const M=await St({serverURL:f,lang:S,paths:[R],type:_.map((x,q)=>`reaction${q}`),signal:I.signal});s.value=_.map((x,q)=>M[0][`reaction${q}`])},b=async f=>{if(i.value===-1){const{serverURL:S,lang:R,path:_}=e.value,I=t.value[_];i.value=f,I!==void 0&&(await We({serverURL:S,lang:R,path:_,type:`reaction${I}`,action:"desc"}),s.value[I]=Math.max(s.value[I]-1,0)),I!==f&&(await We({serverURL:S,lang:R,path:_,type:`reaction${f}`}),s.value[f]=(s.value[f]||0)+1),I===f?delete t.value[_]:t.value[_]=f,i.value=-1}};we(()=>{Q(()=>[e.value.serverURL,e.value.path],()=>{g()},{immediate:!0})}),Be(()=>a==null?void 0:a());const j={reactionStorage:t,config:e,votingIndex:i,voteNumbers:s,locale:r,isReactionEnabled:u,reactionsInfo:l,get abort(){return a},set abort(f){a=f},fetchReaction:g,vote:b,get LoadingIcon(){return ke}};return Object.defineProperty(j,"__isScriptSetup",{enumerable:!1,value:!0}),j}}),ve=(n,o)=>{const t=n.__vccOpts||n;for(const[e,i]of o)t[e]=i;return t};const Qn={key:0,class:"wl-reaction"},$n=["textContent"],eo={class:"wl-reaction-list"},to=["onClick"],no={class:"wl-reaction-img"},oo=["src","alt"],lo=["textContent"],ao=["textContent"];function io(n,o,t,e,i,s){return e.reactionsInfo.length?(c(),d("div",Qn,[m("div",{class:"wl-reaction-title",textContent:L(e.locale.reactionTitle)},null,8,$n),m("ul",eo,[(c(!0),d(V,null,O(e.reactionsInfo,({active:r,icon:u,desc:l},a)=>(c(),d("li",{key:a,class:P(["wl-reaction-item",{active:r}]),onClick:g=>e.vote(a)},[m("div",no,[m("img",{src:u,alt:l},null,8,oo),e.votingIndex===a?(c(),$(e.LoadingIcon,{key:0,class:"wl-reaction-loading"})):(c(),d("div",{key:1,class:"wl-reaction-votes",textContent:L(e.voteNumbers[a]||0)},null,8,lo))]),m("div",{class:"wl-reaction-text",textContent:L(l)},null,8,ao)],10,to))),128))])])):k("v-if",!0)}var ro=ve(Jn,[["render",io],["__file","ArticleReaction.vue"]]),so=me({__name:"ImageWall",props:{items:{default:()=>[]},columnWidth:{default:300},gap:{default:0}},emits:["insert"],setup(n,{expose:o}){const t=n;o();let e=null;const i=p(null),s=p({}),r=p([]),u=()=>{const f=Math.floor((i.value.getBoundingClientRect().width+t.gap)/(t.columnWidth+t.gap));return f>0?f:1},l=f=>new Array(f).fill(null).map(()=>[]),a=async f=>{var S;if(f>=t.items.length)return;await Fe();const R=Array.from(((S=i.value)==null?void 0:S.children)??[]).reduce((_,I)=>I.getBoundingClientRect().height<_.getBoundingClientRect().height?I:_);r.value[Number(R.dataset.index)].push(f),await a(f+1)},g=async(f=!1)=>{if(r.value.length===u()&&!f)return;r.value=l(u());const S=window.scrollY;await a(0),window.scrollTo({top:S})},b=f=>{s.value[f.target.src]=!0};we(()=>{g(!0),e=new ResizeObserver(()=>{g()}),e.observe(i.value),Q(()=>[t.items],()=>{s.value={},g(!0)}),Q(()=>[t.columnWidth,t.gap],()=>{g()})}),Ht(()=>e.unobserve(i.value));const j={props:t,get resizeObserver(){return e},set resizeObserver(f){e=f},wall:i,state:s,columns:r,getColumnCount:u,createColumns:l,fillColumns:a,redraw:g,imageLoad:b,get LoadingIcon(){return ke}};return Object.defineProperty(j,"__isScriptSetup",{enumerable:!1,value:!0}),j}});const co=["data-index"],uo=["src","title","onClick"];function mo(n,o,t,e,i,s){return c(),d("div",{ref:"wall",class:"wl-gallery",style:Oe({gap:`${t.gap}px`})},[(c(!0),d(V,null,O(e.columns,(r,u)=>(c(),d("div",{key:u,class:"wl-gallery-column","data-index":u,style:Oe({gap:`${t.gap}px`})},[(c(!0),d(V,null,O(r,l=>(c(),d(V,{key:l},[e.state[t.items[l].src]?k("v-if",!0):(c(),$(e.LoadingIcon,{key:0,size:36,style:{margin:"20px auto"}})),m("img",{class:"wl-gallery-item",src:t.items[l].src,title:t.items[l].title,loading:"lazy",onLoad:e.imageLoad,onClick:a=>n.$emit("insert",`![](${t.items[l].src})`)},null,40,uo)],64))),128))],12,co))),128))],4)}var vo=ve(so,[["render",mo],["__file","ImageWall.vue"]]),go=me({__name:"CommentBox",props:{edit:{default:null},rootId:{default:""},replyId:{default:""},replyUser:{default:""}},emits:["log","cancelEdit","cancelReply","submit"],setup(n,{expose:o,emit:t}){o();const e=n,i=t,s=Re("config"),r=On(),u=Fn(),l=_e(),a=p({}),g=p(null),b=p(null),j=p(null),f=p(null),S=p(null),R=p(null),_=p(null),I=p({tabs:[],map:{}}),M=p(0),x=p(!1),q=p(!1),se=p(!1),ce=p(""),oe=p(0),H=Ee({loading:!0,list:[]}),ne=p(0),Z=p(!1),ue=p(""),X=p(!1),le=p(!1),Y=T(()=>s.value.locale),y=T(()=>{var v;return!!((v=l.value)!=null&&v.token)}),E=T(()=>s.value.imageUploader!==!1),N=v=>{const h=g.value,w=h.selectionStart,A=h.selectionEnd||0,F=h.scrollTop;r.value=h.value.substring(0,w)+v+h.value.substring(A,h.value.length),h.focus(),h.selectionStart=w+v.length,h.selectionEnd=w+v.length,h.scrollTop=F},G=v=>{const h=v.key;(v.ctrlKey||v.metaKey)&&h==="Enter"&&Ce()},z=v=>{const h=`![${s.value.locale.uploading} ${v.name}]()`;return N(h),X.value=!0,Promise.resolve().then(()=>s.value.imageUploader(v)).then(w=>{r.value=r.value.replace(h,`\r
10
+ ![${v.name}](${w})`)}).catch(w=>{alert(w.message),r.value=r.value.replace(h,"")}).then(()=>{X.value=!1})},B=v=>{var h;if((h=v.dataTransfer)!=null&&h.items){const w=dt(v.dataTransfer.items);w&&E.value&&(z(w),v.preventDefault())}},W=v=>{if(v.clipboardData){const h=dt(v.clipboardData.items);h&&E.value&&z(h)}},de=()=>{const v=b.value;v.files&&E.value&&z(v.files[0]).then(()=>{v.value=""})},Ce=async()=>{var v,h,w,A,F,ae;const{serverURL:K,lang:J,login:ge,wordLimit:He,requiredMeta:Pe,recaptchaV3Key:Ne,turnstileKey:De}=s.value,Rt=await Mn(),U={comment:ue.value,nick:u.value.nick,mail:u.value.mail,link:u.value.link,url:s.value.path,ua:Rt};if((v=l.value)!=null&&v.token&&!e.edit)U.nick=l.value.display_name,U.mail=l.value.email,U.link=l.value.url;else{if(ge==="force")return;if(Pe.indexOf("nick")>-1&&!U.nick)return(h=a.value.nick)==null||h.focus(),alert(Y.value.nickError);if(Pe.indexOf("mail")>-1&&!U.mail||U.mail&&!yn(U.mail))return(w=a.value.mail)==null||w.focus(),alert(Y.value.mailError);U.nick||(U.nick=Y.value.anonymous)}if(!U.comment){(A=g.value)==null||A.focus();return}if(!Z.value)return alert(Y.value.wordHint.replace("$0",He[0].toString()).replace("$1",He[1].toString()).replace("$2",oe.value.toString()));U.comment=mt(U.comment,I.value.map),e.replyId&&e.rootId&&(U.pid=e.replyId,U.rid=e.rootId,U.at=e.replyUser),X.value=!0;try{Ne&&(U.recaptchaV3=await Zn(Ne).execute("social")),De&&(U.turnstile=await Xn(De).execute("social"));const he={serverURL:K,lang:J,token:(F=l.value)==null?void 0:F.token,comment:U},Ie=await(e.edit?fe({objectId:e.edit.objectId,...he}):xt(he));if(X.value=!1,Ie.errmsg)return alert(Ie.errmsg);i("submit",Ie.data),r.value="",ce.value="",await Fe(),e.replyId&&i("cancelReply"),(ae=e.edit)!=null&&ae.objectId&&i("cancelEdit")}catch(he){X.value=!1,alert(he.message)}},Le=v=>{v.preventDefault();const{lang:h,serverURL:w}=s.value;jt({serverURL:w,lang:h}).then(A=>{l.value=A,(A.remember?localStorage:sessionStorage).setItem("WALINE_USER",JSON.stringify(A)),i("log")})},Ct=()=>{l.value={},localStorage.setItem("WALINE_USER","null"),sessionStorage.setItem("WALINE_USER","null"),i("log")},Lt=v=>{v.preventDefault();const{lang:h,serverURL:w}=s.value,A=800,F=800,ae=(window.innerWidth-A)/2,K=(window.innerHeight-F)/2,J=new URLSearchParams({lng:h,token:l.value.token}),ge=window.open(`${w}/ui/profile?${J.toString()}`,"_blank",`width=${A},height=${F},left=${ae},top=${K},scrollbars=no,resizable=no,status=no,location=no,toolbar=no,menubar=no`);ge==null||ge.postMessage({type:"TOKEN",data:l.value.token},"*")},ze=v=>{var h,w,A,F;!((h=j.value)!=null&&h.contains(v.target))&&!((w=f.value)!=null&&w.contains(v.target))&&(x.value=!1),!((A=S.value)!=null&&A.contains(v.target))&&!((F=R.value)!=null&&F.contains(v.target))&&(q.value=!1)},Te=async v=>{var h;const{scrollTop:w,clientHeight:A,scrollHeight:F}=v.target,ae=(A+w)/F,K=s.value.search,J=((h=_.value)==null?void 0:h.value)??"";ae<.9||H.loading||le.value||(H.loading=!0,(K.more&&H.list.length?await K.more(J,H.list.length):await K.search(J)).length?H.list=[...H.list,...K.more&&H.list.length?await K.more(J,H.list.length):await K.search(J)]:le.value=!0,H.loading=!1,setTimeout(()=>{v.target.scrollTop=w},50))},It=Ot(v=>{H.list=[],le.value=!1,Te(v)},300);Q([s,oe],([v,h])=>{const{wordLimit:w}=v;w?h<w[0]&&w[0]!==0?(ne.value=w[0],Z.value=!1):h>w[1]?(ne.value=w[1],Z.value=!1):(ne.value=w[1],Z.value=!0):(ne.value=0,Z.value=!0)},{immediate:!0}),Ke("click",ze),Ke("message",({data:v})=>{!v||v.type!=="profile"||(l.value={...l.value,...v.data},[localStorage,sessionStorage].filter(h=>h.getItem("WALINE_USER")).forEach(h=>h.setItem("WALINE_USER",JSON.stringify(l))))}),Q(q,async v=>{var h;if(!v)return;const w=s.value.search;_.value&&(_.value.value=""),H.loading=!0,H.list=await(((h=w.default)==null?void 0:h.call(w))??w.search("")),H.loading=!1}),we(()=>{var v;(v=e.edit)!=null&&v.objectId&&(r.value=e.edit.orig),Q(()=>r.value,h=>{const{highlighter:w,texRenderer:A}=s.value;ue.value=h,ce.value=En(h,{emojiMap:I.value.map,highlighter:w,texRenderer:A}),oe.value=jn(h),h?Ze(g.value):Ze.destroy(g.value)},{immediate:!0}),Q(()=>s.value.emoji,h=>kn(h).then(w=>{I.value=w}),{immediate:!0})});const Ve={props:e,emit:i,config:s,editor:r,userMeta:u,userInfo:l,inputRefs:a,editorRef:g,imageUploadRef:b,emojiButtonRef:j,emojiPopupRef:f,gifButtonRef:S,gifPopupRef:R,gifSearchInputRef:_,emoji:I,emojiTabIndex:M,showEmoji:x,showGif:q,showPreview:se,previewText:ce,wordNumber:oe,searchResults:H,wordLimit:ne,isWordNumberLegal:Z,content:ue,isSubmitting:X,isImageListEnd:le,locale:Y,isLogin:y,canUploadImage:E,insert:N,onKeyDown:G,uploadImage:z,onDrop:B,onPaste:W,onChange:de,submitComment:Ce,onLogin:Le,onLogout:Ct,onProfile:Lt,popupHandler:ze,onImageWallScroll:Te,onGifSearch:It,get CloseIcon(){return An},get EmojiIcon(){return zn},get GifIcon(){return Bn},get ImageIcon(){return Tn},get LoadingIcon(){return ke},get MarkdownIcon(){return Pn},get PreviewIcon(){return Hn},ImageWall:vo};return Object.defineProperty(Ve,"__isScriptSetup",{enumerable:!1,value:!0}),Ve}});const ho={key:0,class:"wl-login-info"},fo={class:"wl-avatar"},wo=["title"],yo=["title"],bo=["src"],po=["title","textContent"],ko={class:"wl-panel"},_o=["for","textContent"],Co=["id","onUpdate:modelValue","name","type"],Lo=["placeholder"],Io={class:"wl-preview"},Ro=m("hr",null,null,-1),Eo=["innerHTML"],So={class:"wl-footer"},xo={class:"wl-actions"},jo={href:"https://guides.github.com/features/mastering-markdown/",title:"Markdown Guide","aria-label":"Markdown is supported",class:"wl-action",target:"_blank",rel:"noopener noreferrer"},Mo=["title"],Ao=["title"],Uo=["title"],zo=["title"],To={class:"wl-info"},Vo=m("div",{class:"wl-captcha-container"},null,-1),Ho={class:"wl-text-number"},Po={key:0},No=["textContent"],Do=["textContent"],Wo=["disabled"],Bo=["placeholder"],Fo={key:1,class:"wl-loading"},Oo={key:0,class:"wl-tab-wrapper"},qo=["title","onClick"],Go=["src","alt"],Ko={key:0,class:"wl-tabs"},Zo=["onClick"],Xo=["src","alt","title"],Yo=["title"];function Jo(n,o,t,e,i,s){var r,u;return c(),d("div",{key:Number(e.isLogin),class:"wl-comment"},[e.config.login!=="disable"&&e.isLogin&&!((r=t.edit)!=null&&r.objectId)?(c(),d("div",ho,[m("div",fo,[m("button",{type:"submit",class:"wl-logout-btn",title:e.locale.logout,onClick:e.onLogout},[D(e.CloseIcon,{size:14})],8,wo),m("a",{href:"#",class:"wl-login-nick","aria-label":"Profile",title:e.locale.profile,onClick:e.onProfile},[m("img",{src:e.userInfo.avatar,alt:"avatar"},null,8,bo)],8,yo)]),m("a",{href:"#",class:"wl-login-nick","aria-label":"Profile",title:e.locale.profile,onClick:e.onProfile,textContent:L(e.userInfo.display_name)},null,8,po)])):k("v-if",!0),m("div",ko,[e.config.login!=="force"&&e.config.meta.length&&!e.isLogin?(c(),d("div",{key:0,class:P(["wl-header",`item${e.config.meta.length}`])},[(c(!0),d(V,null,O(e.config.meta,l=>(c(),d("div",{key:l,class:"wl-header-item"},[m("label",{for:`wl-${l}`,textContent:L(e.locale[l]+(e.config.requiredMeta.includes(l)||!e.config.requiredMeta.length?"":`(${e.locale.optional})`))},null,8,_o),ye(m("input",{id:`wl-${l}`,ref_for:!0,ref:a=>{a&&(e.inputRefs[l]=a)},"onUpdate:modelValue":a=>e.userMeta[l]=a,class:P(["wl-input",`wl-${l}`]),name:l,type:l==="mail"?"email":"text"},null,10,Co),[[Pt,e.userMeta[l]]])]))),128))],2)):k("v-if",!0),ye(m("textarea",{id:"wl-edit",ref:"editorRef","onUpdate:modelValue":o[0]||(o[0]=l=>e.editor=l),class:"wl-editor",placeholder:t.replyUser?`@${t.replyUser}`:e.locale.placeholder,onKeydown:e.onKeyDown,onDrop:e.onDrop,onPaste:e.onPaste},null,40,Lo),[[Nt,e.editor]]),ye(m("div",Io,[Ro,m("h4",null,L(e.locale.preview)+":",1),m("div",{class:"wl-content",innerHTML:e.previewText},null,8,Eo)],512),[[qe,e.showPreview]]),m("div",So,[m("div",xo,[m("a",jo,[D(e.MarkdownIcon)]),ye(m("button",{ref:"emojiButtonRef",type:"button",class:P(["wl-action",{active:e.showEmoji}]),title:e.locale.emoji,onClick:o[1]||(o[1]=l=>e.showEmoji=!e.showEmoji)},[D(e.EmojiIcon)],10,Mo),[[qe,e.emoji.tabs.length]]),e.config.search?(c(),d("button",{key:0,ref:"gifButtonRef",type:"button",class:P(["wl-action",{active:e.showGif}]),title:e.locale.gif,onClick:o[2]||(o[2]=l=>e.showGif=!e.showGif)},[D(e.GifIcon)],10,Ao)):k("v-if",!0),m("input",{id:"wl-image-upload",ref:"imageUploadRef",class:"upload",type:"file",accept:".png,.jpg,.jpeg,.webp,.bmp,.gif",onChange:e.onChange},null,544),e.canUploadImage?(c(),d("label",{key:1,for:"wl-image-upload",class:"wl-action",title:e.locale.uploadImage},[D(e.ImageIcon)],8,Uo)):k("v-if",!0),m("button",{type:"button",class:P(["wl-action",{active:e.showPreview}]),title:e.locale.preview,onClick:o[3]||(o[3]=l=>e.showPreview=!e.showPreview)},[D(e.PreviewIcon)],10,zo)]),m("div",To,[Vo,m("div",Ho,[ee(L(e.wordNumber)+" ",1),e.config.wordLimit?(c(),d("span",Po,[ee("  /  "),m("span",{class:P({illegal:!e.isWordNumberLegal}),textContent:L(e.wordLimit)},null,10,No)])):k("v-if",!0),ee("  "+L(e.locale.word),1)]),e.config.login!=="disable"&&!e.isLogin?(c(),d("button",{key:0,type:"button",class:"wl-btn",onClick:e.onLogin,textContent:L(e.locale.login)},null,8,Do)):k("v-if",!0),e.config.login!=="force"||e.isLogin?(c(),d("button",{key:1,type:"submit",class:"primary wl-btn",title:"Cmd|Ctrl + Enter",disabled:e.isSubmitting,onClick:e.submitComment},[e.isSubmitting?(c(),$(e.LoadingIcon,{key:0,size:16})):(c(),d(V,{key:1},[ee(L(e.locale.submit),1)],64))],8,Wo)):k("v-if",!0)]),m("div",{ref:"gifPopupRef",class:P(["wl-gif-popup",{display:e.showGif}])},[m("input",{ref:"gifSearchInputRef",type:"text",placeholder:e.locale.gifSearchPlaceholder,onInput:o[4]||(o[4]=(...l)=>e.onGifSearch&&e.onGifSearch(...l))},null,40,Bo),e.searchResults.list.length?(c(),$(e.ImageWall,{key:0,items:e.searchResults.list,"column-width":200,gap:6,onInsert:o[5]||(o[5]=l=>e.insert(l)),onScroll:e.onImageWallScroll},null,8,["items"])):k("v-if",!0),e.searchResults.loading?(c(),d("div",Fo,[D(e.LoadingIcon,{size:30})])):k("v-if",!0)],2),m("div",{ref:"emojiPopupRef",class:P(["wl-emoji-popup",{display:e.showEmoji}])},[(c(!0),d(V,null,O(e.emoji.tabs,(l,a)=>(c(),d(V,{key:l.name},[a===e.emojiTabIndex?(c(),d("div",Oo,[(c(!0),d(V,null,O(l.items,g=>(c(),d("button",{key:g,type:"button",title:g,onClick:b=>e.insert(`:${g}:`)},[e.showEmoji?(c(),d("img",{key:0,class:"wl-emoji",src:e.emoji.map[g],alt:g,loading:"lazy",referrerPolicy:"no-referrer"},null,8,Go)):k("v-if",!0)],8,qo))),128))])):k("v-if",!0)],64))),128)),e.emoji.tabs.length>1?(c(),d("div",Ko,[(c(!0),d(V,null,O(e.emoji.tabs,(l,a)=>(c(),d("button",{key:l.name,type:"button",class:P(["wl-tab",{active:e.emojiTabIndex===a}]),onClick:g=>e.emojiTabIndex=a},[m("img",{class:"wl-emoji",src:l.icon,alt:l.name,title:l.name,loading:"lazy",referrerPolicy:"no-referrer"},null,8,Xo)],10,Zo))),128))])):k("v-if",!0)],2)])]),t.replyId||(u=t.edit)!=null&&u.objectId?(c(),d("button",{key:1,type:"button",class:"wl-close",title:e.locale.cancelReply,onClick:o[6]||(o[6]=l=>t.replyId?e.emit("cancelReply"):e.emit("cancelEdit"))},[D(e.CloseIcon,{size:24})],8,Yo)):k("v-if",!0)])}var bt=ve(go,[["render",Jo],["__file","CommentBox.vue"]]),Qo=me({__name:"CommentCard",props:{comment:{},edit:{default:null},rootId:{},reply:{default:null}},emits:["log","submit","delete","edit","like","status","sticky","reply"],setup(n,{expose:o,emit:t}){o();const e=n,i=t,s=["approved","waiting","spam"],r=Re("config"),u=ht(),l=qt(),a=_e(),g=T(()=>r.value.locale),b=T(()=>{const{link:x}=e.comment;return x?st(x)?x:`https://${x}`:""}),j=T(()=>u.value.includes(e.comment.objectId)),f=T(()=>fn(new Date(e.comment.time),l.value,g.value)),S=T(()=>a.value.type==="administrator"),R=T(()=>e.comment.user_id&&a.value.objectId===e.comment.user_id),_=T(()=>{var x;return e.comment.objectId===((x=e.reply)==null?void 0:x.objectId)}),I=T(()=>{var x;return e.comment.objectId===((x=e.edit)==null?void 0:x.objectId)}),M={props:e,emit:i,commentStatus:s,config:r,likes:u,now:l,userInfo:a,locale:g,link:b,like:j,time:f,isAdmin:S,isOwner:R,isReplyingCurrent:_,isEditingCurrent:I,CommentBox:bt,get DeleteIcon(){return Un},get EditIcon(){return Dn},get LikeIcon(){return Vn},get ReplyIcon(){return Nn},get VerifiedIcon(){return Wn}};return Object.defineProperty(M,"__isScriptSetup",{enumerable:!1,value:!0}),M}});const $o=["id"],el={class:"wl-user","aria-hidden":"true"},tl=["src"],nl={class:"wl-card"},ol={class:"wl-head"},ll=["href"],al={key:1,class:"wl-nick"},il=["textContent"],rl=["textContent"],sl=["textContent"],cl=["textContent"],ul=["textContent"],dl={class:"wl-comment-actions"},ml=["title"],vl=["title"],gl={class:"wl-meta","aria-hidden":"true"},hl=["data-value","textContent"],fl={key:0,class:"wl-content"},wl={key:0},yl=["href"],bl=m("span",null,": ",-1),pl=["innerHTML"],kl={key:1,class:"wl-admin-actions"},_l={class:"wl-comment-status"},Cl=["disabled","onClick","textContent"],Ll={key:3,class:"wl-quote"};function Il(n,o,t,e,i,s){var u;const r=Dt("CommentCard",!0);return c(),d("div",{id:t.comment.objectId,class:"wl-card-item"},[m("div",el,[t.comment.avatar?(c(),d("img",{key:0,class:"wl-user-avatar",src:t.comment.avatar},null,8,tl)):k("v-if",!0),t.comment.type?(c(),$(e.VerifiedIcon,{key:1})):k("v-if",!0)]),m("div",nl,[m("div",ol,[e.link?(c(),d("a",{key:0,class:"wl-nick",href:e.link,target:"_blank",rel:"nofollow noopener noreferrer"},L(t.comment.nick),9,ll)):(c(),d("span",al,L(t.comment.nick),1)),t.comment.type==="administrator"?(c(),d("span",{key:2,class:"wl-badge",textContent:L(e.locale.admin)},null,8,il)):k("v-if",!0),t.comment.label?(c(),d("span",{key:3,class:"wl-badge",textContent:L(t.comment.label)},null,8,rl)):k("v-if",!0),t.comment.sticky?(c(),d("span",{key:4,class:"wl-badge",textContent:L(e.locale.sticky)},null,8,sl)):k("v-if",!0),typeof t.comment.level=="number"?(c(),d("span",{key:5,class:P(`wl-badge level${t.comment.level}`),textContent:L(e.locale[`level${t.comment.level}`]||`Level ${t.comment.level}`)},null,10,cl)):k("v-if",!0),m("span",{class:"wl-time",textContent:L(e.time)},null,8,ul),m("div",dl,[e.isAdmin||e.isOwner?(c(),d(V,{key:0},[m("button",{type:"button",class:"wl-edit",onClick:o[0]||(o[0]=l=>e.emit("edit",t.comment))},[D(e.EditIcon)]),m("button",{type:"button",class:"wl-delete",onClick:o[1]||(o[1]=l=>e.emit("delete",t.comment))},[D(e.DeleteIcon)])],64)):k("v-if",!0),m("button",{type:"button",class:"wl-like",title:e.like?e.locale.cancelLike:e.locale.like,onClick:o[2]||(o[2]=l=>e.emit("like",t.comment))},[D(e.LikeIcon,{active:e.like},null,8,["active"]),ee(" "+L("like"in t.comment?t.comment.like:""),1)],8,ml),m("button",{type:"button",class:P(["wl-reply",{active:e.isReplyingCurrent}]),title:e.isReplyingCurrent?e.locale.cancelReply:e.locale.reply,onClick:o[3]||(o[3]=l=>e.emit("reply",e.isReplyingCurrent?null:t.comment))},[D(e.ReplyIcon)],10,vl)])]),m("div",gl,[(c(),d(V,null,O(["addr","browser","os"],l=>(c(),d(V,null,[t.comment[l]?(c(),d("span",{key:l,class:P(`wl-${l}`),"data-value":t.comment[l],textContent:L(t.comment[l])},null,10,hl)):k("v-if",!0)],64))),64))]),e.isEditingCurrent?k("v-if",!0):(c(),d("div",fl,[t.comment.reply_user?(c(),d("p",wl,[m("a",{href:"#"+t.comment.pid},"@"+L(t.comment.reply_user.nick),9,yl),bl])):k("v-if",!0),m("div",{innerHTML:t.comment.comment},null,8,pl)])),e.isAdmin&&!e.isEditingCurrent?(c(),d("div",kl,[m("span",_l,[(c(),d(V,null,O(e.commentStatus,l=>m("button",{key:l,type:"submit",class:P(`wl-btn wl-${l}`),disabled:t.comment.status===l,onClick:a=>e.emit("status",{status:l,comment:t.comment}),textContent:L(e.locale[l])},null,10,Cl)),64))]),e.isAdmin&&!("rid"in t.comment)?(c(),d("button",{key:0,type:"submit",class:"wl-btn wl-sticky",onClick:o[4]||(o[4]=l=>e.emit("sticky",t.comment))},L(t.comment.sticky?e.locale.unsticky:e.locale.sticky),1)):k("v-if",!0)])):k("v-if",!0),e.isReplyingCurrent||e.isEditingCurrent?(c(),d("div",{key:2,class:P({"wl-reply-wrapper":e.isReplyingCurrent,"wl-edit-wrapper":e.isEditingCurrent})},[D(e.CommentBox,{edit:t.edit,"reply-id":(u=t.reply)==null?void 0:u.objectId,"reply-user":t.comment.nick,"root-id":t.rootId,onLog:o[5]||(o[5]=l=>e.emit("log")),onCancelReply:o[6]||(o[6]=l=>e.emit("reply",null)),onCancelEdit:o[7]||(o[7]=l=>e.emit("edit",null)),onSubmit:o[8]||(o[8]=l=>e.emit("submit",l))},null,8,["edit","reply-id","reply-user","root-id"])],2)):k("v-if",!0),"children"in t.comment?(c(),d("div",Ll,[(c(!0),d(V,null,O(t.comment.children,l=>(c(),$(r,{key:l.objectId,comment:l,reply:t.reply,edit:t.edit,"root-id":t.rootId,onLog:o[9]||(o[9]=a=>e.emit("log")),onDelete:o[10]||(o[10]=a=>e.emit("delete",a)),onEdit:o[11]||(o[11]=a=>e.emit("edit",a)),onLike:o[12]||(o[12]=a=>e.emit("like",a)),onReply:o[13]||(o[13]=a=>e.emit("reply",a)),onStatus:o[14]||(o[14]=a=>e.emit("status",a)),onSticky:o[15]||(o[15]=a=>e.emit("sticky",a)),onSubmit:o[16]||(o[16]=a=>e.emit("submit",a))},null,8,["comment","reply","edit","root-id"]))),128))])):k("v-if",!0)])],8,$o)}var Rl=ve(Qo,[["render",Il],["__file","CommentCard.vue"]]);const pt="3.2.5";var El=me({__name:"WalineComment",props:["serverURL","path","meta","requiredMeta","dark","commentSorting","lang","locale","pageSize","wordLimit","emoji","login","highlighter","texRenderer","imageUploader","search","copyright","recaptchaV3Key","turnstileKey","reaction"],setup(n,{expose:o}){o();const t=n,e={latest:"insertedAt_desc",oldest:"insertedAt_asc",hottest:"like_desc"},i=Object.keys(e),s=_e(),r=ht(),u=p("loading"),l=p(0),a=p(1),g=p(0),b=T(()=>vn(t)),j=p(b.value.commentSorting),f=p([]),S=p(null),R=p(null),_=T(()=>gn(b.value.dark)),I=T(()=>b.value.locale);Gt(_,{id:"waline-darkmode"});let M;const x=y=>{var E;const{serverURL:N,path:G,pageSize:z}=b.value,B=new AbortController;u.value="loading",M==null||M(),Mt({serverURL:N,lang:b.value.lang,path:G,pageSize:z,sortBy:e[j.value],page:y,signal:B.signal,token:(E=s.value)==null?void 0:E.token}).then(W=>{u.value="success",l.value=W.count,f.value.push(...W.data),a.value=y,g.value=W.totalPages}).catch(W=>{W.name!=="AbortError"&&(console.error(W.message),u.value="error")}),M=B.abort.bind(B)},q=()=>x(a.value+1),se=()=>{l.value=0,f.value=[],x(1)},ce=y=>{j.value!==y&&(j.value=y,se())},oe=y=>{S.value=y},H=y=>{R.value=y},ne=y=>{if(R.value)R.value.comment=y.comment,R.value.orig=y.orig;else if("rid"in y){const E=f.value.find(({objectId:N})=>N===y.rid);if(!E)return;Array.isArray(E.children)||(E.children=[]),E.children.push(y)}else f.value.unshift(y),l.value+=1},Z=async({comment:y,status:E})=>{var N;if(y.status===E)return;const{serverURL:G,lang:z}=b.value;await fe({serverURL:G,lang:z,token:(N=s.value)==null?void 0:N.token,objectId:y.objectId,comment:{status:E}}),y.status=E},ue=async y=>{var E;if("rid"in y)return;const{serverURL:N,lang:G}=b.value;await fe({serverURL:N,lang:G,token:(E=s.value)==null?void 0:E.token,objectId:y.objectId,comment:{sticky:y.sticky?0:1}}),y.sticky=!y.sticky},X=async({objectId:y})=>{var E;if(!confirm("Are you sure you want to delete this comment?"))return;const{serverURL:N,lang:G}=b.value;await At({serverURL:N,lang:G,token:(E=s.value)==null?void 0:E.token,objectId:y}),f.value.some((z,B)=>z.objectId===y?(f.value=f.value.filter((W,de)=>de!==B),!0):z.children.some((W,de)=>W.objectId===y?(f.value[B].children=z.children.filter((Ce,Le)=>Le!==de),!0):!1))},le=async y=>{var E;const{serverURL:N,lang:G}=b.value,{objectId:z}=y,B=r.value.includes(z);await fe({serverURL:N,lang:G,objectId:z,token:(E=s.value)==null?void 0:E.token,comment:{like:!B}}),B?r.value=r.value.filter(W=>W!==z):(r.value=[...r.value,z],r.value.length>50&&(r.value=r.value.slice(-50))),y.like=(y.like||0)+(B?-1:1)};Wt("config",b),we(()=>{Q(()=>[t.serverURL,t.path],()=>se(),{immediate:!0})}),Be(()=>M==null?void 0:M());const Y={props:t,sortKeyMap:e,sortingMethods:i,userInfo:s,likeStorage:r,status:u,count:l,page:a,totalPages:g,config:b,commentSortingRef:j,data:f,reply:S,edit:R,darkmodeStyle:_,i18n:I,get abort(){return M},set abort(y){M=y},getCommentData:x,loadMore:q,refresh:se,onSortByChange:ce,onReply:oe,onEdit:H,onSubmit:ne,onStatusChange:Z,onSticky:ue,onDelete:X,onLike:le,Reaction:ro,CommentBox:bt,CommentCard:Rl,get LoadingIcon(){return ke},get version(){return pt}};return Object.defineProperty(Y,"__isScriptSetup",{enumerable:!1,value:!0}),Y}});const Sl={"data-waline":""},xl={class:"wl-meta-head"},jl={class:"wl-count"},Ml=["textContent"],Al={class:"wl-sort"},Ul=["onClick"],zl={class:"wl-cards"},Tl={key:1,class:"wl-operation"},Vl=["textContent"],Hl={key:2,class:"wl-loading"},Pl=["textContent"],Nl={key:4,class:"wl-operation"},Dl=["textContent"],Wl={key:5,class:"wl-power"},Bl=m("a",{href:"https://github.com/walinejs/waline",target:"_blank",rel:"noopener noreferrer"}," Waline ",-1);function Fl(n,o,t,e,i,s){return c(),d("div",Sl,[D(e.Reaction),e.reply?k("v-if",!0):(c(),$(e.CommentBox,{key:0,onLog:e.refresh,onSubmit:e.onSubmit})),m("div",xl,[m("div",jl,[e.count?(c(),d("span",{key:0,class:"wl-num",textContent:L(e.count)},null,8,Ml)):k("v-if",!0),ee(" "+L(e.i18n.comment),1)]),m("ul",Al,[(c(!0),d(V,null,O(e.sortingMethods,r=>(c(),d("li",{key:r,class:P([r===e.commentSortingRef?"active":""]),onClick:u=>e.onSortByChange(r)},L(e.i18n[r]),11,Ul))),128))])]),m("div",zl,[(c(!0),d(V,null,O(e.data,r=>(c(),$(e.CommentCard,{key:r.objectId,"root-id":r.objectId,comment:r,reply:e.reply,edit:e.edit,onLog:e.refresh,onReply:e.onReply,onEdit:e.onEdit,onSubmit:e.onSubmit,onStatus:e.onStatusChange,onDelete:e.onDelete,onSticky:e.onSticky,onLike:e.onLike},null,8,["root-id","comment","reply","edit"]))),128))]),e.status==="error"?(c(),d("div",Tl,[m("button",{type:"button",class:"wl-btn",onClick:e.refresh,textContent:L(e.i18n.refresh)},null,8,Vl)])):e.status==="loading"?(c(),d("div",Hl,[D(e.LoadingIcon,{size:30})])):e.data.length?e.page<e.totalPages?(c(),d("div",Nl,[m("button",{type:"button",class:"wl-btn",onClick:e.loadMore,textContent:L(e.i18n.more)},null,8,Dl)])):k("v-if",!0):(c(),d("div",{key:3,class:"wl-empty",textContent:L(e.i18n.sofa)},null,8,Pl)),e.config.copyright?(c(),d("div",Wl,[ee(" Powered by "),Bl,ee(" v"+L(e.version),1)])):k("v-if",!0)])}var Ol=ve(El,[["render",Fl],["__file","WalineComment.vue"]]);const kt=(n,o)=>{o.forEach((t,e)=>{const i=n[e].time;typeof i=="number"&&(t.innerText=i.toString())})},_t=({serverURL:n,path:o=window.location.pathname,selector:t=".waline-pageview-count",update:e=!0,lang:i=navigator.language})=>{const s=new AbortController,r=Array.from(document.querySelectorAll(t)),u=a=>{const g=Ue(a);return g!==null&&o!==g},l=a=>zt({serverURL:pe(n),paths:a.map(g=>Ue(g)??o),lang:i,signal:s.signal}).then(g=>kt(g,a)).catch(ut);if(e){const a=r.filter(b=>!u(b)),g=r.filter(u);Ut({serverURL:pe(n),path:o,lang:i}).then(b=>kt(b,a)),g.length&&l(g)}else l(r);return s.abort.bind(s)},ql=({el:n="#waline",path:o=window.location.pathname,comment:t=!1,pageview:e=!1,...i})=>{const s=n?Ae(n):null;if(n&&!s)throw new Error("Option 'el' do not match any domElement!");if(!i.serverURL)throw new Error("Option 'serverURL' is missing!");const r=Ee({...i}),u=Ee({comment:t,pageview:e,path:o}),l=()=>{u.comment&&vt({serverURL:r.serverURL,path:u.path,...re(u.comment)?{selector:u.comment}:{}})},a=()=>{u.pageview&&_t({serverURL:r.serverURL,path:u.path,...re(u.pageview)?{selector:u.pageview}:{}})},g=s?Bt(()=>C(Ol,{path:u.path,...r})):null;g&&g.mount(s);const b=Ge(l),j=Ge(a);return{el:s,update:({comment:f,pageview:S,path:R=window.location.pathname,..._}={})=>{Object.entries(_).forEach(([I,M])=>{r[I]=M}),u.path=R,f!==void 0&&(u.comment=f),S!==void 0&&(u.pageview=S)},destroy:()=>{g==null||g.unmount(),b(),j()}}},Gl=({el:n,serverURL:o,count:t,lang:e=navigator.language})=>{var i;const s=_e(),r=Ae(n),u=new AbortController;return Tt({serverURL:o,count:t,lang:e,signal:u.signal,token:(i=s.value)==null?void 0:i.token}).then(l=>r&&l.length?(r.innerHTML=`<ul class="wl-recent-list">${l.map(a=>`<li class="wl-recent-item"><a href="${a.url}">${a.nick}</a>:${a.comment}</li>`).join("")}</ul>`,{comments:l,destroy:()=>{u.abort(),r.innerHTML=""}}):{comments:l,destroy:()=>u.abort()})},Kl=({el:n,serverURL:o,count:t,locale:e,lang:i=navigator.language,mode:s="list"})=>{const r=Ae(n),u=new AbortController;return Vt({serverURL:o,pageSize:t,lang:i,signal:u.signal}).then(l=>!r||!l.length?{users:l,destroy:()=>u.abort()}:(e={...at(i),...typeof e=="object"?e:{}},r.innerHTML=`<ul class="wl-user-${s}">${l.map((a,g)=>[`<li class="wl-user-item" aria-label="${a.nick}">`,a.link&&`<a href="${a.link}" target="_blank">`,'<div class="wl-user-avatar">',`<img src="${a.avatar}" alt="${a.nick}">`,`<span class="wl-user-badge">${g+1}</span>`,"</div>",'<div class="wl-user-meta">','<div class="wl-user-name">',a.nick,a.level&&`<span class="wl-badge">${e?e[`level${a.level}`]:`Level ${a.level}`}</span>`,a.label&&`<span class="wl-badge">${a.label}</span>`,"</div>",a.link&&a.link,"</div>",a.link&&"</a>","</li>"].filter(b=>b).join("")).join("")}</ul>`,{users:l,destroy:()=>{u.abort(),r.innerHTML=""}}))};export{Gl as RecentComments,Kl as UserList,vt as commentCount,be as defaultLocales,ql as init,_t as pageviewCount,pt as version};
11
11
  //# sourceMappingURL=slim.js.map