@waline/client 3.7.0 → 3.7.1

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.7.0",$={"Content-Type":"application/json"},h=e=>`${e.replace(/\/?$/,"/")}api/`,u=(e,t="")=>{if(typeof e=="object"&&e.errno)throw new TypeError(`${t} failed with ${e.errno}: ${e.errmsg}`);return e},f=({serverURL:e,lang:t,paths:r,type:o,signal:a})=>fetch(`${h(e)}article?path=${encodeURIComponent(r.join(","))}&type=${encodeURIComponent(o.join(","))}&lang=${t}`,{signal:a}).then(n=>n.json()).then(n=>u(n,"Get counter").data),R=({serverURL:e,lang:t,path:r,type:o,action:a})=>fetch(`${h(e)}article?lang=${t}`,{method:"POST",headers:$,body:JSON.stringify({path:r,type:o,action:a})}).then(n=>n.json()).then(n=>u(n,"Update counter").data),U=({serverURL:e,lang:t,paths:r,signal:o})=>f({serverURL:e,lang:t,paths:r,type:["time"],signal:o}),w=e=>R({...e,type:"time",action:"inc"}),L=(e="")=>e.replace(/\/$/u,""),b=e=>/^(https?:)?\/\//.test(e),d=e=>{const t=L(e);return b(t)?t:`https://${t}`},j=e=>{e.name!=="AbortError"&&console.error(e.message)},m=e=>{const{path:t}=e.dataset;return t!=null&&t.length?t:null},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=>U({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.7.1",$={"Content-Type":"application/json"},h=e=>`${e.replace(/\/?$/,"/")}api/`,u=(e,t="")=>{if(typeof e=="object"&&e.errno)throw new TypeError(`${t} failed with ${e.errno}: ${e.errmsg}`);return e},f=({serverURL:e,lang:t,paths:r,type:o,signal:a})=>fetch(`${h(e)}article?path=${encodeURIComponent(r.join(","))}&type=${encodeURIComponent(o.join(","))}&lang=${t}`,{signal:a}).then(n=>n.json()).then(n=>u(n,"Get counter").data),R=({serverURL:e,lang:t,path:r,type:o,action:a})=>fetch(`${h(e)}article?lang=${t}`,{method:"POST",headers:$,body:JSON.stringify({path:r,type:o,action:a})}).then(n=>n.json()).then(n=>u(n,"Update counter").data),U=({serverURL:e,lang:t,paths:r,signal:o})=>f({serverURL:e,lang:t,paths:r,type:["time"],signal:o}),w=e=>R({...e,type:"time",action:"inc"}),L=(e="")=>e.replace(/\/$/u,""),b=e=>/^(https?:)?\/\//.test(e),d=e=>{const t=L(e);return b(t)?t:`https://${t}`},j=e=>{e.name!=="AbortError"&&console.error(e.message)},m=e=>{const{path:t}=e.dataset;return t!=null&&t.length?t:null},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=>U({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
@@ -7,6 +7,6 @@ import{fetchCommentCount as Lt,getArticleCounter as Et,updateArticleCounter as V
7
7
  Номер текущего слова: $2`,"Анонимный","Dwarves","Hobbits","Ents","Wizards","Elves","Maiar","GIF","Поиск GIF","Персональные данные","Одобренный","Ожидающий","Спам","Нелипкий","самый старый","последний","самый горячий","Что вы думаете?"]),Ye=J(["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ừ!
8
8
  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?"]),Je=J(["昵称","昵称不能少于3个字符","邮箱","请填写正确的邮件地址","网址","可选","欢迎评论","来发评论吧~","提交","喜欢","取消喜欢","回复","取消回复","评论","刷新","加载更多...","预览","表情","上传图片","秒前","分钟前","小时前","天前","刚刚","正在上传","登录","退出","博主","置顶","字",`评论字数应在 $0 到 $1 字之间!
9
9
  当前字数:$2`,"匿名","潜水","冒泡","吐槽","活跃","话痨","传说","表情包","搜索表情包","个人资料","通过","待审核","垃圾","取消置顶","按倒序","按正序","按热度","你认为这篇文章怎么样?"]),sa=J(["暱稱","暱稱不能少於3個字元","郵箱","請填寫正確的郵件地址","網址","可選","歡迎留言","來發留言吧~","送出","喜歡","取消喜歡","回覆","取消回覆","留言","重整","載入更多...","預覽","表情","上傳圖片","秒前","分鐘前","小時前","天前","剛剛","正在上傳","登入","登出","管理者","置頂","字",`留言字數應在 $0 到 $1 字之間!
10
- 目前字數:$2`,"匿名","潛水","冒泡","吐槽","活躍","多話","傳說","表情包","搜尋表情包","個人資料","通過","待審核","垃圾","取消置頂","最早","最新","熱門","你認為這篇文章怎麼樣?"]);const Qe="en-US",fe={zh:Je,"zh-cn":Je,"zh-tw":sa,en:Oe,"en-us":Oe,fr:Ke,"fr-fr":Ke,jp:Ze,"jp-jp":Ze,"pt-br":ia,ru:Xe,"ru-ru":Xe,vi:Ye,"vi-vn":Ye,de:oa,es:Ge,"es-mx":Ge},et=e=>fe[e.toLowerCase()]||fe[Qe.toLowerCase()],tt=e=>Object.keys(fe).includes(e.toLowerCase())?e:Qe,at={latest:"insertedAt_desc",oldest:"insertedAt_asc",hottest:"like_desc"},ca=Object.keys(at),we=Symbol("waline-config"),lt=e=>{try{e=decodeURI(e)}catch{}return e},nt=(e="")=>e.replace(/\/$/u,""),rt=e=>/^(https?:)?\/\//.test(e),ye=e=>{const l=nt(e);return rt(l)?l:`https://${l}`},ua=e=>Array.isArray(e)?e:e?[0,e]:!1,ce=(e,l)=>e==null||e===!0?l:e===!1?null:e,ma=({serverURL:e,path:l=location.pathname,lang:t=typeof navigator>"u"?"en-US":navigator.language,locale:a,meta:n=["nick","mail","link"],requiredMeta:i=[],dark:p=!1,pageSize:s=10,wordLimit:g,noCopyright:u=!1,login:w="enable",recaptchaV3Key:v="",turnstileKey:x="",commentSorting:j="latest",emoji:L=Pe,imageUploader:C,highlighter:S,texRenderer:R,search:d,reaction:K,...X})=>({serverURL:ye(e),path:lt(l),lang:tt(t),locale:{...et(tt(t)),...typeof a=="object"?a:{}},wordLimit:ua(g),meta:De(n),requiredMeta:De(i),dark:p,pageSize:s,commentSorting:j,login:w,noCopyright:u,recaptchaV3Key:v,turnstileKey:x,...X,reaction:K===!0?Zt:K||null,imageUploader:ce(C,Xt),highlighter:ce(S,na),texRenderer:ce(R,Yt),emoji:ce(L,Pe),search:ce(d,Jt(t))}),re=e=>typeof e=="string",Ae="{--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}",va=e=>re(e)?e==="auto"?`@media(prefers-color-scheme:dark){body${Ae}}`:`${e}${Ae}`:e===!0?`:root${Ae}`:"",Me=(e,l)=>{let t=e.toString();for(;t.length<l;)t="0"+t;return t},da=e=>{const l=Me(e.getDate(),2),t=Me(e.getMonth()+1,2);return`${Me(e.getFullYear(),2)}-${t}-${l}`},pa=(e,l,t)=>{if(!e)return"";const a=re(e)?new Date(e.includes(" ")?e.replace(/-/g,"/"):e):e,n=l.getTime()-a.getTime(),i=Math.floor(n/(24*3600*1e3));if(i===0){const p=n%864e5,s=Math.floor(p/(3600*1e3));if(s===0){const g=p%36e5,u=Math.floor(g/(60*1e3));if(u===0){const w=g%6e4;return`${Math.round(w/1e3)} ${t.seconds}`}return`${u} ${t.minutes}`}return`${s} ${t.hours}`}return i<0?t.now:i<8?`${i} ${t.days}`:da(a)},ga=/^[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])?)*$/,ha=e=>ga.test(e),fa="WALINE_EMOJI",ot=ne(fa,{}),wa=e=>/@[0-9]+\.[0-9]+\.[0-9]+/.test(e),ya=e=>{const l=wa(e);if(l){const t=ot.value[e];if(t)return Promise.resolve(t)}return fetch(`${e}/info.json`).then(t=>t.json()).then(t=>{const a={folder:e,...t};return l&&(ot.value[e]=a),a})},it=(e,l="",t="",a="")=>`${l?`${l}/`:""}${t}${e}${a?`.${a}`:""}`,ba=e=>Promise.all(e?e.map(l=>re(l)?ya(nt(l)):Promise.resolve(l)):[]).then(l=>{const t={tabs:[],map:{}};return l.forEach(a=>{const{name:n,folder:i,icon:p,prefix:s="",type:g,items:u}=a;t.tabs.push({name:n,icon:it(p,i,s,g),items:u.map(w=>{const v=`${s}${w}`;return t.map[v]=it(w,i,s,g),v})})}),t}),st=e=>{e.name!=="AbortError"&&console.error(e.message)},xe=e=>e instanceof HTMLElement?e:re(e)?document.querySelector(e):null,ka=e=>e.type.includes("image"),ct=e=>{const l=Array.from(e).find(ka);return l?l.getAsFile():null},Ca=/\$.*?\$/,$a=/^\$(.*?)\$/,La=/^(?:\s{0,3})\$\$((?:[^\n]|\n[^\n])+?)\n{0,1}\$\$/,Ea=e=>[{name:"blockMath",level:"block",tokenizer(l){const t=La.exec(l);if(t!==null)return{type:"html",raw:t[0],text:e(!0,t[1])}}},{name:"inlineMath",level:"inline",start(l){const t=l.search(Ca);return t!==-1?t:l.length},tokenizer(l){const t=$a.exec(l);if(t!==null)return{type:"html",raw:t[0],text:e(!1,t[1])}}}],ut=(e="",l={})=>e.replace(/:(.+?):/g,(t,a)=>l[a]?`<img class="wl-emoji" src="${l[a]}" alt="${a}">`:t),Ia=(e,{emojiMap:l,highlighter:t,texRenderer:a})=>{const n=new qt;if(n.setOptions({breaks:!0}),t&&n.use(Ot({highlight:t})),a){const i=Ea(a);n.use({extensions:i})}return n.parse(ut(e,l))},Se=e=>{const{path:l}=e.dataset;return l!=null&&l.length?l:null},Aa=e=>e.match(/[\w\d\s,.\u00C0-\u024F\u0400-\u04FF]+/giu),Ma=e=>e.match(/[\u4E00-\u9FD5]/gu),xa=e=>{var l,t;return(((l=Aa(e))==null?void 0:l.reduce((a,n)=>a+(["",",","."].includes(n.trim())?0:n.trim().split(/\s+/u).length),0))??0)+(((t=Ma(e))==null?void 0:t.length)??0)},Sa=async()=>{const{userAgentData:e}=navigator;let l=navigator.userAgent;if(!e||e.platform!=="Windows")return l;const{platformVersion:t}=await e.getHighEntropyValues(["platformVersion"]);return t&&parseInt(t.split(".")[0])>=13&&(l=l.replace("Windows NT 10.0","Windows NT 11.0")),l},mt=({serverURL:e,path:l=window.location.pathname,selector:t=".waline-comment-count",lang:a=navigator.language})=>{const n=new AbortController,i=document.querySelectorAll(t);return i.length&&Lt({serverURL:ye(e),paths:Array.from(i).map(p=>lt(Se(p)??l)),lang:a,signal:n.signal}).then(p=>{i.forEach((s,g)=>{s.innerText=p[g].toString()})}).catch(st),n.abort.bind(n)},vt=({size:e})=>I("svg",{class:"wl-close-icon",viewBox:"0 0 1024 1024",width:e,height:e},[I("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"}),I("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"})]),Ra=()=>I("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},I("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"})),ja=()=>I("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},I("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"})),Ua=()=>I("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},[I("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"}),I("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"})]),za=({active:e=!1})=>I("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},[I("path",{d:`M850.654 323.804c-11.042-25.625-26.862-48.532-46.885-68.225-20.022-19.61-43.258-34.936-69.213-45.73-26.78-11.124-55.124-16.727-84.375-16.727-40.622 0-80.256 11.123-114.698 32.135A214.79 214.79 0 0 0 512 241.819a214.79 214.79 0 0 0-23.483-16.562c-34.442-21.012-74.076-32.135-114.698-32.135-29.25 0-57.595 5.603-84.375 16.727-25.872 10.711-49.19 26.12-69.213 45.73-20.105 19.693-35.843 42.6-46.885 68.225-11.453 26.615-17.303 54.877-17.303 83.963 0 27.439 5.603 56.03 16.727 85.117 9.31 24.307 22.659 49.52 39.715 74.981 27.027 40.293 64.188 82.316 110.33 124.915 76.465 70.615 152.189 119.394 155.402 121.371l19.528 12.525c8.652 5.52 19.776 5.52 28.427 0l19.529-12.525c3.213-2.06 78.854-50.756 155.401-121.371 46.143-42.6 83.304-84.622 110.33-124.915 17.057-25.46 30.487-50.674 39.716-74.981 11.124-29.087 16.727-57.678 16.727-85.117.082-29.086-5.768-57.348-17.221-83.963z${e?"":"M512 761.5S218.665 573.55 218.665 407.767c0-83.963 69.461-152.023 155.154-152.023 60.233 0 112.473 33.618 138.181 82.727 25.708-49.109 77.948-82.727 138.18-82.727 85.694 0 155.155 68.06 155.155 152.023C805.335 573.551 512 761.5 512 761.5z"}`,fill:e?"red":"currentColor"})]),Va=()=>I("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},[I("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"}),I("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"})]),Ha=()=>I("svg",{width:"16",height:"16",ariaHidden:"true"},I("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"})),_a=()=>I("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},I("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"})),Ta=()=>I("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},I("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"})),Fa=()=>I("svg",{class:"verified-icon",viewBox:"0 0 1024 1024",width:"14",height:"14"},I("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"})),Na=()=>I("svg",{class:"administrator-icon",viewBox:"0 0 1024 1024",width:"14",height:"14"},[I("path",{d:"M461.6 129.56C489.6 105.96 534.8 105.96 562.4 129.56L625.6 183.96C637.6 194.36 660.4 202.76 676 202.76H744C786.4 202.76 821.2 237.56 821.2 279.96V347.96C821.2 363.96 829.6 386.36 840 398.36L894.4 461.56C918 489.16 918 534.76 894.8 562.36L840.4 625.56C830 637.56 821.6 660.36 821.6 675.96V743.96C821.6 786.36 786.8 821.16 744.4 821.16H676.4C660.4 821.16 638 829.56 626 839.96L562.8 894.36C534.8 917.96 489.6 917.96 462 894.36L398.8 839.96C386.8 829.56 364 821.16 348.4 821.16H279.2C236.8 821.16 202 786.36 202 743.96V675.56C201.999 659.96 193.6 637.56 183.6 625.56L129.6 561.96C106.4 534.36 106.4 489.56 129.6 461.96L183.6 398.36C193.6 386.359 202 363.959 202 348.36V279.96C202 237.56 236.8 202.76 279.2 202.76H348.4C364 202.76 386.8 194.36 398.8 184.36L461.6 129.56ZM549.567 331.896C530.047 303.082 486.645 306.12 471.433 337.412L442.175 396.526C435.587 409.848 422.856 419.097 408.146 421.226L342.706 430.726C340.776 431 338.884 431.397 336.993 431.946C303.482 441.361 292.756 483.493 317.671 507.812L364.975 553.96C375.623 564.321 380.507 579.299 377.991 593.954L366.917 659.102C366.595 661.03 366.355 662.967 366.279 664.923C364.906 699.688 401.683 722.937 432.514 706.738L491.05 675.966C504.217 669.068 519.954 669.069 533.121 675.966L591.675 706.738C593.406 707.645 595.174 708.432 597.028 709.104C629.666 721.205 663.139 693.382 657.273 659.102L646.069 593.954C643.42 579.176 648.24 564.083 659.001 553.6L706.315 507.461C707.687 506.118 708.994 504.66 710.215 503.127C731.779 475.809 715.737 435.41 681.281 430.365L615.839 420.874C601.13 418.745 588.4 409.486 581.821 396.174L552.562 337.052C551.644 335.284 550.674 333.551 549.567 331.896Z",fill:"#f59831"})]),ue=({size:e=100})=>I("svg",{width:e,height:e,viewBox:"0 0 100 100",preserveAspectRatio:"xMidYMid"},I("circle",{cx:50,cy:50,fill:"none",stroke:"currentColor",strokeWidth:"4",r:"40","stroke-dasharray":"85 30"},I("animateTransform",{attributeName:"transform",type:"rotate",repeatCount:"indefinite",dur:"1s",values:"0 50 50;360 50 50",keyTimes:"0;1"}))),Wa=()=>I("svg",{width:24,height:24,fill:"currentcolor",viewBox:"0 0 24 24"},[I("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"}),I("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"})]),Ba=()=>ne("WALINE_USER_META",{nick:"",mail:"",link:""}),Da=()=>ne("WALINE_COMMENT_BOX_EDITOR",""),Pa="WALINE_LIKE",qa=ne(Pa,[]),dt=()=>qa,Oa="WALINE_REACTION",Ga=ne(Oa,{}),Ka=()=>Ga,pt={},Za=e=>{const l=pt[e]??(pt[e]=Gt(e,{useRecaptchaNet:!0,autoHideBadge:!0}));return{execute:t=>l.then(a=>a.execute(t))}},Xa=e=>({execute:async l=>{const{load:t}=Wt("https://challenges.cloudflare.com/turnstile/v0/api.js",void 0,{async:!1});await t();const a=window.turnstile;return new Promise(n=>{a==null||a.ready(()=>{a.render(".wl-captcha-container",{sitekey:e,action:l,size:"compact",callback:n})})})}}),Ya="WALINE_USER",Ja=ne(Ya,{}),be=()=>Ja,Qa={key:0,class:"wl-reaction"},el=["textContent"],tl={class:"wl-reaction-list"},al=["onClick"],ll={class:"wl-reaction-img"},nl=["src","alt"],rl=["textContent"],ol=["textContent"];var il=ie({__name:"ArticleReaction",setup(e){const l=Ka(),t=$e(we),a=z(-1),n=z([]),i=W(()=>t.value.locale),p=W(()=>{const{reaction:v}=t.value;return v!=null&&v.length?v:null}),s=W(()=>{var v;const{path:x}=t.value;return((v=p.value)==null?void 0:v.map((j,L)=>({icon:j,desc:i.value[`reaction${L}`],active:l.value[x]===L})))??null});let g;const u=async()=>{const{serverURL:v,lang:x,path:j}=t.value;if(!p.value)return;const L=new AbortController;g=L.abort.bind(L);const[C]=await Et({serverURL:v,lang:x,paths:[j],type:p.value.map((S,R)=>`reaction${R}`),signal:L.signal});n.value=p.value.map((S,R)=>C[`reaction${R}`])},w=async v=>{if(a.value!==-1)return;const{serverURL:x,lang:j,path:L}=t.value,C=l.value[L];a.value=v,C!==void 0&&(await Ve({serverURL:x,lang:j,path:L,type:`reaction${C}`,action:"desc"}),n.value[C]=Math.max(n.value[C]-1,0)),C!==v&&(await Ve({serverURL:x,lang:j,path:L,type:`reaction${v}`}),n.value[v]=(n.value[v]||0)+1),C===v?delete l.value[L]:l.value[L]=v,a.value=-1};return ge(()=>{se(()=>[t.value.serverURL,t.value.path],()=>u())}),He(()=>{g==null||g()}),(v,x)=>s.value?(o(),c("div",Qa,[m("div",{class:"wl-reaction-title",textContent:M(i.value.reactionTitle)},null,8,el),m("ul",tl,[(o(!0),c(B,null,Z(s.value,({active:j,icon:L,desc:C},S)=>(o(),c("li",{key:S,class:P(["wl-reaction-item",{active:j}]),onClick:R=>w(S)},[m("div",ll,[m("img",{src:L,alt:C},null,8,nl),a.value===S?(o(),Q($(ue),{key:0,class:"wl-reaction-loading"})):(o(),c("div",{key:1,class:"wl-reaction-votes",textContent:M(n.value[S]||0)},null,8,rl))]),m("div",{class:"wl-reaction-text",textContent:M(C)},null,8,ol)],10,al))),128))])])):E("v-if",!0)}});const sl=["data-index"],cl=["src","title","onClick"];var ul=ie({__name:"ImageWall",props:{items:{default:()=>[]},columnWidth:{default:300},gap:{default:0}},emits:["insert"],setup(e){const l=e;let t=null;const a=te("wall"),n=z({}),i=z([]),p=()=>{const v=Math.floor((a.value.getBoundingClientRect().width+l.gap)/(l.columnWidth+l.gap));return v>0?v:1},s=v=>new Array(v).fill(null).map(()=>[]),g=async v=>{var x;if(v>=l.items.length)return;await Te();const j=Array.from(((x=a.value)==null?void 0:x.children)??[]).reduce((L,C)=>C.getBoundingClientRect().height<L.getBoundingClientRect().height?C:L);i.value[Number(j.dataset.index)].push(v),await g(v+1)},u=async(v=!1)=>{if(i.value.length===p()&&!v)return;i.value=s(p());const x=window.scrollY;await g(0),window.scrollTo({top:x})},w=v=>{n.value[v.target.src]=!0};return ge(()=>{u(!0),t=new ResizeObserver(()=>{u()}),t.observe(a.value),Le(()=>[l.items],()=>{n.value={},u(!0)}),Le(()=>[l.columnWidth,l.gap],()=>{u()})}),zt(()=>{t.unobserve(a.value)}),(v,x)=>(o(),c("div",{ref_key:"wall",ref:a,class:"wl-gallery",style:_e({gap:`${e.gap}px`})},[(o(!0),c(B,null,Z(i.value,(j,L)=>(o(),c("div",{key:L,class:"wl-gallery-column","data-index":L,style:_e({gap:`${e.gap}px`})},[(o(!0),c(B,null,Z(j,C=>(o(),c(B,{key:C},[n.value[e.items[C].src]?E("v-if",!0):(o(),Q($(ue),{key:0,size:36,style:{margin:"20px auto"}})),m("img",{class:"wl-gallery-item",src:e.items[C].src,title:e.items[C].title,loading:"lazy",onLoad:w,onClick:S=>v.$emit("insert",`![](${e.items[C].src})`)},null,40,cl)],64))),128))],12,sl))),128))],4))}});const ml={key:0,class:"wl-login-info"},vl={class:"wl-avatar"},dl=["title"],pl=["title"],gl=["src"],hl=["title","textContent"],fl={class:"wl-panel"},wl=["for","textContent"],yl=["id","onUpdate:modelValue","name","type"],bl=["placeholder"],kl={class:"wl-preview"},Cl=["innerHTML"],$l={class:"wl-footer"},Ll={class:"wl-actions"},El={href:"https://guides.github.com/features/mastering-markdown/",title:"Markdown Guide","aria-label":"Markdown is supported",class:"wl-action",target:"_blank",rel:"noopener noreferrer"},Il=["title"],Al=["title"],Ml=["title","aria-label"],xl=["title"],Sl={class:"wl-info"},Rl={class:"wl-text-number"},jl={key:0},Ul=["textContent"],zl=["textContent"],Vl=["disabled"],Hl=["placeholder"],_l={key:1,class:"wl-loading"},Tl={key:0,class:"wl-tab-wrapper"},Fl=["title","onClick"],Nl=["src","alt"],Wl={key:0,class:"wl-tabs"},Bl=["onClick"],Dl=["src","alt","title"],Pl=["title"];var gt=ie({__name:"CommentBox",props:{edit:{},rootId:{},replyId:{},replyUser:{}},emits:["log","cancelEdit","cancelReply","submit"],setup(e,{emit:l}){const t=e,a=l,n=$e(we),i=Da(),p=Ba(),s=be(),g=z({}),u=te("textarea"),w=te("image-uploader"),v=te("emoji-button"),x=te("emoji-popup"),j=te("gif-button"),L=te("gif-popup"),C=te("gif-search"),S=z({tabs:[],map:{}}),R=z(0),d=z(!1),K=z(!1),X=z(!1),A=z(""),V=z(0),T=Ee({loading:!0,list:[]}),le=z(0),ee=z(!1),me=z(""),f=z(!1),U=z(!1),y=W(()=>n.value.locale),F=W(()=>!!s.value.token),q=W(()=>n.value.imageUploader!==null),O=h=>{const r=u.value,k=r.selectionStart,_=r.selectionEnd||0,b=r.scrollTop;i.value=r.value.substring(0,k)+h+r.value.substring(_,r.value.length),r.focus(),r.selectionStart=k+h.length,r.selectionEnd=k+h.length,r.scrollTop=b},oe=({key:h,ctrlKey:r,metaKey:k})=>{f.value||(r||k)&&h==="Enter"&&Re()},ve=async h=>{const r=`![${n.value.locale.uploading} ${h.name}]()`;O(r),f.value=!0;try{const k=await n.value.imageUploader(h);i.value=i.value.replace(r,`\r
11
- ![${h.name}](${k})`)}catch(k){alert(k.message),i.value=i.value.replace(r,"")}finally{f.value=!1}},ke=h=>{var r;if((r=h.dataTransfer)!=null&&r.items){const k=ct(h.dataTransfer.items);k&&q.value&&(ve(k),h.preventDefault())}},yt=h=>{if(h.clipboardData){const r=ct(h.clipboardData.items);r&&q.value&&ve(r)}},bt=()=>{const h=w.value;h.files&&q.value&&ve(h.files[0]).then(()=>{h.value=""})},Re=async()=>{var h;const{serverURL:r,lang:k,login:_,wordLimit:b,requiredMeta:D,recaptchaV3Key:N,turnstileKey:Y}=n.value,H={comment:me.value,nick:p.value.nick,mail:p.value.mail,link:p.value.link,url:n.value.path,ua:await Sa()};if(!t.edit)if(s.value.token)H.nick=s.value.display_name,H.mail=s.value.email,H.link=s.value.url;else{if(_==="force")return;if(D.includes("nick")&&!H.nick){g.value.nick.focus(),alert(y.value.nickError);return}if(D.includes("mail")&&!H.mail||H.mail&&!ha(H.mail)){g.value.mail.focus(),alert(y.value.mailError);return}H.nick||(H.nick=y.value.anonymous)}if(!H.comment){u.value.focus();return}if(!ee.value){alert(y.value.wordHint.replace("$0",b[0].toString()).replace("$1",b[1].toString()).replace("$2",V.value.toString()));return}H.comment=ut(H.comment,S.value.map),t.replyId&&t.rootId&&(H.pid=t.replyId,H.rid=t.rootId,H.at=t.replyUser),f.value=!0;try{N&&(H.recaptchaV3=await Za(N).execute("social")),Y&&(H.turnstile=await Xa(Y).execute("social"));const de={serverURL:r,lang:k,token:s.value.token,comment:H},Ce=await(t.edit?pe({objectId:t.edit.objectId,...de}):It(de));if(f.value=!1,Ce.errmsg){alert(Ce.errmsg);return}a("submit",Ce.data),i.value="",A.value="",await Te(),t.replyId&&a("cancelReply"),(h=t.edit)!=null&&h.objectId&&a("cancelEdit")}catch(de){f.value=!1,alert(de.message)}},kt=h=>{h.preventDefault();const{lang:r,serverURL:k}=n.value;At({serverURL:k,lang:r}).then(_=>{s.value=_,(_.remember?localStorage:sessionStorage).setItem("WALINE_USER",JSON.stringify(_)),a("log")})},Ct=()=>{s.value={},localStorage.setItem("WALINE_USER","null"),sessionStorage.setItem("WALINE_USER","null"),a("log")},je=h=>{h.preventDefault();const{lang:r,serverURL:k}=n.value,_=800,b=800,D=(window.innerWidth-_)/2,N=(window.innerHeight-b)/2,Y=new URLSearchParams({lng:r,token:s.value.token}),H=window.open(`${k}/ui/profile?${Y.toString()}`,"_blank",`width=${_},height=${b},left=${D},top=${N},scrollbars=no,resizable=no,status=no,location=no,toolbar=no,menubar=no`);H==null||H.postMessage({type:"TOKEN",data:s.value.token},"*")},$t=h=>{var r,k,_,b;!((r=v.value)!=null&&r.contains(h.target))&&!((k=x.value)!=null&&k.contains(h.target))&&(d.value=!1),!((_=j.value)!=null&&_.contains(h.target))&&!((b=L.value)!=null&&b.contains(h.target))&&(K.value=!1)},Ue=async h=>{var r;const{scrollTop:k,clientHeight:_,scrollHeight:b}=h.target,D=(_+k)/b,N=n.value.search,Y=((r=C.value)==null?void 0:r.value)??"";D<.9||T.loading||U.value||(T.loading=!0,(N.more&&T.list.length?await N.more(Y,T.list.length):await N.search(Y)).length?T.list=[...T.list,...N.more&&T.list.length?await N.more(Y,T.list.length):await N.search(Y)]:U.value=!0,T.loading=!1,setTimeout(()=>{h.target.scrollTop=k},50))},ze=Bt(h=>{T.list=[],U.value=!1,Ue(h)},300);return We("click",$t),We("message",({data:h})=>{!h||h.type!=="profile"||(s.value={...s.value,...h.data},[localStorage,sessionStorage].filter(r=>r.getItem("WALINE_USER")).forEach(r=>{r.setItem("WALINE_USER",JSON.stringify(s))}))}),se([n,V],([h,r])=>{const{wordLimit:k}=h;k?r<k[0]&&k[0]!==0?(le.value=k[0],ee.value=!1):r>k[1]?(le.value=k[1],ee.value=!1):(le.value=k[1],ee.value=!0):(le.value=0,ee.value=!0)}),Le(K,async h=>{var r;if(!h)return;const k=n.value.search;C.value&&(C.value.value=""),T.loading=!0,T.list=await(((r=k.default)==null?void 0:r.call(k))??k.search("")),T.loading=!1}),ge(()=>{var h;(h=t.edit)!=null&&h.objectId&&(i.value=t.edit.orig),se(()=>i.value,r=>{const{highlighter:k,texRenderer:_}=n.value;me.value=r,A.value=Ia(r,{emojiMap:S.value.map,highlighter:k,texRenderer:_}),V.value=xa(r),r?Be(u.value):Be.destroy(u.value)}),se(()=>n.value.emoji,async r=>{S.value=await ba(r)})}),(h,r)=>{var k,_;return o(),c("div",{key:$(s).token,class:"wl-comment"},[$(n).login!=="disable"&&F.value&&!((k=e.edit)!=null&&k.objectId)?(o(),c("div",ml,[m("div",vl,[m("button",{type:"submit",class:"wl-logout-btn",title:y.value.logout,onClick:Ct},[G($(vt),{size:14})],8,dl),m("a",{href:"#",class:"wl-login-nick","aria-label":"Profile",title:y.value.profile,onClick:je},[m("img",{src:$(s).avatar,alt:"avatar"},null,8,gl)],8,pl)]),m("a",{href:"#",class:"wl-login-nick","aria-label":"Profile",title:y.value.profile,onClick:je,textContent:M($(s).display_name)},null,8,hl)])):E("v-if",!0),m("div",fl,[$(n).login!=="force"&&$(n).meta.length&&!F.value?(o(),c("div",{key:0,class:P(["wl-header",`item${$(n).meta.length}`])},[(o(!0),c(B,null,Z($(n).meta,b=>(o(),c("div",{key:b,class:"wl-header-item"},[m("label",{for:`wl-${b}`,textContent:M(y.value[b]+($(n).requiredMeta.includes(b)||!$(n).requiredMeta.length?"":`(${y.value.optional})`))},null,8,wl),he(m("input",{id:`wl-${b}`,ref_for:!0,ref:D=>{D&&(g.value[b]=D)},"onUpdate:modelValue":D=>$(p)[b]=D,class:P(["wl-input",`wl-${b}`]),name:b,type:b==="mail"?"email":"text"},null,10,yl),[[Vt,$(p)[b]]])]))),128))],2)):E("v-if",!0),he(m("textarea",{id:"wl-edit",ref:"textarea","onUpdate:modelValue":r[0]||(r[0]=b=>Ht(i)?i.value=b:null),class:"wl-editor",placeholder:e.replyUser?`@${e.replyUser}`:y.value.placeholder,onKeydown:oe,onDrop:ke,onPaste:yt},null,40,bl),[[_t,$(i)]]),he(m("div",kl,[r[7]||(r[7]=m("hr",null,null,-1)),m("h4",null,M(y.value.preview)+":",1),m("div",{class:"wl-content",innerHTML:A.value},null,8,Cl)],512),[[Fe,X.value]]),m("div",$l,[m("div",Ll,[m("a",El,[G($(Ha))]),he(m("button",{ref:"emoji-button",type:"button",class:P(["wl-action",{active:d.value}]),title:y.value.emoji,onClick:r[1]||(r[1]=b=>d.value=!d.value)},[G($(ja))],10,Il),[[Fe,S.value.tabs.length]]),$(n).search?(o(),c("button",{key:0,ref:"gif-button",type:"button",class:P(["wl-action",{active:K.value}]),title:y.value.gif,onClick:r[2]||(r[2]=b=>K.value=!K.value)},[G($(Wa))],10,Al)):E("v-if",!0),m("input",{id:"wl-image-upload",ref:"image-uploader",class:"upload","aria-hidden":"true",type:"file",accept:".png,.jpg,.jpeg,.webp,.bmp,.gif",onChange:bt},null,544),q.value?(o(),c("label",{key:1,for:"wl-image-upload",class:"wl-action",title:y.value.uploadImage,"aria-label":y.value.uploadImage},[G($(Ua))],8,Ml)):E("v-if",!0),m("button",{type:"button",class:P(["wl-action",{active:X.value}]),title:y.value.preview,onClick:r[3]||(r[3]=b=>X.value=!X.value)},[G($(Va))],10,xl)]),m("div",Sl,[r[9]||(r[9]=m("div",{class:"wl-captcha-container"},null,-1)),m("div",Rl,[ae(M(V.value)+" ",1),$(n).wordLimit?(o(),c("span",jl,[r[8]||(r[8]=ae("  /  ",-1)),m("span",{class:P({illegal:!ee.value}),textContent:M(le.value)},null,10,Ul)])):E("v-if",!0),ae("  "+M(y.value.word),1)]),$(n).login!=="disable"&&!F.value?(o(),c("button",{key:0,type:"button",class:"wl-btn",onClick:kt,textContent:M(y.value.login)},null,8,zl)):E("v-if",!0),$(n).login!=="force"||F.value?(o(),c("button",{key:1,type:"submit",class:"primary wl-btn",title:"Cmd|Ctrl + Enter",disabled:f.value,onClick:Re},[f.value?(o(),Q($(ue),{key:0,size:16})):(o(),c(B,{key:1},[ae(M(y.value.submit),1)],64))],8,Vl)):E("v-if",!0)]),m("div",{ref:"gif-popup",class:P(["wl-gif-popup",{display:K.value}])},[m("input",{ref:"gif-search",type:"text",placeholder:y.value.gifSearchPlaceholder,onInput:r[4]||(r[4]=(...b)=>$(ze)&&$(ze)(...b))},null,40,Hl),T.list.length?(o(),Q(ul,{key:0,items:T.list,"column-width":200,gap:6,onInsert:r[5]||(r[5]=b=>O(b)),onScroll:Ue},null,8,["items"])):E("v-if",!0),T.loading?(o(),c("div",_l,[G($(ue),{size:30})])):E("v-if",!0)],2),m("div",{ref:"emoji-popup",class:P(["wl-emoji-popup",{display:d.value}])},[(o(!0),c(B,null,Z(S.value.tabs,(b,D)=>(o(),c(B,{key:b.name},[D===R.value?(o(),c("div",Tl,[(o(!0),c(B,null,Z(b.items,N=>(o(),c("button",{key:N,type:"button",title:N,onClick:Y=>O(`:${N}:`)},[d.value?(o(),c("img",{key:0,class:"wl-emoji",src:S.value.map[N],alt:N,loading:"lazy",referrerPolicy:"no-referrer"},null,8,Nl)):E("v-if",!0)],8,Fl))),128))])):E("v-if",!0)],64))),128)),S.value.tabs.length>1?(o(),c("div",Wl,[(o(!0),c(B,null,Z(S.value.tabs,(b,D)=>(o(),c("button",{key:b.name,type:"button",class:P(["wl-tab",{active:R.value===D}]),onClick:N=>R.value=D},[m("img",{class:"wl-emoji",src:b.icon,alt:b.name,title:b.name,loading:"lazy",referrerPolicy:"no-referrer"},null,8,Dl)],10,Bl))),128))])):E("v-if",!0)],2)])]),e.replyId||(_=e.edit)!=null&&_.objectId?(o(),c("button",{key:1,type:"button",class:"wl-close",title:y.value.cancelReply,onClick:r[6]||(r[6]=b=>e.replyId?a("cancelReply"):a("cancelEdit"))},[G($(vt),{size:24})],8,Pl)):E("v-if",!0)])}}});const ql=["id"],Ol={class:"wl-user","aria-hidden":"true"},Gl=["src"],Kl={class:"wl-card"},Zl={class:"wl-head"},Xl=["href"],Yl={key:1,class:"wl-nick"},Jl=["textContent"],Ql=["textContent"],en=["textContent"],tn=["textContent"],an={class:"wl-comment-actions"},ln=["title"],nn=["title"],rn={class:"wl-meta","aria-hidden":"true"},on=["data-value","textContent"],sn={key:0,class:"wl-content"},cn={key:0},un=["href"],mn=["innerHTML"],vn={key:1,class:"wl-admin-actions"},dn={class:"wl-comment-status"},pn=["disabled","onClick","textContent"],gn={key:3,class:"wl-quote"};var hn=ie({__name:"CommentCard",props:{comment:{},edit:{},rootId:{},reply:{}},emits:["log","submit","delete","like","sticky","edit","reply","status"],setup(e,{emit:l}){const t=e,a=l,n=["approved","waiting","spam"],i=$e(we),p=dt(),s=Dt(),g=be(),u=W(()=>i.value.locale),w=W(()=>{const{link:R}=t.comment;return R?rt(R)?R:`https://${R}`:""}),v=W(()=>p.value.includes(t.comment.objectId)),x=W(()=>pa(new Date(t.comment.time),s.value,u.value)),j=W(()=>g.value.type==="administrator"),L=W(()=>t.comment.user_id&&g.value.objectId===t.comment.user_id),C=W(()=>{var R;return t.comment.objectId===((R=t.reply)==null?void 0:R.objectId)}),S=W(()=>{var R;return t.comment.objectId===((R=t.edit)==null?void 0:R.objectId)});return(R,d)=>{var K;const X=Tt("CommentCard",!0);return o(),c("div",{id:e.comment.objectId.toString(),class:"wl-card-item"},[m("div",Ol,[e.comment.avatar?(o(),c("img",{key:0,class:"wl-user-avatar",src:e.comment.avatar,alt:""},null,8,Gl)):E("v-if",!0),e.comment.type==="guest"?(o(),Q($(Fa),{key:1})):E("v-if",!0),e.comment.type==="administrator"?(o(),Q($(Na),{key:2})):E("v-if",!0)]),m("div",Kl,[m("div",Zl,[w.value?(o(),c("a",{key:0,class:"wl-nick",href:w.value,target:"_blank",rel:"nofollow noopener noreferrer"},M(e.comment.nick),9,Xl)):(o(),c("span",Yl,M(e.comment.nick),1)),e.comment.label?(o(),c("span",{key:2,class:"wl-badge",textContent:M(e.comment.label)},null,8,Jl)):E("v-if",!0),e.comment.sticky?(o(),c("span",{key:3,class:"wl-badge",textContent:M(u.value.sticky)},null,8,Ql)):E("v-if",!0),typeof e.comment.level=="number"?(o(),c("span",{key:4,class:P(`wl-badge level${e.comment.level}`),textContent:M(u.value[`level${e.comment.level}`]||`Level ${e.comment.level}`)},null,10,en)):E("v-if",!0),m("span",{class:"wl-time",textContent:M(x.value)},null,8,tn),m("div",an,[j.value||L.value?(o(),c(B,{key:0},[m("button",{type:"button",class:"wl-edit",onClick:d[0]||(d[0]=A=>a("edit",e.comment))},[G($(Ta))]),m("button",{type:"button",class:"wl-delete",onClick:d[1]||(d[1]=A=>a("delete",e.comment))},[G($(Ra))])],64)):E("v-if",!0),m("button",{type:"button",class:"wl-like",title:v.value?u.value.cancelLike:u.value.like,onClick:d[2]||(d[2]=A=>a("like",e.comment))},[G($(za),{active:v.value},null,8,["active"]),ae(" "+M("like"in e.comment?e.comment.like:""),1)],8,ln),m("button",{type:"button",class:P(["wl-reply",{active:C.value}]),title:C.value?u.value.cancelReply:u.value.reply,onClick:d[3]||(d[3]=A=>a("reply",C.value?null:e.comment))},[G($(_a))],10,nn)])]),m("div",rn,[(o(),c(B,null,Z(["addr","browser","os"],A=>(o(),c(B,null,[e.comment[A]?(o(),c("span",{key:A,class:P(`wl-${A}`),"data-value":e.comment[A],textContent:M(e.comment[A])},null,10,on)):E("v-if",!0)],64))),64))]),S.value?E("v-if",!0):(o(),c("div",sn,["reply_user"in e.comment&&e.comment.reply_user?(o(),c("p",cn,[m("a",{href:"#"+e.comment.pid},"@"+M(e.comment.reply_user.nick),9,un),d[17]||(d[17]=m("span",null,": ",-1))])):E("v-if",!0),m("div",{innerHTML:e.comment.comment},null,8,mn)])),j.value&&!S.value?(o(),c("div",vn,[m("span",dn,[(o(),c(B,null,Z(n,A=>m("button",{key:A,type:"submit",class:P(`wl-btn wl-${A}`),disabled:e.comment.status===A,onClick:V=>a("status",{status:A,comment:e.comment}),textContent:M(u.value[A])},null,10,pn)),64))]),j.value&&!("rid"in e.comment)?(o(),c("button",{key:0,type:"submit",class:"wl-btn wl-sticky",onClick:d[4]||(d[4]=A=>a("sticky",e.comment))},M(e.comment.sticky?u.value.unsticky:u.value.sticky),1)):E("v-if",!0)])):E("v-if",!0),C.value||S.value?(o(),c("div",{key:2,class:P({"wl-reply-wrapper":C.value,"wl-edit-wrapper":S.value})},[G(gt,{edit:e.edit,"reply-id":(K=e.reply)==null?void 0:K.objectId,"reply-user":e.comment.nick,"root-id":e.rootId,onLog:d[5]||(d[5]=A=>a("log")),onCancelReply:d[6]||(d[6]=A=>a("reply",null)),onCancelEdit:d[7]||(d[7]=A=>a("edit",null)),onSubmit:d[8]||(d[8]=A=>a("submit",A))},null,8,["edit","reply-id","reply-user","root-id"])],2)):E("v-if",!0),"children"in e.comment?(o(),c("div",gn,[(o(!0),c(B,null,Z(e.comment.children,A=>(o(),Q(X,{key:A.objectId,comment:A,reply:e.reply,edit:e.edit,"root-id":e.rootId,onLog:d[9]||(d[9]=V=>a("log")),onDelete:d[10]||(d[10]=V=>a("delete",V)),onEdit:d[11]||(d[11]=V=>a("edit",V)),onLike:d[12]||(d[12]=V=>a("like",V)),onReply:d[13]||(d[13]=V=>a("reply",V)),onStatus:d[14]||(d[14]=V=>a("status",V)),onSticky:d[15]||(d[15]=V=>a("sticky",V)),onSubmit:d[16]||(d[16]=V=>a("submit",V))},null,8,["comment","reply","edit","root-id"]))),128))])):E("v-if",!0)])],8,ql)}}});const ht="3.7.0",fn={"data-waline":""},wn={class:"wl-meta-head"},yn={class:"wl-count"},bn=["textContent"],kn={class:"wl-sort"},Cn=["onClick"],$n={class:"wl-cards"},Ln={key:1,class:"wl-operation"},En=["textContent"],In={key:2,class:"wl-loading"},An=["textContent"],Mn={key:4,class:"wl-operation"},xn=["textContent"],Sn={key:5,class:"wl-power"};var Rn=ie({__name:"WalineComment",props:{serverURL:{},path:{},meta:{},requiredMeta:{},wordLimit:{},pageSize:{},lang:{},locale:{},commentSorting:{},dark:{type:[String,Boolean]},login:{},noCopyright:{type:Boolean},recaptchaV3Key:{},turnstileKey:{},reaction:{type:[Array,Boolean]},emoji:{},search:{},highlighter:{type:Function},imageUploader:{type:Function},texRenderer:{type:Function}},setup(e){const l=e,t=be(),a=dt(),n=z("loading"),i=z(0),p=z(1),s=z(0),g=W(()=>ma(l)),u=z(g.value.commentSorting),w=z([]),v=z(null),x=z(null),j=W(()=>va(g.value.dark)),L=W(()=>g.value.locale);Pt(j,{id:"waline-darkmode"});let C=null;const S=f=>{const{serverURL:U,path:y,pageSize:F}=g.value,q=new AbortController;n.value="loading",C==null||C(),xt({serverURL:U,lang:g.value.lang,path:y,pageSize:F,sortBy:at[u.value],page:f,signal:q.signal,token:t.value.token}).then(O=>{n.value="success",i.value=O.count,w.value.push(...O.data),p.value=f,s.value=O.totalPages}).catch(O=>{O.name!=="AbortError"&&(console.error(O.message),n.value="error")}),C=q.abort.bind(q)},R=()=>{S(p.value+1)},d=()=>{i.value=0,w.value=[],S(1)},K=f=>{u.value!==f&&(u.value=f,d())},X=f=>{v.value=f},A=f=>{x.value=f},V=f=>{if(x.value)x.value.comment=f.comment,x.value.orig=f.orig;else if("rid"in f){const U=w.value.find(({objectId:y})=>y===f.rid);if(!U)return;Array.isArray(U.children)||(U.children=[]),U.children.push(f)}else w.value.unshift(f),i.value+=1},T=async({comment:f,status:U})=>{if(f.status===U)return;const{serverURL:y,lang:F}=g.value;await pe({serverURL:y,lang:F,token:t.value.token,objectId:f.objectId,comment:{status:U}}),f.status=U},le=async f=>{if("rid"in f)return;const{serverURL:U,lang:y}=g.value;await pe({serverURL:U,lang:y,token:t.value.token,objectId:f.objectId,comment:{sticky:f.sticky?0:1}}),f.sticky=!f.sticky},ee=async({objectId:f})=>{if(!confirm("Are you sure you want to delete this comment?"))return;const{serverURL:U,lang:y}=g.value;await Mt({serverURL:U,lang:y,token:t.value.token,objectId:f}),w.value.some((F,q)=>F.objectId===f?(w.value=w.value.filter((O,oe)=>oe!==q),!0):F.children.some((O,oe)=>O.objectId===f?(w.value[q].children=F.children.filter((ve,ke)=>ke!==oe),!0):!1))},me=async f=>{const{serverURL:U,lang:y}=g.value,{objectId:F}=f,q=a.value.includes(F);await pe({serverURL:U,lang:y,objectId:F,token:t.value.token,comment:{like:!q}}),q?a.value=a.value.filter(O=>O!==F):(a.value=[...a.value,F],a.value.length>50&&(a.value=a.value.slice(-50))),f.like=Math.max(0,(f.like||0)+(q?-1:1))};return Ft(we,g),ge(()=>{se(()=>[l.serverURL,l.path],()=>{d()})}),He(()=>{C==null||C()}),(f,U)=>(o(),c("div",fn,[G(il),!v.value&&!x.value?(o(),Q(gt,{key:0,onLog:d,onSubmit:V})):E("v-if",!0),m("div",wn,[m("div",yn,[i.value?(o(),c("span",{key:0,class:"wl-num",textContent:M(i.value)},null,8,bn)):E("v-if",!0),ae(" "+M(L.value.comment),1)]),m("ul",kn,[(o(!0),c(B,null,Z($(ca),y=>(o(),c("li",{key:y,class:P([y===u.value?"active":""]),onClick:F=>K(y)},M(L.value[y]),11,Cn))),128))])]),m("div",$n,[(o(!0),c(B,null,Z(w.value,y=>(o(),Q(hn,{key:y.objectId,"root-id":y.objectId,comment:y,reply:v.value,edit:x.value,onLog:d,onReply:X,onEdit:A,onSubmit:V,onStatus:T,onDelete:ee,onSticky:le,onLike:me},null,8,["root-id","comment","reply","edit"]))),128))]),n.value==="error"?(o(),c("div",Ln,[m("button",{type:"button",class:"wl-btn",onClick:d,textContent:M(L.value.refresh)},null,8,En)])):n.value==="loading"?(o(),c("div",In,[G($(ue),{size:30})])):w.value.length?p.value<s.value?(o(),c("div",Mn,[m("button",{type:"button",class:"wl-btn",onClick:R,textContent:M(L.value.more)},null,8,xn)])):E("v-if",!0):(o(),c("div",{key:3,class:"wl-empty",textContent:M(L.value.sofa)},null,8,An)),g.value.noCopyright?E("v-if",!0):(o(),c("div",Sn,[U[0]||(U[0]=ae(" Powered by ",-1)),U[1]||(U[1]=m("a",{href:"https://github.com/walinejs/waline",target:"_blank",rel:"noopener noreferrer"}," Waline ",-1)),ae(" v"+M($(ht)),1)]))]))}});const ft=(e,l)=>{l.forEach((t,a)=>{const n=e[a].time;typeof n=="number"&&(t.innerText=n.toString())})},wt=({serverURL:e,path:l=window.location.pathname,selector:t=".waline-pageview-count",update:a=!0,lang:n=navigator.language})=>{const i=new AbortController,p=Array.from(document.querySelectorAll(t)),s=u=>{const w=Se(u);return w!==null&&l!==w},g=u=>Rt({serverURL:ye(e),paths:u.map(w=>Se(w)??l),lang:n,signal:i.signal}).then(w=>ft(w,u)).catch(st);if(a){const u=p.filter(v=>!s(v)),w=p.filter(s);St({serverURL:ye(e),path:l,lang:n}).then(v=>ft(v,u)),w.length&&g(w)}else g(p);return i.abort.bind(i)},jn=({el:e="#waline",path:l=window.location.pathname,comment:t=!1,pageview:a=!1,...n})=>{const i=e?xe(e):null;if(e&&!i)throw new Error("Option 'el' do not match any domElement!");if(!n.serverURL)throw new Error("Option 'serverURL' is missing!");const p=Ee({...n}),s=Ee({comment:t,pageview:a,path:l}),g=()=>{s.comment&&mt({serverURL:p.serverURL,path:s.path,...re(s.comment)?{selector:s.comment}:{}})},u=()=>{s.pageview&&wt({serverURL:p.serverURL,path:s.path,...re(s.pageview)?{selector:s.pageview}:{}})};let w=null;i&&(w=Nt(()=>I(Rn,{path:s.path,...p})),w.mount(i));const v=Ne(g),x=Ne(u);return{el:i,update:({comment:j,pageview:L,path:C=window.location.pathname,...S}={})=>{Object.entries(S).forEach(([R,d])=>{p[R]=d}),s.path=C,j!==void 0&&(s.comment=j),L!==void 0&&(s.pageview=L)},destroy:()=>{w==null||w.unmount(),v(),x()}}},Un=({el:e,serverURL:l,count:t,lang:a=navigator.language})=>{const n=be(),i=xe(e),p=new AbortController;return jt({serverURL:l,count:t,lang:a,signal:p.signal,token:n.value.token}).then(s=>i&&s.length?(i.innerHTML=`<ul class="wl-recent-list">${s.map(g=>`<li class="wl-recent-item"><a href="${g.url}">${g.nick}</a>:${g.comment}</li>`).join("")}</ul>`,{comments:s,destroy:()=>{p.abort(),i.innerHTML=""}}):{comments:s,destroy:()=>p.abort()})},zn=({el:e,serverURL:l,count:t,locale:a,lang:n=navigator.language,mode:i="list"})=>{const p=xe(e),s=new AbortController;return Ut({serverURL:l,pageSize:t,lang:n,signal:s.signal}).then(g=>!p||!g.length?{users:g,destroy:()=>s.abort()}:(a={...et(n),...typeof a=="object"?a:{}},p.innerHTML=`<ul class="wl-user-${i}">${g.map((u,w)=>[`<li class="wl-user-item" aria-label="${u.nick}">`,u.link&&`<a href="${u.link}" target="_blank">`,'<div class="wl-user-avatar">',`<img src="${u.avatar}" alt="${u.nick}">`,`<span class="wl-user-badge">${w+1}</span>`,"</div>",'<div class="wl-user-meta">','<div class="wl-user-name">',u.nick,u.level&&`<span class="wl-badge">${a?a[`level${u.level}`]:`Level ${u.level}`}</span>`,u.label&&`<span class="wl-badge">${u.label}</span>`,"</div>",u.link&&u.link,"</div>",u.link&&"</a>","</li>"].filter(v=>v).join("")).join("")}</ul>`,{users:g,destroy:()=>{s.abort(),p.innerHTML=""}}))};export{Un as RecentComments,zn as UserList,mt as commentCount,fe as defaultLocales,jn as init,wt as pageviewCount,ht as version};
10
+ 目前字數:$2`,"匿名","潛水","冒泡","吐槽","活躍","多話","傳說","表情包","搜尋表情包","個人資料","通過","待審核","垃圾","取消置頂","最早","最新","熱門","你認為這篇文章怎麼樣?"]);const Qe="en-US",fe={zh:Je,"zh-cn":Je,"zh-tw":sa,en:Oe,"en-us":Oe,fr:Ke,"fr-fr":Ke,jp:Ze,"jp-jp":Ze,"pt-br":ia,ru:Xe,"ru-ru":Xe,vi:Ye,"vi-vn":Ye,de:oa,es:Ge,"es-mx":Ge},et=e=>fe[e.toLowerCase()]||fe[Qe.toLowerCase()],tt=e=>Object.keys(fe).includes(e.toLowerCase())?e:Qe,at={latest:"insertedAt_desc",oldest:"insertedAt_asc",hottest:"like_desc"},ca=Object.keys(at),we=Symbol("waline-config"),lt=e=>{try{e=decodeURI(e)}catch{}return e},nt=(e="")=>e.replace(/\/$/u,""),rt=e=>/^(https?:)?\/\//.test(e),ye=e=>{const l=nt(e);return rt(l)?l:`https://${l}`},ua=e=>Array.isArray(e)?e:e?[0,e]:!1,ce=(e,l)=>e==null||e===!0?l:e===!1?null:e,ma=({serverURL:e,path:l=location.pathname,lang:t=typeof navigator>"u"?"en-US":navigator.language,locale:a,meta:n=["nick","mail","link"],requiredMeta:i=[],dark:p=!1,pageSize:s=10,wordLimit:g,noCopyright:u=!1,login:w="enable",recaptchaV3Key:v="",turnstileKey:x="",commentSorting:j="latest",emoji:L=Pe,imageUploader:C,highlighter:S,texRenderer:R,search:d,reaction:K,...X})=>({serverURL:ye(e),path:lt(l),lang:tt(t),locale:{...et(tt(t)),...typeof a=="object"?a:{}},wordLimit:ua(g),meta:De(n),requiredMeta:De(i),dark:p,pageSize:s,commentSorting:j,login:w,noCopyright:u,recaptchaV3Key:v,turnstileKey:x,...X,reaction:K===!0?Zt:K||null,imageUploader:ce(C,Xt),highlighter:ce(S,na),texRenderer:ce(R,Yt),emoji:ce(L,Pe),search:ce(d,Jt(t))}),re=e=>typeof e=="string",Ae="{--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}",va=e=>re(e)?e==="auto"?`@media(prefers-color-scheme:dark){body${Ae}}`:`${e}${Ae}`:e===!0?`:root${Ae}`:"",Me=(e,l)=>{let t=e.toString();for(;t.length<l;)t="0"+t;return t},da=e=>{const l=Me(e.getDate(),2),t=Me(e.getMonth()+1,2);return`${Me(e.getFullYear(),2)}-${t}-${l}`},pa=(e,l,t)=>{if(!e)return"";const a=re(e)?new Date(e.includes(" ")?e.replace(/-/g,"/"):e):e,n=l.getTime()-a.getTime(),i=Math.floor(n/(24*3600*1e3));if(i===0){const p=n%864e5,s=Math.floor(p/(3600*1e3));if(s===0){const g=p%36e5,u=Math.floor(g/(60*1e3));if(u===0){const w=g%6e4;return`${Math.round(w/1e3)} ${t.seconds}`}return`${u} ${t.minutes}`}return`${s} ${t.hours}`}return i<0?t.now:i<8?`${i} ${t.days}`:da(a)},ga=/^[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])?)*$/,ha=e=>ga.test(e),fa="WALINE_EMOJI",ot=ne(fa,{}),wa=e=>/@[0-9]+\.[0-9]+\.[0-9]+/.test(e),ya=e=>{const l=wa(e);if(l){const t=ot.value[e];if(t)return Promise.resolve(t)}return fetch(`${e}/info.json`).then(t=>t.json()).then(t=>{const a={folder:e,...t};return l&&(ot.value[e]=a),a})},it=(e,l="",t="",a="")=>`${l?`${l}/`:""}${t}${e}${a?`.${a}`:""}`,ba=e=>Promise.all(e?e.map(l=>re(l)?ya(nt(l)):Promise.resolve(l)):[]).then(l=>{const t={tabs:[],map:{}};return l.forEach(a=>{const{name:n,folder:i,icon:p,prefix:s="",type:g,items:u}=a;t.tabs.push({name:n,icon:it(p,i,s,g),items:u.map(w=>{const v=`${s}${w}`;return t.map[v]=it(w,i,s,g),v})})}),t}),st=e=>{e.name!=="AbortError"&&console.error(e.message)},xe=e=>e instanceof HTMLElement?e:re(e)?document.querySelector(e):null,ka=e=>e.type.includes("image"),ct=e=>{const l=Array.from(e).find(ka);return l?l.getAsFile():null},Ca=/\$.*?\$/,$a=/^\$(.*?)\$/,La=/^(?:\s{0,3})\$\$((?:[^\n]|\n[^\n])+?)\n{0,1}\$\$/,Ea=e=>[{name:"blockMath",level:"block",tokenizer(l){const t=La.exec(l);if(t!==null)return{type:"html",raw:t[0],text:e(!0,t[1])}}},{name:"inlineMath",level:"inline",start(l){const t=l.search(Ca);return t!==-1?t:l.length},tokenizer(l){const t=$a.exec(l);if(t!==null)return{type:"html",raw:t[0],text:e(!1,t[1])}}}],ut=(e="",l={})=>e.replace(/:(.+?):/g,(t,a)=>l[a]?`<img class="wl-emoji" src="${l[a]}" alt="${a}">`:t),Ia=(e,{emojiMap:l,highlighter:t,texRenderer:a})=>{const n=new qt;if(n.setOptions({breaks:!0}),t&&n.use(Ot({highlight:t})),a){const i=Ea(a);n.use({extensions:i})}return n.parse(ut(e,l))},Se=e=>{const{path:l}=e.dataset;return l!=null&&l.length?l:null},Aa=e=>e.match(/[\w\d\s,.\u00C0-\u024F\u0400-\u04FF]+/giu),Ma=e=>e.match(/[\u4E00-\u9FD5]/gu),xa=e=>{var l,t;return(((l=Aa(e))==null?void 0:l.reduce((a,n)=>a+(["",",","."].includes(n.trim())?0:n.trim().split(/\s+/u).length),0))??0)+(((t=Ma(e))==null?void 0:t.length)??0)},Sa=async()=>{const{userAgentData:e}=navigator;let l=navigator.userAgent;if((e==null?void 0:e.platform)!=="Windows")return l;const{platformVersion:t}=await e.getHighEntropyValues(["platformVersion"]);return t&&parseInt(t.split(".")[0])>=13&&(l=l.replace("Windows NT 10.0","Windows NT 11.0")),l},mt=({serverURL:e,path:l=window.location.pathname,selector:t=".waline-comment-count",lang:a=navigator.language})=>{const n=new AbortController,i=document.querySelectorAll(t);return i.length&&Lt({serverURL:ye(e),paths:Array.from(i).map(p=>lt(Se(p)??l)),lang:a,signal:n.signal}).then(p=>{i.forEach((s,g)=>{s.innerText=p[g].toString()})}).catch(st),n.abort.bind(n)},vt=({size:e})=>I("svg",{class:"wl-close-icon",viewBox:"0 0 1024 1024",width:e,height:e},[I("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"}),I("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"})]),Ra=()=>I("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},I("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"})),ja=()=>I("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},I("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"})),Ua=()=>I("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},[I("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"}),I("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"})]),za=({active:e=!1})=>I("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},[I("path",{d:`M850.654 323.804c-11.042-25.625-26.862-48.532-46.885-68.225-20.022-19.61-43.258-34.936-69.213-45.73-26.78-11.124-55.124-16.727-84.375-16.727-40.622 0-80.256 11.123-114.698 32.135A214.79 214.79 0 0 0 512 241.819a214.79 214.79 0 0 0-23.483-16.562c-34.442-21.012-74.076-32.135-114.698-32.135-29.25 0-57.595 5.603-84.375 16.727-25.872 10.711-49.19 26.12-69.213 45.73-20.105 19.693-35.843 42.6-46.885 68.225-11.453 26.615-17.303 54.877-17.303 83.963 0 27.439 5.603 56.03 16.727 85.117 9.31 24.307 22.659 49.52 39.715 74.981 27.027 40.293 64.188 82.316 110.33 124.915 76.465 70.615 152.189 119.394 155.402 121.371l19.528 12.525c8.652 5.52 19.776 5.52 28.427 0l19.529-12.525c3.213-2.06 78.854-50.756 155.401-121.371 46.143-42.6 83.304-84.622 110.33-124.915 17.057-25.46 30.487-50.674 39.716-74.981 11.124-29.087 16.727-57.678 16.727-85.117.082-29.086-5.768-57.348-17.221-83.963z${e?"":"M512 761.5S218.665 573.55 218.665 407.767c0-83.963 69.461-152.023 155.154-152.023 60.233 0 112.473 33.618 138.181 82.727 25.708-49.109 77.948-82.727 138.18-82.727 85.694 0 155.155 68.06 155.155 152.023C805.335 573.551 512 761.5 512 761.5z"}`,fill:e?"red":"currentColor"})]),Va=()=>I("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},[I("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"}),I("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"})]),Ha=()=>I("svg",{width:"16",height:"16",ariaHidden:"true"},I("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"})),_a=()=>I("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},I("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"})),Ta=()=>I("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},I("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"})),Fa=()=>I("svg",{class:"verified-icon",viewBox:"0 0 1024 1024",width:"14",height:"14"},I("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"})),Na=()=>I("svg",{class:"administrator-icon",viewBox:"0 0 1024 1024",width:"14",height:"14"},[I("path",{d:"M461.6 129.56C489.6 105.96 534.8 105.96 562.4 129.56L625.6 183.96C637.6 194.36 660.4 202.76 676 202.76H744C786.4 202.76 821.2 237.56 821.2 279.96V347.96C821.2 363.96 829.6 386.36 840 398.36L894.4 461.56C918 489.16 918 534.76 894.8 562.36L840.4 625.56C830 637.56 821.6 660.36 821.6 675.96V743.96C821.6 786.36 786.8 821.16 744.4 821.16H676.4C660.4 821.16 638 829.56 626 839.96L562.8 894.36C534.8 917.96 489.6 917.96 462 894.36L398.8 839.96C386.8 829.56 364 821.16 348.4 821.16H279.2C236.8 821.16 202 786.36 202 743.96V675.56C201.999 659.96 193.6 637.56 183.6 625.56L129.6 561.96C106.4 534.36 106.4 489.56 129.6 461.96L183.6 398.36C193.6 386.359 202 363.959 202 348.36V279.96C202 237.56 236.8 202.76 279.2 202.76H348.4C364 202.76 386.8 194.36 398.8 184.36L461.6 129.56ZM549.567 331.896C530.047 303.082 486.645 306.12 471.433 337.412L442.175 396.526C435.587 409.848 422.856 419.097 408.146 421.226L342.706 430.726C340.776 431 338.884 431.397 336.993 431.946C303.482 441.361 292.756 483.493 317.671 507.812L364.975 553.96C375.623 564.321 380.507 579.299 377.991 593.954L366.917 659.102C366.595 661.03 366.355 662.967 366.279 664.923C364.906 699.688 401.683 722.937 432.514 706.738L491.05 675.966C504.217 669.068 519.954 669.069 533.121 675.966L591.675 706.738C593.406 707.645 595.174 708.432 597.028 709.104C629.666 721.205 663.139 693.382 657.273 659.102L646.069 593.954C643.42 579.176 648.24 564.083 659.001 553.6L706.315 507.461C707.687 506.118 708.994 504.66 710.215 503.127C731.779 475.809 715.737 435.41 681.281 430.365L615.839 420.874C601.13 418.745 588.4 409.486 581.821 396.174L552.562 337.052C551.644 335.284 550.674 333.551 549.567 331.896Z",fill:"#f59831"})]),ue=({size:e=100})=>I("svg",{width:e,height:e,viewBox:"0 0 100 100",preserveAspectRatio:"xMidYMid"},I("circle",{cx:50,cy:50,fill:"none",stroke:"currentColor",strokeWidth:"4",r:"40","stroke-dasharray":"85 30"},I("animateTransform",{attributeName:"transform",type:"rotate",repeatCount:"indefinite",dur:"1s",values:"0 50 50;360 50 50",keyTimes:"0;1"}))),Wa=()=>I("svg",{width:24,height:24,fill:"currentcolor",viewBox:"0 0 24 24"},[I("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"}),I("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"})]),Ba=()=>ne("WALINE_USER_META",{nick:"",mail:"",link:""}),Da=()=>ne("WALINE_COMMENT_BOX_EDITOR",""),Pa="WALINE_LIKE",qa=ne(Pa,[]),dt=()=>qa,Oa="WALINE_REACTION",Ga=ne(Oa,{}),Ka=()=>Ga,pt={},Za=e=>{const l=pt[e]??(pt[e]=Gt(e,{useRecaptchaNet:!0,autoHideBadge:!0}));return{execute:t=>l.then(a=>a.execute(t))}},Xa=e=>({execute:async l=>{const{load:t}=Wt("https://challenges.cloudflare.com/turnstile/v0/api.js",void 0,{async:!1});await t();const a=window.turnstile;return new Promise(n=>{a==null||a.ready(()=>{a.render(".wl-captcha-container",{sitekey:e,action:l,size:"compact",callback:n})})})}}),Ya="WALINE_USER",Ja=ne(Ya,{}),be=()=>Ja,Qa={key:0,class:"wl-reaction"},el=["textContent"],tl={class:"wl-reaction-list"},al=["onClick"],ll={class:"wl-reaction-img"},nl=["src","alt"],rl=["textContent"],ol=["textContent"];var il=ie({__name:"ArticleReaction",setup(e){const l=Ka(),t=$e(we),a=z(-1),n=z([]),i=W(()=>t.value.locale),p=W(()=>{const{reaction:v}=t.value;return v!=null&&v.length?v:null}),s=W(()=>{var v;const{path:x}=t.value;return((v=p.value)==null?void 0:v.map((j,L)=>({icon:j,desc:i.value[`reaction${L}`],active:l.value[x]===L})))??null});let g;const u=async()=>{const{serverURL:v,lang:x,path:j}=t.value;if(!p.value)return;const L=new AbortController;g=L.abort.bind(L);const[C]=await Et({serverURL:v,lang:x,paths:[j],type:p.value.map((S,R)=>`reaction${R}`),signal:L.signal});n.value=p.value.map((S,R)=>C[`reaction${R}`])},w=async v=>{if(a.value!==-1)return;const{serverURL:x,lang:j,path:L}=t.value,C=l.value[L];a.value=v,C!==void 0&&(await Ve({serverURL:x,lang:j,path:L,type:`reaction${C}`,action:"desc"}),n.value[C]=Math.max(n.value[C]-1,0)),C!==v&&(await Ve({serverURL:x,lang:j,path:L,type:`reaction${v}`}),n.value[v]=(n.value[v]||0)+1),C===v?delete l.value[L]:l.value[L]=v,a.value=-1};return ge(()=>{se(()=>[t.value.serverURL,t.value.path],()=>u())}),He(()=>{g==null||g()}),(v,x)=>s.value?(o(),c("div",Qa,[m("div",{class:"wl-reaction-title",textContent:M(i.value.reactionTitle)},null,8,el),m("ul",tl,[(o(!0),c(B,null,Z(s.value,({active:j,icon:L,desc:C},S)=>(o(),c("li",{key:S,class:P(["wl-reaction-item",{active:j}]),onClick:R=>w(S)},[m("div",ll,[m("img",{src:L,alt:C},null,8,nl),a.value===S?(o(),Q($(ue),{key:0,class:"wl-reaction-loading"})):(o(),c("div",{key:1,class:"wl-reaction-votes",textContent:M(n.value[S]||0)},null,8,rl))]),m("div",{class:"wl-reaction-text",textContent:M(C)},null,8,ol)],10,al))),128))])])):E("v-if",!0)}});const sl=["data-index"],cl=["src","title","onClick"];var ul=ie({__name:"ImageWall",props:{items:{default:()=>[]},columnWidth:{default:300},gap:{default:0}},emits:["insert"],setup(e){const l=e;let t=null;const a=te("wall"),n=z({}),i=z([]),p=()=>{const v=Math.floor((a.value.getBoundingClientRect().width+l.gap)/(l.columnWidth+l.gap));return v>0?v:1},s=v=>new Array(v).fill(null).map(()=>[]),g=async v=>{var x;if(v>=l.items.length)return;await Te();const j=Array.from(((x=a.value)==null?void 0:x.children)??[]).reduce((L,C)=>C.getBoundingClientRect().height<L.getBoundingClientRect().height?C:L);i.value[Number(j.dataset.index)].push(v),await g(v+1)},u=async(v=!1)=>{if(i.value.length===p()&&!v)return;i.value=s(p());const x=window.scrollY;await g(0),window.scrollTo({top:x})},w=v=>{n.value[v.target.src]=!0};return ge(()=>{u(!0),t=new ResizeObserver(()=>{u()}),t.observe(a.value),Le(()=>[l.items],()=>{n.value={},u(!0)}),Le(()=>[l.columnWidth,l.gap],()=>{u()})}),zt(()=>{t.unobserve(a.value)}),(v,x)=>(o(),c("div",{ref_key:"wall",ref:a,class:"wl-gallery",style:_e({gap:`${e.gap}px`})},[(o(!0),c(B,null,Z(i.value,(j,L)=>(o(),c("div",{key:L,class:"wl-gallery-column","data-index":L,style:_e({gap:`${e.gap}px`})},[(o(!0),c(B,null,Z(j,C=>(o(),c(B,{key:C},[n.value[e.items[C].src]?E("v-if",!0):(o(),Q($(ue),{key:0,size:36,style:{margin:"20px auto"}})),m("img",{class:"wl-gallery-item",src:e.items[C].src,title:e.items[C].title,loading:"lazy",onLoad:w,onClick:S=>v.$emit("insert",`![](${e.items[C].src})`)},null,40,cl)],64))),128))],12,sl))),128))],4))}});const ml={key:0,class:"wl-login-info"},vl={class:"wl-avatar"},dl=["title"],pl=["title"],gl=["src"],hl=["title","textContent"],fl={class:"wl-panel"},wl=["for","textContent"],yl=["id","onUpdate:modelValue","name","type"],bl=["placeholder"],kl={class:"wl-preview"},Cl=["innerHTML"],$l={class:"wl-footer"},Ll={class:"wl-actions"},El={href:"https://guides.github.com/features/mastering-markdown/",title:"Markdown Guide","aria-label":"Markdown is supported",class:"wl-action",target:"_blank",rel:"noopener noreferrer"},Il=["title"],Al=["title"],Ml=["title","aria-label"],xl=["title"],Sl={class:"wl-info"},Rl={class:"wl-text-number"},jl={key:0},Ul=["textContent"],zl=["textContent"],Vl=["disabled"],Hl=["placeholder"],_l={key:1,class:"wl-loading"},Tl={key:0,class:"wl-tab-wrapper"},Fl=["title","onClick"],Nl=["src","alt"],Wl={key:0,class:"wl-tabs"},Bl=["onClick"],Dl=["src","alt","title"],Pl=["title"];var gt=ie({__name:"CommentBox",props:{edit:{},rootId:{},replyId:{},replyUser:{}},emits:["log","cancelEdit","cancelReply","submit"],setup(e,{emit:l}){const t=e,a=l,n=$e(we),i=Da(),p=Ba(),s=be(),g=z({}),u=te("textarea"),w=te("image-uploader"),v=te("emoji-button"),x=te("emoji-popup"),j=te("gif-button"),L=te("gif-popup"),C=te("gif-search"),S=z({tabs:[],map:{}}),R=z(0),d=z(!1),K=z(!1),X=z(!1),A=z(""),V=z(0),T=Ee({loading:!0,list:[]}),le=z(0),ee=z(!1),me=z(""),f=z(!1),U=z(!1),y=W(()=>n.value.locale),F=W(()=>!!s.value.token),q=W(()=>n.value.imageUploader!==null),O=h=>{const r=u.value,k=r.selectionStart,_=r.selectionEnd||0,b=r.scrollTop;i.value=r.value.substring(0,k)+h+r.value.substring(_,r.value.length),r.focus(),r.selectionStart=k+h.length,r.selectionEnd=k+h.length,r.scrollTop=b},oe=({key:h,ctrlKey:r,metaKey:k})=>{f.value||(r||k)&&h==="Enter"&&Re()},ve=async h=>{const r=`![${n.value.locale.uploading} ${h.name}]()`;O(r),f.value=!0;try{const k=await n.value.imageUploader(h);i.value=i.value.replace(r,`\r
11
+ ![${h.name}](${k})`)}catch(k){alert(k.message),i.value=i.value.replace(r,"")}finally{f.value=!1}},ke=h=>{var r;if((r=h.dataTransfer)!=null&&r.items){const k=ct(h.dataTransfer.items);k&&q.value&&(ve(k),h.preventDefault())}},yt=h=>{if(h.clipboardData){const r=ct(h.clipboardData.items);r&&q.value&&ve(r)}},bt=()=>{const h=w.value;h.files&&q.value&&ve(h.files[0]).then(()=>{h.value=""})},Re=async()=>{var h;const{serverURL:r,lang:k,login:_,wordLimit:b,requiredMeta:D,recaptchaV3Key:N,turnstileKey:Y}=n.value,H={comment:me.value,nick:p.value.nick,mail:p.value.mail,link:p.value.link,url:n.value.path,ua:await Sa()};if(!t.edit)if(s.value.token)H.nick=s.value.display_name,H.mail=s.value.email,H.link=s.value.url;else{if(_==="force")return;if(D.includes("nick")&&!H.nick){g.value.nick.focus(),alert(y.value.nickError);return}if(D.includes("mail")&&!H.mail||H.mail&&!ha(H.mail)){g.value.mail.focus(),alert(y.value.mailError);return}H.nick||(H.nick=y.value.anonymous)}if(!H.comment){u.value.focus();return}if(!ee.value){alert(y.value.wordHint.replace("$0",b[0].toString()).replace("$1",b[1].toString()).replace("$2",V.value.toString()));return}H.comment=ut(H.comment,S.value.map),t.replyId&&t.rootId&&(H.pid=t.replyId,H.rid=t.rootId,H.at=t.replyUser),f.value=!0;try{N&&(H.recaptchaV3=await Za(N).execute("social")),Y&&(H.turnstile=await Xa(Y).execute("social"));const de={serverURL:r,lang:k,token:s.value.token,comment:H},Ce=await(t.edit?pe({objectId:t.edit.objectId,...de}):It(de));if(f.value=!1,Ce.errmsg){alert(Ce.errmsg);return}a("submit",Ce.data),i.value="",A.value="",await Te(),t.replyId&&a("cancelReply"),(h=t.edit)!=null&&h.objectId&&a("cancelEdit")}catch(de){f.value=!1,alert(de.message)}},kt=h=>{h.preventDefault();const{lang:r,serverURL:k}=n.value;At({serverURL:k,lang:r}).then(_=>{s.value=_,(_.remember?localStorage:sessionStorage).setItem("WALINE_USER",JSON.stringify(_)),a("log")})},Ct=()=>{s.value={},localStorage.setItem("WALINE_USER","null"),sessionStorage.setItem("WALINE_USER","null"),a("log")},je=h=>{h.preventDefault();const{lang:r,serverURL:k}=n.value,_=800,b=800,D=(window.innerWidth-_)/2,N=(window.innerHeight-b)/2,Y=new URLSearchParams({lng:r,token:s.value.token}),H=window.open(`${k}/ui/profile?${Y.toString()}`,"_blank",`width=${_},height=${b},left=${D},top=${N},scrollbars=no,resizable=no,status=no,location=no,toolbar=no,menubar=no`);H==null||H.postMessage({type:"TOKEN",data:s.value.token},"*")},$t=h=>{var r,k,_,b;!((r=v.value)!=null&&r.contains(h.target))&&!((k=x.value)!=null&&k.contains(h.target))&&(d.value=!1),!((_=j.value)!=null&&_.contains(h.target))&&!((b=L.value)!=null&&b.contains(h.target))&&(K.value=!1)},Ue=async h=>{var r;const{scrollTop:k,clientHeight:_,scrollHeight:b}=h.target,D=(_+k)/b,N=n.value.search,Y=((r=C.value)==null?void 0:r.value)??"";D<.9||T.loading||U.value||(T.loading=!0,(N.more&&T.list.length?await N.more(Y,T.list.length):await N.search(Y)).length?T.list=[...T.list,...N.more&&T.list.length?await N.more(Y,T.list.length):await N.search(Y)]:U.value=!0,T.loading=!1,setTimeout(()=>{h.target.scrollTop=k},50))},ze=Bt(h=>{T.list=[],U.value=!1,Ue(h)},300);return We("click",$t),We("message",({data:h})=>{(h==null?void 0:h.type)==="profile"&&(s.value={...s.value,...h.data},[localStorage,sessionStorage].filter(r=>r.getItem("WALINE_USER")).forEach(r=>{r.setItem("WALINE_USER",JSON.stringify(s))}))}),se([n,V],([h,r])=>{const{wordLimit:k}=h;k?r<k[0]&&k[0]!==0?(le.value=k[0],ee.value=!1):r>k[1]?(le.value=k[1],ee.value=!1):(le.value=k[1],ee.value=!0):(le.value=0,ee.value=!0)}),Le(K,async h=>{var r;if(!h)return;const k=n.value.search;C.value&&(C.value.value=""),T.loading=!0,T.list=await(((r=k.default)==null?void 0:r.call(k))??k.search("")),T.loading=!1}),ge(()=>{var h;(h=t.edit)!=null&&h.objectId&&(i.value=t.edit.orig),se(()=>i.value,r=>{const{highlighter:k,texRenderer:_}=n.value;me.value=r,A.value=Ia(r,{emojiMap:S.value.map,highlighter:k,texRenderer:_}),V.value=xa(r),r?Be(u.value):Be.destroy(u.value)}),se(()=>n.value.emoji,async r=>{S.value=await ba(r)})}),(h,r)=>{var k,_;return o(),c("div",{key:$(s).token,class:"wl-comment"},[$(n).login!=="disable"&&F.value&&!((k=e.edit)!=null&&k.objectId)?(o(),c("div",ml,[m("div",vl,[m("button",{type:"submit",class:"wl-logout-btn",title:y.value.logout,onClick:Ct},[G($(vt),{size:14})],8,dl),m("a",{href:"#",class:"wl-login-nick","aria-label":"Profile",title:y.value.profile,onClick:je},[m("img",{src:$(s).avatar,alt:"avatar"},null,8,gl)],8,pl)]),m("a",{href:"#",class:"wl-login-nick","aria-label":"Profile",title:y.value.profile,onClick:je,textContent:M($(s).display_name)},null,8,hl)])):E("v-if",!0),m("div",fl,[$(n).login!=="force"&&$(n).meta.length&&!F.value?(o(),c("div",{key:0,class:P(["wl-header",`item${$(n).meta.length}`])},[(o(!0),c(B,null,Z($(n).meta,b=>(o(),c("div",{key:b,class:"wl-header-item"},[m("label",{for:`wl-${b}`,textContent:M(y.value[b]+($(n).requiredMeta.includes(b)||!$(n).requiredMeta.length?"":`(${y.value.optional})`))},null,8,wl),he(m("input",{id:`wl-${b}`,ref_for:!0,ref:D=>{D&&(g.value[b]=D)},"onUpdate:modelValue":D=>$(p)[b]=D,class:P(["wl-input",`wl-${b}`]),name:b,type:b==="mail"?"email":"text"},null,10,yl),[[Vt,$(p)[b]]])]))),128))],2)):E("v-if",!0),he(m("textarea",{id:"wl-edit",ref:"textarea","onUpdate:modelValue":r[0]||(r[0]=b=>Ht(i)?i.value=b:null),class:"wl-editor",placeholder:e.replyUser?`@${e.replyUser}`:y.value.placeholder,onKeydown:oe,onDrop:ke,onPaste:yt},null,40,bl),[[_t,$(i)]]),he(m("div",kl,[r[7]||(r[7]=m("hr",null,null,-1)),m("h4",null,M(y.value.preview)+":",1),m("div",{class:"wl-content",innerHTML:A.value},null,8,Cl)],512),[[Fe,X.value]]),m("div",$l,[m("div",Ll,[m("a",El,[G($(Ha))]),he(m("button",{ref:"emoji-button",type:"button",class:P(["wl-action",{active:d.value}]),title:y.value.emoji,onClick:r[1]||(r[1]=b=>d.value=!d.value)},[G($(ja))],10,Il),[[Fe,S.value.tabs.length]]),$(n).search?(o(),c("button",{key:0,ref:"gif-button",type:"button",class:P(["wl-action",{active:K.value}]),title:y.value.gif,onClick:r[2]||(r[2]=b=>K.value=!K.value)},[G($(Wa))],10,Al)):E("v-if",!0),m("input",{id:"wl-image-upload",ref:"image-uploader",class:"upload","aria-hidden":"true",type:"file",accept:".png,.jpg,.jpeg,.webp,.bmp,.gif",onChange:bt},null,544),q.value?(o(),c("label",{key:1,for:"wl-image-upload",class:"wl-action",title:y.value.uploadImage,"aria-label":y.value.uploadImage},[G($(Ua))],8,Ml)):E("v-if",!0),m("button",{type:"button",class:P(["wl-action",{active:X.value}]),title:y.value.preview,onClick:r[3]||(r[3]=b=>X.value=!X.value)},[G($(Va))],10,xl)]),m("div",Sl,[r[9]||(r[9]=m("div",{class:"wl-captcha-container"},null,-1)),m("div",Rl,[ae(M(V.value)+" ",1),$(n).wordLimit?(o(),c("span",jl,[r[8]||(r[8]=ae("  /  ",-1)),m("span",{class:P({illegal:!ee.value}),textContent:M(le.value)},null,10,Ul)])):E("v-if",!0),ae("  "+M(y.value.word),1)]),$(n).login!=="disable"&&!F.value?(o(),c("button",{key:0,type:"button",class:"wl-btn",onClick:kt,textContent:M(y.value.login)},null,8,zl)):E("v-if",!0),$(n).login!=="force"||F.value?(o(),c("button",{key:1,type:"submit",class:"primary wl-btn",title:"Cmd|Ctrl + Enter",disabled:f.value,onClick:Re},[f.value?(o(),Q($(ue),{key:0,size:16})):(o(),c(B,{key:1},[ae(M(y.value.submit),1)],64))],8,Vl)):E("v-if",!0)]),m("div",{ref:"gif-popup",class:P(["wl-gif-popup",{display:K.value}])},[m("input",{ref:"gif-search",type:"text",placeholder:y.value.gifSearchPlaceholder,onInput:r[4]||(r[4]=(...b)=>$(ze)&&$(ze)(...b))},null,40,Hl),T.list.length?(o(),Q(ul,{key:0,items:T.list,"column-width":200,gap:6,onInsert:r[5]||(r[5]=b=>O(b)),onScroll:Ue},null,8,["items"])):E("v-if",!0),T.loading?(o(),c("div",_l,[G($(ue),{size:30})])):E("v-if",!0)],2),m("div",{ref:"emoji-popup",class:P(["wl-emoji-popup",{display:d.value}])},[(o(!0),c(B,null,Z(S.value.tabs,(b,D)=>(o(),c(B,{key:b.name},[D===R.value?(o(),c("div",Tl,[(o(!0),c(B,null,Z(b.items,N=>(o(),c("button",{key:N,type:"button",title:N,onClick:Y=>O(`:${N}:`)},[d.value?(o(),c("img",{key:0,class:"wl-emoji",src:S.value.map[N],alt:N,loading:"lazy",referrerPolicy:"no-referrer"},null,8,Nl)):E("v-if",!0)],8,Fl))),128))])):E("v-if",!0)],64))),128)),S.value.tabs.length>1?(o(),c("div",Wl,[(o(!0),c(B,null,Z(S.value.tabs,(b,D)=>(o(),c("button",{key:b.name,type:"button",class:P(["wl-tab",{active:R.value===D}]),onClick:N=>R.value=D},[m("img",{class:"wl-emoji",src:b.icon,alt:b.name,title:b.name,loading:"lazy",referrerPolicy:"no-referrer"},null,8,Dl)],10,Bl))),128))])):E("v-if",!0)],2)])]),e.replyId||(_=e.edit)!=null&&_.objectId?(o(),c("button",{key:1,type:"button",class:"wl-close",title:y.value.cancelReply,onClick:r[6]||(r[6]=b=>e.replyId?a("cancelReply"):a("cancelEdit"))},[G($(vt),{size:24})],8,Pl)):E("v-if",!0)])}}});const ql=["id"],Ol={class:"wl-user","aria-hidden":"true"},Gl=["src"],Kl={class:"wl-card"},Zl={class:"wl-head"},Xl=["href"],Yl={key:1,class:"wl-nick"},Jl=["textContent"],Ql=["textContent"],en=["textContent"],tn=["textContent"],an={class:"wl-comment-actions"},ln=["title"],nn=["title"],rn={class:"wl-meta","aria-hidden":"true"},on=["data-value","textContent"],sn={key:0,class:"wl-content"},cn={key:0},un=["href"],mn=["innerHTML"],vn={key:1,class:"wl-admin-actions"},dn={class:"wl-comment-status"},pn=["disabled","onClick","textContent"],gn={key:3,class:"wl-quote"};var hn=ie({__name:"CommentCard",props:{comment:{},edit:{},rootId:{},reply:{}},emits:["log","submit","delete","like","sticky","edit","reply","status"],setup(e,{emit:l}){const t=e,a=l,n=["approved","waiting","spam"],i=$e(we),p=dt(),s=Dt(),g=be(),u=W(()=>i.value.locale),w=W(()=>{const{link:R}=t.comment;return R?rt(R)?R:`https://${R}`:""}),v=W(()=>p.value.includes(t.comment.objectId)),x=W(()=>pa(new Date(t.comment.time),s.value,u.value)),j=W(()=>g.value.type==="administrator"),L=W(()=>t.comment.user_id&&g.value.objectId===t.comment.user_id),C=W(()=>{var R;return t.comment.objectId===((R=t.reply)==null?void 0:R.objectId)}),S=W(()=>{var R;return t.comment.objectId===((R=t.edit)==null?void 0:R.objectId)});return(R,d)=>{var K;const X=Tt("CommentCard",!0);return o(),c("div",{id:e.comment.objectId.toString(),class:"wl-card-item"},[m("div",Ol,[e.comment.avatar?(o(),c("img",{key:0,class:"wl-user-avatar",src:e.comment.avatar,alt:""},null,8,Gl)):E("v-if",!0),e.comment.type==="guest"?(o(),Q($(Fa),{key:1})):E("v-if",!0),e.comment.type==="administrator"?(o(),Q($(Na),{key:2})):E("v-if",!0)]),m("div",Kl,[m("div",Zl,[w.value?(o(),c("a",{key:0,class:"wl-nick",href:w.value,target:"_blank",rel:"nofollow noopener noreferrer"},M(e.comment.nick),9,Xl)):(o(),c("span",Yl,M(e.comment.nick),1)),e.comment.label?(o(),c("span",{key:2,class:"wl-badge",textContent:M(e.comment.label)},null,8,Jl)):E("v-if",!0),e.comment.sticky?(o(),c("span",{key:3,class:"wl-badge",textContent:M(u.value.sticky)},null,8,Ql)):E("v-if",!0),typeof e.comment.level=="number"?(o(),c("span",{key:4,class:P(`wl-badge level${e.comment.level}`),textContent:M(u.value[`level${e.comment.level}`]||`Level ${e.comment.level}`)},null,10,en)):E("v-if",!0),m("span",{class:"wl-time",textContent:M(x.value)},null,8,tn),m("div",an,[j.value||L.value?(o(),c(B,{key:0},[m("button",{type:"button",class:"wl-edit",onClick:d[0]||(d[0]=A=>a("edit",e.comment))},[G($(Ta))]),m("button",{type:"button",class:"wl-delete",onClick:d[1]||(d[1]=A=>a("delete",e.comment))},[G($(Ra))])],64)):E("v-if",!0),m("button",{type:"button",class:"wl-like",title:v.value?u.value.cancelLike:u.value.like,onClick:d[2]||(d[2]=A=>a("like",e.comment))},[G($(za),{active:v.value},null,8,["active"]),ae(" "+M("like"in e.comment?e.comment.like:""),1)],8,ln),m("button",{type:"button",class:P(["wl-reply",{active:C.value}]),title:C.value?u.value.cancelReply:u.value.reply,onClick:d[3]||(d[3]=A=>a("reply",C.value?null:e.comment))},[G($(_a))],10,nn)])]),m("div",rn,[(o(),c(B,null,Z(["addr","browser","os"],A=>(o(),c(B,null,[e.comment[A]?(o(),c("span",{key:A,class:P(`wl-${A}`),"data-value":e.comment[A],textContent:M(e.comment[A])},null,10,on)):E("v-if",!0)],64))),64))]),S.value?E("v-if",!0):(o(),c("div",sn,["reply_user"in e.comment&&e.comment.reply_user?(o(),c("p",cn,[m("a",{href:"#"+e.comment.pid},"@"+M(e.comment.reply_user.nick),9,un),d[17]||(d[17]=m("span",null,": ",-1))])):E("v-if",!0),m("div",{innerHTML:e.comment.comment},null,8,mn)])),j.value&&!S.value?(o(),c("div",vn,[m("span",dn,[(o(),c(B,null,Z(n,A=>m("button",{key:A,type:"submit",class:P(`wl-btn wl-${A}`),disabled:e.comment.status===A,onClick:V=>a("status",{status:A,comment:e.comment}),textContent:M(u.value[A])},null,10,pn)),64))]),j.value&&!("rid"in e.comment)?(o(),c("button",{key:0,type:"submit",class:"wl-btn wl-sticky",onClick:d[4]||(d[4]=A=>a("sticky",e.comment))},M(e.comment.sticky?u.value.unsticky:u.value.sticky),1)):E("v-if",!0)])):E("v-if",!0),C.value||S.value?(o(),c("div",{key:2,class:P({"wl-reply-wrapper":C.value,"wl-edit-wrapper":S.value})},[G(gt,{edit:e.edit,"reply-id":(K=e.reply)==null?void 0:K.objectId,"reply-user":e.comment.nick,"root-id":e.rootId,onLog:d[5]||(d[5]=A=>a("log")),onCancelReply:d[6]||(d[6]=A=>a("reply",null)),onCancelEdit:d[7]||(d[7]=A=>a("edit",null)),onSubmit:d[8]||(d[8]=A=>a("submit",A))},null,8,["edit","reply-id","reply-user","root-id"])],2)):E("v-if",!0),"children"in e.comment?(o(),c("div",gn,[(o(!0),c(B,null,Z(e.comment.children,A=>(o(),Q(X,{key:A.objectId,comment:A,reply:e.reply,edit:e.edit,"root-id":e.rootId,onLog:d[9]||(d[9]=V=>a("log")),onDelete:d[10]||(d[10]=V=>a("delete",V)),onEdit:d[11]||(d[11]=V=>a("edit",V)),onLike:d[12]||(d[12]=V=>a("like",V)),onReply:d[13]||(d[13]=V=>a("reply",V)),onStatus:d[14]||(d[14]=V=>a("status",V)),onSticky:d[15]||(d[15]=V=>a("sticky",V)),onSubmit:d[16]||(d[16]=V=>a("submit",V))},null,8,["comment","reply","edit","root-id"]))),128))])):E("v-if",!0)])],8,ql)}}});const ht="3.7.1",fn={"data-waline":""},wn={class:"wl-meta-head"},yn={class:"wl-count"},bn=["textContent"],kn={class:"wl-sort"},Cn=["onClick"],$n={class:"wl-cards"},Ln={key:1,class:"wl-operation"},En=["textContent"],In={key:2,class:"wl-loading"},An=["textContent"],Mn={key:4,class:"wl-operation"},xn=["textContent"],Sn={key:5,class:"wl-power"};var Rn=ie({__name:"WalineComment",props:{serverURL:{},path:{},meta:{},requiredMeta:{},wordLimit:{},pageSize:{},lang:{},locale:{},commentSorting:{},dark:{type:[String,Boolean]},login:{},noCopyright:{type:Boolean},recaptchaV3Key:{},turnstileKey:{},reaction:{type:[Array,Boolean]},emoji:{},search:{},highlighter:{type:Function},imageUploader:{type:Function},texRenderer:{type:Function}},setup(e){const l=e,t=be(),a=dt(),n=z("loading"),i=z(0),p=z(1),s=z(0),g=W(()=>ma(l)),u=z(g.value.commentSorting),w=z([]),v=z(null),x=z(null),j=W(()=>va(g.value.dark)),L=W(()=>g.value.locale);Pt(j,{id:"waline-darkmode"});let C=null;const S=f=>{const{serverURL:U,path:y,pageSize:F}=g.value,q=new AbortController;n.value="loading",C==null||C(),xt({serverURL:U,lang:g.value.lang,path:y,pageSize:F,sortBy:at[u.value],page:f,signal:q.signal,token:t.value.token}).then(O=>{n.value="success",i.value=O.count,w.value.push(...O.data),p.value=f,s.value=O.totalPages}).catch(O=>{O.name!=="AbortError"&&(console.error(O.message),n.value="error")}),C=q.abort.bind(q)},R=()=>{S(p.value+1)},d=()=>{i.value=0,w.value=[],S(1)},K=f=>{u.value!==f&&(u.value=f,d())},X=f=>{v.value=f},A=f=>{x.value=f},V=f=>{if(x.value)x.value.comment=f.comment,x.value.orig=f.orig;else if("rid"in f){const U=w.value.find(({objectId:y})=>y===f.rid);if(!U)return;Array.isArray(U.children)||(U.children=[]),U.children.push(f)}else w.value.unshift(f),i.value+=1},T=async({comment:f,status:U})=>{if(f.status===U)return;const{serverURL:y,lang:F}=g.value;await pe({serverURL:y,lang:F,token:t.value.token,objectId:f.objectId,comment:{status:U}}),f.status=U},le=async f=>{if("rid"in f)return;const{serverURL:U,lang:y}=g.value;await pe({serverURL:U,lang:y,token:t.value.token,objectId:f.objectId,comment:{sticky:f.sticky?0:1}}),f.sticky=!f.sticky},ee=async({objectId:f})=>{if(!confirm("Are you sure you want to delete this comment?"))return;const{serverURL:U,lang:y}=g.value;await Mt({serverURL:U,lang:y,token:t.value.token,objectId:f}),w.value.some((F,q)=>F.objectId===f?(w.value=w.value.filter((O,oe)=>oe!==q),!0):F.children.some((O,oe)=>O.objectId===f?(w.value[q].children=F.children.filter((ve,ke)=>ke!==oe),!0):!1))},me=async f=>{const{serverURL:U,lang:y}=g.value,{objectId:F}=f,q=a.value.includes(F);await pe({serverURL:U,lang:y,objectId:F,token:t.value.token,comment:{like:!q}}),q?a.value=a.value.filter(O=>O!==F):(a.value=[...a.value,F],a.value.length>50&&(a.value=a.value.slice(-50))),f.like=Math.max(0,(f.like||0)+(q?-1:1))};return Ft(we,g),ge(()=>{se(()=>[l.serverURL,l.path],()=>{d()})}),He(()=>{C==null||C()}),(f,U)=>(o(),c("div",fn,[G(il),!v.value&&!x.value?(o(),Q(gt,{key:0,onLog:d,onSubmit:V})):E("v-if",!0),m("div",wn,[m("div",yn,[i.value?(o(),c("span",{key:0,class:"wl-num",textContent:M(i.value)},null,8,bn)):E("v-if",!0),ae(" "+M(L.value.comment),1)]),m("ul",kn,[(o(!0),c(B,null,Z($(ca),y=>(o(),c("li",{key:y,class:P([y===u.value?"active":""]),onClick:F=>K(y)},M(L.value[y]),11,Cn))),128))])]),m("div",$n,[(o(!0),c(B,null,Z(w.value,y=>(o(),Q(hn,{key:y.objectId,"root-id":y.objectId,comment:y,reply:v.value,edit:x.value,onLog:d,onReply:X,onEdit:A,onSubmit:V,onStatus:T,onDelete:ee,onSticky:le,onLike:me},null,8,["root-id","comment","reply","edit"]))),128))]),n.value==="error"?(o(),c("div",Ln,[m("button",{type:"button",class:"wl-btn",onClick:d,textContent:M(L.value.refresh)},null,8,En)])):n.value==="loading"?(o(),c("div",In,[G($(ue),{size:30})])):w.value.length?p.value<s.value?(o(),c("div",Mn,[m("button",{type:"button",class:"wl-btn",onClick:R,textContent:M(L.value.more)},null,8,xn)])):E("v-if",!0):(o(),c("div",{key:3,class:"wl-empty",textContent:M(L.value.sofa)},null,8,An)),g.value.noCopyright?E("v-if",!0):(o(),c("div",Sn,[U[0]||(U[0]=ae(" Powered by ",-1)),U[1]||(U[1]=m("a",{href:"https://github.com/walinejs/waline",target:"_blank",rel:"noopener noreferrer"}," Waline ",-1)),ae(" v"+M($(ht)),1)]))]))}});const ft=(e,l)=>{l.forEach((t,a)=>{const n=e[a].time;typeof n=="number"&&(t.innerText=n.toString())})},wt=({serverURL:e,path:l=window.location.pathname,selector:t=".waline-pageview-count",update:a=!0,lang:n=navigator.language})=>{const i=new AbortController,p=Array.from(document.querySelectorAll(t)),s=u=>{const w=Se(u);return w!==null&&l!==w},g=u=>Rt({serverURL:ye(e),paths:u.map(w=>Se(w)??l),lang:n,signal:i.signal}).then(w=>ft(w,u)).catch(st);if(a){const u=p.filter(v=>!s(v)),w=p.filter(s);St({serverURL:ye(e),path:l,lang:n}).then(v=>ft(v,u)),w.length&&g(w)}else g(p);return i.abort.bind(i)},jn=({el:e="#waline",path:l=window.location.pathname,comment:t=!1,pageview:a=!1,...n})=>{const i=e?xe(e):null;if(e&&!i)throw new Error("Option 'el' do not match any domElement!");if(!n.serverURL)throw new Error("Option 'serverURL' is missing!");const p=Ee({...n}),s=Ee({comment:t,pageview:a,path:l}),g=()=>{s.comment&&mt({serverURL:p.serverURL,path:s.path,...re(s.comment)?{selector:s.comment}:{}})},u=()=>{s.pageview&&wt({serverURL:p.serverURL,path:s.path,...re(s.pageview)?{selector:s.pageview}:{}})};let w=null;i&&(w=Nt(()=>I(Rn,{path:s.path,...p})),w.mount(i));const v=Ne(g),x=Ne(u);return{el:i,update:({comment:j,pageview:L,path:C=window.location.pathname,...S}={})=>{Object.entries(S).forEach(([R,d])=>{p[R]=d}),s.path=C,j!==void 0&&(s.comment=j),L!==void 0&&(s.pageview=L)},destroy:()=>{w==null||w.unmount(),v(),x()}}},Un=({el:e,serverURL:l,count:t,lang:a=navigator.language})=>{const n=be(),i=xe(e),p=new AbortController;return jt({serverURL:l,count:t,lang:a,signal:p.signal,token:n.value.token}).then(s=>i&&s.length?(i.innerHTML=`<ul class="wl-recent-list">${s.map(g=>`<li class="wl-recent-item"><a href="${g.url}">${g.nick}</a>:${g.comment}</li>`).join("")}</ul>`,{comments:s,destroy:()=>{p.abort(),i.innerHTML=""}}):{comments:s,destroy:()=>p.abort()})},zn=({el:e,serverURL:l,count:t,locale:a,lang:n=navigator.language,mode:i="list"})=>{const p=xe(e),s=new AbortController;return Ut({serverURL:l,pageSize:t,lang:n,signal:s.signal}).then(g=>!p||!g.length?{users:g,destroy:()=>s.abort()}:(a={...et(n),...typeof a=="object"?a:{}},p.innerHTML=`<ul class="wl-user-${i}">${g.map((u,w)=>[`<li class="wl-user-item" aria-label="${u.nick}">`,u.link&&`<a href="${u.link}" target="_blank">`,'<div class="wl-user-avatar">',`<img src="${u.avatar}" alt="${u.nick}">`,`<span class="wl-user-badge">${w+1}</span>`,"</div>",'<div class="wl-user-meta">','<div class="wl-user-name">',u.nick,u.level&&`<span class="wl-badge">${a?a[`level${u.level}`]:`Level ${u.level}`}</span>`,u.label&&`<span class="wl-badge">${u.label}</span>`,"</div>",u.link&&u.link,"</div>",u.link&&"</a>","</li>"].filter(v=>v).join("")).join("")}</ul>`,{users:g,destroy:()=>{s.abort(),p.innerHTML=""}}))};export{Un as RecentComments,zn as UserList,mt as commentCount,fe as defaultLocales,jn as init,wt as pageviewCount,ht as version};
12
12
  //# sourceMappingURL=slim.js.map