@waline/client 3.1.0 → 3.1.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/comment.js.map +1 -1
- package/dist/component.js +1 -1
- package/dist/pageview.js +1 -1
- package/dist/pageview.js.map +1 -1
- package/dist/slim.js +1 -1
- package/dist/slim.js.map +1 -1
- package/dist/waline.js +2 -2
- package/dist/waline.js.map +1 -1
- package/dist/waline.umd.js +29 -29
- package/dist/waline.umd.js.map +1 -1
- package/package.json +2 -2
package/dist/waline.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var yo=Object.defineProperty;var wo=(e,t,n)=>t in e?yo(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var ze=(e,t,n)=>(wo(e,typeof t!="symbol"?t+"":t,n),n),bo=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)};var _i=(e,t,n)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,n)};var Rn=(e,t,n)=>(bo(e,t,"access private method"),n);var Tn,Cr,bi,vo;const Rr={"Content-Type":"application/json"},Ge=e=>`${e.replace(/\/?$/,"/")}api/`,St=(e,t="")=>{if(typeof e=="object"&&e.errno)throw new TypeError(`${t} failed with ${e.errno}: ${e.errmsg}`);return e},Ci=({serverURL:e,lang:t,paths:n,type:i,signal:r})=>fetch(`${Ge(e)}article?path=${encodeURIComponent(n.join(","))}&type=${encodeURIComponent(i.join(","))}&lang=${t}`,{signal:r}).then(s=>s.json()),An=({serverURL:e,lang:t,path:n,type:i,action:r})=>fetch(`${Ge(e)}article?lang=${t}`,{method:"POST",headers:Rr,body:JSON.stringify({path:n,type:i,action:r})}).then(s=>s.json()).then(s=>St(s,"Update counter").data),Ar=({serverURL:e,lang:t,path:n,page:i,pageSize:r,sortBy:s,signal:l,token:o})=>{const a={};return o&&(a.Authorization=`Bearer ${o}`),fetch(`${Ge(e)}comment?path=${encodeURIComponent(n)}&pageSize=${r}&page=${i}&lang=${t}&sortBy=${s}`,{signal:l,headers:a}).then(c=>c.json()).then(c=>St(c,"Get comment data").data)},Sr=({serverURL:e,lang:t,token:n,comment:i})=>{const r={"Content-Type":"application/json"};return n&&(r.Authorization=`Bearer ${n}`),fetch(`${Ge(e)}comment?lang=${t}`,{method:"POST",headers:r,body:JSON.stringify(i)}).then(s=>s.json())},Ir=({serverURL:e,lang:t,token:n,objectId:i})=>fetch(`${Ge(e)}comment/${i}?lang=${t}`,{method:"DELETE",headers:{Authorization:`Bearer ${n}`}}).then(r=>r.json()).then(r=>St(r,"Delete comment")),Zt=({serverURL:e,lang:t,token:n,objectId:i,comment:r})=>fetch(`${Ge(e)}comment/${i}?lang=${t}`,{method:"PUT",headers:{...Rr,Authorization:`Bearer ${n}`},body:JSON.stringify(r)}).then(s=>s.json()).then(s=>St(s,"Update comment")),Lr=({serverURL:e,lang:t,paths:n,signal:i})=>fetch(`${Ge(e)}comment?type=count&url=${encodeURIComponent(n.join(","))}&lang=${t}`,{signal:i}).then(r=>r.json()).then(r=>St(r,"Get comment count").data),Mr=({lang:e,serverURL:t})=>{const n=(window.innerWidth-450)/2,i=(window.innerHeight-450)/2,r=window.open(`${t.replace(/\/$/,"")}/ui/login?lng=${encodeURIComponent(e)}`,"_blank",`width=450,height=450,left=${n},top=${i},scrollbars=no,resizable=no,status=no,location=no,toolbar=no,menubar=no`);return r==null||r.postMessage({type:"TOKEN",data:null},"*"),new Promise(s=>{const l=({data:o})=>{!o||typeof o!="object"||o.type!=="userInfo"||o.data.token&&(r==null||r.close(),window.removeEventListener("message",l),s(o.data))};window.addEventListener("message",l)})},Or=({serverURL:e,lang:t,paths:n,signal:i})=>Ci({serverURL:e,lang:t,paths:n,type:["time"],signal:i})
|
|
1
|
+
var yo=Object.defineProperty;var wo=(e,t,n)=>t in e?yo(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var ze=(e,t,n)=>(wo(e,typeof t!="symbol"?t+"":t,n),n),bo=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)};var _i=(e,t,n)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,n)};var Rn=(e,t,n)=>(bo(e,t,"access private method"),n);var Tn,Cr,bi,vo;const Rr={"Content-Type":"application/json"},Ge=e=>`${e.replace(/\/?$/,"/")}api/`,St=(e,t="")=>{if(typeof e=="object"&&e.errno)throw new TypeError(`${t} failed with ${e.errno}: ${e.errmsg}`);return e},Ci=({serverURL:e,lang:t,paths:n,type:i,signal:r})=>fetch(`${Ge(e)}article?path=${encodeURIComponent(n.join(","))}&type=${encodeURIComponent(i.join(","))}&lang=${t}`,{signal:r}).then(s=>s.json()),An=({serverURL:e,lang:t,path:n,type:i,action:r})=>fetch(`${Ge(e)}article?lang=${t}`,{method:"POST",headers:Rr,body:JSON.stringify({path:n,type:i,action:r})}).then(s=>s.json()).then(s=>St(s,"Update counter").data),Ar=({serverURL:e,lang:t,path:n,page:i,pageSize:r,sortBy:s,signal:l,token:o})=>{const a={};return o&&(a.Authorization=`Bearer ${o}`),fetch(`${Ge(e)}comment?path=${encodeURIComponent(n)}&pageSize=${r}&page=${i}&lang=${t}&sortBy=${s}`,{signal:l,headers:a}).then(c=>c.json()).then(c=>St(c,"Get comment data").data)},Sr=({serverURL:e,lang:t,token:n,comment:i})=>{const r={"Content-Type":"application/json"};return n&&(r.Authorization=`Bearer ${n}`),fetch(`${Ge(e)}comment?lang=${t}`,{method:"POST",headers:r,body:JSON.stringify(i)}).then(s=>s.json())},Ir=({serverURL:e,lang:t,token:n,objectId:i})=>fetch(`${Ge(e)}comment/${i}?lang=${t}`,{method:"DELETE",headers:{Authorization:`Bearer ${n}`}}).then(r=>r.json()).then(r=>St(r,"Delete comment")),Zt=({serverURL:e,lang:t,token:n,objectId:i,comment:r})=>fetch(`${Ge(e)}comment/${i}?lang=${t}`,{method:"PUT",headers:{...Rr,Authorization:`Bearer ${n}`},body:JSON.stringify(r)}).then(s=>s.json()).then(s=>St(s,"Update comment")),Lr=({serverURL:e,lang:t,paths:n,signal:i})=>fetch(`${Ge(e)}comment?type=count&url=${encodeURIComponent(n.join(","))}&lang=${t}`,{signal:i}).then(r=>r.json()).then(r=>St(r,"Get comment count").data),Mr=({lang:e,serverURL:t})=>{const n=(window.innerWidth-450)/2,i=(window.innerHeight-450)/2,r=window.open(`${t.replace(/\/$/,"")}/ui/login?lng=${encodeURIComponent(e)}`,"_blank",`width=450,height=450,left=${n},top=${i},scrollbars=no,resizable=no,status=no,location=no,toolbar=no,menubar=no`);return r==null||r.postMessage({type:"TOKEN",data:null},"*"),new Promise(s=>{const l=({data:o})=>{!o||typeof o!="object"||o.type!=="userInfo"||o.data.token&&(r==null||r.close(),window.removeEventListener("message",l),s(o.data))};window.addEventListener("message",l)})},Or=({serverURL:e,lang:t,paths:n,signal:i})=>Ci({serverURL:e,lang:t,paths:n,type:["time"],signal:i}),zr=e=>An({...e,type:"time",action:"inc"}),jr=({serverURL:e,lang:t,count:n,signal:i,token:r})=>{const s={};return r&&(s.Authorization=`Bearer ${r}`),fetch(`${Ge(e)}comment?type=recent&count=${n}&lang=${t}`,{signal:i,headers:s}).then(l=>l.json())},Pr=({serverURL:e,signal:t,pageSize:n,lang:i})=>fetch(`${Ge(e)}user?pageSize=${n}&lang=${i}`,{signal:t}).then(r=>r.json()).then(r=>St(r,"user list")).then(r=>r.data),ko=["nick","mail","link"],Fr=e=>e.filter(t=>ko.includes(t)),Ur=["//unpkg.com/@waline/emojis@1.1.0/weibo"],xo=["//unpkg.com/@waline/emojis/tieba/tieba_agree.png","//unpkg.com/@waline/emojis/tieba/tieba_look_down.png","//unpkg.com/@waline/emojis/tieba/tieba_sunglasses.png","//unpkg.com/@waline/emojis/tieba/tieba_pick_nose.png","//unpkg.com/@waline/emojis/tieba/tieba_awkward.png","//unpkg.com/@waline/emojis/tieba/tieba_sleep.png"],_o=e=>new Promise((t,n)=>{if(e.size>128*1e3)return n(new Error("File too large! File size limit 128KB"));const i=new FileReader;i.readAsDataURL(e),i.onload=()=>{var r;return t(((r=i.result)==null?void 0:r.toString())||"")},i.onerror=n}),Co=e=>e===!0?'<p class="wl-tex">TeX is not available in preview</p>':'<span class="wl-tex">TeX is not available in preview</span>',$o=e=>{const t=async(n,i={})=>fetch(`https://api.giphy.com/v1/gifs/${n}?${new URLSearchParams({lang:e,limit:"20",rating:"g",api_key:"6CIMLkNMMOhRcXPoMCPkFy4Ybk2XUiMp",...i}).toString()}`).then(r=>r.json()).then(({data:r})=>r.map(s=>({title:s.title,src:s.images.downsized_medium.url})));return{search:n=>t("search",{q:n,offset:"0"}),default:()=>t("trending",{}),more:(n,i=0)=>t("search",{q:n,offset:i.toString()})}},Eo=/[\u4E00-\u9FFF\u3400-\u4dbf\uf900-\ufaff\u3040-\u309f\uac00-\ud7af\u0400-\u04FF]+|\w+/,To=/</,Ro=/(?:^|\s)\/\/(.+?)$/gm,Ao=/\/\*([\S\s]*?)\*\//gm,So=new RegExp(`(${Eo.source}|${To.source})|((?:${Ro.source})|(?:${Ao.source}))`,"gmi"),Nr=["23AC69","91C132","F19726","E8552D","1AAB8E","E1147F","2980C1","1BA1E6","9FA0A0","F19726","E30B20","E30B20","A3338B"],$i={},Io=e=>{let t=0;return e.replace(So,(n,i,r)=>{if(r)return`<span style="color: slategray">${r}</span>`;if(i==="<")return"<";let s;$i[i]?s=$i[i]:(s=Nr[t],$i[i]=s);const l=`<span style="color: #${s}">${i}</span>`;return t=++t%Nr.length,l})},Lo=["nick","nickError","mail","mailError","link","optional","placeholder","sofa","submit","like","cancelLike","reply","cancelReply","comment","refresh","more","preview","emoji","uploadImage","seconds","minutes","hours","days","now","uploading","login","logout","admin","sticky","word","wordHint","anonymous","level0","level1","level2","level3","level4","level5","gif","gifSearchPlaceholder","profile","approved","waiting","spam","unsticky","oldest","latest","hottest","reactionTitle"],st=e=>Object.fromEntries(e.map((t,n)=>[Lo[n],t]));var Hr=st(["NickName","NickName cannot be less than 3 bytes.","E-Mail","Please confirm your email address.","Website","Optional","Comment here...","No comment yet.","Submit","Like","Cancel like","Reply","Cancel reply","Comments","Refresh","Load More...","Preview","Emoji","Upload Image","seconds ago","minutes ago","hours ago","days ago","just now","Uploading","Login","logout","Admin","Sticky","Words",`Please input comments between $0 and $1 words!
|
|
2
2
|
Current word number: $2`,"Anonymous","Dwarves","Hobbits","Ents","Wizards","Elves","Maiar","GIF","Search GIF","Profile","Approved","Waiting","Spam","Unsticky","Oldest","Latest","Hottest","What do you think?"]),Dr=st(["Pseudo","Le pseudo ne peut pas faire moins de 3 octets.","E-mail","Veuillez confirmer votre adresse e-mail.","Site Web","Optionnel","Commentez ici...","Aucun commentaire pour l'instant.","Envoyer","J'aime","Annuler le j'aime","Répondre","Annuler la réponse","Commentaires","Actualiser","Charger plus...","Aperçu","Emoji","Télécharger une image","Il y a quelques secondes","Il y a quelques minutes","Il y a quelques heures","Il y a quelques jours","À l'instant","Téléchargement en cours","Connexion","Déconnexion","Admin","Épinglé","Mots",`Veuillez saisir des commentaires entre $0 et $1 mots !
|
|
3
3
|
Nombre actuel de mots : $2`,"Anonyme","Nains","Hobbits","Ents","Mages","Elfes","Maïar","GIF","Rechercher un GIF","Profil","Approuvé","En attente","Indésirable","Détacher","Le plus ancien","Dernier","Le plus populaire","Qu'en pensez-vous ?"]),Vr=st(["ニックネーム","3バイト以上のニックネームをご入力ください.","メールアドレス","メールアドレスをご確認ください.","サイト","オプション","ここにコメント","コメントしましょう~","提出する","Like","Cancel like","返信する","キャンセル","コメント","更新","さらに読み込む","プレビュー","絵文字","画像をアップロード","秒前","分前","時間前","日前","たっだ今","アップロード","ログインする","ログアウト","管理者","トップに置く","ワード",`コメントは $0 から $1 ワードの間でなければなりません!
|
|
4
4
|
現在の単語番号: $2`,"匿名","うえにん","なかにん","しもおし","特にしもおし","かげ","なぬし","GIF","探す GIF","個人情報","承認済み","待っている","スパム","べたつかない","逆順","正順","人気順","どう思いますか?"]),Mo=st(["Apelido","Apelido não pode ser menor que 3 bytes.","E-Mail","Por favor, confirme seu endereço de e-mail.","Website","Opcional","Comente aqui...","Nenhum comentário, ainda.","Enviar","Like","Cancel like","Responder","Cancelar resposta","Comentários","Refrescar","Carregar Mais...","Visualizar","Emoji","Enviar Imagem","segundos atrás","minutos atrás","horas atrás","dias atrás","agora mesmo","Enviando","Entrar","Sair","Admin","Sticky","Palavras",`Favor enviar comentário com $0 a $1 palavras!
|
|
@@ -68,5 +68,5 @@ ${t}</tr>
|
|
|
68
68
|
`+(l.tokens?this.parseInline(l.tokens):l.text);i+=n?this.renderer.paragraph(o):o;continue}default:{const l='Token with "'+s.type+'" type was not found.';if(this.options.silent)return console.error(l),"";throw new Error(l)}}}return i}parseInline(t,n){n=n||this.renderer;let i="";for(let r=0;r<t.length;r++){const s=t[r];if(this.options.extensions&&this.options.extensions.renderers&&this.options.extensions.renderers[s.type]){const l=this.options.extensions.renderers[s.type].call({parser:this},s);if(l!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(s.type)){i+=l||"";continue}}switch(s.type){case"escape":{const l=s;i+=n.text(l.text);break}case"html":{const l=s;i+=n.html(l.text);break}case"link":{const l=s;i+=n.link(l.href,l.title,this.parseInline(l.tokens,n));break}case"image":{const l=s;i+=n.image(l.href,l.title,l.text);break}case"strong":{const l=s;i+=n.strong(this.parseInline(l.tokens,n));break}case"em":{const l=s;i+=n.em(this.parseInline(l.tokens,n));break}case"codespan":{const l=s;i+=n.codespan(l.text);break}case"br":{i+=n.br();break}case"del":{const l=s;i+=n.del(this.parseInline(l.tokens,n));break}case"text":{const l=s;i+=n.text(l.text);break}default:{const l='Token with "'+s.type+'" type was not found.';if(this.options.silent)return console.error(l),"";throw new Error(l)}}}return i}}class kn{options;constructor(t){this.options=t||Et}preprocess(t){return t}postprocess(t){return t}processAllTokens(t){return t}}ze(kn,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens"]));class Zl{constructor(...t){_i(this,Tn);_i(this,bi);ze(this,"defaults",gr());ze(this,"options",this.setOptions);ze(this,"parse",Rn(this,Tn,Cr).call(this,nt.lex,it.parse));ze(this,"parseInline",Rn(this,Tn,Cr).call(this,nt.lexInline,it.parseInline));ze(this,"Parser",it);ze(this,"Renderer",vi);ze(this,"TextRenderer",xr);ze(this,"Lexer",nt);ze(this,"Tokenizer",hi);ze(this,"Hooks",kn);this.use(...t)}walkTokens(t,n){var r,s;let i=[];for(const l of t)switch(i=i.concat(n.call(this,l)),l.type){case"table":{const o=l;for(const a of o.header)i=i.concat(this.walkTokens(a.tokens,n));for(const a of o.rows)for(const c of a)i=i.concat(this.walkTokens(c.tokens,n));break}case"list":{const o=l;i=i.concat(this.walkTokens(o.items,n));break}default:{const o=l;(s=(r=this.defaults.extensions)==null?void 0:r.childTokens)!=null&&s[o.type]?this.defaults.extensions.childTokens[o.type].forEach(a=>{const c=o[a].flat(1/0);i=i.concat(this.walkTokens(c,n))}):o.tokens&&(i=i.concat(this.walkTokens(o.tokens,n)))}}return i}use(...t){const n=this.defaults.extensions||{renderers:{},childTokens:{}};return t.forEach(i=>{const r={...i};if(r.async=this.defaults.async||r.async||!1,i.extensions&&(i.extensions.forEach(s=>{if(!s.name)throw new Error("extension name required");if("renderer"in s){const l=n.renderers[s.name];l?n.renderers[s.name]=function(...o){let a=s.renderer.apply(this,o);return a===!1&&(a=l.apply(this,o)),a}:n.renderers[s.name]=s.renderer}if("tokenizer"in s){if(!s.level||s.level!=="block"&&s.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");const l=n[s.level];l?l.unshift(s.tokenizer):n[s.level]=[s.tokenizer],s.start&&(s.level==="block"?n.startBlock?n.startBlock.push(s.start):n.startBlock=[s.start]:s.level==="inline"&&(n.startInline?n.startInline.push(s.start):n.startInline=[s.start]))}"childTokens"in s&&s.childTokens&&(n.childTokens[s.name]=s.childTokens)}),r.extensions=n),i.renderer){const s=this.defaults.renderer||new vi(this.defaults);for(const l in i.renderer){if(!(l in s))throw new Error(`renderer '${l}' does not exist`);if(l==="options")continue;const o=l,a=i.renderer[o],c=s[o];s[o]=(...f)=>{let p=a.apply(s,f);return p===!1&&(p=c.apply(s,f)),p||""}}r.renderer=s}if(i.tokenizer){const s=this.defaults.tokenizer||new hi(this.defaults);for(const l in i.tokenizer){if(!(l in s))throw new Error(`tokenizer '${l}' does not exist`);if(["options","rules","lexer"].includes(l))continue;const o=l,a=i.tokenizer[o],c=s[o];s[o]=(...f)=>{let p=a.apply(s,f);return p===!1&&(p=c.apply(s,f)),p}}r.tokenizer=s}if(i.hooks){const s=this.defaults.hooks||new kn;for(const l in i.hooks){if(!(l in s))throw new Error(`hook '${l}' does not exist`);if(l==="options")continue;const o=l,a=i.hooks[o],c=s[o];kn.passThroughHooks.has(l)?s[o]=f=>{if(this.defaults.async)return Promise.resolve(a.call(s,f)).then(h=>c.call(s,h));const p=a.call(s,f);return c.call(s,p)}:s[o]=(...f)=>{let p=a.apply(s,f);return p===!1&&(p=c.apply(s,f)),p}}r.hooks=s}if(i.walkTokens){const s=this.defaults.walkTokens,l=i.walkTokens;r.walkTokens=function(o){let a=[];return a.push(l.call(this,o)),s&&(a=a.concat(s.call(this,o))),a}}this.defaults={...this.defaults,...r}}),this}setOptions(t){return this.defaults={...this.defaults,...t},this}lexer(t,n){return nt.lex(t,n??this.defaults)}parser(t,n){return it.parse(t,n??this.defaults)}}Tn=new WeakSet,Cr=function(t,n){return(i,r)=>{const s={...r},l={...this.defaults,...s};this.defaults.async===!0&&s.async===!1&&(l.silent||console.warn("marked(): The async option was set to true by an extension. The async: false option sent to parse will be ignored."),l.async=!0);const o=Rn(this,bi,vo).call(this,!!l.silent,!!l.async);if(typeof i>"u"||i===null)return o(new Error("marked(): input parameter is undefined or null"));if(typeof i!="string")return o(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(i)+", string expected"));if(l.hooks&&(l.hooks.options=l),l.async)return Promise.resolve(l.hooks?l.hooks.preprocess(i):i).then(a=>t(a,l)).then(a=>l.hooks?l.hooks.processAllTokens(a):a).then(a=>l.walkTokens?Promise.all(this.walkTokens(a,l.walkTokens)).then(()=>a):a).then(a=>n(a,l)).then(a=>l.hooks?l.hooks.postprocess(a):a).catch(o);try{l.hooks&&(i=l.hooks.preprocess(i));let a=t(i,l);l.hooks&&(a=l.hooks.processAllTokens(a)),l.walkTokens&&this.walkTokens(a,l.walkTokens);let c=n(a,l);return l.hooks&&(c=l.hooks.postprocess(c)),c}catch(a){return o(a)}}},bi=new WeakSet,vo=function(t,n){return i=>{if(i.message+=`
|
|
69
69
|
Please report this to https://github.com/markedjs/marked.`,t){const r="<p>An error occurred:</p><pre>"+Le(i.message+"",!0)+"</pre>";return n?Promise.resolve(r):r}if(n)return Promise.reject(i);throw i}};const Tt=new Zl;function de(e,t){return Tt.parse(e,t)}de.options=de.setOptions=function(e){return Tt.setOptions(e),de.defaults=Tt.defaults,Ml(de.defaults),de},de.getDefaults=gr,de.defaults=Et,de.use=function(...e){return Tt.use(...e),de.defaults=Tt.defaults,Ml(de.defaults),de},de.walkTokens=function(e,t){return Tt.walkTokens(e,t)},de.parseInline=Tt.parseInline,de.Parser=it,de.parser=it.parse,de.Renderer=vi,de.TextRenderer=xr,de.Lexer=nt,de.lexer=nt.lex,de.Tokenizer=hi,de.Hooks=kn,de.parse=de;function df(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-"),{async:!!e.async,walkTokens(t){if(t.type!=="code")return;const n=Gl(t.lang);if(e.async)return Promise.resolve(e.highlight(t.text,n,t.lang||"")).then(Ql(t));const i=e.highlight(t.text,n,t.lang||"");if(i instanceof Promise)throw new Error("markedHighlight is not set to async but the highlight function is async. Set the async option to true on markedHighlight to await the async highlight function.");Ql(t)(i)},renderer:{code(t,n,i){const r=Gl(n),s=r?` class="${e.langPrefix}${eo(r)}"`:"";return t=t.replace(/\n$/,""),`<pre><code${s}>${i?t:eo(t,!0)}
|
|
70
70
|
</code></pre>`}}}}function Gl(e){return(e||"").match(/\S*/)[0]}function Ql(e){return t=>{typeof t=="string"&&t!==e.text&&(e.escaped=!0,e.text=t)}}const Jl=/[&<>"']/,hf=new RegExp(Jl.source,"g"),Yl=/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,pf=new RegExp(Yl.source,"g"),gf={"&":"&","<":"<",">":">",'"':""","'":"'"},Xl=e=>gf[e];function eo(e,t){if(t){if(Jl.test(e))return e.replace(hf,Xl)}else if(Yl.test(e))return e.replace(pf,Xl);return e}const mf=/\$.*?\$/,vf=/^\$(.*?)\$/,yf=/^(?:\s{0,3})\$\$((?:[^\n]|\n[^\n])+?)\n{0,1}\$\$/,wf=e=>[{name:"blockMath",level:"block",tokenizer(t){const n=yf.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(mf);return n!==-1?n:t.length},tokenizer(t){const n=vf.exec(t);if(n!==null)return{type:"html",raw:n[0],text:e(!1,n[1])}}}],to=(e="",t={})=>e.replace(/:(.+?):/g,(n,i)=>t[i]?`<img class="wl-emoji" src="${t[i]}" alt="${i}">`:n),bf=(e,{emojiMap:t,highlighter:n,texRenderer:i})=>{const r=new Zl;if(r.setOptions({breaks:!0}),n&&r.use(df({highlight:n})),i){const s=wf(i);r.use({extensions:s})}return r.parse(to(e,t))},_r=e=>e.dataset.path||null,kf=e=>e.match(/[\w\d\s,.\u00C0-\u024F\u0400-\u04FF]+/giu),xf=e=>e.match(/[\u4E00-\u9FD5]/gu),_f=e=>{var t,n;return(((t=kf(e))==null?void 0:t.reduce((i,r)=>i+(["",",","."].includes(r.trim())?0:r.trim().split(/\s+/u).length),0))||0)+(((n=xf(e))==null?void 0:n.length)||0)},Cf=async()=>{if(!navigator)return"";const{userAgentData:e}=navigator;let t=navigator.userAgent;if(!e||e.platform!=="Windows")return t;const{platformVersion:n}=await e.getHighEntropyValues(["platformVersion"]);return n&&parseInt(n.split(".")[0])>=13&&(t=t.replace("Windows NT 10.0","Windows NT 11.0")),t},no=({serverURL:e,path:t=window.location.pathname,selector:n=".waline-comment-count",lang:i=navigator.language})=>{const r=new AbortController,s=document.querySelectorAll(n);return s.length&&Lr({serverURL:In(e),paths:Array.from(s).map(l=>Gr(_r(l)||t)),lang:i,signal:r.signal}).then(l=>{s.forEach((o,a)=>{o.innerText=l[a].toString()})}).catch(Il),r.abort.bind(r)},io=({size:e})=>ee("svg",{class:"wl-close-icon",viewBox:"0 0 1024 1024",width:e,height:e},[ee("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"}),ee("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"})]),$f=()=>ee("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},ee("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"})),Ef=()=>ee("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},ee("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"})),Tf=()=>ee("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},[ee("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"}),ee("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"})]),Rf=({active:e=!1})=>ee("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},[ee("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"})]),Af=()=>ee("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},[ee("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"}),ee("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"})]),Sf=()=>ee("svg",{width:"16",height:"16",ariaHidden:"true"},ee("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"})),If=()=>ee("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},ee("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"})),Lf=()=>ee("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},ee("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"})),Mf=()=>ee("svg",{class:"verified-icon",viewBox:"0 0 1024 1024",width:"14",height:"14"},ee("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"})),xn=({size:e=100})=>ee("svg",{width:e,height:e,viewBox:"0 0 100 100",preserveAspectRatio:"xMidYMid"},ee("circle",{cx:50,cy:50,fill:"none",stroke:"currentColor",strokeWidth:"4",r:"40","stroke-dasharray":"85 30"},ee("animateTransform",{attributeName:"transform",type:"rotate",repeatCount:"indefinite",dur:"1s",values:"0 50 50;360 50 50",keyTimes:"0;1"}))),Of=()=>ee("svg",{width:24,height:24,fill:"currentcolor",viewBox:"0 0 24 24"},[ee("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"}),ee("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"})]),zf=()=>Vt("WALINE_USER_META",{nick:"",mail:"",link:""}),jf=()=>Vt("WALINE_COMMENT_BOX_EDITOR",""),Pf="WALINE_LIKE";let ro=null;const so=()=>ro||(ro=Vt(Pf,[])),Ff="WALINE_REACTION";let lo=null;const Uf=()=>lo??(lo=Vt(Ff,{}));var yi=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},oo={},Bt={},_n={},Nf=yi&&yi.__awaiter||function(e,t,n,i){function r(s){return s instanceof n?s:new n(function(l){l(s)})}return new(n||(n=Promise))(function(s,l){function o(f){try{c(i.next(f))}catch(p){l(p)}}function a(f){try{c(i.throw(f))}catch(p){l(p)}}function c(f){f.done?s(f.value):r(f.value).then(o,a)}c((i=i.apply(e,t||[])).next())})},Hf=yi&&yi.__generator||function(e,t){var n={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},i,r,s,l;return l={next:o(0),throw:o(1),return:o(2)},typeof Symbol=="function"&&(l[Symbol.iterator]=function(){return this}),l;function o(c){return function(f){return a([c,f])}}function a(c){if(i)throw new TypeError("Generator is already executing.");for(;n;)try{if(i=1,r&&(s=c[0]&2?r.return:c[0]?r.throw||((s=r.return)&&s.call(r),0):r.next)&&!(s=s.call(r,c[1])).done)return s;switch(r=0,s&&(c=[c[0]&2,s.value]),c[0]){case 0:case 1:s=c;break;case 4:return n.label++,{value:c[1],done:!1};case 5:n.label++,r=c[1],c=[0];continue;case 7:c=n.ops.pop(),n.trys.pop();continue;default:if(s=n.trys,!(s=s.length>0&&s[s.length-1])&&(c[0]===6||c[0]===2)){n=0;continue}if(c[0]===3&&(!s||c[1]>s[0]&&c[1]<s[3])){n.label=c[1];break}if(c[0]===6&&n.label<s[1]){n.label=s[1],s=c;break}if(s&&n.label<s[2]){n.label=s[2],n.ops.push(c);break}s[2]&&n.ops.pop(),n.trys.pop();continue}c=t.call(e,n)}catch(f){c=[6,f],r=0}finally{i=s=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}};Object.defineProperty(_n,"__esModule",{value:!0}),_n.ReCaptchaInstance=void 0;var Df=function(){function e(t,n,i){this.siteKey=t,this.recaptchaID=n,this.recaptcha=i,this.styleContainer=null}return e.prototype.execute=function(t){return Nf(this,void 0,void 0,function(){return Hf(this,function(n){return[2,this.recaptcha.enterprise?this.recaptcha.enterprise.execute(this.recaptchaID,{action:t}):this.recaptcha.execute(this.recaptchaID,{action:t})]})})},e.prototype.getSiteKey=function(){return this.siteKey},e.prototype.hideBadge=function(){this.styleContainer===null&&(this.styleContainer=document.createElement("style"),this.styleContainer.innerHTML=".grecaptcha-badge{visibility:hidden !important;}",document.head.appendChild(this.styleContainer))},e.prototype.showBadge=function(){this.styleContainer!==null&&(document.head.removeChild(this.styleContainer),this.styleContainer=null)},e}();_n.ReCaptchaInstance=Df,Object.defineProperty(Bt,"__esModule",{value:!0}),Bt.getInstance=Bt.load=void 0;var Vf=_n,gt;(function(e){e[e.NOT_LOADED=0]="NOT_LOADED",e[e.LOADING=1]="LOADING",e[e.LOADED=2]="LOADED"})(gt||(gt={}));var ao=function(){function e(){}return e.load=function(t,n){if(n===void 0&&(n={}),typeof document>"u")return Promise.reject(new Error("This is a library for the browser!"));if(e.getLoadingState()===gt.LOADED)return e.instance.getSiteKey()===t?Promise.resolve(e.instance):Promise.reject(new Error("reCAPTCHA already loaded with different site key!"));if(e.getLoadingState()===gt.LOADING)return t!==e.instanceSiteKey?Promise.reject(new Error("reCAPTCHA already loaded with different site key!")):new Promise(function(r,s){e.successfulLoadingConsumers.push(function(l){return r(l)}),e.errorLoadingRunnable.push(function(l){return s(l)})});e.instanceSiteKey=t,e.setLoadingState(gt.LOADING);var i=new e;return new Promise(function(r,s){i.loadScript(t,n.useRecaptchaNet||!1,n.useEnterprise||!1,n.renderParameters?n.renderParameters:{},n.customUrl).then(function(){e.setLoadingState(gt.LOADED);var l=i.doExplicitRender(grecaptcha,t,n.explicitRenderParameters?n.explicitRenderParameters:{},n.useEnterprise||!1),o=new Vf.ReCaptchaInstance(t,l,grecaptcha);e.successfulLoadingConsumers.forEach(function(a){return a(o)}),e.successfulLoadingConsumers=[],n.autoHideBadge&&o.hideBadge(),e.instance=o,r(o)}).catch(function(l){e.errorLoadingRunnable.forEach(function(o){return o(l)}),e.errorLoadingRunnable=[],s(l)})})},e.getInstance=function(){return e.instance},e.setLoadingState=function(t){e.loadingState=t},e.getLoadingState=function(){return e.loadingState===null?gt.NOT_LOADED:e.loadingState},e.prototype.loadScript=function(t,n,i,r,s){var l=this;n===void 0&&(n=!1),i===void 0&&(i=!1),r===void 0&&(r={}),s===void 0&&(s="");var o=document.createElement("script");o.setAttribute("recaptcha-v3-script","");var a="https://www.google.com/recaptcha/api.js";n&&(i?a="https://recaptcha.net/recaptcha/enterprise.js":a="https://recaptcha.net/recaptcha/api.js"),i&&(a="https://www.google.com/recaptcha/enterprise.js"),s&&(a=s),r.render&&(r.render=void 0);var c=this.buildQueryString(r);return o.src=a+"?render=explicit"+c,new Promise(function(f,p){o.addEventListener("load",l.waitForScriptToLoad(function(){f(o)},i),!1),o.onerror=function(h){e.setLoadingState(gt.NOT_LOADED),p(h)},document.head.appendChild(o)})},e.prototype.buildQueryString=function(t){var n=Object.keys(t);return n.length<1?"":"&"+Object.keys(t).filter(function(i){return!!t[i]}).map(function(i){return i+"="+t[i]}).join("&")},e.prototype.waitForScriptToLoad=function(t,n){var i=this;return function(){window.grecaptcha===void 0?setTimeout(function(){i.waitForScriptToLoad(t,n)},e.SCRIPT_LOAD_DELAY):n?window.grecaptcha.enterprise.ready(function(){t()}):window.grecaptcha.ready(function(){t()})}},e.prototype.doExplicitRender=function(t,n,i,r){var s={sitekey:n,badge:i.badge,size:i.size,tabindex:i.tabindex};return i.container?r?t.enterprise.render(i.container,s):t.render(i.container,s):r?t.enterprise.render(s):t.render(s)},e.loadingState=null,e.instance=null,e.instanceSiteKey=null,e.successfulLoadingConsumers=[],e.errorLoadingRunnable=[],e.SCRIPT_LOAD_DELAY=25,e}();Bt.load=ao.load,Bt.getInstance=ao.getInstance,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.ReCaptchaInstance=e.getInstance=e.load=void 0;var t=Bt;Object.defineProperty(e,"load",{enumerable:!0,get:function(){return t.load}}),Object.defineProperty(e,"getInstance",{enumerable:!0,get:function(){return t.getInstance}});var n=_n;Object.defineProperty(e,"ReCaptchaInstance",{enumerable:!0,get:function(){return n.ReCaptchaInstance}})}(oo);const co={},Bf=e=>{const t=co[e]??(co[e]=oo.load(e,{useRecaptchaNet:!0,autoHideBadge:!0}));return{execute:n=>t.then(i=>i.execute(n))}},Wf=e=>({execute:async t=>{const{load:n}=Cu("https://challenges.cloudflare.com/turnstile/v0/api.js",void 0,{async:!1});await n();const i=window==null?void 0:window.turnstile;return new Promise(r=>{i==null||i.ready(()=>{i==null||i.render(".wl-captcha-container",{sitekey:e,action:t,size:"compact",callback:r})})})}}),qf="WALINE_USER";let uo=null;const wi=()=>uo??(uo=Vt(qf,{})),Kf={key:0,class:"wl-reaction"},Zf=["textContent"],Gf={class:"wl-reaction-list"},Qf=["onClick"],Jf={class:"wl-reaction-img"},Yf=["src","alt"],Xf=["textContent"],ed=["textContent"];var td=ln({__name:"ArticleReaction",setup(e,{expose:t}){t();const n=Uf(),i=Xn("config"),r=K(-1),s=K([]),l=we(()=>i.value.locale),o=we(()=>i.value.reaction.length>0),a=we(()=>{const{reaction:h,path:m}=i.value;return h.map((A,x)=>({icon:A,desc:l.value[`reaction${x}`],active:n.value[m]===x}))});let c;const f=async()=>{if(o.value){const{serverURL:h,lang:m,path:A,reaction:x}=i.value,C=new AbortController;c=C.abort.bind(C);const w=await Ci({serverURL:h,lang:m,paths:[A],type:x.map((T,j)=>`reaction${j}`),signal:C.signal});if(Array.isArray(w)||typeof w=="number")return;s.value=x.map((T,j)=>w[`reaction${j}`])}},p=async h=>{if(r.value===-1){const{serverURL:m,lang:A,path:x}=i.value,C=n.value[x];r.value=h,C!==void 0&&(await An({serverURL:m,lang:A,path:x,type:`reaction${C}`,action:"desc"}),s.value[C]=Math.max(s.value[C]-1,0)),C!==h&&(await An({serverURL:m,lang:A,path:x,type:`reaction${h}`}),s.value[h]=(s.value[h]||0)+1),C===h?delete n.value[x]:n.value[x]=h,r.value=-1}};return on(()=>{je(()=>[i.value.serverURL,i.value.path],()=>{f()},{immediate:!0})}),Jn(()=>c==null?void 0:c()),(h,m)=>a.value.length?(L(),O("div",Kf,[F("div",{class:"wl-reaction-title",textContent:ne(l.value.reactionTitle)},null,8,Zf),F("ul",Gf,[(L(!0),O(ae,null,Pe(a.value,({active:A,icon:x,desc:C},w)=>(L(),O("li",{key:w,class:pe(["wl-reaction-item",{active:A}]),onClick:T=>p(w)},[F("div",Jf,[F("img",{src:x,alt:C},null,8,Yf),r.value===w?(L(),Ye(G(xn),{key:0,class:"wl-reaction-loading"})):(L(),O("div",{key:1,class:"wl-reaction-votes",textContent:ne(s.value[w]||0)},null,8,Xf))]),F("div",{class:"wl-reaction-text",textContent:ne(C)},null,8,ed)],10,Qf))),128))])])):Y("v-if",!0)}}),Cn=(e,t)=>{const n=e.__vccOpts||e;for(const[i,r]of t)n[i]=r;return n},nd=Cn(td,[["__file","ArticleReaction.vue"]]),$n=new Map;function id(e){var t=$n.get(e);t&&t.destroy()}function rd(e){var t=$n.get(e);t&&t.update()}var En=null;typeof window>"u"?((En=function(e){return e}).destroy=function(e){return e},En.update=function(e){return e}):((En=function(e,t){return e&&Array.prototype.forEach.call(e.length?e:[e],function(n){return function(i){if(i&&i.nodeName&&i.nodeName==="TEXTAREA"&&!$n.has(i)){var r,s=null,l=window.getComputedStyle(i),o=(r=i.value,function(){c({testForHeightReduction:r===""||!i.value.startsWith(r),restoreTextAlign:null}),r=i.value}),a=(function(p){i.removeEventListener("autosize:destroy",a),i.removeEventListener("autosize:update",f),i.removeEventListener("input",o),window.removeEventListener("resize",f),Object.keys(p).forEach(function(h){return i.style[h]=p[h]}),$n.delete(i)}).bind(i,{height:i.style.height,resize:i.style.resize,textAlign:i.style.textAlign,overflowY:i.style.overflowY,overflowX:i.style.overflowX,wordWrap:i.style.wordWrap});i.addEventListener("autosize:destroy",a),i.addEventListener("autosize:update",f),i.addEventListener("input",o),window.addEventListener("resize",f),i.style.overflowX="hidden",i.style.wordWrap="break-word",$n.set(i,{destroy:a,update:f}),f()}function c(p){var h,m,A=p.restoreTextAlign,x=A===void 0?null:A,C=p.testForHeightReduction,w=C===void 0||C,T=l.overflowY;if(i.scrollHeight!==0&&(l.resize==="vertical"?i.style.resize="none":l.resize==="both"&&(i.style.resize="horizontal"),w&&(h=function(N){for(var P=[];N&&N.parentNode&&N.parentNode instanceof Element;)N.parentNode.scrollTop&&P.push([N.parentNode,N.parentNode.scrollTop]),N=N.parentNode;return function(){return P.forEach(function(z){var W=z[0],B=z[1];W.style.scrollBehavior="auto",W.scrollTop=B,W.style.scrollBehavior=null})}}(i),i.style.height=""),m=l.boxSizing==="content-box"?i.scrollHeight-(parseFloat(l.paddingTop)+parseFloat(l.paddingBottom)):i.scrollHeight+parseFloat(l.borderTopWidth)+parseFloat(l.borderBottomWidth),l.maxHeight!=="none"&&m>parseFloat(l.maxHeight)?(l.overflowY==="hidden"&&(i.style.overflow="scroll"),m=parseFloat(l.maxHeight)):l.overflowY!=="hidden"&&(i.style.overflow="hidden"),i.style.height=m+"px",x&&(i.style.textAlign=x),h&&h(),s!==m&&(i.dispatchEvent(new Event("autosize:resized",{bubbles:!0})),s=m),T!==l.overflow&&!x)){var j=l.textAlign;l.overflow==="hidden"&&(i.style.textAlign=j==="start"?"end":"start"),c({restoreTextAlign:j,testForHeightReduction:!0})}}function f(){c({testForHeightReduction:!0,restoreTextAlign:null})}}(n)}),e}).destroy=function(e){return e&&Array.prototype.forEach.call(e.length?e:[e],id),e},En.update=function(e){return e&&Array.prototype.forEach.call(e.length?e:[e],rd),e});var fo=En;const sd=["data-index"],ld=["src","title","onClick"];var od=ln({__name:"ImageWall",props:{items:{default:()=>[]},columnWidth:{default:300},gap:{default:0}},emits:["insert"],setup(e,{expose:t}){const n=e;t();let i=null;const r=K(null),s=K({}),l=K([]),o=()=>{const h=Math.floor((r.value.getBoundingClientRect().width+n.gap)/(n.columnWidth+n.gap));return h>0?h:1},a=h=>new Array(h).fill(null).map(()=>[]),c=async h=>{var m;if(h>=n.items.length)return;await rn();const A=Array.from(((m=r.value)==null?void 0:m.children)||[]).reduce((x,C)=>C.getBoundingClientRect().height<x.getBoundingClientRect().height?C:x);l.value[Number(A.dataset.index)].push(h),await c(h+1)},f=async(h=!1)=>{if(l.value.length===o()&&!h)return;l.value=a(o());const m=window.scrollY;await c(0),window.scrollTo({top:m})},p=h=>{s.value[h.target.src]=!0};return on(()=>{f(!0),i=new ResizeObserver(()=>{f()}),i.observe(r.value),je(()=>[n.items],()=>{s.value={},f(!0)}),je(()=>[n.columnWidth,n.gap],()=>{f()})}),Za(()=>i.unobserve(r.value)),(h,m)=>(L(),O("div",{ref_key:"wall",ref:r,class:"wl-gallery",style:Yt({gap:`${h.gap}px`})},[(L(!0),O(ae,null,Pe(l.value,(A,x)=>(L(),O("div",{key:x,class:"wl-gallery-column","data-index":x,style:Yt({gap:`${h.gap}px`})},[(L(!0),O(ae,null,Pe(A,C=>(L(),O(ae,{key:C},[s.value[h.items[C].src]?Y("v-if",!0):(L(),Ye(G(xn),{key:0,size:36,style:{margin:"20px auto"}})),F("img",{class:"wl-gallery-item",src:h.items[C].src,title:h.items[C].title,loading:"lazy",onLoad:p,onClick:w=>h.$emit("insert",``)},null,40,ld)],64))),128))],12,sd))),128))],4))}}),ad=Cn(od,[["__file","ImageWall.vue"]]);const cd={class:"wl-comment"},ud={key:0,class:"wl-login-info"},fd={class:"wl-avatar"},dd=["title"],hd=["title"],pd=["src"],gd=["title","textContent"],md={class:"wl-panel"},vd=["for","textContent"],yd=["id","onUpdate:modelValue","name","type"],wd=["placeholder"],bd={class:"wl-preview"},kd=F("hr",null,null,-1),xd=["innerHTML"],_d={class:"wl-footer"},Cd={class:"wl-actions"},$d={href:"https://guides.github.com/features/mastering-markdown/",title:"Markdown Guide","aria-label":"Markdown is supported",class:"wl-action",target:"_blank",rel:"noopener noreferrer"},Ed=["title"],Td=["title"],Rd=["title"],Ad=["title"],Sd={class:"wl-info"},Id=F("div",{class:"wl-captcha-container"},null,-1),Ld={class:"wl-text-number"},Md={key:0},Od=["textContent"],zd=["textContent"],jd=["disabled"],Pd=["placeholder"],Fd={key:1,class:"wl-loading"},Ud={key:0,class:"wl-tab-wrapper"},Nd=["title","onClick"],Hd=["src","alt"],Dd={key:0,class:"wl-tabs"},Vd=["onClick"],Bd=["src","alt","title"],Wd=["title"];var qd=ln({__name:"CommentBox",props:{edit:{default:null},rootId:{default:""},replyId:{default:""},replyUser:{default:""}},emits:["log","cancelEdit","cancelReply","submit"],setup(e,{expose:t,emit:n}){const i=e,r=n;t();const s=Xn("config"),l=jf(),o=zf(),a=wi(),c=K({}),f=K(null),p=K(null),h=K(null),m=K(null),A=K(null),x=K(null),C=K(null),w=K({tabs:[],map:{}}),T=K(0),j=K(!1),N=K(!1),P=K(!1),z=K(""),W=K(0),B=Xt({loading:!0,list:[]}),Q=K(0),oe=K(!1),xe=K(""),Ue=K(!1),q=K(!1),D=we(()=>s.value.locale),ie=we(()=>{var M;return!!((M=a.value)!=null&&M.token)}),ge=we(()=>s.value.imageUploader!==!1),he=M=>{const S=f.value,u=S.selectionStart,d=S.selectionEnd||0,g=S.scrollTop;l.value=S.value.substring(0,u)+M+S.value.substring(d,S.value.length),S.focus(),S.selectionStart=u+M.length,S.selectionEnd=u+M.length,S.scrollTop=g},be=M=>{const S=M.key;(M.ctrlKey||M.metaKey)&&S==="Enter"&&Wt()},ve=M=>{const S=`![${s.value.locale.uploading} ${M.name}]()`;return he(S),Ue.value=!0,Promise.resolve().then(()=>s.value.imageUploader(M)).then(u=>{l.value=l.value.replace(S,`\r
|
|
71
|
-
`)}).catch(u=>{alert(u.message),l.value=l.value.replace(S,"")}).then(()=>{Ue.value=!1})},rt=M=>{var S;if((S=M.dataTransfer)!=null&&S.items){const u=Ll(M.dataTransfer.items);u&&ge.value&&(ve(u),M.preventDefault())}},mt=M=>{if(M.clipboardData){const S=Ll(M.clipboardData.items);S&&ge.value&&ve(S)}},Me=()=>{const M=p.value;M.files&&ge.value&&ve(M.files[0]).then(()=>{M.value=""})},Wt=async()=>{var M,S,u,d,g,v;const{serverURL:y,lang:k,login:E,wordLimit:_,requiredMeta:$,recaptchaV3Key:b,turnstileKey:I}=s.value,U=await Cf(),R={comment:xe.value,nick:o.value.nick,mail:o.value.mail,link:o.value.link,url:s.value.path,ua:U};if((M=a.value)!=null&&M.token&&!i.edit)R.nick=a.value.display_name,R.mail=a.value.email,R.link=a.value.url;else{if(E==="force")return;if($.indexOf("nick")>-1&&!R.nick)return(S=c.value.nick)==null||S.focus(),alert(D.value.nickError);if($.indexOf("mail")>-1&&!R.mail||R.mail&&!Do(R.mail))return(u=c.value.mail)==null||u.focus(),alert(D.value.mailError);R.nick||(R.nick=D.value.anonymous)}if(!R.comment){(d=f.value)==null||d.focus();return}if(!oe.value)return alert(D.value.wordHint.replace("$0",_[0].toString()).replace("$1",_[1].toString()).replace("$2",W.value.toString()));R.comment=to(R.comment,w.value.map),i.replyId&&i.rootId&&(R.pid=i.replyId,R.rid=i.rootId,R.at=i.replyUser),Ue.value=!0;try{b&&(R.recaptchaV3=await Bf(b).execute("social")),I&&(R.turnstile=await Wf(I).execute("social"));const H={serverURL:y,lang:k,token:(g=a.value)==null?void 0:g.token,comment:R},Z=await(i.edit?Zt({objectId:i.edit.objectId,...H}):Sr(H));if(Ue.value=!1,Z.errmsg)return alert(Z.errmsg);r("submit",Z.data),l.value="",z.value="",i.replyId&&r("cancelReply"),(v=i.edit)!=null&&v.objectId&&r("cancelEdit")}catch(H){Ue.value=!1,alert(H.message)}},ki=M=>{M.preventDefault();const{lang:S,serverURL:u}=s.value;Mr({serverURL:u,lang:S}).then(d=>{a.value=d,(d.remember?localStorage:sessionStorage).setItem("WALINE_USER",JSON.stringify(d)),r("log")})},xi=()=>{a.value={},localStorage.setItem("WALINE_USER","null"),sessionStorage.setItem("WALINE_USER","null"),r("log")},Oe=M=>{M.preventDefault();const{lang:S,serverURL:u}=s.value,d=800,g=800,v=(window.innerWidth-d)/2,y=(window.innerHeight-g)/2,k=new URLSearchParams({lng:S,token:a.value.token}),E=window.open(`${u}/ui/profile?${k.toString()}`,"_blank",`width=${d},height=${g},left=${v},top=${y},scrollbars=no,resizable=no,status=no,location=no,toolbar=no,menubar=no`);E==null||E.postMessage({type:"TOKEN",data:a.value.token},"*")},vt=M=>{var S,u,d,g;!((S=h.value)!=null&&S.contains(M.target))&&!((u=m.value)!=null&&u.contains(M.target))&&(j.value=!1),!((d=A.value)!=null&&d.contains(M.target))&&!((g=x.value)!=null&&g.contains(M.target))&&(N.value=!1)},Rt=async M=>{var S;const{scrollTop:u,clientHeight:d,scrollHeight:g}=M.target,v=(d+u)/g,y=s.value.search,k=((S=C.value)==null?void 0:S.value)||"";v<.9||B.loading||q.value||(B.loading=!0,(y.more&&B.list.length?await y.more(k,B.list.length):await y.search(k)).length?B.list=[...B.list,...y.more&&B.list.length?await y.more(k,B.list.length):await y.search(k)]:q.value=!0,B.loading=!1,setTimeout(()=>{M.target.scrollTop=u},50))},qt=fu(M=>{B.list=[],q.value=!1,Rt(M)},300);je([s,W],([M,S])=>{const{wordLimit:u}=M;u?S<u[0]&&u[0]!==0?(Q.value=u[0],oe.value=!1):S>u[1]?(Q.value=u[1],oe.value=!1):(Q.value=u[1],oe.value=!0):(Q.value=0,oe.value=!0)},{immediate:!0});const Ze=({data:M})=>{!M||M.type!=="profile"||(a.value={...a.value,...M.data},[localStorage,sessionStorage].filter(S=>S.getItem("WALINE_USER")).forEach(S=>S.setItem("WALINE_USER",JSON.stringify(a))))};return on(()=>{var M;document.body.addEventListener("click",vt),window.addEventListener("message",Ze),(M=i.edit)!=null&&M.objectId&&(l.value=i.edit.orig),je(N,async S=>{if(!S)return;const u=s.value.search;C.value&&(C.value.value=""),B.loading=!0,B.list=u.default?await u.default():await u.search(""),B.loading=!1}),je(()=>l.value,S=>{const{highlighter:u,texRenderer:d}=s.value;xe.value=S,z.value=bf(S,{emojiMap:w.value.map,highlighter:u,texRenderer:d}),W.value=_f(S),S?fo(f.value):fo.destroy(f.value)},{immediate:!0}),je(()=>s.value.emoji,S=>Au(S).then(u=>{w.value=u}),{immediate:!0})}),Jn(()=>{document.body.removeEventListener("click",vt),window.removeEventListener("message",Ze)}),(M,S)=>{var u,d;return L(),O("div",cd,[G(s).login!=="disable"&&ie.value&&!((u=M.edit)!=null&&u.objectId)?(L(),O("div",ud,[F("div",fd,[F("button",{type:"submit",class:"wl-logout-btn",title:D.value.logout,onClick:xi},[se(G(io),{size:14})],8,dd),F("a",{href:"#",class:"wl-login-nick","aria-label":"Profile",title:D.value.profile,onClick:Oe},[F("img",{src:G(a).avatar,alt:"avatar"},null,8,pd)],8,hd)]),F("a",{href:"#",class:"wl-login-nick","aria-label":"Profile",title:D.value.profile,onClick:Oe,textContent:ne(G(a).display_name)},null,8,gd)])):Y("v-if",!0),F("div",md,[G(s).login!=="force"&&G(s).meta.length&&!ie.value?(L(),O("div",{key:0,class:pe(["wl-header",`item${G(s).meta.length}`])},[(L(!0),O(ae,null,Pe(G(s).meta,g=>(L(),O("div",{key:g,class:"wl-header-item"},[F("label",{for:`wl-${g}`,textContent:ne(D.value[g]+(G(s).requiredMeta.includes(g)||!G(s).requiredMeta.length?"":`(${D.value.optional})`))},null,8,vd),Gn(F("input",{id:`wl-${g}`,ref_for:!0,ref:v=>{v&&(c.value[g]=v)},"onUpdate:modelValue":v=>G(o)[g]=v,class:pe(["wl-input",`wl-${g}`]),name:g,type:g==="mail"?"email":"text"},null,10,yd),[[eu,G(o)[g]]])]))),128))],2)):Y("v-if",!0),Gn(F("textarea",{id:"wl-edit",ref_key:"editorRef",ref:f,"onUpdate:modelValue":S[0]||(S[0]=g=>Ce(l)?l.value=g:null),class:"wl-editor",placeholder:M.replyUser?`@${M.replyUser}`:D.value.placeholder,onKeydown:be,onDrop:rt,onPaste:mt},null,40,wd),[[dr,G(l)]]),Gn(F("div",bd,[kd,F("h4",null,ne(D.value.preview)+":",1),F("div",{class:"wl-content",innerHTML:z.value},null,8,xd)],512),[[dl,P.value]]),F("div",_d,[F("div",Cd,[F("a",$d,[se(G(Sf))]),Gn(F("button",{ref_key:"emojiButtonRef",ref:h,type:"button",class:pe(["wl-action",{active:j.value}]),title:D.value.emoji,onClick:S[1]||(S[1]=g=>j.value=!j.value)},[se(G(Ef))],10,Ed),[[dl,w.value.tabs.length]]),G(s).search?(L(),O("button",{key:0,ref_key:"gifButtonRef",ref:A,type:"button",class:pe(["wl-action",{active:N.value}]),title:D.value.gif,onClick:S[2]||(S[2]=g=>N.value=!N.value)},[se(G(Of))],10,Td)):Y("v-if",!0),F("input",{id:"wl-image-upload",ref_key:"imageUploadRef",ref:p,class:"upload",type:"file",accept:".png,.jpg,.jpeg,.webp,.bmp,.gif",onChange:Me},null,544),ge.value?(L(),O("label",{key:1,for:"wl-image-upload",class:"wl-action",title:D.value.uploadImage},[se(G(Tf))],8,Rd)):Y("v-if",!0),F("button",{type:"button",class:pe(["wl-action",{active:P.value}]),title:D.value.preview,onClick:S[3]||(S[3]=g=>P.value=!P.value)},[se(G(Af))],10,Ad)]),F("div",Sd,[Id,F("div",Ld,[Xe(ne(W.value)+" ",1),G(s).wordLimit?(L(),O("span",Md,[Xe(" / "),F("span",{class:pe({illegal:!oe.value}),textContent:ne(Q.value)},null,10,Od)])):Y("v-if",!0),Xe(" "+ne(D.value.word),1)]),G(s).login!=="disable"&&!ie.value?(L(),O("button",{key:0,type:"button",class:"wl-btn",onClick:ki,textContent:ne(D.value.login)},null,8,zd)):Y("v-if",!0),G(s).login!=="force"||ie.value?(L(),O("button",{key:1,type:"submit",class:"primary wl-btn",title:"Cmd|Ctrl + Enter",disabled:Ue.value,onClick:Wt},[Ue.value?(L(),Ye(G(xn),{key:0,size:16})):(L(),O(ae,{key:1},[Xe(ne(D.value.submit),1)],64))],8,jd)):Y("v-if",!0)]),F("div",{ref_key:"gifPopupRef",ref:x,class:pe(["wl-gif-popup",{display:N.value}])},[F("input",{ref_key:"gifSearchInputRef",ref:C,type:"text",placeholder:D.value.gifSearchPlaceholder,onInput:S[4]||(S[4]=(...g)=>G(qt)&&G(qt)(...g))},null,40,Pd),B.list.length?(L(),Ye(ad,{key:0,items:B.list,"column-width":200,gap:6,onInsert:S[5]||(S[5]=g=>he(g)),onScroll:Rt},null,8,["items"])):Y("v-if",!0),B.loading?(L(),O("div",Fd,[se(G(xn),{size:30})])):Y("v-if",!0)],2),F("div",{ref_key:"emojiPopupRef",ref:m,class:pe(["wl-emoji-popup",{display:j.value}])},[(L(!0),O(ae,null,Pe(w.value.tabs,(g,v)=>(L(),O(ae,{key:g.name},[v===T.value?(L(),O("div",Ud,[(L(!0),O(ae,null,Pe(g.items,y=>(L(),O("button",{key:y,type:"button",title:y,onClick:k=>he(`:${y}:`)},[j.value?(L(),O("img",{key:0,class:"wl-emoji",src:w.value.map[y],alt:y,loading:"lazy",referrerPolicy:"no-referrer"},null,8,Hd)):Y("v-if",!0)],8,Nd))),128))])):Y("v-if",!0)],64))),128)),w.value.tabs.length>1?(L(),O("div",Dd,[(L(!0),O(ae,null,Pe(w.value.tabs,(g,v)=>(L(),O("button",{key:g.name,type:"button",class:pe(["wl-tab",{active:T.value===v}]),onClick:y=>T.value=v},[F("img",{class:"wl-emoji",src:g.icon,alt:g.name,title:g.name,loading:"lazy",referrerPolicy:"no-referrer"},null,8,Bd)],10,Vd))),128))])):Y("v-if",!0)],2)])]),M.replyId||(d=M.edit)!=null&&d.objectId?(L(),O("button",{key:1,type:"button",class:"wl-close",title:D.value.cancelReply,onClick:S[6]||(S[6]=g=>M.$emit(M.replyId?"cancelReply":"cancelEdit"))},[se(G(io),{size:24})],8,Wd)):Y("v-if",!0)])}}}),ho=Cn(qd,[["__file","CommentBox.vue"]]);const Kd=["id"],Zd={class:"wl-user","aria-hidden":"true"},Gd=["src"],Qd={class:"wl-card"},Jd={class:"wl-head"},Yd=["href"],Xd={key:1,class:"wl-nick"},eh=["textContent"],th=["textContent"],nh=["textContent"],ih=["textContent"],rh=["textContent"],sh={class:"wl-comment-actions"},lh=["title"],oh=["title"],ah={class:"wl-meta","aria-hidden":"true"},ch=["data-value","textContent"],uh=["innerHTML"],fh={key:1,class:"wl-admin-actions"},dh={class:"wl-comment-status"},hh=["disabled","onClick","textContent"],ph={key:3,class:"wl-quote"};var gh=ln({__name:"CommentCard",props:{comment:{},edit:{default:null},rootId:{},reply:{default:null}},emits:["log","submit","delete","edit","like","status","sticky","reply"],setup(e,{emit:t}){const n=e,i=t,r=["approved","waiting","spam"],s=Xn("config"),l=so(),o=_u(),a=wi(),c=we(()=>s.value.locale),f=we(()=>{const{link:w}=n.comment;return w?Jr(w)?w:`https://${w}`:""}),p=we(()=>l.value.includes(n.comment.objectId)),h=we(()=>No(new Date(n.comment.time),o.value,c.value)),m=we(()=>a.value.type==="administrator"),A=we(()=>n.comment.user_id&&a.value.objectId===n.comment.user_id),x=we(()=>{var w;return n.comment.objectId===((w=n.reply)==null?void 0:w.objectId)}),C=we(()=>{var w;return n.comment.objectId===((w=n.edit)==null?void 0:w.objectId)});return(w,T)=>{var j;const N=Ua("CommentCard",!0);return L(),O("div",{id:w.comment.objectId,class:"wl-card-item"},[F("div",Zd,[w.comment.avatar?(L(),O("img",{key:0,class:"wl-user-avatar",src:w.comment.avatar},null,8,Gd)):Y("v-if",!0),w.comment.type?(L(),Ye(G(Mf),{key:1})):Y("v-if",!0)]),F("div",Qd,[F("div",Jd,[f.value?(L(),O("a",{key:0,class:"wl-nick",href:f.value,target:"_blank",rel:"nofollow noopener noreferrer"},ne(w.comment.nick),9,Yd)):(L(),O("span",Xd,ne(w.comment.nick),1)),w.comment.type==="administrator"?(L(),O("span",{key:2,class:"wl-badge",textContent:ne(c.value.admin)},null,8,eh)):Y("v-if",!0),w.comment.label?(L(),O("span",{key:3,class:"wl-badge",textContent:ne(w.comment.label)},null,8,th)):Y("v-if",!0),w.comment.sticky?(L(),O("span",{key:4,class:"wl-badge",textContent:ne(c.value.sticky)},null,8,nh)):Y("v-if",!0),typeof w.comment.level=="number"?(L(),O("span",{key:5,class:pe(`wl-badge level${w.comment.level}`),textContent:ne(c.value[`level${w.comment.level}`]||`Level ${w.comment.level}`)},null,10,ih)):Y("v-if",!0),F("span",{class:"wl-time",textContent:ne(h.value)},null,8,rh),F("div",sh,[m.value||A.value?(L(),O(ae,{key:0},[F("button",{type:"button",class:"wl-edit",onClick:T[0]||(T[0]=P=>i("edit",w.comment))},[se(G(Lf))]),F("button",{type:"button",class:"wl-delete",onClick:T[1]||(T[1]=P=>i("delete",w.comment))},[se(G($f))])],64)):Y("v-if",!0),F("button",{type:"button",class:"wl-like",title:p.value?c.value.cancelLike:c.value.like,onClick:T[2]||(T[2]=P=>i("like",w.comment))},[se(G(Rf),{active:p.value},null,8,["active"]),Xe(" "+ne("like"in w.comment?w.comment.like:""),1)],8,lh),F("button",{type:"button",class:pe(["wl-reply",{active:x.value}]),title:x.value?c.value.cancelReply:c.value.reply,onClick:T[3]||(T[3]=P=>i("reply",x.value?null:w.comment))},[se(G(If))],10,oh)])]),F("div",ah,[(L(),O(ae,null,Pe(["addr","browser","os"],P=>(L(),O(ae,null,[w.comment[P]?(L(),O("span",{key:P,class:pe(`wl-${P}`),"data-value":w.comment[P],textContent:ne(w.comment[P])},null,10,ch)):Y("v-if",!0)],64))),64))]),C.value?Y("v-if",!0):(L(),O("div",{key:0,class:"wl-content",innerHTML:w.comment.comment},null,8,uh)),m.value&&!C.value?(L(),O("div",fh,[F("span",dh,[(L(),O(ae,null,Pe(r,P=>F("button",{key:P,type:"submit",class:pe(`wl-btn wl-${P}`),disabled:w.comment.status===P,onClick:z=>i("status",{status:P,comment:w.comment}),textContent:ne(c.value[P])},null,10,hh)),64))]),m.value&&!("rid"in w.comment)?(L(),O("button",{key:0,type:"submit",class:"wl-btn wl-sticky",onClick:T[4]||(T[4]=P=>i("sticky",w.comment))},ne(w.comment.sticky?c.value.unsticky:c.value.sticky),1)):Y("v-if",!0)])):Y("v-if",!0),x.value||C.value?(L(),O("div",{key:2,class:pe({"wl-reply-wrapper":x.value,"wl-edit-wrapper":C.value})},[se(ho,{edit:w.edit,"reply-id":(j=w.reply)==null?void 0:j.objectId,"reply-user":w.comment.nick,"root-id":w.rootId,onLog:T[5]||(T[5]=P=>i("log")),onCancelReply:T[6]||(T[6]=P=>i("reply",null)),onCancelEdit:T[7]||(T[7]=P=>i("edit",null)),onSubmit:T[8]||(T[8]=P=>i("submit",P))},null,8,["edit","reply-id","reply-user","root-id"])],2)):Y("v-if",!0),"children"in w.comment?(L(),O("div",ph,[(L(!0),O(ae,null,Pe(w.comment.children,P=>(L(),Ye(N,{key:P.objectId,comment:P,reply:w.reply,edit:w.edit,"root-id":w.rootId,onLog:T[9]||(T[9]=z=>i("log")),onDelete:T[10]||(T[10]=z=>i("delete",z)),onEdit:T[11]||(T[11]=z=>i("edit",z)),onLike:T[12]||(T[12]=z=>i("like",z)),onReply:T[13]||(T[13]=z=>i("reply",z)),onStatus:T[14]||(T[14]=z=>i("status",z)),onSticky:T[15]||(T[15]=z=>i("sticky",z)),onSubmit:T[16]||(T[16]=z=>i("submit",z))},null,8,["comment","reply","edit","root-id"]))),128))])):Y("v-if",!0)])],8,Kd)}}}),mh=Cn(gh,[["__file","CommentCard.vue"]]);const po="3.1.0",vh={"data-waline":""},yh={class:"wl-meta-head"},wh={class:"wl-count"},bh=["textContent"],kh={class:"wl-sort"},xh=["onClick"],_h={class:"wl-cards"},Ch={key:1,class:"wl-operation"},$h=["textContent"],Eh={key:2,class:"wl-loading"},Th=["textContent"],Rh={key:4,class:"wl-operation"},Ah=["textContent"],Sh={key:5,class:"wl-power"},Ih=F("a",{href:"https://github.com/walinejs/waline",target:"_blank",rel:"noopener noreferrer"}," Waline ",-1);var Lh=ln({__name:"WalineComment",props:["serverURL","path","meta","requiredMeta","dark","commentSorting","lang","locale","pageSize","wordLimit","emoji","login","highlighter","texRenderer","imageUploader","search","copyright","recaptchaV3Key","turnstileKey","reaction"],setup(e){const t=e,n={latest:"insertedAt_desc",oldest:"insertedAt_asc",hottest:"like_desc"},i=Object.keys(n),r=wi(),s=so(),l=K("loading"),o=K(0),a=K(1),c=K(0),f=we(()=>Po(t)),p=K(f.value.commentSorting),h=K([]),m=K(null),A=K(null),x=we(()=>Fo(f.value.dark)),C=we(()=>f.value.locale);Eu(x,{id:"waline-darkmode"});let w;const T=q=>{var D;const{serverURL:ie,path:ge,pageSize:he}=f.value,be=new AbortController;l.value="loading",w==null||w(),Ar({serverURL:ie,lang:f.value.lang,path:ge,pageSize:he,sortBy:n[p.value],page:q,signal:be.signal,token:(D=r.value)==null?void 0:D.token}).then(ve=>{l.value="success",o.value=ve.count,h.value.push(...ve.data),a.value=q,c.value=ve.totalPages}).catch(ve=>{ve.name!=="AbortError"&&(console.error(ve.message),l.value="error")}),w=be.abort.bind(be)},j=()=>T(a.value+1),N=()=>{o.value=0,h.value=[],T(1)},P=q=>{p.value!==q&&(p.value=q,N())},z=q=>{m.value=q},W=q=>{A.value=q},B=q=>{if(A.value)A.value.comment=q.comment,A.value.orig=q.orig;else if("rid"in q){const D=h.value.find(({objectId:ie})=>ie===q.rid);if(!D)return;Array.isArray(D.children)||(D.children=[]),D.children.push(q)}else h.value.unshift(q),o.value+=1},Q=async({comment:q,status:D})=>{var ie;if(q.status===D)return;const{serverURL:ge,lang:he}=f.value;await Zt({serverURL:ge,lang:he,token:(ie=r.value)==null?void 0:ie.token,objectId:q.objectId,comment:{status:D}}),q.status=D},oe=async q=>{var D;if("rid"in q)return;const{serverURL:ie,lang:ge}=f.value;await Zt({serverURL:ie,lang:ge,token:(D=r.value)==null?void 0:D.token,objectId:q.objectId,comment:{sticky:q.sticky?0:1}}),q.sticky=!q.sticky},xe=async({objectId:q})=>{var D;if(!confirm("Are you sure you want to delete this comment?"))return;const{serverURL:ie,lang:ge}=f.value;await Ir({serverURL:ie,lang:ge,token:(D=r.value)==null?void 0:D.token,objectId:q}),h.value.some((he,be)=>he.objectId===q?(h.value=h.value.filter((ve,rt)=>rt!==be),!0):he.children.some((ve,rt)=>ve.objectId===q?(h.value[be].children=he.children.filter((mt,Me)=>Me!==rt),!0):!1))},Ue=async q=>{var D;const{serverURL:ie,lang:ge}=f.value,{objectId:he}=q,be=s.value.includes(he);await Zt({serverURL:ie,lang:ge,objectId:he,token:(D=r.value)==null?void 0:D.token,comment:{like:!be}}),be?s.value=s.value.filter(ve=>ve!==he):(s.value=[...s.value,he],s.value.length>50&&(s.value=s.value.slice(-50))),q.like=(q.like||0)+(be?-1:1)};return nc("config",f),on(()=>{je(()=>[t.serverURL,t.path],()=>N(),{immediate:!0})}),Jn(()=>w==null?void 0:w()),(q,D)=>(L(),O("div",vh,[se(nd),m.value?Y("v-if",!0):(L(),Ye(ho,{key:0,onLog:N,onSubmit:B})),F("div",yh,[F("div",wh,[o.value?(L(),O("span",{key:0,class:"wl-num",textContent:ne(o.value)},null,8,bh)):Y("v-if",!0),Xe(" "+ne(C.value.comment),1)]),F("ul",kh,[(L(!0),O(ae,null,Pe(G(i),ie=>(L(),O("li",{key:ie,class:pe([ie===p.value?"active":""]),onClick:ge=>P(ie)},ne(C.value[ie]),11,xh))),128))])]),F("div",_h,[(L(!0),O(ae,null,Pe(h.value,ie=>(L(),Ye(mh,{key:ie.objectId,"root-id":ie.objectId,comment:ie,reply:m.value,edit:A.value,onLog:N,onReply:z,onEdit:W,onSubmit:B,onStatus:Q,onDelete:xe,onSticky:oe,onLike:Ue},null,8,["root-id","comment","reply","edit"]))),128))]),l.value==="error"?(L(),O("div",Ch,[F("button",{type:"button",class:"wl-btn",onClick:N,textContent:ne(C.value.refresh)},null,8,$h)])):l.value==="loading"?(L(),O("div",Eh,[se(G(xn),{size:30})])):h.value.length?a.value<c.value?(L(),O("div",Rh,[F("button",{type:"button",class:"wl-btn",onClick:j,textContent:ne(C.value.more)},null,8,Ah)])):Y("v-if",!0):(L(),O("div",{key:3,class:"wl-empty",textContent:ne(C.value.sofa)},null,8,Th)),f.value.copyright?(L(),O("div",Sh,[Xe(" Powered by "),Ih,Xe(" v"+ne(G(po)),1)])):Y("v-if",!0)]))}}),Mh=Cn(Lh,[["__file","WalineComment.vue"]]);const go=(e,t)=>{t.forEach((n,i)=>{n.innerText=e[i].toString()})},mo=({serverURL:e,path:t=window.location.pathname,selector:n=".waline-pageview-count",update:i=!0,lang:r=navigator.language})=>{const s=new AbortController,l=Array.from(document.querySelectorAll(n)),o=c=>{const f=_r(c);return f!==null&&t!==f},a=c=>Or({serverURL:In(e),paths:c.map(f=>_r(f)||t),lang:r,signal:s.signal}).then(f=>go(f,c)).catch(Il);if(i){const c=l.filter(p=>!o(p)),f=l.filter(o);zr({serverURL:In(e),path:t,lang:r}).then(([p])=>go(new Array(c.length).fill(p),c)),f.length&&a(f)}else a(l);return s.abort.bind(s)},Oh=({el:e="#waline",path:t=window.location.pathname,comment:n=!1,pageview:i=!1,...r})=>{const s=e?pr(e):null;if(e&&!s)throw new Error("Option 'el' do not match any domElement!");if(!r.serverURL)throw new Error("Option 'serverURL' is missing!");const l=Xt({...r}),o=Xt({comment:n,pageview:i,path:t}),a=()=>{o.comment&&no({serverURL:l.serverURL,path:o.path,...It(o.comment)?{selector:o.comment}:{}})},c=()=>{o.pageview&&mo({serverURL:l.serverURL,path:o.path,...It(o.pageview)?{selector:o.pageview}:{}})},f=s?ru(()=>ee(Mh,{path:o.path,...l})):null;f&&f.mount(s);const p=Ns(a),h=Ns(c);return{el:s,update:({comment:m,pageview:A,path:x=window.location.pathname,...C}={})=>{Object.entries(C).forEach(([w,T])=>{l[w]=T}),o.path=x,m!==void 0&&(o.comment=m),A!==void 0&&(o.pageview=A)},destroy:()=>{f==null||f.unmount(),p(),h()}}},zh=({el:e,serverURL:t,count:n,lang:i=navigator.language})=>{var r;const s=wi(),l=pr(e),o=new AbortController;return jr({serverURL:t,count:n,lang:i,signal:o.signal,token:(r=s.value)==null?void 0:r.token}).then(a=>l&&a.length?(l.innerHTML=`<ul class="wl-recent-list">${a.map(c=>`<li class="wl-recent-item"><a href="${c.url}">${c.nick}</a>:${c.comment}</li>`).join("")}</ul>`,{comments:a,destroy:()=>{o.abort(),l.innerHTML=""}}):{comments:a,destroy:()=>o.abort()})},jh=({el:e,serverURL:t,count:n,locale:i,lang:r=navigator.language,mode:s="list"})=>{const l=pr(e),o=new AbortController;return Pr({serverURL:t,pageSize:n,lang:r,signal:o.signal}).then(a=>!l||!a.length?{users:a,destroy:()=>o.abort()}:(i={...Zr(r),...typeof i=="object"?i:{}},l.innerHTML=`<ul class="wl-user-${s}">${a.map((c,f)=>[`<li class="wl-user-item" aria-label="${c.nick}">`,c.link&&`<a href="${c.link}" target="_blank">`,'<div class="wl-user-avatar">',`<img src="${c.avatar}" alt="${c.nick}">`,`<span class="wl-user-badge">${f+1}</span>`,"</div>",'<div class="wl-user-meta">','<div class="wl-user-name">',c.nick,c.level&&`<span class="wl-badge">${i?i[`level${c.level}`]:`Level ${c.level}`}</span>`,c.label&&`<span class="wl-badge">${c.label}</span>`,"</div>",c.link&&c.link,"</div>",c.link&&"</a>","</li>"].filter(p=>p).join("")).join("")}</ul>`,{users:a,destroy:()=>{o.abort(),l.innerHTML=""}}))};export{zh as RecentComments,jh as UserList,Sr as addComment,no as commentCount,Sn as defaultLocales,Ir as deleteComment,Lr as fetchCommentCount,Ci as getArticleCounter,Ar as getComment,Or as getPageview,jr as getRecentComment,Pr as getUserList,Oh as init,Mr as login,mo as pageviewCount,An as updateArticleCounter,Zt as updateComment,zr as updatePageview,po as version};
|
|
71
|
+
`)}).catch(u=>{alert(u.message),l.value=l.value.replace(S,"")}).then(()=>{Ue.value=!1})},rt=M=>{var S;if((S=M.dataTransfer)!=null&&S.items){const u=Ll(M.dataTransfer.items);u&&ge.value&&(ve(u),M.preventDefault())}},mt=M=>{if(M.clipboardData){const S=Ll(M.clipboardData.items);S&&ge.value&&ve(S)}},Me=()=>{const M=p.value;M.files&&ge.value&&ve(M.files[0]).then(()=>{M.value=""})},Wt=async()=>{var M,S,u,d,g,v;const{serverURL:y,lang:k,login:E,wordLimit:_,requiredMeta:$,recaptchaV3Key:b,turnstileKey:I}=s.value,U=await Cf(),R={comment:xe.value,nick:o.value.nick,mail:o.value.mail,link:o.value.link,url:s.value.path,ua:U};if((M=a.value)!=null&&M.token&&!i.edit)R.nick=a.value.display_name,R.mail=a.value.email,R.link=a.value.url;else{if(E==="force")return;if($.indexOf("nick")>-1&&!R.nick)return(S=c.value.nick)==null||S.focus(),alert(D.value.nickError);if($.indexOf("mail")>-1&&!R.mail||R.mail&&!Do(R.mail))return(u=c.value.mail)==null||u.focus(),alert(D.value.mailError);R.nick||(R.nick=D.value.anonymous)}if(!R.comment){(d=f.value)==null||d.focus();return}if(!oe.value)return alert(D.value.wordHint.replace("$0",_[0].toString()).replace("$1",_[1].toString()).replace("$2",W.value.toString()));R.comment=to(R.comment,w.value.map),i.replyId&&i.rootId&&(R.pid=i.replyId,R.rid=i.rootId,R.at=i.replyUser),Ue.value=!0;try{b&&(R.recaptchaV3=await Bf(b).execute("social")),I&&(R.turnstile=await Wf(I).execute("social"));const H={serverURL:y,lang:k,token:(g=a.value)==null?void 0:g.token,comment:R},Z=await(i.edit?Zt({objectId:i.edit.objectId,...H}):Sr(H));if(Ue.value=!1,Z.errmsg)return alert(Z.errmsg);r("submit",Z.data),l.value="",z.value="",i.replyId&&r("cancelReply"),(v=i.edit)!=null&&v.objectId&&r("cancelEdit")}catch(H){Ue.value=!1,alert(H.message)}},ki=M=>{M.preventDefault();const{lang:S,serverURL:u}=s.value;Mr({serverURL:u,lang:S}).then(d=>{a.value=d,(d.remember?localStorage:sessionStorage).setItem("WALINE_USER",JSON.stringify(d)),r("log")})},xi=()=>{a.value={},localStorage.setItem("WALINE_USER","null"),sessionStorage.setItem("WALINE_USER","null"),r("log")},Oe=M=>{M.preventDefault();const{lang:S,serverURL:u}=s.value,d=800,g=800,v=(window.innerWidth-d)/2,y=(window.innerHeight-g)/2,k=new URLSearchParams({lng:S,token:a.value.token}),E=window.open(`${u}/ui/profile?${k.toString()}`,"_blank",`width=${d},height=${g},left=${v},top=${y},scrollbars=no,resizable=no,status=no,location=no,toolbar=no,menubar=no`);E==null||E.postMessage({type:"TOKEN",data:a.value.token},"*")},vt=M=>{var S,u,d,g;!((S=h.value)!=null&&S.contains(M.target))&&!((u=m.value)!=null&&u.contains(M.target))&&(j.value=!1),!((d=A.value)!=null&&d.contains(M.target))&&!((g=x.value)!=null&&g.contains(M.target))&&(N.value=!1)},Rt=async M=>{var S;const{scrollTop:u,clientHeight:d,scrollHeight:g}=M.target,v=(d+u)/g,y=s.value.search,k=((S=C.value)==null?void 0:S.value)||"";v<.9||B.loading||q.value||(B.loading=!0,(y.more&&B.list.length?await y.more(k,B.list.length):await y.search(k)).length?B.list=[...B.list,...y.more&&B.list.length?await y.more(k,B.list.length):await y.search(k)]:q.value=!0,B.loading=!1,setTimeout(()=>{M.target.scrollTop=u},50))},qt=fu(M=>{B.list=[],q.value=!1,Rt(M)},300);je([s,W],([M,S])=>{const{wordLimit:u}=M;u?S<u[0]&&u[0]!==0?(Q.value=u[0],oe.value=!1):S>u[1]?(Q.value=u[1],oe.value=!1):(Q.value=u[1],oe.value=!0):(Q.value=0,oe.value=!0)},{immediate:!0});const Ze=({data:M})=>{!M||M.type!=="profile"||(a.value={...a.value,...M.data},[localStorage,sessionStorage].filter(S=>S.getItem("WALINE_USER")).forEach(S=>S.setItem("WALINE_USER",JSON.stringify(a))))};return on(()=>{var M;document.body.addEventListener("click",vt),window.addEventListener("message",Ze),(M=i.edit)!=null&&M.objectId&&(l.value=i.edit.orig),je(N,async S=>{if(!S)return;const u=s.value.search;C.value&&(C.value.value=""),B.loading=!0,B.list=u.default?await u.default():await u.search(""),B.loading=!1}),je(()=>l.value,S=>{const{highlighter:u,texRenderer:d}=s.value;xe.value=S,z.value=bf(S,{emojiMap:w.value.map,highlighter:u,texRenderer:d}),W.value=_f(S),S?fo(f.value):fo.destroy(f.value)},{immediate:!0}),je(()=>s.value.emoji,S=>Au(S).then(u=>{w.value=u}),{immediate:!0})}),Jn(()=>{document.body.removeEventListener("click",vt),window.removeEventListener("message",Ze)}),(M,S)=>{var u,d;return L(),O("div",cd,[G(s).login!=="disable"&&ie.value&&!((u=M.edit)!=null&&u.objectId)?(L(),O("div",ud,[F("div",fd,[F("button",{type:"submit",class:"wl-logout-btn",title:D.value.logout,onClick:xi},[se(G(io),{size:14})],8,dd),F("a",{href:"#",class:"wl-login-nick","aria-label":"Profile",title:D.value.profile,onClick:Oe},[F("img",{src:G(a).avatar,alt:"avatar"},null,8,pd)],8,hd)]),F("a",{href:"#",class:"wl-login-nick","aria-label":"Profile",title:D.value.profile,onClick:Oe,textContent:ne(G(a).display_name)},null,8,gd)])):Y("v-if",!0),F("div",md,[G(s).login!=="force"&&G(s).meta.length&&!ie.value?(L(),O("div",{key:0,class:pe(["wl-header",`item${G(s).meta.length}`])},[(L(!0),O(ae,null,Pe(G(s).meta,g=>(L(),O("div",{key:g,class:"wl-header-item"},[F("label",{for:`wl-${g}`,textContent:ne(D.value[g]+(G(s).requiredMeta.includes(g)||!G(s).requiredMeta.length?"":`(${D.value.optional})`))},null,8,vd),Gn(F("input",{id:`wl-${g}`,ref_for:!0,ref:v=>{v&&(c.value[g]=v)},"onUpdate:modelValue":v=>G(o)[g]=v,class:pe(["wl-input",`wl-${g}`]),name:g,type:g==="mail"?"email":"text"},null,10,yd),[[eu,G(o)[g]]])]))),128))],2)):Y("v-if",!0),Gn(F("textarea",{id:"wl-edit",ref_key:"editorRef",ref:f,"onUpdate:modelValue":S[0]||(S[0]=g=>Ce(l)?l.value=g:null),class:"wl-editor",placeholder:M.replyUser?`@${M.replyUser}`:D.value.placeholder,onKeydown:be,onDrop:rt,onPaste:mt},null,40,wd),[[dr,G(l)]]),Gn(F("div",bd,[kd,F("h4",null,ne(D.value.preview)+":",1),F("div",{class:"wl-content",innerHTML:z.value},null,8,xd)],512),[[dl,P.value]]),F("div",_d,[F("div",Cd,[F("a",$d,[se(G(Sf))]),Gn(F("button",{ref_key:"emojiButtonRef",ref:h,type:"button",class:pe(["wl-action",{active:j.value}]),title:D.value.emoji,onClick:S[1]||(S[1]=g=>j.value=!j.value)},[se(G(Ef))],10,Ed),[[dl,w.value.tabs.length]]),G(s).search?(L(),O("button",{key:0,ref_key:"gifButtonRef",ref:A,type:"button",class:pe(["wl-action",{active:N.value}]),title:D.value.gif,onClick:S[2]||(S[2]=g=>N.value=!N.value)},[se(G(Of))],10,Td)):Y("v-if",!0),F("input",{id:"wl-image-upload",ref_key:"imageUploadRef",ref:p,class:"upload",type:"file",accept:".png,.jpg,.jpeg,.webp,.bmp,.gif",onChange:Me},null,544),ge.value?(L(),O("label",{key:1,for:"wl-image-upload",class:"wl-action",title:D.value.uploadImage},[se(G(Tf))],8,Rd)):Y("v-if",!0),F("button",{type:"button",class:pe(["wl-action",{active:P.value}]),title:D.value.preview,onClick:S[3]||(S[3]=g=>P.value=!P.value)},[se(G(Af))],10,Ad)]),F("div",Sd,[Id,F("div",Ld,[Xe(ne(W.value)+" ",1),G(s).wordLimit?(L(),O("span",Md,[Xe(" / "),F("span",{class:pe({illegal:!oe.value}),textContent:ne(Q.value)},null,10,Od)])):Y("v-if",!0),Xe(" "+ne(D.value.word),1)]),G(s).login!=="disable"&&!ie.value?(L(),O("button",{key:0,type:"button",class:"wl-btn",onClick:ki,textContent:ne(D.value.login)},null,8,zd)):Y("v-if",!0),G(s).login!=="force"||ie.value?(L(),O("button",{key:1,type:"submit",class:"primary wl-btn",title:"Cmd|Ctrl + Enter",disabled:Ue.value,onClick:Wt},[Ue.value?(L(),Ye(G(xn),{key:0,size:16})):(L(),O(ae,{key:1},[Xe(ne(D.value.submit),1)],64))],8,jd)):Y("v-if",!0)]),F("div",{ref_key:"gifPopupRef",ref:x,class:pe(["wl-gif-popup",{display:N.value}])},[F("input",{ref_key:"gifSearchInputRef",ref:C,type:"text",placeholder:D.value.gifSearchPlaceholder,onInput:S[4]||(S[4]=(...g)=>G(qt)&&G(qt)(...g))},null,40,Pd),B.list.length?(L(),Ye(ad,{key:0,items:B.list,"column-width":200,gap:6,onInsert:S[5]||(S[5]=g=>he(g)),onScroll:Rt},null,8,["items"])):Y("v-if",!0),B.loading?(L(),O("div",Fd,[se(G(xn),{size:30})])):Y("v-if",!0)],2),F("div",{ref_key:"emojiPopupRef",ref:m,class:pe(["wl-emoji-popup",{display:j.value}])},[(L(!0),O(ae,null,Pe(w.value.tabs,(g,v)=>(L(),O(ae,{key:g.name},[v===T.value?(L(),O("div",Ud,[(L(!0),O(ae,null,Pe(g.items,y=>(L(),O("button",{key:y,type:"button",title:y,onClick:k=>he(`:${y}:`)},[j.value?(L(),O("img",{key:0,class:"wl-emoji",src:w.value.map[y],alt:y,loading:"lazy",referrerPolicy:"no-referrer"},null,8,Hd)):Y("v-if",!0)],8,Nd))),128))])):Y("v-if",!0)],64))),128)),w.value.tabs.length>1?(L(),O("div",Dd,[(L(!0),O(ae,null,Pe(w.value.tabs,(g,v)=>(L(),O("button",{key:g.name,type:"button",class:pe(["wl-tab",{active:T.value===v}]),onClick:y=>T.value=v},[F("img",{class:"wl-emoji",src:g.icon,alt:g.name,title:g.name,loading:"lazy",referrerPolicy:"no-referrer"},null,8,Bd)],10,Vd))),128))])):Y("v-if",!0)],2)])]),M.replyId||(d=M.edit)!=null&&d.objectId?(L(),O("button",{key:1,type:"button",class:"wl-close",title:D.value.cancelReply,onClick:S[6]||(S[6]=g=>M.$emit(M.replyId?"cancelReply":"cancelEdit"))},[se(G(io),{size:24})],8,Wd)):Y("v-if",!0)])}}}),ho=Cn(qd,[["__file","CommentBox.vue"]]);const Kd=["id"],Zd={class:"wl-user","aria-hidden":"true"},Gd=["src"],Qd={class:"wl-card"},Jd={class:"wl-head"},Yd=["href"],Xd={key:1,class:"wl-nick"},eh=["textContent"],th=["textContent"],nh=["textContent"],ih=["textContent"],rh=["textContent"],sh={class:"wl-comment-actions"},lh=["title"],oh=["title"],ah={class:"wl-meta","aria-hidden":"true"},ch=["data-value","textContent"],uh=["innerHTML"],fh={key:1,class:"wl-admin-actions"},dh={class:"wl-comment-status"},hh=["disabled","onClick","textContent"],ph={key:3,class:"wl-quote"};var gh=ln({__name:"CommentCard",props:{comment:{},edit:{default:null},rootId:{},reply:{default:null}},emits:["log","submit","delete","edit","like","status","sticky","reply"],setup(e,{emit:t}){const n=e,i=t,r=["approved","waiting","spam"],s=Xn("config"),l=so(),o=_u(),a=wi(),c=we(()=>s.value.locale),f=we(()=>{const{link:w}=n.comment;return w?Jr(w)?w:`https://${w}`:""}),p=we(()=>l.value.includes(n.comment.objectId)),h=we(()=>No(new Date(n.comment.time),o.value,c.value)),m=we(()=>a.value.type==="administrator"),A=we(()=>n.comment.user_id&&a.value.objectId===n.comment.user_id),x=we(()=>{var w;return n.comment.objectId===((w=n.reply)==null?void 0:w.objectId)}),C=we(()=>{var w;return n.comment.objectId===((w=n.edit)==null?void 0:w.objectId)});return(w,T)=>{var j;const N=Ua("CommentCard",!0);return L(),O("div",{id:w.comment.objectId,class:"wl-card-item"},[F("div",Zd,[w.comment.avatar?(L(),O("img",{key:0,class:"wl-user-avatar",src:w.comment.avatar},null,8,Gd)):Y("v-if",!0),w.comment.type?(L(),Ye(G(Mf),{key:1})):Y("v-if",!0)]),F("div",Qd,[F("div",Jd,[f.value?(L(),O("a",{key:0,class:"wl-nick",href:f.value,target:"_blank",rel:"nofollow noopener noreferrer"},ne(w.comment.nick),9,Yd)):(L(),O("span",Xd,ne(w.comment.nick),1)),w.comment.type==="administrator"?(L(),O("span",{key:2,class:"wl-badge",textContent:ne(c.value.admin)},null,8,eh)):Y("v-if",!0),w.comment.label?(L(),O("span",{key:3,class:"wl-badge",textContent:ne(w.comment.label)},null,8,th)):Y("v-if",!0),w.comment.sticky?(L(),O("span",{key:4,class:"wl-badge",textContent:ne(c.value.sticky)},null,8,nh)):Y("v-if",!0),typeof w.comment.level=="number"?(L(),O("span",{key:5,class:pe(`wl-badge level${w.comment.level}`),textContent:ne(c.value[`level${w.comment.level}`]||`Level ${w.comment.level}`)},null,10,ih)):Y("v-if",!0),F("span",{class:"wl-time",textContent:ne(h.value)},null,8,rh),F("div",sh,[m.value||A.value?(L(),O(ae,{key:0},[F("button",{type:"button",class:"wl-edit",onClick:T[0]||(T[0]=P=>i("edit",w.comment))},[se(G(Lf))]),F("button",{type:"button",class:"wl-delete",onClick:T[1]||(T[1]=P=>i("delete",w.comment))},[se(G($f))])],64)):Y("v-if",!0),F("button",{type:"button",class:"wl-like",title:p.value?c.value.cancelLike:c.value.like,onClick:T[2]||(T[2]=P=>i("like",w.comment))},[se(G(Rf),{active:p.value},null,8,["active"]),Xe(" "+ne("like"in w.comment?w.comment.like:""),1)],8,lh),F("button",{type:"button",class:pe(["wl-reply",{active:x.value}]),title:x.value?c.value.cancelReply:c.value.reply,onClick:T[3]||(T[3]=P=>i("reply",x.value?null:w.comment))},[se(G(If))],10,oh)])]),F("div",ah,[(L(),O(ae,null,Pe(["addr","browser","os"],P=>(L(),O(ae,null,[w.comment[P]?(L(),O("span",{key:P,class:pe(`wl-${P}`),"data-value":w.comment[P],textContent:ne(w.comment[P])},null,10,ch)):Y("v-if",!0)],64))),64))]),C.value?Y("v-if",!0):(L(),O("div",{key:0,class:"wl-content",innerHTML:w.comment.comment},null,8,uh)),m.value&&!C.value?(L(),O("div",fh,[F("span",dh,[(L(),O(ae,null,Pe(r,P=>F("button",{key:P,type:"submit",class:pe(`wl-btn wl-${P}`),disabled:w.comment.status===P,onClick:z=>i("status",{status:P,comment:w.comment}),textContent:ne(c.value[P])},null,10,hh)),64))]),m.value&&!("rid"in w.comment)?(L(),O("button",{key:0,type:"submit",class:"wl-btn wl-sticky",onClick:T[4]||(T[4]=P=>i("sticky",w.comment))},ne(w.comment.sticky?c.value.unsticky:c.value.sticky),1)):Y("v-if",!0)])):Y("v-if",!0),x.value||C.value?(L(),O("div",{key:2,class:pe({"wl-reply-wrapper":x.value,"wl-edit-wrapper":C.value})},[se(ho,{edit:w.edit,"reply-id":(j=w.reply)==null?void 0:j.objectId,"reply-user":w.comment.nick,"root-id":w.rootId,onLog:T[5]||(T[5]=P=>i("log")),onCancelReply:T[6]||(T[6]=P=>i("reply",null)),onCancelEdit:T[7]||(T[7]=P=>i("edit",null)),onSubmit:T[8]||(T[8]=P=>i("submit",P))},null,8,["edit","reply-id","reply-user","root-id"])],2)):Y("v-if",!0),"children"in w.comment?(L(),O("div",ph,[(L(!0),O(ae,null,Pe(w.comment.children,P=>(L(),Ye(N,{key:P.objectId,comment:P,reply:w.reply,edit:w.edit,"root-id":w.rootId,onLog:T[9]||(T[9]=z=>i("log")),onDelete:T[10]||(T[10]=z=>i("delete",z)),onEdit:T[11]||(T[11]=z=>i("edit",z)),onLike:T[12]||(T[12]=z=>i("like",z)),onReply:T[13]||(T[13]=z=>i("reply",z)),onStatus:T[14]||(T[14]=z=>i("status",z)),onSticky:T[15]||(T[15]=z=>i("sticky",z)),onSubmit:T[16]||(T[16]=z=>i("submit",z))},null,8,["comment","reply","edit","root-id"]))),128))])):Y("v-if",!0)])],8,Kd)}}}),mh=Cn(gh,[["__file","CommentCard.vue"]]);const po="3.1.1",vh={"data-waline":""},yh={class:"wl-meta-head"},wh={class:"wl-count"},bh=["textContent"],kh={class:"wl-sort"},xh=["onClick"],_h={class:"wl-cards"},Ch={key:1,class:"wl-operation"},$h=["textContent"],Eh={key:2,class:"wl-loading"},Th=["textContent"],Rh={key:4,class:"wl-operation"},Ah=["textContent"],Sh={key:5,class:"wl-power"},Ih=F("a",{href:"https://github.com/walinejs/waline",target:"_blank",rel:"noopener noreferrer"}," Waline ",-1);var Lh=ln({__name:"WalineComment",props:["serverURL","path","meta","requiredMeta","dark","commentSorting","lang","locale","pageSize","wordLimit","emoji","login","highlighter","texRenderer","imageUploader","search","copyright","recaptchaV3Key","turnstileKey","reaction"],setup(e){const t=e,n={latest:"insertedAt_desc",oldest:"insertedAt_asc",hottest:"like_desc"},i=Object.keys(n),r=wi(),s=so(),l=K("loading"),o=K(0),a=K(1),c=K(0),f=we(()=>Po(t)),p=K(f.value.commentSorting),h=K([]),m=K(null),A=K(null),x=we(()=>Fo(f.value.dark)),C=we(()=>f.value.locale);Eu(x,{id:"waline-darkmode"});let w;const T=q=>{var D;const{serverURL:ie,path:ge,pageSize:he}=f.value,be=new AbortController;l.value="loading",w==null||w(),Ar({serverURL:ie,lang:f.value.lang,path:ge,pageSize:he,sortBy:n[p.value],page:q,signal:be.signal,token:(D=r.value)==null?void 0:D.token}).then(ve=>{l.value="success",o.value=ve.count,h.value.push(...ve.data),a.value=q,c.value=ve.totalPages}).catch(ve=>{ve.name!=="AbortError"&&(console.error(ve.message),l.value="error")}),w=be.abort.bind(be)},j=()=>T(a.value+1),N=()=>{o.value=0,h.value=[],T(1)},P=q=>{p.value!==q&&(p.value=q,N())},z=q=>{m.value=q},W=q=>{A.value=q},B=q=>{if(A.value)A.value.comment=q.comment,A.value.orig=q.orig;else if("rid"in q){const D=h.value.find(({objectId:ie})=>ie===q.rid);if(!D)return;Array.isArray(D.children)||(D.children=[]),D.children.push(q)}else h.value.unshift(q),o.value+=1},Q=async({comment:q,status:D})=>{var ie;if(q.status===D)return;const{serverURL:ge,lang:he}=f.value;await Zt({serverURL:ge,lang:he,token:(ie=r.value)==null?void 0:ie.token,objectId:q.objectId,comment:{status:D}}),q.status=D},oe=async q=>{var D;if("rid"in q)return;const{serverURL:ie,lang:ge}=f.value;await Zt({serverURL:ie,lang:ge,token:(D=r.value)==null?void 0:D.token,objectId:q.objectId,comment:{sticky:q.sticky?0:1}}),q.sticky=!q.sticky},xe=async({objectId:q})=>{var D;if(!confirm("Are you sure you want to delete this comment?"))return;const{serverURL:ie,lang:ge}=f.value;await Ir({serverURL:ie,lang:ge,token:(D=r.value)==null?void 0:D.token,objectId:q}),h.value.some((he,be)=>he.objectId===q?(h.value=h.value.filter((ve,rt)=>rt!==be),!0):he.children.some((ve,rt)=>ve.objectId===q?(h.value[be].children=he.children.filter((mt,Me)=>Me!==rt),!0):!1))},Ue=async q=>{var D;const{serverURL:ie,lang:ge}=f.value,{objectId:he}=q,be=s.value.includes(he);await Zt({serverURL:ie,lang:ge,objectId:he,token:(D=r.value)==null?void 0:D.token,comment:{like:!be}}),be?s.value=s.value.filter(ve=>ve!==he):(s.value=[...s.value,he],s.value.length>50&&(s.value=s.value.slice(-50))),q.like=(q.like||0)+(be?-1:1)};return nc("config",f),on(()=>{je(()=>[t.serverURL,t.path],()=>N(),{immediate:!0})}),Jn(()=>w==null?void 0:w()),(q,D)=>(L(),O("div",vh,[se(nd),m.value?Y("v-if",!0):(L(),Ye(ho,{key:0,onLog:N,onSubmit:B})),F("div",yh,[F("div",wh,[o.value?(L(),O("span",{key:0,class:"wl-num",textContent:ne(o.value)},null,8,bh)):Y("v-if",!0),Xe(" "+ne(C.value.comment),1)]),F("ul",kh,[(L(!0),O(ae,null,Pe(G(i),ie=>(L(),O("li",{key:ie,class:pe([ie===p.value?"active":""]),onClick:ge=>P(ie)},ne(C.value[ie]),11,xh))),128))])]),F("div",_h,[(L(!0),O(ae,null,Pe(h.value,ie=>(L(),Ye(mh,{key:ie.objectId,"root-id":ie.objectId,comment:ie,reply:m.value,edit:A.value,onLog:N,onReply:z,onEdit:W,onSubmit:B,onStatus:Q,onDelete:xe,onSticky:oe,onLike:Ue},null,8,["root-id","comment","reply","edit"]))),128))]),l.value==="error"?(L(),O("div",Ch,[F("button",{type:"button",class:"wl-btn",onClick:N,textContent:ne(C.value.refresh)},null,8,$h)])):l.value==="loading"?(L(),O("div",Eh,[se(G(xn),{size:30})])):h.value.length?a.value<c.value?(L(),O("div",Rh,[F("button",{type:"button",class:"wl-btn",onClick:j,textContent:ne(C.value.more)},null,8,Ah)])):Y("v-if",!0):(L(),O("div",{key:3,class:"wl-empty",textContent:ne(C.value.sofa)},null,8,Th)),f.value.copyright?(L(),O("div",Sh,[Xe(" Powered by "),Ih,Xe(" v"+ne(G(po)),1)])):Y("v-if",!0)]))}}),Mh=Cn(Lh,[["__file","WalineComment.vue"]]);const go=(e,t)=>{t.forEach((n,i)=>{const r=e[i].time;typeof r=="number"&&(n.innerText=r.toString())})},mo=({serverURL:e,path:t=window.location.pathname,selector:n=".waline-pageview-count",update:i=!0,lang:r=navigator.language})=>{const s=new AbortController,l=Array.from(document.querySelectorAll(n)),o=c=>{const f=_r(c);return f!==null&&t!==f},a=c=>Or({serverURL:In(e),paths:c.map(f=>_r(f)||t),lang:r,signal:s.signal}).then(f=>go(f,c)).catch(Il);if(i){const c=l.filter(p=>!o(p)),f=l.filter(o);zr({serverURL:In(e),path:t,lang:r}).then(p=>go(p,c)),f.length&&a(f)}else a(l);return s.abort.bind(s)},Oh=({el:e="#waline",path:t=window.location.pathname,comment:n=!1,pageview:i=!1,...r})=>{const s=e?pr(e):null;if(e&&!s)throw new Error("Option 'el' do not match any domElement!");if(!r.serverURL)throw new Error("Option 'serverURL' is missing!");const l=Xt({...r}),o=Xt({comment:n,pageview:i,path:t}),a=()=>{o.comment&&no({serverURL:l.serverURL,path:o.path,...It(o.comment)?{selector:o.comment}:{}})},c=()=>{o.pageview&&mo({serverURL:l.serverURL,path:o.path,...It(o.pageview)?{selector:o.pageview}:{}})},f=s?ru(()=>ee(Mh,{path:o.path,...l})):null;f&&f.mount(s);const p=Ns(a),h=Ns(c);return{el:s,update:({comment:m,pageview:A,path:x=window.location.pathname,...C}={})=>{Object.entries(C).forEach(([w,T])=>{l[w]=T}),o.path=x,m!==void 0&&(o.comment=m),A!==void 0&&(o.pageview=A)},destroy:()=>{f==null||f.unmount(),p(),h()}}},zh=({el:e,serverURL:t,count:n,lang:i=navigator.language})=>{var r;const s=wi(),l=pr(e),o=new AbortController;return jr({serverURL:t,count:n,lang:i,signal:o.signal,token:(r=s.value)==null?void 0:r.token}).then(a=>l&&a.length?(l.innerHTML=`<ul class="wl-recent-list">${a.map(c=>`<li class="wl-recent-item"><a href="${c.url}">${c.nick}</a>:${c.comment}</li>`).join("")}</ul>`,{comments:a,destroy:()=>{o.abort(),l.innerHTML=""}}):{comments:a,destroy:()=>o.abort()})},jh=({el:e,serverURL:t,count:n,locale:i,lang:r=navigator.language,mode:s="list"})=>{const l=pr(e),o=new AbortController;return Pr({serverURL:t,pageSize:n,lang:r,signal:o.signal}).then(a=>!l||!a.length?{users:a,destroy:()=>o.abort()}:(i={...Zr(r),...typeof i=="object"?i:{}},l.innerHTML=`<ul class="wl-user-${s}">${a.map((c,f)=>[`<li class="wl-user-item" aria-label="${c.nick}">`,c.link&&`<a href="${c.link}" target="_blank">`,'<div class="wl-user-avatar">',`<img src="${c.avatar}" alt="${c.nick}">`,`<span class="wl-user-badge">${f+1}</span>`,"</div>",'<div class="wl-user-meta">','<div class="wl-user-name">',c.nick,c.level&&`<span class="wl-badge">${i?i[`level${c.level}`]:`Level ${c.level}`}</span>`,c.label&&`<span class="wl-badge">${c.label}</span>`,"</div>",c.link&&c.link,"</div>",c.link&&"</a>","</li>"].filter(p=>p).join("")).join("")}</ul>`,{users:a,destroy:()=>{o.abort(),l.innerHTML=""}}))};export{zh as RecentComments,jh as UserList,Sr as addComment,no as commentCount,Sn as defaultLocales,Ir as deleteComment,Lr as fetchCommentCount,Ci as getArticleCounter,Ar as getComment,Or as getPageview,jr as getRecentComment,Pr as getUserList,Oh as init,Mr as login,mo as pageviewCount,An as updateArticleCounter,Zt as updateComment,zr as updatePageview,po as version};
|
|
72
72
|
//# sourceMappingURL=waline.js.map
|