UNPKG

@shinigamidev/comment-client

Version:

client for waline comment system

10 lines 57.9 kB
import{h as y,defineComponent as he,inject as xe,ref as p,computed as N,onMounted as fe,watch as ae,onUnmounted as Fe,openBlock as i,createElementBlock as u,createElementVNode as l,toDisplayString as S,Fragment as O,renderList as J,normalizeClass as W,createBlock as ee,createCommentVNode as b,onBeforeUnmount as Ct,nextTick as Oe,normalizeStyle as Ge,reactive as It,withDirectives as pe,vModelText as St,vShow as Ee,createVNode as q,createTextVNode as ne,resolveComponent as qe,withCtx as xt,provide as Et}from"vue";import{useStorage as ve,useScriptTag as Lt,useDebounceFn as Rt,useEventListener as Ke,useNow as jt,useStyleTag as At}from"@vueuse/core";import{getArticleCounter as Mt,updateArticleCounter as Ze,updateComment as be,addComment as zt,login as Ut,getComment as Tt,deleteComment as Pt}from"@waline/api";import*as Xe from"vue-toastification";import Je from"autosize";import{marked as Vt,Marked as Bt}from"marked";import{markedHighlight as Wt}from"marked-highlight";import{load as Ht}from"recaptcha-v3";const Nt=({size:n})=>y("svg",{class:"wl-close-icon",viewBox:"0 0 1024 1024",width:n,height:n},[y("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"}),y("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"})]),Dt=()=>y("svg",{viewBox:"0 0 24 24",width:"20",height:"20",fill:"none",stroke:"red","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"lucide lucide-trash2-icon lucide-trash-2"},[y("path",{d:"M3 6h18"}),y("path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6"}),y("path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2"}),y("line",{x1:"10",y1:"11",x2:"10",y2:"17"}),y("line",{x1:"14",y1:"11",x2:"14",y2:"17"})]),Ft=({size:n})=>y("svg",{viewBox:"0 0 640 512",width:n,height:n,xmlns:"http://www.w3.org/2000/svg"},y("path",{fill:"currentColor",d:"M38.8 5.1C28.4-3.1 13.3-1.2 5.1 9.2S-1.2 34.7 9.2 42.9l592 464c10.4 8.2 25.5 6.3 33.7-4.1s6.3-25.5-4.1-33.7L525.6 386.7c39.6-40.6 66.4-86.1 79.9-118.4c3.3-7.9 3.3-16.7 0-24.6c-14.9-35.7-46.2-87.7-93-131.1C465.5 68.8 400.8 32 320 32c-68.2 0-125 26.3-169.3 60.8L38.8 5.1zm151 118.3C226 97.7 269.5 80 320 80c65.2 0 118.8 29.6 159.9 67.7C518.4 183.5 545 226 558.6 256c-12.6 28-36.6 66.8-70.9 100.9l-53.8-42.2c9.1-17.6 14.2-37.5 14.2-58.7c0-70.7-57.3-128-128-128c-32.2 0-61.7 11.9-84.2 31.5l-46.1-36.1zM394.9 284.2l-81.5-63.9c4.2-8.5 6.6-18.2 6.6-28.3c0-5.5-.7-10.9-2-16c.7 0 1.3 0 2 0c44.2 0 80 35.8 80 80c0 9.9-1.8 19.4-5.1 28.2zm51.3 163.3l-41.9-33C378.8 425.4 350.7 432 320 432c-65.2 0-118.8-29.6-159.9-67.7C121.6 328.5 95 286 81.4 256c8.3-18.4 21.5-41.5 39.4-64.8L83.1 161.5C60.3 191.2 44 220.8 34.5 243.7c-3.3 7.9-3.3 16.7 0 24.6c14.9 35.7 46.2 87.7 93 131.1C174.5 443.2 239.2 480 320 480c47.8 0 89.9-12.9 126.2-32.5zm-88-69.3L302 334c-23.5-5.4-43.1-21.2-53.7-42.3l-56.1-44.2c-.2 2.8-.3 5.6-.3 8.5c0 70.7 57.3 128 128 128c13.3 0 26.1-2 38.2-5.8z"})),Ot=()=>y("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},y("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"})),Gt=()=>y("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},[y("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"}),y("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"})]),qt=({active:n=!1})=>y("svg",{viewBox:"0 0 24 24",width:"20",height:"20",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"lucide lucide-thumbs-up-icon lucide-thumbs-up"},[y("path",{d:"M15 5.88 14 10h5.83a2 2 0 0 1 1.92 2.56l-2.33 8A2 2 0 0 1 17.5 22H4a2 2 0 0 1-2-2v-8a2 2 0 0 1 2-2h2.76a2 2 0 0 0 1.79-1.11L12 2a3.13 3.13 0 0 1 3 3.88Z",fill:n?"currentColor":""}),y("path",{d:"M7 10v12"})]),Kt=()=>y("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},[y("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"}),y("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"})]),Zt=()=>y("svg",{viewBox:"0 0 24 24",width:"20",height:"20",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"lucide lucide-square-pen-icon lucide-square-pen"},[y("path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"}),y("path",{d:"M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z"})]),Xt=()=>y("svg",{class:"verified-icon",viewBox:"0 0 1024 1024",width:"14",height:"14"},y("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"})),Jt=()=>y("svg",{class:"lucide lucide-pin-icon lucide-pin",viewBox:"0 0 24 24",width:"20",height:"20",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[y("path",{d:"M12 17v5"}),y("path",{d:"M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z"})]),_e=({size:n=100})=>y("svg",{width:n,height:n,viewBox:"0 0 100 100",preserveAspectRatio:"xMidYMid"},y("circle",{cx:50,cy:50,fill:"none",stroke:"currentColor",strokeWidth:"4",r:"40","stroke-dasharray":"85 30"},y("animateTransform",{attributeName:"transform",type:"rotate",repeatCount:"indefinite",dur:"1s",values:"0 50 50;360 50 50",keyTimes:"0;1"}))),Yt=()=>y("svg",{width:24,height:24,fill:"currentcolor",viewBox:"0 0 24 24"},[y("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"}),y("path",{d:"M18.5 3H5.75C3.6875 3 2 4.6875 2 6.75V18C2 20.0625 3.6875 21.75 5.75 21.75H18.5C20.5625 21.75 22.25 20.0625 22.25 18V6.75C22.25 4.6875 20.5625 3 18.5 3ZM20.75 18C20.75 19.2375 19.7375 20.25 18.5 20.25H5.75C4.5125 20.25 3.5 19.2375 3.5 18V6.75C3.5 5.5125 4.5125 4.5 5.75 4.5H18.5C19.7375 4.5 20.75 5.5125 20.75 6.75V18Z"})]),Qt=()=>y("svg",{width:20,height:20,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor","stroke-width":2,"stroke-linecap":"round","stroke-linejoin":"round",class:"lucide lucide-chevron-down-icon lucide-chevron-down"},y("path",{d:"m6 9 6 6 6-6"})),$t=()=>y("svg",{width:20,height:20,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor","stroke-width":2,"stroke-linecap":"round","stroke-linejoin":"round",class:"lucide lucide-chevron-down-icon lucide-chevron-down"},y("path",{d:"m18 15-6-6-6 6"})),en=()=>ve("WALINE_USER_META",{nick:"",mail:"",link:""}),tn=()=>ve("WALINE_COMMENT_BOX_EDITOR",""),nn="WALINE_LIKE";let Ye=null;const Qe=()=>Ye??(Ye=ve(nn,[])),on="WALINE_REACTION";let $e=null;const ln=()=>$e??($e=ve(on,{})),et={},an=n=>{const o=et[n]??(et[n]=Ht(n,{useRecaptchaNet:!0,autoHideBadge:!0}));return{execute:t=>o.then(e=>e.execute(t))}},rn=n=>({execute:async o=>{const{load:t}=Lt("https://challenges.cloudflare.com/turnstile/v0/api.js",void 0,{async:!1});await t();const e=window==null?void 0:window.turnstile;return new Promise(s=>{e==null||e.ready(()=>{e==null||e.render(".wl-captcha-container",{sitekey:n,action:o,size:"compact",callback:s})})})}}),sn="WALINE_USER";let tt=null;const Le=()=>tt??(tt=ve(sn,{}));var cn=he({__name:"ArticleReaction",setup(n,{expose:o}){o();const t=ln(),e=xe("config"),s=p(-1),w=p([]),v=p(0),g=N(()=>e.value.locale),a=N(()=>e.value.reaction.length>0),c=N(()=>{const{reaction:C,path:x}=e.value;return C.map((M,E)=>({icon:M,desc:g.value[`reaction${E}`],active:t.value[x]===E}))});let r;const U=async()=>{if(!a.value)return;const{serverURL:C,lang:x,path:M,reaction:E}=e.value,j=new AbortController;r=j.abort.bind(j);const G=await Mt({serverURL:C,lang:x,paths:[M],type:E.map((H,Z)=>`reaction${Z}`),signal:j.signal});w.value=E.map((H,Z)=>G[0][`reaction${Z}`]),v.value=G[0].totalReaction},P=async C=>{if(s.value===-1){const{serverURL:x,lang:M,path:E}=e.value,j=t.value[E];s.value=C,j!==void 0&&(await Ze({serverURL:x,lang:M,path:E,type:`reaction${j}`,action:"desc"}),w.value[j]=Math.max(w.value[j]-1,0)),j!==C&&(await Ze({serverURL:x,lang:M,path:E,type:`reaction${C}`}),w.value[C]=(w.value[C]||0)+1),v.value=w.value.reduce((G,H)=>G+H,0),j===C?delete t.value[E]:t.value[E]=C,s.value=-1}};fe(()=>{ae(()=>[e.value.serverURL,e.value.path],()=>{U()},{immediate:!0})}),Fe(()=>r==null?void 0:r());const k={reactionStorage:t,config:e,votingIndex:s,voteNumbers:w,totalReaction:v,locale:g,isReactionEnabled:a,reactionsInfo:c,get abort(){return r},set abort(C){r=C},fetchReaction:U,vote:P,get LoadingIcon(){return _e}};return Object.defineProperty(k,"__isScriptSetup",{enumerable:!1,value:!0}),k}}),we=(n,o)=>{const t=n.__vccOpts||n;for(const[e,s]of o)t[e]=s;return t};const dn={key:0,class:"wl-reaction"},un=["textContent"],mn=["textContent"],vn={class:"wl-reaction-list"},gn=["onClick"],hn={class:"wl-reaction-img"},fn=["src","alt"],wn=["textContent"],yn=["textContent"];function kn(n,o,t,e,s,w){return e.reactionsInfo.length?(i(),u("div",dn,[l("div",{class:"wl-reaction-title",textContent:S(e.locale.reactionTitle)},null,8,un),l("div",{class:"wl-reaction-respons",textContent:S(`${e.totalReaction} Reactions`)},null,8,mn),l("ul",vn,[(i(!0),u(O,null,J(e.reactionsInfo,({active:v,icon:g,desc:a},c)=>(i(),u("li",{key:c,class:W(["wl-reaction-item",{active:v}]),onClick:r=>e.vote(c)},[l("div",hn,[l("img",{src:g,alt:a},null,8,fn),e.votingIndex===c?(i(),ee(e.LoadingIcon,{key:0,class:"wl-reaction-loading"})):(i(),u("div",{key:1,class:"wl-reaction-votes",textContent:S(e.voteNumbers[c]||0)},null,8,wn))]),l("div",{class:"wl-reaction-text",textContent:S(a)},null,8,yn)],10,gn))),128))])])):b("v-if",!0)}var pn=we(cn,[["render",kn],["__file","ArticleReaction.vue"]]),bn=he({__name:"ImageWall",props:{items:{default:()=>[]},columnWidth:{default:300},gap:{default:0}},emits:["insert"],setup(n,{expose:o}){const t=n;o();let e=null;const s=p(null),w=p({}),v=p([]),g=()=>{const k=Math.floor((s.value.getBoundingClientRect().width+t.gap)/(t.columnWidth+t.gap));return k>0?k:1},a=k=>new Array(k).fill(null).map(()=>[]),c=async k=>{var C;if(k>=t.items.length)return;await Oe();const x=Array.from(((C=s.value)==null?void 0:C.children)??[]).reduce((M,E)=>E.getBoundingClientRect().height<M.getBoundingClientRect().height?E:M);v.value[Number(x.dataset.index)].push(k),await c(k+1)},r=async(k=!1)=>{if(v.value.length===g()&&!k)return;v.value=a(g());const C=window.scrollY;await c(0),window.scrollTo({top:C})},U=k=>{w.value[k.target.src]=!0};fe(()=>{r(!0),e=new ResizeObserver(()=>{r()}),e.observe(s.value),ae(()=>[t.items],()=>{w.value={},r(!0)}),ae(()=>[t.columnWidth,t.gap],()=>{r()})}),Ct(()=>e.unobserve(s.value));const P={props:t,get resizeObserver(){return e},set resizeObserver(k){e=k},wall:s,state:w,columns:v,getColumnCount:g,createColumns:a,fillColumns:c,redraw:r,imageLoad:U,get LoadingIcon(){return _e}};return Object.defineProperty(P,"__isScriptSetup",{enumerable:!1,value:!0}),P}});const _n=["data-index"],Cn=["src","title","onClick"];function In(n,o,t,e,s,w){return i(),u("div",{ref:"wall",class:"wl-gallery",style:Ge({gap:`${t.gap}px`})},[(i(!0),u(O,null,J(e.columns,(v,g)=>(i(),u("div",{key:g,class:"wl-gallery-column","data-index":g,style:Ge({gap:`${t.gap}px`})},[(i(!0),u(O,null,J(v,a=>(i(),u(O,{key:a},[e.state[t.items[a].src]?b("v-if",!0):(i(),ee(e.LoadingIcon,{key:0,size:36,style:{margin:"20px auto"}})),l("img",{class:"wl-gallery-item",src:t.items[a].src,title:t.items[a].title,loading:"lazy",onLoad:e.imageLoad,onClick:c=>n.$emit("insert",`![](${t.items[a].src})`)},null,40,Cn)],64))),128))],12,_n))),128))],4)}var Sn=we(bn,[["render",In],["__file","ImageWall.vue"]]);const xn=n=>{try{n=decodeURI(n)}catch{}return n},nt=(n="")=>n.replace(/\/$/u,""),ot=n=>/^(https?:)?\/\//.test(n),En=["nick","mail","link"],lt=n=>n.filter(o=>En.includes(o)),it=["//unpkg.com/@waline/emojis@1.1.0/weibo"],Ln=["//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"],Rn=n=>new Promise((o,t)=>{if(n.size>128e3)return t(new Error("File too large! File size limit 128KB"));const e=new FileReader;e.readAsDataURL(n),e.onload=()=>{var s;return o(((s=e.result)==null?void 0:s.toString())??"")},e.onerror=t}),jn=n=>n===!0?'<p class="wl-tex">TeX is not available in preview</p>':'<span class="wl-tex">TeX is not available in preview</span>',An=n=>{const o=async(t,e={})=>fetch(`https://api.giphy.com/v1/gifs/${t}?${new URLSearchParams({lang:n,limit:"20",rating:"g",api_key:"6CIMLkNMMOhRcXPoMCPkFy4Ybk2XUiMp",...e}).toString()}`).then(s=>s.json()).then(({data:s})=>s.map(w=>({title:w.title,src:w.images.downsized_medium.url})));return{search:t=>o("search",{q:t,offset:"0"}),default:()=>o("trending",{}),more:(t,e=0)=>o("search",{q:t,offset:e.toString()})}},Mn=/[\u4E00-\u9FFF\u3400-\u4dbf\uf900-\ufaff\u3040-\u309f\uac00-\ud7af\u0400-\u04FF]+|\w+/,zn=/</,Un=/(?:^|\s)\/\/(.+?)$/gm,Tn=/\/\*([\S\s]*?)\*\//gm,Pn=new RegExp(`(${Mn.source}|${zn.source})|((?:${Un.source})|(?:${Tn.source}))`,"gmi"),at=["23AC69","91C132","F19726","E8552D","1AAB8E","E1147F","2980C1","1BA1E6","9FA0A0","F19726","E30B20","E30B20","A3338B"],Re={},Vn=n=>{let o=0;return n.replace(Pn,(t,e,s)=>{if(s)return`<span style="color: slategray">${s}</span>`;if(e==="<")return"&lt;";let w;Re[e]?w=Re[e]:(w=at[o],Re[e]=w);const v=`<span style="color: #${w}">${e}</span>`;return o=++o%at.length,v})},Bn=["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=n=>Object.fromEntries(n.map((o,t)=>[Bn[t],o]));var Wn=oe(["Benutzername","Der Benutzername darf nicht weniger als 3 Bytes umfassen.","E-Mail","Bitte bestätigen Sie Ihre E-Mail-Adresse.","Webseite","Optional","Kommentieren Sie hier...","Noch keine Kommentare.","Senden","Gefällt mir","Gefällt mir nicht mehr","Antworten","Antwort abbrechen","Kommentare","Aktualisieren","Mehr laden...","Vorschau","Emoji","Ein Bild hochladen","Vor einigen Sekunden","Vor einigen Minuten","Vor einigen Stunden","Vor einigen Tagen","Gerade eben","Hochladen läuft","Anmelden","Abmelden","Admin","Angeheftet","Wörter","Bitte geben Sie Kommentare zwischen $0 und $1 Wörtern ein! Aktuelle Anzahl der Wörter: $2","Anonym","Zwerge","Hobbits","Ents","Magier","Elfen","Maïar","GIF","Nach einem GIF suchen","Profil","Genehmigt","Ausstehend","Spam","Lösen","Älteste","Neueste","Am beliebtesten","Was denken Sie?"]),rt=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! Current word number: $2`,"Anonymous","Dwarves","Hobbits","Ents","Wizards","Elves","Maiar","GIF","Search GIF","Profile","Approved","Waiting","Spam","Unsticky","Oldest","Latest","Hottest","What do you think?"]),st=oe(["Pseudo","Le pseudo ne peut pas faire moins de 3 octets.","E-mail","Veuillez confirmer votre adresse e-mail.","Site Web","Optionnel","Commentez ici...","Aucun commentaire pour l'instant.","Envoyer","J'aime","Annuler le j'aime","Répondre","Annuler la réponse","Commentaires","Actualiser","Charger plus...","Aperçu","Emoji","Télécharger une image","Il y a quelques secondes","Il y a quelques minutes","Il y a quelques heures","Il y a quelques jours","À l'instant","Téléchargement en cours","Connexion","Déconnexion","Admin","Épinglé","Mots",`Veuillez saisir des commentaires entre $0 et $1 mots ! Nombre actuel de mots : $2`,"Anonyme","Nains","Hobbits","Ents","Mages","Elfes","Maïar","GIF","Rechercher un GIF","Profil","Approuvé","En attente","Indésirable","Détacher","Le plus ancien","Dernier","Le plus populaire","Qu'en pensez-vous ?"]),ct=oe(["ニックネーム","3バイト以上のニックネームをご入力ください.","メールアドレス","メールアドレスをご確認ください.","サイト","オプション","ここにコメント","コメントしましょう~","提出する","Like","Cancel like","返信する","キャンセル","コメント","更新","さらに読み込む","プレビュー","絵文字","画像をアップロード","秒前","分前","時間前","日前","たっだ今","アップロード","ログインする","ログアウト","管理者","トップに置く","ワード",`コメントは $0 から $1 ワードの間でなければなりません! 現在の単語番号: $2`,"匿名","うえにん","なかにん","しもおし","特にしもおし","かげ","なぬし","GIF","探す GIF","個人情報","承認済み","待っている","スパム","べたつかない","逆順","正順","人気順","どう思いますか?"]),Hn=oe(["Apelido","Apelido não pode ser menor que 3 bytes.","E-Mail","Por favor, confirme seu endereço de e-mail.","Website","Opcional","Comente aqui...","Nenhum comentário, ainda.","Enviar","Like","Cancel like","Responder","Cancelar resposta","Comentários","Refrescar","Carregar Mais...","Visualizar","Emoji","Enviar Imagem","segundos atrás","minutos atrás","horas atrás","dias atrás","agora mesmo","Enviando","Entrar","Sair","Admin","Sticky","Palavras",`Favor enviar comentário com $0 a $1 palavras! Número de palavras atuais: $2`,"Anônimo","Dwarves","Hobbits","Ents","Wizards","Elves","Maiar","GIF","Pesquisar GIF","informação pessoal","Aprovado","Espera","Spam","Unsticky","Mais velho","Mais recentes","Mais quente","O que você acha?"]),dt=oe(["Псевдоним","Никнейм не может быть меньше 3 байт.","Эл. адрес","Пожалуйста, подтвердите адрес вашей электронной почты.","Веб-сайт","Необязательный","Комментарий здесь...","Пока нет комментариев.","Отправить","Like","Cancel like","Отвечать","Отменить ответ","Комментарии","Обновить","Загрузи больше...","Превью","эмодзи","Загрузить изображение","секунд назад","несколько минут назад","несколько часов назад","дней назад","прямо сейчас","Загрузка","Авторизоваться","Выход из системы","Админ","Липкий","Слова",`Пожалуйста, введите комментарии от $0 до $1 слов! Номер текущего слова: $2`,"Анонимный","Dwarves","Hobbits","Ents","Wizards","Elves","Maiar","GIF","Поиск GIF","Персональные данные","Одобренный","Ожидающий","Спам","Нелипкий","самый старый","последний","самый горячий","Что вы думаете?"]),ut=oe(["Tên","Tên không được nhỏ hơn 3 ký tự.","E-Mail","Vui lòng xác nhập địa chỉ email của bạn.","Website","Tùy chọn","Hãy bình luận có văn hoá!","Chưa có bình luận","Gửi","Thích","Bỏ thích","Trả lời","Hủy bỏ","bình luận","Làm mới","Tải thêm...","Xem trước","Emoji","Tải lên hình ảnh","giây trước","phút trước","giờ trước","ngày trước","Vừa xong","Đang tải lên","Đăng nhập","đăng xuất","Quản trị viên","Dính","từ",`Bình luận phải có độ dài giữa $0 và $1 từ! Số từ hiện tại: $2`,"Vô danh","Người lùn","Người tí hon","Thần rừng","Pháp sư","Tiên tộc","Maiar","Ảnh GIF","Tìm kiếm ảnh GIF","thông tin cá nhân","Đã được phê duyệt","Đang chờ đợi","Thư rác","Không dính","lâu đời nhất","muộn nhất","nóng nhất","What do you think?"]),mt=oe(["昵称","昵称不能少于3个字符","邮箱","请填写正确的邮件地址","网址","可选","欢迎评论","来发评论吧~","提交","喜欢","取消喜欢","回复","取消回复","评论","刷新","加载更多...","预览","表情","上传图片","秒前","分钟前","小时前","天前","刚刚","正在上传","登录","退出","博主","置顶","字",`评论字数应在 $0 到 $1 字之间! 当前字数:$2`,"匿名","潜水","冒泡","吐槽","活跃","话痨","传说","表情包","搜索表情包","个人资料","通过","待审核","垃圾","取消置顶","按倒序","按正序","按热度","你认为这篇文章怎么样?"]),Nn=oe(["暱稱","暱稱不能少於3個字元","郵箱","請填寫正確的郵件地址","網址","可選","歡迎留言","來發留言吧~","送出","喜歡","取消喜歡","回覆","取消回覆","留言","重整","載入更多...","預覽","表情","上傳圖片","秒前","分鐘前","小時前","天前","剛剛","正在上傳","登入","登出","管理者","置頂","字",`留言字數應在 $0 到 $1 字之間! 目前字數:$2`,"匿名","潛水","冒泡","吐槽","活躍","多話","傳說","表情包","搜尋表情包","個人資料","通過","待審核","垃圾","取消置頂","最早","最新","熱門","你認為這篇文章怎麼樣?"]);const vt="en-US",je={zh:mt,"zh-cn":mt,"zh-tw":Nn,en:rt,"en-us":rt,fr:st,"fr-fr":st,jp:ct,"jp-jp":ct,"pt-br":Hn,ru:dt,"ru-ru":dt,vi:ut,"vi-vn":ut,de:Wn},Dn=n=>je[n.toLowerCase()]||je[vt.toLowerCase()],gt=n=>Object.keys(je).includes(n.toLowerCase())?n:vt,Fn=n=>{const o=nt(n);return ot(o)?o:`https://${o}`},On=n=>Array.isArray(n)?n:n?[0,n]:!1,Ae=(n,o)=>typeof n=="function"?n:n===!1?!1:o,Gn=({serverURL:n,path:o=location.pathname,lang:t=typeof navigator>"u"?"en-US":navigator.language,locale:e,emoji:s=it,meta:w=["nick","mail","link"],requiredMeta:v=[],dark:g=!1,pageSize:a=10,wordLimit:c,imageUploader:r,highlighter:U,texRenderer:P,copyright:k=!0,login:C="enable",search:x,reaction:M,recaptchaV3Key:E="",turnstileKey:j="",commentSorting:G="latest",...H})=>({serverURL:Fn(n),path:xn(o),lang:gt(t),locale:{...Dn(gt(t)),...typeof e=="object"?e:{}},wordLimit:On(c),meta:lt(w),requiredMeta:lt(v),imageUploader:Ae(r,Rn),highlighter:Ae(U,Vn),texRenderer:Ae(P,jn),dark:g,emoji:typeof s=="boolean"?s?it:[]:s,pageSize:a,login:C,copyright:k,search:x===!1?!1:typeof x=="object"?x:An(t),recaptchaV3Key:E,turnstileKey:j,reaction:Array.isArray(M)?M:M===!0?Ln:[],commentSorting:G,...H}),Me=n=>typeof n=="string",ze="{--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}",qn=n=>Me(n)?n==="auto"?`@media(prefers-color-scheme:dark){body${ze}}`:`${n}${ze}`:n===!0?`:root${ze}`:"",Ue=(n,o)=>{let t=n.toString();for(;t.length<o;)t="0"+t;return t},Kn=n=>{const o=Ue(n.getDate(),2),t=Ue(n.getMonth()+1,2);return`${Ue(n.getFullYear(),2)}-${t}-${o}`},Zn=(n,o,t)=>{if(!n)return"";const e=Me(n)?new Date(n.indexOf(" ")!==-1?n.replace(/-/g,"/"):n):n,s=o.getTime()-e.getTime(),w=Math.floor(s/(24*3600*1e3));if(w===0){const v=s%864e5,g=Math.floor(v/(3600*1e3));if(g===0){const a=v%36e5,c=Math.floor(a/(60*1e3));if(c===0){const r=a%6e4;return`${Math.round(r/1e3)} ${t.seconds}`}return`${c} ${t.minutes}`}return`${g} ${t.hours}`}return w<0?t.now:w<8?`${w} ${t.days}`:Kn(e)},Xn=/^[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])?)*$/,Jn=n=>Xn.test(n),Yn=n=>!!/@[0-9]+\.[0-9]+\.[0-9]+/.test(n),Qn=n=>{const o=ve("WALINE_EMOJI",{}),t=Yn(n);if(t){const e=o.value[n];if(e)return Promise.resolve(e)}return fetch(`${n}/info.json`).then(e=>e.json()).then(e=>{const s={folder:n,...e};return t&&(o.value[n]=s),s})},ht=(n,o="",t="",e="")=>`${o?`${o}/`:""}${t}${n}${e?`.${e}`:""}`,$n=n=>Promise.all(n.map(o=>Me(o)?Qn(nt(o)):Promise.resolve(o))).then(o=>{const t={tabs:[],map:{}};return o.forEach(e=>{const{name:s,folder:w,icon:v,prefix:g="",type:a,items:c}=e;t.tabs.push({name:s,icon:ht(v,w,g,a),items:c.map(r=>{const U=`${g}${r}`;return t.map[U]=ht(r,w,g,a),U})})}),t}),eo=n=>n.type.includes("image"),ft=n=>{const o=Array.from(n).find(eo);return o?o.getAsFile():null},to=/\$.*?\$/,no=/^\$(.*?)\$/,oo=/^(?:\s{0,3})\$\$((?:[^\n]|\n[^\n])+?)\n{0,1}\$\$/,lo=n=>[{name:"blockMath",level:"block",tokenizer(o){const t=oo.exec(o);if(t!==null)return{type:"html",raw:t[0],text:n(!0,t[1])}}},{name:"inlineMath",level:"inline",start(o){const t=o.search(to);return t!==-1?t:o.length},tokenizer(o){const t=no.exec(o);if(t!==null)return{type:"html",raw:t[0],text:n(!1,t[1])}}}],io=()=>[{name:"spoiler",level:"block",start(n){return n.indexOf("[spoiler]")},tokenizer(n){const o=/^\[spoiler\]([\s\S]+?)\[\/spoiler\]/.exec(n);if(o)return{type:"spoiler",raw:o[0],text:o[1].trim()}},renderer(n){return`<details><summary>Spoiler</summary>${Vt(n.text)}</details>`}},{name:"inlinespoiler",level:"inline",start(n){return n.indexOf("!!")},tokenizer(n){const o=/^!!([^\s][^]*?[^\s])!!(?!\s)/,t=n.match(o);if(t)return{type:"inlinespoiler",raw:t[0],text:t[1].trim(),tokens:this.lexer.inlineTokens(t[1].trim())}},renderer(n){return`<span class="spoiler">${this.parser.parseInline(n.tokens)}</span>`}}],wt=(n="",o={})=>n.replace(/:(.+?):/g,(t,e)=>o[e]?`<img class="wl-emoji" src="${o[e]}" alt="${e}">`:t),ao=(n,{emojiMap:o,highlighter:t,texRenderer:e})=>{const s=new Bt;if(s.setOptions({breaks:!0}),t&&s.use(Wt({highlight:t})),e){const w=lo(e);s.use({extensions:w})}return s.use({extensions:io()}),s.parse(wt(n,o))},ro=n=>n.match(/[\w\d\s,.\u00C0-\u024F\u0400-\u04FF]+/giu),so=n=>n.match(/[\u4E00-\u9FD5]/gu),co=n=>{var o,t;return(((o=ro(n))==null?void 0:o.reduce((e,s)=>e+(["",",","."].includes(s.trim())?0:s.trim().split(/\s+/u).length),0))??0)+(((t=so(n))==null?void 0:t.length)??0)},uo=async()=>{if(!navigator)return"";const{userAgentData:n}=navigator;let o=navigator.userAgent;if(!n||n.platform!=="Windows")return o;const{platformVersion:t}=await n.getHighEntropyValues(["platformVersion"]);return t&&parseInt(t.split(".")[0])>=13&&(o=o.replace("Windows NT 10.0","Windows NT 11.0")),o};var mo=he({__name:"CommentBox",props:{edit:{default:null},rootId:{default:""},replyId:{default:""},replyUser:{default:""}},emits:["log","cancelEdit","cancelReply","submit"],setup(n,{expose:o,emit:t}){o();const e=n,s=t,{useToast:w}=Xe,v=w(),g=xe("config"),a=tn(),c=en(),r=Le(),U=p({}),P=p(null),k=p(null),C=p(null),x=p(null),M=p(null),E=p(null),j=p(null),G=p({tabs:[],map:{}}),H=p(0),Z=p(!1),re=p(!1),le=p(!1),z=p(""),ue=p(0),D=It({loading:!0,list:[]}),se=p(0),Y=p(!1),ge=p(""),ie=p(!1),me=p(!1),ce=N(()=>g.value.locale),Ce=N(()=>{var d;return!!((d=r.value)!=null&&d.token)}),de=N(()=>g.value.imageUploader!==!1),h=d=>{const m=P.value,f=m.selectionStart,L=m.selectionEnd||0,F=m.scrollTop;a.value=m.value.substring(0,f)+d+m.value.substring(L,m.value.length),m.focus(),m.selectionStart=f+d.length,m.selectionEnd=f+d.length,m.scrollTop=F},_=()=>{const d=P.value,m=d.selectionStart,f=d.selectionEnd,L=d.value,F=L.substring(0,m),X=L.substring(f,L.length),V=L.substring(m,f),$=`${F}[spoiler]${V}[/spoiler]${X}`;a.value=$,d.focus(),d.selectionStart=m+9,d.selectionEnd=f+9},A=d=>{const m=d.key;(d.ctrlKey||d.metaKey)&&m==="Enter"&&Q()},R=d=>{const m=`![${g.value.locale.uploading} ${d.name}]()`;return h(m),ie.value=!0,Promise.resolve().then(()=>g.value.imageUploader(d)).then(f=>{a.value=a.value.replace(m,`\r ![](${f})`)}).catch(f=>{v.error(f.message),a.value=a.value.replace(m,"")}).then(()=>{ie.value=!1})},T=d=>{var m;if((m=d.dataTransfer)!=null&&m.items){const f=ft(d.dataTransfer.items);f&&de.value&&(R(f),d.preventDefault())}},K=d=>{if(d.clipboardData){const m=ft(d.clipboardData.items);m&&de.value&&R(m)}},I=()=>{const d=k.value;d.files&&de.value&&R(d.files[0]).then(()=>{d.value=""})},Q=async()=>{var d,m,f,L,F,X;const{serverURL:V,lang:$,login:ye,wordLimit:We,requiredMeta:He,recaptchaV3Key:Ne,turnstileKey:De}=g.value,_t=await uo(),B={comment:ge.value,nick:c.value.nick,mail:c.value.mail,link:c.value.link,url:g.value.path,ua:_t};if(!e.edit)if((d=r.value)!=null&&d.token)B.nick=r.value.display_name,B.mail=r.value.email,B.link=r.value.url;else{if(ye==="force")return;if(He.indexOf("nick")>-1&&!B.nick){(m=U.value.nick)==null||m.focus(),v.error(ce.value.nickError);return}if(He.indexOf("mail")>-1&&!B.mail||B.mail&&!Jn(B.mail)){(f=U.value.mail)==null||f.focus(),v.error(ce.value.mailError);return}B.nick||(B.nick=ce.value.anonymous)}if(!B.comment){(L=P.value)==null||L.focus();return}if(!Y.value){v.error(ce.value.wordHint.replace("$0",We[0].toString()).replace("$1",We[1].toString()).replace("$2",ue.value.toString()));return}B.comment=wt(B.comment,G.value.map),e.replyId&&e.rootId&&(B.pid=e.replyId,B.rid=e.rootId,B.at=e.replyUser),ie.value=!0;try{Ne&&(B.recaptchaV3=await an(Ne).execute("social")),De&&(B.turnstile=await rn(De).execute("social"));const ke={serverURL:V,lang:$,token:(F=r.value)==null?void 0:F.token,comment:B},te=await(e.edit?be({objectId:e.edit.objectId,...ke}):zt(ke));if(ie.value=!1,typeof te.errno>"u"&&te.success===!1){v.error(te.message),Se();return}if(te.errno==1001){v.error(te.errmsg),Se();return}if(te.errmsg){if(te.errno===401){v.info("Login dulu tong!");return}v.error(te.errmsg);return}s("submit",te.data),a.value="",z.value="",await Oe(),e.replyId&&s("cancelReply"),(X=e.edit)!=null&&X.objectId&&s("cancelEdit")}catch(ke){ie.value=!1,v.error(ke.message)}},Te=d=>{const m=(window.innerWidth-450)/2,f=(window.innerHeight-450)/2,L=window.open(`${d}/oauth?type=google&redirect=/ui/profile`,"_blank",`width=450,height=450,left=${m},top=${f},scrollbars=no,resizable=no,status=no,location=no,toolbar=no,menubar=no`);return new Promise(F=>{const X=({data:V})=>{!V||typeof V!="object"||V.type!=="userInfo"||V.data.token&&(L==null||L.close(),window.removeEventListener("message",X),F(V.data))};window.addEventListener("message",X)})},Ie=d=>{d.preventDefault();const{lang:m,serverURL:f}=g.value;Ut({serverURL:f,lang:m}).then(L=>{r.value=L,(L.remember?localStorage:sessionStorage).setItem("WALINE_USER",JSON.stringify(L)),s("log")})},Se=()=>{r.value={},localStorage.setItem("WALINE_USER","null"),sessionStorage.setItem("WALINE_USER","null"),s("log")},pt=d=>{d.preventDefault();const{lang:m,serverURL:f}=g.value,L=800,F=800,X=(window.innerWidth-L)/2,V=(window.innerHeight-F)/2,$=new URLSearchParams({lng:m,token:r.value.token}),ye=window.open(`${f}/ui/profile?${$.toString()}`,"_blank",`width=${L},height=${F},left=${X},top=${V},scrollbars=no,resizable=no,status=no,location=no,toolbar=no,menubar=no`);ye==null||ye.postMessage({type:"TOKEN",data:r.value.token},"*")},Pe=d=>{var m,f,L,F;!((m=C.value)!=null&&m.contains(d.target))&&!((f=x.value)!=null&&f.contains(d.target))&&(Z.value=!1),!((L=M.value)!=null&&L.contains(d.target))&&!((F=E.value)!=null&&F.contains(d.target))&&(re.value=!1)},Ve=async d=>{var m;const{scrollTop:f,clientHeight:L,scrollHeight:F}=d.target,X=(L+f)/F,V=g.value.search,$=((m=j.value)==null?void 0:m.value)??"";X<.9||D.loading||me.value||(D.loading=!0,(V.more&&D.list.length?await V.more($,D.list.length):await V.search($)).length?D.list=[...D.list,...V.more&&D.list.length?await V.more($,D.list.length):await V.search($)]:me.value=!0,D.loading=!1,setTimeout(()=>{d.target.scrollTop=f},50))},bt=Rt(d=>{D.list=[],me.value=!1,Ve(d)},300);ae([g,ue],([d,m])=>{const{wordLimit:f}=d;f?m<f[0]&&f[0]!==0?(se.value=f[0],Y.value=!1):m>f[1]?(se.value=f[1],Y.value=!1):(se.value=f[1],Y.value=!0):(se.value=0,Y.value=!0)},{immediate:!0}),Ke("click",Pe),Ke("message",({data:d})=>{!d||d.type!=="profile"||(r.value={...r.value,...d.data},[localStorage,sessionStorage].filter(m=>m.getItem("WALINE_USER")).forEach(m=>m.setItem("WALINE_USER",JSON.stringify(r))))}),ae(re,async d=>{var m;if(!d)return;const f=g.value.search;j.value&&(j.value.value=""),D.loading=!0,D.list=await(((m=f.default)==null?void 0:m.call(f))??f.search("")),D.loading=!1}),fe(()=>{var d;(d=e.edit)!=null&&d.objectId&&(a.value=e.edit.orig),ae(()=>a.value,m=>{const{highlighter:f,texRenderer:L}=g.value;ge.value=m,z.value=ao(m,{emojiMap:G.value.map,highlighter:f,texRenderer:L}),ue.value=co(m),m?Je(P.value):Je.destroy(P.value)},{immediate:!0}),ae(()=>g.value.emoji,m=>$n(m).then(f=>{G.value=f}),{immediate:!0})});const Be={props:e,emit:s,useToast:w,toast:v,config:g,editor:a,userMeta:c,userInfo:r,inputRefs:U,editorRef:P,imageUploadRef:k,emojiButtonRef:C,emojiPopupRef:x,gifButtonRef:M,gifPopupRef:E,gifSearchInputRef:j,emoji:G,emojiTabIndex:H,showEmoji:Z,showGif:re,showPreview:le,previewText:z,wordNumber:ue,searchResults:D,wordLimit:se,isWordNumberLegal:Y,content:ge,isSubmitting:ie,isImageListEnd:me,locale:ce,isLogin:Ce,canUploadImage:de,insert:h,addSpoilerTag:_,onKeyDown:A,uploadImage:R,onDrop:T,onPaste:K,onChange:I,submitComment:Q,customLogin:Te,onLogin:Ie,onLogout:Se,onProfile:pt,popupHandler:Pe,onImageWallScroll:Ve,onGifSearch:bt,get CloseIcon(){return Nt},get EmojiIcon(){return Ot},get GifIcon(){return Yt},get ImageIcon(){return Gt},get LoadingIcon(){return _e},get PreviewIcon(){return Kt},get SpoilerIcon(){return Ft},ImageWall:Sn};return Object.defineProperty(Be,"__isScriptSetup",{enumerable:!1,value:!0}),Be}});const vo={key:0,class:"",style:{margin:"0.5em",position:"relative",display:"flex","justify-content":"space-between","align-items":"center"}},go={style:{display:"flex","justify-content":"space-between","align-items":"center"}},ho={class:"wl-avatar-custom"},fo=["title"],wo=["src"],yo=["textContent"],ko=["title"],po=["title"],bo={class:"wl-comment"},_o={class:"wl-panel"},Co=["placeholder"],Io={class:"wl-preview"},So=l("hr",null,null,-1),xo=["innerHTML"],Eo={class:"wl-footer"},Lo={class:"wl-actions"},Ro=["title"],jo=["title"],Ao=["title","aria-label"],Mo=["title"],zo={class:"wl-info"},Uo=l("div",{class:"wl-captcha-container"},null,-1),To={class:"wl-text-number"},Po={key:0},Vo=["textContent"],Bo=["textContent"],Wo=["disabled"],Ho=["placeholder"],No={key:1,class:"wl-loading"},Do={key:0,class:"wl-tab-wrapper"},Fo=["title","onClick"],Oo=["src","alt"],Go={key:0,class:"wl-tabs"},qo=["onClick"],Ko=["src","alt","title"],Zo=["title"];function Xo(n,o,t,e,s,w){var v,g;return i(),u("div",{key:e.userInfo.token},[e.config.login!=="disable"&&e.isLogin&&!((v=t.edit)!=null&&v.objectId)&&!t.replyId?(i(),u("div",vo,[l("div",go,[l("div",ho,[l("a",{href:"#",class:"wl-login-nick","aria-label":"Profile",title:e.locale.profile},[l("img",{src:e.userInfo.avatar,alt:"avatar"},null,8,wo)],8,fo)]),l("span",{style:{"margin-left":"0.5em","font-weight":"bold","font-size":"0.875em","line-height":"1",color:"var(--waline-dark-grey)"},textContent:S(e.userInfo.display_name)},null,8,yo)]),l("div",null,[l("a",{href:"#",class:"","aria-label":"Profile",title:e.locale.profile,onClick:e.onProfile,textContent:"Edit Profile"},null,8,ko),l("a",{href:"#",class:"",style:{"margin-left":"0.5em"},"aria-label":"Logout",title:e.locale.logout,onClick:e.onLogout,textContent:"Logout"},null,8,po)])])):b("v-if",!0),l("div",bo,[l("div",_o,[pe(l("textarea",{id:"wl-edit",ref:"editorRef","onUpdate:modelValue":o[0]||(o[0]=a=>e.editor=a),class:"wl-editor",placeholder:t.replyUser?`@${t.replyUser}`:e.locale.placeholder,onKeydown:e.onKeyDown,onDrop:e.onDrop,onPaste:e.onPaste},null,40,Co),[[St,e.editor]]),pe(l("div",Io,[So,l("h4",null,S(e.locale.preview)+":",1),l("div",{class:"wl-content",innerHTML:e.previewText},null,8,xo)],512),[[Ee,e.showPreview]]),l("div",Eo,[l("div",Lo,[pe(l("button",{ref:"emojiButtonRef",type:"button",class:W(["wl-action",{active:e.showEmoji}]),title:e.locale.emoji,onClick:o[1]||(o[1]=a=>e.showEmoji=!e.showEmoji)},[q(e.EmojiIcon)],10,Ro),[[Ee,e.emoji.tabs.length]]),e.config.search?(i(),u("button",{key:0,ref:"gifButtonRef",type:"button",class:W(["wl-action",{active:e.showGif}]),title:e.locale.gif,onClick:o[2]||(o[2]=a=>e.showGif=!e.showGif)},[q(e.GifIcon)],10,jo)):b("v-if",!0),l("input",{id:"wl-image-upload",ref:"imageUploadRef",class:"upload","aria-hidden":"true",type:"file",accept:".png,.jpg,.jpeg,.webp,.bmp,.gif",onChange:e.onChange},null,544),e.canUploadImage?(i(),u("label",{key:1,for:"wl-image-upload",class:"wl-action",title:e.locale.uploadImage,"aria-label":e.locale.uploadImage},[q(e.ImageIcon)],8,Ao)):b("v-if",!0),l("button",{type:"button",class:W(["wl-action",{active:e.showPreview}]),title:e.locale.preview,onClick:o[3]||(o[3]=a=>e.showPreview=!e.showPreview)},[q(e.PreviewIcon)],10,Mo),l("button",{type:"button",class:"wl-action",title:"Spoiler",onClick:e.addSpoilerTag},[q(e.SpoilerIcon,{size:24})])]),l("div",zo,[Uo,l("div",To,[ne(S(e.wordNumber)+" ",1),e.config.wordLimit?(i(),u("span",Po,[ne("  /  "),l("span",{class:W({illegal:!e.isWordNumberLegal}),textContent:S(e.wordLimit)},null,10,Vo)])):b("v-if",!0),ne("  "+S(e.locale.word),1)]),e.config.login!=="disable"&&!e.isLogin?(i(),u("button",{key:0,type:"button",class:"wl-btn",onClick:e.onLogin,textContent:S(e.locale.login)},null,8,Bo)):b("v-if",!0),e.config.login!=="force"||e.isLogin?(i(),u("button",{key:1,type:"submit",class:"primary wl-btn",title:"Cmd|Ctrl + Enter",disabled:e.isSubmitting,onClick:e.submitComment},[e.isSubmitting?(i(),ee(e.LoadingIcon,{key:0,size:16})):(i(),u(O,{key:1},[ne(S(e.locale.submit),1)],64))],8,Wo)):b("v-if",!0)]),l("div",{ref:"gifPopupRef",class:W(["wl-gif-popup",{display:e.showGif}])},[l("input",{ref:"gifSearchInputRef",type:"text",placeholder:e.locale.gifSearchPlaceholder,onInput:o[4]||(o[4]=(...a)=>e.onGifSearch&&e.onGifSearch(...a))},null,40,Ho),e.searchResults.list.length?(i(),ee(e.ImageWall,{key:0,items:e.searchResults.list,"column-width":200,gap:6,onInsert:o[5]||(o[5]=a=>e.insert(a)),onScroll:e.onImageWallScroll},null,8,["items"])):b("v-if",!0),e.searchResults.loading?(i(),u("div",No,[q(e.LoadingIcon,{size:30})])):b("v-if",!0)],2),l("div",{ref:"emojiPopupRef",class:W(["wl-emoji-popup",{display:e.showEmoji}])},[(i(!0),u(O,null,J(e.emoji.tabs,(a,c)=>(i(),u(O,{key:a.name},[c===e.emojiTabIndex?(i(),u("div",Do,[(i(!0),u(O,null,J(a.items,r=>(i(),u("button",{key:r,type:"button",title:r,onClick:U=>e.insert(`:${r}:`)},[e.showEmoji?(i(),u("img",{key:0,class:"wl-emoji",src:e.emoji.map[r],alt:r,loading:"lazy",referrerPolicy:"no-referrer"},null,8,Oo)):b("v-if",!0)],8,Fo))),128))])):b("v-if",!0)],64))),128)),e.emoji.tabs.length>1?(i(),u("div",Go,[(i(!0),u(O,null,J(e.emoji.tabs,(a,c)=>(i(),u("button",{key:a.name,type:"button",class:W(["wl-tab",{active:e.emojiTabIndex===c}]),onClick:r=>e.emojiTabIndex=c},[l("img",{class:"wl-emoji",src:a.icon,alt:a.name,title:a.name,loading:"lazy",referrerPolicy:"no-referrer"},null,8,Ko)],10,qo))),128))])):b("v-if",!0)],2)])]),t.replyId||(g=t.edit)!=null&&g.objectId?(i(),u("button",{key:0,type:"button",class:"wl-close",title:e.locale.cancelReply,onClick:o[6]||(o[6]=a=>t.replyId?e.emit("cancelReply"):e.emit("cancelEdit"))},[q(e.CloseIcon,{size:24})],8,Zo)):b("v-if",!0)])])}var yt=we(mo,[["render",Xo],["__file","CommentBox.vue"]]),Jo=he({__name:"CommentCard",props:{comment:{},edit:{default:null},rootId:{},reply:{default:null}},emits:["log","submit","delete","edit","like","status","sticky","reply","banned"],setup(n,{expose:o,emit:t}){o();const e=n,s=t,w=["approved","waiting","spam"],v=xe("config"),g=Qe(),a=jt(),c=Le(),r=N(()=>v.value.locale),U=N(()=>{const{link:z}=e.comment;return z?ot(z)?z:`https://${z}`:""}),P=N(()=>g.value.includes(e.comment.objectId)),k=N(()=>Zn(new Date(e.comment.time),a.value,r.value)),C=N(()=>c.value.type==="administrator"),x=N(()=>e.comment.user_id&&c.value.objectId===e.comment.user_id),M=N(()=>{var z;return e.comment.objectId===((z=e.reply)==null?void 0:z.objectId)}),E=N(()=>{var z;return e.comment.objectId===((z=e.edit)==null?void 0:z.objectId)}),j=p(!1);function G(){}function H(z){s("submit",z)}function Z(z){s("edit",z)}function re(z){s("reply",M.value?null:z),j.value=!0}fe(()=>{});const le={props:e,emit:s,commentStatus:w,config:v,likes:g,now:a,userInfo:c,locale:r,link:U,like:P,time:k,isAdmin:C,isOwner:x,isReplyingCurrent:M,isEditingCurrent:E,showReplies:j,init:G,onSubmit:H,onEdit:Z,onReply:re,CommentBox:yt,get DeleteIcon(){return Dt},get EditIcon(){return Zt},get LikeIcon(){return qt},get ChevronDownIcon(){return Qt},get ChevronUpIcon(){return $t},get VerifiedIcon(){return Xt},get StickyIcon(){return Jt}};return Object.defineProperty(le,"__isScriptSetup",{enumerable:!1,value:!0}),le}});const Yo=["id"],Qo={key:0,style:{"z-index":"1",top:"-10px",position:"absolute",opacity:"70%"}},$o={class:"wl-user","aria-hidden":"true"},el=["src"],tl={class:"wl-head"},nl=["href"],ol=["textContent"],ll=["textContent"],il=["textContent"],al=["textContent"],rl={class:"wl-meta","aria-hidden":"true"},sl=["data-value","textContent"],cl={key:0,class:"wl-content"},dl={key:0},ul=["href"],ml=l("span",null,": ",-1),vl=["innerHTML"],gl={style:{display:"flex","justify-content":"space-between","align-items":"center"}},hl={key:0,class:"wl-comment-actions"},fl=["title"],wl={style:{display:"flex","flex-direction":"row",gap:"0.25em"}},yl=["title"],kl=l("span",null,"Reply",-1),pl=[kl],bl={key:1,class:"wl-admin-actions",style:{display:"flex","justify-content":"space-between","align-items":"center",gap:"0.5em"}},_l={class:"dropdown"},Cl=l("summary",{role:"button"},[l("a",{class:"button"},[l("svg",{width:"24",height:"24",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},[l("path",{d:"M7 12C7 13.1046 6.10457 14 5 14C3.89543 14 3 13.1046 3 12C3 10.8954 3.89543 10 5 10C6.10457 10 7 10.8954 7 12Z",fill:"#999"}),l("path",{d:"M14 12C14 13.1046 13.1046 14 12 14C10.8954 14 10 13.1046 10 12C10 10.8954 10.8954 10 12 10C13.1046 10 14 10.8954 14 12Z",fill:"#999"}),l("path",{d:"M21 12C21 13.1046 20.1046 14 19 14C17.8954 14 17 13.1046 17 12C17 10.8954 17.8954 10 19 10C20.1046 10 21 10.8954 21 12Z",fill:"#999"})])])],-1),Il=["onClick"],Sl={key:2,class:""},xl=["title"],El={key:3,class:"wl-quote"};function Ll(n,o,t,e,s,w){var a;const v=qe("TruncateReadMore"),g=qe("CommentCard",!0);return i(),u("div",{id:t.comment.objectId,class:W(["wl-card-item",{sticky:t.comment.sticky}])},[t.comment.sticky?(i(),u("div",Qo,[q(e.StickyIcon)])):b("v-if",!0),l("div",$o,[t.comment.avatar?(i(),u("img",{key:0,class:"wl-user-avatar",src:t.comment.avatar,alt:""},null,8,el)):b("v-if",!0),t.comment.type?(i(),ee(e.VerifiedIcon,{key:1})):b("v-if",!0)]),l("div",{class:W(["wl-card",{sticky:t.comment.sticky}])},[l("div",tl,[e.link?(i(),u("a",{key:0,class:"wl-nick",href:e.link,target:"_blank",rel:"nofollow noopener noreferrer"},S(t.comment.nick),9,nl)):(i(),u("span",{key:1,class:W(["wl-nick",{sticky:t.comment.sticky}])},S(t.comment.nick),3)),t.comment.type==="administrator"?(i(),u("span",{key:2,class:W(["wl-badge","admin"]),textContent:S(e.locale.admin)},null,8,ol)):b("v-if",!0),t.comment.label?(i(),u("span",{key:3,class:"wl-badge",textContent:S(t.comment.label)},null,8,ll)):b("v-if",!0),typeof t.comment.level=="number"?(i(),u("span",{key:4,class:W(`wl-badge level${t.comment.level}`),textContent:S(e.locale[`level${t.comment.level}`]||`Level ${t.comment.level}`)},null,10,il)):b("v-if",!0),l("span",{class:"wl-time",textContent:S(e.time)},null,8,al)]),l("div",rl,[(i(),u(O,null,J(["addr","browser","os"],c=>(i(),u(O,null,[t.comment[c]?(i(),u("span",{key:c,class:W(`wl-${c}`),"data-value":t.comment[c],textContent:S(t.comment[c])},null,10,sl)):b("v-if",!0)],64))),64))]),e.isEditingCurrent?b("v-if",!0):(i(),u("div",cl,[t.comment.reply_user?(i(),u("p",dl,[l("a",{href:"#"+t.comment.pid},"@"+S(t.comment.reply_user.nick),9,ul),ml])):b("v-if",!0),q(v,{"truncate-value":300,"only-if-more-than-value":375},{html:xt(()=>[l("div",{innerHTML:t.comment.comment},null,8,vl)]),_:1})])),l("div",gl,[e.isEditingCurrent?b("v-if",!0):(i(),u("div",hl,[e.isAdmin||e.isOwner?(i(),u(O,{key:0},[l("button",{type:"button",class:"wl-edit",onClick:o[0]||(o[0]=c=>e.emit("edit",t.comment))},[q(e.EditIcon)]),l("button",{type:"button",class:"wl-delete",onClick:o[1]||(o[1]=c=>e.emit("delete",t.comment))},[q(e.DeleteIcon)])],64)):b("v-if",!0),l("button",{type:"button",class:"wl-like",title:e.like?e.locale.cancelLike:e.locale.like,onClick:o[2]||(o[2]=c=>e.emit("like",t.comment))},[l("span",wl,[q(e.LikeIcon,{active:e.like},null,8,["active"]),ne(" "+S("like"in t.comment?t.comment.like:""),1)])],8,fl),l("button",{type:"button",class:W(["wl-reply",{active:e.isReplyingCurrent}]),title:e.isReplyingCurrent?e.locale.cancelReply:e.locale.reply,onClick:o[3]||(o[3]=c=>e.onReply(t.comment))},pl,10,yl)])),e.isAdmin&&!e.isEditingCurrent?(i(),u("div",bl,[e.isAdmin&&!("rid"in t.comment)?(i(),u("button",{key:0,type:"submit",class:"wl-btn wl-sticky",onClick:o[4]||(o[4]=c=>e.emit("sticky",t.comment))},S(t.comment.sticky?e.locale.unsticky:e.locale.sticky),1)):b("v-if",!0),l("details",_l,[Cl,l("ul",null,[(i(),u(O,null,J(e.commentStatus,c=>l("li",{key:c},[l("span",{class:W({disabled:t.comment.status===c}),onClick:r=>e.emit("status",{status:c,comment:t.comment})},S(e.locale[c]),11,Il)])),64)),l("li",null,[l("span",{onClick:o[5]||(o[5]=c=>e.emit("banned",t.comment))},"Banned")])])])])):b("v-if",!0)]),e.isReplyingCurrent||e.isEditingCurrent?(i(),u("div",{key:1,class:W({"wl-reply-wrapper":e.isReplyingCurrent,"wl-edit-wrapper":e.isEditingCurrent})},[q(e.CommentBox,{edit:t.edit,"reply-id":(a=t.reply)==null?void 0:a.objectId,"reply-user":t.comment.nick,"root-id":t.rootId,onLog:o[6]||(o[6]=c=>e.emit("log")),onCancelReply:o[7]||(o[7]=c=>e.emit("reply",null)),onCancelEdit:o[8]||(o[8]=c=>e.emit("edit",null)),onSubmit:o[9]||(o[9]=c=>e.onSubmit(c))},null,8,["edit","reply-id","reply-user","root-id"])],2)):b("v-if",!0),"children"in t.comment&&t.comment.children.length>0?(i(),u("div",Sl,[l("button",{type:"button",class:"wl-show-comment",title:e.showReplies?"Hide replies":"Show replies",onClick:o[10]||(o[10]=c=>e.showReplies=!e.showReplies)},[e.showReplies?(i(),ee(e.ChevronUpIcon,{key:1})):(i(),ee(e.ChevronDownIcon,{key:0})),ne(" "+S(t.comment.children.length)+" balasan ",1)],8,xl)])):b("v-if",!0),"children"in t.comment?pe((i(),u("div",El,[(i(!0),u(O,null,J(t.comment.children,c=>(i(),ee(g,{key:c.objectId,comment:c,reply:t.reply,edit:t.edit,"root-id":t.rootId,onLog:o[11]||(o[11]=r=>e.emit("log")),onDelete:o[12]||(o[12]=r=>e.emit("delete",r)),onEdit:o[13]||(o[13]=r=>e.onEdit(r)),onLike:o[14]||(o[14]=r=>e.emit("like",r)),onReply:o[15]||(o[15]=r=>e.onReply(r)),onStatus:o[16]||(o[16]=r=>e.emit("status",r)),onSticky:o[17]||(o[17]=r=>e.emit("sticky",r)),onSubmit:o[18]||(o[18]=r=>e.onSubmit(r))},null,8,["comment","reply","edit","root-id"]))),128))],512)),[[Ee,e.showReplies]]):b("v-if",!0)],2)],10,Yo)}var Rl=we(Jo,[["render",Ll],["__file","CommentCard.vue"]]);const kt="2.7.0-alpha";var jl=he({__name:"WalineComment",props:["serverURL","path","meta","requiredMeta","dark","commentSorting","lang","locale","pageSize","wordLimit","emoji","login","highlighter","