@waline/client 3.4.0 → 3.4.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/comment.js +1 -1
- package/dist/component.js +1 -1
- package/dist/pageview.js +1 -1
- package/dist/slim.js +1 -1
- package/dist/waline.js +1 -1
- package/dist/waline.js.map +1 -1
- package/dist/waline.umd.js +1 -1
- package/dist/waline.umd.js.map +1 -1
- package/package.json +4 -4
package/dist/comment.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const h=t=>`${t.replace(/\/?$/,"/")}api/`,i=(t,e="")=>{if(typeof t=="object"&&t.errno)throw new TypeError(`${e} failed with ${t.errno}: ${t.errmsg}`);return t},g=({serverURL:t,lang:e,paths:r,signal:o})=>fetch(`${h(t)}comment?type=count&url=${encodeURIComponent(r.join(","))}&lang=${e}`,{signal:o}).then(n=>n.json()).then(n=>i(n,"Get comment count").data),p=t=>{try{t=decodeURI(t)}catch{}return t},m=(t="")=>t.replace(/\/$/u,""),u=t=>/^(https?:)?\/\//.test(t),d=t=>{const e=m(t);return u(e)?e:`https://${e}`},$=t=>{t.name!=="AbortError"&&console.error(t.message)},f=t=>{const{path:e}=t.dataset;return e!=null&&e.length?e:null},v=({serverURL:t,path:e=window.location.pathname,selector:r=".waline-comment-count",lang:o=navigator.language})=>{const n=new AbortController,a=document.querySelectorAll(r);return a.length&&g({serverURL:d(t),paths:Array.from(a).map(c=>p(f(c)??e)),lang:o,signal:n.signal}).then(c=>{a.forEach((s,l)=>{s.innerText=c[l].toString()})}).catch($),n.abort.bind(n)},w="3.4.
|
|
1
|
+
const h=t=>`${t.replace(/\/?$/,"/")}api/`,i=(t,e="")=>{if(typeof t=="object"&&t.errno)throw new TypeError(`${e} failed with ${t.errno}: ${t.errmsg}`);return t},g=({serverURL:t,lang:e,paths:r,signal:o})=>fetch(`${h(t)}comment?type=count&url=${encodeURIComponent(r.join(","))}&lang=${e}`,{signal:o}).then(n=>n.json()).then(n=>i(n,"Get comment count").data),p=t=>{try{t=decodeURI(t)}catch{}return t},m=(t="")=>t.replace(/\/$/u,""),u=t=>/^(https?:)?\/\//.test(t),d=t=>{const e=m(t);return u(e)?e:`https://${e}`},$=t=>{t.name!=="AbortError"&&console.error(t.message)},f=t=>{const{path:e}=t.dataset;return e!=null&&e.length?e:null},v=({serverURL:t,path:e=window.location.pathname,selector:r=".waline-comment-count",lang:o=navigator.language})=>{const n=new AbortController,a=document.querySelectorAll(r);return a.length&&g({serverURL:d(t),paths:Array.from(a).map(c=>p(f(c)??e)),lang:o,signal:n.signal}).then(c=>{a.forEach((s,l)=>{s.innerText=c[l].toString()})}).catch($),n.abort.bind(n)},w="3.4.1";export{v as commentCount,w as version};
|
|
2
2
|
//# sourceMappingURL=comment.js.map
|
package/dist/component.js
CHANGED
|
@@ -8,5 +8,5 @@ import{h as M,defineComponent as ce,inject as we,ref as C,computed as W,onMounte
|
|
|
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?"]),it=Q(["昵称","昵称不能少于3个字符","邮箱","请填写正确的邮件地址","网址","可选","欢迎评论","来发评论吧~","提交","喜欢","取消喜欢","回复","取消回复","评论","刷新","加载更多...","预览","表情","上传图片","秒前","分钟前","小时前","天前","刚刚","正在上传","登录","退出","博主","置顶","字",`评论字数应在 $0 到 $1 字之间!
|
|
9
9
|
当前字数:$2`,"匿名","潜水","冒泡","吐槽","活跃","话痨","传说","表情包","搜索表情包","个人资料","通过","待审核","垃圾","取消置顶","按倒序","按正序","按热度","你认为这篇文章怎么样?"]),xl=Q(["暱稱","暱稱不能少於3個字元","郵箱","請填寫正確的郵件地址","網址","可選","歡迎留言","來發留言吧~","送出","喜歡","取消喜歡","回覆","取消回覆","留言","重整","載入更多...","預覽","表情","上傳圖片","秒前","分鐘前","小時前","天前","剛剛","正在上傳","登入","登出","管理者","置頂","字",`留言字數應在 $0 到 $1 字之間!
|
|
10
10
|
目前字數:$2`,"匿名","潛水","冒泡","吐槽","活躍","多話","傳說","表情包","搜尋表情包","個人資料","通過","待審核","垃圾","取消置頂","最早","最新","熱門","你認為這篇文章怎麼樣?"]);const ot="en-US",Ce={zh:it,"zh-cn":it,"zh-tw":xl,en:Qe,"en-us":Qe,fr:tt,"fr-fr":tt,jp:lt,"jp-jp":lt,"pt-br":Ll,ru:at,"ru-ru":at,vi:nt,"vi-vn":nt,de:El,es:et,"es-mx":et},Al=e=>Ce[e.toLowerCase()]||Ce[ot.toLowerCase()],rt=e=>Object.keys(Ce).includes(e.toLowerCase())?e:ot,Ml=e=>{const a=Ke(e);return Ze(a)?a:`https://${a}`},Sl=e=>Array.isArray(e)?e:e?[0,e]:!1,$e=(e,a)=>typeof e=="function"?e:e===!1?!1:a,Rl=({serverURL:e,path:a=location.pathname,lang:t=typeof navigator>"u"?"en-US":navigator.language,locale:l,emoji:n=Je,meta:v=["nick","mail","link"],requiredMeta:E=[],dark:y=!1,pageSize:z=10,wordLimit:b,imageUploader:I,highlighter:U,texRenderer:d,copyright:S=!0,login:R="enable",search:k,reaction:g,recaptchaV3Key:o="",turnstileKey:p="",commentSorting:F="latest",...q})=>({serverURL:Ml(e),path:vl(a),lang:rt(t),locale:{...Al(rt(t)),...typeof l=="object"?l:{}},wordLimit:Sl(b),meta:Xe(v),requiredMeta:Xe(E),imageUploader:$e(I,gl),highlighter:$e(U,$l),texRenderer:$e(d,hl),dark:y,emoji:typeof n=="boolean"?n?Je:[]:n,pageSize:z,login:R,copyright:S,search:k===!1?!1:typeof k=="object"?k:fl(t),recaptchaV3Key:o,turnstileKey:p,reaction:Array.isArray(g)?g:g===!0?pl:[],commentSorting:F,...q}),Ie=e=>typeof e=="string",Ee="{--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}",jl=e=>Ie(e)?e==="auto"?`@media(prefers-color-scheme:dark){body${Ee}}`:`${e}${Ee}`:e===!0?`:root${Ee}`:"",Le=(e,a)=>{let t=e.toString();for(;t.length<a;)t="0"+t;return t},zl=e=>{const a=Le(e.getDate(),2),t=Le(e.getMonth()+1,2);return`${Le(e.getFullYear(),2)}-${t}-${a}`},_l=(e,a,t)=>{if(!e)return"";const l=Ie(e)?new Date(e.includes(" ")?e.replace(/-/g,"/"):e):e,n=a.getTime()-l.getTime(),v=Math.floor(n/(24*3600*1e3));if(v===0){const E=n%864e5,y=Math.floor(E/(3600*1e3));if(y===0){const z=E%36e5,b=Math.floor(z/(60*1e3));if(b===0){const I=z%6e4;return`${Math.round(I/1e3)} ${t.seconds}`}return`${b} ${t.minutes}`}return`${y} ${t.hours}`}return v<0?t.now:v<8?`${v} ${t.days}`:zl(l)},Vl=/^[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])?)*$/,Ul=e=>Vl.test(e),Hl=e=>!!/@[0-9]+\.[0-9]+\.[0-9]+/.test(e),Tl=e=>{const a=oe("WALINE_EMOJI",{}),t=Hl(e);if(t){const l=a.value[e];if(l)return Promise.resolve(l)}return fetch(`${e}/info.json`).then(l=>l.json()).then(l=>{const n={folder:e,...l};return t&&(a.value[e]=n),n})},st=(e,a="",t="",l="")=>`${a?`${a}/`:""}${t}${e}${l?`.${l}`:""}`,Fl=e=>Promise.all(e.map(a=>Ie(a)?Tl(Ke(a)):Promise.resolve(a))).then(a=>{const t={tabs:[],map:{}};return a.forEach(l=>{const{name:n,folder:v,icon:E,prefix:y="",type:z,items:b}=l;t.tabs.push({name:n,icon:st(E,v,y,z),items:b.map(I=>{const U=`${y}${I}`;return t.map[U]=st(I,v,y,z),U})})}),t}),Nl=e=>e.type.includes("image"),ct=e=>{const a=Array.from(e).find(Nl);return a?a.getAsFile():null},Wl=/\$.*?\$/,Bl=/^\$(.*?)\$/,Pl=/^(?:\s{0,3})\$\$((?:[^\n]|\n[^\n])+?)\n{0,1}\$\$/,Dl=e=>[{name:"blockMath",level:"block",tokenizer(a){const t=Pl.exec(a);if(t!==null)return{type:"html",raw:t[0],text:e(!0,t[1])}}},{name:"inlineMath",level:"inline",start(a){const t=a.search(Wl);return t!==-1?t:a.length},tokenizer(a){const t=Bl.exec(a);if(t!==null)return{type:"html",raw:t[0],text:e(!1,t[1])}}}],ut=(e="",a={})=>e.replace(/:(.+?):/g,(t,l)=>a[l]?`<img class="wl-emoji" src="${a[l]}" alt="${l}">`:t),Ol=(e,{emojiMap:a,highlighter:t,texRenderer:l})=>{const n=new zt;if(n.setOptions({breaks:!0}),t&&n.use(_t({highlight:t})),l){const v=Dl(l);n.use({extensions:v})}return n.parse(ut(e,a))},ql=e=>e.match(/[\w\d\s,.\u00C0-\u024F\u0400-\u04FF]+/giu),Gl=e=>e.match(/[\u4E00-\u9FD5]/gu),Kl=e=>{var a,t;return(((a=ql(e))==null?void 0:a.reduce((l,n)=>l+(["",",","."].includes(n.trim())?0:n.trim().split(/\s+/u).length),0))??0)+(((t=Gl(e))==null?void 0:t.length)??0)},Zl=async()=>{if(!navigator)return"";const{userAgentData:e}=navigator;let a=navigator.userAgent;if(!e||e.platform!=="Windows")return a;const{platformVersion:t}=await e.getHighEntropyValues(["platformVersion"]);return t&&parseInt(t.split(".")[0])>=13&&(a=a.replace("Windows NT 10.0","Windows NT 11.0")),a},Xl={key:0,class:"wl-login-info"},Jl={class:"wl-avatar"},Yl=["title"],Ql=["title"],ea=["src"],ta=["title","textContent"],la={class:"wl-panel"},aa=["for","textContent"],na=["id","onUpdate:modelValue","name","type"],ia=["placeholder"],oa={class:"wl-preview"},ra=["innerHTML"],sa={class:"wl-footer"},ca={class:"wl-actions"},ua={href:"https://guides.github.com/features/mastering-markdown/",title:"Markdown Guide","aria-label":"Markdown is supported",class:"wl-action",target:"_blank",rel:"noopener noreferrer"},ma=["title"],va=["title"],da=["title","aria-label"],pa=["title"],ga={class:"wl-info"},ha={class:"wl-text-number"},fa={key:0},ya=["textContent"],wa=["textContent"],ka=["disabled"],ba=["placeholder"],Ca={key:1,class:"wl-loading"},$a={key:0,class:"wl-tab-wrapper"},Ia=["title","onClick"],Ea=["src","alt"],La={key:0,class:"wl-tabs"},xa=["onClick"],Aa=["src","alt","title"],Ma=["title"];var mt=ce({__name:"CommentBox",props:{edit:{default:null},rootId:{default:""},replyId:{default:""},replyUser:{default:""}},emits:["log","cancelEdit","cancelReply","submit"],setup(e,{emit:a}){const t=e,l=a,n=we("config"),v=Gt(),E=qt(),y=ke(),z=C({}),b=C(null),I=C(null),U=C(null),d=C(null),S=C(null),R=C(null),k=C(null),g=C({tabs:[],map:{}}),o=C(0),p=C(!1),F=C(!1),q=C(!1),L=C(""),_=C(0),H=yt({loading:!0,list:[]}),te=C(0),le=C(!1),me=C(""),Y=C(!1),re=C(!1),u=W(()=>n.value.locale),x=W(()=>{var c;return!!((c=y.value)!=null&&c.token)}),j=W(()=>n.value.imageUploader!==!1),G=c=>{const i=b.value,h=i.selectionStart,V=i.selectionEnd||0,f=i.scrollTop;v.value=i.value.substring(0,h)+c+i.value.substring(V,i.value.length),i.focus(),i.selectionStart=h+c.length,i.selectionEnd=h+c.length,i.scrollTop=f},K=c=>{if(Y.value)return;const i=c.key;(c.ctrlKey||c.metaKey)&&i==="Enter"&&ve()},Z=c=>{const i=`![${n.value.locale.uploading} ${c.name}]()`;return G(i),Y.value=!0,Promise.resolve().then(()=>n.value.imageUploader(c)).then(h=>{v.value=v.value.replace(i,`\r
|
|
11
|
-
`)}).catch(h=>{alert(h.message),v.value=v.value.replace(i,"")}).then(()=>{Y.value=!1})},X=c=>{var i;if((i=c.dataTransfer)!=null&&i.items){const h=ct(c.dataTransfer.items);h&&j.value&&(Z(h),c.preventDefault())}},se=c=>{if(c.clipboardData){const i=ct(c.clipboardData.items);i&&j.value&&Z(i)}},xe=()=>{const c=I.value;c.files&&j.value&&Z(c.files[0]).then(()=>{c.value=""})},ve=async()=>{var c,i,h,V,f,P;const{serverURL:N,lang:ee,login:de,wordLimit:Re,requiredMeta:je,recaptchaV3Key:ze,turnstileKey:_e}=n.value,ht=await Zl(),T={comment:me.value,nick:E.value.nick,mail:E.value.mail,link:E.value.link,url:n.value.path,ua:ht};if(!t.edit)if((c=y.value)!=null&&c.token)T.nick=y.value.display_name,T.mail=y.value.email,T.link=y.value.url;else{if(de==="force")return;if(je.includes("nick")&&!T.nick)return(i=z.value.nick)==null||i.focus(),alert(u.value.nickError);if(je.includes("mail")&&!T.mail||T.mail&&!Ul(T.mail))return(h=z.value.mail)==null||h.focus(),alert(u.value.mailError);T.nick||(T.nick=u.value.anonymous)}if(!T.comment){(V=b.value)==null||V.focus();return}if(!le.value)return alert(u.value.wordHint.replace("$0",Re[0].toString()).replace("$1",Re[1].toString()).replace("$2",_.value.toString()));T.comment=ut(T.comment,g.value.map),t.replyId&&t.rootId&&(T.pid=t.replyId,T.rid=t.rootId,T.at=t.replyUser),Y.value=!0;try{ze&&(T.recaptchaV3=await Jt(ze).execute("social")),_e&&(T.turnstile=await Yt(_e).execute("social"));const pe={serverURL:N,lang:ee,token:(f=y.value)==null?void 0:f.token,comment:T},ye=await(t.edit?fe({objectId:t.edit.objectId,...pe}):Mt(pe));if(Y.value=!1,ye.errmsg)return alert(ye.errmsg);l("submit",ye.data),v.value="",L.value="",await He(),t.replyId&&l("cancelReply"),(P=t.edit)!=null&&P.objectId&&l("cancelEdit")}catch(pe){Y.value=!1,alert(pe.message)}},dt=c=>{c.preventDefault();const{lang:i,serverURL:h}=n.value;St({serverURL:h,lang:i}).then(V=>{y.value=V,(V.remember?localStorage:sessionStorage).setItem("WALINE_USER",JSON.stringify(V)),l("log")})},pt=()=>{y.value={},localStorage.setItem("WALINE_USER","null"),sessionStorage.setItem("WALINE_USER","null"),l("log")},Ae=c=>{c.preventDefault();const{lang:i,serverURL:h}=n.value,V=800,f=800,P=(window.innerWidth-V)/2,N=(window.innerHeight-f)/2,ee=new URLSearchParams({lng:i,token:y.value.token}),de=window.open(`${h}/ui/profile?${ee.toString()}`,"_blank",`width=${V},height=${f},left=${P},top=${N},scrollbars=no,resizable=no,status=no,location=no,toolbar=no,menubar=no`);de==null||de.postMessage({type:"TOKEN",data:y.value.token},"*")},gt=c=>{var i,h,V,f;!((i=U.value)!=null&&i.contains(c.target))&&!((h=d.value)!=null&&h.contains(c.target))&&(p.value=!1),!((V=S.value)!=null&&V.contains(c.target))&&!((f=R.value)!=null&&f.contains(c.target))&&(F.value=!1)},Me=async c=>{var i;const{scrollTop:h,clientHeight:V,scrollHeight:f}=c.target,P=(V+h)/f,N=n.value.search,ee=((i=k.value)==null?void 0:i.value)??"";P<.9||H.loading||re.value||(H.loading=!0,(N.more&&H.list.length?await N.more(ee,H.list.length):await N.search(ee)).length?H.list=[...H.list,...N.more&&H.list.length?await N.more(ee,H.list.length):await N.search(ee)]:re.value=!0,H.loading=!1,setTimeout(()=>{c.target.scrollTop=h},50))},Se=Et(c=>{H.list=[],re.value=!1,Me(c)},300);return ae([n,_],([c,i])=>{const{wordLimit:h}=c;h?i<h[0]&&h[0]!==0?(te.value=h[0],le.value=!1):i>h[1]?(te.value=h[1],le.value=!1):(te.value=h[1],le.value=!0):(te.value=0,le.value=!0)},{immediate:!0}),Fe("click",gt),Fe("message",({data:c})=>{!c||c.type!=="profile"||(y.value={...y.value,...c.data},[localStorage,sessionStorage].filter(i=>i.getItem("WALINE_USER")).forEach(i=>i.setItem("WALINE_USER",JSON.stringify(y))))}),ae(F,async c=>{var i;if(!c)return;const h=n.value.search;k.value&&(k.value.value=""),H.loading=!0,H.list=await(((i=h.default)==null?void 0:i.call(h))??h.search("")),H.loading=!1}),ge(()=>{var c;(c=t.edit)!=null&&c.objectId&&(v.value=t.edit.orig),ae(()=>v.value,i=>{const{highlighter:h,texRenderer:V}=n.value;me.value=i,L.value=Ol(i,{emojiMap:g.value.map,highlighter:h,texRenderer:V}),_.value=Kl(i),i?We(b.value):We.destroy(b.value)},{immediate:!0}),ae(()=>n.value.emoji,i=>Fl(i).then(h=>{g.value=h}),{immediate:!0})}),(c,i)=>{var h,V;return r(),s("div",{key:w(y).token,class:"wl-comment"},[w(n).login!=="disable"&&x.value&&!((h=c.edit)!=null&&h.objectId)?(r(),s("div",Xl,[m("div",Jl,[m("button",{type:"submit",class:"wl-logout-btn",title:u.value.logout,onClick:pt},[O(w(Be),{size:14})],8,Yl),m("a",{href:"#",class:"wl-login-nick","aria-label":"Profile",title:u.value.profile,onClick:Ae},[m("img",{src:w(y).avatar,alt:"avatar"},null,8,ea)],8,Ql)]),m("a",{href:"#",class:"wl-login-nick","aria-label":"Profile",title:u.value.profile,onClick:Ae,textContent:A(w(y).display_name)},null,8,ta)])):$("v-if",!0),m("div",la,[w(n).login!=="force"&&w(n).meta.length&&!x.value?(r(),s("div",{key:0,class:D(["wl-header",`item${w(n).meta.length}`])},[(r(!0),s(B,null,J(w(n).meta,f=>(r(),s("div",{key:f,class:"wl-header-item"},[m("label",{for:`wl-${f}`,textContent:A(u.value[f]+(w(n).requiredMeta.includes(f)||!w(n).requiredMeta.length?"":`(${u.value.optional})`))},null,8,aa),he(m("input",{id:`wl-${f}`,ref_for:!0,ref:P=>{P&&(z.value[f]=P)},"onUpdate:modelValue":P=>w(E)[f]=P,class:D(["wl-input",`wl-${f}`]),name:f,type:f==="mail"?"email":"text"},null,10,na),[[wt,w(E)[f]]])]))),128))],2)):$("v-if",!0),he(m("textarea",{id:"wl-edit",ref_key:"editorRef",ref:b,"onUpdate:modelValue":i[0]||(i[0]=f=>kt(v)?v.value=f:null),class:"wl-editor",placeholder:c.replyUser?`@${c.replyUser}`:u.value.placeholder,onKeydown:K,onDrop:X,onPaste:se},null,40,ia),[[bt,w(v)]]),he(m("div",oa,[i[7]||(i[7]=m("hr",null,null,-1)),m("h4",null,A(u.value.preview)+":",1),m("div",{class:"wl-content",innerHTML:L.value},null,8,ra)],512),[[Te,q.value]]),m("div",sa,[m("div",ca,[m("a",ua,[O(w(Wt))]),he(m("button",{ref_key:"emojiButtonRef",ref:U,type:"button",class:D(["wl-action",{active:p.value}]),title:u.value.emoji,onClick:i[1]||(i[1]=f=>p.value=!p.value)},[O(w(Ht))],10,ma),[[Te,g.value.tabs.length]]),w(n).search?(r(),s("button",{key:0,ref_key:"gifButtonRef",ref:S,type:"button",class:D(["wl-action",{active:F.value}]),title:u.value.gif,onClick:i[2]||(i[2]=f=>F.value=!F.value)},[O(w(Ot))],10,va)):$("v-if",!0),m("input",{id:"wl-image-upload",ref_key:"imageUploadRef",ref:I,class:"upload","aria-hidden":"true",type:"file",accept:".png,.jpg,.jpeg,.webp,.bmp,.gif",onChange:xe},null,544),j.value?(r(),s("label",{key:1,for:"wl-image-upload",class:"wl-action",title:u.value.uploadImage,"aria-label":u.value.uploadImage},[O(w(Tt))],8,da)):$("v-if",!0),m("button",{type:"button",class:D(["wl-action",{active:q.value}]),title:u.value.preview,onClick:i[3]||(i[3]=f=>q.value=!q.value)},[O(w(Nt))],10,pa)]),m("div",ga,[i[9]||(i[9]=m("div",{class:"wl-captcha-container"},null,-1)),m("div",ha,[ie(A(_.value)+" ",1),w(n).wordLimit?(r(),s("span",fa,[i[8]||(i[8]=ie(" / ")),m("span",{class:D({illegal:!le.value}),textContent:A(te.value)},null,10,ya)])):$("v-if",!0),ie(" "+A(u.value.word),1)]),w(n).login!=="disable"&&!x.value?(r(),s("button",{key:0,type:"button",class:"wl-btn",onClick:dt,textContent:A(u.value.login)},null,8,wa)):$("v-if",!0),w(n).login!=="force"||x.value?(r(),s("button",{key:1,type:"submit",class:"primary wl-btn",title:"Cmd|Ctrl + Enter",disabled:Y.value,onClick:ve},[Y.value?(r(),ne(w(ue),{key:0,size:16})):(r(),s(B,{key:1},[ie(A(u.value.submit),1)],64))],8,ka)):$("v-if",!0)]),m("div",{ref_key:"gifPopupRef",ref:R,class:D(["wl-gif-popup",{display:F.value}])},[m("input",{ref_key:"gifSearchInputRef",ref:k,type:"text",placeholder:u.value.gifSearchPlaceholder,onInput:i[4]||(i[4]=(...f)=>w(Se)&&w(Se)(...f))},null,40,ba),H.list.length?(r(),ne(ml,{key:0,items:H.list,"column-width":200,gap:6,onInsert:i[5]||(i[5]=f=>G(f)),onScroll:Me},null,8,["items"])):$("v-if",!0),H.loading?(r(),s("div",Ca,[O(w(ue),{size:30})])):$("v-if",!0)],2),m("div",{ref_key:"emojiPopupRef",ref:d,class:D(["wl-emoji-popup",{display:p.value}])},[(r(!0),s(B,null,J(g.value.tabs,(f,P)=>(r(),s(B,{key:f.name},[P===o.value?(r(),s("div",$a,[(r(!0),s(B,null,J(f.items,N=>(r(),s("button",{key:N,type:"button",title:N,onClick:ee=>G(`:${N}:`)},[p.value?(r(),s("img",{key:0,class:"wl-emoji",src:g.value.map[N],alt:N,loading:"lazy",referrerPolicy:"no-referrer"},null,8,Ea)):$("v-if",!0)],8,Ia))),128))])):$("v-if",!0)],64))),128)),g.value.tabs.length>1?(r(),s("div",La,[(r(!0),s(B,null,J(g.value.tabs,(f,P)=>(r(),s("button",{key:f.name,type:"button",class:D(["wl-tab",{active:o.value===P}]),onClick:N=>o.value=P},[m("img",{class:"wl-emoji",src:f.icon,alt:f.name,title:f.name,loading:"lazy",referrerPolicy:"no-referrer"},null,8,Aa)],10,xa))),128))])):$("v-if",!0)],2)])]),c.replyId||(V=c.edit)!=null&&V.objectId?(r(),s("button",{key:1,type:"button",class:"wl-close",title:u.value.cancelReply,onClick:i[6]||(i[6]=f=>c.replyId?l("cancelReply"):l("cancelEdit"))},[O(w(Be),{size:24})],8,Ma)):$("v-if",!0)])}}});const Sa=["id"],Ra={class:"wl-user","aria-hidden":"true"},ja=["src"],za={class:"wl-card"},_a={class:"wl-head"},Va=["href"],Ua={key:1,class:"wl-nick"},Ha=["textContent"],Ta=["textContent"],Fa=["textContent"],Na=["textContent"],Wa=["textContent"],Ba={class:"wl-comment-actions"},Pa=["title"],Da=["title"],Oa={class:"wl-meta","aria-hidden":"true"},qa=["data-value","textContent"],Ga={key:0,class:"wl-content"},Ka={key:0},Za=["href"],Xa=["innerHTML"],Ja={key:1,class:"wl-admin-actions"},Ya={class:"wl-comment-status"},Qa=["disabled","onClick","textContent"],en={key:3,class:"wl-quote"};var tn=ce({__name:"CommentCard",props:{comment:{},edit:{default:null},rootId:{},reply:{default:null}},emits:["log","submit","delete","edit","like","status","sticky","reply"],setup(e,{emit:a}){const t=e,l=a,n=["approved","waiting","spam"],v=we("config"),E=De(),y=Lt(),z=ke(),b=W(()=>v.value.locale),I=W(()=>{const{link:o}=t.comment;return o?Ze(o)?o:`https://${o}`:""}),U=W(()=>E.value.includes(t.comment.objectId)),d=W(()=>_l(new Date(t.comment.time),y.value,b.value)),S=W(()=>z.value.type==="administrator"),R=W(()=>t.comment.user_id&&z.value.objectId===t.comment.user_id),k=W(()=>{var o;return t.comment.objectId===((o=t.reply)==null?void 0:o.objectId)}),g=W(()=>{var o;return t.comment.objectId===((o=t.edit)==null?void 0:o.objectId)});return(o,p)=>{var F;const q=Ct("CommentCard",!0);return r(),s("div",{id:o.comment.objectId,class:"wl-card-item"},[m("div",Ra,[o.comment.avatar?(r(),s("img",{key:0,class:"wl-user-avatar",src:o.comment.avatar,alt:""},null,8,ja)):$("v-if",!0),o.comment.type?(r(),ne(w(Dt),{key:1})):$("v-if",!0)]),m("div",za,[m("div",_a,[I.value?(r(),s("a",{key:0,class:"wl-nick",href:I.value,target:"_blank",rel:"nofollow noopener noreferrer"},A(o.comment.nick),9,Va)):(r(),s("span",Ua,A(o.comment.nick),1)),o.comment.type==="administrator"?(r(),s("span",{key:2,class:"wl-badge",textContent:A(b.value.admin)},null,8,Ha)):$("v-if",!0),o.comment.label?(r(),s("span",{key:3,class:"wl-badge",textContent:A(o.comment.label)},null,8,Ta)):$("v-if",!0),o.comment.sticky?(r(),s("span",{key:4,class:"wl-badge",textContent:A(b.value.sticky)},null,8,Fa)):$("v-if",!0),typeof o.comment.level=="number"?(r(),s("span",{key:5,class:D(`wl-badge level${o.comment.level}`),textContent:A(b.value[`level${o.comment.level}`]||`Level ${o.comment.level}`)},null,10,Na)):$("v-if",!0),m("span",{class:"wl-time",textContent:A(d.value)},null,8,Wa),m("div",Ba,[S.value||R.value?(r(),s(B,{key:0},[m("button",{type:"button",class:"wl-edit",onClick:p[0]||(p[0]=L=>l("edit",o.comment))},[O(w(Pt))]),m("button",{type:"button",class:"wl-delete",onClick:p[1]||(p[1]=L=>l("delete",o.comment))},[O(w(Ut))])],64)):$("v-if",!0),m("button",{type:"button",class:"wl-like",title:U.value?b.value.cancelLike:b.value.like,onClick:p[2]||(p[2]=L=>l("like",o.comment))},[O(w(Ft),{active:U.value},null,8,["active"]),ie(" "+A("like"in o.comment?o.comment.like:""),1)],8,Pa),m("button",{type:"button",class:D(["wl-reply",{active:k.value}]),title:k.value?b.value.cancelReply:b.value.reply,onClick:p[3]||(p[3]=L=>l("reply",k.value?null:o.comment))},[O(w(Bt))],10,Da)])]),m("div",Oa,[(r(),s(B,null,J(["addr","browser","os"],L=>(r(),s(B,null,[o.comment[L]?(r(),s("span",{key:L,class:D(`wl-${L}`),"data-value":o.comment[L],textContent:A(o.comment[L])},null,10,qa)):$("v-if",!0)],64))),64))]),g.value?$("v-if",!0):(r(),s("div",Ga,[o.comment.reply_user?(r(),s("p",Ka,[m("a",{href:"#"+o.comment.pid},"@"+A(o.comment.reply_user.nick),9,Za),p[17]||(p[17]=m("span",null,": ",-1))])):$("v-if",!0),m("div",{innerHTML:o.comment.comment},null,8,Xa)])),S.value&&!g.value?(r(),s("div",Ja,[m("span",Ya,[(r(),s(B,null,J(n,L=>m("button",{key:L,type:"submit",class:D(`wl-btn wl-${L}`),disabled:o.comment.status===L,onClick:_=>l("status",{status:L,comment:o.comment}),textContent:A(b.value[L])},null,10,Qa)),64))]),S.value&&!("rid"in o.comment)?(r(),s("button",{key:0,type:"submit",class:"wl-btn wl-sticky",onClick:p[4]||(p[4]=L=>l("sticky",o.comment))},A(o.comment.sticky?b.value.unsticky:b.value.sticky),1)):$("v-if",!0)])):$("v-if",!0),k.value||g.value?(r(),s("div",{key:2,class:D({"wl-reply-wrapper":k.value,"wl-edit-wrapper":g.value})},[O(mt,{edit:o.edit,"reply-id":(F=o.reply)==null?void 0:F.objectId,"reply-user":o.comment.nick,"root-id":o.rootId,onLog:p[5]||(p[5]=L=>l("log")),onCancelReply:p[6]||(p[6]=L=>l("reply",null)),onCancelEdit:p[7]||(p[7]=L=>l("edit",null)),onSubmit:p[8]||(p[8]=L=>l("submit",L))},null,8,["edit","reply-id","reply-user","root-id"])],2)):$("v-if",!0),"children"in o.comment?(r(),s("div",en,[(r(!0),s(B,null,J(o.comment.children,L=>(r(),ne(q,{key:L.objectId,comment:L,reply:o.reply,edit:o.edit,"root-id":o.rootId,onLog:p[9]||(p[9]=_=>l("log")),onDelete:p[10]||(p[10]=_=>l("delete",_)),onEdit:p[11]||(p[11]=_=>l("edit",_)),onLike:p[12]||(p[12]=_=>l("like",_)),onReply:p[13]||(p[13]=_=>l("reply",_)),onStatus:p[14]||(p[14]=_=>l("status",_)),onSticky:p[15]||(p[15]=_=>l("sticky",_)),onSubmit:p[16]||(p[16]=_=>l("submit",_))},null,8,["comment","reply","edit","root-id"]))),128))])):$("v-if",!0)])],8,Sa)}}});const vt="3.4.0",ln={"data-waline":""},an={class:"wl-meta-head"},nn={class:"wl-count"},on=["textContent"],rn={class:"wl-sort"},sn=["onClick"],cn={class:"wl-cards"},un={key:1,class:"wl-operation"},mn=["textContent"],vn={key:2,class:"wl-loading"},dn=["textContent"],pn={key:4,class:"wl-operation"},gn=["textContent"],hn={key:5,class:"wl-power"};var fn=ce({__name:"WalineComment",props:["serverURL","path","meta","requiredMeta","dark","commentSorting","lang","locale","pageSize","wordLimit","emoji","login","highlighter","texRenderer","imageUploader","search","copyright","recaptchaV3Key","turnstileKey","reaction"],setup(e){const a=e,t={latest:"insertedAt_desc",oldest:"insertedAt_asc",hottest:"like_desc"},l=Object.keys(t),n=ke(),v=De(),E=C("loading"),y=C(0),z=C(1),b=C(0),I=W(()=>Rl(a)),U=C(I.value.commentSorting),d=C([]),S=C(null),R=C(null),k=W(()=>jl(I.value.dark)),g=W(()=>I.value.locale);xt(k,{id:"waline-darkmode"});let o;const p=u=>{var x;const{serverURL:j,path:G,pageSize:K}=I.value,Z=new AbortController;E.value="loading",o==null||o(),jt({serverURL:j,lang:I.value.lang,path:G,pageSize:K,sortBy:t[U.value],page:u,signal:Z.signal,token:(x=n.value)==null?void 0:x.token}).then(X=>{E.value="success",y.value=X.count,d.value.push(...X.data),z.value=u,b.value=X.totalPages}).catch(X=>{X.name!=="AbortError"&&(console.error(X.message),E.value="error")}),o=Z.abort.bind(Z)},F=()=>p(z.value+1),q=()=>{y.value=0,d.value=[],p(1)},L=u=>{U.value!==u&&(U.value=u,q())},_=u=>{S.value=u},H=u=>{R.value=u},te=u=>{if(R.value)R.value.comment=u.comment,R.value.orig=u.orig;else if("rid"in u){const x=d.value.find(({objectId:j})=>j===u.rid);if(!x)return;Array.isArray(x.children)||(x.children=[]),x.children.push(u)}else d.value.unshift(u),y.value+=1},le=async({comment:u,status:x})=>{var j;if(u.status===x)return;const{serverURL:G,lang:K}=I.value;await fe({serverURL:G,lang:K,token:(j=n.value)==null?void 0:j.token,objectId:u.objectId,comment:{status:x}}),u.status=x},me=async u=>{var x;if("rid"in u)return;const{serverURL:j,lang:G}=I.value;await fe({serverURL:j,lang:G,token:(x=n.value)==null?void 0:x.token,objectId:u.objectId,comment:{sticky:u.sticky?0:1}}),u.sticky=!u.sticky},Y=async({objectId:u})=>{var x;if(!confirm("Are you sure you want to delete this comment?"))return;const{serverURL:j,lang:G}=I.value;await Rt({serverURL:j,lang:G,token:(x=n.value)==null?void 0:x.token,objectId:u}),d.value.some((K,Z)=>K.objectId===u?(d.value=d.value.filter((X,se)=>se!==Z),!0):K.children.some((X,se)=>X.objectId===u?(d.value[Z].children=K.children.filter((xe,ve)=>ve!==se),!0):!1))},re=async u=>{var x;const{serverURL:j,lang:G}=I.value,{objectId:K}=u,Z=v.value.includes(K);await fe({serverURL:j,lang:G,objectId:K,token:(x=n.value)==null?void 0:x.token,comment:{like:!Z}}),Z?v.value=v.value.filter(X=>X!==K):(v.value=[...v.value,K],v.value.length>50&&(v.value=v.value.slice(-50))),u.like=(u.like||0)+(Z?-1:1)};return $t("config",I),ge(()=>{ae(()=>[a.serverURL,a.path],()=>q(),{immediate:!0})}),Ve(()=>o==null?void 0:o()),(u,x)=>(r(),s("div",ln,[O(sl),!S.value&&!R.value?(r(),ne(mt,{key:0,onLog:q,onSubmit:te})):$("v-if",!0),m("div",an,[m("div",nn,[y.value?(r(),s("span",{key:0,class:"wl-num",textContent:A(y.value)},null,8,on)):$("v-if",!0),ie(" "+A(g.value.comment),1)]),m("ul",rn,[(r(!0),s(B,null,J(w(l),j=>(r(),s("li",{key:j,class:D([j===U.value?"active":""]),onClick:G=>L(j)},A(g.value[j]),11,sn))),128))])]),m("div",cn,[(r(!0),s(B,null,J(d.value,j=>(r(),ne(tn,{key:j.objectId,"root-id":j.objectId,comment:j,reply:S.value,edit:R.value,onLog:q,onReply:_,onEdit:H,onSubmit:te,onStatus:le,onDelete:Y,onSticky:me,onLike:re},null,8,["root-id","comment","reply","edit"]))),128))]),E.value==="error"?(r(),s("div",un,[m("button",{type:"button",class:"wl-btn",onClick:q,textContent:A(g.value.refresh)},null,8,mn)])):E.value==="loading"?(r(),s("div",vn,[O(w(ue),{size:30})])):d.value.length?z.value<b.value?(r(),s("div",pn,[m("button",{type:"button",class:"wl-btn",onClick:F,textContent:A(g.value.more)},null,8,gn)])):$("v-if",!0):(r(),s("div",{key:3,class:"wl-empty",textContent:A(g.value.sofa)},null,8,dn)),I.value.copyright?(r(),s("div",hn,[x[0]||(x[0]=ie(" Powered by ")),x[1]||(x[1]=m("a",{href:"https://github.com/walinejs/waline",target:"_blank",rel:"noopener noreferrer"}," Waline ",-1)),ie(" v"+A(w(vt)),1)])):$("v-if",!0)]))}});export{fn as Waline,vt as version};
|
|
11
|
+
`)}).catch(h=>{alert(h.message),v.value=v.value.replace(i,"")}).then(()=>{Y.value=!1})},X=c=>{var i;if((i=c.dataTransfer)!=null&&i.items){const h=ct(c.dataTransfer.items);h&&j.value&&(Z(h),c.preventDefault())}},se=c=>{if(c.clipboardData){const i=ct(c.clipboardData.items);i&&j.value&&Z(i)}},xe=()=>{const c=I.value;c.files&&j.value&&Z(c.files[0]).then(()=>{c.value=""})},ve=async()=>{var c,i,h,V,f,P;const{serverURL:N,lang:ee,login:de,wordLimit:Re,requiredMeta:je,recaptchaV3Key:ze,turnstileKey:_e}=n.value,ht=await Zl(),T={comment:me.value,nick:E.value.nick,mail:E.value.mail,link:E.value.link,url:n.value.path,ua:ht};if(!t.edit)if((c=y.value)!=null&&c.token)T.nick=y.value.display_name,T.mail=y.value.email,T.link=y.value.url;else{if(de==="force")return;if(je.includes("nick")&&!T.nick)return(i=z.value.nick)==null||i.focus(),alert(u.value.nickError);if(je.includes("mail")&&!T.mail||T.mail&&!Ul(T.mail))return(h=z.value.mail)==null||h.focus(),alert(u.value.mailError);T.nick||(T.nick=u.value.anonymous)}if(!T.comment){(V=b.value)==null||V.focus();return}if(!le.value)return alert(u.value.wordHint.replace("$0",Re[0].toString()).replace("$1",Re[1].toString()).replace("$2",_.value.toString()));T.comment=ut(T.comment,g.value.map),t.replyId&&t.rootId&&(T.pid=t.replyId,T.rid=t.rootId,T.at=t.replyUser),Y.value=!0;try{ze&&(T.recaptchaV3=await Jt(ze).execute("social")),_e&&(T.turnstile=await Yt(_e).execute("social"));const pe={serverURL:N,lang:ee,token:(f=y.value)==null?void 0:f.token,comment:T},ye=await(t.edit?fe({objectId:t.edit.objectId,...pe}):Mt(pe));if(Y.value=!1,ye.errmsg)return alert(ye.errmsg);l("submit",ye.data),v.value="",L.value="",await He(),t.replyId&&l("cancelReply"),(P=t.edit)!=null&&P.objectId&&l("cancelEdit")}catch(pe){Y.value=!1,alert(pe.message)}},dt=c=>{c.preventDefault();const{lang:i,serverURL:h}=n.value;St({serverURL:h,lang:i}).then(V=>{y.value=V,(V.remember?localStorage:sessionStorage).setItem("WALINE_USER",JSON.stringify(V)),l("log")})},pt=()=>{y.value={},localStorage.setItem("WALINE_USER","null"),sessionStorage.setItem("WALINE_USER","null"),l("log")},Ae=c=>{c.preventDefault();const{lang:i,serverURL:h}=n.value,V=800,f=800,P=(window.innerWidth-V)/2,N=(window.innerHeight-f)/2,ee=new URLSearchParams({lng:i,token:y.value.token}),de=window.open(`${h}/ui/profile?${ee.toString()}`,"_blank",`width=${V},height=${f},left=${P},top=${N},scrollbars=no,resizable=no,status=no,location=no,toolbar=no,menubar=no`);de==null||de.postMessage({type:"TOKEN",data:y.value.token},"*")},gt=c=>{var i,h,V,f;!((i=U.value)!=null&&i.contains(c.target))&&!((h=d.value)!=null&&h.contains(c.target))&&(p.value=!1),!((V=S.value)!=null&&V.contains(c.target))&&!((f=R.value)!=null&&f.contains(c.target))&&(F.value=!1)},Me=async c=>{var i;const{scrollTop:h,clientHeight:V,scrollHeight:f}=c.target,P=(V+h)/f,N=n.value.search,ee=((i=k.value)==null?void 0:i.value)??"";P<.9||H.loading||re.value||(H.loading=!0,(N.more&&H.list.length?await N.more(ee,H.list.length):await N.search(ee)).length?H.list=[...H.list,...N.more&&H.list.length?await N.more(ee,H.list.length):await N.search(ee)]:re.value=!0,H.loading=!1,setTimeout(()=>{c.target.scrollTop=h},50))},Se=Et(c=>{H.list=[],re.value=!1,Me(c)},300);return ae([n,_],([c,i])=>{const{wordLimit:h}=c;h?i<h[0]&&h[0]!==0?(te.value=h[0],le.value=!1):i>h[1]?(te.value=h[1],le.value=!1):(te.value=h[1],le.value=!0):(te.value=0,le.value=!0)},{immediate:!0}),Fe("click",gt),Fe("message",({data:c})=>{!c||c.type!=="profile"||(y.value={...y.value,...c.data},[localStorage,sessionStorage].filter(i=>i.getItem("WALINE_USER")).forEach(i=>i.setItem("WALINE_USER",JSON.stringify(y))))}),ae(F,async c=>{var i;if(!c)return;const h=n.value.search;k.value&&(k.value.value=""),H.loading=!0,H.list=await(((i=h.default)==null?void 0:i.call(h))??h.search("")),H.loading=!1}),ge(()=>{var c;(c=t.edit)!=null&&c.objectId&&(v.value=t.edit.orig),ae(()=>v.value,i=>{const{highlighter:h,texRenderer:V}=n.value;me.value=i,L.value=Ol(i,{emojiMap:g.value.map,highlighter:h,texRenderer:V}),_.value=Kl(i),i?We(b.value):We.destroy(b.value)},{immediate:!0}),ae(()=>n.value.emoji,i=>Fl(i).then(h=>{g.value=h}),{immediate:!0})}),(c,i)=>{var h,V;return r(),s("div",{key:w(y).token,class:"wl-comment"},[w(n).login!=="disable"&&x.value&&!((h=c.edit)!=null&&h.objectId)?(r(),s("div",Xl,[m("div",Jl,[m("button",{type:"submit",class:"wl-logout-btn",title:u.value.logout,onClick:pt},[O(w(Be),{size:14})],8,Yl),m("a",{href:"#",class:"wl-login-nick","aria-label":"Profile",title:u.value.profile,onClick:Ae},[m("img",{src:w(y).avatar,alt:"avatar"},null,8,ea)],8,Ql)]),m("a",{href:"#",class:"wl-login-nick","aria-label":"Profile",title:u.value.profile,onClick:Ae,textContent:A(w(y).display_name)},null,8,ta)])):$("v-if",!0),m("div",la,[w(n).login!=="force"&&w(n).meta.length&&!x.value?(r(),s("div",{key:0,class:D(["wl-header",`item${w(n).meta.length}`])},[(r(!0),s(B,null,J(w(n).meta,f=>(r(),s("div",{key:f,class:"wl-header-item"},[m("label",{for:`wl-${f}`,textContent:A(u.value[f]+(w(n).requiredMeta.includes(f)||!w(n).requiredMeta.length?"":`(${u.value.optional})`))},null,8,aa),he(m("input",{id:`wl-${f}`,ref_for:!0,ref:P=>{P&&(z.value[f]=P)},"onUpdate:modelValue":P=>w(E)[f]=P,class:D(["wl-input",`wl-${f}`]),name:f,type:f==="mail"?"email":"text"},null,10,na),[[wt,w(E)[f]]])]))),128))],2)):$("v-if",!0),he(m("textarea",{id:"wl-edit",ref_key:"editorRef",ref:b,"onUpdate:modelValue":i[0]||(i[0]=f=>kt(v)?v.value=f:null),class:"wl-editor",placeholder:c.replyUser?`@${c.replyUser}`:u.value.placeholder,onKeydown:K,onDrop:X,onPaste:se},null,40,ia),[[bt,w(v)]]),he(m("div",oa,[i[7]||(i[7]=m("hr",null,null,-1)),m("h4",null,A(u.value.preview)+":",1),m("div",{class:"wl-content",innerHTML:L.value},null,8,ra)],512),[[Te,q.value]]),m("div",sa,[m("div",ca,[m("a",ua,[O(w(Wt))]),he(m("button",{ref_key:"emojiButtonRef",ref:U,type:"button",class:D(["wl-action",{active:p.value}]),title:u.value.emoji,onClick:i[1]||(i[1]=f=>p.value=!p.value)},[O(w(Ht))],10,ma),[[Te,g.value.tabs.length]]),w(n).search?(r(),s("button",{key:0,ref_key:"gifButtonRef",ref:S,type:"button",class:D(["wl-action",{active:F.value}]),title:u.value.gif,onClick:i[2]||(i[2]=f=>F.value=!F.value)},[O(w(Ot))],10,va)):$("v-if",!0),m("input",{id:"wl-image-upload",ref_key:"imageUploadRef",ref:I,class:"upload","aria-hidden":"true",type:"file",accept:".png,.jpg,.jpeg,.webp,.bmp,.gif",onChange:xe},null,544),j.value?(r(),s("label",{key:1,for:"wl-image-upload",class:"wl-action",title:u.value.uploadImage,"aria-label":u.value.uploadImage},[O(w(Tt))],8,da)):$("v-if",!0),m("button",{type:"button",class:D(["wl-action",{active:q.value}]),title:u.value.preview,onClick:i[3]||(i[3]=f=>q.value=!q.value)},[O(w(Nt))],10,pa)]),m("div",ga,[i[9]||(i[9]=m("div",{class:"wl-captcha-container"},null,-1)),m("div",ha,[ie(A(_.value)+" ",1),w(n).wordLimit?(r(),s("span",fa,[i[8]||(i[8]=ie(" / ")),m("span",{class:D({illegal:!le.value}),textContent:A(te.value)},null,10,ya)])):$("v-if",!0),ie(" "+A(u.value.word),1)]),w(n).login!=="disable"&&!x.value?(r(),s("button",{key:0,type:"button",class:"wl-btn",onClick:dt,textContent:A(u.value.login)},null,8,wa)):$("v-if",!0),w(n).login!=="force"||x.value?(r(),s("button",{key:1,type:"submit",class:"primary wl-btn",title:"Cmd|Ctrl + Enter",disabled:Y.value,onClick:ve},[Y.value?(r(),ne(w(ue),{key:0,size:16})):(r(),s(B,{key:1},[ie(A(u.value.submit),1)],64))],8,ka)):$("v-if",!0)]),m("div",{ref_key:"gifPopupRef",ref:R,class:D(["wl-gif-popup",{display:F.value}])},[m("input",{ref_key:"gifSearchInputRef",ref:k,type:"text",placeholder:u.value.gifSearchPlaceholder,onInput:i[4]||(i[4]=(...f)=>w(Se)&&w(Se)(...f))},null,40,ba),H.list.length?(r(),ne(ml,{key:0,items:H.list,"column-width":200,gap:6,onInsert:i[5]||(i[5]=f=>G(f)),onScroll:Me},null,8,["items"])):$("v-if",!0),H.loading?(r(),s("div",Ca,[O(w(ue),{size:30})])):$("v-if",!0)],2),m("div",{ref_key:"emojiPopupRef",ref:d,class:D(["wl-emoji-popup",{display:p.value}])},[(r(!0),s(B,null,J(g.value.tabs,(f,P)=>(r(),s(B,{key:f.name},[P===o.value?(r(),s("div",$a,[(r(!0),s(B,null,J(f.items,N=>(r(),s("button",{key:N,type:"button",title:N,onClick:ee=>G(`:${N}:`)},[p.value?(r(),s("img",{key:0,class:"wl-emoji",src:g.value.map[N],alt:N,loading:"lazy",referrerPolicy:"no-referrer"},null,8,Ea)):$("v-if",!0)],8,Ia))),128))])):$("v-if",!0)],64))),128)),g.value.tabs.length>1?(r(),s("div",La,[(r(!0),s(B,null,J(g.value.tabs,(f,P)=>(r(),s("button",{key:f.name,type:"button",class:D(["wl-tab",{active:o.value===P}]),onClick:N=>o.value=P},[m("img",{class:"wl-emoji",src:f.icon,alt:f.name,title:f.name,loading:"lazy",referrerPolicy:"no-referrer"},null,8,Aa)],10,xa))),128))])):$("v-if",!0)],2)])]),c.replyId||(V=c.edit)!=null&&V.objectId?(r(),s("button",{key:1,type:"button",class:"wl-close",title:u.value.cancelReply,onClick:i[6]||(i[6]=f=>c.replyId?l("cancelReply"):l("cancelEdit"))},[O(w(Be),{size:24})],8,Ma)):$("v-if",!0)])}}});const Sa=["id"],Ra={class:"wl-user","aria-hidden":"true"},ja=["src"],za={class:"wl-card"},_a={class:"wl-head"},Va=["href"],Ua={key:1,class:"wl-nick"},Ha=["textContent"],Ta=["textContent"],Fa=["textContent"],Na=["textContent"],Wa=["textContent"],Ba={class:"wl-comment-actions"},Pa=["title"],Da=["title"],Oa={class:"wl-meta","aria-hidden":"true"},qa=["data-value","textContent"],Ga={key:0,class:"wl-content"},Ka={key:0},Za=["href"],Xa=["innerHTML"],Ja={key:1,class:"wl-admin-actions"},Ya={class:"wl-comment-status"},Qa=["disabled","onClick","textContent"],en={key:3,class:"wl-quote"};var tn=ce({__name:"CommentCard",props:{comment:{},edit:{default:null},rootId:{},reply:{default:null}},emits:["log","submit","delete","edit","like","status","sticky","reply"],setup(e,{emit:a}){const t=e,l=a,n=["approved","waiting","spam"],v=we("config"),E=De(),y=Lt(),z=ke(),b=W(()=>v.value.locale),I=W(()=>{const{link:o}=t.comment;return o?Ze(o)?o:`https://${o}`:""}),U=W(()=>E.value.includes(t.comment.objectId)),d=W(()=>_l(new Date(t.comment.time),y.value,b.value)),S=W(()=>z.value.type==="administrator"),R=W(()=>t.comment.user_id&&z.value.objectId===t.comment.user_id),k=W(()=>{var o;return t.comment.objectId===((o=t.reply)==null?void 0:o.objectId)}),g=W(()=>{var o;return t.comment.objectId===((o=t.edit)==null?void 0:o.objectId)});return(o,p)=>{var F;const q=Ct("CommentCard",!0);return r(),s("div",{id:o.comment.objectId,class:"wl-card-item"},[m("div",Ra,[o.comment.avatar?(r(),s("img",{key:0,class:"wl-user-avatar",src:o.comment.avatar,alt:""},null,8,ja)):$("v-if",!0),o.comment.type?(r(),ne(w(Dt),{key:1})):$("v-if",!0)]),m("div",za,[m("div",_a,[I.value?(r(),s("a",{key:0,class:"wl-nick",href:I.value,target:"_blank",rel:"nofollow noopener noreferrer"},A(o.comment.nick),9,Va)):(r(),s("span",Ua,A(o.comment.nick),1)),o.comment.type==="administrator"?(r(),s("span",{key:2,class:"wl-badge",textContent:A(b.value.admin)},null,8,Ha)):$("v-if",!0),o.comment.label?(r(),s("span",{key:3,class:"wl-badge",textContent:A(o.comment.label)},null,8,Ta)):$("v-if",!0),o.comment.sticky?(r(),s("span",{key:4,class:"wl-badge",textContent:A(b.value.sticky)},null,8,Fa)):$("v-if",!0),typeof o.comment.level=="number"?(r(),s("span",{key:5,class:D(`wl-badge level${o.comment.level}`),textContent:A(b.value[`level${o.comment.level}`]||`Level ${o.comment.level}`)},null,10,Na)):$("v-if",!0),m("span",{class:"wl-time",textContent:A(d.value)},null,8,Wa),m("div",Ba,[S.value||R.value?(r(),s(B,{key:0},[m("button",{type:"button",class:"wl-edit",onClick:p[0]||(p[0]=L=>l("edit",o.comment))},[O(w(Pt))]),m("button",{type:"button",class:"wl-delete",onClick:p[1]||(p[1]=L=>l("delete",o.comment))},[O(w(Ut))])],64)):$("v-if",!0),m("button",{type:"button",class:"wl-like",title:U.value?b.value.cancelLike:b.value.like,onClick:p[2]||(p[2]=L=>l("like",o.comment))},[O(w(Ft),{active:U.value},null,8,["active"]),ie(" "+A("like"in o.comment?o.comment.like:""),1)],8,Pa),m("button",{type:"button",class:D(["wl-reply",{active:k.value}]),title:k.value?b.value.cancelReply:b.value.reply,onClick:p[3]||(p[3]=L=>l("reply",k.value?null:o.comment))},[O(w(Bt))],10,Da)])]),m("div",Oa,[(r(),s(B,null,J(["addr","browser","os"],L=>(r(),s(B,null,[o.comment[L]?(r(),s("span",{key:L,class:D(`wl-${L}`),"data-value":o.comment[L],textContent:A(o.comment[L])},null,10,qa)):$("v-if",!0)],64))),64))]),g.value?$("v-if",!0):(r(),s("div",Ga,[o.comment.reply_user?(r(),s("p",Ka,[m("a",{href:"#"+o.comment.pid},"@"+A(o.comment.reply_user.nick),9,Za),p[17]||(p[17]=m("span",null,": ",-1))])):$("v-if",!0),m("div",{innerHTML:o.comment.comment},null,8,Xa)])),S.value&&!g.value?(r(),s("div",Ja,[m("span",Ya,[(r(),s(B,null,J(n,L=>m("button",{key:L,type:"submit",class:D(`wl-btn wl-${L}`),disabled:o.comment.status===L,onClick:_=>l("status",{status:L,comment:o.comment}),textContent:A(b.value[L])},null,10,Qa)),64))]),S.value&&!("rid"in o.comment)?(r(),s("button",{key:0,type:"submit",class:"wl-btn wl-sticky",onClick:p[4]||(p[4]=L=>l("sticky",o.comment))},A(o.comment.sticky?b.value.unsticky:b.value.sticky),1)):$("v-if",!0)])):$("v-if",!0),k.value||g.value?(r(),s("div",{key:2,class:D({"wl-reply-wrapper":k.value,"wl-edit-wrapper":g.value})},[O(mt,{edit:o.edit,"reply-id":(F=o.reply)==null?void 0:F.objectId,"reply-user":o.comment.nick,"root-id":o.rootId,onLog:p[5]||(p[5]=L=>l("log")),onCancelReply:p[6]||(p[6]=L=>l("reply",null)),onCancelEdit:p[7]||(p[7]=L=>l("edit",null)),onSubmit:p[8]||(p[8]=L=>l("submit",L))},null,8,["edit","reply-id","reply-user","root-id"])],2)):$("v-if",!0),"children"in o.comment?(r(),s("div",en,[(r(!0),s(B,null,J(o.comment.children,L=>(r(),ne(q,{key:L.objectId,comment:L,reply:o.reply,edit:o.edit,"root-id":o.rootId,onLog:p[9]||(p[9]=_=>l("log")),onDelete:p[10]||(p[10]=_=>l("delete",_)),onEdit:p[11]||(p[11]=_=>l("edit",_)),onLike:p[12]||(p[12]=_=>l("like",_)),onReply:p[13]||(p[13]=_=>l("reply",_)),onStatus:p[14]||(p[14]=_=>l("status",_)),onSticky:p[15]||(p[15]=_=>l("sticky",_)),onSubmit:p[16]||(p[16]=_=>l("submit",_))},null,8,["comment","reply","edit","root-id"]))),128))])):$("v-if",!0)])],8,Sa)}}});const vt="3.4.1",ln={"data-waline":""},an={class:"wl-meta-head"},nn={class:"wl-count"},on=["textContent"],rn={class:"wl-sort"},sn=["onClick"],cn={class:"wl-cards"},un={key:1,class:"wl-operation"},mn=["textContent"],vn={key:2,class:"wl-loading"},dn=["textContent"],pn={key:4,class:"wl-operation"},gn=["textContent"],hn={key:5,class:"wl-power"};var fn=ce({__name:"WalineComment",props:["serverURL","path","meta","requiredMeta","dark","commentSorting","lang","locale","pageSize","wordLimit","emoji","login","highlighter","texRenderer","imageUploader","search","copyright","recaptchaV3Key","turnstileKey","reaction"],setup(e){const a=e,t={latest:"insertedAt_desc",oldest:"insertedAt_asc",hottest:"like_desc"},l=Object.keys(t),n=ke(),v=De(),E=C("loading"),y=C(0),z=C(1),b=C(0),I=W(()=>Rl(a)),U=C(I.value.commentSorting),d=C([]),S=C(null),R=C(null),k=W(()=>jl(I.value.dark)),g=W(()=>I.value.locale);xt(k,{id:"waline-darkmode"});let o;const p=u=>{var x;const{serverURL:j,path:G,pageSize:K}=I.value,Z=new AbortController;E.value="loading",o==null||o(),jt({serverURL:j,lang:I.value.lang,path:G,pageSize:K,sortBy:t[U.value],page:u,signal:Z.signal,token:(x=n.value)==null?void 0:x.token}).then(X=>{E.value="success",y.value=X.count,d.value.push(...X.data),z.value=u,b.value=X.totalPages}).catch(X=>{X.name!=="AbortError"&&(console.error(X.message),E.value="error")}),o=Z.abort.bind(Z)},F=()=>p(z.value+1),q=()=>{y.value=0,d.value=[],p(1)},L=u=>{U.value!==u&&(U.value=u,q())},_=u=>{S.value=u},H=u=>{R.value=u},te=u=>{if(R.value)R.value.comment=u.comment,R.value.orig=u.orig;else if("rid"in u){const x=d.value.find(({objectId:j})=>j===u.rid);if(!x)return;Array.isArray(x.children)||(x.children=[]),x.children.push(u)}else d.value.unshift(u),y.value+=1},le=async({comment:u,status:x})=>{var j;if(u.status===x)return;const{serverURL:G,lang:K}=I.value;await fe({serverURL:G,lang:K,token:(j=n.value)==null?void 0:j.token,objectId:u.objectId,comment:{status:x}}),u.status=x},me=async u=>{var x;if("rid"in u)return;const{serverURL:j,lang:G}=I.value;await fe({serverURL:j,lang:G,token:(x=n.value)==null?void 0:x.token,objectId:u.objectId,comment:{sticky:u.sticky?0:1}}),u.sticky=!u.sticky},Y=async({objectId:u})=>{var x;if(!confirm("Are you sure you want to delete this comment?"))return;const{serverURL:j,lang:G}=I.value;await Rt({serverURL:j,lang:G,token:(x=n.value)==null?void 0:x.token,objectId:u}),d.value.some((K,Z)=>K.objectId===u?(d.value=d.value.filter((X,se)=>se!==Z),!0):K.children.some((X,se)=>X.objectId===u?(d.value[Z].children=K.children.filter((xe,ve)=>ve!==se),!0):!1))},re=async u=>{var x;const{serverURL:j,lang:G}=I.value,{objectId:K}=u,Z=v.value.includes(K);await fe({serverURL:j,lang:G,objectId:K,token:(x=n.value)==null?void 0:x.token,comment:{like:!Z}}),Z?v.value=v.value.filter(X=>X!==K):(v.value=[...v.value,K],v.value.length>50&&(v.value=v.value.slice(-50))),u.like=(u.like||0)+(Z?-1:1)};return $t("config",I),ge(()=>{ae(()=>[a.serverURL,a.path],()=>q(),{immediate:!0})}),Ve(()=>o==null?void 0:o()),(u,x)=>(r(),s("div",ln,[O(sl),!S.value&&!R.value?(r(),ne(mt,{key:0,onLog:q,onSubmit:te})):$("v-if",!0),m("div",an,[m("div",nn,[y.value?(r(),s("span",{key:0,class:"wl-num",textContent:A(y.value)},null,8,on)):$("v-if",!0),ie(" "+A(g.value.comment),1)]),m("ul",rn,[(r(!0),s(B,null,J(w(l),j=>(r(),s("li",{key:j,class:D([j===U.value?"active":""]),onClick:G=>L(j)},A(g.value[j]),11,sn))),128))])]),m("div",cn,[(r(!0),s(B,null,J(d.value,j=>(r(),ne(tn,{key:j.objectId,"root-id":j.objectId,comment:j,reply:S.value,edit:R.value,onLog:q,onReply:_,onEdit:H,onSubmit:te,onStatus:le,onDelete:Y,onSticky:me,onLike:re},null,8,["root-id","comment","reply","edit"]))),128))]),E.value==="error"?(r(),s("div",un,[m("button",{type:"button",class:"wl-btn",onClick:q,textContent:A(g.value.refresh)},null,8,mn)])):E.value==="loading"?(r(),s("div",vn,[O(w(ue),{size:30})])):d.value.length?z.value<b.value?(r(),s("div",pn,[m("button",{type:"button",class:"wl-btn",onClick:F,textContent:A(g.value.more)},null,8,gn)])):$("v-if",!0):(r(),s("div",{key:3,class:"wl-empty",textContent:A(g.value.sofa)},null,8,dn)),I.value.copyright?(r(),s("div",hn,[x[0]||(x[0]=ie(" Powered by ")),x[1]||(x[1]=m("a",{href:"https://github.com/walinejs/waline",target:"_blank",rel:"noopener noreferrer"}," Waline ",-1)),ie(" v"+A(w(vt)),1)])):$("v-if",!0)]))}});export{fn as Waline,vt as version};
|
|
12
12
|
//# sourceMappingURL=component.js.map
|
package/dist/pageview.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const v="3.4.
|
|
1
|
+
const v="3.4.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),U=({serverURL:e,lang:t,path:r,type:o,action:a})=>fetch(`${h(e)}article?lang=${t}`,{method:"POST",headers:$,body:JSON.stringify({path:r,type:o,action:a})}).then(n=>n.json()).then(n=>u(n,"Update counter").data),R=({serverURL:e,lang:t,paths:r,signal:o})=>f({serverURL:e,lang:t,paths:r,type:["time"],signal:o}),w=e=>U({...e,type:"time",action:"inc"}),L=(e="")=>e.replace(/\/$/u,""),b=e=>/^(https?:)?\/\//.test(e),d=e=>{const t=L(e);return b(t)?t:`https://${t}`},j=e=>{e.name!=="AbortError"&&console.error(e.message)},m=e=>{const{path:t}=e.dataset;return t!=null&&t.length?t:null},y=(e,t)=>{t.forEach((r,o)=>{const a=e[o].time;typeof a=="number"&&(r.innerText=a.toString())})},S=({serverURL:e,path:t=window.location.pathname,selector:r=".waline-pageview-count",update:o=!0,lang:a=navigator.language})=>{const n=new AbortController,i=Array.from(document.querySelectorAll(r)),p=l=>{const s=m(l);return s!==null&&t!==s},g=l=>R({serverURL:d(e),paths:l.map(s=>m(s)??t),lang:a,signal:n.signal}).then(s=>y(s,l)).catch(j);if(o){const l=i.filter(c=>!p(c)),s=i.filter(p);w({serverURL:d(e),path:t,lang:a}).then(c=>y(c,l)),s.length&&g(s)}else g(i);return n.abort.bind(n)};export{S as pageviewCount,v as version};
|
|
2
2
|
//# sourceMappingURL=pageview.js.map
|
package/dist/slim.js
CHANGED
|
@@ -8,5 +8,5 @@ import{fetchCommentCount as Rt,getArticleCounter as xt,updateArticleCounter as F
|
|
|
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?"]),lt=Q(["昵称","昵称不能少于3个字符","邮箱","请填写正确的邮件地址","网址","可选","欢迎评论","来发评论吧~","提交","喜欢","取消喜欢","回复","取消回复","评论","刷新","加载更多...","预览","表情","上传图片","秒前","分钟前","小时前","天前","刚刚","正在上传","登录","退出","博主","置顶","字",`评论字数应在 $0 到 $1 字之间!
|
|
9
9
|
当前字数:$2`,"匿名","潜水","冒泡","吐槽","活跃","话痨","传说","表情包","搜索表情包","个人资料","通过","待审核","垃圾","取消置顶","按倒序","按正序","按热度","你认为这篇文章怎么样?"]),vl=Q(["暱稱","暱稱不能少於3個字元","郵箱","請填寫正確的郵件地址","網址","可選","歡迎留言","來發留言吧~","送出","喜歡","取消喜歡","回覆","取消回覆","留言","重整","載入更多...","預覽","表情","上傳圖片","秒前","分鐘前","小時前","天前","剛剛","正在上傳","登入","登出","管理者","置頂","字",`留言字數應在 $0 到 $1 字之間!
|
|
10
10
|
目前字數:$2`,"匿名","潛水","冒泡","吐槽","活躍","多話","傳說","表情包","搜尋表情包","個人資料","通過","待審核","垃圾","取消置頂","最早","最新","熱門","你認為這篇文章怎麼樣?"]);const at="en-US",ye={zh:lt,"zh-cn":lt,"zh-tw":vl,en:Xe,"en-us":Xe,fr:Ye,"fr-fr":Ye,jp:Qe,"jp-jp":Qe,"pt-br":ml,ru:et,"ru-ru":et,vi:tt,"vi-vn":tt,de:ul,es:Je,"es-mx":Je},nt=e=>ye[e.toLowerCase()]||ye[at.toLowerCase()],it=e=>Object.keys(ye).includes(e.toLowerCase())?e:at,ot=e=>{try{e=decodeURI(e)}catch{}return e},rt=(e="")=>e.replace(/\/$/u,""),st=e=>/^(https?:)?\/\//.test(e),ke=e=>{const a=rt(e);return st(a)?a:`https://${a}`},dl=e=>Array.isArray(e)?e:e?[0,e]:!1,Ie=(e,a)=>typeof e=="function"?e:e===!1?!1:a,pl=({serverURL:e,path:a=location.pathname,lang:t=typeof navigator>"u"?"en-US":navigator.language,locale:l,emoji:n=Ke,meta:r=["nick","mail","link"],requiredMeta:f=[],dark:c=!1,pageSize:C=10,wordLimit:u,imageUploader:w,highlighter:U,texRenderer:g,copyright:S=!0,login:j="enable",search:$,reaction:y,recaptchaV3Key:i="",turnstileKey:h="",commentSorting:F="latest",...q})=>({serverURL:ke(e),path:ot(a),lang:it(t),locale:{...nt(it(t)),...typeof l=="object"?l:{}},wordLimit:dl(u),meta:Ge(r),requiredMeta:Ge(f),imageUploader:Ie(w,el),highlighter:Ie(U,sl),texRenderer:Ie(g,tl),dark:c,emoji:typeof n=="boolean"?n?Ke:[]:n,pageSize:C,login:j,copyright:S,search:$===!1?!1:typeof $=="object"?$:ll(t),recaptchaV3Key:i,turnstileKey:h,reaction:Array.isArray(y)?y:y===!0?Qt:[],commentSorting:F,...q}),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}",gl=e=>re(e)?e==="auto"?`@media(prefers-color-scheme:dark){body${Ae}}`:`${e}${Ae}`:e===!0?`:root${Ae}`:"",Re=(e,a)=>{let t=e.toString();for(;t.length<a;)t="0"+t;return t},hl=e=>{const a=Re(e.getDate(),2),t=Re(e.getMonth()+1,2);return`${Re(e.getFullYear(),2)}-${t}-${a}`},fl=(e,a,t)=>{if(!e)return"";const l=re(e)?new Date(e.includes(" ")?e.replace(/-/g,"/"):e):e,n=a.getTime()-l.getTime(),r=Math.floor(n/(24*3600*1e3));if(r===0){const f=n%864e5,c=Math.floor(f/(3600*1e3));if(c===0){const C=f%36e5,u=Math.floor(C/(60*1e3));if(u===0){const w=C%6e4;return`${Math.round(w/1e3)} ${t.seconds}`}return`${u} ${t.minutes}`}return`${c} ${t.hours}`}return r<0?t.now:r<8?`${r} ${t.days}`:hl(l)},wl=/^[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])?)*$/,yl=e=>wl.test(e),kl=e=>!!/@[0-9]+\.[0-9]+\.[0-9]+/.test(e),bl=e=>{const a=oe("WALINE_EMOJI",{}),t=kl(e);if(t){const l=a.value[e];if(l)return Promise.resolve(l)}return fetch(`${e}/info.json`).then(l=>l.json()).then(l=>{const n={folder:e,...l};return t&&(a.value[e]=n),n})},ct=(e,a="",t="",l="")=>`${a?`${a}/`:""}${t}${e}${l?`.${l}`:""}`,Cl=e=>Promise.all(e.map(a=>re(a)?bl(rt(a)):Promise.resolve(a))).then(a=>{const t={tabs:[],map:{}};return a.forEach(l=>{const{name:n,folder:r,icon:f,prefix:c="",type:C,items:u}=l;t.tabs.push({name:n,icon:ct(f,r,c,C),items:u.map(w=>{const U=`${c}${w}`;return t.map[U]=ct(w,r,c,C),U})})}),t}),ut=e=>{e.name!=="AbortError"&&console.error(e.message)},xe=e=>e instanceof HTMLElement?e:re(e)?document.querySelector(e):null,$l=e=>e.type.includes("image"),mt=e=>{const a=Array.from(e).find($l);return a?a.getAsFile():null},Ll=/\$.*?\$/,El=/^\$(.*?)\$/,Il=/^(?:\s{0,3})\$\$((?:[^\n]|\n[^\n])+?)\n{0,1}\$\$/,Al=e=>[{name:"blockMath",level:"block",tokenizer(a){const t=Il.exec(a);if(t!==null)return{type:"html",raw:t[0],text:e(!0,t[1])}}},{name:"inlineMath",level:"inline",start(a){const t=a.search(Ll);return t!==-1?t:a.length},tokenizer(a){const t=El.exec(a);if(t!==null)return{type:"html",raw:t[0],text:e(!1,t[1])}}}],vt=(e="",a={})=>e.replace(/:(.+?):/g,(t,l)=>a[l]?`<img class="wl-emoji" src="${a[l]}" alt="${l}">`:t),Rl=(e,{emojiMap:a,highlighter:t,texRenderer:l})=>{const n=new Zt;if(n.setOptions({breaks:!0}),t&&n.use(Xt({highlight:t})),l){const r=Al(l);n.use({extensions:r})}return n.parse(vt(e,a))},Me=e=>{const{path:a}=e.dataset;return a!=null&&a.length?a:null},xl=e=>e.match(/[\w\d\s,.\u00C0-\u024F\u0400-\u04FF]+/giu),Ml=e=>e.match(/[\u4E00-\u9FD5]/gu),Sl=e=>{var a,t;return(((a=xl(e))==null?void 0:a.reduce((l,n)=>l+(["",",","."].includes(n.trim())?0:n.trim().split(/\s+/u).length),0))??0)+(((t=Ml(e))==null?void 0:t.length)??0)},jl=async()=>{if(!navigator)return"";const{userAgentData:e}=navigator;let a=navigator.userAgent;if(!e||e.platform!=="Windows")return a;const{platformVersion:t}=await e.getHighEntropyValues(["platformVersion"]);return t&&parseInt(t.split(".")[0])>=13&&(a=a.replace("Windows NT 10.0","Windows NT 11.0")),a},dt=({serverURL:e,path:a=window.location.pathname,selector:t=".waline-comment-count",lang:l=navigator.language})=>{const n=new AbortController,r=document.querySelectorAll(t);return r.length&&Rt({serverURL:ke(e),paths:Array.from(r).map(f=>ot(Me(f)??a)),lang:l,signal:n.signal}).then(f=>{r.forEach((c,C)=>{c.innerText=f[C].toString()})}).catch(ut),n.abort.bind(n)},pt=({size:e})=>x("svg",{class:"wl-close-icon",viewBox:"0 0 1024 1024",width:e,height:e},[x("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"}),x("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"})]),Ul=()=>x("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},x("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"})),zl=()=>x("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},x("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"})),_l=()=>x("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},[x("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"}),x("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"})]),Vl=({active:e=!1})=>x("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},[x("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"})]),Hl=()=>x("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},[x("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"}),x("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"})]),Tl=()=>x("svg",{width:"16",height:"16",ariaHidden:"true"},x("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"})),Fl=()=>x("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},x("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"})),Nl=()=>x("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},x("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"})),Pl=()=>x("svg",{class:"verified-icon",viewBox:"0 0 1024 1024",width:"14",height:"14"},x("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"})),me=({size:e=100})=>x("svg",{width:e,height:e,viewBox:"0 0 100 100",preserveAspectRatio:"xMidYMid"},x("circle",{cx:50,cy:50,fill:"none",stroke:"currentColor",strokeWidth:"4",r:"40","stroke-dasharray":"85 30"},x("animateTransform",{attributeName:"transform",type:"rotate",repeatCount:"indefinite",dur:"1s",values:"0 50 50;360 50 50",keyTimes:"0;1"}))),Wl=()=>x("svg",{width:24,height:24,fill:"currentcolor",viewBox:"0 0 24 24"},[x("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"}),x("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"})]),Bl=()=>oe("WALINE_USER_META",{nick:"",mail:"",link:""}),Dl=()=>oe("WALINE_COMMENT_BOX_EDITOR",""),Ol="WALINE_LIKE";let gt=null;const ht=()=>gt??(gt=oe(Ol,[])),ql="WALINE_REACTION";let ft=null;const Gl=()=>ft??(ft=oe(ql,{})),wt={},Kl=e=>{const a=wt[e]??(wt[e]=Jt(e,{useRecaptchaNet:!0,autoHideBadge:!0}));return{execute:t=>a.then(l=>l.execute(t))}},Zl=e=>({execute:async a=>{const{load:t}=Ot("https://challenges.cloudflare.com/turnstile/v0/api.js",void 0,{async:!1});await t();const l=window==null?void 0:window.turnstile;return new Promise(n=>{l==null||l.ready(()=>{l==null||l.render(".wl-captcha-container",{sitekey:e,action:a,size:"compact",callback:n})})})}}),Xl="WALINE_USER";let yt=null;const be=()=>yt??(yt=oe(Xl,{})),Jl={key:0,class:"wl-reaction"},Yl=["textContent"],Ql={class:"wl-reaction-list"},ea=["onClick"],ta={class:"wl-reaction-img"},la=["src","alt"],aa=["textContent"],na=["textContent"];var ia=ue({__name:"ArticleReaction",setup(e,{expose:a}){a();const t=Gl(),l=$e("config"),n=E(-1),r=E([]),f=P(()=>l.value.locale),c=P(()=>l.value.reaction.length>0),C=P(()=>{const{reaction:g,path:S}=l.value;return g.map((j,$)=>({icon:j,desc:f.value[`reaction${$}`],active:t.value[S]===$}))});let u;const w=async()=>{if(!c.value)return;const{serverURL:g,lang:S,path:j,reaction:$}=l.value,y=new AbortController;u=y.abort.bind(y);const i=await xt({serverURL:g,lang:S,paths:[j],type:$.map((h,F)=>`reaction${F}`),signal:y.signal});r.value=$.map((h,F)=>i[0][`reaction${F}`])},U=async g=>{if(n.value===-1){const{serverURL:S,lang:j,path:$}=l.value,y=t.value[$];n.value=g,y!==void 0&&(await Fe({serverURL:S,lang:j,path:$,type:`reaction${y}`,action:"desc"}),r.value[y]=Math.max(r.value[y]-1,0)),y!==g&&(await Fe({serverURL:S,lang:j,path:$,type:`reaction${g}`}),r.value[g]=(r.value[g]||0)+1),y===g?delete t.value[$]:t.value[$]=g,n.value=-1}};return fe(()=>{ae(()=>[l.value.serverURL,l.value.path],()=>{w()},{immediate:!0})}),Ne(()=>u==null?void 0:u()),(g,S)=>C.value.length?(s(),m("div",Jl,[p("div",{class:"wl-reaction-title",textContent:M(f.value.reactionTitle)},null,8,Yl),p("ul",Ql,[(s(!0),m(W,null,J(C.value,({active:j,icon:$,desc:y},i)=>(s(),m("li",{key:i,class:D(["wl-reaction-item",{active:j}]),onClick:h=>U(i)},[p("div",ta,[p("img",{src:$,alt:y},null,8,la),n.value===i?(s(),ne(L(me),{key:0,class:"wl-reaction-loading"})):(s(),m("div",{key:1,class:"wl-reaction-votes",textContent:M(r.value[i]||0)},null,8,aa))]),p("div",{class:"wl-reaction-text",textContent:M(y)},null,8,na)],10,ea))),128))])])):I("v-if",!0)}});const oa=["data-index"],ra=["src","title","onClick"];var sa=ue({__name:"ImageWall",props:{items:{default:()=>[]},columnWidth:{default:300},gap:{default:0}},emits:["insert"],setup(e,{expose:a}){const t=e;a();let l=null;const n=E(null),r=E({}),f=E([]),c=()=>{const g=Math.floor((n.value.getBoundingClientRect().width+t.gap)/(t.columnWidth+t.gap));return g>0?g:1},C=g=>new Array(g).fill(null).map(()=>[]),u=async g=>{var S;if(g>=t.items.length)return;await We();const j=Array.from(((S=n.value)==null?void 0:S.children)??[]).reduce(($,y)=>y.getBoundingClientRect().height<$.getBoundingClientRect().height?y:$);f.value[Number(j.dataset.index)].push(g),await u(g+1)},w=async(g=!1)=>{if(f.value.length===c()&&!g)return;f.value=C(c());const S=window.scrollY;await u(0),window.scrollTo({top:S})},U=g=>{r.value[g.target.src]=!0};return fe(()=>{w(!0),l=new ResizeObserver(()=>{w()}),l.observe(n.value),ae(()=>[t.items],()=>{r.value={},w(!0)}),ae(()=>[t.columnWidth,t.gap],()=>{w()})}),Tt(()=>l.unobserve(n.value)),(g,S)=>(s(),m("div",{ref_key:"wall",ref:n,class:"wl-gallery",style:Pe({gap:`${g.gap}px`})},[(s(!0),m(W,null,J(f.value,(j,$)=>(s(),m("div",{key:$,class:"wl-gallery-column","data-index":$,style:Pe({gap:`${g.gap}px`})},[(s(!0),m(W,null,J(j,y=>(s(),m(W,{key:y},[r.value[g.items[y].src]?I("v-if",!0):(s(),ne(L(me),{key:0,size:36,style:{margin:"20px auto"}})),p("img",{class:"wl-gallery-item",src:g.items[y].src,title:g.items[y].title,loading:"lazy",onLoad:U,onClick:i=>g.$emit("insert",``)},null,40,ra)],64))),128))],12,oa))),128))],4))}});const ca={key:0,class:"wl-login-info"},ua={class:"wl-avatar"},ma=["title"],va=["title"],da=["src"],pa=["title","textContent"],ga={class:"wl-panel"},ha=["for","textContent"],fa=["id","onUpdate:modelValue","name","type"],wa=["placeholder"],ya={class:"wl-preview"},ka=["innerHTML"],ba={class:"wl-footer"},Ca={class:"wl-actions"},$a={href:"https://guides.github.com/features/mastering-markdown/",title:"Markdown Guide","aria-label":"Markdown is supported",class:"wl-action",target:"_blank",rel:"noopener noreferrer"},La=["title"],Ea=["title"],Ia=["title","aria-label"],Aa=["title"],Ra={class:"wl-info"},xa={class:"wl-text-number"},Ma={key:0},Sa=["textContent"],ja=["textContent"],Ua=["disabled"],za=["placeholder"],_a={key:1,class:"wl-loading"},Va={key:0,class:"wl-tab-wrapper"},Ha=["title","onClick"],Ta=["src","alt"],Fa={key:0,class:"wl-tabs"},Na=["onClick"],Pa=["src","alt","title"],Wa=["title"];var kt=ue({__name:"CommentBox",props:{edit:{default:null},rootId:{default:""},replyId:{default:""},replyUser:{default:""}},emits:["log","cancelEdit","cancelReply","submit"],setup(e,{emit:a}){const t=e,l=a,n=$e("config"),r=Dl(),f=Bl(),c=be(),C=E({}),u=E(null),w=E(null),U=E(null),g=E(null),S=E(null),j=E(null),$=E(null),y=E({tabs:[],map:{}}),i=E(0),h=E(!1),F=E(!1),q=E(!1),A=E(""),_=E(0),H=Le({loading:!0,list:[]}),te=E(0),le=E(!1),ve=E(""),Y=E(!1),se=E(!1),d=P(()=>n.value.locale),R=P(()=>{var v;return!!((v=c.value)!=null&&v.token)}),z=P(()=>n.value.imageUploader!==!1),G=v=>{const o=u.value,k=o.selectionStart,V=o.selectionEnd||0,b=o.scrollTop;r.value=o.value.substring(0,k)+v+o.value.substring(V,o.value.length),o.focus(),o.selectionStart=k+v.length,o.selectionEnd=k+v.length,o.scrollTop=b},K=v=>{if(Y.value)return;const o=v.key;(v.ctrlKey||v.metaKey)&&o==="Enter"&&de()},Z=v=>{const o=`![${n.value.locale.uploading} ${v.name}]()`;return G(o),Y.value=!0,Promise.resolve().then(()=>n.value.imageUploader(v)).then(k=>{r.value=r.value.replace(o,`\r
|
|
11
|
-
`)}).catch(k=>{alert(k.message),r.value=r.value.replace(o,"")}).then(()=>{Y.value=!1})},X=v=>{var o;if((o=v.dataTransfer)!=null&&o.items){const k=mt(v.dataTransfer.items);k&&z.value&&(Z(k),v.preventDefault())}},ce=v=>{if(v.clipboardData){const o=mt(v.clipboardData.items);o&&z.value&&Z(o)}},Se=()=>{const v=w.value;v.files&&z.value&&Z(v.files[0]).then(()=>{v.value=""})},de=async()=>{var v,o,k,V,b,B;const{serverURL:N,lang:ee,login:pe,wordLimit:_e,requiredMeta:Ve,recaptchaV3Key:He,turnstileKey:Te}=n.value,At=await jl(),T={comment:ve.value,nick:f.value.nick,mail:f.value.mail,link:f.value.link,url:n.value.path,ua:At};if(!t.edit)if((v=c.value)!=null&&v.token)T.nick=c.value.display_name,T.mail=c.value.email,T.link=c.value.url;else{if(pe==="force")return;if(Ve.includes("nick")&&!T.nick)return(o=C.value.nick)==null||o.focus(),alert(d.value.nickError);if(Ve.includes("mail")&&!T.mail||T.mail&&!yl(T.mail))return(k=C.value.mail)==null||k.focus(),alert(d.value.mailError);T.nick||(T.nick=d.value.anonymous)}if(!T.comment){(V=u.value)==null||V.focus();return}if(!le.value)return alert(d.value.wordHint.replace("$0",_e[0].toString()).replace("$1",_e[1].toString()).replace("$2",_.value.toString()));T.comment=vt(T.comment,y.value.map),t.replyId&&t.rootId&&(T.pid=t.replyId,T.rid=t.rootId,T.at=t.replyUser),Y.value=!0;try{He&&(T.recaptchaV3=await Kl(He).execute("social")),Te&&(T.turnstile=await Zl(Te).execute("social"));const ge={serverURL:N,lang:ee,token:(b=c.value)==null?void 0:b.token,comment:T},Ce=await(t.edit?he({objectId:t.edit.objectId,...ge}):Mt(ge));if(Y.value=!1,Ce.errmsg)return alert(Ce.errmsg);l("submit",Ce.data),r.value="",A.value="",await We(),t.replyId&&l("cancelReply"),(B=t.edit)!=null&&B.objectId&&l("cancelEdit")}catch(ge){Y.value=!1,alert(ge.message)}},Lt=v=>{v.preventDefault();const{lang:o,serverURL:k}=n.value;St({serverURL:k,lang:o}).then(V=>{c.value=V,(V.remember?localStorage:sessionStorage).setItem("WALINE_USER",JSON.stringify(V)),l("log")})},Et=()=>{c.value={},localStorage.setItem("WALINE_USER","null"),sessionStorage.setItem("WALINE_USER","null"),l("log")},je=v=>{v.preventDefault();const{lang:o,serverURL:k}=n.value,V=800,b=800,B=(window.innerWidth-V)/2,N=(window.innerHeight-b)/2,ee=new URLSearchParams({lng:o,token:c.value.token}),pe=window.open(`${k}/ui/profile?${ee.toString()}`,"_blank",`width=${V},height=${b},left=${B},top=${N},scrollbars=no,resizable=no,status=no,location=no,toolbar=no,menubar=no`);pe==null||pe.postMessage({type:"TOKEN",data:c.value.token},"*")},It=v=>{var o,k,V,b;!((o=U.value)!=null&&o.contains(v.target))&&!((k=g.value)!=null&&k.contains(v.target))&&(h.value=!1),!((V=S.value)!=null&&V.contains(v.target))&&!((b=j.value)!=null&&b.contains(v.target))&&(F.value=!1)},Ue=async v=>{var o;const{scrollTop:k,clientHeight:V,scrollHeight:b}=v.target,B=(V+k)/b,N=n.value.search,ee=((o=$.value)==null?void 0:o.value)??"";B<.9||H.loading||se.value||(H.loading=!0,(N.more&&H.list.length?await N.more(ee,H.list.length):await N.search(ee)).length?H.list=[...H.list,...N.more&&H.list.length?await N.more(ee,H.list.length):await N.search(ee)]:se.value=!0,H.loading=!1,setTimeout(()=>{v.target.scrollTop=k},50))},ze=qt(v=>{H.list=[],se.value=!1,Ue(v)},300);return ae([n,_],([v,o])=>{const{wordLimit:k}=v;k?o<k[0]&&k[0]!==0?(te.value=k[0],le.value=!1):o>k[1]?(te.value=k[1],le.value=!1):(te.value=k[1],le.value=!0):(te.value=0,le.value=!0)},{immediate:!0}),Oe("click",It),Oe("message",({data:v})=>{!v||v.type!=="profile"||(c.value={...c.value,...v.data},[localStorage,sessionStorage].filter(o=>o.getItem("WALINE_USER")).forEach(o=>o.setItem("WALINE_USER",JSON.stringify(c))))}),ae(F,async v=>{var o;if(!v)return;const k=n.value.search;$.value&&($.value.value=""),H.loading=!0,H.list=await(((o=k.default)==null?void 0:o.call(k))??k.search("")),H.loading=!1}),fe(()=>{var v;(v=t.edit)!=null&&v.objectId&&(r.value=t.edit.orig),ae(()=>r.value,o=>{const{highlighter:k,texRenderer:V}=n.value;ve.value=o,A.value=Rl(o,{emojiMap:y.value.map,highlighter:k,texRenderer:V}),_.value=Sl(o),o?qe(u.value):qe.destroy(u.value)},{immediate:!0}),ae(()=>n.value.emoji,o=>Cl(o).then(k=>{y.value=k}),{immediate:!0})}),(v,o)=>{var k,V;return s(),m("div",{key:L(c).token,class:"wl-comment"},[L(n).login!=="disable"&&R.value&&!((k=v.edit)!=null&&k.objectId)?(s(),m("div",ca,[p("div",ua,[p("button",{type:"submit",class:"wl-logout-btn",title:d.value.logout,onClick:Et},[O(L(pt),{size:14})],8,ma),p("a",{href:"#",class:"wl-login-nick","aria-label":"Profile",title:d.value.profile,onClick:je},[p("img",{src:L(c).avatar,alt:"avatar"},null,8,da)],8,va)]),p("a",{href:"#",class:"wl-login-nick","aria-label":"Profile",title:d.value.profile,onClick:je,textContent:M(L(c).display_name)},null,8,pa)])):I("v-if",!0),p("div",ga,[L(n).login!=="force"&&L(n).meta.length&&!R.value?(s(),m("div",{key:0,class:D(["wl-header",`item${L(n).meta.length}`])},[(s(!0),m(W,null,J(L(n).meta,b=>(s(),m("div",{key:b,class:"wl-header-item"},[p("label",{for:`wl-${b}`,textContent:M(d.value[b]+(L(n).requiredMeta.includes(b)||!L(n).requiredMeta.length?"":`(${d.value.optional})`))},null,8,ha),we(p("input",{id:`wl-${b}`,ref_for:!0,ref:B=>{B&&(C.value[b]=B)},"onUpdate:modelValue":B=>L(f)[b]=B,class:D(["wl-input",`wl-${b}`]),name:b,type:b==="mail"?"email":"text"},null,10,fa),[[Ft,L(f)[b]]])]))),128))],2)):I("v-if",!0),we(p("textarea",{id:"wl-edit",ref_key:"editorRef",ref:u,"onUpdate:modelValue":o[0]||(o[0]=b=>Nt(r)?r.value=b:null),class:"wl-editor",placeholder:v.replyUser?`@${v.replyUser}`:d.value.placeholder,onKeydown:K,onDrop:X,onPaste:ce},null,40,wa),[[Pt,L(r)]]),we(p("div",ya,[o[7]||(o[7]=p("hr",null,null,-1)),p("h4",null,M(d.value.preview)+":",1),p("div",{class:"wl-content",innerHTML:A.value},null,8,ka)],512),[[Be,q.value]]),p("div",ba,[p("div",Ca,[p("a",$a,[O(L(Tl))]),we(p("button",{ref_key:"emojiButtonRef",ref:U,type:"button",class:D(["wl-action",{active:h.value}]),title:d.value.emoji,onClick:o[1]||(o[1]=b=>h.value=!h.value)},[O(L(zl))],10,La),[[Be,y.value.tabs.length]]),L(n).search?(s(),m("button",{key:0,ref_key:"gifButtonRef",ref:S,type:"button",class:D(["wl-action",{active:F.value}]),title:d.value.gif,onClick:o[2]||(o[2]=b=>F.value=!F.value)},[O(L(Wl))],10,Ea)):I("v-if",!0),p("input",{id:"wl-image-upload",ref_key:"imageUploadRef",ref:w,class:"upload","aria-hidden":"true",type:"file",accept:".png,.jpg,.jpeg,.webp,.bmp,.gif",onChange:Se},null,544),z.value?(s(),m("label",{key:1,for:"wl-image-upload",class:"wl-action",title:d.value.uploadImage,"aria-label":d.value.uploadImage},[O(L(_l))],8,Ia)):I("v-if",!0),p("button",{type:"button",class:D(["wl-action",{active:q.value}]),title:d.value.preview,onClick:o[3]||(o[3]=b=>q.value=!q.value)},[O(L(Hl))],10,Aa)]),p("div",Ra,[o[9]||(o[9]=p("div",{class:"wl-captcha-container"},null,-1)),p("div",xa,[ie(M(_.value)+" ",1),L(n).wordLimit?(s(),m("span",Ma,[o[8]||(o[8]=ie(" / ")),p("span",{class:D({illegal:!le.value}),textContent:M(te.value)},null,10,Sa)])):I("v-if",!0),ie(" "+M(d.value.word),1)]),L(n).login!=="disable"&&!R.value?(s(),m("button",{key:0,type:"button",class:"wl-btn",onClick:Lt,textContent:M(d.value.login)},null,8,ja)):I("v-if",!0),L(n).login!=="force"||R.value?(s(),m("button",{key:1,type:"submit",class:"primary wl-btn",title:"Cmd|Ctrl + Enter",disabled:Y.value,onClick:de},[Y.value?(s(),ne(L(me),{key:0,size:16})):(s(),m(W,{key:1},[ie(M(d.value.submit),1)],64))],8,Ua)):I("v-if",!0)]),p("div",{ref_key:"gifPopupRef",ref:j,class:D(["wl-gif-popup",{display:F.value}])},[p("input",{ref_key:"gifSearchInputRef",ref:$,type:"text",placeholder:d.value.gifSearchPlaceholder,onInput:o[4]||(o[4]=(...b)=>L(ze)&&L(ze)(...b))},null,40,za),H.list.length?(s(),ne(sa,{key:0,items:H.list,"column-width":200,gap:6,onInsert:o[5]||(o[5]=b=>G(b)),onScroll:Ue},null,8,["items"])):I("v-if",!0),H.loading?(s(),m("div",_a,[O(L(me),{size:30})])):I("v-if",!0)],2),p("div",{ref_key:"emojiPopupRef",ref:g,class:D(["wl-emoji-popup",{display:h.value}])},[(s(!0),m(W,null,J(y.value.tabs,(b,B)=>(s(),m(W,{key:b.name},[B===i.value?(s(),m("div",Va,[(s(!0),m(W,null,J(b.items,N=>(s(),m("button",{key:N,type:"button",title:N,onClick:ee=>G(`:${N}:`)},[h.value?(s(),m("img",{key:0,class:"wl-emoji",src:y.value.map[N],alt:N,loading:"lazy",referrerPolicy:"no-referrer"},null,8,Ta)):I("v-if",!0)],8,Ha))),128))])):I("v-if",!0)],64))),128)),y.value.tabs.length>1?(s(),m("div",Fa,[(s(!0),m(W,null,J(y.value.tabs,(b,B)=>(s(),m("button",{key:b.name,type:"button",class:D(["wl-tab",{active:i.value===B}]),onClick:N=>i.value=B},[p("img",{class:"wl-emoji",src:b.icon,alt:b.name,title:b.name,loading:"lazy",referrerPolicy:"no-referrer"},null,8,Pa)],10,Na))),128))])):I("v-if",!0)],2)])]),v.replyId||(V=v.edit)!=null&&V.objectId?(s(),m("button",{key:1,type:"button",class:"wl-close",title:d.value.cancelReply,onClick:o[6]||(o[6]=b=>v.replyId?l("cancelReply"):l("cancelEdit"))},[O(L(pt),{size:24})],8,Wa)):I("v-if",!0)])}}});const Ba=["id"],Da={class:"wl-user","aria-hidden":"true"},Oa=["src"],qa={class:"wl-card"},Ga={class:"wl-head"},Ka=["href"],Za={key:1,class:"wl-nick"},Xa=["textContent"],Ja=["textContent"],Ya=["textContent"],Qa=["textContent"],en=["textContent"],tn={class:"wl-comment-actions"},ln=["title"],an=["title"],nn={class:"wl-meta","aria-hidden":"true"},on=["data-value","textContent"],rn={key:0,class:"wl-content"},sn={key:0},cn=["href"],un=["innerHTML"],mn={key:1,class:"wl-admin-actions"},vn={class:"wl-comment-status"},dn=["disabled","onClick","textContent"],pn={key:3,class:"wl-quote"};var gn=ue({__name:"CommentCard",props:{comment:{},edit:{default:null},rootId:{},reply:{default:null}},emits:["log","submit","delete","edit","like","status","sticky","reply"],setup(e,{emit:a}){const t=e,l=a,n=["approved","waiting","spam"],r=$e("config"),f=ht(),c=Gt(),C=be(),u=P(()=>r.value.locale),w=P(()=>{const{link:i}=t.comment;return i?st(i)?i:`https://${i}`:""}),U=P(()=>f.value.includes(t.comment.objectId)),g=P(()=>fl(new Date(t.comment.time),c.value,u.value)),S=P(()=>C.value.type==="administrator"),j=P(()=>t.comment.user_id&&C.value.objectId===t.comment.user_id),$=P(()=>{var i;return t.comment.objectId===((i=t.reply)==null?void 0:i.objectId)}),y=P(()=>{var i;return t.comment.objectId===((i=t.edit)==null?void 0:i.objectId)});return(i,h)=>{var F;const q=Wt("CommentCard",!0);return s(),m("div",{id:i.comment.objectId,class:"wl-card-item"},[p("div",Da,[i.comment.avatar?(s(),m("img",{key:0,class:"wl-user-avatar",src:i.comment.avatar,alt:""},null,8,Oa)):I("v-if",!0),i.comment.type?(s(),ne(L(Pl),{key:1})):I("v-if",!0)]),p("div",qa,[p("div",Ga,[w.value?(s(),m("a",{key:0,class:"wl-nick",href:w.value,target:"_blank",rel:"nofollow noopener noreferrer"},M(i.comment.nick),9,Ka)):(s(),m("span",Za,M(i.comment.nick),1)),i.comment.type==="administrator"?(s(),m("span",{key:2,class:"wl-badge",textContent:M(u.value.admin)},null,8,Xa)):I("v-if",!0),i.comment.label?(s(),m("span",{key:3,class:"wl-badge",textContent:M(i.comment.label)},null,8,Ja)):I("v-if",!0),i.comment.sticky?(s(),m("span",{key:4,class:"wl-badge",textContent:M(u.value.sticky)},null,8,Ya)):I("v-if",!0),typeof i.comment.level=="number"?(s(),m("span",{key:5,class:D(`wl-badge level${i.comment.level}`),textContent:M(u.value[`level${i.comment.level}`]||`Level ${i.comment.level}`)},null,10,Qa)):I("v-if",!0),p("span",{class:"wl-time",textContent:M(g.value)},null,8,en),p("div",tn,[S.value||j.value?(s(),m(W,{key:0},[p("button",{type:"button",class:"wl-edit",onClick:h[0]||(h[0]=A=>l("edit",i.comment))},[O(L(Nl))]),p("button",{type:"button",class:"wl-delete",onClick:h[1]||(h[1]=A=>l("delete",i.comment))},[O(L(Ul))])],64)):I("v-if",!0),p("button",{type:"button",class:"wl-like",title:U.value?u.value.cancelLike:u.value.like,onClick:h[2]||(h[2]=A=>l("like",i.comment))},[O(L(Vl),{active:U.value},null,8,["active"]),ie(" "+M("like"in i.comment?i.comment.like:""),1)],8,ln),p("button",{type:"button",class:D(["wl-reply",{active:$.value}]),title:$.value?u.value.cancelReply:u.value.reply,onClick:h[3]||(h[3]=A=>l("reply",$.value?null:i.comment))},[O(L(Fl))],10,an)])]),p("div",nn,[(s(),m(W,null,J(["addr","browser","os"],A=>(s(),m(W,null,[i.comment[A]?(s(),m("span",{key:A,class:D(`wl-${A}`),"data-value":i.comment[A],textContent:M(i.comment[A])},null,10,on)):I("v-if",!0)],64))),64))]),y.value?I("v-if",!0):(s(),m("div",rn,[i.comment.reply_user?(s(),m("p",sn,[p("a",{href:"#"+i.comment.pid},"@"+M(i.comment.reply_user.nick),9,cn),h[17]||(h[17]=p("span",null,": ",-1))])):I("v-if",!0),p("div",{innerHTML:i.comment.comment},null,8,un)])),S.value&&!y.value?(s(),m("div",mn,[p("span",vn,[(s(),m(W,null,J(n,A=>p("button",{key:A,type:"submit",class:D(`wl-btn wl-${A}`),disabled:i.comment.status===A,onClick:_=>l("status",{status:A,comment:i.comment}),textContent:M(u.value[A])},null,10,dn)),64))]),S.value&&!("rid"in i.comment)?(s(),m("button",{key:0,type:"submit",class:"wl-btn wl-sticky",onClick:h[4]||(h[4]=A=>l("sticky",i.comment))},M(i.comment.sticky?u.value.unsticky:u.value.sticky),1)):I("v-if",!0)])):I("v-if",!0),$.value||y.value?(s(),m("div",{key:2,class:D({"wl-reply-wrapper":$.value,"wl-edit-wrapper":y.value})},[O(kt,{edit:i.edit,"reply-id":(F=i.reply)==null?void 0:F.objectId,"reply-user":i.comment.nick,"root-id":i.rootId,onLog:h[5]||(h[5]=A=>l("log")),onCancelReply:h[6]||(h[6]=A=>l("reply",null)),onCancelEdit:h[7]||(h[7]=A=>l("edit",null)),onSubmit:h[8]||(h[8]=A=>l("submit",A))},null,8,["edit","reply-id","reply-user","root-id"])],2)):I("v-if",!0),"children"in i.comment?(s(),m("div",pn,[(s(!0),m(W,null,J(i.comment.children,A=>(s(),ne(q,{key:A.objectId,comment:A,reply:i.reply,edit:i.edit,"root-id":i.rootId,onLog:h[9]||(h[9]=_=>l("log")),onDelete:h[10]||(h[10]=_=>l("delete",_)),onEdit:h[11]||(h[11]=_=>l("edit",_)),onLike:h[12]||(h[12]=_=>l("like",_)),onReply:h[13]||(h[13]=_=>l("reply",_)),onStatus:h[14]||(h[14]=_=>l("status",_)),onSticky:h[15]||(h[15]=_=>l("sticky",_)),onSubmit:h[16]||(h[16]=_=>l("submit",_))},null,8,["comment","reply","edit","root-id"]))),128))])):I("v-if",!0)])],8,Ba)}}});const bt="3.4.0",hn={"data-waline":""},fn={class:"wl-meta-head"},wn={class:"wl-count"},yn=["textContent"],kn={class:"wl-sort"},bn=["onClick"],Cn={class:"wl-cards"},$n={key:1,class:"wl-operation"},Ln=["textContent"],En={key:2,class:"wl-loading"},In=["textContent"],An={key:4,class:"wl-operation"},Rn=["textContent"],xn={key:5,class:"wl-power"};var Mn=ue({__name:"WalineComment",props:["serverURL","path","meta","requiredMeta","dark","commentSorting","lang","locale","pageSize","wordLimit","emoji","login","highlighter","texRenderer","imageUploader","search","copyright","recaptchaV3Key","turnstileKey","reaction"],setup(e){const a=e,t={latest:"insertedAt_desc",oldest:"insertedAt_asc",hottest:"like_desc"},l=Object.keys(t),n=be(),r=ht(),f=E("loading"),c=E(0),C=E(1),u=E(0),w=P(()=>pl(a)),U=E(w.value.commentSorting),g=E([]),S=E(null),j=E(null),$=P(()=>gl(w.value.dark)),y=P(()=>w.value.locale);Kt($,{id:"waline-darkmode"});let i;const h=d=>{var R;const{serverURL:z,path:G,pageSize:K}=w.value,Z=new AbortController;f.value="loading",i==null||i(),Ut({serverURL:z,lang:w.value.lang,path:G,pageSize:K,sortBy:t[U.value],page:d,signal:Z.signal,token:(R=n.value)==null?void 0:R.token}).then(X=>{f.value="success",c.value=X.count,g.value.push(...X.data),C.value=d,u.value=X.totalPages}).catch(X=>{X.name!=="AbortError"&&(console.error(X.message),f.value="error")}),i=Z.abort.bind(Z)},F=()=>h(C.value+1),q=()=>{c.value=0,g.value=[],h(1)},A=d=>{U.value!==d&&(U.value=d,q())},_=d=>{S.value=d},H=d=>{j.value=d},te=d=>{if(j.value)j.value.comment=d.comment,j.value.orig=d.orig;else if("rid"in d){const R=g.value.find(({objectId:z})=>z===d.rid);if(!R)return;Array.isArray(R.children)||(R.children=[]),R.children.push(d)}else g.value.unshift(d),c.value+=1},le=async({comment:d,status:R})=>{var z;if(d.status===R)return;const{serverURL:G,lang:K}=w.value;await he({serverURL:G,lang:K,token:(z=n.value)==null?void 0:z.token,objectId:d.objectId,comment:{status:R}}),d.status=R},ve=async d=>{var R;if("rid"in d)return;const{serverURL:z,lang:G}=w.value;await he({serverURL:z,lang:G,token:(R=n.value)==null?void 0:R.token,objectId:d.objectId,comment:{sticky:d.sticky?0:1}}),d.sticky=!d.sticky},Y=async({objectId:d})=>{var R;if(!confirm("Are you sure you want to delete this comment?"))return;const{serverURL:z,lang:G}=w.value;await jt({serverURL:z,lang:G,token:(R=n.value)==null?void 0:R.token,objectId:d}),g.value.some((K,Z)=>K.objectId===d?(g.value=g.value.filter((X,ce)=>ce!==Z),!0):K.children.some((X,ce)=>X.objectId===d?(g.value[Z].children=K.children.filter((Se,de)=>de!==ce),!0):!1))},se=async d=>{var R;const{serverURL:z,lang:G}=w.value,{objectId:K}=d,Z=r.value.includes(K);await he({serverURL:z,lang:G,objectId:K,token:(R=n.value)==null?void 0:R.token,comment:{like:!Z}}),Z?r.value=r.value.filter(X=>X!==K):(r.value=[...r.value,K],r.value.length>50&&(r.value=r.value.slice(-50))),d.like=(d.like||0)+(Z?-1:1)};return Bt("config",w),fe(()=>{ae(()=>[a.serverURL,a.path],()=>q(),{immediate:!0})}),Ne(()=>i==null?void 0:i()),(d,R)=>(s(),m("div",hn,[O(ia),!S.value&&!j.value?(s(),ne(kt,{key:0,onLog:q,onSubmit:te})):I("v-if",!0),p("div",fn,[p("div",wn,[c.value?(s(),m("span",{key:0,class:"wl-num",textContent:M(c.value)},null,8,yn)):I("v-if",!0),ie(" "+M(y.value.comment),1)]),p("ul",kn,[(s(!0),m(W,null,J(L(l),z=>(s(),m("li",{key:z,class:D([z===U.value?"active":""]),onClick:G=>A(z)},M(y.value[z]),11,bn))),128))])]),p("div",Cn,[(s(!0),m(W,null,J(g.value,z=>(s(),ne(gn,{key:z.objectId,"root-id":z.objectId,comment:z,reply:S.value,edit:j.value,onLog:q,onReply:_,onEdit:H,onSubmit:te,onStatus:le,onDelete:Y,onSticky:ve,onLike:se},null,8,["root-id","comment","reply","edit"]))),128))]),f.value==="error"?(s(),m("div",$n,[p("button",{type:"button",class:"wl-btn",onClick:q,textContent:M(y.value.refresh)},null,8,Ln)])):f.value==="loading"?(s(),m("div",En,[O(L(me),{size:30})])):g.value.length?C.value<u.value?(s(),m("div",An,[p("button",{type:"button",class:"wl-btn",onClick:F,textContent:M(y.value.more)},null,8,Rn)])):I("v-if",!0):(s(),m("div",{key:3,class:"wl-empty",textContent:M(y.value.sofa)},null,8,In)),w.value.copyright?(s(),m("div",xn,[R[0]||(R[0]=ie(" Powered by ")),R[1]||(R[1]=p("a",{href:"https://github.com/walinejs/waline",target:"_blank",rel:"noopener noreferrer"}," Waline ",-1)),ie(" v"+M(L(bt)),1)])):I("v-if",!0)]))}});const Ct=(e,a)=>{a.forEach((t,l)=>{const n=e[l].time;typeof n=="number"&&(t.innerText=n.toString())})},$t=({serverURL:e,path:a=window.location.pathname,selector:t=".waline-pageview-count",update:l=!0,lang:n=navigator.language})=>{const r=new AbortController,f=Array.from(document.querySelectorAll(t)),c=u=>{const w=Me(u);return w!==null&&a!==w},C=u=>_t({serverURL:ke(e),paths:u.map(w=>Me(w)??a),lang:n,signal:r.signal}).then(w=>Ct(w,u)).catch(ut);if(l){const u=f.filter(U=>!c(U)),w=f.filter(c);zt({serverURL:ke(e),path:a,lang:n}).then(U=>Ct(U,u)),w.length&&C(w)}else C(f);return r.abort.bind(r)},Sn=({el:e="#waline",path:a=window.location.pathname,comment:t=!1,pageview:l=!1,...n})=>{const r=e?xe(e):null;if(e&&!r)throw new Error("Option 'el' do not match any domElement!");if(!n.serverURL)throw new Error("Option 'serverURL' is missing!");const f=Le({...n}),c=Le({comment:t,pageview:l,path:a}),C=()=>{c.comment&&dt({serverURL:f.serverURL,path:c.path,...re(c.comment)?{selector:c.comment}:{}})},u=()=>{c.pageview&&$t({serverURL:f.serverURL,path:c.path,...re(c.pageview)?{selector:c.pageview}:{}})},w=r?Dt(()=>x(Mn,{path:c.path,...f})):null;w&&w.mount(r);const U=De(C),g=De(u);return{el:r,update:({comment:S,pageview:j,path:$=window.location.pathname,...y}={})=>{Object.entries(y).forEach(([i,h])=>{f[i]=h}),c.path=$,S!==void 0&&(c.comment=S),j!==void 0&&(c.pageview=j)},destroy:()=>{w==null||w.unmount(),U(),g()}}},jn=({el:e,serverURL:a,count:t,lang:l=navigator.language})=>{var n;const r=be(),f=xe(e),c=new AbortController;return Vt({serverURL:a,count:t,lang:l,signal:c.signal,token:(n=r.value)==null?void 0:n.token}).then(C=>f&&C.length?(f.innerHTML=`<ul class="wl-recent-list">${C.map(u=>`<li class="wl-recent-item"><a href="${u.url}">${u.nick}</a>:${u.comment}</li>`).join("")}</ul>`,{comments:C,destroy:()=>{c.abort(),f.innerHTML=""}}):{comments:C,destroy:()=>c.abort()})},Un=({el:e,serverURL:a,count:t,locale:l,lang:n=navigator.language,mode:r="list"})=>{const f=xe(e),c=new AbortController;return Ht({serverURL:a,pageSize:t,lang:n,signal:c.signal}).then(C=>!f||!C.length?{users:C,destroy:()=>c.abort()}:(l={...nt(n),...typeof l=="object"?l:{}},f.innerHTML=`<ul class="wl-user-${r}">${C.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">${l?l[`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(U=>U).join("")).join("")}</ul>`,{users:C,destroy:()=>{c.abort(),f.innerHTML=""}}))};export{jn as RecentComments,Un as UserList,dt as commentCount,ye as defaultLocales,Sn as init,$t as pageviewCount,bt as version};
|
|
11
|
+
`)}).catch(k=>{alert(k.message),r.value=r.value.replace(o,"")}).then(()=>{Y.value=!1})},X=v=>{var o;if((o=v.dataTransfer)!=null&&o.items){const k=mt(v.dataTransfer.items);k&&z.value&&(Z(k),v.preventDefault())}},ce=v=>{if(v.clipboardData){const o=mt(v.clipboardData.items);o&&z.value&&Z(o)}},Se=()=>{const v=w.value;v.files&&z.value&&Z(v.files[0]).then(()=>{v.value=""})},de=async()=>{var v,o,k,V,b,B;const{serverURL:N,lang:ee,login:pe,wordLimit:_e,requiredMeta:Ve,recaptchaV3Key:He,turnstileKey:Te}=n.value,At=await jl(),T={comment:ve.value,nick:f.value.nick,mail:f.value.mail,link:f.value.link,url:n.value.path,ua:At};if(!t.edit)if((v=c.value)!=null&&v.token)T.nick=c.value.display_name,T.mail=c.value.email,T.link=c.value.url;else{if(pe==="force")return;if(Ve.includes("nick")&&!T.nick)return(o=C.value.nick)==null||o.focus(),alert(d.value.nickError);if(Ve.includes("mail")&&!T.mail||T.mail&&!yl(T.mail))return(k=C.value.mail)==null||k.focus(),alert(d.value.mailError);T.nick||(T.nick=d.value.anonymous)}if(!T.comment){(V=u.value)==null||V.focus();return}if(!le.value)return alert(d.value.wordHint.replace("$0",_e[0].toString()).replace("$1",_e[1].toString()).replace("$2",_.value.toString()));T.comment=vt(T.comment,y.value.map),t.replyId&&t.rootId&&(T.pid=t.replyId,T.rid=t.rootId,T.at=t.replyUser),Y.value=!0;try{He&&(T.recaptchaV3=await Kl(He).execute("social")),Te&&(T.turnstile=await Zl(Te).execute("social"));const ge={serverURL:N,lang:ee,token:(b=c.value)==null?void 0:b.token,comment:T},Ce=await(t.edit?he({objectId:t.edit.objectId,...ge}):Mt(ge));if(Y.value=!1,Ce.errmsg)return alert(Ce.errmsg);l("submit",Ce.data),r.value="",A.value="",await We(),t.replyId&&l("cancelReply"),(B=t.edit)!=null&&B.objectId&&l("cancelEdit")}catch(ge){Y.value=!1,alert(ge.message)}},Lt=v=>{v.preventDefault();const{lang:o,serverURL:k}=n.value;St({serverURL:k,lang:o}).then(V=>{c.value=V,(V.remember?localStorage:sessionStorage).setItem("WALINE_USER",JSON.stringify(V)),l("log")})},Et=()=>{c.value={},localStorage.setItem("WALINE_USER","null"),sessionStorage.setItem("WALINE_USER","null"),l("log")},je=v=>{v.preventDefault();const{lang:o,serverURL:k}=n.value,V=800,b=800,B=(window.innerWidth-V)/2,N=(window.innerHeight-b)/2,ee=new URLSearchParams({lng:o,token:c.value.token}),pe=window.open(`${k}/ui/profile?${ee.toString()}`,"_blank",`width=${V},height=${b},left=${B},top=${N},scrollbars=no,resizable=no,status=no,location=no,toolbar=no,menubar=no`);pe==null||pe.postMessage({type:"TOKEN",data:c.value.token},"*")},It=v=>{var o,k,V,b;!((o=U.value)!=null&&o.contains(v.target))&&!((k=g.value)!=null&&k.contains(v.target))&&(h.value=!1),!((V=S.value)!=null&&V.contains(v.target))&&!((b=j.value)!=null&&b.contains(v.target))&&(F.value=!1)},Ue=async v=>{var o;const{scrollTop:k,clientHeight:V,scrollHeight:b}=v.target,B=(V+k)/b,N=n.value.search,ee=((o=$.value)==null?void 0:o.value)??"";B<.9||H.loading||se.value||(H.loading=!0,(N.more&&H.list.length?await N.more(ee,H.list.length):await N.search(ee)).length?H.list=[...H.list,...N.more&&H.list.length?await N.more(ee,H.list.length):await N.search(ee)]:se.value=!0,H.loading=!1,setTimeout(()=>{v.target.scrollTop=k},50))},ze=qt(v=>{H.list=[],se.value=!1,Ue(v)},300);return ae([n,_],([v,o])=>{const{wordLimit:k}=v;k?o<k[0]&&k[0]!==0?(te.value=k[0],le.value=!1):o>k[1]?(te.value=k[1],le.value=!1):(te.value=k[1],le.value=!0):(te.value=0,le.value=!0)},{immediate:!0}),Oe("click",It),Oe("message",({data:v})=>{!v||v.type!=="profile"||(c.value={...c.value,...v.data},[localStorage,sessionStorage].filter(o=>o.getItem("WALINE_USER")).forEach(o=>o.setItem("WALINE_USER",JSON.stringify(c))))}),ae(F,async v=>{var o;if(!v)return;const k=n.value.search;$.value&&($.value.value=""),H.loading=!0,H.list=await(((o=k.default)==null?void 0:o.call(k))??k.search("")),H.loading=!1}),fe(()=>{var v;(v=t.edit)!=null&&v.objectId&&(r.value=t.edit.orig),ae(()=>r.value,o=>{const{highlighter:k,texRenderer:V}=n.value;ve.value=o,A.value=Rl(o,{emojiMap:y.value.map,highlighter:k,texRenderer:V}),_.value=Sl(o),o?qe(u.value):qe.destroy(u.value)},{immediate:!0}),ae(()=>n.value.emoji,o=>Cl(o).then(k=>{y.value=k}),{immediate:!0})}),(v,o)=>{var k,V;return s(),m("div",{key:L(c).token,class:"wl-comment"},[L(n).login!=="disable"&&R.value&&!((k=v.edit)!=null&&k.objectId)?(s(),m("div",ca,[p("div",ua,[p("button",{type:"submit",class:"wl-logout-btn",title:d.value.logout,onClick:Et},[O(L(pt),{size:14})],8,ma),p("a",{href:"#",class:"wl-login-nick","aria-label":"Profile",title:d.value.profile,onClick:je},[p("img",{src:L(c).avatar,alt:"avatar"},null,8,da)],8,va)]),p("a",{href:"#",class:"wl-login-nick","aria-label":"Profile",title:d.value.profile,onClick:je,textContent:M(L(c).display_name)},null,8,pa)])):I("v-if",!0),p("div",ga,[L(n).login!=="force"&&L(n).meta.length&&!R.value?(s(),m("div",{key:0,class:D(["wl-header",`item${L(n).meta.length}`])},[(s(!0),m(W,null,J(L(n).meta,b=>(s(),m("div",{key:b,class:"wl-header-item"},[p("label",{for:`wl-${b}`,textContent:M(d.value[b]+(L(n).requiredMeta.includes(b)||!L(n).requiredMeta.length?"":`(${d.value.optional})`))},null,8,ha),we(p("input",{id:`wl-${b}`,ref_for:!0,ref:B=>{B&&(C.value[b]=B)},"onUpdate:modelValue":B=>L(f)[b]=B,class:D(["wl-input",`wl-${b}`]),name:b,type:b==="mail"?"email":"text"},null,10,fa),[[Ft,L(f)[b]]])]))),128))],2)):I("v-if",!0),we(p("textarea",{id:"wl-edit",ref_key:"editorRef",ref:u,"onUpdate:modelValue":o[0]||(o[0]=b=>Nt(r)?r.value=b:null),class:"wl-editor",placeholder:v.replyUser?`@${v.replyUser}`:d.value.placeholder,onKeydown:K,onDrop:X,onPaste:ce},null,40,wa),[[Pt,L(r)]]),we(p("div",ya,[o[7]||(o[7]=p("hr",null,null,-1)),p("h4",null,M(d.value.preview)+":",1),p("div",{class:"wl-content",innerHTML:A.value},null,8,ka)],512),[[Be,q.value]]),p("div",ba,[p("div",Ca,[p("a",$a,[O(L(Tl))]),we(p("button",{ref_key:"emojiButtonRef",ref:U,type:"button",class:D(["wl-action",{active:h.value}]),title:d.value.emoji,onClick:o[1]||(o[1]=b=>h.value=!h.value)},[O(L(zl))],10,La),[[Be,y.value.tabs.length]]),L(n).search?(s(),m("button",{key:0,ref_key:"gifButtonRef",ref:S,type:"button",class:D(["wl-action",{active:F.value}]),title:d.value.gif,onClick:o[2]||(o[2]=b=>F.value=!F.value)},[O(L(Wl))],10,Ea)):I("v-if",!0),p("input",{id:"wl-image-upload",ref_key:"imageUploadRef",ref:w,class:"upload","aria-hidden":"true",type:"file",accept:".png,.jpg,.jpeg,.webp,.bmp,.gif",onChange:Se},null,544),z.value?(s(),m("label",{key:1,for:"wl-image-upload",class:"wl-action",title:d.value.uploadImage,"aria-label":d.value.uploadImage},[O(L(_l))],8,Ia)):I("v-if",!0),p("button",{type:"button",class:D(["wl-action",{active:q.value}]),title:d.value.preview,onClick:o[3]||(o[3]=b=>q.value=!q.value)},[O(L(Hl))],10,Aa)]),p("div",Ra,[o[9]||(o[9]=p("div",{class:"wl-captcha-container"},null,-1)),p("div",xa,[ie(M(_.value)+" ",1),L(n).wordLimit?(s(),m("span",Ma,[o[8]||(o[8]=ie(" / ")),p("span",{class:D({illegal:!le.value}),textContent:M(te.value)},null,10,Sa)])):I("v-if",!0),ie(" "+M(d.value.word),1)]),L(n).login!=="disable"&&!R.value?(s(),m("button",{key:0,type:"button",class:"wl-btn",onClick:Lt,textContent:M(d.value.login)},null,8,ja)):I("v-if",!0),L(n).login!=="force"||R.value?(s(),m("button",{key:1,type:"submit",class:"primary wl-btn",title:"Cmd|Ctrl + Enter",disabled:Y.value,onClick:de},[Y.value?(s(),ne(L(me),{key:0,size:16})):(s(),m(W,{key:1},[ie(M(d.value.submit),1)],64))],8,Ua)):I("v-if",!0)]),p("div",{ref_key:"gifPopupRef",ref:j,class:D(["wl-gif-popup",{display:F.value}])},[p("input",{ref_key:"gifSearchInputRef",ref:$,type:"text",placeholder:d.value.gifSearchPlaceholder,onInput:o[4]||(o[4]=(...b)=>L(ze)&&L(ze)(...b))},null,40,za),H.list.length?(s(),ne(sa,{key:0,items:H.list,"column-width":200,gap:6,onInsert:o[5]||(o[5]=b=>G(b)),onScroll:Ue},null,8,["items"])):I("v-if",!0),H.loading?(s(),m("div",_a,[O(L(me),{size:30})])):I("v-if",!0)],2),p("div",{ref_key:"emojiPopupRef",ref:g,class:D(["wl-emoji-popup",{display:h.value}])},[(s(!0),m(W,null,J(y.value.tabs,(b,B)=>(s(),m(W,{key:b.name},[B===i.value?(s(),m("div",Va,[(s(!0),m(W,null,J(b.items,N=>(s(),m("button",{key:N,type:"button",title:N,onClick:ee=>G(`:${N}:`)},[h.value?(s(),m("img",{key:0,class:"wl-emoji",src:y.value.map[N],alt:N,loading:"lazy",referrerPolicy:"no-referrer"},null,8,Ta)):I("v-if",!0)],8,Ha))),128))])):I("v-if",!0)],64))),128)),y.value.tabs.length>1?(s(),m("div",Fa,[(s(!0),m(W,null,J(y.value.tabs,(b,B)=>(s(),m("button",{key:b.name,type:"button",class:D(["wl-tab",{active:i.value===B}]),onClick:N=>i.value=B},[p("img",{class:"wl-emoji",src:b.icon,alt:b.name,title:b.name,loading:"lazy",referrerPolicy:"no-referrer"},null,8,Pa)],10,Na))),128))])):I("v-if",!0)],2)])]),v.replyId||(V=v.edit)!=null&&V.objectId?(s(),m("button",{key:1,type:"button",class:"wl-close",title:d.value.cancelReply,onClick:o[6]||(o[6]=b=>v.replyId?l("cancelReply"):l("cancelEdit"))},[O(L(pt),{size:24})],8,Wa)):I("v-if",!0)])}}});const Ba=["id"],Da={class:"wl-user","aria-hidden":"true"},Oa=["src"],qa={class:"wl-card"},Ga={class:"wl-head"},Ka=["href"],Za={key:1,class:"wl-nick"},Xa=["textContent"],Ja=["textContent"],Ya=["textContent"],Qa=["textContent"],en=["textContent"],tn={class:"wl-comment-actions"},ln=["title"],an=["title"],nn={class:"wl-meta","aria-hidden":"true"},on=["data-value","textContent"],rn={key:0,class:"wl-content"},sn={key:0},cn=["href"],un=["innerHTML"],mn={key:1,class:"wl-admin-actions"},vn={class:"wl-comment-status"},dn=["disabled","onClick","textContent"],pn={key:3,class:"wl-quote"};var gn=ue({__name:"CommentCard",props:{comment:{},edit:{default:null},rootId:{},reply:{default:null}},emits:["log","submit","delete","edit","like","status","sticky","reply"],setup(e,{emit:a}){const t=e,l=a,n=["approved","waiting","spam"],r=$e("config"),f=ht(),c=Gt(),C=be(),u=P(()=>r.value.locale),w=P(()=>{const{link:i}=t.comment;return i?st(i)?i:`https://${i}`:""}),U=P(()=>f.value.includes(t.comment.objectId)),g=P(()=>fl(new Date(t.comment.time),c.value,u.value)),S=P(()=>C.value.type==="administrator"),j=P(()=>t.comment.user_id&&C.value.objectId===t.comment.user_id),$=P(()=>{var i;return t.comment.objectId===((i=t.reply)==null?void 0:i.objectId)}),y=P(()=>{var i;return t.comment.objectId===((i=t.edit)==null?void 0:i.objectId)});return(i,h)=>{var F;const q=Wt("CommentCard",!0);return s(),m("div",{id:i.comment.objectId,class:"wl-card-item"},[p("div",Da,[i.comment.avatar?(s(),m("img",{key:0,class:"wl-user-avatar",src:i.comment.avatar,alt:""},null,8,Oa)):I("v-if",!0),i.comment.type?(s(),ne(L(Pl),{key:1})):I("v-if",!0)]),p("div",qa,[p("div",Ga,[w.value?(s(),m("a",{key:0,class:"wl-nick",href:w.value,target:"_blank",rel:"nofollow noopener noreferrer"},M(i.comment.nick),9,Ka)):(s(),m("span",Za,M(i.comment.nick),1)),i.comment.type==="administrator"?(s(),m("span",{key:2,class:"wl-badge",textContent:M(u.value.admin)},null,8,Xa)):I("v-if",!0),i.comment.label?(s(),m("span",{key:3,class:"wl-badge",textContent:M(i.comment.label)},null,8,Ja)):I("v-if",!0),i.comment.sticky?(s(),m("span",{key:4,class:"wl-badge",textContent:M(u.value.sticky)},null,8,Ya)):I("v-if",!0),typeof i.comment.level=="number"?(s(),m("span",{key:5,class:D(`wl-badge level${i.comment.level}`),textContent:M(u.value[`level${i.comment.level}`]||`Level ${i.comment.level}`)},null,10,Qa)):I("v-if",!0),p("span",{class:"wl-time",textContent:M(g.value)},null,8,en),p("div",tn,[S.value||j.value?(s(),m(W,{key:0},[p("button",{type:"button",class:"wl-edit",onClick:h[0]||(h[0]=A=>l("edit",i.comment))},[O(L(Nl))]),p("button",{type:"button",class:"wl-delete",onClick:h[1]||(h[1]=A=>l("delete",i.comment))},[O(L(Ul))])],64)):I("v-if",!0),p("button",{type:"button",class:"wl-like",title:U.value?u.value.cancelLike:u.value.like,onClick:h[2]||(h[2]=A=>l("like",i.comment))},[O(L(Vl),{active:U.value},null,8,["active"]),ie(" "+M("like"in i.comment?i.comment.like:""),1)],8,ln),p("button",{type:"button",class:D(["wl-reply",{active:$.value}]),title:$.value?u.value.cancelReply:u.value.reply,onClick:h[3]||(h[3]=A=>l("reply",$.value?null:i.comment))},[O(L(Fl))],10,an)])]),p("div",nn,[(s(),m(W,null,J(["addr","browser","os"],A=>(s(),m(W,null,[i.comment[A]?(s(),m("span",{key:A,class:D(`wl-${A}`),"data-value":i.comment[A],textContent:M(i.comment[A])},null,10,on)):I("v-if",!0)],64))),64))]),y.value?I("v-if",!0):(s(),m("div",rn,[i.comment.reply_user?(s(),m("p",sn,[p("a",{href:"#"+i.comment.pid},"@"+M(i.comment.reply_user.nick),9,cn),h[17]||(h[17]=p("span",null,": ",-1))])):I("v-if",!0),p("div",{innerHTML:i.comment.comment},null,8,un)])),S.value&&!y.value?(s(),m("div",mn,[p("span",vn,[(s(),m(W,null,J(n,A=>p("button",{key:A,type:"submit",class:D(`wl-btn wl-${A}`),disabled:i.comment.status===A,onClick:_=>l("status",{status:A,comment:i.comment}),textContent:M(u.value[A])},null,10,dn)),64))]),S.value&&!("rid"in i.comment)?(s(),m("button",{key:0,type:"submit",class:"wl-btn wl-sticky",onClick:h[4]||(h[4]=A=>l("sticky",i.comment))},M(i.comment.sticky?u.value.unsticky:u.value.sticky),1)):I("v-if",!0)])):I("v-if",!0),$.value||y.value?(s(),m("div",{key:2,class:D({"wl-reply-wrapper":$.value,"wl-edit-wrapper":y.value})},[O(kt,{edit:i.edit,"reply-id":(F=i.reply)==null?void 0:F.objectId,"reply-user":i.comment.nick,"root-id":i.rootId,onLog:h[5]||(h[5]=A=>l("log")),onCancelReply:h[6]||(h[6]=A=>l("reply",null)),onCancelEdit:h[7]||(h[7]=A=>l("edit",null)),onSubmit:h[8]||(h[8]=A=>l("submit",A))},null,8,["edit","reply-id","reply-user","root-id"])],2)):I("v-if",!0),"children"in i.comment?(s(),m("div",pn,[(s(!0),m(W,null,J(i.comment.children,A=>(s(),ne(q,{key:A.objectId,comment:A,reply:i.reply,edit:i.edit,"root-id":i.rootId,onLog:h[9]||(h[9]=_=>l("log")),onDelete:h[10]||(h[10]=_=>l("delete",_)),onEdit:h[11]||(h[11]=_=>l("edit",_)),onLike:h[12]||(h[12]=_=>l("like",_)),onReply:h[13]||(h[13]=_=>l("reply",_)),onStatus:h[14]||(h[14]=_=>l("status",_)),onSticky:h[15]||(h[15]=_=>l("sticky",_)),onSubmit:h[16]||(h[16]=_=>l("submit",_))},null,8,["comment","reply","edit","root-id"]))),128))])):I("v-if",!0)])],8,Ba)}}});const bt="3.4.1",hn={"data-waline":""},fn={class:"wl-meta-head"},wn={class:"wl-count"},yn=["textContent"],kn={class:"wl-sort"},bn=["onClick"],Cn={class:"wl-cards"},$n={key:1,class:"wl-operation"},Ln=["textContent"],En={key:2,class:"wl-loading"},In=["textContent"],An={key:4,class:"wl-operation"},Rn=["textContent"],xn={key:5,class:"wl-power"};var Mn=ue({__name:"WalineComment",props:["serverURL","path","meta","requiredMeta","dark","commentSorting","lang","locale","pageSize","wordLimit","emoji","login","highlighter","texRenderer","imageUploader","search","copyright","recaptchaV3Key","turnstileKey","reaction"],setup(e){const a=e,t={latest:"insertedAt_desc",oldest:"insertedAt_asc",hottest:"like_desc"},l=Object.keys(t),n=be(),r=ht(),f=E("loading"),c=E(0),C=E(1),u=E(0),w=P(()=>pl(a)),U=E(w.value.commentSorting),g=E([]),S=E(null),j=E(null),$=P(()=>gl(w.value.dark)),y=P(()=>w.value.locale);Kt($,{id:"waline-darkmode"});let i;const h=d=>{var R;const{serverURL:z,path:G,pageSize:K}=w.value,Z=new AbortController;f.value="loading",i==null||i(),Ut({serverURL:z,lang:w.value.lang,path:G,pageSize:K,sortBy:t[U.value],page:d,signal:Z.signal,token:(R=n.value)==null?void 0:R.token}).then(X=>{f.value="success",c.value=X.count,g.value.push(...X.data),C.value=d,u.value=X.totalPages}).catch(X=>{X.name!=="AbortError"&&(console.error(X.message),f.value="error")}),i=Z.abort.bind(Z)},F=()=>h(C.value+1),q=()=>{c.value=0,g.value=[],h(1)},A=d=>{U.value!==d&&(U.value=d,q())},_=d=>{S.value=d},H=d=>{j.value=d},te=d=>{if(j.value)j.value.comment=d.comment,j.value.orig=d.orig;else if("rid"in d){const R=g.value.find(({objectId:z})=>z===d.rid);if(!R)return;Array.isArray(R.children)||(R.children=[]),R.children.push(d)}else g.value.unshift(d),c.value+=1},le=async({comment:d,status:R})=>{var z;if(d.status===R)return;const{serverURL:G,lang:K}=w.value;await he({serverURL:G,lang:K,token:(z=n.value)==null?void 0:z.token,objectId:d.objectId,comment:{status:R}}),d.status=R},ve=async d=>{var R;if("rid"in d)return;const{serverURL:z,lang:G}=w.value;await he({serverURL:z,lang:G,token:(R=n.value)==null?void 0:R.token,objectId:d.objectId,comment:{sticky:d.sticky?0:1}}),d.sticky=!d.sticky},Y=async({objectId:d})=>{var R;if(!confirm("Are you sure you want to delete this comment?"))return;const{serverURL:z,lang:G}=w.value;await jt({serverURL:z,lang:G,token:(R=n.value)==null?void 0:R.token,objectId:d}),g.value.some((K,Z)=>K.objectId===d?(g.value=g.value.filter((X,ce)=>ce!==Z),!0):K.children.some((X,ce)=>X.objectId===d?(g.value[Z].children=K.children.filter((Se,de)=>de!==ce),!0):!1))},se=async d=>{var R;const{serverURL:z,lang:G}=w.value,{objectId:K}=d,Z=r.value.includes(K);await he({serverURL:z,lang:G,objectId:K,token:(R=n.value)==null?void 0:R.token,comment:{like:!Z}}),Z?r.value=r.value.filter(X=>X!==K):(r.value=[...r.value,K],r.value.length>50&&(r.value=r.value.slice(-50))),d.like=(d.like||0)+(Z?-1:1)};return Bt("config",w),fe(()=>{ae(()=>[a.serverURL,a.path],()=>q(),{immediate:!0})}),Ne(()=>i==null?void 0:i()),(d,R)=>(s(),m("div",hn,[O(ia),!S.value&&!j.value?(s(),ne(kt,{key:0,onLog:q,onSubmit:te})):I("v-if",!0),p("div",fn,[p("div",wn,[c.value?(s(),m("span",{key:0,class:"wl-num",textContent:M(c.value)},null,8,yn)):I("v-if",!0),ie(" "+M(y.value.comment),1)]),p("ul",kn,[(s(!0),m(W,null,J(L(l),z=>(s(),m("li",{key:z,class:D([z===U.value?"active":""]),onClick:G=>A(z)},M(y.value[z]),11,bn))),128))])]),p("div",Cn,[(s(!0),m(W,null,J(g.value,z=>(s(),ne(gn,{key:z.objectId,"root-id":z.objectId,comment:z,reply:S.value,edit:j.value,onLog:q,onReply:_,onEdit:H,onSubmit:te,onStatus:le,onDelete:Y,onSticky:ve,onLike:se},null,8,["root-id","comment","reply","edit"]))),128))]),f.value==="error"?(s(),m("div",$n,[p("button",{type:"button",class:"wl-btn",onClick:q,textContent:M(y.value.refresh)},null,8,Ln)])):f.value==="loading"?(s(),m("div",En,[O(L(me),{size:30})])):g.value.length?C.value<u.value?(s(),m("div",An,[p("button",{type:"button",class:"wl-btn",onClick:F,textContent:M(y.value.more)},null,8,Rn)])):I("v-if",!0):(s(),m("div",{key:3,class:"wl-empty",textContent:M(y.value.sofa)},null,8,In)),w.value.copyright?(s(),m("div",xn,[R[0]||(R[0]=ie(" Powered by ")),R[1]||(R[1]=p("a",{href:"https://github.com/walinejs/waline",target:"_blank",rel:"noopener noreferrer"}," Waline ",-1)),ie(" v"+M(L(bt)),1)])):I("v-if",!0)]))}});const Ct=(e,a)=>{a.forEach((t,l)=>{const n=e[l].time;typeof n=="number"&&(t.innerText=n.toString())})},$t=({serverURL:e,path:a=window.location.pathname,selector:t=".waline-pageview-count",update:l=!0,lang:n=navigator.language})=>{const r=new AbortController,f=Array.from(document.querySelectorAll(t)),c=u=>{const w=Me(u);return w!==null&&a!==w},C=u=>_t({serverURL:ke(e),paths:u.map(w=>Me(w)??a),lang:n,signal:r.signal}).then(w=>Ct(w,u)).catch(ut);if(l){const u=f.filter(U=>!c(U)),w=f.filter(c);zt({serverURL:ke(e),path:a,lang:n}).then(U=>Ct(U,u)),w.length&&C(w)}else C(f);return r.abort.bind(r)},Sn=({el:e="#waline",path:a=window.location.pathname,comment:t=!1,pageview:l=!1,...n})=>{const r=e?xe(e):null;if(e&&!r)throw new Error("Option 'el' do not match any domElement!");if(!n.serverURL)throw new Error("Option 'serverURL' is missing!");const f=Le({...n}),c=Le({comment:t,pageview:l,path:a}),C=()=>{c.comment&&dt({serverURL:f.serverURL,path:c.path,...re(c.comment)?{selector:c.comment}:{}})},u=()=>{c.pageview&&$t({serverURL:f.serverURL,path:c.path,...re(c.pageview)?{selector:c.pageview}:{}})},w=r?Dt(()=>x(Mn,{path:c.path,...f})):null;w&&w.mount(r);const U=De(C),g=De(u);return{el:r,update:({comment:S,pageview:j,path:$=window.location.pathname,...y}={})=>{Object.entries(y).forEach(([i,h])=>{f[i]=h}),c.path=$,S!==void 0&&(c.comment=S),j!==void 0&&(c.pageview=j)},destroy:()=>{w==null||w.unmount(),U(),g()}}},jn=({el:e,serverURL:a,count:t,lang:l=navigator.language})=>{var n;const r=be(),f=xe(e),c=new AbortController;return Vt({serverURL:a,count:t,lang:l,signal:c.signal,token:(n=r.value)==null?void 0:n.token}).then(C=>f&&C.length?(f.innerHTML=`<ul class="wl-recent-list">${C.map(u=>`<li class="wl-recent-item"><a href="${u.url}">${u.nick}</a>:${u.comment}</li>`).join("")}</ul>`,{comments:C,destroy:()=>{c.abort(),f.innerHTML=""}}):{comments:C,destroy:()=>c.abort()})},Un=({el:e,serverURL:a,count:t,locale:l,lang:n=navigator.language,mode:r="list"})=>{const f=xe(e),c=new AbortController;return Ht({serverURL:a,pageSize:t,lang:n,signal:c.signal}).then(C=>!f||!C.length?{users:C,destroy:()=>c.abort()}:(l={...nt(n),...typeof l=="object"?l:{}},f.innerHTML=`<ul class="wl-user-${r}">${C.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">${l?l[`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(U=>U).join("")).join("")}</ul>`,{users:C,destroy:()=>{c.abort(),f.innerHTML=""}}))};export{jn as RecentComments,Un as UserList,dt as commentCount,ye as defaultLocales,Sn as init,$t as pageviewCount,bt as version};
|
|
12
12
|
//# sourceMappingURL=slim.js.map
|
package/dist/waline.js
CHANGED
|
@@ -80,5 +80,5 @@ ${t}</tr>
|
|
|
80
80
|
`+this.renderer.text(c);n?r+=this.renderer.paragraph({type:"paragraph",raw:u,text:u,tokens:[{type:"text",raw:u,text:u,escaped:!0}]}):r+=u;continue}default:{const c='Token with "'+a.type+'" type was not found.';if(this.options.silent)return console.error(c),"";throw new Error(c)}}}return r}parseInline(t,n=this.renderer){var i,s;let r="";for(let l=0;l<t.length;l++){const o=t[l];if((s=(i=this.options.extensions)==null?void 0:i.renderers)!=null&&s[o.type]){const c=this.options.extensions.renderers[o.type].call({parser:this},o);if(c!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(o.type)){r+=c||"";continue}}const a=o;switch(a.type){case"escape":{r+=n.text(a);break}case"html":{r+=n.html(a);break}case"link":{r+=n.link(a);break}case"image":{r+=n.image(a);break}case"strong":{r+=n.strong(a);break}case"em":{r+=n.em(a);break}case"codespan":{r+=n.codespan(a);break}case"br":{r+=n.br(a);break}case"del":{r+=n.del(a);break}case"text":{r+=n.text(a);break}default:{const c='Token with "'+a.type+'" type was not found.';if(this.options.silent)return console.error(c),"";throw new Error(c)}}}return r}}class An{options;block;constructor(t){this.options=t||Pt}preprocess(t){return t}postprocess(t){return t}processAllTokens(t){return t}provideLexer(){return this.block?Ge.lex:Ge.lexInline}provideParser(){return this.block?Ze.parse:Ze.parseInline}}$i(An,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens"]));class Vl{defaults=di();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=Ze;Renderer=br;TextRenderer=wi;Lexer=Ge;Tokenizer=vr;Hooks=An;constructor(...t){this.use(...t)}walkTokens(t,n){var i,s;let r=[];for(const l of t)switch(r=r.concat(n.call(this,l)),l.type){case"table":{const o=l;for(const a of o.header)r=r.concat(this.walkTokens(a.tokens,n));for(const a of o.rows)for(const c of a)r=r.concat(this.walkTokens(c.tokens,n));break}case"list":{const o=l;r=r.concat(this.walkTokens(o.items,n));break}default:{const o=l;(s=(i=this.defaults.extensions)==null?void 0:i.childTokens)!=null&&s[o.type]?this.defaults.extensions.childTokens[o.type].forEach(a=>{const c=o[a].flat(1/0);r=r.concat(this.walkTokens(c,n))}):o.tokens&&(r=r.concat(this.walkTokens(o.tokens,n)))}}return r}use(...t){const n=this.defaults.extensions||{renderers:{},childTokens:{}};return t.forEach(r=>{const i={...r};if(i.async=this.defaults.async||i.async||!1,r.extensions&&(r.extensions.forEach(s=>{if(!s.name)throw new Error("extension name required");if("renderer"in s){const l=n.renderers[s.name];l?n.renderers[s.name]=function(...o){let a=s.renderer.apply(this,o);return a===!1&&(a=l.apply(this,o)),a}:n.renderers[s.name]=s.renderer}if("tokenizer"in s){if(!s.level||s.level!=="block"&&s.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");const l=n[s.level];l?l.unshift(s.tokenizer):n[s.level]=[s.tokenizer],s.start&&(s.level==="block"?n.startBlock?n.startBlock.push(s.start):n.startBlock=[s.start]:s.level==="inline"&&(n.startInline?n.startInline.push(s.start):n.startInline=[s.start]))}"childTokens"in s&&s.childTokens&&(n.childTokens[s.name]=s.childTokens)}),i.extensions=n),r.renderer){const s=this.defaults.renderer||new br(this.defaults);for(const l in r.renderer){if(!(l in s))throw new Error(`renderer '${l}' does not exist`);if(["options","parser"].includes(l))continue;const o=l,a=r.renderer[o],c=s[o];s[o]=(...u)=>{let h=a.apply(s,u);return h===!1&&(h=c.apply(s,u)),h||""}}i.renderer=s}if(r.tokenizer){const s=this.defaults.tokenizer||new vr(this.defaults);for(const l in r.tokenizer){if(!(l in s))throw new Error(`tokenizer '${l}' does not exist`);if(["options","rules","lexer"].includes(l))continue;const o=l,a=r.tokenizer[o],c=s[o];s[o]=(...u)=>{let h=a.apply(s,u);return h===!1&&(h=c.apply(s,u)),h}}i.tokenizer=s}if(r.hooks){const s=this.defaults.hooks||new An;for(const l in r.hooks){if(!(l in s))throw new Error(`hook '${l}' does not exist`);if(["options","block"].includes(l))continue;const o=l,a=r.hooks[o],c=s[o];An.passThroughHooks.has(l)?s[o]=u=>{if(this.defaults.async)return Promise.resolve(a.call(s,u)).then(d=>c.call(s,d));const h=a.call(s,u);return c.call(s,h)}:s[o]=(...u)=>{let h=a.apply(s,u);return h===!1&&(h=c.apply(s,u)),h}}i.hooks=s}if(r.walkTokens){const s=this.defaults.walkTokens,l=r.walkTokens;i.walkTokens=function(o){let a=[];return a.push(l.call(this,o)),s&&(a=a.concat(s.call(this,o))),a}}this.defaults={...this.defaults,...i}}),this}setOptions(t){return this.defaults={...this.defaults,...t},this}lexer(t,n){return Ge.lex(t,n??this.defaults)}parser(t,n){return Ze.parse(t,n??this.defaults)}parseMarkdown(t){return(r,i)=>{const s={...i},l={...this.defaults,...s},o=this.onError(!!l.silent,!!l.async);if(this.defaults.async===!0&&s.async===!1)return o(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof r>"u"||r===null)return o(new Error("marked(): input parameter is undefined or null"));if(typeof r!="string")return o(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(r)+", string expected"));l.hooks&&(l.hooks.options=l,l.hooks.block=t);const a=l.hooks?l.hooks.provideLexer():t?Ge.lex:Ge.lexInline,c=l.hooks?l.hooks.provideParser():t?Ze.parse:Ze.parseInline;if(l.async)return Promise.resolve(l.hooks?l.hooks.preprocess(r):r).then(u=>a(u,l)).then(u=>l.hooks?l.hooks.processAllTokens(u):u).then(u=>l.walkTokens?Promise.all(this.walkTokens(u,l.walkTokens)).then(()=>u):u).then(u=>c(u,l)).then(u=>l.hooks?l.hooks.postprocess(u):u).catch(o);try{l.hooks&&(r=l.hooks.preprocess(r));let u=a(r,l);l.hooks&&(u=l.hooks.processAllTokens(u)),l.walkTokens&&this.walkTokens(u,l.walkTokens);let h=c(u,l);return l.hooks&&(h=l.hooks.postprocess(h)),h}catch(u){return o(u)}}}onError(t,n){return r=>{if(r.message+=`
|
|
81
81
|
Please report this to https://github.com/markedjs/marked.`,t){const i="<p>An error occurred:</p><pre>"+nt(r.message+"",!0)+"</pre>";return n?Promise.resolve(i):i}if(n)return Promise.reject(r);throw r}}}const jt=new Vl;function pe(e,t){return jt.parse(e,t)}pe.options=pe.setOptions=function(e){return jt.setOptions(e),pe.defaults=jt.defaults,Ll(pe.defaults),pe},pe.getDefaults=di,pe.defaults=Pt,pe.use=function(...e){return jt.use(...e),pe.defaults=jt.defaults,Ll(pe.defaults),pe},pe.walkTokens=function(e,t){return jt.walkTokens(e,t)},pe.parseInline=jt.parseInline,pe.Parser=Ze,pe.parser=Ze.parse,pe.Renderer=br,pe.TextRenderer=wi,pe.Lexer=Ge,pe.lexer=Ge.lex,pe.Tokenizer=vr,pe.Hooks=An,pe.parse=pe;function ef(e){if(typeof e=="function"&&(e={highlight:e}),!e||typeof e.highlight!="function")throw new Error("Must provide highlight function");return typeof e.langPrefix!="string"&&(e.langPrefix="language-"),typeof e.emptyLangClass!="string"&&(e.emptyLangClass=""),{async:!!e.async,walkTokens(t){if(t.type!=="code")return;const n=Wl(t.lang);if(e.async)return Promise.resolve(e.highlight(t.text,n,t.lang||"")).then(ql(t));const r=e.highlight(t.text,n,t.lang||"");if(r instanceof Promise)throw new Error("markedHighlight is not set to async but the highlight function is async. Set the async option to true on markedHighlight to await the async highlight function.");ql(t)(r)},useNewRenderer:!0,renderer:{code(t,n,r){typeof t=="object"&&(r=t.escaped,n=t.lang,t=t.text);const i=Wl(n),s=i?e.langPrefix+Jl(i):e.emptyLangClass,l=s?` class="${s}"`:"";return t=t.replace(/\n$/,""),`<pre><code${l}>${r?t:Jl(t,!0)}
|
|
82
82
|
</code></pre>`}}}}function Wl(e){return(e||"").match(/\S*/)[0]}function ql(e){return t=>{typeof t=="string"&&t!==e.text&&(e.escaped=!0,e.text=t)}}const Kl=/[&<>"']/,tf=new RegExp(Kl.source,"g"),Gl=/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,nf=new RegExp(Gl.source,"g"),rf={"&":"&","<":"<",">":">",'"':""","'":"'"},Zl=e=>rf[e];function Jl(e,t){if(t){if(Kl.test(e))return e.replace(tf,Zl)}else if(Gl.test(e))return e.replace(nf,Zl);return e}const sf=/\$.*?\$/,lf=/^\$(.*?)\$/,of=/^(?:\s{0,3})\$\$((?:[^\n]|\n[^\n])+?)\n{0,1}\$\$/,af=e=>[{name:"blockMath",level:"block",tokenizer(t){const n=of.exec(t);if(n!==null)return{type:"html",raw:n[0],text:e(!0,n[1])}}},{name:"inlineMath",level:"inline",start(t){const n=t.search(sf);return n!==-1?n:t.length},tokenizer(t){const n=lf.exec(t);if(n!==null)return{type:"html",raw:n[0],text:e(!1,n[1])}}}],Yl=(e="",t={})=>e.replace(/:(.+?):/g,(n,r)=>t[r]?`<img class="wl-emoji" src="${t[r]}" alt="${r}">`:n),cf=(e,{emojiMap:t,highlighter:n,texRenderer:r})=>{const i=new Vl;if(i.setOptions({breaks:!0}),n&&i.use(ef({highlight:n})),r){const s=af(r);i.use({extensions:s})}return i.parse(Yl(e,t))},ki=e=>{const{path:t}=e.dataset;return t!=null&&t.length?t:null},uf=e=>e.match(/[\w\d\s,.\u00C0-\u024F\u0400-\u04FF]+/giu),ff=e=>e.match(/[\u4E00-\u9FD5]/gu),hf=e=>{var t,n;return(((t=uf(e))==null?void 0:t.reduce((r,i)=>r+(["",",","."].includes(i.trim())?0:i.trim().split(/\s+/u).length),0))??0)+(((n=ff(e))==null?void 0:n.length)??0)},df=async()=>{if(!navigator)return"";const{userAgentData:e}=navigator;let t=navigator.userAgent;if(!e||e.platform!=="Windows")return t;const{platformVersion:n}=await e.getHighEntropyValues(["platformVersion"]);return n&&parseInt(n.split(".")[0])>=13&&(t=t.replace("Windows NT 10.0","Windows NT 11.0")),t},Ql=({serverURL:e,path:t=window.location.pathname,selector:n=".waline-comment-count",lang:r=navigator.language})=>{const i=new AbortController,s=document.querySelectorAll(n);return s.length&&Ti({serverURL:jn(e),paths:Array.from(s).map(l=>Zi(ki(l)??t)),lang:r,signal:i.signal}).then(l=>{s.forEach((o,a)=>{o.innerText=l[a].toString()})}).catch(El),i.abort.bind(i)},Xl=({size:e})=>ne("svg",{class:"wl-close-icon",viewBox:"0 0 1024 1024",width:e,height:e},[ne("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"}),ne("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"})]),pf=()=>ne("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},ne("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"})),gf=()=>ne("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},ne("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"})),mf=()=>ne("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},[ne("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"}),ne("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"})]),vf=({active:e=!1})=>ne("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},[ne("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"})]),bf=()=>ne("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},[ne("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"}),ne("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"})]),yf=()=>ne("svg",{width:"16",height:"16",ariaHidden:"true"},ne("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"})),wf=()=>ne("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},ne("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"})),kf=()=>ne("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},ne("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"})),xf=()=>ne("svg",{class:"verified-icon",viewBox:"0 0 1024 1024",width:"14",height:"14"},ne("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"})),En=({size:e=100})=>ne("svg",{width:e,height:e,viewBox:"0 0 100 100",preserveAspectRatio:"xMidYMid"},ne("circle",{cx:50,cy:50,fill:"none",stroke:"currentColor",strokeWidth:"4",r:"40","stroke-dasharray":"85 30"},ne("animateTransform",{attributeName:"transform",type:"rotate",repeatCount:"indefinite",dur:"1s",values:"0 50 50;360 50 50",keyTimes:"0;1"}))),_f=()=>ne("svg",{width:24,height:24,fill:"currentcolor",viewBox:"0 0 24 24"},[ne("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"}),ne("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"})]),Cf=()=>Jt("WALINE_USER_META",{nick:"",mail:"",link:""}),$f=()=>Jt("WALINE_COMMENT_BOX_EDITOR",""),Sf="WALINE_LIKE";let eo=null;const to=()=>eo??(eo=Jt(Sf,[])),Rf="WALINE_REACTION";let no=null;const Af=()=>no??(no=Jt(Rf,{}));var xi={},dt={},pt={},ro;function io(){if(ro)return pt;ro=1;var e=pt&&pt.__awaiter||function(r,i,s,l){function o(a){return a instanceof s?a:new s(function(c){c(a)})}return new(s||(s=Promise))(function(a,c){function u(g){try{d(l.next(g))}catch(k){c(k)}}function h(g){try{d(l.throw(g))}catch(k){c(k)}}function d(g){g.done?a(g.value):o(g.value).then(u,h)}d((l=l.apply(r,i||[])).next())})},t=pt&&pt.__generator||function(r,i){var s={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},l,o,a,c;return c={next:u(0),throw:u(1),return:u(2)},typeof Symbol=="function"&&(c[Symbol.iterator]=function(){return this}),c;function u(d){return function(g){return h([d,g])}}function h(d){if(l)throw new TypeError("Generator is already executing.");for(;c&&(c=0,d[0]&&(s=0)),s;)try{if(l=1,o&&(a=d[0]&2?o.return:d[0]?o.throw||((a=o.return)&&a.call(o),0):o.next)&&!(a=a.call(o,d[1])).done)return a;switch(o=0,a&&(d=[d[0]&2,a.value]),d[0]){case 0:case 1:a=d;break;case 4:return s.label++,{value:d[1],done:!1};case 5:s.label++,o=d[1],d=[0];continue;case 7:d=s.ops.pop(),s.trys.pop();continue;default:if(a=s.trys,!(a=a.length>0&&a[a.length-1])&&(d[0]===6||d[0]===2)){s=0;continue}if(d[0]===3&&(!a||d[1]>a[0]&&d[1]<a[3])){s.label=d[1];break}if(d[0]===6&&s.label<a[1]){s.label=a[1],a=d;break}if(a&&s.label<a[2]){s.label=a[2],s.ops.push(d);break}a[2]&&s.ops.pop(),s.trys.pop();continue}d=i.call(r,s)}catch(g){d=[6,g],o=0}finally{l=a=0}if(d[0]&5)throw d[1];return{value:d[0]?d[1]:void 0,done:!0}}};Object.defineProperty(pt,"__esModule",{value:!0}),pt.ReCaptchaInstance=void 0;var n=function(){function r(i,s,l){this.siteKey=i,this.recaptchaID=s,this.recaptcha=l,this.styleContainer=null}return r.prototype.execute=function(i){return e(this,void 0,void 0,function(){var s;return t(this,function(l){switch(l.label){case 0:return this.recaptcha.enterprise?[4,this.recaptcha.enterprise.execute(this.recaptchaID,{action:i})]:[3,2];case 1:return s=l.sent(),[3,4];case 2:return[4,this.recaptcha.execute(this.recaptchaID,{action:i})];case 3:s=l.sent(),l.label=4;case 4:return[2,s]}})})},r.prototype.getSiteKey=function(){return this.siteKey},r.prototype.hideBadge=function(){this.styleContainer===null&&(this.styleContainer=document.createElement("style"),this.styleContainer.innerHTML=".grecaptcha-badge{visibility:hidden !important;}",document.head.appendChild(this.styleContainer))},r.prototype.showBadge=function(){this.styleContainer!==null&&(document.head.removeChild(this.styleContainer),this.styleContainer=null)},r}();return pt.ReCaptchaInstance=n,pt}var so;function Ef(){if(so)return dt;so=1;var e=dt&&dt.__assign||function(){return e=Object.assign||function(i){for(var s,l=1,o=arguments.length;l<o;l++){s=arguments[l];for(var a in s)Object.prototype.hasOwnProperty.call(s,a)&&(i[a]=s[a])}return i},e.apply(this,arguments)};Object.defineProperty(dt,"__esModule",{value:!0}),dt.getInstance=dt.load=void 0;var t=io(),n;(function(i){i[i.NOT_LOADED=0]="NOT_LOADED",i[i.LOADING=1]="LOADING",i[i.LOADED=2]="LOADED"})(n||(n={}));var r=function(){function i(){}return i.load=function(s,l){if(l===void 0&&(l={}),typeof document>"u")return Promise.reject(new Error("This is a library for the browser!"));if(i.getLoadingState()===n.LOADED)return i.instance.getSiteKey()===s?Promise.resolve(i.instance):Promise.reject(new Error("reCAPTCHA already loaded with different site key!"));if(i.getLoadingState()===n.LOADING)return s!==i.instanceSiteKey?Promise.reject(new Error("reCAPTCHA already loaded with different site key!")):new Promise(function(a,c){i.successfulLoadingConsumers.push(function(u){return a(u)}),i.errorLoadingRunnable.push(function(u){return c(u)})});i.instanceSiteKey=s,i.setLoadingState(n.LOADING);var o=new i;return new Promise(function(a,c){o.loadScript(s,l.useRecaptchaNet||!1,l.useEnterprise||!1,l.renderParameters?l.renderParameters:{},l.customUrl).then(function(){i.setLoadingState(n.LOADED);var u=o.doExplicitRender(grecaptcha,s,l.explicitRenderParameters?l.explicitRenderParameters:{},l.useEnterprise||!1),h=new t.ReCaptchaInstance(s,u,grecaptcha);i.successfulLoadingConsumers.forEach(function(d){return d(h)}),i.successfulLoadingConsumers=[],l.autoHideBadge&&h.hideBadge(),i.instance=h,a(h)}).catch(function(u){i.errorLoadingRunnable.forEach(function(h){return h(u)}),i.errorLoadingRunnable=[],c(u)})})},i.getInstance=function(){return i.instance},i.setLoadingState=function(s){i.loadingState=s},i.getLoadingState=function(){return i.loadingState===null?n.NOT_LOADED:i.loadingState},i.prototype.loadScript=function(s,l,o,a,c){var u=this;l===void 0&&(l=!1),o===void 0&&(o=!1),a===void 0&&(a={}),c===void 0&&(c="");var h=document.createElement("script");h.setAttribute("recaptcha-v3-script",""),h.setAttribute("async",""),h.setAttribute("defer","");var d="https://www.google.com/recaptcha/api.js";l?o?d="https://recaptcha.net/recaptcha/enterprise.js":d="https://recaptcha.net/recaptcha/api.js":o&&(d="https://www.google.com/recaptcha/enterprise.js"),c&&(d=c),a.render&&(a.render=void 0);var g=this.buildQueryString(a);return h.src=d+"?render=explicit"+g,new Promise(function(k,v){h.addEventListener("load",u.waitForScriptToLoad(function(){k(h)},o),!1),h.onerror=function($){i.setLoadingState(n.NOT_LOADED),v($)},document.head.appendChild(h)})},i.prototype.buildQueryString=function(s){var l=Object.keys(s);return l.length<1?"":"&"+Object.keys(s).filter(function(o){return!!s[o]}).map(function(o){return o+"="+s[o]}).join("&")},i.prototype.waitForScriptToLoad=function(s,l){var o=this;return function(){window.grecaptcha===void 0?setTimeout(function(){o.waitForScriptToLoad(s,l)},i.SCRIPT_LOAD_DELAY):l?window.grecaptcha.enterprise.ready(function(){s()}):window.grecaptcha.ready(function(){s()})}},i.prototype.doExplicitRender=function(s,l,o,a){var c=e({sitekey:l},o);return o.container?a?s.enterprise.render(o.container,c):s.render(o.container,c):a?s.enterprise.render(c):s.render(c)},i.loadingState=null,i.instance=null,i.instanceSiteKey=null,i.successfulLoadingConsumers=[],i.errorLoadingRunnable=[],i.SCRIPT_LOAD_DELAY=25,i}();return dt.load=r.load,dt.getInstance=r.getInstance,dt}var lo;function Tf(){return lo||(lo=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.ReCaptchaInstance=e.getInstance=e.load=void 0;var t=Ef();Object.defineProperty(e,"load",{enumerable:!0,get:function(){return t.load}}),Object.defineProperty(e,"getInstance",{enumerable:!0,get:function(){return t.getInstance}});var n=io();Object.defineProperty(e,"ReCaptchaInstance",{enumerable:!0,get:function(){return n.ReCaptchaInstance}})}(xi)),xi}var Lf=Tf();const oo={},If=e=>{const t=oo[e]??(oo[e]=Lf.load(e,{useRecaptchaNet:!0,autoHideBadge:!0}));return{execute:n=>t.then(r=>r.execute(n))}},Mf=e=>({execute:async t=>{const{load:n}=bu("https://challenges.cloudflare.com/turnstile/v0/api.js",void 0,{async:!1});await n();const r=window==null?void 0:window.turnstile;return new Promise(i=>{r==null||r.ready(()=>{r==null||r.render(".wl-captcha-container",{sitekey:e,action:t,size:"compact",callback:i})})})}}),Of="WALINE_USER";let ao=null;const yr=()=>ao??(ao=Jt(Of,{})),Pf={key:0,class:"wl-reaction"},jf=["textContent"],zf={class:"wl-reaction-list"},Ff=["onClick"],Df={class:"wl-reaction-img"},Hf=["src","alt"],Nf=["textContent"],Uf=["textContent"];var Bf=dn({__name:"ArticleReaction",setup(e,{expose:t}){t();const n=Af(),r=Qn("config"),i=W(-1),s=W([]),l=_e(()=>r.value.locale),o=_e(()=>r.value.reaction.length>0),a=_e(()=>{const{reaction:d,path:g}=r.value;return d.map((k,v)=>({icon:k,desc:l.value[`reaction${v}`],active:n.value[g]===v}))});let c;const u=async()=>{if(!o.value)return;const{serverURL:d,lang:g,path:k,reaction:v}=r.value,$=new AbortController;c=$.abort.bind($);const b=await kr({serverURL:d,lang:g,paths:[k],type:v.map((C,N)=>`reaction${N}`),signal:$.signal});s.value=v.map((C,N)=>b[0][`reaction${N}`])},h=async d=>{if(i.value===-1){const{serverURL:g,lang:k,path:v}=r.value,$=n.value[v];i.value=d,$!==void 0&&(await On({serverURL:g,lang:k,path:v,type:`reaction${$}`,action:"desc"}),s.value[$]=Math.max(s.value[$]-1,0)),$!==d&&(await On({serverURL:g,lang:k,path:v,type:`reaction${d}`}),s.value[d]=(s.value[d]||0)+1),$===d?delete n.value[v]:n.value[v]=d,i.value=-1}};return gn(()=>{Ve(()=>[r.value.serverURL,r.value.path],()=>{u()},{immediate:!0})}),Jr(()=>c==null?void 0:c()),(d,g)=>a.value.length?(I(),P("div",Pf,[H("div",{class:"wl-reaction-title",textContent:X(l.value.reactionTitle)},null,8,jf),H("ul",zf,[(I(!0),P(he,null,Be(a.value,({active:k,icon:v,desc:$},b)=>(I(),P("li",{key:b,class:ve(["wl-reaction-item",{active:k}]),onClick:C=>h(b)},[H("div",Df,[H("img",{src:v,alt:$},null,8,Hf),i.value===b?(I(),at(q(En),{key:0,class:"wl-reaction-loading"})):(I(),P("div",{key:1,class:"wl-reaction-votes",textContent:X(s.value[b]||0)},null,8,Nf))]),H("div",{class:"wl-reaction-text",textContent:X($)},null,8,Uf)],10,Ff))),128))])])):Q("v-if",!0)}}),Tn=new Map;function Vf(e){var t=Tn.get(e);t&&t.destroy()}function Wf(e){var t=Tn.get(e);t&&t.update()}var Ln=null;typeof window>"u"?((Ln=function(e){return e}).destroy=function(e){return e},Ln.update=function(e){return e}):((Ln=function(e,t){return e&&Array.prototype.forEach.call(e.length?e:[e],function(n){return function(r){if(r&&r.nodeName&&r.nodeName==="TEXTAREA"&&!Tn.has(r)){var i,s=null,l=window.getComputedStyle(r),o=(i=r.value,function(){c({testForHeightReduction:i===""||!r.value.startsWith(i),restoreTextAlign:null}),i=r.value}),a=(function(h){r.removeEventListener("autosize:destroy",a),r.removeEventListener("autosize:update",u),r.removeEventListener("input",o),window.removeEventListener("resize",u),Object.keys(h).forEach(function(d){return r.style[d]=h[d]}),Tn.delete(r)}).bind(r,{height:r.style.height,resize:r.style.resize,textAlign:r.style.textAlign,overflowY:r.style.overflowY,overflowX:r.style.overflowX,wordWrap:r.style.wordWrap});r.addEventListener("autosize:destroy",a),r.addEventListener("autosize:update",u),r.addEventListener("input",o),window.addEventListener("resize",u),r.style.overflowX="hidden",r.style.wordWrap="break-word",Tn.set(r,{destroy:a,update:u}),u()}function c(h){var d,g,k=h.restoreTextAlign,v=k===void 0?null:k,$=h.testForHeightReduction,b=$===void 0||$,C=l.overflowY;if(r.scrollHeight!==0&&(l.resize==="vertical"?r.style.resize="none":l.resize==="both"&&(r.style.resize="horizontal"),b&&(d=function(E){for(var j=[];E&&E.parentNode&&E.parentNode instanceof Element;)E.parentNode.scrollTop&&j.push([E.parentNode,E.parentNode.scrollTop]),E=E.parentNode;return function(){return j.forEach(function(K){var z=K[0],G=K[1];z.style.scrollBehavior="auto",z.scrollTop=G,z.style.scrollBehavior=null})}}(r),r.style.height=""),g=l.boxSizing==="content-box"?r.scrollHeight-(parseFloat(l.paddingTop)+parseFloat(l.paddingBottom)):r.scrollHeight+parseFloat(l.borderTopWidth)+parseFloat(l.borderBottomWidth),l.maxHeight!=="none"&&g>parseFloat(l.maxHeight)?(l.overflowY==="hidden"&&(r.style.overflow="scroll"),g=parseFloat(l.maxHeight)):l.overflowY!=="hidden"&&(r.style.overflow="hidden"),r.style.height=g+"px",v&&(r.style.textAlign=v),d&&d(),s!==g&&(r.dispatchEvent(new Event("autosize:resized",{bubbles:!0})),s=g),C!==l.overflow&&!v)){var N=l.textAlign;l.overflow==="hidden"&&(r.style.textAlign=N==="start"?"end":"start"),c({restoreTextAlign:N,testForHeightReduction:!0})}}function u(){c({testForHeightReduction:!0,restoreTextAlign:null})}}(n)}),e}).destroy=function(e){return e&&Array.prototype.forEach.call(e.length?e:[e],Vf),e},Ln.update=function(e){return e&&Array.prototype.forEach.call(e.length?e:[e],Wf),e});var co=Ln;const qf=["data-index"],Kf=["src","title","onClick"];var Gf=dn({__name:"ImageWall",props:{items:{default:()=>[]},columnWidth:{default:300},gap:{default:0}},emits:["insert"],setup(e,{expose:t}){const n=e;t();let r=null;const i=W(null),s=W({}),l=W([]),o=()=>{const d=Math.floor((i.value.getBoundingClientRect().width+n.gap)/(n.columnWidth+n.gap));return d>0?d:1},a=d=>new Array(d).fill(null).map(()=>[]),c=async d=>{var g;if(d>=n.items.length)return;await qt();const k=Array.from(((g=i.value)==null?void 0:g.children)??[]).reduce((v,$)=>$.getBoundingClientRect().height<v.getBoundingClientRect().height?$:v);l.value[Number(k.dataset.index)].push(d),await c(d+1)},u=async(d=!1)=>{if(l.value.length===o()&&!d)return;l.value=a(o());const g=window.scrollY;await c(0),window.scrollTo({top:g})},h=d=>{s.value[d.target.src]=!0};return gn(()=>{u(!0),r=new ResizeObserver(()=>{u()}),r.observe(i.value),Ve(()=>[n.items],()=>{s.value={},u(!0)}),Ve(()=>[n.columnWidth,n.gap],()=>{u()})}),Pa(()=>r.unobserve(i.value)),(d,g)=>(I(),P("div",{ref_key:"wall",ref:i,class:"wl-gallery",style:nn({gap:`${d.gap}px`})},[(I(!0),P(he,null,Be(l.value,(k,v)=>(I(),P("div",{key:v,class:"wl-gallery-column","data-index":v,style:nn({gap:`${d.gap}px`})},[(I(!0),P(he,null,Be(k,$=>(I(),P(he,{key:$},[s.value[d.items[$].src]?Q("v-if",!0):(I(),at(q(En),{key:0,size:36,style:{margin:"20px auto"}})),H("img",{class:"wl-gallery-item",src:d.items[$].src,title:d.items[$].title,loading:"lazy",onLoad:h,onClick:b=>d.$emit("insert",``)},null,40,Kf)],64))),128))],12,qf))),128))],4))}});const Zf={key:0,class:"wl-login-info"},Jf={class:"wl-avatar"},Yf=["title"],Qf=["title"],Xf=["src"],eh=["title","textContent"],th={class:"wl-panel"},nh=["for","textContent"],rh=["id","onUpdate:modelValue","name","type"],ih=["placeholder"],sh={class:"wl-preview"},lh=["innerHTML"],oh={class:"wl-footer"},ah={class:"wl-actions"},ch={href:"https://guides.github.com/features/mastering-markdown/",title:"Markdown Guide","aria-label":"Markdown is supported",class:"wl-action",target:"_blank",rel:"noopener noreferrer"},uh=["title"],fh=["title"],hh=["title","aria-label"],dh=["title"],ph={class:"wl-info"},gh={class:"wl-text-number"},mh={key:0},vh=["textContent"],bh=["textContent"],yh=["disabled"],wh=["placeholder"],kh={key:1,class:"wl-loading"},xh={key:0,class:"wl-tab-wrapper"},_h=["title","onClick"],Ch=["src","alt"],$h={key:0,class:"wl-tabs"},Sh=["onClick"],Rh=["src","alt","title"],Ah=["title"];var uo=dn({__name:"CommentBox",props:{edit:{default:null},rootId:{default:""},replyId:{default:""},replyUser:{default:""}},emits:["log","cancelEdit","cancelReply","submit"],setup(e,{emit:t}){const n=e,r=t,i=Qn("config"),s=$f(),l=Cf(),o=yr(),a=W({}),c=W(null),u=W(null),h=W(null),d=W(null),g=W(null),k=W(null),v=W(null),$=W({tabs:[],map:{}}),b=W(0),C=W(!1),N=W(!1),E=W(!1),j=W(""),K=W(0),z=cn({loading:!0,list:[]}),G=W(0),Ie=W(!1),Z=W(""),re=W(!1),me=W(!1),F=_e(()=>i.value.locale),Y=_e(()=>{var O;return!!((O=o.value)!=null&&O.token)}),se=_e(()=>i.value.imageUploader!==!1),ke=O=>{const A=c.value,U=A.selectionStart,de=A.selectionEnd||0,f=A.scrollTop;s.value=A.value.substring(0,U)+O+A.value.substring(de,A.value.length),A.focus(),A.selectionStart=U+O.length,A.selectionEnd=U+O.length,A.scrollTop=f},be=O=>{if(re.value)return;const A=O.key;(O.ctrlKey||O.metaKey)&&A==="Enter"&&Oe()},ye=O=>{const A=`![${i.value.locale.uploading} ${O.name}]()`;return ke(A),re.value=!0,Promise.resolve().then(()=>i.value.imageUploader(O)).then(U=>{s.value=s.value.replace(A,`\r
|
|
83
|
-
`)}).catch(U=>{alert(U.message),s.value=s.value.replace(A,"")}).then(()=>{re.value=!1})},Re=O=>{var A;if((A=O.dataTransfer)!=null&&A.items){const U=Tl(O.dataTransfer.items);U&&se.value&&(ye(U),O.preventDefault())}},gt=O=>{if(O.clipboardData){const A=Tl(O.clipboardData.items);A&&se.value&&ye(A)}},wt=()=>{const O=u.value;O.files&&se.value&&ye(O.files[0]).then(()=>{O.value=""})},Oe=async()=>{var O,A,U,de,f,p;const{serverURL:m,lang:w,login:y,wordLimit:x,requiredMeta:T,recaptchaV3Key:R,turnstileKey:S}=i.value,_=await df(),M={comment:Z.value,nick:l.value.nick,mail:l.value.mail,link:l.value.link,url:i.value.path,ua:_};if(!n.edit)if((O=o.value)!=null&&O.token)M.nick=o.value.display_name,M.mail=o.value.email,M.link=o.value.url;else{if(y==="force")return;if(T.includes("nick")&&!M.nick)return(A=a.value.nick)==null||A.focus(),alert(F.value.nickError);if(T.includes("mail")&&!M.mail||M.mail&&!Fo(M.mail))return(U=a.value.mail)==null||U.focus(),alert(F.value.mailError);M.nick||(M.nick=F.value.anonymous)}if(!M.comment){(de=c.value)==null||de.focus();return}if(!Ie.value)return alert(F.value.wordHint.replace("$0",x[0].toString()).replace("$1",x[1].toString()).replace("$2",K.value.toString()));M.comment=Yl(M.comment,$.value.map),n.replyId&&n.rootId&&(M.pid=n.replyId,M.rid=n.rootId,M.at=n.replyUser),re.value=!0;try{R&&(M.recaptchaV3=await If(R).execute("social")),S&&(M.turnstile=await Mf(S).execute("social"));const L={serverURL:m,lang:w,token:(f=o.value)==null?void 0:f.token,comment:M},D=await(n.edit?Qt({objectId:n.edit.objectId,...L}):Ai(L));if(re.value=!1,D.errmsg)return alert(D.errmsg);r("submit",D.data),s.value="",j.value="",await qt(),n.replyId&&r("cancelReply"),(p=n.edit)!=null&&p.objectId&&r("cancelEdit")}catch(L){re.value=!1,alert(L.message)}},In=O=>{O.preventDefault();const{lang:A,serverURL:U}=i.value;Li({serverURL:U,lang:A}).then(de=>{o.value=de,(de.remember?localStorage:sessionStorage).setItem("WALINE_USER",JSON.stringify(de)),r("log")})},wr=()=>{o.value={},localStorage.setItem("WALINE_USER","null"),sessionStorage.setItem("WALINE_USER","null"),r("log")},Mn=O=>{O.preventDefault();const{lang:A,serverURL:U}=i.value,de=800,f=800,p=(window.innerWidth-de)/2,m=(window.innerHeight-f)/2,w=new URLSearchParams({lng:A,token:o.value.token}),y=window.open(`${U}/ui/profile?${w.toString()}`,"_blank",`width=${de},height=${f},left=${p},top=${m},scrollbars=no,resizable=no,status=no,location=no,toolbar=no,menubar=no`);y==null||y.postMessage({type:"TOKEN",data:o.value.token},"*")},kt=O=>{var A,U,de,f;!((A=h.value)!=null&&A.contains(O.target))&&!((U=d.value)!=null&&U.contains(O.target))&&(C.value=!1),!((de=g.value)!=null&&de.contains(O.target))&&!((f=k.value)!=null&&f.contains(O.target))&&(N.value=!1)},xt=async O=>{var A;const{scrollTop:U,clientHeight:de,scrollHeight:f}=O.target,p=(de+U)/f,m=i.value.search,w=((A=v.value)==null?void 0:A.value)??"";p<.9||z.loading||me.value||(z.loading=!0,(m.more&&z.list.length?await m.more(w,z.list.length):await m.search(w)).length?z.list=[...z.list,...m.more&&z.list.length?await m.more(w,z.list.length):await m.search(w)]:me.value=!0,z.loading=!1,setTimeout(()=>{O.target.scrollTop=U},50))},zt=su(O=>{z.list=[],me.value=!1,xt(O)},300);return Ve([i,K],([O,A])=>{const{wordLimit:U}=O;U?A<U[0]&&U[0]!==0?(G.value=U[0],Ie.value=!1):A>U[1]?(G.value=U[1],Ie.value=!1):(G.value=U[1],Ie.value=!0):(G.value=0,Ie.value=!0)},{immediate:!0}),fr("click",kt),fr("message",({data:O})=>{!O||O.type!=="profile"||(o.value={...o.value,...O.data},[localStorage,sessionStorage].filter(A=>A.getItem("WALINE_USER")).forEach(A=>A.setItem("WALINE_USER",JSON.stringify(o))))}),Ve(N,async O=>{var A;if(!O)return;const U=i.value.search;v.value&&(v.value.value=""),z.loading=!0,z.list=await(((A=U.default)==null?void 0:A.call(U))??U.search("")),z.loading=!1}),gn(()=>{var O;(O=n.edit)!=null&&O.objectId&&(s.value=n.edit.orig),Ve(()=>s.value,A=>{const{highlighter:U,texRenderer:de}=i.value;Z.value=A,j.value=cf(A,{emojiMap:$.value.map,highlighter:U,texRenderer:de}),K.value=hf(A),A?co(c.value):co.destroy(c.value)},{immediate:!0}),Ve(()=>i.value.emoji,A=>_u(A).then(U=>{$.value=U}),{immediate:!0})}),(O,A)=>{var U,de;return I(),P("div",{key:q(o).token,class:"wl-comment"},[q(i).login!=="disable"&&Y.value&&!((U=O.edit)!=null&&U.objectId)?(I(),P("div",Zf,[H("div",Jf,[H("button",{type:"submit",class:"wl-logout-btn",title:F.value.logout,onClick:wr},[oe(q(Xl),{size:14})],8,Yf),H("a",{href:"#",class:"wl-login-nick","aria-label":"Profile",title:F.value.profile,onClick:Mn},[H("img",{src:q(o).avatar,alt:"avatar"},null,8,Xf)],8,Qf)]),H("a",{href:"#",class:"wl-login-nick","aria-label":"Profile",title:F.value.profile,onClick:Mn,textContent:X(q(o).display_name)},null,8,eh)])):Q("v-if",!0),H("div",th,[q(i).login!=="force"&&q(i).meta.length&&!Y.value?(I(),P("div",{key:0,class:ve(["wl-header",`item${q(i).meta.length}`])},[(I(!0),P(he,null,Be(q(i).meta,f=>(I(),P("div",{key:f,class:"wl-header-item"},[H("label",{for:`wl-${f}`,textContent:X(F.value[f]+(q(i).requiredMeta.includes(f)||!q(i).requiredMeta.length?"":`(${F.value.optional})`))},null,8,nh),Jn(H("input",{id:`wl-${f}`,ref_for:!0,ref:p=>{p&&(a.value[f]=p)},"onUpdate:modelValue":p=>q(l)[f]=p,class:ve(["wl-input",`wl-${f}`]),name:f,type:f==="mail"?"email":"text"},null,10,rh),[[Gc,q(l)[f]]])]))),128))],2)):Q("v-if",!0),Jn(H("textarea",{id:"wl-edit",ref_key:"editorRef",ref:c,"onUpdate:modelValue":A[0]||(A[0]=f=>xe(s)?s.value=f:null),class:"wl-editor",placeholder:O.replyUser?`@${O.replyUser}`:F.value.placeholder,onKeydown:be,onDrop:Re,onPaste:gt},null,40,ih),[[ui,q(s)]]),Jn(H("div",sh,[A[7]||(A[7]=H("hr",null,null,-1)),H("h4",null,X(F.value.preview)+":",1),H("div",{class:"wl-content",innerHTML:j.value},null,8,lh)],512),[[cl,E.value]]),H("div",oh,[H("div",ah,[H("a",ch,[oe(q(yf))]),Jn(H("button",{ref_key:"emojiButtonRef",ref:h,type:"button",class:ve(["wl-action",{active:C.value}]),title:F.value.emoji,onClick:A[1]||(A[1]=f=>C.value=!C.value)},[oe(q(gf))],10,uh),[[cl,$.value.tabs.length]]),q(i).search?(I(),P("button",{key:0,ref_key:"gifButtonRef",ref:g,type:"button",class:ve(["wl-action",{active:N.value}]),title:F.value.gif,onClick:A[2]||(A[2]=f=>N.value=!N.value)},[oe(q(_f))],10,fh)):Q("v-if",!0),H("input",{id:"wl-image-upload",ref_key:"imageUploadRef",ref:u,class:"upload","aria-hidden":"true",type:"file",accept:".png,.jpg,.jpeg,.webp,.bmp,.gif",onChange:wt},null,544),se.value?(I(),P("label",{key:1,for:"wl-image-upload",class:"wl-action",title:F.value.uploadImage,"aria-label":F.value.uploadImage},[oe(q(mf))],8,hh)):Q("v-if",!0),H("button",{type:"button",class:ve(["wl-action",{active:E.value}]),title:F.value.preview,onClick:A[3]||(A[3]=f=>E.value=!E.value)},[oe(q(bf))],10,dh)]),H("div",ph,[A[9]||(A[9]=H("div",{class:"wl-captcha-container"},null,-1)),H("div",gh,[ct(X(K.value)+" ",1),q(i).wordLimit?(I(),P("span",mh,[A[8]||(A[8]=ct(" / ")),H("span",{class:ve({illegal:!Ie.value}),textContent:X(G.value)},null,10,vh)])):Q("v-if",!0),ct(" "+X(F.value.word),1)]),q(i).login!=="disable"&&!Y.value?(I(),P("button",{key:0,type:"button",class:"wl-btn",onClick:In,textContent:X(F.value.login)},null,8,bh)):Q("v-if",!0),q(i).login!=="force"||Y.value?(I(),P("button",{key:1,type:"submit",class:"primary wl-btn",title:"Cmd|Ctrl + Enter",disabled:re.value,onClick:Oe},[re.value?(I(),at(q(En),{key:0,size:16})):(I(),P(he,{key:1},[ct(X(F.value.submit),1)],64))],8,yh)):Q("v-if",!0)]),H("div",{ref_key:"gifPopupRef",ref:k,class:ve(["wl-gif-popup",{display:N.value}])},[H("input",{ref_key:"gifSearchInputRef",ref:v,type:"text",placeholder:F.value.gifSearchPlaceholder,onInput:A[4]||(A[4]=(...f)=>q(zt)&&q(zt)(...f))},null,40,wh),z.list.length?(I(),at(Gf,{key:0,items:z.list,"column-width":200,gap:6,onInsert:A[5]||(A[5]=f=>ke(f)),onScroll:xt},null,8,["items"])):Q("v-if",!0),z.loading?(I(),P("div",kh,[oe(q(En),{size:30})])):Q("v-if",!0)],2),H("div",{ref_key:"emojiPopupRef",ref:d,class:ve(["wl-emoji-popup",{display:C.value}])},[(I(!0),P(he,null,Be($.value.tabs,(f,p)=>(I(),P(he,{key:f.name},[p===b.value?(I(),P("div",xh,[(I(!0),P(he,null,Be(f.items,m=>(I(),P("button",{key:m,type:"button",title:m,onClick:w=>ke(`:${m}:`)},[C.value?(I(),P("img",{key:0,class:"wl-emoji",src:$.value.map[m],alt:m,loading:"lazy",referrerPolicy:"no-referrer"},null,8,Ch)):Q("v-if",!0)],8,_h))),128))])):Q("v-if",!0)],64))),128)),$.value.tabs.length>1?(I(),P("div",$h,[(I(!0),P(he,null,Be($.value.tabs,(f,p)=>(I(),P("button",{key:f.name,type:"button",class:ve(["wl-tab",{active:b.value===p}]),onClick:m=>b.value=p},[H("img",{class:"wl-emoji",src:f.icon,alt:f.name,title:f.name,loading:"lazy",referrerPolicy:"no-referrer"},null,8,Rh)],10,Sh))),128))])):Q("v-if",!0)],2)])]),O.replyId||(de=O.edit)!=null&&de.objectId?(I(),P("button",{key:1,type:"button",class:"wl-close",title:F.value.cancelReply,onClick:A[6]||(A[6]=f=>O.replyId?r("cancelReply"):r("cancelEdit"))},[oe(q(Xl),{size:24})],8,Ah)):Q("v-if",!0)])}}});const Eh=["id"],Th={class:"wl-user","aria-hidden":"true"},Lh=["src"],Ih={class:"wl-card"},Mh={class:"wl-head"},Oh=["href"],Ph={key:1,class:"wl-nick"},jh=["textContent"],zh=["textContent"],Fh=["textContent"],Dh=["textContent"],Hh=["textContent"],Nh={class:"wl-comment-actions"},Uh=["title"],Bh=["title"],Vh={class:"wl-meta","aria-hidden":"true"},Wh=["data-value","textContent"],qh={key:0,class:"wl-content"},Kh={key:0},Gh=["href"],Zh=["innerHTML"],Jh={key:1,class:"wl-admin-actions"},Yh={class:"wl-comment-status"},Qh=["disabled","onClick","textContent"],Xh={key:3,class:"wl-quote"};var ed=dn({__name:"CommentCard",props:{comment:{},edit:{default:null},rootId:{},reply:{default:null}},emits:["log","submit","delete","edit","like","status","sticky","reply"],setup(e,{emit:t}){const n=e,r=t,i=["approved","waiting","spam"],s=Qn("config"),l=to(),o=vu(),a=yr(),c=_e(()=>s.value.locale),u=_e(()=>{const{link:b}=n.comment;return b?Yi(b)?b:`https://${b}`:""}),h=_e(()=>l.value.includes(n.comment.objectId)),d=_e(()=>jo(new Date(n.comment.time),o.value,c.value)),g=_e(()=>a.value.type==="administrator"),k=_e(()=>n.comment.user_id&&a.value.objectId===n.comment.user_id),v=_e(()=>{var b;return n.comment.objectId===((b=n.reply)==null?void 0:b.objectId)}),$=_e(()=>{var b;return n.comment.objectId===((b=n.edit)==null?void 0:b.objectId)});return(b,C)=>{var N;const E=za("CommentCard",!0);return I(),P("div",{id:b.comment.objectId,class:"wl-card-item"},[H("div",Th,[b.comment.avatar?(I(),P("img",{key:0,class:"wl-user-avatar",src:b.comment.avatar,alt:""},null,8,Lh)):Q("v-if",!0),b.comment.type?(I(),at(q(xf),{key:1})):Q("v-if",!0)]),H("div",Ih,[H("div",Mh,[u.value?(I(),P("a",{key:0,class:"wl-nick",href:u.value,target:"_blank",rel:"nofollow noopener noreferrer"},X(b.comment.nick),9,Oh)):(I(),P("span",Ph,X(b.comment.nick),1)),b.comment.type==="administrator"?(I(),P("span",{key:2,class:"wl-badge",textContent:X(c.value.admin)},null,8,jh)):Q("v-if",!0),b.comment.label?(I(),P("span",{key:3,class:"wl-badge",textContent:X(b.comment.label)},null,8,zh)):Q("v-if",!0),b.comment.sticky?(I(),P("span",{key:4,class:"wl-badge",textContent:X(c.value.sticky)},null,8,Fh)):Q("v-if",!0),typeof b.comment.level=="number"?(I(),P("span",{key:5,class:ve(`wl-badge level${b.comment.level}`),textContent:X(c.value[`level${b.comment.level}`]||`Level ${b.comment.level}`)},null,10,Dh)):Q("v-if",!0),H("span",{class:"wl-time",textContent:X(d.value)},null,8,Hh),H("div",Nh,[g.value||k.value?(I(),P(he,{key:0},[H("button",{type:"button",class:"wl-edit",onClick:C[0]||(C[0]=j=>r("edit",b.comment))},[oe(q(kf))]),H("button",{type:"button",class:"wl-delete",onClick:C[1]||(C[1]=j=>r("delete",b.comment))},[oe(q(pf))])],64)):Q("v-if",!0),H("button",{type:"button",class:"wl-like",title:h.value?c.value.cancelLike:c.value.like,onClick:C[2]||(C[2]=j=>r("like",b.comment))},[oe(q(vf),{active:h.value},null,8,["active"]),ct(" "+X("like"in b.comment?b.comment.like:""),1)],8,Uh),H("button",{type:"button",class:ve(["wl-reply",{active:v.value}]),title:v.value?c.value.cancelReply:c.value.reply,onClick:C[3]||(C[3]=j=>r("reply",v.value?null:b.comment))},[oe(q(wf))],10,Bh)])]),H("div",Vh,[(I(),P(he,null,Be(["addr","browser","os"],j=>(I(),P(he,null,[b.comment[j]?(I(),P("span",{key:j,class:ve(`wl-${j}`),"data-value":b.comment[j],textContent:X(b.comment[j])},null,10,Wh)):Q("v-if",!0)],64))),64))]),$.value?Q("v-if",!0):(I(),P("div",qh,[b.comment.reply_user?(I(),P("p",Kh,[H("a",{href:"#"+b.comment.pid},"@"+X(b.comment.reply_user.nick),9,Gh),C[17]||(C[17]=H("span",null,": ",-1))])):Q("v-if",!0),H("div",{innerHTML:b.comment.comment},null,8,Zh)])),g.value&&!$.value?(I(),P("div",Jh,[H("span",Yh,[(I(),P(he,null,Be(i,j=>H("button",{key:j,type:"submit",class:ve(`wl-btn wl-${j}`),disabled:b.comment.status===j,onClick:K=>r("status",{status:j,comment:b.comment}),textContent:X(c.value[j])},null,10,Qh)),64))]),g.value&&!("rid"in b.comment)?(I(),P("button",{key:0,type:"submit",class:"wl-btn wl-sticky",onClick:C[4]||(C[4]=j=>r("sticky",b.comment))},X(b.comment.sticky?c.value.unsticky:c.value.sticky),1)):Q("v-if",!0)])):Q("v-if",!0),v.value||$.value?(I(),P("div",{key:2,class:ve({"wl-reply-wrapper":v.value,"wl-edit-wrapper":$.value})},[oe(uo,{edit:b.edit,"reply-id":(N=b.reply)==null?void 0:N.objectId,"reply-user":b.comment.nick,"root-id":b.rootId,onLog:C[5]||(C[5]=j=>r("log")),onCancelReply:C[6]||(C[6]=j=>r("reply",null)),onCancelEdit:C[7]||(C[7]=j=>r("edit",null)),onSubmit:C[8]||(C[8]=j=>r("submit",j))},null,8,["edit","reply-id","reply-user","root-id"])],2)):Q("v-if",!0),"children"in b.comment?(I(),P("div",Xh,[(I(!0),P(he,null,Be(b.comment.children,j=>(I(),at(E,{key:j.objectId,comment:j,reply:b.reply,edit:b.edit,"root-id":b.rootId,onLog:C[9]||(C[9]=K=>r("log")),onDelete:C[10]||(C[10]=K=>r("delete",K)),onEdit:C[11]||(C[11]=K=>r("edit",K)),onLike:C[12]||(C[12]=K=>r("like",K)),onReply:C[13]||(C[13]=K=>r("reply",K)),onStatus:C[14]||(C[14]=K=>r("status",K)),onSticky:C[15]||(C[15]=K=>r("sticky",K)),onSubmit:C[16]||(C[16]=K=>r("submit",K))},null,8,["comment","reply","edit","root-id"]))),128))])):Q("v-if",!0)])],8,Eh)}}});const fo="3.4.0",td={"data-waline":""},nd={class:"wl-meta-head"},rd={class:"wl-count"},id=["textContent"],sd={class:"wl-sort"},ld=["onClick"],od={class:"wl-cards"},ad={key:1,class:"wl-operation"},cd=["textContent"],ud={key:2,class:"wl-loading"},fd=["textContent"],hd={key:4,class:"wl-operation"},dd=["textContent"],pd={key:5,class:"wl-power"};var gd=dn({__name:"WalineComment",props:["serverURL","path","meta","requiredMeta","dark","commentSorting","lang","locale","pageSize","wordLimit","emoji","login","highlighter","texRenderer","imageUploader","search","copyright","recaptchaV3Key","turnstileKey","reaction"],setup(e){const t=e,n={latest:"insertedAt_desc",oldest:"insertedAt_asc",hottest:"like_desc"},r=Object.keys(n),i=yr(),s=to(),l=W("loading"),o=W(0),a=W(1),c=W(0),u=_e(()=>Mo(t)),h=W(u.value.commentSorting),d=W([]),g=W(null),k=W(null),v=_e(()=>Oo(u.value.dark)),$=_e(()=>u.value.locale);wu(v,{id:"waline-darkmode"});let b;const C=F=>{var Y;const{serverURL:se,path:ke,pageSize:be}=u.value,ye=new AbortController;l.value="loading",b==null||b(),Ri({serverURL:se,lang:u.value.lang,path:ke,pageSize:be,sortBy:n[h.value],page:F,signal:ye.signal,token:(Y=i.value)==null?void 0:Y.token}).then(Re=>{l.value="success",o.value=Re.count,d.value.push(...Re.data),a.value=F,c.value=Re.totalPages}).catch(Re=>{Re.name!=="AbortError"&&(console.error(Re.message),l.value="error")}),b=ye.abort.bind(ye)},N=()=>C(a.value+1),E=()=>{o.value=0,d.value=[],C(1)},j=F=>{h.value!==F&&(h.value=F,E())},K=F=>{g.value=F},z=F=>{k.value=F},G=F=>{if(k.value)k.value.comment=F.comment,k.value.orig=F.orig;else if("rid"in F){const Y=d.value.find(({objectId:se})=>se===F.rid);if(!Y)return;Array.isArray(Y.children)||(Y.children=[]),Y.children.push(F)}else d.value.unshift(F),o.value+=1},Ie=async({comment:F,status:Y})=>{var se;if(F.status===Y)return;const{serverURL:ke,lang:be}=u.value;await Qt({serverURL:ke,lang:be,token:(se=i.value)==null?void 0:se.token,objectId:F.objectId,comment:{status:Y}}),F.status=Y},Z=async F=>{var Y;if("rid"in F)return;const{serverURL:se,lang:ke}=u.value;await Qt({serverURL:se,lang:ke,token:(Y=i.value)==null?void 0:Y.token,objectId:F.objectId,comment:{sticky:F.sticky?0:1}}),F.sticky=!F.sticky},re=async({objectId:F})=>{var Y;if(!confirm("Are you sure you want to delete this comment?"))return;const{serverURL:se,lang:ke}=u.value;await Ei({serverURL:se,lang:ke,token:(Y=i.value)==null?void 0:Y.token,objectId:F}),d.value.some((be,ye)=>be.objectId===F?(d.value=d.value.filter((Re,gt)=>gt!==ye),!0):be.children.some((Re,gt)=>Re.objectId===F?(d.value[ye].children=be.children.filter((wt,Oe)=>Oe!==gt),!0):!1))},me=async F=>{var Y;const{serverURL:se,lang:ke}=u.value,{objectId:be}=F,ye=s.value.includes(be);await Qt({serverURL:se,lang:ke,objectId:be,token:(Y=i.value)==null?void 0:Y.token,comment:{like:!ye}}),ye?s.value=s.value.filter(Re=>Re!==be):(s.value=[...s.value,be],s.value.length>50&&(s.value=s.value.slice(-50))),F.like=(F.like||0)+(ye?-1:1)};return Ba("config",u),gn(()=>{Ve(()=>[t.serverURL,t.path],()=>E(),{immediate:!0})}),Jr(()=>b==null?void 0:b()),(F,Y)=>(I(),P("div",td,[oe(Bf),!g.value&&!k.value?(I(),at(uo,{key:0,onLog:E,onSubmit:G})):Q("v-if",!0),H("div",nd,[H("div",rd,[o.value?(I(),P("span",{key:0,class:"wl-num",textContent:X(o.value)},null,8,id)):Q("v-if",!0),ct(" "+X($.value.comment),1)]),H("ul",sd,[(I(!0),P(he,null,Be(q(r),se=>(I(),P("li",{key:se,class:ve([se===h.value?"active":""]),onClick:ke=>j(se)},X($.value[se]),11,ld))),128))])]),H("div",od,[(I(!0),P(he,null,Be(d.value,se=>(I(),at(ed,{key:se.objectId,"root-id":se.objectId,comment:se,reply:g.value,edit:k.value,onLog:E,onReply:K,onEdit:z,onSubmit:G,onStatus:Ie,onDelete:re,onSticky:Z,onLike:me},null,8,["root-id","comment","reply","edit"]))),128))]),l.value==="error"?(I(),P("div",ad,[H("button",{type:"button",class:"wl-btn",onClick:E,textContent:X($.value.refresh)},null,8,cd)])):l.value==="loading"?(I(),P("div",ud,[oe(q(En),{size:30})])):d.value.length?a.value<c.value?(I(),P("div",hd,[H("button",{type:"button",class:"wl-btn",onClick:N,textContent:X($.value.more)},null,8,dd)])):Q("v-if",!0):(I(),P("div",{key:3,class:"wl-empty",textContent:X($.value.sofa)},null,8,fd)),u.value.copyright?(I(),P("div",pd,[Y[0]||(Y[0]=ct(" Powered by ")),Y[1]||(Y[1]=H("a",{href:"https://github.com/walinejs/waline",target:"_blank",rel:"noopener noreferrer"}," Waline ",-1)),ct(" v"+X(q(fo)),1)])):Q("v-if",!0)]))}});const ho=(e,t)=>{t.forEach((n,r)=>{const i=e[r].time;typeof i=="number"&&(n.innerText=i.toString())})},po=({serverURL:e,path:t=window.location.pathname,selector:n=".waline-pageview-count",update:r=!0,lang:i=navigator.language})=>{const s=new AbortController,l=Array.from(document.querySelectorAll(n)),o=c=>{const u=ki(c);return u!==null&&t!==u},a=c=>Ii({serverURL:jn(e),paths:c.map(u=>ki(u)??t),lang:i,signal:s.signal}).then(u=>ho(u,c)).catch(El);if(r){const c=l.filter(h=>!o(h)),u=l.filter(o);Mi({serverURL:jn(e),path:t,lang:i}).then(h=>ho(h,c)),u.length&&a(u)}else a(l);return s.abort.bind(s)},md=({el:e="#waline",path:t=window.location.pathname,comment:n=!1,pageview:r=!1,...i})=>{const s=e?hi(e):null;if(e&&!s)throw new Error("Option 'el' do not match any domElement!");if(!i.serverURL)throw new Error("Option 'serverURL' is missing!");const l=cn({...i}),o=cn({comment:n,pageview:r,path:t}),a=()=>{o.comment&&Ql({serverURL:l.serverURL,path:o.path,...Ft(o.comment)?{selector:o.comment}:{}})},c=()=>{o.pageview&&po({serverURL:l.serverURL,path:o.path,...Ft(o.pageview)?{selector:o.pageview}:{}})},u=s?Qc(()=>ne(gd,{path:o.path,...l})):null;u&&u.mount(s);const h=Ks(a),d=Ks(c);return{el:s,update:({comment:g,pageview:k,path:v=window.location.pathname,...$}={})=>{Object.entries($).forEach(([b,C])=>{l[b]=C}),o.path=v,g!==void 0&&(o.comment=g),k!==void 0&&(o.pageview=k)},destroy:()=>{u==null||u.unmount(),h(),d()}}},vd=({el:e,serverURL:t,count:n,lang:r=navigator.language})=>{var i;const s=yr(),l=hi(e),o=new AbortController;return Oi({serverURL:t,count:n,lang:r,signal:o.signal,token:(i=s.value)==null?void 0:i.token}).then(a=>l&&a.length?(l.innerHTML=`<ul class="wl-recent-list">${a.map(c=>`<li class="wl-recent-item"><a href="${c.url}">${c.nick}</a>:${c.comment}</li>`).join("")}</ul>`,{comments:a,destroy:()=>{o.abort(),l.innerHTML=""}}):{comments:a,destroy:()=>o.abort()})},bd=({el:e,serverURL:t,count:n,locale:r,lang:i=navigator.language,mode:s="list"})=>{const l=hi(e),o=new AbortController;return Pi({serverURL:t,pageSize:n,lang:i,signal:o.signal}).then(a=>!l||!a.length?{users:a,destroy:()=>o.abort()}:(r={...Ki(i),...typeof r=="object"?r:{}},l.innerHTML=`<ul class="wl-user-${s}">${a.map((c,u)=>[`<li class="wl-user-item" aria-label="${c.nick}">`,c.link&&`<a href="${c.link}" target="_blank">`,'<div class="wl-user-avatar">',`<img src="${c.avatar}" alt="${c.nick}">`,`<span class="wl-user-badge">${u+1}</span>`,"</div>",'<div class="wl-user-meta">','<div class="wl-user-name">',c.nick,c.level&&`<span class="wl-badge">${r?r[`level${c.level}`]:`Level ${c.level}`}</span>`,c.label&&`<span class="wl-badge">${c.label}</span>`,"</div>",c.link&&c.link,"</div>",c.link&&"</a>","</li>"].filter(h=>h).join("")).join("")}</ul>`,{users:a,destroy:()=>{o.abort(),l.innerHTML=""}}))};export{vd as RecentComments,bd as UserList,Ai as addComment,Ql as commentCount,Pn as defaultLocales,Ei as deleteComment,Ti as fetchCommentCount,kr as getArticleCounter,Ri as getComment,Ii as getPageview,Oi as getRecentComment,Pi as getUserList,md as init,Li as login,po as pageviewCount,On as updateArticleCounter,Qt as updateComment,Mi as updatePageview,fo as version};
|
|
83
|
+
`)}).catch(U=>{alert(U.message),s.value=s.value.replace(A,"")}).then(()=>{re.value=!1})},Re=O=>{var A;if((A=O.dataTransfer)!=null&&A.items){const U=Tl(O.dataTransfer.items);U&&se.value&&(ye(U),O.preventDefault())}},gt=O=>{if(O.clipboardData){const A=Tl(O.clipboardData.items);A&&se.value&&ye(A)}},wt=()=>{const O=u.value;O.files&&se.value&&ye(O.files[0]).then(()=>{O.value=""})},Oe=async()=>{var O,A,U,de,f,p;const{serverURL:m,lang:w,login:y,wordLimit:x,requiredMeta:T,recaptchaV3Key:R,turnstileKey:S}=i.value,_=await df(),M={comment:Z.value,nick:l.value.nick,mail:l.value.mail,link:l.value.link,url:i.value.path,ua:_};if(!n.edit)if((O=o.value)!=null&&O.token)M.nick=o.value.display_name,M.mail=o.value.email,M.link=o.value.url;else{if(y==="force")return;if(T.includes("nick")&&!M.nick)return(A=a.value.nick)==null||A.focus(),alert(F.value.nickError);if(T.includes("mail")&&!M.mail||M.mail&&!Fo(M.mail))return(U=a.value.mail)==null||U.focus(),alert(F.value.mailError);M.nick||(M.nick=F.value.anonymous)}if(!M.comment){(de=c.value)==null||de.focus();return}if(!Ie.value)return alert(F.value.wordHint.replace("$0",x[0].toString()).replace("$1",x[1].toString()).replace("$2",K.value.toString()));M.comment=Yl(M.comment,$.value.map),n.replyId&&n.rootId&&(M.pid=n.replyId,M.rid=n.rootId,M.at=n.replyUser),re.value=!0;try{R&&(M.recaptchaV3=await If(R).execute("social")),S&&(M.turnstile=await Mf(S).execute("social"));const L={serverURL:m,lang:w,token:(f=o.value)==null?void 0:f.token,comment:M},D=await(n.edit?Qt({objectId:n.edit.objectId,...L}):Ai(L));if(re.value=!1,D.errmsg)return alert(D.errmsg);r("submit",D.data),s.value="",j.value="",await qt(),n.replyId&&r("cancelReply"),(p=n.edit)!=null&&p.objectId&&r("cancelEdit")}catch(L){re.value=!1,alert(L.message)}},In=O=>{O.preventDefault();const{lang:A,serverURL:U}=i.value;Li({serverURL:U,lang:A}).then(de=>{o.value=de,(de.remember?localStorage:sessionStorage).setItem("WALINE_USER",JSON.stringify(de)),r("log")})},wr=()=>{o.value={},localStorage.setItem("WALINE_USER","null"),sessionStorage.setItem("WALINE_USER","null"),r("log")},Mn=O=>{O.preventDefault();const{lang:A,serverURL:U}=i.value,de=800,f=800,p=(window.innerWidth-de)/2,m=(window.innerHeight-f)/2,w=new URLSearchParams({lng:A,token:o.value.token}),y=window.open(`${U}/ui/profile?${w.toString()}`,"_blank",`width=${de},height=${f},left=${p},top=${m},scrollbars=no,resizable=no,status=no,location=no,toolbar=no,menubar=no`);y==null||y.postMessage({type:"TOKEN",data:o.value.token},"*")},kt=O=>{var A,U,de,f;!((A=h.value)!=null&&A.contains(O.target))&&!((U=d.value)!=null&&U.contains(O.target))&&(C.value=!1),!((de=g.value)!=null&&de.contains(O.target))&&!((f=k.value)!=null&&f.contains(O.target))&&(N.value=!1)},xt=async O=>{var A;const{scrollTop:U,clientHeight:de,scrollHeight:f}=O.target,p=(de+U)/f,m=i.value.search,w=((A=v.value)==null?void 0:A.value)??"";p<.9||z.loading||me.value||(z.loading=!0,(m.more&&z.list.length?await m.more(w,z.list.length):await m.search(w)).length?z.list=[...z.list,...m.more&&z.list.length?await m.more(w,z.list.length):await m.search(w)]:me.value=!0,z.loading=!1,setTimeout(()=>{O.target.scrollTop=U},50))},zt=su(O=>{z.list=[],me.value=!1,xt(O)},300);return Ve([i,K],([O,A])=>{const{wordLimit:U}=O;U?A<U[0]&&U[0]!==0?(G.value=U[0],Ie.value=!1):A>U[1]?(G.value=U[1],Ie.value=!1):(G.value=U[1],Ie.value=!0):(G.value=0,Ie.value=!0)},{immediate:!0}),fr("click",kt),fr("message",({data:O})=>{!O||O.type!=="profile"||(o.value={...o.value,...O.data},[localStorage,sessionStorage].filter(A=>A.getItem("WALINE_USER")).forEach(A=>A.setItem("WALINE_USER",JSON.stringify(o))))}),Ve(N,async O=>{var A;if(!O)return;const U=i.value.search;v.value&&(v.value.value=""),z.loading=!0,z.list=await(((A=U.default)==null?void 0:A.call(U))??U.search("")),z.loading=!1}),gn(()=>{var O;(O=n.edit)!=null&&O.objectId&&(s.value=n.edit.orig),Ve(()=>s.value,A=>{const{highlighter:U,texRenderer:de}=i.value;Z.value=A,j.value=cf(A,{emojiMap:$.value.map,highlighter:U,texRenderer:de}),K.value=hf(A),A?co(c.value):co.destroy(c.value)},{immediate:!0}),Ve(()=>i.value.emoji,A=>_u(A).then(U=>{$.value=U}),{immediate:!0})}),(O,A)=>{var U,de;return I(),P("div",{key:q(o).token,class:"wl-comment"},[q(i).login!=="disable"&&Y.value&&!((U=O.edit)!=null&&U.objectId)?(I(),P("div",Zf,[H("div",Jf,[H("button",{type:"submit",class:"wl-logout-btn",title:F.value.logout,onClick:wr},[oe(q(Xl),{size:14})],8,Yf),H("a",{href:"#",class:"wl-login-nick","aria-label":"Profile",title:F.value.profile,onClick:Mn},[H("img",{src:q(o).avatar,alt:"avatar"},null,8,Xf)],8,Qf)]),H("a",{href:"#",class:"wl-login-nick","aria-label":"Profile",title:F.value.profile,onClick:Mn,textContent:X(q(o).display_name)},null,8,eh)])):Q("v-if",!0),H("div",th,[q(i).login!=="force"&&q(i).meta.length&&!Y.value?(I(),P("div",{key:0,class:ve(["wl-header",`item${q(i).meta.length}`])},[(I(!0),P(he,null,Be(q(i).meta,f=>(I(),P("div",{key:f,class:"wl-header-item"},[H("label",{for:`wl-${f}`,textContent:X(F.value[f]+(q(i).requiredMeta.includes(f)||!q(i).requiredMeta.length?"":`(${F.value.optional})`))},null,8,nh),Jn(H("input",{id:`wl-${f}`,ref_for:!0,ref:p=>{p&&(a.value[f]=p)},"onUpdate:modelValue":p=>q(l)[f]=p,class:ve(["wl-input",`wl-${f}`]),name:f,type:f==="mail"?"email":"text"},null,10,rh),[[Gc,q(l)[f]]])]))),128))],2)):Q("v-if",!0),Jn(H("textarea",{id:"wl-edit",ref_key:"editorRef",ref:c,"onUpdate:modelValue":A[0]||(A[0]=f=>xe(s)?s.value=f:null),class:"wl-editor",placeholder:O.replyUser?`@${O.replyUser}`:F.value.placeholder,onKeydown:be,onDrop:Re,onPaste:gt},null,40,ih),[[ui,q(s)]]),Jn(H("div",sh,[A[7]||(A[7]=H("hr",null,null,-1)),H("h4",null,X(F.value.preview)+":",1),H("div",{class:"wl-content",innerHTML:j.value},null,8,lh)],512),[[cl,E.value]]),H("div",oh,[H("div",ah,[H("a",ch,[oe(q(yf))]),Jn(H("button",{ref_key:"emojiButtonRef",ref:h,type:"button",class:ve(["wl-action",{active:C.value}]),title:F.value.emoji,onClick:A[1]||(A[1]=f=>C.value=!C.value)},[oe(q(gf))],10,uh),[[cl,$.value.tabs.length]]),q(i).search?(I(),P("button",{key:0,ref_key:"gifButtonRef",ref:g,type:"button",class:ve(["wl-action",{active:N.value}]),title:F.value.gif,onClick:A[2]||(A[2]=f=>N.value=!N.value)},[oe(q(_f))],10,fh)):Q("v-if",!0),H("input",{id:"wl-image-upload",ref_key:"imageUploadRef",ref:u,class:"upload","aria-hidden":"true",type:"file",accept:".png,.jpg,.jpeg,.webp,.bmp,.gif",onChange:wt},null,544),se.value?(I(),P("label",{key:1,for:"wl-image-upload",class:"wl-action",title:F.value.uploadImage,"aria-label":F.value.uploadImage},[oe(q(mf))],8,hh)):Q("v-if",!0),H("button",{type:"button",class:ve(["wl-action",{active:E.value}]),title:F.value.preview,onClick:A[3]||(A[3]=f=>E.value=!E.value)},[oe(q(bf))],10,dh)]),H("div",ph,[A[9]||(A[9]=H("div",{class:"wl-captcha-container"},null,-1)),H("div",gh,[ct(X(K.value)+" ",1),q(i).wordLimit?(I(),P("span",mh,[A[8]||(A[8]=ct(" / ")),H("span",{class:ve({illegal:!Ie.value}),textContent:X(G.value)},null,10,vh)])):Q("v-if",!0),ct(" "+X(F.value.word),1)]),q(i).login!=="disable"&&!Y.value?(I(),P("button",{key:0,type:"button",class:"wl-btn",onClick:In,textContent:X(F.value.login)},null,8,bh)):Q("v-if",!0),q(i).login!=="force"||Y.value?(I(),P("button",{key:1,type:"submit",class:"primary wl-btn",title:"Cmd|Ctrl + Enter",disabled:re.value,onClick:Oe},[re.value?(I(),at(q(En),{key:0,size:16})):(I(),P(he,{key:1},[ct(X(F.value.submit),1)],64))],8,yh)):Q("v-if",!0)]),H("div",{ref_key:"gifPopupRef",ref:k,class:ve(["wl-gif-popup",{display:N.value}])},[H("input",{ref_key:"gifSearchInputRef",ref:v,type:"text",placeholder:F.value.gifSearchPlaceholder,onInput:A[4]||(A[4]=(...f)=>q(zt)&&q(zt)(...f))},null,40,wh),z.list.length?(I(),at(Gf,{key:0,items:z.list,"column-width":200,gap:6,onInsert:A[5]||(A[5]=f=>ke(f)),onScroll:xt},null,8,["items"])):Q("v-if",!0),z.loading?(I(),P("div",kh,[oe(q(En),{size:30})])):Q("v-if",!0)],2),H("div",{ref_key:"emojiPopupRef",ref:d,class:ve(["wl-emoji-popup",{display:C.value}])},[(I(!0),P(he,null,Be($.value.tabs,(f,p)=>(I(),P(he,{key:f.name},[p===b.value?(I(),P("div",xh,[(I(!0),P(he,null,Be(f.items,m=>(I(),P("button",{key:m,type:"button",title:m,onClick:w=>ke(`:${m}:`)},[C.value?(I(),P("img",{key:0,class:"wl-emoji",src:$.value.map[m],alt:m,loading:"lazy",referrerPolicy:"no-referrer"},null,8,Ch)):Q("v-if",!0)],8,_h))),128))])):Q("v-if",!0)],64))),128)),$.value.tabs.length>1?(I(),P("div",$h,[(I(!0),P(he,null,Be($.value.tabs,(f,p)=>(I(),P("button",{key:f.name,type:"button",class:ve(["wl-tab",{active:b.value===p}]),onClick:m=>b.value=p},[H("img",{class:"wl-emoji",src:f.icon,alt:f.name,title:f.name,loading:"lazy",referrerPolicy:"no-referrer"},null,8,Rh)],10,Sh))),128))])):Q("v-if",!0)],2)])]),O.replyId||(de=O.edit)!=null&&de.objectId?(I(),P("button",{key:1,type:"button",class:"wl-close",title:F.value.cancelReply,onClick:A[6]||(A[6]=f=>O.replyId?r("cancelReply"):r("cancelEdit"))},[oe(q(Xl),{size:24})],8,Ah)):Q("v-if",!0)])}}});const Eh=["id"],Th={class:"wl-user","aria-hidden":"true"},Lh=["src"],Ih={class:"wl-card"},Mh={class:"wl-head"},Oh=["href"],Ph={key:1,class:"wl-nick"},jh=["textContent"],zh=["textContent"],Fh=["textContent"],Dh=["textContent"],Hh=["textContent"],Nh={class:"wl-comment-actions"},Uh=["title"],Bh=["title"],Vh={class:"wl-meta","aria-hidden":"true"},Wh=["data-value","textContent"],qh={key:0,class:"wl-content"},Kh={key:0},Gh=["href"],Zh=["innerHTML"],Jh={key:1,class:"wl-admin-actions"},Yh={class:"wl-comment-status"},Qh=["disabled","onClick","textContent"],Xh={key:3,class:"wl-quote"};var ed=dn({__name:"CommentCard",props:{comment:{},edit:{default:null},rootId:{},reply:{default:null}},emits:["log","submit","delete","edit","like","status","sticky","reply"],setup(e,{emit:t}){const n=e,r=t,i=["approved","waiting","spam"],s=Qn("config"),l=to(),o=vu(),a=yr(),c=_e(()=>s.value.locale),u=_e(()=>{const{link:b}=n.comment;return b?Yi(b)?b:`https://${b}`:""}),h=_e(()=>l.value.includes(n.comment.objectId)),d=_e(()=>jo(new Date(n.comment.time),o.value,c.value)),g=_e(()=>a.value.type==="administrator"),k=_e(()=>n.comment.user_id&&a.value.objectId===n.comment.user_id),v=_e(()=>{var b;return n.comment.objectId===((b=n.reply)==null?void 0:b.objectId)}),$=_e(()=>{var b;return n.comment.objectId===((b=n.edit)==null?void 0:b.objectId)});return(b,C)=>{var N;const E=za("CommentCard",!0);return I(),P("div",{id:b.comment.objectId,class:"wl-card-item"},[H("div",Th,[b.comment.avatar?(I(),P("img",{key:0,class:"wl-user-avatar",src:b.comment.avatar,alt:""},null,8,Lh)):Q("v-if",!0),b.comment.type?(I(),at(q(xf),{key:1})):Q("v-if",!0)]),H("div",Ih,[H("div",Mh,[u.value?(I(),P("a",{key:0,class:"wl-nick",href:u.value,target:"_blank",rel:"nofollow noopener noreferrer"},X(b.comment.nick),9,Oh)):(I(),P("span",Ph,X(b.comment.nick),1)),b.comment.type==="administrator"?(I(),P("span",{key:2,class:"wl-badge",textContent:X(c.value.admin)},null,8,jh)):Q("v-if",!0),b.comment.label?(I(),P("span",{key:3,class:"wl-badge",textContent:X(b.comment.label)},null,8,zh)):Q("v-if",!0),b.comment.sticky?(I(),P("span",{key:4,class:"wl-badge",textContent:X(c.value.sticky)},null,8,Fh)):Q("v-if",!0),typeof b.comment.level=="number"?(I(),P("span",{key:5,class:ve(`wl-badge level${b.comment.level}`),textContent:X(c.value[`level${b.comment.level}`]||`Level ${b.comment.level}`)},null,10,Dh)):Q("v-if",!0),H("span",{class:"wl-time",textContent:X(d.value)},null,8,Hh),H("div",Nh,[g.value||k.value?(I(),P(he,{key:0},[H("button",{type:"button",class:"wl-edit",onClick:C[0]||(C[0]=j=>r("edit",b.comment))},[oe(q(kf))]),H("button",{type:"button",class:"wl-delete",onClick:C[1]||(C[1]=j=>r("delete",b.comment))},[oe(q(pf))])],64)):Q("v-if",!0),H("button",{type:"button",class:"wl-like",title:h.value?c.value.cancelLike:c.value.like,onClick:C[2]||(C[2]=j=>r("like",b.comment))},[oe(q(vf),{active:h.value},null,8,["active"]),ct(" "+X("like"in b.comment?b.comment.like:""),1)],8,Uh),H("button",{type:"button",class:ve(["wl-reply",{active:v.value}]),title:v.value?c.value.cancelReply:c.value.reply,onClick:C[3]||(C[3]=j=>r("reply",v.value?null:b.comment))},[oe(q(wf))],10,Bh)])]),H("div",Vh,[(I(),P(he,null,Be(["addr","browser","os"],j=>(I(),P(he,null,[b.comment[j]?(I(),P("span",{key:j,class:ve(`wl-${j}`),"data-value":b.comment[j],textContent:X(b.comment[j])},null,10,Wh)):Q("v-if",!0)],64))),64))]),$.value?Q("v-if",!0):(I(),P("div",qh,[b.comment.reply_user?(I(),P("p",Kh,[H("a",{href:"#"+b.comment.pid},"@"+X(b.comment.reply_user.nick),9,Gh),C[17]||(C[17]=H("span",null,": ",-1))])):Q("v-if",!0),H("div",{innerHTML:b.comment.comment},null,8,Zh)])),g.value&&!$.value?(I(),P("div",Jh,[H("span",Yh,[(I(),P(he,null,Be(i,j=>H("button",{key:j,type:"submit",class:ve(`wl-btn wl-${j}`),disabled:b.comment.status===j,onClick:K=>r("status",{status:j,comment:b.comment}),textContent:X(c.value[j])},null,10,Qh)),64))]),g.value&&!("rid"in b.comment)?(I(),P("button",{key:0,type:"submit",class:"wl-btn wl-sticky",onClick:C[4]||(C[4]=j=>r("sticky",b.comment))},X(b.comment.sticky?c.value.unsticky:c.value.sticky),1)):Q("v-if",!0)])):Q("v-if",!0),v.value||$.value?(I(),P("div",{key:2,class:ve({"wl-reply-wrapper":v.value,"wl-edit-wrapper":$.value})},[oe(uo,{edit:b.edit,"reply-id":(N=b.reply)==null?void 0:N.objectId,"reply-user":b.comment.nick,"root-id":b.rootId,onLog:C[5]||(C[5]=j=>r("log")),onCancelReply:C[6]||(C[6]=j=>r("reply",null)),onCancelEdit:C[7]||(C[7]=j=>r("edit",null)),onSubmit:C[8]||(C[8]=j=>r("submit",j))},null,8,["edit","reply-id","reply-user","root-id"])],2)):Q("v-if",!0),"children"in b.comment?(I(),P("div",Xh,[(I(!0),P(he,null,Be(b.comment.children,j=>(I(),at(E,{key:j.objectId,comment:j,reply:b.reply,edit:b.edit,"root-id":b.rootId,onLog:C[9]||(C[9]=K=>r("log")),onDelete:C[10]||(C[10]=K=>r("delete",K)),onEdit:C[11]||(C[11]=K=>r("edit",K)),onLike:C[12]||(C[12]=K=>r("like",K)),onReply:C[13]||(C[13]=K=>r("reply",K)),onStatus:C[14]||(C[14]=K=>r("status",K)),onSticky:C[15]||(C[15]=K=>r("sticky",K)),onSubmit:C[16]||(C[16]=K=>r("submit",K))},null,8,["comment","reply","edit","root-id"]))),128))])):Q("v-if",!0)])],8,Eh)}}});const fo="3.4.1",td={"data-waline":""},nd={class:"wl-meta-head"},rd={class:"wl-count"},id=["textContent"],sd={class:"wl-sort"},ld=["onClick"],od={class:"wl-cards"},ad={key:1,class:"wl-operation"},cd=["textContent"],ud={key:2,class:"wl-loading"},fd=["textContent"],hd={key:4,class:"wl-operation"},dd=["textContent"],pd={key:5,class:"wl-power"};var gd=dn({__name:"WalineComment",props:["serverURL","path","meta","requiredMeta","dark","commentSorting","lang","locale","pageSize","wordLimit","emoji","login","highlighter","texRenderer","imageUploader","search","copyright","recaptchaV3Key","turnstileKey","reaction"],setup(e){const t=e,n={latest:"insertedAt_desc",oldest:"insertedAt_asc",hottest:"like_desc"},r=Object.keys(n),i=yr(),s=to(),l=W("loading"),o=W(0),a=W(1),c=W(0),u=_e(()=>Mo(t)),h=W(u.value.commentSorting),d=W([]),g=W(null),k=W(null),v=_e(()=>Oo(u.value.dark)),$=_e(()=>u.value.locale);wu(v,{id:"waline-darkmode"});let b;const C=F=>{var Y;const{serverURL:se,path:ke,pageSize:be}=u.value,ye=new AbortController;l.value="loading",b==null||b(),Ri({serverURL:se,lang:u.value.lang,path:ke,pageSize:be,sortBy:n[h.value],page:F,signal:ye.signal,token:(Y=i.value)==null?void 0:Y.token}).then(Re=>{l.value="success",o.value=Re.count,d.value.push(...Re.data),a.value=F,c.value=Re.totalPages}).catch(Re=>{Re.name!=="AbortError"&&(console.error(Re.message),l.value="error")}),b=ye.abort.bind(ye)},N=()=>C(a.value+1),E=()=>{o.value=0,d.value=[],C(1)},j=F=>{h.value!==F&&(h.value=F,E())},K=F=>{g.value=F},z=F=>{k.value=F},G=F=>{if(k.value)k.value.comment=F.comment,k.value.orig=F.orig;else if("rid"in F){const Y=d.value.find(({objectId:se})=>se===F.rid);if(!Y)return;Array.isArray(Y.children)||(Y.children=[]),Y.children.push(F)}else d.value.unshift(F),o.value+=1},Ie=async({comment:F,status:Y})=>{var se;if(F.status===Y)return;const{serverURL:ke,lang:be}=u.value;await Qt({serverURL:ke,lang:be,token:(se=i.value)==null?void 0:se.token,objectId:F.objectId,comment:{status:Y}}),F.status=Y},Z=async F=>{var Y;if("rid"in F)return;const{serverURL:se,lang:ke}=u.value;await Qt({serverURL:se,lang:ke,token:(Y=i.value)==null?void 0:Y.token,objectId:F.objectId,comment:{sticky:F.sticky?0:1}}),F.sticky=!F.sticky},re=async({objectId:F})=>{var Y;if(!confirm("Are you sure you want to delete this comment?"))return;const{serverURL:se,lang:ke}=u.value;await Ei({serverURL:se,lang:ke,token:(Y=i.value)==null?void 0:Y.token,objectId:F}),d.value.some((be,ye)=>be.objectId===F?(d.value=d.value.filter((Re,gt)=>gt!==ye),!0):be.children.some((Re,gt)=>Re.objectId===F?(d.value[ye].children=be.children.filter((wt,Oe)=>Oe!==gt),!0):!1))},me=async F=>{var Y;const{serverURL:se,lang:ke}=u.value,{objectId:be}=F,ye=s.value.includes(be);await Qt({serverURL:se,lang:ke,objectId:be,token:(Y=i.value)==null?void 0:Y.token,comment:{like:!ye}}),ye?s.value=s.value.filter(Re=>Re!==be):(s.value=[...s.value,be],s.value.length>50&&(s.value=s.value.slice(-50))),F.like=(F.like||0)+(ye?-1:1)};return Ba("config",u),gn(()=>{Ve(()=>[t.serverURL,t.path],()=>E(),{immediate:!0})}),Jr(()=>b==null?void 0:b()),(F,Y)=>(I(),P("div",td,[oe(Bf),!g.value&&!k.value?(I(),at(uo,{key:0,onLog:E,onSubmit:G})):Q("v-if",!0),H("div",nd,[H("div",rd,[o.value?(I(),P("span",{key:0,class:"wl-num",textContent:X(o.value)},null,8,id)):Q("v-if",!0),ct(" "+X($.value.comment),1)]),H("ul",sd,[(I(!0),P(he,null,Be(q(r),se=>(I(),P("li",{key:se,class:ve([se===h.value?"active":""]),onClick:ke=>j(se)},X($.value[se]),11,ld))),128))])]),H("div",od,[(I(!0),P(he,null,Be(d.value,se=>(I(),at(ed,{key:se.objectId,"root-id":se.objectId,comment:se,reply:g.value,edit:k.value,onLog:E,onReply:K,onEdit:z,onSubmit:G,onStatus:Ie,onDelete:re,onSticky:Z,onLike:me},null,8,["root-id","comment","reply","edit"]))),128))]),l.value==="error"?(I(),P("div",ad,[H("button",{type:"button",class:"wl-btn",onClick:E,textContent:X($.value.refresh)},null,8,cd)])):l.value==="loading"?(I(),P("div",ud,[oe(q(En),{size:30})])):d.value.length?a.value<c.value?(I(),P("div",hd,[H("button",{type:"button",class:"wl-btn",onClick:N,textContent:X($.value.more)},null,8,dd)])):Q("v-if",!0):(I(),P("div",{key:3,class:"wl-empty",textContent:X($.value.sofa)},null,8,fd)),u.value.copyright?(I(),P("div",pd,[Y[0]||(Y[0]=ct(" Powered by ")),Y[1]||(Y[1]=H("a",{href:"https://github.com/walinejs/waline",target:"_blank",rel:"noopener noreferrer"}," Waline ",-1)),ct(" v"+X(q(fo)),1)])):Q("v-if",!0)]))}});const ho=(e,t)=>{t.forEach((n,r)=>{const i=e[r].time;typeof i=="number"&&(n.innerText=i.toString())})},po=({serverURL:e,path:t=window.location.pathname,selector:n=".waline-pageview-count",update:r=!0,lang:i=navigator.language})=>{const s=new AbortController,l=Array.from(document.querySelectorAll(n)),o=c=>{const u=ki(c);return u!==null&&t!==u},a=c=>Ii({serverURL:jn(e),paths:c.map(u=>ki(u)??t),lang:i,signal:s.signal}).then(u=>ho(u,c)).catch(El);if(r){const c=l.filter(h=>!o(h)),u=l.filter(o);Mi({serverURL:jn(e),path:t,lang:i}).then(h=>ho(h,c)),u.length&&a(u)}else a(l);return s.abort.bind(s)},md=({el:e="#waline",path:t=window.location.pathname,comment:n=!1,pageview:r=!1,...i})=>{const s=e?hi(e):null;if(e&&!s)throw new Error("Option 'el' do not match any domElement!");if(!i.serverURL)throw new Error("Option 'serverURL' is missing!");const l=cn({...i}),o=cn({comment:n,pageview:r,path:t}),a=()=>{o.comment&&Ql({serverURL:l.serverURL,path:o.path,...Ft(o.comment)?{selector:o.comment}:{}})},c=()=>{o.pageview&&po({serverURL:l.serverURL,path:o.path,...Ft(o.pageview)?{selector:o.pageview}:{}})},u=s?Qc(()=>ne(gd,{path:o.path,...l})):null;u&&u.mount(s);const h=Ks(a),d=Ks(c);return{el:s,update:({comment:g,pageview:k,path:v=window.location.pathname,...$}={})=>{Object.entries($).forEach(([b,C])=>{l[b]=C}),o.path=v,g!==void 0&&(o.comment=g),k!==void 0&&(o.pageview=k)},destroy:()=>{u==null||u.unmount(),h(),d()}}},vd=({el:e,serverURL:t,count:n,lang:r=navigator.language})=>{var i;const s=yr(),l=hi(e),o=new AbortController;return Oi({serverURL:t,count:n,lang:r,signal:o.signal,token:(i=s.value)==null?void 0:i.token}).then(a=>l&&a.length?(l.innerHTML=`<ul class="wl-recent-list">${a.map(c=>`<li class="wl-recent-item"><a href="${c.url}">${c.nick}</a>:${c.comment}</li>`).join("")}</ul>`,{comments:a,destroy:()=>{o.abort(),l.innerHTML=""}}):{comments:a,destroy:()=>o.abort()})},bd=({el:e,serverURL:t,count:n,locale:r,lang:i=navigator.language,mode:s="list"})=>{const l=hi(e),o=new AbortController;return Pi({serverURL:t,pageSize:n,lang:i,signal:o.signal}).then(a=>!l||!a.length?{users:a,destroy:()=>o.abort()}:(r={...Ki(i),...typeof r=="object"?r:{}},l.innerHTML=`<ul class="wl-user-${s}">${a.map((c,u)=>[`<li class="wl-user-item" aria-label="${c.nick}">`,c.link&&`<a href="${c.link}" target="_blank">`,'<div class="wl-user-avatar">',`<img src="${c.avatar}" alt="${c.nick}">`,`<span class="wl-user-badge">${u+1}</span>`,"</div>",'<div class="wl-user-meta">','<div class="wl-user-name">',c.nick,c.level&&`<span class="wl-badge">${r?r[`level${c.level}`]:`Level ${c.level}`}</span>`,c.label&&`<span class="wl-badge">${c.label}</span>`,"</div>",c.link&&c.link,"</div>",c.link&&"</a>","</li>"].filter(h=>h).join("")).join("")}</ul>`,{users:a,destroy:()=>{o.abort(),l.innerHTML=""}}))};export{vd as RecentComments,bd as UserList,Ai as addComment,Ql as commentCount,Pn as defaultLocales,Ei as deleteComment,Ti as fetchCommentCount,kr as getArticleCounter,Ri as getComment,Ii as getPageview,Oi as getRecentComment,Pi as getUserList,md as init,Li as login,po as pageviewCount,On as updateArticleCounter,Qt as updateComment,Mi as updatePageview,fo as version};
|
|
84
84
|
//# sourceMappingURL=waline.js.map
|