@waline/client 2.10.0 → 2.11.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.
Files changed (48) hide show
  1. package/dist/component.mjs +1 -1
  2. package/dist/component.mjs.map +1 -1
  3. package/dist/legacy.umd.d.ts +14 -0
  4. package/dist/legacy.umd.js +1 -1
  5. package/dist/legacy.umd.js.map +1 -1
  6. package/dist/pageview.cjs +1 -1
  7. package/dist/pageview.cjs.map +1 -1
  8. package/dist/pageview.js +1 -1
  9. package/dist/pageview.js.map +1 -1
  10. package/dist/pageview.mjs +1 -1
  11. package/dist/pageview.mjs.map +1 -1
  12. package/dist/shim.cjs +1 -1
  13. package/dist/shim.cjs.map +1 -1
  14. package/dist/shim.d.cts +14 -0
  15. package/dist/shim.d.mts +14 -0
  16. package/dist/shim.mjs +1 -1
  17. package/dist/shim.mjs.map +1 -1
  18. package/dist/waline.cjs +1 -1
  19. package/dist/waline.cjs.map +1 -1
  20. package/dist/waline.css +1 -1
  21. package/dist/waline.css.map +1 -1
  22. package/dist/waline.d.cts +14 -0
  23. package/dist/waline.d.mts +14 -0
  24. package/dist/waline.d.ts +14 -0
  25. package/dist/waline.js +1 -1
  26. package/dist/waline.js.map +1 -1
  27. package/dist/waline.mjs +1 -1
  28. package/dist/waline.mjs.map +1 -1
  29. package/package.json +5 -5
  30. package/src/components/ArticleReaction.vue +141 -0
  31. package/src/components/Waline.vue +13 -0
  32. package/src/composables/vote.ts +17 -0
  33. package/src/config/default.ts +9 -0
  34. package/src/config/i18n/en.ts +1 -0
  35. package/src/config/i18n/generate.ts +1 -0
  36. package/src/config/i18n/jp.ts +1 -0
  37. package/src/config/i18n/pt-BR.ts +1 -0
  38. package/src/config/i18n/ru.ts +1 -0
  39. package/src/config/i18n/vi-VN.ts +1 -0
  40. package/src/config/i18n/zh-CN.ts +1 -0
  41. package/src/config/i18n/zh-TW.ts +1 -0
  42. package/src/styles/card.scss +3 -1
  43. package/src/styles/index.scss +1 -0
  44. package/src/styles/reaction.scss +66 -0
  45. package/src/typings/locale.ts +10 -0
  46. package/src/typings/waline.ts +6 -1
  47. package/src/utils/config.ts +5 -1
  48. package/src/utils/fetch.ts +48 -14
package/dist/shim.cjs CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@vueuse/core"),t=require("vue"),n=require("autosize"),o=require("marked");function a(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var l=a(n);const r=["nick","mail","link"],i=e=>e.filter((e=>r.includes(e))),c=e=>new Promise(((t,n)=>{if(e.size>128e3)return n(new Error("File too large! File size limit 128KB"));const o=new FileReader;o.readAsDataURL(e),o.onload=()=>t(o.result?.toString()||""),o.onerror=n})),s=e=>!0===e?'<p class="wl-tex">Tex is not available in preview</p>':'<span class="wl-tex">Tex is not available in preview</span>',m=()=>{const e={next:""},t=({keyword:e,pos:t})=>{const n=new URLSearchParams("media_filter=minimal");return n.set("key","PAY5JLFIH6V6"),n.set("limit","20"),n.set("pos",t||""),n.set("q",e),fetch(`https://g.tenor.com/v1/search?${n.toString()}`,{headers:{"Content-Type":"application/json"}}).then((e=>e.json())).catch((()=>({next:t||"",results:[]})))};return{search:(n="")=>t({keyword:n}).then((t=>(e.next=t.next,t.results.map((e=>({title:e.title,src:e.media[0].tinygif.url})))))),more:n=>t({keyword:n,pos:e.next}).then((t=>(e.next=t.next,t.results.map((e=>({title:e.title,src:e.media[0].tinygif.url}))))))}},d=new RegExp(`(${/[\u4E00-\u9FFF\u3400-\u4dbf\uf900-\ufaff\u3040-\u309f\uac00-\ud7af\u0400-\u04FF]+|\w+/.source}|${/</.source})|((?:${/(?:^|\s)\/\/(.+?)$/gm.source})|(?:${/\/\*([\S\s]*?)\*\//gm.source}))`,"gmi"),u=["23AC69","91C132","F19726","E8552D","1AAB8E","E1147F","2980C1","1BA1E6","9FA0A0","F19726","E30B20","E30B20","A3338B"],p={},h=e=>{let t=0;return e.replace(d,((e,n,o)=>{if(o)return`<span style="color: slategray">${o}</span>`;if("<"===n)return"&lt;";let a;p[n]?a=p[n]:(a=u[t],p[n]=a);const l=`<span style="color: #${a}">${n}</span>`;return t=++t%u.length,l}))},g=["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"],v=e=>Object.fromEntries(e.map(((e,t)=>[g[t],e])));var f=v(["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!\n Current word number: $2","Anonymous","Dwarves","Hobbits","Ents","Wizards","Elves","Maiar","GIF","Search GIF","Profile","Approved","Waiting","Spam","Unsticky","Oldest","Latest","Hottest"]),y=v(["ニックネーム","3バイト以上のニックネームをご入力ください.","メールアドレス","メールアドレスをご確認ください.","サイト","オプション","ここにコメント","コメントしましょう~","提出する","Like","Cancel like","返信する","キャンセル","コメント","更新","さらに読み込む","プレビュー","絵文字","画像をアップロード","秒前","分前","時間前","日前","たっだ今","アップロード","ログインする","ログアウト","管理者","トップに置く","ワード","コメントは $0 から $1 ワードの間でなければなりません!\n 現在の単語番号: $2","匿名","うえにん","なかにん","しもおし","特にしもおし","かげ","なぬし","GIF","探す GIF","個人情報","承認済み","待っている","スパム","べたつかない","逆順","正順","人気順"]),k=v(["昵称","昵称不能少于3个字符","邮箱","请填写正确的邮件地址","网址","可选","欢迎评论","来发评论吧~","提交","喜欢","取消喜欢","回复","取消回复","评论","刷新","加载更多...","预览","表情","上传图片","秒前","分钟前","小时前","天前","刚刚","正在上传","登录","退出","博主","置顶","字","评论字数应在 $0 到 $1 字之间!\n当前字数:$2","匿名","潜水","冒泡","吐槽","活跃","话痨","传说","表情包","搜索表情包","个人资料","通过","待审核","垃圾","取消置顶","按倒序","按正序","按热度"]),w=v(["暱稱","暱稱不能少於3個字元","郵箱","請填寫正確的郵件地址","網址","可選","歡迎評論","來發評論吧~","提交","喜歡","取消喜歡","回覆","取消回覆","評論","刷新","載入更多...","預覽","表情","上傳圖片","秒前","分鐘前","小時前","天前","剛剛","正在上傳","登錄","退出","博主","置頂","字","評論字數應在 $0 到 $1 字之間!\n當前字數:$2","匿名","潛水","冒泡","吐槽","活躍","話癆","傳說","表情包","搜索表情包","個人資料","通過","待審核","垃圾","取消置頂","按倒序","按正序","按熱度"]),C=v(["Apelido","Apelido não pode ser menor que 3 bytes.","E-Mail","Por favor, confirme seu endereço de e-mail.","Website","Opcional","Comente aqui...","Nenhum comentário, ainda.","Enviar","Like","Cancel like","Responder","Cancelar resposta","Comentários","Refrescar","Carregar Mais...","Visualizar","Emoji","Enviar Imagem","segundos atrás","minutos atrás","horas atrás","dias atrás","agora mesmo","Enviando","Entrar","Sair","Admin","Sticky","Palavras","Favor enviar comentário com $0 a $1 palavras!\n Número de palavras atuais: $2","Anônimo","Dwarves","Hobbits","Ents","Wizards","Elves","Maiar","GIF","Pesquisar GIF","informação pessoal","Aprovado","Espera","Spam","Unsticky","Mais velho","Mais recentes","Mais quente"]),b=v(["Псевдоним","Никнейм не может быть меньше 3 байт.","Эл. адрес","Пожалуйста, подтвердите адрес вашей электронной почты.","Веб-сайт","Необязательный","Комментарий здесь...","Пока нет комментариев.","Отправить","Like","Cancel like","Отвечать","Отменить ответ","Комментарии","Обновить","Загрузи больше...","Превью","эмодзи","Загрузить изображение","секунд назад","несколько минут назад","несколько часов назад","дней назад","прямо сейчас","Загрузка","Авторизоваться","Выход из системы","Админ","Липкий","Слова","Пожалуйста, введите комментарии от $0 до $1 слов!\nНомер текущего слова: $2","Анонимный","Dwarves","Hobbits","Ents","Wizards","Elves","Maiar","GIF","Поиск GIF","Персональные данные","Одобренный","Ожидающий","Спам","Нелипкий","самый старый","последний","самый горячий"]);const E={zh:k,"zh-cn":k,"zh-CN":k,"zh-tw":w,"zh-TW":w,en:f,"en-US":f,"en-us":f,jp:y,"jp-jp":y,"jp-JP":y,"pt-br":C,"pt-BR":C,ru:b,"ru-ru":b,"ru-RU":b},B=e=>{try{e=decodeURI(e)}catch(e){}return e},L=(e="")=>e.replace(/\/$/u,""),S=e=>/^(https?:)?\/\//.test(e),V=e=>{const t=L(e);return S(t)?t:`https://${t}`},$=e=>Array.isArray(e)?e:!!e&&[0,e],N=(e,t)=>"function"==typeof e?e:!1!==e&&t,I="{--waline-white:#000;--waline-light-grey:#666;--waline-dark-grey:#999;--waline-color:#888;--waline-bgcolor:#1e1e1e;--waline-bgcolor-light:#272727;--waline-bgcolor-hover: #444;--waline-border-color:#333;--waline-disable-bgcolor:#444;--waline-disable-color:#272727;--waline-bq-color:#272727;--waline-info-bgcolor:#272727;--waline-info-color:#666}",x=(e,t)=>{let n=e.toString();for(;n.length<t;)n="0"+n;return n},R=(e,t,n)=>{if(!e)return"";const o="string"==typeof e?new Date(-1!==e.indexOf(" ")?e.replace(/-/g,"/"):e):e,a=t.getTime()-o.getTime(),l=Math.floor(a/864e5);if(0===l){const e=a%864e5,t=Math.floor(e/36e5);if(0===t){const t=e%36e5,o=Math.floor(t/6e4);if(0===o){const e=t%6e4;return`${Math.round(e/1e3)} ${n.seconds}`}return`${o} ${n.minutes}`}return`${t} ${n.hours}`}return l<0?n.now:l<8?`${l} ${n.days}`:(e=>{const t=x(e.getDate(),2),n=x(e.getMonth()+1,2);return`${x(e.getFullYear(),2)}-${n}-${t}`})(o)},j=t=>{const n=e.useStorage("WALINE_EMOJI",{}),o=Boolean(/@[0-9]+\.[0-9]+\.[0-9]+/.test(t));if(o){const e=n.value[t];if(e)return Promise.resolve(e)}return fetch(`${t}/info.json`).then((e=>e.json())).then((e=>{const a={folder:t,...e};return o&&(n.value[t]=a),a}))},A=(e,t="",n="",o="")=>`${t?`${t}/`:""}${n}${e}${o?`.${o}`:""}`,z=e=>{"AbortError"!==e.name&&console.error(e.message)},D={"Content-Type":"application/json"},M=(e,t="")=>{if("object"==typeof e&&e.errno)throw new TypeError(`Fetch ${t} failed with ${e.errno}: ${e.errmsg}`);return e},U=({serverURL:e,lang:t,token:n,objectId:o,...a})=>fetch(`${e}/comment/${o}?lang=${t}`,{method:"PUT",headers:{"Content-Type":"application/json",Authorization:`Bearer ${n}`},body:JSON.stringify(a)}).then((e=>e.json())),P=({serverURL:e,lang:t,paths:n,signal:o})=>fetch(`${e}/article?path=${encodeURIComponent(n.join(","))}&lang=${t}`,{signal:o}).then((e=>e.json())).then((e=>M(e,"visit count"))).then((e=>Array.isArray(e)?e:[e])),T=({serverURL:e,lang:t,path:n})=>fetch(`${e}/article?lang=${t}`,{method:"POST",headers:D,body:JSON.stringify({path:n})}).then((e=>e.json())).then((e=>M(e,"visit count"))),O=e=>e instanceof HTMLElement?e:"string"==typeof e?document.querySelector(e):null,H=e=>e.type.includes("image"),_=e=>{const t=Array.from(e).find(H);return t?t.getAsFile():null},F=/\$.*?\$/,W=/^\$(.*?)\$/,G=/^(?:\s{0,3})\$\$((?:[^\n]|\n[^\n])+?)\n{0,1}\$\$/,q=(e="",t={})=>e.replace(/:(.+?):/g,((e,n)=>t[n]?`<img class="wl-emoji" src="${t[n]}" alt="${n}">`:e)),K=(e,{emojiMap:t,highlighter:n,texRenderer:a})=>{if(o.marked.setOptions({highlight:n||void 0,breaks:!0,smartLists:!0,smartypants:!0}),a){const e=(e=>[{name:"blockMath",level:"block",tokenizer(t){const n=G.exec(t);if(null!==n)return{type:"html",raw:n[0],text:e(!0,n[1])}}},{name:"inlineMath",level:"inline",start(e){const t=e.search(F);return-1!==t?t:e.length},tokenizer(t){const n=W.exec(t);if(null!==n)return{type:"html",raw:n[0],text:e(!1,n[1])}}}])(a);o.marked.use({extensions:e})}return o.marked.parse(q(e,t))},J=e=>e.dataset.path||e.getAttribute("id");let Z=null;const Y=()=>Z||(Z=e.useStorage("WALINE_USER",{}));let Q=null;const X=()=>Q||(Q=e.useStorage("WALINE_LIKE",[])),ee=({serverURL:e,path:t=window.location.pathname,selector:n=".waline-comment-count",lang:o="zh-CN"})=>{const a=new AbortController,l=document.querySelectorAll(n),r=Y();return l.length&&(({serverURL:e,lang:t,paths:n,signal:o,token:a})=>{const l={};return a&&(l.Authorization=`Bearer ${a}`),fetch(`${e}/comment?type=count&url=${encodeURIComponent(n.join(","))}&lang=${t}`,{signal:o,headers:l}).then((e=>e.json())).then((e=>M(e,"comment count"))).then((e=>Array.isArray(e)?e:[e]))})({serverURL:V(e),paths:Array.from(l).map((e=>B(e.dataset.path||e.getAttribute("id")||t))),lang:o,signal:a.signal,token:r.value?.token}).then((e=>{l.forEach(((t,n)=>{t.innerText=e[n].toString()}))})).catch(z),a.abort.bind(a)};var te="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},ne={},oe={},ae={},le=te&&te.__awaiter||function(e,t,n,o){return new(n||(n=Promise))((function(a,l){function r(e){try{c(o.next(e))}catch(e){l(e)}}function i(e){try{c(o.throw(e))}catch(e){l(e)}}function c(e){var t;e.done?a(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(r,i)}c((o=o.apply(e,t||[])).next())}))},re=te&&te.__generator||function(e,t){var n,o,a,l,r={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]};return l={next:i(0),throw:i(1),return:i(2)},"function"==typeof Symbol&&(l[Symbol.iterator]=function(){return this}),l;function i(l){return function(i){return function(l){if(n)throw new TypeError("Generator is already executing.");for(;r;)try{if(n=1,o&&(a=2&l[0]?o.return:l[0]?o.throw||((a=o.return)&&a.call(o),0):o.next)&&!(a=a.call(o,l[1])).done)return a;switch(o=0,a&&(l=[2&l[0],a.value]),l[0]){case 0:case 1:a=l;break;case 4:return r.label++,{value:l[1],done:!1};case 5:r.label++,o=l[1],l=[0];continue;case 7:l=r.ops.pop(),r.trys.pop();continue;default:if(!(a=r.trys,(a=a.length>0&&a[a.length-1])||6!==l[0]&&2!==l[0])){r=0;continue}if(3===l[0]&&(!a||l[1]>a[0]&&l[1]<a[3])){r.label=l[1];break}if(6===l[0]&&r.label<a[1]){r.label=a[1],a=l;break}if(a&&r.label<a[2]){r.label=a[2],r.ops.push(l);break}a[2]&&r.ops.pop(),r.trys.pop();continue}l=t.call(e,r)}catch(e){l=[6,e],o=0}finally{n=a=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}([l,i])}}};Object.defineProperty(ae,"__esModule",{value:!0}),ae.ReCaptchaInstance=void 0;var ie=function(){function e(e,t,n){this.siteKey=e,this.recaptchaID=t,this.recaptcha=n,this.styleContainer=null}return e.prototype.execute=function(e){return le(this,void 0,void 0,(function(){return re(this,(function(t){return[2,this.recaptcha.enterprise?this.recaptcha.enterprise.execute(this.recaptchaID,{action:e}):this.recaptcha.execute(this.recaptchaID,{action:e})]}))}))},e.prototype.getSiteKey=function(){return this.siteKey},e.prototype.hideBadge=function(){null===this.styleContainer&&(this.styleContainer=document.createElement("style"),this.styleContainer.innerHTML=".grecaptcha-badge{visibility:hidden !important;}",document.head.appendChild(this.styleContainer))},e.prototype.showBadge=function(){null!==this.styleContainer&&(document.head.removeChild(this.styleContainer),this.styleContainer=null)},e}();ae.ReCaptchaInstance=ie,Object.defineProperty(oe,"__esModule",{value:!0}),oe.getInstance=oe.load=void 0;var ce,se=ae;!function(e){e[e.NOT_LOADED=0]="NOT_LOADED",e[e.LOADING=1]="LOADING",e[e.LOADED=2]="LOADED"}(ce||(ce={}));var me=function(){function e(){}return e.load=function(t,n){if(void 0===n&&(n={}),"undefined"==typeof document)return Promise.reject(new Error("This is a library for the browser!"));if(e.getLoadingState()===ce.LOADED)return e.instance.getSiteKey()===t?Promise.resolve(e.instance):Promise.reject(new Error("reCAPTCHA already loaded with different site key!"));if(e.getLoadingState()===ce.LOADING)return t!==e.instanceSiteKey?Promise.reject(new Error("reCAPTCHA already loaded with different site key!")):new Promise((function(t,n){e.successfulLoadingConsumers.push((function(e){return t(e)})),e.errorLoadingRunnable.push((function(e){return n(e)}))}));e.instanceSiteKey=t,e.setLoadingState(ce.LOADING);var o=new e;return new Promise((function(a,l){o.loadScript(t,n.useRecaptchaNet||!1,n.useEnterprise||!1,n.renderParameters?n.renderParameters:{},n.customUrl).then((function(){e.setLoadingState(ce.LOADED);var l=o.doExplicitRender(grecaptcha,t,n.explicitRenderParameters?n.explicitRenderParameters:{},n.useEnterprise||!1),r=new se.ReCaptchaInstance(t,l,grecaptcha);e.successfulLoadingConsumers.forEach((function(e){return e(r)})),e.successfulLoadingConsumers=[],n.autoHideBadge&&r.hideBadge(),e.instance=r,a(r)})).catch((function(t){e.errorLoadingRunnable.forEach((function(e){return e(t)})),e.errorLoadingRunnable=[],l(t)}))}))},e.getInstance=function(){return e.instance},e.setLoadingState=function(t){e.loadingState=t},e.getLoadingState=function(){return null===e.loadingState?ce.NOT_LOADED:e.loadingState},e.prototype.loadScript=function(t,n,o,a,l){var r=this;void 0===n&&(n=!1),void 0===o&&(o=!1),void 0===a&&(a={}),void 0===l&&(l="");var i=document.createElement("script");i.setAttribute("recaptcha-v3-script","");var c="https://www.google.com/recaptcha/api.js";n&&(c=o?"https://recaptcha.net/recaptcha/enterprise.js":"https://recaptcha.net/recaptcha/api.js"),o&&(c="https://www.google.com/recaptcha/enterprise.js"),l&&(c=l),a.render&&(a.render=void 0);var s=this.buildQueryString(a);return i.src=c+"?render=explicit"+s,new Promise((function(t,n){i.addEventListener("load",r.waitForScriptToLoad((function(){t(i)}),o),!1),i.onerror=function(t){e.setLoadingState(ce.NOT_LOADED),n(t)},document.head.appendChild(i)}))},e.prototype.buildQueryString=function(e){return Object.keys(e).length<1?"":"&"+Object.keys(e).filter((function(t){return!!e[t]})).map((function(t){return t+"="+e[t]})).join("&")},e.prototype.waitForScriptToLoad=function(t,n){var o=this;return function(){void 0===window.grecaptcha?setTimeout((function(){o.waitForScriptToLoad(t,n)}),e.SCRIPT_LOAD_DELAY):n?window.grecaptcha.enterprise.ready((function(){t()})):window.grecaptcha.ready((function(){t()}))}},e.prototype.doExplicitRender=function(e,t,n,o){var a={sitekey:t,badge:n.badge,size:n.size,tabindex:n.tabindex};return n.container?o?e.enterprise.render(n.container,a):e.render(n.container,a):o?e.enterprise.render(a):e.render(a)},e.loadingState=null,e.instance=null,e.instanceSiteKey=null,e.successfulLoadingConsumers=[],e.errorLoadingRunnable=[],e.SCRIPT_LOAD_DELAY=25,e}();oe.load=me.load,oe.getInstance=me.getInstance,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.ReCaptchaInstance=e.getInstance=e.load=void 0;var t=oe;Object.defineProperty(e,"load",{enumerable:!0,get:function(){return t.load}}),Object.defineProperty(e,"getInstance",{enumerable:!0,get:function(){return t.getInstance}});var n=ae;Object.defineProperty(e,"ReCaptchaInstance",{enumerable:!0,get:function(){return n.ReCaptchaInstance}})}(ne);const de=Symbol("VueReCaptchaInjectKey"),ue={loadedWaiters:[],error:null},pe={install(e,n){const o=t.ref(!1),a=t.ref(void 0);e.config.globalProperties.$recaptchaLoaded=he(o),async function(e){return await ne.load(e.siteKey,e.loaderOptions)}(n).then((t=>{o.value=!0,a.value=t,e.config.globalProperties.$recaptcha=ge(a),e.config.globalProperties.$recaptchaInstance=a,ue.loadedWaiters.forEach((e=>e.resolve(!0)))})).catch((e=>{ue.error=e,ue.loadedWaiters.forEach((t=>t.reject(e)))})),e.provide(de,{instance:a,isLoaded:o,executeRecaptcha:ge(a),recaptchaLoaded:he(o)})}};function he(e){return()=>new Promise(((t,n)=>null!==ue.error?n(ue.error):e.value?t(!0):void ue.loadedWaiters.push({resolve:t,reject:n})))}function ge(e){return async t=>await(e.value?.execute(t))}const ve=({size:e})=>t.h("svg",{width:e,height:e,viewBox:"0 0 100 100",preserveAspectRatio:"xMidYMid"},t.h("circle",{cx:50,cy:50,fill:"none",stroke:"currentColor",strokeWidth:"4",r:"40","stroke-dasharray":"85 30"},t.h("animateTransform",{attributeName:"transform",type:"rotate",repeatCount:"indefinite",dur:"1s",values:"0 50 50;360 50 50",keyTimes:"0;1"})));var fe=t.defineComponent({name:"ImageWall",components:{LoadingIcon:ve},props:{items:{type:Array,default:()=>[]},columnWidth:{type:Number,default:300},gap:{type:Number,default:0}},emits:["insert"],setup(e){let n=null;const o=t.ref(null),a=t.ref({}),l=t.ref([]),r=()=>{const t=Math.floor((o.value.getBoundingClientRect().width+e.gap)/(e.columnWidth+e.gap));return t>0?t:1},i=async n=>{if(n>=e.items.length)return;await t.nextTick();const a=Array.from(o.value?.children||[]).reduce(((e,t)=>t.getBoundingClientRect().height<e.getBoundingClientRect().height?t:e));l.value[Number(a.dataset.index)].push(n),await i(n+1)},c=async(e=!1)=>{if(l.value.length===r()&&!e)return;var t;l.value=(t=r(),new Array(t).fill(null).map((()=>[])));const n=window.scrollY;await i(0),window.scrollTo({top:n})};return t.watch((()=>[e.items]),(()=>{a.value={},c(!0)})),t.watch((()=>[e.columnWidth,e.gap]),(()=>c())),t.onMounted((()=>{c(!0),n=new ResizeObserver((()=>c())),n.observe(o.value)})),t.onBeforeUnmount((()=>n.unobserve(o.value))),{columns:l,state:a,wall:o}}}),ye=(e,t)=>{const n=e.__vccOpts||e;for(const[e,o]of t)n[e]=o;return n};const ke=["data-index"],we=["src","title","onLoad","onClick"];var Ce=ye(fe,[["render",function(e,n,o,a,l,r){const i=t.resolveComponent("LoadingIcon");return t.openBlock(),t.createElementBlock("div",{ref:"wall",class:"wl-gallery",style:t.normalizeStyle({gap:`${e.gap}px`})},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(e.columns,((n,o)=>(t.openBlock(),t.createElementBlock("div",{key:o,class:"wl-gallery-column","data-index":o,style:t.normalizeStyle({gap:`${e.gap}px`})},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(n,(n=>(t.openBlock(),t.createElementBlock(t.Fragment,{key:n},[e.state[e.items[n].src]?t.createCommentVNode("v-if",!0):(t.openBlock(),t.createBlock(i,{key:0,size:36,style:{margin:"20px auto"}})),t.createElementVNode("img",{class:"wl-gallery-item",src:e.items[n].src,title:e.items[n].title,loading:"lazy",onLoad:t=>e.state[e.items[n].src]=!0,onClick:t=>e.$emit("insert",`![](${e.items[n].src})`)},null,40,we)],64)))),128))],12,ke)))),128))],4)}],["__file","ImageWall.vue"]]),be=t.defineComponent({name:"CommentBox",components:{CloseIcon:({size:e})=>t.h("svg",{class:"wl-close-icon",viewBox:"0 0 1024 1024",width:e,height:e},[t.h("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"}),t.h("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"})]),EmojiIcon:()=>t.h("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},t.h("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"})),ImageIcon:()=>t.h("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},[t.h("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"}),t.h("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"})]),ImageWall:Ce,MarkdownIcon:()=>t.h("svg",{width:"16",height:"16",ariaHidden:"true"},t.h("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"})),PreviewIcon:()=>t.h("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},[t.h("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"}),t.h("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"})]),LoadingIcon:ve,GifIcon:()=>t.h("svg",{width:24,height:24,fill:"currentcolor",viewBox:"0 0 24 24"},[t.h("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"}),t.h("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"})])},props:{rootId:{type:String,default:""},replyId:{type:String,default:""},replyUser:{type:String,default:""},edit:{type:Object,default:null}},emits:["submit","cancel-reply","cancel-edit"],setup(n,{emit:o}){const a=t.inject("config"),r=e.useStorage("WALINE_COMMENT_BOX_EDITOR",""),i=e.useStorage("WALINE_USER_META",{nick:"",mail:"",link:""}),c=Y(),s=t.inject(de),m=t.ref({}),d=t.ref(null),u=t.ref(null),p=t.ref(null),h=t.ref(null),g=t.ref(null),v=t.ref(null),f=t.ref(null),y=t.ref({tabs:[],map:{}}),k=t.ref(0),w=t.ref(!1),C=t.ref(!1),b=t.ref(!1),E=t.ref(""),B=t.ref(0),S=t.reactive({loading:!0,list:[]}),V=t.ref(0),$=t.ref(!1),N=t.ref(""),I=t.ref(!1),x=t.computed((()=>a.value.locale)),R=t.computed((()=>Boolean(c.value?.token))),z=t.computed((()=>!1!==a.value.imageUploader)),D=e=>{const t=d.value,n=t.selectionStart,o=t.selectionEnd||0,a=t.scrollTop;r.value=t.value.substring(0,n)+e+t.value.substring(o,t.value.length),t.focus(),t.selectionStart=n+e.length,t.selectionEnd=n+e.length,t.scrollTop=a},M=e=>{const t=`![${a.value.locale.uploading} ${e.name}]()`;return D(t),Promise.resolve().then((()=>a.value.imageUploader(e))).then((n=>{r.value=r.value.replace(t,`\r\n![${e.name}](${n})`)})).catch((e=>{alert(e.message),r.value=r.value.replace(t,"")}))},U=async()=>{const{serverURL:e,lang:t,login:l,wordLimit:u,requiredMeta:p}=a.value;let h="";if(s){const{executeRecaptcha:e,recaptchaLoaded:t}=s;await t(),h=await e("social")}const g={comment:N.value,nick:i.value.nick,mail:i.value.mail,link:i.value.link,ua:navigator.userAgent,url:a.value.path,recaptchaV3:h};if(c.value?.token)g.nick=c.value.display_name,g.mail=c.value.email,g.link=c.value.url;else{if("force"===l)return;if(p.indexOf("nick")>-1&&!g.nick)return m.value.nick?.focus(),alert(x.value.nickError);if(p.indexOf("mail")>-1&&!g.mail||g.mail&&!/^\w(?:[\w._-]*\w)?@(?:\w(?:[\w-]*\w)?\.)*\w+$/.exec(g.mail))return m.value.mail?.focus(),alert(x.value.mailError);if(!g.comment)return void d.value?.focus();g.nick||(g.nick=x.value.anonymous)}if(!$.value)return alert(x.value.wordHint.replace("$0",u[0].toString()).replace("$1",u[1].toString()).replace("$2",B.value.toString()));g.comment=q(g.comment,y.value.map),n.replyId&&n.rootId?(g.pid=n.replyId,g.rid=n.rootId,g.at=n.replyUser):n.edit&&(g.eid=n.edit.objectId),I.value=!0,(({serverURL:e,lang:t,token:n,comment:o})=>{const a={"Content-Type":"application/json"};return n&&(a.Authorization=`Bearer ${n}`),o.eid?fetch(`${e}/comment/${o.eid}?lang=${t}`,{method:"PUT",headers:a,body:JSON.stringify(o)}).then((e=>e.json())):fetch(`${e}/comment?lang=${t}`,{method:"POST",headers:a,body:JSON.stringify(o)}).then((e=>e.json()))})({serverURL:e,lang:t,token:c.value?.token,comment:g}).then((e=>{if(I.value=!1,e.errmsg)return alert(e.errmsg);o("submit",e.data),r.value="",E.value="",n.replyId&&o("cancel-reply"),n.edit?.objectId&&o("cancel-edit")})).catch((e=>{I.value=!1,alert(e.message)}))},P=e=>{p.value.contains(e.target)||h.value.contains(e.target)||(w.value=!1),g.value.contains(e.target)||v.value.contains(e.target)||(C.value=!1)},T=async e=>{const{scrollTop:t,clientHeight:n,scrollHeight:o}=e.target,l=(n+t)/o,r=a.value.search,i=f.value?.value||"";l<.9||S.loading||(S.loading=!0,S.list.push(...r.more?await r.more(i,S.list.length):await r.search(i)),S.loading=!1,setTimeout((()=>{e.target.scrollTop=t}),50))},O=e.useDebounceFn((e=>{S.list=[],T(e)}),300);t.watch([a,B],(([e,t])=>{const{wordLimit:n}=e;n?t<n[0]&&0!==n[0]?(V.value=n[0],$.value=!1):t>n[1]?(V.value=n[1],$.value=!1):(V.value=n[1],$.value=!0):(V.value=0,$.value=!0)}),{immediate:!0}),t.watch(C,(async e=>{if(!e)return;const t=a.value.search;f.value&&(f.value.value=""),S.loading=!0,S.list=t.default?await t.default():await t.search(""),S.loading=!1}));const H=({data:e})=>{e&&"profile"===e.type&&(c.value={...c.value,...e.data},[localStorage,sessionStorage].filter((e=>e.getItem("WALINE_USER"))).forEach((e=>e.setItem("WALINE_USER",JSON.stringify(c)))))};return t.onMounted((()=>{document.body.addEventListener("click",P),window.addEventListener("message",H),n.edit?.objectId&&(r.value=n.edit.orig),t.watch((()=>r.value),(e=>{const{highlighter:t,texRenderer:n}=a.value;N.value=e,E.value=K(e,{emojiMap:y.value.map,highlighter:t,texRenderer:n}),B.value=(e=>(e=>e.match(/[\w\d\s\u00C0-\u024F]+/giu)||[])(e).reduce(((e,t)=>e+(""===t.trim()?0:t.trim().split(/\s+/u).length)),0)+(e=>e.match(/[\u4E00-\u9FA5]/gu)||[])(e).length)(e),e?l.default(d.value):l.default.destroy(d.value)}),{immediate:!0}),t.watch((()=>a.value.emoji),(e=>{return(t=Array.isArray(e)?e:[],Promise.all(t.map((e=>"string"==typeof e?j(L(e)):Promise.resolve(e)))).then((e=>{const t={tabs:[],map:{}};return e.forEach((e=>{const{name:n,folder:o,icon:a,prefix:l,type:r,items:i}=e;t.tabs.push({name:n,icon:A(a,o,l,r),items:i.map((e=>{const n=`${l||""}${e}`;return t.map[n]=A(e,o,l,r),n}))})})),t}))).then((e=>{y.value=e}));var t}),{immediate:!0})})),t.onUnmounted((()=>{document.body.removeEventListener("click",P),window.removeEventListener("message",H)})),{config:a,locale:x,insert:D,onChange:()=>{const e=u.value;e.files&&z.value&&M(e.files[0]).then((()=>{e.value=""}))},onDrop:e=>{if(e.dataTransfer?.items){const t=_(e.dataTransfer.items);t&&z.value&&(M(t),e.preventDefault())}},onKeyDown:e=>{const t=e.key;(e.ctrlKey||e.metaKey)&&"Enter"===t&&U()},onPaste:e=>{if(e.clipboardData){const t=_(e.clipboardData.items);t&&z.value&&M(t)}},onLogin:e=>{e.preventDefault();const{lang:t,serverURL:n}=a.value,o=(window.innerWidth-450)/2,l=(window.innerHeight-450)/2,r=window.open(`${n}/ui/login?lng=${encodeURIComponent(t)}`,"_blank",`width=450,height=450,left=${o},top=${l},scrollbars=no,resizable=no,status=no,location=no,toolbar=no,menubar=no`);r?.postMessage({type:"TOKEN",data:null},"*");const i=({data:e})=>{e&&"userInfo"===e.type&&e.data.token&&(r?.close(),c.value=e.data,(e.data.remember?localStorage:sessionStorage).setItem("WALINE_USER",JSON.stringify(e.data)),window.removeEventListener("message",i))};window.addEventListener("message",i)},onLogout:()=>{c.value={},localStorage.setItem("WALINE_USER","null"),sessionStorage.setItem("WALINE_USER","null")},onProfile:e=>{e.preventDefault();const{lang:t,serverURL:n}=a.value,o=(window.innerWidth-800)/2,l=(window.innerHeight-800)/2;window.open(`${n}/ui/profile?lng=${encodeURIComponent(t)}`,"_blank",`width=800,height=800,left=${o},top=${l},scrollbars=no,resizable=no,status=no,location=no,toolbar=no,menubar=no`)?.postMessage({type:"TOKEN",data:c.value.token},"*")},submitComment:U,onImageWallScroll:T,onGifSearch:O,isLogin:R,userInfo:c,isSubmitting:I,wordNumber:B,wordLimit:V,isWordNumberLegal:$,editor:r,userMeta:i,emoji:y,emojiTabIndex:k,showEmoji:w,gifData:S,showGif:C,canUploadImage:z,previewText:E,showPreview:b,inputRefs:m,editorRef:d,emojiButtonRef:p,emojiPopupRef:h,gifButtonRef:g,gifPopupRef:v,imageUploadRef:u,gifSearchInputRef:f}}});const Ee={class:"wl-comment"},Be={key:0,class:"wl-login-info"},Le={class:"wl-avatar"},Se=["title"],Ve=["title"],$e=["src"],Ne=["title","textContent"],Ie={class:"wl-panel"},xe=["for","textContent"],Re=["id","onUpdate:modelValue","name","type"],je=["placeholder"],Ae={class:"wl-preview"},ze=t.createElementVNode("hr",null,null,-1),De=["innerHTML"],Me={class:"wl-footer"},Ue={class:"wl-actions"},Pe={href:"https://guides.github.com/features/mastering-markdown/",title:"Markdown Guide","aria-label":"Markdown is supported",class:"wl-action",target:"_blank",rel:"noreferrer"},Te=["title"],Oe=["title"],He=["title"],_e=["title"],Fe={class:"wl-info"},We={class:"wl-text-number"},Ge={key:0},qe=t.createTextVNode("  /  "),Ke=["textContent"],Je=["textContent"],Ze=["disabled"],Ye=["placeholder"],Qe={key:0,class:"wl-loading"},Xe={key:0,class:"wl-tab-wrapper"},et=["title","onClick"],tt=["src","alt"],nt={key:0,class:"wl-tabs"},ot=["onClick"],at=["src","alt","title"],lt=["title"];var rt=ye(be,[["render",function(e,n,o,a,l,r){const i=t.resolveComponent("CloseIcon"),c=t.resolveComponent("MarkdownIcon"),s=t.resolveComponent("EmojiIcon"),m=t.resolveComponent("GifIcon"),d=t.resolveComponent("ImageIcon"),u=t.resolveComponent("PreviewIcon"),p=t.resolveComponent("LoadingIcon"),h=t.resolveComponent("ImageWall");return t.openBlock(),t.createElementBlock("div",Ee,["disable"!==e.config.login&&e.isLogin&&!e.edit?.objectId?(t.openBlock(),t.createElementBlock("div",Be,[t.createElementVNode("div",Le,[t.createElementVNode("button",{class:"wl-logout-btn",title:e.locale.logout,onClick:n[0]||(n[0]=(...t)=>e.onLogout&&e.onLogout(...t))},[t.createVNode(i,{size:14})],8,Se),t.createElementVNode("a",{href:"#",class:"wl-login-nick","aria-label":"Profile",title:e.locale.profile,onClick:n[1]||(n[1]=(...t)=>e.onProfile&&e.onProfile(...t))},[t.createElementVNode("img",{src:e.userInfo.avatar,alt:"avatar"},null,8,$e)],8,Ve)]),t.createElementVNode("a",{href:"#",class:"wl-login-nick","aria-label":"Profile",title:e.locale.profile,onClick:n[2]||(n[2]=(...t)=>e.onProfile&&e.onProfile(...t)),textContent:t.toDisplayString(e.userInfo.display_name)},null,8,Ne)])):t.createCommentVNode("v-if",!0),t.createElementVNode("div",Ie,["force"!==e.config.login&&e.config.meta.length&&!e.isLogin?(t.openBlock(),t.createElementBlock("div",{key:0,class:t.normalizeClass(["wl-header",`item${e.config.meta.length}`])},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(e.config.meta,(n=>(t.openBlock(),t.createElementBlock("div",{key:n,class:"wl-header-item"},[t.createElementVNode("label",{for:n,textContent:t.toDisplayString(e.locale[n]+(e.config.requiredMeta.includes(n)||!e.config.requiredMeta.length?"":`(${e.locale.optional})`))},null,8,xe),t.withDirectives(t.createElementVNode("input",{id:`wl-${n}`,ref_for:!0,ref:t=>{t&&(e.inputRefs[n]=t)},"onUpdate:modelValue":t=>e.userMeta[n]=t,class:t.normalizeClass(["wl-input",`wl-${n}`]),name:n,type:"mail"===n?"email":"text"},null,10,Re),[[t.vModelDynamic,e.userMeta[n]]])])))),128))],2)):t.createCommentVNode("v-if",!0),t.withDirectives(t.createElementVNode("textarea",{id:"wl-edit",ref:"editorRef","onUpdate:modelValue":n[3]||(n[3]=t=>e.editor=t),class:"wl-editor",placeholder:e.replyUser?`@${e.replyUser}`:e.locale.placeholder,onKeydown:n[4]||(n[4]=(...t)=>e.onKeyDown&&e.onKeyDown(...t)),onDrop:n[5]||(n[5]=(...t)=>e.onDrop&&e.onDrop(...t)),onPaste:n[6]||(n[6]=(...t)=>e.onPaste&&e.onPaste(...t))},null,40,je),[[t.vModelText,e.editor]]),t.withDirectives(t.createElementVNode("div",Ae,[ze,t.createElementVNode("h4",null,t.toDisplayString(e.locale.preview)+":",1),t.createCommentVNode(" eslint-disable-next-line vue/no-v-html "),t.createElementVNode("div",{class:"wl-content",innerHTML:e.previewText},null,8,De)],512),[[t.vShow,e.showPreview]]),t.createElementVNode("div",Me,[t.createElementVNode("div",Ue,[t.createElementVNode("a",Pe,[t.createVNode(c)]),t.withDirectives(t.createElementVNode("button",{ref:"emojiButtonRef",class:t.normalizeClass(["wl-action",{actived:e.showEmoji}]),title:e.locale.emoji,onClick:n[7]||(n[7]=t=>e.showEmoji=!e.showEmoji)},[t.createVNode(s)],10,Te),[[t.vShow,e.emoji.tabs.length]]),e.config.search?(t.openBlock(),t.createElementBlock("button",{key:0,ref:"gifButtonRef",class:t.normalizeClass(["wl-action",{actived:e.showGif}]),title:e.locale.gif,onClick:n[8]||(n[8]=t=>e.showGif=!e.showGif)},[t.createVNode(m)],10,Oe)):t.createCommentVNode("v-if",!0),t.createElementVNode("input",{id:"wl-image-upload",ref:"imageUploadRef",class:"upload",type:"file",accept:".png,.jpg,.jpeg,.webp,.bmp,.gif",onChange:n[9]||(n[9]=(...t)=>e.onChange&&e.onChange(...t))},null,544),e.canUploadImage?(t.openBlock(),t.createElementBlock("label",{key:1,for:"wl-image-upload",class:"wl-action",title:e.locale.uploadImage},[t.createVNode(d)],8,He)):t.createCommentVNode("v-if",!0),t.createElementVNode("button",{class:t.normalizeClass(["wl-action",{actived:e.showPreview}]),title:e.locale.preview,onClick:n[10]||(n[10]=t=>e.showPreview=!e.showPreview)},[t.createVNode(u)],10,_e)]),t.createElementVNode("div",Fe,[t.createElementVNode("div",We,[t.createTextVNode(t.toDisplayString(e.wordNumber)+" ",1),e.config.wordLimit?(t.openBlock(),t.createElementBlock("span",Ge,[qe,t.createElementVNode("span",{class:t.normalizeClass({illegal:!e.isWordNumberLegal}),textContent:t.toDisplayString(e.wordLimit)},null,10,Ke)])):t.createCommentVNode("v-if",!0),t.createTextVNode("  "+t.toDisplayString(e.locale.word),1)]),"disable"===e.config.login||e.isLogin?t.createCommentVNode("v-if",!0):(t.openBlock(),t.createElementBlock("button",{key:0,class:"wl-btn",onClick:n[11]||(n[11]=(...t)=>e.onLogin&&e.onLogin(...t)),textContent:t.toDisplayString(e.locale.login)},null,8,Je)),"force"!==e.config.login||e.isLogin?(t.openBlock(),t.createElementBlock("button",{key:1,class:"wl-btn primary",title:"Cmd|Ctrl + Enter",disabled:e.isSubmitting,onClick:n[12]||(n[12]=(...t)=>e.submitComment&&e.submitComment(...t))},[e.isSubmitting?(t.openBlock(),t.createBlock(p,{key:0,size:16})):(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[t.createTextVNode(t.toDisplayString(e.locale.submit),1)],64))],8,Ze)):t.createCommentVNode("v-if",!0)]),t.createElementVNode("div",{ref:"gifPopupRef",class:t.normalizeClass(["wl-gif-popup",{display:e.showGif}])},[t.createElementVNode("input",{ref:"gifSearchInputRef",type:"text",placeholder:e.locale.gifSearchPlaceholder,onInput:n[13]||(n[13]=(...t)=>e.onGifSearch&&e.onGifSearch(...t))},null,40,Ye),t.createVNode(h,{items:e.gifData.list,"column-width":200,gap:6,onInsert:n[14]||(n[14]=t=>e.insert(t)),onScroll:e.onImageWallScroll},null,8,["items","onScroll"]),e.gifData.loading?(t.openBlock(),t.createElementBlock("div",Qe,[t.createVNode(p,{size:30})])):t.createCommentVNode("v-if",!0)],2),t.createElementVNode("div",{ref:"emojiPopupRef",class:t.normalizeClass(["wl-emoji-popup",{display:e.showEmoji}])},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(e.emoji.tabs,((n,o)=>(t.openBlock(),t.createElementBlock(t.Fragment,{key:n.name},[o===e.emojiTabIndex?(t.openBlock(),t.createElementBlock("div",Xe,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(n.items,(n=>(t.openBlock(),t.createElementBlock("button",{key:n,title:n,onClick:t=>e.insert(`:${n}:`)},[e.showEmoji?(t.openBlock(),t.createElementBlock("img",{key:0,class:"wl-emoji",src:e.emoji.map[n],alt:n,loading:"lazy",referrerPolicy:"no-referrer"},null,8,tt)):t.createCommentVNode("v-if",!0)],8,et)))),128))])):t.createCommentVNode("v-if",!0)],64)))),128)),e.emoji.tabs.length>1?(t.openBlock(),t.createElementBlock("div",nt,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(e.emoji.tabs,((n,o)=>(t.openBlock(),t.createElementBlock("button",{key:n.name,class:t.normalizeClass(["wl-tab",{active:e.emojiTabIndex===o}]),onClick:t=>e.emojiTabIndex=o},[t.createElementVNode("img",{class:"wl-emoji",src:n.icon,alt:n.name,title:n.name,loading:"lazy",referrerPolicy:"no-referrer"},null,8,at)],10,ot)))),128))])):t.createCommentVNode("v-if",!0)],2)])]),e.replyId||e.edit?.objectId?(t.openBlock(),t.createElementBlock("button",{key:1,class:"wl-close",title:e.locale.cancelReply,onClick:n[15]||(n[15]=t=>e.$emit(e.replyId?"cancel-reply":"cancel-edit"))},[t.createVNode(i,{size:24})],8,lt)):t.createCommentVNode("v-if",!0)])}],["__file","CommentBox.vue"]]);const it=["approved","waiting","spam"];var ct=t.defineComponent({components:{CommentBox:rt,DeleteIcon:()=>t.h("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},t.h("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"})),LikeIcon:({active:e=!1})=>t.h("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},[t.h("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"})]),ReplyIcon:()=>t.h("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},t.h("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"})),EditIcon:()=>t.h("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},t.h("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"})),VerifiedIcon:()=>t.h("svg",{class:"verified-icon",viewBox:"0 0 1024 1024",width:"14",height:"14"},t.h("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"}))},props:{comment:{type:Object,required:!0},rootId:{type:String,required:!0},reply:{type:Object,default:null},edit:{type:Object,default:null}},emits:["submit","reply","like","delete","status","sticky","edit"],setup(n){const o=t.inject("config"),a=X(),l=Y(),r=t.computed((()=>o.value.locale)),i=t.computed((()=>{const{link:e}=n.comment;return e?S(e)?e:`https://${e}`:""})),c=t.computed((()=>a.value.includes(n.comment.objectId))),s=((n,o)=>{const a=e.useNow();return t.computed((()=>R(n,a.value,o)))})(n.comment.insertedAt,r.value),m=t.computed((()=>"administrator"===l.value.type)),d=t.computed((()=>n.comment.user_id&&l.value.objectId===n.comment.user_id)),u=t.computed((()=>n.comment.objectId===n.reply?.objectId)),p=t.computed((()=>n.comment.objectId===n.edit?.objectId));return{config:o,locale:r,isReplyingCurrent:u,isEditingCurrent:p,link:i,like:c,time:s,isAdmin:m,isOwner:d,commentStatus:it}}});const st=["id"],mt={class:"wl-user","aria-hidden":"true"},dt=["src"],ut={class:"wl-card"},pt={class:"wl-head"},ht=["href"],gt={key:1,class:"wl-nick"},vt=["textContent"],ft=["textContent"],yt=["textContent"],kt=["textContent"],wt=["textContent"],Ct={class:"wl-comment-actions"},bt=["title"],Et=["textContent"],Bt=["title"],Lt={class:"wl-meta","aria-hidden":"true"},St=["data-value","textContent"],Vt=["data-value","textContent"],$t=["data-value","textContent"],Nt=["innerHTML"],It={key:1,class:"wl-admin-actions"},xt={class:"wl-comment-status"},Rt=["disabled","onClick","textContent"],jt={key:3,class:"wl-quote"};var At=ye(ct,[["render",function(e,n,o,a,l,r){const i=t.resolveComponent("VerifiedIcon"),c=t.resolveComponent("EditIcon"),s=t.resolveComponent("DeleteIcon"),m=t.resolveComponent("LikeIcon"),d=t.resolveComponent("ReplyIcon"),u=t.resolveComponent("CommentBox"),p=t.resolveComponent("CommentCard",!0);return t.openBlock(),t.createElementBlock("div",{id:e.comment.objectId,class:"wl-item"},[t.createElementVNode("div",mt,[e.comment.avatar?(t.openBlock(),t.createElementBlock("img",{key:0,src:e.comment.avatar},null,8,dt)):t.createCommentVNode("v-if",!0),e.comment.type?(t.openBlock(),t.createBlock(i,{key:1})):t.createCommentVNode("v-if",!0)]),t.createElementVNode("div",ut,[t.createElementVNode("div",pt,[e.link?(t.openBlock(),t.createElementBlock("a",{key:0,class:"wl-nick",href:e.link,target:"_blank",rel:"nofollow noreferrer"},t.toDisplayString(e.comment.nick),9,ht)):(t.openBlock(),t.createElementBlock("span",gt,t.toDisplayString(e.comment.nick),1)),"administrator"===e.comment.type?(t.openBlock(),t.createElementBlock("span",{key:2,class:"wl-badge",textContent:t.toDisplayString(e.locale.admin)},null,8,vt)):t.createCommentVNode("v-if",!0),e.comment.label?(t.openBlock(),t.createElementBlock("span",{key:3,class:"wl-badge",textContent:t.toDisplayString(e.comment.label)},null,8,ft)):t.createCommentVNode("v-if",!0),e.comment.sticky?(t.openBlock(),t.createElementBlock("span",{key:4,class:"wl-badge",textContent:t.toDisplayString(e.locale.sticky)},null,8,yt)):t.createCommentVNode("v-if",!0),void 0!==e.comment.level&&e.comment.level>=0?(t.openBlock(),t.createElementBlock("span",{key:5,class:t.normalizeClass(`wl-badge level${e.comment.level}`),textContent:t.toDisplayString(e.locale[`level${e.comment.level}`]||`Level ${e.comment.level}`)},null,10,kt)):t.createCommentVNode("v-if",!0),t.createElementVNode("span",{class:"wl-time",textContent:t.toDisplayString(e.time)},null,8,wt),t.createElementVNode("div",Ct,[e.isAdmin||e.isOwner?(t.openBlock(),t.createElementBlock("button",{key:0,class:"wl-edit",onClick:n[0]||(n[0]=t=>e.$emit("edit",e.comment))},[t.createVNode(c)])):t.createCommentVNode("v-if",!0),e.isAdmin||e.isOwner?(t.openBlock(),t.createElementBlock("button",{key:1,class:"wl-delete",onClick:n[1]||(n[1]=t=>e.$emit("delete",e.comment))},[t.createVNode(s)])):t.createCommentVNode("v-if",!0),t.createElementVNode("button",{class:"wl-like",title:e.like?e.locale.cancelLike:e.locale.like,onClick:n[2]||(n[2]=t=>e.$emit("like",e.comment))},[t.createVNode(m,{active:e.like},null,8,["active"]),"like"in e.comment?(t.openBlock(),t.createElementBlock("span",{key:0,textContent:t.toDisplayString(e.comment.like)},null,8,Et)):t.createCommentVNode("v-if",!0)],8,bt),t.createElementVNode("button",{class:t.normalizeClass(["wl-reply",{active:e.isReplyingCurrent}]),title:e.isReplyingCurrent?e.locale.cancelReply:e.locale.reply,onClick:n[3]||(n[3]=t=>e.$emit("reply",e.isReplyingCurrent?null:e.comment))},[t.createVNode(d)],10,Bt)])]),t.createElementVNode("div",Lt,[e.comment.addr?(t.openBlock(),t.createElementBlock("span",{key:0,class:"wl-addr","data-value":e.comment.addr,textContent:t.toDisplayString(e.comment.addr)},null,8,St)):t.createCommentVNode("v-if",!0),e.comment.browser?(t.openBlock(),t.createElementBlock("span",{key:1,class:"wl-browser","data-value":e.comment.browser,textContent:t.toDisplayString(e.comment.browser)},null,8,Vt)):t.createCommentVNode("v-if",!0),e.comment.os?(t.openBlock(),t.createElementBlock("span",{key:2,class:"wl-os","data-value":e.comment.os,textContent:t.toDisplayString(e.comment.os)},null,8,$t)):t.createCommentVNode("v-if",!0)]),t.createCommentVNode(" eslint-disable vue/no-v-html "),e.isEditingCurrent?t.createCommentVNode("v-if",!0):(t.openBlock(),t.createElementBlock("div",{key:0,class:"wl-content",innerHTML:e.comment.comment},null,8,Nt)),t.createCommentVNode(" eslint-enable vue/no-v-html "),e.isAdmin&&!e.isEditingCurrent?(t.openBlock(),t.createElementBlock("div",It,[t.createElementVNode("span",xt,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(e.commentStatus,(n=>(t.openBlock(),t.createElementBlock("button",{key:n,class:t.normalizeClass(`wl-btn wl-${n}`),disabled:e.comment.status===n,onClick:t=>e.$emit("status",{status:n,comment:e.comment}),textContent:t.toDisplayString(e.locale[n])},null,10,Rt)))),128))]),e.isAdmin&&!e.comment.rid?(t.openBlock(),t.createElementBlock("button",{key:0,class:"wl-btn wl-sticky",onClick:n[4]||(n[4]=t=>e.$emit("sticky",e.comment))},t.toDisplayString(e.comment.sticky?e.locale.unsticky:e.locale.sticky),1)):t.createCommentVNode("v-if",!0)])):t.createCommentVNode("v-if",!0),e.isReplyingCurrent||e.isEditingCurrent?(t.openBlock(),t.createElementBlock("div",{key:2,class:t.normalizeClass({"wl-reply-wrapper":e.isReplyingCurrent,"wl-edit-wrapper":e.isEditingCurrent})},[t.createVNode(u,{edit:e.edit,"reply-id":e.reply?.objectId,"reply-user":e.comment.nick,"root-id":e.rootId,onSubmit:n[5]||(n[5]=t=>e.$emit("submit",t)),onCancelReply:n[6]||(n[6]=t=>e.$emit("reply",null)),onCancelEdit:n[7]||(n[7]=t=>e.$emit("edit",null))},null,8,["edit","reply-id","reply-user","root-id"])],2)):t.createCommentVNode("v-if",!0),e.comment.children?(t.openBlock(),t.createElementBlock("div",jt,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(e.comment.children,(o=>(t.openBlock(),t.createBlock(p,{key:o.objectId,comment:o,reply:e.reply,edit:e.edit,"root-id":e.rootId,onReply:n[8]||(n[8]=t=>e.$emit("reply",t)),onSubmit:n[9]||(n[9]=t=>e.$emit("submit",t)),onLike:n[10]||(n[10]=t=>e.$emit("like",t)),onEdit:n[11]||(n[11]=t=>e.$emit("edit",t)),onDelete:n[12]||(n[12]=t=>e.$emit("delete",t)),onStatus:n[13]||(n[13]=t=>e.$emit("status",t)),onSticky:n[14]||(n[14]=t=>e.$emit("sticky",t))},null,8,["comment","reply","edit","root-id"])))),128))])):t.createCommentVNode("v-if",!0)])],8,st)}],["__file","CommentCard.vue"]]);const zt=[{key:"insertedAt_desc",name:"latest"},{key:"insertedAt_asc",name:"oldest"},{key:"like_desc",name:"hottest"}];var Dt=t.defineComponent({name:"WalineRoot",components:{CommentBox:rt,CommentCard:At,LoadingIcon:ve},props:["serverURL","path","meta","requiredMeta","dark","lang","locale","pageSize","wordLimit","emoji","login","highlighter","texRenderer","imageUploader","search","copyright"],setup(n){const o=t.computed((()=>(({serverURL:e,path:t=location.pathname,lang:n="zh-CN",locale:o,emoji:a=["//unpkg.com/@waline/emojis@1.1.0/weibo"],meta:l=["nick","mail","link"],requiredMeta:r=[],dark:d=!1,pageSize:u=10,wordLimit:p,imageUploader:g,highlighter:v,texRenderer:f,copyright:y=!0,login:k="enable",search:w=m(),...C})=>({serverURL:V(e),path:B(t),locale:{...E[n]||E["zh-CN"],..."object"==typeof o?o:{}},wordLimit:$(p),meta:i(l),requiredMeta:i(r),imageUploader:N(g,c),highlighter:N(v,h),texRenderer:N(f,s),lang:n,dark:d,emoji:a,pageSize:u,login:k,copyright:y,search:w,...C}))(n))),a=Y(),l=X(),r=t.ref("loading"),d=t.ref(0),u=t.ref(1),p=t.ref(0),g=t.ref(zt[0].key),v=t.ref([]),f=t.ref(null),y=t.ref(null),k=t.computed((()=>{return"string"==typeof(e=o.value.dark)?"auto"===e?`@media(prefers-color-scheme:dark){body${I}}`:`${e}${I}`:!0===e?`:root${I}`:"";var e}));let w;e.useStyleTag(k);const C=e=>{const{serverURL:t,path:n,pageSize:l}=o.value,i=new AbortController;r.value="loading",w?.(),(({serverURL:e,lang:t,path:n,page:o,pageSize:a,sortBy:l,signal:r,token:i})=>{const c={};return i&&(c.Authorization=`Bearer ${i}`),fetch(`${e}/comment?path=${encodeURIComponent(n)}&pageSize=${a}&page=${o}&lang=${t}&sortBy=${l}`,{signal:r,headers:c}).then((e=>e.json())).then((e=>M(e,"comment list")))})({serverURL:t,lang:o.value.lang,path:n,pageSize:l,sortBy:g.value,page:e,signal:i.signal,token:a.value?.token}).then((t=>{r.value="success",d.value=t.count,v.value.push(...t.data),u.value=e,p.value=t.totalPages})).catch((e=>{"AbortError"!==e.name&&(console.error(e.message),r.value="error")})),w=i.abort.bind(i)},b=()=>{d.value=0,v.value=[],C(1)};return t.provide("config",o),t.watch((()=>n.path),b),t.onMounted((()=>b())),{config:o,darkmodeStyle:k,i18n:t.computed((()=>o.value.locale)),status:r,count:d,page:u,totalPages:p,sortBy:g,sortByItems:zt,data:v,reply:f,edit:y,loadMore:()=>C(u.value+1),refresh:b,onSortByChange:e=>{g.value!==e&&(g.value=e,b())},onReply:e=>{f.value=e},onSubmit:e=>{if(y.value)y.value.comment=e.comment,y.value.orig=e.orig;else if(e.rid){const t=v.value.find((({objectId:t})=>t===e.rid));if(!t)return;Array.isArray(t.children)||(t.children=[]),t.children.push(e)}else v.value.unshift(e)},onStatusChange:async({comment:e,status:t})=>{if(e.status===t)return;const{serverURL:n,lang:l}=o.value;await U({serverURL:n,lang:l,token:a.value?.token,objectId:e.objectId,status:t}),e.status=t},onDelete:async({objectId:e})=>{if(!confirm("Are you sure you want to delete this comment?"))return;const{serverURL:t,lang:n}=o.value;await(({serverURL:e,lang:t,token:n,objectId:o})=>fetch(`${e}/comment/${o}?lang=${t}`,{method:"DELETE",headers:{Authorization:`Bearer ${n}`}}).then((e=>e.json())))({serverURL:t,lang:n,token:a.value?.token,objectId:e}),v.value.some(((t,n)=>t.objectId===e?(v.value=v.value.filter(((e,t)=>t!==n)),!0):t.children.some(((o,a)=>o.objectId===e&&(v.value[n].children=t.children.filter(((e,t)=>t!==a)),!0)))))},onSticky:async e=>{if(e.rid)return;const{serverURL:t,lang:n}=o.value;await U({serverURL:t,lang:n,token:a.value?.token,objectId:e.objectId,sticky:e.sticky?0:1}),e.sticky=!e.sticky},onLike:async e=>{const{serverURL:t,lang:n}=o.value,{objectId:a}=e,r=l.value.includes(a);await(({serverURL:e,lang:t,objectId:n,like:o})=>fetch(`${e}/comment/${n}?lang=${t}`,{method:"PUT",headers:D,body:JSON.stringify({like:o})}).then((e=>e.json())))({serverURL:t,lang:n,objectId:a,like:!r}),r?l.value=l.value.filter((e=>e!==a)):(l.value=[...l.value,a],l.value.length>50&&(l.value=l.value.slice(-50))),e.like=(e.like||0)+(r?-1:1)},onEdit:e=>{y.value=e},version:"2.10.0"}}});const Mt={"data-waline":""},Ut={class:"wl-meta-head"},Pt={class:"wl-count"},Tt=["textContent"],Ot={class:"wl-sort"},Ht=["onClick"],_t={class:"wl-cards"},Ft={key:1,class:"wl-operation"},Wt=["textContent"],Gt={key:0,class:"wl-loading"},qt=["textContent"],Kt={class:"wl-operation"},Jt=["textContent"],Zt={key:3,class:"wl-power"},Yt=t.createTextVNode(" Powered by "),Qt=t.createElementVNode("a",{href:"https://github.com/walinejs/waline",target:"_blank",rel:"noreferrer"}," Waline ",-1);var Xt=ye(Dt,[["render",function(e,n,o,a,l,r){const i=t.resolveComponent("CommentBox"),c=t.resolveComponent("CommentCard"),s=t.resolveComponent("LoadingIcon");return t.openBlock(),t.createElementBlock("div",Mt,[e.reply?t.createCommentVNode("v-if",!0):(t.openBlock(),t.createBlock(i,{key:0,onSubmit:e.onSubmit},null,8,["onSubmit"])),t.createElementVNode("div",Ut,[t.createElementVNode("div",Pt,[e.count?(t.openBlock(),t.createElementBlock("span",{key:0,class:"wl-num",textContent:t.toDisplayString(e.count)},null,8,Tt)):t.createCommentVNode("v-if",!0),t.createTextVNode(" "+t.toDisplayString(e.i18n.comment),1)]),t.createElementVNode("ul",Ot,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(e.sortByItems,(n=>(t.openBlock(),t.createElementBlock("li",{key:n.key,class:t.normalizeClass([n.key===e.sortBy?"active":""]),onClick:t=>e.onSortByChange(n.key)},t.toDisplayString(e.i18n[n.name]),11,Ht)))),128))])]),t.createElementVNode("div",_t,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(e.data,(n=>(t.openBlock(),t.createBlock(c,{key:n.objectId,"root-id":n.objectId,comment:n,reply:e.reply,edit:e.edit,onReply:e.onReply,onEdit:e.onEdit,onSubmit:e.onSubmit,onStatus:e.onStatusChange,onDelete:e.onDelete,onSticky:e.onSticky,onLike:e.onLike},null,8,["root-id","comment","reply","edit","onReply","onEdit","onSubmit","onStatus","onDelete","onSticky","onLike"])))),128))]),"error"===e.status?(t.openBlock(),t.createElementBlock("div",Ft,[t.createElementVNode("button",{type:"button",class:"wl-btn",onClick:n[0]||(n[0]=(...t)=>e.refresh&&e.refresh(...t)),textContent:t.toDisplayString(e.i18n.refresh)},null,8,Wt)])):(t.openBlock(),t.createElementBlock(t.Fragment,{key:2},["loading"===e.status?(t.openBlock(),t.createElementBlock("div",Gt,[t.createVNode(s,{size:30})])):e.data.length?e.page<e.totalPages?(t.openBlock(),t.createElementBlock(t.Fragment,{key:2},[t.createCommentVNode(" Load more button "),t.createElementVNode("div",Kt,[t.createElementVNode("button",{type:"button",class:"wl-btn",onClick:n[1]||(n[1]=(...t)=>e.loadMore&&e.loadMore(...t)),textContent:t.toDisplayString(e.i18n.more)},null,8,Jt)])],2112)):t.createCommentVNode("v-if",!0):(t.openBlock(),t.createElementBlock("div",{key:1,class:"wl-empty",textContent:t.toDisplayString(e.i18n.sofa)},null,8,qt))],64)),t.createCommentVNode(" Copyright Information "),e.config.copyright?(t.openBlock(),t.createElementBlock("div",Zt,[Yt,Qt,t.createTextVNode(" v"+t.toDisplayString(e.version),1)])):t.createCommentVNode("v-if",!0)])}],["__file","Waline.vue"]]);const en=(e,t)=>{t.forEach(((t,n)=>{t.innerText=e[n].toString()}))},tn=({serverURL:e,path:t=window.location.pathname,selector:n=".waline-pageview-count",update:o=!0,lang:a="zh-CN"})=>{const l=new AbortController,r=Array.from(document.querySelectorAll(n)),i=e=>{const n=J(e);return null!==n&&t!==n},c=n=>P({serverURL:V(e),paths:n.map((e=>J(e)||t)),lang:a,signal:l.signal}).then((e=>en(e,n))).catch(z);if(o){const n=r.filter((e=>!i(e))),o=r.filter(i);T({serverURL:V(e),path:t,lang:a}).then((e=>en(new Array(n.length).fill(e),n))),o.length&&c(o)}else c(r);return l.abort.bind(l)};exports.RecentComments=({el:e,serverURL:t,count:n,lang:o="zh-CN"})=>{const a=Y(),l=O(e),r=new AbortController;return(({serverURL:e,lang:t,count:n,signal:o,token:a})=>{const l={};return a&&(l.Authorization=`Bearer ${a}`),fetch(`${e}/comment?type=recent&count=${n}&lang=${t}`,{signal:o,headers:l}).then((e=>e.json())).then((e=>M(e,"recent comment")))})({serverURL:t,count:n,lang:o,signal:r.signal,token:a.value?.token}).then((e=>l&&e.length?(l.innerHTML=`<ul class="wl-recent-list">${e.map((e=>`<li class="wl-recent-item"><a href="${e.url}">${e.nick}</a>:${e.comment}</li>`)).join("")}</ul>`,{comments:e,destroy:()=>{r.abort(),l.innerHTML=""}}):{comments:e,destroy:()=>r.abort()}))},exports.commentCount=ee,exports.defaultLocales=E,exports.init=({el:e="#waline",path:n=window.location.pathname,comment:o=!1,pageview:a=!1,...l})=>{const r=e?O(e):null;if(e&&!r)throw new Error("Option 'el' do not match any domElement!");if(!l.serverURL)throw new Error("Option 'serverURL' is missing!");const i=t.reactive({...l}),c=t.reactive({comment:o,pageview:a,path:n}),s=r?t.createApp((()=>t.h(Xt,{path:c.path,...i}))):null;s&&l.recaptchaV3Key&&s.use(pe,{siteKey:l.recaptchaV3Key,loaderOptions:{useRecaptchaNet:!0,autoHideBadge:!0}}),s&&s.mount(r);const m=t.watchEffect((()=>{c.comment&&ee({serverURL:i.serverURL,path:c.path,selector:"string"==typeof c.comment?c.comment:void 0})})),d=t.watchEffect((()=>{c.pageview&&tn({serverURL:i.serverURL,path:c.path,selector:"string"==typeof c.pageview?c.pageview:void 0})}));return{el:r,update:({comment:e,pageview:t,path:n=window.location.pathname,...o}={})=>{Object.entries(o).forEach((([e,t])=>{i[e]=t})),c.path=n,void 0!==e&&(c.comment=e),void 0!==t&&(c.pageview=t)},destroy:()=>{s?.unmount(),m(),d()}}},exports.pageviewCount=tn,exports.version="2.10.0";
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@vueuse/core"),t=require("vue"),n=require("autosize"),o=require("marked");function a(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var l=a(n);const r=["nick","mail","link"],i=e=>e.filter((e=>r.includes(e))),c=e=>new Promise(((t,n)=>{if(e.size>128e3)return n(new Error("File too large! File size limit 128KB"));const o=new FileReader;o.readAsDataURL(e),o.onload=()=>t(o.result?.toString()||""),o.onerror=n})),s=e=>!0===e?'<p class="wl-tex">Tex is not available in preview</p>':'<span class="wl-tex">Tex is not available in preview</span>',m=()=>{const e={next:""},t=({keyword:e,pos:t})=>{const n=new URLSearchParams("media_filter=minimal");return n.set("key","PAY5JLFIH6V6"),n.set("limit","20"),n.set("pos",t||""),n.set("q",e),fetch(`https://g.tenor.com/v1/search?${n.toString()}`,{headers:{"Content-Type":"application/json"}}).then((e=>e.json())).catch((()=>({next:t||"",results:[]})))};return{search:(n="")=>t({keyword:n}).then((t=>(e.next=t.next,t.results.map((e=>({title:e.title,src:e.media[0].tinygif.url})))))),more:n=>t({keyword:n,pos:e.next}).then((t=>(e.next=t.next,t.results.map((e=>({title:e.title,src:e.media[0].tinygif.url}))))))}},d=["//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"],u=new RegExp(`(${/[\u4E00-\u9FFF\u3400-\u4dbf\uf900-\ufaff\u3040-\u309f\uac00-\ud7af\u0400-\u04FF]+|\w+/.source}|${/</.source})|((?:${/(?:^|\s)\/\/(.+?)$/gm.source})|(?:${/\/\*([\S\s]*?)\*\//gm.source}))`,"gmi"),p=["23AC69","91C132","F19726","E8552D","1AAB8E","E1147F","2980C1","1BA1E6","9FA0A0","F19726","E30B20","E30B20","A3338B"],g={},h=e=>{let t=0;return e.replace(u,((e,n,o)=>{if(o)return`<span style="color: slategray">${o}</span>`;if("<"===n)return"&lt;";let a;g[n]?a=g[n]:(a=p[t],g[n]=a);const l=`<span style="color: #${a}">${n}</span>`;return t=++t%p.length,l}))},v=["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"],f=e=>Object.fromEntries(e.map(((e,t)=>[v[t],e])));var y=f(["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!\n 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?"]),k=f(["ニックネーム","3バイト以上のニックネームをご入力ください.","メールアドレス","メールアドレスをご確認ください.","サイト","オプション","ここにコメント","コメントしましょう~","提出する","Like","Cancel like","返信する","キャンセル","コメント","更新","さらに読み込む","プレビュー","絵文字","画像をアップロード","秒前","分前","時間前","日前","たっだ今","アップロード","ログインする","ログアウト","管理者","トップに置く","ワード","コメントは $0 から $1 ワードの間でなければなりません!\n 現在の単語番号: $2","匿名","うえにん","なかにん","しもおし","特にしもおし","かげ","なぬし","GIF","探す GIF","個人情報","承認済み","待っている","スパム","べたつかない","逆順","正順","人気順","どう思いますか?"]),w=f(["昵称","昵称不能少于3个字符","邮箱","请填写正确的邮件地址","网址","可选","欢迎评论","来发评论吧~","提交","喜欢","取消喜欢","回复","取消回复","评论","刷新","加载更多...","预览","表情","上传图片","秒前","分钟前","小时前","天前","刚刚","正在上传","登录","退出","博主","置顶","字","评论字数应在 $0 到 $1 字之间!\n当前字数:$2","匿名","潜水","冒泡","吐槽","活跃","话痨","传说","表情包","搜索表情包","个人资料","通过","待审核","垃圾","取消置顶","按倒序","按正序","按热度","你认为这篇文章怎么样?"]),C=f(["暱稱","暱稱不能少於3個字元","郵箱","請填寫正確的郵件地址","網址","可選","歡迎評論","來發評論吧~","提交","喜歡","取消喜歡","回覆","取消回覆","評論","刷新","載入更多...","預覽","表情","上傳圖片","秒前","分鐘前","小時前","天前","剛剛","正在上傳","登錄","退出","博主","置頂","字","評論字數應在 $0 到 $1 字之間!\n當前字數:$2","匿名","潛水","冒泡","吐槽","活躍","話癆","傳說","表情包","搜索表情包","個人資料","通過","待審核","垃圾","取消置頂","按倒序","按正序","按熱度","你認為這篇文章怎麼樣?"]),b=f(["Apelido","Apelido não pode ser menor que 3 bytes.","E-Mail","Por favor, confirme seu endereço de e-mail.","Website","Opcional","Comente aqui...","Nenhum comentário, ainda.","Enviar","Like","Cancel like","Responder","Cancelar resposta","Comentários","Refrescar","Carregar Mais...","Visualizar","Emoji","Enviar Imagem","segundos atrás","minutos atrás","horas atrás","dias atrás","agora mesmo","Enviando","Entrar","Sair","Admin","Sticky","Palavras","Favor enviar comentário com $0 a $1 palavras!\n Número de palavras atuais: $2","Anônimo","Dwarves","Hobbits","Ents","Wizards","Elves","Maiar","GIF","Pesquisar GIF","informação pessoal","Aprovado","Espera","Spam","Unsticky","Mais velho","Mais recentes","Mais quente","O que você acha?"]),E=f(["Псевдоним","Никнейм не может быть меньше 3 байт.","Эл. адрес","Пожалуйста, подтвердите адрес вашей электронной почты.","Веб-сайт","Необязательный","Комментарий здесь...","Пока нет комментариев.","Отправить","Like","Cancel like","Отвечать","Отменить ответ","Комментарии","Обновить","Загрузи больше...","Превью","эмодзи","Загрузить изображение","секунд назад","несколько минут назад","несколько часов назад","дней назад","прямо сейчас","Загрузка","Авторизоваться","Выход из системы","Админ","Липкий","Слова","Пожалуйста, введите комментарии от $0 до $1 слов!\nНомер текущего слова: $2","Анонимный","Dwarves","Hobbits","Ents","Wizards","Elves","Maiar","GIF","Поиск GIF","Персональные данные","Одобренный","Ожидающий","Спам","Нелипкий","самый старый","последний","самый горячий","Что вы думаете?"]);const B={zh:w,"zh-cn":w,"zh-CN":w,"zh-tw":C,"zh-TW":C,en:y,"en-US":y,"en-us":y,jp:k,"jp-jp":k,"jp-JP":k,"pt-br":b,"pt-BR":b,ru:E,"ru-ru":E,"ru-RU":E},L=e=>{try{e=decodeURI(e)}catch(e){}return e},V=(e="")=>e.replace(/\/$/u,""),N=e=>/^(https?:)?\/\//.test(e),S=e=>{const t=V(e);return N(t)?t:`https://${t}`},$=e=>Array.isArray(e)?e:!!e&&[0,e],I=(e,t)=>"function"==typeof e?e:!1!==e&&t,R="{--waline-white:#000;--waline-light-grey:#666;--waline-dark-grey:#999;--waline-color:#888;--waline-bgcolor:#1e1e1e;--waline-bgcolor-light:#272727;--waline-bgcolor-hover: #444;--waline-border-color:#333;--waline-disable-bgcolor:#444;--waline-disable-color:#272727;--waline-bq-color:#272727;--waline-info-bgcolor:#272727;--waline-info-color:#666}",x=(e,t)=>{let n=e.toString();for(;n.length<t;)n="0"+n;return n},j=(e,t,n)=>{if(!e)return"";const o="string"==typeof e?new Date(-1!==e.indexOf(" ")?e.replace(/-/g,"/"):e):e,a=t.getTime()-o.getTime(),l=Math.floor(a/864e5);if(0===l){const e=a%864e5,t=Math.floor(e/36e5);if(0===t){const t=e%36e5,o=Math.floor(t/6e4);if(0===o){const e=t%6e4;return`${Math.round(e/1e3)} ${n.seconds}`}return`${o} ${n.minutes}`}return`${t} ${n.hours}`}return l<0?n.now:l<8?`${l} ${n.days}`:(e=>{const t=x(e.getDate(),2),n=x(e.getMonth()+1,2);return`${x(e.getFullYear(),2)}-${n}-${t}`})(o)},A=t=>{const n=e.useStorage("WALINE_EMOJI",{}),o=Boolean(/@[0-9]+\.[0-9]+\.[0-9]+/.test(t));if(o){const e=n.value[t];if(e)return Promise.resolve(e)}return fetch(`${t}/info.json`).then((e=>e.json())).then((e=>{const a={folder:t,...e};return o&&(n.value[t]=a),a}))},z=(e,t="",n="",o="")=>`${t?`${t}/`:""}${n}${e}${o?`.${o}`:""}`,D=e=>{"AbortError"!==e.name&&console.error(e.message)},U={"Content-Type":"application/json"},M=(e,t="")=>{if("object"==typeof e&&e.errno)throw new TypeError(`Fetch ${t} failed with ${e.errno}: ${e.errmsg}`);return e},P=({serverURL:e,lang:t,token:n,objectId:o,...a})=>fetch(`${e}/comment/${o}?lang=${t}`,{method:"PUT",headers:{"Content-Type":"application/json",Authorization:`Bearer ${n}`},body:JSON.stringify(a)}).then((e=>e.json())),T=({serverURL:e,lang:t,paths:n,type:o,signal:a})=>fetch(`${e}/article?path=${encodeURIComponent(n.join(","))}&type=${encodeURIComponent(o.join(","))}&lang=${t}`,{signal:a}).then((e=>e.json())).then((e=>M(e,"article count"))),_=({serverURL:e,lang:t,path:n,type:o,action:a})=>fetch(`${e}/article?lang=${t}`,{method:"POST",headers:U,body:JSON.stringify({path:n,type:o,action:a})}).then((e=>e.json())).then((e=>M(e,"article count"))),O=e=>e instanceof HTMLElement?e:"string"==typeof e?document.querySelector(e):null,H=e=>e.type.includes("image"),F=e=>{const t=Array.from(e).find(H);return t?t.getAsFile():null},W=/\$.*?\$/,G=/^\$(.*?)\$/,q=/^(?:\s{0,3})\$\$((?:[^\n]|\n[^\n])+?)\n{0,1}\$\$/,K=(e="",t={})=>e.replace(/:(.+?):/g,((e,n)=>t[n]?`<img class="wl-emoji" src="${t[n]}" alt="${n}">`:e)),J=(e,{emojiMap:t,highlighter:n,texRenderer:a})=>{if(o.marked.setOptions({highlight:n||void 0,breaks:!0,smartLists:!0,smartypants:!0}),a){const e=(e=>[{name:"blockMath",level:"block",tokenizer(t){const n=q.exec(t);if(null!==n)return{type:"html",raw:n[0],text:e(!0,n[1])}}},{name:"inlineMath",level:"inline",start(e){const t=e.search(W);return-1!==t?t:e.length},tokenizer(t){const n=G.exec(t);if(null!==n)return{type:"html",raw:n[0],text:e(!1,n[1])}}}])(a);o.marked.use({extensions:e})}return o.marked.parse(K(e,t))},Z=e=>e.dataset.path||e.getAttribute("id");let Y=null;const Q=()=>Y||(Y=e.useStorage("WALINE_USER",{}));let X=null;const ee=()=>X||(X=e.useStorage("WALINE_LIKE",[])),te=({serverURL:e,path:t=window.location.pathname,selector:n=".waline-comment-count",lang:o="zh-CN"})=>{const a=new AbortController,l=document.querySelectorAll(n),r=Q();return l.length&&(({serverURL:e,lang:t,paths:n,signal:o,token:a})=>{const l={};return a&&(l.Authorization=`Bearer ${a}`),fetch(`${e}/comment?type=count&url=${encodeURIComponent(n.join(","))}&lang=${t}`,{signal:o,headers:l}).then((e=>e.json())).then((e=>M(e,"comment count"))).then((e=>Array.isArray(e)?e:[e]))})({serverURL:S(e),paths:Array.from(l).map((e=>L(e.dataset.path||e.getAttribute("id")||t))),lang:o,signal:a.signal,token:r.value?.token}).then((e=>{l.forEach(((t,n)=>{t.innerText=e[n].toString()}))})).catch(D),a.abort.bind(a)};var ne="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},oe={},ae={},le={},re=ne&&ne.__awaiter||function(e,t,n,o){return new(n||(n=Promise))((function(a,l){function r(e){try{c(o.next(e))}catch(e){l(e)}}function i(e){try{c(o.throw(e))}catch(e){l(e)}}function c(e){var t;e.done?a(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(r,i)}c((o=o.apply(e,t||[])).next())}))},ie=ne&&ne.__generator||function(e,t){var n,o,a,l,r={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]};return l={next:i(0),throw:i(1),return:i(2)},"function"==typeof Symbol&&(l[Symbol.iterator]=function(){return this}),l;function i(l){return function(i){return function(l){if(n)throw new TypeError("Generator is already executing.");for(;r;)try{if(n=1,o&&(a=2&l[0]?o.return:l[0]?o.throw||((a=o.return)&&a.call(o),0):o.next)&&!(a=a.call(o,l[1])).done)return a;switch(o=0,a&&(l=[2&l[0],a.value]),l[0]){case 0:case 1:a=l;break;case 4:return r.label++,{value:l[1],done:!1};case 5:r.label++,o=l[1],l=[0];continue;case 7:l=r.ops.pop(),r.trys.pop();continue;default:if(!(a=r.trys,(a=a.length>0&&a[a.length-1])||6!==l[0]&&2!==l[0])){r=0;continue}if(3===l[0]&&(!a||l[1]>a[0]&&l[1]<a[3])){r.label=l[1];break}if(6===l[0]&&r.label<a[1]){r.label=a[1],a=l;break}if(a&&r.label<a[2]){r.label=a[2],r.ops.push(l);break}a[2]&&r.ops.pop(),r.trys.pop();continue}l=t.call(e,r)}catch(e){l=[6,e],o=0}finally{n=a=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}([l,i])}}};Object.defineProperty(le,"__esModule",{value:!0}),le.ReCaptchaInstance=void 0;var ce=function(){function e(e,t,n){this.siteKey=e,this.recaptchaID=t,this.recaptcha=n,this.styleContainer=null}return e.prototype.execute=function(e){return re(this,void 0,void 0,(function(){return ie(this,(function(t){return[2,this.recaptcha.enterprise?this.recaptcha.enterprise.execute(this.recaptchaID,{action:e}):this.recaptcha.execute(this.recaptchaID,{action:e})]}))}))},e.prototype.getSiteKey=function(){return this.siteKey},e.prototype.hideBadge=function(){null===this.styleContainer&&(this.styleContainer=document.createElement("style"),this.styleContainer.innerHTML=".grecaptcha-badge{visibility:hidden !important;}",document.head.appendChild(this.styleContainer))},e.prototype.showBadge=function(){null!==this.styleContainer&&(document.head.removeChild(this.styleContainer),this.styleContainer=null)},e}();le.ReCaptchaInstance=ce,Object.defineProperty(ae,"__esModule",{value:!0}),ae.getInstance=ae.load=void 0;var se,me=le;!function(e){e[e.NOT_LOADED=0]="NOT_LOADED",e[e.LOADING=1]="LOADING",e[e.LOADED=2]="LOADED"}(se||(se={}));var de=function(){function e(){}return e.load=function(t,n){if(void 0===n&&(n={}),"undefined"==typeof document)return Promise.reject(new Error("This is a library for the browser!"));if(e.getLoadingState()===se.LOADED)return e.instance.getSiteKey()===t?Promise.resolve(e.instance):Promise.reject(new Error("reCAPTCHA already loaded with different site key!"));if(e.getLoadingState()===se.LOADING)return t!==e.instanceSiteKey?Promise.reject(new Error("reCAPTCHA already loaded with different site key!")):new Promise((function(t,n){e.successfulLoadingConsumers.push((function(e){return t(e)})),e.errorLoadingRunnable.push((function(e){return n(e)}))}));e.instanceSiteKey=t,e.setLoadingState(se.LOADING);var o=new e;return new Promise((function(a,l){o.loadScript(t,n.useRecaptchaNet||!1,n.useEnterprise||!1,n.renderParameters?n.renderParameters:{},n.customUrl).then((function(){e.setLoadingState(se.LOADED);var l=o.doExplicitRender(grecaptcha,t,n.explicitRenderParameters?n.explicitRenderParameters:{},n.useEnterprise||!1),r=new me.ReCaptchaInstance(t,l,grecaptcha);e.successfulLoadingConsumers.forEach((function(e){return e(r)})),e.successfulLoadingConsumers=[],n.autoHideBadge&&r.hideBadge(),e.instance=r,a(r)})).catch((function(t){e.errorLoadingRunnable.forEach((function(e){return e(t)})),e.errorLoadingRunnable=[],l(t)}))}))},e.getInstance=function(){return e.instance},e.setLoadingState=function(t){e.loadingState=t},e.getLoadingState=function(){return null===e.loadingState?se.NOT_LOADED:e.loadingState},e.prototype.loadScript=function(t,n,o,a,l){var r=this;void 0===n&&(n=!1),void 0===o&&(o=!1),void 0===a&&(a={}),void 0===l&&(l="");var i=document.createElement("script");i.setAttribute("recaptcha-v3-script","");var c="https://www.google.com/recaptcha/api.js";n&&(c=o?"https://recaptcha.net/recaptcha/enterprise.js":"https://recaptcha.net/recaptcha/api.js"),o&&(c="https://www.google.com/recaptcha/enterprise.js"),l&&(c=l),a.render&&(a.render=void 0);var s=this.buildQueryString(a);return i.src=c+"?render=explicit"+s,new Promise((function(t,n){i.addEventListener("load",r.waitForScriptToLoad((function(){t(i)}),o),!1),i.onerror=function(t){e.setLoadingState(se.NOT_LOADED),n(t)},document.head.appendChild(i)}))},e.prototype.buildQueryString=function(e){return Object.keys(e).length<1?"":"&"+Object.keys(e).filter((function(t){return!!e[t]})).map((function(t){return t+"="+e[t]})).join("&")},e.prototype.waitForScriptToLoad=function(t,n){var o=this;return function(){void 0===window.grecaptcha?setTimeout((function(){o.waitForScriptToLoad(t,n)}),e.SCRIPT_LOAD_DELAY):n?window.grecaptcha.enterprise.ready((function(){t()})):window.grecaptcha.ready((function(){t()}))}},e.prototype.doExplicitRender=function(e,t,n,o){var a={sitekey:t,badge:n.badge,size:n.size,tabindex:n.tabindex};return n.container?o?e.enterprise.render(n.container,a):e.render(n.container,a):o?e.enterprise.render(a):e.render(a)},e.loadingState=null,e.instance=null,e.instanceSiteKey=null,e.successfulLoadingConsumers=[],e.errorLoadingRunnable=[],e.SCRIPT_LOAD_DELAY=25,e}();ae.load=de.load,ae.getInstance=de.getInstance,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.ReCaptchaInstance=e.getInstance=e.load=void 0;var t=ae;Object.defineProperty(e,"load",{enumerable:!0,get:function(){return t.load}}),Object.defineProperty(e,"getInstance",{enumerable:!0,get:function(){return t.getInstance}});var n=le;Object.defineProperty(e,"ReCaptchaInstance",{enumerable:!0,get:function(){return n.ReCaptchaInstance}})}(oe);const ue=Symbol("VueReCaptchaInjectKey"),pe={loadedWaiters:[],error:null},ge={install(e,n){const o=t.ref(!1),a=t.ref(void 0);e.config.globalProperties.$recaptchaLoaded=he(o),async function(e){return await oe.load(e.siteKey,e.loaderOptions)}(n).then((t=>{o.value=!0,a.value=t,e.config.globalProperties.$recaptcha=ve(a),e.config.globalProperties.$recaptchaInstance=a,pe.loadedWaiters.forEach((e=>e.resolve(!0)))})).catch((e=>{pe.error=e,pe.loadedWaiters.forEach((t=>t.reject(e)))})),e.provide(ue,{instance:a,isLoaded:o,executeRecaptcha:ve(a),recaptchaLoaded:he(o)})}};function he(e){return()=>new Promise(((t,n)=>null!==pe.error?n(pe.error):e.value?t(!0):void pe.loadedWaiters.push({resolve:t,reject:n})))}function ve(e){return async t=>await(e.value?.execute(t))}let fe=null;const ye=()=>fe||(fe=e.useStorage("WALINE_VOTE",[]));var ke=t.defineComponent({setup(){const e=t.ref([]),n=ye(),o=t.inject("config"),a=t.computed((()=>o.value.locale)),l=t.computed((()=>{const{path:t}=o.value;return Array.isArray(o.value.reaction)?o.value.reaction.map(((o,l)=>({icon:o,vote:e.value[l]||0,desc:a.value[`reaction${l}`],active:Boolean(n.value.find((({u:e,i:n})=>e===t&&n===l)))}))):[]})),r=new AbortController;return t.onMounted((()=>(async()=>{const{serverURL:t,lang:n,path:a,reaction:l}=o.value;if(!Array.isArray(l))return;const i=await T({serverURL:t,lang:n,paths:[a],type:l.map(((e,t)=>`reaction${t}`)),signal:r.signal});Array.isArray(i)||"number"==typeof i||(e.value=l.map(((e,t)=>i[`reaction${t}`])))})())),t.onUnmounted((()=>r.abort())),{reaction:l,locale:a,onVote:async t=>{const{serverURL:a,lang:l,path:r}=o.value,i=n.value.find((({u:e})=>e===r));i&&i.i===t||(await _({serverURL:a,lang:l,path:r,type:`reaction${t}`}),e.value[t]=(e.value[t]||0)+1,i?(e.value[i.i]=Math.max(e.value[i.i]-1,0),_({serverURL:a,lang:l,path:r,type:`reaction${i.i}`,action:"desc"}),i.i=t,n.value=Array.from(n.value)):n.value=[...n.value,{u:r,i:t}],n.value.length>50&&(n.value=n.value.slice(-50)))}}}}),we=(e,t)=>{const n=e.__vccOpts||e;for(const[e,o]of t)n[e]=o;return n};const Ce={key:0,class:"wl-reaction"},be=["onClick"],Ee={class:"wl-reaction__img"},Be=["src","alt"],Le={class:"wl-reaction__votes"},Ve={class:"wl-reaction__text"};var Ne=we(ke,[["render",function(e,n,o,a,l,r){return e.reaction&&e.reaction.length?(t.openBlock(),t.createElementBlock("div",Ce,[t.createElementVNode("h4",null,t.toDisplayString(e.locale.reactionTitle),1),t.createElementVNode("ul",null,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(e.reaction,((n,o)=>(t.openBlock(),t.createElementBlock("li",{key:o,class:t.normalizeClass(n.active?"active":""),onClick:t=>e.onVote(o)},[t.createElementVNode("div",Ee,[t.createElementVNode("img",{src:n.icon,alt:n.desc},null,8,Be),t.createElementVNode("div",Le,t.toDisplayString(n.vote),1)]),t.createElementVNode("div",Ve,t.toDisplayString(n.desc),1)],10,be)))),128))])])):t.createCommentVNode("v-if",!0)}],["__file","ArticleReaction.vue"]]);const Se=({size:e})=>t.h("svg",{width:e,height:e,viewBox:"0 0 100 100",preserveAspectRatio:"xMidYMid"},t.h("circle",{cx:50,cy:50,fill:"none",stroke:"currentColor",strokeWidth:"4",r:"40","stroke-dasharray":"85 30"},t.h("animateTransform",{attributeName:"transform",type:"rotate",repeatCount:"indefinite",dur:"1s",values:"0 50 50;360 50 50",keyTimes:"0;1"})));var $e=t.defineComponent({name:"ImageWall",components:{LoadingIcon:Se},props:{items:{type:Array,default:()=>[]},columnWidth:{type:Number,default:300},gap:{type:Number,default:0}},emits:["insert"],setup(e){let n=null;const o=t.ref(null),a=t.ref({}),l=t.ref([]),r=()=>{const t=Math.floor((o.value.getBoundingClientRect().width+e.gap)/(e.columnWidth+e.gap));return t>0?t:1},i=async n=>{if(n>=e.items.length)return;await t.nextTick();const a=Array.from(o.value?.children||[]).reduce(((e,t)=>t.getBoundingClientRect().height<e.getBoundingClientRect().height?t:e));l.value[Number(a.dataset.index)].push(n),await i(n+1)},c=async(e=!1)=>{if(l.value.length===r()&&!e)return;var t;l.value=(t=r(),new Array(t).fill(null).map((()=>[])));const n=window.scrollY;await i(0),window.scrollTo({top:n})};return t.watch((()=>[e.items]),(()=>{a.value={},c(!0)})),t.watch((()=>[e.columnWidth,e.gap]),(()=>c())),t.onMounted((()=>{c(!0),n=new ResizeObserver((()=>c())),n.observe(o.value)})),t.onBeforeUnmount((()=>n.unobserve(o.value))),{columns:l,state:a,wall:o}}});const Ie=["data-index"],Re=["src","title","onLoad","onClick"];var xe=we($e,[["render",function(e,n,o,a,l,r){const i=t.resolveComponent("LoadingIcon");return t.openBlock(),t.createElementBlock("div",{ref:"wall",class:"wl-gallery",style:t.normalizeStyle({gap:`${e.gap}px`})},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(e.columns,((n,o)=>(t.openBlock(),t.createElementBlock("div",{key:o,class:"wl-gallery-column","data-index":o,style:t.normalizeStyle({gap:`${e.gap}px`})},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(n,(n=>(t.openBlock(),t.createElementBlock(t.Fragment,{key:n},[e.state[e.items[n].src]?t.createCommentVNode("v-if",!0):(t.openBlock(),t.createBlock(i,{key:0,size:36,style:{margin:"20px auto"}})),t.createElementVNode("img",{class:"wl-gallery-item",src:e.items[n].src,title:e.items[n].title,loading:"lazy",onLoad:t=>e.state[e.items[n].src]=!0,onClick:t=>e.$emit("insert",`![](${e.items[n].src})`)},null,40,Re)],64)))),128))],12,Ie)))),128))],4)}],["__file","ImageWall.vue"]]),je=t.defineComponent({name:"CommentBox",components:{CloseIcon:({size:e})=>t.h("svg",{class:"wl-close-icon",viewBox:"0 0 1024 1024",width:e,height:e},[t.h("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"}),t.h("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"})]),EmojiIcon:()=>t.h("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},t.h("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"})),ImageIcon:()=>t.h("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},[t.h("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"}),t.h("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"})]),ImageWall:xe,MarkdownIcon:()=>t.h("svg",{width:"16",height:"16",ariaHidden:"true"},t.h("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"})),PreviewIcon:()=>t.h("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},[t.h("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"}),t.h("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"})]),LoadingIcon:Se,GifIcon:()=>t.h("svg",{width:24,height:24,fill:"currentcolor",viewBox:"0 0 24 24"},[t.h("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"}),t.h("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"})])},props:{rootId:{type:String,default:""},replyId:{type:String,default:""},replyUser:{type:String,default:""},edit:{type:Object,default:null}},emits:["submit","cancel-reply","cancel-edit"],setup(n,{emit:o}){const a=t.inject("config"),r=e.useStorage("WALINE_COMMENT_BOX_EDITOR",""),i=e.useStorage("WALINE_USER_META",{nick:"",mail:"",link:""}),c=Q(),s=t.inject(ue),m=t.ref({}),d=t.ref(null),u=t.ref(null),p=t.ref(null),g=t.ref(null),h=t.ref(null),v=t.ref(null),f=t.ref(null),y=t.ref({tabs:[],map:{}}),k=t.ref(0),w=t.ref(!1),C=t.ref(!1),b=t.ref(!1),E=t.ref(""),B=t.ref(0),L=t.reactive({loading:!0,list:[]}),N=t.ref(0),S=t.ref(!1),$=t.ref(""),I=t.ref(!1),R=t.computed((()=>a.value.locale)),x=t.computed((()=>Boolean(c.value?.token))),j=t.computed((()=>!1!==a.value.imageUploader)),D=e=>{const t=d.value,n=t.selectionStart,o=t.selectionEnd||0,a=t.scrollTop;r.value=t.value.substring(0,n)+e+t.value.substring(o,t.value.length),t.focus(),t.selectionStart=n+e.length,t.selectionEnd=n+e.length,t.scrollTop=a},U=e=>{const t=`![${a.value.locale.uploading} ${e.name}]()`;return D(t),Promise.resolve().then((()=>a.value.imageUploader(e))).then((n=>{r.value=r.value.replace(t,`\r\n![${e.name}](${n})`)})).catch((e=>{alert(e.message),r.value=r.value.replace(t,"")}))},M=async()=>{const{serverURL:e,lang:t,login:l,wordLimit:u,requiredMeta:p}=a.value;let g="";if(s){const{executeRecaptcha:e,recaptchaLoaded:t}=s;await t(),g=await e("social")}const h={comment:$.value,nick:i.value.nick,mail:i.value.mail,link:i.value.link,ua:navigator.userAgent,url:a.value.path,recaptchaV3:g};if(c.value?.token)h.nick=c.value.display_name,h.mail=c.value.email,h.link=c.value.url;else{if("force"===l)return;if(p.indexOf("nick")>-1&&!h.nick)return m.value.nick?.focus(),alert(R.value.nickError);if(p.indexOf("mail")>-1&&!h.mail||h.mail&&!/^\w(?:[\w._-]*\w)?@(?:\w(?:[\w-]*\w)?\.)*\w+$/.exec(h.mail))return m.value.mail?.focus(),alert(R.value.mailError);if(!h.comment)return void d.value?.focus();h.nick||(h.nick=R.value.anonymous)}if(!S.value)return alert(R.value.wordHint.replace("$0",u[0].toString()).replace("$1",u[1].toString()).replace("$2",B.value.toString()));h.comment=K(h.comment,y.value.map),n.replyId&&n.rootId?(h.pid=n.replyId,h.rid=n.rootId,h.at=n.replyUser):n.edit&&(h.eid=n.edit.objectId),I.value=!0,(({serverURL:e,lang:t,token:n,comment:o})=>{const a={"Content-Type":"application/json"};return n&&(a.Authorization=`Bearer ${n}`),o.eid?fetch(`${e}/comment/${o.eid}?lang=${t}`,{method:"PUT",headers:a,body:JSON.stringify(o)}).then((e=>e.json())):fetch(`${e}/comment?lang=${t}`,{method:"POST",headers:a,body:JSON.stringify(o)}).then((e=>e.json()))})({serverURL:e,lang:t,token:c.value?.token,comment:h}).then((e=>{if(I.value=!1,e.errmsg)return alert(e.errmsg);o("submit",e.data),r.value="",E.value="",n.replyId&&o("cancel-reply"),n.edit?.objectId&&o("cancel-edit")})).catch((e=>{I.value=!1,alert(e.message)}))},P=e=>{p.value.contains(e.target)||g.value.contains(e.target)||(w.value=!1),h.value.contains(e.target)||v.value.contains(e.target)||(C.value=!1)},T=async e=>{const{scrollTop:t,clientHeight:n,scrollHeight:o}=e.target,l=(n+t)/o,r=a.value.search,i=f.value?.value||"";l<.9||L.loading||(L.loading=!0,L.list.push(...r.more?await r.more(i,L.list.length):await r.search(i)),L.loading=!1,setTimeout((()=>{e.target.scrollTop=t}),50))},_=e.useDebounceFn((e=>{L.list=[],T(e)}),300);t.watch([a,B],(([e,t])=>{const{wordLimit:n}=e;n?t<n[0]&&0!==n[0]?(N.value=n[0],S.value=!1):t>n[1]?(N.value=n[1],S.value=!1):(N.value=n[1],S.value=!0):(N.value=0,S.value=!0)}),{immediate:!0}),t.watch(C,(async e=>{if(!e)return;const t=a.value.search;f.value&&(f.value.value=""),L.loading=!0,L.list=t.default?await t.default():await t.search(""),L.loading=!1}));const O=({data:e})=>{e&&"profile"===e.type&&(c.value={...c.value,...e.data},[localStorage,sessionStorage].filter((e=>e.getItem("WALINE_USER"))).forEach((e=>e.setItem("WALINE_USER",JSON.stringify(c)))))};return t.onMounted((()=>{document.body.addEventListener("click",P),window.addEventListener("message",O),n.edit?.objectId&&(r.value=n.edit.orig),t.watch((()=>r.value),(e=>{const{highlighter:t,texRenderer:n}=a.value;$.value=e,E.value=J(e,{emojiMap:y.value.map,highlighter:t,texRenderer:n}),B.value=(e=>(e=>e.match(/[\w\d\s\u00C0-\u024F]+/giu)||[])(e).reduce(((e,t)=>e+(""===t.trim()?0:t.trim().split(/\s+/u).length)),0)+(e=>e.match(/[\u4E00-\u9FA5]/gu)||[])(e).length)(e),e?l.default(d.value):l.default.destroy(d.value)}),{immediate:!0}),t.watch((()=>a.value.emoji),(e=>{return(t=Array.isArray(e)?e:[],Promise.all(t.map((e=>"string"==typeof e?A(V(e)):Promise.resolve(e)))).then((e=>{const t={tabs:[],map:{}};return e.forEach((e=>{const{name:n,folder:o,icon:a,prefix:l,type:r,items:i}=e;t.tabs.push({name:n,icon:z(a,o,l,r),items:i.map((e=>{const n=`${l||""}${e}`;return t.map[n]=z(e,o,l,r),n}))})})),t}))).then((e=>{y.value=e}));var t}),{immediate:!0})})),t.onUnmounted((()=>{document.body.removeEventListener("click",P),window.removeEventListener("message",O)})),{config:a,locale:R,insert:D,onChange:()=>{const e=u.value;e.files&&j.value&&U(e.files[0]).then((()=>{e.value=""}))},onDrop:e=>{if(e.dataTransfer?.items){const t=F(e.dataTransfer.items);t&&j.value&&(U(t),e.preventDefault())}},onKeyDown:e=>{const t=e.key;(e.ctrlKey||e.metaKey)&&"Enter"===t&&M()},onPaste:e=>{if(e.clipboardData){const t=F(e.clipboardData.items);t&&j.value&&U(t)}},onLogin:e=>{e.preventDefault();const{lang:t,serverURL:n}=a.value,o=(window.innerWidth-450)/2,l=(window.innerHeight-450)/2,r=window.open(`${n}/ui/login?lng=${encodeURIComponent(t)}`,"_blank",`width=450,height=450,left=${o},top=${l},scrollbars=no,resizable=no,status=no,location=no,toolbar=no,menubar=no`);r?.postMessage({type:"TOKEN",data:null},"*");const i=({data:e})=>{e&&"userInfo"===e.type&&e.data.token&&(r?.close(),c.value=e.data,(e.data.remember?localStorage:sessionStorage).setItem("WALINE_USER",JSON.stringify(e.data)),window.removeEventListener("message",i))};window.addEventListener("message",i)},onLogout:()=>{c.value={},localStorage.setItem("WALINE_USER","null"),sessionStorage.setItem("WALINE_USER","null")},onProfile:e=>{e.preventDefault();const{lang:t,serverURL:n}=a.value,o=(window.innerWidth-800)/2,l=(window.innerHeight-800)/2;window.open(`${n}/ui/profile?lng=${encodeURIComponent(t)}`,"_blank",`width=800,height=800,left=${o},top=${l},scrollbars=no,resizable=no,status=no,location=no,toolbar=no,menubar=no`)?.postMessage({type:"TOKEN",data:c.value.token},"*")},submitComment:M,onImageWallScroll:T,onGifSearch:_,isLogin:x,userInfo:c,isSubmitting:I,wordNumber:B,wordLimit:N,isWordNumberLegal:S,editor:r,userMeta:i,emoji:y,emojiTabIndex:k,showEmoji:w,gifData:L,showGif:C,canUploadImage:j,previewText:E,showPreview:b,inputRefs:m,editorRef:d,emojiButtonRef:p,emojiPopupRef:g,gifButtonRef:h,gifPopupRef:v,imageUploadRef:u,gifSearchInputRef:f}}});const Ae={class:"wl-comment"},ze={key:0,class:"wl-login-info"},De={class:"wl-avatar"},Ue=["title"],Me=["title"],Pe=["src"],Te=["title","textContent"],_e={class:"wl-panel"},Oe=["for","textContent"],He=["id","onUpdate:modelValue","name","type"],Fe=["placeholder"],We={class:"wl-preview"},Ge=t.createElementVNode("hr",null,null,-1),qe=["innerHTML"],Ke={class:"wl-footer"},Je={class:"wl-actions"},Ze={href:"https://guides.github.com/features/mastering-markdown/",title:"Markdown Guide","aria-label":"Markdown is supported",class:"wl-action",target:"_blank",rel:"noreferrer"},Ye=["title"],Qe=["title"],Xe=["title"],et=["title"],tt={class:"wl-info"},nt={class:"wl-text-number"},ot={key:0},at=t.createTextVNode("  /  "),lt=["textContent"],rt=["textContent"],it=["disabled"],ct=["placeholder"],st={key:0,class:"wl-loading"},mt={key:0,class:"wl-tab-wrapper"},dt=["title","onClick"],ut=["src","alt"],pt={key:0,class:"wl-tabs"},gt=["onClick"],ht=["src","alt","title"],vt=["title"];var ft=we(je,[["render",function(e,n,o,a,l,r){const i=t.resolveComponent("CloseIcon"),c=t.resolveComponent("MarkdownIcon"),s=t.resolveComponent("EmojiIcon"),m=t.resolveComponent("GifIcon"),d=t.resolveComponent("ImageIcon"),u=t.resolveComponent("PreviewIcon"),p=t.resolveComponent("LoadingIcon"),g=t.resolveComponent("ImageWall");return t.openBlock(),t.createElementBlock("div",Ae,["disable"!==e.config.login&&e.isLogin&&!e.edit?.objectId?(t.openBlock(),t.createElementBlock("div",ze,[t.createElementVNode("div",De,[t.createElementVNode("button",{class:"wl-logout-btn",title:e.locale.logout,onClick:n[0]||(n[0]=(...t)=>e.onLogout&&e.onLogout(...t))},[t.createVNode(i,{size:14})],8,Ue),t.createElementVNode("a",{href:"#",class:"wl-login-nick","aria-label":"Profile",title:e.locale.profile,onClick:n[1]||(n[1]=(...t)=>e.onProfile&&e.onProfile(...t))},[t.createElementVNode("img",{src:e.userInfo.avatar,alt:"avatar"},null,8,Pe)],8,Me)]),t.createElementVNode("a",{href:"#",class:"wl-login-nick","aria-label":"Profile",title:e.locale.profile,onClick:n[2]||(n[2]=(...t)=>e.onProfile&&e.onProfile(...t)),textContent:t.toDisplayString(e.userInfo.display_name)},null,8,Te)])):t.createCommentVNode("v-if",!0),t.createElementVNode("div",_e,["force"!==e.config.login&&e.config.meta.length&&!e.isLogin?(t.openBlock(),t.createElementBlock("div",{key:0,class:t.normalizeClass(["wl-header",`item${e.config.meta.length}`])},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(e.config.meta,(n=>(t.openBlock(),t.createElementBlock("div",{key:n,class:"wl-header-item"},[t.createElementVNode("label",{for:n,textContent:t.toDisplayString(e.locale[n]+(e.config.requiredMeta.includes(n)||!e.config.requiredMeta.length?"":`(${e.locale.optional})`))},null,8,Oe),t.withDirectives(t.createElementVNode("input",{id:`wl-${n}`,ref_for:!0,ref:t=>{t&&(e.inputRefs[n]=t)},"onUpdate:modelValue":t=>e.userMeta[n]=t,class:t.normalizeClass(["wl-input",`wl-${n}`]),name:n,type:"mail"===n?"email":"text"},null,10,He),[[t.vModelDynamic,e.userMeta[n]]])])))),128))],2)):t.createCommentVNode("v-if",!0),t.withDirectives(t.createElementVNode("textarea",{id:"wl-edit",ref:"editorRef","onUpdate:modelValue":n[3]||(n[3]=t=>e.editor=t),class:"wl-editor",placeholder:e.replyUser?`@${e.replyUser}`:e.locale.placeholder,onKeydown:n[4]||(n[4]=(...t)=>e.onKeyDown&&e.onKeyDown(...t)),onDrop:n[5]||(n[5]=(...t)=>e.onDrop&&e.onDrop(...t)),onPaste:n[6]||(n[6]=(...t)=>e.onPaste&&e.onPaste(...t))},null,40,Fe),[[t.vModelText,e.editor]]),t.withDirectives(t.createElementVNode("div",We,[Ge,t.createElementVNode("h4",null,t.toDisplayString(e.locale.preview)+":",1),t.createCommentVNode(" eslint-disable-next-line vue/no-v-html "),t.createElementVNode("div",{class:"wl-content",innerHTML:e.previewText},null,8,qe)],512),[[t.vShow,e.showPreview]]),t.createElementVNode("div",Ke,[t.createElementVNode("div",Je,[t.createElementVNode("a",Ze,[t.createVNode(c)]),t.withDirectives(t.createElementVNode("button",{ref:"emojiButtonRef",class:t.normalizeClass(["wl-action",{actived:e.showEmoji}]),title:e.locale.emoji,onClick:n[7]||(n[7]=t=>e.showEmoji=!e.showEmoji)},[t.createVNode(s)],10,Ye),[[t.vShow,e.emoji.tabs.length]]),e.config.search?(t.openBlock(),t.createElementBlock("button",{key:0,ref:"gifButtonRef",class:t.normalizeClass(["wl-action",{actived:e.showGif}]),title:e.locale.gif,onClick:n[8]||(n[8]=t=>e.showGif=!e.showGif)},[t.createVNode(m)],10,Qe)):t.createCommentVNode("v-if",!0),t.createElementVNode("input",{id:"wl-image-upload",ref:"imageUploadRef",class:"upload",type:"file",accept:".png,.jpg,.jpeg,.webp,.bmp,.gif",onChange:n[9]||(n[9]=(...t)=>e.onChange&&e.onChange(...t))},null,544),e.canUploadImage?(t.openBlock(),t.createElementBlock("label",{key:1,for:"wl-image-upload",class:"wl-action",title:e.locale.uploadImage},[t.createVNode(d)],8,Xe)):t.createCommentVNode("v-if",!0),t.createElementVNode("button",{class:t.normalizeClass(["wl-action",{actived:e.showPreview}]),title:e.locale.preview,onClick:n[10]||(n[10]=t=>e.showPreview=!e.showPreview)},[t.createVNode(u)],10,et)]),t.createElementVNode("div",tt,[t.createElementVNode("div",nt,[t.createTextVNode(t.toDisplayString(e.wordNumber)+" ",1),e.config.wordLimit?(t.openBlock(),t.createElementBlock("span",ot,[at,t.createElementVNode("span",{class:t.normalizeClass({illegal:!e.isWordNumberLegal}),textContent:t.toDisplayString(e.wordLimit)},null,10,lt)])):t.createCommentVNode("v-if",!0),t.createTextVNode("  "+t.toDisplayString(e.locale.word),1)]),"disable"===e.config.login||e.isLogin?t.createCommentVNode("v-if",!0):(t.openBlock(),t.createElementBlock("button",{key:0,class:"wl-btn",onClick:n[11]||(n[11]=(...t)=>e.onLogin&&e.onLogin(...t)),textContent:t.toDisplayString(e.locale.login)},null,8,rt)),"force"!==e.config.login||e.isLogin?(t.openBlock(),t.createElementBlock("button",{key:1,class:"wl-btn primary",title:"Cmd|Ctrl + Enter",disabled:e.isSubmitting,onClick:n[12]||(n[12]=(...t)=>e.submitComment&&e.submitComment(...t))},[e.isSubmitting?(t.openBlock(),t.createBlock(p,{key:0,size:16})):(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[t.createTextVNode(t.toDisplayString(e.locale.submit),1)],64))],8,it)):t.createCommentVNode("v-if",!0)]),t.createElementVNode("div",{ref:"gifPopupRef",class:t.normalizeClass(["wl-gif-popup",{display:e.showGif}])},[t.createElementVNode("input",{ref:"gifSearchInputRef",type:"text",placeholder:e.locale.gifSearchPlaceholder,onInput:n[13]||(n[13]=(...t)=>e.onGifSearch&&e.onGifSearch(...t))},null,40,ct),t.createVNode(g,{items:e.gifData.list,"column-width":200,gap:6,onInsert:n[14]||(n[14]=t=>e.insert(t)),onScroll:e.onImageWallScroll},null,8,["items","onScroll"]),e.gifData.loading?(t.openBlock(),t.createElementBlock("div",st,[t.createVNode(p,{size:30})])):t.createCommentVNode("v-if",!0)],2),t.createElementVNode("div",{ref:"emojiPopupRef",class:t.normalizeClass(["wl-emoji-popup",{display:e.showEmoji}])},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(e.emoji.tabs,((n,o)=>(t.openBlock(),t.createElementBlock(t.Fragment,{key:n.name},[o===e.emojiTabIndex?(t.openBlock(),t.createElementBlock("div",mt,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(n.items,(n=>(t.openBlock(),t.createElementBlock("button",{key:n,title:n,onClick:t=>e.insert(`:${n}:`)},[e.showEmoji?(t.openBlock(),t.createElementBlock("img",{key:0,class:"wl-emoji",src:e.emoji.map[n],alt:n,loading:"lazy",referrerPolicy:"no-referrer"},null,8,ut)):t.createCommentVNode("v-if",!0)],8,dt)))),128))])):t.createCommentVNode("v-if",!0)],64)))),128)),e.emoji.tabs.length>1?(t.openBlock(),t.createElementBlock("div",pt,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(e.emoji.tabs,((n,o)=>(t.openBlock(),t.createElementBlock("button",{key:n.name,class:t.normalizeClass(["wl-tab",{active:e.emojiTabIndex===o}]),onClick:t=>e.emojiTabIndex=o},[t.createElementVNode("img",{class:"wl-emoji",src:n.icon,alt:n.name,title:n.name,loading:"lazy",referrerPolicy:"no-referrer"},null,8,ht)],10,gt)))),128))])):t.createCommentVNode("v-if",!0)],2)])]),e.replyId||e.edit?.objectId?(t.openBlock(),t.createElementBlock("button",{key:1,class:"wl-close",title:e.locale.cancelReply,onClick:n[15]||(n[15]=t=>e.$emit(e.replyId?"cancel-reply":"cancel-edit"))},[t.createVNode(i,{size:24})],8,vt)):t.createCommentVNode("v-if",!0)])}],["__file","CommentBox.vue"]]);const yt=["approved","waiting","spam"];var kt=t.defineComponent({components:{CommentBox:ft,DeleteIcon:()=>t.h("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},t.h("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"})),LikeIcon:({active:e=!1})=>t.h("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},[t.h("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"})]),ReplyIcon:()=>t.h("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},t.h("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"})),EditIcon:()=>t.h("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24"},t.h("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"})),VerifiedIcon:()=>t.h("svg",{class:"verified-icon",viewBox:"0 0 1024 1024",width:"14",height:"14"},t.h("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"}))},props:{comment:{type:Object,required:!0},rootId:{type:String,required:!0},reply:{type:Object,default:null},edit:{type:Object,default:null}},emits:["submit","reply","like","delete","status","sticky","edit"],setup(n){const o=t.inject("config"),a=ee(),l=Q(),r=t.computed((()=>o.value.locale)),i=t.computed((()=>{const{link:e}=n.comment;return e?N(e)?e:`https://${e}`:""})),c=t.computed((()=>a.value.includes(n.comment.objectId))),s=((n,o)=>{const a=e.useNow();return t.computed((()=>j(n,a.value,o)))})(n.comment.insertedAt,r.value),m=t.computed((()=>"administrator"===l.value.type)),d=t.computed((()=>n.comment.user_id&&l.value.objectId===n.comment.user_id)),u=t.computed((()=>n.comment.objectId===n.reply?.objectId)),p=t.computed((()=>n.comment.objectId===n.edit?.objectId));return{config:o,locale:r,isReplyingCurrent:u,isEditingCurrent:p,link:i,like:c,time:s,isAdmin:m,isOwner:d,commentStatus:yt}}});const wt=["id"],Ct={class:"wl-user","aria-hidden":"true"},bt=["src"],Et={class:"wl-card"},Bt={class:"wl-head"},Lt=["href"],Vt={key:1,class:"wl-nick"},Nt=["textContent"],St=["textContent"],$t=["textContent"],It=["textContent"],Rt=["textContent"],xt={class:"wl-comment-actions"},jt=["title"],At=["textContent"],zt=["title"],Dt={class:"wl-meta","aria-hidden":"true"},Ut=["data-value","textContent"],Mt=["data-value","textContent"],Pt=["data-value","textContent"],Tt=["innerHTML"],_t={key:1,class:"wl-admin-actions"},Ot={class:"wl-comment-status"},Ht=["disabled","onClick","textContent"],Ft={key:3,class:"wl-quote"};var Wt=we(kt,[["render",function(e,n,o,a,l,r){const i=t.resolveComponent("VerifiedIcon"),c=t.resolveComponent("EditIcon"),s=t.resolveComponent("DeleteIcon"),m=t.resolveComponent("LikeIcon"),d=t.resolveComponent("ReplyIcon"),u=t.resolveComponent("CommentBox"),p=t.resolveComponent("CommentCard",!0);return t.openBlock(),t.createElementBlock("div",{id:e.comment.objectId,class:"wl-item"},[t.createElementVNode("div",Ct,[e.comment.avatar?(t.openBlock(),t.createElementBlock("img",{key:0,src:e.comment.avatar},null,8,bt)):t.createCommentVNode("v-if",!0),e.comment.type?(t.openBlock(),t.createBlock(i,{key:1})):t.createCommentVNode("v-if",!0)]),t.createElementVNode("div",Et,[t.createElementVNode("div",Bt,[e.link?(t.openBlock(),t.createElementBlock("a",{key:0,class:"wl-nick",href:e.link,target:"_blank",rel:"nofollow noreferrer"},t.toDisplayString(e.comment.nick),9,Lt)):(t.openBlock(),t.createElementBlock("span",Vt,t.toDisplayString(e.comment.nick),1)),"administrator"===e.comment.type?(t.openBlock(),t.createElementBlock("span",{key:2,class:"wl-badge",textContent:t.toDisplayString(e.locale.admin)},null,8,Nt)):t.createCommentVNode("v-if",!0),e.comment.label?(t.openBlock(),t.createElementBlock("span",{key:3,class:"wl-badge",textContent:t.toDisplayString(e.comment.label)},null,8,St)):t.createCommentVNode("v-if",!0),e.comment.sticky?(t.openBlock(),t.createElementBlock("span",{key:4,class:"wl-badge",textContent:t.toDisplayString(e.locale.sticky)},null,8,$t)):t.createCommentVNode("v-if",!0),void 0!==e.comment.level&&e.comment.level>=0?(t.openBlock(),t.createElementBlock("span",{key:5,class:t.normalizeClass(`wl-badge level${e.comment.level}`),textContent:t.toDisplayString(e.locale[`level${e.comment.level}`]||`Level ${e.comment.level}`)},null,10,It)):t.createCommentVNode("v-if",!0),t.createElementVNode("span",{class:"wl-time",textContent:t.toDisplayString(e.time)},null,8,Rt),t.createElementVNode("div",xt,[e.isAdmin||e.isOwner?(t.openBlock(),t.createElementBlock("button",{key:0,class:"wl-edit",onClick:n[0]||(n[0]=t=>e.$emit("edit",e.comment))},[t.createVNode(c)])):t.createCommentVNode("v-if",!0),e.isAdmin||e.isOwner?(t.openBlock(),t.createElementBlock("button",{key:1,class:"wl-delete",onClick:n[1]||(n[1]=t=>e.$emit("delete",e.comment))},[t.createVNode(s)])):t.createCommentVNode("v-if",!0),t.createElementVNode("button",{class:"wl-like",title:e.like?e.locale.cancelLike:e.locale.like,onClick:n[2]||(n[2]=t=>e.$emit("like",e.comment))},[t.createVNode(m,{active:e.like},null,8,["active"]),"like"in e.comment?(t.openBlock(),t.createElementBlock("span",{key:0,textContent:t.toDisplayString(e.comment.like)},null,8,At)):t.createCommentVNode("v-if",!0)],8,jt),t.createElementVNode("button",{class:t.normalizeClass(["wl-reply",{active:e.isReplyingCurrent}]),title:e.isReplyingCurrent?e.locale.cancelReply:e.locale.reply,onClick:n[3]||(n[3]=t=>e.$emit("reply",e.isReplyingCurrent?null:e.comment))},[t.createVNode(d)],10,zt)])]),t.createElementVNode("div",Dt,[e.comment.addr?(t.openBlock(),t.createElementBlock("span",{key:0,class:"wl-addr","data-value":e.comment.addr,textContent:t.toDisplayString(e.comment.addr)},null,8,Ut)):t.createCommentVNode("v-if",!0),e.comment.browser?(t.openBlock(),t.createElementBlock("span",{key:1,class:"wl-browser","data-value":e.comment.browser,textContent:t.toDisplayString(e.comment.browser)},null,8,Mt)):t.createCommentVNode("v-if",!0),e.comment.os?(t.openBlock(),t.createElementBlock("span",{key:2,class:"wl-os","data-value":e.comment.os,textContent:t.toDisplayString(e.comment.os)},null,8,Pt)):t.createCommentVNode("v-if",!0)]),t.createCommentVNode(" eslint-disable vue/no-v-html "),e.isEditingCurrent?t.createCommentVNode("v-if",!0):(t.openBlock(),t.createElementBlock("div",{key:0,class:"wl-content",innerHTML:e.comment.comment},null,8,Tt)),t.createCommentVNode(" eslint-enable vue/no-v-html "),e.isAdmin&&!e.isEditingCurrent?(t.openBlock(),t.createElementBlock("div",_t,[t.createElementVNode("span",Ot,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(e.commentStatus,(n=>(t.openBlock(),t.createElementBlock("button",{key:n,class:t.normalizeClass(`wl-btn wl-${n}`),disabled:e.comment.status===n,onClick:t=>e.$emit("status",{status:n,comment:e.comment}),textContent:t.toDisplayString(e.locale[n])},null,10,Ht)))),128))]),e.isAdmin&&!e.comment.rid?(t.openBlock(),t.createElementBlock("button",{key:0,class:"wl-btn wl-sticky",onClick:n[4]||(n[4]=t=>e.$emit("sticky",e.comment))},t.toDisplayString(e.comment.sticky?e.locale.unsticky:e.locale.sticky),1)):t.createCommentVNode("v-if",!0)])):t.createCommentVNode("v-if",!0),e.isReplyingCurrent||e.isEditingCurrent?(t.openBlock(),t.createElementBlock("div",{key:2,class:t.normalizeClass({"wl-reply-wrapper":e.isReplyingCurrent,"wl-edit-wrapper":e.isEditingCurrent})},[t.createVNode(u,{edit:e.edit,"reply-id":e.reply?.objectId,"reply-user":e.comment.nick,"root-id":e.rootId,onSubmit:n[5]||(n[5]=t=>e.$emit("submit",t)),onCancelReply:n[6]||(n[6]=t=>e.$emit("reply",null)),onCancelEdit:n[7]||(n[7]=t=>e.$emit("edit",null))},null,8,["edit","reply-id","reply-user","root-id"])],2)):t.createCommentVNode("v-if",!0),e.comment.children?(t.openBlock(),t.createElementBlock("div",Ft,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(e.comment.children,(o=>(t.openBlock(),t.createBlock(p,{key:o.objectId,comment:o,reply:e.reply,edit:e.edit,"root-id":e.rootId,onReply:n[8]||(n[8]=t=>e.$emit("reply",t)),onSubmit:n[9]||(n[9]=t=>e.$emit("submit",t)),onLike:n[10]||(n[10]=t=>e.$emit("like",t)),onEdit:n[11]||(n[11]=t=>e.$emit("edit",t)),onDelete:n[12]||(n[12]=t=>e.$emit("delete",t)),onStatus:n[13]||(n[13]=t=>e.$emit("status",t)),onSticky:n[14]||(n[14]=t=>e.$emit("sticky",t))},null,8,["comment","reply","edit","root-id"])))),128))])):t.createCommentVNode("v-if",!0)])],8,wt)}],["__file","CommentCard.vue"]]);const Gt=[{key:"insertedAt_desc",name:"latest"},{key:"insertedAt_asc",name:"oldest"},{key:"like_desc",name:"hottest"}];var qt=t.defineComponent({name:"WalineRoot",components:{Reaction:Ne,CommentBox:ft,CommentCard:Wt,LoadingIcon:Se},props:["serverURL","path","meta","requiredMeta","dark","lang","locale","pageSize","wordLimit","emoji","login","highlighter","texRenderer","imageUploader","search","copyright","recaptchaV3Key","reaction"],setup(n){const o=t.computed((()=>(({serverURL:e,path:t=location.pathname,lang:n="zh-CN",locale:o,emoji:a=["//unpkg.com/@waline/emojis@1.1.0/weibo"],meta:l=["nick","mail","link"],requiredMeta:r=[],dark:u=!1,pageSize:p=10,wordLimit:g,imageUploader:v,highlighter:f,texRenderer:y,copyright:k=!0,login:w="enable",search:C=m(),reaction:b,...E})=>({serverURL:S(e),path:L(t),locale:{...B[n]||B["zh-CN"],..."object"==typeof o?o:{}},wordLimit:$(g),meta:i(l),requiredMeta:i(r),imageUploader:I(v,c),highlighter:I(f,h),texRenderer:I(y,s),lang:n,dark:u,emoji:a,pageSize:p,login:w,copyright:k,search:C,reaction:!0===b?d:b||!1,...E}))(n))),a=Q(),l=ee(),r=t.ref("loading"),u=t.ref(0),p=t.ref(1),g=t.ref(0),v=t.ref(Gt[0].key),f=t.ref([]),y=t.ref(null),k=t.ref(null),w=t.computed((()=>{return"string"==typeof(e=o.value.dark)?"auto"===e?`@media(prefers-color-scheme:dark){body${R}}`:`${e}${R}`:!0===e?`:root${R}`:"";var e}));let C;e.useStyleTag(w);const b=e=>{const{serverURL:t,path:n,pageSize:l}=o.value,i=new AbortController;r.value="loading",C?.(),(({serverURL:e,lang:t,path:n,page:o,pageSize:a,sortBy:l,signal:r,token:i})=>{const c={};return i&&(c.Authorization=`Bearer ${i}`),fetch(`${e}/comment?path=${encodeURIComponent(n)}&pageSize=${a}&page=${o}&lang=${t}&sortBy=${l}`,{signal:r,headers:c}).then((e=>e.json())).then((e=>M(e,"comment list")))})({serverURL:t,lang:o.value.lang,path:n,pageSize:l,sortBy:v.value,page:e,signal:i.signal,token:a.value?.token}).then((t=>{r.value="success",u.value=t.count,f.value.push(...t.data),p.value=e,g.value=t.totalPages})).catch((e=>{"AbortError"!==e.name&&(console.error(e.message),r.value="error")})),C=i.abort.bind(i)},E=()=>{u.value=0,f.value=[],b(1)};return t.provide("config",o),t.watch((()=>n.path),E),t.onMounted((()=>E())),{config:o,darkmodeStyle:w,i18n:t.computed((()=>o.value.locale)),status:r,count:u,page:p,totalPages:g,sortBy:v,sortByItems:Gt,data:f,reply:y,edit:k,loadMore:()=>b(p.value+1),refresh:E,onSortByChange:e=>{v.value!==e&&(v.value=e,E())},onReply:e=>{y.value=e},onSubmit:e=>{if(k.value)k.value.comment=e.comment,k.value.orig=e.orig;else if(e.rid){const t=f.value.find((({objectId:t})=>t===e.rid));if(!t)return;Array.isArray(t.children)||(t.children=[]),t.children.push(e)}else f.value.unshift(e)},onStatusChange:async({comment:e,status:t})=>{if(e.status===t)return;const{serverURL:n,lang:l}=o.value;await P({serverURL:n,lang:l,token:a.value?.token,objectId:e.objectId,status:t}),e.status=t},onDelete:async({objectId:e})=>{if(!confirm("Are you sure you want to delete this comment?"))return;const{serverURL:t,lang:n}=o.value;await(({serverURL:e,lang:t,token:n,objectId:o})=>fetch(`${e}/comment/${o}?lang=${t}`,{method:"DELETE",headers:{Authorization:`Bearer ${n}`}}).then((e=>e.json())))({serverURL:t,lang:n,token:a.value?.token,objectId:e}),f.value.some(((t,n)=>t.objectId===e?(f.value=f.value.filter(((e,t)=>t!==n)),!0):t.children.some(((o,a)=>o.objectId===e&&(f.value[n].children=t.children.filter(((e,t)=>t!==a)),!0)))))},onSticky:async e=>{if(e.rid)return;const{serverURL:t,lang:n}=o.value;await P({serverURL:t,lang:n,token:a.value?.token,objectId:e.objectId,sticky:e.sticky?0:1}),e.sticky=!e.sticky},onLike:async e=>{const{serverURL:t,lang:n}=o.value,{objectId:a}=e,r=l.value.includes(a);await(({serverURL:e,lang:t,objectId:n,like:o})=>fetch(`${e}/comment/${n}?lang=${t}`,{method:"PUT",headers:U,body:JSON.stringify({like:o})}).then((e=>e.json())))({serverURL:t,lang:n,objectId:a,like:!r}),r?l.value=l.value.filter((e=>e!==a)):(l.value=[...l.value,a],l.value.length>50&&(l.value=l.value.slice(-50))),e.like=(e.like||0)+(r?-1:1)},onEdit:e=>{k.value=e},version:"2.11.1"}}});const Kt={"data-waline":""},Jt={class:"wl-meta-head"},Zt={class:"wl-count"},Yt=["textContent"],Qt={class:"wl-sort"},Xt=["onClick"],en={class:"wl-cards"},tn={key:1,class:"wl-operation"},nn=["textContent"],on={key:0,class:"wl-loading"},an=["textContent"],ln={class:"wl-operation"},rn=["textContent"],cn={key:3,class:"wl-power"},sn=t.createTextVNode(" Powered by "),mn=t.createElementVNode("a",{href:"https://github.com/walinejs/waline",target:"_blank",rel:"noreferrer"}," Waline ",-1);var dn=we(qt,[["render",function(e,n,o,a,l,r){const i=t.resolveComponent("Reaction"),c=t.resolveComponent("CommentBox"),s=t.resolveComponent("CommentCard"),m=t.resolveComponent("LoadingIcon");return t.openBlock(),t.createElementBlock("div",Kt,[t.createVNode(i),e.reply?t.createCommentVNode("v-if",!0):(t.openBlock(),t.createBlock(c,{key:0,onSubmit:e.onSubmit},null,8,["onSubmit"])),t.createElementVNode("div",Jt,[t.createElementVNode("div",Zt,[e.count?(t.openBlock(),t.createElementBlock("span",{key:0,class:"wl-num",textContent:t.toDisplayString(e.count)},null,8,Yt)):t.createCommentVNode("v-if",!0),t.createTextVNode(" "+t.toDisplayString(e.i18n.comment),1)]),t.createElementVNode("ul",Qt,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(e.sortByItems,(n=>(t.openBlock(),t.createElementBlock("li",{key:n.key,class:t.normalizeClass([n.key===e.sortBy?"active":""]),onClick:t=>e.onSortByChange(n.key)},t.toDisplayString(e.i18n[n.name]),11,Xt)))),128))])]),t.createElementVNode("div",en,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(e.data,(n=>(t.openBlock(),t.createBlock(s,{key:n.objectId,"root-id":n.objectId,comment:n,reply:e.reply,edit:e.edit,onReply:e.onReply,onEdit:e.onEdit,onSubmit:e.onSubmit,onStatus:e.onStatusChange,onDelete:e.onDelete,onSticky:e.onSticky,onLike:e.onLike},null,8,["root-id","comment","reply","edit","onReply","onEdit","onSubmit","onStatus","onDelete","onSticky","onLike"])))),128))]),"error"===e.status?(t.openBlock(),t.createElementBlock("div",tn,[t.createElementVNode("button",{type:"button",class:"wl-btn",onClick:n[0]||(n[0]=(...t)=>e.refresh&&e.refresh(...t)),textContent:t.toDisplayString(e.i18n.refresh)},null,8,nn)])):(t.openBlock(),t.createElementBlock(t.Fragment,{key:2},["loading"===e.status?(t.openBlock(),t.createElementBlock("div",on,[t.createVNode(m,{size:30})])):e.data.length?e.page<e.totalPages?(t.openBlock(),t.createElementBlock(t.Fragment,{key:2},[t.createCommentVNode(" Load more button "),t.createElementVNode("div",ln,[t.createElementVNode("button",{type:"button",class:"wl-btn",onClick:n[1]||(n[1]=(...t)=>e.loadMore&&e.loadMore(...t)),textContent:t.toDisplayString(e.i18n.more)},null,8,rn)])],2112)):t.createCommentVNode("v-if",!0):(t.openBlock(),t.createElementBlock("div",{key:1,class:"wl-empty",textContent:t.toDisplayString(e.i18n.sofa)},null,8,an))],64)),t.createCommentVNode(" Copyright Information "),e.config.copyright?(t.openBlock(),t.createElementBlock("div",cn,[sn,mn,t.createTextVNode(" v"+t.toDisplayString(e.version),1)])):t.createCommentVNode("v-if",!0)])}],["__file","Waline.vue"]]);const un=(e,t)=>{t.forEach(((t,n)=>{t.innerText=e[n].toString()}))},pn=({serverURL:e,path:t=window.location.pathname,selector:n=".waline-pageview-count",update:o=!0,lang:a="zh-CN"})=>{const l=new AbortController,r=Array.from(document.querySelectorAll(n)),i=e=>{const n=Z(e);return null!==n&&t!==n},c=n=>(({serverURL:e,lang:t,paths:n,signal:o})=>T({serverURL:e,lang:t,paths:n,type:["time"],signal:o}).then((e=>Array.isArray(e)?e:[e])))({serverURL:S(e),paths:n.map((e=>Z(e)||t)),lang:a,signal:l.signal}).then((e=>un(e,n))).catch(D);if(o){const n=r.filter((e=>!i(e))),o=r.filter(i);(s={serverURL:S(e),path:t,lang:a},_({...s,type:"time"})).then((e=>un(new Array(n.length).fill(e),n))),o.length&&c(o)}else c(r);var s;return l.abort.bind(l)};exports.RecentComments=({el:e,serverURL:t,count:n,lang:o="zh-CN"})=>{const a=Q(),l=O(e),r=new AbortController;return(({serverURL:e,lang:t,count:n,signal:o,token:a})=>{const l={};return a&&(l.Authorization=`Bearer ${a}`),fetch(`${e}/comment?type=recent&count=${n}&lang=${t}`,{signal:o,headers:l}).then((e=>e.json())).then((e=>M(e,"recent comment")))})({serverURL:t,count:n,lang:o,signal:r.signal,token:a.value?.token}).then((e=>l&&e.length?(l.innerHTML=`<ul class="wl-recent-list">${e.map((e=>`<li class="wl-recent-item"><a href="${e.url}">${e.nick}</a>:${e.comment}</li>`)).join("")}</ul>`,{comments:e,destroy:()=>{r.abort(),l.innerHTML=""}}):{comments:e,destroy:()=>r.abort()}))},exports.commentCount=te,exports.defaultLocales=B,exports.init=({el:e="#waline",path:n=window.location.pathname,comment:o=!1,pageview:a=!1,...l})=>{const r=e?O(e):null;if(e&&!r)throw new Error("Option 'el' do not match any domElement!");if(!l.serverURL)throw new Error("Option 'serverURL' is missing!");const i=t.reactive({...l}),c=t.reactive({comment:o,pageview:a,path:n}),s=r?t.createApp((()=>t.h(dn,{path:c.path,...i}))):null;s&&l.recaptchaV3Key&&s.use(ge,{siteKey:l.recaptchaV3Key,loaderOptions:{useRecaptchaNet:!0,autoHideBadge:!0}}),s&&s.mount(r);const m=t.watchEffect((()=>{c.comment&&te({serverURL:i.serverURL,path:c.path,selector:"string"==typeof c.comment?c.comment:void 0})})),d=t.watchEffect((()=>{c.pageview&&pn({serverURL:i.serverURL,path:c.path,selector:"string"==typeof c.pageview?c.pageview:void 0})}));return{el:r,update:({comment:e,pageview:t,path:n=window.location.pathname,...o}={})=>{Object.entries(o).forEach((([e,t])=>{i[e]=t})),c.path=n,void 0!==e&&(c.comment=e),void 0!==t&&(c.pageview=t)},destroy:()=>{s?.unmount(),m(),d()}}},exports.pageviewCount=pn,exports.version="2.11.1";
2
2
  //# sourceMappingURL=shim.cjs.map