@waline/client 3.12.0 → 3.12.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/comment.js +1 -1
- package/dist/component.js +3 -3
- package/dist/component.js.map +1 -1
- package/dist/pageview.js +1 -1
- package/dist/slim.js +1 -1
- package/dist/slim.js.map +1 -1
- package/dist/waline.css +1 -1
- package/dist/waline.css.map +1 -1
- package/dist/waline.js +11 -11
- package/dist/waline.js.map +1 -1
- package/dist/waline.umd.js +1 -1
- package/dist/waline.umd.js.map +1 -1
- package/package.json +1 -1
package/dist/waline.umd.js
CHANGED
|
@@ -85,5 +85,5 @@ ${e}</tr>
|
|
|
85
85
|
`}strong({tokens:e}){return`<strong>${this.parser.parseInline(e)}</strong>`}em({tokens:e}){return`<em>${this.parser.parseInline(e)}</em>`}codespan({text:e}){return`<code>${ct(e,!0)}</code>`}br(e){return"<br>"}del({tokens:e}){return`<del>${this.parser.parseInline(e)}</del>`}link({href:e,title:t,tokens:n}){let r=this.parser.parseInline(n),s=yo(e);if(s===null)return r;e=s;let i='<a href="'+e+'"';return t&&(i+=' title="'+ct(t)+'"'),i+=">"+r+"</a>",i}image({href:e,title:t,text:n,tokens:r}){r&&(n=this.parser.parseInline(r,this.parser.textRenderer));let s=yo(e);if(s===null)return ct(n);e=s;let i=`<img src="${e}" alt="${n}"`;return t&&(i+=` title="${ct(t)}"`),i+=">",i}text(e){return"tokens"in e&&e.tokens?this.parser.parseInline(e.tokens):"escaped"in e&&e.escaped?e.text:ct(e.text)}},Ts=class{strong({text:e}){return e}em({text:e}){return e}codespan({text:e}){return e}del({text:e}){return e}html({text:e}){return e}text({text:e}){return e}link({text:e}){return""+e}image({text:e}){return""+e}br(){return""}checkbox({raw:e}){return e}},Je=class Fs{options;renderer;textRenderer;constructor(t){this.options=t||Dt,this.options.renderer=this.options.renderer||new Mr,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new Ts}static parse(t,n){return new Fs(n).parse(t)}static parseInline(t,n){return new Fs(n).parseInline(t)}parse(t){var r,s;let n="";for(let i=0;i<t.length;i++){let l=t[i];if((s=(r=this.options.extensions)==null?void 0:r.renderers)!=null&&s[l.type]){let a=l,c=this.options.extensions.renderers[a.type].call({parser:this},a);if(c!==!1||!["space","hr","heading","code","table","blockquote","list","html","def","paragraph","text"].includes(a.type)){n+=c||"";continue}}let o=l;switch(o.type){case"space":{n+=this.renderer.space(o);break}case"hr":{n+=this.renderer.hr(o);break}case"heading":{n+=this.renderer.heading(o);break}case"code":{n+=this.renderer.code(o);break}case"table":{n+=this.renderer.table(o);break}case"blockquote":{n+=this.renderer.blockquote(o);break}case"list":{n+=this.renderer.list(o);break}case"checkbox":{n+=this.renderer.checkbox(o);break}case"html":{n+=this.renderer.html(o);break}case"def":{n+=this.renderer.def(o);break}case"paragraph":{n+=this.renderer.paragraph(o);break}case"text":{n+=this.renderer.text(o);break}default:{let a='Token with "'+o.type+'" type was not found.';if(this.options.silent)return console.error(a),"";throw new Error(a)}}}return n}parseInline(t,n=this.renderer){var s,i;let r="";for(let l=0;l<t.length;l++){let o=t[l];if((i=(s=this.options.extensions)==null?void 0:s.renderers)!=null&&i[o.type]){let c=this.options.extensions.renderers[o.type].call({parser:this},o);if(c!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(o.type)){r+=c||"";continue}}let a=o;switch(a.type){case"escape":{r+=n.text(a);break}case"html":{r+=n.html(a);break}case"link":{r+=n.link(a);break}case"image":{r+=n.image(a);break}case"checkbox":{r+=n.checkbox(a);break}case"strong":{r+=n.strong(a);break}case"em":{r+=n.em(a);break}case"codespan":{r+=n.codespan(a);break}case"br":{r+=n.br(a);break}case"del":{r+=n.del(a);break}case"text":{r+=n.text(a);break}default:{let c='Token with "'+a.type+'" type was not found.';if(this.options.silent)return console.error(c),"";throw new Error(c)}}}return r}},Mn=(zr=class{options;block;constructor(t){this.options=t||Dt}preprocess(t){return t}postprocess(t){return t}processAllTokens(t){return t}emStrongMask(t){return t}provideLexer(){return this.block?Ye.lex:Ye.lexInline}provideParser(){return this.block?Je.parse:Je.parseInline}},js(zr,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens","emStrongMask"])),js(zr,"passThroughHooksRespectAsync",new Set(["preprocess","postprocess","processAllTokens"])),zr),xo=class{defaults=ks();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=Je;Renderer=Mr;TextRenderer=Ts;Lexer=Ye;Tokenizer=Ir;Hooks=Mn;constructor(...e){this.use(...e)}walkTokens(e,t){var r,s;let n=[];for(let i of e)switch(n=n.concat(t.call(this,i)),i.type){case"table":{let l=i;for(let o of l.header)n=n.concat(this.walkTokens(o.tokens,t));for(let o of l.rows)for(let a of o)n=n.concat(this.walkTokens(a.tokens,t));break}case"list":{let l=i;n=n.concat(this.walkTokens(l.items,t));break}default:{let l=i;(s=(r=this.defaults.extensions)==null?void 0:r.childTokens)!=null&&s[l.type]?this.defaults.extensions.childTokens[l.type].forEach(o=>{let a=l[o].flat(1/0);n=n.concat(this.walkTokens(a,t))}):l.tokens&&(n=n.concat(this.walkTokens(l.tokens,t)))}}return n}use(...e){let t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(n=>{let r={...n};if(r.async=this.defaults.async||r.async||!1,n.extensions&&(n.extensions.forEach(s=>{if(!s.name)throw new Error("extension name required");if("renderer"in s){let i=t.renderers[s.name];i?t.renderers[s.name]=function(...l){let o=s.renderer.apply(this,l);return o===!1&&(o=i.apply(this,l)),o}:t.renderers[s.name]=s.renderer}if("tokenizer"in s){if(!s.level||s.level!=="block"&&s.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let i=t[s.level];i?i.unshift(s.tokenizer):t[s.level]=[s.tokenizer],s.start&&(s.level==="block"?t.startBlock?t.startBlock.push(s.start):t.startBlock=[s.start]:s.level==="inline"&&(t.startInline?t.startInline.push(s.start):t.startInline=[s.start]))}"childTokens"in s&&s.childTokens&&(t.childTokens[s.name]=s.childTokens)}),r.extensions=t),n.renderer){let s=this.defaults.renderer||new Mr(this.defaults);for(let i in n.renderer){if(!(i in s))throw new Error(`renderer '${i}' does not exist`);if(["options","parser"].includes(i))continue;let l=i,o=n.renderer[l],a=s[l];s[l]=(...c)=>{let u=o.apply(s,c);return u===!1&&(u=a.apply(s,c)),u||""}}r.renderer=s}if(n.tokenizer){let s=this.defaults.tokenizer||new Ir(this.defaults);for(let i in n.tokenizer){if(!(i in s))throw new Error(`tokenizer '${i}' does not exist`);if(["options","rules","lexer"].includes(i))continue;let l=i,o=n.tokenizer[l],a=s[l];s[l]=(...c)=>{let u=o.apply(s,c);return u===!1&&(u=a.apply(s,c)),u}}r.tokenizer=s}if(n.hooks){let s=this.defaults.hooks||new Mn;for(let i in n.hooks){if(!(i in s))throw new Error(`hook '${i}' does not exist`);if(["options","block"].includes(i))continue;let l=i,o=n.hooks[l],a=s[l];Mn.passThroughHooks.has(i)?s[l]=c=>{if(this.defaults.async&&Mn.passThroughHooksRespectAsync.has(i))return(async()=>{let f=await o.call(s,c);return a.call(s,f)})();let u=o.call(s,c);return a.call(s,u)}:s[l]=(...c)=>{if(this.defaults.async)return(async()=>{let f=await o.apply(s,c);return f===!1&&(f=await a.apply(s,c)),f})();let u=o.apply(s,c);return u===!1&&(u=a.apply(s,c)),u}}r.hooks=s}if(n.walkTokens){let s=this.defaults.walkTokens,i=n.walkTokens;r.walkTokens=function(l){let o=[];return o.push(i.call(this,l)),s&&(o=o.concat(s.call(this,l))),o}}this.defaults={...this.defaults,...r}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return Ye.lex(e,t??this.defaults)}parser(e,t){return Je.parse(e,t??this.defaults)}parseMarkdown(e){return(t,n)=>{let r={...n},s={...this.defaults,...r},i=this.onError(!!s.silent,!!s.async);if(this.defaults.async===!0&&r.async===!1)return i(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof t>"u"||t===null)return i(new Error("marked(): input parameter is undefined or null"));if(typeof t!="string")return i(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(t)+", string expected"));if(s.hooks&&(s.hooks.options=s,s.hooks.block=e),s.async)return(async()=>{let l=s.hooks?await s.hooks.preprocess(t):t,o=await(s.hooks?await s.hooks.provideLexer():e?Ye.lex:Ye.lexInline)(l,s),a=s.hooks?await s.hooks.processAllTokens(o):o;s.walkTokens&&await Promise.all(this.walkTokens(a,s.walkTokens));let c=await(s.hooks?await s.hooks.provideParser():e?Je.parse:Je.parseInline)(a,s);return s.hooks?await s.hooks.postprocess(c):c})().catch(i);try{s.hooks&&(t=s.hooks.preprocess(t));let l=(s.hooks?s.hooks.provideLexer():e?Ye.lex:Ye.lexInline)(t,s);s.hooks&&(l=s.hooks.processAllTokens(l)),s.walkTokens&&this.walkTokens(l,s.walkTokens);let o=(s.hooks?s.hooks.provideParser():e?Je.parse:Je.parseInline)(l,s);return s.hooks&&(o=s.hooks.postprocess(o)),o}catch(l){return i(l)}}}onError(e,t){return n=>{if(n.message+=`
|
|
86
86
|
Please report this to https://github.com/markedjs/marked.`,e){let r="<p>An error occurred:</p><pre>"+ct(n.message+"",!0)+"</pre>";return t?Promise.resolve(r):r}if(t)return Promise.reject(n);throw n}}},Ht=new xo;function ge(e,t){return Ht.parse(e,t)}ge.options=ge.setOptions=function(e){return Ht.setOptions(e),ge.defaults=Ht.defaults,ro(ge.defaults),ge},ge.getDefaults=ks,ge.defaults=Dt,ge.use=function(...e){return Ht.use(...e),ge.defaults=Ht.defaults,ro(ge.defaults),ge},ge.walkTokens=function(e,t){return Ht.walkTokens(e,t)},ge.parseInline=Ht.parseInline,ge.Parser=Je,ge.parser=Je.parse,ge.Renderer=Mr,ge.TextRenderer=Ts,ge.Lexer=Ye,ge.lexer=Ye.lex,ge.Tokenizer=Ir,ge.Hooks=Mn,ge.parse=ge;function Xf(e){if(typeof e=="function"&&(e={highlight:e}),!e||typeof e.highlight!="function")throw new Error("Must provide highlight function");return typeof e.langPrefix!="string"&&(e.langPrefix="language-"),typeof e.emptyLangClass!="string"&&(e.emptyLangClass=""),{async:!!e.async,walkTokens(t){if(t.type!=="code")return;const n=_o(t.lang);if(e.async)return Promise.resolve(e.highlight(t.text,n,t.lang||"")).then(Co(t));const r=e.highlight(t.text,n,t.lang||"");if(r instanceof Promise)throw new Error("markedHighlight is not set to async but the highlight function is async. Set the async option to true on markedHighlight to await the async highlight function.");Co(t)(r)},useNewRenderer:!0,renderer:{code(t,n,r){typeof t=="object"&&(r=t.escaped,n=t.lang,t=t.text);const s=_o(n),i=s?e.langPrefix+Ao(s):e.emptyLangClass,l=i?` class="${i}"`:"";return t=t.replace(/\n$/,""),`<pre><code${l}>${r?t:Ao(t,!0)}
|
|
87
87
|
</code></pre>`}}}}function _o(e){return(e||"").match(/\S*/)[0]}function Co(e){return t=>{typeof t=="string"&&t!==e.text&&(e.escaped=!0,e.text=t)}}const $o=/[&<>"']/,eh=new RegExp($o.source,"g"),So=/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,th=new RegExp(So.source,"g"),nh={"&":"&","<":"<",">":">",'"':""","'":"'"},Ro=e=>nh[e];function Ao(e,t){if(t){if($o.test(e))return e.replace(eh,Ro)}else if(So.test(e))return e.replace(th,Ro);return e}const rh=/\$.*?\$/,sh=/^\$(.*?)\$/,ih=/^(?:\s{0,3})\$\$((?:[^\n]|\n[^\n])+?)\n{0,1}\$\$/,lh=e=>[{name:"blockMath",level:"block",tokenizer(t){const n=ih.exec(t);if(n!=null)return{type:"html",raw:n[0],text:e(!0,n[1])}}},{name:"inlineMath",level:"inline",start(t){const n=t.search(rh);return n===-1?t.length:n},tokenizer(t){const n=sh.exec(t);if(n!=null)return{type:"html",raw:n[0],text:e(!1,n[1])}}}],Eo=(e="",t={})=>e.replaceAll(/:(.+?):/g,(n,r)=>t[r]?`<img class="wl-emoji" src="${t[r]}" alt="${r}">`:n),oh=(e,{emojiMap:t,highlighter:n,texRenderer:r})=>{const s=new xo;if(s.setOptions({breaks:!0}),n&&s.use(Xf({highlight:n})),r){const i=lh(r);s.use({extensions:i})}return s.parse(Eo(e,t))},Ls=e=>{const{path:t}=e.dataset;return t!=null&&t.length?t:null},ah=e=>e.match(/[\w\d\s,.\u00C0-\u024F\u0400-\u04FF]+/giu),ch=e=>e.match(/[\u4E00-\u9FD5]/gu),uh=e=>{var t,n;return(((t=ah(e))==null?void 0:t.reduce((r,s)=>r+(["",",","."].includes(s.trim())?0:s.trim().split(/\s+/u).length),0))??0)+(((n=ch(e))==null?void 0:n.length)??0)},fh=async()=>{const{userAgentData:e}=navigator;let t=navigator.userAgent;if((e==null?void 0:e.platform)!=="Windows")return t;const{platformVersion:n}=await e.getHighEntropyValues(["platformVersion"]);return n&&Number.parseInt(n.split(".")[0],10)>=13&&(t=t.replace("Windows NT 10.0","Windows NT 11.0")),t},To=({serverURL:e,path:t=window.location.pathname,selector:n=".waline-comment-count",lang:r=navigator.language})=>{const s=new AbortController,i=document.querySelectorAll(n);return i.length>0&&Ns({serverURL:Bn(e),paths:Array.from(i,l=>ui(Ls(l)??t)),lang:r,signal:s.signal}).then(l=>{i.forEach((o,a)=>{o.textContent=l[a].toString()})}).catch(to),s.abort.bind(s)},Lo=({size:e})=>W("svg",{class:"wl-close-icon",viewBox:"0 0 1024 1024",width:e,height:e},[W("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"}),W("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"})]),hh=()=>W("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},W("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"})),ph=()=>W("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},W("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"})),dh=()=>W("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},[W("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"}),W("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"})]),gh=({active:e=!1})=>W("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},[W("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"})]),mh=()=>W("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},[W("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"}),W("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"})]),vh=()=>W("svg",{width:"16",height:"16",ariaHidden:"true"},W("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"})),bh=()=>W("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},W("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"})),yh=()=>W("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},W("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"})),wh=()=>W("svg",{class:"verified-icon",viewBox:"0 0 1024 1024",width:"14",height:"14"},W("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"})),kh=()=>W("svg",{class:"administrator-icon",viewBox:"0 0 1024 1024",width:"14",height:"14"},[W("path",{d:"M461.6 129.56C489.6 105.96 534.8 105.96 562.4 129.56L625.6 183.96C637.6 194.36 660.4 202.76 676 202.76H744C786.4 202.76 821.2 237.56 821.2 279.96V347.96C821.2 363.96 829.6 386.36 840 398.36L894.4 461.56C918 489.16 918 534.76 894.8 562.36L840.4 625.56C830 637.56 821.6 660.36 821.6 675.96V743.96C821.6 786.36 786.8 821.16 744.4 821.16H676.4C660.4 821.16 638 829.56 626 839.96L562.8 894.36C534.8 917.96 489.6 917.96 462 894.36L398.8 839.96C386.8 829.56 364 821.16 348.4 821.16H279.2C236.8 821.16 202 786.36 202 743.96V675.56C201.999 659.96 193.6 637.56 183.6 625.56L129.6 561.96C106.4 534.36 106.4 489.56 129.6 461.96L183.6 398.36C193.6 386.359 202 363.959 202 348.36V279.96C202 237.56 236.8 202.76 279.2 202.76H348.4C364 202.76 386.8 194.36 398.8 184.36L461.6 129.56ZM549.567 331.896C530.047 303.082 486.645 306.12 471.433 337.412L442.175 396.526C435.587 409.848 422.856 419.097 408.146 421.226L342.706 430.726C340.776 431 338.884 431.397 336.993 431.946C303.482 441.361 292.756 483.493 317.671 507.812L364.975 553.96C375.623 564.321 380.507 579.299 377.991 593.954L366.917 659.102C366.595 661.03 366.355 662.967 366.279 664.923C364.906 699.688 401.683 722.937 432.514 706.738L491.05 675.966C504.217 669.068 519.954 669.069 533.121 675.966L591.675 706.738C593.406 707.645 595.174 708.432 597.028 709.104C629.666 721.205 663.139 693.382 657.273 659.102L646.069 593.954C643.42 579.176 648.24 564.083 659.001 553.6L706.315 507.461C707.687 506.118 708.994 504.66 710.215 503.127C731.779 475.809 715.737 435.41 681.281 430.365L615.839 420.874C601.13 418.745 588.4 409.486 581.821 396.174L552.562 337.052C551.644 335.284 550.674 333.551 549.567 331.896Z",fill:"#f59831"})]),Pn=({size:e=100})=>W("svg",{width:e,height:e,viewBox:"0 0 100 100",preserveAspectRatio:"xMidYMid"},W("circle",{cx:50,cy:50,fill:"none",stroke:"currentColor",strokeWidth:"4",r:"40","stroke-dasharray":"85 30"},W("animateTransform",{attributeName:"transform",type:"rotate",repeatCount:"indefinite",dur:"1s",values:"0 50 50;360 50 50",keyTimes:"0;1"}))),xh=()=>W("svg",{width:24,height:24,fill:"currentcolor",viewBox:"0 0 24 24"},[W("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"}),W("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"})]),Io=()=>W("svg",{width:"16",height:"16",viewBox:"0 0 24 24"},W("g",{transform:"translate(0 -1028.4)"},W("g",{},[W("path",{d:"m4 1031.4c-1.1046 0-2 0.9-2 2v16c0 1.1 0.8954 2 2 2h16c1.105 0 2-0.9 2-2v-16c0-1.1-0.895-2-2-2h-16z",fill:"#d35400"}),W("path",{d:"m4 2c-1.1046 0-2 0.8954-2 2v16c0 1.105 0.8954 2 2 2h16c1.105 0 2-0.895 2-2v-16c0-1.1046-0.895-2-2-2h-16z",transform:"translate(0 1028.4)",fill:"#e67e22"}),W("path",{d:"m5 1034.4v2.3c6.443 0 11.667 5.2 11.667 11.7h2.333c0-7.8-6.268-14-14-14zm0 4.6v2.4c3.866 0 7 3.1 7 7h2.333c0-5.2-4.178-9.4-9.333-9.4zm2.0417 5.3c-1.1276 0-2.0417 0.9-2.0417 2s0.9141 2.1 2.0417 2.1c1.1275 0 2.0416-1 2.0416-2.1s-0.9141-2-2.0416-2z",fill:"#d35400"}),W("path",{d:"m5 1033.4v2.3c6.443 0 11.667 5.2 11.667 11.7h2.333c0-7.8-6.268-14-14-14zm0 4.6v2.4c3.866 0 7 3.1 7 7h2.333c0-5.2-4.178-9.4-9.333-9.4zm2.0417 5.3c-1.1276 0-2.0417 0.9-2.0417 2s0.9141 2.1 2.0417 2.1c1.1275 0 2.0416-1 2.0416-2.1s-0.9141-2-2.0416-2z",fill:"#ecf0f1"})]))),_h=()=>W("svg",{fill:"currentColor",width:"24",height:"24",viewBox:"-3 0 19 19",class:"cf-icon-svg"},W("path",{d:"M.926 12.818a1.403 1.403 0 1 1 0 1.984 1.402 1.402 0 0 1 0-1.984zm10.531 2.357a1.03 1.03 0 0 1-1.029-1.03 8.775 8.775 0 0 0-.694-3.438A8.826 8.826 0 0 0 1.591 5.31a1.03 1.03 0 1 1 0-2.059 10.817 10.817 0 0 1 4.24.857 10.893 10.893 0 0 1 3.463 2.334 10.867 10.867 0 0 1 3.19 7.703 1.027 1.027 0 0 1-1.027 1.029zm-4.538 0a1.03 1.03 0 0 1-1.029-1.03 4.297 4.297 0 0 0-4.299-4.298 1.03 1.03 0 0 1 0-2.059 6.362 6.362 0 0 1 5.857 3.883 6.298 6.298 0 0 1 .5 2.475 1.03 1.03 0 0 1-1.029 1.029z"})),Ch=()=>on("WALINE_USER_META",{nick:"",mail:"",link:""}),$h=()=>on("WALINE_COMMENT_BOX_EDITOR",""),Sh="WALINE_LIKE",Rh=on(Sh,[]),Mo=()=>Rh,Ah="WALINE_REACTION",Eh=on(Ah,{}),Po=()=>Eh;var Is={},ut={},ft={},zo;function jo(){if(zo)return ft;zo=1;var e=ft&&ft.__awaiter||function(r,s,i,l){function o(a){return a instanceof i?a:new i(function(c){c(a)})}return new(i||(i=Promise))(function(a,c){function u(m){try{p(l.next(m))}catch(x){c(x)}}function f(m){try{p(l.throw(m))}catch(x){c(x)}}function p(m){m.done?a(m.value):o(m.value).then(u,f)}p((l=l.apply(r,s||[])).next())})},t=ft&&ft.__generator||function(r,s){var i={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},l,o,a,c;return c={next:u(0),throw:u(1),return:u(2)},typeof Symbol=="function"&&(c[Symbol.iterator]=function(){return this}),c;function u(p){return function(m){return f([p,m])}}function f(p){if(l)throw new TypeError("Generator is already executing.");for(;c&&(c=0,p[0]&&(i=0)),i;)try{if(l=1,o&&(a=p[0]&2?o.return:p[0]?o.throw||((a=o.return)&&a.call(o),0):o.next)&&!(a=a.call(o,p[1])).done)return a;switch(o=0,a&&(p=[p[0]&2,a.value]),p[0]){case 0:case 1:a=p;break;case 4:return i.label++,{value:p[1],done:!1};case 5:i.label++,o=p[1],p=[0];continue;case 7:p=i.ops.pop(),i.trys.pop();continue;default:if(a=i.trys,!(a=a.length>0&&a[a.length-1])&&(p[0]===6||p[0]===2)){i=0;continue}if(p[0]===3&&(!a||p[1]>a[0]&&p[1]<a[3])){i.label=p[1];break}if(p[0]===6&&i.label<a[1]){i.label=a[1],a=p;break}if(a&&i.label<a[2]){i.label=a[2],i.ops.push(p);break}a[2]&&i.ops.pop(),i.trys.pop();continue}p=s.call(r,i)}catch(m){p=[6,m],o=0}finally{l=a=0}if(p[0]&5)throw p[1];return{value:p[0]?p[1]:void 0,done:!0}}};Object.defineProperty(ft,"__esModule",{value:!0}),ft.ReCaptchaInstance=void 0;var n=(function(){function r(s,i,l){this.siteKey=s,this.recaptchaID=i,this.recaptcha=l,this.styleContainer=null}return r.prototype.execute=function(s){return e(this,void 0,void 0,function(){var i;return t(this,function(l){switch(l.label){case 0:return this.recaptcha.enterprise?[4,this.recaptcha.enterprise.execute(this.recaptchaID,{action:s})]:[3,2];case 1:return i=l.sent(),[3,4];case 2:return[4,this.recaptcha.execute(this.recaptchaID,{action:s})];case 3:i=l.sent(),l.label=4;case 4:return[2,i]}})})},r.prototype.getSiteKey=function(){return this.siteKey},r.prototype.hideBadge=function(){this.styleContainer===null&&(this.styleContainer=document.createElement("style"),this.styleContainer.innerHTML=".grecaptcha-badge{visibility:hidden !important;}",document.head.appendChild(this.styleContainer))},r.prototype.showBadge=function(){this.styleContainer!==null&&(document.head.removeChild(this.styleContainer),this.styleContainer=null)},r})();return ft.ReCaptchaInstance=n,ft}var Oo;function Th(){if(Oo)return ut;Oo=1;var e=ut&&ut.__assign||function(){return e=Object.assign||function(s){for(var i,l=1,o=arguments.length;l<o;l++){i=arguments[l];for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(s[a]=i[a])}return s},e.apply(this,arguments)};Object.defineProperty(ut,"__esModule",{value:!0}),ut.getInstance=ut.load=void 0;var t=jo(),n;(function(s){s[s.NOT_LOADED=0]="NOT_LOADED",s[s.LOADING=1]="LOADING",s[s.LOADED=2]="LOADED"})(n||(n={}));var r=(function(){function s(){}return s.load=function(i,l){if(l===void 0&&(l={}),typeof document>"u")return Promise.reject(new Error("This is a library for the browser!"));if(s.getLoadingState()===n.LOADED)return s.instance.getSiteKey()===i?Promise.resolve(s.instance):Promise.reject(new Error("reCAPTCHA already loaded with different site key!"));if(s.getLoadingState()===n.LOADING)return i!==s.instanceSiteKey?Promise.reject(new Error("reCAPTCHA already loaded with different site key!")):new Promise(function(a,c){s.successfulLoadingConsumers.push(function(u){return a(u)}),s.errorLoadingRunnable.push(function(u){return c(u)})});s.instanceSiteKey=i,s.setLoadingState(n.LOADING);var o=new s;return new Promise(function(a,c){o.loadScript(i,l.useRecaptchaNet||!1,l.useEnterprise||!1,l.renderParameters?l.renderParameters:{},l.customUrl).then(function(){s.setLoadingState(n.LOADED);var u=o.doExplicitRender(grecaptcha,i,l.explicitRenderParameters?l.explicitRenderParameters:{},l.useEnterprise||!1),f=new t.ReCaptchaInstance(i,u,grecaptcha);s.successfulLoadingConsumers.forEach(function(p){return p(f)}),s.successfulLoadingConsumers=[],l.autoHideBadge&&f.hideBadge(),s.instance=f,a(f)}).catch(function(u){s.errorLoadingRunnable.forEach(function(f){return f(u)}),s.errorLoadingRunnable=[],c(u)})})},s.getInstance=function(){return s.instance},s.setLoadingState=function(i){s.loadingState=i},s.getLoadingState=function(){return s.loadingState===null?n.NOT_LOADED:s.loadingState},s.prototype.loadScript=function(i,l,o,a,c){var u=this;l===void 0&&(l=!1),o===void 0&&(o=!1),a===void 0&&(a={}),c===void 0&&(c="");var f=document.createElement("script");f.setAttribute("recaptcha-v3-script",""),f.setAttribute("async",""),f.setAttribute("defer","");var p="https://www.google.com/recaptcha/api.js";l?o?p="https://recaptcha.net/recaptcha/enterprise.js":p="https://recaptcha.net/recaptcha/api.js":o&&(p="https://www.google.com/recaptcha/enterprise.js"),c&&(p=c),a.render&&(a.render=void 0);var m=this.buildQueryString(a);return f.src=p+"?render=explicit"+m,new Promise(function(x,y){f.addEventListener("load",u.waitForScriptToLoad(function(){x(f)},o),!1),f.onerror=function(A){s.setLoadingState(n.NOT_LOADED),y(A)},document.head.appendChild(f)})},s.prototype.buildQueryString=function(i){var l=Object.keys(i);return l.length<1?"":"&"+Object.keys(i).filter(function(o){return!!i[o]}).map(function(o){return o+"="+i[o]}).join("&")},s.prototype.waitForScriptToLoad=function(i,l){var o=this;return function(){window.grecaptcha===void 0?setTimeout(function(){o.waitForScriptToLoad(i,l)},s.SCRIPT_LOAD_DELAY):l?window.grecaptcha.enterprise.ready(function(){i()}):window.grecaptcha.ready(function(){i()})}},s.prototype.doExplicitRender=function(i,l,o,a){var c=e({sitekey:l},o);return o.container?a?i.enterprise.render(o.container,c):i.render(o.container,c):a?i.enterprise.render(c):i.render(c)},s.loadingState=null,s.instance=null,s.instanceSiteKey=null,s.successfulLoadingConsumers=[],s.errorLoadingRunnable=[],s.SCRIPT_LOAD_DELAY=25,s})();return ut.load=r.load,ut.getInstance=r.getInstance,ut}var Fo;function Lh(){return Fo||(Fo=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.ReCaptchaInstance=e.getInstance=e.load=void 0;var t=Th();Object.defineProperty(e,"load",{enumerable:!0,get:function(){return t.load}}),Object.defineProperty(e,"getInstance",{enumerable:!0,get:function(){return t.getInstance}});var n=jo();Object.defineProperty(e,"ReCaptchaInstance",{enumerable:!0,get:function(){return n.ReCaptchaInstance}})})(Is)),Is}var Ih=Lh();const Do={},Mh=e=>{const t=Do[e]??(Do[e]=Ih.load(e,{useRecaptchaNet:!0,autoHideBadge:!0}));return{execute:n=>t.then(r=>r.execute(n))}},Ph=e=>({execute:async t=>{const{load:n}=rf("https://challenges.cloudflare.com/turnstile/v0/api.js",void 0,{async:!1});await n();const{turnstile:r}=window;return new Promise(s=>{r==null||r.ready(()=>{r.render(".wl-captcha-container",{sitekey:e,action:t,size:"compact",callback:s})})})}}),zh=on("WALINE_USER",{}),Pr=()=>zh,jh={key:0,class:"wl-reaction"},Oh=["textContent"],Fh={class:"wl-reaction-list"},Dh=["onClick"],Uh={class:"wl-reaction-img"},Hh=["src","alt"],Nh=["textContent"],Bh=["textContent"];var Vh=zt({__name:"ArticleReaction",setup(e){const t=Po(),n=ur(Nn),r=K(-1),s=K([]),i=de(()=>n.value.locale),l=de(()=>{const{reaction:f}=n.value;return f!=null&&f.length?f:null}),o=de(()=>{var f;const{path:p}=n.value;return((f=l.value)==null?void 0:f.map((m,x)=>({icon:m,desc:i.value[`reaction${x}`],active:t.value[p]===x})))??null});let a;const c=async()=>{const{serverURL:f,lang:p,path:m}=n.value;if(!l.value)return;const x=new AbortController;a=x.abort.bind(x);const[y]=await Un({serverURL:f,lang:p,paths:[m],type:l.value.map((A,_)=>`reaction${_}`),signal:x.signal});s.value=l.value.map((A,_)=>y[`reaction${_}`])},u=async f=>{if(r.value!==-1)return;const{serverURL:p,lang:m,path:x}=n.value,y=t.value[x];r.value=f,y!=null&&(await Wt({serverURL:p,lang:m,path:x,type:`reaction${y}`,action:"desc"}),s.value[y]=Math.max(s.value[y]-1,0)),y!==f&&(await Wt({serverURL:p,lang:m,path:x,type:`reaction${f}`}),s.value[f]=(s.value[f]||0)+1),y===f?delete t.value[x]:t.value[x]=f,r.value=-1};return tn(()=>{Ot(()=>[n.value.serverURL,n.value.path],()=>c())}),rs(()=>{a==null||a()}),(f,p)=>o.value?(E(),P("div",jh,[I("div",{class:"wl-reaction-title",textContent:Z(i.value.reactionTitle)},null,8,Oh),I("ul",Fh,[(E(!0),P(ie,null,Ae(o.value,({active:m,icon:x,desc:y},A)=>(E(),P("li",{key:A,class:ve(["wl-reaction-item",{active:m}]),onClick:_=>u(A)},[I("div",Uh,[I("img",{src:x,alt:y},null,8,Hh),r.value===A?(E(),Ke(U(Pn),{key:0,class:"wl-reaction-loading"})):(E(),P("div",{key:1,class:"wl-reaction-votes",textContent:Z(s.value[A]||0)},null,8,Nh))]),I("div",{class:"wl-reaction-text",textContent:Z(y)},null,8,Bh)],10,Dh))),128))])])):q("v-if",!0)}}),zn=new Map;function Wh(e){var t=zn.get(e);t&&t.destroy()}function qh(e){var t=zn.get(e);t&&t.update()}var jn=null;typeof window>"u"?((jn=function(e){return e}).destroy=function(e){return e},jn.update=function(e){return e}):((jn=function(e,t){return e&&Array.prototype.forEach.call(e.length?e:[e],function(n){return(function(r){if(r&&r.nodeName&&r.nodeName==="TEXTAREA"&&!zn.has(r)){var s,i=null,l=window.getComputedStyle(r),o=(s=r.value,function(){c({testForHeightReduction:s===""||!r.value.startsWith(s),restoreTextAlign:null}),s=r.value}),a=(function(f){r.removeEventListener("autosize:destroy",a),r.removeEventListener("autosize:update",u),r.removeEventListener("input",o),window.removeEventListener("resize",u),Object.keys(f).forEach(function(p){return r.style[p]=f[p]}),zn.delete(r)}).bind(r,{height:r.style.height,resize:r.style.resize,textAlign:r.style.textAlign,overflowY:r.style.overflowY,overflowX:r.style.overflowX,wordWrap:r.style.wordWrap});r.addEventListener("autosize:destroy",a),r.addEventListener("autosize:update",u),r.addEventListener("input",o),window.addEventListener("resize",u),r.style.overflowX="hidden",r.style.wordWrap="break-word",zn.set(r,{destroy:a,update:u}),u()}function c(f){var p,m,x=f.restoreTextAlign,y=x===void 0?null:x,A=f.testForHeightReduction,_=A===void 0||A,L=l.overflowY;if(r.scrollHeight!==0&&(l.resize==="vertical"?r.style.resize="none":l.resize==="both"&&(r.style.resize="horizontal"),_&&(p=(function(S){for(var O=[];S&&S.parentNode&&S.parentNode instanceof Element;)S.parentNode.scrollTop&&O.push([S.parentNode,S.parentNode.scrollTop]),S=S.parentNode;return function(){return O.forEach(function(pe){var oe=pe[0],D=pe[1];oe.style.scrollBehavior="auto",oe.scrollTop=D,oe.style.scrollBehavior=null})}})(r),r.style.height=""),m=l.boxSizing==="content-box"?r.scrollHeight-(parseFloat(l.paddingTop)+parseFloat(l.paddingBottom)):r.scrollHeight+parseFloat(l.borderTopWidth)+parseFloat(l.borderBottomWidth),l.maxHeight!=="none"&&m>parseFloat(l.maxHeight)?(l.overflowY==="hidden"&&(r.style.overflow="scroll"),m=parseFloat(l.maxHeight)):l.overflowY!=="hidden"&&(r.style.overflow="hidden"),r.style.height=m+"px",y&&(r.style.textAlign=y),p&&p(),i!==m&&(r.dispatchEvent(new Event("autosize:resized",{bubbles:!0})),i=m),L!==l.overflow&&!y)){var z=l.textAlign;l.overflow==="hidden"&&(r.style.textAlign=z==="start"?"end":"start"),c({restoreTextAlign:z,testForHeightReduction:!0})}}function u(){c({testForHeightReduction:!0,restoreTextAlign:null})}})(n)}),e}).destroy=function(e){return e&&Array.prototype.forEach.call(e.length?e:[e],Wh),e},jn.update=function(e){return e&&Array.prototype.forEach.call(e.length?e:[e],qh),e});var Uo=jn;const Kh=["data-index"],Gh=["src","title","onClick"];var Zh=zt({__name:"ImageWall",props:{items:{default:()=>[]},columnWidth:{default:300},gap:{default:0}},emits:["insert"],setup(e){let t=null;const n=yt("wall"),r=K({}),s=K([]),i=()=>{const u=Math.floor((n.value.getBoundingClientRect().width+e.gap)/(e.columnWidth+e.gap));return u>0?u:1},l=u=>Array.from({length:u},()=>[]),o=async u=>{var f;if(u>=e.items.length)return;await en();const p=[...((f=n.value)==null?void 0:f.children)??[]].reduce((m,x)=>x.getBoundingClientRect().height<m.getBoundingClientRect().height?x:m);s.value[Number(p.dataset.index)].push(u),await o(u+1)},a=async(u=!1)=>{if(s.value.length===i()&&!u)return;s.value=l(i());const{scrollY:f}=window;await o(0),window.scrollTo({top:f})},c=u=>{r.value[u.target.src]=!0};return tn(()=>{a(!0),t=new ResizeObserver(()=>{a()}),t.observe(n.value),bt(()=>[e.items],()=>{r.value={},a(!0)}),bt(()=>[e.columnWidth,e.gap],()=>{a()})}),$c(()=>{t.unobserve(n.value)}),(u,f)=>(E(),P("div",{ref_key:"wall",ref:n,class:"wl-gallery",style:At({gap:`${e.gap}px`})},[(E(!0),P(ie,null,Ae(s.value,(p,m)=>(E(),P("div",{key:m,class:"wl-gallery-column","data-index":m,style:At({gap:`${e.gap}px`})},[(E(!0),P(ie,null,Ae(p,x=>(E(),P(ie,{key:x},[r.value[e.items[x].src]?q("v-if",!0):(E(),Ke(U(Pn),{key:0,size:36,style:{margin:"20px auto"}})),I("img",{class:"wl-gallery-item",src:e.items[x].src,title:e.items[x].title,loading:"lazy",onLoad:c,onClick:y=>u.$emit("insert",``)},null,40,Gh)],64))),128))],12,Kh))),128))],4))}});const Yh={key:0,class:"wl-login-info"},Jh={class:"wl-avatar"},Qh=["title"],Xh=["title"],ep=["src"],tp=["title","textContent"],np={class:"wl-panel"},rp=["for","textContent"],sp=["id","onUpdate:modelValue","name","type"],ip=["placeholder"],lp={class:"wl-preview"},op=["innerHTML"],ap={class:"wl-footer"},cp={class:"wl-actions"},up={href:"https://guides.github.com/features/mastering-markdown/",title:"Markdown Guide","aria-label":"Markdown is supported",class:"wl-action",target:"_blank",rel:"noopener noreferrer"},fp=["title"],hp=["title"],pp=["title","aria-label"],dp=["title"],gp={class:"wl-info"},mp={class:"wl-text-number"},vp={key:0},bp=["textContent"],yp=["textContent"],wp=["disabled"],kp=["placeholder"],xp={key:1,class:"wl-loading"},_p=["title","onClick","onMouseenter"],Cp=["src","alt"],$p=["src"],Sp={key:0,class:"wl-tabs"},Rp=["onClick"],Ap=["src","alt","title"],Ep=["title"];var Ho=zt({__name:"CommentBox",props:{edit:{},rootId:{},replyId:{},replyUser:{}},emits:["log","cancelEdit","cancelReply","submit"],setup(e,{emit:t}){const n=e,r=t,s=ur(Nn),i=$h(),l=Ch(),o=Pr(),a=K({}),c=yt("textarea"),u=yt("image-uploader"),f=yt("emoji-button"),p=yt("emoji-popup"),m=yt("gif-button"),x=yt("gif-popup"),y=yt("gif-search"),A=K({tabs:[],map:{}}),_=K(0),L=K(!1),z=K(""),S=K({});let O;const pe=(g,v)=>{clearTimeout(O),z.value=v;const b=g.currentTarget,w=p.value;if(b&&w){const k=b.getBoundingClientRect(),R=w.getBoundingClientRect();S.value={left:`${k.left-R.left+k.width/2}px`,top:`${k.top-R.top}px`,transform:"translate(-50%, -100%)"}}},oe=()=>{O=setTimeout(()=>{z.value=""},50)},D=K(!1),Ce=K(!1),me=K(""),H=K(0),N=yn({loading:!0,list:[]}),re=K(0),F=K(!1),X=K(""),G=K(!1),Ve=K(!1),fe=de(()=>s.value.locale),xt=de(()=>!!o.value.token),Nt=de(()=>s.value.imageUploader!=null),_t=g=>{const v=c.value,b=v.selectionStart,w=v.selectionEnd||0,{scrollTop:k}=v;i.value=v.value.slice(0,b)+g+v.value.slice(w),v.focus(),v.selectionStart=b+g.length,v.selectionEnd=b+g.length,v.scrollTop=k},Qe=({key:g,ctrlKey:v,metaKey:b})=>{G.value||(v||b)&&g==="Enter"&&Vt()},an=async g=>{const v=`![${s.value.locale.uploading} ${g.name}]()`;_t(v),G.value=!0;try{const b=await s.value.imageUploader(g);i.value=i.value.replace(v,`\r
|
|
88
|
-
`)}catch(b){alert(b.message),i.value=i.value.replace(v,"")}finally{G.value=!1}},Ps=g=>{var v;if((v=g.dataTransfer)!=null&&v.items){const b=no(g.dataTransfer.items);b&&Nt.value&&(an(b),g.preventDefault())}},zs=g=>{if(g.clipboardData){const v=no(g.clipboardData.items);v&&Nt.value&&an(v)}},Bt=()=>{const g=u.value;g.files&&Nt.value&&an(g.files[0]).then(()=>{g.value=""})},Vt=async()=>{var g;const{serverURL:v,lang:b,login:w,wordLimit:k,requiredMeta:R,recaptchaV3Key:$,turnstileKey:C}=s.value,M={comment:X.value,nick:l.value.nick,mail:l.value.mail,link:l.value.link,url:s.value.path,ua:await fh()};if(!n.edit)if(o.value.token)M.nick=o.value.display_name,M.mail=o.value.email,M.link=o.value.url;else{if(w==="force")return;if(R.includes("nick")&&!M.nick){a.value.nick.focus(),alert(fe.value.nickError);return}if(R.includes("mail")&&!M.mail||M.mail&&!ya(M.mail)){a.value.mail.focus(),alert(fe.value.mailError);return}M.nick||(M.nick=fe.value.anonymous)}if(!M.comment){c.value.focus();return}if(!F.value){alert(fe.value.wordHint.replace("$0",k[0].toString()).replace("$1",k[1].toString()).replace("$2",H.value.toString()));return}M.comment=Eo(M.comment,A.value.map),n.replyId&&n.rootId&&(M.pid=n.replyId,M.rid=n.rootId,M.at=n.replyUser),G.value=!0;try{$&&(M.recaptchaV3=await Mh($).execute("social")),C&&(M.turnstile=await Ph(C).execute("social"));const T={serverURL:v,lang:b,token:o.value.token,comment:M},j=await(n.edit?cn({objectId:n.edit.objectId,...T}):Us(T));if(G.value=!1,j.errmsg){alert(j.errmsg);return}r("submit",j.data),i.value="",me.value="",await en(),n.replyId&&r("cancelReply"),(g=n.edit)!=null&&g.objectId&&r("cancelEdit")}catch(T){G.value=!1,alert(T.message)}},On=g=>{g.preventDefault();const{lang:v,serverURL:b}=s.value;Bs({serverURL:b,lang:v}).then(w=>{o.value=w,(w.remember?localStorage:sessionStorage).setItem("WALINE_USER",JSON.stringify(w)),r("log")})},jr=()=>{o.value={},localStorage.setItem("WALINE_USER","null"),sessionStorage.setItem("WALINE_USER","null"),r("log")},Ct=g=>{g.preventDefault();const{lang:v,serverURL:b}=s.value,w=800,k=800,R=(window.innerWidth-w)/2,$=(window.innerHeight-k)/2,C=new URLSearchParams({lng:v,token:o.value.token}),M=window.open(`${b}/ui/profile?${C.toString()}`,"_blank",`width=${w},height=${k},left=${R},top=${$},scrollbars=no,resizable=no,status=no,location=no,toolbar=no,menubar=no`);M==null||M.postMessage({type:"TOKEN",data:o.value.token},"*")},Ko=g=>{var v,b,w,k;!((v=f.value)!=null&&v.contains(g.target))&&!((b=p.value)!=null&&b.contains(g.target))&&(L.value=!1),!((w=m.value)!=null&&w.contains(g.target))&&!((k=x.value)!=null&&k.contains(g.target))&&(D.value=!1)},h=async g=>{var v;const{scrollTop:b,clientHeight:w,scrollHeight:k}=g.target,R=(w+b)/k,$=s.value.search,C=((v=y.value)==null?void 0:v.value)??"";R<.9||N.loading||Ve.value||(N.loading=!0,($.more&&N.list.length>0?await $.more(C,N.list.length):await $.search(C)).length>0?N.list=[...N.list,...$.more&&N.list.length>0?await $.more(C,N.list.length):await $.search(C)]:Ve.value=!0,N.loading=!1,setTimeout(()=>{g.target.scrollTop=b},50))},d=Vu(g=>{N.list=[],Ve.value=!1,h(g)},300);return Ft("click",Ko),Ft("message",({data:g})=>{(g==null?void 0:g.type)==="profile"&&(o.value={...o.value,...g.data},[localStorage,sessionStorage].filter(v=>v.getItem("WALINE_USER")).forEach(v=>{v.setItem("WALINE_USER",JSON.stringify(o))}))}),Ot([s,H],([g,v])=>{const{wordLimit:b}=g;b?v<b[0]&&b[0]!==0?([re.value]=b,F.value=!1):v>b[1]?([,re.value]=b,F.value=!1):([,re.value]=b,F.value=!0):(re.value=0,F.value=!0)}),bt(D,async g=>{var v;if(!g)return;const b=s.value.search;y.value&&(y.value.value=""),N.loading=!0,N.list=await(((v=b.default)==null?void 0:v.call(b))??b.search("")),N.loading=!1}),tn(()=>{var g;(g=n.edit)!=null&&g.objectId&&(i.value=n.edit.orig),Ot(()=>i.value,v=>{const{highlighter:b,texRenderer:w}=s.value;X.value=v,me.value=oh(v,{emojiMap:A.value.map,highlighter:b,texRenderer:w}),H.value=uh(v),v?Uo(c.value):Uo.destroy(c.value)}),Ot(()=>s.value.emoji,async v=>{A.value=await uf(v)})}),(g,v)=>{var b,w;return E(),P("div",{key:U(o).token,class:"wl-comment"},[U(s).login!=="disable"&&xt.value&&!((b=e.edit)!=null&&b.objectId)?(E(),P("div",Yh,[I("div",Jh,[I("button",{type:"submit",class:"wl-logout-btn",title:fe.value.logout,onClick:jr},[Q(U(Lo),{size:14})],8,Qh),I("a",{href:"#",class:"wl-login-nick","aria-label":"Profile",title:fe.value.profile,onClick:Ct},[I("img",{src:U(o).avatar,alt:"avatar"},null,8,ep)],8,Xh)]),I("a",{href:"#",class:"wl-login-nick","aria-label":"Profile",title:fe.value.profile,onClick:Ct,textContent:Z(U(o).display_name)},null,8,tp)])):q("v-if",!0),I("div",np,[U(s).login!=="force"&&U(s).meta.length&&!xt.value?(E(),P("div",{key:0,class:ve(["wl-header",`item${U(s).meta.length}`])},[(E(!0),P(ie,null,Ae(U(s).meta,k=>(E(),P("div",{key:k,class:"wl-header-item"},[I("label",{for:`wl-${k}`,textContent:Z(fe.value[k]+(U(s).requiredMeta.includes(k)||!U(s).requiredMeta.length?"":`(${fe.value.optional})`))},null,8,rp),cr(I("input",{id:`wl-${k}`,ref_for:!0,ref:R=>{R&&(a.value[k]=R)},"onUpdate:modelValue":R=>U(l)[k]=R,class:ve(["wl-input",`wl-${k}`]),name:k,type:k==="mail"?"email":"text"},null,10,sp),[[Mu,U(l)[k]]])]))),128))],2)):q("v-if",!0),cr(I("textarea",{id:"wl-edit",ref:"textarea","onUpdate:modelValue":v[0]||(v[0]=k=>be(i)?i.value=k:null),class:"wl-editor",placeholder:e.replyUser?`@${e.replyUser}`:fe.value.placeholder,onKeydown:Qe,onDrop:Ps,onPaste:zs},null,40,ip),[[bs,U(i)]]),cr(I("div",lp,[v[7]||(v[7]=I("hr",null,null,-1)),I("h4",null,Z(fe.value.preview)+":",1),I("div",{class:"wl-content",innerHTML:me.value},null,8,op)],512),[[Ll,Ce.value]]),I("div",ap,[I("div",cp,[I("a",up,[Q(U(vh))]),cr(I("button",{ref:"emoji-button",type:"button",class:ve(["wl-action",{active:L.value}]),title:fe.value.emoji,onClick:v[1]||(v[1]=k=>L.value=!L.value)},[Q(U(ph))],10,fp),[[Ll,A.value.tabs.length]]),U(s).search?(E(),P("button",{key:0,ref:"gif-button",type:"button",class:ve(["wl-action",{active:D.value}]),title:fe.value.gif,onClick:v[2]||(v[2]=k=>D.value=!D.value)},[Q(U(xh))],10,hp)):q("v-if",!0),I("input",{id:"wl-image-upload",ref:"image-uploader",class:"upload","aria-hidden":"true",type:"file",accept:".png,.jpg,.jpeg,.webp,.bmp,.gif",onChange:Bt},null,544),Nt.value?(E(),P("label",{key:1,for:"wl-image-upload",class:"wl-action",title:fe.value.uploadImage,"aria-label":fe.value.uploadImage},[Q(U(dh))],8,pp)):q("v-if",!0),I("button",{type:"button",class:ve(["wl-action",{active:Ce.value}]),title:fe.value.preview,onClick:v[3]||(v[3]=k=>Ce.value=!Ce.value)},[Q(U(mh))],10,dp)]),I("div",gp,[v[9]||(v[9]=I("div",{class:"wl-captcha-container"},null,-1)),I("div",mp,[it(Z(H.value)+" ",1),U(s).wordLimit?(E(),P("span",vp,[v[8]||(v[8]=it(" / ",-1)),I("span",{class:ve({illegal:!F.value}),textContent:Z(re.value)},null,10,bp)])):q("v-if",!0),it(" "+Z(fe.value.word),1)]),U(s).login!=="disable"&&!xt.value?(E(),P("button",{key:0,type:"button",class:"wl-btn",onClick:On,textContent:Z(fe.value.login)},null,8,yp)):q("v-if",!0),U(s).login!=="force"||xt.value?(E(),P("button",{key:1,type:"submit",class:"primary wl-btn",title:"Cmd|Ctrl + Enter",disabled:G.value,onClick:Vt},[G.value?(E(),Ke(U(Pn),{key:0,size:16})):(E(),P(ie,{key:1},[it(Z(fe.value.submit),1)],64))],8,wp)):q("v-if",!0)]),I("div",{ref:"gif-popup",class:ve(["wl-gif-popup",{display:D.value}])},[I("input",{ref:"gif-search",type:"text",placeholder:fe.value.gifSearchPlaceholder,onInput:v[4]||(v[4]=(...k)=>U(d)&&U(d)(...k))},null,40,kp),N.list.length?(E(),Ke(Zh,{key:0,items:N.list,"column-width":200,gap:6,onInsert:v[5]||(v[5]=k=>_t(k)),onScroll:h},null,8,["items"])):q("v-if",!0),N.loading?(E(),P("div",xp,[Q(U(Pn),{size:30})])):q("v-if",!0)],2),I("div",{ref:"emoji-popup",class:ve(["wl-emoji-popup",{display:L.value}])},[(E(!0),P(ie,null,Ae(A.value.tabs,(k,R)=>(E(),P(ie,{key:k.name},[R===_.value?(E(),P("div",{key:0,class:"wl-tab-wrapper",onScroll:oe},[(E(!0),P(ie,null,Ae(k.items,$=>(E(),P("button",{key:$,type:"button",title:$,onClick:C=>_t(`:${$}:`),onMouseenter:C=>pe(C,$),onMouseleave:oe},[L.value?(E(),P("img",{key:0,class:"wl-emoji",src:A.value.map[$],alt:$,loading:"lazy",referrerPolicy:"no-referrer"},null,8,Cp)):q("v-if",!0)],40,_p))),128))],32)):q("v-if",!0)],64))),128)),I("div",null,[z.value?(E(),P("img",{key:0,class:"wl-emoji-preview",src:A.value.map[z.value],alt:"preview",loading:"lazy",referrerPolicy:"no-referrer",style:At(S.value)},null,12,$p)):q("v-if",!0)]),A.value.tabs.length>1?(E(),P("div",Sp,[(E(!0),P(ie,null,Ae(A.value.tabs,(k,R)=>(E(),P("button",{key:k.name,type:"button",class:ve(["wl-tab",{active:_.value===R}]),onClick:$=>_.value=R},[I("img",{class:"wl-emoji",src:k.icon,alt:k.name,title:k.name,loading:"lazy",referrerPolicy:"no-referrer"},null,8,Ap)],10,Rp))),128))])):q("v-if",!0)],2)])]),e.replyId||(w=e.edit)!=null&&w.objectId?(E(),P("button",{key:1,type:"button",class:"wl-close",title:fe.value.cancelReply,onClick:v[6]||(v[6]=k=>e.replyId?r("cancelReply"):r("cancelEdit"))},[Q(U(Lo),{size:24})],8,Ep)):q("v-if",!0)])}}});const Tp=["id"],Lp={class:"wl-user","aria-hidden":"true"},Ip=["src"],Mp={class:"wl-card"},Pp={class:"wl-head"},zp=["href"],jp={key:1,class:"wl-nick"},Op=["textContent"],Fp=["textContent"],Dp=["textContent"],Up=["textContent"],Hp={class:"wl-comment-actions"},Np=["title","href"],Bp=["title"],Vp=["title"],Wp={class:"wl-meta","aria-hidden":"true"},qp=["data-value","textContent"],Kp={key:0,class:"wl-warning","aria-hidden":"true"},Gp={key:1,class:"wl-content"},Zp={key:0},Yp=["href"],Jp=["innerHTML"],Qp={key:2,class:"wl-admin-actions"},Xp={class:"wl-comment-status"},ed=["disabled","onClick","textContent"],td={key:4,class:"wl-quote"};var nd=zt({__name:"CommentCard",props:{comment:{},edit:{},rootId:{},reply:{}},emits:["log","submit","delete","like","sticky","edit","reply","status"],setup(e,{emit:t}){const n=t,r=["approved","waiting","spam"],s=ur(Nn),i=Mo(),l=nf(),o=Pr(),a=de(()=>s.value.locale),c=de(()=>{const{link:A}=e.comment;return A?hi(A)?A:`https://${A}`:""}),u=de(()=>i.value.includes(e.comment.objectId)),f=de(()=>va(new Date(e.comment.time),l.value,a.value)),p=de(()=>o.value.type==="administrator"),m=de(()=>e.comment.user_id&&o.value.objectId===e.comment.user_id),x=de(()=>{var A;return e.comment.objectId===((A=e.reply)==null?void 0:A.objectId)}),y=de(()=>{var A;return e.comment.objectId===((A=e.edit)==null?void 0:A.objectId)});return(A,_)=>{var L;const z=tl("CommentCard",!0);return E(),P("div",{id:e.comment.objectId.toString(),class:"wl-card-item"},[I("div",Lp,[e.comment.avatar?(E(),P("img",{key:0,class:"wl-user-avatar",src:e.comment.avatar,alt:""},null,8,Ip)):q("v-if",!0),e.comment.type==="guest"?(E(),Ke(U(wh),{key:1})):q("v-if",!0),e.comment.type==="administrator"?(E(),Ke(U(kh),{key:2})):q("v-if",!0)]),I("div",Mp,[I("div",Pp,[c.value?(E(),P("a",{key:0,class:"wl-nick",href:c.value,target:"_blank",rel:"nofollow noopener noreferrer"},Z(e.comment.nick),9,zp)):(E(),P("span",jp,Z(e.comment.nick),1)),e.comment.label?(E(),P("span",{key:2,class:"wl-badge",textContent:Z(e.comment.label)},null,8,Op)):q("v-if",!0),e.comment.sticky?(E(),P("span",{key:3,class:"wl-badge",textContent:Z(a.value.sticky)},null,8,Fp)):q("v-if",!0),typeof e.comment.level=="number"?(E(),P("span",{key:4,class:ve(`wl-badge level${e.comment.level}`),textContent:Z(a.value[`level${e.comment.level}`]||`Level ${e.comment.level}`)},null,10,Dp)):q("v-if",!0),I("span",{class:"wl-time",textContent:Z(f.value)},null,8,Up),I("div",Hp,[p.value||m.value?(E(),P(ie,{key:0},[I("button",{type:"button",class:"wl-edit",onClick:_[0]||(_[0]=S=>n("edit",e.comment))},[Q(U(yh))]),I("button",{type:"button",class:"wl-delete",onClick:_[1]||(_[1]=S=>n("delete",e.comment))},[Q(U(hh))])],64)):q("v-if",!0),m.value?(E(),P("a",{key:1,role:"button",class:"wl-rss",title:a.value.subscribeToReplies,href:`${U(s).serverURL}/api/comment/rss?user_id=${e.comment.user_id}`,target:"_blank",rel:"noopener noreferrer"},[Q(U(_h))],8,Np)):q("v-if",!0),I("button",{type:"button",class:"wl-like",title:u.value?a.value.cancelLike:a.value.like,onClick:_[2]||(_[2]=S=>n("like",e.comment))},[Q(U(gh),{active:u.value},null,8,["active"]),it(" "+Z("like"in e.comment?e.comment.like:""),1)],8,Bp),I("button",{type:"button",class:ve(["wl-reply",{active:x.value}]),title:x.value?a.value.cancelReply:a.value.reply,onClick:_[3]||(_[3]=S=>n("reply",x.value?null:e.comment))},[Q(U(bh))],10,Vp)])]),I("div",Wp,[(E(),P(ie,null,Ae(["addr","browser","os"],S=>(E(),P(ie,null,[e.comment[S]?(E(),P("span",{key:S,class:ve(`wl-${S}`),"data-value":e.comment[S],textContent:Z(e.comment[S])},null,10,qp)):q("v-if",!0)],64))),64))]),e.comment.status==="waiting"&&!p.value?(E(),P("div",Kp,Z(a.value.commentUnderReview),1)):q("v-if",!0),y.value?q("v-if",!0):(E(),P("div",Gp,["reply_user"in e.comment&&e.comment.reply_user?(E(),P("p",Zp,[I("a",{href:"#"+e.comment.pid},"@"+Z(e.comment.reply_user.nick),9,Yp),_[17]||(_[17]=I("span",null,": ",-1))])):q("v-if",!0),I("div",{innerHTML:e.comment.comment},null,8,Jp)])),p.value&&!y.value?(E(),P("div",Qp,[I("span",Xp,[(E(),P(ie,null,Ae(r,S=>I("button",{key:S,type:"submit",class:ve(`wl-btn wl-${S}`),disabled:e.comment.status===S,onClick:O=>n("status",{status:S,comment:e.comment}),textContent:Z(a.value[S])},null,10,ed)),64))]),p.value&&!("rid"in e.comment)?(E(),P("button",{key:0,type:"submit",class:"wl-btn wl-sticky",onClick:_[4]||(_[4]=S=>n("sticky",e.comment))},Z(e.comment.sticky?a.value.unsticky:a.value.sticky),1)):q("v-if",!0)])):q("v-if",!0),x.value||y.value?(E(),P("div",{key:3,class:ve({"wl-reply-wrapper":x.value,"wl-edit-wrapper":y.value})},[Q(Ho,{edit:e.edit,"reply-id":(L=e.reply)==null?void 0:L.objectId,"reply-user":e.comment.nick,"root-id":e.rootId,onLog:_[5]||(_[5]=S=>n("log")),onCancelReply:_[6]||(_[6]=S=>n("reply",null)),onCancelEdit:_[7]||(_[7]=S=>n("edit",null)),onSubmit:_[8]||(_[8]=S=>n("submit",S))},null,8,["edit","reply-id","reply-user","root-id"])],2)):q("v-if",!0),"children"in e.comment?(E(),P("div",td,[(E(!0),P(ie,null,Ae(e.comment.children,S=>(E(),Ke(z,{key:S.objectId,comment:S,reply:e.reply,edit:e.edit,"root-id":e.rootId,onLog:_[9]||(_[9]=O=>n("log")),onDelete:_[10]||(_[10]=O=>n("delete",O)),onEdit:_[11]||(_[11]=O=>n("edit",O)),onLike:_[12]||(_[12]=O=>n("like",O)),onReply:_[13]||(_[13]=O=>n("reply",O)),onStatus:_[14]||(_[14]=O=>n("status",O)),onSticky:_[15]||(_[15]=O=>n("sticky",O)),onSubmit:_[16]||(_[16]=O=>n("submit",O))},null,8,["comment","reply","edit","root-id"]))),128))])):q("v-if",!0)])],8,Tp)}}});const No="3.12.0",rd={"data-waline":""},sd={class:"wl-meta-head"},id={class:"wl-count"},ld=["textContent"],od={class:"wl-sort"},ad=["onClick"],cd={class:"wl-cards"},ud={key:1,class:"wl-operation"},fd=["textContent"],hd={key:2,class:"wl-loading"},pd=["textContent"],dd={key:4,class:"wl-operation"},gd=["textContent"],md={key:5,class:"wl-meta-foot"},vd={class:"wl-rss"},bd=["href"],yd=["textContent"],wd=["href"],kd=["textContent"],xd={key:0,class:"wl-power"};var _d=zt({__name:"WalineComment",props:{serverURL:{},path:{},meta:{},requiredMeta:{},wordLimit:{},pageSize:{},lang:{},locale:{},commentSorting:{},dark:{type:[String,Boolean]},login:{},noCopyright:{type:Boolean},recaptchaV3Key:{},turnstileKey:{},reaction:{type:[Array,Boolean]},emoji:{},search:{},highlighter:{type:Function},imageUploader:{type:Function},texRenderer:{type:Function}},setup(e){const t=e,n=Pr(),r=Mo(),s=K("loading"),i=K(0),l=K(1),o=K(0),a=de(()=>da(t)),c=K(a.value.commentSorting),u=K([]),f=K(null),p=K(null),m=de(()=>ga(a.value.dark)),x=de(()=>a.value.locale);lf(m,{id:"waline-darkmode"});let y=null;const A=H=>{const{serverURL:N,path:re,pageSize:F}=a.value,X=new AbortController;s.value="loading",y==null||y(),Ds({serverURL:N,lang:a.value.lang,path:re,pageSize:F,sortBy:ci[c.value],page:H,signal:X.signal,token:n.value.token}).then(G=>{s.value="success",i.value=G.count,u.value.push(...G.data),l.value=H,o.value=G.totalPages}).catch(G=>{G.name!=="AbortError"&&(console.error(G.message),s.value="error")}),y=X.abort.bind(X)},_=()=>{A(l.value+1)},L=()=>{i.value=0,u.value=[],A(1)},z=H=>{c.value!==H&&(c.value=H,L())},S=H=>{f.value=H},O=H=>{p.value=H},pe=H=>{if(p.value)p.value.comment=H.comment,p.value.orig=H.orig;else if("rid"in H){const N=u.value.find(({objectId:re})=>re===H.rid);if(!N)return;Array.isArray(N.children)||(N.children=[]),N.children.push(H)}else u.value.unshift(H),i.value+=1},oe=async({comment:H,status:N})=>{if(H.status===N)return;const{serverURL:re,lang:F}=a.value;await cn({serverURL:re,lang:F,token:n.value.token,objectId:H.objectId,comment:{status:N}}),H.status=N},D=async H=>{if("rid"in H)return;const{serverURL:N,lang:re}=a.value;await cn({serverURL:N,lang:re,token:n.value.token,objectId:H.objectId,comment:{sticky:H.sticky?0:1}}),H.sticky=!H.sticky},Ce=async({objectId:H})=>{if(!confirm("Are you sure you want to delete this comment?"))return;const{serverURL:N,lang:re}=a.value;await Hs({serverURL:N,lang:re,token:n.value.token,objectId:H}),u.value.some((F,X)=>F.objectId===H?(u.value=u.value.filter((G,Ve)=>Ve!==X),!0):F.children.some((G,Ve)=>G.objectId===H?(u.value[X].children=F.children.filter((fe,xt)=>xt!==Ve),!0):!1))},me=async H=>{const{serverURL:N,lang:re}=a.value,{objectId:F}=H,X=r.value.includes(F);await cn({serverURL:N,lang:re,objectId:F,token:n.value.token,comment:{like:!X}}),X?r.value=r.value.filter(G=>G!==F):(r.value=[...r.value,F],r.value.length>50&&(r.value=r.value.slice(-50))),H.like=Math.max(0,(H.like||0)+(X?-1:1))};return mc(Nn,a),tn(()=>{Ot(()=>[t.serverURL,t.path],()=>{L()})}),rs(()=>{y==null||y()}),(H,N)=>(E(),P("div",rd,[Q(Vh),!f.value&&!p.value?(E(),Ke(Ho,{key:0,onLog:L,onSubmit:pe})):q("v-if",!0),I("div",sd,[I("div",id,[i.value?(E(),P("span",{key:0,class:"wl-num",textContent:Z(i.value)},null,8,ld)):q("v-if",!0),it(" "+Z(x.value.comment),1)]),I("ul",od,[(E(!0),P(ie,null,Ae(U(ha),re=>(E(),P("li",{key:re,class:ve([re===c.value?"active":""]),onClick:F=>z(re)},Z(x.value[re]),11,ad))),128))])]),I("div",cd,[(E(!0),P(ie,null,Ae(u.value,re=>(E(),Ke(nd,{key:re.objectId,"root-id":re.objectId,comment:re,reply:f.value,edit:p.value,onLog:L,onReply:S,onEdit:O,onSubmit:pe,onStatus:oe,onDelete:Ce,onSticky:D,onLike:me},null,8,["root-id","comment","reply","edit"]))),128))]),s.value==="error"?(E(),P("div",ud,[I("button",{type:"button",class:"wl-btn",onClick:L,textContent:Z(x.value.refresh)},null,8,fd)])):s.value==="loading"?(E(),P("div",hd,[Q(U(Pn),{size:30})])):u.value.length?l.value<o.value?(E(),P("div",dd,[I("button",{type:"button",class:"wl-btn",onClick:_,textContent:Z(x.value.more)},null,8,gd)])):q("v-if",!0):(E(),P("div",{key:3,class:"wl-empty",textContent:Z(x.value.sofa)},null,8,pd)),u.value.length||s.value!=="loading"?(E(),P("div",md,[I("div",vd,[I("a",{href:`${a.value.serverURL}/api/comment/rss?path=${encodeURIComponent(a.value.path)}`,target:"_blank",rel:"noopener noreferrer"},[Q(U(Io)),I("span",{textContent:Z(x.value.subPostComment)},null,8,yd)],8,bd),I("a",{href:`${a.value.serverURL}/api/comment/rss`,target:"_blank",rel:"noopener noreferrer"},[Q(U(Io)),I("span",{textContent:Z(x.value.subSiteComment)},null,8,kd)],8,wd)]),a.value.noCopyright?q("v-if",!0):(E(),P("div",xd,[N[0]||(N[0]=it(" Powered by ",-1)),N[1]||(N[1]=I("a",{href:"https://github.com/walinejs/waline",target:"_blank",rel:"noopener noreferrer"}," Waline ",-1)),it(" v"+Z(U(No)),1)]))])):q("v-if",!0)]))}});const Bo=(e,t)=>{t.forEach((n,r)=>{const s=e[r].time;typeof s=="number"&&(n.textContent=s.toString())})},Vo=({serverURL:e,path:t=window.location.pathname,selector:n=".waline-pageview-count",update:r=!0,lang:s=navigator.language})=>{const i=new AbortController,l=[...document.querySelectorAll(n)],o=c=>{const u=Ls(c);return u!=null&&t!==u},a=c=>Vs({serverURL:Bn(e),paths:c.map(u=>Ls(u)??t),lang:s,signal:i.signal}).then(u=>{Bo(u,c)}).catch(to);if(r){const c=l.filter(f=>!o(f)),u=l.filter(f=>o(f));Ws({serverURL:Bn(e),path:t,lang:s}).then(f=>{Bo(f,c)}),u.length>0&&a(u)}else a(l);return i.abort.bind(i)},Cd=({el:e="#waline",path:t=window.location.pathname,comment:n=!1,pageview:r=!1,...s})=>{const i=e?Rr(e):null;if(e&&!i)throw new Error("Option 'el' do not match any domElement!");if(!s.serverURL)throw new Error("Option 'serverURL' is missing!");const l=yn({...s}),o=yn({comment:n,pageview:r,path:t}),a=()=>{o.comment&&To({serverURL:l.serverURL,path:o.path,...qt(o.comment)?{selector:o.comment}:{}})},c=()=>{o.pageview&&Vo({serverURL:l.serverURL,path:o.path,...qt(o.pageview)?{selector:o.pageview}:{}})};let u=null;i&&(u=ql(()=>W(_d,{path:o.path,...l})),u.mount(i));const f=Ji(a),p=Ji(c);return{el:i,update:({comment:m,pageview:x,path:y=window.location.pathname,...A}={})=>{Object.entries(A).forEach(([_,L])=>{l[_]=L}),o.path=y,m!=null&&(o.comment=m),x!=null&&(o.pageview=x)},destroy:()=>{u==null||u.unmount(),f(),p()}}},$d=({el:e,serverURL:t,count:n,lang:r=navigator.language})=>{const s=Pr(),i=Rr(e),l=new AbortController;return qs({serverURL:t,count:n,lang:r,signal:l.signal,token:s.value.token}).then(o=>i&&o.length>0?(i.innerHTML=`<ul class="wl-recent-list">${o.map(a=>`<li class="wl-recent-item"><a href="${a.url}">${a.nick}</a>:${a.comment}</li>`).join("")}</ul>`,{comments:o,destroy:()=>{l.abort(),i.innerHTML=""}}):{comments:o,destroy:()=>{l.abort()}})},Sd=({el:e,serverURL:t,count:n,locale:r,lang:s=navigator.language,mode:i="list"})=>{const l=Rr(e),o=new AbortController;return Ks({serverURL:t,pageSize:n,lang:s,signal:o.signal}).then(a=>{if(!l||a.length===0)return{users:a,destroy:()=>{o.abort()}};const c={...oi(s),...typeof r=="object"?r:{}};return l.innerHTML=`<ul class="wl-user-${i}">${a.map((u,f)=>[`<li class="wl-user-item" aria-label="${u.nick}">`,u.link?`<a href="${u.link}" target="_blank">`:"",'<div class="wl-user-avatar">',`<img src="${u.avatar}" alt="${u.nick}">`,`<span class="wl-user-badge">${f+1}</span>`,"</div>",'<div class="wl-user-meta">','<div class="wl-user-name">',u.nick,typeof u.level=="number"?`<span class="wl-badge">${c[`level${u.level}`]??`Level ${u.level}`}</span>`:"",u.label?`<span class="wl-badge">${u.label}</span>`:"","</div>",u.link,"</div>",u.link?"</a>":"","</li>"].filter(Boolean).join("")).join("")}</ul>`,{users:a,destroy:()=>{o.abort(),l.innerHTML=""}}})},Rd=async({serverURL:e,lang:t,path:n})=>{const r=[1,2,3,4,5],s=new AbortController,i=s.abort.bind(s),[l]=await Un({serverURL:e,lang:t,paths:[n],type:Array.from({length:5},(o,a)=>`reaction${a}`),signal:s.signal});return{value:r.map((o,a)=>l[`reaction${a}`]),abort:i}},Ms=e=>{if(Number.isNaN(e))return 0;const t=Math.round(e);return Math.min(5,Math.max(0,t))},Wo=(e=[])=>Array.from({length:5},(t,n)=>{const r=e[n]??0;return typeof r=="number"&&r>0?r:0});var Ad=zt({name:"WalineStarDisplay",props:{score:{type:Number,default:0}},setup(e){const t=de(()=>Ms(e.score));return{displayScore:t,displayClass:n=>t.value>=n?"wl-star-solid":"wl-star-outline"}}}),qo=(e,t)=>{const n=e.__vccOpts||e;for(const[r,s]of t)n[r]=s;return n};const Ed={class:"wl-star-icon",viewBox:"0 0 24 24"};function Td(e,t,n,r,s,i){return E(),P(ie,null,Ae([1,2,3,4,5],l=>I("span",{key:l,class:"wl-star-item"},[(E(),P("svg",Ed,[I("path",{class:ve(e.displayClass(l)),d:"M12 2l3.09 6.26L22 9.27l-5 4.87L18.18 22 12 18.56 5.82 22 7 14.14l-5-4.87 6.91-1.01L12 2z"},null,2)]))])),64)}var Ld=qo(Ad,[["render",Td]]),Id=zt({name:"WalineStarWidget",components:{StarDisplay:Ld},props:{path:{type:String,default:""},serverURL:{type:String,default:""},lang:{type:String,default:""}},emits:["rate"],setup(e,{emit:t}){const n=K(null),r=Po(),s=K(Ms((r.value[e.path]??0)+1)),i=K(null),l=K(Wo([])),o=K(!1);tn(()=>{Ot(()=>[e.serverURL,e.path],async()=>{try{const _=await Rd({serverURL:e.serverURL,path:e.path,lang:e.lang});l.value=Wo(_.value)}catch(_){console.error("Failed to fetch reaction data:",_)}})});const a=de(()=>i.value??s.value),c=de(()=>l.value.reduce((_,L)=>_+L,0)),u=de(()=>l.value.map(_=>c.value?_/c.value:0)),f=_=>{if(!n.value)return 0;const{firstElementChild:L,lastElementChild:z}=n.value;if(!L||!z)return 0;const{left:S}=L.getBoundingClientRect(),{right:O}=z.getBoundingClientRect(),pe=O-S,oe=(_.clientX-S)/pe,D=Math.min(1,Math.max(0,oe))*5;return Ms(D)},p=_=>{i.value=f(_)},m=()=>{i.value=null},x=async _=>{const L=i.value??f(_);if(L===s.value||o.value)return;o.value=!0;const z=s.value,S={serverURL:e.serverURL,lang:e.lang,path:e.path};try{z&&(await Wt({...S,type:`reaction${z-1}`,action:"desc"}),l.value[z-1]=Math.max(0,(l.value[z-1]??0)-1)),s.value=L;const O=L-1;r.value[e.path]=O,await Wt({serverURL:e.serverURL,lang:e.lang,path:e.path,type:`reaction${O}`,action:"inc"}),l.value[O]=(l.value[O]??0)+1,t("rate",L)}catch(O){s.value=z,z?r.value[e.path]=z-1:delete r.value[e.path],console.error("[Waline] Failed to update reaction counter",O)}finally{o.value=!1}};function y(_){return l.value[_-1]??0}function A(_){return`${((u.value[_-1]??0)*100).toFixed(1)}%`}return{ratingArea:n,displayScore:a,onMouseMove:p,onMouseLeave:m,onClick:x,countFor:y,percentText:A}}});const Md={class:"wl-star"},Pd={class:"wl-star-score"},zd={class:"wl-star-rate"},jd={class:"wl-star-progress"},Od=["data-count"],Fd={class:"wl-star-percent"};function Dd(e,t,n,r,s,i){const l=tl("StarDisplay");return E(),P("div",Md,[I("div",{ref:"ratingArea",class:"wl-star-rate",onMousemove:t[0]||(t[0]=(...o)=>e.onMouseMove&&e.onMouseMove(...o)),onMouseleave:t[1]||(t[1]=(...o)=>e.onMouseLeave&&e.onMouseLeave(...o)),onClick:t[2]||(t[2]=(...o)=>e.onClick&&e.onClick(...o))},[Q(l,{score:e.displayScore},null,8,["score"])],544),I("div",Pd,[(E(),P(ie,null,Ae([5,4,3,2,1],o=>I("div",{key:o,class:"wl-star-row"},[I("div",zd,[Q(l,{score:o},null,8,["score"])]),I("div",jd,[I("div",{class:"wl-star-progress-bar",style:At({width:e.percentText(o)}),"data-count":e.countFor(o).toString()},null,12,Od)]),I("span",Fd,Z(e.percentText(o)),1)])),64))])])}var Ud=qo(Id,[["render",Dd]]);const Hd=({el:e,path:t,lang:n=navigator.language,serverURL:r,onRate:s})=>{const i=Rr(e);if(!i)return{destroy:()=>{}};const l=ql(Ud,{path:t,lang:n,serverURL:r,onRate:s});return l.mount(i),{destroy:()=>{l.unmount(),i.innerHTML=""}}};te.RecentComments=$d,te.Star=Hd,te.UserList=Sd,te.addComment=Us,te.commentCount=To,te.defaultLocales=Hn,te.deleteComment=Hs,te.fetchCommentCount=Ns,te.getArticleCounter=Un,te.getComment=Ds,te.getPageview=Vs,te.getRecentComment=qs,te.getUserList=Ks,te.init=Cd,te.login=Bs,te.pageviewCount=Vo,te.updateArticleCounter=Wt,te.updateComment=cn,te.updatePageview=Ws,te.version=No}));
|
|
88
|
+
`)}catch(b){alert(b.message),i.value=i.value.replace(v,"")}finally{G.value=!1}},Ps=g=>{var v;if((v=g.dataTransfer)!=null&&v.items){const b=no(g.dataTransfer.items);b&&Nt.value&&(an(b),g.preventDefault())}},zs=g=>{if(g.clipboardData){const v=no(g.clipboardData.items);v&&Nt.value&&an(v)}},Bt=()=>{const g=u.value;g.files&&Nt.value&&an(g.files[0]).then(()=>{g.value=""})},Vt=async()=>{var g;const{serverURL:v,lang:b,login:w,wordLimit:k,requiredMeta:R,recaptchaV3Key:$,turnstileKey:C}=s.value,M={comment:X.value,nick:l.value.nick,mail:l.value.mail,link:l.value.link,url:s.value.path,ua:await fh()};if(!n.edit)if(o.value.token)M.nick=o.value.display_name,M.mail=o.value.email,M.link=o.value.url;else{if(w==="force")return;if(R.includes("nick")&&!M.nick){a.value.nick.focus(),alert(fe.value.nickError);return}if(R.includes("mail")&&!M.mail||M.mail&&!ya(M.mail)){a.value.mail.focus(),alert(fe.value.mailError);return}M.nick||(M.nick=fe.value.anonymous)}if(!M.comment){c.value.focus();return}if(!F.value){alert(fe.value.wordHint.replace("$0",k[0].toString()).replace("$1",k[1].toString()).replace("$2",H.value.toString()));return}M.comment=Eo(M.comment,A.value.map),n.replyId&&n.rootId&&(M.pid=n.replyId,M.rid=n.rootId,M.at=n.replyUser),G.value=!0;try{$&&(M.recaptchaV3=await Mh($).execute("social")),C&&(M.turnstile=await Ph(C).execute("social"));const T={serverURL:v,lang:b,token:o.value.token,comment:M},j=await(n.edit?cn({objectId:n.edit.objectId,...T}):Us(T));if(G.value=!1,j.errmsg){alert(j.errmsg);return}r("submit",j.data),i.value="",me.value="",await en(),n.replyId&&r("cancelReply"),(g=n.edit)!=null&&g.objectId&&r("cancelEdit")}catch(T){G.value=!1,alert(T.message)}},On=g=>{g.preventDefault();const{lang:v,serverURL:b}=s.value;Bs({serverURL:b,lang:v}).then(w=>{o.value=w,(w.remember?localStorage:sessionStorage).setItem("WALINE_USER",JSON.stringify(w)),r("log")})},jr=()=>{o.value={},localStorage.setItem("WALINE_USER","null"),sessionStorage.setItem("WALINE_USER","null"),r("log")},Ct=g=>{g.preventDefault();const{lang:v,serverURL:b}=s.value,w=800,k=800,R=(window.innerWidth-w)/2,$=(window.innerHeight-k)/2,C=new URLSearchParams({lng:v,token:o.value.token}),M=window.open(`${b}/ui/profile?${C.toString()}`,"_blank",`width=${w},height=${k},left=${R},top=${$},scrollbars=no,resizable=no,status=no,location=no,toolbar=no,menubar=no`);M==null||M.postMessage({type:"TOKEN",data:o.value.token},"*")},Ko=g=>{var v,b,w,k;!((v=f.value)!=null&&v.contains(g.target))&&!((b=p.value)!=null&&b.contains(g.target))&&(L.value=!1),!((w=m.value)!=null&&w.contains(g.target))&&!((k=x.value)!=null&&k.contains(g.target))&&(D.value=!1)},h=async g=>{var v;const{scrollTop:b,clientHeight:w,scrollHeight:k}=g.target,R=(w+b)/k,$=s.value.search,C=((v=y.value)==null?void 0:v.value)??"";R<.9||N.loading||Ve.value||(N.loading=!0,($.more&&N.list.length>0?await $.more(C,N.list.length):await $.search(C)).length>0?N.list=[...N.list,...$.more&&N.list.length>0?await $.more(C,N.list.length):await $.search(C)]:Ve.value=!0,N.loading=!1,setTimeout(()=>{g.target.scrollTop=b},50))},d=Vu(g=>{N.list=[],Ve.value=!1,h(g)},300);return Ft("click",Ko),Ft("message",({data:g})=>{(g==null?void 0:g.type)==="profile"&&(o.value={...o.value,...g.data},[localStorage,sessionStorage].filter(v=>v.getItem("WALINE_USER")).forEach(v=>{v.setItem("WALINE_USER",JSON.stringify(o))}))}),Ot([s,H],([g,v])=>{const{wordLimit:b}=g;b?v<b[0]&&b[0]!==0?([re.value]=b,F.value=!1):v>b[1]?([,re.value]=b,F.value=!1):([,re.value]=b,F.value=!0):(re.value=0,F.value=!0)}),bt(D,async g=>{var v;if(!g)return;const b=s.value.search;y.value&&(y.value.value=""),N.loading=!0,N.list=await(((v=b.default)==null?void 0:v.call(b))??b.search("")),N.loading=!1}),tn(()=>{var g;(g=n.edit)!=null&&g.objectId&&(i.value=n.edit.orig),Ot(()=>i.value,v=>{const{highlighter:b,texRenderer:w}=s.value;X.value=v,me.value=oh(v,{emojiMap:A.value.map,highlighter:b,texRenderer:w}),H.value=uh(v),v?Uo(c.value):Uo.destroy(c.value)}),Ot(()=>s.value.emoji,async v=>{A.value=await uf(v)})}),(g,v)=>{var b,w;return E(),P("div",{key:U(o).token,class:"wl-comment"},[U(s).login!=="disable"&&xt.value&&!((b=e.edit)!=null&&b.objectId)?(E(),P("div",Yh,[I("div",Jh,[I("button",{type:"submit",class:"wl-logout-btn",title:fe.value.logout,onClick:jr},[Q(U(Lo),{size:14})],8,Qh),I("a",{href:"#",class:"wl-login-nick","aria-label":"Profile",title:fe.value.profile,onClick:Ct},[I("img",{src:U(o).avatar,alt:"avatar"},null,8,ep)],8,Xh)]),I("a",{href:"#",class:"wl-login-nick","aria-label":"Profile",title:fe.value.profile,onClick:Ct,textContent:Z(U(o).display_name)},null,8,tp)])):q("v-if",!0),I("div",np,[U(s).login!=="force"&&U(s).meta.length&&!xt.value?(E(),P("div",{key:0,class:ve(["wl-header",`item${U(s).meta.length}`])},[(E(!0),P(ie,null,Ae(U(s).meta,k=>(E(),P("div",{key:k,class:"wl-header-item"},[I("label",{for:`wl-${k}`,textContent:Z(fe.value[k]+(U(s).requiredMeta.includes(k)||!U(s).requiredMeta.length?"":`(${fe.value.optional})`))},null,8,rp),cr(I("input",{id:`wl-${k}`,ref_for:!0,ref:R=>{R&&(a.value[k]=R)},"onUpdate:modelValue":R=>U(l)[k]=R,class:ve(["wl-input",`wl-${k}`]),name:k,type:k==="mail"?"email":"text"},null,10,sp),[[Mu,U(l)[k]]])]))),128))],2)):q("v-if",!0),cr(I("textarea",{id:"wl-edit",ref:"textarea","onUpdate:modelValue":v[0]||(v[0]=k=>be(i)?i.value=k:null),class:"wl-editor",placeholder:e.replyUser?`@${e.replyUser}`:fe.value.placeholder,onKeydown:Qe,onDrop:Ps,onPaste:zs},null,40,ip),[[bs,U(i)]]),cr(I("div",lp,[v[7]||(v[7]=I("hr",null,null,-1)),I("h4",null,Z(fe.value.preview)+":",1),I("div",{class:"wl-content",innerHTML:me.value},null,8,op)],512),[[Ll,Ce.value]]),I("div",ap,[I("div",cp,[I("a",up,[Q(U(vh))]),cr(I("button",{ref:"emoji-button",type:"button",class:ve(["wl-action",{active:L.value}]),title:fe.value.emoji,onClick:v[1]||(v[1]=k=>L.value=!L.value)},[Q(U(ph))],10,fp),[[Ll,A.value.tabs.length]]),U(s).search?(E(),P("button",{key:0,ref:"gif-button",type:"button",class:ve(["wl-action",{active:D.value}]),title:fe.value.gif,onClick:v[2]||(v[2]=k=>D.value=!D.value)},[Q(U(xh))],10,hp)):q("v-if",!0),I("input",{id:"wl-image-upload",ref:"image-uploader",class:"upload","aria-hidden":"true",type:"file",accept:".png,.jpg,.jpeg,.webp,.bmp,.gif",onChange:Bt},null,544),Nt.value?(E(),P("label",{key:1,for:"wl-image-upload",class:"wl-action",title:fe.value.uploadImage,"aria-label":fe.value.uploadImage},[Q(U(dh))],8,pp)):q("v-if",!0),I("button",{type:"button",class:ve(["wl-action",{active:Ce.value}]),title:fe.value.preview,onClick:v[3]||(v[3]=k=>Ce.value=!Ce.value)},[Q(U(mh))],10,dp)]),I("div",gp,[v[9]||(v[9]=I("div",{class:"wl-captcha-container"},null,-1)),I("div",mp,[it(Z(H.value)+" ",1),U(s).wordLimit?(E(),P("span",vp,[v[8]||(v[8]=it(" / ",-1)),I("span",{class:ve({illegal:!F.value}),textContent:Z(re.value)},null,10,bp)])):q("v-if",!0),it(" "+Z(fe.value.word),1)]),U(s).login!=="disable"&&!xt.value?(E(),P("button",{key:0,type:"button",class:"wl-btn",onClick:On,textContent:Z(fe.value.login)},null,8,yp)):q("v-if",!0),U(s).login!=="force"||xt.value?(E(),P("button",{key:1,type:"submit",class:"primary wl-btn",title:"Cmd|Ctrl + Enter",disabled:G.value,onClick:Vt},[G.value?(E(),Ke(U(Pn),{key:0,size:16})):(E(),P(ie,{key:1},[it(Z(fe.value.submit),1)],64))],8,wp)):q("v-if",!0)]),I("div",{ref:"gif-popup",class:ve(["wl-gif-popup",{display:D.value}])},[I("input",{ref:"gif-search",type:"text",placeholder:fe.value.gifSearchPlaceholder,onInput:v[4]||(v[4]=(...k)=>U(d)&&U(d)(...k))},null,40,kp),N.list.length?(E(),Ke(Zh,{key:0,items:N.list,"column-width":200,gap:6,onInsert:v[5]||(v[5]=k=>_t(k)),onScroll:h},null,8,["items"])):q("v-if",!0),N.loading?(E(),P("div",xp,[Q(U(Pn),{size:30})])):q("v-if",!0)],2),I("div",{ref:"emoji-popup",class:ve(["wl-emoji-popup",{display:L.value}])},[(E(!0),P(ie,null,Ae(A.value.tabs,(k,R)=>(E(),P(ie,{key:k.name},[R===_.value?(E(),P("div",{key:0,class:"wl-tab-wrapper",onScroll:oe},[(E(!0),P(ie,null,Ae(k.items,$=>(E(),P("button",{key:$,type:"button",title:$,onClick:C=>_t(`:${$}:`),onMouseenter:C=>pe(C,$),onMouseleave:oe},[L.value?(E(),P("img",{key:0,class:"wl-emoji",src:A.value.map[$],alt:$,loading:"lazy",referrerPolicy:"no-referrer"},null,8,Cp)):q("v-if",!0)],40,_p))),128))],32)):q("v-if",!0)],64))),128)),I("div",null,[z.value?(E(),P("img",{key:0,class:"wl-emoji-preview",src:A.value.map[z.value],alt:"preview",loading:"lazy",referrerPolicy:"no-referrer",style:At(S.value)},null,12,$p)):q("v-if",!0)]),A.value.tabs.length>1?(E(),P("div",Sp,[(E(!0),P(ie,null,Ae(A.value.tabs,(k,R)=>(E(),P("button",{key:k.name,type:"button",class:ve(["wl-tab",{active:_.value===R}]),onClick:$=>_.value=R},[I("img",{class:"wl-emoji",src:k.icon,alt:k.name,title:k.name,loading:"lazy",referrerPolicy:"no-referrer"},null,8,Ap)],10,Rp))),128))])):q("v-if",!0)],2)])]),e.replyId||(w=e.edit)!=null&&w.objectId?(E(),P("button",{key:1,type:"button",class:"wl-close",title:fe.value.cancelReply,onClick:v[6]||(v[6]=k=>e.replyId?r("cancelReply"):r("cancelEdit"))},[Q(U(Lo),{size:24})],8,Ep)):q("v-if",!0)])}}});const Tp=["id"],Lp={class:"wl-user","aria-hidden":"true"},Ip=["src"],Mp={class:"wl-card"},Pp={class:"wl-head"},zp=["href"],jp={key:1,class:"wl-nick"},Op=["textContent"],Fp=["textContent"],Dp=["textContent"],Up=["textContent"],Hp={class:"wl-comment-actions"},Np=["title","href"],Bp=["title"],Vp=["title"],Wp={class:"wl-meta","aria-hidden":"true"},qp=["data-value","textContent"],Kp={key:0,class:"wl-warning","aria-hidden":"true"},Gp={key:1,class:"wl-content"},Zp={key:0,class:"wl-reply-to"},Yp=["href"],Jp=["innerHTML"],Qp={key:2,class:"wl-admin-actions"},Xp={class:"wl-comment-status"},ed=["disabled","onClick","textContent"],td={key:4,class:"wl-quote"};var nd=zt({__name:"CommentCard",props:{comment:{},edit:{},rootId:{},reply:{}},emits:["log","submit","delete","like","sticky","edit","reply","status"],setup(e,{emit:t}){const n=t,r=["approved","waiting","spam"],s=ur(Nn),i=Mo(),l=nf(),o=Pr(),a=de(()=>s.value.locale),c=de(()=>{const{link:A}=e.comment;return A?hi(A)?A:`https://${A}`:""}),u=de(()=>i.value.includes(e.comment.objectId)),f=de(()=>va(new Date(e.comment.time),l.value,a.value)),p=de(()=>o.value.type==="administrator"),m=de(()=>e.comment.user_id&&o.value.objectId===e.comment.user_id),x=de(()=>{var A;return e.comment.objectId===((A=e.reply)==null?void 0:A.objectId)}),y=de(()=>{var A;return e.comment.objectId===((A=e.edit)==null?void 0:A.objectId)});return(A,_)=>{var L;const z=tl("CommentCard",!0);return E(),P("div",{id:e.comment.objectId.toString(),class:"wl-card-item"},[I("div",Lp,[e.comment.avatar?(E(),P("img",{key:0,class:"wl-user-avatar",src:e.comment.avatar,alt:""},null,8,Ip)):q("v-if",!0),e.comment.type==="guest"?(E(),Ke(U(wh),{key:1})):q("v-if",!0),e.comment.type==="administrator"?(E(),Ke(U(kh),{key:2})):q("v-if",!0)]),I("div",Mp,[I("div",Pp,[c.value?(E(),P("a",{key:0,class:"wl-nick",href:c.value,target:"_blank",rel:"nofollow noopener noreferrer"},Z(e.comment.nick),9,zp)):(E(),P("span",jp,Z(e.comment.nick),1)),e.comment.label?(E(),P("span",{key:2,class:"wl-badge",textContent:Z(e.comment.label)},null,8,Op)):q("v-if",!0),e.comment.sticky?(E(),P("span",{key:3,class:"wl-badge",textContent:Z(a.value.sticky)},null,8,Fp)):q("v-if",!0),typeof e.comment.level=="number"?(E(),P("span",{key:4,class:ve(`wl-badge level${e.comment.level}`),textContent:Z(a.value[`level${e.comment.level}`]||`Level ${e.comment.level}`)},null,10,Dp)):q("v-if",!0),I("span",{class:"wl-time",textContent:Z(f.value)},null,8,Up),I("div",Hp,[p.value||m.value?(E(),P(ie,{key:0},[I("button",{type:"button",class:"wl-edit",onClick:_[0]||(_[0]=S=>n("edit",e.comment))},[Q(U(yh))]),I("button",{type:"button",class:"wl-delete",onClick:_[1]||(_[1]=S=>n("delete",e.comment))},[Q(U(hh))])],64)):q("v-if",!0),m.value?(E(),P("a",{key:1,role:"button",class:"wl-rss",title:a.value.subscribeToReplies,href:`${U(s).serverURL}/api/comment/rss?user_id=${e.comment.user_id}`,target:"_blank",rel:"noopener noreferrer"},[Q(U(_h))],8,Np)):q("v-if",!0),I("button",{type:"button",class:"wl-like",title:u.value?a.value.cancelLike:a.value.like,onClick:_[2]||(_[2]=S=>n("like",e.comment))},[Q(U(gh),{active:u.value},null,8,["active"]),it(" "+Z("like"in e.comment?e.comment.like:""),1)],8,Bp),I("button",{type:"button",class:ve(["wl-reply",{active:x.value}]),title:x.value?a.value.cancelReply:a.value.reply,onClick:_[3]||(_[3]=S=>n("reply",x.value?null:e.comment))},[Q(U(bh))],10,Vp)])]),I("div",Wp,[(E(),P(ie,null,Ae(["addr","browser","os"],S=>(E(),P(ie,null,[e.comment[S]?(E(),P("span",{key:S,class:ve(`wl-${S}`),"data-value":e.comment[S],textContent:Z(e.comment[S])},null,10,qp)):q("v-if",!0)],64))),64))]),e.comment.status==="waiting"&&!p.value?(E(),P("div",Kp,Z(a.value.commentUnderReview),1)):q("v-if",!0),y.value?q("v-if",!0):(E(),P("div",Gp,["reply_user"in e.comment&&e.comment.reply_user?(E(),P("div",Zp,[I("a",{href:"#"+e.comment.pid},"@"+Z(e.comment.reply_user.nick),9,Yp),_[17]||(_[17]=I("span",null,": ",-1))])):q("v-if",!0),I("div",{innerHTML:e.comment.comment},null,8,Jp)])),p.value&&!y.value?(E(),P("div",Qp,[I("span",Xp,[(E(),P(ie,null,Ae(r,S=>I("button",{key:S,type:"submit",class:ve(`wl-btn wl-${S}`),disabled:e.comment.status===S,onClick:O=>n("status",{status:S,comment:e.comment}),textContent:Z(a.value[S])},null,10,ed)),64))]),p.value&&!("rid"in e.comment)?(E(),P("button",{key:0,type:"submit",class:"wl-btn wl-sticky",onClick:_[4]||(_[4]=S=>n("sticky",e.comment))},Z(e.comment.sticky?a.value.unsticky:a.value.sticky),1)):q("v-if",!0)])):q("v-if",!0),x.value||y.value?(E(),P("div",{key:3,class:ve({"wl-reply-wrapper":x.value,"wl-edit-wrapper":y.value})},[Q(Ho,{edit:e.edit,"reply-id":(L=e.reply)==null?void 0:L.objectId,"reply-user":e.comment.nick,"root-id":e.rootId,onLog:_[5]||(_[5]=S=>n("log")),onCancelReply:_[6]||(_[6]=S=>n("reply",null)),onCancelEdit:_[7]||(_[7]=S=>n("edit",null)),onSubmit:_[8]||(_[8]=S=>n("submit",S))},null,8,["edit","reply-id","reply-user","root-id"])],2)):q("v-if",!0),"children"in e.comment?(E(),P("div",td,[(E(!0),P(ie,null,Ae(e.comment.children,S=>(E(),Ke(z,{key:S.objectId,comment:S,reply:e.reply,edit:e.edit,"root-id":e.rootId,onLog:_[9]||(_[9]=O=>n("log")),onDelete:_[10]||(_[10]=O=>n("delete",O)),onEdit:_[11]||(_[11]=O=>n("edit",O)),onLike:_[12]||(_[12]=O=>n("like",O)),onReply:_[13]||(_[13]=O=>n("reply",O)),onStatus:_[14]||(_[14]=O=>n("status",O)),onSticky:_[15]||(_[15]=O=>n("sticky",O)),onSubmit:_[16]||(_[16]=O=>n("submit",O))},null,8,["comment","reply","edit","root-id"]))),128))])):q("v-if",!0)])],8,Tp)}}});const No="3.12.1",rd={"data-waline":""},sd={class:"wl-meta-head"},id={class:"wl-count"},ld=["textContent"],od={class:"wl-sort"},ad=["onClick"],cd={class:"wl-cards"},ud={key:1,class:"wl-operation"},fd=["textContent"],hd={key:2,class:"wl-loading"},pd=["textContent"],dd={key:4,class:"wl-operation"},gd=["textContent"],md={key:5,class:"wl-meta-foot"},vd={class:"wl-rss"},bd=["href","alt"],yd=["textContent"],wd=["href","alt"],kd=["textContent"],xd={key:0,class:"wl-power"};var _d=zt({__name:"WalineComment",props:{serverURL:{},path:{},meta:{},requiredMeta:{},wordLimit:{},pageSize:{},lang:{},locale:{},commentSorting:{},dark:{type:[String,Boolean]},login:{},noCopyright:{type:Boolean},recaptchaV3Key:{},turnstileKey:{},reaction:{type:[Array,Boolean]},emoji:{},search:{},highlighter:{type:Function},imageUploader:{type:Function},texRenderer:{type:Function}},setup(e){const t=e,n=Pr(),r=Mo(),s=K("loading"),i=K(0),l=K(1),o=K(0),a=de(()=>da(t)),c=K(a.value.commentSorting),u=K([]),f=K(null),p=K(null),m=de(()=>ga(a.value.dark)),x=de(()=>a.value.locale);lf(m,{id:"waline-darkmode"});let y=null;const A=H=>{const{serverURL:N,path:re,pageSize:F}=a.value,X=new AbortController;s.value="loading",y==null||y(),Ds({serverURL:N,lang:a.value.lang,path:re,pageSize:F,sortBy:ci[c.value],page:H,signal:X.signal,token:n.value.token}).then(G=>{s.value="success",i.value=G.count,u.value.push(...G.data),l.value=H,o.value=G.totalPages}).catch(G=>{G.name!=="AbortError"&&(console.error(G.message),s.value="error")}),y=X.abort.bind(X)},_=()=>{A(l.value+1)},L=()=>{i.value=0,u.value=[],A(1)},z=H=>{c.value!==H&&(c.value=H,L())},S=H=>{f.value=H},O=H=>{p.value=H},pe=H=>{if(p.value)p.value.comment=H.comment,p.value.orig=H.orig;else if("rid"in H){const N=u.value.find(({objectId:re})=>re===H.rid);if(!N)return;Array.isArray(N.children)||(N.children=[]),N.children.push(H)}else u.value.unshift(H),i.value+=1},oe=async({comment:H,status:N})=>{if(H.status===N)return;const{serverURL:re,lang:F}=a.value;await cn({serverURL:re,lang:F,token:n.value.token,objectId:H.objectId,comment:{status:N}}),H.status=N},D=async H=>{if("rid"in H)return;const{serverURL:N,lang:re}=a.value;await cn({serverURL:N,lang:re,token:n.value.token,objectId:H.objectId,comment:{sticky:H.sticky?0:1}}),H.sticky=!H.sticky},Ce=async({objectId:H})=>{if(!confirm("Are you sure you want to delete this comment?"))return;const{serverURL:N,lang:re}=a.value;await Hs({serverURL:N,lang:re,token:n.value.token,objectId:H}),u.value.some((F,X)=>F.objectId===H?(u.value=u.value.filter((G,Ve)=>Ve!==X),!0):F.children.some((G,Ve)=>G.objectId===H?(u.value[X].children=F.children.filter((fe,xt)=>xt!==Ve),!0):!1))},me=async H=>{const{serverURL:N,lang:re}=a.value,{objectId:F}=H,X=r.value.includes(F);await cn({serverURL:N,lang:re,objectId:F,token:n.value.token,comment:{like:!X}}),X?r.value=r.value.filter(G=>G!==F):(r.value=[...r.value,F],r.value.length>50&&(r.value=r.value.slice(-50))),H.like=Math.max(0,(H.like||0)+(X?-1:1))};return mc(Nn,a),tn(()=>{Ot(()=>[t.serverURL,t.path],()=>{L()})}),rs(()=>{y==null||y()}),(H,N)=>(E(),P("div",rd,[Q(Vh),!f.value&&!p.value?(E(),Ke(Ho,{key:0,onLog:L,onSubmit:pe})):q("v-if",!0),I("div",sd,[I("div",id,[i.value?(E(),P("span",{key:0,class:"wl-num",textContent:Z(i.value)},null,8,ld)):q("v-if",!0),it(" "+Z(x.value.comment),1)]),I("ul",od,[(E(!0),P(ie,null,Ae(U(ha),re=>(E(),P("li",{key:re,class:ve([re===c.value?"active":""]),onClick:F=>z(re)},Z(x.value[re]),11,ad))),128))])]),I("div",cd,[(E(!0),P(ie,null,Ae(u.value,re=>(E(),Ke(nd,{key:re.objectId,"root-id":re.objectId,comment:re,reply:f.value,edit:p.value,onLog:L,onReply:S,onEdit:O,onSubmit:pe,onStatus:oe,onDelete:Ce,onSticky:D,onLike:me},null,8,["root-id","comment","reply","edit"]))),128))]),s.value==="error"?(E(),P("div",ud,[I("button",{type:"button",class:"wl-btn",onClick:L,textContent:Z(x.value.refresh)},null,8,fd)])):s.value==="loading"?(E(),P("div",hd,[Q(U(Pn),{size:30})])):u.value.length?l.value<o.value?(E(),P("div",dd,[I("button",{type:"button",class:"wl-btn",onClick:_,textContent:Z(x.value.more)},null,8,gd)])):q("v-if",!0):(E(),P("div",{key:3,class:"wl-empty",textContent:Z(x.value.sofa)},null,8,pd)),u.value.length||s.value!=="loading"?(E(),P("div",md,[I("div",vd,[I("a",{href:`${a.value.serverURL}/api/comment/rss?path=${encodeURIComponent(a.value.path)}`,target:"_blank",rel:"noopener noreferrer",alt:x.value.subPostComment},[Q(U(Io)),I("span",{textContent:Z(x.value.subPostComment)},null,8,yd)],8,bd),I("a",{href:`${a.value.serverURL}/api/comment/rss`,target:"_blank",rel:"noopener noreferrer",alt:x.value.subSiteComment},[Q(U(Io)),I("span",{textContent:Z(x.value.subSiteComment)},null,8,kd)],8,wd)]),a.value.noCopyright?q("v-if",!0):(E(),P("div",xd,[N[0]||(N[0]=it(" Powered by ",-1)),N[1]||(N[1]=I("a",{href:"https://github.com/walinejs/waline",target:"_blank",rel:"noopener noreferrer"}," Waline ",-1)),it(" v"+Z(U(No)),1)]))])):q("v-if",!0)]))}});const Bo=(e,t)=>{t.forEach((n,r)=>{const s=e[r].time;typeof s=="number"&&(n.textContent=s.toString())})},Vo=({serverURL:e,path:t=window.location.pathname,selector:n=".waline-pageview-count",update:r=!0,lang:s=navigator.language})=>{const i=new AbortController,l=[...document.querySelectorAll(n)],o=c=>{const u=Ls(c);return u!=null&&t!==u},a=c=>Vs({serverURL:Bn(e),paths:c.map(u=>Ls(u)??t),lang:s,signal:i.signal}).then(u=>{Bo(u,c)}).catch(to);if(r){const c=l.filter(f=>!o(f)),u=l.filter(f=>o(f));Ws({serverURL:Bn(e),path:t,lang:s}).then(f=>{Bo(f,c)}),u.length>0&&a(u)}else a(l);return i.abort.bind(i)},Cd=({el:e="#waline",path:t=window.location.pathname,comment:n=!1,pageview:r=!1,...s})=>{const i=e?Rr(e):null;if(e&&!i)throw new Error("Option 'el' do not match any domElement!");if(!s.serverURL)throw new Error("Option 'serverURL' is missing!");const l=yn({...s}),o=yn({comment:n,pageview:r,path:t}),a=()=>{o.comment&&To({serverURL:l.serverURL,path:o.path,...qt(o.comment)?{selector:o.comment}:{}})},c=()=>{o.pageview&&Vo({serverURL:l.serverURL,path:o.path,...qt(o.pageview)?{selector:o.pageview}:{}})};let u=null;i&&(u=ql(()=>W(_d,{path:o.path,...l})),u.mount(i));const f=Ji(a),p=Ji(c);return{el:i,update:({comment:m,pageview:x,path:y=window.location.pathname,...A}={})=>{Object.entries(A).forEach(([_,L])=>{l[_]=L}),o.path=y,m!=null&&(o.comment=m),x!=null&&(o.pageview=x)},destroy:()=>{u==null||u.unmount(),f(),p()}}},$d=({el:e,serverURL:t,count:n,lang:r=navigator.language})=>{const s=Pr(),i=Rr(e),l=new AbortController;return qs({serverURL:t,count:n,lang:r,signal:l.signal,token:s.value.token}).then(o=>i&&o.length>0?(i.innerHTML=`<ul class="wl-recent-list">${o.map(a=>`<li class="wl-recent-item"><a href="${a.url}">${a.nick}</a>:${a.comment}</li>`).join("")}</ul>`,{comments:o,destroy:()=>{l.abort(),i.innerHTML=""}}):{comments:o,destroy:()=>{l.abort()}})},Sd=({el:e,serverURL:t,count:n,locale:r,lang:s=navigator.language,mode:i="list"})=>{const l=Rr(e),o=new AbortController;return Ks({serverURL:t,pageSize:n,lang:s,signal:o.signal}).then(a=>{if(!l||a.length===0)return{users:a,destroy:()=>{o.abort()}};const c={...oi(s),...typeof r=="object"?r:{}};return l.innerHTML=`<ul class="wl-user-${i}">${a.map((u,f)=>[`<li class="wl-user-item" aria-label="${u.nick}">`,u.link?`<a href="${u.link}" target="_blank">`:"",'<div class="wl-user-avatar">',`<img src="${u.avatar}" alt="${u.nick}">`,`<span class="wl-user-badge">${f+1}</span>`,"</div>",'<div class="wl-user-meta">','<div class="wl-user-name">',u.nick,typeof u.level=="number"?`<span class="wl-badge">${c[`level${u.level}`]??`Level ${u.level}`}</span>`:"",u.label?`<span class="wl-badge">${u.label}</span>`:"","</div>",u.link,"</div>",u.link?"</a>":"","</li>"].filter(Boolean).join("")).join("")}</ul>`,{users:a,destroy:()=>{o.abort(),l.innerHTML=""}}})},Rd=async({serverURL:e,lang:t,path:n})=>{const r=[1,2,3,4,5],s=new AbortController,i=s.abort.bind(s),[l]=await Un({serverURL:e,lang:t,paths:[n],type:Array.from({length:5},(o,a)=>`reaction${a}`),signal:s.signal});return{value:r.map((o,a)=>l[`reaction${a}`]),abort:i}},Ms=e=>{if(Number.isNaN(e))return 0;const t=Math.round(e);return Math.min(5,Math.max(0,t))},Wo=(e=[])=>Array.from({length:5},(t,n)=>{const r=e[n]??0;return typeof r=="number"&&r>0?r:0});var Ad=zt({name:"WalineStarDisplay",props:{score:{type:Number,default:0}},setup(e){const t=de(()=>Ms(e.score));return{displayScore:t,displayClass:n=>t.value>=n?"wl-star-solid":"wl-star-outline"}}}),qo=(e,t)=>{const n=e.__vccOpts||e;for(const[r,s]of t)n[r]=s;return n};const Ed={class:"wl-star-icon",viewBox:"0 0 24 24"};function Td(e,t,n,r,s,i){return E(),P(ie,null,Ae([1,2,3,4,5],l=>I("span",{key:l,class:"wl-star-item"},[(E(),P("svg",Ed,[I("path",{class:ve(e.displayClass(l)),d:"M12 2l3.09 6.26L22 9.27l-5 4.87L18.18 22 12 18.56 5.82 22 7 14.14l-5-4.87 6.91-1.01L12 2z"},null,2)]))])),64)}var Ld=qo(Ad,[["render",Td]]),Id=zt({name:"WalineStarWidget",components:{StarDisplay:Ld},props:{path:{type:String,default:""},serverURL:{type:String,default:""},lang:{type:String,default:""}},emits:["rate"],setup(e,{emit:t}){const n=K(null),r=Po(),s=K(Ms((r.value[e.path]??0)+1)),i=K(null),l=K(Wo([])),o=K(!1);tn(()=>{Ot(()=>[e.serverURL,e.path],async()=>{try{const _=await Rd({serverURL:e.serverURL,path:e.path,lang:e.lang});l.value=Wo(_.value)}catch(_){console.error("Failed to fetch reaction data:",_)}})});const a=de(()=>i.value??s.value),c=de(()=>l.value.reduce((_,L)=>_+L,0)),u=de(()=>l.value.map(_=>c.value?_/c.value:0)),f=_=>{if(!n.value)return 0;const{firstElementChild:L,lastElementChild:z}=n.value;if(!L||!z)return 0;const{left:S}=L.getBoundingClientRect(),{right:O}=z.getBoundingClientRect(),pe=O-S,oe=(_.clientX-S)/pe,D=Math.min(1,Math.max(0,oe))*5;return Ms(D)},p=_=>{i.value=f(_)},m=()=>{i.value=null},x=async _=>{const L=i.value??f(_);if(L===s.value||o.value)return;o.value=!0;const z=s.value,S={serverURL:e.serverURL,lang:e.lang,path:e.path};try{z&&(await Wt({...S,type:`reaction${z-1}`,action:"desc"}),l.value[z-1]=Math.max(0,(l.value[z-1]??0)-1)),s.value=L;const O=L-1;r.value[e.path]=O,await Wt({serverURL:e.serverURL,lang:e.lang,path:e.path,type:`reaction${O}`,action:"inc"}),l.value[O]=(l.value[O]??0)+1,t("rate",L)}catch(O){s.value=z,z?r.value[e.path]=z-1:delete r.value[e.path],console.error("[Waline] Failed to update reaction counter",O)}finally{o.value=!1}};function y(_){return l.value[_-1]??0}function A(_){return`${((u.value[_-1]??0)*100).toFixed(1)}%`}return{ratingArea:n,displayScore:a,onMouseMove:p,onMouseLeave:m,onClick:x,countFor:y,percentText:A}}});const Md={class:"wl-star"},Pd={class:"wl-star-score"},zd={class:"wl-star-rate"},jd={class:"wl-star-progress"},Od=["data-count"],Fd={class:"wl-star-percent"};function Dd(e,t,n,r,s,i){const l=tl("StarDisplay");return E(),P("div",Md,[I("div",{ref:"ratingArea",class:"wl-star-rate",onMousemove:t[0]||(t[0]=(...o)=>e.onMouseMove&&e.onMouseMove(...o)),onMouseleave:t[1]||(t[1]=(...o)=>e.onMouseLeave&&e.onMouseLeave(...o)),onClick:t[2]||(t[2]=(...o)=>e.onClick&&e.onClick(...o))},[Q(l,{score:e.displayScore},null,8,["score"])],544),I("div",Pd,[(E(),P(ie,null,Ae([5,4,3,2,1],o=>I("div",{key:o,class:"wl-star-row"},[I("div",zd,[Q(l,{score:o},null,8,["score"])]),I("div",jd,[I("div",{class:"wl-star-progress-bar",style:At({width:e.percentText(o)}),"data-count":e.countFor(o).toString()},null,12,Od)]),I("span",Fd,Z(e.percentText(o)),1)])),64))])])}var Ud=qo(Id,[["render",Dd]]);const Hd=({el:e,path:t,lang:n=navigator.language,serverURL:r,onRate:s})=>{const i=Rr(e);if(!i)return{destroy:()=>{}};const l=ql(Ud,{path:t,lang:n,serverURL:r,onRate:s});return l.mount(i),{destroy:()=>{l.unmount(),i.innerHTML=""}}};te.RecentComments=$d,te.Star=Hd,te.UserList=Sd,te.addComment=Us,te.commentCount=To,te.defaultLocales=Hn,te.deleteComment=Hs,te.fetchCommentCount=Ns,te.getArticleCounter=Un,te.getComment=Ds,te.getPageview=Vs,te.getRecentComment=qs,te.getUserList=Ks,te.init=Cd,te.login=Bs,te.pageviewCount=Vo,te.updateArticleCounter=Wt,te.updateComment=cn,te.updatePageview=Ws,te.version=No}));
|
|
89
89
|
//# sourceMappingURL=waline.umd.js.map
|