Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@waline/client

Package Overview
Dependencies
Maintainers
0
Versions
173
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@waline/client - npm Package Compare versions

Comparing version 3.3.2 to 3.4.0

2

dist/comment.js

@@ -1,2 +0,2 @@

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.3.2";export{v as commentCount,w as version};
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.0";export{v as commentCount,w as version};
//# sourceMappingURL=comment.js.map

@@ -11,3 +11,3 @@ import{h as M,defineComponent as ce,inject as we,ref as C,computed as W,onMounted as ge,watch as ae,onUnmounted as Ve,openBlock as r,createElementBlock as s,createElementVNode as m,toDisplayString as A,Fragment as B,renderList as J,normalizeClass as D,createBlock as ne,unref as w,createCommentVNode as $,onBeforeUnmount as ft,normalizeStyle as Ue,nextTick as He,reactive as yt,createVNode as O,withDirectives as he,vModelDynamic as wt,isRef as kt,vModelText as bt,vShow as Te,createTextVNode as ie,resolveComponent as Ct,provide as $t}from"vue";import{useStorage as oe,useScriptTag as It,useDebounceFn as Et,useEventListener as Fe,useNow as Lt,useStyleTag as xt}from"@vueuse/core";import{getArticleCounter as At,updateArticleCounter as Ne,updateComment as fe,addComment as Mt,login as St,deleteComment as Rt,getComment as jt}from"@waline/api";import We from"autosize";import{Marked as zt}from"marked";import{markedHighlight as _t}from"marked-highlight";import{load as Vt}from"recaptcha-v3";const Be=({size:e})=>M("svg",{class:"wl-close-icon",viewBox:"0 0 1024 1024",width:e,height:e},[M("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"}),M("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"})]),Ut=()=>M("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},M("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"})),Ht=()=>M("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},M("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"})),Tt=()=>M("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},[M("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"}),M("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"})]),Ft=({active:e=!1})=>M("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},[M("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"})]),Nt=()=>M("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},[M("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"}),M("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"})]),Wt=()=>M("svg",{width:"16",height:"16",ariaHidden:"true"},M("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"})),Bt=()=>M("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},M("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"})),Pt=()=>M("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},M("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"})),Dt=()=>M("svg",{class:"verified-icon",viewBox:"0 0 1024 1024",width:"14",height:"14"},M("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"})),ue=({size:e=100})=>M("svg",{width:e,height:e,viewBox:"0 0 100 100",preserveAspectRatio:"xMidYMid"},M("circle",{cx:50,cy:50,fill:"none",stroke:"currentColor",strokeWidth:"4",r:"40","stroke-dasharray":"85 30"},M("animateTransform",{attributeName:"transform",type:"rotate",repeatCount:"indefinite",dur:"1s",values:"0 50 50;360 50 50",keyTimes:"0;1"}))),Ot=()=>M("svg",{width:24,height:24,fill:"currentcolor",viewBox:"0 0 24 24"},[M("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"}),M("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"})]),qt=()=>oe("WALINE_USER_META",{nick:"",mail:"",link:""}),Gt=()=>oe("WALINE_COMMENT_BOX_EDITOR",""),Kt="WALINE_LIKE";let Pe=null;const De=()=>Pe??(Pe=oe(Kt,[])),Zt="WALINE_REACTION";let Oe=null;const Xt=()=>Oe??(Oe=oe(Zt,{})),qe={},Jt=e=>{const a=qe[e]??(qe[e]=Vt(e,{useRecaptchaNet:!0,autoHideBadge:!0}));return{execute:t=>a.then(l=>l.execute(t))}},Yt=e=>({execute:async a=>{const{load:t}=It("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})})})}}),Qt="WALINE_USER";let Ge=null;const ke=()=>Ge??(Ge=oe(Qt,{})),el={key:0,class:"wl-reaction"},tl=["textContent"],ll={class:"wl-reaction-list"},al=["onClick"],nl={class:"wl-reaction-img"},il=["src","alt"],ol=["textContent"],rl=["textContent"];var sl=ce({__name:"ArticleReaction",setup(e,{expose:a}){a();const t=Xt(),l=we("config"),n=C(-1),v=C([]),E=W(()=>l.value.locale),y=W(()=>l.value.reaction.length>0),z=W(()=>{const{reaction:d,path:S}=l.value;return d.map((R,k)=>({icon:R,desc:E.value[`reaction${k}`],active:t.value[S]===k}))});let b;const I=async()=>{if(!y.value)return;const{serverURL:d,lang:S,path:R,reaction:k}=l.value,g=new AbortController;b=g.abort.bind(g);const o=await At({serverURL:d,lang:S,paths:[R],type:k.map((p,F)=>`reaction${F}`),signal:g.signal});v.value=k.map((p,F)=>o[0][`reaction${F}`])},U=async d=>{if(n.value===-1){const{serverURL:S,lang:R,path:k}=l.value,g=t.value[k];n.value=d,g!==void 0&&(await Ne({serverURL:S,lang:R,path:k,type:`reaction${g}`,action:"desc"}),v.value[g]=Math.max(v.value[g]-1,0)),g!==d&&(await Ne({serverURL:S,lang:R,path:k,type:`reaction${d}`}),v.value[d]=(v.value[d]||0)+1),g===d?delete t.value[k]:t.value[k]=d,n.value=-1}};return ge(()=>{ae(()=>[l.value.serverURL,l.value.path],()=>{I()},{immediate:!0})}),Ve(()=>b==null?void 0:b()),(d,S)=>z.value.length?(r(),s("div",el,[m("div",{class:"wl-reaction-title",textContent:A(E.value.reactionTitle)},null,8,tl),m("ul",ll,[(r(!0),s(B,null,J(z.value,({active:R,icon:k,desc:g},o)=>(r(),s("li",{key:o,class:D(["wl-reaction-item",{active:R}]),onClick:p=>U(o)},[m("div",nl,[m("img",{src:k,alt:g},null,8,il),n.value===o?(r(),ne(w(ue),{key:0,class:"wl-reaction-loading"})):(r(),s("div",{key:1,class:"wl-reaction-votes",textContent:A(v.value[o]||0)},null,8,ol))]),m("div",{class:"wl-reaction-text",textContent:A(g)},null,8,rl)],10,al))),128))])])):$("v-if",!0)}});const cl=["data-index"],ul=["src","title","onClick"];var ml=ce({__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=C(null),v=C({}),E=C([]),y=()=>{const d=Math.floor((n.value.getBoundingClientRect().width+t.gap)/(t.columnWidth+t.gap));return d>0?d:1},z=d=>new Array(d).fill(null).map(()=>[]),b=async d=>{var S;if(d>=t.items.length)return;await He();const R=Array.from(((S=n.value)==null?void 0:S.children)??[]).reduce((k,g)=>g.getBoundingClientRect().height<k.getBoundingClientRect().height?g:k);E.value[Number(R.dataset.index)].push(d),await b(d+1)},I=async(d=!1)=>{if(E.value.length===y()&&!d)return;E.value=z(y());const S=window.scrollY;await b(0),window.scrollTo({top:S})},U=d=>{v.value[d.target.src]=!0};return ge(()=>{I(!0),l=new ResizeObserver(()=>{I()}),l.observe(n.value),ae(()=>[t.items],()=>{v.value={},I(!0)}),ae(()=>[t.columnWidth,t.gap],()=>{I()})}),ft(()=>l.unobserve(n.value)),(d,S)=>(r(),s("div",{ref_key:"wall",ref:n,class:"wl-gallery",style:Ue({gap:`${d.gap}px`})},[(r(!0),s(B,null,J(E.value,(R,k)=>(r(),s("div",{key:k,class:"wl-gallery-column","data-index":k,style:Ue({gap:`${d.gap}px`})},[(r(!0),s(B,null,J(R,g=>(r(),s(B,{key:g},[v.value[d.items[g].src]?$("v-if",!0):(r(),ne(w(ue),{key:0,size:36,style:{margin:"20px auto"}})),m("img",{class:"wl-gallery-item",src:d.items[g].src,title:d.items[g].title,loading:"lazy",onLoad:U,onClick:o=>d.$emit("insert",`![](${d.items[g].src})`)},null,40,ul)],64))),128))],12,cl))),128))],4))}});const vl=e=>{try{e=decodeURI(e)}catch{}return e},Ke=(e="")=>e.replace(/\/$/u,""),Ze=e=>/^(https?:)?\/\//.test(e),dl=["nick","mail","link"],Xe=e=>e.filter(a=>dl.includes(a)),Je=["//unpkg.com/@waline/emojis@1.1.0/weibo"],pl=["//unpkg.com/@waline/emojis/tieba/tieba_agree.png","//unpkg.com/@waline/emojis/tieba/tieba_look_down.png","//unpkg.com/@waline/emojis/tieba/tieba_sunglasses.png","//unpkg.com/@waline/emojis/tieba/tieba_pick_nose.png","//unpkg.com/@waline/emojis/tieba/tieba_awkward.png","//unpkg.com/@waline/emojis/tieba/tieba_sleep.png"],gl=e=>new Promise((a,t)=>{if(e.size>128e3)return t(new Error("File too large! File size limit 128KB"));const l=new FileReader;l.readAsDataURL(e),l.onload=()=>{var n;return a(((n=l.result)==null?void 0:n.toString())??"")},l.onerror=t}),hl=e=>e===!0?'<p class="wl-tex">TeX is not available in preview</p>':'<span class="wl-tex">TeX is not available in preview</span>',fl=e=>{const a=async(t,l={})=>fetch(`https://api.giphy.com/v1/gifs/${t}?${new URLSearchParams({lang:e,limit:"20",rating:"g",api_key:"6CIMLkNMMOhRcXPoMCPkFy4Ybk2XUiMp",...l}).toString()}`).then(n=>n.json()).then(({data:n})=>n.map(v=>({title:v.title,src:v.images.downsized_medium.url})));return{search:t=>a("search",{q:t,offset:"0"}),default:()=>a("trending",{}),more:(t,l=0)=>a("search",{q:t,offset:l.toString()})}},yl=/[\u4E00-\u9FFF\u3400-\u4dbf\uf900-\ufaff\u3040-\u309f\uac00-\ud7af\u0400-\u04FF]+|\w+/,wl=/</,kl=/(?:^|\s)\/\/(.+?)$/gm,bl=/\/\*([\S\s]*?)\*\//gm,Cl=new RegExp(`(${yl.source}|${wl.source})|((?:${kl.source})|(?:${bl.source}))`,"gmi"),Ye=["23AC69","91C132","F19726","E8552D","1AAB8E","E1147F","2980C1","1BA1E6","9FA0A0","F19726","E30B20","E30B20","A3338B"],be={},$l=e=>{let a=0;return e.replace(Cl,(t,l,n)=>{if(n)return`<span style="color: slategray">${n}</span>`;if(l==="<")return"&lt;";let v;be[l]?v=be[l]:(v=Ye[a],be[l]=v);const E=`<span style="color: #${v}">${l}</span>`;return a=++a%Ye.length,E})},Il=["nick","nickError","mail","mailError","link","optional","placeholder","sofa","submit","like","cancelLike","reply","cancelReply","comment","refresh","more","preview","emoji","uploadImage","seconds","minutes","hours","days","now","uploading","login","logout","admin","sticky","word","wordHint","anonymous","level0","level1","level2","level3","level4","level5","gif","gifSearchPlaceholder","profile","approved","waiting","spam","unsticky","oldest","latest","hottest","reactionTitle"],Q=e=>Object.fromEntries(e.map((a,t)=>[Il[t],a]));var El=Q(["Benutzername","Der Benutzername darf nicht weniger als 3 Bytes umfassen.","E-Mail","Bitte bestätigen Sie Ihre E-Mail-Adresse.","Webseite","Optional","Kommentieren Sie hier...","Noch keine Kommentare.","Senden","Gefällt mir","Gefällt mir nicht mehr","Antworten","Antwort abbrechen","Kommentare","Aktualisieren","Mehr laden...","Vorschau","Emoji","Ein Bild hochladen","Vor einigen Sekunden","Vor einigen Minuten","Vor einigen Stunden","Vor einigen Tagen","Gerade eben","Hochladen läuft","Anmelden","Abmelden","Admin","Angeheftet","Wörter","Bitte geben Sie Kommentare zwischen $0 und $1 Wörtern ein! Aktuelle Anzahl der Wörter: $2","Anonym","Zwerge","Hobbits","Ents","Magier","Elfen","Maïar","GIF","Nach einem GIF suchen","Profil","Genehmigt","Ausstehend","Spam","Lösen","Älteste","Neueste","Am beliebtesten","Was denken Sie?"]),Qe=Q(["NickName","NickName cannot be less than 3 bytes.","E-Mail","Please confirm your email address.","Website","Optional","Comment here...","No comment yet.","Submit","Like","Cancel like","Reply","Cancel reply","Comments","Refresh","Load More...","Preview","Emoji","Upload Image","seconds ago","minutes ago","hours ago","days ago","just now","Uploading","Login","logout","Admin","Sticky","Words",`Please input comments between $0 and $1 words!

目前字數:$2`,"匿名","潛水","冒泡","吐槽","活躍","多話","傳說","表情包","搜尋表情包","個人資料","通過","待審核","垃圾","取消置頂","最早","最新","熱門","你認為這篇文章怎麼樣?"]);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
![${c.name}](${h})`)}).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.3.2",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};
![${c.name}](${h})`)}).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};
//# sourceMappingURL=component.js.map

@@ -1,2 +0,2 @@

const v="3.3.2",$={"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};
const v="3.4.0",$={"Content-Type":"application/json"},h=e=>`${e.replace(/\/?$/,"/")}api/`,u=(e,t="")=>{if(typeof e=="object"&&e.errno)throw new TypeError(`${t} failed with ${e.errno}: ${e.errmsg}`);return e},f=({serverURL:e,lang:t,paths:r,type:o,signal:a})=>fetch(`${h(e)}article?path=${encodeURIComponent(r.join(","))}&type=${encodeURIComponent(o.join(","))}&lang=${t}`,{signal:a}).then(n=>n.json()).then(n=>u(n,"Get counter").data),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};
//# sourceMappingURL=pageview.js.map

@@ -11,3 +11,3 @@ import{fetchCommentCount as Rt,getArticleCounter as xt,updateArticleCounter as Fe,updateComment as he,addComment as Mt,login as St,deleteComment as jt,getComment as Ut,updatePageview as zt,getPageview as _t,getRecentComment as Vt,getUserList as Ht}from"@waline/api";export*from"@waline/api";import{h as x,defineComponent as ue,inject as $e,ref as E,computed as P,onMounted as fe,watch as ae,onUnmounted as Ne,openBlock as s,createElementBlock as m,createElementVNode as p,toDisplayString as M,Fragment as W,renderList as J,normalizeClass as D,createBlock as ne,unref as L,createCommentVNode as I,onBeforeUnmount as Tt,normalizeStyle as Pe,nextTick as We,reactive as Le,createVNode as O,withDirectives as we,vModelDynamic as Ft,isRef as Nt,vModelText as Pt,vShow as Be,createTextVNode as ie,resolveComponent as Wt,provide as Bt,createApp as Dt,watchEffect as De}from"vue";import{useStorage as oe,useScriptTag as Ot,useDebounceFn as qt,useEventListener as Oe,useNow as Gt,useStyleTag as Kt}from"@vueuse/core";import qe from"autosize";import{Marked as Zt}from"marked";import{markedHighlight as Xt}from"marked-highlight";import{load as Jt}from"recaptcha-v3";const Yt=["nick","mail","link"],Ge=e=>e.filter(a=>Yt.includes(a)),Ke=["//unpkg.com/@waline/emojis@1.1.0/weibo"],Qt=["//unpkg.com/@waline/emojis/tieba/tieba_agree.png","//unpkg.com/@waline/emojis/tieba/tieba_look_down.png","//unpkg.com/@waline/emojis/tieba/tieba_sunglasses.png","//unpkg.com/@waline/emojis/tieba/tieba_pick_nose.png","//unpkg.com/@waline/emojis/tieba/tieba_awkward.png","//unpkg.com/@waline/emojis/tieba/tieba_sleep.png"],el=e=>new Promise((a,t)=>{if(e.size>128e3)return t(new Error("File too large! File size limit 128KB"));const l=new FileReader;l.readAsDataURL(e),l.onload=()=>{var n;return a(((n=l.result)==null?void 0:n.toString())??"")},l.onerror=t}),tl=e=>e===!0?'<p class="wl-tex">TeX is not available in preview</p>':'<span class="wl-tex">TeX is not available in preview</span>',ll=e=>{const a=async(t,l={})=>fetch(`https://api.giphy.com/v1/gifs/${t}?${new URLSearchParams({lang:e,limit:"20",rating:"g",api_key:"6CIMLkNMMOhRcXPoMCPkFy4Ybk2XUiMp",...l}).toString()}`).then(n=>n.json()).then(({data:n})=>n.map(r=>({title:r.title,src:r.images.downsized_medium.url})));return{search:t=>a("search",{q:t,offset:"0"}),default:()=>a("trending",{}),more:(t,l=0)=>a("search",{q:t,offset:l.toString()})}},al=/[\u4E00-\u9FFF\u3400-\u4dbf\uf900-\ufaff\u3040-\u309f\uac00-\ud7af\u0400-\u04FF]+|\w+/,nl=/</,il=/(?:^|\s)\/\/(.+?)$/gm,ol=/\/\*([\S\s]*?)\*\//gm,rl=new RegExp(`(${al.source}|${nl.source})|((?:${il.source})|(?:${ol.source}))`,"gmi"),Ze=["23AC69","91C132","F19726","E8552D","1AAB8E","E1147F","2980C1","1BA1E6","9FA0A0","F19726","E30B20","E30B20","A3338B"],Ee={},sl=e=>{let a=0;return e.replace(rl,(t,l,n)=>{if(n)return`<span style="color: slategray">${n}</span>`;if(l==="<")return"&lt;";let r;Ee[l]?r=Ee[l]:(r=Ze[a],Ee[l]=r);const f=`<span style="color: #${r}">${l}</span>`;return a=++a%Ze.length,f})},cl=["nick","nickError","mail","mailError","link","optional","placeholder","sofa","submit","like","cancelLike","reply","cancelReply","comment","refresh","more","preview","emoji","uploadImage","seconds","minutes","hours","days","now","uploading","login","logout","admin","sticky","word","wordHint","anonymous","level0","level1","level2","level3","level4","level5","gif","gifSearchPlaceholder","profile","approved","waiting","spam","unsticky","oldest","latest","hottest","reactionTitle"],Q=e=>Object.fromEntries(e.map((a,t)=>[cl[t],a]));var ul=Q(["Benutzername","Der Benutzername darf nicht weniger als 3 Bytes umfassen.","E-Mail","Bitte bestätigen Sie Ihre E-Mail-Adresse.","Webseite","Optional","Kommentieren Sie hier...","Noch keine Kommentare.","Senden","Gefällt mir","Gefällt mir nicht mehr","Antworten","Antwort abbrechen","Kommentare","Aktualisieren","Mehr laden...","Vorschau","Emoji","Ein Bild hochladen","Vor einigen Sekunden","Vor einigen Minuten","Vor einigen Stunden","Vor einigen Tagen","Gerade eben","Hochladen läuft","Anmelden","Abmelden","Admin","Angeheftet","Wörter","Bitte geben Sie Kommentare zwischen $0 und $1 Wörtern ein! Aktuelle Anzahl der Wörter: $2","Anonym","Zwerge","Hobbits","Ents","Magier","Elfen","Maïar","GIF","Nach einem GIF suchen","Profil","Genehmigt","Ausstehend","Spam","Lösen","Älteste","Neueste","Am beliebtesten","Was denken Sie?"]),Xe=Q(["NickName","NickName cannot be less than 3 bytes.","E-Mail","Please confirm your email address.","Website","Optional","Comment here...","No comment yet.","Submit","Like","Cancel like","Reply","Cancel reply","Comments","Refresh","Load More...","Preview","Emoji","Upload Image","seconds ago","minutes ago","hours ago","days ago","just now","Uploading","Login","logout","Admin","Sticky","Words",`Please input comments between $0 and $1 words!

目前字數:$2`,"匿名","潛水","冒泡","吐槽","活躍","多話","傳說","表情包","搜尋表情包","個人資料","通過","待審核","垃圾","取消置頂","最早","最新","熱門","你認為這篇文章怎麼樣?"]);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",`![](${g.items[y].src})`)},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
![${v.name}](${k})`)}).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.3.2",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};
![${v.name}](${k})`)}).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};
//# sourceMappingURL=slim.js.map
{
"name": "@waline/client",
"version": "3.3.2",
"version": "3.4.0",
"description": "client for waline comment system",

@@ -85,18 +85,18 @@ "keywords": [

"dependencies": {
"@vueuse/core": "^11.0.3",
"@vueuse/core": "12.0.0-beta.1",
"@waline/api": "1.0.0-alpha.8",
"autosize": "^6.0.1",
"marked": "^14.1.1",
"marked-highlight": "^2.1.4",
"marked": "^15.0.2",
"marked-highlight": "^2.2.1",
"recaptcha-v3": "^1.11.3",
"vue": "^3.5.3"
"vue": "^3.5.13"
},
"devDependencies": {
"@babel/core": "7.25.2",
"@babel/preset-env": "7.25.4",
"@babel/core": "7.26.0",
"@babel/preset-env": "7.26.0",
"@giphy/js-types": "5.1.0",
"@types/autosize": "4.0.3",
"@vitejs/plugin-vue": "5.1.3",
"@vitejs/plugin-vue": "5.2.0",
"user-agent-data-types": "0.4.2",
"vite": "5.4.3"
"vite": "5.4.11"
},

@@ -103,0 +103,0 @@ "engines": {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc