Socket
Socket
Sign inDemoInstall

@waline/client

Package Overview
Dependencies
31
Maintainers
2
Versions
160
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 3.0.0-alpha.12 to 3.0.0

2

dist/comment.js

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

const h=e=>`${e.replace(/\/?$/,"/")}api/`,i=(e,t="")=>{if(typeof e=="object"&&e.errno)throw new TypeError(`${t} failed with ${e.errno}: ${e.errmsg}`);return e},p=({serverURL:e,lang:t,paths:r,signal:o})=>fetch(`${h(e)}comment?type=count&url=${encodeURIComponent(r.join(","))}&lang=${t}`,{signal:o}).then(n=>n.json()).then(n=>i(n,"Get comment count").data),g=e=>{try{e=decodeURI(e)}catch{}return e},m=(e="")=>e.replace(/\/$/u,""),u=e=>/^(https?:)?\/\//.test(e),d=e=>{const t=m(e);return u(t)?t:`https://${t}`},$=e=>{e.name!=="AbortError"&&console.error(e.message)},f=e=>e.dataset.path||null,v=({serverURL:e,path:t=window.location.pathname,selector:r=".waline-comment-count",lang:o=navigator.language})=>{const n=new AbortController,a=document.querySelectorAll(r);return a.length&&p({serverURL:d(e),paths:Array.from(a).map(c=>g(f(c)||t)),lang:o,signal:n.signal}).then(c=>{a.forEach((s,l)=>{s.innerText=c[l].toString()})}).catch($),n.abort.bind(n)},w="3.0.0-alpha.12";export{v as commentCount,w as version};
const i=e=>`${e.replace(/\/?$/,"/")}api/`,h=(e,t="")=>{if(typeof e=="object"&&e.errno)throw new TypeError(`${t} failed with ${e.errno}: ${e.errmsg}`);return e},g=({serverURL:e,lang:t,paths:r,signal:o})=>fetch(`${i(e)}comment?type=count&url=${encodeURIComponent(r.join(","))}&lang=${t}`,{signal:o}).then(n=>n.json()).then(n=>h(n,"Get comment count").data),p=e=>{try{e=decodeURI(e)}catch{}return e},m=(e="")=>e.replace(/\/$/u,""),u=e=>/^(https?:)?\/\//.test(e),d=e=>{const t=m(e);return u(t)?t:`https://${t}`},$=e=>{e.name!=="AbortError"&&console.error(e.message)},f=e=>e.dataset.path||null,v=({serverURL:e,path:t=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(e),paths:Array.from(a).map(c=>p(f(c)||t)),lang:o,signal:n.signal}).then(c=>{a.forEach((s,l)=>{s.innerText=c[l].toString()})}).catch($),n.abort.bind(n)},w="3.0.0";export{v as commentCount,w as version};
//# sourceMappingURL=comment.js.map

@@ -9,3 +9,3 @@ import{h as R,defineComponent as ce,inject as ke,ref as L,computed as W,onMounted as ge,watch as te,onUnmounted as be,openBlock as o,createElementBlock as s,createElementVNode as v,toDisplayString as _,Fragment as D,renderList as X,normalizeClass as q,createBlock as le,unref as w,createCommentVNode as x,onBeforeUnmount as gt,normalizeStyle as Ne,nextTick as ht,reactive as ft,createVNode as G,withDirectives as he,vModelDynamic as yt,isRef as wt,vModelText as kt,vShow as We,createTextVNode as ae,resolveComponent as bt,provide as Ct}from"vue";import{useStorage as re,useScriptTag as $t,useDebounceFn as Lt,useNow as It,useStyleTag as xt}from"@vueuse/core";import{getArticleCounter as Et,updateArticleCounter as De,updateComment as fe,addComment as Rt,login as _t,deleteComment as Mt,getComment as At}from"@waline/api";import Pe from"autosize";import{Marked as St}from"marked";import{markedHighlight as zt}from"marked-highlight";import{load as jt}from"recaptcha-v3";const Be=({size:e})=>R("svg",{class:"wl-close-icon",viewBox:"0 0 1024 1024",width:e,height:e},[R("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"}),R("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=()=>R("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},R("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"})),Vt=()=>R("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},R("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"})),Ht=()=>R("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},[R("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"}),R("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"})]),Tt=({active:e=!1})=>R("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},[R("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"})]),Ft=()=>R("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},[R("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"}),R("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"})]),Nt=()=>R("svg",{width:"16",height:"16",ariaHidden:"true"},R("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"})),Wt=()=>R("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},R("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"})),Dt=()=>R("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},R("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"})),Pt=()=>R("svg",{class:"verified-icon",viewBox:"0 0 1024 1024",width:"14",height:"14"},R("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})=>R("svg",{width:e,height:e,viewBox:"0 0 100 100",preserveAspectRatio:"xMidYMid"},R("circle",{cx:50,cy:50,fill:"none",stroke:"currentColor",strokeWidth:"4",r:"40","stroke-dasharray":"85 30"},R("animateTransform",{attributeName:"transform",type:"rotate",repeatCount:"indefinite",dur:"1s",values:"0 50 50;360 50 50",keyTimes:"0;1"}))),Bt=()=>R("svg",{width:24,height:24,fill:"currentcolor",viewBox:"0 0 24 24"},[R("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"}),R("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"})]),Ot=()=>re("WALINE_USER_META",{nick:"",mail:"",link:""}),qt=()=>re("WALINE_COMMENT_BOX_EDITOR",""),Kt="WALINE_LIKE";let Oe=null;const qe=()=>Oe||(Oe=re(Kt,[])),Zt="WALINE_REACTION";let Ke=null;const Gt=()=>Ke??(Ke=re(Zt,{})),Ze={},Jt=e=>{const a=Ze[e]??(Ze[e]=jt(e,{useRecaptchaNet:!0,autoHideBadge:!0}));return{execute:l=>a.then(t=>t.execute(l))}},Xt=e=>({execute:async a=>{const{load:l}=$t("https://challenges.cloudflare.com/turnstile/v0/api.js",void 0,{async:!1});await l();const t=window==null?void 0:window.turnstile;return new Promise(u=>{t==null||t.ready(()=>{t==null||t.render(".wl-captcha-container",{sitekey:e,action:a,size:"compact",callback:u})})})}}),Yt="WALINE_USER";let Ge=null;const Ce=()=>Ge??(Ge=re(Yt,{})),Qt={key:0,class:"wl-reaction"},el=["textContent"],tl={class:"wl-reaction-list"},ll=["onClick"],al={class:"wl-reaction-img"},nl=["src","alt"],ol=["textContent"],il=["textContent"];var rl=ce({__name:"ArticleReaction",setup(e,{expose:a}){a();const l=Gt(),t=ke("config"),u=L(-1),i=L([]),k=W(()=>t.value.locale),M=W(()=>t.value.reaction.length>0),b=W(()=>{const{reaction:m,path:A}=t.value;return m.map((z,$)=>({icon:z,desc:k.value[`reaction${$}`],active:l.value[A]===$}))});let I;const C=async()=>{if(M.value){const{serverURL:m,lang:A,path:z,reaction:$}=t.value,p=new AbortController;I=p.abort.bind(p);const n=await Et({serverURL:m,lang:A,paths:[z],type:$.map((d,F)=>`reaction${F}`),signal:p.signal});if(Array.isArray(n)||typeof n=="number")return;i.value=$.map((d,F)=>n[`reaction${F}`])}},V=async m=>{if(u.value===-1){const{serverURL:A,lang:z,path:$}=t.value,p=l.value[$];u.value=m,p!==void 0&&(await De({serverURL:A,lang:z,path:$,type:`reaction${p}`,action:"desc"}),i.value[p]=Math.max(i.value[p]-1,0)),p!==m&&(await De({serverURL:A,lang:z,path:$,type:`reaction${m}`}),i.value[m]=(i.value[m]||0)+1),p===m?delete l.value[$]:l.value[$]=m,u.value=-1}};return ge(()=>{te(()=>[t.value.serverURL,t.value.path],()=>{C()},{immediate:!0})}),be(()=>I==null?void 0:I()),(m,A)=>b.value.length?(o(),s("div",Qt,[v("div",{class:"wl-reaction-title",textContent:_(k.value.reactionTitle)},null,8,el),v("ul",tl,[(o(!0),s(D,null,X(b.value,({active:z,icon:$,desc:p},n)=>(o(),s("li",{key:n,class:q(["wl-reaction-item",{active:z}]),onClick:d=>V(n)},[v("div",al,[v("img",{src:$,alt:p},null,8,nl),u.value===n?(o(),le(w(ue),{key:0,class:"wl-reaction-loading"})):(o(),s("div",{key:1,class:"wl-reaction-votes",textContent:_(i.value[n]||0)},null,8,ol))]),v("div",{class:"wl-reaction-text",textContent:_(p)},null,8,il)],10,ll))),128))])])):x("v-if",!0)}}),ve=(e,a)=>{const l=e.__vccOpts||e;for(const[t,u]of a)l[t]=u;return l},sl=ve(rl,[["__file","ArticleReaction.vue"]]);const cl=["data-index"],ul=["src","title","onClick"];var vl=ce({__name:"ImageWall",props:{items:{default:()=>[]},columnWidth:{default:300},gap:{default:0}},emits:["insert"],setup(e,{expose:a}){const l=e;a();let t=null;const u=L(null),i=L({}),k=L([]),M=()=>{const m=Math.floor((u.value.getBoundingClientRect().width+l.gap)/(l.columnWidth+l.gap));return m>0?m:1},b=m=>new Array(m).fill(null).map(()=>[]),I=async m=>{var A;if(m>=l.items.length)return;await ht();const z=Array.from(((A=u.value)==null?void 0:A.children)||[]).reduce(($,p)=>p.getBoundingClientRect().height<$.getBoundingClientRect().height?p:$);k.value[Number(z.dataset.index)].push(m),await I(m+1)},C=async(m=!1)=>{if(k.value.length===M()&&!m)return;k.value=b(M());const A=window.scrollY;await I(0),window.scrollTo({top:A})},V=m=>{i.value[m.target.src]=!0};return ge(()=>{C(!0),t=new ResizeObserver(()=>{C()}),t.observe(u.value),te(()=>[l.items],()=>{i.value={},C(!0)}),te(()=>[l.columnWidth,l.gap],()=>{C()})}),gt(()=>t.unobserve(u.value)),(m,A)=>(o(),s("div",{ref_key:"wall",ref:u,class:"wl-gallery",style:Ne({gap:`${m.gap}px`})},[(o(!0),s(D,null,X(k.value,(z,$)=>(o(),s("div",{key:$,class:"wl-gallery-column","data-index":$,style:Ne({gap:`${m.gap}px`})},[(o(!0),s(D,null,X(z,p=>(o(),s(D,{key:p},[i.value[m.items[p].src]?x("v-if",!0):(o(),le(w(ue),{key:0,size:36,style:{margin:"20px auto"}})),v("img",{class:"wl-gallery-item",src:m.items[p].src,title:m.items[p].title,loading:"lazy",onLoad:V,onClick:n=>m.$emit("insert",`![](${m.items[p].src})`)},null,40,ul)],64))),128))],12,cl))),128))],4))}}),ml=ve(vl,[["__file","ImageWall.vue"]]);const dl=e=>{try{e=decodeURI(e)}catch{}return e},Je=(e="")=>e.replace(/\/$/u,""),Xe=e=>/^(https?:)?\/\//.test(e),pl=["nick","mail","link"],Ye=e=>e.filter(a=>pl.includes(a)),Qe=["//unpkg.com/@waline/emojis@1.1.0/weibo"],gl=["//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"],hl=e=>new Promise((a,l)=>{if(e.size>128*1e3)return l(new Error("File too large! File size limit 128KB"));const t=new FileReader;t.readAsDataURL(e),t.onload=()=>{var u;return a(((u=t.result)==null?void 0:u.toString())||"")},t.onerror=l}),fl=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>',yl=e=>{const a=async(l,t={})=>fetch(`https://api.giphy.com/v1/gifs/${l}?${new URLSearchParams({lang:e,limit:"20",rating:"g",api_key:"6CIMLkNMMOhRcXPoMCPkFy4Ybk2XUiMp",...t}).toString()}`).then(u=>u.json()).then(({data:u})=>u.map(i=>({title:i.title,src:i.images.downsized_medium.url})));return{search:l=>a("search",{q:l,offset:"0"}),default:()=>a("trending",{}),more:(l,t=0)=>a("search",{q:l,offset:t.toString()})}},wl=/[\u4E00-\u9FFF\u3400-\u4dbf\uf900-\ufaff\u3040-\u309f\uac00-\ud7af\u0400-\u04FF]+|\w+/,kl=/</,bl=/(?:^|\s)\/\/(.+?)$/gm,Cl=/\/\*([\S\s]*?)\*\//gm,$l=new RegExp(`(${wl.source}|${kl.source})|((?:${bl.source})|(?:${Cl.source}))`,"gmi"),et=["23AC69","91C132","F19726","E8552D","1AAB8E","E1147F","2980C1","1BA1E6","9FA0A0","F19726","E30B20","E30B20","A3338B"],$e={},Ll=e=>{let a=0;return e.replace($l,(l,t,u)=>{if(u)return`<span style="color: slategray">${u}</span>`;if(t==="<")return"&lt;";let i;$e[t]?i=$e[t]:(i=et[a],$e[t]=i);const k=`<span style="color: #${i}">${t}</span>`;return a=++a%et.length,k})},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"],oe=e=>Object.fromEntries(e.map((a,l)=>[Il[l],a]));var tt=oe(["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 it="en-US",Le={zh:ot,"zh-cn":ot,"zh-tw":El,en:tt,"en-us":tt,fr:lt,"fr-fr":lt,jp:at,"jp-jp":at,"pt-br":xl,ru:nt,"ru-ru":nt},Rl=e=>Le[e.toLowerCase()]||Le[it],_l=e=>Object.keys(Le).includes(e.toLowerCase())?e:it,Ml=e=>{const a=Je(e);return Xe(a)?a:`https://${a}`},Al=e=>Array.isArray(e)?e:e?[0,e]:!1,Ie=(e,a)=>typeof e=="function"?e:e===!1?!1:a,Sl=({serverURL:e,path:a=location.pathname,lang:l=typeof navigator>"u"?"en-US":navigator.language,locale:t,emoji:u=Qe,meta:i=["nick","mail","link"],requiredMeta:k=[],dark:M=!1,pageSize:b=10,wordLimit:I,imageUploader:C,highlighter:V,texRenderer:m,copyright:A=!0,login:z="enable",search:$,reaction:p,recaptchaV3Key:n="",turnstileKey:d="",commentSorting:F="latest",...P})=>({serverURL:Ml(e),path:dl(a),lang:_l(l),locale:{...Rl(l),...typeof t=="object"?t:{}},wordLimit:Al(I),meta:Ye(i),requiredMeta:Ye(k),imageUploader:Ie(C,hl),highlighter:Ie(V,Ll),texRenderer:Ie(m,fl),dark:M,emoji:typeof u=="boolean"?u?Qe:[]:u,pageSize:b,login:z,copyright:A,search:$===!1?!1:typeof $=="object"?$:yl(l),recaptchaV3Key:n,turnstileKey:d,reaction:Array.isArray(p)?p:p===!0?gl:[],commentSorting:F,...P}),xe=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}",zl=e=>xe(e)?e==="auto"?`@media(prefers-color-scheme:dark){body${Ee}}`:`${e}${Ee}`:e===!0?`:root${Ee}`:"",Re=(e,a)=>{let l=e.toString();for(;l.length<a;)l="0"+l;return l},jl=e=>{const a=Re(e.getDate(),2),l=Re(e.getMonth()+1,2);return`${Re(e.getFullYear(),2)}-${l}-${a}`},Ul=(e,a,l)=>{if(!e)return"";const t=xe(e)?new Date(e.indexOf(" ")!==-1?e.replace(/-/g,"/"):e):e,u=a.getTime()-t.getTime(),i=Math.floor(u/(24*3600*1e3));if(i===0){const k=u%864e5,M=Math.floor(k/(3600*1e3));if(M===0){const b=k%36e5,I=Math.floor(b/(60*1e3));if(I===0){const C=b%6e4;return`${Math.round(C/1e3)} ${l.seconds}`}return`${I} ${l.minutes}`}return`${M} ${l.hours}`}return i<0?l.now:i<8?`${i} ${l.days}`:jl(t)},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])?)*$/,Hl=e=>Vl.test(e),Tl=e=>!!/@[0-9]+\.[0-9]+\.[0-9]+/.test(e),Fl=e=>{const a=re("WALINE_EMOJI",{}),l=Tl(e);if(l){const t=a.value[e];if(t)return Promise.resolve(t)}return fetch(`${e}/info.json`).then(t=>t.json()).then(t=>{const u={folder:e,...t};return l&&(a.value[e]=u),u})},rt=(e,a="",l="",t="")=>`${a?`${a}/`:""}${l}${e}${t?`.${t}`:""}`,Nl=e=>Promise.all(e.map(a=>xe(a)?Fl(Je(a)):Promise.resolve(a))).then(a=>{const l={tabs:[],map:{}};return a.forEach(t=>{const{name:u,folder:i,icon:k,prefix:M,type:b,items:I}=t;l.tabs.push({name:u,icon:rt(k,i,M,b),items:I.map(C=>{const V=`${M||""}${C}`;return l.map[V]=rt(C,i,M,b),V})})}),l}),Wl=e=>e.type.includes("image"),st=e=>{const a=Array.from(e).find(Wl);return a?a.getAsFile():null},Dl=/\$.*?\$/,Pl=/^\$(.*?)\$/,Bl=/^(?:\s{0,3})\$\$((?:[^\n]|\n[^\n])+?)\n{0,1}\$\$/,Ol=e=>[{name:"blockMath",level:"block",tokenizer(a){const l=Bl.exec(a);if(l!==null)return{type:"html",raw:l[0],text:e(!0,l[1])}}},{name:"inlineMath",level:"inline",start(a){const l=a.search(Dl);return l!==-1?l:a.length},tokenizer(a){const l=Pl.exec(a);if(l!==null)return{type:"html",raw:l[0],text:e(!1,l[1])}}}],ct=(e="",a={})=>e.replace(/:(.+?):/g,(l,t)=>a[t]?`<img class="wl-emoji" src="${a[t]}" alt="${t}">`:l),ql=(e,{emojiMap:a,highlighter:l,texRenderer:t})=>{const u=new St;if(u.setOptions({breaks:!0}),l&&u.use(zt({highlight:l})),t){const i=Ol(t);u.use({extensions:i})}return u.parse(ct(e,a))},Kl=e=>e.match(/[\w\d\s,.\u00C0-\u024F\u0400-\u04FF]+/giu),Zl=e=>e.match(/[\u4E00-\u9FD5]/gu),Gl=e=>{var a,l;return(((a=Kl(e))==null?void 0:a.reduce((t,u)=>t+(["",",","."].includes(u.trim())?0:u.trim().split(/\s+/u).length),0))||0)+(((l=Zl(e))==null?void 0:l.length)||0)},Jl=async()=>{if(!navigator)return"";const{userAgentData:e}=navigator;let a=navigator.userAgent;if(!e||e.platform!=="Windows")return a;const{platformVersion:l}=await e.getHighEntropyValues(["platformVersion"]);return l&&parseInt(l.split(".")[0])>=13&&(a=a.replace("Windows NT 10.0","Windows NT 11.0")),a},Xl={class:"wl-comment"},Yl={key:0,class:"wl-login-info"},Ql={class:"wl-avatar"},ea=["title"],ta=["title"],la=["src"],aa=["title","textContent"],na={class:"wl-panel"},oa=["for","textContent"],ia=["id","onUpdate:modelValue","name","type"],ra=["placeholder"],sa={class:"wl-preview"},ca=v("hr",null,null,-1),ua=["innerHTML"],va={class:"wl-footer"},ma={class:"wl-actions"},da={href:"https://guides.github.com/features/mastering-markdown/",title:"Markdown Guide","aria-label":"Markdown is supported",class:"wl-action",target:"_blank",rel:"noopener noreferrer"},pa=["title"],ga=["title"],ha=["title"],fa=["title"],ya={class:"wl-info"},wa=v("div",{class:"wl-captcha-container"},null,-1),ka={class:"wl-text-number"},ba={key:0},Ca=["textContent"],$a=["textContent"],La=["disabled"],Ia=["placeholder"],xa={key:1,class:"wl-loading"},Ea={key:0,class:"wl-tab-wrapper"},Ra=["title","onClick"],_a=["src","alt"],Ma={key:0,class:"wl-tabs"},Aa=["onClick"],Sa=["src","alt","title"],za=["title"];var ja=ce({__name:"CommentBox",props:{edit:{default:null},rootId:{default:""},replyId:{default:""},replyUser:{default:""}},emits:["log","cancelEdit","cancelReply","submit"],setup(e,{expose:a,emit:l}){const t=e,u=l;a();const i=ke("config"),k=qt(),M=Ot(),b=Ce(),I=L({}),C=L(null),V=L(null),m=L(null),A=L(null),z=L(null),$=L(null),p=L(null),n=L({tabs:[],map:{}}),d=L(0),F=L(!1),P=L(!1),E=L(!1),j=L(""),ie=L(0),H=ft({loading:!0,list:[]}),ne=L(0),ee=L(!1),me=L(""),Y=L(!1),y=L(!1),g=W(()=>i.value.locale),S=W(()=>{var c;return!!((c=b.value)!=null&&c.token)}),K=W(()=>i.value.imageUploader!==!1),B=c=>{const r=C.value,h=r.selectionStart,U=r.selectionEnd||0,f=r.scrollTop;k.value=r.value.substring(0,h)+c+r.value.substring(U,r.value.length),r.focus(),r.selectionStart=h+c.length,r.selectionEnd=h+c.length,r.scrollTop=f},J=c=>{const r=c.key;(c.ctrlKey||c.metaKey)&&r==="Enter"&&Me()},Z=c=>{const r=`![${i.value.locale.uploading} ${c.name}]()`;return B(r),Y.value=!0,Promise.resolve().then(()=>i.value.imageUploader(c)).then(h=>{k.value=k.value.replace(r,`\r
![${c.name}](${h})`)}).catch(h=>{alert(h.message),k.value=k.value.replace(r,"")}).then(()=>{Y.value=!1})},se=c=>{var r;if((r=c.dataTransfer)!=null&&r.items){const h=st(c.dataTransfer.items);h&&K.value&&(Z(h),c.preventDefault())}},_e=c=>{if(c.clipboardData){const r=st(c.clipboardData.items);r&&K.value&&Z(r)}},ye=()=>{const c=V.value;c.files&&K.value&&Z(c.files[0]).then(()=>{c.value=""})},Me=async()=>{var c,r,h,U,f,O;const{serverURL:N,lang:Q,login:de,wordLimit:Ve,requiredMeta:He,recaptchaV3Key:Te,turnstileKey:Fe}=i.value,pt=await Jl(),T={comment:me.value,nick:M.value.nick,mail:M.value.mail,link:M.value.link,url:i.value.path,ua:pt};if((c=b.value)!=null&&c.token)T.nick=b.value.display_name,T.mail=b.value.email,T.link=b.value.url;else{if(de==="force")return;if(He.indexOf("nick")>-1&&!T.nick)return(r=I.value.nick)==null||r.focus(),alert(g.value.nickError);if(He.indexOf("mail")>-1&&!T.mail||T.mail&&!Hl(T.mail))return(h=I.value.mail)==null||h.focus(),alert(g.value.mailError);T.nick||(T.nick=g.value.anonymous)}if(!T.comment){(U=C.value)==null||U.focus();return}if(!ee.value)return alert(g.value.wordHint.replace("$0",Ve[0].toString()).replace("$1",Ve[1].toString()).replace("$2",ie.value.toString()));T.comment=ct(T.comment,n.value.map),t.replyId&&t.rootId&&(T.pid=t.replyId,T.rid=t.rootId,T.at=t.replyUser),Y.value=!0;try{Te&&(T.recaptchaV3=await Jt(Te).execute("social")),Fe&&(T.turnstile=await Xt(Fe).execute("social"));const pe={serverURL:N,lang:Q,token:(f=b.value)==null?void 0:f.token,comment:T},we=await(t.edit?fe({objectId:t.edit.objectId,...pe}):Rt(pe));if(Y.value=!1,we.errmsg)return alert(we.errmsg);u("submit",we.data),k.value="",j.value="",t.replyId&&u("cancelReply"),(O=t.edit)!=null&&O.objectId&&u("cancelEdit")}catch(pe){Y.value=!1,alert(pe.message)}},mt=c=>{c.preventDefault();const{lang:r,serverURL:h}=i.value;_t({serverURL:h,lang:r}).then(U=>{b.value=U,(U.remember?localStorage:sessionStorage).setItem("WALINE_USER",JSON.stringify(U)),u("log")})},dt=()=>{b.value={},localStorage.setItem("WALINE_USER","null"),sessionStorage.setItem("WALINE_USER","null"),u("log")},Ae=c=>{c.preventDefault();const{lang:r,serverURL:h}=i.value,U=800,f=800,O=(window.innerWidth-U)/2,N=(window.innerHeight-f)/2,Q=new URLSearchParams({lng:r,token:b.value.token}),de=window.open(`${h}/ui/profile?${Q.toString()}`,"_blank",`width=${U},height=${f},left=${O},top=${N},scrollbars=no,resizable=no,status=no,location=no,toolbar=no,menubar=no`);de==null||de.postMessage({type:"TOKEN",data:b.value.token},"*")},Se=c=>{var r,h,U,f;!((r=m.value)!=null&&r.contains(c.target))&&!((h=A.value)!=null&&h.contains(c.target))&&(F.value=!1),!((U=z.value)!=null&&U.contains(c.target))&&!((f=$.value)!=null&&f.contains(c.target))&&(P.value=!1)},ze=async c=>{var r;const{scrollTop:h,clientHeight:U,scrollHeight:f}=c.target,O=(U+h)/f,N=i.value.search,Q=((r=p.value)==null?void 0:r.value)||"";O<.9||H.loading||y.value||(H.loading=!0,(N.more&&H.list.length?await N.more(Q,H.list.length):await N.search(Q)).length?H.list=[...H.list,...N.more&&H.list.length?await N.more(Q,H.list.length):await N.search(Q)]:y.value=!0,H.loading=!1,setTimeout(()=>{c.target.scrollTop=h},50))},je=Lt(c=>{H.list=[],y.value=!1,ze(c)},300);te([i,ie],([c,r])=>{const{wordLimit:h}=c;h?r<h[0]&&h[0]!==0?(ne.value=h[0],ee.value=!1):r>h[1]?(ne.value=h[1],ee.value=!1):(ne.value=h[1],ee.value=!0):(ne.value=0,ee.value=!0)},{immediate:!0});const Ue=({data:c})=>{!c||c.type!=="profile"||(b.value={...b.value,...c.data},[localStorage,sessionStorage].filter(r=>r.getItem("WALINE_USER")).forEach(r=>r.setItem("WALINE_USER",JSON.stringify(b))))};return ge(()=>{var c;document.body.addEventListener("click",Se),window.addEventListener("message",Ue),(c=t.edit)!=null&&c.objectId&&(k.value=t.edit.orig),te(P,async r=>{if(!r)return;const h=i.value.search;p.value&&(p.value.value=""),H.loading=!0,H.list=h.default?await h.default():await h.search(""),H.loading=!1}),te(()=>k.value,r=>{const{highlighter:h,texRenderer:U}=i.value;me.value=r,j.value=ql(r,{emojiMap:n.value.map,highlighter:h,texRenderer:U}),ie.value=Gl(r),r?Pe(C.value):Pe.destroy(C.value)},{immediate:!0}),te(()=>i.value.emoji,r=>Nl(r).then(h=>{n.value=h}),{immediate:!0})}),be(()=>{document.body.removeEventListener("click",Se),window.removeEventListener("message",Ue)}),(c,r)=>{var h,U;return o(),s("div",Xl,[w(i).login!=="disable"&&S.value&&!((h=c.edit)!=null&&h.objectId)?(o(),s("div",Yl,[v("div",Ql,[v("button",{type:"submit",class:"wl-logout-btn",title:g.value.logout,onClick:dt},[G(w(Be),{size:14})],8,ea),v("a",{href:"#",class:"wl-login-nick","aria-label":"Profile",title:g.value.profile,onClick:Ae},[v("img",{src:w(b).avatar,alt:"avatar"},null,8,la)],8,ta)]),v("a",{href:"#",class:"wl-login-nick","aria-label":"Profile",title:g.value.profile,onClick:Ae,textContent:_(w(b).display_name)},null,8,aa)])):x("v-if",!0),v("div",na,[w(i).login!=="force"&&w(i).meta.length&&!S.value?(o(),s("div",{key:0,class:q(["wl-header",`item${w(i).meta.length}`])},[(o(!0),s(D,null,X(w(i).meta,f=>(o(),s("div",{key:f,class:"wl-header-item"},[v("label",{for:`wl-${f}`,textContent:_(g.value[f]+(w(i).requiredMeta.includes(f)||!w(i).requiredMeta.length?"":`(${g.value.optional})`))},null,8,oa),he(v("input",{id:`wl-${f}`,ref_for:!0,ref:O=>{O&&(I.value[f]=O)},"onUpdate:modelValue":O=>w(M)[f]=O,class:q(["wl-input",`wl-${f}`]),name:f,type:f==="mail"?"email":"text"},null,10,ia),[[yt,w(M)[f]]])]))),128))],2)):x("v-if",!0),he(v("textarea",{id:"wl-edit",ref_key:"editorRef",ref:C,"onUpdate:modelValue":r[0]||(r[0]=f=>wt(k)?k.value=f:null),class:"wl-editor",placeholder:c.replyUser?`@${c.replyUser}`:g.value.placeholder,onKeydown:J,onDrop:se,onPaste:_e},null,40,ra),[[kt,w(k)]]),he(v("div",sa,[ca,v("h4",null,_(g.value.preview)+":",1),v("div",{class:"wl-content",innerHTML:j.value},null,8,ua)],512),[[We,E.value]]),v("div",va,[v("div",ma,[v("a",da,[G(w(Nt))]),he(v("button",{ref_key:"emojiButtonRef",ref:m,type:"button",class:q(["wl-action",{active:F.value}]),title:g.value.emoji,onClick:r[1]||(r[1]=f=>F.value=!F.value)},[G(w(Vt))],10,pa),[[We,n.value.tabs.length]]),w(i).search?(o(),s("button",{key:0,ref_key:"gifButtonRef",ref:z,type:"button",class:q(["wl-action",{active:P.value}]),title:g.value.gif,onClick:r[2]||(r[2]=f=>P.value=!P.value)},[G(w(Bt))],10,ga)):x("v-if",!0),v("input",{id:"wl-image-upload",ref_key:"imageUploadRef",ref:V,class:"upload",type:"file",accept:".png,.jpg,.jpeg,.webp,.bmp,.gif",onChange:ye},null,544),K.value?(o(),s("label",{key:1,for:"wl-image-upload",class:"wl-action",title:g.value.uploadImage},[G(w(Ht))],8,ha)):x("v-if",!0),v("button",{type:"button",class:q(["wl-action",{active:E.value}]),title:g.value.preview,onClick:r[3]||(r[3]=f=>E.value=!E.value)},[G(w(Ft))],10,fa)]),v("div",ya,[wa,v("div",ka,[ae(_(ie.value)+" ",1),w(i).wordLimit?(o(),s("span",ba,[ae("  /  "),v("span",{class:q({illegal:!ee.value}),textContent:_(ne.value)},null,10,Ca)])):x("v-if",!0),ae("  "+_(g.value.word),1)]),w(i).login!=="disable"&&!S.value?(o(),s("button",{key:0,type:"button",class:"wl-btn",onClick:mt,textContent:_(g.value.login)},null,8,$a)):x("v-if",!0),w(i).login!=="force"||S.value?(o(),s("button",{key:1,type:"submit",class:"primary wl-btn",title:"Cmd|Ctrl + Enter",disabled:Y.value,onClick:Me},[Y.value?(o(),le(w(ue),{key:0,size:16})):(o(),s(D,{key:1},[ae(_(g.value.submit),1)],64))],8,La)):x("v-if",!0)]),v("div",{ref_key:"gifPopupRef",ref:$,class:q(["wl-gif-popup",{display:P.value}])},[v("input",{ref_key:"gifSearchInputRef",ref:p,type:"text",placeholder:g.value.gifSearchPlaceholder,onInput:r[4]||(r[4]=(...f)=>w(je)&&w(je)(...f))},null,40,Ia),H.list.length?(o(),le(ml,{key:0,items:H.list,"column-width":200,gap:6,onInsert:r[5]||(r[5]=f=>B(f)),onScroll:ze},null,8,["items"])):x("v-if",!0),H.loading?(o(),s("div",xa,[G(w(ue),{size:30})])):x("v-if",!0)],2),v("div",{ref_key:"emojiPopupRef",ref:A,class:q(["wl-emoji-popup",{display:F.value}])},[(o(!0),s(D,null,X(n.value.tabs,(f,O)=>(o(),s(D,{key:f.name},[O===d.value?(o(),s("div",Ea,[(o(!0),s(D,null,X(f.items,N=>(o(),s("button",{key:N,type:"button",title:N,onClick:Q=>B(`:${N}:`)},[F.value?(o(),s("img",{key:0,class:"wl-emoji",src:n.value.map[N],alt:N,loading:"lazy",referrerPolicy:"no-referrer"},null,8,_a)):x("v-if",!0)],8,Ra))),128))])):x("v-if",!0)],64))),128)),n.value.tabs.length>1?(o(),s("div",Ma,[(o(!0),s(D,null,X(n.value.tabs,(f,O)=>(o(),s("button",{key:f.name,type:"button",class:q(["wl-tab",{active:d.value===O}]),onClick:N=>d.value=O},[v("img",{class:"wl-emoji",src:f.icon,alt:f.name,title:f.name,loading:"lazy",referrerPolicy:"no-referrer"},null,8,Sa)],10,Aa))),128))])):x("v-if",!0)],2)])]),c.replyId||(U=c.edit)!=null&&U.objectId?(o(),s("button",{key:1,type:"button",class:"wl-close",title:g.value.cancelReply,onClick:r[6]||(r[6]=f=>c.$emit(c.replyId?"cancelReply":"cancelEdit"))},[G(w(Be),{size:24})],8,za)):x("v-if",!0)])}}}),ut=ve(ja,[["__file","CommentBox.vue"]]);const Ua=["id"],Va={class:"wl-user","aria-hidden":"true"},Ha=["src"],Ta={class:"wl-card"},Fa={class:"wl-head"},Na=["href"],Wa={key:1,class:"wl-nick"},Da=["textContent"],Pa=["textContent"],Ba=["textContent"],Oa=["textContent"],qa=["textContent"],Ka={class:"wl-comment-actions"},Za=["title"],Ga=["title"],Ja={class:"wl-meta","aria-hidden":"true"},Xa=["data-value","textContent"],Ya=["innerHTML"],Qa={key:1,class:"wl-admin-actions"},en={class:"wl-comment-status"},tn=["disabled","onClick","textContent"],ln={key:3,class:"wl-quote"};var an=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 l=e,t=a,u=["approved","waiting","spam"],i=ke("config"),k=qe(),M=It(),b=Ce(),I=W(()=>i.value.locale),C=W(()=>{const{link:n}=l.comment;return n?Xe(n)?n:`https://${n}`:""}),V=W(()=>k.value.includes(l.comment.objectId)),m=W(()=>Ul(new Date(l.comment.time),M.value,I.value)),A=W(()=>b.value.type==="administrator"),z=W(()=>l.comment.user_id&&b.value.objectId===l.comment.user_id),$=W(()=>{var n;return l.comment.objectId===((n=l.reply)==null?void 0:n.objectId)}),p=W(()=>{var n;return l.comment.objectId===((n=l.edit)==null?void 0:n.objectId)});return(n,d)=>{var F;const P=bt("CommentCard",!0);return o(),s("div",{id:n.comment.objectId,class:"wl-card-item"},[v("div",Va,[n.comment.avatar?(o(),s("img",{key:0,class:"wl-user-avatar",src:n.comment.avatar},null,8,Ha)):x("v-if",!0),n.comment.type?(o(),le(w(Pt),{key:1})):x("v-if",!0)]),v("div",Ta,[v("div",Fa,[C.value?(o(),s("a",{key:0,class:"wl-nick",href:C.value,target:"_blank",rel:"nofollow noopener noreferrer"},_(n.comment.nick),9,Na)):(o(),s("span",Wa,_(n.comment.nick),1)),n.comment.type==="administrator"?(o(),s("span",{key:2,class:"wl-badge",textContent:_(I.value.admin)},null,8,Da)):x("v-if",!0),n.comment.label?(o(),s("span",{key:3,class:"wl-badge",textContent:_(n.comment.label)},null,8,Pa)):x("v-if",!0),n.comment.sticky?(o(),s("span",{key:4,class:"wl-badge",textContent:_(I.value.sticky)},null,8,Ba)):x("v-if",!0),typeof n.comment.level=="number"?(o(),s("span",{key:5,class:q(`wl-badge level${n.comment.level}`),textContent:_(I.value[`level${n.comment.level}`]||`Level ${n.comment.level}`)},null,10,Oa)):x("v-if",!0),v("span",{class:"wl-time",textContent:_(m.value)},null,8,qa),v("div",Ka,[A.value||z.value?(o(),s(D,{key:0},[v("button",{type:"button",class:"wl-edit",onClick:d[0]||(d[0]=E=>t("edit",n.comment))},[G(w(Dt))]),v("button",{type:"button",class:"wl-delete",onClick:d[1]||(d[1]=E=>t("delete",n.comment))},[G(w(Ut))])],64)):x("v-if",!0),v("button",{type:"button",class:"wl-like",title:V.value?I.value.cancelLike:I.value.like,onClick:d[2]||(d[2]=E=>t("like",n.comment))},[G(w(Tt),{active:V.value},null,8,["active"]),ae(" "+_("like"in n.comment?n.comment.like:""),1)],8,Za),v("button",{type:"button",class:q(["wl-reply",{active:$.value}]),title:$.value?I.value.cancelReply:I.value.reply,onClick:d[3]||(d[3]=E=>t("reply",$.value?null:n.comment))},[G(w(Wt))],10,Ga)])]),v("div",Ja,[(o(),s(D,null,X(["addr","browser","os"],E=>(o(),s(D,null,[n.comment[E]?(o(),s("span",{key:E,class:q(`wl-${E}`),"data-value":n.comment[E],textContent:_(n.comment[E])},null,10,Xa)):x("v-if",!0)],64))),64))]),p.value?x("v-if",!0):(o(),s("div",{key:0,class:"wl-content",innerHTML:n.comment.comment},null,8,Ya)),A.value&&!p.value?(o(),s("div",Qa,[v("span",en,[(o(),s(D,null,X(u,E=>v("button",{key:E,type:"submit",class:q(`wl-btn wl-${E}`),disabled:n.comment.status===E,onClick:j=>t("status",{status:E,comment:n.comment}),textContent:_(I.value[E])},null,10,tn)),64))]),A.value&&!("rid"in n.comment)?(o(),s("button",{key:0,type:"submit",class:"wl-btn wl-sticky",onClick:d[4]||(d[4]=E=>t("sticky",n.comment))},_(n.comment.sticky?I.value.unsticky:I.value.sticky),1)):x("v-if",!0)])):x("v-if",!0),$.value||p.value?(o(),s("div",{key:2,class:q({"wl-reply-wrapper":$.value,"wl-edit-wrapper":p.value})},[G(ut,{edit:n.edit,"reply-id":(F=n.reply)==null?void 0:F.objectId,"reply-user":n.comment.nick,"root-id":n.rootId,onLog:d[5]||(d[5]=E=>t("log")),onCancelReply:d[6]||(d[6]=E=>t("reply",null)),onCancelEdit:d[7]||(d[7]=E=>t("edit",null)),onSubmit:d[8]||(d[8]=E=>t("submit",E))},null,8,["edit","reply-id","reply-user","root-id"])],2)):x("v-if",!0),"children"in n.comment?(o(),s("div",ln,[(o(!0),s(D,null,X(n.comment.children,E=>(o(),le(P,{key:E.objectId,comment:E,reply:n.reply,edit:n.edit,"root-id":n.rootId,onLog:d[9]||(d[9]=j=>t("log")),onDelete:d[10]||(d[10]=j=>t("delete",j)),onEdit:d[11]||(d[11]=j=>t("edit",j)),onLike:d[12]||(d[12]=j=>t("like",j)),onReply:d[13]||(d[13]=j=>t("reply",j)),onStatus:d[14]||(d[14]=j=>t("status",j)),onSticky:d[15]||(d[15]=j=>t("sticky",j)),onSubmit:d[16]||(d[16]=j=>t("submit",j))},null,8,["comment","reply","edit","root-id"]))),128))])):x("v-if",!0)])],8,Ua)}}}),nn=ve(an,[["__file","CommentCard.vue"]]);const vt="3.0.0-alpha.12",on={"data-waline":""},rn={class:"wl-meta-head"},sn={class:"wl-count"},cn=["textContent"],un={class:"wl-sort"},vn=["onClick"],mn={class:"wl-cards"},dn={key:1,class:"wl-operation"},pn=["textContent"],gn={key:2,class:"wl-loading"},hn=["textContent"],fn={key:4,class:"wl-operation"},yn=["textContent"],wn={key:5,class:"wl-power"},kn=v("a",{href:"https://github.com/walinejs/waline",target:"_blank",rel:"noopener noreferrer"}," Waline ",-1);var bn=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,l={latest:"insertedAt_desc",oldest:"insertedAt_asc",hottest:"like_desc"},t=Object.keys(l),u=Ce(),i=qe(),k=L("loading"),M=L(0),b=L(1),I=L(0),C=W(()=>Sl(a)),V=L(C.value.commentSorting),m=L([]),A=L(null),z=L(null),$=W(()=>zl(C.value.dark)),p=W(()=>C.value.locale);xt($,{id:"waline-darkmode"});let n;const d=y=>{var g;const{serverURL:S,path:K,pageSize:B}=C.value,J=new AbortController;k.value="loading",n==null||n(),At({serverURL:S,lang:C.value.lang,path:K,pageSize:B,sortBy:l[V.value],page:y,signal:J.signal,token:(g=u.value)==null?void 0:g.token}).then(Z=>{k.value="success",M.value=Z.count,m.value.push(...Z.data),b.value=y,I.value=Z.totalPages}).catch(Z=>{Z.name!=="AbortError"&&(console.error(Z.message),k.value="error")}),n=J.abort.bind(J)},F=()=>d(b.value+1),P=()=>{M.value=0,m.value=[],d(1)},E=y=>{V.value!==y&&(V.value=y,P())},j=y=>{A.value=y},ie=y=>{z.value=y},H=y=>{if(z.value)z.value.comment=y.comment,z.value.orig=y.orig;else if("rid"in y){const g=m.value.find(({objectId:S})=>S===y.rid);if(!g)return;Array.isArray(g.children)||(g.children=[]),g.children.push(y)}else m.value.unshift(y),M.value+=1},ne=async({comment:y,status:g})=>{var S;if(y.status===g)return;const{serverURL:K,lang:B}=C.value;await fe({serverURL:K,lang:B,token:(S=u.value)==null?void 0:S.token,objectId:y.objectId,comment:{status:g}}),y.status=g},ee=async y=>{var g;if("rid"in y)return;const{serverURL:S,lang:K}=C.value;await fe({serverURL:S,lang:K,token:(g=u.value)==null?void 0:g.token,objectId:y.objectId,comment:{sticky:y.sticky?0:1}}),y.sticky=!y.sticky},me=async({objectId:y})=>{var g;if(!confirm("Are you sure you want to delete this comment?"))return;const{serverURL:S,lang:K}=C.value;await Mt({serverURL:S,lang:K,token:(g=u.value)==null?void 0:g.token,objectId:y}),m.value.some((B,J)=>B.objectId===y?(m.value=m.value.filter((Z,se)=>se!==J),!0):B.children.some((Z,se)=>Z.objectId===y?(m.value[J].children=B.children.filter((_e,ye)=>ye!==se),!0):!1))},Y=async y=>{var g;const{serverURL:S,lang:K}=C.value,{objectId:B}=y,J=i.value.includes(B);await fe({serverURL:S,lang:K,objectId:B,token:(g=u.value)==null?void 0:g.token,comment:{like:!J}}),J?i.value=i.value.filter(Z=>Z!==B):(i.value=[...i.value,B],i.value.length>50&&(i.value=i.value.slice(-50))),y.like=(y.like||0)+(J?-1:1)};return Ct("config",C),ge(()=>{te(()=>[a.serverURL,a.path],()=>P(),{immediate:!0})}),be(()=>n==null?void 0:n()),(y,g)=>(o(),s("div",on,[G(sl),A.value?x("v-if",!0):(o(),le(ut,{key:0,onLog:P,onSubmit:H})),v("div",rn,[v("div",sn,[M.value?(o(),s("span",{key:0,class:"wl-num",textContent:_(M.value)},null,8,cn)):x("v-if",!0),ae(" "+_(p.value.comment),1)]),v("ul",un,[(o(!0),s(D,null,X(w(t),S=>(o(),s("li",{key:S,class:q([S===V.value?"active":""]),onClick:K=>E(S)},_(p.value[S]),11,vn))),128))])]),v("div",mn,[(o(!0),s(D,null,X(m.value,S=>(o(),le(nn,{key:S.objectId,"root-id":S.objectId,comment:S,reply:A.value,edit:z.value,onLog:P,onReply:j,onEdit:ie,onSubmit:H,onStatus:ne,onDelete:me,onSticky:ee,onLike:Y},null,8,["root-id","comment","reply","edit"]))),128))]),k.value==="error"?(o(),s("div",dn,[v("button",{type:"button",class:"wl-btn",onClick:P,textContent:_(p.value.refresh)},null,8,pn)])):k.value==="loading"?(o(),s("div",gn,[G(w(ue),{size:30})])):m.value.length?b.value<I.value?(o(),s("div",fn,[v("button",{type:"button",class:"wl-btn",onClick:F,textContent:_(p.value.more)},null,8,yn)])):x("v-if",!0):(o(),s("div",{key:3,class:"wl-empty",textContent:_(p.value.sofa)},null,8,hn)),C.value.copyright?(o(),s("div",wn,[ae(" Powered by "),kn,ae(" v"+_(w(vt)),1)])):x("v-if",!0)]))}}),Cn=ve(bn,[["__file","WalineComment.vue"]]);export{Cn as Waline,vt as version};
![${c.name}](${h})`)}).catch(h=>{alert(h.message),k.value=k.value.replace(r,"")}).then(()=>{Y.value=!1})},se=c=>{var r;if((r=c.dataTransfer)!=null&&r.items){const h=st(c.dataTransfer.items);h&&K.value&&(Z(h),c.preventDefault())}},_e=c=>{if(c.clipboardData){const r=st(c.clipboardData.items);r&&K.value&&Z(r)}},ye=()=>{const c=V.value;c.files&&K.value&&Z(c.files[0]).then(()=>{c.value=""})},Me=async()=>{var c,r,h,U,f,O;const{serverURL:N,lang:Q,login:de,wordLimit:Ve,requiredMeta:He,recaptchaV3Key:Te,turnstileKey:Fe}=i.value,pt=await Jl(),T={comment:me.value,nick:M.value.nick,mail:M.value.mail,link:M.value.link,url:i.value.path,ua:pt};if((c=b.value)!=null&&c.token)T.nick=b.value.display_name,T.mail=b.value.email,T.link=b.value.url;else{if(de==="force")return;if(He.indexOf("nick")>-1&&!T.nick)return(r=I.value.nick)==null||r.focus(),alert(g.value.nickError);if(He.indexOf("mail")>-1&&!T.mail||T.mail&&!Hl(T.mail))return(h=I.value.mail)==null||h.focus(),alert(g.value.mailError);T.nick||(T.nick=g.value.anonymous)}if(!T.comment){(U=C.value)==null||U.focus();return}if(!ee.value)return alert(g.value.wordHint.replace("$0",Ve[0].toString()).replace("$1",Ve[1].toString()).replace("$2",ie.value.toString()));T.comment=ct(T.comment,n.value.map),t.replyId&&t.rootId&&(T.pid=t.replyId,T.rid=t.rootId,T.at=t.replyUser),Y.value=!0;try{Te&&(T.recaptchaV3=await Jt(Te).execute("social")),Fe&&(T.turnstile=await Xt(Fe).execute("social"));const pe={serverURL:N,lang:Q,token:(f=b.value)==null?void 0:f.token,comment:T},we=await(t.edit?fe({objectId:t.edit.objectId,...pe}):Rt(pe));if(Y.value=!1,we.errmsg)return alert(we.errmsg);u("submit",we.data),k.value="",j.value="",t.replyId&&u("cancelReply"),(O=t.edit)!=null&&O.objectId&&u("cancelEdit")}catch(pe){Y.value=!1,alert(pe.message)}},mt=c=>{c.preventDefault();const{lang:r,serverURL:h}=i.value;_t({serverURL:h,lang:r}).then(U=>{b.value=U,(U.remember?localStorage:sessionStorage).setItem("WALINE_USER",JSON.stringify(U)),u("log")})},dt=()=>{b.value={},localStorage.setItem("WALINE_USER","null"),sessionStorage.setItem("WALINE_USER","null"),u("log")},Ae=c=>{c.preventDefault();const{lang:r,serverURL:h}=i.value,U=800,f=800,O=(window.innerWidth-U)/2,N=(window.innerHeight-f)/2,Q=new URLSearchParams({lng:r,token:b.value.token}),de=window.open(`${h}/ui/profile?${Q.toString()}`,"_blank",`width=${U},height=${f},left=${O},top=${N},scrollbars=no,resizable=no,status=no,location=no,toolbar=no,menubar=no`);de==null||de.postMessage({type:"TOKEN",data:b.value.token},"*")},Se=c=>{var r,h,U,f;!((r=m.value)!=null&&r.contains(c.target))&&!((h=A.value)!=null&&h.contains(c.target))&&(F.value=!1),!((U=z.value)!=null&&U.contains(c.target))&&!((f=$.value)!=null&&f.contains(c.target))&&(P.value=!1)},ze=async c=>{var r;const{scrollTop:h,clientHeight:U,scrollHeight:f}=c.target,O=(U+h)/f,N=i.value.search,Q=((r=p.value)==null?void 0:r.value)||"";O<.9||H.loading||y.value||(H.loading=!0,(N.more&&H.list.length?await N.more(Q,H.list.length):await N.search(Q)).length?H.list=[...H.list,...N.more&&H.list.length?await N.more(Q,H.list.length):await N.search(Q)]:y.value=!0,H.loading=!1,setTimeout(()=>{c.target.scrollTop=h},50))},je=Lt(c=>{H.list=[],y.value=!1,ze(c)},300);te([i,ie],([c,r])=>{const{wordLimit:h}=c;h?r<h[0]&&h[0]!==0?(ne.value=h[0],ee.value=!1):r>h[1]?(ne.value=h[1],ee.value=!1):(ne.value=h[1],ee.value=!0):(ne.value=0,ee.value=!0)},{immediate:!0});const Ue=({data:c})=>{!c||c.type!=="profile"||(b.value={...b.value,...c.data},[localStorage,sessionStorage].filter(r=>r.getItem("WALINE_USER")).forEach(r=>r.setItem("WALINE_USER",JSON.stringify(b))))};return ge(()=>{var c;document.body.addEventListener("click",Se),window.addEventListener("message",Ue),(c=t.edit)!=null&&c.objectId&&(k.value=t.edit.orig),te(P,async r=>{if(!r)return;const h=i.value.search;p.value&&(p.value.value=""),H.loading=!0,H.list=h.default?await h.default():await h.search(""),H.loading=!1}),te(()=>k.value,r=>{const{highlighter:h,texRenderer:U}=i.value;me.value=r,j.value=ql(r,{emojiMap:n.value.map,highlighter:h,texRenderer:U}),ie.value=Gl(r),r?Pe(C.value):Pe.destroy(C.value)},{immediate:!0}),te(()=>i.value.emoji,r=>Nl(r).then(h=>{n.value=h}),{immediate:!0})}),be(()=>{document.body.removeEventListener("click",Se),window.removeEventListener("message",Ue)}),(c,r)=>{var h,U;return o(),s("div",Xl,[w(i).login!=="disable"&&S.value&&!((h=c.edit)!=null&&h.objectId)?(o(),s("div",Yl,[v("div",Ql,[v("button",{type:"submit",class:"wl-logout-btn",title:g.value.logout,onClick:dt},[G(w(Be),{size:14})],8,ea),v("a",{href:"#",class:"wl-login-nick","aria-label":"Profile",title:g.value.profile,onClick:Ae},[v("img",{src:w(b).avatar,alt:"avatar"},null,8,la)],8,ta)]),v("a",{href:"#",class:"wl-login-nick","aria-label":"Profile",title:g.value.profile,onClick:Ae,textContent:_(w(b).display_name)},null,8,aa)])):x("v-if",!0),v("div",na,[w(i).login!=="force"&&w(i).meta.length&&!S.value?(o(),s("div",{key:0,class:q(["wl-header",`item${w(i).meta.length}`])},[(o(!0),s(D,null,X(w(i).meta,f=>(o(),s("div",{key:f,class:"wl-header-item"},[v("label",{for:`wl-${f}`,textContent:_(g.value[f]+(w(i).requiredMeta.includes(f)||!w(i).requiredMeta.length?"":`(${g.value.optional})`))},null,8,oa),he(v("input",{id:`wl-${f}`,ref_for:!0,ref:O=>{O&&(I.value[f]=O)},"onUpdate:modelValue":O=>w(M)[f]=O,class:q(["wl-input",`wl-${f}`]),name:f,type:f==="mail"?"email":"text"},null,10,ia),[[yt,w(M)[f]]])]))),128))],2)):x("v-if",!0),he(v("textarea",{id:"wl-edit",ref_key:"editorRef",ref:C,"onUpdate:modelValue":r[0]||(r[0]=f=>wt(k)?k.value=f:null),class:"wl-editor",placeholder:c.replyUser?`@${c.replyUser}`:g.value.placeholder,onKeydown:J,onDrop:se,onPaste:_e},null,40,ra),[[kt,w(k)]]),he(v("div",sa,[ca,v("h4",null,_(g.value.preview)+":",1),v("div",{class:"wl-content",innerHTML:j.value},null,8,ua)],512),[[We,E.value]]),v("div",va,[v("div",ma,[v("a",da,[G(w(Nt))]),he(v("button",{ref_key:"emojiButtonRef",ref:m,type:"button",class:q(["wl-action",{active:F.value}]),title:g.value.emoji,onClick:r[1]||(r[1]=f=>F.value=!F.value)},[G(w(Vt))],10,pa),[[We,n.value.tabs.length]]),w(i).search?(o(),s("button",{key:0,ref_key:"gifButtonRef",ref:z,type:"button",class:q(["wl-action",{active:P.value}]),title:g.value.gif,onClick:r[2]||(r[2]=f=>P.value=!P.value)},[G(w(Bt))],10,ga)):x("v-if",!0),v("input",{id:"wl-image-upload",ref_key:"imageUploadRef",ref:V,class:"upload",type:"file",accept:".png,.jpg,.jpeg,.webp,.bmp,.gif",onChange:ye},null,544),K.value?(o(),s("label",{key:1,for:"wl-image-upload",class:"wl-action",title:g.value.uploadImage},[G(w(Ht))],8,ha)):x("v-if",!0),v("button",{type:"button",class:q(["wl-action",{active:E.value}]),title:g.value.preview,onClick:r[3]||(r[3]=f=>E.value=!E.value)},[G(w(Ft))],10,fa)]),v("div",ya,[wa,v("div",ka,[ae(_(ie.value)+" ",1),w(i).wordLimit?(o(),s("span",ba,[ae("  /  "),v("span",{class:q({illegal:!ee.value}),textContent:_(ne.value)},null,10,Ca)])):x("v-if",!0),ae("  "+_(g.value.word),1)]),w(i).login!=="disable"&&!S.value?(o(),s("button",{key:0,type:"button",class:"wl-btn",onClick:mt,textContent:_(g.value.login)},null,8,$a)):x("v-if",!0),w(i).login!=="force"||S.value?(o(),s("button",{key:1,type:"submit",class:"primary wl-btn",title:"Cmd|Ctrl + Enter",disabled:Y.value,onClick:Me},[Y.value?(o(),le(w(ue),{key:0,size:16})):(o(),s(D,{key:1},[ae(_(g.value.submit),1)],64))],8,La)):x("v-if",!0)]),v("div",{ref_key:"gifPopupRef",ref:$,class:q(["wl-gif-popup",{display:P.value}])},[v("input",{ref_key:"gifSearchInputRef",ref:p,type:"text",placeholder:g.value.gifSearchPlaceholder,onInput:r[4]||(r[4]=(...f)=>w(je)&&w(je)(...f))},null,40,Ia),H.list.length?(o(),le(ml,{key:0,items:H.list,"column-width":200,gap:6,onInsert:r[5]||(r[5]=f=>B(f)),onScroll:ze},null,8,["items"])):x("v-if",!0),H.loading?(o(),s("div",xa,[G(w(ue),{size:30})])):x("v-if",!0)],2),v("div",{ref_key:"emojiPopupRef",ref:A,class:q(["wl-emoji-popup",{display:F.value}])},[(o(!0),s(D,null,X(n.value.tabs,(f,O)=>(o(),s(D,{key:f.name},[O===d.value?(o(),s("div",Ea,[(o(!0),s(D,null,X(f.items,N=>(o(),s("button",{key:N,type:"button",title:N,onClick:Q=>B(`:${N}:`)},[F.value?(o(),s("img",{key:0,class:"wl-emoji",src:n.value.map[N],alt:N,loading:"lazy",referrerPolicy:"no-referrer"},null,8,_a)):x("v-if",!0)],8,Ra))),128))])):x("v-if",!0)],64))),128)),n.value.tabs.length>1?(o(),s("div",Ma,[(o(!0),s(D,null,X(n.value.tabs,(f,O)=>(o(),s("button",{key:f.name,type:"button",class:q(["wl-tab",{active:d.value===O}]),onClick:N=>d.value=O},[v("img",{class:"wl-emoji",src:f.icon,alt:f.name,title:f.name,loading:"lazy",referrerPolicy:"no-referrer"},null,8,Sa)],10,Aa))),128))])):x("v-if",!0)],2)])]),c.replyId||(U=c.edit)!=null&&U.objectId?(o(),s("button",{key:1,type:"button",class:"wl-close",title:g.value.cancelReply,onClick:r[6]||(r[6]=f=>c.$emit(c.replyId?"cancelReply":"cancelEdit"))},[G(w(Be),{size:24})],8,za)):x("v-if",!0)])}}}),ut=ve(ja,[["__file","CommentBox.vue"]]);const Ua=["id"],Va={class:"wl-user","aria-hidden":"true"},Ha=["src"],Ta={class:"wl-card"},Fa={class:"wl-head"},Na=["href"],Wa={key:1,class:"wl-nick"},Da=["textContent"],Pa=["textContent"],Ba=["textContent"],Oa=["textContent"],qa=["textContent"],Ka={class:"wl-comment-actions"},Za=["title"],Ga=["title"],Ja={class:"wl-meta","aria-hidden":"true"},Xa=["data-value","textContent"],Ya=["innerHTML"],Qa={key:1,class:"wl-admin-actions"},en={class:"wl-comment-status"},tn=["disabled","onClick","textContent"],ln={key:3,class:"wl-quote"};var an=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 l=e,t=a,u=["approved","waiting","spam"],i=ke("config"),k=qe(),M=It(),b=Ce(),I=W(()=>i.value.locale),C=W(()=>{const{link:n}=l.comment;return n?Xe(n)?n:`https://${n}`:""}),V=W(()=>k.value.includes(l.comment.objectId)),m=W(()=>Ul(new Date(l.comment.time),M.value,I.value)),A=W(()=>b.value.type==="administrator"),z=W(()=>l.comment.user_id&&b.value.objectId===l.comment.user_id),$=W(()=>{var n;return l.comment.objectId===((n=l.reply)==null?void 0:n.objectId)}),p=W(()=>{var n;return l.comment.objectId===((n=l.edit)==null?void 0:n.objectId)});return(n,d)=>{var F;const P=bt("CommentCard",!0);return o(),s("div",{id:n.comment.objectId,class:"wl-card-item"},[v("div",Va,[n.comment.avatar?(o(),s("img",{key:0,class:"wl-user-avatar",src:n.comment.avatar},null,8,Ha)):x("v-if",!0),n.comment.type?(o(),le(w(Pt),{key:1})):x("v-if",!0)]),v("div",Ta,[v("div",Fa,[C.value?(o(),s("a",{key:0,class:"wl-nick",href:C.value,target:"_blank",rel:"nofollow noopener noreferrer"},_(n.comment.nick),9,Na)):(o(),s("span",Wa,_(n.comment.nick),1)),n.comment.type==="administrator"?(o(),s("span",{key:2,class:"wl-badge",textContent:_(I.value.admin)},null,8,Da)):x("v-if",!0),n.comment.label?(o(),s("span",{key:3,class:"wl-badge",textContent:_(n.comment.label)},null,8,Pa)):x("v-if",!0),n.comment.sticky?(o(),s("span",{key:4,class:"wl-badge",textContent:_(I.value.sticky)},null,8,Ba)):x("v-if",!0),typeof n.comment.level=="number"?(o(),s("span",{key:5,class:q(`wl-badge level${n.comment.level}`),textContent:_(I.value[`level${n.comment.level}`]||`Level ${n.comment.level}`)},null,10,Oa)):x("v-if",!0),v("span",{class:"wl-time",textContent:_(m.value)},null,8,qa),v("div",Ka,[A.value||z.value?(o(),s(D,{key:0},[v("button",{type:"button",class:"wl-edit",onClick:d[0]||(d[0]=E=>t("edit",n.comment))},[G(w(Dt))]),v("button",{type:"button",class:"wl-delete",onClick:d[1]||(d[1]=E=>t("delete",n.comment))},[G(w(Ut))])],64)):x("v-if",!0),v("button",{type:"button",class:"wl-like",title:V.value?I.value.cancelLike:I.value.like,onClick:d[2]||(d[2]=E=>t("like",n.comment))},[G(w(Tt),{active:V.value},null,8,["active"]),ae(" "+_("like"in n.comment?n.comment.like:""),1)],8,Za),v("button",{type:"button",class:q(["wl-reply",{active:$.value}]),title:$.value?I.value.cancelReply:I.value.reply,onClick:d[3]||(d[3]=E=>t("reply",$.value?null:n.comment))},[G(w(Wt))],10,Ga)])]),v("div",Ja,[(o(),s(D,null,X(["addr","browser","os"],E=>(o(),s(D,null,[n.comment[E]?(o(),s("span",{key:E,class:q(`wl-${E}`),"data-value":n.comment[E],textContent:_(n.comment[E])},null,10,Xa)):x("v-if",!0)],64))),64))]),p.value?x("v-if",!0):(o(),s("div",{key:0,class:"wl-content",innerHTML:n.comment.comment},null,8,Ya)),A.value&&!p.value?(o(),s("div",Qa,[v("span",en,[(o(),s(D,null,X(u,E=>v("button",{key:E,type:"submit",class:q(`wl-btn wl-${E}`),disabled:n.comment.status===E,onClick:j=>t("status",{status:E,comment:n.comment}),textContent:_(I.value[E])},null,10,tn)),64))]),A.value&&!("rid"in n.comment)?(o(),s("button",{key:0,type:"submit",class:"wl-btn wl-sticky",onClick:d[4]||(d[4]=E=>t("sticky",n.comment))},_(n.comment.sticky?I.value.unsticky:I.value.sticky),1)):x("v-if",!0)])):x("v-if",!0),$.value||p.value?(o(),s("div",{key:2,class:q({"wl-reply-wrapper":$.value,"wl-edit-wrapper":p.value})},[G(ut,{edit:n.edit,"reply-id":(F=n.reply)==null?void 0:F.objectId,"reply-user":n.comment.nick,"root-id":n.rootId,onLog:d[5]||(d[5]=E=>t("log")),onCancelReply:d[6]||(d[6]=E=>t("reply",null)),onCancelEdit:d[7]||(d[7]=E=>t("edit",null)),onSubmit:d[8]||(d[8]=E=>t("submit",E))},null,8,["edit","reply-id","reply-user","root-id"])],2)):x("v-if",!0),"children"in n.comment?(o(),s("div",ln,[(o(!0),s(D,null,X(n.comment.children,E=>(o(),le(P,{key:E.objectId,comment:E,reply:n.reply,edit:n.edit,"root-id":n.rootId,onLog:d[9]||(d[9]=j=>t("log")),onDelete:d[10]||(d[10]=j=>t("delete",j)),onEdit:d[11]||(d[11]=j=>t("edit",j)),onLike:d[12]||(d[12]=j=>t("like",j)),onReply:d[13]||(d[13]=j=>t("reply",j)),onStatus:d[14]||(d[14]=j=>t("status",j)),onSticky:d[15]||(d[15]=j=>t("sticky",j)),onSubmit:d[16]||(d[16]=j=>t("submit",j))},null,8,["comment","reply","edit","root-id"]))),128))])):x("v-if",!0)])],8,Ua)}}}),nn=ve(an,[["__file","CommentCard.vue"]]);const vt="3.0.0",on={"data-waline":""},rn={class:"wl-meta-head"},sn={class:"wl-count"},cn=["textContent"],un={class:"wl-sort"},vn=["onClick"],mn={class:"wl-cards"},dn={key:1,class:"wl-operation"},pn=["textContent"],gn={key:2,class:"wl-loading"},hn=["textContent"],fn={key:4,class:"wl-operation"},yn=["textContent"],wn={key:5,class:"wl-power"},kn=v("a",{href:"https://github.com/walinejs/waline",target:"_blank",rel:"noopener noreferrer"}," Waline ",-1);var bn=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,l={latest:"insertedAt_desc",oldest:"insertedAt_asc",hottest:"like_desc"},t=Object.keys(l),u=Ce(),i=qe(),k=L("loading"),M=L(0),b=L(1),I=L(0),C=W(()=>Sl(a)),V=L(C.value.commentSorting),m=L([]),A=L(null),z=L(null),$=W(()=>zl(C.value.dark)),p=W(()=>C.value.locale);xt($,{id:"waline-darkmode"});let n;const d=y=>{var g;const{serverURL:S,path:K,pageSize:B}=C.value,J=new AbortController;k.value="loading",n==null||n(),At({serverURL:S,lang:C.value.lang,path:K,pageSize:B,sortBy:l[V.value],page:y,signal:J.signal,token:(g=u.value)==null?void 0:g.token}).then(Z=>{k.value="success",M.value=Z.count,m.value.push(...Z.data),b.value=y,I.value=Z.totalPages}).catch(Z=>{Z.name!=="AbortError"&&(console.error(Z.message),k.value="error")}),n=J.abort.bind(J)},F=()=>d(b.value+1),P=()=>{M.value=0,m.value=[],d(1)},E=y=>{V.value!==y&&(V.value=y,P())},j=y=>{A.value=y},ie=y=>{z.value=y},H=y=>{if(z.value)z.value.comment=y.comment,z.value.orig=y.orig;else if("rid"in y){const g=m.value.find(({objectId:S})=>S===y.rid);if(!g)return;Array.isArray(g.children)||(g.children=[]),g.children.push(y)}else m.value.unshift(y),M.value+=1},ne=async({comment:y,status:g})=>{var S;if(y.status===g)return;const{serverURL:K,lang:B}=C.value;await fe({serverURL:K,lang:B,token:(S=u.value)==null?void 0:S.token,objectId:y.objectId,comment:{status:g}}),y.status=g},ee=async y=>{var g;if("rid"in y)return;const{serverURL:S,lang:K}=C.value;await fe({serverURL:S,lang:K,token:(g=u.value)==null?void 0:g.token,objectId:y.objectId,comment:{sticky:y.sticky?0:1}}),y.sticky=!y.sticky},me=async({objectId:y})=>{var g;if(!confirm("Are you sure you want to delete this comment?"))return;const{serverURL:S,lang:K}=C.value;await Mt({serverURL:S,lang:K,token:(g=u.value)==null?void 0:g.token,objectId:y}),m.value.some((B,J)=>B.objectId===y?(m.value=m.value.filter((Z,se)=>se!==J),!0):B.children.some((Z,se)=>Z.objectId===y?(m.value[J].children=B.children.filter((_e,ye)=>ye!==se),!0):!1))},Y=async y=>{var g;const{serverURL:S,lang:K}=C.value,{objectId:B}=y,J=i.value.includes(B);await fe({serverURL:S,lang:K,objectId:B,token:(g=u.value)==null?void 0:g.token,comment:{like:!J}}),J?i.value=i.value.filter(Z=>Z!==B):(i.value=[...i.value,B],i.value.length>50&&(i.value=i.value.slice(-50))),y.like=(y.like||0)+(J?-1:1)};return Ct("config",C),ge(()=>{te(()=>[a.serverURL,a.path],()=>P(),{immediate:!0})}),be(()=>n==null?void 0:n()),(y,g)=>(o(),s("div",on,[G(sl),A.value?x("v-if",!0):(o(),le(ut,{key:0,onLog:P,onSubmit:H})),v("div",rn,[v("div",sn,[M.value?(o(),s("span",{key:0,class:"wl-num",textContent:_(M.value)},null,8,cn)):x("v-if",!0),ae(" "+_(p.value.comment),1)]),v("ul",un,[(o(!0),s(D,null,X(w(t),S=>(o(),s("li",{key:S,class:q([S===V.value?"active":""]),onClick:K=>E(S)},_(p.value[S]),11,vn))),128))])]),v("div",mn,[(o(!0),s(D,null,X(m.value,S=>(o(),le(nn,{key:S.objectId,"root-id":S.objectId,comment:S,reply:A.value,edit:z.value,onLog:P,onReply:j,onEdit:ie,onSubmit:H,onStatus:ne,onDelete:me,onSticky:ee,onLike:Y},null,8,["root-id","comment","reply","edit"]))),128))]),k.value==="error"?(o(),s("div",dn,[v("button",{type:"button",class:"wl-btn",onClick:P,textContent:_(p.value.refresh)},null,8,pn)])):k.value==="loading"?(o(),s("div",gn,[G(w(ue),{size:30})])):m.value.length?b.value<I.value?(o(),s("div",fn,[v("button",{type:"button",class:"wl-btn",onClick:F,textContent:_(p.value.more)},null,8,yn)])):x("v-if",!0):(o(),s("div",{key:3,class:"wl-empty",textContent:_(p.value.sofa)},null,8,hn)),C.value.copyright?(o(),s("div",wn,[ae(" Powered by "),kn,ae(" v"+_(w(vt)),1)])):x("v-if",!0)]))}}),Cn=ve(bn,[["__file","WalineComment.vue"]]);export{Cn as Waline,vt as version};
//# sourceMappingURL=component.js.map

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

const u="3.0.0-alpha.12",v={"Content-Type":"application/json"},g=e=>`${e.replace(/\/?$/,"/")}api/`,$=(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:a,signal:n})=>fetch(`${g(e)}article?path=${encodeURIComponent(r.join(","))}&type=${encodeURIComponent(a.join(","))}&lang=${t}`,{signal:n}).then(o=>o.json()),R=({serverURL:e,lang:t,path:r,type:a,action:n})=>fetch(`${g(e)}article?lang=${t}`,{method:"POST",headers:v,body:JSON.stringify({path:r,type:a,action:n})}).then(o=>o.json()).then(o=>$(o,"Update counter").data),U=({serverURL:e,lang:t,paths:r,signal:a})=>f({serverURL:e,lang:t,paths:r,type:["time"],signal:a}).then(n=>Array.isArray(n)?n:[n]),w=e=>R({...e,type:"time",action:"inc"}),L=(e="")=>e.replace(/\/$/u,""),A=e=>/^(https?:)?\/\//.test(e),y=e=>{const t=L(e);return A(t)?t:`https://${t}`},b=e=>{e.name!=="AbortError"&&console.error(e.message)},d=e=>e.dataset.path||null,m=(e,t)=>{t.forEach((r,a)=>{r.innerText=e[a].toString()})},j=({serverURL:e,path:t=window.location.pathname,selector:r=".waline-pageview-count",update:a=!0,lang:n=navigator.language})=>{const o=new AbortController,i=Array.from(document.querySelectorAll(r)),c=l=>{const s=d(l);return s!==null&&t!==s},h=l=>U({serverURL:y(e),paths:l.map(s=>d(s)||t),lang:n,signal:o.signal}).then(s=>m(s,l)).catch(b);if(a){const l=i.filter(p=>!c(p)),s=i.filter(c);w({serverURL:y(e),path:t,lang:n}).then(([p])=>m(new Array(l.length).fill(p),l)),s.length&&h(s)}else h(i);return o.abort.bind(o)};export{j as pageviewCount,u as version};
const u="3.0.0",v={"Content-Type":"application/json"},h=e=>`${e.replace(/\/?$/,"/")}api/`,$=(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:a,signal:n})=>fetch(`${h(e)}article?path=${encodeURIComponent(r.join(","))}&type=${encodeURIComponent(a.join(","))}&lang=${t}`,{signal:n}).then(o=>o.json()),R=({serverURL:e,lang:t,path:r,type:a,action:n})=>fetch(`${h(e)}article?lang=${t}`,{method:"POST",headers:v,body:JSON.stringify({path:r,type:a,action:n})}).then(o=>o.json()).then(o=>$(o,"Update counter").data),U=({serverURL:e,lang:t,paths:r,signal:a})=>f({serverURL:e,lang:t,paths:r,type:["time"],signal:a}).then(n=>Array.isArray(n)?n:[n]),w=e=>R({...e,type:"time",action:"inc"}),L=(e="")=>e.replace(/\/$/u,""),A=e=>/^(https?:)?\/\//.test(e),y=e=>{const t=L(e);return A(t)?t:`https://${t}`},b=e=>{e.name!=="AbortError"&&console.error(e.message)},d=e=>e.dataset.path||null,m=(e,t)=>{t.forEach((r,a)=>{r.innerText=e[a].toString()})},j=({serverURL:e,path:t=window.location.pathname,selector:r=".waline-pageview-count",update:a=!0,lang:n=navigator.language})=>{const o=new AbortController,i=Array.from(document.querySelectorAll(r)),c=l=>{const s=d(l);return s!==null&&t!==s},g=l=>U({serverURL:y(e),paths:l.map(s=>d(s)||t),lang:n,signal:o.signal}).then(s=>m(s,l)).catch(b);if(a){const l=i.filter(p=>!c(p)),s=i.filter(c);w({serverURL:y(e),path:t,lang:n}).then(([p])=>m(new Array(l.length).fill(p),l)),s.length&&g(s)}else g(i);return o.abort.bind(o)};export{j as pageviewCount,u as version};
//# sourceMappingURL=pageview.js.map

@@ -9,3 +9,3 @@ import{fetchCommentCount as It,getArticleCounter as Rt,updateArticleCounter as Be,updateComment as he,addComment as xt,login as At,deleteComment as Mt,getComment as Ut,updatePageview as _t,getPageview as St,getRecentComment as jt,getUserList as zt}from"@waline/api";export*from"@waline/api";import{h as A,defineComponent as ue,inject as Le,ref as I,computed as W,onMounted as fe,watch as te,onUnmounted as Ee,openBlock as r,createElementBlock as u,createElementVNode as h,toDisplayString as U,Fragment as P,renderList as X,normalizeClass as q,createBlock as le,unref as L,createCommentVNode as R,onBeforeUnmount as Ht,normalizeStyle as Oe,nextTick as Vt,reactive as Ie,createVNode as G,withDirectives as we,vModelDynamic as Tt,isRef as Ft,vModelText as Nt,vShow as qe,createTextVNode as ae,resolveComponent as Wt,provide as Pt,createApp as Dt,watchEffect as Ke}from"vue";import{useStorage as re,useScriptTag as Bt,useDebounceFn as Ot,useNow as qt,useStyleTag as Kt}from"@vueuse/core";import Ze from"autosize";import{Marked as Zt}from"marked";import{markedHighlight as Gt}from"marked-highlight";import{load as Jt}from"recaptcha-v3";const Xt=["nick","mail","link"],Ge=e=>e.filter(a=>Xt.includes(a)),Je=["//unpkg.com/@waline/emojis@1.1.0/weibo"],Yt=["//unpkg.com/@waline/emojis/tieba/tieba_agree.png","//unpkg.com/@waline/emojis/tieba/tieba_look_down.png","//unpkg.com/@waline/emojis/tieba/tieba_sunglasses.png","//unpkg.com/@waline/emojis/tieba/tieba_pick_nose.png","//unpkg.com/@waline/emojis/tieba/tieba_awkward.png","//unpkg.com/@waline/emojis/tieba/tieba_sleep.png"],Qt=e=>new Promise((a,l)=>{if(e.size>128*1e3)return l(new Error("File too large! File size limit 128KB"));const t=new FileReader;t.readAsDataURL(e),t.onload=()=>{var i;return a(((i=t.result)==null?void 0:i.toString())||"")},t.onerror=l}),el=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>',tl=e=>{const a=async(l,t={})=>fetch(`https://api.giphy.com/v1/gifs/${l}?${new URLSearchParams({lang:e,limit:"20",rating:"g",api_key:"6CIMLkNMMOhRcXPoMCPkFy4Ybk2XUiMp",...t}).toString()}`).then(i=>i.json()).then(({data:i})=>i.map(n=>({title:n.title,src:n.images.downsized_medium.url})));return{search:l=>a("search",{q:l,offset:"0"}),default:()=>a("trending",{}),more:(l,t=0)=>a("search",{q:l,offset:t.toString()})}},ll=/[\u4E00-\u9FFF\u3400-\u4dbf\uf900-\ufaff\u3040-\u309f\uac00-\ud7af\u0400-\u04FF]+|\w+/,al=/</,nl=/(?:^|\s)\/\/(.+?)$/gm,ol=/\/\*([\S\s]*?)\*\//gm,il=new RegExp(`(${ll.source}|${al.source})|((?:${nl.source})|(?:${ol.source}))`,"gmi"),Xe=["23AC69","91C132","F19726","E8552D","1AAB8E","E1147F","2980C1","1BA1E6","9FA0A0","F19726","E30B20","E30B20","A3338B"],Re={},rl=e=>{let a=0;return e.replace(il,(l,t,i)=>{if(i)return`<span style="color: slategray">${i}</span>`;if(t==="<")return"&lt;";let n;Re[t]?n=Re[t]:(n=Xe[a],Re[t]=n);const m=`<span style="color: #${n}">${t}</span>`;return a=++a%Xe.length,m})},sl=["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"],oe=e=>Object.fromEntries(e.map((a,l)=>[sl[l],a]));var Ye=oe(["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":ul,en:Ye,"en-us":Ye,fr:Qe,"fr-fr":Qe,jp:et,"jp-jp":et,"pt-br":cl,ru:tt,"ru-ru":tt},nt=e=>ye[e.toLowerCase()]||ye[at],vl=e=>Object.keys(ye).includes(e.toLowerCase())?e:at,ot=e=>{try{e=decodeURI(e)}catch{}return e},it=(e="")=>e.replace(/\/$/u,""),rt=e=>/^(https?:)?\/\//.test(e),ke=e=>{const a=it(e);return rt(a)?a:`https://${a}`},ml=e=>Array.isArray(e)?e:e?[0,e]:!1,xe=(e,a)=>typeof e=="function"?e:e===!1?!1:a,dl=({serverURL:e,path:a=location.pathname,lang:l=typeof navigator>"u"?"en-US":navigator.language,locale:t,emoji:i=Je,meta:n=["nick","mail","link"],requiredMeta:m=[],dark:d=!1,pageSize:g=10,wordLimit:c,imageUploader:f,highlighter:S,texRenderer:p,copyright:M=!0,login:_="enable",search:E,reaction:y,recaptchaV3Key:o="",turnstileKey:w="",commentSorting:F="latest",...D})=>({serverURL:ke(e),path:ot(a),lang:vl(l),locale:{...nt(l),...typeof t=="object"?t:{}},wordLimit:ml(c),meta:Ge(n),requiredMeta:Ge(m),imageUploader:xe(f,Qt),highlighter:xe(S,rl),texRenderer:xe(p,el),dark:d,emoji:typeof i=="boolean"?i?Je:[]:i,pageSize:g,login:_,copyright:M,search:E===!1?!1:typeof E=="object"?E:tl(l),recaptchaV3Key:o,turnstileKey:w,reaction:Array.isArray(y)?y:y===!0?Yt:[],commentSorting:F,...D}),se=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}",pl=e=>se(e)?e==="auto"?`@media(prefers-color-scheme:dark){body${Ae}}`:`${e}${Ae}`:e===!0?`:root${Ae}`:"",Me=(e,a)=>{let l=e.toString();for(;l.length<a;)l="0"+l;return l},gl=e=>{const a=Me(e.getDate(),2),l=Me(e.getMonth()+1,2);return`${Me(e.getFullYear(),2)}-${l}-${a}`},hl=(e,a,l)=>{if(!e)return"";const t=se(e)?new Date(e.indexOf(" ")!==-1?e.replace(/-/g,"/"):e):e,i=a.getTime()-t.getTime(),n=Math.floor(i/(24*3600*1e3));if(n===0){const m=i%864e5,d=Math.floor(m/(3600*1e3));if(d===0){const g=m%36e5,c=Math.floor(g/(60*1e3));if(c===0){const f=g%6e4;return`${Math.round(f/1e3)} ${l.seconds}`}return`${c} ${l.minutes}`}return`${d} ${l.hours}`}return n<0?l.now:n<8?`${n} ${l.days}`:gl(t)},fl=/^[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])?)*$/,wl=e=>fl.test(e),yl=e=>!!/@[0-9]+\.[0-9]+\.[0-9]+/.test(e),kl=e=>{const a=re("WALINE_EMOJI",{}),l=yl(e);if(l){const t=a.value[e];if(t)return Promise.resolve(t)}return fetch(`${e}/info.json`).then(t=>t.json()).then(t=>{const i={folder:e,...t};return l&&(a.value[e]=i),i})},st=(e,a="",l="",t="")=>`${a?`${a}/`:""}${l}${e}${t?`.${t}`:""}`,bl=e=>Promise.all(e.map(a=>se(a)?kl(it(a)):Promise.resolve(a))).then(a=>{const l={tabs:[],map:{}};return a.forEach(t=>{const{name:i,folder:n,icon:m,prefix:d,type:g,items:c}=t;l.tabs.push({name:i,icon:st(m,n,d,g),items:c.map(f=>{const S=`${d||""}${f}`;return l.map[S]=st(f,n,d,g),S})})}),l}),ct=e=>{e.name!=="AbortError"&&console.error(e.message)},Ue=e=>e instanceof HTMLElement?e:se(e)?document.querySelector(e):null,Cl=e=>e.type.includes("image"),ut=e=>{const a=Array.from(e).find(Cl);return a?a.getAsFile():null},$l=/\$.*?\$/,Ll=/^\$(.*?)\$/,El=/^(?:\s{0,3})\$\$((?:[^\n]|\n[^\n])+?)\n{0,1}\$\$/,Il=e=>[{name:"blockMath",level:"block",tokenizer(a){const l=El.exec(a);if(l!==null)return{type:"html",raw:l[0],text:e(!0,l[1])}}},{name:"inlineMath",level:"inline",start(a){const l=a.search($l);return l!==-1?l:a.length},tokenizer(a){const l=Ll.exec(a);if(l!==null)return{type:"html",raw:l[0],text:e(!1,l[1])}}}],vt=(e="",a={})=>e.replace(/:(.+?):/g,(l,t)=>a[t]?`<img class="wl-emoji" src="${a[t]}" alt="${t}">`:l),Rl=(e,{emojiMap:a,highlighter:l,texRenderer:t})=>{const i=new Zt;if(i.setOptions({breaks:!0}),l&&i.use(Gt({highlight:l})),t){const n=Il(t);i.use({extensions:n})}return i.parse(vt(e,a))},_e=e=>e.dataset.path||null,xl=e=>e.match(/[\w\d\s,.\u00C0-\u024F\u0400-\u04FF]+/giu),Al=e=>e.match(/[\u4E00-\u9FD5]/gu),Ml=e=>{var a,l;return(((a=xl(e))==null?void 0:a.reduce((t,i)=>t+(["",",","."].includes(i.trim())?0:i.trim().split(/\s+/u).length),0))||0)+(((l=Al(e))==null?void 0:l.length)||0)},Ul=async()=>{if(!navigator)return"";const{userAgentData:e}=navigator;let a=navigator.userAgent;if(!e||e.platform!=="Windows")return a;const{platformVersion:l}=await e.getHighEntropyValues(["platformVersion"]);return l&&parseInt(l.split(".")[0])>=13&&(a=a.replace("Windows NT 10.0","Windows NT 11.0")),a},mt=({serverURL:e,path:a=window.location.pathname,selector:l=".waline-comment-count",lang:t=navigator.language})=>{const i=new AbortController,n=document.querySelectorAll(l);return n.length&&It({serverURL:ke(e),paths:Array.from(n).map(m=>ot(_e(m)||a)),lang:t,signal:i.signal}).then(m=>{n.forEach((d,g)=>{d.innerText=m[g].toString()})}).catch(ct),i.abort.bind(i)},dt=({size:e})=>A("svg",{class:"wl-close-icon",viewBox:"0 0 1024 1024",width:e,height:e},[A("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"}),A("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"})]),_l=()=>A("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},A("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"})),Sl=()=>A("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},A("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"})),jl=()=>A("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},[A("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"}),A("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"})]),zl=({active:e=!1})=>A("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},[A("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=()=>A("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},[A("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"}),A("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"})]),Vl=()=>A("svg",{width:"16",height:"16",ariaHidden:"true"},A("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"})),Tl=()=>A("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},A("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"})),Fl=()=>A("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},A("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"})),Nl=()=>A("svg",{class:"verified-icon",viewBox:"0 0 1024 1024",width:"14",height:"14"},A("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"})),ve=({size:e=100})=>A("svg",{width:e,height:e,viewBox:"0 0 100 100",preserveAspectRatio:"xMidYMid"},A("circle",{cx:50,cy:50,fill:"none",stroke:"currentColor",strokeWidth:"4",r:"40","stroke-dasharray":"85 30"},A("animateTransform",{attributeName:"transform",type:"rotate",repeatCount:"indefinite",dur:"1s",values:"0 50 50;360 50 50",keyTimes:"0;1"}))),Wl=()=>A("svg",{width:24,height:24,fill:"currentcolor",viewBox:"0 0 24 24"},[A("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"}),A("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"})]),Pl=()=>re("WALINE_USER_META",{nick:"",mail:"",link:""}),Dl=()=>re("WALINE_COMMENT_BOX_EDITOR",""),Bl="WALINE_LIKE";let pt=null;const gt=()=>pt||(pt=re(Bl,[])),Ol="WALINE_REACTION";let ht=null;const ql=()=>ht??(ht=re(Ol,{})),ft={},Kl=e=>{const a=ft[e]??(ft[e]=Jt(e,{useRecaptchaNet:!0,autoHideBadge:!0}));return{execute:l=>a.then(t=>t.execute(l))}},Zl=e=>({execute:async a=>{const{load:l}=Bt("https://challenges.cloudflare.com/turnstile/v0/api.js",void 0,{async:!1});await l();const t=window==null?void 0:window.turnstile;return new Promise(i=>{t==null||t.ready(()=>{t==null||t.render(".wl-captcha-container",{sitekey:e,action:a,size:"compact",callback:i})})})}}),Gl="WALINE_USER";let wt=null;const be=()=>wt??(wt=re(Gl,{})),Jl={key:0,class:"wl-reaction"},Xl=["textContent"],Yl={class:"wl-reaction-list"},Ql=["onClick"],ea={class:"wl-reaction-img"},ta=["src","alt"],la=["textContent"],aa=["textContent"];var na=ue({__name:"ArticleReaction",setup(e,{expose:a}){a();const l=ql(),t=Le("config"),i=I(-1),n=I([]),m=W(()=>t.value.locale),d=W(()=>t.value.reaction.length>0),g=W(()=>{const{reaction:p,path:M}=t.value;return p.map((_,E)=>({icon:_,desc:m.value[`reaction${E}`],active:l.value[M]===E}))});let c;const f=async()=>{if(d.value){const{serverURL:p,lang:M,path:_,reaction:E}=t.value,y=new AbortController;c=y.abort.bind(y);const o=await Rt({serverURL:p,lang:M,paths:[_],type:E.map((w,F)=>`reaction${F}`),signal:y.signal});if(Array.isArray(o)||typeof o=="number")return;n.value=E.map((w,F)=>o[`reaction${F}`])}},S=async p=>{if(i.value===-1){const{serverURL:M,lang:_,path:E}=t.value,y=l.value[E];i.value=p,y!==void 0&&(await Be({serverURL:M,lang:_,path:E,type:`reaction${y}`,action:"desc"}),n.value[y]=Math.max(n.value[y]-1,0)),y!==p&&(await Be({serverURL:M,lang:_,path:E,type:`reaction${p}`}),n.value[p]=(n.value[p]||0)+1),y===p?delete l.value[E]:l.value[E]=p,i.value=-1}};return fe(()=>{te(()=>[t.value.serverURL,t.value.path],()=>{f()},{immediate:!0})}),Ee(()=>c==null?void 0:c()),(p,M)=>g.value.length?(r(),u("div",Jl,[h("div",{class:"wl-reaction-title",textContent:U(m.value.reactionTitle)},null,8,Xl),h("ul",Yl,[(r(!0),u(P,null,X(g.value,({active:_,icon:E,desc:y},o)=>(r(),u("li",{key:o,class:q(["wl-reaction-item",{active:_}]),onClick:w=>S(o)},[h("div",ea,[h("img",{src:E,alt:y},null,8,ta),i.value===o?(r(),le(L(ve),{key:0,class:"wl-reaction-loading"})):(r(),u("div",{key:1,class:"wl-reaction-votes",textContent:U(n.value[o]||0)},null,8,la))]),h("div",{class:"wl-reaction-text",textContent:U(y)},null,8,aa)],10,Ql))),128))])])):R("v-if",!0)}}),me=(e,a)=>{const l=e.__vccOpts||e;for(const[t,i]of a)l[t]=i;return l},oa=me(na,[["__file","ArticleReaction.vue"]]);const ia=["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 l=e;a();let t=null;const i=I(null),n=I({}),m=I([]),d=()=>{const p=Math.floor((i.value.getBoundingClientRect().width+l.gap)/(l.columnWidth+l.gap));return p>0?p:1},g=p=>new Array(p).fill(null).map(()=>[]),c=async p=>{var M;if(p>=l.items.length)return;await Vt();const _=Array.from(((M=i.value)==null?void 0:M.children)||[]).reduce((E,y)=>y.getBoundingClientRect().height<E.getBoundingClientRect().height?y:E);m.value[Number(_.dataset.index)].push(p),await c(p+1)},f=async(p=!1)=>{if(m.value.length===d()&&!p)return;m.value=g(d());const M=window.scrollY;await c(0),window.scrollTo({top:M})},S=p=>{n.value[p.target.src]=!0};return fe(()=>{f(!0),t=new ResizeObserver(()=>{f()}),t.observe(i.value),te(()=>[l.items],()=>{n.value={},f(!0)}),te(()=>[l.columnWidth,l.gap],()=>{f()})}),Ht(()=>t.unobserve(i.value)),(p,M)=>(r(),u("div",{ref_key:"wall",ref:i,class:"wl-gallery",style:Oe({gap:`${p.gap}px`})},[(r(!0),u(P,null,X(m.value,(_,E)=>(r(),u("div",{key:E,class:"wl-gallery-column","data-index":E,style:Oe({gap:`${p.gap}px`})},[(r(!0),u(P,null,X(_,y=>(r(),u(P,{key:y},[n.value[p.items[y].src]?R("v-if",!0):(r(),le(L(ve),{key:0,size:36,style:{margin:"20px auto"}})),h("img",{class:"wl-gallery-item",src:p.items[y].src,title:p.items[y].title,loading:"lazy",onLoad:S,onClick:o=>p.$emit("insert",`![](${p.items[y].src})`)},null,40,ra)],64))),128))],12,ia))),128))],4))}}),ca=me(sa,[["__file","ImageWall.vue"]]);const ua={class:"wl-comment"},va={key:0,class:"wl-login-info"},ma={class:"wl-avatar"},da=["title"],pa=["title"],ga=["src"],ha=["title","textContent"],fa={class:"wl-panel"},wa=["for","textContent"],ya=["id","onUpdate:modelValue","name","type"],ka=["placeholder"],ba={class:"wl-preview"},Ca=h("hr",null,null,-1),$a=["innerHTML"],La={class:"wl-footer"},Ea={class:"wl-actions"},Ia={href:"https://guides.github.com/features/mastering-markdown/",title:"Markdown Guide","aria-label":"Markdown is supported",class:"wl-action",target:"_blank",rel:"noopener noreferrer"},Ra=["title"],xa=["title"],Aa=["title"],Ma=["title"],Ua={class:"wl-info"},_a=h("div",{class:"wl-captcha-container"},null,-1),Sa={class:"wl-text-number"},ja={key:0},za=["textContent"],Ha=["textContent"],Va=["disabled"],Ta=["placeholder"],Fa={key:1,class:"wl-loading"},Na={key:0,class:"wl-tab-wrapper"},Wa=["title","onClick"],Pa=["src","alt"],Da={key:0,class:"wl-tabs"},Ba=["onClick"],Oa=["src","alt","title"],qa=["title"];var Ka=ue({__name:"CommentBox",props:{edit:{default:null},rootId:{default:""},replyId:{default:""},replyUser:{default:""}},emits:["log","cancelEdit","cancelReply","submit"],setup(e,{expose:a,emit:l}){const t=e,i=l;a();const n=Le("config"),m=Dl(),d=Pl(),g=be(),c=I({}),f=I(null),S=I(null),p=I(null),M=I(null),_=I(null),E=I(null),y=I(null),o=I({tabs:[],map:{}}),w=I(0),F=I(!1),D=I(!1),x=I(!1),z=I(""),ie=I(0),V=Ie({loading:!0,list:[]}),ne=I(0),ee=I(!1),de=I(""),Y=I(!1),$=I(!1),k=W(()=>n.value.locale),j=W(()=>{var v;return!!((v=g.value)!=null&&v.token)}),K=W(()=>n.value.imageUploader!==!1),B=v=>{const s=f.value,b=s.selectionStart,H=s.selectionEnd||0,C=s.scrollTop;m.value=s.value.substring(0,b)+v+s.value.substring(H,s.value.length),s.focus(),s.selectionStart=b+v.length,s.selectionEnd=b+v.length,s.scrollTop=C},J=v=>{const s=v.key;(v.ctrlKey||v.metaKey)&&s==="Enter"&&je()},Z=v=>{const s=`![${n.value.locale.uploading} ${v.name}]()`;return B(s),Y.value=!0,Promise.resolve().then(()=>n.value.imageUploader(v)).then(b=>{m.value=m.value.replace(s,`\r
![${v.name}](${b})`)}).catch(b=>{alert(b.message),m.value=m.value.replace(s,"")}).then(()=>{Y.value=!1})},ce=v=>{var s;if((s=v.dataTransfer)!=null&&s.items){const b=ut(v.dataTransfer.items);b&&K.value&&(Z(b),v.preventDefault())}},Se=v=>{if(v.clipboardData){const s=ut(v.clipboardData.items);s&&K.value&&Z(s)}},Ce=()=>{const v=S.value;v.files&&K.value&&Z(v.files[0]).then(()=>{v.value=""})},je=async()=>{var v,s,b,H,C,O;const{serverURL:N,lang:Q,login:pe,wordLimit:Ne,requiredMeta:We,recaptchaV3Key:Pe,turnstileKey:De}=n.value,Et=await Ul(),T={comment:de.value,nick:d.value.nick,mail:d.value.mail,link:d.value.link,url:n.value.path,ua:Et};if((v=g.value)!=null&&v.token)T.nick=g.value.display_name,T.mail=g.value.email,T.link=g.value.url;else{if(pe==="force")return;if(We.indexOf("nick")>-1&&!T.nick)return(s=c.value.nick)==null||s.focus(),alert(k.value.nickError);if(We.indexOf("mail")>-1&&!T.mail||T.mail&&!wl(T.mail))return(b=c.value.mail)==null||b.focus(),alert(k.value.mailError);T.nick||(T.nick=k.value.anonymous)}if(!T.comment){(H=f.value)==null||H.focus();return}if(!ee.value)return alert(k.value.wordHint.replace("$0",Ne[0].toString()).replace("$1",Ne[1].toString()).replace("$2",ie.value.toString()));T.comment=vt(T.comment,o.value.map),t.replyId&&t.rootId&&(T.pid=t.replyId,T.rid=t.rootId,T.at=t.replyUser),Y.value=!0;try{Pe&&(T.recaptchaV3=await Kl(Pe).execute("social")),De&&(T.turnstile=await Zl(De).execute("social"));const ge={serverURL:N,lang:Q,token:(C=g.value)==null?void 0:C.token,comment:T},$e=await(t.edit?he({objectId:t.edit.objectId,...ge}):xt(ge));if(Y.value=!1,$e.errmsg)return alert($e.errmsg);i("submit",$e.data),m.value="",z.value="",t.replyId&&i("cancelReply"),(O=t.edit)!=null&&O.objectId&&i("cancelEdit")}catch(ge){Y.value=!1,alert(ge.message)}},$t=v=>{v.preventDefault();const{lang:s,serverURL:b}=n.value;At({serverURL:b,lang:s}).then(H=>{g.value=H,(H.remember?localStorage:sessionStorage).setItem("WALINE_USER",JSON.stringify(H)),i("log")})},Lt=()=>{g.value={},localStorage.setItem("WALINE_USER","null"),sessionStorage.setItem("WALINE_USER","null"),i("log")},ze=v=>{v.preventDefault();const{lang:s,serverURL:b}=n.value,H=800,C=800,O=(window.innerWidth-H)/2,N=(window.innerHeight-C)/2,Q=new URLSearchParams({lng:s,token:g.value.token}),pe=window.open(`${b}/ui/profile?${Q.toString()}`,"_blank",`width=${H},height=${C},left=${O},top=${N},scrollbars=no,resizable=no,status=no,location=no,toolbar=no,menubar=no`);pe==null||pe.postMessage({type:"TOKEN",data:g.value.token},"*")},He=v=>{var s,b,H,C;!((s=p.value)!=null&&s.contains(v.target))&&!((b=M.value)!=null&&b.contains(v.target))&&(F.value=!1),!((H=_.value)!=null&&H.contains(v.target))&&!((C=E.value)!=null&&C.contains(v.target))&&(D.value=!1)},Ve=async v=>{var s;const{scrollTop:b,clientHeight:H,scrollHeight:C}=v.target,O=(H+b)/C,N=n.value.search,Q=((s=y.value)==null?void 0:s.value)||"";O<.9||V.loading||$.value||(V.loading=!0,(N.more&&V.list.length?await N.more(Q,V.list.length):await N.search(Q)).length?V.list=[...V.list,...N.more&&V.list.length?await N.more(Q,V.list.length):await N.search(Q)]:$.value=!0,V.loading=!1,setTimeout(()=>{v.target.scrollTop=b},50))},Te=Ot(v=>{V.list=[],$.value=!1,Ve(v)},300);te([n,ie],([v,s])=>{const{wordLimit:b}=v;b?s<b[0]&&b[0]!==0?(ne.value=b[0],ee.value=!1):s>b[1]?(ne.value=b[1],ee.value=!1):(ne.value=b[1],ee.value=!0):(ne.value=0,ee.value=!0)},{immediate:!0});const Fe=({data:v})=>{!v||v.type!=="profile"||(g.value={...g.value,...v.data},[localStorage,sessionStorage].filter(s=>s.getItem("WALINE_USER")).forEach(s=>s.setItem("WALINE_USER",JSON.stringify(g))))};return fe(()=>{var v;document.body.addEventListener("click",He),window.addEventListener("message",Fe),(v=t.edit)!=null&&v.objectId&&(m.value=t.edit.orig),te(D,async s=>{if(!s)return;const b=n.value.search;y.value&&(y.value.value=""),V.loading=!0,V.list=b.default?await b.default():await b.search(""),V.loading=!1}),te(()=>m.value,s=>{const{highlighter:b,texRenderer:H}=n.value;de.value=s,z.value=Rl(s,{emojiMap:o.value.map,highlighter:b,texRenderer:H}),ie.value=Ml(s),s?Ze(f.value):Ze.destroy(f.value)},{immediate:!0}),te(()=>n.value.emoji,s=>bl(s).then(b=>{o.value=b}),{immediate:!0})}),Ee(()=>{document.body.removeEventListener("click",He),window.removeEventListener("message",Fe)}),(v,s)=>{var b,H;return r(),u("div",ua,[L(n).login!=="disable"&&j.value&&!((b=v.edit)!=null&&b.objectId)?(r(),u("div",va,[h("div",ma,[h("button",{type:"submit",class:"wl-logout-btn",title:k.value.logout,onClick:Lt},[G(L(dt),{size:14})],8,da),h("a",{href:"#",class:"wl-login-nick","aria-label":"Profile",title:k.value.profile,onClick:ze},[h("img",{src:L(g).avatar,alt:"avatar"},null,8,ga)],8,pa)]),h("a",{href:"#",class:"wl-login-nick","aria-label":"Profile",title:k.value.profile,onClick:ze,textContent:U(L(g).display_name)},null,8,ha)])):R("v-if",!0),h("div",fa,[L(n).login!=="force"&&L(n).meta.length&&!j.value?(r(),u("div",{key:0,class:q(["wl-header",`item${L(n).meta.length}`])},[(r(!0),u(P,null,X(L(n).meta,C=>(r(),u("div",{key:C,class:"wl-header-item"},[h("label",{for:`wl-${C}`,textContent:U(k.value[C]+(L(n).requiredMeta.includes(C)||!L(n).requiredMeta.length?"":`(${k.value.optional})`))},null,8,wa),we(h("input",{id:`wl-${C}`,ref_for:!0,ref:O=>{O&&(c.value[C]=O)},"onUpdate:modelValue":O=>L(d)[C]=O,class:q(["wl-input",`wl-${C}`]),name:C,type:C==="mail"?"email":"text"},null,10,ya),[[Tt,L(d)[C]]])]))),128))],2)):R("v-if",!0),we(h("textarea",{id:"wl-edit",ref_key:"editorRef",ref:f,"onUpdate:modelValue":s[0]||(s[0]=C=>Ft(m)?m.value=C:null),class:"wl-editor",placeholder:v.replyUser?`@${v.replyUser}`:k.value.placeholder,onKeydown:J,onDrop:ce,onPaste:Se},null,40,ka),[[Nt,L(m)]]),we(h("div",ba,[Ca,h("h4",null,U(k.value.preview)+":",1),h("div",{class:"wl-content",innerHTML:z.value},null,8,$a)],512),[[qe,x.value]]),h("div",La,[h("div",Ea,[h("a",Ia,[G(L(Vl))]),we(h("button",{ref_key:"emojiButtonRef",ref:p,type:"button",class:q(["wl-action",{active:F.value}]),title:k.value.emoji,onClick:s[1]||(s[1]=C=>F.value=!F.value)},[G(L(Sl))],10,Ra),[[qe,o.value.tabs.length]]),L(n).search?(r(),u("button",{key:0,ref_key:"gifButtonRef",ref:_,type:"button",class:q(["wl-action",{active:D.value}]),title:k.value.gif,onClick:s[2]||(s[2]=C=>D.value=!D.value)},[G(L(Wl))],10,xa)):R("v-if",!0),h("input",{id:"wl-image-upload",ref_key:"imageUploadRef",ref:S,class:"upload",type:"file",accept:".png,.jpg,.jpeg,.webp,.bmp,.gif",onChange:Ce},null,544),K.value?(r(),u("label",{key:1,for:"wl-image-upload",class:"wl-action",title:k.value.uploadImage},[G(L(jl))],8,Aa)):R("v-if",!0),h("button",{type:"button",class:q(["wl-action",{active:x.value}]),title:k.value.preview,onClick:s[3]||(s[3]=C=>x.value=!x.value)},[G(L(Hl))],10,Ma)]),h("div",Ua,[_a,h("div",Sa,[ae(U(ie.value)+" ",1),L(n).wordLimit?(r(),u("span",ja,[ae("  /  "),h("span",{class:q({illegal:!ee.value}),textContent:U(ne.value)},null,10,za)])):R("v-if",!0),ae("  "+U(k.value.word),1)]),L(n).login!=="disable"&&!j.value?(r(),u("button",{key:0,type:"button",class:"wl-btn",onClick:$t,textContent:U(k.value.login)},null,8,Ha)):R("v-if",!0),L(n).login!=="force"||j.value?(r(),u("button",{key:1,type:"submit",class:"primary wl-btn",title:"Cmd|Ctrl + Enter",disabled:Y.value,onClick:je},[Y.value?(r(),le(L(ve),{key:0,size:16})):(r(),u(P,{key:1},[ae(U(k.value.submit),1)],64))],8,Va)):R("v-if",!0)]),h("div",{ref_key:"gifPopupRef",ref:E,class:q(["wl-gif-popup",{display:D.value}])},[h("input",{ref_key:"gifSearchInputRef",ref:y,type:"text",placeholder:k.value.gifSearchPlaceholder,onInput:s[4]||(s[4]=(...C)=>L(Te)&&L(Te)(...C))},null,40,Ta),V.list.length?(r(),le(ca,{key:0,items:V.list,"column-width":200,gap:6,onInsert:s[5]||(s[5]=C=>B(C)),onScroll:Ve},null,8,["items"])):R("v-if",!0),V.loading?(r(),u("div",Fa,[G(L(ve),{size:30})])):R("v-if",!0)],2),h("div",{ref_key:"emojiPopupRef",ref:M,class:q(["wl-emoji-popup",{display:F.value}])},[(r(!0),u(P,null,X(o.value.tabs,(C,O)=>(r(),u(P,{key:C.name},[O===w.value?(r(),u("div",Na,[(r(!0),u(P,null,X(C.items,N=>(r(),u("button",{key:N,type:"button",title:N,onClick:Q=>B(`:${N}:`)},[F.value?(r(),u("img",{key:0,class:"wl-emoji",src:o.value.map[N],alt:N,loading:"lazy",referrerPolicy:"no-referrer"},null,8,Pa)):R("v-if",!0)],8,Wa))),128))])):R("v-if",!0)],64))),128)),o.value.tabs.length>1?(r(),u("div",Da,[(r(!0),u(P,null,X(o.value.tabs,(C,O)=>(r(),u("button",{key:C.name,type:"button",class:q(["wl-tab",{active:w.value===O}]),onClick:N=>w.value=O},[h("img",{class:"wl-emoji",src:C.icon,alt:C.name,title:C.name,loading:"lazy",referrerPolicy:"no-referrer"},null,8,Oa)],10,Ba))),128))])):R("v-if",!0)],2)])]),v.replyId||(H=v.edit)!=null&&H.objectId?(r(),u("button",{key:1,type:"button",class:"wl-close",title:k.value.cancelReply,onClick:s[6]||(s[6]=C=>v.$emit(v.replyId?"cancelReply":"cancelEdit"))},[G(L(dt),{size:24})],8,qa)):R("v-if",!0)])}}}),yt=me(Ka,[["__file","CommentBox.vue"]]);const Za=["id"],Ga={class:"wl-user","aria-hidden":"true"},Ja=["src"],Xa={class:"wl-card"},Ya={class:"wl-head"},Qa=["href"],en={key:1,class:"wl-nick"},tn=["textContent"],ln=["textContent"],an=["textContent"],nn=["textContent"],on=["textContent"],rn={class:"wl-comment-actions"},sn=["title"],cn=["title"],un={class:"wl-meta","aria-hidden":"true"},vn=["data-value","textContent"],mn=["innerHTML"],dn={key:1,class:"wl-admin-actions"},pn={class:"wl-comment-status"},gn=["disabled","onClick","textContent"],hn={key:3,class:"wl-quote"};var fn=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 l=e,t=a,i=["approved","waiting","spam"],n=Le("config"),m=gt(),d=qt(),g=be(),c=W(()=>n.value.locale),f=W(()=>{const{link:o}=l.comment;return o?rt(o)?o:`https://${o}`:""}),S=W(()=>m.value.includes(l.comment.objectId)),p=W(()=>hl(new Date(l.comment.time),d.value,c.value)),M=W(()=>g.value.type==="administrator"),_=W(()=>l.comment.user_id&&g.value.objectId===l.comment.user_id),E=W(()=>{var o;return l.comment.objectId===((o=l.reply)==null?void 0:o.objectId)}),y=W(()=>{var o;return l.comment.objectId===((o=l.edit)==null?void 0:o.objectId)});return(o,w)=>{var F;const D=Wt("CommentCard",!0);return r(),u("div",{id:o.comment.objectId,class:"wl-card-item"},[h("div",Ga,[o.comment.avatar?(r(),u("img",{key:0,class:"wl-user-avatar",src:o.comment.avatar},null,8,Ja)):R("v-if",!0),o.comment.type?(r(),le(L(Nl),{key:1})):R("v-if",!0)]),h("div",Xa,[h("div",Ya,[f.value?(r(),u("a",{key:0,class:"wl-nick",href:f.value,target:"_blank",rel:"nofollow noopener noreferrer"},U(o.comment.nick),9,Qa)):(r(),u("span",en,U(o.comment.nick),1)),o.comment.type==="administrator"?(r(),u("span",{key:2,class:"wl-badge",textContent:U(c.value.admin)},null,8,tn)):R("v-if",!0),o.comment.label?(r(),u("span",{key:3,class:"wl-badge",textContent:U(o.comment.label)},null,8,ln)):R("v-if",!0),o.comment.sticky?(r(),u("span",{key:4,class:"wl-badge",textContent:U(c.value.sticky)},null,8,an)):R("v-if",!0),typeof o.comment.level=="number"?(r(),u("span",{key:5,class:q(`wl-badge level${o.comment.level}`),textContent:U(c.value[`level${o.comment.level}`]||`Level ${o.comment.level}`)},null,10,nn)):R("v-if",!0),h("span",{class:"wl-time",textContent:U(p.value)},null,8,on),h("div",rn,[M.value||_.value?(r(),u(P,{key:0},[h("button",{type:"button",class:"wl-edit",onClick:w[0]||(w[0]=x=>t("edit",o.comment))},[G(L(Fl))]),h("button",{type:"button",class:"wl-delete",onClick:w[1]||(w[1]=x=>t("delete",o.comment))},[G(L(_l))])],64)):R("v-if",!0),h("button",{type:"button",class:"wl-like",title:S.value?c.value.cancelLike:c.value.like,onClick:w[2]||(w[2]=x=>t("like",o.comment))},[G(L(zl),{active:S.value},null,8,["active"]),ae(" "+U("like"in o.comment?o.comment.like:""),1)],8,sn),h("button",{type:"button",class:q(["wl-reply",{active:E.value}]),title:E.value?c.value.cancelReply:c.value.reply,onClick:w[3]||(w[3]=x=>t("reply",E.value?null:o.comment))},[G(L(Tl))],10,cn)])]),h("div",un,[(r(),u(P,null,X(["addr","browser","os"],x=>(r(),u(P,null,[o.comment[x]?(r(),u("span",{key:x,class:q(`wl-${x}`),"data-value":o.comment[x],textContent:U(o.comment[x])},null,10,vn)):R("v-if",!0)],64))),64))]),y.value?R("v-if",!0):(r(),u("div",{key:0,class:"wl-content",innerHTML:o.comment.comment},null,8,mn)),M.value&&!y.value?(r(),u("div",dn,[h("span",pn,[(r(),u(P,null,X(i,x=>h("button",{key:x,type:"submit",class:q(`wl-btn wl-${x}`),disabled:o.comment.status===x,onClick:z=>t("status",{status:x,comment:o.comment}),textContent:U(c.value[x])},null,10,gn)),64))]),M.value&&!("rid"in o.comment)?(r(),u("button",{key:0,type:"submit",class:"wl-btn wl-sticky",onClick:w[4]||(w[4]=x=>t("sticky",o.comment))},U(o.comment.sticky?c.value.unsticky:c.value.sticky),1)):R("v-if",!0)])):R("v-if",!0),E.value||y.value?(r(),u("div",{key:2,class:q({"wl-reply-wrapper":E.value,"wl-edit-wrapper":y.value})},[G(yt,{edit:o.edit,"reply-id":(F=o.reply)==null?void 0:F.objectId,"reply-user":o.comment.nick,"root-id":o.rootId,onLog:w[5]||(w[5]=x=>t("log")),onCancelReply:w[6]||(w[6]=x=>t("reply",null)),onCancelEdit:w[7]||(w[7]=x=>t("edit",null)),onSubmit:w[8]||(w[8]=x=>t("submit",x))},null,8,["edit","reply-id","reply-user","root-id"])],2)):R("v-if",!0),"children"in o.comment?(r(),u("div",hn,[(r(!0),u(P,null,X(o.comment.children,x=>(r(),le(D,{key:x.objectId,comment:x,reply:o.reply,edit:o.edit,"root-id":o.rootId,onLog:w[9]||(w[9]=z=>t("log")),onDelete:w[10]||(w[10]=z=>t("delete",z)),onEdit:w[11]||(w[11]=z=>t("edit",z)),onLike:w[12]||(w[12]=z=>t("like",z)),onReply:w[13]||(w[13]=z=>t("reply",z)),onStatus:w[14]||(w[14]=z=>t("status",z)),onSticky:w[15]||(w[15]=z=>t("sticky",z)),onSubmit:w[16]||(w[16]=z=>t("submit",z))},null,8,["comment","reply","edit","root-id"]))),128))])):R("v-if",!0)])],8,Za)}}}),wn=me(fn,[["__file","CommentCard.vue"]]);const kt="3.0.0-alpha.12",yn={"data-waline":""},kn={class:"wl-meta-head"},bn={class:"wl-count"},Cn=["textContent"],$n={class:"wl-sort"},Ln=["onClick"],En={class:"wl-cards"},In={key:1,class:"wl-operation"},Rn=["textContent"],xn={key:2,class:"wl-loading"},An=["textContent"],Mn={key:4,class:"wl-operation"},Un=["textContent"],_n={key:5,class:"wl-power"},Sn=h("a",{href:"https://github.com/walinejs/waline",target:"_blank",rel:"noopener noreferrer"}," Waline ",-1);var jn=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,l={latest:"insertedAt_desc",oldest:"insertedAt_asc",hottest:"like_desc"},t=Object.keys(l),i=be(),n=gt(),m=I("loading"),d=I(0),g=I(1),c=I(0),f=W(()=>dl(a)),S=I(f.value.commentSorting),p=I([]),M=I(null),_=I(null),E=W(()=>pl(f.value.dark)),y=W(()=>f.value.locale);Kt(E,{id:"waline-darkmode"});let o;const w=$=>{var k;const{serverURL:j,path:K,pageSize:B}=f.value,J=new AbortController;m.value="loading",o==null||o(),Ut({serverURL:j,lang:f.value.lang,path:K,pageSize:B,sortBy:l[S.value],page:$,signal:J.signal,token:(k=i.value)==null?void 0:k.token}).then(Z=>{m.value="success",d.value=Z.count,p.value.push(...Z.data),g.value=$,c.value=Z.totalPages}).catch(Z=>{Z.name!=="AbortError"&&(console.error(Z.message),m.value="error")}),o=J.abort.bind(J)},F=()=>w(g.value+1),D=()=>{d.value=0,p.value=[],w(1)},x=$=>{S.value!==$&&(S.value=$,D())},z=$=>{M.value=$},ie=$=>{_.value=$},V=$=>{if(_.value)_.value.comment=$.comment,_.value.orig=$.orig;else if("rid"in $){const k=p.value.find(({objectId:j})=>j===$.rid);if(!k)return;Array.isArray(k.children)||(k.children=[]),k.children.push($)}else p.value.unshift($),d.value+=1},ne=async({comment:$,status:k})=>{var j;if($.status===k)return;const{serverURL:K,lang:B}=f.value;await he({serverURL:K,lang:B,token:(j=i.value)==null?void 0:j.token,objectId:$.objectId,comment:{status:k}}),$.status=k},ee=async $=>{var k;if("rid"in $)return;const{serverURL:j,lang:K}=f.value;await he({serverURL:j,lang:K,token:(k=i.value)==null?void 0:k.token,objectId:$.objectId,comment:{sticky:$.sticky?0:1}}),$.sticky=!$.sticky},de=async({objectId:$})=>{var k;if(!confirm("Are you sure you want to delete this comment?"))return;const{serverURL:j,lang:K}=f.value;await Mt({serverURL:j,lang:K,token:(k=i.value)==null?void 0:k.token,objectId:$}),p.value.some((B,J)=>B.objectId===$?(p.value=p.value.filter((Z,ce)=>ce!==J),!0):B.children.some((Z,ce)=>Z.objectId===$?(p.value[J].children=B.children.filter((Se,Ce)=>Ce!==ce),!0):!1))},Y=async $=>{var k;const{serverURL:j,lang:K}=f.value,{objectId:B}=$,J=n.value.includes(B);await he({serverURL:j,lang:K,objectId:B,token:(k=i.value)==null?void 0:k.token,comment:{like:!J}}),J?n.value=n.value.filter(Z=>Z!==B):(n.value=[...n.value,B],n.value.length>50&&(n.value=n.value.slice(-50))),$.like=($.like||0)+(J?-1:1)};return Pt("config",f),fe(()=>{te(()=>[a.serverURL,a.path],()=>D(),{immediate:!0})}),Ee(()=>o==null?void 0:o()),($,k)=>(r(),u("div",yn,[G(oa),M.value?R("v-if",!0):(r(),le(yt,{key:0,onLog:D,onSubmit:V})),h("div",kn,[h("div",bn,[d.value?(r(),u("span",{key:0,class:"wl-num",textContent:U(d.value)},null,8,Cn)):R("v-if",!0),ae(" "+U(y.value.comment),1)]),h("ul",$n,[(r(!0),u(P,null,X(L(t),j=>(r(),u("li",{key:j,class:q([j===S.value?"active":""]),onClick:K=>x(j)},U(y.value[j]),11,Ln))),128))])]),h("div",En,[(r(!0),u(P,null,X(p.value,j=>(r(),le(wn,{key:j.objectId,"root-id":j.objectId,comment:j,reply:M.value,edit:_.value,onLog:D,onReply:z,onEdit:ie,onSubmit:V,onStatus:ne,onDelete:de,onSticky:ee,onLike:Y},null,8,["root-id","comment","reply","edit"]))),128))]),m.value==="error"?(r(),u("div",In,[h("button",{type:"button",class:"wl-btn",onClick:D,textContent:U(y.value.refresh)},null,8,Rn)])):m.value==="loading"?(r(),u("div",xn,[G(L(ve),{size:30})])):p.value.length?g.value<c.value?(r(),u("div",Mn,[h("button",{type:"button",class:"wl-btn",onClick:F,textContent:U(y.value.more)},null,8,Un)])):R("v-if",!0):(r(),u("div",{key:3,class:"wl-empty",textContent:U(y.value.sofa)},null,8,An)),f.value.copyright?(r(),u("div",_n,[ae(" Powered by "),Sn,ae(" v"+U(L(kt)),1)])):R("v-if",!0)]))}}),zn=me(jn,[["__file","WalineComment.vue"]]);const bt=(e,a)=>{a.forEach((l,t)=>{l.innerText=e[t].toString()})},Ct=({serverURL:e,path:a=window.location.pathname,selector:l=".waline-pageview-count",update:t=!0,lang:i=navigator.language})=>{const n=new AbortController,m=Array.from(document.querySelectorAll(l)),d=c=>{const f=_e(c);return f!==null&&a!==f},g=c=>St({serverURL:ke(e),paths:c.map(f=>_e(f)||a),lang:i,signal:n.signal}).then(f=>bt(f,c)).catch(ct);if(t){const c=m.filter(S=>!d(S)),f=m.filter(d);_t({serverURL:ke(e),path:a,lang:i}).then(([S])=>bt(new Array(c.length).fill(S),c)),f.length&&g(f)}else g(m);return n.abort.bind(n)},Hn=({el:e="#waline",path:a=window.location.pathname,comment:l=!1,pageview:t=!1,...i})=>{const n=e?Ue(e):null;if(e&&!n)throw new Error("Option 'el' do not match any domElement!");if(!i.serverURL)throw new Error("Option 'serverURL' is missing!");const m=Ie({...i}),d=Ie({comment:l,pageview:t,path:a}),g=()=>{d.comment&&mt({serverURL:m.serverURL,path:d.path,...se(d.comment)?{selector:d.comment}:{}})},c=()=>{d.pageview&&Ct({serverURL:m.serverURL,path:d.path,...se(d.pageview)?{selector:d.pageview}:{}})},f=n?Dt(()=>A(zn,{path:d.path,...m})):null;f&&f.mount(n);const S=Ke(g),p=Ke(c);return{el:n,update:({comment:M,pageview:_,path:E=window.location.pathname,...y}={})=>{Object.entries(y).forEach(([o,w])=>{m[o]=w}),d.path=E,M!==void 0&&(d.comment=M),_!==void 0&&(d.pageview=_)},destroy:()=>{f==null||f.unmount(),S(),p()}}},Vn=({el:e,serverURL:a,count:l,lang:t=navigator.language})=>{var i;const n=be(),m=Ue(e),d=new AbortController;return jt({serverURL:a,count:l,lang:t,signal:d.signal,token:(i=n.value)==null?void 0:i.token}).then(g=>m&&g.length?(m.innerHTML=`<ul class="wl-recent-list">${g.map(c=>`<li class="wl-recent-item"><a href="${c.url}">${c.nick}</a>:${c.comment}</li>`).join("")}</ul>`,{comments:g,destroy:()=>{d.abort(),m.innerHTML=""}}):{comments:g,destroy:()=>d.abort()})},Tn=({el:e,serverURL:a,count:l,locale:t,lang:i=navigator.language,mode:n="list"})=>{const m=Ue(e),d=new AbortController;return zt({serverURL:a,pageSize:l,lang:i,signal:d.signal}).then(g=>!m||!g.length?{users:g,destroy:()=>d.abort()}:(t={...nt(i),...typeof t=="object"?t:{}},m.innerHTML=`<ul class="wl-user-${n}">${g.map((c,f)=>[`<li class="wl-user-item" aria-label="${c.nick}">`,c.link&&`<a href="${c.link}" target="_blank">`,'<div class="wl-user-avatar">',`<img src="${c.avatar}" alt="${c.nick}">`,`<span class="wl-user-badge">${f+1}</span>`,"</div>",'<div class="wl-user-meta">','<div class="wl-user-name">',c.nick,c.level&&`<span class="wl-badge">${t?t[`level${c.level}`]:`Level ${c.level}`}</span>`,c.label&&`<span class="wl-badge">${c.label}</span>`,"</div>",c.link&&c.link,"</div>",c.link&&"</a>","</li>"].filter(S=>S).join("")).join("")}</ul>`,{users:g,destroy:()=>{d.abort(),m.innerHTML=""}}))};export{Vn as RecentComments,Tn as UserList,mt as commentCount,ye as defaultLocales,Hn as init,Ct as pageviewCount,kt as version};
![${v.name}](${b})`)}).catch(b=>{alert(b.message),m.value=m.value.replace(s,"")}).then(()=>{Y.value=!1})},ce=v=>{var s;if((s=v.dataTransfer)!=null&&s.items){const b=ut(v.dataTransfer.items);b&&K.value&&(Z(b),v.preventDefault())}},Se=v=>{if(v.clipboardData){const s=ut(v.clipboardData.items);s&&K.value&&Z(s)}},Ce=()=>{const v=S.value;v.files&&K.value&&Z(v.files[0]).then(()=>{v.value=""})},je=async()=>{var v,s,b,H,C,O;const{serverURL:N,lang:Q,login:pe,wordLimit:Ne,requiredMeta:We,recaptchaV3Key:Pe,turnstileKey:De}=n.value,Et=await Ul(),T={comment:de.value,nick:d.value.nick,mail:d.value.mail,link:d.value.link,url:n.value.path,ua:Et};if((v=g.value)!=null&&v.token)T.nick=g.value.display_name,T.mail=g.value.email,T.link=g.value.url;else{if(pe==="force")return;if(We.indexOf("nick")>-1&&!T.nick)return(s=c.value.nick)==null||s.focus(),alert(k.value.nickError);if(We.indexOf("mail")>-1&&!T.mail||T.mail&&!wl(T.mail))return(b=c.value.mail)==null||b.focus(),alert(k.value.mailError);T.nick||(T.nick=k.value.anonymous)}if(!T.comment){(H=f.value)==null||H.focus();return}if(!ee.value)return alert(k.value.wordHint.replace("$0",Ne[0].toString()).replace("$1",Ne[1].toString()).replace("$2",ie.value.toString()));T.comment=vt(T.comment,o.value.map),t.replyId&&t.rootId&&(T.pid=t.replyId,T.rid=t.rootId,T.at=t.replyUser),Y.value=!0;try{Pe&&(T.recaptchaV3=await Kl(Pe).execute("social")),De&&(T.turnstile=await Zl(De).execute("social"));const ge={serverURL:N,lang:Q,token:(C=g.value)==null?void 0:C.token,comment:T},$e=await(t.edit?he({objectId:t.edit.objectId,...ge}):xt(ge));if(Y.value=!1,$e.errmsg)return alert($e.errmsg);i("submit",$e.data),m.value="",z.value="",t.replyId&&i("cancelReply"),(O=t.edit)!=null&&O.objectId&&i("cancelEdit")}catch(ge){Y.value=!1,alert(ge.message)}},$t=v=>{v.preventDefault();const{lang:s,serverURL:b}=n.value;At({serverURL:b,lang:s}).then(H=>{g.value=H,(H.remember?localStorage:sessionStorage).setItem("WALINE_USER",JSON.stringify(H)),i("log")})},Lt=()=>{g.value={},localStorage.setItem("WALINE_USER","null"),sessionStorage.setItem("WALINE_USER","null"),i("log")},ze=v=>{v.preventDefault();const{lang:s,serverURL:b}=n.value,H=800,C=800,O=(window.innerWidth-H)/2,N=(window.innerHeight-C)/2,Q=new URLSearchParams({lng:s,token:g.value.token}),pe=window.open(`${b}/ui/profile?${Q.toString()}`,"_blank",`width=${H},height=${C},left=${O},top=${N},scrollbars=no,resizable=no,status=no,location=no,toolbar=no,menubar=no`);pe==null||pe.postMessage({type:"TOKEN",data:g.value.token},"*")},He=v=>{var s,b,H,C;!((s=p.value)!=null&&s.contains(v.target))&&!((b=M.value)!=null&&b.contains(v.target))&&(F.value=!1),!((H=_.value)!=null&&H.contains(v.target))&&!((C=E.value)!=null&&C.contains(v.target))&&(D.value=!1)},Ve=async v=>{var s;const{scrollTop:b,clientHeight:H,scrollHeight:C}=v.target,O=(H+b)/C,N=n.value.search,Q=((s=y.value)==null?void 0:s.value)||"";O<.9||V.loading||$.value||(V.loading=!0,(N.more&&V.list.length?await N.more(Q,V.list.length):await N.search(Q)).length?V.list=[...V.list,...N.more&&V.list.length?await N.more(Q,V.list.length):await N.search(Q)]:$.value=!0,V.loading=!1,setTimeout(()=>{v.target.scrollTop=b},50))},Te=Ot(v=>{V.list=[],$.value=!1,Ve(v)},300);te([n,ie],([v,s])=>{const{wordLimit:b}=v;b?s<b[0]&&b[0]!==0?(ne.value=b[0],ee.value=!1):s>b[1]?(ne.value=b[1],ee.value=!1):(ne.value=b[1],ee.value=!0):(ne.value=0,ee.value=!0)},{immediate:!0});const Fe=({data:v})=>{!v||v.type!=="profile"||(g.value={...g.value,...v.data},[localStorage,sessionStorage].filter(s=>s.getItem("WALINE_USER")).forEach(s=>s.setItem("WALINE_USER",JSON.stringify(g))))};return fe(()=>{var v;document.body.addEventListener("click",He),window.addEventListener("message",Fe),(v=t.edit)!=null&&v.objectId&&(m.value=t.edit.orig),te(D,async s=>{if(!s)return;const b=n.value.search;y.value&&(y.value.value=""),V.loading=!0,V.list=b.default?await b.default():await b.search(""),V.loading=!1}),te(()=>m.value,s=>{const{highlighter:b,texRenderer:H}=n.value;de.value=s,z.value=Rl(s,{emojiMap:o.value.map,highlighter:b,texRenderer:H}),ie.value=Ml(s),s?Ze(f.value):Ze.destroy(f.value)},{immediate:!0}),te(()=>n.value.emoji,s=>bl(s).then(b=>{o.value=b}),{immediate:!0})}),Ee(()=>{document.body.removeEventListener("click",He),window.removeEventListener("message",Fe)}),(v,s)=>{var b,H;return r(),u("div",ua,[L(n).login!=="disable"&&j.value&&!((b=v.edit)!=null&&b.objectId)?(r(),u("div",va,[h("div",ma,[h("button",{type:"submit",class:"wl-logout-btn",title:k.value.logout,onClick:Lt},[G(L(dt),{size:14})],8,da),h("a",{href:"#",class:"wl-login-nick","aria-label":"Profile",title:k.value.profile,onClick:ze},[h("img",{src:L(g).avatar,alt:"avatar"},null,8,ga)],8,pa)]),h("a",{href:"#",class:"wl-login-nick","aria-label":"Profile",title:k.value.profile,onClick:ze,textContent:U(L(g).display_name)},null,8,ha)])):R("v-if",!0),h("div",fa,[L(n).login!=="force"&&L(n).meta.length&&!j.value?(r(),u("div",{key:0,class:q(["wl-header",`item${L(n).meta.length}`])},[(r(!0),u(P,null,X(L(n).meta,C=>(r(),u("div",{key:C,class:"wl-header-item"},[h("label",{for:`wl-${C}`,textContent:U(k.value[C]+(L(n).requiredMeta.includes(C)||!L(n).requiredMeta.length?"":`(${k.value.optional})`))},null,8,wa),we(h("input",{id:`wl-${C}`,ref_for:!0,ref:O=>{O&&(c.value[C]=O)},"onUpdate:modelValue":O=>L(d)[C]=O,class:q(["wl-input",`wl-${C}`]),name:C,type:C==="mail"?"email":"text"},null,10,ya),[[Tt,L(d)[C]]])]))),128))],2)):R("v-if",!0),we(h("textarea",{id:"wl-edit",ref_key:"editorRef",ref:f,"onUpdate:modelValue":s[0]||(s[0]=C=>Ft(m)?m.value=C:null),class:"wl-editor",placeholder:v.replyUser?`@${v.replyUser}`:k.value.placeholder,onKeydown:J,onDrop:ce,onPaste:Se},null,40,ka),[[Nt,L(m)]]),we(h("div",ba,[Ca,h("h4",null,U(k.value.preview)+":",1),h("div",{class:"wl-content",innerHTML:z.value},null,8,$a)],512),[[qe,x.value]]),h("div",La,[h("div",Ea,[h("a",Ia,[G(L(Vl))]),we(h("button",{ref_key:"emojiButtonRef",ref:p,type:"button",class:q(["wl-action",{active:F.value}]),title:k.value.emoji,onClick:s[1]||(s[1]=C=>F.value=!F.value)},[G(L(Sl))],10,Ra),[[qe,o.value.tabs.length]]),L(n).search?(r(),u("button",{key:0,ref_key:"gifButtonRef",ref:_,type:"button",class:q(["wl-action",{active:D.value}]),title:k.value.gif,onClick:s[2]||(s[2]=C=>D.value=!D.value)},[G(L(Wl))],10,xa)):R("v-if",!0),h("input",{id:"wl-image-upload",ref_key:"imageUploadRef",ref:S,class:"upload",type:"file",accept:".png,.jpg,.jpeg,.webp,.bmp,.gif",onChange:Ce},null,544),K.value?(r(),u("label",{key:1,for:"wl-image-upload",class:"wl-action",title:k.value.uploadImage},[G(L(jl))],8,Aa)):R("v-if",!0),h("button",{type:"button",class:q(["wl-action",{active:x.value}]),title:k.value.preview,onClick:s[3]||(s[3]=C=>x.value=!x.value)},[G(L(Hl))],10,Ma)]),h("div",Ua,[_a,h("div",Sa,[ae(U(ie.value)+" ",1),L(n).wordLimit?(r(),u("span",ja,[ae("  /  "),h("span",{class:q({illegal:!ee.value}),textContent:U(ne.value)},null,10,za)])):R("v-if",!0),ae("  "+U(k.value.word),1)]),L(n).login!=="disable"&&!j.value?(r(),u("button",{key:0,type:"button",class:"wl-btn",onClick:$t,textContent:U(k.value.login)},null,8,Ha)):R("v-if",!0),L(n).login!=="force"||j.value?(r(),u("button",{key:1,type:"submit",class:"primary wl-btn",title:"Cmd|Ctrl + Enter",disabled:Y.value,onClick:je},[Y.value?(r(),le(L(ve),{key:0,size:16})):(r(),u(P,{key:1},[ae(U(k.value.submit),1)],64))],8,Va)):R("v-if",!0)]),h("div",{ref_key:"gifPopupRef",ref:E,class:q(["wl-gif-popup",{display:D.value}])},[h("input",{ref_key:"gifSearchInputRef",ref:y,type:"text",placeholder:k.value.gifSearchPlaceholder,onInput:s[4]||(s[4]=(...C)=>L(Te)&&L(Te)(...C))},null,40,Ta),V.list.length?(r(),le(ca,{key:0,items:V.list,"column-width":200,gap:6,onInsert:s[5]||(s[5]=C=>B(C)),onScroll:Ve},null,8,["items"])):R("v-if",!0),V.loading?(r(),u("div",Fa,[G(L(ve),{size:30})])):R("v-if",!0)],2),h("div",{ref_key:"emojiPopupRef",ref:M,class:q(["wl-emoji-popup",{display:F.value}])},[(r(!0),u(P,null,X(o.value.tabs,(C,O)=>(r(),u(P,{key:C.name},[O===w.value?(r(),u("div",Na,[(r(!0),u(P,null,X(C.items,N=>(r(),u("button",{key:N,type:"button",title:N,onClick:Q=>B(`:${N}:`)},[F.value?(r(),u("img",{key:0,class:"wl-emoji",src:o.value.map[N],alt:N,loading:"lazy",referrerPolicy:"no-referrer"},null,8,Pa)):R("v-if",!0)],8,Wa))),128))])):R("v-if",!0)],64))),128)),o.value.tabs.length>1?(r(),u("div",Da,[(r(!0),u(P,null,X(o.value.tabs,(C,O)=>(r(),u("button",{key:C.name,type:"button",class:q(["wl-tab",{active:w.value===O}]),onClick:N=>w.value=O},[h("img",{class:"wl-emoji",src:C.icon,alt:C.name,title:C.name,loading:"lazy",referrerPolicy:"no-referrer"},null,8,Oa)],10,Ba))),128))])):R("v-if",!0)],2)])]),v.replyId||(H=v.edit)!=null&&H.objectId?(r(),u("button",{key:1,type:"button",class:"wl-close",title:k.value.cancelReply,onClick:s[6]||(s[6]=C=>v.$emit(v.replyId?"cancelReply":"cancelEdit"))},[G(L(dt),{size:24})],8,qa)):R("v-if",!0)])}}}),yt=me(Ka,[["__file","CommentBox.vue"]]);const Za=["id"],Ga={class:"wl-user","aria-hidden":"true"},Ja=["src"],Xa={class:"wl-card"},Ya={class:"wl-head"},Qa=["href"],en={key:1,class:"wl-nick"},tn=["textContent"],ln=["textContent"],an=["textContent"],nn=["textContent"],on=["textContent"],rn={class:"wl-comment-actions"},sn=["title"],cn=["title"],un={class:"wl-meta","aria-hidden":"true"},vn=["data-value","textContent"],mn=["innerHTML"],dn={key:1,class:"wl-admin-actions"},pn={class:"wl-comment-status"},gn=["disabled","onClick","textContent"],hn={key:3,class:"wl-quote"};var fn=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 l=e,t=a,i=["approved","waiting","spam"],n=Le("config"),m=gt(),d=qt(),g=be(),c=W(()=>n.value.locale),f=W(()=>{const{link:o}=l.comment;return o?rt(o)?o:`https://${o}`:""}),S=W(()=>m.value.includes(l.comment.objectId)),p=W(()=>hl(new Date(l.comment.time),d.value,c.value)),M=W(()=>g.value.type==="administrator"),_=W(()=>l.comment.user_id&&g.value.objectId===l.comment.user_id),E=W(()=>{var o;return l.comment.objectId===((o=l.reply)==null?void 0:o.objectId)}),y=W(()=>{var o;return l.comment.objectId===((o=l.edit)==null?void 0:o.objectId)});return(o,w)=>{var F;const D=Wt("CommentCard",!0);return r(),u("div",{id:o.comment.objectId,class:"wl-card-item"},[h("div",Ga,[o.comment.avatar?(r(),u("img",{key:0,class:"wl-user-avatar",src:o.comment.avatar},null,8,Ja)):R("v-if",!0),o.comment.type?(r(),le(L(Nl),{key:1})):R("v-if",!0)]),h("div",Xa,[h("div",Ya,[f.value?(r(),u("a",{key:0,class:"wl-nick",href:f.value,target:"_blank",rel:"nofollow noopener noreferrer"},U(o.comment.nick),9,Qa)):(r(),u("span",en,U(o.comment.nick),1)),o.comment.type==="administrator"?(r(),u("span",{key:2,class:"wl-badge",textContent:U(c.value.admin)},null,8,tn)):R("v-if",!0),o.comment.label?(r(),u("span",{key:3,class:"wl-badge",textContent:U(o.comment.label)},null,8,ln)):R("v-if",!0),o.comment.sticky?(r(),u("span",{key:4,class:"wl-badge",textContent:U(c.value.sticky)},null,8,an)):R("v-if",!0),typeof o.comment.level=="number"?(r(),u("span",{key:5,class:q(`wl-badge level${o.comment.level}`),textContent:U(c.value[`level${o.comment.level}`]||`Level ${o.comment.level}`)},null,10,nn)):R("v-if",!0),h("span",{class:"wl-time",textContent:U(p.value)},null,8,on),h("div",rn,[M.value||_.value?(r(),u(P,{key:0},[h("button",{type:"button",class:"wl-edit",onClick:w[0]||(w[0]=x=>t("edit",o.comment))},[G(L(Fl))]),h("button",{type:"button",class:"wl-delete",onClick:w[1]||(w[1]=x=>t("delete",o.comment))},[G(L(_l))])],64)):R("v-if",!0),h("button",{type:"button",class:"wl-like",title:S.value?c.value.cancelLike:c.value.like,onClick:w[2]||(w[2]=x=>t("like",o.comment))},[G(L(zl),{active:S.value},null,8,["active"]),ae(" "+U("like"in o.comment?o.comment.like:""),1)],8,sn),h("button",{type:"button",class:q(["wl-reply",{active:E.value}]),title:E.value?c.value.cancelReply:c.value.reply,onClick:w[3]||(w[3]=x=>t("reply",E.value?null:o.comment))},[G(L(Tl))],10,cn)])]),h("div",un,[(r(),u(P,null,X(["addr","browser","os"],x=>(r(),u(P,null,[o.comment[x]?(r(),u("span",{key:x,class:q(`wl-${x}`),"data-value":o.comment[x],textContent:U(o.comment[x])},null,10,vn)):R("v-if",!0)],64))),64))]),y.value?R("v-if",!0):(r(),u("div",{key:0,class:"wl-content",innerHTML:o.comment.comment},null,8,mn)),M.value&&!y.value?(r(),u("div",dn,[h("span",pn,[(r(),u(P,null,X(i,x=>h("button",{key:x,type:"submit",class:q(`wl-btn wl-${x}`),disabled:o.comment.status===x,onClick:z=>t("status",{status:x,comment:o.comment}),textContent:U(c.value[x])},null,10,gn)),64))]),M.value&&!("rid"in o.comment)?(r(),u("button",{key:0,type:"submit",class:"wl-btn wl-sticky",onClick:w[4]||(w[4]=x=>t("sticky",o.comment))},U(o.comment.sticky?c.value.unsticky:c.value.sticky),1)):R("v-if",!0)])):R("v-if",!0),E.value||y.value?(r(),u("div",{key:2,class:q({"wl-reply-wrapper":E.value,"wl-edit-wrapper":y.value})},[G(yt,{edit:o.edit,"reply-id":(F=o.reply)==null?void 0:F.objectId,"reply-user":o.comment.nick,"root-id":o.rootId,onLog:w[5]||(w[5]=x=>t("log")),onCancelReply:w[6]||(w[6]=x=>t("reply",null)),onCancelEdit:w[7]||(w[7]=x=>t("edit",null)),onSubmit:w[8]||(w[8]=x=>t("submit",x))},null,8,["edit","reply-id","reply-user","root-id"])],2)):R("v-if",!0),"children"in o.comment?(r(),u("div",hn,[(r(!0),u(P,null,X(o.comment.children,x=>(r(),le(D,{key:x.objectId,comment:x,reply:o.reply,edit:o.edit,"root-id":o.rootId,onLog:w[9]||(w[9]=z=>t("log")),onDelete:w[10]||(w[10]=z=>t("delete",z)),onEdit:w[11]||(w[11]=z=>t("edit",z)),onLike:w[12]||(w[12]=z=>t("like",z)),onReply:w[13]||(w[13]=z=>t("reply",z)),onStatus:w[14]||(w[14]=z=>t("status",z)),onSticky:w[15]||(w[15]=z=>t("sticky",z)),onSubmit:w[16]||(w[16]=z=>t("submit",z))},null,8,["comment","reply","edit","root-id"]))),128))])):R("v-if",!0)])],8,Za)}}}),wn=me(fn,[["__file","CommentCard.vue"]]);const kt="3.0.0",yn={"data-waline":""},kn={class:"wl-meta-head"},bn={class:"wl-count"},Cn=["textContent"],$n={class:"wl-sort"},Ln=["onClick"],En={class:"wl-cards"},In={key:1,class:"wl-operation"},Rn=["textContent"],xn={key:2,class:"wl-loading"},An=["textContent"],Mn={key:4,class:"wl-operation"},Un=["textContent"],_n={key:5,class:"wl-power"},Sn=h("a",{href:"https://github.com/walinejs/waline",target:"_blank",rel:"noopener noreferrer"}," Waline ",-1);var jn=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,l={latest:"insertedAt_desc",oldest:"insertedAt_asc",hottest:"like_desc"},t=Object.keys(l),i=be(),n=gt(),m=I("loading"),d=I(0),g=I(1),c=I(0),f=W(()=>dl(a)),S=I(f.value.commentSorting),p=I([]),M=I(null),_=I(null),E=W(()=>pl(f.value.dark)),y=W(()=>f.value.locale);Kt(E,{id:"waline-darkmode"});let o;const w=$=>{var k;const{serverURL:j,path:K,pageSize:B}=f.value,J=new AbortController;m.value="loading",o==null||o(),Ut({serverURL:j,lang:f.value.lang,path:K,pageSize:B,sortBy:l[S.value],page:$,signal:J.signal,token:(k=i.value)==null?void 0:k.token}).then(Z=>{m.value="success",d.value=Z.count,p.value.push(...Z.data),g.value=$,c.value=Z.totalPages}).catch(Z=>{Z.name!=="AbortError"&&(console.error(Z.message),m.value="error")}),o=J.abort.bind(J)},F=()=>w(g.value+1),D=()=>{d.value=0,p.value=[],w(1)},x=$=>{S.value!==$&&(S.value=$,D())},z=$=>{M.value=$},ie=$=>{_.value=$},V=$=>{if(_.value)_.value.comment=$.comment,_.value.orig=$.orig;else if("rid"in $){const k=p.value.find(({objectId:j})=>j===$.rid);if(!k)return;Array.isArray(k.children)||(k.children=[]),k.children.push($)}else p.value.unshift($),d.value+=1},ne=async({comment:$,status:k})=>{var j;if($.status===k)return;const{serverURL:K,lang:B}=f.value;await he({serverURL:K,lang:B,token:(j=i.value)==null?void 0:j.token,objectId:$.objectId,comment:{status:k}}),$.status=k},ee=async $=>{var k;if("rid"in $)return;const{serverURL:j,lang:K}=f.value;await he({serverURL:j,lang:K,token:(k=i.value)==null?void 0:k.token,objectId:$.objectId,comment:{sticky:$.sticky?0:1}}),$.sticky=!$.sticky},de=async({objectId:$})=>{var k;if(!confirm("Are you sure you want to delete this comment?"))return;const{serverURL:j,lang:K}=f.value;await Mt({serverURL:j,lang:K,token:(k=i.value)==null?void 0:k.token,objectId:$}),p.value.some((B,J)=>B.objectId===$?(p.value=p.value.filter((Z,ce)=>ce!==J),!0):B.children.some((Z,ce)=>Z.objectId===$?(p.value[J].children=B.children.filter((Se,Ce)=>Ce!==ce),!0):!1))},Y=async $=>{var k;const{serverURL:j,lang:K}=f.value,{objectId:B}=$,J=n.value.includes(B);await he({serverURL:j,lang:K,objectId:B,token:(k=i.value)==null?void 0:k.token,comment:{like:!J}}),J?n.value=n.value.filter(Z=>Z!==B):(n.value=[...n.value,B],n.value.length>50&&(n.value=n.value.slice(-50))),$.like=($.like||0)+(J?-1:1)};return Pt("config",f),fe(()=>{te(()=>[a.serverURL,a.path],()=>D(),{immediate:!0})}),Ee(()=>o==null?void 0:o()),($,k)=>(r(),u("div",yn,[G(oa),M.value?R("v-if",!0):(r(),le(yt,{key:0,onLog:D,onSubmit:V})),h("div",kn,[h("div",bn,[d.value?(r(),u("span",{key:0,class:"wl-num",textContent:U(d.value)},null,8,Cn)):R("v-if",!0),ae(" "+U(y.value.comment),1)]),h("ul",$n,[(r(!0),u(P,null,X(L(t),j=>(r(),u("li",{key:j,class:q([j===S.value?"active":""]),onClick:K=>x(j)},U(y.value[j]),11,Ln))),128))])]),h("div",En,[(r(!0),u(P,null,X(p.value,j=>(r(),le(wn,{key:j.objectId,"root-id":j.objectId,comment:j,reply:M.value,edit:_.value,onLog:D,onReply:z,onEdit:ie,onSubmit:V,onStatus:ne,onDelete:de,onSticky:ee,onLike:Y},null,8,["root-id","comment","reply","edit"]))),128))]),m.value==="error"?(r(),u("div",In,[h("button",{type:"button",class:"wl-btn",onClick:D,textContent:U(y.value.refresh)},null,8,Rn)])):m.value==="loading"?(r(),u("div",xn,[G(L(ve),{size:30})])):p.value.length?g.value<c.value?(r(),u("div",Mn,[h("button",{type:"button",class:"wl-btn",onClick:F,textContent:U(y.value.more)},null,8,Un)])):R("v-if",!0):(r(),u("div",{key:3,class:"wl-empty",textContent:U(y.value.sofa)},null,8,An)),f.value.copyright?(r(),u("div",_n,[ae(" Powered by "),Sn,ae(" v"+U(L(kt)),1)])):R("v-if",!0)]))}}),zn=me(jn,[["__file","WalineComment.vue"]]);const bt=(e,a)=>{a.forEach((l,t)=>{l.innerText=e[t].toString()})},Ct=({serverURL:e,path:a=window.location.pathname,selector:l=".waline-pageview-count",update:t=!0,lang:i=navigator.language})=>{const n=new AbortController,m=Array.from(document.querySelectorAll(l)),d=c=>{const f=_e(c);return f!==null&&a!==f},g=c=>St({serverURL:ke(e),paths:c.map(f=>_e(f)||a),lang:i,signal:n.signal}).then(f=>bt(f,c)).catch(ct);if(t){const c=m.filter(S=>!d(S)),f=m.filter(d);_t({serverURL:ke(e),path:a,lang:i}).then(([S])=>bt(new Array(c.length).fill(S),c)),f.length&&g(f)}else g(m);return n.abort.bind(n)},Hn=({el:e="#waline",path:a=window.location.pathname,comment:l=!1,pageview:t=!1,...i})=>{const n=e?Ue(e):null;if(e&&!n)throw new Error("Option 'el' do not match any domElement!");if(!i.serverURL)throw new Error("Option 'serverURL' is missing!");const m=Ie({...i}),d=Ie({comment:l,pageview:t,path:a}),g=()=>{d.comment&&mt({serverURL:m.serverURL,path:d.path,...se(d.comment)?{selector:d.comment}:{}})},c=()=>{d.pageview&&Ct({serverURL:m.serverURL,path:d.path,...se(d.pageview)?{selector:d.pageview}:{}})},f=n?Dt(()=>A(zn,{path:d.path,...m})):null;f&&f.mount(n);const S=Ke(g),p=Ke(c);return{el:n,update:({comment:M,pageview:_,path:E=window.location.pathname,...y}={})=>{Object.entries(y).forEach(([o,w])=>{m[o]=w}),d.path=E,M!==void 0&&(d.comment=M),_!==void 0&&(d.pageview=_)},destroy:()=>{f==null||f.unmount(),S(),p()}}},Vn=({el:e,serverURL:a,count:l,lang:t=navigator.language})=>{var i;const n=be(),m=Ue(e),d=new AbortController;return jt({serverURL:a,count:l,lang:t,signal:d.signal,token:(i=n.value)==null?void 0:i.token}).then(g=>m&&g.length?(m.innerHTML=`<ul class="wl-recent-list">${g.map(c=>`<li class="wl-recent-item"><a href="${c.url}">${c.nick}</a>:${c.comment}</li>`).join("")}</ul>`,{comments:g,destroy:()=>{d.abort(),m.innerHTML=""}}):{comments:g,destroy:()=>d.abort()})},Tn=({el:e,serverURL:a,count:l,locale:t,lang:i=navigator.language,mode:n="list"})=>{const m=Ue(e),d=new AbortController;return zt({serverURL:a,pageSize:l,lang:i,signal:d.signal}).then(g=>!m||!g.length?{users:g,destroy:()=>d.abort()}:(t={...nt(i),...typeof t=="object"?t:{}},m.innerHTML=`<ul class="wl-user-${n}">${g.map((c,f)=>[`<li class="wl-user-item" aria-label="${c.nick}">`,c.link&&`<a href="${c.link}" target="_blank">`,'<div class="wl-user-avatar">',`<img src="${c.avatar}" alt="${c.nick}">`,`<span class="wl-user-badge">${f+1}</span>`,"</div>",'<div class="wl-user-meta">','<div class="wl-user-name">',c.nick,c.level&&`<span class="wl-badge">${t?t[`level${c.level}`]:`Level ${c.level}`}</span>`,c.label&&`<span class="wl-badge">${c.label}</span>`,"</div>",c.link&&c.link,"</div>",c.link&&"</a>","</li>"].filter(S=>S).join("")).join("")}</ul>`,{users:g,destroy:()=>{d.abort(),m.innerHTML=""}}))};export{Vn as RecentComments,Tn as UserList,mt as commentCount,ye as defaultLocales,Hn as init,Ct as pageviewCount,kt as version};
//# sourceMappingURL=slim.js.map
{
"name": "@waline/client",
"version": "3.0.0-alpha.12",
"version": "3.0.0",
"description": "client for waline comment system",

@@ -5,0 +5,0 @@ "keywords": [

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc